@pennixrv/trellis 0.7.2-beta.3 → 0.7.2-beta.30
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/README.md +14 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/ablate.d.ts.map +1 -1
- package/dist/commands/ablate.js +13 -0
- package/dist/commands/ablate.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +138 -120
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/teamwork/adapters/acp.d.ts.map +1 -1
- package/dist/commands/teamwork/adapters/acp.js +3 -0
- package/dist/commands/teamwork/adapters/acp.js.map +1 -1
- package/dist/commands/teamwork/adapters/index.d.ts +1 -1
- package/dist/commands/teamwork/adapters/index.d.ts.map +1 -1
- package/dist/commands/teamwork/artifact.d.ts +2 -0
- package/dist/commands/teamwork/artifact.d.ts.map +1 -1
- package/dist/commands/teamwork/artifact.js +4 -2
- package/dist/commands/teamwork/artifact.js.map +1 -1
- package/dist/commands/teamwork/batch-reservation.d.ts.map +1 -1
- package/dist/commands/teamwork/batch-reservation.js +16 -8
- package/dist/commands/teamwork/batch-reservation.js.map +1 -1
- package/dist/commands/teamwork/batch.d.ts +15 -1
- package/dist/commands/teamwork/batch.d.ts.map +1 -1
- package/dist/commands/teamwork/batch.js +279 -24
- package/dist/commands/teamwork/batch.js.map +1 -1
- package/dist/commands/teamwork/coordinator.d.ts +3 -0
- package/dist/commands/teamwork/coordinator.d.ts.map +1 -1
- package/dist/commands/teamwork/coordinator.js +22 -3
- package/dist/commands/teamwork/coordinator.js.map +1 -1
- package/dist/commands/teamwork/create.d.ts +1 -0
- package/dist/commands/teamwork/create.d.ts.map +1 -1
- package/dist/commands/teamwork/create.js +4 -0
- package/dist/commands/teamwork/create.js.map +1 -1
- package/dist/commands/teamwork/evidence-references.d.ts +19 -0
- package/dist/commands/teamwork/evidence-references.d.ts.map +1 -0
- package/dist/commands/teamwork/evidence-references.js +249 -0
- package/dist/commands/teamwork/evidence-references.js.map +1 -0
- package/dist/commands/teamwork/foreground-wait.d.ts +4 -1
- package/dist/commands/teamwork/foreground-wait.d.ts.map +1 -1
- package/dist/commands/teamwork/foreground-wait.js +15 -1
- package/dist/commands/teamwork/foreground-wait.js.map +1 -1
- package/dist/commands/teamwork/index.d.ts.map +1 -1
- package/dist/commands/teamwork/index.js +47 -5
- package/dist/commands/teamwork/index.js.map +1 -1
- package/dist/commands/teamwork/list.d.ts +1 -0
- package/dist/commands/teamwork/list.d.ts.map +1 -1
- package/dist/commands/teamwork/list.js +4 -1
- package/dist/commands/teamwork/list.js.map +1 -1
- package/dist/commands/teamwork/prompt.js +1 -1
- package/dist/commands/teamwork/prompt.js.map +1 -1
- package/dist/commands/teamwork/rm.d.ts +27 -4
- package/dist/commands/teamwork/rm.d.ts.map +1 -1
- package/dist/commands/teamwork/rm.js +155 -51
- package/dist/commands/teamwork/rm.js.map +1 -1
- package/dist/commands/teamwork/run.d.ts.map +1 -1
- package/dist/commands/teamwork/run.js +10 -1
- package/dist/commands/teamwork/run.js.map +1 -1
- package/dist/commands/teamwork/runtime.d.ts +1 -1
- package/dist/commands/teamwork/runtime.d.ts.map +1 -1
- package/dist/commands/teamwork/runtime.js +14 -4
- package/dist/commands/teamwork/runtime.js.map +1 -1
- package/dist/commands/teamwork/spawn.d.ts.map +1 -1
- package/dist/commands/teamwork/spawn.js +4 -1
- package/dist/commands/teamwork/spawn.js.map +1 -1
- package/dist/commands/teamwork/supervisor/stdout.d.ts.map +1 -1
- package/dist/commands/teamwork/supervisor/stdout.js +7 -0
- package/dist/commands/teamwork/supervisor/stdout.js.map +1 -1
- package/dist/commands/teamwork/supervisor.d.ts +1 -1
- package/dist/commands/teamwork/supervisor.d.ts.map +1 -1
- package/dist/commands/teamwork/teammate-adapters.d.ts +3 -0
- package/dist/commands/teamwork/teammate-adapters.d.ts.map +1 -1
- package/dist/commands/teamwork/teammate-adapters.js +14 -5
- package/dist/commands/teamwork/teammate-adapters.js.map +1 -1
- package/dist/commands/teamwork/teammate-launch.d.ts +3 -1
- package/dist/commands/teamwork/teammate-launch.d.ts.map +1 -1
- package/dist/commands/teamwork/teammate-launch.js +7 -5
- package/dist/commands/teamwork/teammate-launch.js.map +1 -1
- package/dist/commands/teamwork/workers.d.ts +8 -0
- package/dist/commands/teamwork/workers.d.ts.map +1 -0
- package/dist/commands/teamwork/workers.js +67 -0
- package/dist/commands/teamwork/workers.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +188 -59
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +5 -7
- package/dist/commands/workflow.js.map +1 -1
- package/dist/configurators/codebuddy.d.ts +1 -8
- package/dist/configurators/codebuddy.d.ts.map +1 -1
- package/dist/configurators/codebuddy.js +2 -12
- package/dist/configurators/codebuddy.js.map +1 -1
- package/dist/configurators/codex.d.ts +0 -36
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +13 -106
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts +1 -12
- package/dist/configurators/copilot.d.ts.map +1 -1
- package/dist/configurators/copilot.js +2 -20
- package/dist/configurators/copilot.js.map +1 -1
- package/dist/configurators/cursor.d.ts +1 -8
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +2 -12
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/droid.d.ts +1 -8
- package/dist/configurators/droid.d.ts.map +1 -1
- package/dist/configurators/droid.js +2 -12
- package/dist/configurators/droid.js.map +1 -1
- package/dist/configurators/dsh.d.ts +1 -21
- package/dist/configurators/dsh.d.ts.map +1 -1
- package/dist/configurators/dsh.js +4 -37
- package/dist/configurators/dsh.js.map +1 -1
- package/dist/configurators/gemini.d.ts +1 -16
- package/dist/configurators/gemini.d.ts.map +1 -1
- package/dist/configurators/gemini.js +3 -21
- package/dist/configurators/gemini.js.map +1 -1
- package/dist/configurators/grok.d.ts +1 -12
- package/dist/configurators/grok.d.ts.map +1 -1
- package/dist/configurators/grok.js +2 -18
- package/dist/configurators/grok.js.map +1 -1
- package/dist/configurators/kimi.d.ts +1 -21
- package/dist/configurators/kimi.d.ts.map +1 -1
- package/dist/configurators/kimi.js +2 -38
- package/dist/configurators/kimi.js.map +1 -1
- package/dist/configurators/kiro.d.ts +1 -9
- package/dist/configurators/kiro.d.ts.map +1 -1
- package/dist/configurators/kiro.js +1 -9
- package/dist/configurators/kiro.js.map +1 -1
- package/dist/configurators/omp.d.ts.map +1 -1
- package/dist/configurators/omp.js +1 -5
- package/dist/configurators/omp.js.map +1 -1
- package/dist/configurators/pi.d.ts.map +1 -1
- package/dist/configurators/pi.js +2 -5
- package/dist/configurators/pi.js.map +1 -1
- package/dist/configurators/qoder.d.ts +1 -10
- package/dist/configurators/qoder.d.ts.map +1 -1
- package/dist/configurators/qoder.js +3 -15
- package/dist/configurators/qoder.js.map +1 -1
- package/dist/configurators/reasonix.d.ts +1 -12
- package/dist/configurators/reasonix.d.ts.map +1 -1
- package/dist/configurators/reasonix.js +3 -22
- package/dist/configurators/reasonix.js.map +1 -1
- package/dist/configurators/shared.d.ts +1 -24
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +5 -184
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/snow.d.ts +1 -20
- package/dist/configurators/snow.d.ts.map +1 -1
- package/dist/configurators/snow.js +2 -25
- package/dist/configurators/snow.js.map +1 -1
- package/dist/configurators/trae.d.ts +1 -14
- package/dist/configurators/trae.d.ts.map +1 -1
- package/dist/configurators/trae.js +3 -19
- package/dist/configurators/trae.js.map +1 -1
- package/dist/configurators/workflow.d.ts +5 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +85 -57
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/configurators/zcode.d.ts +1 -13
- package/dist/configurators/zcode.d.ts.map +1 -1
- package/dist/configurators/zcode.js +2 -18
- package/dist/configurators/zcode.js.map +1 -1
- package/dist/migrations/manifests/0.5.0-beta.5.json +1 -212
- package/dist/migrations/manifests/0.7.2-beta.10.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.11.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.12.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.13.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.14.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.15.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.16.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.17.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.18.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.19.json +11 -0
- package/dist/migrations/manifests/0.7.2-beta.20.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.21.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.22.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.23.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.24.json +8 -0
- package/dist/migrations/manifests/0.7.2-beta.25.json +8 -0
- package/dist/migrations/manifests/0.7.2-beta.26.json +8 -0
- package/dist/migrations/manifests/0.7.2-beta.27.json +8 -0
- package/dist/migrations/manifests/0.7.2-beta.28.json +8 -0
- package/dist/migrations/manifests/0.7.2-beta.29.json +8 -0
- package/dist/migrations/manifests/0.7.2-beta.30.json +10 -0
- package/dist/migrations/manifests/0.7.2-beta.4.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.5.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.6.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.7.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.8.json +9 -0
- package/dist/migrations/manifests/0.7.2-beta.9.json +9 -0
- package/dist/migrations/retired-native-paths.d.ts +109 -0
- package/dist/migrations/retired-native-paths.d.ts.map +1 -0
- package/dist/migrations/retired-native-paths.js +263 -0
- package/dist/migrations/retired-native-paths.js.map +1 -0
- package/dist/templates/claude/index.d.ts +1 -16
- package/dist/templates/claude/index.d.ts.map +1 -1
- package/dist/templates/claude/index.js +5 -32
- package/dist/templates/claude/index.js.map +1 -1
- package/dist/templates/claude/settings.json +0 -22
- package/dist/templates/codebuddy/index.d.ts +2 -3
- package/dist/templates/codebuddy/index.d.ts.map +1 -1
- package/dist/templates/codebuddy/index.js +2 -3
- package/dist/templates/codebuddy/index.js.map +1 -1
- package/dist/templates/codebuddy/settings.json +0 -10
- package/dist/templates/codex/config.toml +4 -19
- package/dist/templates/codex/hooks/session-start.py +25 -30
- package/dist/templates/codex/hooks/turn-guard.py +67 -0
- package/dist/templates/codex/hooks.json +57 -6
- package/dist/templates/codex/index.d.ts +0 -5
- package/dist/templates/codex/index.d.ts.map +1 -1
- package/dist/templates/codex/index.js +0 -13
- package/dist/templates/codex/index.js.map +1 -1
- package/dist/templates/common/bundled-skills/trellis-decision-space-construction-and-merging/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-decision-space-construction-and-merging/workflow.md +13 -3
- package/dist/templates/common/bundled-skills/trellis-delivery-review-and-closeout/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-delivery-review-and-closeout/workflow.md +17 -9
- package/dist/templates/common/bundled-skills/trellis-goal-exploration-and-requirements/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-goal-exploration-and-requirements/workflow.md +7 -3
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +7 -7
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +9 -51
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +3 -15
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +1 -2
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/bundled-skills.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +4 -9
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +2 -2
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/multi-agent-teamwork.md +6 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +10 -8
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +9 -79
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +2 -4
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +3 -6
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +24 -103
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-solution-design-and-convergence/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-solution-design-and-convergence/workflow.md +27 -6
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/SKILL.md +9 -7
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/mcp-setup.md +12 -84
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/repository-analysis.md +5 -25
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +5 -9
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-writing.md +8 -0
- package/dist/templates/common/bundled-skills/trellis-task-implementation/SKILL.md +2 -0
- package/dist/templates/common/bundled-skills/trellis-task-implementation/workflow.md +5 -3
- package/dist/templates/common/bundled-skills/trellis-teamwork/SKILL.md +8 -1
- package/dist/templates/common/bundled-skills/trellis-teamwork/references/teammate-processes.md +21 -1
- package/dist/templates/common/bundled-skills/trellis-teamwork/references/teamwork-plan-construction.md +13 -2
- package/dist/templates/common/bundled-skills/trellis-worktree-delegation/SKILL.md +14 -0
- package/dist/templates/common/bundled-skills/trellis-worktree-delegation/workflow.md +82 -0
- package/dist/templates/common/commands/continue.md +16 -1
- package/dist/templates/common/commands/start.md +2 -0
- package/dist/templates/common/skills/before-dev.md +3 -1
- package/dist/templates/common/skills/check.md +3 -1
- package/dist/templates/common/skills/request-intake.md +14 -1
- package/dist/templates/copilot/hooks/session-start.py +11 -30
- package/dist/templates/cursor/hooks.json +0 -7
- package/dist/templates/cursor/index.d.ts +1 -11
- package/dist/templates/cursor/index.d.ts.map +1 -1
- package/dist/templates/cursor/index.js +2 -10
- package/dist/templates/cursor/index.js.map +1 -1
- package/dist/templates/droid/index.d.ts +2 -3
- package/dist/templates/droid/index.d.ts.map +1 -1
- package/dist/templates/droid/index.js +2 -3
- package/dist/templates/droid/index.js.map +1 -1
- package/dist/templates/droid/settings.json +0 -10
- package/dist/templates/dsh/DSH.md +2 -33
- package/dist/templates/dsh/index.d.ts +1 -19
- package/dist/templates/dsh/index.d.ts.map +1 -1
- package/dist/templates/dsh/index.js +2 -21
- package/dist/templates/dsh/index.js.map +1 -1
- package/dist/templates/gemini/index.d.ts +1 -11
- package/dist/templates/gemini/index.d.ts.map +1 -1
- package/dist/templates/gemini/index.js +2 -10
- package/dist/templates/gemini/index.js.map +1 -1
- package/dist/templates/kiro/index.d.ts +1 -13
- package/dist/templates/kiro/index.d.ts.map +1 -1
- package/dist/templates/kiro/index.js +1 -13
- package/dist/templates/kiro/index.js.map +1 -1
- package/dist/templates/markdown/agents.md +9 -14
- package/dist/templates/markdown/index.d.ts +1 -0
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +1 -0
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/spec/index.md.txt +20 -0
- package/dist/templates/omp/extensions/trellis/index.ts.txt +27 -60
- package/dist/templates/omp/index.d.ts +0 -2
- package/dist/templates/omp/index.d.ts.map +1 -1
- package/dist/templates/omp/index.js +1 -4
- package/dist/templates/omp/index.js.map +1 -1
- package/dist/templates/opencode/lib/session-utils.js +17 -5
- package/dist/templates/opencode/lib/trellis-context.js +12 -321
- package/dist/templates/opencode/plugins/inject-shell-session-context.js +93 -0
- package/dist/templates/opencode/plugins/inject-workflow-state.js +19 -17
- package/dist/templates/opencode/plugins/session-start.js +2 -6
- package/dist/templates/pi/extensions/trellis/index.ts.txt +17 -1436
- package/dist/templates/pi/index.d.ts +1 -2
- package/dist/templates/pi/index.d.ts.map +1 -1
- package/dist/templates/pi/index.js +2 -5
- package/dist/templates/pi/index.js.map +1 -1
- package/dist/templates/qoder/index.d.ts +2 -3
- package/dist/templates/qoder/index.d.ts.map +1 -1
- package/dist/templates/qoder/index.js +2 -3
- package/dist/templates/qoder/index.js.map +1 -1
- package/dist/templates/shared-hooks/guard-teamwork-wait.py +118 -12
- package/dist/templates/shared-hooks/index.d.ts +2 -56
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +4 -70
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/inject-shell-session-context.py +27 -1
- package/dist/templates/shared-hooks/inject-spec-context.py +6 -35
- package/dist/templates/shared-hooks/inject-workflow-state.py +62 -104
- package/dist/templates/shared-hooks/session-start.py +8 -6
- package/dist/templates/snow/SNOW.md +6 -18
- package/dist/templates/snow/hooks/write-trellis-context.py +51 -133
- package/dist/templates/snow/index.d.ts +2 -21
- package/dist/templates/snow/index.d.ts.map +1 -1
- package/dist/templates/snow/index.js +3 -24
- package/dist/templates/snow/index.js.map +1 -1
- package/dist/templates/template-utils.d.ts +1 -2
- package/dist/templates/template-utils.d.ts.map +1 -1
- package/dist/templates/template-utils.js +1 -11
- package/dist/templates/template-utils.js.map +1 -1
- package/dist/templates/trae/index.d.ts +2 -3
- package/dist/templates/trae/index.d.ts.map +1 -1
- package/dist/templates/trae/index.js +2 -3
- package/dist/templates/trae/index.js.map +1 -1
- package/dist/templates/trellis/agents/delegated-worktree-primary-agent.md +22 -22
- package/dist/templates/trellis/agents/teammate.md +6 -2
- package/dist/templates/trellis/agents/worktree-delegation-node.md +30 -0
- package/dist/templates/trellis/config.yaml +7 -36
- package/dist/templates/trellis/gitignore.txt +4 -0
- package/dist/templates/trellis/index.d.ts +1 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +9 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/common/active_task.py +23 -31
- package/dist/templates/trellis/scripts/common/config.py +16 -36
- package/dist/templates/trellis/scripts/common/git_context.py +13 -4
- package/dist/templates/trellis/scripts/common/io.py +2 -2
- package/dist/templates/trellis/scripts/common/markdown_format.py +107 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +29 -1
- package/dist/templates/trellis/scripts/common/session_context.py +25 -50
- package/dist/templates/trellis/scripts/common/task_context.py +5 -3
- package/dist/templates/trellis/scripts/common/task_continuity.py +66 -9
- package/dist/templates/trellis/scripts/common/task_move.py +11 -5
- package/dist/templates/trellis/scripts/common/task_runtime.py +211 -0
- package/dist/templates/trellis/scripts/common/task_store.py +8 -78
- package/dist/templates/trellis/scripts/common/task_turn.py +514 -0
- package/dist/templates/trellis/scripts/common/task_workflow.py +380 -395
- package/dist/templates/trellis/scripts/common/workflow_phase.py +3 -36
- package/dist/templates/trellis/scripts/common/workflow_selection.py +35 -40
- package/dist/templates/trellis/scripts/common/worktree_delegation.py +690 -0
- package/dist/templates/trellis/scripts/common/worktree_delegation_contract.py +446 -0
- package/dist/templates/trellis/scripts/common/worktree_delegation_messages.py +376 -0
- package/dist/templates/trellis/scripts/common/worktree_delegation_transport.py +57 -0
- package/dist/templates/trellis/scripts/markdown_format.py +40 -0
- package/dist/templates/trellis/scripts/task.py +73 -10
- package/dist/templates/trellis/workflow.md +48 -9
- package/dist/templates/zcode/config.json +0 -10
- package/dist/templates/zcode/index.d.ts +3 -22
- package/dist/templates/zcode/index.d.ts.map +1 -1
- package/dist/templates/zcode/index.js +3 -24
- package/dist/templates/zcode/index.js.map +1 -1
- package/dist/types/ai-tools.d.ts +0 -4
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +4 -109
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/ablation-store.d.ts.map +1 -1
- package/dist/utils/ablation-store.js +41 -1
- package/dist/utils/ablation-store.js.map +1 -1
- package/dist/utils/asset-backup.d.ts +1 -0
- package/dist/utils/asset-backup.d.ts.map +1 -1
- package/dist/utils/asset-backup.js +131 -31
- package/dist/utils/asset-backup.js.map +1 -1
- package/dist/utils/atomic-write.d.ts +1 -1
- package/dist/utils/atomic-write.d.ts.map +1 -1
- package/dist/utils/atomic-write.js +8 -2
- package/dist/utils/atomic-write.js.map +1 -1
- package/dist/utils/codex-config-ownership.d.ts +13 -0
- package/dist/utils/codex-config-ownership.d.ts.map +1 -0
- package/dist/utils/codex-config-ownership.js +64 -0
- package/dist/utils/codex-config-ownership.js.map +1 -0
- package/dist/utils/file-writer.d.ts +2 -0
- package/dist/utils/file-writer.d.ts.map +1 -1
- package/dist/utils/file-writer.js +1 -1
- package/dist/utils/file-writer.js.map +1 -1
- package/dist/utils/managed-markdown.d.ts +5 -0
- package/dist/utils/managed-markdown.d.ts.map +1 -0
- package/dist/utils/managed-markdown.js +64 -0
- package/dist/utils/managed-markdown.js.map +1 -0
- package/dist/utils/managed-removal.d.ts +2 -0
- package/dist/utils/managed-removal.d.ts.map +1 -1
- package/dist/utils/managed-removal.js +62 -8
- package/dist/utils/managed-removal.js.map +1 -1
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +5 -12
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/project-init.d.ts +26 -0
- package/dist/utils/project-init.d.ts.map +1 -0
- package/dist/utils/project-init.js +484 -0
- package/dist/utils/project-init.js.map +1 -0
- package/dist/utils/retired-native-assets.d.ts +17 -0
- package/dist/utils/retired-native-assets.d.ts.map +1 -0
- package/dist/utils/retired-native-assets.js +221 -0
- package/dist/utils/retired-native-assets.js.map +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
- package/dist/utils/uninstall-scrubbers.js +6 -12
- package/dist/utils/uninstall-scrubbers.js.map +1 -1
- package/package.json +2 -2
- package/dist/templates/claude/agents/trellis-check.md +0 -115
- package/dist/templates/claude/agents/trellis-implement.md +0 -110
- package/dist/templates/claude/agents/trellis-research.md +0 -137
- package/dist/templates/codebuddy/agents/trellis-check.md +0 -115
- package/dist/templates/codebuddy/agents/trellis-implement.md +0 -110
- package/dist/templates/codebuddy/agents/trellis-research.md +0 -137
- package/dist/templates/codex/agents/trellis-check.toml +0 -56
- package/dist/templates/codex/agents/trellis-implement.toml +0 -37
- package/dist/templates/codex/agents/trellis-research.toml +0 -78
- package/dist/templates/cursor/agents/trellis-check.md +0 -114
- package/dist/templates/cursor/agents/trellis-implement.md +0 -109
- package/dist/templates/cursor/agents/trellis-research.md +0 -136
- package/dist/templates/droid/droids/trellis-check.md +0 -107
- package/dist/templates/droid/droids/trellis-implement.md +0 -102
- package/dist/templates/droid/droids/trellis-research.md +0 -137
- package/dist/templates/dsh/agents/trellis-check.md +0 -99
- package/dist/templates/dsh/agents/trellis-implement.md +0 -106
- package/dist/templates/dsh/agents/trellis-research.md +0 -134
- package/dist/templates/gemini/agents/trellis-check.md +0 -107
- package/dist/templates/gemini/agents/trellis-implement.md +0 -102
- package/dist/templates/gemini/agents/trellis-research.md +0 -136
- package/dist/templates/grok/agents/trellis-check.md +0 -105
- package/dist/templates/grok/agents/trellis-implement.md +0 -116
- package/dist/templates/grok/agents/trellis-research.md +0 -146
- package/dist/templates/grok/index.d.ts +0 -16
- package/dist/templates/grok/index.d.ts.map +0 -1
- package/dist/templates/grok/index.js +0 -19
- package/dist/templates/grok/index.js.map +0 -1
- package/dist/templates/kimi/agents/trellis-check.md +0 -103
- package/dist/templates/kimi/agents/trellis-implement.md +0 -115
- package/dist/templates/kimi/agents/trellis-research.md +0 -144
- package/dist/templates/kimi/index.d.ts +0 -20
- package/dist/templates/kimi/index.d.ts.map +0 -1
- package/dist/templates/kimi/index.js +0 -23
- package/dist/templates/kimi/index.js.map +0 -1
- package/dist/templates/kiro/agents/trellis-check.json +0 -26
- package/dist/templates/kiro/agents/trellis-implement.json +0 -26
- package/dist/templates/kiro/agents/trellis-research.json +0 -30
- package/dist/templates/omp/agents/trellis-check.md +0 -41
- package/dist/templates/omp/agents/trellis-implement.md +0 -45
- package/dist/templates/omp/agents/trellis-research.md +0 -30
- package/dist/templates/opencode/agents/trellis-check.md +0 -122
- package/dist/templates/opencode/agents/trellis-implement.md +0 -118
- package/dist/templates/opencode/agents/trellis-research.md +0 -145
- package/dist/templates/opencode/plugins/inject-subagent-context.js +0 -569
- package/dist/templates/pi/agents/trellis-check.md +0 -37
- package/dist/templates/pi/agents/trellis-implement.md +0 -42
- package/dist/templates/pi/agents/trellis-research.md +0 -25
- package/dist/templates/qoder/agents/trellis-check.md +0 -108
- package/dist/templates/qoder/agents/trellis-implement.md +0 -103
- package/dist/templates/qoder/agents/trellis-research.md +0 -137
- package/dist/templates/reasonix/agents/trellis-check.md +0 -36
- package/dist/templates/reasonix/agents/trellis-implement.md +0 -41
- package/dist/templates/reasonix/index.d.ts +0 -13
- package/dist/templates/reasonix/index.d.ts.map +0 -1
- package/dist/templates/reasonix/index.js +0 -16
- package/dist/templates/reasonix/index.js.map +0 -1
- package/dist/templates/shared-hooks/inject-subagent-context.py +0 -1217
- package/dist/templates/snow/agents/trellis-check.md +0 -135
- package/dist/templates/snow/agents/trellis-implement.md +0 -153
- package/dist/templates/snow/agents/trellis-research.md +0 -114
- package/dist/templates/snow/hooks/beforeSubAgentStart.json +0 -15
- package/dist/templates/trae/agents/trellis-check.md +0 -108
- package/dist/templates/trae/agents/trellis-implement.md +0 -103
- package/dist/templates/trae/agents/trellis-research.md +0 -137
- package/dist/templates/zcode/agents/trellis-check.md +0 -109
- package/dist/templates/zcode/agents/trellis-implement.md +0 -111
- package/dist/templates/zcode/agents/trellis-research.md +0 -133
package/dist/commands/update.js
CHANGED
|
@@ -3,6 +3,9 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import inquirer from "inquirer";
|
|
6
|
+
import { managedBlock, mergeManagedMarkdown, readManagedMarkdown, } from "../utils/managed-markdown.js";
|
|
7
|
+
import { writeFileAtomic } from "../utils/atomic-write.js";
|
|
8
|
+
import { CODEX_CONFIG_PATH, ownedCodexConfig, readCodexConfig, splitCodexConfig, } from "../utils/codex-config-ownership.js";
|
|
6
9
|
import { DIR_NAMES, FILE_NAMES, PATHS } from "../constants/paths.js";
|
|
7
10
|
import { VERSION, PACKAGE_NAME } from "../constants/version.js";
|
|
8
11
|
import { getMigrationsForVersion, getAllMigrations, getMigrationMetadata, getConfigSectionsAddedBetween, } from "../migrations/index.js";
|
|
@@ -20,22 +23,43 @@ import { agentsMdContent } from "../templates/markdown/index.js";
|
|
|
20
23
|
import { COPILOT_INSTRUCTIONS_BLOCK_END, COPILOT_INSTRUCTIONS_BLOCK_START, COPILOT_INSTRUCTIONS_PATH, getCopilotInstructions, } from "../templates/copilot/index.js";
|
|
21
24
|
import { getConfiguredPlatforms, collectPlatformTemplates, } from "../configurators/index.js";
|
|
22
25
|
import { replacePythonCommandLiterals } from "../configurators/shared.js";
|
|
23
|
-
import { preserveCodexAgentModelKeys } from "../configurators/codex.js";
|
|
24
26
|
import { printZcodeSetupHint } from "../configurators/zcode.js";
|
|
25
|
-
import { ensureGitattributes } from "../configurators/workflow.js";
|
|
27
|
+
import { ensureGitattributes, withMarkdownFormatGate, } from "../configurators/workflow.js";
|
|
26
28
|
import { pruneOrphanManifestKeys } from "../utils/manifest-prune.js";
|
|
29
|
+
import { planNativeRetirement, executeNativeRetirement, assertCurrentExecutionTree, assertNativeRetirementWrites, mixedNativeAssets, } from "../utils/retired-native-assets.js";
|
|
27
30
|
import { fetchRegistrySpecTemplates, collectDirectoryFiles, removeDirectory, parseRegistrySource, probeRegistryIndex, downloadTemplateById, } from "../utils/template-fetcher.js";
|
|
28
31
|
import { loadSpecRegistryConfig } from "../utils/registry-config.js";
|
|
29
32
|
import { cleanupEmptyDirs, TRELLIS_BLOCK_END, TRELLIS_BLOCK_START, } from "../utils/managed-paths.js";
|
|
30
33
|
export { cleanupEmptyDirs, TRELLIS_BLOCK_END, TRELLIS_BLOCK_START, } from "../utils/managed-paths.js";
|
|
34
|
+
function writeUpdateFile(file) {
|
|
35
|
+
if (file.relativePath === CODEX_CONFIG_PATH) {
|
|
36
|
+
if (readCodexConfig(file.path) === file.previousContent) {
|
|
37
|
+
try {
|
|
38
|
+
writeFileAtomic(file.path, file.newContent, file.previousContent === null
|
|
39
|
+
? undefined
|
|
40
|
+
: fs.statSync(file.path).mode, file.previousContent === null);
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (error.code !== "EEXIST")
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
console.log(chalk.yellow(" ○ Preserved shared Codex configuration: changed after preview"));
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (file.previousContent === undefined) {
|
|
52
|
+
fs.writeFileSync(file.path, file.newContent);
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (file.previousContent !== undefined &&
|
|
56
|
+
readManagedMarkdown(file.path) !== file.previousContent) {
|
|
57
|
+
throw new Error(`Managed Markdown changed before write: ${file.relativePath}`);
|
|
58
|
+
}
|
|
59
|
+
writeFileAtomic(file.path, file.newContent, file.previousContent === null ? undefined : fs.statSync(file.path).mode);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
31
62
|
const CLAUDE_SETTINGS_PATH = ".claude/settings.json";
|
|
32
|
-
const LEGACY_UNTRACKED_AGENTS_MD_BLOCK_HASHES = new Set([
|
|
33
|
-
// v0.5.0-beta.17 and earlier wrote AGENTS.md but did not hash-track it.
|
|
34
|
-
// This hash is the pristine Trellis-managed block before the Subagents
|
|
35
|
-
// section was added, so old untouched projects can be updated without a
|
|
36
|
-
// false "modified by you" conflict.
|
|
37
|
-
"c1f511b1cfc1902f2147da159f09cc51f380b0c9e341cdb3ac5dea5233f3e307",
|
|
38
|
-
]);
|
|
39
63
|
// Paths that should never be touched (true user data)
|
|
40
64
|
// spec/ is user-customized content created during init; update should never modify it
|
|
41
65
|
const PROTECTED_PATHS = [
|
|
@@ -46,28 +70,15 @@ const PROTECTED_PATHS = [
|
|
|
46
70
|
`${DIR_NAMES.WORKFLOW}/.current-task`,
|
|
47
71
|
];
|
|
48
72
|
function getManagedBlock(content, startMarker, endMarker) {
|
|
49
|
-
|
|
50
|
-
if (start === -1) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
const end = content.indexOf(endMarker, start);
|
|
54
|
-
if (end === -1) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return content.slice(start, end + endMarker.length);
|
|
58
|
-
}
|
|
59
|
-
function getTrellisManagedBlock(content) {
|
|
60
|
-
return getManagedBlock(content, TRELLIS_BLOCK_START, TRELLIS_BLOCK_END);
|
|
73
|
+
return managedBlock(content, startMarker, endMarker);
|
|
61
74
|
}
|
|
62
75
|
function replaceManagedBlock(existingContent, templateContent, startMarker, endMarker) {
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const existingEnd = existingContent.indexOf(endMarker, existingStart);
|
|
68
|
-
if (existingEnd === -1) {
|
|
76
|
+
const previous = managedBlock(existingContent, startMarker, endMarker);
|
|
77
|
+
if (!previous) {
|
|
69
78
|
return null;
|
|
70
79
|
}
|
|
80
|
+
const existingStart = existingContent.indexOf(startMarker);
|
|
81
|
+
const existingEnd = existingStart + previous.length - endMarker.length;
|
|
71
82
|
const templateBlock = getManagedBlock(templateContent, startMarker, endMarker);
|
|
72
83
|
if (!templateBlock) {
|
|
73
84
|
return null;
|
|
@@ -85,15 +96,14 @@ function mergeManagedBlockContent(existingContent, templateContent, startMarker,
|
|
|
85
96
|
if (!templateBlock) {
|
|
86
97
|
return templateContent;
|
|
87
98
|
}
|
|
88
|
-
|
|
89
|
-
return `${trimmed}\n\n${templateBlock}\n`;
|
|
99
|
+
return mergeManagedMarkdown(existingContent, templateContent, startMarker, endMarker);
|
|
90
100
|
}
|
|
91
101
|
function buildManagedBlockTemplate(cwd, relativePath, templateContent, startMarker, endMarker) {
|
|
92
102
|
const fullPath = path.join(cwd, ...relativePath.split("/"));
|
|
93
|
-
|
|
103
|
+
const existingContent = readManagedMarkdown(fullPath);
|
|
104
|
+
if (existingContent === null) {
|
|
94
105
|
return templateContent;
|
|
95
106
|
}
|
|
96
|
-
const existingContent = fs.readFileSync(fullPath, "utf-8");
|
|
97
107
|
return mergeManagedBlockContent(existingContent, templateContent, startMarker, endMarker);
|
|
98
108
|
}
|
|
99
109
|
function buildAgentsMdTemplate(cwd) {
|
|
@@ -102,16 +112,6 @@ function buildAgentsMdTemplate(cwd) {
|
|
|
102
112
|
function buildCopilotInstructionsTemplate(cwd) {
|
|
103
113
|
return buildManagedBlockTemplate(cwd, COPILOT_INSTRUCTIONS_PATH, getCopilotInstructions(), COPILOT_INSTRUCTIONS_BLOCK_START, COPILOT_INSTRUCTIONS_BLOCK_END);
|
|
104
114
|
}
|
|
105
|
-
function isKnownUntrackedTemplate(relativePath, existingContent) {
|
|
106
|
-
if (relativePath !== FILE_NAMES.AGENTS) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
const managedBlock = getTrellisManagedBlock(existingContent);
|
|
110
|
-
if (!managedBlock) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
return LEGACY_UNTRACKED_AGENTS_MD_BLOCK_HASHES.has(computeHash(managedBlock));
|
|
114
|
-
}
|
|
115
115
|
function isSafeUntrackedCopilotInstructionsMerge(relativePath, existingContent, newContent) {
|
|
116
116
|
if (relativePath !== COPILOT_INSTRUCTIONS_PATH) {
|
|
117
117
|
return false;
|
|
@@ -528,6 +528,24 @@ function preserveExistingRegistryConfig(cwd, template) {
|
|
|
528
528
|
` source: ${registry.source}\n` +
|
|
529
529
|
(registry.template ? ` template: ${registry.template}\n` : ""));
|
|
530
530
|
}
|
|
531
|
+
const RUNTIME_IGNORE_RULES = [
|
|
532
|
+
"session-handoffs/",
|
|
533
|
+
"tasks/**/provider-stderr.log",
|
|
534
|
+
];
|
|
535
|
+
function runtimeIgnoreContent(existing) {
|
|
536
|
+
const lines = existing.split(/\r?\n/).map((line) => line.trim());
|
|
537
|
+
const missing = RUNTIME_IGNORE_RULES.filter((rule) => {
|
|
538
|
+
const index = lines.lastIndexOf(rule);
|
|
539
|
+
return (index < 0 || lines.slice(index + 1).some((line) => line.startsWith("!")));
|
|
540
|
+
});
|
|
541
|
+
return missing.length
|
|
542
|
+
? existing +
|
|
543
|
+
(existing.endsWith("\n") ? "\n" : "\n\n") +
|
|
544
|
+
"# Private Trellis handoff and provider diagnostics\n" +
|
|
545
|
+
missing.join("\n") +
|
|
546
|
+
"\n"
|
|
547
|
+
: existing;
|
|
548
|
+
}
|
|
531
549
|
async function collectRegistrySpecTemplates(cwd) {
|
|
532
550
|
const config = loadSpecRegistryConfig(cwd);
|
|
533
551
|
if (!config)
|
|
@@ -605,8 +623,12 @@ bypassUpdateSkip = false) {
|
|
|
605
623
|
}
|
|
606
624
|
// Configuration
|
|
607
625
|
files.set(`${DIR_NAMES.WORKFLOW}/teamwork.json`, teamworkConfigTemplate);
|
|
608
|
-
files.set(`${DIR_NAMES.WORKFLOW}/config.yaml`, preserveExistingRegistryConfig(cwd, configYamlTemplate));
|
|
609
|
-
|
|
626
|
+
files.set(`${DIR_NAMES.WORKFLOW}/config.yaml`, withMarkdownFormatGate(cwd, preserveExistingRegistryConfig(cwd, configYamlTemplate)));
|
|
627
|
+
const ignorePath = `${DIR_NAMES.WORKFLOW}/.gitignore`;
|
|
628
|
+
const existingIgnore = path.join(cwd, ignorePath);
|
|
629
|
+
files.set(ignorePath, fs.existsSync(existingIgnore)
|
|
630
|
+
? runtimeIgnoreContent(fs.readFileSync(existingIgnore, "utf8"))
|
|
631
|
+
: gitignoreTemplate);
|
|
610
632
|
// workflow.md is included here because it is runtime-parsed by
|
|
611
633
|
// get_context.py and shared hooks. Keep it on the normal template update
|
|
612
634
|
// path: if the installed file still matches the tracked hash, update the
|
|
@@ -630,14 +652,6 @@ bypassUpdateSkip = false) {
|
|
|
630
652
|
}
|
|
631
653
|
}
|
|
632
654
|
}
|
|
633
|
-
// Users configure sub-agent models by editing `model` /
|
|
634
|
-
// `model_reasoning_effort` directly on the generated agent tomls. Preserve
|
|
635
|
-
// those two keys from the on-disk files into the freshly rendered desired
|
|
636
|
-
// content so a project whose only local edit is these keys is not flagged
|
|
637
|
-
// as a modified-file conflict by the hash comparison below.
|
|
638
|
-
if (platforms.has("codex")) {
|
|
639
|
-
preserveCodexAgentModelKeys(cwd, files);
|
|
640
|
-
}
|
|
641
655
|
preserveExistingClaudeStatusLine(cwd, files);
|
|
642
656
|
for (const [filePath, content] of await collectRegistrySpecTemplates(cwd)) {
|
|
643
657
|
files.set(filePath, content);
|
|
@@ -679,11 +693,49 @@ function analyzeChanges(cwd, hashes, templates) {
|
|
|
679
693
|
};
|
|
680
694
|
for (const [relativePath, newContent] of templates) {
|
|
681
695
|
const fullPath = path.join(cwd, relativePath);
|
|
696
|
+
if (relativePath === CODEX_CONFIG_PATH) {
|
|
697
|
+
const current = readCodexConfig(fullPath);
|
|
698
|
+
const seed = splitCodexConfig(newContent);
|
|
699
|
+
if (!seed || seed.suffix)
|
|
700
|
+
throw new Error("Invalid bundled Codex configuration prefix");
|
|
701
|
+
const stored = hashes[relativePath];
|
|
702
|
+
if (current === null && !stored) {
|
|
703
|
+
result.newFiles.push({
|
|
704
|
+
path: fullPath,
|
|
705
|
+
relativePath,
|
|
706
|
+
newContent,
|
|
707
|
+
previousContent: null,
|
|
708
|
+
status: "new",
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
else if (current !== null) {
|
|
712
|
+
const owned = typeof current === "string"
|
|
713
|
+
? ownedCodexConfig(current, stored)
|
|
714
|
+
: undefined;
|
|
715
|
+
if (!owned) {
|
|
716
|
+
console.log(chalk.gray(` ○ Preserved shared ${relativePath}: no matching Trellis ownership receipt`));
|
|
717
|
+
}
|
|
718
|
+
else if (owned.prefix !== newContent) {
|
|
719
|
+
result.autoUpdateFiles.push({
|
|
720
|
+
path: fullPath,
|
|
721
|
+
relativePath,
|
|
722
|
+
newContent: newContent + owned.suffix,
|
|
723
|
+
previousContent: current,
|
|
724
|
+
templateContent: newContent,
|
|
725
|
+
status: "changed",
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
682
731
|
const exists = fs.existsSync(fullPath);
|
|
683
732
|
const change = {
|
|
684
733
|
path: fullPath,
|
|
685
734
|
relativePath,
|
|
686
735
|
newContent,
|
|
736
|
+
previousContent: relativePath === FILE_NAMES.AGENTS
|
|
737
|
+
? readManagedMarkdown(fullPath)
|
|
738
|
+
: undefined,
|
|
687
739
|
status: "new",
|
|
688
740
|
};
|
|
689
741
|
if (!exists) {
|
|
@@ -709,8 +761,9 @@ function analyzeChanges(cwd, hashes, templates) {
|
|
|
709
761
|
const storedHash = hashes[relativePath];
|
|
710
762
|
const currentHash = computeHash(existingContent);
|
|
711
763
|
if ((storedHash && storedHash === currentHash) ||
|
|
712
|
-
(
|
|
713
|
-
|
|
764
|
+
(relativePath === `${DIR_NAMES.WORKFLOW}/.gitignore` &&
|
|
765
|
+
newContent.startsWith(existingContent) &&
|
|
766
|
+
newContent === runtimeIgnoreContent(existingContent)) ||
|
|
714
767
|
(!storedHash &&
|
|
715
768
|
isSafeUntrackedCopilotInstructionsMerge(relativePath, existingContent, newContent))) {
|
|
716
769
|
// Either the tracked hash matches, or this is a known pristine template
|
|
@@ -758,6 +811,8 @@ function collectUnchangedFileHashRepairs(changes, hashes) {
|
|
|
758
811
|
const key = toPosix(file.relativePath);
|
|
759
812
|
const recorded = hashes[key];
|
|
760
813
|
if (recorded === undefined) {
|
|
814
|
+
if (key === FILE_NAMES.AGENTS)
|
|
815
|
+
continue;
|
|
761
816
|
// A missing entry is only an omission for a path the receipt is meant
|
|
762
817
|
// to carry. `EXCLUDE_FROM_HASH` holds paths deliberately left out —
|
|
763
818
|
// `.trellis/.gitignore` among them — and adding those here would put
|
|
@@ -1625,6 +1680,14 @@ export async function update(options) {
|
|
|
1625
1680
|
// Migration metadata is displayed at the end to prevent scrolling off screen
|
|
1626
1681
|
// Load template hashes for modification detection
|
|
1627
1682
|
let hashes = loadHashes(cwd);
|
|
1683
|
+
const retirementHashes = { ...hashes };
|
|
1684
|
+
// Keep ownership evidence before orphan pruning removes retired paths.
|
|
1685
|
+
const nativeRetirement = planNativeRetirement(cwd, hashes, loadUpdateSkipPaths(cwd));
|
|
1686
|
+
if (nativeRetirement.deletions.length > 0) {
|
|
1687
|
+
console.log(chalk.cyan("Retiring native execution assets:"));
|
|
1688
|
+
for (const entry of nativeRetirement.deletions)
|
|
1689
|
+
console.log(` Delete: ${entry.path}`);
|
|
1690
|
+
}
|
|
1628
1691
|
const zcodeConfigured = getConfiguredPlatforms(cwd).has("zcode");
|
|
1629
1692
|
const isFirstHashTracking = Object.keys(hashes).length === 0;
|
|
1630
1693
|
// Handle unknown version - skip regular migrations but safe-file-delete still runs
|
|
@@ -1674,7 +1737,37 @@ export async function update(options) {
|
|
|
1674
1737
|
return md.breaking && md.recommendMigrate;
|
|
1675
1738
|
})();
|
|
1676
1739
|
// Collect templates (used for both migration classification and change analysis)
|
|
1740
|
+
const agentsSnapshot = readManagedMarkdown(path.join(cwd, FILE_NAMES.AGENTS));
|
|
1677
1741
|
const templates = await collectTemplateFiles(cwd, codexUpgradeNeeded ? new Set(["codex"]) : undefined, breakingBypass);
|
|
1742
|
+
const mixedBaselines = new Map();
|
|
1743
|
+
for (const relative of mixedNativeAssets) {
|
|
1744
|
+
const template = templates.get(relative);
|
|
1745
|
+
const absolute = path.join(cwd, relative);
|
|
1746
|
+
if (template === undefined || !fs.existsSync(absolute))
|
|
1747
|
+
continue;
|
|
1748
|
+
const current = fs.readFileSync(absolute, "utf8");
|
|
1749
|
+
if (nativeRetirement.edits.has(relative)) {
|
|
1750
|
+
mixedBaselines.set(relative, template);
|
|
1751
|
+
}
|
|
1752
|
+
else if (current !== template &&
|
|
1753
|
+
hashes[relative] === computeHash(current)) {
|
|
1754
|
+
// A mixed-content receipt cannot authorize replacing user fields.
|
|
1755
|
+
hashes[relative] = computeHash(template);
|
|
1756
|
+
mixedBaselines.set(relative, template);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
for (const [relative, content] of nativeRetirement.edits) {
|
|
1760
|
+
templates.set(relative, content);
|
|
1761
|
+
}
|
|
1762
|
+
for (const [relative, hash] of nativeRetirement.originalHashes) {
|
|
1763
|
+
hashes[relative] = hash;
|
|
1764
|
+
retirementHashes[relative] = hash;
|
|
1765
|
+
}
|
|
1766
|
+
assertNativeRetirementWrites(cwd, templates, retirementHashes, nativeRetirement.edits);
|
|
1767
|
+
if (readManagedMarkdown(path.join(cwd, FILE_NAMES.AGENTS)) !==
|
|
1768
|
+
agentsSnapshot) {
|
|
1769
|
+
throw new Error("AGENTS.md changed during template collection; preview again");
|
|
1770
|
+
}
|
|
1678
1771
|
// Load update.skip paths (used for both safe-file-delete and template collection)
|
|
1679
1772
|
const skipPaths = loadUpdateSkipPaths(cwd);
|
|
1680
1773
|
// Collect safe-file-delete items from ALL manifests (hash match is the safety net)
|
|
@@ -1765,6 +1858,12 @@ export async function update(options) {
|
|
|
1765
1858
|
}
|
|
1766
1859
|
// Analyze changes (pass hashes for modification detection)
|
|
1767
1860
|
const changes = analyzeChanges(cwd, hashes, templates);
|
|
1861
|
+
const sharedCodex = templates.has(CODEX_CONFIG_PATH)
|
|
1862
|
+
? readCodexConfig(path.join(cwd, CODEX_CONFIG_PATH))
|
|
1863
|
+
: undefined;
|
|
1864
|
+
const discardMixedCodexReceipt = typeof sharedCodex === "string" &&
|
|
1865
|
+
hashes[CODEX_CONFIG_PATH] === computeHash(sharedCodex) &&
|
|
1866
|
+
!ownedCodexConfig(sharedCodex, hashes[CODEX_CONFIG_PATH]);
|
|
1768
1867
|
const unchangedFileHashRepairs = collectUnchangedFileHashRepairs(changes, hashes);
|
|
1769
1868
|
// Print summary
|
|
1770
1869
|
printChangeSummary(changes);
|
|
@@ -1794,19 +1893,24 @@ export async function update(options) {
|
|
|
1794
1893
|
changes.autoUpdateFiles.length === 0 &&
|
|
1795
1894
|
changes.changedFiles.length === 0 &&
|
|
1796
1895
|
!hasPendingMigrations &&
|
|
1797
|
-
!hasSafeDeletes
|
|
1896
|
+
!hasSafeDeletes &&
|
|
1897
|
+
nativeRetirement.deletions.length === 0) {
|
|
1898
|
+
assertCurrentExecutionTree(cwd);
|
|
1798
1899
|
// The "already up to date" exit still has to repair the receipt: this is
|
|
1799
1900
|
// exactly the clean tree where every file is `unchanged`, so it is the run
|
|
1800
1901
|
// where a wrong entry would otherwise be skipped again.
|
|
1801
1902
|
if (!options.dryRun && unchangedFileHashRepairs.size > 0) {
|
|
1802
1903
|
updateHashes(cwd, unchangedFileHashRepairs);
|
|
1803
1904
|
}
|
|
1905
|
+
if (!options.dryRun && discardMixedCodexReceipt)
|
|
1906
|
+
removeHash(cwd, CODEX_CONFIG_PATH);
|
|
1804
1907
|
if (isSameVersion) {
|
|
1805
1908
|
console.log(chalk.green("✓ Already up to date!"));
|
|
1806
1909
|
}
|
|
1807
1910
|
else {
|
|
1808
1911
|
// Version changed but no file changes needed — still update the version stamp
|
|
1809
|
-
|
|
1912
|
+
if (!options.dryRun)
|
|
1913
|
+
updateVersionFile(cwd);
|
|
1810
1914
|
if (isUpgrade) {
|
|
1811
1915
|
console.log(chalk.green(`✓ No file changes needed for ${projectVersion} → ${cliVersion}`));
|
|
1812
1916
|
}
|
|
@@ -1906,6 +2010,7 @@ export async function update(options) {
|
|
|
1906
2010
|
];
|
|
1907
2011
|
});
|
|
1908
2012
|
const backupDir = createFullBackup(cwd, [
|
|
2013
|
+
...nativeRetirement.deletions.map((entry) => entry.path),
|
|
1909
2014
|
...templates.keys(),
|
|
1910
2015
|
...changes.changedFiles.map((file) => `${file.relativePath}.new`),
|
|
1911
2016
|
...migrationScope,
|
|
@@ -1938,6 +2043,7 @@ export async function update(options) {
|
|
|
1938
2043
|
}
|
|
1939
2044
|
}
|
|
1940
2045
|
// Execute safe-file-delete (after backup, before template writes)
|
|
2046
|
+
executeNativeRetirement(cwd, nativeRetirement);
|
|
1941
2047
|
let safeDeleted = 0;
|
|
1942
2048
|
if (hasSafeDeletes) {
|
|
1943
2049
|
safeDeleted = executeSafeFileDeletes(safeFileDeletes, cwd);
|
|
@@ -1951,13 +2057,18 @@ export async function update(options) {
|
|
|
1951
2057
|
let updated = 0;
|
|
1952
2058
|
let skipped = 0;
|
|
1953
2059
|
let createdNew = 0;
|
|
2060
|
+
const skippedWrites = new Set();
|
|
1954
2061
|
// Add new files
|
|
1955
2062
|
if (changes.newFiles.length > 0) {
|
|
1956
2063
|
console.log(chalk.blue("\nAdding new files..."));
|
|
1957
2064
|
for (const file of changes.newFiles) {
|
|
1958
2065
|
const dir = path.dirname(file.path);
|
|
1959
2066
|
fs.mkdirSync(dir, { recursive: true });
|
|
1960
|
-
|
|
2067
|
+
if (!writeUpdateFile(file)) {
|
|
2068
|
+
skippedWrites.add(file.relativePath);
|
|
2069
|
+
skipped++;
|
|
2070
|
+
continue;
|
|
2071
|
+
}
|
|
1961
2072
|
// Make scripts executable
|
|
1962
2073
|
if (file.relativePath.endsWith(".sh") ||
|
|
1963
2074
|
file.relativePath.endsWith(".py")) {
|
|
@@ -1971,7 +2082,11 @@ export async function update(options) {
|
|
|
1971
2082
|
if (changes.autoUpdateFiles.length > 0) {
|
|
1972
2083
|
console.log(chalk.blue("\nAuto-updating template files..."));
|
|
1973
2084
|
for (const file of changes.autoUpdateFiles) {
|
|
1974
|
-
|
|
2085
|
+
if (!writeUpdateFile(file)) {
|
|
2086
|
+
skippedWrites.add(file.relativePath);
|
|
2087
|
+
skipped++;
|
|
2088
|
+
continue;
|
|
2089
|
+
}
|
|
1975
2090
|
// Make scripts executable
|
|
1976
2091
|
if (file.relativePath.endsWith(".sh") ||
|
|
1977
2092
|
file.relativePath.endsWith(".py")) {
|
|
@@ -1988,7 +2103,7 @@ export async function update(options) {
|
|
|
1988
2103
|
for (const file of changes.changedFiles) {
|
|
1989
2104
|
const action = await promptConflictResolution(file, options, applyToAll);
|
|
1990
2105
|
if (action === "overwrite") {
|
|
1991
|
-
|
|
2106
|
+
writeUpdateFile(file);
|
|
1992
2107
|
if (file.relativePath.endsWith(".sh") ||
|
|
1993
2108
|
file.relativePath.endsWith(".py")) {
|
|
1994
2109
|
fs.chmodSync(file.path, "755");
|
|
@@ -2020,18 +2135,27 @@ export async function update(options) {
|
|
|
2020
2135
|
}
|
|
2021
2136
|
}
|
|
2022
2137
|
// Update version file
|
|
2138
|
+
assertCurrentExecutionTree(cwd);
|
|
2023
2139
|
updateVersionFile(cwd);
|
|
2024
2140
|
// Update template hashes for new, auto-updated, and overwritten files
|
|
2025
2141
|
const filesToHash = new Map(unchangedFileHashRepairs);
|
|
2026
2142
|
for (const file of changes.newFiles) {
|
|
2143
|
+
if (file.relativePath === `${DIR_NAMES.WORKFLOW}/.gitignore` ||
|
|
2144
|
+
skippedWrites.has(file.relativePath))
|
|
2145
|
+
continue;
|
|
2027
2146
|
filesToHash.set(file.relativePath, file.newContent);
|
|
2028
2147
|
}
|
|
2029
2148
|
// Auto-updated files always get new hash
|
|
2030
2149
|
for (const file of changes.autoUpdateFiles) {
|
|
2031
|
-
|
|
2150
|
+
if (file.relativePath === `${DIR_NAMES.WORKFLOW}/.gitignore` ||
|
|
2151
|
+
skippedWrites.has(file.relativePath))
|
|
2152
|
+
continue;
|
|
2153
|
+
filesToHash.set(file.relativePath, file.templateContent ?? file.newContent);
|
|
2032
2154
|
}
|
|
2033
2155
|
// Only hash overwritten files (not skipped or .new copies)
|
|
2034
2156
|
for (const file of changes.changedFiles) {
|
|
2157
|
+
if (file.relativePath === `${DIR_NAMES.WORKFLOW}/.gitignore`)
|
|
2158
|
+
continue;
|
|
2035
2159
|
const fullPath = path.join(cwd, file.relativePath);
|
|
2036
2160
|
if (fs.existsSync(fullPath)) {
|
|
2037
2161
|
const content = fs.readFileSync(fullPath, "utf-8");
|
|
@@ -2040,9 +2164,14 @@ export async function update(options) {
|
|
|
2040
2164
|
}
|
|
2041
2165
|
}
|
|
2042
2166
|
}
|
|
2167
|
+
for (const [relative, template] of mixedBaselines) {
|
|
2168
|
+
filesToHash.set(relative, template);
|
|
2169
|
+
}
|
|
2043
2170
|
if (filesToHash.size > 0) {
|
|
2044
2171
|
updateHashes(cwd, filesToHash);
|
|
2045
2172
|
}
|
|
2173
|
+
if (discardMixedCodexReceipt)
|
|
2174
|
+
removeHash(cwd, CODEX_CONFIG_PATH);
|
|
2046
2175
|
// Print summary
|
|
2047
2176
|
console.log(chalk.cyan("\n--- Summary ---\n"));
|
|
2048
2177
|
if (added > 0) {
|