@mindfoldhq/trellis 0.4.0 → 0.5.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +0 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +10 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +382 -120
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts +5 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +178 -61
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/antigravity.d.ts +3 -4
- package/dist/configurators/antigravity.d.ts.map +1 -1
- package/dist/configurators/antigravity.js +17 -10
- package/dist/configurators/antigravity.js.map +1 -1
- package/dist/configurators/claude.d.ts +5 -28
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +30 -51
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/codebuddy.d.ts +6 -7
- package/dist/configurators/codebuddy.d.ts.map +1 -1
- package/dist/configurators/codebuddy.js +23 -51
- package/dist/configurators/codebuddy.js.map +1 -1
- package/dist/configurators/codex.d.ts +3 -6
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +29 -12
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts +6 -5
- package/dist/configurators/copilot.d.ts.map +1 -1
- package/dist/configurators/copilot.js +42 -13
- package/dist/configurators/copilot.js.map +1 -1
- package/dist/configurators/cursor.d.ts +6 -1
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +22 -45
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/droid.d.ts +6 -1
- package/dist/configurators/droid.d.ts.map +1 -1
- package/dist/configurators/droid.js +23 -41
- package/dist/configurators/droid.js.map +1 -1
- package/dist/configurators/gemini.d.ts +8 -4
- package/dist/configurators/gemini.d.ts.map +1 -1
- package/dist/configurators/gemini.js +28 -47
- package/dist/configurators/gemini.js.map +1 -1
- package/dist/configurators/index.d.ts +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +146 -100
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/kilo.d.ts +3 -4
- package/dist/configurators/kilo.d.ts.map +1 -1
- package/dist/configurators/kilo.js +19 -46
- package/dist/configurators/kilo.js.map +1 -1
- package/dist/configurators/kiro.d.ts +4 -4
- package/dist/configurators/kiro.d.ts.map +1 -1
- package/dist/configurators/kiro.js +18 -14
- package/dist/configurators/kiro.js.map +1 -1
- package/dist/configurators/opencode.d.ts +7 -25
- package/dist/configurators/opencode.d.ts.map +1 -1
- package/dist/configurators/opencode.js +57 -56
- package/dist/configurators/opencode.js.map +1 -1
- package/dist/configurators/qoder.d.ts +6 -3
- package/dist/configurators/qoder.d.ts.map +1 -1
- package/dist/configurators/qoder.js +27 -46
- package/dist/configurators/qoder.js.map +1 -1
- package/dist/configurators/shared.d.ts +68 -3
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +274 -3
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/windsurf.d.ts +3 -4
- package/dist/configurators/windsurf.d.ts.map +1 -1
- package/dist/configurators/windsurf.js +17 -10
- package/dist/configurators/windsurf.js.map +1 -1
- package/dist/configurators/workflow.d.ts +0 -3
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +1 -7
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/manifests/0.4.0.json +1 -1
- package/dist/migrations/manifests/0.5.0-beta.0.json +1646 -0
- package/dist/migrations/manifests/0.5.0-beta.1.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.5.json +222 -0
- package/dist/migrations/manifests/0.5.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.8.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.9.json +48 -0
- package/dist/templates/claude/agents/{check.md → trellis-check.md} +3 -31
- package/dist/templates/claude/agents/{implement.md → trellis-implement.md} +1 -2
- package/dist/templates/claude/agents/trellis-research.md +137 -0
- package/dist/templates/claude/index.d.ts +5 -37
- package/dist/templates/claude/index.d.ts.map +1 -1
- package/dist/templates/claude/index.js +3 -42
- package/dist/templates/claude/index.js.map +1 -1
- package/dist/templates/claude/settings.json +6 -4
- package/dist/templates/{iflow/agents/check.md → codebuddy/agents/trellis-check.md} +3 -31
- package/dist/templates/{iflow/agents/implement.md → codebuddy/agents/trellis-implement.md} +1 -2
- package/dist/templates/codebuddy/agents/trellis-research.md +137 -0
- package/dist/templates/codebuddy/index.d.ts +6 -16
- package/dist/templates/codebuddy/index.d.ts.map +1 -1
- package/dist/templates/codebuddy/index.js +6 -36
- package/dist/templates/codebuddy/index.js.map +1 -1
- package/dist/templates/codebuddy/settings.json +59 -0
- package/dist/templates/codex/agents/trellis-check.toml +38 -0
- package/dist/templates/codex/agents/{implement.toml → trellis-implement.toml} +1 -1
- package/dist/templates/codex/agents/trellis-research.toml +60 -0
- package/dist/templates/codex/config.toml +10 -0
- package/dist/templates/codex/hooks/session-start.py +65 -29
- package/dist/templates/codex/hooks.json +11 -0
- package/dist/templates/codex/index.d.ts +0 -1
- package/dist/templates/codex/index.d.ts.map +1 -1
- package/dist/templates/codex/index.js +1 -8
- package/dist/templates/codex/index.js.map +1 -1
- package/dist/templates/codex/skills/start/SKILL.md +1 -1
- package/dist/templates/common/commands/continue.md +51 -0
- package/dist/templates/common/commands/finish-work.md +32 -0
- package/dist/templates/common/commands/start.md +56 -0
- package/dist/templates/common/index.d.ts +28 -0
- package/dist/templates/common/index.d.ts.map +1 -0
- package/dist/templates/common/index.js +55 -0
- package/dist/templates/common/index.js.map +1 -0
- package/dist/templates/{droid/commands/trellis → common/skills}/brainstorm.md +51 -12
- package/dist/templates/{iflow/commands/trellis → common/skills}/break-loop.md +4 -4
- package/dist/templates/common/skills/check.md +87 -0
- package/dist/templates/{codebuddy/commands/trellis → common/skills}/update-spec.md +18 -21
- package/dist/templates/copilot/hooks/session-start.py +65 -29
- package/dist/templates/copilot/hooks.json +8 -0
- package/dist/templates/copilot/prompts/start.prompt.md +13 -16
- package/dist/templates/cursor/agents/trellis-check.md +94 -0
- package/dist/templates/cursor/agents/trellis-implement.md +94 -0
- package/dist/templates/cursor/agents/trellis-research.md +137 -0
- package/dist/templates/cursor/hooks.json +24 -0
- package/dist/templates/cursor/index.d.ts +6 -17
- package/dist/templates/cursor/index.d.ts.map +1 -1
- package/dist/templates/cursor/index.js +6 -37
- package/dist/templates/cursor/index.js.map +1 -1
- package/dist/templates/droid/droids/trellis-check.md +94 -0
- package/dist/templates/droid/droids/trellis-implement.md +94 -0
- package/dist/templates/droid/droids/trellis-research.md +137 -0
- package/dist/templates/droid/index.d.ts +7 -19
- package/dist/templates/droid/index.d.ts.map +1 -1
- package/dist/templates/droid/index.js +7 -39
- package/dist/templates/droid/index.js.map +1 -1
- package/dist/templates/droid/settings.json +59 -0
- package/dist/templates/extract.d.ts +7 -193
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +7 -310
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/gemini/agents/trellis-check.md +94 -0
- package/dist/templates/gemini/agents/trellis-implement.md +94 -0
- package/dist/templates/gemini/agents/trellis-research.md +137 -0
- package/dist/templates/gemini/index.d.ts +6 -14
- package/dist/templates/gemini/index.d.ts.map +1 -1
- package/dist/templates/gemini/index.js +6 -37
- package/dist/templates/gemini/index.js.map +1 -1
- package/dist/templates/gemini/settings.json +28 -0
- package/dist/templates/kiro/agents/trellis-check.json +13 -0
- package/dist/templates/kiro/agents/trellis-implement.json +13 -0
- package/dist/templates/kiro/agents/trellis-research.json +21 -0
- package/dist/templates/kiro/index.d.ts +11 -11
- package/dist/templates/kiro/index.d.ts.map +1 -1
- package/dist/templates/kiro/index.js +11 -33
- package/dist/templates/kiro/index.js.map +1 -1
- package/dist/templates/opencode/agents/{check.md → trellis-check.md} +3 -30
- package/dist/templates/opencode/agents/{implement.md → trellis-implement.md} +1 -1
- package/dist/templates/opencode/agents/{research.md → trellis-research.md} +1 -2
- package/dist/templates/opencode/plugins/inject-subagent-context.js +18 -190
- package/dist/templates/opencode/plugins/inject-workflow-state.js +172 -0
- package/dist/templates/opencode/plugins/session-start.js +76 -39
- package/dist/templates/qoder/agents/trellis-check.md +94 -0
- package/dist/templates/qoder/agents/trellis-implement.md +94 -0
- package/dist/templates/qoder/agents/trellis-research.md +137 -0
- package/dist/templates/qoder/index.d.ts +7 -10
- package/dist/templates/qoder/index.d.ts.map +1 -1
- package/dist/templates/qoder/index.js +7 -32
- package/dist/templates/qoder/index.js.map +1 -1
- package/dist/templates/qoder/settings.json +47 -0
- package/dist/templates/shared-hooks/index.d.ts +19 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -0
- package/dist/templates/shared-hooks/index.js +30 -0
- package/dist/templates/shared-hooks/index.js.map +1 -0
- package/dist/templates/{iflow/hooks → shared-hooks}/inject-subagent-context.py +77 -266
- package/dist/templates/shared-hooks/inject-workflow-state.py +244 -0
- package/dist/templates/{claude/hooks → shared-hooks}/session-start.py +172 -55
- package/dist/templates/template-utils.d.ts +26 -0
- package/dist/templates/template-utils.d.ts.map +1 -0
- package/dist/templates/template-utils.js +60 -0
- package/dist/templates/template-utils.js.map +1 -0
- package/dist/templates/trellis/config.yaml +6 -0
- package/dist/templates/trellis/index.d.ts +1 -15
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +2 -29
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/common/cli_adapter.py +31 -8
- package/dist/templates/trellis/scripts/common/config.py +126 -1
- package/dist/templates/trellis/scripts/common/git_context.py +25 -2
- package/dist/templates/trellis/scripts/common/task_context.py +23 -28
- package/dist/templates/trellis/scripts/common/task_store.py +0 -12
- package/dist/templates/trellis/scripts/common/types.py +0 -2
- package/dist/templates/trellis/scripts/common/workflow_phase.py +176 -0
- package/dist/templates/trellis/scripts/task.py +13 -35
- package/dist/templates/trellis/workflow.md +283 -298
- package/dist/types/ai-tools.d.ts +30 -3
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +119 -15
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/types/migration.d.ts +8 -1
- package/dist/types/migration.d.ts.map +1 -1
- package/dist/utils/project-detector.d.ts +2 -0
- package/dist/utils/project-detector.d.ts.map +1 -1
- package/dist/utils/project-detector.js +120 -11
- package/dist/utils/project-detector.js.map +1 -1
- package/dist/utils/task-json.d.ts +46 -0
- package/dist/utils/task-json.d.ts.map +1 -0
- package/dist/utils/task-json.js +49 -0
- package/dist/utils/task-json.js.map +1 -0
- package/package.json +3 -2
- package/dist/configurators/iflow.d.ts +0 -33
- package/dist/configurators/iflow.d.ts.map +0 -1
- package/dist/configurators/iflow.js +0 -99
- package/dist/configurators/iflow.js.map +0 -1
- package/dist/templates/antigravity/index.d.ts +0 -12
- package/dist/templates/antigravity/index.d.ts.map +0 -1
- package/dist/templates/antigravity/index.js +0 -29
- package/dist/templates/antigravity/index.js.map +0 -1
- package/dist/templates/claude/agents/debug.md +0 -106
- package/dist/templates/claude/agents/dispatch.md +0 -213
- package/dist/templates/claude/agents/plan.md +0 -396
- package/dist/templates/claude/agents/research.md +0 -120
- package/dist/templates/claude/commands/trellis/brainstorm.md +0 -487
- package/dist/templates/claude/commands/trellis/break-loop.md +0 -125
- package/dist/templates/claude/commands/trellis/check-cross-layer.md +0 -153
- package/dist/templates/claude/commands/trellis/check.md +0 -25
- package/dist/templates/claude/commands/trellis/create-command.md +0 -154
- package/dist/templates/claude/commands/trellis/finish-work.md +0 -153
- package/dist/templates/claude/commands/trellis/integrate-skill.md +0 -219
- package/dist/templates/claude/commands/trellis/onboard.md +0 -358
- package/dist/templates/claude/commands/trellis/parallel.md +0 -192
- package/dist/templates/claude/commands/trellis/record-session.md +0 -62
- package/dist/templates/claude/commands/trellis/start.md +0 -393
- package/dist/templates/claude/commands/trellis/update-spec.md +0 -354
- package/dist/templates/claude/hooks/inject-subagent-context.py +0 -803
- package/dist/templates/claude/hooks/ralph-loop.py +0 -396
- package/dist/templates/codebuddy/commands/trellis/before-dev.md +0 -29
- package/dist/templates/codebuddy/commands/trellis/brainstorm.md +0 -487
- package/dist/templates/codebuddy/commands/trellis/break-loop.md +0 -107
- package/dist/templates/codebuddy/commands/trellis/check-cross-layer.md +0 -153
- package/dist/templates/codebuddy/commands/trellis/check.md +0 -25
- package/dist/templates/codebuddy/commands/trellis/create-command.md +0 -154
- package/dist/templates/codebuddy/commands/trellis/finish-work.md +0 -143
- package/dist/templates/codebuddy/commands/trellis/integrate-skill.md +0 -219
- package/dist/templates/codebuddy/commands/trellis/onboard.md +0 -358
- package/dist/templates/codebuddy/commands/trellis/record-session.md +0 -61
- package/dist/templates/codebuddy/commands/trellis/start.md +0 -373
- package/dist/templates/codex/agents/check.toml +0 -23
- package/dist/templates/codex/agents/research.toml +0 -26
- package/dist/templates/codex/codex-skills/parallel/SKILL.md +0 -194
- package/dist/templates/cursor/commands/trellis-before-dev.md +0 -29
- package/dist/templates/cursor/commands/trellis-brainstorm.md +0 -487
- package/dist/templates/cursor/commands/trellis-break-loop.md +0 -107
- package/dist/templates/cursor/commands/trellis-check-cross-layer.md +0 -153
- package/dist/templates/cursor/commands/trellis-check.md +0 -25
- package/dist/templates/cursor/commands/trellis-create-command.md +0 -154
- package/dist/templates/cursor/commands/trellis-finish-work.md +0 -143
- package/dist/templates/cursor/commands/trellis-integrate-skill.md +0 -219
- package/dist/templates/cursor/commands/trellis-onboard.md +0 -358
- package/dist/templates/cursor/commands/trellis-record-session.md +0 -62
- package/dist/templates/cursor/commands/trellis-start.md +0 -373
- package/dist/templates/cursor/commands/trellis-update-spec.md +0 -354
- package/dist/templates/droid/commands/trellis/before-dev.md +0 -33
- package/dist/templates/droid/commands/trellis/break-loop.md +0 -111
- package/dist/templates/droid/commands/trellis/check-cross-layer.md +0 -157
- package/dist/templates/droid/commands/trellis/check.md +0 -29
- package/dist/templates/droid/commands/trellis/create-command.md +0 -158
- package/dist/templates/droid/commands/trellis/finish-work.md +0 -147
- package/dist/templates/droid/commands/trellis/integrate-skill.md +0 -223
- package/dist/templates/droid/commands/trellis/onboard.md +0 -362
- package/dist/templates/droid/commands/trellis/record-session.md +0 -66
- package/dist/templates/droid/commands/trellis/start.md +0 -377
- package/dist/templates/droid/commands/trellis/update-spec.md +0 -358
- package/dist/templates/gemini/commands/trellis/before-dev.toml +0 -33
- package/dist/templates/gemini/commands/trellis/brainstorm.toml +0 -435
- package/dist/templates/gemini/commands/trellis/break-loop.toml +0 -129
- package/dist/templates/gemini/commands/trellis/check-cross-layer.toml +0 -147
- package/dist/templates/gemini/commands/trellis/check.toml +0 -29
- package/dist/templates/gemini/commands/trellis/create-command.toml +0 -119
- package/dist/templates/gemini/commands/trellis/finish-work.toml +0 -133
- package/dist/templates/gemini/commands/trellis/integrate-skill.toml +0 -104
- package/dist/templates/gemini/commands/trellis/onboard.toml +0 -111
- package/dist/templates/gemini/commands/trellis/record-session.toml +0 -66
- package/dist/templates/gemini/commands/trellis/start.toml +0 -354
- package/dist/templates/gemini/commands/trellis/update-spec.toml +0 -132
- package/dist/templates/iflow/agents/debug.md +0 -106
- package/dist/templates/iflow/agents/dispatch.md +0 -213
- package/dist/templates/iflow/agents/plan.md +0 -396
- package/dist/templates/iflow/agents/research.md +0 -120
- package/dist/templates/iflow/commands/trellis/before-dev.md +0 -29
- package/dist/templates/iflow/commands/trellis/brainstorm.md +0 -487
- package/dist/templates/iflow/commands/trellis/check-cross-layer.md +0 -153
- package/dist/templates/iflow/commands/trellis/check.md +0 -25
- package/dist/templates/iflow/commands/trellis/create-command.md +0 -152
- package/dist/templates/iflow/commands/trellis/finish-work.md +0 -153
- package/dist/templates/iflow/commands/trellis/integrate-skill.md +0 -219
- package/dist/templates/iflow/commands/trellis/onboard.md +0 -358
- package/dist/templates/iflow/commands/trellis/parallel.md +0 -192
- package/dist/templates/iflow/commands/trellis/record-session.md +0 -62
- package/dist/templates/iflow/commands/trellis/start.md +0 -393
- package/dist/templates/iflow/commands/trellis/update-spec.md +0 -354
- package/dist/templates/iflow/hooks/ralph-loop.py +0 -395
- package/dist/templates/iflow/hooks/session-start.py +0 -403
- package/dist/templates/iflow/index.d.ts +0 -54
- package/dist/templates/iflow/index.d.ts.map +0 -1
- package/dist/templates/iflow/index.js +0 -85
- package/dist/templates/iflow/index.js.map +0 -1
- package/dist/templates/iflow/settings.json +0 -60
- package/dist/templates/kilo/index.d.ts +0 -16
- package/dist/templates/kilo/index.d.ts.map +0 -1
- package/dist/templates/kilo/index.js +0 -39
- package/dist/templates/kilo/index.js.map +0 -1
- package/dist/templates/kilo/workflows/before-dev.md +0 -29
- package/dist/templates/kilo/workflows/brainstorm.md +0 -487
- package/dist/templates/kilo/workflows/break-loop.md +0 -125
- package/dist/templates/kilo/workflows/check-cross-layer.md +0 -153
- package/dist/templates/kilo/workflows/check.md +0 -25
- package/dist/templates/kilo/workflows/create-command.md +0 -152
- package/dist/templates/kilo/workflows/finish-work.md +0 -129
- package/dist/templates/kilo/workflows/integrate-skill.md +0 -219
- package/dist/templates/kilo/workflows/onboard.md +0 -358
- package/dist/templates/kilo/workflows/parallel.md +0 -193
- package/dist/templates/kilo/workflows/record-session.md +0 -62
- package/dist/templates/kilo/workflows/start.md +0 -387
- package/dist/templates/kilo/workflows/update-spec.md +0 -285
- package/dist/templates/kiro/skills/before-dev/SKILL.md +0 -34
- package/dist/templates/kiro/skills/brainstorm/SKILL.md +0 -492
- package/dist/templates/kiro/skills/break-loop/SKILL.md +0 -130
- package/dist/templates/kiro/skills/check/SKILL.md +0 -30
- package/dist/templates/kiro/skills/check-cross-layer/SKILL.md +0 -158
- package/dist/templates/kiro/skills/create-command/SKILL.md +0 -101
- package/dist/templates/kiro/skills/finish-work/SKILL.md +0 -148
- package/dist/templates/kiro/skills/integrate-skill/SKILL.md +0 -221
- package/dist/templates/kiro/skills/onboard/SKILL.md +0 -363
- package/dist/templates/kiro/skills/record-session/SKILL.md +0 -67
- package/dist/templates/kiro/skills/start/SKILL.md +0 -351
- package/dist/templates/kiro/skills/update-spec/SKILL.md +0 -335
- package/dist/templates/markdown/spec/backend/directory-structure.md +0 -292
- package/dist/templates/markdown/spec/backend/index.md +0 -40
- package/dist/templates/markdown/spec/backend/script-conventions.md +0 -742
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md +0 -118
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md +0 -394
- package/dist/templates/opencode/agents/debug.md +0 -129
- package/dist/templates/opencode/agents/dispatch.md +0 -223
- package/dist/templates/opencode/agents/trellis-plan.md +0 -427
- package/dist/templates/opencode/commands/trellis/before-dev.md +0 -29
- package/dist/templates/opencode/commands/trellis/brainstorm.md +0 -487
- package/dist/templates/opencode/commands/trellis/break-loop.md +0 -125
- package/dist/templates/opencode/commands/trellis/check-cross-layer.md +0 -153
- package/dist/templates/opencode/commands/trellis/check.md +0 -25
- package/dist/templates/opencode/commands/trellis/create-command.md +0 -154
- package/dist/templates/opencode/commands/trellis/finish-work.md +0 -144
- package/dist/templates/opencode/commands/trellis/integrate-skill.md +0 -219
- package/dist/templates/opencode/commands/trellis/migrate-specs.md +0 -0
- package/dist/templates/opencode/commands/trellis/onboard.md +0 -358
- package/dist/templates/opencode/commands/trellis/parallel.md +0 -193
- package/dist/templates/opencode/commands/trellis/record-session.md +0 -62
- package/dist/templates/opencode/commands/trellis/start.md +0 -351
- package/dist/templates/opencode/commands/trellis/update-spec.md +0 -354
- package/dist/templates/qoder/skills/before-dev/SKILL.md +0 -34
- package/dist/templates/qoder/skills/brainstorm/SKILL.md +0 -492
- package/dist/templates/qoder/skills/break-loop/SKILL.md +0 -130
- package/dist/templates/qoder/skills/check/SKILL.md +0 -30
- package/dist/templates/qoder/skills/check-cross-layer/SKILL.md +0 -158
- package/dist/templates/qoder/skills/create-command/SKILL.md +0 -101
- package/dist/templates/qoder/skills/finish-work/SKILL.md +0 -134
- package/dist/templates/qoder/skills/integrate-skill/SKILL.md +0 -221
- package/dist/templates/qoder/skills/onboard/SKILL.md +0 -363
- package/dist/templates/qoder/skills/record-session/SKILL.md +0 -67
- package/dist/templates/qoder/skills/start/SKILL.md +0 -388
- package/dist/templates/qoder/skills/update-spec/SKILL.md +0 -290
- package/dist/templates/trellis/scripts/common/phase.py +0 -254
- package/dist/templates/trellis/scripts/common/registry.py +0 -335
- package/dist/templates/trellis/scripts/common/worktree.py +0 -305
- package/dist/templates/trellis/scripts/create_bootstrap.py +0 -298
- package/dist/templates/trellis/scripts/multi_agent/__init__.py +0 -5
- package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +0 -17
- package/dist/templates/trellis/scripts/multi_agent/cleanup.py +0 -398
- package/dist/templates/trellis/scripts/multi_agent/create_pr.py +0 -620
- package/dist/templates/trellis/scripts/multi_agent/plan.py +0 -213
- package/dist/templates/trellis/scripts/multi_agent/start.py +0 -539
- package/dist/templates/trellis/scripts/multi_agent/status.py +0 -76
- package/dist/templates/trellis/scripts/multi_agent/status_display.py +0 -542
- package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +0 -225
- package/dist/templates/trellis/scripts-shell-archive/add-session.sh +0 -384
- package/dist/templates/trellis/scripts-shell-archive/common/developer.sh +0 -129
- package/dist/templates/trellis/scripts-shell-archive/common/git-context.sh +0 -263
- package/dist/templates/trellis/scripts-shell-archive/common/paths.sh +0 -208
- package/dist/templates/trellis/scripts-shell-archive/common/phase.sh +0 -150
- package/dist/templates/trellis/scripts-shell-archive/common/registry.sh +0 -247
- package/dist/templates/trellis/scripts-shell-archive/common/task-queue.sh +0 -142
- package/dist/templates/trellis/scripts-shell-archive/common/task-utils.sh +0 -151
- package/dist/templates/trellis/scripts-shell-archive/common/worktree.sh +0 -128
- package/dist/templates/trellis/scripts-shell-archive/create-bootstrap.sh +0 -299
- package/dist/templates/trellis/scripts-shell-archive/get-context.sh +0 -7
- package/dist/templates/trellis/scripts-shell-archive/get-developer.sh +0 -15
- package/dist/templates/trellis/scripts-shell-archive/init-developer.sh +0 -34
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/cleanup.sh +0 -396
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/create-pr.sh +0 -241
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/plan.sh +0 -207
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/start.sh +0 -317
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/status.sh +0 -828
- package/dist/templates/trellis/scripts-shell-archive/task.sh +0 -1204
- package/dist/templates/trellis/worktree.yaml +0 -47
- package/dist/templates/windsurf/index.d.ts +0 -21
- package/dist/templates/windsurf/index.d.ts.map +0 -1
- package/dist/templates/windsurf/index.js +0 -44
- package/dist/templates/windsurf/index.js.map +0 -1
- package/dist/templates/windsurf/workflows/trellis-before-dev.md +0 -31
- package/dist/templates/windsurf/workflows/trellis-brainstorm.md +0 -491
- package/dist/templates/windsurf/workflows/trellis-break-loop.md +0 -111
- package/dist/templates/windsurf/workflows/trellis-check-cross-layer.md +0 -157
- package/dist/templates/windsurf/workflows/trellis-check.md +0 -27
- package/dist/templates/windsurf/workflows/trellis-create-command.md +0 -154
- package/dist/templates/windsurf/workflows/trellis-finish-work.md +0 -147
- package/dist/templates/windsurf/workflows/trellis-integrate-skill.md +0 -220
- package/dist/templates/windsurf/workflows/trellis-onboard.md +0 -362
- package/dist/templates/windsurf/workflows/trellis-record-session.md +0 -66
- package/dist/templates/windsurf/workflows/trellis-start.md +0 -373
- package/dist/templates/windsurf/workflows/trellis-update-spec.md +0 -358
- /package/dist/templates/{claude/commands/trellis → common/skills}/before-dev.md +0 -0
- /package/dist/templates/{claude/hooks → shared-hooks}/statusline.py +0 -0
|
@@ -1,539 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Multi-Agent Pipeline: Start Worktree Agent.
|
|
4
|
-
|
|
5
|
-
Usage: python3 start.py <task-dir>
|
|
6
|
-
Example: python3 start.py .trellis/tasks/01-21-my-task
|
|
7
|
-
|
|
8
|
-
This script:
|
|
9
|
-
1. Creates worktree (if not exists) with dependency install
|
|
10
|
-
2. Copies environment files (from worktree.yaml config)
|
|
11
|
-
3. Sets .current-task in worktree
|
|
12
|
-
4. Starts claude agent in background
|
|
13
|
-
5. Registers agent to registry.json
|
|
14
|
-
|
|
15
|
-
Prerequisites:
|
|
16
|
-
- task.json must exist with 'branch' field
|
|
17
|
-
- agents/dispatch.md must exist (in .claude/, .cursor/, .iflow/, or .opencode/)
|
|
18
|
-
|
|
19
|
-
Configuration: .trellis/worktree.yaml
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
from __future__ import annotations
|
|
23
|
-
|
|
24
|
-
import os
|
|
25
|
-
import shutil
|
|
26
|
-
import subprocess
|
|
27
|
-
import sys
|
|
28
|
-
import uuid
|
|
29
|
-
from pathlib import Path
|
|
30
|
-
|
|
31
|
-
import _bootstrap # noqa: F401 — adds parent scripts/ dir to sys.path
|
|
32
|
-
|
|
33
|
-
from common.cli_adapter import get_cli_adapter
|
|
34
|
-
from common.git import run_git
|
|
35
|
-
from common.io import read_json, write_json
|
|
36
|
-
from common.log import Colors, log_info, log_success, log_warn, log_error
|
|
37
|
-
from common.paths import (
|
|
38
|
-
DIR_WORKFLOW,
|
|
39
|
-
FILE_CURRENT_TASK,
|
|
40
|
-
FILE_TASK_JSON,
|
|
41
|
-
get_repo_root,
|
|
42
|
-
)
|
|
43
|
-
from common.registry import (
|
|
44
|
-
registry_add_agent,
|
|
45
|
-
registry_get_file,
|
|
46
|
-
)
|
|
47
|
-
from common.config import (
|
|
48
|
-
get_default_package,
|
|
49
|
-
get_packages,
|
|
50
|
-
get_submodule_packages,
|
|
51
|
-
validate_package,
|
|
52
|
-
)
|
|
53
|
-
from common.worktree import (
|
|
54
|
-
get_worktree_base_dir,
|
|
55
|
-
get_worktree_config,
|
|
56
|
-
get_worktree_copy_files,
|
|
57
|
-
get_worktree_post_create_hooks,
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
# Colors, log_info, log_success, log_warn, log_error, read_json, write_json
|
|
61
|
-
# are now imported from common.log and common.io above.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# =============================================================================
|
|
65
|
-
# Constants
|
|
66
|
-
# =============================================================================
|
|
67
|
-
|
|
68
|
-
DEFAULT_PLATFORM = "claude"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
# =============================================================================
|
|
72
|
-
# Submodule Init
|
|
73
|
-
# =============================================================================
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def _init_submodules_for_task(
|
|
77
|
-
task_data: dict, worktree_path: str, project_root: Path
|
|
78
|
-
) -> None:
|
|
79
|
-
"""Initialize submodules in worktree based on task's target package.
|
|
80
|
-
|
|
81
|
-
Resolves the target package from task_data.package -> default_package -> None.
|
|
82
|
-
Only initializes submodule-type packages. Idempotent: skips already-initialized
|
|
83
|
-
submodules to avoid detaching HEAD on in-progress work.
|
|
84
|
-
"""
|
|
85
|
-
# Skip if not a monorepo (no packages configured)
|
|
86
|
-
if get_packages(project_root) is None:
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
# Resolve package: task.package -> default_package -> None
|
|
90
|
-
task_package = task_data.get("package")
|
|
91
|
-
package = None
|
|
92
|
-
|
|
93
|
-
if task_package and isinstance(task_package, str):
|
|
94
|
-
if validate_package(task_package, project_root):
|
|
95
|
-
package = task_package
|
|
96
|
-
else:
|
|
97
|
-
log_warn(
|
|
98
|
-
f"package '{task_package}' not found in config.yaml, "
|
|
99
|
-
"skipping submodule init"
|
|
100
|
-
)
|
|
101
|
-
return
|
|
102
|
-
else:
|
|
103
|
-
# Fallback to default_package
|
|
104
|
-
default_pkg = get_default_package(project_root)
|
|
105
|
-
if default_pkg:
|
|
106
|
-
if validate_package(default_pkg, project_root):
|
|
107
|
-
package = default_pkg
|
|
108
|
-
else:
|
|
109
|
-
log_warn(
|
|
110
|
-
f"package '{default_pkg}' not found in config.yaml, "
|
|
111
|
-
"skipping submodule init"
|
|
112
|
-
)
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
if not package:
|
|
116
|
-
log_warn("no package specified, skipping submodule init")
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
# Check if this package is a submodule
|
|
120
|
-
submodule_packages = get_submodule_packages(project_root)
|
|
121
|
-
if package not in submodule_packages:
|
|
122
|
-
log_info(f"Package '{package}' is not a submodule, skipping submodule init")
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
submodule_path = submodule_packages[package]
|
|
126
|
-
log_info(f"Checking submodule status for '{package}' ({submodule_path})...")
|
|
127
|
-
|
|
128
|
-
# Run git submodule status in worktree directory
|
|
129
|
-
ret, status_out, status_err = run_git(
|
|
130
|
-
["submodule", "status", submodule_path], cwd=Path(worktree_path)
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
if ret != 0:
|
|
134
|
-
log_warn(
|
|
135
|
-
f"git submodule status failed for '{submodule_path}': {status_err.strip()}, "
|
|
136
|
-
"skipping submodule init"
|
|
137
|
-
)
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
# Parse the prefix character from submodule status output
|
|
141
|
-
# Format: "<prefix><sha1> <path> (<describe>)"
|
|
142
|
-
# Prefix: '-' (uninitialized), ' ' (normal), '+' (commit mismatch), 'U' (conflict)
|
|
143
|
-
status_line = status_out.rstrip("\n\r")
|
|
144
|
-
if not status_line:
|
|
145
|
-
log_warn(f"Empty submodule status for '{submodule_path}', skipping")
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
prefix = status_line[0]
|
|
149
|
-
|
|
150
|
-
if prefix == "-":
|
|
151
|
-
# Uninitialized: run git submodule update --init
|
|
152
|
-
log_info(f"Initializing submodule '{submodule_path}'...")
|
|
153
|
-
ret, _, err = run_git(
|
|
154
|
-
["submodule", "update", "--init", submodule_path],
|
|
155
|
-
cwd=Path(worktree_path),
|
|
156
|
-
)
|
|
157
|
-
if ret != 0:
|
|
158
|
-
log_warn(f"Failed to initialize submodule '{submodule_path}': {err.strip()}")
|
|
159
|
-
else:
|
|
160
|
-
log_success(f"Submodule '{submodule_path}' initialized")
|
|
161
|
-
elif prefix == " ":
|
|
162
|
-
log_info(f"Submodule '{submodule_path}' already initialized, skipping")
|
|
163
|
-
elif prefix == "+":
|
|
164
|
-
log_warn(
|
|
165
|
-
f"submodule {submodule_path} has local changes, skipping update"
|
|
166
|
-
)
|
|
167
|
-
elif prefix == "U":
|
|
168
|
-
log_warn(
|
|
169
|
-
f"submodule {submodule_path} has conflicts, skipping"
|
|
170
|
-
)
|
|
171
|
-
else:
|
|
172
|
-
log_warn(
|
|
173
|
-
f"Unknown submodule status prefix '{prefix}' for '{submodule_path}', skipping"
|
|
174
|
-
)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
# =============================================================================
|
|
178
|
-
# Main
|
|
179
|
-
# =============================================================================
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
def main() -> int:
|
|
183
|
-
"""Main entry point."""
|
|
184
|
-
import argparse
|
|
185
|
-
|
|
186
|
-
parser = argparse.ArgumentParser(description="Multi-Agent Pipeline: Start Worktree Agent")
|
|
187
|
-
parser.add_argument("task_dir", help="Task directory path")
|
|
188
|
-
parser.add_argument(
|
|
189
|
-
"--platform", "-p",
|
|
190
|
-
choices=["claude", "cursor", "iflow", "opencode", "codex", "qoder"],
|
|
191
|
-
default=DEFAULT_PLATFORM,
|
|
192
|
-
help="Platform to use (default: claude)"
|
|
193
|
-
)
|
|
194
|
-
|
|
195
|
-
args = parser.parse_args()
|
|
196
|
-
task_dir_arg = args.task_dir
|
|
197
|
-
platform = args.platform
|
|
198
|
-
|
|
199
|
-
# Initialize CLI adapter
|
|
200
|
-
adapter = get_cli_adapter(platform)
|
|
201
|
-
|
|
202
|
-
project_root = get_repo_root()
|
|
203
|
-
|
|
204
|
-
# Normalize paths
|
|
205
|
-
task_dir_path = Path(task_dir_arg)
|
|
206
|
-
if task_dir_path.is_absolute():
|
|
207
|
-
task_dir_abs = task_dir_path
|
|
208
|
-
else:
|
|
209
|
-
task_dir_abs = project_root / task_dir_path
|
|
210
|
-
|
|
211
|
-
try:
|
|
212
|
-
task_dir_relative = task_dir_abs.relative_to(project_root).as_posix()
|
|
213
|
-
except ValueError:
|
|
214
|
-
task_dir_relative = str(task_dir_abs)
|
|
215
|
-
|
|
216
|
-
task_json_path = task_dir_abs / FILE_TASK_JSON
|
|
217
|
-
|
|
218
|
-
# =============================================================================
|
|
219
|
-
# Validation
|
|
220
|
-
# =============================================================================
|
|
221
|
-
if not task_json_path.is_file():
|
|
222
|
-
log_error(f"task.json not found at {task_json_path}")
|
|
223
|
-
return 1
|
|
224
|
-
|
|
225
|
-
if adapter.requires_agent_definition_file:
|
|
226
|
-
dispatch_md = adapter.get_agent_path("dispatch", project_root)
|
|
227
|
-
if not dispatch_md.is_file():
|
|
228
|
-
log_error(f"Agent definition not found at {dispatch_md}")
|
|
229
|
-
log_info(f"Platform: {platform}")
|
|
230
|
-
return 1
|
|
231
|
-
|
|
232
|
-
config_file = get_worktree_config(project_root)
|
|
233
|
-
if not config_file.is_file():
|
|
234
|
-
log_error(f"worktree.yaml not found at {config_file}")
|
|
235
|
-
return 1
|
|
236
|
-
|
|
237
|
-
# =============================================================================
|
|
238
|
-
# Read Task Config
|
|
239
|
-
# =============================================================================
|
|
240
|
-
print()
|
|
241
|
-
print(f"{Colors.BLUE}=== Multi-Agent Pipeline: Start ==={Colors.NC}")
|
|
242
|
-
log_info(f"Task: {task_dir_abs}")
|
|
243
|
-
|
|
244
|
-
task_data = read_json(task_json_path)
|
|
245
|
-
if not task_data:
|
|
246
|
-
log_error("Failed to read task.json")
|
|
247
|
-
return 1
|
|
248
|
-
|
|
249
|
-
branch = task_data.get("branch")
|
|
250
|
-
task_name = task_data.get("name")
|
|
251
|
-
task_status = task_data.get("status")
|
|
252
|
-
worktree_path = task_data.get("worktree_path")
|
|
253
|
-
|
|
254
|
-
# Check if task was rejected
|
|
255
|
-
if task_status == "rejected":
|
|
256
|
-
log_error("Task was rejected by Plan Agent")
|
|
257
|
-
rejected_file = task_dir_abs / "REJECTED.md"
|
|
258
|
-
if rejected_file.is_file():
|
|
259
|
-
print()
|
|
260
|
-
print(f"{Colors.YELLOW}Rejection reason:{Colors.NC}")
|
|
261
|
-
print(rejected_file.read_text(encoding="utf-8"))
|
|
262
|
-
print()
|
|
263
|
-
log_info(
|
|
264
|
-
"To retry, delete this directory and run plan.py again with revised requirements"
|
|
265
|
-
)
|
|
266
|
-
return 1
|
|
267
|
-
|
|
268
|
-
# Check if prd.md exists (plan completed successfully)
|
|
269
|
-
prd_file = task_dir_abs / "prd.md"
|
|
270
|
-
if not prd_file.is_file():
|
|
271
|
-
log_error("prd.md not found - Plan Agent may not have completed")
|
|
272
|
-
log_info(f"Check plan log: {task_dir_abs}/.plan-log")
|
|
273
|
-
return 1
|
|
274
|
-
|
|
275
|
-
if not branch:
|
|
276
|
-
log_error("branch field not set in task.json")
|
|
277
|
-
log_info("Please set branch field first, e.g.:")
|
|
278
|
-
log_info(
|
|
279
|
-
" jq '.branch = \"task/my-task\"' task.json > tmp && mv tmp task.json"
|
|
280
|
-
)
|
|
281
|
-
return 1
|
|
282
|
-
|
|
283
|
-
log_info(f"Branch: {branch}")
|
|
284
|
-
log_info(f"Name: {task_name}")
|
|
285
|
-
|
|
286
|
-
# =============================================================================
|
|
287
|
-
# Step 1: Create Worktree (if not exists)
|
|
288
|
-
# =============================================================================
|
|
289
|
-
if not worktree_path or not Path(worktree_path).is_dir():
|
|
290
|
-
log_info("Step 1: Creating worktree...")
|
|
291
|
-
|
|
292
|
-
# Record current branch as base_branch (PR target)
|
|
293
|
-
_, base_branch_out, _ = run_git(
|
|
294
|
-
["branch", "--show-current"], cwd=project_root
|
|
295
|
-
)
|
|
296
|
-
base_branch = base_branch_out.strip()
|
|
297
|
-
log_info(f"Base branch (PR target): {base_branch}")
|
|
298
|
-
|
|
299
|
-
# Calculate worktree path
|
|
300
|
-
worktree_base = get_worktree_base_dir(project_root)
|
|
301
|
-
worktree_base.mkdir(parents=True, exist_ok=True)
|
|
302
|
-
worktree_base = worktree_base.resolve()
|
|
303
|
-
worktree_path_obj = worktree_base / branch
|
|
304
|
-
worktree_path = str(worktree_path_obj)
|
|
305
|
-
|
|
306
|
-
# Create parent directory
|
|
307
|
-
worktree_path_obj.parent.mkdir(parents=True, exist_ok=True)
|
|
308
|
-
|
|
309
|
-
# Create branch if not exists
|
|
310
|
-
ret, _, _ = run_git(
|
|
311
|
-
["show-ref", "--verify", "--quiet", f"refs/heads/{branch}"],
|
|
312
|
-
cwd=project_root,
|
|
313
|
-
)
|
|
314
|
-
if ret == 0:
|
|
315
|
-
log_info("Branch exists, checking out...")
|
|
316
|
-
ret, _, err = run_git(
|
|
317
|
-
["worktree", "add", worktree_path, branch], cwd=project_root
|
|
318
|
-
)
|
|
319
|
-
else:
|
|
320
|
-
log_info(f"Creating new branch: {branch}")
|
|
321
|
-
ret, _, err = run_git(
|
|
322
|
-
["worktree", "add", "-b", branch, worktree_path], cwd=project_root
|
|
323
|
-
)
|
|
324
|
-
|
|
325
|
-
if ret != 0:
|
|
326
|
-
log_error(f"Failed to create worktree: {err}")
|
|
327
|
-
return 1
|
|
328
|
-
|
|
329
|
-
log_success(f"Worktree created: {worktree_path}")
|
|
330
|
-
|
|
331
|
-
# Update task.json with worktree_path and base_branch
|
|
332
|
-
task_data["worktree_path"] = worktree_path
|
|
333
|
-
task_data["base_branch"] = base_branch
|
|
334
|
-
write_json(task_json_path, task_data)
|
|
335
|
-
|
|
336
|
-
# ----- Copy environment files -----
|
|
337
|
-
log_info("Copying environment files...")
|
|
338
|
-
copy_list = get_worktree_copy_files(project_root)
|
|
339
|
-
copy_count = 0
|
|
340
|
-
|
|
341
|
-
for item in copy_list:
|
|
342
|
-
if not item:
|
|
343
|
-
continue
|
|
344
|
-
|
|
345
|
-
source = project_root / item
|
|
346
|
-
target = Path(worktree_path) / item
|
|
347
|
-
|
|
348
|
-
if source.is_file():
|
|
349
|
-
target.parent.mkdir(parents=True, exist_ok=True)
|
|
350
|
-
shutil.copy2(str(source), str(target))
|
|
351
|
-
copy_count += 1
|
|
352
|
-
|
|
353
|
-
if copy_count > 0:
|
|
354
|
-
log_success(f"Copied {copy_count} file(s)")
|
|
355
|
-
|
|
356
|
-
# ----- Copy task directory (may not be committed yet) -----
|
|
357
|
-
log_info("Copying task directory...")
|
|
358
|
-
task_target_dir = Path(worktree_path) / task_dir_relative
|
|
359
|
-
task_target_dir.parent.mkdir(parents=True, exist_ok=True)
|
|
360
|
-
if task_target_dir.exists():
|
|
361
|
-
shutil.rmtree(str(task_target_dir))
|
|
362
|
-
shutil.copytree(str(task_dir_abs), str(task_target_dir))
|
|
363
|
-
log_success("Task directory copied to worktree")
|
|
364
|
-
|
|
365
|
-
# ----- Initialize submodules (before hooks, so hooks can use submodule content) -----
|
|
366
|
-
_init_submodules_for_task(task_data, worktree_path, project_root)
|
|
367
|
-
|
|
368
|
-
# ----- Run post_create hooks -----
|
|
369
|
-
log_info("Running post_create hooks...")
|
|
370
|
-
post_create = get_worktree_post_create_hooks(project_root)
|
|
371
|
-
hook_count = 0
|
|
372
|
-
|
|
373
|
-
for cmd in post_create:
|
|
374
|
-
if not cmd:
|
|
375
|
-
continue
|
|
376
|
-
|
|
377
|
-
log_info(f" Running: {cmd}")
|
|
378
|
-
ret = subprocess.run(cmd, shell=True, cwd=worktree_path)
|
|
379
|
-
if ret.returncode != 0:
|
|
380
|
-
log_error(f"Hook failed: {cmd}")
|
|
381
|
-
return 1
|
|
382
|
-
hook_count += 1
|
|
383
|
-
|
|
384
|
-
if hook_count > 0:
|
|
385
|
-
log_success(f"Ran {hook_count} hook(s)")
|
|
386
|
-
else:
|
|
387
|
-
log_info(f"Step 1: Using existing worktree: {worktree_path}")
|
|
388
|
-
|
|
389
|
-
# ----- Initialize submodules (idempotent, for reused worktrees) -----
|
|
390
|
-
_init_submodules_for_task(task_data, worktree_path, project_root)
|
|
391
|
-
|
|
392
|
-
# =============================================================================
|
|
393
|
-
# Step 2: Set .current-task in Worktree
|
|
394
|
-
# =============================================================================
|
|
395
|
-
log_info("Step 2: Setting current task in worktree...")
|
|
396
|
-
|
|
397
|
-
worktree_workflow_dir = Path(worktree_path) / DIR_WORKFLOW
|
|
398
|
-
worktree_workflow_dir.mkdir(parents=True, exist_ok=True)
|
|
399
|
-
|
|
400
|
-
current_task_file = worktree_workflow_dir / FILE_CURRENT_TASK
|
|
401
|
-
current_task_file.write_text(task_dir_relative, encoding="utf-8")
|
|
402
|
-
log_success(f"Current task set: {task_dir_relative}")
|
|
403
|
-
|
|
404
|
-
# =============================================================================
|
|
405
|
-
# Step 3: Prepare and Start Claude Agent
|
|
406
|
-
# =============================================================================
|
|
407
|
-
log_info(f"Step 3: Starting {adapter.cli_name} agent...")
|
|
408
|
-
|
|
409
|
-
# Update task status
|
|
410
|
-
task_data["status"] = "in_progress"
|
|
411
|
-
write_json(task_json_path, task_data)
|
|
412
|
-
|
|
413
|
-
log_file = Path(worktree_path) / ".agent-log"
|
|
414
|
-
session_id_file = Path(worktree_path) / ".session-id"
|
|
415
|
-
|
|
416
|
-
log_file.touch()
|
|
417
|
-
|
|
418
|
-
# Generate session ID for resume support (Claude Code only)
|
|
419
|
-
# OpenCode generates its own session ID, we'll extract it from logs later
|
|
420
|
-
if adapter.supports_session_id_on_create:
|
|
421
|
-
session_id = str(uuid.uuid4()).lower()
|
|
422
|
-
session_id_file.write_text(session_id, encoding="utf-8")
|
|
423
|
-
log_info(f"Session ID: {session_id}")
|
|
424
|
-
else:
|
|
425
|
-
session_id = None # Will be extracted from logs after startup
|
|
426
|
-
log_info("Session ID will be extracted from logs after startup")
|
|
427
|
-
|
|
428
|
-
# Get proxy environment variables
|
|
429
|
-
https_proxy = os.environ.get("https_proxy", "")
|
|
430
|
-
http_proxy = os.environ.get("http_proxy", "")
|
|
431
|
-
all_proxy = os.environ.get("all_proxy", "")
|
|
432
|
-
|
|
433
|
-
# Start agent in background (cross-platform, no shell script needed)
|
|
434
|
-
env = os.environ.copy()
|
|
435
|
-
env["https_proxy"] = https_proxy
|
|
436
|
-
env["http_proxy"] = http_proxy
|
|
437
|
-
env["all_proxy"] = all_proxy
|
|
438
|
-
|
|
439
|
-
# Clear nested-session detection so the new CLI process can start
|
|
440
|
-
# (when this script runs inside a Claude Code session, CLAUDECODE=1 is inherited)
|
|
441
|
-
env.pop("CLAUDECODE", None)
|
|
442
|
-
|
|
443
|
-
# Set non-interactive env var based on platform
|
|
444
|
-
env.update(adapter.get_non_interactive_env())
|
|
445
|
-
|
|
446
|
-
# Build CLI command using adapter
|
|
447
|
-
# Note: Use explicit prompt to avoid confusion with CI/CD pipelines
|
|
448
|
-
# Also remind the model to follow its agent definition for better cross-model compatibility
|
|
449
|
-
cli_cmd = adapter.build_run_command(
|
|
450
|
-
agent="dispatch",
|
|
451
|
-
prompt="Follow your agent instructions to execute the task workflow. Start by reading .trellis/.current-task to get the task directory, then execute each action in task.json next_action array in order.",
|
|
452
|
-
session_id=session_id if adapter.supports_session_id_on_create else None,
|
|
453
|
-
skip_permissions=True,
|
|
454
|
-
verbose=True,
|
|
455
|
-
json_output=True,
|
|
456
|
-
)
|
|
457
|
-
|
|
458
|
-
with log_file.open("w") as log_f:
|
|
459
|
-
# Use shell=False for cross-platform compatibility
|
|
460
|
-
# creationflags for Windows, start_new_session for Unix
|
|
461
|
-
popen_kwargs = {
|
|
462
|
-
"stdout": log_f,
|
|
463
|
-
"stderr": subprocess.STDOUT,
|
|
464
|
-
"cwd": worktree_path,
|
|
465
|
-
"env": env,
|
|
466
|
-
}
|
|
467
|
-
if sys.platform == "win32":
|
|
468
|
-
popen_kwargs["creationflags"] = subprocess.CREATE_NEW_PROCESS_GROUP
|
|
469
|
-
else:
|
|
470
|
-
popen_kwargs["start_new_session"] = True
|
|
471
|
-
|
|
472
|
-
process = subprocess.Popen(cli_cmd, **popen_kwargs)
|
|
473
|
-
agent_pid = process.pid
|
|
474
|
-
|
|
475
|
-
log_success(f"Agent started with PID: {agent_pid}")
|
|
476
|
-
|
|
477
|
-
# For OpenCode: extract session ID from logs after startup
|
|
478
|
-
if not adapter.supports_session_id_on_create:
|
|
479
|
-
import time
|
|
480
|
-
log_info("Waiting for session ID from logs...")
|
|
481
|
-
# Wait a bit for the log to have session ID
|
|
482
|
-
for _ in range(10): # Try for up to 5 seconds
|
|
483
|
-
time.sleep(0.5)
|
|
484
|
-
try:
|
|
485
|
-
log_content = log_file.read_text(encoding="utf-8", errors="replace")
|
|
486
|
-
session_id = adapter.extract_session_id_from_log(log_content)
|
|
487
|
-
if session_id:
|
|
488
|
-
session_id_file.write_text(session_id, encoding="utf-8")
|
|
489
|
-
log_success(f"Session ID extracted: {session_id}")
|
|
490
|
-
break
|
|
491
|
-
except Exception:
|
|
492
|
-
pass
|
|
493
|
-
else:
|
|
494
|
-
log_warn("Could not extract session ID from logs")
|
|
495
|
-
session_id = "unknown"
|
|
496
|
-
|
|
497
|
-
# =============================================================================
|
|
498
|
-
# Step 4: Register to Registry (in main repo, not worktree)
|
|
499
|
-
# =============================================================================
|
|
500
|
-
log_info("Step 4: Registering agent to registry...")
|
|
501
|
-
|
|
502
|
-
# Generate agent ID
|
|
503
|
-
task_id = task_data.get("id")
|
|
504
|
-
if not task_id:
|
|
505
|
-
task_id = branch.replace("/", "-")
|
|
506
|
-
|
|
507
|
-
registry_add_agent(
|
|
508
|
-
task_id, worktree_path, agent_pid, task_dir_relative, project_root, platform
|
|
509
|
-
)
|
|
510
|
-
|
|
511
|
-
log_success(f"Agent registered: {task_id}")
|
|
512
|
-
|
|
513
|
-
# =============================================================================
|
|
514
|
-
# Summary
|
|
515
|
-
# =============================================================================
|
|
516
|
-
print()
|
|
517
|
-
print(f"{Colors.GREEN}=== Agent Started ==={Colors.NC}")
|
|
518
|
-
print()
|
|
519
|
-
print(f" ID: {task_id}")
|
|
520
|
-
print(f" PID: {agent_pid}")
|
|
521
|
-
print(f" Session: {session_id}")
|
|
522
|
-
print(f" Worktree: {worktree_path}")
|
|
523
|
-
print(f" Task: {task_dir_relative}")
|
|
524
|
-
print(f" Log: {log_file}")
|
|
525
|
-
print(f" Registry: {registry_get_file(project_root)}")
|
|
526
|
-
print()
|
|
527
|
-
print(f"{Colors.YELLOW}To monitor:{Colors.NC} tail -f {log_file}")
|
|
528
|
-
print(f"{Colors.YELLOW}To stop:{Colors.NC} kill {agent_pid}")
|
|
529
|
-
if session_id and session_id != "unknown":
|
|
530
|
-
resume_cmd = adapter.get_resume_command_str(session_id, cwd=worktree_path)
|
|
531
|
-
print(f"{Colors.YELLOW}To resume:{Colors.NC} {resume_cmd}")
|
|
532
|
-
else:
|
|
533
|
-
print(f"{Colors.YELLOW}To resume:{Colors.NC} (session ID not available)")
|
|
534
|
-
|
|
535
|
-
return 0
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if __name__ == "__main__":
|
|
539
|
-
sys.exit(main())
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Multi-Agent Pipeline: Status Monitor.
|
|
4
|
-
|
|
5
|
-
Usage:
|
|
6
|
-
python3 status.py Show summary of all tasks (default)
|
|
7
|
-
python3 status.py -a <assignee> Filter tasks by assignee
|
|
8
|
-
python3 status.py --list List all worktrees and agents
|
|
9
|
-
python3 status.py --detail <task> Detailed task status
|
|
10
|
-
python3 status.py --watch <task> Watch agent log in real-time
|
|
11
|
-
python3 status.py --log <task> Show recent log entries
|
|
12
|
-
python3 status.py --registry Show agent registry
|
|
13
|
-
|
|
14
|
-
Entry shim — delegates to status_display and status_monitor.
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
from __future__ import annotations
|
|
18
|
-
|
|
19
|
-
import argparse
|
|
20
|
-
import sys
|
|
21
|
-
|
|
22
|
-
import _bootstrap # noqa: F401 — adds parent scripts/ dir to sys.path
|
|
23
|
-
|
|
24
|
-
from common.paths import get_repo_root
|
|
25
|
-
|
|
26
|
-
from .status_display import (
|
|
27
|
-
cmd_detail,
|
|
28
|
-
cmd_help,
|
|
29
|
-
cmd_list,
|
|
30
|
-
cmd_registry,
|
|
31
|
-
cmd_summary,
|
|
32
|
-
)
|
|
33
|
-
from .status_monitor import cmd_log, cmd_watch
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# =============================================================================
|
|
37
|
-
# Main
|
|
38
|
-
# =============================================================================
|
|
39
|
-
|
|
40
|
-
def main() -> int:
|
|
41
|
-
"""Main entry point."""
|
|
42
|
-
parser = argparse.ArgumentParser(description="Multi-Agent Pipeline: Status Monitor")
|
|
43
|
-
parser.add_argument("-a", "--assignee", help="Filter by assignee")
|
|
44
|
-
parser.add_argument(
|
|
45
|
-
"--list", action="store_true", help="List all worktrees and agents"
|
|
46
|
-
)
|
|
47
|
-
parser.add_argument("--detail", metavar="TASK", help="Detailed task status")
|
|
48
|
-
parser.add_argument("--progress", metavar="TASK", help="Quick progress view")
|
|
49
|
-
parser.add_argument("--watch", metavar="TASK", help="Watch agent log")
|
|
50
|
-
parser.add_argument("--log", metavar="TASK", help="Show recent log entries")
|
|
51
|
-
parser.add_argument("--registry", action="store_true", help="Show agent registry")
|
|
52
|
-
parser.add_argument("target", nargs="?", help="Target task")
|
|
53
|
-
|
|
54
|
-
args = parser.parse_args()
|
|
55
|
-
repo_root = get_repo_root()
|
|
56
|
-
|
|
57
|
-
if args.list:
|
|
58
|
-
return cmd_list(repo_root)
|
|
59
|
-
elif args.detail:
|
|
60
|
-
return cmd_detail(args.detail, repo_root)
|
|
61
|
-
elif args.progress:
|
|
62
|
-
return cmd_detail(args.progress, repo_root) # Similar to detail
|
|
63
|
-
elif args.watch:
|
|
64
|
-
return cmd_watch(args.watch, repo_root)
|
|
65
|
-
elif args.log:
|
|
66
|
-
return cmd_log(args.log, repo_root)
|
|
67
|
-
elif args.registry:
|
|
68
|
-
return cmd_registry(repo_root)
|
|
69
|
-
elif args.target:
|
|
70
|
-
return cmd_detail(args.target, repo_root)
|
|
71
|
-
else:
|
|
72
|
-
return cmd_summary(repo_root, args.assignee)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if __name__ == "__main__":
|
|
76
|
-
sys.exit(main())
|