delegates call `rtk rewrite <cmd>` without `--`, so a command of `--help` or `-h` comes back as rtk's help text with exit 0
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bash, python, shell, typescript
- Domain
- tooling
Research direction
Reproduce first: run rtk rewrite "--help" (usage text, exit 0) against rtk rewrite -- "--help" (exit 1, the expected refusal). Then fix all six call sites named in the issue so the command is passed after --: hooks/pi/rtk.ts:46, hooks/hermes/rtk-rewrite/__init__.py:63, openclaw/index.ts:85, and the rtk rewrite "$CMD" lines in hooks/claude/rtk-rewrite.sh, hooks/cursor/rtk-rewrite.sh and .claude/hooks/rtk-rewrite.sh. Done when --help and -h come back non-zero at every site while normal commands like git status still rewrite unchanged.
Written by the indexing model from the issue text.
Description
rtk rewrite takes the command as one positional argument. When that argument reads as an option of rtk rewrite itself, clap handles it as one (rtk 1.2.0 and develop):
$ rtk rewrite "--help"; echo " -> exit $?" # 1789 bytes of usage text on stdout
-> exit 0
$ rtk rewrite "-h"; echo " -> exit $?" # 453 bytes of usage text
-> exit 0
$ rtk rewrite -- "--help"; echo " -> exit $?"
-> exit 1
$ rtk rewrite -- "git status"; echo " -> exit $?"
rtk git status -> exit 3
Exit 0 with non-empty stdout is the "rewrite, allowed" answer, so a delegate hands the usage text to the shell as the command to run. The Claude Code and Cursor shell hooks also mark it auto-allowed, since exit 0 is their allow case. Six call sites pass the command without --:
hooks/pi/rtk.ts:46—pi.exec("rtk", ["rewrite", cmd], …)hooks/hermes/rtk-rewrite/__init__.py:63—["rtk", "rewrite", command]openclaw/index.ts:85—execFileSync("rtk", ["rewrite", command], …)hooks/claude/rtk-rewrite.sh:59,hooks/cursor/rtk-rewrite.sh:48,.claude/hooks/rtk-rewrite.sh:54—rtk rewrite "$CMD"
--help or -h is not a valid shell command on its own, so the practical harm is small: the agent gets "command not found" errors from usage lines instead of the same error for --help. The fix is to pass -- before the command at each site. rtk rewrite -- "<cmd>" works on 1.1.0, 1.2.0 and develop. The embedding guide (#3918) now documents the -- form.
- Dominant language
- Rust
- Stars
- 86.4k
- Forks
- 5.5k
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 51
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rtk-ai/rtk
-
area:docs bug good first issue priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
`rtk gain`: headline cap checks only `input_tokens`, so rows with huge `output_tokens` leak into "Output tokens"Possibly taken @Pybsama claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Proxy setup turns off Claude Code Remote ControlPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
rtk cargo build --message-format=short reports a clean build and drops the warningsPossibly taken @KuSh claimed this 2 days ago. Openarea:cli bug cargo priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Hook integrity messages: ~/.claude named under CLAUDE_CONFIG_DIR, no restore hint on a bad baseline, orphaned-baseline warning never printsPossibly taken @Lil-Clanky claimed this 6 days ago. Openarea:cli area:security bug good first issue priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
rtk-ai/rtk#5039 · 2 comments ·
Maintainers usually reply within 1 day
Similar issues
-
status: new topic: ga4gh-sdk type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
comp-rbac
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ClickHouse/ClickHouse#131875 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
googleworkspace/cli#984 ·
Maintainers usually reply within 1 day
-
bug(python): read_transaction raises TypeError on a Rewrite with rewritten indicesPossibly taken @Borg93 claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
lance-format/lance#11117 ·
Maintainers usually reply within 2 days