Skip to content
This repository was archived by the owner on Nov 3, 2026. It is now read-only.

feat(cli): report a missing config as JSON to --json callers - #46

Closed
gold-silver-copper wants to merge 6 commits into
mainfrom
refactor/drop-meta-worktree-identity
Closed

gold-silver-copper wants to merge 6 commits into
mainfrom
refactor/drop-meta-worktree-identity

Conversation

@gold-silver-copper

@gold-silver-copper gold-silver-copper commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What and why

atc's workspace provider must talk to meta only through meta … --json (no reading meta's files, env vars or layout). To decide whether a directory belongs to a meta workspace at all, it needs meta to say so. Today meta project list --recursive --json outside a workspace exits 1 with only a stderr message, the same as any real failure, so atc had to look for meta's config file names on disk itself.

With --json (before or after the command), meta's "Could not find meta config file" branch in meta_cli/src/main.rs now also prints one JSON object on stdout:

{"error":{"code":"config_not_found","message":"Could not find meta config file '.meta.yaml'\nSearched from /some/dir up to root"}}
  • Exit status stays 1: the command did not run.
  • Stderr text is unchanged.
  • Without --json, the output is unchanged (stdout stays empty). The one behaviour change, with or without --json, is in a .worktrees/<name> directory with no config; see below.
  • code is the contract; the message is for people. Rebased on refactor!: meta_cli reads only .meta.yaml #47 (tasks/harmony-2878, .meta.yaml only).
  • The code is config_not_found rather than "not a workspace": an explicit --config that doesn't exist reaches the same error inside a workspace, and, for plugin commands, inside a worktree set (see below). Callers that pass no --config (atc) can read it as "no meta workspace here".

Every command that needs a config goes through this branch (plugin commands and meta exec); context, init, plugin management, help and git clone don't.

Inside a .worktrees/<name> directory with no config (for example a plain git worktree add .worktrees/x), meta took a "degraded" path that ran any command as a raw program in the set's checkouts, so meta project list --json tried to run a project binary and printed loop results. Now a command that a plugin claims gets the same config-not-found error there (as JSON with --json), the same as outside a workspace: plugin commands need a config. meta exec keeps running in the set's checkouts. Which commands count as plugin commands depends on the installed plugins: without meta-project installed, meta project list there still runs a project program from PATH, as before. The error code is built in one helper, config_not_found, used by both places.

Tests

json_callers_without_a_config_get_a_json_error (tests/json_errors.rs, not unix-gated, so Windows CI runs it too):

  • project list --recursive --json and --json git worktree list outside a workspace exit with status 1, print the JSON error with code = "config_not_found", and repeat the message on stderr;
  • an explicit --config that doesn't exist, inside a workspace, gives the same error;
  • a malformed .meta.yaml fails without claiming config_not_found;
  • meta --json exec -- true outside a workspace gives the same error.

a_plugin_command_in_a_plain_git_worktree_needs_a_config (tests/plugin_routing.rs): in a plain Git worktree under .worktrees/x with no config, meta --json touch (claimed by a fake plugin) exits 1 with config_not_found and runs nothing; meta exec -- touch ran still runs there. It fails without the change.

The existing missing_config_errors_are_escaped now also checks that a non-JSON run prints nothing on stdout. cargo test -p meta after the rebase on #47: all pass.

Related

Task: [[tasks/harmony-2794]]

Related: gitkb/meta_project_cli#22 (project aliases in project list --json, same branch) is also needed by atc#606.

(Any bot-generated summary appended below is not part of this description.)

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: afb71911-76b8-41bb-9a34-f41c0d11bf8e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@gold-silver-copper
gold-silver-copper force-pushed the refactor/drop-meta-worktree-identity branch from c9d943f to 677d302 Compare October 28, 2026 21:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant