Skip to content
This repository was archived by the owner on Nov 3, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude/skills/meta-exec/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ meta exec -- cargo test
meta --tag frontend exec -- npm update

# Exclude slow repos (meta options go before `exec`)
meta --exclude large-monorepo exec -- cargo update # fails if meta-rust is installed (see below)
meta --exclude large-monorepo exec -- cargo update
```

### Find Files Across Repos
Expand All @@ -167,7 +167,7 @@ meta exec -- 'find . -name "*.rs" -type f' | head -20

### Clean Build Artifacts
```bash
meta exec -- cargo clean # fails if meta-rust is installed (see below)
meta exec -- cargo clean
meta exec -- rm -rf node_modules dist
```

Expand All @@ -180,7 +180,7 @@ meta exec -- rm -rf node_modules dist
| One-off scripts | Operations with meta-specific logic |
| npm/cargo/make | Clone, update, snapshot |

`meta exec -- <cmd>` still offers the command to plugins first: `meta exec -- git ...` goes to the git plugin, and every `meta exec -- cargo ...` goes to meta-rust when it is installed. meta-rust only handles `build` and `test`, so with it installed other cargo commands (`cargo update`, `cargo clean`) fail. Plugins intercept command patterns and provide enhanced behavior. `meta git clone` doesn't run `git clone` in each repo—it reads `.meta` and clones the entire graph.
`meta exec -- <cmd>` always runs the command as typed, never through a plugin: `meta exec -- git status` runs plain `git status` in each repo, while `meta git status` uses the git plugin. Prefer `meta git <cmd>` for git: any git subcommand passes through it, and it runs remote commands (`fetch`, `pull`, `push`) without credential prompts that would hang parallel runs. Plugins intercept only their own subcommands (`meta git ...`, `meta cargo ...`) and provide enhanced behavior. `meta git clone` doesn't run `git clone` in each repo—it reads `.meta` and clones the entire graph.

## Worktree Context Detection

Expand Down
9 changes: 5 additions & 4 deletions .claude/skills/meta-plugins/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ meta project check # Verify all repos exist
meta project dependents <name> # Projects that depend on one
```

### Rust Plugin (`meta-rust`, if installed)
### Rust Plugin (`meta-rust`)

Cargo workspace awareness. Check `meta --help` for it; without it, use `meta exec -- cargo build`.
Runs any cargo command in each selected repo that has a `Cargo.toml`, skipping the rest (listed on stderr). `meta exec -- cargo ...` runs cargo in every repo instead.

```bash
meta rust build # cargo build in each repo with a Cargo.toml
meta rust test # cargo test in each repo with a Cargo.toml (no dependency ordering)
meta cargo build --release # cargo build --release in each Rust repo
meta cargo fmt --check # any cargo subcommand passes through
meta --include api cargo clippy --all-targets -- -D warnings
```

