@ibotor/smart-trellis 0.5.19
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/LICENSE +235 -0
- package/README.md +263 -0
- package/bin/smart-trellis.js +3 -0
- package/bin/trellis.js +3 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +132 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/smart.d.ts +2 -0
- package/dist/cli/smart.d.ts.map +1 -0
- package/dist/cli/smart.js +41 -0
- package/dist/cli/smart.js.map +1 -0
- package/dist/commands/init.d.ts +56 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +1466 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/smart-init.d.ts +22 -0
- package/dist/commands/smart-init.d.ts.map +1 -0
- package/dist/commands/smart-init.js +122 -0
- package/dist/commands/smart-init.js.map +1 -0
- package/dist/commands/uninstall.d.ts +27 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +339 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +72 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +1926 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/configurators/antigravity.d.ts +7 -0
- package/dist/configurators/antigravity.d.ts.map +1 -0
- package/dist/configurators/antigravity.js +19 -0
- package/dist/configurators/antigravity.js.map +1 -0
- package/dist/configurators/claude.d.ts +9 -0
- package/dist/configurators/claude.d.ts.map +1 -0
- package/dist/configurators/claude.js +72 -0
- package/dist/configurators/claude.js.map +1 -0
- package/dist/configurators/codebuddy.d.ts +10 -0
- package/dist/configurators/codebuddy.d.ts.map +1 -0
- package/dist/configurators/codebuddy.js +30 -0
- package/dist/configurators/codebuddy.js.map +1 -0
- package/dist/configurators/codex.d.ts +8 -0
- package/dist/configurators/codex.d.ts.map +1 -0
- package/dist/configurators/codex.js +85 -0
- package/dist/configurators/codex.js.map +1 -0
- package/dist/configurators/copilot.d.ts +10 -0
- package/dist/configurators/copilot.d.ts.map +1 -0
- package/dist/configurators/copilot.js +51 -0
- package/dist/configurators/copilot.js.map +1 -0
- package/dist/configurators/cursor.d.ts +10 -0
- package/dist/configurators/cursor.d.ts.map +1 -0
- package/dist/configurators/cursor.js +29 -0
- package/dist/configurators/cursor.js.map +1 -0
- package/dist/configurators/droid.d.ts +10 -0
- package/dist/configurators/droid.d.ts.map +1 -0
- package/dist/configurators/droid.js +30 -0
- package/dist/configurators/droid.js.map +1 -0
- package/dist/configurators/gemini.d.ts +16 -0
- package/dist/configurators/gemini.d.ts.map +1 -0
- package/dist/configurators/gemini.js +38 -0
- package/dist/configurators/gemini.js.map +1 -0
- package/dist/configurators/index.d.ts +65 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +367 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/kilo.d.ts +7 -0
- package/dist/configurators/kilo.d.ts.map +1 -0
- package/dist/configurators/kilo.js +19 -0
- package/dist/configurators/kilo.js.map +1 -0
- package/dist/configurators/kiro.d.ts +8 -0
- package/dist/configurators/kiro.d.ts.map +1 -0
- package/dist/configurators/kiro.js +24 -0
- package/dist/configurators/kiro.js.map +1 -0
- package/dist/configurators/opencode.d.ts +14 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +96 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/pi.d.ts +3 -0
- package/dist/configurators/pi.d.ts.map +1 -0
- package/dist/configurators/pi.js +45 -0
- package/dist/configurators/pi.js.map +1 -0
- package/dist/configurators/qoder.d.ts +11 -0
- package/dist/configurators/qoder.d.ts.map +1 -0
- package/dist/configurators/qoder.js +31 -0
- package/dist/configurators/qoder.js.map +1 -0
- package/dist/configurators/shared.d.ts +178 -0
- package/dist/configurators/shared.d.ts.map +1 -0
- package/dist/configurators/shared.js +538 -0
- package/dist/configurators/shared.js.map +1 -0
- package/dist/configurators/windsurf.d.ts +7 -0
- package/dist/configurators/windsurf.d.ts.map +1 -0
- package/dist/configurators/windsurf.js +19 -0
- package/dist/configurators/windsurf.js.map +1 -0
- package/dist/configurators/workflow.d.ts +29 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +163 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/constants/paths.d.ts +70 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +79 -0
- package/dist/constants/paths.js.map +1 -0
- package/dist/constants/version.d.ts +9 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/constants/version.js +15 -0
- package/dist/constants/version.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.d.ts +62 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +187 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.9.json +30 -0
- package/dist/migrations/manifests/0.2.0.json +49 -0
- package/dist/migrations/manifests/0.2.12.json +9 -0
- package/dist/migrations/manifests/0.2.13.json +9 -0
- package/dist/migrations/manifests/0.2.14.json +175 -0
- package/dist/migrations/manifests/0.2.15.json +33 -0
- package/dist/migrations/manifests/0.3.0-beta.0.json +297 -0
- package/dist/migrations/manifests/0.3.0-beta.1.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.15.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.7.json +11 -0
- package/dist/migrations/manifests/0.3.0-beta.8.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.9.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.0.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.1.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.2.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.3.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.4.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.5.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.6.json +9 -0
- package/dist/migrations/manifests/0.3.0.json +11 -0
- package/dist/migrations/manifests/0.3.1.json +9 -0
- package/dist/migrations/manifests/0.3.10.json +9 -0
- package/dist/migrations/manifests/0.3.2.json +9 -0
- package/dist/migrations/manifests/0.3.3.json +9 -0
- package/dist/migrations/manifests/0.3.4.json +21 -0
- package/dist/migrations/manifests/0.3.5.json +9 -0
- package/dist/migrations/manifests/0.3.6.json +9 -0
- package/dist/migrations/manifests/0.3.7.json +9 -0
- package/dist/migrations/manifests/0.3.8.json +9 -0
- package/dist/migrations/manifests/0.3.9.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.1.json +228 -0
- package/dist/migrations/manifests/0.4.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.8.json +34 -0
- package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
- package/dist/migrations/manifests/0.4.0-rc.0.json +9 -0
- package/dist/migrations/manifests/0.4.0-rc.1.json +9 -0
- package/dist/migrations/manifests/0.4.0.json +9 -0
- 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.10.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.15.json +116 -0
- package/dist/migrations/manifests/0.5.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.17.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.18.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.19.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/migrations/manifests/0.5.0-rc.0.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.1.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.2.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.3.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.4.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.5.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.6.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.7.json +9 -0
- package/dist/migrations/manifests/0.5.0.json +9 -0
- package/dist/migrations/manifests/0.5.1.json +9 -0
- package/dist/migrations/manifests/0.5.10.json +9 -0
- package/dist/migrations/manifests/0.5.11.json +16 -0
- package/dist/migrations/manifests/0.5.12.json +9 -0
- package/dist/migrations/manifests/0.5.13.json +9 -0
- package/dist/migrations/manifests/0.5.14.json +9 -0
- package/dist/migrations/manifests/0.5.15.json +9 -0
- package/dist/migrations/manifests/0.5.16.json +9 -0
- package/dist/migrations/manifests/0.5.17.json +9 -0
- package/dist/migrations/manifests/0.5.18.json +9 -0
- package/dist/migrations/manifests/0.5.19.json +9 -0
- package/dist/migrations/manifests/0.5.2.json +9 -0
- package/dist/migrations/manifests/0.5.3.json +9 -0
- package/dist/migrations/manifests/0.5.4.json +9 -0
- package/dist/migrations/manifests/0.5.5.json +9 -0
- package/dist/migrations/manifests/0.5.6.json +9 -0
- package/dist/migrations/manifests/0.5.7.json +16 -0
- package/dist/migrations/manifests/0.5.8.json +9 -0
- package/dist/migrations/manifests/0.5.9.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.0.json +16 -0
- package/dist/migrations/manifests/0.6.0-beta.1.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.15.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.17.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.18.json +16 -0
- package/dist/migrations/manifests/0.6.0-beta.19.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.20.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.21.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.6.json +16 -0
- package/dist/migrations/manifests/0.6.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.8.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.9.json +9 -0
- package/dist/templates/claude/agents/trellis-check.md +109 -0
- package/dist/templates/claude/agents/trellis-implement.md +109 -0
- package/dist/templates/claude/agents/trellis-research.md +137 -0
- package/dist/templates/claude/index.d.ts +22 -0
- package/dist/templates/claude/index.d.ts.map +1 -0
- package/dist/templates/claude/index.js +46 -0
- package/dist/templates/claude/index.js.map +1 -0
- package/dist/templates/claude/settings.json +73 -0
- package/dist/templates/codebuddy/agents/trellis-check.md +109 -0
- package/dist/templates/codebuddy/agents/trellis-implement.md +109 -0
- package/dist/templates/codebuddy/agents/trellis-research.md +137 -0
- package/dist/templates/codebuddy/index.d.ts +15 -0
- package/dist/templates/codebuddy/index.d.ts.map +1 -0
- package/dist/templates/codebuddy/index.js +15 -0
- package/dist/templates/codebuddy/index.js.map +1 -0
- package/dist/templates/codebuddy/settings.json +59 -0
- package/dist/templates/codex/agents/trellis-check.toml +84 -0
- package/dist/templates/codex/agents/trellis-implement.toml +65 -0
- package/dist/templates/codex/agents/trellis-research.toml +73 -0
- package/dist/templates/codex/config.toml +28 -0
- package/dist/templates/codex/hooks/session-start.py +481 -0
- package/dist/templates/codex/hooks.json +15 -0
- package/dist/templates/codex/index.d.ts +39 -0
- package/dist/templates/codex/index.d.ts.map +1 -0
- package/dist/templates/codex/index.js +85 -0
- package/dist/templates/codex/index.js.map +1 -0
- package/dist/templates/codex/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +500 -0
- package/dist/templates/codex/skills/break-loop/SKILL.md +130 -0
- package/dist/templates/codex/skills/check/SKILL.md +30 -0
- package/dist/templates/codex/skills/check-cross-layer/SKILL.md +158 -0
- package/dist/templates/codex/skills/create-command/SKILL.md +101 -0
- package/dist/templates/codex/skills/finish-work/SKILL.md +90 -0
- package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
- package/dist/templates/codex/skills/integrate-skill/SKILL.md +221 -0
- package/dist/templates/codex/skills/onboard/SKILL.md +363 -0
- package/dist/templates/codex/skills/record-session/SKILL.md +67 -0
- package/dist/templates/codex/skills/start/SKILL.md +354 -0
- package/dist/templates/codex/skills/update-spec/SKILL.md +335 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +81 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +78 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +64 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +101 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +79 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +74 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/SKILL.md +41 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/mcp-setup.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/repository-analysis.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/spec-task-planning.md +61 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/spec-writing.md +70 -0
- package/dist/templates/common/commands/continue.md +55 -0
- package/dist/templates/common/commands/finish-work.md +66 -0
- package/dist/templates/common/commands/start.md +58 -0
- package/dist/templates/common/index.d.ts +48 -0
- package/dist/templates/common/index.d.ts.map +1 -0
- package/dist/templates/common/index.js +104 -0
- package/dist/templates/common/index.js.map +1 -0
- package/dist/templates/common/skills/before-dev.md +29 -0
- package/dist/templates/common/skills/brainstorm.md +543 -0
- package/dist/templates/common/skills/break-loop.md +125 -0
- package/dist/templates/common/skills/check.md +87 -0
- package/dist/templates/common/skills/update-spec.md +351 -0
- package/dist/templates/copilot/hooks/session-start.py +454 -0
- package/dist/templates/copilot/hooks.json +19 -0
- package/dist/templates/copilot/index.d.ts +23 -0
- package/dist/templates/copilot/index.d.ts.map +1 -0
- package/dist/templates/copilot/index.js +54 -0
- package/dist/templates/copilot/index.js.map +1 -0
- package/dist/templates/copilot/prompts/before-dev.prompt.md +33 -0
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +499 -0
- package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
- package/dist/templates/copilot/prompts/check.prompt.md +29 -0
- package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
- package/dist/templates/copilot/prompts/finish-work.prompt.md +99 -0
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
- package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
- package/dist/templates/copilot/prompts/parallel.prompt.md +196 -0
- package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
- package/dist/templates/copilot/prompts/start.prompt.md +397 -0
- package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
- package/dist/templates/cursor/agents/trellis-check.md +108 -0
- package/dist/templates/cursor/agents/trellis-implement.md +108 -0
- package/dist/templates/cursor/agents/trellis-research.md +136 -0
- package/dist/templates/cursor/hooks.json +24 -0
- package/dist/templates/cursor/index.d.ts +13 -0
- package/dist/templates/cursor/index.d.ts.map +1 -0
- package/dist/templates/cursor/index.js +13 -0
- package/dist/templates/cursor/index.js.map +1 -0
- package/dist/templates/droid/droids/trellis-check.md +101 -0
- package/dist/templates/droid/droids/trellis-implement.md +101 -0
- package/dist/templates/droid/droids/trellis-research.md +137 -0
- package/dist/templates/droid/index.d.ts +15 -0
- package/dist/templates/droid/index.d.ts.map +1 -0
- package/dist/templates/droid/index.js +15 -0
- package/dist/templates/droid/index.js.map +1 -0
- package/dist/templates/droid/settings.json +59 -0
- package/dist/templates/extract.d.ts +40 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +106 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/gemini/agents/trellis-check.md +101 -0
- package/dist/templates/gemini/agents/trellis-implement.md +101 -0
- package/dist/templates/gemini/agents/trellis-research.md +136 -0
- package/dist/templates/gemini/index.d.ts +13 -0
- package/dist/templates/gemini/index.d.ts.map +1 -0
- package/dist/templates/gemini/index.js +13 -0
- package/dist/templates/gemini/index.js.map +1 -0
- package/dist/templates/gemini/settings.json +28 -0
- package/dist/templates/kiro/agents/trellis-check.json +26 -0
- package/dist/templates/kiro/agents/trellis-implement.json +26 -0
- package/dist/templates/kiro/agents/trellis-research.json +30 -0
- package/dist/templates/kiro/index.d.ts +18 -0
- package/dist/templates/kiro/index.d.ts.map +1 -0
- package/dist/templates/kiro/index.js +18 -0
- package/dist/templates/kiro/index.js.map +1 -0
- package/dist/templates/markdown/agents.md +21 -0
- package/dist/templates/markdown/gitignore.txt +15 -0
- package/dist/templates/markdown/index.d.ts +27 -0
- package/dist/templates/markdown/index.d.ts.map +1 -0
- package/dist/templates/markdown/index.js +52 -0
- package/dist/templates/markdown/index.js.map +1 -0
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -0
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -0
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -0
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -0
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +105 -0
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +162 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +595 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +79 -0
- package/dist/templates/markdown/workspace-index.md +125 -0
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/dist/templates/opencode/agents/trellis-check.md +116 -0
- package/dist/templates/opencode/agents/trellis-implement.md +117 -0
- package/dist/templates/opencode/agents/trellis-research.md +145 -0
- package/dist/templates/opencode/lib/session-utils.js +432 -0
- package/dist/templates/opencode/lib/trellis-context.js +381 -0
- package/dist/templates/opencode/package.json +5 -0
- package/dist/templates/opencode/plugins/inject-subagent-context.js +497 -0
- package/dist/templates/opencode/plugins/inject-workflow-state.js +162 -0
- package/dist/templates/opencode/plugins/session-start.js +101 -0
- package/dist/templates/pi/agents/trellis-check.md +36 -0
- package/dist/templates/pi/agents/trellis-implement.md +41 -0
- package/dist/templates/pi/agents/trellis-research.md +25 -0
- package/dist/templates/pi/extensions/trellis/index.ts.txt +1172 -0
- package/dist/templates/pi/index.d.ts +5 -0
- package/dist/templates/pi/index.d.ts.map +1 -0
- package/dist/templates/pi/index.js +12 -0
- package/dist/templates/pi/index.js.map +1 -0
- package/dist/templates/pi/settings.json +21 -0
- package/dist/templates/qoder/agents/trellis-check.md +102 -0
- package/dist/templates/qoder/agents/trellis-implement.md +102 -0
- package/dist/templates/qoder/agents/trellis-research.md +137 -0
- package/dist/templates/qoder/index.d.ts +15 -0
- package/dist/templates/qoder/index.d.ts.map +1 -0
- package/dist/templates/qoder/index.js +15 -0
- package/dist/templates/qoder/index.js.map +1 -0
- package/dist/templates/qoder/settings.json +47 -0
- package/dist/templates/shared-hooks/index.d.ts +50 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -0
- package/dist/templates/shared-hooks/index.js +88 -0
- package/dist/templates/shared-hooks/index.js.map +1 -0
- package/dist/templates/shared-hooks/inject-shell-session-context.py +183 -0
- package/dist/templates/shared-hooks/inject-subagent-context.py +749 -0
- package/dist/templates/shared-hooks/inject-workflow-state.py +387 -0
- package/dist/templates/shared-hooks/session-start.py +797 -0
- 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 +90 -0
- package/dist/templates/trellis/gitignore.txt +32 -0
- package/dist/templates/trellis/index.d.ts +52 -0
- package/dist/templates/trellis/index.d.ts.map +1 -0
- package/dist/templates/trellis/index.js +97 -0
- package/dist/templates/trellis/index.js.map +1 -0
- package/dist/templates/trellis/scripts/__init__.py +5 -0
- package/dist/templates/trellis/scripts/add_session.py +547 -0
- package/dist/templates/trellis/scripts/common/__init__.py +92 -0
- package/dist/templates/trellis/scripts/common/active_task.py +626 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +811 -0
- package/dist/templates/trellis/scripts/common/config.py +445 -0
- package/dist/templates/trellis/scripts/common/developer.py +190 -0
- package/dist/templates/trellis/scripts/common/git.py +31 -0
- package/dist/templates/trellis/scripts/common/git_context.py +106 -0
- package/dist/templates/trellis/scripts/common/io.py +37 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +238 -0
- package/dist/templates/trellis/scripts/common/paths.py +447 -0
- package/dist/templates/trellis/scripts/common/safe_commit.py +285 -0
- package/dist/templates/trellis/scripts/common/session_context.py +821 -0
- package/dist/templates/trellis/scripts/common/task_context.py +223 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +188 -0
- package/dist/templates/trellis/scripts/common/task_store.py +697 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +274 -0
- package/dist/templates/trellis/scripts/common/tasks.py +112 -0
- package/dist/templates/trellis/scripts/common/trellis_config.py +131 -0
- package/dist/templates/trellis/scripts/common/types.py +110 -0
- package/dist/templates/trellis/scripts/common/workflow_phase.py +215 -0
- package/dist/templates/trellis/scripts/get_context.py +16 -0
- package/dist/templates/trellis/scripts/get_developer.py +26 -0
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/trellis/scripts/init_developer.py +51 -0
- package/dist/templates/trellis/scripts/task.py +500 -0
- package/dist/templates/trellis/tasks/.gitkeep +0 -0
- package/dist/templates/trellis/workflow.md +690 -0
- package/dist/types/ai-tools.d.ts +95 -0
- package/dist/types/ai-tools.d.ts.map +1 -0
- package/dist/types/ai-tools.js +280 -0
- package/dist/types/ai-tools.js.map +1 -0
- package/dist/types/migration.d.ts +125 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +8 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/utils/compare-versions.d.ts +12 -0
- package/dist/utils/compare-versions.d.ts.map +1 -0
- package/dist/utils/compare-versions.js +86 -0
- package/dist/utils/compare-versions.js.map +1 -0
- package/dist/utils/cwd-guard.d.ts +38 -0
- package/dist/utils/cwd-guard.d.ts.map +1 -0
- package/dist/utils/cwd-guard.js +62 -0
- package/dist/utils/cwd-guard.js.map +1 -0
- package/dist/utils/file-writer.d.ts +36 -0
- package/dist/utils/file-writer.d.ts.map +1 -0
- package/dist/utils/file-writer.js +203 -0
- package/dist/utils/file-writer.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +61 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -0
- package/dist/utils/manifest-prune.js +136 -0
- package/dist/utils/manifest-prune.js.map +1 -0
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/project-detector.d.ts +46 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +666 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/proxy.d.ts +25 -0
- package/dist/utils/proxy.d.ts.map +1 -0
- package/dist/utils/proxy.js +60 -0
- package/dist/utils/proxy.js.map +1 -0
- 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/dist/utils/template-fetcher.d.ts +150 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -0
- package/dist/utils/template-fetcher.js +907 -0
- package/dist/utils/template-fetcher.js.map +1 -0
- package/dist/utils/template-hash.d.ts +123 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +334 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts +66 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -0
- package/dist/utils/uninstall-scrubbers.js +342 -0
- package/dist/utils/uninstall-scrubbers.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Task CRUD operations.
|
|
4
|
+
|
|
5
|
+
Provides:
|
|
6
|
+
ensure_tasks_dir - Ensure tasks directory exists
|
|
7
|
+
cmd_create - Create a new task
|
|
8
|
+
cmd_archive - Archive completed task
|
|
9
|
+
cmd_set_branch - Set git branch for task
|
|
10
|
+
cmd_set_base_branch - Set PR target branch
|
|
11
|
+
cmd_set_scope - Set scope for PR title
|
|
12
|
+
cmd_add_subtask - Link child task to parent
|
|
13
|
+
cmd_remove_subtask - Unlink child task from parent
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import argparse
|
|
19
|
+
import json
|
|
20
|
+
import re
|
|
21
|
+
import sys
|
|
22
|
+
from datetime import datetime
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
|
|
25
|
+
from .config import (
|
|
26
|
+
get_packages,
|
|
27
|
+
get_session_auto_commit,
|
|
28
|
+
is_monorepo,
|
|
29
|
+
resolve_package,
|
|
30
|
+
validate_package,
|
|
31
|
+
)
|
|
32
|
+
from .git import run_git
|
|
33
|
+
from .io import read_json, write_json
|
|
34
|
+
from .log import Colors, colored
|
|
35
|
+
from .paths import (
|
|
36
|
+
DIR_ARCHIVE,
|
|
37
|
+
DIR_TASKS,
|
|
38
|
+
DIR_WORKFLOW,
|
|
39
|
+
FILE_TASK_JSON,
|
|
40
|
+
generate_task_date_prefix,
|
|
41
|
+
get_developer,
|
|
42
|
+
get_repo_root,
|
|
43
|
+
get_tasks_dir,
|
|
44
|
+
)
|
|
45
|
+
from .safe_commit import (
|
|
46
|
+
print_gitignore_warning,
|
|
47
|
+
safe_archive_paths_to_add,
|
|
48
|
+
safe_git_add,
|
|
49
|
+
)
|
|
50
|
+
from .task_utils import (
|
|
51
|
+
archive_task_complete,
|
|
52
|
+
find_task_by_name,
|
|
53
|
+
resolve_task_dir,
|
|
54
|
+
run_task_hooks,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# =============================================================================
|
|
59
|
+
# Helper Functions
|
|
60
|
+
# =============================================================================
|
|
61
|
+
|
|
62
|
+
def _slugify(title: str) -> str:
|
|
63
|
+
"""Convert title to slug (only works with ASCII)."""
|
|
64
|
+
result = title.lower()
|
|
65
|
+
result = re.sub(r"[^a-z0-9]", "-", result)
|
|
66
|
+
result = re.sub(r"-+", "-", result)
|
|
67
|
+
result = result.strip("-")
|
|
68
|
+
return result
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def ensure_tasks_dir(repo_root: Path) -> Path:
|
|
72
|
+
"""Ensure tasks directory exists."""
|
|
73
|
+
tasks_dir = get_tasks_dir(repo_root)
|
|
74
|
+
archive_dir = tasks_dir / "archive"
|
|
75
|
+
|
|
76
|
+
if not tasks_dir.exists():
|
|
77
|
+
tasks_dir.mkdir(parents=True)
|
|
78
|
+
print(colored(f"Created tasks directory: {tasks_dir}", Colors.GREEN), file=sys.stderr)
|
|
79
|
+
|
|
80
|
+
if not archive_dir.exists():
|
|
81
|
+
archive_dir.mkdir(parents=True)
|
|
82
|
+
|
|
83
|
+
return tasks_dir
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _find_archived_task_by_dir_name(tasks_dir: Path, dir_name: str) -> Path | None:
|
|
87
|
+
"""Find an archived task directory with the exact active-task dir name."""
|
|
88
|
+
archive_dir = tasks_dir / DIR_ARCHIVE
|
|
89
|
+
if not archive_dir.is_dir():
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
for month_dir in sorted(archive_dir.iterdir()):
|
|
93
|
+
if not month_dir.is_dir():
|
|
94
|
+
continue
|
|
95
|
+
candidate = month_dir / dir_name
|
|
96
|
+
if candidate.is_dir():
|
|
97
|
+
return candidate
|
|
98
|
+
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _repo_relative_path(path: Path, repo_root: Path) -> str:
|
|
103
|
+
"""Format a path relative to the repo root when possible."""
|
|
104
|
+
try:
|
|
105
|
+
return path.relative_to(repo_root).as_posix()
|
|
106
|
+
except ValueError:
|
|
107
|
+
return str(path)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# =============================================================================
|
|
111
|
+
# Sub-agent platform detection + JSONL seeding
|
|
112
|
+
# =============================================================================
|
|
113
|
+
|
|
114
|
+
# Config directories of platforms that consume implement.jsonl / check.jsonl.
|
|
115
|
+
# Keep in sync with src/types/ai-tools.ts AI_TOOLS entries — these are the
|
|
116
|
+
# platforms listed in workflow.md's "agent-capable" Skill Routing block
|
|
117
|
+
# (Class-1 hook-inject + Class-2 pull-based preludes). Kilo / Antigravity /
|
|
118
|
+
# Windsurf are NOT in this list: they do not consume JSONL.
|
|
119
|
+
_SUBAGENT_CONFIG_DIRS: tuple[str, ...] = (
|
|
120
|
+
".claude",
|
|
121
|
+
".cursor",
|
|
122
|
+
".codex",
|
|
123
|
+
".kiro",
|
|
124
|
+
".gemini",
|
|
125
|
+
".opencode",
|
|
126
|
+
".qoder",
|
|
127
|
+
".codebuddy",
|
|
128
|
+
".factory", # Factory Droid
|
|
129
|
+
".github/copilot",
|
|
130
|
+
".pi", # Pi Agent
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
_SEED_EXAMPLE = (
|
|
134
|
+
"Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. "
|
|
135
|
+
"Put spec/research files only — no code paths. "
|
|
136
|
+
"Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. "
|
|
137
|
+
"Delete this line once real entries are added."
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def _has_subagent_platform(repo_root: Path) -> bool:
|
|
142
|
+
"""Return True if any sub-agent-capable platform is configured.
|
|
143
|
+
|
|
144
|
+
Detected by probing well-known config directories at the repo root. Used
|
|
145
|
+
only to decide whether ``task.py create`` should seed empty
|
|
146
|
+
``implement.jsonl`` / ``check.jsonl`` files.
|
|
147
|
+
"""
|
|
148
|
+
for config_dir in _SUBAGENT_CONFIG_DIRS:
|
|
149
|
+
if (repo_root / config_dir).is_dir():
|
|
150
|
+
return True
|
|
151
|
+
return False
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _write_seed_jsonl(path: Path) -> None:
|
|
155
|
+
"""Write a one-line seed JSONL file with a self-describing ``_example``.
|
|
156
|
+
|
|
157
|
+
The seed row has no ``file`` field, so downstream consumers (hooks +
|
|
158
|
+
preludes) that iterate entries via ``item.get("file")`` naturally skip
|
|
159
|
+
it. The row exists purely as an in-file prompt for the AI curator.
|
|
160
|
+
"""
|
|
161
|
+
seed = {"_example": _SEED_EXAMPLE}
|
|
162
|
+
path.write_text(json.dumps(seed, ensure_ascii=False) + "\n", encoding="utf-8")
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# =============================================================================
|
|
166
|
+
# Command: create
|
|
167
|
+
# =============================================================================
|
|
168
|
+
|
|
169
|
+
def cmd_create(args: argparse.Namespace) -> int:
|
|
170
|
+
"""Create a new task."""
|
|
171
|
+
repo_root = get_repo_root()
|
|
172
|
+
|
|
173
|
+
if not args.title:
|
|
174
|
+
print(colored("Error: title is required", Colors.RED), file=sys.stderr)
|
|
175
|
+
return 1
|
|
176
|
+
|
|
177
|
+
# Validate --package (CLI source: fail-fast)
|
|
178
|
+
package: str | None = getattr(args, "package", None)
|
|
179
|
+
if not is_monorepo(repo_root):
|
|
180
|
+
# Single-repo: ignore --package, no package prefix
|
|
181
|
+
if package:
|
|
182
|
+
print(colored(f"Warning: --package ignored in single-repo project", Colors.YELLOW), file=sys.stderr)
|
|
183
|
+
package = None
|
|
184
|
+
elif package:
|
|
185
|
+
if not validate_package(package, repo_root):
|
|
186
|
+
packages = get_packages(repo_root)
|
|
187
|
+
available = ", ".join(sorted(packages.keys())) if packages else "(none)"
|
|
188
|
+
print(colored(f"Error: unknown package '{package}'. Available: {available}", Colors.RED), file=sys.stderr)
|
|
189
|
+
return 1
|
|
190
|
+
else:
|
|
191
|
+
# Inferred: default_package → None (no task.json yet for create)
|
|
192
|
+
package = resolve_package(repo_root=repo_root)
|
|
193
|
+
|
|
194
|
+
# Default assignee to current developer
|
|
195
|
+
assignee = args.assignee
|
|
196
|
+
if not assignee:
|
|
197
|
+
assignee = get_developer(repo_root)
|
|
198
|
+
if not assignee:
|
|
199
|
+
print(colored("Error: No developer set. Run init_developer.py first or use --assignee", Colors.RED), file=sys.stderr)
|
|
200
|
+
return 1
|
|
201
|
+
|
|
202
|
+
ensure_tasks_dir(repo_root)
|
|
203
|
+
|
|
204
|
+
# Get current developer as creator
|
|
205
|
+
creator = get_developer(repo_root) or assignee
|
|
206
|
+
|
|
207
|
+
# Generate slug if not provided
|
|
208
|
+
slug = args.slug or _slugify(args.title)
|
|
209
|
+
if not slug:
|
|
210
|
+
print(colored("Error: could not generate slug from title", Colors.RED), file=sys.stderr)
|
|
211
|
+
return 1
|
|
212
|
+
|
|
213
|
+
# Create task directory with MM-DD-slug format
|
|
214
|
+
tasks_dir = get_tasks_dir(repo_root)
|
|
215
|
+
date_prefix = generate_task_date_prefix()
|
|
216
|
+
dir_name = f"{date_prefix}-{slug}"
|
|
217
|
+
task_dir = tasks_dir / dir_name
|
|
218
|
+
task_json_path = task_dir / FILE_TASK_JSON
|
|
219
|
+
|
|
220
|
+
archived_task_dir = _find_archived_task_by_dir_name(tasks_dir, dir_name)
|
|
221
|
+
if archived_task_dir:
|
|
222
|
+
print(colored(f"Error: Task already archived: {dir_name}", Colors.RED), file=sys.stderr)
|
|
223
|
+
print(f"Archived at: {_repo_relative_path(archived_task_dir, repo_root)}", file=sys.stderr)
|
|
224
|
+
print("Use a new slug if you intend to create a new task.", file=sys.stderr)
|
|
225
|
+
return 1
|
|
226
|
+
|
|
227
|
+
if task_dir.exists():
|
|
228
|
+
print(colored(f"Warning: Task directory already exists: {dir_name}", Colors.YELLOW), file=sys.stderr)
|
|
229
|
+
else:
|
|
230
|
+
task_dir.mkdir(parents=True)
|
|
231
|
+
|
|
232
|
+
today = datetime.now().strftime("%Y-%m-%d")
|
|
233
|
+
|
|
234
|
+
# Record current branch as base_branch (PR target)
|
|
235
|
+
_, branch_out, _ = run_git(["branch", "--show-current"], cwd=repo_root)
|
|
236
|
+
current_branch = branch_out.strip() or "main"
|
|
237
|
+
|
|
238
|
+
task_data = {
|
|
239
|
+
"id": slug,
|
|
240
|
+
"name": slug,
|
|
241
|
+
"title": args.title,
|
|
242
|
+
"description": args.description or "",
|
|
243
|
+
"status": "planning",
|
|
244
|
+
"dev_type": None,
|
|
245
|
+
"scope": None,
|
|
246
|
+
"package": package,
|
|
247
|
+
"priority": args.priority,
|
|
248
|
+
"creator": creator,
|
|
249
|
+
"assignee": assignee,
|
|
250
|
+
"createdAt": today,
|
|
251
|
+
"completedAt": None,
|
|
252
|
+
"branch": None,
|
|
253
|
+
"base_branch": current_branch,
|
|
254
|
+
"worktree_path": None,
|
|
255
|
+
"commit": None,
|
|
256
|
+
"pr_url": None,
|
|
257
|
+
"subtasks": [],
|
|
258
|
+
"children": [],
|
|
259
|
+
"parent": None,
|
|
260
|
+
"relatedFiles": [],
|
|
261
|
+
"notes": "",
|
|
262
|
+
"meta": {},
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
write_json(task_json_path, task_data)
|
|
266
|
+
|
|
267
|
+
# Seed implement.jsonl / check.jsonl for sub-agent-capable platforms.
|
|
268
|
+
# Agent curates real entries in Phase 1.3 (see .trellis/workflow.md).
|
|
269
|
+
# Agent-less platforms (Kilo / Antigravity / Windsurf) skip this — they
|
|
270
|
+
# load specs via the trellis-before-dev skill instead of JSONL.
|
|
271
|
+
seeded_jsonl = False
|
|
272
|
+
if _has_subagent_platform(repo_root):
|
|
273
|
+
for jsonl_name in ("implement.jsonl", "check.jsonl"):
|
|
274
|
+
jsonl_path = task_dir / jsonl_name
|
|
275
|
+
if not jsonl_path.exists():
|
|
276
|
+
_write_seed_jsonl(jsonl_path)
|
|
277
|
+
seeded_jsonl = True
|
|
278
|
+
|
|
279
|
+
# Handle --parent: establish bidirectional link
|
|
280
|
+
if args.parent:
|
|
281
|
+
parent_dir = resolve_task_dir(args.parent, repo_root)
|
|
282
|
+
parent_json_path = parent_dir / FILE_TASK_JSON
|
|
283
|
+
if not parent_json_path.is_file():
|
|
284
|
+
print(colored(f"Warning: Parent task.json not found: {args.parent}", Colors.YELLOW), file=sys.stderr)
|
|
285
|
+
else:
|
|
286
|
+
parent_data = read_json(parent_json_path)
|
|
287
|
+
if parent_data:
|
|
288
|
+
# Add child to parent's children list
|
|
289
|
+
parent_children = parent_data.get("children", [])
|
|
290
|
+
if dir_name not in parent_children:
|
|
291
|
+
parent_children.append(dir_name)
|
|
292
|
+
parent_data["children"] = parent_children
|
|
293
|
+
write_json(parent_json_path, parent_data)
|
|
294
|
+
|
|
295
|
+
# Set parent in child's task.json
|
|
296
|
+
task_data["parent"] = parent_dir.name
|
|
297
|
+
write_json(task_json_path, task_data)
|
|
298
|
+
|
|
299
|
+
print(colored(f"Linked as child of: {parent_dir.name}", Colors.GREEN), file=sys.stderr)
|
|
300
|
+
|
|
301
|
+
# Auto-activate the new task so the per-turn breadcrumb fires planning
|
|
302
|
+
# state. Best-effort: gracefully degrade if no session identity (CLI run
|
|
303
|
+
# outside an AI session) — the task is still created, the user can run
|
|
304
|
+
# task.py start later. Pointer is session-scoped so this never affects
|
|
305
|
+
# other AI sessions.
|
|
306
|
+
try:
|
|
307
|
+
from .active_task import resolve_context_key, set_active_task
|
|
308
|
+
if resolve_context_key():
|
|
309
|
+
try:
|
|
310
|
+
rel_dir = task_dir.relative_to(repo_root).as_posix()
|
|
311
|
+
except ValueError:
|
|
312
|
+
rel_dir = str(task_dir)
|
|
313
|
+
set_active_task(rel_dir, repo_root)
|
|
314
|
+
except Exception:
|
|
315
|
+
pass
|
|
316
|
+
|
|
317
|
+
print(colored(f"Created task: {dir_name}", Colors.GREEN), file=sys.stderr)
|
|
318
|
+
print("", file=sys.stderr)
|
|
319
|
+
print(colored("Next steps:", Colors.BLUE), file=sys.stderr)
|
|
320
|
+
print(" 1. Create prd.md with requirements", file=sys.stderr)
|
|
321
|
+
if seeded_jsonl:
|
|
322
|
+
print(
|
|
323
|
+
" 2. Curate implement.jsonl / check.jsonl (spec + research files only — "
|
|
324
|
+
"see .trellis/workflow.md Phase 1.3)",
|
|
325
|
+
file=sys.stderr,
|
|
326
|
+
)
|
|
327
|
+
print(" 3. Run: python3 task.py start <dir>", file=sys.stderr)
|
|
328
|
+
else:
|
|
329
|
+
print(" 2. Run: python3 task.py start <dir>", file=sys.stderr)
|
|
330
|
+
print("", file=sys.stderr)
|
|
331
|
+
|
|
332
|
+
# Output relative path for script chaining
|
|
333
|
+
print(f"{DIR_WORKFLOW}/{DIR_TASKS}/{dir_name}")
|
|
334
|
+
|
|
335
|
+
run_task_hooks("after_create", task_json_path, repo_root)
|
|
336
|
+
return 0
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
# =============================================================================
|
|
340
|
+
# Command: archive
|
|
341
|
+
# =============================================================================
|
|
342
|
+
|
|
343
|
+
def cmd_archive(args: argparse.Namespace) -> int:
|
|
344
|
+
"""Archive completed task."""
|
|
345
|
+
repo_root = get_repo_root()
|
|
346
|
+
task_name = args.name
|
|
347
|
+
|
|
348
|
+
if not task_name:
|
|
349
|
+
print(colored("Error: Task name is required", Colors.RED), file=sys.stderr)
|
|
350
|
+
return 1
|
|
351
|
+
|
|
352
|
+
tasks_dir = get_tasks_dir(repo_root)
|
|
353
|
+
|
|
354
|
+
# Resolve task directory (supports task name, relative path, or absolute path)
|
|
355
|
+
task_dir = resolve_task_dir(task_name, repo_root)
|
|
356
|
+
|
|
357
|
+
if not task_dir or not task_dir.is_dir():
|
|
358
|
+
print(colored(f"Error: Task not found: {task_name}", Colors.RED), file=sys.stderr)
|
|
359
|
+
print("Active tasks:", file=sys.stderr)
|
|
360
|
+
# Import lazily to avoid circular dependency
|
|
361
|
+
from .tasks import iter_active_tasks
|
|
362
|
+
for t in iter_active_tasks(tasks_dir):
|
|
363
|
+
print(f" - {t.dir_name}/", file=sys.stderr)
|
|
364
|
+
return 1
|
|
365
|
+
|
|
366
|
+
dir_name = task_dir.name
|
|
367
|
+
task_json_path = task_dir / FILE_TASK_JSON
|
|
368
|
+
|
|
369
|
+
# Update status before archiving
|
|
370
|
+
today = datetime.now().strftime("%Y-%m-%d")
|
|
371
|
+
# Names of child task dirs whose task.json gets modified below; passed
|
|
372
|
+
# into safe_archive_paths_to_add so they're staged in this commit.
|
|
373
|
+
modified_children: list[str] = []
|
|
374
|
+
if task_json_path.is_file():
|
|
375
|
+
data = read_json(task_json_path)
|
|
376
|
+
if data:
|
|
377
|
+
data["status"] = "completed"
|
|
378
|
+
data["completedAt"] = today
|
|
379
|
+
write_json(task_json_path, data)
|
|
380
|
+
|
|
381
|
+
# Handle subtask relationships on archive.
|
|
382
|
+
# Keep this task in its parent's children list so progress
|
|
383
|
+
# counters (children_progress) stay consistent — children
|
|
384
|
+
# missing from the active set are treated as completed.
|
|
385
|
+
task_children = data.get("children", [])
|
|
386
|
+
|
|
387
|
+
# If this is a parent, clear parent field in all children
|
|
388
|
+
if task_children:
|
|
389
|
+
for child_name in task_children:
|
|
390
|
+
child_dir_path = find_task_by_name(child_name, tasks_dir)
|
|
391
|
+
if child_dir_path:
|
|
392
|
+
child_json = child_dir_path / FILE_TASK_JSON
|
|
393
|
+
if child_json.is_file():
|
|
394
|
+
child_data = read_json(child_json)
|
|
395
|
+
if child_data:
|
|
396
|
+
child_data["parent"] = None
|
|
397
|
+
write_json(child_json, child_data)
|
|
398
|
+
modified_children.append(child_dir_path.name)
|
|
399
|
+
|
|
400
|
+
# Clear any session that still points at this task before the path moves.
|
|
401
|
+
from .active_task import clear_task_from_sessions
|
|
402
|
+
clear_task_from_sessions(str(task_dir), repo_root)
|
|
403
|
+
|
|
404
|
+
# Archive
|
|
405
|
+
result = archive_task_complete(task_dir, repo_root)
|
|
406
|
+
if "archived_to" in result:
|
|
407
|
+
archive_dest = Path(result["archived_to"])
|
|
408
|
+
year_month = archive_dest.parent.name
|
|
409
|
+
print(colored(f"Archived: {dir_name} -> archive/{year_month}/", Colors.GREEN), file=sys.stderr)
|
|
410
|
+
|
|
411
|
+
# Auto-commit unless --no-commit
|
|
412
|
+
if not getattr(args, "no_commit", False):
|
|
413
|
+
_auto_commit_archive(dir_name, repo_root, modified_children)
|
|
414
|
+
|
|
415
|
+
# Return the archive path
|
|
416
|
+
print(f"{DIR_WORKFLOW}/{DIR_TASKS}/{DIR_ARCHIVE}/{year_month}/{dir_name}")
|
|
417
|
+
|
|
418
|
+
# Run hooks with the archived path
|
|
419
|
+
archived_json = archive_dest / FILE_TASK_JSON
|
|
420
|
+
run_task_hooks("after_archive", archived_json, repo_root)
|
|
421
|
+
return 0
|
|
422
|
+
|
|
423
|
+
return 1
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def _auto_commit_archive(
|
|
427
|
+
task_name: str,
|
|
428
|
+
repo_root: Path,
|
|
429
|
+
modified_children: list[str] | None = None,
|
|
430
|
+
) -> None:
|
|
431
|
+
"""Stage Trellis-owned task paths and commit after archive.
|
|
432
|
+
|
|
433
|
+
Scoped narrowly to the archived task's source + destination paths
|
|
434
|
+
plus any child task dirs whose ``task.json`` was edited (parent →
|
|
435
|
+
children relationship update). Dirty changes in OTHER active task
|
|
436
|
+
dirs are NOT bundled into the archive commit.
|
|
437
|
+
|
|
438
|
+
If ``.gitignore`` blocks the paths, we warn + skip — we do NOT
|
|
439
|
+
retry with ``git add -f``. The warning explicitly forbids
|
|
440
|
+
``git add -f .trellis/`` (which would fan out to caches/backups)
|
|
441
|
+
and points users at ``session_auto_commit: false``.
|
|
442
|
+
|
|
443
|
+
Honors ``session_auto_commit`` in ``.trellis/config.yaml``: when
|
|
444
|
+
set to ``false``, this function returns immediately without
|
|
445
|
+
touching git (the archive directory move on disk is unaffected).
|
|
446
|
+
"""
|
|
447
|
+
if not get_session_auto_commit(repo_root):
|
|
448
|
+
print(
|
|
449
|
+
"[OK] session_auto_commit: false — skipping git stage/commit.",
|
|
450
|
+
file=sys.stderr,
|
|
451
|
+
)
|
|
452
|
+
return
|
|
453
|
+
|
|
454
|
+
paths = safe_archive_paths_to_add(
|
|
455
|
+
repo_root, task_name=task_name, modified_children=modified_children
|
|
456
|
+
)
|
|
457
|
+
if not paths:
|
|
458
|
+
print("[OK] No task changes to commit.", file=sys.stderr)
|
|
459
|
+
return
|
|
460
|
+
|
|
461
|
+
success, _, err = safe_git_add(paths, repo_root)
|
|
462
|
+
if not success:
|
|
463
|
+
if err and "ignored by" in err.lower():
|
|
464
|
+
print_gitignore_warning(paths)
|
|
465
|
+
else:
|
|
466
|
+
print(
|
|
467
|
+
f"[WARN] git add failed: {err.strip() if err else 'unknown error'}",
|
|
468
|
+
file=sys.stderr,
|
|
469
|
+
)
|
|
470
|
+
return
|
|
471
|
+
|
|
472
|
+
# Belt-and-suspenders for the phantom-delete bug: `safe_git_add` uses
|
|
473
|
+
# `git add` (no -A) which only stages additions/modifications. The
|
|
474
|
+
# source task directory was moved away by `shutil.move`, so its files
|
|
475
|
+
# need an explicit `git rm --cached` to stage the deletions in this
|
|
476
|
+
# same commit — otherwise they sit as uncommitted "phantom deletes"
|
|
477
|
+
# against HEAD until something later picks them up.
|
|
478
|
+
#
|
|
479
|
+
# `--ignore-unmatch` makes this a no-op when the task was never tracked
|
|
480
|
+
# (e.g. archiving a task that lived only in working tree).
|
|
481
|
+
source_rel = f"{DIR_WORKFLOW}/{DIR_TASKS}/{task_name}"
|
|
482
|
+
run_git(
|
|
483
|
+
["rm", "-r", "--cached", "--ignore-unmatch", "--", source_rel],
|
|
484
|
+
cwd=repo_root,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
rc, _, _ = run_git(
|
|
488
|
+
["diff", "--cached", "--quiet", "--", *paths, source_rel],
|
|
489
|
+
cwd=repo_root,
|
|
490
|
+
)
|
|
491
|
+
if rc == 0:
|
|
492
|
+
print("[OK] No task changes to commit.", file=sys.stderr)
|
|
493
|
+
return
|
|
494
|
+
|
|
495
|
+
commit_msg = f"chore(task): archive {task_name}"
|
|
496
|
+
rc, _, err = run_git(["commit", "-m", commit_msg], cwd=repo_root)
|
|
497
|
+
if rc == 0:
|
|
498
|
+
print(f"[OK] Auto-committed: {commit_msg}", file=sys.stderr)
|
|
499
|
+
else:
|
|
500
|
+
print(f"[WARN] Auto-commit failed: {err.strip()}", file=sys.stderr)
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
# =============================================================================
|
|
504
|
+
# Command: add-subtask
|
|
505
|
+
# =============================================================================
|
|
506
|
+
|
|
507
|
+
def cmd_add_subtask(args: argparse.Namespace) -> int:
|
|
508
|
+
"""Link a child task to a parent task."""
|
|
509
|
+
repo_root = get_repo_root()
|
|
510
|
+
|
|
511
|
+
parent_dir = resolve_task_dir(args.parent_dir, repo_root)
|
|
512
|
+
child_dir = resolve_task_dir(args.child_dir, repo_root)
|
|
513
|
+
|
|
514
|
+
parent_json_path = parent_dir / FILE_TASK_JSON
|
|
515
|
+
child_json_path = child_dir / FILE_TASK_JSON
|
|
516
|
+
|
|
517
|
+
if not parent_json_path.is_file():
|
|
518
|
+
print(colored(f"Error: Parent task.json not found: {args.parent_dir}", Colors.RED), file=sys.stderr)
|
|
519
|
+
return 1
|
|
520
|
+
|
|
521
|
+
if not child_json_path.is_file():
|
|
522
|
+
print(colored(f"Error: Child task.json not found: {args.child_dir}", Colors.RED), file=sys.stderr)
|
|
523
|
+
return 1
|
|
524
|
+
|
|
525
|
+
parent_data = read_json(parent_json_path)
|
|
526
|
+
child_data = read_json(child_json_path)
|
|
527
|
+
|
|
528
|
+
if not parent_data or not child_data:
|
|
529
|
+
print(colored("Error: Failed to read task.json", Colors.RED), file=sys.stderr)
|
|
530
|
+
return 1
|
|
531
|
+
|
|
532
|
+
# Check if child already has a parent
|
|
533
|
+
existing_parent = child_data.get("parent")
|
|
534
|
+
if existing_parent:
|
|
535
|
+
print(colored(f"Error: Child task already has a parent: {existing_parent}", Colors.RED), file=sys.stderr)
|
|
536
|
+
return 1
|
|
537
|
+
|
|
538
|
+
# Add child to parent's children list
|
|
539
|
+
parent_children = parent_data.get("children", [])
|
|
540
|
+
child_dir_name = child_dir.name
|
|
541
|
+
if child_dir_name not in parent_children:
|
|
542
|
+
parent_children.append(child_dir_name)
|
|
543
|
+
parent_data["children"] = parent_children
|
|
544
|
+
|
|
545
|
+
# Set parent in child's task.json
|
|
546
|
+
child_data["parent"] = parent_dir.name
|
|
547
|
+
|
|
548
|
+
# Write both
|
|
549
|
+
write_json(parent_json_path, parent_data)
|
|
550
|
+
write_json(child_json_path, child_data)
|
|
551
|
+
|
|
552
|
+
print(colored(f"Linked: {child_dir.name} -> {parent_dir.name}", Colors.GREEN), file=sys.stderr)
|
|
553
|
+
return 0
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
# =============================================================================
|
|
557
|
+
# Command: remove-subtask
|
|
558
|
+
# =============================================================================
|
|
559
|
+
|
|
560
|
+
def cmd_remove_subtask(args: argparse.Namespace) -> int:
|
|
561
|
+
"""Unlink a child task from a parent task."""
|
|
562
|
+
repo_root = get_repo_root()
|
|
563
|
+
|
|
564
|
+
parent_dir = resolve_task_dir(args.parent_dir, repo_root)
|
|
565
|
+
child_dir = resolve_task_dir(args.child_dir, repo_root)
|
|
566
|
+
|
|
567
|
+
parent_json_path = parent_dir / FILE_TASK_JSON
|
|
568
|
+
child_json_path = child_dir / FILE_TASK_JSON
|
|
569
|
+
|
|
570
|
+
if not parent_json_path.is_file():
|
|
571
|
+
print(colored(f"Error: Parent task.json not found: {args.parent_dir}", Colors.RED), file=sys.stderr)
|
|
572
|
+
return 1
|
|
573
|
+
|
|
574
|
+
if not child_json_path.is_file():
|
|
575
|
+
print(colored(f"Error: Child task.json not found: {args.child_dir}", Colors.RED), file=sys.stderr)
|
|
576
|
+
return 1
|
|
577
|
+
|
|
578
|
+
parent_data = read_json(parent_json_path)
|
|
579
|
+
child_data = read_json(child_json_path)
|
|
580
|
+
|
|
581
|
+
if not parent_data or not child_data:
|
|
582
|
+
print(colored("Error: Failed to read task.json", Colors.RED), file=sys.stderr)
|
|
583
|
+
return 1
|
|
584
|
+
|
|
585
|
+
# Remove child from parent's children list
|
|
586
|
+
parent_children = parent_data.get("children", [])
|
|
587
|
+
child_dir_name = child_dir.name
|
|
588
|
+
if child_dir_name in parent_children:
|
|
589
|
+
parent_children.remove(child_dir_name)
|
|
590
|
+
parent_data["children"] = parent_children
|
|
591
|
+
|
|
592
|
+
# Clear parent in child's task.json
|
|
593
|
+
child_data["parent"] = None
|
|
594
|
+
|
|
595
|
+
# Write both
|
|
596
|
+
write_json(parent_json_path, parent_data)
|
|
597
|
+
write_json(child_json_path, child_data)
|
|
598
|
+
|
|
599
|
+
print(colored(f"Unlinked: {child_dir.name} from {parent_dir.name}", Colors.GREEN), file=sys.stderr)
|
|
600
|
+
return 0
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
# =============================================================================
|
|
604
|
+
# Command: set-branch
|
|
605
|
+
# =============================================================================
|
|
606
|
+
|
|
607
|
+
def cmd_set_branch(args: argparse.Namespace) -> int:
|
|
608
|
+
"""Set git branch for task."""
|
|
609
|
+
repo_root = get_repo_root()
|
|
610
|
+
target_dir = resolve_task_dir(args.dir, repo_root)
|
|
611
|
+
branch = args.branch
|
|
612
|
+
|
|
613
|
+
if not branch:
|
|
614
|
+
print(colored("Error: Missing arguments", Colors.RED))
|
|
615
|
+
print("Usage: python3 task.py set-branch <task-dir> <branch-name>")
|
|
616
|
+
return 1
|
|
617
|
+
|
|
618
|
+
task_json = target_dir / FILE_TASK_JSON
|
|
619
|
+
if not task_json.is_file():
|
|
620
|
+
print(colored(f"Error: task.json not found at {target_dir}", Colors.RED))
|
|
621
|
+
return 1
|
|
622
|
+
|
|
623
|
+
data = read_json(task_json)
|
|
624
|
+
if not data:
|
|
625
|
+
return 1
|
|
626
|
+
|
|
627
|
+
data["branch"] = branch
|
|
628
|
+
write_json(task_json, data)
|
|
629
|
+
|
|
630
|
+
print(colored(f"✓ Branch set to: {branch}", Colors.GREEN))
|
|
631
|
+
return 0
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
# =============================================================================
|
|
635
|
+
# Command: set-base-branch
|
|
636
|
+
# =============================================================================
|
|
637
|
+
|
|
638
|
+
def cmd_set_base_branch(args: argparse.Namespace) -> int:
|
|
639
|
+
"""Set the base branch (PR target) for task."""
|
|
640
|
+
repo_root = get_repo_root()
|
|
641
|
+
target_dir = resolve_task_dir(args.dir, repo_root)
|
|
642
|
+
base_branch = args.base_branch
|
|
643
|
+
|
|
644
|
+
if not base_branch:
|
|
645
|
+
print(colored("Error: Missing arguments", Colors.RED))
|
|
646
|
+
print("Usage: python3 task.py set-base-branch <task-dir> <base-branch>")
|
|
647
|
+
print("Example: python3 task.py set-base-branch <dir> develop")
|
|
648
|
+
print()
|
|
649
|
+
print("This sets the target branch for PR (the branch your feature will merge into).")
|
|
650
|
+
return 1
|
|
651
|
+
|
|
652
|
+
task_json = target_dir / FILE_TASK_JSON
|
|
653
|
+
if not task_json.is_file():
|
|
654
|
+
print(colored(f"Error: task.json not found at {target_dir}", Colors.RED))
|
|
655
|
+
return 1
|
|
656
|
+
|
|
657
|
+
data = read_json(task_json)
|
|
658
|
+
if not data:
|
|
659
|
+
return 1
|
|
660
|
+
|
|
661
|
+
data["base_branch"] = base_branch
|
|
662
|
+
write_json(task_json, data)
|
|
663
|
+
|
|
664
|
+
print(colored(f"✓ Base branch set to: {base_branch}", Colors.GREEN))
|
|
665
|
+
print(f" PR will target: {base_branch}")
|
|
666
|
+
return 0
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
# =============================================================================
|
|
670
|
+
# Command: set-scope
|
|
671
|
+
# =============================================================================
|
|
672
|
+
|
|
673
|
+
def cmd_set_scope(args: argparse.Namespace) -> int:
|
|
674
|
+
"""Set scope for PR title."""
|
|
675
|
+
repo_root = get_repo_root()
|
|
676
|
+
target_dir = resolve_task_dir(args.dir, repo_root)
|
|
677
|
+
scope = args.scope
|
|
678
|
+
|
|
679
|
+
if not scope:
|
|
680
|
+
print(colored("Error: Missing arguments", Colors.RED))
|
|
681
|
+
print("Usage: python3 task.py set-scope <task-dir> <scope>")
|
|
682
|
+
return 1
|
|
683
|
+
|
|
684
|
+
task_json = target_dir / FILE_TASK_JSON
|
|
685
|
+
if not task_json.is_file():
|
|
686
|
+
print(colored(f"Error: task.json not found at {target_dir}", Colors.RED))
|
|
687
|
+
return 1
|
|
688
|
+
|
|
689
|
+
data = read_json(task_json)
|
|
690
|
+
if not data:
|
|
691
|
+
return 1
|
|
692
|
+
|
|
693
|
+
data["scope"] = scope
|
|
694
|
+
write_json(task_json, data)
|
|
695
|
+
|
|
696
|
+
print(colored(f"✓ Scope set to: {scope}", Colors.GREEN))
|
|
697
|
+
return 0
|