[Bug] /copy code extra reports 'Unknown option "code"', and /help does not mention the code argument
Description
/copy accepts one optional argument, code. When there is an extra argument (/copy code extra), the error names args[0], which is the valid word code, instead of the extra word. The command description in /help also does not mention [code].
Environment
- OS: Windows 11 (10.0.26300)
- Node version: 22.22.3
- Nanocoder version: 1.31.0 (main at 9d88dda7)
- Provider / Model: not relevant
Steps to Reproduce
- Run
/copy code extra. - Run
/copy codfor comparison. - Run
/helpand read the/copyline.
Expected Behavior
Too many arguments. Usage: /copy [code], and the /help text mentions [code].
Actual Behavior
/copy code extra -> Unknown option "code". Usage: /copy [code]
/copy cod -> Unknown option "cod". Usage: /copy [code] (correct)
/help -> "Copy the last assistant response to the clipboard"
Suggested Fix
source/commands/copy.ts:62-66: handleargs.length > 1first with a "too many arguments" message, then the unknown-word case.- Change the description in
copy.tsand insource/commands/lazy-registry.ts(thecopyentry) to mention[code]. - Update the existing test
copyCommand warns when multiple arguments are providedinsource/commands/copy.spec.tsx(around line 196-208), which currently asserts the confusing textUnknown option "code".
Additional Context
/copyvalidation came from #1603.- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder
Claim — termux-monorepo help-wanted lane
Taking a look at this issue as part of our external evaluation + contribution lane.
- Lane: help-wanted / CPPH ranked
- Actor: timerloggedout-spec (agentic)
- Will open a focused PR if a clean fix is in scope
If someone is already actively working this, say so and we will yield.
Hi @addyCooks , I'd like to work on this issue.
I recently contributed the "/copy" argument validation fix in #1603, which has now been merged. Thanks for linking that PR here!
I'll investigate the remaining behavior and focus on:
- Reporting "Too many arguments. Usage: /copy [code]" when extra arguments are provided.
- Ensuring the error identifies the actual problem rather than the valid "code" argument.
- Updating the "/help" description to mention the optional "[code]" argument.
- Adding regression tests for both invalid and multiple arguments.
Before I start implementing, could you please confirm that I can take this issue?
Thanks everyone for picking this up. I'm assigning this issue to @yunuschoudhurywork-lang, whose PR I'll review first.
To the other contributors who opened PRs for it without being assigned (@timerloggedout-spec, @Vishesh-Verma-07): please ask for assignment first. Comment on the issue that you'd like to take it, and wait until a maintainer assigns it to you before opening a PR. Doing it in that order avoids duplicate work, and it lets us flag design concerns before you've written the code.
Since this one is now assigned, I'll soon close the unassigned PRs as duplicates. We'd love your help on other open issues, comment on the one you want, and those will be assigned to you. Thankyou : )
Hi @yunuschoudhurywork-lang, thanks for the reply, and for the #1603 fix. Yes, this is yours, and I've assigned it to you. Your plan covers the issue. Please make sure of three things:
- Change the
/helpdescription in bothsource/commands/copy.tsand thecopyentry insource/commands/lazy-registry.ts./helpreads from the registry, so updating only one leaves it stale. - Update the existing test
copyCommand warns when multiple arguments are providedinsource/commands/copy.spec.tsx(around L196-208). It currently asserts the confusingUnknown option "code"text, so it needs to expect the new message. Keep a separate test for a single unknown argument like/copy cod. - Add a patch changeset (
pnpm changeset), since CI checks for one.
Open the PR once you're ready. Thanks!
@addyCooks thanks for the assign, you proceed with review sir, also i see a blocking because PR #1761 targets the same issue.
@yunuschoudhurywork-lang, the duplicate flag on #1767 is from the review bot, and I've closed the other PRs for #1748. I'll re-run the review now. Thanks for the quick PR.