## Plugin Discovery
Expand Down
50 changes: 25 additions & 25 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ fn main() -> Result<()> {
println!("Arguments:");
println!(" <COMMAND>... Command and arguments to run");
println!();
println!("The command runs in each project directory defined in .meta.");
println!("Use this for any command not explicitly handled by a plugin.");
println!("The command runs as typed in each project directory defined in .meta,");
println!("never through a plugin (use `meta git ...` for the git plugin).");
println!();
println!("Examples:");
println!(" meta exec -- npm install");
println!(" meta exec -- git fetch --all");
println!(" meta exec -- cargo fmt --check");
println!(" meta exec -- make clean");
println!(" meta exec --include api,web -- docker-compose up -d");
std::process::exit(0);
Expand Down Expand Up @@ -564,7 +564,6 @@ fn main() -> Result<()> {
}

if wants_help {
let command_str = args.join(" ");
let options = PluginRequestOptions {
json_output: cli.json,
verbose: cli.verbose,
Expand All @@ -577,7 +576,7 @@ fn main() -> Result<()> {
exclude_filters: cli.exclude.clone(),
strict: cli.strict,
};
if subprocess_plugins.execute(&command_str, &args, &[], None, options)? {
if subprocess_plugins.execute(&args, &[], None, options)? {
return Ok(());
}
}
Expand All @@ -589,10 +588,13 @@ fn main() -> Result<()> {

// === Command Dispatch (shared by exec and external) ===

/// Dispatch a command to plugins or loop execution.
/// Run a command across the selected repos.
///
/// Used by both `meta exec` (is_explicit_exec=true) and external subcommands
/// (is_explicit_exec=false).
/// `meta exec` (is_explicit_exec=true) runs the command as typed and never
/// offers it to plugins, so a plugin's claimed command (e.g. meta-rust's
/// `cargo`) cannot shadow a raw one. External subcommands
/// (is_explicit_exec=false, e.g. `meta git status`) go to the plugin that owns
/// them, or fail as unrecognized.
fn handle_command_dispatch(
command_args: Vec<String>,
cli: &Cli,
Expand Down Expand Up @@ -643,7 +645,7 @@ fn handle_command_dispatch(
let is_git_clone = command_args.first().map(|s| s == "git").unwrap_or(false)
&& command_args.get(1).map(|s| s == "clone").unwrap_or(false);

if is_git_clone {
if is_git_clone && !is_explicit_exec {
// Handle git clone directly via plugin without requiring .meta file
let subprocess_options = PluginRequestOptions {
json_output: cli.json,
Expand All @@ -658,7 +660,7 @@ fn handle_command_dispatch(
strict: cli.strict,
};

if plugins.execute("git clone", &command_args, &[], None, subprocess_options)? {
if plugins.execute(&command_args, &[], None, subprocess_options)? {
if cli.verbose {
println!("{}", "Git clone handled by subprocess plugin.".green());
}
Expand Down Expand Up @@ -760,7 +762,7 @@ fn handle_command_dispatch(
root_dir: Some(task_dir.clone()),
};

// Try plugin dispatch first (full feature parity with normal path)
// Plugin dispatch (full feature parity with normal path)
let subprocess_options = PluginRequestOptions {
json_output: cli.json,
verbose: cli.verbose,
Expand All @@ -774,8 +776,9 @@ fn handle_command_dispatch(
strict: cli.strict,
};

if plugins.execute(
&command_str,
if is_explicit_exec {
run(&config, &command_str)?;
} else if plugins.execute(
&command_args,
&wt_directories,
Some(&task_dir),
Expand All @@ -787,8 +790,6 @@ fn handle_command_dispatch(
"Command handled by subprocess plugin (worktree).".green()
);
}
} else if is_explicit_exec {
run(&config, &command_str)?;
} else {
unrecognized_command_error(&command_args, &command_str, plugins);
}
Expand Down Expand Up @@ -916,7 +917,7 @@ fn handle_command_dispatch(
root_dir: Some(meta_dir.to_path_buf()),
};

// Try subprocess plugins first (preferred)
// Plugin dispatch for external subcommands
let subprocess_options = PluginRequestOptions {
json_output: cli.json,
verbose: cli.verbose,
Expand All @@ -930,8 +931,14 @@ fn handle_command_dispatch(
strict: cli.strict,
};

if plugins.execute(
&command_str,
if is_explicit_exec {
// User explicitly requested exec, run the command in all repos
log::info!("Explicit exec requested, running command via loop");
if cli.verbose {
println!("{}", "Running command via loop (explicit exec).".green());
}
run(&config, &command_str)?;
} else if plugins.execute(
&command_args,
&project_paths,
Some(meta_dir),
Expand All @@ -941,13 +948,6 @@ fn handle_command_dispatch(
if cli.verbose {
println!("{}", "Command handled by subprocess plugin.".green());
}
} else if is_explicit_exec {
// User explicitly requested exec, run the command in all repos
log::info!("Explicit exec requested, running command via loop");
if cli.verbose {
println!("{}", "Running command via loop (explicit exec).".green());
}
run(&config, &command_str)?;
} else {
unrecognized_command_error(&command_args, &command_str, plugins);
}
Expand Down
Loading
Loading