diff --git a/.github/workflows/notify-parent.yml b/.github/workflows/notify-parent.yml new file mode 100644 index 0000000..7f027b7 --- /dev/null +++ b/.github/workflows/notify-parent.yml @@ -0,0 +1,26 @@ +name: Notify Parent Repo + +on: + push: + branches: [main] + +permissions: {} + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Notify parent repo + # PARENT_REPO_PAT requires `repo` scope (or fine-grained `contents:write`) + # on harmony-labs/meta. Configure in Settings → Secrets → Actions. + uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4 + with: + token: ${{ secrets.PARENT_REPO_PAT }} + repository: harmony-labs/meta + event-type: child-repo-updated + client-payload: >- + { + "repo_name": ${{ toJSON(github.event.repository.name) }}, + "sha": ${{ toJSON(github.sha) }}, + "actor": ${{ toJSON(github.actor) }} + } diff --git a/src/commands/worktree/mod.rs b/src/commands/worktree/mod.rs index 60c564c..00742ee 100644 --- a/src/commands/worktree/mod.rs +++ b/src/commands/worktree/mod.rs @@ -36,6 +36,7 @@ pub fn execute_worktree_command( verbose: bool, json: bool, strict: bool, + recursive: bool, ) -> CommandResult { // Extract the subcommand name from the matched command prefix (if present). // When the plugin registers bare "worktree", the subcommand is in args[0] instead. @@ -45,7 +46,7 @@ pub fn execute_worktree_command( .unwrap_or(""); // Build args for clap - let clap_args: Vec = if subcommand.is_empty() { + let mut clap_args: Vec = if subcommand.is_empty() { // Bare "worktree" or "git worktree" — args already contains the subcommand (if any) args.to_vec() } else { @@ -55,6 +56,14 @@ pub fn execute_worktree_command( .collect() }; + // Inject --recursive if the protocol option was set but the flag wasn't in the + // command args (the host strips global flags like --recursive before forwarding). + // Only inject for `create` — it's the only subcommand that declares this flag. + let is_create = matches!(clap_args.first().map(String::as_str), Some("create")); + if recursive && is_create && !clap_args.iter().any(|a| a == "--recursive" || a == "-r") { + clap_args.push("--recursive".to_string()); + } + // No subcommand at all — show help if clap_args.is_empty() { print_worktree_help(); diff --git a/src/lib.rs b/src/lib.rs index 6b0306e..4766c78 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,6 +51,7 @@ pub fn execute_command( options.verbose, options.json_output, options.strict, + options.recursive, ); }