Skip to content

feat: reject positional args for clets that don't accept them#55

Merged
tig merged 5 commits into
mainfrom
copilot/fix-clet-argument-handling
May 6, 2026
Merged

feat: reject positional args for clets that don't accept them#55
tig merged 5 commits into
mainfrom
copilot/fix-clet-argument-handling

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

Clets that don't consume positional args (e.g. color, int, decimal) were silently ignoring them — clet color - blue would open the color picker as if the args weren't there. A bare - also fell through as a positional arg with no feedback.

Changes

  • IClet interface — new bool AcceptsPositionalArgs { get; } default-false property; new clets are safe by default
  • SelectClet, MultiSelectClet, MarkdownClet — override to true (these three are the only clets that consume positional args)
  • CommandLineRoot.DispatchAlias — early-exit validation before TUI init: resolves the clet, checks AcceptsPositionalArgs, and emits a usage error (exit 2) if positional args were supplied to a non-consuming clet; a hint: line is shown for the single-arg case:
error: 'int' does not accept positional arguments: 42
hint: did you mean 'clet int --initial 42'?
  • TestsAcceptsPositionalArgs property assertions on representative clets; four CommandLineRoot tests covering error message content, single-arg hint, multi-arg no-hint, and bare - rejection
  • Docs — spec §4.7 updated; decisions log entry D-022 added

Copilot AI assigned Copilot and tig May 6, 2026
Copilot AI linked an issue May 6, 2026 that may be closed by this pull request
- Add `AcceptsPositionalArgs` default-false property to `IClet` interface
- Override to `true` in SelectClet, MultiSelectClet, and MarkdownClet
- Add early validation in CommandLineRoot.DispatchAlias: if positional
  args are supplied to a clet that doesn't accept them, emit a usage
  error (exit 2) with a hint when a single arg was given
- Add unit tests for the new validation behavior
- Update specs/clet-spec.md §4.7 and add decisions log entry D-022

Agent-Logs-Url: https://github.com/gui-cs/clet/sessions/e7f45719-5f0c-4aa4-84c4-9c7436e10273

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix clets to reject unused positional arguments feat: reject positional args for clets that don't accept them May 6, 2026
Copilot finished work on behalf of tig May 6, 2026 12:01
Copilot AI requested a review from tig May 6, 2026 12:01
@tig tig marked this pull request as ready for review May 6, 2026 12:06
@tig
Copy link
Copy Markdown
Member

tig commented May 6, 2026

@copilot resolve the merge conflicts in this pull request

…ositionalArgs entry to D-023

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in commit 0be59ab. Both sides had added a D-022 entry — main's "clet versions independently of TG" and this PR's "AcceptsPositionalArgs". I renumbered this PR's entry to D-023 and updated the spec's cross-reference accordingly.

D-024 (package id) and D-023 (two-branch versioning) came from develop.
This PR's AcceptsPositionalArgs decision renumbered from D-023 to D-025
to avoid collision.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
tig added a commit that referenced this pull request May 6, 2026
D-024 (package id) and D-023 (two-branch versioning) came from develop.
This PR's --rows decision renumbered from D-023 to D-026 to avoid
collision (D-025 is taken by PR #55's AcceptsPositionalArgs).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tig
Copy link
Copy Markdown
Member

tig commented May 6, 2026

@copilot resolve the merge conflicts in this pull request

… integrate --rows/size-cap tests

Co-authored-by: tig <585482+tig@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in commit 29d0f40. Two conflicts this time: specs/decisions.md (kept our D-025 entry, removed the empty incoming side) and tests/Clet.UnitTests/CommandLineRootTests.cs (kept both our positional-args tests and the new --rows/size-cap tests from main). All 216 unit tests pass.

Copilot finished work on behalf of tig May 6, 2026 13:31
@tig tig merged commit dfd6cf1 into main May 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clets that don't accept positional args should reject them

2 participants