feat(cli): migrate list command to adapter API (#264)#294
Merged
Conversation
Reference implementation for the CLI adapter migration. `leanspec list` now reads the project's configured adapter (markdown or GitHub), uses `SpecSchema` semantic hints to translate `--status`, `--priority`, `--tag`, and `--assignee` into a generic `ListFilter::fields` map, and renders rows from `SpecDoc.fields` using the schema's declared enum colors. The `--specs-dir` flag now errors cleanly when the project adapter is non-markdown rather than silently overriding it. Adds `AdapterRegistry::project_config` so callers can inspect the configured adapter name before instantiating it — important for adapters like GitHub that require auth at construction time. Other CLI commands that still reach into `SpecLoader`/`SpecInfo` are left as stubs returning a "not yet migrated" error. They cover the same set of broken commands flagged by ea92e01 as the migration map for downstream specs (390+). The TUI stays in this stubbed bucket. Test plan - New unit tests in `commands/list.rs` cover the semantic-hint translation, the silent-drop behaviour for missing fields, hex parsing, and parent-link extraction. - E2E tests in `tests/list.rs` create markdown specs directly on disk (because `create`/`update` are stubbed) and exercise the markdown filter, JSON output, the `--specs-dir`-on-GitHub error, and the `--priority`-on-empty-project no-op.
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #264
Summary
Reference implementation for the CLI adapter migration.
leanspec listis now the canonical template every subsequent command migration (specs 390–392) will follow.--status,--priority,--tag, and--assigneeare translated intoListFilter::fieldsviaSpecSchema::key_for_semantic. A flag with no matching semantic on the active adapter is silently dropped (e.g.--priority highagainst an adapter without a priority field).EnumOption::colorinstead of hard-codedSpecStatusmatches. Tags/assignee/priority read viafield_str/field_stringsagainst semantic keys.--specs-dironly applies to markdown. When passed against a non-markdown project, the command returns a clean--specs-dir is not applicable to the 'github' adaptererror before ever trying to authenticate. Powered by a newAdapterRegistry::project_configaccessor that loads adapter config without instantiating the adapter (important — GitHub-style adapters demand env vars at construction).doc.linksfiltered bylink_type == "parent", working for any adapter that populates links.SpecLoader/SpecInfo/SpecStatus/SpecPriority/SpecFilterOptionsimports remain inlist.rs.Stubs for the rest of the CLI
Commit ea92e01 (#285) intentionally left
leanspec-cliandleanspec-httpbroken as a "compiler-guided migration map." Because the issue's test plan needs a buildable binary, I've stubbed every still-broken command (analyze, archive, backfill, board, check, children, create, deps, files, gantt, open, rel, search, stats, timeline, tokens, update, validate, view, tui) with aErr("not yet migrated to the adapter API")body.CreateParamsandRelArgsare preserved becausemain.rsconstructs them. The TUI submodules are unwired fromtui/mod.rsbut left on disk so the downstream migration can crib from them.These stubs will be replaced one-for-one by specs 390–392 (and the TUI's own migration spec). E2E tests for those commands fail predictably with the stub message until then.
Test plan
cargo test -p leanspec-cli --test list— 11/11 pass (markdown filtering, JSON output,--specs-diron non-markdown errors cleanly,--priorityon adapter without the field is a no-op).cargo test -p leanspec-cli --bin leanspec— 13/13 pass (includes 6 new unit tests incommands/list.rscovering semantic-hint translation, silent-drop, hex parsing, andparent_idextraction).cargo test -p leanspec-core --lib— 219/219 pass (includes the newproject_configlookup inadapters::registry).cargo test -p leanspec-http --lib adapter_resolution— 4/4 pass.cargo build -p leanspec-cli— binary now builds.cargo clippy -p leanspec-cli --bin leanspec --tests -- -D warnings— clean.cargo fmt --check— clean.https://claude.ai/code/session_01P3WTP6T4Dtc8LYsVFfaHNx
Generated by Claude Code