Skip to content

Commit 2ce043e

Browse files
committed
refactor: standardize system keys with underscore prefix
Breaking changes: - Rename `args:` frontmatter key to `_inputs:` - Rename `env:` (object form) to `_env:` for process.env - Template variables now require underscore prefix (e.g., {{ _name }}) to prevent namespace collision with CLI flags like --model New features: - Add shell_escape filter (also aliased as `q`) for safe shell quoting - All underscore-prefixed keys are now consistently treated as system keys Template collision prevention: - extractTemplateVars() now only returns underscore-prefixed variables - {{ model }} no longer consumes --model CLI flag - {{ _model }} is the new convention for template variables Updated: - schema.ts: _inputs and _env validation - command.ts: expanded SYSTEM_KEYS set - command-builder.ts: _env extraction, skip object values - template.ts: shell_escape filter, underscore-only extraction - All test files updated for new conventions - CLAUDE.md and README.md documentation updated
1 parent d6e5cbd commit 2ce043e

28 files changed

+10891
-618
lines changed

.beads/beads.db

36 KB
Binary file not shown.

.packx_cache/cache.json

Lines changed: 173 additions & 173 deletions
Large diffs are not rendered by default.

CLAUDE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ Commands are resolved in priority order:
9595
- `_stdin`: Auto-injected template variable containing piped input
9696
- `_1`, `_2`, etc.: Auto-injected positional CLI args (e.g., `md task.md "foo"``{{ _1 }}` = "foo")
9797
- `_args`: Auto-injected numbered list of all positional args
98-
- `env` (object form): Sets process.env before execution
98+
- `_inputs`: Named positional arguments to consume from CLI (e.g., `_inputs: [_message]`)
99+
- `_env`: Sets process.env before execution
99100
- `$1`, `$2`, etc.: Map positional args to flags
100101
- `_interactive`: Enable interactive mode (overrides print-mode defaults)
101102
- `_subcommand`: Prepend subcommand(s) to CLI args (e.g., `_subcommand: exec`)
@@ -112,7 +113,7 @@ dangerously-skip-permissions: true # → --dangerously-skip-permissions
112113
add-dir: # → --add-dir ./src --add-dir ./tests
113114
- ./src
114115
- ./tests
115-
env: # Object form: sets process.env
116+
_env: # Sets process.env (underscore prefix = system key)
116117
API_KEY: secret
117118
---
118119
```

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,12 @@ mdflow create-feature.claude.md --_feature_name "Auth"
401401

402402
### Environment Variables
403403

404+
Use `_env` (underscore prefix) to set environment variables for the command:
405+
404406
```markdown
405407
# api-test.claude.md
406408
---
407-
env:
409+
_env:
408410
API_URL: https://api.example.com
409411
DEBUG: "true"
410412
---

0 commit comments

Comments
 (0)