Skip to content

Commit d55f7a3

Browse files
committed
Replace mdsh with esh for template processing
- Vendor esh script (MIT licensed) into lib/esh/ - Remove mdsh dependency from Cargo.toml - Update prompts.rs to use esh instead of mdsh - Extract load_system_md helper for cleaner code - Simplify system prompt change logging - Update README with esh syntax examples Syntax: <%= $(command) %> for substitution, <% code -%> for control flow
1 parent c6ded5b commit d55f7a3

7 files changed

Lines changed: 402 additions & 58 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ clap = { version = "4", features = ["derive", "env"], optional = true }
5151
anyhow = "1"
5252
thiserror = "2"
5353

54-
# Markdown shell preprocessor (for dynamic system prompts)
55-
mdsh = { git = "https://github.com/zimbatm/mdsh" }
56-
5754
# Utilities
5855
fancy-regex = "0.14"
5956
unicode-width = "0.2"

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,21 @@ You can extend Codey's system prompt by creating `SYSTEM.md` files that are auto
9494
1. **User config**: `~/.config/codey/SYSTEM.md` - personal customizations
9595
2. **Project**: `.codey/SYSTEM.md` - project-specific instructions
9696

97-
### Dynamic Content with mdsh
97+
### Dynamic Content with esh
9898

99-
SYSTEM.md files support [mdsh](https://github.com/zimbatm/mdsh) syntax, allowing you to embed shell commands that are executed dynamically. This is useful for including context that changes over time.
99+
SYSTEM.md files support [esh](https://github.com/jirutka/esh) (Embedded SHell) syntax, allowing you to embed shell commands that are executed dynamically. This is useful for including context that changes over time.
100100

101101
### Example SYSTEM.md
102102

103103
```markdown
104-
Today is `$ date '+%d %B %Y'`.
104+
## Environment
105105

106-
```$
107-
if which linctl > /dev/null 2>&1; then
108-
echo "Use linctl to manage Linear tickets."
109-
fi
110-
```
106+
- Today's date: <%= $(date +"%m-%d-%Y") %>
107+
- Project root: <%= $(pwd) %>
108+
109+
<% if which linctl > /dev/null 2>&1; then -%>
110+
Use linctl to manage Linear tickets.
111+
<% fi -%>
111112

112113
## Guidelines
113114
- Follow the existing code style

lib/esh/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright 2017-present Jakub Jirutka <jakub@jirutka.cz>.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)