@jahanxu/trellis 0.4.1
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 +212 -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 +97 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/init.d.ts +21 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +527 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/update.d.ts +27 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +1289 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/configurators/antigravity.d.ts +8 -0
- package/dist/configurators/antigravity.d.ts.map +1 -0
- package/dist/configurators/antigravity.js +18 -0
- package/dist/configurators/antigravity.js.map +1 -0
- package/dist/configurators/claude.d.ts +32 -0
- package/dist/configurators/claude.d.ts.map +1 -0
- package/dist/configurators/claude.js +98 -0
- package/dist/configurators/claude.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 +20 -0
- package/dist/configurators/codex.js.map +1 -0
- package/dist/configurators/cursor.d.ts +5 -0
- package/dist/configurators/cursor.d.ts.map +1 -0
- package/dist/configurators/cursor.js +52 -0
- package/dist/configurators/cursor.js.map +1 -0
- package/dist/configurators/gemini.d.ts +8 -0
- package/dist/configurators/gemini.d.ts.map +1 -0
- package/dist/configurators/gemini.js +52 -0
- package/dist/configurators/gemini.js.map +1 -0
- package/dist/configurators/iflow.d.ts +33 -0
- package/dist/configurators/iflow.d.ts.map +1 -0
- package/dist/configurators/iflow.js +99 -0
- package/dist/configurators/iflow.js.map +1 -0
- package/dist/configurators/index.d.ts +55 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +220 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/kilo.d.ts +8 -0
- package/dist/configurators/kilo.d.ts.map +1 -0
- package/dist/configurators/kilo.js +51 -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 +20 -0
- package/dist/configurators/kiro.js.map +1 -0
- package/dist/configurators/opencode.d.ts +32 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +92 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/shared.d.ts +12 -0
- package/dist/configurators/shared.d.ts.map +1 -0
- package/dist/configurators/shared.js +21 -0
- package/dist/configurators/shared.js.map +1 -0
- package/dist/configurators/workflow.d.ts +28 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +134 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/constants/paths.d.ts +68 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +77 -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 +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/migrations/index.d.ts +54 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +160 -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 +278 -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/templates/antigravity/index.d.ts +12 -0
- package/dist/templates/antigravity/index.d.ts.map +1 -0
- package/dist/templates/antigravity/index.js +29 -0
- package/dist/templates/antigravity/index.js.map +1 -0
- package/dist/templates/claude/agents/check.md +122 -0
- package/dist/templates/claude/agents/debug.md +106 -0
- package/dist/templates/claude/agents/dispatch.md +214 -0
- package/dist/templates/claude/agents/implement.md +96 -0
- package/dist/templates/claude/agents/plan.md +396 -0
- package/dist/templates/claude/agents/research.md +120 -0
- package/dist/templates/claude/commands/trellis/before-backend-dev.md +13 -0
- package/dist/templates/claude/commands/trellis/before-frontend-dev.md +13 -0
- package/dist/templates/claude/commands/trellis/before-role-work.md +364 -0
- package/dist/templates/claude/commands/trellis/brainstorm.md +474 -0
- package/dist/templates/claude/commands/trellis/break-loop.md +125 -0
- package/dist/templates/claude/commands/trellis/check-backend.md +13 -0
- package/dist/templates/claude/commands/trellis/check-cross-layer.md +153 -0
- package/dist/templates/claude/commands/trellis/check-frontend.md +13 -0
- package/dist/templates/claude/commands/trellis/create-command.md +154 -0
- package/dist/templates/claude/commands/trellis/finish-work.md +153 -0
- package/dist/templates/claude/commands/trellis/handoff.md +445 -0
- package/dist/templates/claude/commands/trellis/integrate-skill.md +219 -0
- package/dist/templates/claude/commands/trellis/onboard.md +358 -0
- package/dist/templates/claude/commands/trellis/parallel.md +193 -0
- package/dist/templates/claude/commands/trellis/pick-task.md +515 -0
- package/dist/templates/claude/commands/trellis/record-session.md +62 -0
- package/dist/templates/claude/commands/trellis/start.md +373 -0
- package/dist/templates/claude/commands/trellis/update-spec.md +354 -0
- package/dist/templates/claude/hooks/inject-subagent-context.py +873 -0
- package/dist/templates/claude/hooks/ralph-loop.py +388 -0
- package/dist/templates/claude/hooks/session-start.py +200 -0
- package/dist/templates/claude/index.d.ts +54 -0
- package/dist/templates/claude/index.d.ts.map +1 -0
- package/dist/templates/claude/index.js +85 -0
- package/dist/templates/claude/index.js.map +1 -0
- package/dist/templates/claude/settings.json +41 -0
- package/dist/templates/codex/index.d.ts +18 -0
- package/dist/templates/codex/index.d.ts.map +1 -0
- package/dist/templates/codex/index.js +40 -0
- package/dist/templates/codex/index.js.map +1 -0
- package/dist/templates/codex/skills/before-backend-dev/SKILL.md +18 -0
- package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +18 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +479 -0
- package/dist/templates/codex/skills/break-loop/SKILL.md +130 -0
- package/dist/templates/codex/skills/check-backend/SKILL.md +18 -0
- package/dist/templates/codex/skills/check-cross-layer/SKILL.md +158 -0
- package/dist/templates/codex/skills/check-frontend/SKILL.md +18 -0
- package/dist/templates/codex/skills/create-command/SKILL.md +101 -0
- package/dist/templates/codex/skills/finish-work/SKILL.md +148 -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 +330 -0
- package/dist/templates/codex/skills/update-spec/SKILL.md +335 -0
- package/dist/templates/cursor/commands/trellis-before-backend-dev.md +13 -0
- package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +13 -0
- package/dist/templates/cursor/commands/trellis-brainstorm.md +474 -0
- package/dist/templates/cursor/commands/trellis-break-loop.md +107 -0
- package/dist/templates/cursor/commands/trellis-check-backend.md +13 -0
- package/dist/templates/cursor/commands/trellis-check-cross-layer.md +153 -0
- package/dist/templates/cursor/commands/trellis-check-frontend.md +13 -0
- package/dist/templates/cursor/commands/trellis-create-command.md +154 -0
- package/dist/templates/cursor/commands/trellis-finish-work.md +143 -0
- package/dist/templates/cursor/commands/trellis-integrate-skill.md +219 -0
- package/dist/templates/cursor/commands/trellis-onboard.md +358 -0
- package/dist/templates/cursor/commands/trellis-record-session.md +62 -0
- package/dist/templates/cursor/commands/trellis-start.md +366 -0
- package/dist/templates/cursor/commands/trellis-update-spec.md +354 -0
- package/dist/templates/cursor/index.d.ts +24 -0
- package/dist/templates/cursor/index.d.ts.map +1 -0
- package/dist/templates/cursor/index.js +44 -0
- package/dist/templates/cursor/index.js.map +1 -0
- package/dist/templates/extract.d.ts +166 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +296 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +17 -0
- package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +17 -0
- package/dist/templates/gemini/commands/trellis/brainstorm.toml +420 -0
- package/dist/templates/gemini/commands/trellis/break-loop.toml +129 -0
- package/dist/templates/gemini/commands/trellis/check-backend.toml +17 -0
- package/dist/templates/gemini/commands/trellis/check-cross-layer.toml +147 -0
- package/dist/templates/gemini/commands/trellis/check-frontend.toml +17 -0
- package/dist/templates/gemini/commands/trellis/create-command.toml +119 -0
- package/dist/templates/gemini/commands/trellis/finish-work.toml +133 -0
- package/dist/templates/gemini/commands/trellis/integrate-skill.toml +104 -0
- package/dist/templates/gemini/commands/trellis/onboard.toml +111 -0
- package/dist/templates/gemini/commands/trellis/record-session.toml +66 -0
- package/dist/templates/gemini/commands/trellis/start.toml +292 -0
- package/dist/templates/gemini/commands/trellis/update-spec.toml +132 -0
- package/dist/templates/gemini/index.d.ts +21 -0
- package/dist/templates/gemini/index.d.ts.map +1 -0
- package/dist/templates/gemini/index.js +44 -0
- package/dist/templates/gemini/index.js.map +1 -0
- package/dist/templates/iflow/agents/check.md +122 -0
- package/dist/templates/iflow/agents/debug.md +106 -0
- package/dist/templates/iflow/agents/dispatch.md +214 -0
- package/dist/templates/iflow/agents/implement.md +96 -0
- package/dist/templates/iflow/agents/plan.md +396 -0
- package/dist/templates/iflow/agents/research.md +120 -0
- package/dist/templates/iflow/commands/trellis/before-backend-dev.md +13 -0
- package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +13 -0
- package/dist/templates/iflow/commands/trellis/brainstorm.md +474 -0
- package/dist/templates/iflow/commands/trellis/break-loop.md +125 -0
- package/dist/templates/iflow/commands/trellis/check-backend.md +13 -0
- package/dist/templates/iflow/commands/trellis/check-cross-layer.md +153 -0
- package/dist/templates/iflow/commands/trellis/check-frontend.md +13 -0
- package/dist/templates/iflow/commands/trellis/create-command.md +152 -0
- package/dist/templates/iflow/commands/trellis/finish-work.md +153 -0
- package/dist/templates/iflow/commands/trellis/integrate-skill.md +219 -0
- package/dist/templates/iflow/commands/trellis/onboard.md +358 -0
- package/dist/templates/iflow/commands/trellis/parallel.md +193 -0
- package/dist/templates/iflow/commands/trellis/record-session.md +62 -0
- package/dist/templates/iflow/commands/trellis/start.md +373 -0
- package/dist/templates/iflow/commands/trellis/update-spec.md +354 -0
- package/dist/templates/iflow/hooks/inject-subagent-context.py +788 -0
- package/dist/templates/iflow/hooks/ralph-loop.py +388 -0
- package/dist/templates/iflow/hooks/session-start.py +143 -0
- package/dist/templates/iflow/index.d.ts +54 -0
- package/dist/templates/iflow/index.d.ts.map +1 -0
- package/dist/templates/iflow/index.js +85 -0
- package/dist/templates/iflow/index.js.map +1 -0
- package/dist/templates/iflow/settings.json +40 -0
- package/dist/templates/kilo/commands/trellis/before-backend-dev.md +13 -0
- package/dist/templates/kilo/commands/trellis/before-frontend-dev.md +13 -0
- package/dist/templates/kilo/commands/trellis/brainstorm.md +474 -0
- package/dist/templates/kilo/commands/trellis/break-loop.md +125 -0
- package/dist/templates/kilo/commands/trellis/check-backend.md +13 -0
- package/dist/templates/kilo/commands/trellis/check-cross-layer.md +153 -0
- package/dist/templates/kilo/commands/trellis/check-frontend.md +13 -0
- package/dist/templates/kilo/commands/trellis/create-command.md +152 -0
- package/dist/templates/kilo/commands/trellis/finish-work.md +129 -0
- package/dist/templates/kilo/commands/trellis/integrate-skill.md +219 -0
- package/dist/templates/kilo/commands/trellis/onboard.md +358 -0
- package/dist/templates/kilo/commands/trellis/parallel.md +194 -0
- package/dist/templates/kilo/commands/trellis/record-session.md +62 -0
- package/dist/templates/kilo/commands/trellis/start.md +321 -0
- package/dist/templates/kilo/commands/trellis/update-spec.md +285 -0
- package/dist/templates/kilo/index.d.ts +16 -0
- package/dist/templates/kilo/index.d.ts.map +1 -0
- package/dist/templates/kilo/index.js +39 -0
- package/dist/templates/kilo/index.js.map +1 -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 +40 -0
- package/dist/templates/kiro/index.js.map +1 -0
- package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +18 -0
- package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +18 -0
- package/dist/templates/kiro/skills/brainstorm/SKILL.md +479 -0
- package/dist/templates/kiro/skills/break-loop/SKILL.md +130 -0
- package/dist/templates/kiro/skills/check-backend/SKILL.md +18 -0
- package/dist/templates/kiro/skills/check-cross-layer/SKILL.md +158 -0
- package/dist/templates/kiro/skills/check-frontend/SKILL.md +18 -0
- package/dist/templates/kiro/skills/create-command/SKILL.md +101 -0
- package/dist/templates/kiro/skills/finish-work/SKILL.md +148 -0
- package/dist/templates/kiro/skills/integrate-skill/SKILL.md +221 -0
- package/dist/templates/kiro/skills/onboard/SKILL.md +363 -0
- package/dist/templates/kiro/skills/record-session/SKILL.md +67 -0
- package/dist/templates/kiro/skills/start/SKILL.md +330 -0
- package/dist/templates/kiro/skills/update-spec/SKILL.md +335 -0
- package/dist/templates/markdown/agents.md +18 -0
- package/dist/templates/markdown/gitignore.txt +12 -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 +40 -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/backend/script-conventions.md +467 -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 +118 -0
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +92 -0
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +94 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md +394 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +319 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +79 -0
- package/dist/templates/markdown/workspace-index.md +123 -0
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/dist/templates/opencode/agents/check.md +146 -0
- package/dist/templates/opencode/agents/debug.md +129 -0
- package/dist/templates/opencode/agents/dispatch.md +223 -0
- package/dist/templates/opencode/agents/implement.md +120 -0
- package/dist/templates/opencode/agents/research.md +147 -0
- package/dist/templates/opencode/agents/trellis-plan.md +427 -0
- package/dist/templates/opencode/commands/trellis/before-backend-dev.md +13 -0
- package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +13 -0
- package/dist/templates/opencode/commands/trellis/brainstorm.md +474 -0
- package/dist/templates/opencode/commands/trellis/break-loop.md +125 -0
- package/dist/templates/opencode/commands/trellis/check-backend.md +13 -0
- package/dist/templates/opencode/commands/trellis/check-cross-layer.md +153 -0
- package/dist/templates/opencode/commands/trellis/check-frontend.md +13 -0
- package/dist/templates/opencode/commands/trellis/create-command.md +154 -0
- package/dist/templates/opencode/commands/trellis/finish-work.md +144 -0
- package/dist/templates/opencode/commands/trellis/integrate-skill.md +219 -0
- package/dist/templates/opencode/commands/trellis/migrate-specs.md +0 -0
- package/dist/templates/opencode/commands/trellis/onboard.md +358 -0
- package/dist/templates/opencode/commands/trellis/parallel.md +194 -0
- package/dist/templates/opencode/commands/trellis/record-session.md +62 -0
- package/dist/templates/opencode/commands/trellis/start.md +338 -0
- package/dist/templates/opencode/commands/trellis/update-spec.md +354 -0
- package/dist/templates/opencode/lib/trellis-context.js +436 -0
- package/dist/templates/opencode/package.json +5 -0
- package/dist/templates/opencode/plugin/inject-subagent-context.js +538 -0
- package/dist/templates/opencode/plugin/session-start.js +192 -0
- package/dist/templates/trellis/VERSION +1 -0
- package/dist/templates/trellis/deliverables/README.md +51 -0
- package/dist/templates/trellis/gitignore.txt +29 -0
- package/dist/templates/trellis/index.d.ts +49 -0
- package/dist/templates/trellis/index.d.ts.map +1 -0
- package/dist/templates/trellis/index.js +92 -0
- package/dist/templates/trellis/index.js.map +1 -0
- package/dist/templates/trellis/paths.README.md +277 -0
- package/dist/templates/trellis/paths.yaml +41 -0
- package/dist/templates/trellis/pool/implementations.json +5 -0
- package/dist/templates/trellis/pool/prototypes.json +5 -0
- package/dist/templates/trellis/pool/requirements.json +5 -0
- package/dist/templates/trellis/scripts/__init__.py +5 -0
- package/dist/templates/trellis/scripts/add_session.py +391 -0
- package/dist/templates/trellis/scripts/common/__init__.py +80 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +522 -0
- package/dist/templates/trellis/scripts/common/developer.py +189 -0
- package/dist/templates/trellis/scripts/common/git_context.py +383 -0
- package/dist/templates/trellis/scripts/common/paths.py +346 -0
- package/dist/templates/trellis/scripts/common/phase.py +253 -0
- package/dist/templates/trellis/scripts/common/project_paths.py +189 -0
- package/dist/templates/trellis/scripts/common/registry.py +365 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +255 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +177 -0
- package/dist/templates/trellis/scripts/common/worktree.py +218 -0
- package/dist/templates/trellis/scripts/create_bootstrap.py +290 -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/handoff_generator.py +380 -0
- package/dist/templates/trellis/scripts/init_developer.py +51 -0
- package/dist/templates/trellis/scripts/multi_agent/__init__.py +5 -0
- package/dist/templates/trellis/scripts/multi_agent/cleanup.py +403 -0
- package/dist/templates/trellis/scripts/multi_agent/create_pr.py +329 -0
- package/dist/templates/trellis/scripts/multi_agent/plan.py +233 -0
- package/dist/templates/trellis/scripts/multi_agent/start.py +461 -0
- package/dist/templates/trellis/scripts/multi_agent/status.py +817 -0
- package/dist/templates/trellis/scripts/pool.py +373 -0
- package/dist/templates/trellis/scripts/task.py +1162 -0
- package/dist/templates/trellis/scripts-shell-archive/add-session.sh +384 -0
- package/dist/templates/trellis/scripts-shell-archive/common/developer.sh +129 -0
- package/dist/templates/trellis/scripts-shell-archive/common/git-context.sh +263 -0
- package/dist/templates/trellis/scripts-shell-archive/common/paths.sh +208 -0
- package/dist/templates/trellis/scripts-shell-archive/common/phase.sh +150 -0
- package/dist/templates/trellis/scripts-shell-archive/common/registry.sh +247 -0
- package/dist/templates/trellis/scripts-shell-archive/common/task-queue.sh +142 -0
- package/dist/templates/trellis/scripts-shell-archive/common/task-utils.sh +151 -0
- package/dist/templates/trellis/scripts-shell-archive/common/worktree.sh +128 -0
- package/dist/templates/trellis/scripts-shell-archive/create-bootstrap.sh +299 -0
- package/dist/templates/trellis/scripts-shell-archive/get-context.sh +7 -0
- package/dist/templates/trellis/scripts-shell-archive/get-developer.sh +15 -0
- package/dist/templates/trellis/scripts-shell-archive/init-developer.sh +34 -0
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/cleanup.sh +396 -0
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/create-pr.sh +241 -0
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/plan.sh +207 -0
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/start.sh +317 -0
- package/dist/templates/trellis/scripts-shell-archive/multi-agent/status.sh +828 -0
- package/dist/templates/trellis/scripts-shell-archive/task.sh +1204 -0
- package/dist/templates/trellis/spec/roles/designer/index.md +243 -0
- package/dist/templates/trellis/spec/roles/designer/mock-data-standards.md +481 -0
- package/dist/templates/trellis/spec/roles/designer/prototype-guidelines.md +429 -0
- package/dist/templates/trellis/spec/roles/frontend-impl/api-integration.md +565 -0
- package/dist/templates/trellis/spec/roles/frontend-impl/index.md +321 -0
- package/dist/templates/trellis/spec/roles/frontend-impl/state-management.md +599 -0
- package/dist/templates/trellis/spec/roles/pm/index.md +112 -0
- package/dist/templates/trellis/spec/roles/pm/prd-template.md +124 -0
- package/dist/templates/trellis/tasks/.gitkeep +0 -0
- package/dist/templates/trellis/workflow.md +416 -0
- package/dist/templates/trellis/worktree.yaml +47 -0
- package/dist/types/ai-tools.d.ts +56 -0
- package/dist/types/ai-tools.d.ts.map +1 -0
- package/dist/types/ai-tools.js +103 -0
- package/dist/types/ai-tools.js.map +1 -0
- package/dist/types/migration.d.ts +86 -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 +76 -0
- package/dist/utils/compare-versions.js.map +1 -0
- package/dist/utils/file-writer.d.ts +23 -0
- package/dist/utils/file-writer.d.ts.map +1 -0
- package/dist/utils/file-writer.js +140 -0
- package/dist/utils/file-writer.js.map +1 -0
- package/dist/utils/project-detector.d.ts +16 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +186 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +51 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -0
- package/dist/utils/template-fetcher.js +174 -0
- package/dist/utils/template-fetcher.js.map +1 -0
- package/dist/utils/template-hash.d.ts +78 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +233 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Developer management utilities.
|
|
4
|
+
|
|
5
|
+
Provides:
|
|
6
|
+
init_developer - Initialize developer
|
|
7
|
+
ensure_developer - Ensure developer is initialized (exit if not)
|
|
8
|
+
show_developer_info - Show developer information
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import sys
|
|
13
|
+
from datetime import datetime
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
from .paths import (
|
|
17
|
+
DIR_WORKFLOW,
|
|
18
|
+
DIR_WORKSPACE,
|
|
19
|
+
DIR_TASKS,
|
|
20
|
+
FILE_DEVELOPER,
|
|
21
|
+
FILE_JOURNAL_PREFIX,
|
|
22
|
+
get_repo_root,
|
|
23
|
+
get_developer,
|
|
24
|
+
check_developer,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# =============================================================================
|
|
29
|
+
# Developer Initialization
|
|
30
|
+
# =============================================================================
|
|
31
|
+
|
|
32
|
+
def init_developer(name: str, repo_root: Optional[Path] = None) -> bool:
|
|
33
|
+
"""Initialize developer.
|
|
34
|
+
|
|
35
|
+
Creates:
|
|
36
|
+
- .trellis/.developer file with developer info
|
|
37
|
+
- .trellis/workspace/<name>/ directory structure
|
|
38
|
+
- Initial journal file and index.md
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
name: Developer name.
|
|
42
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
True on success, False on error.
|
|
46
|
+
"""
|
|
47
|
+
if not name:
|
|
48
|
+
print("Error: developer name is required", file=sys.stderr)
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
if repo_root is None:
|
|
52
|
+
repo_root = get_repo_root()
|
|
53
|
+
|
|
54
|
+
dev_file = repo_root / DIR_WORKFLOW / FILE_DEVELOPER
|
|
55
|
+
workspace_dir = repo_root / DIR_WORKFLOW / DIR_WORKSPACE / name
|
|
56
|
+
|
|
57
|
+
# Create .developer file
|
|
58
|
+
initialized_at = datetime.now().isoformat()
|
|
59
|
+
try:
|
|
60
|
+
dev_file.write_text(
|
|
61
|
+
f"name={name}\ninitialized_at={initialized_at}\n",
|
|
62
|
+
encoding="utf-8"
|
|
63
|
+
)
|
|
64
|
+
except (OSError, IOError) as e:
|
|
65
|
+
print(f"Error: Failed to create .developer file: {e}", file=sys.stderr)
|
|
66
|
+
return False
|
|
67
|
+
|
|
68
|
+
# Create workspace directory structure
|
|
69
|
+
try:
|
|
70
|
+
workspace_dir.mkdir(parents=True, exist_ok=True)
|
|
71
|
+
except (OSError, IOError) as e:
|
|
72
|
+
print(f"Error: Failed to create workspace directory: {e}", file=sys.stderr)
|
|
73
|
+
return False
|
|
74
|
+
|
|
75
|
+
# Create initial journal file
|
|
76
|
+
journal_file = workspace_dir / f"{FILE_JOURNAL_PREFIX}1.md"
|
|
77
|
+
if not journal_file.exists():
|
|
78
|
+
today = datetime.now().strftime("%Y-%m-%d")
|
|
79
|
+
journal_content = f"""# Journal - {name} (Part 1)
|
|
80
|
+
|
|
81
|
+
> AI development session journal
|
|
82
|
+
> Started: {today}
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
"""
|
|
87
|
+
try:
|
|
88
|
+
journal_file.write_text(journal_content, encoding="utf-8")
|
|
89
|
+
except (OSError, IOError) as e:
|
|
90
|
+
print(f"Error: Failed to create journal file: {e}", file=sys.stderr)
|
|
91
|
+
return False
|
|
92
|
+
|
|
93
|
+
# Create index.md with markers for auto-update
|
|
94
|
+
index_file = workspace_dir / "index.md"
|
|
95
|
+
if not index_file.exists():
|
|
96
|
+
index_content = f"""# Workspace Index - {name}
|
|
97
|
+
|
|
98
|
+
> Journal tracking for AI development sessions.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Current Status
|
|
103
|
+
|
|
104
|
+
<!-- @@@auto:current-status -->
|
|
105
|
+
- **Active File**: `journal-1.md`
|
|
106
|
+
- **Total Sessions**: 0
|
|
107
|
+
- **Last Active**: -
|
|
108
|
+
<!-- @@@/auto:current-status -->
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Active Documents
|
|
113
|
+
|
|
114
|
+
<!-- @@@auto:active-documents -->
|
|
115
|
+
| File | Lines | Status |
|
|
116
|
+
|------|-------|--------|
|
|
117
|
+
| `journal-1.md` | ~0 | Active |
|
|
118
|
+
<!-- @@@/auto:active-documents -->
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Session History
|
|
123
|
+
|
|
124
|
+
<!-- @@@auto:session-history -->
|
|
125
|
+
| # | Date | Title | Commits |
|
|
126
|
+
|---|------|-------|---------|
|
|
127
|
+
<!-- @@@/auto:session-history -->
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Notes
|
|
132
|
+
|
|
133
|
+
- Sessions are appended to journal files
|
|
134
|
+
- New journal file created when current exceeds 2000 lines
|
|
135
|
+
- Use `add_session.py` to record sessions
|
|
136
|
+
"""
|
|
137
|
+
try:
|
|
138
|
+
index_file.write_text(index_content, encoding="utf-8")
|
|
139
|
+
except (OSError, IOError) as e:
|
|
140
|
+
print(f"Error: Failed to create index.md: {e}", file=sys.stderr)
|
|
141
|
+
return False
|
|
142
|
+
|
|
143
|
+
print(f"Developer initialized: {name}")
|
|
144
|
+
print(f" .developer file: {dev_file}")
|
|
145
|
+
print(f" Workspace dir: {workspace_dir}")
|
|
146
|
+
|
|
147
|
+
return True
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def ensure_developer(repo_root: Optional[Path] = None) -> None:
|
|
151
|
+
"""Ensure developer is initialized, exit if not.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
155
|
+
"""
|
|
156
|
+
if repo_root is None:
|
|
157
|
+
repo_root = get_repo_root()
|
|
158
|
+
|
|
159
|
+
if not check_developer(repo_root):
|
|
160
|
+
print("Error: Developer not initialized.", file=sys.stderr)
|
|
161
|
+
print(f"Run: python3 ./{DIR_WORKFLOW}/scripts/init_developer.py <your-name>", file=sys.stderr)
|
|
162
|
+
sys.exit(1)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def show_developer_info(repo_root: Optional[Path] = None) -> None:
|
|
166
|
+
"""Show developer information.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
170
|
+
"""
|
|
171
|
+
if repo_root is None:
|
|
172
|
+
repo_root = get_repo_root()
|
|
173
|
+
|
|
174
|
+
developer = get_developer(repo_root)
|
|
175
|
+
|
|
176
|
+
if not developer:
|
|
177
|
+
print("Developer: (not initialized)")
|
|
178
|
+
else:
|
|
179
|
+
print(f"Developer: {developer}")
|
|
180
|
+
print(f"Workspace: {DIR_WORKFLOW}/{DIR_WORKSPACE}/{developer}/")
|
|
181
|
+
print(f"Tasks: {DIR_WORKFLOW}/{DIR_TASKS}/")
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# =============================================================================
|
|
185
|
+
# Main Entry (for testing)
|
|
186
|
+
# =============================================================================
|
|
187
|
+
|
|
188
|
+
if __name__ == "__main__":
|
|
189
|
+
show_developer_info()
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Git and Session Context utilities.
|
|
5
|
+
|
|
6
|
+
Provides:
|
|
7
|
+
output_json - Output context in JSON format
|
|
8
|
+
output_text - Output context in text format
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
# IMPORTANT: Force stdout to use UTF-8 on Windows
|
|
15
|
+
# This fixes UnicodeEncodeError when outputting non-ASCII characters
|
|
16
|
+
if sys.platform == "win32":
|
|
17
|
+
import io as _io
|
|
18
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
19
|
+
sys.stdout.reconfigure(encoding="utf-8", errors="replace") # type: ignore[union-attr]
|
|
20
|
+
elif hasattr(sys.stdout, "detach"):
|
|
21
|
+
sys.stdout = _io.TextIOWrapper(sys.stdout.detach(), encoding="utf-8", errors="replace") # type: ignore[union-attr]
|
|
22
|
+
|
|
23
|
+
import json
|
|
24
|
+
import subprocess
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
from typing import Optional
|
|
27
|
+
|
|
28
|
+
from .paths import (
|
|
29
|
+
DIR_SCRIPTS,
|
|
30
|
+
DIR_SPEC,
|
|
31
|
+
DIR_TASKS,
|
|
32
|
+
DIR_WORKFLOW,
|
|
33
|
+
DIR_WORKSPACE,
|
|
34
|
+
FILE_TASK_JSON,
|
|
35
|
+
count_lines,
|
|
36
|
+
get_active_journal_file,
|
|
37
|
+
get_current_task,
|
|
38
|
+
get_developer,
|
|
39
|
+
get_repo_root,
|
|
40
|
+
get_tasks_dir,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# =============================================================================
|
|
44
|
+
# Helper Functions
|
|
45
|
+
# =============================================================================
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _run_git_command(args: list[str], cwd: Optional[Path] = None) -> tuple[int, str, str]:
|
|
49
|
+
"""Run a git command and return (returncode, stdout, stderr).
|
|
50
|
+
|
|
51
|
+
Uses UTF-8 encoding with -c i18n.logOutputEncoding=UTF-8 to ensure
|
|
52
|
+
consistent output across all platforms (Windows, macOS, Linux).
|
|
53
|
+
"""
|
|
54
|
+
try:
|
|
55
|
+
# Force git to output UTF-8 for consistent cross-platform behavior
|
|
56
|
+
git_args = ["git", "-c", "i18n.logOutputEncoding=UTF-8"] + args
|
|
57
|
+
result = subprocess.run(
|
|
58
|
+
git_args,
|
|
59
|
+
cwd=cwd,
|
|
60
|
+
capture_output=True,
|
|
61
|
+
text=True,
|
|
62
|
+
encoding="utf-8",
|
|
63
|
+
errors="replace",
|
|
64
|
+
)
|
|
65
|
+
return result.returncode, result.stdout, result.stderr
|
|
66
|
+
except Exception as e:
|
|
67
|
+
return 1, "", str(e)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _read_json_file(path: Path) -> Optional[dict]:
|
|
71
|
+
"""Read and parse a JSON file."""
|
|
72
|
+
try:
|
|
73
|
+
return json.loads(path.read_text(encoding="utf-8"))
|
|
74
|
+
except (FileNotFoundError, json.JSONDecodeError, OSError):
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# =============================================================================
|
|
79
|
+
# JSON Output
|
|
80
|
+
# =============================================================================
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def get_context_json(repo_root: Optional[Path] = None) -> dict:
|
|
84
|
+
"""Get context as a dictionary.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Context dictionary.
|
|
91
|
+
"""
|
|
92
|
+
if repo_root is None:
|
|
93
|
+
repo_root = get_repo_root()
|
|
94
|
+
|
|
95
|
+
developer = get_developer(repo_root)
|
|
96
|
+
tasks_dir = get_tasks_dir(repo_root)
|
|
97
|
+
journal_file = get_active_journal_file(repo_root)
|
|
98
|
+
|
|
99
|
+
journal_lines = 0
|
|
100
|
+
journal_relative = ""
|
|
101
|
+
if journal_file and developer:
|
|
102
|
+
journal_lines = count_lines(journal_file)
|
|
103
|
+
journal_relative = (
|
|
104
|
+
f"{DIR_WORKFLOW}/{DIR_WORKSPACE}/{developer}/{journal_file.name}"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Git info
|
|
108
|
+
_, branch_out, _ = _run_git_command(["branch", "--show-current"], cwd=repo_root)
|
|
109
|
+
branch = branch_out.strip() or "unknown"
|
|
110
|
+
|
|
111
|
+
_, status_out, _ = _run_git_command(["status", "--porcelain"], cwd=repo_root)
|
|
112
|
+
git_status_count = len([line for line in status_out.splitlines() if line.strip()])
|
|
113
|
+
is_clean = git_status_count == 0
|
|
114
|
+
|
|
115
|
+
# Recent commits
|
|
116
|
+
_, log_out, _ = _run_git_command(["log", "--oneline", "-5"], cwd=repo_root)
|
|
117
|
+
commits = []
|
|
118
|
+
for line in log_out.splitlines():
|
|
119
|
+
if line.strip():
|
|
120
|
+
parts = line.split(" ", 1)
|
|
121
|
+
if len(parts) >= 2:
|
|
122
|
+
commits.append({"hash": parts[0], "message": parts[1]})
|
|
123
|
+
elif len(parts) == 1:
|
|
124
|
+
commits.append({"hash": parts[0], "message": ""})
|
|
125
|
+
|
|
126
|
+
# Tasks
|
|
127
|
+
tasks = []
|
|
128
|
+
if tasks_dir.is_dir():
|
|
129
|
+
for d in tasks_dir.iterdir():
|
|
130
|
+
if d.is_dir() and d.name != "archive":
|
|
131
|
+
task_json_path = d / FILE_TASK_JSON
|
|
132
|
+
if task_json_path.is_file():
|
|
133
|
+
data = _read_json_file(task_json_path)
|
|
134
|
+
if data:
|
|
135
|
+
tasks.append(
|
|
136
|
+
{
|
|
137
|
+
"dir": d.name,
|
|
138
|
+
"name": data.get("name") or data.get("id") or "unknown",
|
|
139
|
+
"status": data.get("status", "unknown"),
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
"developer": developer or "",
|
|
145
|
+
"git": {
|
|
146
|
+
"branch": branch,
|
|
147
|
+
"isClean": is_clean,
|
|
148
|
+
"uncommittedChanges": git_status_count,
|
|
149
|
+
"recentCommits": commits,
|
|
150
|
+
},
|
|
151
|
+
"tasks": {
|
|
152
|
+
"active": tasks,
|
|
153
|
+
"directory": f"{DIR_WORKFLOW}/{DIR_TASKS}",
|
|
154
|
+
},
|
|
155
|
+
"journal": {
|
|
156
|
+
"file": journal_relative,
|
|
157
|
+
"lines": journal_lines,
|
|
158
|
+
"nearLimit": journal_lines > 1800,
|
|
159
|
+
},
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def output_json(repo_root: Optional[Path] = None) -> None:
|
|
164
|
+
"""Output context in JSON format.
|
|
165
|
+
|
|
166
|
+
Args:
|
|
167
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
168
|
+
"""
|
|
169
|
+
context = get_context_json(repo_root)
|
|
170
|
+
print(json.dumps(context, indent=2, ensure_ascii=False))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# =============================================================================
|
|
174
|
+
# Text Output
|
|
175
|
+
# =============================================================================
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def get_context_text(repo_root: Optional[Path] = None) -> str:
|
|
179
|
+
"""Get context as formatted text.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
Formatted text output.
|
|
186
|
+
"""
|
|
187
|
+
if repo_root is None:
|
|
188
|
+
repo_root = get_repo_root()
|
|
189
|
+
|
|
190
|
+
lines = []
|
|
191
|
+
lines.append("========================================")
|
|
192
|
+
lines.append("SESSION CONTEXT")
|
|
193
|
+
lines.append("========================================")
|
|
194
|
+
lines.append("")
|
|
195
|
+
|
|
196
|
+
developer = get_developer(repo_root)
|
|
197
|
+
|
|
198
|
+
# Developer section
|
|
199
|
+
lines.append("## DEVELOPER")
|
|
200
|
+
if not developer:
|
|
201
|
+
lines.append(
|
|
202
|
+
f"ERROR: Not initialized. Run: python3 ./{DIR_WORKFLOW}/{DIR_SCRIPTS}/init_developer.py <name>"
|
|
203
|
+
)
|
|
204
|
+
return "\n".join(lines)
|
|
205
|
+
|
|
206
|
+
lines.append(f"Name: {developer}")
|
|
207
|
+
lines.append("")
|
|
208
|
+
|
|
209
|
+
# Git status
|
|
210
|
+
lines.append("## GIT STATUS")
|
|
211
|
+
_, branch_out, _ = _run_git_command(["branch", "--show-current"], cwd=repo_root)
|
|
212
|
+
branch = branch_out.strip() or "unknown"
|
|
213
|
+
lines.append(f"Branch: {branch}")
|
|
214
|
+
|
|
215
|
+
_, status_out, _ = _run_git_command(["status", "--porcelain"], cwd=repo_root)
|
|
216
|
+
status_lines = [line for line in status_out.splitlines() if line.strip()]
|
|
217
|
+
status_count = len(status_lines)
|
|
218
|
+
|
|
219
|
+
if status_count == 0:
|
|
220
|
+
lines.append("Working directory: Clean")
|
|
221
|
+
else:
|
|
222
|
+
lines.append(f"Working directory: {status_count} uncommitted change(s)")
|
|
223
|
+
lines.append("")
|
|
224
|
+
lines.append("Changes:")
|
|
225
|
+
_, short_out, _ = _run_git_command(["status", "--short"], cwd=repo_root)
|
|
226
|
+
for line in short_out.splitlines()[:10]:
|
|
227
|
+
lines.append(line)
|
|
228
|
+
lines.append("")
|
|
229
|
+
|
|
230
|
+
# Recent commits
|
|
231
|
+
lines.append("## RECENT COMMITS")
|
|
232
|
+
_, log_out, _ = _run_git_command(["log", "--oneline", "-5"], cwd=repo_root)
|
|
233
|
+
if log_out.strip():
|
|
234
|
+
for line in log_out.splitlines():
|
|
235
|
+
lines.append(line)
|
|
236
|
+
else:
|
|
237
|
+
lines.append("(no commits)")
|
|
238
|
+
lines.append("")
|
|
239
|
+
|
|
240
|
+
# Current task
|
|
241
|
+
lines.append("## CURRENT TASK")
|
|
242
|
+
current_task = get_current_task(repo_root)
|
|
243
|
+
if current_task:
|
|
244
|
+
current_task_dir = repo_root / current_task
|
|
245
|
+
task_json_path = current_task_dir / FILE_TASK_JSON
|
|
246
|
+
lines.append(f"Path: {current_task}")
|
|
247
|
+
|
|
248
|
+
if task_json_path.is_file():
|
|
249
|
+
data = _read_json_file(task_json_path)
|
|
250
|
+
if data:
|
|
251
|
+
t_name = data.get("name") or data.get("id") or "unknown"
|
|
252
|
+
t_status = data.get("status", "unknown")
|
|
253
|
+
t_created = data.get("createdAt", "unknown")
|
|
254
|
+
t_desc = data.get("description", "")
|
|
255
|
+
|
|
256
|
+
lines.append(f"Name: {t_name}")
|
|
257
|
+
lines.append(f"Status: {t_status}")
|
|
258
|
+
lines.append(f"Created: {t_created}")
|
|
259
|
+
if t_desc:
|
|
260
|
+
lines.append(f"Description: {t_desc}")
|
|
261
|
+
|
|
262
|
+
# Check for prd.md
|
|
263
|
+
prd_file = current_task_dir / "prd.md"
|
|
264
|
+
if prd_file.is_file():
|
|
265
|
+
lines.append("")
|
|
266
|
+
lines.append("[!] This task has prd.md - read it for task details")
|
|
267
|
+
else:
|
|
268
|
+
lines.append("(none)")
|
|
269
|
+
lines.append("")
|
|
270
|
+
|
|
271
|
+
# Active tasks
|
|
272
|
+
lines.append("## ACTIVE TASKS")
|
|
273
|
+
tasks_dir = get_tasks_dir(repo_root)
|
|
274
|
+
task_count = 0
|
|
275
|
+
|
|
276
|
+
if tasks_dir.is_dir():
|
|
277
|
+
for d in sorted(tasks_dir.iterdir()):
|
|
278
|
+
if d.is_dir() and d.name != "archive":
|
|
279
|
+
dir_name = d.name
|
|
280
|
+
t_json = d / FILE_TASK_JSON
|
|
281
|
+
status = "unknown"
|
|
282
|
+
assignee = "-"
|
|
283
|
+
|
|
284
|
+
if t_json.is_file():
|
|
285
|
+
data = _read_json_file(t_json)
|
|
286
|
+
if data:
|
|
287
|
+
status = data.get("status", "unknown")
|
|
288
|
+
assignee = data.get("assignee", "-")
|
|
289
|
+
|
|
290
|
+
lines.append(f"- {dir_name}/ ({status}) @{assignee}")
|
|
291
|
+
task_count += 1
|
|
292
|
+
|
|
293
|
+
if task_count == 0:
|
|
294
|
+
lines.append("(no active tasks)")
|
|
295
|
+
lines.append(f"Total: {task_count} active task(s)")
|
|
296
|
+
lines.append("")
|
|
297
|
+
|
|
298
|
+
# My tasks
|
|
299
|
+
lines.append("## MY TASKS (Assigned to me)")
|
|
300
|
+
my_task_count = 0
|
|
301
|
+
|
|
302
|
+
if tasks_dir.is_dir():
|
|
303
|
+
for d in sorted(tasks_dir.iterdir()):
|
|
304
|
+
if d.is_dir() and d.name != "archive":
|
|
305
|
+
t_json = d / FILE_TASK_JSON
|
|
306
|
+
if t_json.is_file():
|
|
307
|
+
data = _read_json_file(t_json)
|
|
308
|
+
if data:
|
|
309
|
+
assignee = data.get("assignee", "")
|
|
310
|
+
status = data.get("status", "planning")
|
|
311
|
+
|
|
312
|
+
if assignee == developer and status != "done":
|
|
313
|
+
title = data.get("title") or data.get("name") or "unknown"
|
|
314
|
+
priority = data.get("priority", "P2")
|
|
315
|
+
lines.append(f"- [{priority}] {title} ({status})")
|
|
316
|
+
my_task_count += 1
|
|
317
|
+
|
|
318
|
+
if my_task_count == 0:
|
|
319
|
+
lines.append("(no tasks assigned to you)")
|
|
320
|
+
lines.append("")
|
|
321
|
+
|
|
322
|
+
# Journal file
|
|
323
|
+
lines.append("## JOURNAL FILE")
|
|
324
|
+
journal_file = get_active_journal_file(repo_root)
|
|
325
|
+
if journal_file:
|
|
326
|
+
journal_lines = count_lines(journal_file)
|
|
327
|
+
relative = f"{DIR_WORKFLOW}/{DIR_WORKSPACE}/{developer}/{journal_file.name}"
|
|
328
|
+
lines.append(f"Active file: {relative}")
|
|
329
|
+
lines.append(f"Line count: {journal_lines} / 2000")
|
|
330
|
+
if journal_lines > 1800:
|
|
331
|
+
lines.append("[!] WARNING: Approaching 2000 line limit!")
|
|
332
|
+
else:
|
|
333
|
+
lines.append("No journal file found")
|
|
334
|
+
lines.append("")
|
|
335
|
+
|
|
336
|
+
# Paths
|
|
337
|
+
lines.append("## PATHS")
|
|
338
|
+
lines.append(f"Workspace: {DIR_WORKFLOW}/{DIR_WORKSPACE}/{developer}/")
|
|
339
|
+
lines.append(f"Tasks: {DIR_WORKFLOW}/{DIR_TASKS}/")
|
|
340
|
+
lines.append(f"Spec: {DIR_WORKFLOW}/{DIR_SPEC}/")
|
|
341
|
+
lines.append("")
|
|
342
|
+
|
|
343
|
+
lines.append("========================================")
|
|
344
|
+
|
|
345
|
+
return "\n".join(lines)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def output_text(repo_root: Optional[Path] = None) -> None:
|
|
349
|
+
"""Output context in text format.
|
|
350
|
+
|
|
351
|
+
Args:
|
|
352
|
+
repo_root: Repository root path. Defaults to auto-detected.
|
|
353
|
+
"""
|
|
354
|
+
print(get_context_text(repo_root))
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
# =============================================================================
|
|
358
|
+
# Main Entry
|
|
359
|
+
# =============================================================================
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def main() -> None:
|
|
363
|
+
"""CLI entry point."""
|
|
364
|
+
import argparse
|
|
365
|
+
|
|
366
|
+
parser = argparse.ArgumentParser(description="Get Session Context for AI Agent")
|
|
367
|
+
parser.add_argument(
|
|
368
|
+
"--json",
|
|
369
|
+
"-j",
|
|
370
|
+
action="store_true",
|
|
371
|
+
help="Output context in JSON format",
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
args = parser.parse_args()
|
|
375
|
+
|
|
376
|
+
if args.json:
|
|
377
|
+
output_json()
|
|
378
|
+
else:
|
|
379
|
+
output_text()
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
if __name__ == "__main__":
|
|
383
|
+
main()
|