trellis-herbivore 0.1.0
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/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 +174 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/channel/adapters/claude.d.ts +38 -0
- package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
- package/dist/commands/channel/adapters/claude.js +209 -0
- package/dist/commands/channel/adapters/claude.js.map +1 -0
- package/dist/commands/channel/adapters/codex.d.ts +77 -0
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
- package/dist/commands/channel/adapters/codex.js +495 -0
- package/dist/commands/channel/adapters/codex.js.map +1 -0
- package/dist/commands/channel/adapters/index.d.ts +79 -0
- package/dist/commands/channel/adapters/index.d.ts.map +1 -0
- package/dist/commands/channel/adapters/index.js +109 -0
- package/dist/commands/channel/adapters/index.js.map +1 -0
- package/dist/commands/channel/adapters/types.d.ts +33 -0
- package/dist/commands/channel/adapters/types.d.ts.map +1 -0
- package/dist/commands/channel/adapters/types.js +2 -0
- package/dist/commands/channel/adapters/types.js.map +1 -0
- package/dist/commands/channel/agent-loader.d.ts +32 -0
- package/dist/commands/channel/agent-loader.d.ts.map +1 -0
- package/dist/commands/channel/agent-loader.js +154 -0
- package/dist/commands/channel/agent-loader.js.map +1 -0
- package/dist/commands/channel/context-loader.d.ts +26 -0
- package/dist/commands/channel/context-loader.d.ts.map +1 -0
- package/dist/commands/channel/context-loader.js +290 -0
- package/dist/commands/channel/context-loader.js.map +1 -0
- package/dist/commands/channel/context.d.ts +16 -0
- package/dist/commands/channel/context.d.ts.map +1 -0
- package/dist/commands/channel/context.js +83 -0
- package/dist/commands/channel/context.js.map +1 -0
- package/dist/commands/channel/create.d.ts +27 -0
- package/dist/commands/channel/create.d.ts.map +1 -0
- package/dist/commands/channel/create.js +39 -0
- package/dist/commands/channel/create.js.map +1 -0
- package/dist/commands/channel/dev-parse-trace.d.ts +14 -0
- package/dist/commands/channel/dev-parse-trace.d.ts.map +1 -0
- package/dist/commands/channel/dev-parse-trace.js +70 -0
- package/dist/commands/channel/dev-parse-trace.js.map +1 -0
- package/dist/commands/channel/index.d.ts +3 -0
- package/dist/commands/channel/index.d.ts.map +1 -0
- package/dist/commands/channel/index.js +496 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/channel/kill.d.ts +7 -0
- package/dist/commands/channel/kill.d.ts.map +1 -0
- package/dist/commands/channel/kill.js +121 -0
- package/dist/commands/channel/kill.js.map +1 -0
- package/dist/commands/channel/list.d.ts +17 -0
- package/dist/commands/channel/list.d.ts.map +1 -0
- package/dist/commands/channel/list.js +233 -0
- package/dist/commands/channel/list.js.map +1 -0
- package/dist/commands/channel/messages.d.ts +16 -0
- package/dist/commands/channel/messages.d.ts.map +1 -0
- package/dist/commands/channel/messages.js +237 -0
- package/dist/commands/channel/messages.js.map +1 -0
- package/dist/commands/channel/rm.d.ts +27 -0
- package/dist/commands/channel/rm.d.ts.map +1 -0
- package/dist/commands/channel/rm.js +216 -0
- package/dist/commands/channel/rm.js.map +1 -0
- package/dist/commands/channel/run.d.ts +31 -0
- package/dist/commands/channel/run.d.ts.map +1 -0
- package/dist/commands/channel/run.js +137 -0
- package/dist/commands/channel/run.js.map +1 -0
- package/dist/commands/channel/send.d.ts +12 -0
- package/dist/commands/channel/send.d.ts.map +1 -0
- package/dist/commands/channel/send.js +24 -0
- package/dist/commands/channel/send.js.map +1 -0
- package/dist/commands/channel/spawn.d.ts +25 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -0
- package/dist/commands/channel/spawn.js +192 -0
- package/dist/commands/channel/spawn.js.map +1 -0
- package/dist/commands/channel/store/events.d.ts +39 -0
- package/dist/commands/channel/store/events.d.ts.map +1 -0
- package/dist/commands/channel/store/events.js +87 -0
- package/dist/commands/channel/store/events.js.map +1 -0
- package/dist/commands/channel/store/filter.d.ts +3 -0
- package/dist/commands/channel/store/filter.d.ts.map +1 -0
- package/dist/commands/channel/store/filter.js +2 -0
- package/dist/commands/channel/store/filter.js.map +1 -0
- package/dist/commands/channel/store/lock.d.ts +23 -0
- package/dist/commands/channel/store/lock.d.ts.map +1 -0
- package/dist/commands/channel/store/lock.js +99 -0
- package/dist/commands/channel/store/lock.js.map +1 -0
- package/dist/commands/channel/store/paths.d.ts +63 -0
- package/dist/commands/channel/store/paths.d.ts.map +1 -0
- package/dist/commands/channel/store/paths.js +246 -0
- package/dist/commands/channel/store/paths.js.map +1 -0
- package/dist/commands/channel/store/schema.d.ts +27 -0
- package/dist/commands/channel/store/schema.d.ts.map +1 -0
- package/dist/commands/channel/store/schema.js +34 -0
- package/dist/commands/channel/store/schema.js.map +1 -0
- package/dist/commands/channel/store/thread-state.d.ts +5 -0
- package/dist/commands/channel/store/thread-state.d.ts.map +1 -0
- package/dist/commands/channel/store/thread-state.js +16 -0
- package/dist/commands/channel/store/thread-state.js.map +1 -0
- package/dist/commands/channel/store/watch.d.ts +19 -0
- package/dist/commands/channel/store/watch.d.ts.map +1 -0
- package/dist/commands/channel/store/watch.js +130 -0
- package/dist/commands/channel/store/watch.js.map +1 -0
- package/dist/commands/channel/supervisor/inbox.d.ts +25 -0
- package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/inbox.js +99 -0
- package/dist/commands/channel/supervisor/inbox.js.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts +66 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.js +143 -0
- package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
- package/dist/commands/channel/supervisor/stdout.d.ts +49 -0
- package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/stdout.js +107 -0
- package/dist/commands/channel/supervisor/stdout.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +47 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -0
- package/dist/commands/channel/supervisor.js +283 -0
- package/dist/commands/channel/supervisor.js.map +1 -0
- package/dist/commands/channel/text-body.d.ts +13 -0
- package/dist/commands/channel/text-body.d.ts.map +1 -0
- package/dist/commands/channel/text-body.js +47 -0
- package/dist/commands/channel/text-body.js.map +1 -0
- package/dist/commands/channel/threads.d.ts +39 -0
- package/dist/commands/channel/threads.d.ts.map +1 -0
- package/dist/commands/channel/threads.js +106 -0
- package/dist/commands/channel/threads.js.map +1 -0
- package/dist/commands/channel/title.d.ts +12 -0
- package/dist/commands/channel/title.d.ts.map +1 -0
- package/dist/commands/channel/title.js +24 -0
- package/dist/commands/channel/title.js.map +1 -0
- package/dist/commands/channel/wait.d.ts +18 -0
- package/dist/commands/channel/wait.d.ts.map +1 -0
- package/dist/commands/channel/wait.js +76 -0
- package/dist/commands/channel/wait.js.map +1 -0
- package/dist/commands/init.d.ts +57 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +1466 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mem.d.ts +234 -0
- package/dist/commands/mem.d.ts.map +1 -0
- package/dist/commands/mem.js +1869 -0
- package/dist/commands/mem.js.map +1 -0
- package/dist/commands/uninstall.d.ts +27 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +339 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/commands/update.d.ts +72 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +1926 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/upgrade.d.ts +28 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +84 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/configurators/antigravity.d.ts +7 -0
- package/dist/configurators/antigravity.d.ts.map +1 -0
- package/dist/configurators/antigravity.js +19 -0
- package/dist/configurators/antigravity.js.map +1 -0
- package/dist/configurators/claude.d.ts +9 -0
- package/dist/configurators/claude.d.ts.map +1 -0
- package/dist/configurators/claude.js +72 -0
- package/dist/configurators/claude.js.map +1 -0
- package/dist/configurators/codebuddy.d.ts +10 -0
- package/dist/configurators/codebuddy.d.ts.map +1 -0
- package/dist/configurators/codebuddy.js +30 -0
- package/dist/configurators/codebuddy.js.map +1 -0
- package/dist/configurators/codex.d.ts +8 -0
- package/dist/configurators/codex.d.ts.map +1 -0
- package/dist/configurators/codex.js +87 -0
- package/dist/configurators/codex.js.map +1 -0
- package/dist/configurators/copilot.d.ts +10 -0
- package/dist/configurators/copilot.d.ts.map +1 -0
- package/dist/configurators/copilot.js +51 -0
- package/dist/configurators/copilot.js.map +1 -0
- package/dist/configurators/cursor.d.ts +10 -0
- package/dist/configurators/cursor.d.ts.map +1 -0
- package/dist/configurators/cursor.js +29 -0
- package/dist/configurators/cursor.js.map +1 -0
- package/dist/configurators/droid.d.ts +10 -0
- package/dist/configurators/droid.d.ts.map +1 -0
- package/dist/configurators/droid.js +30 -0
- package/dist/configurators/droid.js.map +1 -0
- package/dist/configurators/gemini.d.ts +16 -0
- package/dist/configurators/gemini.d.ts.map +1 -0
- package/dist/configurators/gemini.js +38 -0
- package/dist/configurators/gemini.js.map +1 -0
- package/dist/configurators/index.d.ts +65 -0
- package/dist/configurators/index.d.ts.map +1 -0
- package/dist/configurators/index.js +367 -0
- package/dist/configurators/index.js.map +1 -0
- package/dist/configurators/kilo.d.ts +7 -0
- package/dist/configurators/kilo.d.ts.map +1 -0
- package/dist/configurators/kilo.js +19 -0
- package/dist/configurators/kilo.js.map +1 -0
- package/dist/configurators/kiro.d.ts +8 -0
- package/dist/configurators/kiro.d.ts.map +1 -0
- package/dist/configurators/kiro.js +24 -0
- package/dist/configurators/kiro.js.map +1 -0
- package/dist/configurators/opencode.d.ts +14 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +96 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/pi.d.ts +3 -0
- package/dist/configurators/pi.d.ts.map +1 -0
- package/dist/configurators/pi.js +45 -0
- package/dist/configurators/pi.js.map +1 -0
- package/dist/configurators/qoder.d.ts +11 -0
- package/dist/configurators/qoder.d.ts.map +1 -0
- package/dist/configurators/qoder.js +31 -0
- package/dist/configurators/qoder.js.map +1 -0
- package/dist/configurators/shared.d.ts +178 -0
- package/dist/configurators/shared.d.ts.map +1 -0
- package/dist/configurators/shared.js +538 -0
- package/dist/configurators/shared.js.map +1 -0
- package/dist/configurators/windsurf.d.ts +7 -0
- package/dist/configurators/windsurf.d.ts.map +1 -0
- package/dist/configurators/windsurf.js +19 -0
- package/dist/configurators/windsurf.js.map +1 -0
- package/dist/configurators/workflow.d.ts +29 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +163 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/constants/paths.d.ts +70 -0
- package/dist/constants/paths.d.ts.map +1 -0
- package/dist/constants/paths.js +79 -0
- package/dist/constants/paths.js.map +1 -0
- package/dist/constants/version.d.ts +9 -0
- package/dist/constants/version.d.ts.map +1 -0
- package/dist/constants/version.js +15 -0
- package/dist/constants/version.js.map +1 -0
- package/dist/index.d.ts +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 +62 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +187 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.9.json +30 -0
- package/dist/migrations/manifests/0.2.0.json +49 -0
- package/dist/migrations/manifests/0.2.12.json +9 -0
- package/dist/migrations/manifests/0.2.13.json +9 -0
- package/dist/migrations/manifests/0.2.14.json +175 -0
- package/dist/migrations/manifests/0.2.15.json +33 -0
- package/dist/migrations/manifests/0.3.0-beta.0.json +297 -0
- package/dist/migrations/manifests/0.3.0-beta.1.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.15.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.7.json +11 -0
- package/dist/migrations/manifests/0.3.0-beta.8.json +9 -0
- package/dist/migrations/manifests/0.3.0-beta.9.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.0.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.1.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.2.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.3.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.4.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.5.json +9 -0
- package/dist/migrations/manifests/0.3.0-rc.6.json +9 -0
- package/dist/migrations/manifests/0.3.0.json +11 -0
- package/dist/migrations/manifests/0.3.1.json +9 -0
- package/dist/migrations/manifests/0.3.10.json +9 -0
- package/dist/migrations/manifests/0.3.2.json +9 -0
- package/dist/migrations/manifests/0.3.3.json +9 -0
- package/dist/migrations/manifests/0.3.4.json +21 -0
- package/dist/migrations/manifests/0.3.5.json +9 -0
- package/dist/migrations/manifests/0.3.6.json +9 -0
- package/dist/migrations/manifests/0.3.7.json +9 -0
- package/dist/migrations/manifests/0.3.8.json +9 -0
- package/dist/migrations/manifests/0.3.9.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.1.json +228 -0
- package/dist/migrations/manifests/0.4.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.8.json +34 -0
- package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
- package/dist/migrations/manifests/0.4.0-rc.0.json +9 -0
- package/dist/migrations/manifests/0.4.0-rc.1.json +9 -0
- package/dist/migrations/manifests/0.4.0.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.0.json +1646 -0
- package/dist/migrations/manifests/0.5.0-beta.1.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.15.json +116 -0
- package/dist/migrations/manifests/0.5.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.17.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.18.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.19.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.5.json +222 -0
- package/dist/migrations/manifests/0.5.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.8.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.9.json +48 -0
- package/dist/migrations/manifests/0.5.0-rc.0.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.1.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.2.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.3.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.4.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.5.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.6.json +9 -0
- package/dist/migrations/manifests/0.5.0-rc.7.json +9 -0
- package/dist/migrations/manifests/0.5.0.json +9 -0
- package/dist/migrations/manifests/0.5.1.json +9 -0
- package/dist/migrations/manifests/0.5.10.json +9 -0
- package/dist/migrations/manifests/0.5.11.json +16 -0
- package/dist/migrations/manifests/0.5.12.json +9 -0
- package/dist/migrations/manifests/0.5.13.json +9 -0
- package/dist/migrations/manifests/0.5.14.json +9 -0
- package/dist/migrations/manifests/0.5.15.json +9 -0
- package/dist/migrations/manifests/0.5.2.json +9 -0
- package/dist/migrations/manifests/0.5.3.json +9 -0
- package/dist/migrations/manifests/0.5.4.json +9 -0
- package/dist/migrations/manifests/0.5.5.json +9 -0
- package/dist/migrations/manifests/0.5.6.json +9 -0
- package/dist/migrations/manifests/0.5.7.json +16 -0
- package/dist/migrations/manifests/0.5.8.json +9 -0
- package/dist/migrations/manifests/0.5.9.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.0.json +16 -0
- package/dist/migrations/manifests/0.6.0-beta.1.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.6.json +16 -0
- package/dist/migrations/manifests/0.6.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.8.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.9.json +9 -0
- package/dist/templates/claude/agents/trellis-check.md +114 -0
- package/dist/templates/claude/agents/trellis-implement.md +113 -0
- package/dist/templates/claude/agents/trellis-research.md +137 -0
- package/dist/templates/claude/index.d.ts +22 -0
- package/dist/templates/claude/index.d.ts.map +1 -0
- package/dist/templates/claude/index.js +46 -0
- package/dist/templates/claude/index.js.map +1 -0
- package/dist/templates/claude/settings.json +73 -0
- package/dist/templates/codebuddy/agents/trellis-check.md +109 -0
- package/dist/templates/codebuddy/agents/trellis-implement.md +110 -0
- package/dist/templates/codebuddy/agents/trellis-research.md +137 -0
- package/dist/templates/codebuddy/index.d.ts +15 -0
- package/dist/templates/codebuddy/index.d.ts.map +1 -0
- package/dist/templates/codebuddy/index.js +15 -0
- package/dist/templates/codebuddy/index.js.map +1 -0
- package/dist/templates/codebuddy/settings.json +59 -0
- package/dist/templates/codex/agents/trellis-check.toml +84 -0
- package/dist/templates/codex/agents/trellis-implement.toml +65 -0
- package/dist/templates/codex/agents/trellis-research.toml +73 -0
- package/dist/templates/codex/config.toml +35 -0
- package/dist/templates/codex/hooks/session-start.py +545 -0
- package/dist/templates/codex/hooks.json +15 -0
- package/dist/templates/codex/index.d.ts +39 -0
- package/dist/templates/codex/index.d.ts.map +1 -0
- package/dist/templates/codex/index.js +85 -0
- package/dist/templates/codex/index.js.map +1 -0
- package/dist/templates/codex/skills/before-dev/SKILL.md +40 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +112 -0
- package/dist/templates/codex/skills/break-loop/SKILL.md +130 -0
- package/dist/templates/codex/skills/check/SKILL.md +98 -0
- package/dist/templates/codex/skills/check-cross-layer/SKILL.md +158 -0
- package/dist/templates/codex/skills/create-command/SKILL.md +101 -0
- package/dist/templates/codex/skills/finish-work/SKILL.md +90 -0
- package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
- package/dist/templates/codex/skills/integrate-skill/SKILL.md +221 -0
- package/dist/templates/codex/skills/onboard/SKILL.md +363 -0
- package/dist/templates/codex/skills/record-session/SKILL.md +67 -0
- package/dist/templates/codex/skills/start/SKILL.md +64 -0
- package/dist/templates/codex/skills/update-spec/SKILL.md +335 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +84 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +78 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +65 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +103 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +74 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +83 -0
- package/dist/templates/common/commands/continue.md +56 -0
- package/dist/templates/common/commands/finish-work.md +66 -0
- package/dist/templates/common/commands/start.md +59 -0
- package/dist/templates/common/index.d.ts +48 -0
- package/dist/templates/common/index.d.ts.map +1 -0
- package/dist/templates/common/index.js +104 -0
- package/dist/templates/common/index.js.map +1 -0
- package/dist/templates/common/skills/before-dev.md +35 -0
- package/dist/templates/common/skills/brainstorm.md +112 -0
- package/dist/templates/common/skills/break-loop.md +125 -0
- package/dist/templates/common/skills/check.md +93 -0
- package/dist/templates/common/skills/update-spec.md +351 -0
- package/dist/templates/copilot/hooks/session-start.py +547 -0
- package/dist/templates/copilot/hooks.json +19 -0
- package/dist/templates/copilot/index.d.ts +23 -0
- package/dist/templates/copilot/index.d.ts.map +1 -0
- package/dist/templates/copilot/index.js +54 -0
- package/dist/templates/copilot/index.js.map +1 -0
- package/dist/templates/copilot/prompts/before-dev.prompt.md +39 -0
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +111 -0
- package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
- package/dist/templates/copilot/prompts/check.prompt.md +97 -0
- package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
- package/dist/templates/copilot/prompts/finish-work.prompt.md +99 -0
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
- package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
- package/dist/templates/copilot/prompts/parallel.prompt.md +204 -0
- package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
- package/dist/templates/copilot/prompts/start.prompt.md +63 -0
- package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
- package/dist/templates/cursor/agents/trellis-check.md +108 -0
- package/dist/templates/cursor/agents/trellis-implement.md +109 -0
- package/dist/templates/cursor/agents/trellis-research.md +136 -0
- package/dist/templates/cursor/hooks.json +30 -0
- package/dist/templates/cursor/index.d.ts +13 -0
- package/dist/templates/cursor/index.d.ts.map +1 -0
- package/dist/templates/cursor/index.js +13 -0
- package/dist/templates/cursor/index.js.map +1 -0
- package/dist/templates/droid/droids/trellis-check.md +101 -0
- package/dist/templates/droid/droids/trellis-implement.md +102 -0
- package/dist/templates/droid/droids/trellis-research.md +137 -0
- package/dist/templates/droid/index.d.ts +15 -0
- package/dist/templates/droid/index.d.ts.map +1 -0
- package/dist/templates/droid/index.js +15 -0
- package/dist/templates/droid/index.js.map +1 -0
- package/dist/templates/droid/settings.json +59 -0
- package/dist/templates/extract.d.ts +40 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +106 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/gemini/agents/trellis-check.md +101 -0
- package/dist/templates/gemini/agents/trellis-implement.md +102 -0
- package/dist/templates/gemini/agents/trellis-research.md +136 -0
- package/dist/templates/gemini/index.d.ts +13 -0
- package/dist/templates/gemini/index.d.ts.map +1 -0
- package/dist/templates/gemini/index.js +13 -0
- package/dist/templates/gemini/index.js.map +1 -0
- package/dist/templates/gemini/settings.json +28 -0
- package/dist/templates/kiro/agents/trellis-check.json +26 -0
- package/dist/templates/kiro/agents/trellis-implement.json +26 -0
- package/dist/templates/kiro/agents/trellis-research.json +30 -0
- package/dist/templates/kiro/index.d.ts +18 -0
- package/dist/templates/kiro/index.d.ts.map +1 -0
- package/dist/templates/kiro/index.js +18 -0
- package/dist/templates/kiro/index.js.map +1 -0
- package/dist/templates/markdown/agents.md +21 -0
- package/dist/templates/markdown/gitignore.txt +15 -0
- package/dist/templates/markdown/index.d.ts +27 -0
- package/dist/templates/markdown/index.d.ts.map +1 -0
- package/dist/templates/markdown/index.js +52 -0
- package/dist/templates/markdown/index.js.map +1 -0
- package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/backend/error-handling.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/index.md.txt +38 -0
- package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +59 -0
- package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +54 -0
- package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/index.md.txt +39 -0
- package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/state-management.md.txt +51 -0
- package/dist/templates/markdown/spec/frontend/type-safety.md.txt +51 -0
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +223 -0
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +259 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +595 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +97 -0
- package/dist/templates/markdown/workspace-index.md +125 -0
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/dist/templates/opencode/agents/trellis-check.md +116 -0
- package/dist/templates/opencode/agents/trellis-implement.md +118 -0
- package/dist/templates/opencode/agents/trellis-research.md +145 -0
- package/dist/templates/opencode/lib/session-utils.js +521 -0
- package/dist/templates/opencode/lib/trellis-context.js +381 -0
- package/dist/templates/opencode/package.json +5 -0
- package/dist/templates/opencode/plugins/inject-subagent-context.js +513 -0
- package/dist/templates/opencode/plugins/inject-workflow-state.js +159 -0
- package/dist/templates/opencode/plugins/session-start.js +101 -0
- package/dist/templates/pi/agents/trellis-check.md +36 -0
- package/dist/templates/pi/agents/trellis-implement.md +41 -0
- package/dist/templates/pi/agents/trellis-research.md +25 -0
- package/dist/templates/pi/extensions/trellis/index.ts.txt +1174 -0
- package/dist/templates/pi/index.d.ts +5 -0
- package/dist/templates/pi/index.d.ts.map +1 -0
- package/dist/templates/pi/index.js +12 -0
- package/dist/templates/pi/index.js.map +1 -0
- package/dist/templates/pi/settings.json +21 -0
- package/dist/templates/qoder/agents/trellis-check.md +102 -0
- package/dist/templates/qoder/agents/trellis-implement.md +103 -0
- package/dist/templates/qoder/agents/trellis-research.md +137 -0
- package/dist/templates/qoder/index.d.ts +15 -0
- package/dist/templates/qoder/index.d.ts.map +1 -0
- package/dist/templates/qoder/index.js +15 -0
- package/dist/templates/qoder/index.js.map +1 -0
- package/dist/templates/qoder/settings.json +47 -0
- package/dist/templates/shared-hooks/index.d.ts +50 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -0
- package/dist/templates/shared-hooks/index.js +89 -0
- package/dist/templates/shared-hooks/index.js.map +1 -0
- package/dist/templates/shared-hooks/inject-shell-session-context.py +183 -0
- package/dist/templates/shared-hooks/inject-subagent-context.py +771 -0
- package/dist/templates/shared-hooks/inject-workflow-state.py +363 -0
- package/dist/templates/shared-hooks/session-start.py +827 -0
- package/dist/templates/template-utils.d.ts +26 -0
- package/dist/templates/template-utils.d.ts.map +1 -0
- package/dist/templates/template-utils.js +60 -0
- package/dist/templates/template-utils.js.map +1 -0
- package/dist/templates/trellis/config.yaml +90 -0
- package/dist/templates/trellis/gitignore.txt +32 -0
- package/dist/templates/trellis/index.d.ts +52 -0
- package/dist/templates/trellis/index.d.ts.map +1 -0
- package/dist/templates/trellis/index.js +97 -0
- package/dist/templates/trellis/index.js.map +1 -0
- package/dist/templates/trellis/scripts/__init__.py +5 -0
- package/dist/templates/trellis/scripts/add_session.py +547 -0
- package/dist/templates/trellis/scripts/common/__init__.py +92 -0
- package/dist/templates/trellis/scripts/common/active_task.py +626 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +811 -0
- package/dist/templates/trellis/scripts/common/config.py +445 -0
- package/dist/templates/trellis/scripts/common/developer.py +190 -0
- package/dist/templates/trellis/scripts/common/git.py +31 -0
- package/dist/templates/trellis/scripts/common/git_context.py +106 -0
- package/dist/templates/trellis/scripts/common/io.py +37 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +238 -0
- package/dist/templates/trellis/scripts/common/paths.py +447 -0
- package/dist/templates/trellis/scripts/common/safe_commit.py +285 -0
- package/dist/templates/trellis/scripts/common/session_context.py +821 -0
- package/dist/templates/trellis/scripts/common/task_context.py +223 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +188 -0
- package/dist/templates/trellis/scripts/common/task_store.py +698 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +274 -0
- package/dist/templates/trellis/scripts/common/tasks.py +112 -0
- package/dist/templates/trellis/scripts/common/trellis_config.py +131 -0
- package/dist/templates/trellis/scripts/common/types.py +110 -0
- package/dist/templates/trellis/scripts/common/workflow_phase.py +212 -0
- package/dist/templates/trellis/scripts/get_context.py +16 -0
- package/dist/templates/trellis/scripts/get_developer.py +26 -0
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/trellis/scripts/init_developer.py +51 -0
- package/dist/templates/trellis/scripts/task.py +500 -0
- package/dist/templates/trellis/tasks/.gitkeep +0 -0
- package/dist/templates/trellis/workflow.md +690 -0
- package/dist/types/ai-tools.d.ts +95 -0
- package/dist/types/ai-tools.d.ts.map +1 -0
- package/dist/types/ai-tools.js +280 -0
- package/dist/types/ai-tools.js.map +1 -0
- package/dist/types/migration.d.ts +125 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +8 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/utils/compare-versions.d.ts +12 -0
- package/dist/utils/compare-versions.d.ts.map +1 -0
- package/dist/utils/compare-versions.js +86 -0
- package/dist/utils/compare-versions.js.map +1 -0
- package/dist/utils/cwd-guard.d.ts +38 -0
- package/dist/utils/cwd-guard.d.ts.map +1 -0
- package/dist/utils/cwd-guard.js +62 -0
- package/dist/utils/cwd-guard.js.map +1 -0
- package/dist/utils/file-writer.d.ts +36 -0
- package/dist/utils/file-writer.d.ts.map +1 -0
- package/dist/utils/file-writer.js +203 -0
- package/dist/utils/file-writer.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts +61 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -0
- package/dist/utils/manifest-prune.js +136 -0
- package/dist/utils/manifest-prune.js.map +1 -0
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/project-detector.d.ts +46 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +666 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/proxy.d.ts +25 -0
- package/dist/utils/proxy.d.ts.map +1 -0
- package/dist/utils/proxy.js +60 -0
- package/dist/utils/proxy.js.map +1 -0
- package/dist/utils/task-json.d.ts +13 -0
- package/dist/utils/task-json.d.ts.map +1 -0
- package/dist/utils/task-json.js +12 -0
- package/dist/utils/task-json.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +150 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -0
- package/dist/utils/template-fetcher.js +907 -0
- package/dist/utils/template-fetcher.js.map +1 -0
- package/dist/utils/template-hash.d.ts +123 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +334 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts +66 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -0
- package/dist/utils/uninstall-scrubbers.js +342 -0
- package/dist/utils/uninstall-scrubbers.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Homedir guard for destructive commands (init, uninstall).
|
|
3
|
+
*
|
|
4
|
+
* Running `trellis init` / `trellis uninstall` in `$HOME` is catastrophic:
|
|
5
|
+
* platforms like Claude Code, Codex, OpenCode all store global runtime data
|
|
6
|
+
* (`.claude/projects/<sanitized-cwd>/*.jsonl` chat history, `.codex/sessions/`,
|
|
7
|
+
* `.opencode/` caches, etc.) directly in the user's home directory. If
|
|
8
|
+
* trellis manages the same `.{platform}/` config dirs and the hash manifest
|
|
9
|
+
* picks up runtime data, uninstall would later unlink it.
|
|
10
|
+
*
|
|
11
|
+
* Subdirectories of home (`~/Documents/projects/foo/`) are NOT blocked — only
|
|
12
|
+
* exact-home match.
|
|
13
|
+
*
|
|
14
|
+
* Bypass: `TRELLIS_ALLOW_HOMEDIR=1`.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if `process.cwd()` is exactly the user's home directory.
|
|
18
|
+
*
|
|
19
|
+
* Uses `realpathSync.native()` on both sides so symlinks, `..` segments, and
|
|
20
|
+
* case differences (Windows) don't confuse the comparison. On Windows the
|
|
21
|
+
* comparison is also case-insensitive — `C:\Users\Alice` matches
|
|
22
|
+
* `c:\users\alice`.
|
|
23
|
+
*
|
|
24
|
+
* Permissive on lookup failure: if realpath fails for any reason (broken
|
|
25
|
+
* symlink, EACCES, etc.) we return false so a safety check doesn't crash
|
|
26
|
+
* the command.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isCwdHomedir(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Error message printed by both `trellis init` and `trellis uninstall` when
|
|
31
|
+
* the homedir guard trips.
|
|
32
|
+
*/
|
|
33
|
+
export declare function homedirGuardMessage(commandName: "init" | "uninstall"): string;
|
|
34
|
+
/**
|
|
35
|
+
* Returns true when the bypass env var is set.
|
|
36
|
+
*/
|
|
37
|
+
export declare function homedirBypassEnabled(): boolean;
|
|
38
|
+
//# sourceMappingURL=cwd-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd-guard.d.ts","sourceRoot":"","sources":["../../src/utils/cwd-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAYtC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAS7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Homedir guard for destructive commands (init, uninstall).
|
|
3
|
+
*
|
|
4
|
+
* Running `trellis init` / `trellis uninstall` in `$HOME` is catastrophic:
|
|
5
|
+
* platforms like Claude Code, Codex, OpenCode all store global runtime data
|
|
6
|
+
* (`.claude/projects/<sanitized-cwd>/*.jsonl` chat history, `.codex/sessions/`,
|
|
7
|
+
* `.opencode/` caches, etc.) directly in the user's home directory. If
|
|
8
|
+
* trellis manages the same `.{platform}/` config dirs and the hash manifest
|
|
9
|
+
* picks up runtime data, uninstall would later unlink it.
|
|
10
|
+
*
|
|
11
|
+
* Subdirectories of home (`~/Documents/projects/foo/`) are NOT blocked — only
|
|
12
|
+
* exact-home match.
|
|
13
|
+
*
|
|
14
|
+
* Bypass: `TRELLIS_ALLOW_HOMEDIR=1`.
|
|
15
|
+
*/
|
|
16
|
+
import { realpathSync } from "node:fs";
|
|
17
|
+
import * as os from "node:os";
|
|
18
|
+
/**
|
|
19
|
+
* Returns true if `process.cwd()` is exactly the user's home directory.
|
|
20
|
+
*
|
|
21
|
+
* Uses `realpathSync.native()` on both sides so symlinks, `..` segments, and
|
|
22
|
+
* case differences (Windows) don't confuse the comparison. On Windows the
|
|
23
|
+
* comparison is also case-insensitive — `C:\Users\Alice` matches
|
|
24
|
+
* `c:\users\alice`.
|
|
25
|
+
*
|
|
26
|
+
* Permissive on lookup failure: if realpath fails for any reason (broken
|
|
27
|
+
* symlink, EACCES, etc.) we return false so a safety check doesn't crash
|
|
28
|
+
* the command.
|
|
29
|
+
*/
|
|
30
|
+
export function isCwdHomedir() {
|
|
31
|
+
try {
|
|
32
|
+
let cwd = realpathSync.native(process.cwd());
|
|
33
|
+
let home = realpathSync.native(os.homedir());
|
|
34
|
+
if (process.platform === "win32") {
|
|
35
|
+
cwd = cwd.toLowerCase();
|
|
36
|
+
home = home.toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
return cwd === home;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Error message printed by both `trellis init` and `trellis uninstall` when
|
|
46
|
+
* the homedir guard trips.
|
|
47
|
+
*/
|
|
48
|
+
export function homedirGuardMessage(commandName) {
|
|
49
|
+
return (`✗ Refusing to run \`trellis ${commandName}\` in your home directory.\n\n` +
|
|
50
|
+
`Trellis manages platform config dirs like .claude/, .codex/, .opencode/, which\n` +
|
|
51
|
+
`in your home directory also contain runtime data from those CLIs (chat history,\n` +
|
|
52
|
+
`session JSONLs, caches). Running here can wipe that data.\n\n` +
|
|
53
|
+
`Run trellis from your project directory instead. If you really want to run in\n` +
|
|
54
|
+
`$HOME, set TRELLIS_ALLOW_HOMEDIR=1.`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns true when the bypass env var is set.
|
|
58
|
+
*/
|
|
59
|
+
export function homedirBypassEnabled() {
|
|
60
|
+
return process.env.TRELLIS_ALLOW_HOMEDIR === "1";
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=cwd-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd-guard.js","sourceRoot":"","sources":["../../src/utils/cwd-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC;QACH,IAAI,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7C,IAAI,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,GAAG,KAAK,IAAI,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAiC;IACnE,OAAO,CACL,+BAA+B,WAAW,gCAAgC;QAC1E,kFAAkF;QAClF,mFAAmF;QACnF,+DAA+D;QAC/D,iFAAiF;QACjF,qCAAqC,CACtC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type WriteMode = "ask" | "force" | "skip" | "append";
|
|
2
|
+
export interface WriteOptions {
|
|
3
|
+
mode: WriteMode;
|
|
4
|
+
}
|
|
5
|
+
export declare function setWriteMode(mode: WriteMode): void;
|
|
6
|
+
export declare function getWriteMode(): WriteMode;
|
|
7
|
+
/**
|
|
8
|
+
* Begin recording every write into the returned Set. Calls accumulate into the
|
|
9
|
+
* same set until `stopRecordingWrites` runs. POSIX relative paths (relative to
|
|
10
|
+
* `cwd`) are stored, matching `.template-hashes.json` keys.
|
|
11
|
+
*
|
|
12
|
+
* Nested recording sessions are NOT supported — the caller must ensure
|
|
13
|
+
* `stopRecordingWrites` runs before the next `startRecordingWrites`. Failure
|
|
14
|
+
* is silent (the second `start` replaces the first set), so callers should
|
|
15
|
+
* always pair start/stop in try/finally.
|
|
16
|
+
*/
|
|
17
|
+
export declare function startRecordingWrites(cwd: string): Set<string>;
|
|
18
|
+
/** End recording. Subsequent writes are not captured until `start` is called again. */
|
|
19
|
+
export declare function stopRecordingWrites(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Write file with conflict handling
|
|
22
|
+
* - If file doesn't exist: write directly
|
|
23
|
+
* - If file exists and content is identical: skip silently
|
|
24
|
+
* - If file exists and mode is 'force': overwrite
|
|
25
|
+
* - If file exists and mode is 'skip': skip
|
|
26
|
+
* - If file exists and mode is 'append': append to end
|
|
27
|
+
* - If file exists and mode is 'ask': prompt user
|
|
28
|
+
*/
|
|
29
|
+
export declare function writeFile(filePath: string, content: string, options?: {
|
|
30
|
+
executable?: boolean;
|
|
31
|
+
}): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Ensure directory exists
|
|
34
|
+
*/
|
|
35
|
+
export declare function ensureDir(dirPath: string): void;
|
|
36
|
+
//# sourceMappingURL=file-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writer.d.ts","sourceRoot":"","sources":["../../src/utils/file-writer.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;CACjB;AASD,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAElD;AAED,wBAAgB,YAAY,IAAI,SAAS,CAExC;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAK7D;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C;AAsCD;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACjC,OAAO,CAAC,OAAO,CAAC,CA0HlB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import inquirer from "inquirer";
|
|
5
|
+
import { toPosix } from "./posix.js";
|
|
6
|
+
// Global write mode (set from CLI options)
|
|
7
|
+
let globalWriteMode = "ask";
|
|
8
|
+
export function setWriteMode(mode) {
|
|
9
|
+
globalWriteMode = mode;
|
|
10
|
+
}
|
|
11
|
+
export function getWriteMode() {
|
|
12
|
+
return globalWriteMode;
|
|
13
|
+
}
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Write recording
|
|
16
|
+
//
|
|
17
|
+
// `trellis init` uses recording to capture exactly which files were actually
|
|
18
|
+
// written this run (vs skipped because they already existed). The captured
|
|
19
|
+
// set is what `.template-hashes.json` should contain — NOT a blind directory
|
|
20
|
+
// walk of `.codex/` / `.claude/` / etc, which would include user-owned files
|
|
21
|
+
// that pre-dated init. See `pruneOrphanManifestKeys` for the self-heal side
|
|
22
|
+
// of the same contract.
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/** When recording is active, every actual `writeFile` disk write appends here. */
|
|
25
|
+
let writeRecorder = null;
|
|
26
|
+
/** Project root used to convert absolute write paths to POSIX-relative keys. */
|
|
27
|
+
let writeRecorderRoot = null;
|
|
28
|
+
/**
|
|
29
|
+
* Begin recording every write into the returned Set. Calls accumulate into the
|
|
30
|
+
* same set until `stopRecordingWrites` runs. POSIX relative paths (relative to
|
|
31
|
+
* `cwd`) are stored, matching `.template-hashes.json` keys.
|
|
32
|
+
*
|
|
33
|
+
* Nested recording sessions are NOT supported — the caller must ensure
|
|
34
|
+
* `stopRecordingWrites` runs before the next `startRecordingWrites`. Failure
|
|
35
|
+
* is silent (the second `start` replaces the first set), so callers should
|
|
36
|
+
* always pair start/stop in try/finally.
|
|
37
|
+
*/
|
|
38
|
+
export function startRecordingWrites(cwd) {
|
|
39
|
+
const sink = new Set();
|
|
40
|
+
writeRecorder = sink;
|
|
41
|
+
writeRecorderRoot = cwd;
|
|
42
|
+
return sink;
|
|
43
|
+
}
|
|
44
|
+
/** End recording. Subsequent writes are not captured until `start` is called again. */
|
|
45
|
+
export function stopRecordingWrites() {
|
|
46
|
+
writeRecorder = null;
|
|
47
|
+
writeRecorderRoot = null;
|
|
48
|
+
}
|
|
49
|
+
/** Record a successful write. Called internally by `writeFile`. */
|
|
50
|
+
function recordWrite(absPath) {
|
|
51
|
+
if (!writeRecorder || !writeRecorderRoot)
|
|
52
|
+
return;
|
|
53
|
+
const rel = path.relative(writeRecorderRoot, absPath);
|
|
54
|
+
// Defensive: skip writes outside cwd (no meaningful manifest key).
|
|
55
|
+
if (rel.startsWith("..") || path.isAbsolute(rel))
|
|
56
|
+
return;
|
|
57
|
+
writeRecorder.add(toPosix(rel));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Get relative path from cwd for display
|
|
61
|
+
*/
|
|
62
|
+
function getRelativePath(filePath) {
|
|
63
|
+
const cwd = process.cwd();
|
|
64
|
+
const relativePath = path.relative(cwd, filePath);
|
|
65
|
+
return relativePath || path.basename(filePath);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Append content to file
|
|
69
|
+
*/
|
|
70
|
+
function appendToFile(filePath, content, options) {
|
|
71
|
+
const existingContent = fs.readFileSync(filePath, "utf-8");
|
|
72
|
+
const newContent = existingContent.endsWith("\n")
|
|
73
|
+
? existingContent + content
|
|
74
|
+
: existingContent + "\n" + content;
|
|
75
|
+
fs.writeFileSync(filePath, newContent);
|
|
76
|
+
if (options?.executable) {
|
|
77
|
+
fs.chmodSync(filePath, "755");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Write file with conflict handling
|
|
82
|
+
* - If file doesn't exist: write directly
|
|
83
|
+
* - If file exists and content is identical: skip silently
|
|
84
|
+
* - If file exists and mode is 'force': overwrite
|
|
85
|
+
* - If file exists and mode is 'skip': skip
|
|
86
|
+
* - If file exists and mode is 'append': append to end
|
|
87
|
+
* - If file exists and mode is 'ask': prompt user
|
|
88
|
+
*/
|
|
89
|
+
export async function writeFile(filePath, content, options) {
|
|
90
|
+
const exists = fs.existsSync(filePath);
|
|
91
|
+
const displayPath = getRelativePath(filePath);
|
|
92
|
+
if (!exists) {
|
|
93
|
+
// File doesn't exist, write directly
|
|
94
|
+
fs.writeFileSync(filePath, content);
|
|
95
|
+
if (options?.executable) {
|
|
96
|
+
fs.chmodSync(filePath, "755");
|
|
97
|
+
}
|
|
98
|
+
recordWrite(filePath);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
// File exists, check if content is identical
|
|
102
|
+
const existingContent = fs.readFileSync(filePath, "utf-8");
|
|
103
|
+
if (existingContent === content) {
|
|
104
|
+
// Content identical, but no disk write happened. Do not record it for
|
|
105
|
+
// init-time manifests: pre-existing user files can legitimately be
|
|
106
|
+
// byte-identical to a Trellis template and still not be Trellis-owned.
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
// File exists with different content, handle based on mode.
|
|
110
|
+
// Non-TTY (CI, pipes, scripted runs): never prompt — fall back to skip
|
|
111
|
+
// rather than crash with ERR_USE_AFTER_CLOSE if a CLI flag forgot to call
|
|
112
|
+
// setWriteMode. Layer-level safety net for the init.ts mapping.
|
|
113
|
+
const mode = globalWriteMode === "ask" && !process.stdin.isTTY
|
|
114
|
+
? "skip"
|
|
115
|
+
: globalWriteMode;
|
|
116
|
+
if (mode === "force") {
|
|
117
|
+
fs.writeFileSync(filePath, content);
|
|
118
|
+
if (options?.executable) {
|
|
119
|
+
fs.chmodSync(filePath, "755");
|
|
120
|
+
}
|
|
121
|
+
console.log(chalk.yellow(` ↻ Overwritten: ${displayPath}`));
|
|
122
|
+
recordWrite(filePath);
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (mode === "skip") {
|
|
126
|
+
console.log(chalk.gray(` ○ Skipped: ${displayPath} (already exists)`));
|
|
127
|
+
// Skipped: trellis did NOT write this file — caller should not track it
|
|
128
|
+
// in the manifest. This is the AGENTS.md skip-existing case.
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if (mode === "append") {
|
|
132
|
+
appendToFile(filePath, content, options);
|
|
133
|
+
console.log(chalk.blue(` + Appended: ${displayPath}`));
|
|
134
|
+
// Append: trellis added trellis content to a user-owned file. Tracking
|
|
135
|
+
// is risky here (uninstall would unlink the whole file), so we do NOT
|
|
136
|
+
// record appended files. Users on `--append` get a fresh manifest miss
|
|
137
|
+
// on next update; that's the safer default.
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
// mode === 'ask': Interactive prompt
|
|
141
|
+
const { action } = await inquirer.prompt([
|
|
142
|
+
{
|
|
143
|
+
type: "list",
|
|
144
|
+
name: "action",
|
|
145
|
+
message: `File "${displayPath}" already exists. What would you like to do?`,
|
|
146
|
+
choices: [
|
|
147
|
+
{ name: "Skip (keep existing)", value: "skip" },
|
|
148
|
+
{ name: "Overwrite", value: "overwrite" },
|
|
149
|
+
{ name: "Append to end", value: "append" },
|
|
150
|
+
{ name: "Skip all remaining conflicts", value: "skip-all" },
|
|
151
|
+
{ name: "Overwrite all remaining conflicts", value: "overwrite-all" },
|
|
152
|
+
{ name: "Append all remaining conflicts", value: "append-all" },
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
]);
|
|
156
|
+
if (action === "skip") {
|
|
157
|
+
console.log(chalk.gray(` ○ Skipped: ${displayPath}`));
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
if (action === "overwrite") {
|
|
161
|
+
fs.writeFileSync(filePath, content);
|
|
162
|
+
if (options?.executable) {
|
|
163
|
+
fs.chmodSync(filePath, "755");
|
|
164
|
+
}
|
|
165
|
+
console.log(chalk.yellow(` ↻ Overwritten: ${displayPath}`));
|
|
166
|
+
recordWrite(filePath);
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
if (action === "append") {
|
|
170
|
+
appendToFile(filePath, content, options);
|
|
171
|
+
console.log(chalk.blue(` + Appended: ${displayPath}`));
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
if (action === "skip-all") {
|
|
175
|
+
globalWriteMode = "skip";
|
|
176
|
+
console.log(chalk.gray(` ○ Skipped: ${displayPath}`));
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
if (action === "overwrite-all") {
|
|
180
|
+
globalWriteMode = "force";
|
|
181
|
+
fs.writeFileSync(filePath, content);
|
|
182
|
+
if (options?.executable) {
|
|
183
|
+
fs.chmodSync(filePath, "755");
|
|
184
|
+
}
|
|
185
|
+
console.log(chalk.yellow(` ↻ Overwritten: ${displayPath}`));
|
|
186
|
+
recordWrite(filePath);
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
if (action === "append-all") {
|
|
190
|
+
globalWriteMode = "append";
|
|
191
|
+
appendToFile(filePath, content, options);
|
|
192
|
+
console.log(chalk.blue(` + Appended: ${displayPath}`));
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Ensure directory exists
|
|
199
|
+
*/
|
|
200
|
+
export function ensureDir(dirPath) {
|
|
201
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=file-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-writer.js","sourceRoot":"","sources":["../../src/utils/file-writer.ts"],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IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-heal poisoned `.template-hashes.json` manifests.
|
|
3
|
+
*
|
|
4
|
+
* Versions before this fix walked `.codex/`, `.claude/`, etc. with a blind
|
|
5
|
+
* recursive scan when computing the manifest, so they hashed user-owned
|
|
6
|
+
* runtime data (`.codex/sessions/*`, `.claude/projects/*.jsonl`, pre-existing
|
|
7
|
+
* `AGENTS.md`, user-added `.codex/skills/<custom>/`, …). On uninstall, every
|
|
8
|
+
* manifest entry is unlinked, which silently deletes user data.
|
|
9
|
+
*
|
|
10
|
+
* `pruneOrphanManifestKeys` removes any manifest entry that no current
|
|
11
|
+
* platform configurator owns. The two entry points that consume it are
|
|
12
|
+
* `trellis update` (before migration classification) and `trellis uninstall`
|
|
13
|
+
* (before plan building). Together they ensure existing poisoned manifests
|
|
14
|
+
* self-correct on the next routine command.
|
|
15
|
+
*
|
|
16
|
+
* Rules:
|
|
17
|
+
* - `.trellis/*` entries are ALWAYS kept. `trellis uninstall` removes
|
|
18
|
+
* `.trellis/` wholesale via `fs.rmSync(..., { recursive: true })`, so
|
|
19
|
+
* manifest accuracy there doesn't affect uninstall data-loss. `update`
|
|
20
|
+
* also relies on these entries to detect user-modified workflow files.
|
|
21
|
+
* - Root-level `AGENTS.md` is kept only when it still looks Trellis-managed
|
|
22
|
+
* (contains the managed block markers) or is missing on disk. This
|
|
23
|
+
* self-heals old poisoned manifests for user-owned AGENTS.md files that
|
|
24
|
+
* predated init and were skipped.
|
|
25
|
+
* - Paths referenced by `from`/`to` of any migration manifest entry
|
|
26
|
+
* (rename, rename-dir, delete, safe-file-delete) are preserved. Pruning
|
|
27
|
+
* them would prevent legitimate pending migrations from finding their
|
|
28
|
+
* source/target.
|
|
29
|
+
* - Everything else: if the path is not in the union of
|
|
30
|
+
* `collectPlatformTemplates()` for currently-configured platforms, it is
|
|
31
|
+
* pruned. This matches "files trellis actually wrote during init/update".
|
|
32
|
+
*/
|
|
33
|
+
import type { AITool } from "../types/ai-tools.js";
|
|
34
|
+
import type { TemplateHashes } from "../types/migration.js";
|
|
35
|
+
export interface PruneResult {
|
|
36
|
+
/** Manifest keys removed (POSIX-style relative paths). */
|
|
37
|
+
pruned: string[];
|
|
38
|
+
/** The post-prune manifest (saved to disk only when `pruned.length > 0`). */
|
|
39
|
+
hashes: TemplateHashes;
|
|
40
|
+
}
|
|
41
|
+
export interface PruneOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Save the pruned manifest to `.template-hashes.json`. Defaults to true.
|
|
44
|
+
* Callers can pass `false` to compute the prune without mutating disk
|
|
45
|
+
* (dry-run, change-analysis passes).
|
|
46
|
+
*/
|
|
47
|
+
persist?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Walk the manifest and split it into kept vs pruned entries.
|
|
51
|
+
*
|
|
52
|
+
* @param cwd Project root — used to save the rewritten manifest.
|
|
53
|
+
* @param configuredPlatforms Output of `getConfiguredPlatforms(cwd)` — caller
|
|
54
|
+
* resolves this so we don't have to re-walk the filesystem.
|
|
55
|
+
* @param hashes Already-loaded manifest contents. Passing it in (vs reading
|
|
56
|
+
* from disk) lets the caller chain `loadHashes` → prune → use the result.
|
|
57
|
+
* @param options.persist When true (default), saves the pruned manifest to
|
|
58
|
+
* disk. Pass `false` for dry-run flows.
|
|
59
|
+
*/
|
|
60
|
+
export declare function pruneOrphanManifestKeys(cwd: string, configuredPlatforms: readonly AITool[], hashes: TemplateHashes, options?: PruneOptions): PruneResult;
|
|
61
|
+
//# sourceMappingURL=manifest-prune.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-prune.d.ts","sourceRoot":"","sources":["../../src/utils/manifest-prune.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAUH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAK5D,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6EAA6E;IAC7E,MAAM,EAAE,cAAc,CAAC;CACxB;AAoDD,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,mBAAmB,EAAE,SAAS,MAAM,EAAE,EACtC,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,YAAiB,GACzB,WAAW,CAmCb"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-heal poisoned `.template-hashes.json` manifests.
|
|
3
|
+
*
|
|
4
|
+
* Versions before this fix walked `.codex/`, `.claude/`, etc. with a blind
|
|
5
|
+
* recursive scan when computing the manifest, so they hashed user-owned
|
|
6
|
+
* runtime data (`.codex/sessions/*`, `.claude/projects/*.jsonl`, pre-existing
|
|
7
|
+
* `AGENTS.md`, user-added `.codex/skills/<custom>/`, …). On uninstall, every
|
|
8
|
+
* manifest entry is unlinked, which silently deletes user data.
|
|
9
|
+
*
|
|
10
|
+
* `pruneOrphanManifestKeys` removes any manifest entry that no current
|
|
11
|
+
* platform configurator owns. The two entry points that consume it are
|
|
12
|
+
* `trellis update` (before migration classification) and `trellis uninstall`
|
|
13
|
+
* (before plan building). Together they ensure existing poisoned manifests
|
|
14
|
+
* self-correct on the next routine command.
|
|
15
|
+
*
|
|
16
|
+
* Rules:
|
|
17
|
+
* - `.trellis/*` entries are ALWAYS kept. `trellis uninstall` removes
|
|
18
|
+
* `.trellis/` wholesale via `fs.rmSync(..., { recursive: true })`, so
|
|
19
|
+
* manifest accuracy there doesn't affect uninstall data-loss. `update`
|
|
20
|
+
* also relies on these entries to detect user-modified workflow files.
|
|
21
|
+
* - Root-level `AGENTS.md` is kept only when it still looks Trellis-managed
|
|
22
|
+
* (contains the managed block markers) or is missing on disk. This
|
|
23
|
+
* self-heals old poisoned manifests for user-owned AGENTS.md files that
|
|
24
|
+
* predated init and were skipped.
|
|
25
|
+
* - Paths referenced by `from`/`to` of any migration manifest entry
|
|
26
|
+
* (rename, rename-dir, delete, safe-file-delete) are preserved. Pruning
|
|
27
|
+
* them would prevent legitimate pending migrations from finding their
|
|
28
|
+
* source/target.
|
|
29
|
+
* - Everything else: if the path is not in the union of
|
|
30
|
+
* `collectPlatformTemplates()` for currently-configured platforms, it is
|
|
31
|
+
* pruned. This matches "files trellis actually wrote during init/update".
|
|
32
|
+
*/
|
|
33
|
+
import fs from "node:fs";
|
|
34
|
+
import path from "node:path";
|
|
35
|
+
import { collectPlatformTemplates } from "../configurators/index.js";
|
|
36
|
+
import { FILE_NAMES } from "../constants/paths.js";
|
|
37
|
+
import { getAllMigrations } from "../migrations/index.js";
|
|
38
|
+
import { saveHashes } from "./template-hash.js";
|
|
39
|
+
import { toPosix } from "./posix.js";
|
|
40
|
+
const TRELLIS_BLOCK_START = "<!-- TRELLIS:START -->";
|
|
41
|
+
const TRELLIS_BLOCK_END = "<!-- TRELLIS:END -->";
|
|
42
|
+
/**
|
|
43
|
+
* Compute the union of "what trellis writes" across:
|
|
44
|
+
* - every configured platform's collectTemplates() output
|
|
45
|
+
* - root-level AGENTS.md when it still carries Trellis managed-block markers
|
|
46
|
+
* - every migration manifest's from/to path (preserve so legitimate
|
|
47
|
+
* pending migrations can find their source/target)
|
|
48
|
+
*/
|
|
49
|
+
function buildKnownKeys(configuredPlatforms) {
|
|
50
|
+
const known = new Set();
|
|
51
|
+
for (const id of configuredPlatforms) {
|
|
52
|
+
const templates = collectPlatformTemplates(id);
|
|
53
|
+
if (!templates)
|
|
54
|
+
continue;
|
|
55
|
+
for (const key of templates.keys()) {
|
|
56
|
+
known.add(toPosix(key));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Preserve any path referenced by a migration: legitimate pending
|
|
60
|
+
// rename/delete operations need to resolve their `from` (and the target's
|
|
61
|
+
// hash record for `to`) even if the current registry doesn't list it.
|
|
62
|
+
for (const migration of getAllMigrations()) {
|
|
63
|
+
if (migration.from)
|
|
64
|
+
known.add(toPosix(migration.from));
|
|
65
|
+
if (migration.to)
|
|
66
|
+
known.add(toPosix(migration.to));
|
|
67
|
+
}
|
|
68
|
+
return known;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Root-level AGENTS.md needs special handling because it has no platform
|
|
72
|
+
* registry owner. New fixed inits record it only when written, but old
|
|
73
|
+
* manifests may contain a user-owned AGENTS.md that init skipped. The
|
|
74
|
+
* managed block markers are the least destructive ownership signal: no
|
|
75
|
+
* markers means preserve the user's file by pruning the stale manifest key.
|
|
76
|
+
*/
|
|
77
|
+
function shouldKeepAgentsMd(cwd) {
|
|
78
|
+
const fullPath = path.join(cwd, FILE_NAMES.AGENTS);
|
|
79
|
+
if (!fs.existsSync(fullPath)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
84
|
+
return (content.includes(TRELLIS_BLOCK_START) &&
|
|
85
|
+
content.includes(TRELLIS_BLOCK_END));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Walk the manifest and split it into kept vs pruned entries.
|
|
93
|
+
*
|
|
94
|
+
* @param cwd Project root — used to save the rewritten manifest.
|
|
95
|
+
* @param configuredPlatforms Output of `getConfiguredPlatforms(cwd)` — caller
|
|
96
|
+
* resolves this so we don't have to re-walk the filesystem.
|
|
97
|
+
* @param hashes Already-loaded manifest contents. Passing it in (vs reading
|
|
98
|
+
* from disk) lets the caller chain `loadHashes` → prune → use the result.
|
|
99
|
+
* @param options.persist When true (default), saves the pruned manifest to
|
|
100
|
+
* disk. Pass `false` for dry-run flows.
|
|
101
|
+
*/
|
|
102
|
+
export function pruneOrphanManifestKeys(cwd, configuredPlatforms, hashes, options = {}) {
|
|
103
|
+
const persist = options.persist ?? true;
|
|
104
|
+
const known = buildKnownKeys(configuredPlatforms);
|
|
105
|
+
const pruned = [];
|
|
106
|
+
const kept = {};
|
|
107
|
+
for (const [rawKey, value] of Object.entries(hashes)) {
|
|
108
|
+
const key = toPosix(rawKey);
|
|
109
|
+
// Always preserve .trellis/ entries — they're for the workflow tree
|
|
110
|
+
// which uninstall removes wholesale and which update needs for
|
|
111
|
+
// modified-file detection.
|
|
112
|
+
if (key.startsWith(".trellis/") || key === ".trellis") {
|
|
113
|
+
kept[key] = value;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (key === FILE_NAMES.AGENTS) {
|
|
117
|
+
if (shouldKeepAgentsMd(cwd)) {
|
|
118
|
+
kept[key] = value;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
pruned.push(key);
|
|
122
|
+
}
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (known.has(key)) {
|
|
126
|
+
kept[key] = value;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
pruned.push(key);
|
|
130
|
+
}
|
|
131
|
+
if (persist && pruned.length > 0) {
|
|
132
|
+
saveHashes(cwd, kept);
|
|
133
|
+
}
|
|
134
|
+
return { pruned, hashes: kept };
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=manifest-prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-prune.js","sourceRoot":"","sources":["../../src/utils/manifest-prune.ts"],"names":[],"mappings":"AAAA;;;;;;;;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AAkB,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;YACD,SAAS;QACX,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAClB,SAAS;QACX,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POSIX path normalization utility
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for converting OS-native path separators to POSIX `/`.
|
|
5
|
+
* Use ONLY for logical path strings used as cross-platform persistence keys
|
|
6
|
+
* (e.g. hash dictionary keys, JSON-stored paths). Do NOT use for paths passed
|
|
7
|
+
* to filesystem APIs — those must remain OS-native via `path.join`.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Convert any path string's `\` separators to POSIX `/`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function toPosix(p: string): string;
|
|
13
|
+
//# sourceMappingURL=posix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posix.d.ts","sourceRoot":"","sources":["../../src/utils/posix.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* POSIX path normalization utility
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for converting OS-native path separators to POSIX `/`.
|
|
5
|
+
* Use ONLY for logical path strings used as cross-platform persistence keys
|
|
6
|
+
* (e.g. hash dictionary keys, JSON-stored paths). Do NOT use for paths passed
|
|
7
|
+
* to filesystem APIs — those must remain OS-native via `path.join`.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Convert any path string's `\` separators to POSIX `/`.
|
|
11
|
+
*/
|
|
12
|
+
export function toPosix(p) {
|
|
13
|
+
return p.replace(/\\/g, "/");
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=posix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posix.js","sourceRoot":"","sources":["../../src/utils/posix.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project type detected by analyzing project files
|
|
3
|
+
*/
|
|
4
|
+
export type ProjectType = "frontend" | "backend" | "fullstack" | "unknown";
|
|
5
|
+
/**
|
|
6
|
+
* Detect project type by analyzing project files
|
|
7
|
+
*
|
|
8
|
+
* @param cwd - Current working directory to analyze
|
|
9
|
+
* @returns Detected project type
|
|
10
|
+
*/
|
|
11
|
+
export declare function detectProjectType(cwd: string): ProjectType;
|
|
12
|
+
/**
|
|
13
|
+
* Get human-readable description of project type
|
|
14
|
+
*/
|
|
15
|
+
export declare function getProjectTypeDescription(type: ProjectType): string;
|
|
16
|
+
/**
|
|
17
|
+
* Detected package in a monorepo workspace
|
|
18
|
+
*/
|
|
19
|
+
export interface DetectedPackage {
|
|
20
|
+
/** Package name (from package.json, Cargo.toml, go.mod, etc.) */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Relative path from cwd, normalized (no ./ prefix or trailing /) */
|
|
23
|
+
path: string;
|
|
24
|
+
/** Project type detected via detectProjectType() */
|
|
25
|
+
type: ProjectType;
|
|
26
|
+
/** Whether this package is a git submodule */
|
|
27
|
+
isSubmodule: boolean;
|
|
28
|
+
/** Whether this package has its own .git (independent repo, e.g. polyrepo sibling) */
|
|
29
|
+
isGitRepo: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Sanitize a package name for use as a directory name.
|
|
33
|
+
* Strips npm scope prefix (@scope/) so "@zhubao/desktop" becomes "desktop".
|
|
34
|
+
*/
|
|
35
|
+
export declare function sanitizePkgName(name: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Detect monorepo workspace configuration and enumerate packages.
|
|
38
|
+
*
|
|
39
|
+
* Checks workspace managers in priority order (pnpm → npm/yarn/bun → Cargo → Go → uv),
|
|
40
|
+
* merges results, and marks git submodules. Returns null if no monorepo detected.
|
|
41
|
+
*
|
|
42
|
+
* @param cwd - Repository root to analyze
|
|
43
|
+
* @returns Array of detected packages, null if not a monorepo, empty array if config exists but no packages found
|
|
44
|
+
*/
|
|
45
|
+
export declare function detectMonorepo(cwd: string): DetectedPackage[] | null;
|
|
46
|
+
//# sourceMappingURL=project-detector.d.ts.map
|