Repository navigation
fix(cli): agent-facing CLI defects in meta, dotnet meta and metaobjects - #409
Merged
Merged
Conversation
Node `meta`: - --format json|toon puts exactly one document on stdout: gen's first-run pointer and migrate's status lines go to stderr, and a dry run carries its SQL in the document's `sql` field (offline, --from-db and d1 paths); baseline, rollback and eject --list emit documents too. - an unknown flag is refused by name with the command's valid flags, in one wording across every command (no more Node parseArgs text). - types --limit refuses non-numbers instead of reading them as unlimited. - init on an initialized project is a no-op (exit 0); --print-only forecasts the root CLAUDE.md/AGENTS.md wiring; the scaffolded meta.common.json is canonical, so a fresh project passes fmt --check. - metadata that does not load exits 1 in every command (gen, docs and migrate exited 2); verify --db reports an unreachable database as a gate that could not run, not as drift. - the offline migrate path infers the dialect from --db, as the help says. - -V prints the version, and a bare version flag is answered before the command graph loads. - the help footer points at metaobjects.dev. C# `dotnet meta`: gen and docs refuse unknown flags (they ran and exited 0), every command uses the same refusal listing valid flags, --version/-v/-V and --help/<command> --help work, the banner no longer shows --namespace as required, and verify --codegen exits 1 (not 2) on metadata that does not load. Python `metaobjects`: --version/-v/-V work, and an unknown flag is refused for the subcommand it was given to, with that subcommand's flags listed. Java and Kotlin ship no command-line tool (Maven goals only), so none of these defect classes apply there.
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.
Intent
"fix the CLI bugs", and "These CLI fixes need to be check across all languages too".
Context: a fit check of the MetaObjects
metaCLI (npm@metaobjectsdev/cli) against the ten AXI agent-ergonomic CLI principles, done before deciding whether to list it in the AXI community catalog, ran the published 1.0.13 against scratch projects and found plain defects. The catalog decision is separate and still open; these fixes are wanted either way.The defects found in the Node
metaCLI:meta gen --format json(and--format toon) is not a clean document on a fresh project: a prose pointer prints on stdout before the payload,migrateprints a trailing status line after its document, andmigrate --dry-runprints raw SQL ahead of the document.types --limit abcis silently treated as unlimited, and the same applies togen/verify --limit.meta initexits 1 when re-run on an initialized project instead of reporting a no-op;init --print-onlyleaves out the root CLAUDE.md/AGENTS.md wiring a realinitwrites; the scaffoldedmeta.common.jsonfailsmeta fmt --check.genand 1 inverify;verify --dbreports a database connection failure as schema drift.migrate --helpsays the dialect is auto-detected from the URL, but the offline path refuses without--dialect.--versionloads the whole command graph (about 0.1 s against a 0.01 s Node floor) and-Vis refused.Each other language port that ships a command-line tool gets the same defect classes checked and fixed where they apply, so the CLIs behave consistently.
What Changed
Structured document output:
--format json|toonnow emits exactly one document to stdout; diagnostic messages (status lines, pointers, SQL output) route to stderr. Offline migration paths now carry SQL in the document'ssqlfield rather than on stdout.Consistent flag refusal: All CLIs refuse unknown flags by command name with a single, unified wording across all ports and commands (e.g.
unknown flag --bogus for \meta gen`. Valid flags: …`). No more Node parseArgs leakage or three different spellings per codebase.Numeric flag validation: Non-numeric values passed to
--limit(and similar numeric flags) now error instead of silently treating them as unlimited.Init idempotency: Re-running
meta initon an initialized project exits 0 (no-op) rather than exiting 1. The--print-onlyflag now includes the rootCLAUDE.md/AGENTS.mdwiring forecast. Scaffolded metadata is canonical (passesfmt --check).Exit code consistency: Metadata load failures now exit 1 across all commands (
gen,docs,migrate,verify) — previously inconsistent (2 ingen/verify, different in others).verify --dbreports unreachable databases as a gate-unable-to-run error (exit 1) rather than schema drift.Dialect inference: The offline
migratepath now correctly infers dialect from--dbas documented, removing the requirement for explicit--dialect.Version flag support: All three version spellings (
--version,-v,-V) now work. Version flag is answered before loading the command graph (~10x faster probe).Help consistency: Help (
--help/-h) exits 0 and outputs to stdout (not an error). Help footer now points tometaobjects.dev.Changes applied across Node
meta, C#dotnet meta, and PythonmetaobjectsCLIs to align behavior on shared ergonomic principles.Risk Assessment
✅ Low: Change is a well-bounded set of mechanical CLI defect fixes applied consistently across TS, C#, and Python ports, with exit codes unified, structured-output contracts cleaned, and new behavioral tests (via main()/run() with captured stdout/stderr) covering each fix; no architectural risk or scope creep found.
Testing
Validated CLI fixes across Node, C#, and Python ports. Node TS CLI tested live via agent-output-contract test suite (43 pass, covering all 8 TS-specific defects). C# CLI tested live (192 tests pass, covering flag validation, exit codes, and help text). Python CLI fixes verified in code (version flags, unknown-flag refusal, exit codes); live test blocked by environment (Python 3.10 required, package requires >=3.11, not a product issue). Regression: baseline test suite too slow to complete in available time, but the three targeted test suites comprehensively cover the CLI defect classes in the user intent.metaobjects {command}. Valid flags: ...'.Evidence: Node CLI agent-output-contract test results
Evidence: C# CLI MetaObjects.Cli.Tests results
Evidence: Manual test evidence log
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
metaobjects {command}. Valid flags: ...'.scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainsbun test packages/cli/test/agent-output-contract.test.ts (Node TS CLI defects: 43 pass)dotnet test MetaObjects.Cli.Tests (C# CLI defects: 192 pass)Code review: server/python/src/metaobjects/cli.py (version flags, unknown-flag handling present)Code review: server/typescript/packages/cli/bin/meta.ts (-V and --version fast path)Code review: server/csharp/MetaObjects.Cli/Program.cs (unknown flag refusal, exit codes)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.