@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,522 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI Adapter for Multi-Platform Support.
|
|
3
|
+
|
|
4
|
+
Abstracts differences between Claude Code, OpenCode, Cursor, iFlow, Codex, Kilo, Kiro Code, Gemini CLI, and Antigravity interfaces.
|
|
5
|
+
|
|
6
|
+
Supported platforms:
|
|
7
|
+
- claude: Claude Code (default)
|
|
8
|
+
- opencode: OpenCode
|
|
9
|
+
- cursor: Cursor IDE
|
|
10
|
+
- iflow: iFlow CLI
|
|
11
|
+
- codex: Codex CLI (skills-based)
|
|
12
|
+
- kilo: Kilo CLI
|
|
13
|
+
- kiro: Kiro Code (skills-based)
|
|
14
|
+
- gemini: Gemini CLI
|
|
15
|
+
- antigravity: Antigravity (workflow-based)
|
|
16
|
+
|
|
17
|
+
Usage:
|
|
18
|
+
from common.cli_adapter import CLIAdapter
|
|
19
|
+
|
|
20
|
+
adapter = CLIAdapter("opencode")
|
|
21
|
+
cmd = adapter.build_run_command(
|
|
22
|
+
agent="dispatch",
|
|
23
|
+
session_id="abc123",
|
|
24
|
+
prompt="Start the pipeline"
|
|
25
|
+
)
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
from dataclasses import dataclass
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
from typing import ClassVar, Literal
|
|
32
|
+
|
|
33
|
+
Platform = Literal["claude", "opencode", "cursor", "iflow", "codex", "kilo", "kiro", "gemini", "antigravity"]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class CLIAdapter:
|
|
38
|
+
"""Adapter for different AI coding CLI tools."""
|
|
39
|
+
|
|
40
|
+
platform: Platform
|
|
41
|
+
|
|
42
|
+
# =========================================================================
|
|
43
|
+
# Agent Name Mapping
|
|
44
|
+
# =========================================================================
|
|
45
|
+
|
|
46
|
+
# OpenCode has built-in agents that cannot be overridden
|
|
47
|
+
# See: https://github.com/sst/opencode/issues/4271
|
|
48
|
+
# Note: Class-level constant, not a dataclass field
|
|
49
|
+
_AGENT_NAME_MAP: ClassVar[dict[Platform, dict[str, str]]] = {
|
|
50
|
+
"claude": {}, # No mapping needed
|
|
51
|
+
"opencode": {
|
|
52
|
+
"plan": "trellis-plan", # 'plan' is built-in in OpenCode
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
def get_agent_name(self, agent: str) -> str:
|
|
57
|
+
"""Get platform-specific agent name.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
agent: Original agent name (e.g., 'plan', 'dispatch')
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
Platform-specific agent name (e.g., 'trellis-plan' for OpenCode)
|
|
64
|
+
"""
|
|
65
|
+
mapping = self._AGENT_NAME_MAP.get(self.platform, {})
|
|
66
|
+
return mapping.get(agent, agent)
|
|
67
|
+
|
|
68
|
+
# =========================================================================
|
|
69
|
+
# Agent Path
|
|
70
|
+
# =========================================================================
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def config_dir_name(self) -> str:
|
|
74
|
+
"""Get platform-specific config directory name.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
Directory name ('.claude', '.opencode', '.cursor', '.iflow', '.agents', '.kilocode', '.kiro', '.gemini', or '.agent')
|
|
78
|
+
"""
|
|
79
|
+
if self.platform == "opencode":
|
|
80
|
+
return ".opencode"
|
|
81
|
+
elif self.platform == "cursor":
|
|
82
|
+
return ".cursor"
|
|
83
|
+
elif self.platform == "iflow":
|
|
84
|
+
return ".iflow"
|
|
85
|
+
elif self.platform == "codex":
|
|
86
|
+
return ".agents"
|
|
87
|
+
elif self.platform == "kilo":
|
|
88
|
+
return ".kilocode"
|
|
89
|
+
elif self.platform == "kiro":
|
|
90
|
+
return ".kiro"
|
|
91
|
+
elif self.platform == "gemini":
|
|
92
|
+
return ".gemini"
|
|
93
|
+
elif self.platform == "antigravity":
|
|
94
|
+
return ".agent"
|
|
95
|
+
else:
|
|
96
|
+
return ".claude"
|
|
97
|
+
|
|
98
|
+
def get_config_dir(self, project_root: Path) -> Path:
|
|
99
|
+
"""Get platform-specific config directory.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
project_root: Project root directory
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Path to config directory (.claude, .opencode, .cursor, .iflow, .agents, .kilocode, .kiro, or .agent)
|
|
106
|
+
"""
|
|
107
|
+
return project_root / self.config_dir_name
|
|
108
|
+
|
|
109
|
+
def get_agent_path(self, agent: str, project_root: Path) -> Path:
|
|
110
|
+
"""Get path to agent definition file.
|
|
111
|
+
|
|
112
|
+
Args:
|
|
113
|
+
agent: Agent name (original, before mapping)
|
|
114
|
+
project_root: Project root directory
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Path to agent .md file
|
|
118
|
+
"""
|
|
119
|
+
mapped_name = self.get_agent_name(agent)
|
|
120
|
+
return self.get_config_dir(project_root) / "agents" / f"{mapped_name}.md"
|
|
121
|
+
|
|
122
|
+
def get_commands_path(self, project_root: Path, *parts: str) -> Path:
|
|
123
|
+
"""Get path to commands directory or specific command file.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
project_root: Project root directory
|
|
127
|
+
*parts: Additional path parts (e.g., 'trellis', 'finish-work.md')
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Path to commands directory or file
|
|
131
|
+
|
|
132
|
+
Note:
|
|
133
|
+
Cursor uses prefix naming: .cursor/commands/trellis-<name>.md
|
|
134
|
+
Antigravity uses workflow directory: .agent/workflows/<name>.md
|
|
135
|
+
Claude/OpenCode use subdirectory: .claude/commands/trellis/<name>.md
|
|
136
|
+
"""
|
|
137
|
+
if self.platform == "antigravity":
|
|
138
|
+
workflow_dir = self.get_config_dir(project_root) / "workflows"
|
|
139
|
+
if not parts:
|
|
140
|
+
return workflow_dir
|
|
141
|
+
if len(parts) >= 2 and parts[0] == "trellis":
|
|
142
|
+
filename = parts[-1]
|
|
143
|
+
return workflow_dir / filename
|
|
144
|
+
return workflow_dir / Path(*parts)
|
|
145
|
+
|
|
146
|
+
if not parts:
|
|
147
|
+
return self.get_config_dir(project_root) / "commands"
|
|
148
|
+
|
|
149
|
+
# Cursor uses prefix naming instead of subdirectory
|
|
150
|
+
if self.platform == "cursor" and len(parts) >= 2 and parts[0] == "trellis":
|
|
151
|
+
# Convert trellis/<name>.md to trellis-<name>.md
|
|
152
|
+
filename = parts[-1]
|
|
153
|
+
return self.get_config_dir(project_root) / "commands" / f"trellis-{filename}"
|
|
154
|
+
|
|
155
|
+
return self.get_config_dir(project_root) / "commands" / Path(*parts)
|
|
156
|
+
|
|
157
|
+
def get_trellis_command_path(self, name: str) -> str:
|
|
158
|
+
"""Get relative path to a trellis command file.
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
name: Command name without extension (e.g., 'finish-work', 'check-backend')
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
Relative path string for use in JSONL entries
|
|
165
|
+
|
|
166
|
+
Note:
|
|
167
|
+
Cursor: .cursor/commands/trellis-<name>.md
|
|
168
|
+
Codex: .agents/skills/<name>/SKILL.md
|
|
169
|
+
Kiro: .kiro/skills/<name>/SKILL.md
|
|
170
|
+
Gemini: .gemini/commands/trellis/<name>.toml
|
|
171
|
+
Antigravity: .agent/workflows/<name>.md
|
|
172
|
+
Others: .{platform}/commands/trellis/<name>.md
|
|
173
|
+
"""
|
|
174
|
+
if self.platform == "cursor":
|
|
175
|
+
return f".cursor/commands/trellis-{name}.md"
|
|
176
|
+
elif self.platform == "codex":
|
|
177
|
+
return f".agents/skills/{name}/SKILL.md"
|
|
178
|
+
elif self.platform == "kiro":
|
|
179
|
+
return f".kiro/skills/{name}/SKILL.md"
|
|
180
|
+
elif self.platform == "gemini":
|
|
181
|
+
return f".gemini/commands/trellis/{name}.toml"
|
|
182
|
+
elif self.platform == "antigravity":
|
|
183
|
+
return f".agent/workflows/{name}.md"
|
|
184
|
+
else:
|
|
185
|
+
return f"{self.config_dir_name}/commands/trellis/{name}.md"
|
|
186
|
+
|
|
187
|
+
# =========================================================================
|
|
188
|
+
# Environment Variables
|
|
189
|
+
# =========================================================================
|
|
190
|
+
|
|
191
|
+
def get_non_interactive_env(self) -> dict[str, str]:
|
|
192
|
+
"""Get environment variables for non-interactive mode.
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
Dict of environment variables to set
|
|
196
|
+
"""
|
|
197
|
+
if self.platform == "opencode":
|
|
198
|
+
return {"OPENCODE_NON_INTERACTIVE": "1"}
|
|
199
|
+
elif self.platform == "codex":
|
|
200
|
+
return {"CODEX_NON_INTERACTIVE": "1"}
|
|
201
|
+
elif self.platform == "kiro":
|
|
202
|
+
return {"KIRO_NON_INTERACTIVE": "1"}
|
|
203
|
+
elif self.platform == "gemini":
|
|
204
|
+
return {} # Gemini CLI doesn't have a non-interactive env var
|
|
205
|
+
elif self.platform == "antigravity":
|
|
206
|
+
return {}
|
|
207
|
+
else:
|
|
208
|
+
return {"CLAUDE_NON_INTERACTIVE": "1"}
|
|
209
|
+
|
|
210
|
+
# =========================================================================
|
|
211
|
+
# CLI Command Building
|
|
212
|
+
# =========================================================================
|
|
213
|
+
|
|
214
|
+
def build_run_command(
|
|
215
|
+
self,
|
|
216
|
+
agent: str,
|
|
217
|
+
prompt: str,
|
|
218
|
+
session_id: Optional[str] = None,
|
|
219
|
+
skip_permissions: bool = True,
|
|
220
|
+
verbose: bool = True,
|
|
221
|
+
json_output: bool = True,
|
|
222
|
+
) -> list[str]:
|
|
223
|
+
"""Build CLI command for running an agent.
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
agent: Agent name (will be mapped if needed)
|
|
227
|
+
prompt: Prompt to send to the agent
|
|
228
|
+
session_id: Optional session ID (Claude Code only for creation)
|
|
229
|
+
skip_permissions: Whether to skip permission prompts
|
|
230
|
+
verbose: Whether to enable verbose output
|
|
231
|
+
json_output: Whether to use JSON output format
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
List of command arguments
|
|
235
|
+
"""
|
|
236
|
+
mapped_agent = self.get_agent_name(agent)
|
|
237
|
+
|
|
238
|
+
if self.platform == "opencode":
|
|
239
|
+
cmd = ["opencode", "run"]
|
|
240
|
+
cmd.extend(["--agent", mapped_agent])
|
|
241
|
+
|
|
242
|
+
# Note: OpenCode 'run' mode is non-interactive by default
|
|
243
|
+
# No equivalent to Claude Code's --dangerously-skip-permissions
|
|
244
|
+
# See: https://github.com/anomalyco/opencode/issues/9070
|
|
245
|
+
|
|
246
|
+
if json_output:
|
|
247
|
+
cmd.extend(["--format", "json"])
|
|
248
|
+
|
|
249
|
+
if verbose:
|
|
250
|
+
cmd.extend(["--log-level", "DEBUG", "--print-logs"])
|
|
251
|
+
|
|
252
|
+
# Note: OpenCode doesn't support --session-id on creation
|
|
253
|
+
# Session ID must be extracted from logs after startup
|
|
254
|
+
|
|
255
|
+
cmd.append(prompt)
|
|
256
|
+
|
|
257
|
+
elif self.platform == "codex":
|
|
258
|
+
cmd = ["codex", "exec"]
|
|
259
|
+
cmd.append(prompt)
|
|
260
|
+
elif self.platform == "kiro":
|
|
261
|
+
cmd = ["kiro", "run", prompt]
|
|
262
|
+
elif self.platform == "gemini":
|
|
263
|
+
cmd = ["gemini"]
|
|
264
|
+
cmd.append(prompt)
|
|
265
|
+
elif self.platform == "antigravity":
|
|
266
|
+
raise ValueError(
|
|
267
|
+
"Antigravity workflows are UI slash commands; CLI agent run is not supported."
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
else: # claude
|
|
271
|
+
cmd = ["claude", "-p"]
|
|
272
|
+
cmd.extend(["--agent", mapped_agent])
|
|
273
|
+
|
|
274
|
+
if session_id:
|
|
275
|
+
cmd.extend(["--session-id", session_id])
|
|
276
|
+
|
|
277
|
+
if skip_permissions:
|
|
278
|
+
cmd.append("--dangerously-skip-permissions")
|
|
279
|
+
|
|
280
|
+
if json_output:
|
|
281
|
+
cmd.extend(["--output-format", "stream-json"])
|
|
282
|
+
|
|
283
|
+
if verbose:
|
|
284
|
+
cmd.append("--verbose")
|
|
285
|
+
|
|
286
|
+
cmd.append(prompt)
|
|
287
|
+
|
|
288
|
+
return cmd
|
|
289
|
+
|
|
290
|
+
def build_resume_command(self, session_id: str) -> list[str]:
|
|
291
|
+
"""Build CLI command for resuming a session.
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
session_id: Session ID to resume
|
|
295
|
+
|
|
296
|
+
Returns:
|
|
297
|
+
List of command arguments
|
|
298
|
+
"""
|
|
299
|
+
if self.platform == "opencode":
|
|
300
|
+
return ["opencode", "run", "--session", session_id]
|
|
301
|
+
elif self.platform == "codex":
|
|
302
|
+
return ["codex", "resume", session_id]
|
|
303
|
+
elif self.platform == "kiro":
|
|
304
|
+
return ["kiro", "resume", session_id]
|
|
305
|
+
elif self.platform == "gemini":
|
|
306
|
+
return ["gemini", "--resume", session_id]
|
|
307
|
+
elif self.platform == "antigravity":
|
|
308
|
+
raise ValueError(
|
|
309
|
+
"Antigravity workflows are UI slash commands; CLI resume is not supported."
|
|
310
|
+
)
|
|
311
|
+
else:
|
|
312
|
+
return ["claude", "--resume", session_id]
|
|
313
|
+
|
|
314
|
+
def get_resume_command_str(self, session_id: str, cwd: Optional[str] = None) -> str:
|
|
315
|
+
"""Get human-readable resume command string.
|
|
316
|
+
|
|
317
|
+
Args:
|
|
318
|
+
session_id: Session ID to resume
|
|
319
|
+
cwd: Optional working directory to cd into
|
|
320
|
+
|
|
321
|
+
Returns:
|
|
322
|
+
Command string for display
|
|
323
|
+
"""
|
|
324
|
+
cmd = self.build_resume_command(session_id)
|
|
325
|
+
cmd_str = " ".join(cmd)
|
|
326
|
+
|
|
327
|
+
if cwd:
|
|
328
|
+
return f"cd {cwd} && {cmd_str}"
|
|
329
|
+
return cmd_str
|
|
330
|
+
|
|
331
|
+
# =========================================================================
|
|
332
|
+
# Platform Detection Helpers
|
|
333
|
+
# =========================================================================
|
|
334
|
+
|
|
335
|
+
@property
|
|
336
|
+
def is_opencode(self) -> bool:
|
|
337
|
+
"""Check if platform is OpenCode."""
|
|
338
|
+
return self.platform == "opencode"
|
|
339
|
+
|
|
340
|
+
@property
|
|
341
|
+
def is_claude(self) -> bool:
|
|
342
|
+
"""Check if platform is Claude Code."""
|
|
343
|
+
return self.platform == "claude"
|
|
344
|
+
|
|
345
|
+
@property
|
|
346
|
+
def is_cursor(self) -> bool:
|
|
347
|
+
"""Check if platform is Cursor."""
|
|
348
|
+
return self.platform == "cursor"
|
|
349
|
+
|
|
350
|
+
@property
|
|
351
|
+
def cli_name(self) -> str:
|
|
352
|
+
"""Get CLI executable name.
|
|
353
|
+
|
|
354
|
+
Note: Cursor doesn't have a CLI tool, returns None-like value.
|
|
355
|
+
"""
|
|
356
|
+
if self.is_opencode:
|
|
357
|
+
return "opencode"
|
|
358
|
+
elif self.is_cursor:
|
|
359
|
+
return "cursor" # Note: Cursor is IDE-only, no CLI
|
|
360
|
+
elif self.platform == "kiro":
|
|
361
|
+
return "kiro"
|
|
362
|
+
elif self.platform == "gemini":
|
|
363
|
+
return "gemini"
|
|
364
|
+
elif self.platform == "antigravity":
|
|
365
|
+
return "agy"
|
|
366
|
+
else:
|
|
367
|
+
return "claude"
|
|
368
|
+
|
|
369
|
+
@property
|
|
370
|
+
def supports_cli_agents(self) -> bool:
|
|
371
|
+
"""Check if platform supports running agents via CLI.
|
|
372
|
+
|
|
373
|
+
Claude Code and OpenCode support CLI agent execution.
|
|
374
|
+
Cursor is IDE-only and doesn't support CLI agents.
|
|
375
|
+
"""
|
|
376
|
+
return self.platform in ("claude", "opencode")
|
|
377
|
+
|
|
378
|
+
# =========================================================================
|
|
379
|
+
# Session ID Handling
|
|
380
|
+
# =========================================================================
|
|
381
|
+
|
|
382
|
+
@property
|
|
383
|
+
def supports_session_id_on_create(self) -> bool:
|
|
384
|
+
"""Check if platform supports specifying session ID on creation.
|
|
385
|
+
|
|
386
|
+
Claude Code: Yes (--session-id)
|
|
387
|
+
OpenCode: No (auto-generated, extract from logs)
|
|
388
|
+
"""
|
|
389
|
+
return self.platform == "claude"
|
|
390
|
+
|
|
391
|
+
def extract_session_id_from_log(self, log_content: str) -> Optional[str]:
|
|
392
|
+
"""Extract session ID from log output (OpenCode only).
|
|
393
|
+
|
|
394
|
+
OpenCode generates session IDs in format: ses_xxx
|
|
395
|
+
|
|
396
|
+
Args:
|
|
397
|
+
log_content: Log file content
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
Session ID if found, None otherwise
|
|
401
|
+
"""
|
|
402
|
+
import re
|
|
403
|
+
|
|
404
|
+
# OpenCode session ID pattern
|
|
405
|
+
match = re.search(r"ses_[a-zA-Z0-9]+", log_content)
|
|
406
|
+
if match:
|
|
407
|
+
return match.group(0)
|
|
408
|
+
return None
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
# =============================================================================
|
|
412
|
+
# Factory Function
|
|
413
|
+
# =============================================================================
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def get_cli_adapter(platform: str = "claude") -> CLIAdapter:
|
|
417
|
+
"""Get CLI adapter for the specified platform.
|
|
418
|
+
|
|
419
|
+
Args:
|
|
420
|
+
platform: Platform name ('claude', 'opencode', 'cursor', 'iflow', 'codex', 'kilo', 'kiro', or 'antigravity')
|
|
421
|
+
|
|
422
|
+
Returns:
|
|
423
|
+
CLIAdapter instance
|
|
424
|
+
|
|
425
|
+
Raises:
|
|
426
|
+
ValueError: If platform is not supported
|
|
427
|
+
"""
|
|
428
|
+
if platform not in ("claude", "opencode", "cursor", "iflow", "codex", "kilo", "kiro", "gemini", "antigravity"):
|
|
429
|
+
raise ValueError(f"Unsupported platform: {platform} (must be 'claude', 'opencode', 'cursor', 'iflow', 'codex', 'kilo', 'kiro', 'gemini', or 'antigravity')")
|
|
430
|
+
|
|
431
|
+
return CLIAdapter(platform=platform) # type: ignore
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
def detect_platform(project_root: Path) -> Platform:
|
|
435
|
+
"""Auto-detect platform based on existing config directories.
|
|
436
|
+
|
|
437
|
+
Detection order:
|
|
438
|
+
1. TRELLIS_PLATFORM environment variable (if set)
|
|
439
|
+
2. .opencode directory exists → opencode
|
|
440
|
+
3. .iflow directory exists → iflow
|
|
441
|
+
4. .cursor directory exists (without .claude) → cursor
|
|
442
|
+
5. .agents/skills exists and no other platform dirs → codex
|
|
443
|
+
6. .kilocode directory exists → kilo
|
|
444
|
+
7. .kiro/skills exists and no other platform dirs → kiro
|
|
445
|
+
8. .gemini directory exists → gemini
|
|
446
|
+
9. .agent/workflows exists and no other platform dirs → antigravity
|
|
447
|
+
10. Default → claude
|
|
448
|
+
|
|
449
|
+
Args:
|
|
450
|
+
project_root: Project root directory
|
|
451
|
+
|
|
452
|
+
Returns:
|
|
453
|
+
Detected platform ('claude', 'opencode', 'cursor', 'iflow', 'codex', 'kilo', 'kiro', 'gemini', or 'antigravity')
|
|
454
|
+
"""
|
|
455
|
+
import os
|
|
456
|
+
|
|
457
|
+
# Check environment variable first
|
|
458
|
+
env_platform = os.environ.get("TRELLIS_PLATFORM", "").lower()
|
|
459
|
+
if env_platform in ("claude", "opencode", "cursor", "iflow", "codex", "kilo", "kiro", "gemini", "antigravity"):
|
|
460
|
+
return env_platform # type: ignore
|
|
461
|
+
|
|
462
|
+
# Check for .opencode directory (OpenCode-specific)
|
|
463
|
+
# Note: .claude might exist in both platforms during migration
|
|
464
|
+
if (project_root / ".opencode").is_dir():
|
|
465
|
+
return "opencode"
|
|
466
|
+
|
|
467
|
+
# Check for .iflow directory (iFlow-specific)
|
|
468
|
+
# Note: .claude might exist in both platforms during migration
|
|
469
|
+
if (project_root / ".iflow").is_dir():
|
|
470
|
+
return "iflow"
|
|
471
|
+
|
|
472
|
+
# Check for .cursor directory (Cursor-specific)
|
|
473
|
+
# Only detect as cursor if .claude doesn't exist (to avoid confusion)
|
|
474
|
+
if (project_root / ".cursor").is_dir() and not (project_root / ".claude").is_dir():
|
|
475
|
+
return "cursor"
|
|
476
|
+
|
|
477
|
+
# Check for .gemini directory (Gemini CLI-specific)
|
|
478
|
+
if (project_root / ".gemini").is_dir():
|
|
479
|
+
return "gemini"
|
|
480
|
+
|
|
481
|
+
# Check for Codex skills directory only when no other platform config exists
|
|
482
|
+
other_platform_dirs_codex = (".claude", ".cursor", ".iflow", ".opencode", ".kilocode", ".kiro", ".gemini", ".agent")
|
|
483
|
+
has_other_platform_config = any(
|
|
484
|
+
(project_root / directory).is_dir() for directory in other_platform_dirs_codex
|
|
485
|
+
)
|
|
486
|
+
if (project_root / ".agents" / "skills").is_dir() and not has_other_platform_config:
|
|
487
|
+
return "codex"
|
|
488
|
+
|
|
489
|
+
# Check for .kilocode directory (Kilo-specific)
|
|
490
|
+
if (project_root / ".kilocode").is_dir():
|
|
491
|
+
return "kilo"
|
|
492
|
+
|
|
493
|
+
# Check for Kiro skills directory only when no other platform config exists
|
|
494
|
+
other_platform_dirs_kiro = (".claude", ".cursor", ".iflow", ".opencode", ".agents", ".kilocode", ".gemini", ".agent")
|
|
495
|
+
has_other_platform_config = any(
|
|
496
|
+
(project_root / directory).is_dir() for directory in other_platform_dirs_kiro
|
|
497
|
+
)
|
|
498
|
+
if (project_root / ".kiro" / "skills").is_dir() and not has_other_platform_config:
|
|
499
|
+
return "kiro"
|
|
500
|
+
|
|
501
|
+
# Check for Antigravity workflow directory only when no other platform config exists
|
|
502
|
+
other_platform_dirs_antigravity = (".claude", ".cursor", ".iflow", ".opencode", ".agents", ".kilocode", ".kiro")
|
|
503
|
+
has_other_platform_config = any(
|
|
504
|
+
(project_root / directory).is_dir() for directory in other_platform_dirs_antigravity
|
|
505
|
+
)
|
|
506
|
+
if (project_root / ".agent" / "workflows").is_dir() and not has_other_platform_config:
|
|
507
|
+
return "antigravity"
|
|
508
|
+
|
|
509
|
+
return "claude"
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
def get_cli_adapter_auto(project_root: Path) -> CLIAdapter:
|
|
513
|
+
"""Get CLI adapter with auto-detected platform.
|
|
514
|
+
|
|
515
|
+
Args:
|
|
516
|
+
project_root: Project root directory
|
|
517
|
+
|
|
518
|
+
Returns:
|
|
519
|
+
CLIAdapter instance for detected platform
|
|
520
|
+
"""
|
|
521
|
+
platform = detect_platform(project_root)
|
|
522
|
+
return CLIAdapter(platform=platform)
|