This repository was archived by the owner on Nov 3, 2026. It is now read-only.
Repository navigation
fix: init keeps settings it doesn't understand, plugin discovery scoped to the workspace #45
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
d374c8b
docs(skills): config names, plugin locations, --local, worktree scope
gold-silver-copper f897278
fix(cli): preserve init settings and handle command edge cases
gold-silver-copper 570f2e6
fix(plugins): scope discovery to workspaces and bound metadata probes
gold-silver-copper 44eecc0
docs(skills): prune keeps to this workspace's sets
gold-silver-copper 8f3d861
fix(plugins): nested meta repos share their workspace's plugins
gold-silver-copper f54a05b
style: auto-format code
github-actions[bot] 3c45b92
test: platform-independent paths in init and orphan-hint tests
gold-silver-copper abcfbe4
fix: review round 1 (plugin scope in sets, output EPIPE, init merge)
gold-silver-copper b4f580d
fix(cli): escape argument errors; discover a set checkout's own plugins
gold-silver-copper 2381680
fix(cli): review round 3 (plugins with an unusable config, init text)
gold-silver-copper 0549fb3
fix(cli): a closed stdout exits 141, not 0
gold-silver-copper 4a1b9b3
fix(cli): any print to a closed stdout exits 141 quietly
gold-silver-copper 188b9f0
fix(cli): review round 6 (escaping, init wording, test isolation)
gold-silver-copper d812301
fix(cli): Windows closed pipes; cap the plugin probe's output
gold-silver-copper 935727c
fix(cli): clearer init settings errors and plugin warning
gold-silver-copper 785c5ea
fix(cli): inside a set, tags and filters go by project path and name
gold-silver-copper 0da1b7e
fix(cli): scan hidden dirs of a set only on configured project paths
gold-silver-copper f763c06
fix(cli): hidden members by record; tags from the chosen config
gold-silver-copper a38fc84
fix(cli): one lookup for a set's config; filters by directory; escape…
gold-silver-copper 2081cd3
docs(skills): name repos in a set by project name or path
gold-silver-copper a83dc43
fix(cli): a set with no members is an error; path filters compare dir…
gold-silver-copper 879c296
fix(cli): escape plugin values in help; tags of a set from where it w…
gold-silver-copper 52a201f
fix(cli): one set-tree lookup for host and worktree exec; escape rele…
gold-silver-copper e2189df
fix(cli): one set tree; escape verbose dispatch, gitdir and query errors
gold-silver-copper d789379
fix(cli): a plain clone under .worktrees is no set
gold-silver-copper e60d547
fix(cli): only a checkout with meta's record marks a moved set
gold-silver-copper f6a46f4
fix(cli): an unreadable record still marks a moved set; escape walk e…
gold-silver-copper 781ec3c
fix(cli): the moved-set guard skips nested sets; escape ZIP entry names
gold-silver-copper 217d5e9
fix(cli): a checkout whose git dir can't be found may be meta's; clap…
gold-silver-copper e71251b
fix(cli): escape the plugin path in plan errors; the guard checks the…
gold-silver-copper b78ba7b
fix(cli): the moved-set guard refuses what it can't read; readable fa…
gold-silver-copper 81e7344
fix(cli): a plugin may answer without reading its request; the guard …
gold-silver-copper ad73d56
fix(cli): a set's config comes only from members recorded for that set
gold-silver-copper 81b32cc
fix(cli): a record that can't be looked up may be meta's; no orphan a…
gold-silver-copper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,17 +26,17 @@ Read-only work (reading code, searching, answering questions) may stay in the | |||||||||
| primary checkout. | ||||||||||
|
|
||||||||||
| Create one set per task, with only the repos it touches, and remove it once the | ||||||||||
| work is pushed. Before a session ends, remove every set it created. Run | ||||||||||
| `meta git worktree` commands from the primary checkout: inside a set they look | ||||||||||
| for sets under that set (only `list` understands the current set). | ||||||||||
| work is pushed. Before a session ends, remove every set it created. Inside a | ||||||||||
| set, `meta git worktree` commands find sets where the checkout the set was | ||||||||||
| made from keeps them, so running them there acts on the workspace's sets. | ||||||||||
|
|
||||||||||
| ## Creating Worktrees | ||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| # Specific repos (the root repo and their dependencies are added automatically) | ||||||||||
| meta git worktree create auth-fix --repo backend --repo frontend | ||||||||||
|
|
||||||||||
| # Only the named repos (and, for nested aliases, their parent repos) | ||||||||||
| # Only the named repos (and, for a repo nested inside another project's path, that parent project) | ||||||||||
| meta git worktree create auth-fix --repo backend --no-deps | ||||||||||
|
|
||||||||||
| # Every repo configured at this meta level | ||||||||||
|
|
@@ -63,21 +63,22 @@ meta git worktree create auth-fix --repo backend --dry-run | |||||||||
|
|
||||||||||
| Add a repo to an existing set with `meta git worktree add auth-fix --repo another-service`. | ||||||||||
|
|
||||||||||
| A set lays its repos out as the workspace does: each repo sits at its `path` | ||||||||||
| from the meta config, so relative references between repos keep working. | ||||||||||
|
|
||||||||||
| `--from-pr` uses the PR's head branch name and fetches it from the child repo | ||||||||||
| whose `origin` matches; it does not check out a fork's branch or pin the head | ||||||||||
| SHA. It never applies to the root repo. When no repo matches it only warns and | ||||||||||
| keeps the set's own branch; when the fetch fails it warns and still uses a branch | ||||||||||
| named after the PR, without the PR's commits (add `--strict` to make either an | ||||||||||
| error). To continue a PR on the root repo, check out its branch directly: | ||||||||||
| SHA. It never applies to the root repo. When no selected repo matches, or the | ||||||||||
| fetch fails, create fails and makes nothing. To continue a PR on the root repo, | ||||||||||
| check out its branch directly: | ||||||||||
|
|
||||||||||
| ```bash | ||||||||||
| git fetch origin my-feature:my-feature # create or fast-forward the local branch | ||||||||||
| meta git worktree create review --repo .:my-feature --repo backend --strict | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| Don't pass `origin/my-feature` as the commit-ish here: with a commit-ish, create | ||||||||||
| always makes a new branch, which fails when `my-feature` already exists locally | ||||||||||
| (and without `--strict` that failure is only a warning). | ||||||||||
| always makes a new branch, which fails when `my-feature` already exists locally. | ||||||||||
|
|
||||||||||
| With `--from-pr` on a child repo whose PR branch already exists locally, `create` | ||||||||||
| checks that branch out as it is (the fetch only updates `origin/<branch>`), so | ||||||||||
|
|
@@ -96,9 +97,10 @@ meta git worktree create ci-check --all --ephemeral --meta agent=review-bot --me | |||||||||
| meta git worktree exec --ephemeral lint-check --all -- make lint | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| `prune` removes sets whose TTL has expired and sets it considers orphaned (none | ||||||||||
| of its repos are in the project any more); for a set whose directory is gone it | ||||||||||
| only forgets meta's record. `--ephemeral` alone only records metadata. A TTL is a backstop for a session that | ||||||||||
| `prune` removes sets whose TTL has expired; for a set whose directory is gone | ||||||||||
| it only forgets meta's record. Once its repos are taken out of the meta config, | ||||||||||
| or the checkout it was made from is moved or deleted, a set is no longer the | ||||||||||
| workspace's: remove it with `git worktree remove`. `--ephemeral` alone only records metadata. A TTL is a backstop for a session that | ||||||||||
| dies before removing its sets. | ||||||||||
|
|
||||||||||
| ## Inspecting Worktrees | ||||||||||
|
|
@@ -124,8 +126,8 @@ meta git worktree exec auth-fix --exclude legacy -- npm test | |||||||||
| meta git worktree exec auth-fix --parallel -- cargo build | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| `--include`/`--exclude` name whole repos by alias, their path in the set | ||||||||||
| (`.` for the root repo), never part of a path. A value that names no repo in | ||||||||||
| `--include`/`--exclude` name whole repos as in the workspace: a project's name | ||||||||||
| or its path in the set (`.` for the root repo), never part of a path. A value that names no repo in | ||||||||||
| the set is an error. They go after the set name: `meta --include x git | ||||||||||
| worktree ...` is refused. The command's arguments reach it as | ||||||||||
| typed, with no shell; use `-- sh -c '...'` when you want one. | ||||||||||
|
|
@@ -157,20 +159,22 @@ run it from the primary checkout to be sure it uses the primary repos. | |||||||||
| meta git worktree remove auth-fix # refuses a set with work it would lose | ||||||||||
| meta git worktree remove auth-fix --force # discards that work | ||||||||||
| meta git worktree prune --dry-run # preview | ||||||||||
| meta git worktree prune # remove expired (TTL) and orphaned sets | ||||||||||
| meta git worktree prune # remove expired (TTL) and orphaned sets of this workspace | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| `remove` and `prune` delete only sets meta created, and check every repo in the | ||||||||||
| set first, nested ones included: uncommitted or untracked changes, commits on | ||||||||||
| no branch, and files outside every repo count as work. `remove` refuses such a | ||||||||||
| set unless `--force`; `prune` keeps it. `prune` sees the sets recorded in the | ||||||||||
| current workspace's repositories (including sets made from other checkouts of | ||||||||||
| them), not every set on the machine. `--force` and `exec --ephemeral` discard that work: commit and | ||||||||||
| push first. | ||||||||||
| set unless `--force`; `prune` keeps it. Both act only on sets of the current | ||||||||||
| workspace: sets whose every worktree is recorded in one of the workspace's | ||||||||||
| repositories. Another workspace's set is never touched, even when both share a | ||||||||||
| `META_WORKTREES` directory; `remove` refuses it and names its workspace. Run | ||||||||||
| from inside a set, they act on the workspace the set was made from. | ||||||||||
| `--force` and `exec --ephemeral` discard that work: commit and push first. | ||||||||||
|
|
||||||||||
| ## Lifecycle Hooks | ||||||||||
|
|
||||||||||
| Configure hooks in the meta config (`.meta`, `.meta.json`, `.meta.yaml` or `.meta.yml`): | ||||||||||
| Configure hooks in the meta config (`.meta.yaml`, `.meta.yml`, `.meta.json` or the legacy `.meta`): | ||||||||||
|
|
||||||||||
| ```yaml | ||||||||||
| worktree: | ||||||||||
|
|
@@ -180,7 +184,9 @@ worktree: | |||||||||
| post-prune: my-tool worktree on-prune | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| Each hook gets a JSON description of the action on stdin. Hook failures don't | ||||||||||
| Each hook runs in the directory of the config that names it (the workspace's, | ||||||||||
| also when run from inside a set) and gets a JSON description of the action on | ||||||||||
| stdin. Hook failures don't | ||||||||||
| block the operation; they are logged as warnings, shown only with `RUST_LOG=warn`. | ||||||||||
|
|
||||||||||
| ## Where Meta Keeps Its Records | ||||||||||
|
|
@@ -190,14 +196,17 @@ into git's own directory for that worktree, `<repo>/.git/worktrees/<id>/meta-wor | |||||||||
| with the set's path, its project, when it was created, and its TTL, ephemeral | ||||||||||
| flag and custom metadata. Git deletes the record with the worktree. The record | ||||||||||
| is how `remove` and `prune` know meta made a set: a set made by hand, or by a | ||||||||||
| meta from before records, is refused; remove it with `git worktree remove`. | ||||||||||
| meta from before records, is refused, and so is a set holding a worktree meta | ||||||||||
| has no record of (one added by hand with `git worktree add`); remove those with | ||||||||||
|
Comment on lines
+199
to
+200
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the malformed worktree-record sentence. The text - meta from before records, is refused, and so is a set holding a worktree meta
- has no record of (one added by hand with `git worktree add`); remove those with
+ meta from before records is refused, and so is a set holding a worktree that
+ meta has no record of, such as one added manually with `git worktree add`;Committable suggestion
|
||||||||||
| `git worktree remove`. | ||||||||||
| `list` scans this project's `.worktrees/` and shows each set's record. | ||||||||||
|
|
||||||||||
| ## Strict Mode | ||||||||||
|
|
||||||||||
| `--strict` on `create` (or global `meta --strict`) turns warnings such as a | ||||||||||
| missing commit-ish in one repo into errors. A create that fails is rolled back: | ||||||||||
| the worktrees and branches it made are deleted again. | ||||||||||
| the worktrees and branches it made are deleted again. If the rollback itself | ||||||||||
| can't delete something, the error says what was left behind. | ||||||||||
|
|
||||||||||
| ## Command Reference | ||||||||||
|
|
||||||||||
|
|
@@ -219,7 +228,7 @@ the worktrees and branches it made are deleted again. | |||||||||
| | `[<commit-ish>]` | Start from a tag, SHA or branch (positional) | | ||||||||||
| | `--repo <alias>[:<branch>]` | Add specific repo(s) | | ||||||||||
| | `--all` | Add all repos at this meta level | | ||||||||||
| | `--no-deps` | Skip automatic root and dependency selection (nested aliases still get their parents) | | ||||||||||
| | `--no-deps` | Skip automatic root and dependency selection (a repo nested inside another project's path still gets that parent project) | | ||||||||||
| | `-r, --recursive` | Resolve across nested meta repos (root-relative aliases) | | ||||||||||
| | `--branch <name>` | Override the branch name | | ||||||||||
| | `--from-pr <owner/repo#N>` | Start a child repo from a PR's head branch | | ||||||||||
|
|
@@ -233,7 +242,7 @@ the worktrees and branches it made are deleted again. | |||||||||
|
|
||||||||||
| | Option | Description | | ||||||||||
| |--------|-------------| | ||||||||||
| | `--include <repos>` | Only these repos, by alias (comma-separated) | | ||||||||||
| | `--exclude <repos>` | Skip these repos, by alias (comma-separated) | | ||||||||||
| | `--include <repos>` | Only these repos, by name or path (comma-separated) | | ||||||||||
| | `--exclude <repos>` | Skip these repos, by name or path (comma-separated) | | ||||||||||
| | `--parallel` | Run concurrently | | ||||||||||
| | `--ephemeral` | Create, run, then remove (takes `--repo`/`--all`, `--branch`, `--from-pr`, `--meta`, a commit-ish) | | ||||||||||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| //! Command-line errors that never echo control characters. | ||
|
|
||
| use meta_core::display::escape; | ||
| use std::ffi::OsStr; | ||
|
|
||
| /// The error to show for `args` that `P` rejected. Clap quotes rejected | ||
| /// values as given, so the error comes from parsing the escaped arguments: | ||
| /// the same error, with values that can't move the cursor or forge a line. | ||
| /// If the escaped arguments parse, a plain error stands in. | ||
| pub fn escaped_error<P: clap::Parser>( | ||
| args: impl IntoIterator<Item = impl AsRef<OsStr>>, | ||
| ) -> clap::Error { | ||
| let shown = args | ||
| .into_iter() | ||
| .map(|arg| escape(&arg.as_ref().to_string_lossy()).into_owned()) | ||
| .collect::<Vec<_>>(); | ||
| match P::try_parse_from(shown) { | ||
| Err(e) => e, | ||
| Ok(_) => P::command().error( | ||
| clap::error::ErrorKind::InvalidValue, | ||
| "an argument contains a control character", | ||
| ), | ||
| } | ||
| } | ||
|
|
||
| /// Parse `P` from this process's arguments, exiting on an error with | ||
| /// [`escaped_error`] (help and version print as usual, and so does clap's | ||
| /// invalid UTF-8 error, which doesn't echo the value). | ||
| pub fn parse<P: clap::Parser>() -> P { | ||
| use clap::error::ErrorKind; | ||
| P::try_parse().unwrap_or_else(|e| match e.kind() { | ||
| ErrorKind::DisplayHelp | ||
| | ErrorKind::DisplayVersion | ||
| | ErrorKind::DisplayHelpOnMissingArgumentOrSubcommand | ||
| | ErrorKind::InvalidUtf8 => e.exit(), | ||
| _ => escaped_error::<P>(std::env::args_os()).exit(), | ||
| }) | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the
--localfailure claim forplugin list.The text says
--localoutside a meta workspace fails with "not in a meta workspace". This is true forinstall,uninstallandupdate, becausePluginInstaller::new_localreturns an error.meta plugin list --localbehaves differently. Insrc/main.rs(Lines 1162-1168), it prints the message to stdout and returnsOk(()). The exit code is 0. With--json, it prints nothing.Choose one fix:
list --localexits 0 and prints the message outside a workspace.list --localreturn the same error as the other subcommands. This also gives--jsonconsumers an error instead of empty output.