@mindfoldhq/trellis 0.6.0-beta.2 → 0.6.0-beta.20
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 +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +58 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/channel/adapters/claude.d.ts +29 -0
- package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
- package/dist/commands/channel/adapters/claude.js +203 -0
- package/dist/commands/channel/adapters/claude.js.map +1 -0
- package/dist/commands/channel/adapters/codex.d.ts +85 -0
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
- package/dist/commands/channel/adapters/codex.js +505 -0
- package/dist/commands/channel/adapters/codex.js.map +1 -0
- package/dist/commands/channel/adapters/index.d.ts +84 -0
- package/dist/commands/channel/adapters/index.d.ts.map +1 -0
- package/dist/commands/channel/adapters/index.js +115 -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/guard.d.ts +150 -0
- package/dist/commands/channel/guard.d.ts.map +1 -0
- package/dist/commands/channel/guard.js +474 -0
- package/dist/commands/channel/guard.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 +531 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/channel/interrupt.d.ts +10 -0
- package/dist/commands/channel/interrupt.d.ts.map +1 -0
- package/dist/commands/channel/interrupt.js +22 -0
- package/dist/commands/channel/interrupt.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 +15 -0
- package/dist/commands/channel/messages.d.ts.map +1 -0
- package/dist/commands/channel/messages.js +245 -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 +30 -0
- package/dist/commands/channel/run.d.ts.map +1 -0
- package/dist/commands/channel/run.js +130 -0
- package/dist/commands/channel/run.js.map +1 -0
- package/dist/commands/channel/send.d.ts +11 -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 +40 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -0
- package/dist/commands/channel/spawn.js +244 -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 +146 -0
- package/dist/commands/channel/store/watch.js.map +1 -0
- package/dist/commands/channel/supervisor/idle.d.ts +46 -0
- package/dist/commands/channel/supervisor/idle.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/idle.js +72 -0
- package/dist/commands/channel/supervisor/idle.js.map +1 -0
- package/dist/commands/channel/supervisor/inbox.d.ts +30 -0
- package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/inbox.js +160 -0
- package/dist/commands/channel/supervisor/inbox.js.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts +68 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.js +146 -0
- package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
- package/dist/commands/channel/supervisor/stdout.d.ts +51 -0
- package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/stdout.js +121 -0
- package/dist/commands/channel/supervisor/stdout.js.map +1 -0
- package/dist/commands/channel/supervisor/turns.d.ts +31 -0
- package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/turns.js +45 -0
- package/dist/commands/channel/supervisor/turns.js.map +1 -0
- package/dist/commands/channel/supervisor/warning.d.ts +48 -0
- package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/warning.js +77 -0
- package/dist/commands/channel/supervisor/warning.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +59 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -0
- package/dist/commands/channel/supervisor.js +344 -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 +17 -0
- package/dist/commands/channel/wait.d.ts.map +1 -0
- package/dist/commands/channel/wait.js +75 -0
- package/dist/commands/channel/wait.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +97 -42
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mem.d.ts +13 -117
- package/dist/commands/mem.d.ts.map +1 -1
- package/dist/commands/mem.js +168 -1074
- package/dist/commands/mem.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +28 -2
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +31 -111
- package/dist/commands/update.js.map +1 -1
- 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/commands/workflow.d.ts +35 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +219 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +1 -0
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +5 -3
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/shared.js +4 -4
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +8 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +3 -2
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/manifests/0.5.10.json +9 -0
- package/dist/migrations/manifests/0.5.11.json +16 -0
- package/dist/migrations/manifests/0.5.12.json +9 -0
- package/dist/migrations/manifests/0.5.13.json +9 -0
- package/dist/migrations/manifests/0.5.14.json +9 -0
- package/dist/migrations/manifests/0.5.15.json +9 -0
- package/dist/migrations/manifests/0.5.16.json +9 -0
- package/dist/migrations/manifests/0.5.17.json +9 -0
- package/dist/migrations/manifests/0.5.18.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.15.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.17.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.18.json +16 -0
- package/dist/migrations/manifests/0.6.0-beta.19.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.20.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 +13 -7
- package/dist/templates/claude/agents/trellis-implement.md +8 -7
- package/dist/templates/claude/settings.json +4 -4
- package/dist/templates/codebuddy/agents/trellis-check.md +13 -7
- package/dist/templates/codebuddy/agents/trellis-implement.md +8 -7
- package/dist/templates/codebuddy/settings.json +4 -4
- package/dist/templates/codex/agents/trellis-check.toml +4 -4
- package/dist/templates/codex/agents/trellis-implement.toml +4 -4
- package/dist/templates/codex/config.toml +5 -3
- package/dist/templates/codex/hooks/session-start.py +205 -119
- package/dist/templates/codex/hooks.json +2 -2
- package/dist/templates/codex/skills/before-dev/SKILL.md +12 -6
- package/dist/templates/codex/skills/brainstorm/SKILL.md +69 -457
- package/dist/templates/codex/skills/check/SKILL.md +86 -18
- package/dist/templates/codex/skills/start/SKILL.md +33 -323
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +7 -4
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +3 -2
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +5 -5
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +35 -6
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +5 -4
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/SKILL.md +41 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/mcp-setup.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/repository-analysis.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/spec-task-planning.md +61 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstarp/references/spec-writing.md +70 -0
- package/dist/templates/common/commands/continue.md +6 -5
- package/dist/templates/common/commands/start.md +9 -6
- package/dist/templates/common/skills/before-dev.md +12 -6
- package/dist/templates/common/skills/brainstorm.md +68 -504
- package/dist/templates/common/skills/check.md +7 -1
- package/dist/templates/copilot/hooks/session-start.py +219 -101
- package/dist/templates/copilot/hooks.json +2 -2
- package/dist/templates/copilot/prompts/before-dev.prompt.md +12 -6
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +69 -457
- package/dist/templates/copilot/prompts/check.prompt.md +86 -18
- package/dist/templates/copilot/prompts/parallel.prompt.md +16 -8
- package/dist/templates/copilot/prompts/start.prompt.md +33 -367
- package/dist/templates/cursor/agents/trellis-check.md +13 -7
- package/dist/templates/cursor/agents/trellis-implement.md +8 -7
- package/dist/templates/cursor/hooks.json +1 -7
- package/dist/templates/droid/droids/trellis-check.md +13 -7
- package/dist/templates/droid/droids/trellis-implement.md +8 -7
- package/dist/templates/droid/settings.json +4 -4
- package/dist/templates/gemini/agents/trellis-check.md +11 -5
- package/dist/templates/gemini/agents/trellis-implement.md +7 -6
- package/dist/templates/gemini/settings.json +2 -2
- package/dist/templates/kiro/agents/trellis-check.json +1 -1
- package/dist/templates/kiro/agents/trellis-implement.json +1 -1
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +127 -9
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +171 -6
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +333 -43
- package/dist/templates/markdown/spec/guides/index.md.txt +18 -0
- package/dist/templates/opencode/agents/trellis-check.md +13 -7
- package/dist/templates/opencode/agents/trellis-implement.md +9 -8
- package/dist/templates/opencode/lib/session-utils.js +212 -123
- package/dist/templates/opencode/lib/trellis-context.js +73 -11
- package/dist/templates/opencode/plugins/inject-subagent-context.js +131 -29
- package/dist/templates/opencode/plugins/inject-workflow-state.js +9 -5
- package/dist/templates/opencode/plugins/session-start.js +9 -1
- package/dist/templates/pi/agents/trellis-check.md +5 -4
- package/dist/templates/pi/agents/trellis-implement.md +5 -4
- package/dist/templates/pi/extensions/trellis/index.ts.txt +1357 -754
- package/dist/templates/qoder/agents/trellis-check.md +11 -5
- package/dist/templates/qoder/agents/trellis-implement.md +7 -6
- package/dist/templates/qoder/settings.json +4 -4
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +0 -1
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/inject-subagent-context.py +36 -14
- package/dist/templates/shared-hooks/inject-workflow-state.py +40 -42
- package/dist/templates/shared-hooks/session-start.py +222 -171
- package/dist/templates/trellis/config.yaml +38 -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 +2 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +50 -24
- package/dist/templates/trellis/scripts/common/config.py +57 -1
- package/dist/templates/trellis/scripts/common/safe_commit.py +285 -0
- package/dist/templates/trellis/scripts/common/session_context.py +384 -137
- package/dist/templates/trellis/scripts/common/task_context.py +3 -3
- package/dist/templates/trellis/scripts/common/task_store.py +161 -15
- package/dist/templates/trellis/scripts/common/workflow_phase.py +7 -10
- package/dist/templates/trellis/scripts/task.py +3 -3
- package/dist/templates/trellis/workflow.md +119 -98
- 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 +13 -0
- package/dist/utils/file-writer.d.ts.map +1 -1
- package/dist/utils/file-writer.js +59 -1
- package/dist/utils/file-writer.js.map +1 -1
- 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/task-json.d.ts +9 -42
- package/dist/utils/task-json.d.ts.map +1 -1
- package/dist/utils/task-json.js +8 -45
- package/dist/utils/task-json.js.map +1 -1
- package/dist/utils/template-hash.d.ts +32 -6
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +53 -31
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/uninstall-scrubbers.d.ts +1 -0
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
- package/dist/utils/uninstall-scrubbers.js +21 -0
- package/dist/utils/uninstall-scrubbers.js.map +1 -1
- package/dist/utils/workflow-resolver.d.ts +86 -0
- package/dist/utils/workflow-resolver.d.ts.map +1 -0
- package/dist/utils/workflow-resolver.js +265 -0
- package/dist/utils/workflow-resolver.js.map +1 -0
- package/package.json +9 -8
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
9
|
"command": "{{PYTHON_CMD}} .factory/hooks/session-start.py",
|
|
10
|
-
"timeout":
|
|
10
|
+
"timeout": 30
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
{
|
|
18
18
|
"type": "command",
|
|
19
19
|
"command": "{{PYTHON_CMD}} .factory/hooks/session-start.py",
|
|
20
|
-
"timeout":
|
|
20
|
+
"timeout": 30
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
{
|
|
28
28
|
"type": "command",
|
|
29
29
|
"command": "{{PYTHON_CMD}} .factory/hooks/session-start.py",
|
|
30
|
-
"timeout":
|
|
30
|
+
"timeout": 30
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
33
|
}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
{
|
|
51
51
|
"type": "command",
|
|
52
52
|
"command": "{{PYTHON_CMD}} .factory/hooks/inject-workflow-state.py",
|
|
53
|
-
"timeout":
|
|
53
|
+
"timeout": 15
|
|
54
54
|
}
|
|
55
55
|
]
|
|
56
56
|
}
|
|
@@ -19,14 +19,18 @@ You are already the `trellis-check` sub-agent that the main session dispatched.
|
|
|
19
19
|
|
|
20
20
|
Before checking, read:
|
|
21
21
|
- `.trellis/spec/` - Development guidelines
|
|
22
|
+
- Task `prd.md` - Requirements document
|
|
23
|
+
- Task `design.md` - Technical design (if exists)
|
|
24
|
+
- Task `implement.md` - Execution plan (if exists)
|
|
22
25
|
- Pre-commit checklist for quality standards
|
|
23
26
|
|
|
24
27
|
## Core Responsibilities
|
|
25
28
|
|
|
26
29
|
1. **Get code changes** - Use git diff to get uncommitted code
|
|
27
|
-
2. **
|
|
28
|
-
3. **
|
|
29
|
-
4. **
|
|
30
|
+
2. **Review task artifacts** - Check changes against prd.md, design.md if present, and implement.md if present
|
|
31
|
+
3. **Check against specs** - Verify code follows guidelines
|
|
32
|
+
4. **Self-fix** - Fix issues yourself, not just report them
|
|
33
|
+
5. **Run verification** - typecheck and lint
|
|
30
34
|
|
|
31
35
|
## Important
|
|
32
36
|
|
|
@@ -45,10 +49,12 @@ git diff --name-only # List changed files
|
|
|
45
49
|
git diff # View specific changes
|
|
46
50
|
```
|
|
47
51
|
|
|
48
|
-
### Step 2: Check Against Specs
|
|
52
|
+
### Step 2: Check Against Specs and Task Artifacts
|
|
49
53
|
|
|
50
|
-
Read relevant specs in `.trellis/spec/` to check code:
|
|
54
|
+
Read the task's prd.md, design.md if present, and implement.md if present, then read relevant specs in `.trellis/spec/` to check code:
|
|
51
55
|
|
|
56
|
+
- Does it satisfy the task requirements
|
|
57
|
+
- Does it follow the technical design and implementation plan when present
|
|
52
58
|
- Does it follow directory structure conventions
|
|
53
59
|
- Does it follow naming conventions
|
|
54
60
|
- Does it follow code patterns
|
|
@@ -21,13 +21,14 @@ Before implementing, read:
|
|
|
21
21
|
- `.trellis/workflow.md` - Project workflow
|
|
22
22
|
- `.trellis/spec/` - Development guidelines
|
|
23
23
|
- Task `prd.md` - Requirements document
|
|
24
|
-
- Task `
|
|
24
|
+
- Task `design.md` - Technical design (if exists)
|
|
25
|
+
- Task `implement.md` - Execution plan (if exists)
|
|
25
26
|
|
|
26
27
|
## Core Responsibilities
|
|
27
28
|
|
|
28
29
|
1. **Understand specs** - Read relevant spec files in `.trellis/spec/`
|
|
29
|
-
2. **Understand
|
|
30
|
-
3. **Implement features** - Write code following specs and
|
|
30
|
+
2. **Understand task artifacts** - Read prd.md, design.md if present, and implement.md if present
|
|
31
|
+
3. **Implement features** - Write code following specs and task artifacts
|
|
31
32
|
4. **Self-check** - Ensure code quality
|
|
32
33
|
5. **Report results** - Report completion status
|
|
33
34
|
|
|
@@ -52,15 +53,15 @@ Read relevant specs based on task type:
|
|
|
52
53
|
|
|
53
54
|
### 2. Understand Requirements
|
|
54
55
|
|
|
55
|
-
Read the task's prd.md and
|
|
56
|
+
Read the task's prd.md, design.md if present, and implement.md if present:
|
|
56
57
|
|
|
57
58
|
- What are the core requirements
|
|
58
59
|
- Key points of technical design
|
|
59
|
-
-
|
|
60
|
+
- Implementation order, validation commands, and rollback points
|
|
60
61
|
|
|
61
62
|
### 3. Implement Features
|
|
62
63
|
|
|
63
|
-
- Write code following specs and
|
|
64
|
+
- Write code following specs and task artifacts
|
|
64
65
|
- Follow existing code patterns
|
|
65
66
|
- Only do what's required, no over-engineering
|
|
66
67
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
"type": "command",
|
|
9
9
|
"command": "{{PYTHON_CMD}} .gemini/hooks/session-start.py",
|
|
10
|
-
"timeout":
|
|
10
|
+
"timeout": 30000
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
{
|
|
20
20
|
"type": "command",
|
|
21
21
|
"command": "{{PYTHON_CMD}} .gemini/hooks/inject-workflow-state.py",
|
|
22
|
-
"timeout":
|
|
22
|
+
"timeout": 15000
|
|
23
23
|
}
|
|
24
24
|
]
|
|
25
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trellis-check",
|
|
3
3
|
"description": "Code quality check expert. Reviews code changes against specs and self-fixes issues.",
|
|
4
|
-
"prompt": "# Check Agent\n\nYou are the Check Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.\n\n- Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**:
|
|
4
|
+
"prompt": "# Check Agent\n\nYou are the Check Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.\n\n- Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: task artifacts, spec, and research files have already been auto-loaded for you above. Proceed with the check work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/check.jsonl`, each listed file, `<task-path>/prd.md`, `<task-path>/design.md` if present, and `<task-path>/implement.md` if present before doing the work.\n\n## Context\n\nBefore checking, read:\n- `.trellis/spec/` - Development guidelines\n- Task `prd.md` - Requirements document\n- Task `design.md` - Technical design (if exists)\n- Task `implement.md` - Execution plan (if exists)\n- Pre-commit checklist for quality standards\n\n## Core Responsibilities\n\n1. **Get code changes** - Use git diff to get uncommitted code\n2. **Review task artifacts** - Check changes against prd.md, design.md if present, and implement.md if present\n3. **Check against specs** - Verify code follows guidelines\n4. **Self-fix** - Fix issues yourself, not just report them\n5. **Run verification** - typecheck and lint\n\n## Important\n\n**Fix issues yourself**, don't just report them.\n\nYou have write and edit tools, you can modify code directly.\n\n---\n\n## Workflow\n\n### Step 1: Get Changes\n\n```bash\ngit diff --name-only # List changed files\ngit diff # View specific changes\n```\n\n### Step 2: Check Against Specs and Task Artifacts\n\nRead the task's prd.md, design.md if present, and implement.md if present, then read relevant specs in `.trellis/spec/` to check code:\n\n- Does it satisfy the task requirements\n- Does it follow the technical design and implementation plan when present\n- Does it follow directory structure conventions\n- Does it follow naming conventions\n- Does it follow code patterns\n- Are there missing types\n- Are there potential bugs\n\n### Step 3: Self-Fix\n\nAfter finding issues:\n\n1. Fix the issue directly (use edit tool)\n2. Record what was fixed\n3. Continue checking other issues\n\n### Step 4: Run Verification\n\nRun project's lint and typecheck commands to verify changes.\n\nIf failed, fix issues and re-run.\n\n---\n\n## Report Format\n\n```markdown\n## Self-Check Complete\n\n### Files Checked\n\n- src/components/Feature.tsx\n- src/hooks/useFeature.ts\n\n### Issues Found and Fixed\n\n1. `<file>:<line>` - <what was fixed>\n2. `<file>:<line>` - <what was fixed>\n\n### Issues Not Fixed\n\n(If there are issues that cannot be self-fixed, list them here with reasons)\n\n### Verification Results\n\n- TypeCheck: Passed\n- Lint: Passed\n\n### Summary\n\nChecked X files, found Y issues, all fixed.\n```",
|
|
5
5
|
"tools": [
|
|
6
6
|
"read",
|
|
7
7
|
"write",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trellis-implement",
|
|
3
3
|
"description": "Code implementation expert. Understands specs and requirements, then implements features. No git commit allowed.",
|
|
4
|
-
"prompt": "# Implement Agent\n\nYou are the Implement Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.\n\n- Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/
|
|
4
|
+
"prompt": "# Implement Agent\n\nYou are the Implement Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.\n\n- Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/implement.jsonl`, each listed file, `<task-path>/prd.md`, `<task-path>/design.md` if present, and `<task-path>/implement.md` if present before doing the work.\n\n## Context\n\nBefore implementing, read:\n- `.trellis/workflow.md` - Project workflow\n- `.trellis/spec/` - Development guidelines\n- Task `prd.md` - Requirements document\n- Task `design.md` - Technical design (if exists)\n- Task `implement.md` - Execution plan (if exists)\n\n## Core Responsibilities\n\n1. **Understand specs** - Read relevant spec files in `.trellis/spec/`\n2. **Understand task artifacts** - Read prd.md, design.md if present, and implement.md if present\n3. **Implement features** - Write code following specs and task artifacts\n4. **Self-check** - Ensure code quality\n5. **Report results** - Report completion status\n\n## Forbidden Operations\n\n**Do NOT execute these git commands:**\n\n- `git commit`\n- `git push`\n- `git merge`\n\n---\n\n## Workflow\n\n### 1. Understand Specs\n\nRead relevant specs based on task type:\n\n- Spec layers: `.trellis/spec/<package>/<layer>/`\n- Shared guides: `.trellis/spec/guides/`\n\n### 2. Understand Requirements\n\nRead the task's prd.md, design.md if present, and implement.md if present:\n\n- What are the core requirements\n- Key points of technical design\n- Implementation order, validation commands, and rollback points\n\n### 3. Implement Features\n\n- Write code following specs and task artifacts\n- Follow existing code patterns\n- Only do what's required, no over-engineering\n\n### 4. Verify\n\nRun project's lint and typecheck commands to verify changes.\n\n---\n\n## Report Format\n\n```markdown\n## Implementation Complete\n\n### Files Modified\n\n- `src/components/Feature.tsx` - New component\n- `src/hooks/useFeature.ts` - New hook\n\n### Implementation Summary\n\n1. Created Feature component...\n2. Added useFeature hook...\n\n### Verification Results\n\n- Lint: Passed\n- TypeCheck: Passed\n```\n\n---\n\n## Code Standards\n\n- Follow existing code patterns\n- Don't add unnecessary abstractions\n- Only do what's required, no over-engineering\n- Keep code readable",
|
|
5
5
|
"tools": [
|
|
6
6
|
"read",
|
|
7
7
|
"write",
|
|
@@ -58,6 +58,29 @@ grep -r "keyword" .
|
|
|
58
58
|
|
|
59
59
|
**Good**: Single source of truth, import everywhere
|
|
60
60
|
|
|
61
|
+
### Pattern 4: Repeated Payload Field Extraction
|
|
62
|
+
|
|
63
|
+
**Bad**: Multiple consumers cast the same JSON/event fields locally:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const description = (ev as { description?: string }).description;
|
|
67
|
+
const context = (ev as { context?: ContextEntry[] }).context;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This is duplicated contract logic even when the code is only two lines. Each
|
|
71
|
+
consumer now has its own definition of what a valid payload means.
|
|
72
|
+
|
|
73
|
+
**Good**: Put the decoder, type guard, or projection next to the data owner:
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
if (isThreadEvent(ev)) {
|
|
77
|
+
renderThreadEvent(ev);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Rule**: If the same untyped payload field is read in 2+ places, create a
|
|
82
|
+
shared type guard / normalizer / projection before adding a third reader.
|
|
83
|
+
|
|
61
84
|
---
|
|
62
85
|
|
|
63
86
|
## When to Abstract
|
|
@@ -82,6 +105,74 @@ When you've made similar changes to multiple files:
|
|
|
82
105
|
2. **Search**: Run grep to find any missed
|
|
83
106
|
3. **Consider**: Should this be abstracted?
|
|
84
107
|
|
|
108
|
+
### Reducers Should Use Exhaustive Structure
|
|
109
|
+
|
|
110
|
+
When state is derived from action-like values (`action`, `kind`, `status`,
|
|
111
|
+
`phase`), prefer a reducer with one `switch` over scattered `if/else` updates.
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// BAD - action-specific state transitions are hard to audit
|
|
115
|
+
if (action === "opened") { ... }
|
|
116
|
+
else if (action === "comment") { ... }
|
|
117
|
+
else if (action === "status") { ... }
|
|
118
|
+
|
|
119
|
+
// GOOD - one reducer owns the transition table
|
|
120
|
+
switch (event.action) {
|
|
121
|
+
case "opened":
|
|
122
|
+
...
|
|
123
|
+
return;
|
|
124
|
+
case "comment":
|
|
125
|
+
...
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This matters when the event log is the source of truth. A reducer is the
|
|
131
|
+
documented replay model; display code and commands should not duplicate pieces
|
|
132
|
+
of that replay model.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Checklist Before Commit
|
|
137
|
+
|
|
138
|
+
- [ ] Searched for existing similar code
|
|
139
|
+
- [ ] No copy-pasted logic that should be shared
|
|
140
|
+
- [ ] No repeated untyped payload field extraction outside a shared decoder
|
|
141
|
+
- [ ] Constants defined in one place
|
|
142
|
+
- [ ] Similar patterns follow same structure
|
|
143
|
+
- [ ] Reducer/action transitions live in one reducer or command dispatcher
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Gotcha: Python if/elif/else Exhaustive Check
|
|
148
|
+
|
|
149
|
+
**Problem**: Python's if/elif/else chains have no compile-time exhaustive check. When you add a new value to a `Literal` type (e.g., `Platform`), existing if/elif/else chains silently fall through to `else` with wrong defaults.
|
|
150
|
+
|
|
151
|
+
**Symptom**: New platform works partially — some methods return Claude defaults instead of platform-specific values. No error is raised.
|
|
152
|
+
|
|
153
|
+
**Example** (`cli_adapter.py`):
|
|
154
|
+
```python
|
|
155
|
+
# BAD: "gemini" falls through to else, returns "claude"
|
|
156
|
+
@property
|
|
157
|
+
def cli_name(self) -> str:
|
|
158
|
+
if self.platform == "opencode":
|
|
159
|
+
return "opencode"
|
|
160
|
+
else:
|
|
161
|
+
return "claude" # gemini silently gets "claude"!
|
|
162
|
+
|
|
163
|
+
# GOOD: explicit branch for every platform
|
|
164
|
+
@property
|
|
165
|
+
def cli_name(self) -> str:
|
|
166
|
+
if self.platform == "opencode":
|
|
167
|
+
return "opencode"
|
|
168
|
+
elif self.platform == "gemini":
|
|
169
|
+
return "gemini"
|
|
170
|
+
else:
|
|
171
|
+
return "claude"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Prevention**: When adding a new value to a Python `Literal` type, search for ALL if/elif/else chains that switch on that type and add explicit branches. Don't rely on `else` being correct for new values.
|
|
175
|
+
|
|
85
176
|
---
|
|
86
177
|
|
|
87
178
|
## Gotcha: Asymmetric Mechanisms Producing Same Output
|
|
@@ -90,16 +181,43 @@ When you've made similar changes to multiple files:
|
|
|
90
181
|
|
|
91
182
|
**Symptom**: Init works perfectly, but update creates files at wrong paths or misses files entirely.
|
|
92
183
|
|
|
93
|
-
**Prevention
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
184
|
+
**Prevention**:
|
|
185
|
+
- **Best**: Eliminate the asymmetry — have the manual path call the automatic one (e.g., `collectTemplateFiles()` calls `getAllScripts()` instead of maintaining its own list)
|
|
186
|
+
- **If asymmetry is unavoidable**: Add a regression test that compares outputs from both mechanisms
|
|
187
|
+
- When migrating directory structures, search for ALL code paths that reference the old structure
|
|
188
|
+
|
|
189
|
+
**Real example**: `trellis update` had a manual `files.set()` list for 11 scripts that `getAllScripts()` already tracked. Fix: replaced the manual list with a `for..of getAllScripts()` loop. See `update.ts` refactor in v0.4.0-beta.3.
|
|
97
190
|
|
|
98
191
|
---
|
|
99
192
|
|
|
100
|
-
##
|
|
193
|
+
## Template File Registration (Trellis-specific)
|
|
101
194
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
195
|
+
When adding new files to `src/templates/trellis/scripts/`:
|
|
196
|
+
|
|
197
|
+
**Single registration point**: `src/templates/trellis/index.ts`
|
|
198
|
+
|
|
199
|
+
1. Add `export const xxxScript = readTemplate("scripts/path/file.py");`
|
|
200
|
+
2. Add to `getAllScripts()` Map
|
|
201
|
+
|
|
202
|
+
That's it. `commands/update.ts` uses `getAllScripts()` directly — no manual sync needed.
|
|
203
|
+
|
|
204
|
+
**Why this matters**: Without registration in `getAllScripts()`, `trellis update` won't sync the file to user projects. Bug fixes and features won't propagate.
|
|
205
|
+
|
|
206
|
+
**History**: Before v0.4.0-beta.3, `update.ts` had its own hand-maintained file list that frequently fell out of sync with `getAllScripts()`. This caused 11 Python files to be silently skipped during `trellis update`. The fix was to eliminate the duplicate list and use `getAllScripts()` as the single source of truth.
|
|
207
|
+
|
|
208
|
+
### Quick Checklist for New Scripts
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# After adding a new .py file, verify it's in getAllScripts():
|
|
212
|
+
grep -l "newFileName" src/templates/trellis/index.ts # Should match
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Template Sync Convention
|
|
216
|
+
|
|
217
|
+
`.trellis/scripts/` (dogfooded) and `packages/cli/src/templates/trellis/scripts/` (template) must stay identical. After editing `.trellis/scripts/`, always sync:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
rsync -av --delete --exclude='__pycache__' .trellis/scripts/ packages/cli/src/templates/trellis/scripts/
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**Gotcha**: Running rsync with wrong source/destination paths can create nested garbage directories (e.g., `.trellis/scripts/packages/cli/...`). Always double-check paths before running.
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
**Most bugs happen at layer boundaries**, not within layers.
|
|
10
10
|
|
|
11
11
|
Common cross-layer bugs:
|
|
12
|
+
|
|
12
13
|
- API returns format A, frontend expects format B
|
|
13
14
|
- Database stores X, service transforms to Y, but loses data
|
|
14
15
|
- Multiple layers implement the same logic differently
|
|
@@ -26,22 +27,24 @@ Source → Transform → Store → Retrieve → Transform → Display
|
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
For each arrow, ask:
|
|
30
|
+
|
|
29
31
|
- What format is the data in?
|
|
30
32
|
- What could go wrong?
|
|
31
33
|
- Who is responsible for validation?
|
|
32
34
|
|
|
33
35
|
### Step 2: Identify Boundaries
|
|
34
36
|
|
|
35
|
-
| Boundary
|
|
36
|
-
|
|
37
|
-
| API ↔ Service
|
|
38
|
-
| Service ↔ Database
|
|
39
|
-
| Backend ↔ Frontend
|
|
40
|
-
| Component ↔ Component | Props shape changes
|
|
37
|
+
| Boundary | Common Issues |
|
|
38
|
+
| --------------------- | --------------------------------- |
|
|
39
|
+
| API ↔ Service | Type mismatches, missing fields |
|
|
40
|
+
| Service ↔ Database | Format conversions, null handling |
|
|
41
|
+
| Backend ↔ Frontend | Serialization, date formats |
|
|
42
|
+
| Component ↔ Component | Props shape changes |
|
|
41
43
|
|
|
42
44
|
### Step 3: Define Contracts
|
|
43
45
|
|
|
44
46
|
For each boundary:
|
|
47
|
+
|
|
45
48
|
- What is the exact input format?
|
|
46
49
|
- What is the exact output format?
|
|
47
50
|
- What errors can occur?
|
|
@@ -68,27 +71,189 @@ For each boundary:
|
|
|
68
71
|
|
|
69
72
|
**Good**: Each layer only knows its neighbors
|
|
70
73
|
|
|
74
|
+
### Mistake 4: Every Consumer Parses The Same Payload
|
|
75
|
+
|
|
76
|
+
**Bad**: A command reads JSONL events and casts fields inline:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const thread = (ev as { thread?: string }).thread;
|
|
80
|
+
const labels = (ev as { labels?: string[] }).labels;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This looks local, but it means every consumer owns a private version of the
|
|
84
|
+
event contract. The next field change will update one command and miss another.
|
|
85
|
+
|
|
86
|
+
**Good**: Decode once at the event boundary, then export typed projections:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
if (!isThreadEvent(ev)) return false;
|
|
90
|
+
return ev.thread === filter.thread;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Rule**: For append-only logs, JSON streams, RPC payloads, or config files,
|
|
94
|
+
create one owner for:
|
|
95
|
+
|
|
96
|
+
- event / payload type definitions
|
|
97
|
+
- type guards and normalization from `unknown`
|
|
98
|
+
- metadata projections used by UI commands
|
|
99
|
+
- reducers that replay state from the source of truth
|
|
100
|
+
|
|
101
|
+
Rendering code may format fields, but it must not redefine the payload contract.
|
|
102
|
+
|
|
71
103
|
---
|
|
72
104
|
|
|
73
105
|
## Checklist for Cross-Layer Features
|
|
74
106
|
|
|
75
107
|
Before implementation:
|
|
108
|
+
|
|
76
109
|
- [ ] Mapped the complete data flow
|
|
77
110
|
- [ ] Identified all layer boundaries
|
|
78
111
|
- [ ] Defined format at each boundary
|
|
79
112
|
- [ ] Decided where validation happens
|
|
80
113
|
|
|
81
114
|
After implementation:
|
|
115
|
+
|
|
82
116
|
- [ ] Tested with edge cases (null, empty, invalid)
|
|
83
117
|
- [ ] Verified error handling at each boundary
|
|
84
118
|
- [ ] Checked data survives round-trip
|
|
119
|
+
- [ ] Checked that consumers import shared decoders / projections instead of
|
|
120
|
+
casting payload fields locally
|
|
121
|
+
- [ ] Checked that derived state points back to the source event identifier
|
|
122
|
+
(`seq`, `id`, `version`) instead of inventing a second cursor
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Cross-Platform Template Consistency
|
|
127
|
+
|
|
128
|
+
In Trellis, command templates (e.g., `record-session.md`) exist in **multiple platforms** with identical or near-identical content. This is a cross-layer boundary.
|
|
129
|
+
|
|
130
|
+
### Checklist: After Modifying Any Command Template
|
|
131
|
+
|
|
132
|
+
- [ ] Find all platforms with the same command: `find src/templates/*/commands/trellis/ -name "<command>.*"`
|
|
133
|
+
- [ ] Update all platform copies (Markdown `.md` and TOML `.toml`)
|
|
134
|
+
- [ ] For Gemini TOML: adapt line continuations (`\\` vs `\`) and triple-quoted strings
|
|
135
|
+
- [ ] Run `/trellis:check-cross-layer` to verify nothing was missed
|
|
136
|
+
|
|
137
|
+
**Real-world example**: Updated `record-session.md` in Claude to use `--mode record`, but forgot iFlow, Kilo, OpenCode, and Gemini — caught by cross-layer check.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Generated Runtime Template Upgrade Consistency
|
|
142
|
+
|
|
143
|
+
Some generated files are both documentation and runtime input. In Trellis,
|
|
144
|
+
`.trellis/workflow.md` is parsed by `get_context.py`, `workflow_phase.py`,
|
|
145
|
+
SessionStart filters, and per-turn hooks. Template changes must be validated
|
|
146
|
+
against both fresh init and upgrade paths.
|
|
147
|
+
|
|
148
|
+
### Checklist: After Modifying A Runtime-Parsed Template
|
|
149
|
+
|
|
150
|
+
- [ ] Identify every runtime parser that reads the template, not just the file
|
|
151
|
+
writer that installs it
|
|
152
|
+
- [ ] Check whether relevant syntax lives outside obvious managed regions
|
|
153
|
+
such as tag blocks
|
|
154
|
+
- [ ] Verify fresh `init` output and a versioned `update` scenario that writes
|
|
155
|
+
the older `.trellis/.version`
|
|
156
|
+
- [ ] Add an upgrade regression using an older pristine template fixture, then
|
|
157
|
+
assert the installed file reaches the current packaged shape
|
|
158
|
+
- [ ] Update the backend spec that owns the runtime contract
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Versioned Documentation Boundary
|
|
163
|
+
|
|
164
|
+
Versioned documentation is a cross-layer boundary: source paths, `docs.json`
|
|
165
|
+
version routing, and the rendered version selector must all describe the same
|
|
166
|
+
release line.
|
|
167
|
+
|
|
168
|
+
### Checklist: Before Editing Versioned Docs
|
|
169
|
+
|
|
170
|
+
- [ ] Identify the target release line: stable, beta, or RC
|
|
171
|
+
- [ ] Verify the edited MDX path matches that line:
|
|
172
|
+
- stable: `docs-site/{start,advanced,...}` and `docs-site/zh/{start,advanced,...}`
|
|
173
|
+
- beta: `docs-site/beta/**` and `docs-site/zh/beta/**`
|
|
174
|
+
- RC: `docs-site/rc/**` and `docs-site/zh/rc/**`
|
|
175
|
+
- [ ] Verify `docs.json` navigation points the version label to the same paths
|
|
176
|
+
- [ ] Grep the opposite tree for release-line-specific terms before committing
|
|
177
|
+
- [ ] Treat beta content appearing under root release paths as a source-path bug,
|
|
178
|
+
not a rendering bug
|
|
179
|
+
|
|
180
|
+
**Real-world example**: A beta-only task workflow change documented
|
|
181
|
+
`prd.md` + `design.md` + `implement.md`, task-creation consent, and Codex
|
|
182
|
+
mode banners under root `start/` and `advanced/` paths. The docs site then
|
|
183
|
+
served 0.6 beta behavior under the Release selector. The fix was to restore root
|
|
184
|
+
release docs, move the 0.6 content to `beta/` and `zh/beta/`, and add a grep
|
|
185
|
+
audit for beta markers against the root release tree.
|
|
186
|
+
|
|
187
|
+
**Real-world example**: Codex inline mode changed workflow platform markers from
|
|
188
|
+
`[Codex]` / `[Kilo, Antigravity, Windsurf]` to `[codex-sub-agent]` /
|
|
189
|
+
`[codex-inline, Kilo, Antigravity, Windsurf]`. Fresh init was correct, but
|
|
190
|
+
`trellis update` only merged `[workflow-state:*]` blocks and preserved stale
|
|
191
|
+
markers outside those blocks. Result: upgraded projects got new hook scripts
|
|
192
|
+
but old workflow routing, so `get_context.py --mode phase --platform codex`
|
|
193
|
+
could return empty Phase 2.1 detail.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Mode-Detection Probe Checklist
|
|
198
|
+
|
|
199
|
+
When a CLI auto-detects a mode by probing a remote resource (e.g., checking if `index.json` exists to decide marketplace vs direct download):
|
|
200
|
+
|
|
201
|
+
### Before implementing:
|
|
202
|
+
|
|
203
|
+
- [ ] Probe runs in **ALL** code paths that use the result (interactive, `-y`, `--flag` combos)
|
|
204
|
+
- [ ] 404 vs transient error are distinguished — don't treat both as "not found"
|
|
205
|
+
- [ ] Transient errors **abort or retry**, never silently switch modes
|
|
206
|
+
- [ ] Shared state (caches, prefetched data) is **reset** when context changes (e.g., user switches source)
|
|
207
|
+
- [ ] **Shortcut paths** (e.g., `--template` skipping picker) must have the same error-handling quality as the probed path — check that downstream functions don't call catch-all wrappers
|
|
208
|
+
|
|
209
|
+
### After implementing:
|
|
210
|
+
|
|
211
|
+
- [ ] Trace every path from probe result to the mode-decision branch — no fallthrough
|
|
212
|
+
- [ ] External format contracts (giget URI, raw URLs) are tested or at least documented as comments
|
|
213
|
+
- [ ] Metadata reads consume a complete response or use a streaming parser — never parse a fixed-size prefix as full JSON
|
|
214
|
+
- [ ] When reconstructing a composite identifier from parsed parts, verify **all** fields are included and in the **correct position** (e.g., `provider:repo/path#ref` not `provider:repo#ref/path`)
|
|
215
|
+
- [ ] Verify that **action functions** called after a shortcut don't internally use the old catch-all fetch — they must use the probe-quality variant when error distinction matters
|
|
216
|
+
|
|
217
|
+
**Real-world example**: Custom registry flow had 8 bugs across 3 review rounds: (1) probe only ran in interactive mode, (2) transient errors fell through to wrong mode, (3) giget URI had `#ref` in wrong position, (4) prefetched templates leaked across source switches, (5) `--template` shortcut bypassed probe but `downloadTemplateById` internally used catch-all `fetchTemplateIndex`, turning timeouts into "Template not found".
|
|
218
|
+
|
|
219
|
+
**Real-world example**: Agent-session update hints fetched npm `latest` metadata with `response.read(4096)` and then parsed it as complete JSON. The `@mindfoldhq/trellis` package metadata exceeded 4 KB, so the JSON was truncated, parse failed silently, and the first session injection showed no update hint. Fix: read the complete response before parsing, and add a regression where `version` is followed by an 8 KB metadata tail.
|
|
85
220
|
|
|
86
221
|
---
|
|
87
222
|
|
|
88
223
|
## When to Create Flow Documentation
|
|
89
224
|
|
|
90
225
|
Create detailed flow docs when:
|
|
226
|
+
|
|
91
227
|
- Feature spans 3+ layers
|
|
92
228
|
- Multiple teams are involved
|
|
93
229
|
- Data format is complex
|
|
94
230
|
- Feature has caused bugs before
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Event Log / Projection Boundary
|
|
235
|
+
|
|
236
|
+
Append-only logs are cross-layer contracts. A single event travels through:
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
CLI input → event writer → events.jsonl → reader → filter → reducer → display
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Checklist: After Adding A New Event Kind Or Field
|
|
243
|
+
|
|
244
|
+
- [ ] Add the event kind to the central event taxonomy
|
|
245
|
+
- [ ] Add a typed event variant or type guard at the event layer
|
|
246
|
+
- [ ] Add normalization helpers for array/object fields that come from
|
|
247
|
+
user input or JSON
|
|
248
|
+
- [ ] Keep `seq` / `id` assignment in the event writer only
|
|
249
|
+
- [ ] Make filters and reducers consume the typed event guard, not local casts
|
|
250
|
+
- [ ] Make display code consume reducer output or typed events, not raw JSON
|
|
251
|
+
- [ ] Add at least one regression that proves history replay and live filtering
|
|
252
|
+
use the same filter model
|
|
253
|
+
|
|
254
|
+
**Real-world example**: Thread channels added `kind: "thread"`, `description`,
|
|
255
|
+
`context`, labels, and `lastSeq`. The first implementation replayed thread
|
|
256
|
+
state correctly, but several commands still re-parsed event payload fields with
|
|
257
|
+
local casts. The fix was to make the core event layer own `ThreadChannelEvent`
|
|
258
|
+
and `isThreadEvent`, make `reduceChannelMetadata` the only channel metadata
|
|
259
|
+
projection, and make `reduceThreads` the only thread replay reducer.
|