Skip to content

feat(cli): machine-readable output for editor and automation integrations - #499

Open
Caesarsage wants to merge 15 commits into
microcks:masterfrom
Caesarsage:feat/vscode-service-test-json-commands
Open

feat(cli): machine-readable output for editor and automation integrations#499
Caesarsage wants to merge 15 commits into
microcks:masterfrom
Caesarsage:feat/vscode-service-test-json-commands

Conversation

@Caesarsage

Copy link
Copy Markdown
Contributor

Give the human-facing commands a structured --output json mode so the Microcks
VS Code extension (and CI/automation) can drive the CLI without scraping text.
The rule throughout: stdout carries the structured result, stderr carries
progress and diagnostics
, so a consumer can parse stdout cleanly while a human
still sees what's happening.

This is the CLI half of the VS Code integration (LFX mentorship, D3). The
extension is using the CLI as communication interface than re-implementing Microcks
auth, context, and lifecycle logic API.

Depends on

Stacked on #488 (--output framework), which is itself stacked on #491
(→ #490, error-handling refactor). This branch imports pkg/output,
pkg/errors Kind classification, and connectors.GetFullTestResult — none of
which exist on master yet — so it will not compile standalone.

Do not merge until #491 and #488 have landed. Merge order:

  1. refactor(cli): migrate commands to RunE with a single exit funnel #490refactor(cli): remove the legacy exit shim and enforce it in CI #491 (error-handling refactor)
  2. Rebase/update feat(test): add --output (text/json/yaml/github-actions) for machine-readable results #488, then merge
  3. Rebase this branch onto updated master, then merge

What's in it

  • capabilities commandmicrocks capabilities [--output json] emits a
    versioned contract (schemaVersion, cliVersion, capabilities[]) so a
    consumer can feature-detect before depending on any JSON shape.
  • context --output json — list/use/delete now speak JSON; an empty config
    returns [] as a valid disconnected state.
  • start --output json — prints only the structured start result on stdout;
    image-pull and readiness progress move to stderr.
  • import --output json — emits an array of import results.
  • test --dry-run --watch --output json — a newline-delimited JSON event
    stream (ready → imported → test-result → waiting → … → stopped), since a
    long-running watch can't wait for one final document.
  • Service/test query JSON contracts (service list/get, test list/get) and
    their documentation.

Testing

  • go build ./..., go vet ./..., go test ./... all pass.
  • New tests cover context JSON output (list/use/empty-config) and the dry-run
    event writer (well-formed and malformed events).

Docs

documentation/cmd/{capabilities,context,import,start,test,service}.md and the
command table in README.md are updated for the new flags and JSON contracts.

Caesarsage added 15 commits July 9, 2026 14:58
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
…ctions)

Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
…paths

Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
…lize command client/JSON helpers

Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
Signed-off-by: caesarsage <destinyerhabor6@gmail.com>
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.

1 participant