Skip to content

feat: add optional tmux launcher workflow#7

Merged
tt-a1i merged 3 commits intomco-org:mainfrom
Aias00:feat/tmux-launcher-pr
Mar 31, 2026
Merged

feat: add optional tmux launcher workflow#7
tt-a1i merged 3 commits intomco-org:mainfrom
Aias00:feat/tmux-launcher-pr

Conversation

@Aias00
Copy link
Copy Markdown
Contributor

@Aias00 Aias00 commented Mar 31, 2026

Summary

  • add an optional scripts/squad-tmux-launch.sh helper for repeatable tmux-based multi-agent launches
  • add launcher helpers, example config/task templates, and shell smoke tests
  • document the helper as optional automation and run its shell tests in CI on Unix runners

Details

This keeps the core Rust CLI unchanged and treats the launcher as opt-in automation for people who already use Claude Code + tmux.

Notable safety changes in the launcher:

  • wait for agents to appear in squad agents --json before injecting manager / inspector prompts
  • prefer a global worktree location by default when worktree mode is enabled
  • reject repo-local worktree locations that are not ignored by git
  • handle Claude installations that resolve to symlinks or JS entrypoints

Verification

  • bash -n scripts/squad-tmux-launch.sh
  • bash -n scripts/lib/squad-tmux-launcher-helpers.sh
  • bash tests/squad_tmux_launcher_helpers_test.sh
  • bash tests/squad_tmux_launcher_smoke.sh
  • cargo test --all

Copilot AI review requested due to automatic review settings March 31, 2026 08:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional tmux-based launcher workflow around the existing squad CLI to support repeatable multi-agent launches (including worktree mode), along with templates, shell-based tests, and CI coverage for the launcher on Unix runners.

Changes:

  • Add scripts/squad-tmux-launch.sh + helper library to generate prompts/summaries/maps and optionally orchestrate tmux + git worktrees.
  • Add example config/task templates and shell tests (helpers unit-style + end-to-end dry-run smoke).
  • Document the optional launcher in READMEs and run launcher shell tests in CI (non-Windows).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
scripts/squad-tmux-launch.sh Main tmux launcher script: parses config, generates artifacts, optionally creates worktree, orchestrates tmux panes + prompt injection.
scripts/lib/squad-tmux-launcher-helpers.sh Shared helper functions for shell escaping, command detection, path/worktree handling.
tests/squad_tmux_launcher_helpers_test.sh Shell tests for helper functions (command candidate detection, truthy parsing, worktree planning/creation).
tests/squad_tmux_launcher_smoke.sh End-to-end dry-run smoke test validating generated prompt/summary/map artifacts.
templates/launcher.yaml.example Example launcher config template.
templates/run-task.md.example Example task brief template.
README.md Documents the optional tmux launcher and requirements.
README.zh-CN.md Chinese documentation for the optional tmux launcher and requirements.
.github/workflows/ci.yml Runs the new shell tests on Unix GitHub Actions runners.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/lib/squad-tmux-launcher-helpers.sh
Comment thread scripts/squad-tmux-launch.sh Outdated
require "shellwords"

file = ARGV[0]
data = File.exist?(file) ? (YAML.load_file(file) || {}) : {}
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The embedded Ruby config loader uses YAML.load_file, which is unsafe for untrusted YAML (it can deserialize arbitrary Ruby objects). Switch to YAML.safe_load (aliases disabled and a minimal permitted class list) to avoid object-injection risk when running the launcher in arbitrary repos.

Suggested change
data = File.exist?(file) ? (YAML.load_file(file) || {}) : {}
data =
if File.exist?(file)
content = File.read(file)
YAML.safe_load(
content,
permitted_classes: [],
permitted_symbols: [],
aliases: false
) || {}
else
{}
end

Copilot uses AI. Check for mistakes.
Comment thread scripts/squad-tmux-launch.sh
Comment on lines +85 to +88
set +u
printf '%s\n' "${candidates[@]}"
set -u
}
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pane_command_candidates also toggles nounset at function exit (set +u / set -u) which can change the caller’s shell options permanently. Restore the original nounset setting instead of forcing set -u here.

Copilot uses AI. Check for mistakes.
Comment thread scripts/squad-tmux-launch.sh Outdated
Comment on lines +656 to +660
if (( no_setup == 0 )); then
echo "[1/5] Refreshing Claude /squad command"
squad setup claude
else
echo "[1/5] Skipping squad setup claude (--no-setup)"
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The progress logging counters are inconsistent ([1/5] here but later steps are labeled [4/6], [5/6], [6/6]). Update the earlier messages to match the actual total step count so users don’t get confusing output when troubleshooting.

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +37
set +u
for existing in "${candidates[@]}"; do
if [[ "$existing" == "$candidate" ]]; then
found=1
break
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These helpers call set +u / set -u inside a function. Because set is global, sourcing this library from a shell that didn’t enable nounset will end up enabling -u for the rest of the session. Save/restore the prior nounset state (or avoid changing shell options inside helpers).

Copilot uses AI. Check for mistakes.
@Aias00
Copy link
Copy Markdown
Contributor Author

Aias00 commented Mar 31, 2026

@tt-a1i hi, pls take a look

@tt-a1i
Copy link
Copy Markdown
Contributor

tt-a1i commented Mar 31, 2026

@tt-a1i hi, pls take a look

Thank you, LGTM

@tt-a1i tt-a1i merged commit 3852e65 into mco-org:main Mar 31, 2026
3 checks passed
@Aias00
Copy link
Copy Markdown
Contributor Author

Aias00 commented Mar 31, 2026

you Chinese? can we add wechat: aias00

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.

3 participants