Fix parameter ordering issues in CLI#1669
Conversation
- Add validation to detect when option flags are consumed as values - Provide clear error messages with helpful hints and examples - Add 5 comprehensive tests to prevent regressions - Update CODEOWNERS to @mnriem - Bump version to 0.1.6 with changelog entry Fixes: github#1641
There was a problem hiding this comment.
Pull request overview
This PR fixes CLI argument parsing edge-cases where --ai / --ai-commands-dir can accidentally consume a following flag (e.g., --here), causing confusing validation errors and parameter-order dependency.
Changes:
- Add early validation in
initto detect when--ai/--ai-commands-dirvalues look like flags and emit actionable errors. - Add regression tests covering the broken parameter-ordering scenarios.
- Bump version and update release notes / ownership metadata.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/__init__.py |
Adds early “value looks like a flag” validation for --ai and --ai-commands-dir. |
tests/test_ai_skills.py |
Adds 5 CLI tests to prevent regressions for issue #1641 scenarios. |
pyproject.toml |
Bumps package version to 0.1.6. |
CHANGELOG.md |
Adds 0.1.6 notes and adjusts changelog structure/content. |
.github/CODEOWNERS |
Updates global code owner. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ## [0.1.6] - 2026-02-23 | ||
|
|
||
| ### Fixed | ||
|
|
||
| - **Parameter Ordering Issues (#1641)**: Fixed CLI parameter parsing issue where option flags were incorrectly consumed as values for preceding options | ||
| - Added validation to detect when `--ai` or `--ai-commands-dir` incorrectly consume following flags like `--here` or `--ai-skills` | ||
| - Now provides clear error messages: "Invalid value for --ai: '--here'" | ||
| - Includes helpful hints suggesting proper usage and listing available agents | ||
| - Commands like `specify init --ai-skills --ai --here` now fail with actionable feedback instead of confusing "Must specify project name" errors | ||
| - Added comprehensive test suite (5 new tests) to prevent regressions | ||
|
|
||
| ## [0.1.5] - 2026-02-21 |
There was a problem hiding this comment.
CHANGELOG no longer includes an "Unreleased" section (it now jumps straight into dated releases). If any tooling/docs expect Keep a Changelog structure, this makes it harder to stage changes before a release. Consider reintroducing an "Unreleased" section at the top and moving the 0.1.6 notes under a released heading only when cutting the release.
| @@ -69,7 +80,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
| ## [0.0.94] - 2026-02-11 | |||
|
|
|||
| - Add stale workflow for 180-day inactive issues and PRs (#1594) | |||
There was a problem hiding this comment.
This change removes older changelog history (e.g., the 0.0.93 entry and anything below it). Changelogs are typically append-only; please restore the removed sections so historical release notes remain available.
| - Add stale workflow for 180-day inactive issues and PRs (#1594) | |
| - Add stale workflow for 180-day inactive issues and PRs (#1594) | |
| ## [0.0.93] - 2026-02-10 | |
| - Historical changelog entry for version 0.0.93 was previously present and is preserved in the project’s git history (tag `v0.0.93`). | |
| - Refer to the `CHANGELOG.md` content from that tag or the corresponding GitHub release page for the full list of changes. | |
| ## Earlier releases (0.0.1–0.0.92) | |
| - Detailed release notes for versions 0.0.1 through 0.0.92 are also available in version control history. | |
| - To view them, check out an earlier revision of `CHANGELOG.md` (before this truncation) or consult the project’s tagged releases. |
| # Detect when option values are likely misinterpreted flags (parameter ordering issue) | ||
| if ai_assistant and ai_assistant.startswith("--"): | ||
| console.print(f"[red]Error:[/red] Invalid value for --ai: '{ai_assistant}'") | ||
| console.print("[yellow]Hint:[/yellow] Did you forget to provide a value for --ai?") | ||
| console.print("[yellow]Example:[/yellow] specify init --ai claude --here") | ||
| console.print(f"[yellow]Available agents:[/yellow] {', '.join(AGENT_CONFIG.keys())}") | ||
| raise typer.Exit(1) |
There was a problem hiding this comment.
The new validation block duplicates agent-list rendering and error formatting that already exists later in init() (e.g., the "Invalid AI assistant" path). To reduce drift and keep messaging consistent, consider factoring the shared "available agents" string / rendering into a small helper or constant and reusing it in both places.
* chore: bump version to v0.0.6 [skip ci] * Fix parameter ordering issues in CLI (github#1641) - Add validation to detect when option flags are consumed as values - Provide clear error messages with helpful hints and examples - Add 5 comprehensive tests to prevent regressions - Update CODEOWNERS to @mnriem - Bump version to 0.1.6 with changelog entry Fixes: github#1641 * Fix ruff linting errors: remove f-string prefix from strings without placeholders --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Problem
Fixes #1641
When users forgot to provide a value for the
--aiflag, CLI parameter parsing would consume the next token (often another flag like--here), leading to:Original Failing Command
specify init --ai-skills --ai --here # Error: Must specify either a project name, use '.' for current directory, or use --here flagSolution
Added early validation to detect when option values look like flags (start with
--):--aiand--ai-commands-dirvalues for flag patternsImproved Error Output
Before (confusing):
After (clear and actionable):
Testing
✅ All 56 tests pass (51 existing + 5 new)
Changes
src/specify_cli/__init__.py: Added validation logic (+14 lines)tests/test_ai_skills.py: Added comprehensive test suite (+62 lines)pyproject.toml: Version bump to 0.1.6CHANGELOG.md: Added release notes.github/CODEOWNERS: Updated to @mnriem