You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 15a54f5
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -200,6 +200,12 @@ Rules for TS code:
200
200
- Equal-rank rule overlaps throw `AmbiguousOverlapError` at resolve time; fix with an explicit `priority=` in KDL, not code.
201
201
- After editing rules: `bun run gen:compat` and commit `rules.json` alongside the `.kdl` change.
202
202
203
+
## Shell Command Behavior Lives in the Builtins
204
+
205
+
**NEVER pattern-match bash command text in TypeScript** to detect, rewrite, or annotate what a command does (flag misuse, argument quirks, output fixes). Regexes and tokenizers over the raw string miss quoting, expansion, variables, aliases, and wrappers (`xargs`, `timeout`), and drift from the utility's real argument model.
206
+
207
+
Fix the command in its Rust builtin, `crates/builtins/src/<cmd>.rs`: `rewrite_argv` sees the expanded argv before clap parses it and can refuse with a usage error; `run` owns output and diagnostics. Derive flag facts (which options take values, aliases) from the utility's clap `Command`, never a copied table. Example: `refuse_grep_recursion` in `crates/builtins/src/rg.rs` rejects grep-style `rg -rn`.
208
+
203
209
## Generated Files
204
210
205
211
**NEVER edit `packages/catalog/src/models.json` directly.** It is generated from upstream sources (stencil.so, provider catalog discovery, OpenCode docs) by `packages/catalog/scripts/generate-models.ts` and the descriptors/resolvers in `packages/catalog/src/provider-models/`. Hand-edits get overwritten on the next regen. The same applies to `packages/catalog/src/compat/rules.json`, compiled from the KDL tree by `bun run gen:compat`.
0 commit comments