@blulotus/trellis 0.7.0 → 0.7.2
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 +2 -2
- package/dist/cli/index.js +2 -29
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +0 -22
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -12
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mem.d.ts +2 -2
- package/dist/commands/mem.d.ts.map +1 -1
- package/dist/commands/mem.js +7 -40
- package/dist/commands/mem.js.map +1 -1
- package/dist/commands/uninstall.d.ts +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +4 -34
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +2 -28
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +7 -73
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +18 -70
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +20 -299
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +0 -14
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +1 -37
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/manifests/0.1.9.json +0 -12
- package/dist/migrations/manifests/0.2.14.json +0 -84
- package/dist/migrations/manifests/0.3.0-beta.0.json +0 -87
- package/dist/migrations/manifests/0.3.4.json +1 -13
- package/dist/migrations/manifests/0.4.0-beta.1.json +24 -176
- package/dist/migrations/manifests/0.5.0-beta.0.json +67 -1203
- package/dist/migrations/manifests/0.5.0-beta.15.json +0 -96
- package/dist/migrations/manifests/0.5.0-beta.5.json +0 -168
- package/dist/migrations/manifests/0.5.0-beta.9.json +0 -20
- package/dist/migrations/manifests/0.6.0-beta.23.json +0 -66
- package/dist/migrations/manifests/0.6.3.json +1 -16
- package/dist/migrations/manifests/0.6.6.json +1 -9
- package/dist/migrations/manifests/0.7.0.json +9 -0
- package/dist/migrations/manifests/0.7.1.json +9 -0
- package/dist/migrations/manifests/0.7.2.json +9 -0
- package/dist/migrations/manifests/0.8.0.json +9 -0
- package/dist/templates/codex/hooks/session-start.py +37 -13
- package/dist/templates/codex/hooks.json +5 -0
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +5 -5
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +0 -10
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +1 -13
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +2 -2
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/bundled-skills.md +9 -28
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +5 -5
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +1 -17
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +4 -12
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +6 -6
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +5 -75
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +0 -16
- package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +2 -3
- package/dist/templates/common/commands/continue.md +24 -4
- package/dist/templates/common/commands/finish-work.md +19 -9
- package/dist/templates/common/commands/start.md +38 -29
- package/dist/templates/extract.d.ts +0 -10
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +0 -24
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +7 -9
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +4 -8
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +5 -5
- package/dist/templates/shared-hooks/index.d.ts +11 -43
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +9 -86
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/inject-spec-context.py +1 -1
- package/dist/templates/shared-hooks/inject-subagent-context.py +23 -85
- package/dist/templates/shared-hooks/inject-workflow-state.py +56 -86
- package/dist/templates/shared-hooks/session-start.py +76 -98
- package/dist/templates/trellis/config.yaml +8 -8
- package/dist/templates/trellis/index.d.ts +1 -4
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +1 -5
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +12 -11
- package/dist/templates/trellis/scripts/common/__init__.py +2 -0
- package/dist/templates/trellis/scripts/common/active_task.py +80 -152
- package/dist/templates/trellis/scripts/common/config.py +7 -7
- package/dist/templates/trellis/scripts/common/git_context.py +1 -1
- package/dist/templates/trellis/scripts/common/session_context.py +2 -2
- package/dist/templates/trellis/scripts/common/spec_inject.py +2 -2
- package/dist/templates/trellis/scripts/common/task_store.py +8 -28
- package/dist/templates/trellis/scripts/common/workflow_phase.py +4 -8
- package/dist/templates/trellis/scripts/get_context.py +2 -2
- package/dist/templates/trellis/scripts/init_developer.py +1 -1
- package/dist/templates/trellis/scripts/task.py +90 -57
- package/dist/templates/trellis/workflow.md +44 -66
- package/dist/types/ai-tools.d.ts +10 -10
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +3 -434
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/uninstall-scrubbers.d.ts +3 -18
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
- package/dist/utils/uninstall-scrubbers.js +24 -154
- package/dist/utils/uninstall-scrubbers.js.map +1 -1
- package/package.json +2 -2
- package/dist/configurators/antigravity.d.ts +0 -7
- package/dist/configurators/antigravity.d.ts.map +0 -1
- package/dist/configurators/antigravity.js +0 -11
- package/dist/configurators/antigravity.js.map +0 -1
- package/dist/configurators/codebuddy.d.ts +0 -10
- package/dist/configurators/codebuddy.d.ts.map +0 -1
- package/dist/configurators/codebuddy.js +0 -24
- package/dist/configurators/codebuddy.js.map +0 -1
- package/dist/configurators/copilot.d.ts +0 -14
- package/dist/configurators/copilot.d.ts.map +0 -1
- package/dist/configurators/copilot.js +0 -46
- package/dist/configurators/copilot.js.map +0 -1
- package/dist/configurators/cursor.d.ts +0 -10
- package/dist/configurators/cursor.d.ts.map +0 -1
- package/dist/configurators/cursor.js +0 -23
- package/dist/configurators/cursor.js.map +0 -1
- package/dist/configurators/devin.d.ts +0 -8
- package/dist/configurators/devin.d.ts.map +0 -1
- package/dist/configurators/devin.js +0 -12
- package/dist/configurators/devin.js.map +0 -1
- package/dist/configurators/droid.d.ts +0 -10
- package/dist/configurators/droid.d.ts.map +0 -1
- package/dist/configurators/droid.js +0 -24
- package/dist/configurators/droid.js.map +0 -1
- package/dist/configurators/dsh.d.ts +0 -26
- package/dist/configurators/dsh.d.ts.map +0 -1
- package/dist/configurators/dsh.js +0 -76
- package/dist/configurators/dsh.js.map +0 -1
- package/dist/configurators/gemini.d.ts +0 -18
- package/dist/configurators/gemini.d.ts.map +0 -1
- package/dist/configurators/gemini.js +0 -39
- package/dist/configurators/gemini.js.map +0 -1
- package/dist/configurators/grok.d.ts +0 -17
- package/dist/configurators/grok.d.ts.map +0 -1
- package/dist/configurators/grok.js +0 -38
- package/dist/configurators/grok.js.map +0 -1
- package/dist/configurators/kilo.d.ts +0 -7
- package/dist/configurators/kilo.d.ts.map +0 -1
- package/dist/configurators/kilo.js +0 -11
- package/dist/configurators/kilo.js.map +0 -1
- package/dist/configurators/kimi.d.ts +0 -26
- package/dist/configurators/kimi.d.ts.map +0 -1
- package/dist/configurators/kimi.js +0 -74
- package/dist/configurators/kimi.js.map +0 -1
- package/dist/configurators/kiro.d.ts +0 -11
- package/dist/configurators/kiro.d.ts.map +0 -1
- package/dist/configurators/kiro.js +0 -30
- package/dist/configurators/kiro.js.map +0 -1
- package/dist/configurators/omp.d.ts +0 -6
- package/dist/configurators/omp.d.ts.map +0 -1
- package/dist/configurators/omp.js +0 -28
- package/dist/configurators/omp.js.map +0 -1
- package/dist/configurators/opencode.d.ts +0 -5
- package/dist/configurators/opencode.d.ts.map +0 -1
- package/dist/configurators/opencode.js +0 -84
- package/dist/configurators/opencode.js.map +0 -1
- package/dist/configurators/pi.d.ts +0 -5
- package/dist/configurators/pi.d.ts.map +0 -1
- package/dist/configurators/pi.js +0 -39
- package/dist/configurators/pi.js.map +0 -1
- package/dist/configurators/qoder.d.ts +0 -12
- package/dist/configurators/qoder.d.ts.map +0 -1
- package/dist/configurators/qoder.js +0 -30
- package/dist/configurators/qoder.js.map +0 -1
- package/dist/configurators/reasonix.d.ts +0 -17
- package/dist/configurators/reasonix.d.ts.map +0 -1
- package/dist/configurators/reasonix.js +0 -37
- package/dist/configurators/reasonix.js.map +0 -1
- package/dist/configurators/snow.d.ts +0 -25
- package/dist/configurators/snow.d.ts.map +0 -1
- package/dist/configurators/snow.js +0 -69
- package/dist/configurators/snow.js.map +0 -1
- package/dist/configurators/trae.d.ts +0 -16
- package/dist/configurators/trae.d.ts.map +0 -1
- package/dist/configurators/trae.js +0 -34
- package/dist/configurators/trae.js.map +0 -1
- package/dist/configurators/zcode.d.ts +0 -23
- package/dist/configurators/zcode.d.ts.map +0 -1
- package/dist/configurators/zcode.js +0 -63
- package/dist/configurators/zcode.js.map +0 -1
- package/dist/templates/codebuddy/agents/trellis-check.md +0 -115
- package/dist/templates/codebuddy/agents/trellis-implement.md +0 -115
- package/dist/templates/codebuddy/agents/trellis-research.md +0 -137
- package/dist/templates/codebuddy/index.d.ts +0 -15
- package/dist/templates/codebuddy/index.d.ts.map +0 -1
- package/dist/templates/codebuddy/index.js +0 -15
- package/dist/templates/codebuddy/index.js.map +0 -1
- package/dist/templates/codebuddy/settings.json +0 -69
- package/dist/templates/copilot/copilot-instructions.md +0 -11
- package/dist/templates/copilot/hooks/session-start.py +0 -564
- package/dist/templates/copilot/hooks.json +0 -19
- package/dist/templates/copilot/index.d.ts +0 -28
- package/dist/templates/copilot/index.d.ts.map +0 -1
- package/dist/templates/copilot/index.js +0 -61
- package/dist/templates/copilot/index.js.map +0 -1
- package/dist/templates/copilot/prompts/before-dev.prompt.md +0 -39
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +0 -173
- package/dist/templates/copilot/prompts/break-loop.prompt.md +0 -129
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +0 -170
- package/dist/templates/copilot/prompts/check.prompt.md +0 -110
- package/dist/templates/copilot/prompts/create-command.prompt.md +0 -116
- package/dist/templates/copilot/prompts/finish-work.prompt.md +0 -99
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +0 -223
- package/dist/templates/copilot/prompts/onboard.prompt.md +0 -362
- package/dist/templates/copilot/prompts/parallel.prompt.md +0 -204
- package/dist/templates/copilot/prompts/record-session.prompt.md +0 -66
- package/dist/templates/copilot/prompts/start.prompt.md +0 -63
- package/dist/templates/copilot/prompts/update-spec.prompt.md +0 -358
- package/dist/templates/cursor/agents/trellis-check.md +0 -114
- package/dist/templates/cursor/agents/trellis-implement.md +0 -114
- package/dist/templates/cursor/agents/trellis-research.md +0 -136
- package/dist/templates/cursor/hooks.json +0 -24
- package/dist/templates/cursor/index.d.ts +0 -13
- package/dist/templates/cursor/index.d.ts.map +0 -1
- package/dist/templates/cursor/index.js +0 -13
- package/dist/templates/cursor/index.js.map +0 -1
- package/dist/templates/droid/droids/trellis-check.md +0 -107
- package/dist/templates/droid/droids/trellis-implement.md +0 -107
- package/dist/templates/droid/droids/trellis-research.md +0 -137
- package/dist/templates/droid/index.d.ts +0 -15
- package/dist/templates/droid/index.d.ts.map +0 -1
- package/dist/templates/droid/index.js +0 -15
- package/dist/templates/droid/index.js.map +0 -1
- package/dist/templates/droid/settings.json +0 -69
- package/dist/templates/dsh/DSH.md +0 -80
- package/dist/templates/dsh/agents/trellis-check.md +0 -99
- package/dist/templates/dsh/agents/trellis-implement.md +0 -106
- package/dist/templates/dsh/agents/trellis-research.md +0 -134
- package/dist/templates/dsh/index.d.ts +0 -22
- package/dist/templates/dsh/index.d.ts.map +0 -1
- package/dist/templates/dsh/index.js +0 -27
- package/dist/templates/dsh/index.js.map +0 -1
- package/dist/templates/gemini/agents/trellis-check.md +0 -107
- package/dist/templates/gemini/agents/trellis-implement.md +0 -107
- package/dist/templates/gemini/agents/trellis-research.md +0 -136
- package/dist/templates/gemini/index.d.ts +0 -13
- package/dist/templates/gemini/index.d.ts.map +0 -1
- package/dist/templates/gemini/index.js +0 -13
- package/dist/templates/gemini/index.js.map +0 -1
- package/dist/templates/gemini/settings.json +0 -40
- package/dist/templates/grok/agents/trellis-check.md +0 -106
- package/dist/templates/grok/agents/trellis-implement.md +0 -121
- package/dist/templates/grok/agents/trellis-research.md +0 -146
- package/dist/templates/grok/index.d.ts +0 -16
- package/dist/templates/grok/index.d.ts.map +0 -1
- package/dist/templates/grok/index.js +0 -19
- package/dist/templates/grok/index.js.map +0 -1
- package/dist/templates/kimi/agents/trellis-check.md +0 -104
- package/dist/templates/kimi/agents/trellis-implement.md +0 -120
- package/dist/templates/kimi/agents/trellis-research.md +0 -144
- package/dist/templates/kimi/index.d.ts +0 -20
- package/dist/templates/kimi/index.d.ts.map +0 -1
- package/dist/templates/kimi/index.js +0 -23
- package/dist/templates/kimi/index.js.map +0 -1
- package/dist/templates/kiro/agents/trellis-check.json +0 -26
- package/dist/templates/kiro/agents/trellis-implement.json +0 -26
- package/dist/templates/kiro/agents/trellis-research.json +0 -30
- package/dist/templates/kiro/agents/trellis.json +0 -34
- package/dist/templates/kiro/hooks/trellis-workflow-state.kiro.hook +0 -14
- package/dist/templates/kiro/index.d.ts +0 -32
- package/dist/templates/kiro/index.d.ts.map +0 -1
- package/dist/templates/kiro/index.js +0 -28
- package/dist/templates/kiro/index.js.map +0 -1
- package/dist/templates/omp/agents/trellis-check.md +0 -41
- package/dist/templates/omp/agents/trellis-implement.md +0 -55
- package/dist/templates/omp/agents/trellis-research.md +0 -30
- package/dist/templates/omp/extensions/trellis/index.ts.txt +0 -592
- package/dist/templates/omp/index.d.ts +0 -4
- package/dist/templates/omp/index.d.ts.map +0 -1
- package/dist/templates/omp/index.js +0 -9
- package/dist/templates/omp/index.js.map +0 -1
- package/dist/templates/opencode/agents/trellis-check.md +0 -122
- package/dist/templates/opencode/agents/trellis-implement.md +0 -123
- package/dist/templates/opencode/agents/trellis-research.md +0 -145
- package/dist/templates/opencode/lib/context-visibility.js +0 -86
- package/dist/templates/opencode/lib/session-utils.js +0 -526
- package/dist/templates/opencode/lib/trellis-context.js +0 -627
- package/dist/templates/opencode/package.json +0 -5
- package/dist/templates/opencode/plugins/inject-spec-context.js +0 -121
- package/dist/templates/opencode/plugins/inject-subagent-context.js +0 -569
- package/dist/templates/opencode/plugins/inject-workflow-state.js +0 -340
- package/dist/templates/opencode/plugins/session-start.js +0 -74
- package/dist/templates/pi/agents/trellis-check.md +0 -37
- package/dist/templates/pi/agents/trellis-implement.md +0 -52
- package/dist/templates/pi/agents/trellis-research.md +0 -25
- package/dist/templates/pi/extensions/trellis/index.ts.txt +0 -2033
- package/dist/templates/pi/index.d.ts +0 -5
- package/dist/templates/pi/index.d.ts.map +0 -1
- package/dist/templates/pi/index.js +0 -12
- package/dist/templates/pi/index.js.map +0 -1
- package/dist/templates/pi/settings.json +0 -9
- package/dist/templates/qoder/agents/trellis-check.md +0 -108
- package/dist/templates/qoder/agents/trellis-implement.md +0 -108
- package/dist/templates/qoder/agents/trellis-research.md +0 -137
- package/dist/templates/qoder/index.d.ts +0 -15
- package/dist/templates/qoder/index.d.ts.map +0 -1
- package/dist/templates/qoder/index.js +0 -15
- package/dist/templates/qoder/index.js.map +0 -1
- package/dist/templates/qoder/settings.json +0 -59
- package/dist/templates/reasonix/agents/trellis-check.md +0 -36
- package/dist/templates/reasonix/agents/trellis-implement.md +0 -51
- package/dist/templates/reasonix/index.d.ts +0 -13
- package/dist/templates/reasonix/index.d.ts.map +0 -1
- package/dist/templates/reasonix/index.js +0 -16
- package/dist/templates/reasonix/index.js.map +0 -1
- package/dist/templates/shared-hooks/inject-shell-session-context.py +0 -292
- package/dist/templates/snow/SNOW.md +0 -86
- package/dist/templates/snow/agents/trellis-check.md +0 -136
- package/dist/templates/snow/agents/trellis-implement.md +0 -158
- package/dist/templates/snow/agents/trellis-research.md +0 -114
- package/dist/templates/snow/hooks/beforeSubAgentStart.json +0 -15
- package/dist/templates/snow/hooks/onSessionStart.json +0 -15
- package/dist/templates/snow/hooks/onUserMessage.json +0 -15
- package/dist/templates/snow/hooks/write-trellis-context.py +0 -644
- package/dist/templates/snow/index.d.ts +0 -26
- package/dist/templates/snow/index.d.ts.map +0 -1
- package/dist/templates/snow/index.js +0 -36
- package/dist/templates/snow/index.js.map +0 -1
- package/dist/templates/trae/agents/trellis-check.md +0 -108
- package/dist/templates/trae/agents/trellis-implement.md +0 -108
- package/dist/templates/trae/agents/trellis-research.md +0 -137
- package/dist/templates/trae/hooks.json +0 -39
- package/dist/templates/trae/index.d.ts +0 -15
- package/dist/templates/trae/index.d.ts.map +0 -1
- package/dist/templates/trae/index.js +0 -15
- package/dist/templates/trae/index.js.map +0 -1
- package/dist/templates/trellis/gitattributes.txt +0 -9
- package/dist/templates/trellis/scripts/common/cli_adapter.py +0 -982
- package/dist/templates/zcode/agents/trellis-check.md +0 -110
- package/dist/templates/zcode/agents/trellis-implement.md +0 -116
- package/dist/templates/zcode/agents/trellis-research.md +0 -133
- package/dist/templates/zcode/config.json +0 -52
- package/dist/templates/zcode/index.d.ts +0 -25
- package/dist/templates/zcode/index.d.ts.map +0 -1
- package/dist/templates/zcode/index.js +0 -29
- package/dist/templates/zcode/index.js.map +0 -1
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""Pre-shell hook: bridge the host's session identity into task.py.
|
|
3
|
-
|
|
4
|
-
No researched platform exports a session id into its shell tool's child
|
|
5
|
-
process, but every hook-capable one puts that id on hook stdin. So the hook
|
|
6
|
-
that fires just before a shell command writes a short-lived runtime ticket
|
|
7
|
-
whenever the pending command calls `task.py start/current/finish`, and the
|
|
8
|
-
task script consumes it when it has no native session environment.
|
|
9
|
-
|
|
10
|
-
Registered on whichever pre-shell event the host provides — Cursor's
|
|
11
|
-
`beforeShellExecution`, Claude-shaped `PreToolUse`, Gemini's `BeforeTool` —
|
|
12
|
-
which is why the only thing here that knows about payload variation is
|
|
13
|
-
`_pending_shell_command`.
|
|
14
|
-
"""
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import hashlib
|
|
18
|
-
import json
|
|
19
|
-
import os
|
|
20
|
-
import shlex
|
|
21
|
-
import sys
|
|
22
|
-
import time
|
|
23
|
-
from pathlib import Path
|
|
24
|
-
from typing import Any
|
|
25
|
-
|
|
26
|
-
# Hook hosts send UTF-8 JSON regardless of the process locale.
|
|
27
|
-
_stdin_reconfigure = getattr(sys.stdin, "reconfigure", None)
|
|
28
|
-
if callable(_stdin_reconfigure):
|
|
29
|
-
try:
|
|
30
|
-
_stdin_reconfigure(encoding="utf-8", errors="replace")
|
|
31
|
-
except (OSError, ValueError):
|
|
32
|
-
pass
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
DIR_WORKFLOW = ".trellis"
|
|
36
|
-
DIR_RUNTIME = ".runtime"
|
|
37
|
-
DIR_SHELL_TICKETS = "shell-tickets"
|
|
38
|
-
SESSION_SUBCOMMANDS = {"start", "current", "finish"}
|
|
39
|
-
TICKET_TTL_SECONDS = 30
|
|
40
|
-
CONTEXT_IDENTITY_KEYS = (
|
|
41
|
-
"session_id",
|
|
42
|
-
"sessionId",
|
|
43
|
-
"sessionID",
|
|
44
|
-
"conversation_id",
|
|
45
|
-
"conversationId",
|
|
46
|
-
"conversationID",
|
|
47
|
-
"transcript_path",
|
|
48
|
-
"transcriptPath",
|
|
49
|
-
"transcript",
|
|
50
|
-
)
|
|
51
|
-
# Tool-call payloads nest the command one level down; same casing spread as
|
|
52
|
-
# CONTEXT_IDENTITY_KEYS above.
|
|
53
|
-
TOOL_INPUT_KEYS = ("tool_input", "toolInput")
|
|
54
|
-
# Answering a shell-execution event with an explicit allow is what keeps
|
|
55
|
-
# Cursor from re-prompting for a command Trellis itself asked for. Tool-call
|
|
56
|
-
# hosts read a different response schema, so they get no answer at all rather
|
|
57
|
-
# than a key they would have to ignore.
|
|
58
|
-
SHELL_EVENT_RESPONSE = {"permission": "allow"}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def _string_value(value: Any) -> str | None:
|
|
62
|
-
if isinstance(value, str):
|
|
63
|
-
stripped = value.strip()
|
|
64
|
-
return stripped or None
|
|
65
|
-
return None
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def _resolve_trellis_root(hook_input: dict[str, Any]) -> Path | None:
|
|
69
|
-
"""Locate the project root, trying the payload cwd and then our own.
|
|
70
|
-
|
|
71
|
-
Hosts disagree about what `cwd` means. CodeBuddy IDE 4.10.4 sends `"/"` for
|
|
72
|
-
every PreToolUse event, so trusting the payload alone finds no `.trellis`
|
|
73
|
-
and the bridge silently does nothing — the hook is invoked, writes no
|
|
74
|
-
ticket, and `task.py start` degrades. Observed with a wildcard probe:
|
|
75
|
-
|
|
76
|
-
{"cwd": "/", "tool_name": "Bash", "tool_input": {"command": "ls …"}}
|
|
77
|
-
|
|
78
|
-
The hook's own cwd is reliable where the payload is not: hosts launch it
|
|
79
|
-
from the project root, which is why a relative `command` in settings.json
|
|
80
|
-
resolves at all. Try the payload first (it is right on hosts that set it,
|
|
81
|
-
and survives a host that runs hooks from elsewhere), then fall back.
|
|
82
|
-
"""
|
|
83
|
-
candidates: list[Path] = []
|
|
84
|
-
payload_cwd = _string_value(hook_input.get("cwd"))
|
|
85
|
-
if payload_cwd:
|
|
86
|
-
candidates.append(Path(payload_cwd))
|
|
87
|
-
try:
|
|
88
|
-
candidates.append(Path(os.getcwd()))
|
|
89
|
-
except OSError:
|
|
90
|
-
pass
|
|
91
|
-
|
|
92
|
-
for candidate in candidates:
|
|
93
|
-
root = _find_trellis_root(candidate)
|
|
94
|
-
if root is not None:
|
|
95
|
-
return root
|
|
96
|
-
return None
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
def _find_trellis_root(start: Path) -> Path | None:
|
|
100
|
-
current = start.resolve()
|
|
101
|
-
while True:
|
|
102
|
-
if (current / DIR_WORKFLOW).is_dir():
|
|
103
|
-
return current
|
|
104
|
-
if current == current.parent:
|
|
105
|
-
return None
|
|
106
|
-
current = current.parent
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def _runtime_ticket_dir(root: Path) -> Path:
|
|
110
|
-
return root / DIR_WORKFLOW / DIR_RUNTIME / DIR_SHELL_TICKETS
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def _pending_shell_command(hook_input: dict[str, Any]) -> tuple[str, dict[str, Any] | None]:
|
|
114
|
-
"""Read the pending shell command out of either hook payload shape.
|
|
115
|
-
|
|
116
|
-
Returns the command plus the response envelope that shape expects:
|
|
117
|
-
|
|
118
|
-
- shell-execution event (Cursor `beforeShellExecution`) — the command sits
|
|
119
|
-
at the top level and the host wants a permission decision back;
|
|
120
|
-
- tool-call event (`PreToolUse`, `BeforeTool`) — the command sits under
|
|
121
|
-
`tool_input`, and the host reads a schema this hook has no opinion on.
|
|
122
|
-
|
|
123
|
-
An ordered fallback, not a platform switch: a third payload shape extends
|
|
124
|
-
the same function. Anything else yields ("", None) so main() no-ops.
|
|
125
|
-
"""
|
|
126
|
-
command = _string_value(hook_input.get("command"))
|
|
127
|
-
if command:
|
|
128
|
-
return command, SHELL_EVENT_RESPONSE
|
|
129
|
-
|
|
130
|
-
for key in TOOL_INPUT_KEYS:
|
|
131
|
-
tool_input = hook_input.get(key)
|
|
132
|
-
if not isinstance(tool_input, dict):
|
|
133
|
-
continue
|
|
134
|
-
command = _string_value(tool_input.get("command"))
|
|
135
|
-
if command:
|
|
136
|
-
return command, None
|
|
137
|
-
|
|
138
|
-
return "", None
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def _host_platform_name() -> str | None:
|
|
142
|
-
"""Name the host from the config directory this hook was installed into.
|
|
143
|
-
|
|
144
|
-
Every platform puts its hooks under its own dotted directory
|
|
145
|
-
(`.cursor/hooks/`, `.factory/hooks/`, …), so the deepest dotted path
|
|
146
|
-
segment identifies the host without a table of platform names here. It
|
|
147
|
-
matters because the context key must agree with the one the platform's
|
|
148
|
-
other hooks compute — a ticket keyed differently would write a session
|
|
149
|
-
file no later hook ever reads.
|
|
150
|
-
"""
|
|
151
|
-
for part in reversed(Path(sys.argv[0]).parts):
|
|
152
|
-
if part.startswith(".") and part not in (".", "..") and len(part) > 1:
|
|
153
|
-
return part[1:]
|
|
154
|
-
return None
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
def _load_active_task_resolver(root: Path):
|
|
158
|
-
scripts_dir = root / DIR_WORKFLOW / "scripts"
|
|
159
|
-
if str(scripts_dir) not in sys.path:
|
|
160
|
-
sys.path.insert(0, str(scripts_dir))
|
|
161
|
-
from common.active_task import resolve_context_key # type: ignore[import-not-found]
|
|
162
|
-
|
|
163
|
-
return resolve_context_key
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
def _extract_task_subcommands(command: str) -> list[dict[str, str]]:
|
|
167
|
-
try:
|
|
168
|
-
tokens = shlex.split(command, posix=os.name != "nt")
|
|
169
|
-
except ValueError:
|
|
170
|
-
return []
|
|
171
|
-
|
|
172
|
-
subcommands: list[dict[str, str]] = []
|
|
173
|
-
for index, token in enumerate(tokens[:-1]):
|
|
174
|
-
if Path(token.strip("\"'")).name != "task.py":
|
|
175
|
-
continue
|
|
176
|
-
name = tokens[index + 1]
|
|
177
|
-
if name not in SESSION_SUBCOMMANDS:
|
|
178
|
-
continue
|
|
179
|
-
item = {"name": name}
|
|
180
|
-
if name == "start" and index + 2 < len(tokens):
|
|
181
|
-
item["task_ref"] = tokens[index + 2]
|
|
182
|
-
subcommands.append(item)
|
|
183
|
-
return subcommands
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
def _cleanup_expired_tickets(ticket_dir: Path, now: float) -> None:
|
|
187
|
-
if not ticket_dir.is_dir():
|
|
188
|
-
return
|
|
189
|
-
for ticket_path in ticket_dir.glob("*.json"):
|
|
190
|
-
try:
|
|
191
|
-
data = json.loads(ticket_path.read_text(encoding="utf-8"))
|
|
192
|
-
except (json.JSONDecodeError, OSError):
|
|
193
|
-
continue
|
|
194
|
-
expires_at = data.get("expires_at_epoch")
|
|
195
|
-
if isinstance(expires_at, (int, float)) and expires_at < now:
|
|
196
|
-
try:
|
|
197
|
-
ticket_path.unlink()
|
|
198
|
-
except OSError:
|
|
199
|
-
pass
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
def _has_context_identity(hook_input: dict[str, Any]) -> bool:
|
|
203
|
-
return any(_string_value(hook_input.get(key)) for key in CONTEXT_IDENTITY_KEYS)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
def _write_ticket(
|
|
207
|
-
root: Path,
|
|
208
|
-
hook_input: dict[str, Any],
|
|
209
|
-
context_key: str,
|
|
210
|
-
command: str,
|
|
211
|
-
platform_name: str | None,
|
|
212
|
-
subcommands: list[dict[str, str]],
|
|
213
|
-
) -> None:
|
|
214
|
-
now = time.time()
|
|
215
|
-
ticket_dir = _runtime_ticket_dir(root)
|
|
216
|
-
ticket_dir.mkdir(parents=True, exist_ok=True)
|
|
217
|
-
_cleanup_expired_tickets(ticket_dir, now)
|
|
218
|
-
|
|
219
|
-
digest = hashlib.sha256(
|
|
220
|
-
f"{context_key}\0{command}\0{now}".encode("utf-8"),
|
|
221
|
-
).hexdigest()[:16]
|
|
222
|
-
ticket_path = ticket_dir / f"{int(now * 1000)}-{digest}.json"
|
|
223
|
-
|
|
224
|
-
payload = {
|
|
225
|
-
# Debugging metadata. The consumer accepts a ticket on freshness, repo
|
|
226
|
-
# and subcommand — never on this field.
|
|
227
|
-
"platform": platform_name,
|
|
228
|
-
"context_key": context_key,
|
|
229
|
-
"conversation_id": _string_value(hook_input.get("conversation_id")),
|
|
230
|
-
"session_id": _string_value(hook_input.get("session_id")),
|
|
231
|
-
"generation_id": _string_value(hook_input.get("generation_id")),
|
|
232
|
-
# The resolved project root, not the payload's cwd. The consumer
|
|
233
|
-
# rejects a ticket whose cwd is outside the repo, and CodeBuddy IDE
|
|
234
|
-
# 4.10.4 reports "/" for every PreToolUse event — a ticket carrying
|
|
235
|
-
# that is written correctly and then discarded on arrival. Recording
|
|
236
|
-
# the root we actually resolved keeps the containment check meaningful
|
|
237
|
-
# without trusting a field the host may not populate.
|
|
238
|
-
"cwd": str(root),
|
|
239
|
-
# Kept separately so a wrong host cwd stays visible when debugging.
|
|
240
|
-
"host_cwd": _string_value(hook_input.get("cwd")),
|
|
241
|
-
"command": command,
|
|
242
|
-
"subcommands": subcommands,
|
|
243
|
-
"created_at_epoch": now,
|
|
244
|
-
"expires_at_epoch": now + TICKET_TTL_SECONDS,
|
|
245
|
-
}
|
|
246
|
-
ticket_path.write_text(
|
|
247
|
-
json.dumps(payload, indent=2, ensure_ascii=False) + "\n",
|
|
248
|
-
encoding="utf-8",
|
|
249
|
-
)
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
def main() -> int:
|
|
253
|
-
if os.environ.get("TRELLIS_HOOKS") == "0" or os.environ.get("TRELLIS_DISABLE_HOOKS") == "1":
|
|
254
|
-
return 0
|
|
255
|
-
|
|
256
|
-
try:
|
|
257
|
-
hook_input = json.loads(sys.stdin.read())
|
|
258
|
-
except (json.JSONDecodeError, ValueError):
|
|
259
|
-
hook_input = {}
|
|
260
|
-
if not isinstance(hook_input, dict):
|
|
261
|
-
hook_input = {}
|
|
262
|
-
|
|
263
|
-
command, response = _pending_shell_command(hook_input)
|
|
264
|
-
subcommands = _extract_task_subcommands(command)
|
|
265
|
-
if not subcommands:
|
|
266
|
-
return 0
|
|
267
|
-
|
|
268
|
-
root = _resolve_trellis_root(hook_input)
|
|
269
|
-
if root is None:
|
|
270
|
-
return 0
|
|
271
|
-
|
|
272
|
-
if not _has_context_identity(hook_input):
|
|
273
|
-
return 0
|
|
274
|
-
|
|
275
|
-
platform_name = _host_platform_name()
|
|
276
|
-
resolve_context_key = _load_active_task_resolver(root)
|
|
277
|
-
context_key = resolve_context_key(hook_input, platform=platform_name)
|
|
278
|
-
if not context_key:
|
|
279
|
-
return 0
|
|
280
|
-
|
|
281
|
-
try:
|
|
282
|
-
_write_ticket(root, hook_input, context_key, command, platform_name, subcommands)
|
|
283
|
-
except OSError:
|
|
284
|
-
return 0
|
|
285
|
-
|
|
286
|
-
if response is not None:
|
|
287
|
-
print(json.dumps(response, ensure_ascii=False))
|
|
288
|
-
return 0
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if __name__ == "__main__":
|
|
292
|
-
sys.exit(main())
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Trellis on Snow CLI
|
|
2
|
-
|
|
3
|
-
Snow is a **class-1** Trellis host: auto context inject + project agent discovery +
|
|
4
|
-
`beforeSubAgentStart` prompt enrichment.
|
|
5
|
-
|
|
6
|
-
| Capability | Status |
|
|
7
|
-
| ------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
8
|
-
| Skills (`.snow/skills/trellis-*/SKILL.md`) | Works |
|
|
9
|
-
| Prompt commands (`.snow/commands/trellis-*.json`) | Works (`/trellis-continue`, `/trellis-finish-work`, …) |
|
|
10
|
-
| Context hooks (`.snow/hooks/`) | Inject model context via stdout JSON + write `.snow/log/trellis-context.txt` |
|
|
11
|
-
| Project agents (`.snow/agents/*.md`) | Auto-discovered by Snow (`#trellis-implement`, …) |
|
|
12
|
-
| `beforeSubAgentStart` | Injects active-task breadcrumb into sub-agent prompts |
|
|
13
|
-
| `trellis-start` | Optional — session hooks replace the old manual ritual |
|
|
14
|
-
|
|
15
|
-
## Quick start
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
trellis init --snow -u your-name
|
|
19
|
-
snow
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
In Snow:
|
|
23
|
-
|
|
24
|
-
1. Open a session in the project root — `onSessionStart` injects Trellis context automatically.
|
|
25
|
-
2. Dispatch implement/check/research (project agents under `.snow/agents/`). Prefer prompt first line:
|
|
26
|
-
|
|
27
|
-
```text
|
|
28
|
-
Active task: .trellis/tasks/<id>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
3. Optional: `/trellis-continue` / `/trellis-finish-work`, or `skill-execute` on `trellis-*` skills.
|
|
32
|
-
4. Debug injects: set `SNOW_DEBUG_HOOKS=1` and inspect `.snow/log/hooks-inject.txt`.
|
|
33
|
-
|
|
34
|
-
## Agents
|
|
35
|
-
|
|
36
|
-
Snow loads project agents from `.snow/agents/**/*.md` (priority over `~/.snow/sub-agents.json`).
|
|
37
|
-
Primary path: project agent discovery — no manual merge required. Do not use legacy sub-agent JSON merge files.
|
|
38
|
-
|
|
39
|
-
Context loading is class-1 hook inject (`beforeSubAgentStart` / session / user). Agents are **not** shipped with class-2 pull-based prelude text. Hooks already inject context; agents still re-read task artifacts for correctness.
|
|
40
|
-
|
|
41
|
-
## Tool names (Snow-native)
|
|
42
|
-
|
|
43
|
-
- `filesystem-read` / `filesystem-create` / `filesystem-replaceedit` / `filesystem-edit`
|
|
44
|
-
- `terminal-execute`
|
|
45
|
-
- `ace-search` / `codebase-search`
|
|
46
|
-
- `todo-manage` / `notebook-manage`
|
|
47
|
-
- `skill-execute`
|
|
48
|
-
- `websearch-search` / `websearch-fetch` (research)
|
|
49
|
-
- `ide-get_diagnostics`
|
|
50
|
-
|
|
51
|
-
## Hook protocol
|
|
52
|
-
|
|
53
|
-
Session / user / sub-agent hooks emit:
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{ "additionalContext": "...", "display": "..." }
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
- exit 0 + JSON → inject (prepend); UI bubble keeps user original text
|
|
60
|
-
- exit 1 on `onUserMessage` → replace (not used by Trellis)
|
|
61
|
-
- non-JSON stdout → ignored
|
|
62
|
-
|
|
63
|
-
Hook modes (same script, different depth):
|
|
64
|
-
|
|
65
|
-
| Hook | argv mode | Payload |
|
|
66
|
-
| --------------------- | ---------- | ---------------------------------------------------------------- |
|
|
67
|
-
| `onSessionStart` | `session` | full (~7.5KB): task.py, artifacts, prd summary, workflow/session |
|
|
68
|
-
| `onUserMessage` | `user` | compact (~2.8KB): task.py + artifact presence only |
|
|
69
|
-
| `beforeSubAgentStart` | `subagent` | full + agent-kind tailoring (implement/check/research) |
|
|
70
|
-
|
|
71
|
-
## Session identity (multi-session)
|
|
72
|
-
|
|
73
|
-
Snow injects these env vars into hook commands, `terminal-execute`, bash mode, and sub-agent children:
|
|
74
|
-
|
|
75
|
-
| Variable | Example | Purpose |
|
|
76
|
-
| -------------------- | ------------------- | ----------------------------------------- |
|
|
77
|
-
| `SNOW_SESSION_ID` | `c2343752-...` | Native Snow session uuid |
|
|
78
|
-
| `TRELLIS_CONTEXT_ID` | `snow-c2343752-...` | Preferred Trellis active-task context key |
|
|
79
|
-
| `SNOW_CWD` | project root | Working directory for hooks/tools |
|
|
80
|
-
| `SNOW_PLATFORM` | `snow` | Platform tag |
|
|
81
|
-
|
|
82
|
-
Notes:
|
|
83
|
-
|
|
84
|
-
- `TRELLIS_CONTEXT_ID` wins when already set (explicit override).
|
|
85
|
-
- Otherwise Trellis resolves `SNOW_SESSION_ID` via `active_task.py` as platform `snow`.
|
|
86
|
-
- Hook stdin may also include dual keys: `sessionId` / `session_id`.
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: trellis-check
|
|
3
|
-
id: trellis-check
|
|
4
|
-
description: |
|
|
5
|
-
Code quality check expert for Trellis. Reviews code changes against specs
|
|
6
|
-
and self-fixes issues. On Snow CLI, auto-loaded from `.snow/agents/`; first
|
|
7
|
-
prompt line should be Active task: <path>.
|
|
8
|
-
tools:
|
|
9
|
-
- filesystem-read
|
|
10
|
-
- filesystem-create
|
|
11
|
-
- filesystem-replaceedit
|
|
12
|
-
- filesystem-edit
|
|
13
|
-
- terminal-execute
|
|
14
|
-
- ace-search
|
|
15
|
-
- codebase-search
|
|
16
|
-
- todo-manage
|
|
17
|
-
- notebook-manage
|
|
18
|
-
- skill-execute
|
|
19
|
-
- ide-get_diagnostics
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
# Check Agent
|
|
23
|
-
|
|
24
|
-
You are the Check Agent in the Trellis workflow on **Snow CLI**.
|
|
25
|
-
|
|
26
|
-
## Snow tool map
|
|
27
|
-
|
|
28
|
-
| Need | Tool |
|
|
29
|
-
| ----------------------------- | -------------------------------------------- |
|
|
30
|
-
| Read files | `filesystem-read` |
|
|
31
|
-
| Fix code | `filesystem-replaceedit` / `filesystem-edit` |
|
|
32
|
-
| `git diff` / lint / typecheck | `terminal-execute` |
|
|
33
|
-
| Search | `ace-search` / `codebase-search` |
|
|
34
|
-
| Diagnostics | `ide-get_diagnostics` |
|
|
35
|
-
|
|
36
|
-
## Recursion Guard
|
|
37
|
-
|
|
38
|
-
You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
|
|
39
|
-
|
|
40
|
-
- Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
|
|
41
|
-
- If workflow.md, skills, or the parent prompt say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
|
|
42
|
-
- Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
|
|
43
|
-
|
|
44
|
-
## Dispatch note (main session)
|
|
45
|
-
|
|
46
|
-
On Snow CLI (class-1), the main session launches this agent with a full-context prompt. Always start the prompt with:
|
|
47
|
-
|
|
48
|
-
```text
|
|
49
|
-
Active task: <path from task.py current>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
- Session/user hooks inject Trellis context into the main session.
|
|
53
|
-
- `beforeSubAgentStart` injects Trellis task context into this sub-agent prompt.
|
|
54
|
-
- Still re-read prd/design/implement as required below (hook inject is a breadcrumb, not a full substitute).
|
|
55
|
-
- Optionally Read `.snow/log/trellis-context.txt`.
|
|
56
|
-
|
|
57
|
-
## Context
|
|
58
|
-
|
|
59
|
-
Before checking, read:
|
|
60
|
-
|
|
61
|
-
- `.trellis/spec/` - Development guidelines
|
|
62
|
-
- Pre-commit checklist for quality standards
|
|
63
|
-
- Task `prd.md` / `design.md` / `implement.md` if present
|
|
64
|
-
- `check.jsonl` when curated (skip `_example` seed rows)
|
|
65
|
-
- `.snow/log/trellis-context.txt` if present
|
|
66
|
-
|
|
67
|
-
## Core Responsibilities
|
|
68
|
-
|
|
69
|
-
1. **Get code changes** - Use `terminal-execute` with `git diff` to get uncommitted code
|
|
70
|
-
2. **Check against specs** - Verify code follows guidelines
|
|
71
|
-
3. **Check the red-evidence trail** - Every completed `implement.md` slice records the red output it started from, and for `meta.kind=bug` the Phase 1.2 repro command has been re-run green against the full scenario. A slice claiming green with no recorded red is a finding, not a pass.
|
|
72
|
-
4. **Self-fix** - Fix issues yourself, not just report them
|
|
73
|
-
5. **Run verification** - typecheck and lint
|
|
74
|
-
|
|
75
|
-
## Important
|
|
76
|
-
|
|
77
|
-
**Fix issues yourself**, don't just report them.
|
|
78
|
-
|
|
79
|
-
You have write and edit tools (`filesystem-replaceedit` / `filesystem-edit`), you can modify code directly.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Workflow
|
|
84
|
-
|
|
85
|
-
### Step 1: Get Changes
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
git diff --name-only
|
|
89
|
-
git diff
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Step 2: Check Against Specs and Task Artifacts
|
|
93
|
-
|
|
94
|
-
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.
|
|
95
|
-
|
|
96
|
-
### Step 3: Self-Fix
|
|
97
|
-
|
|
98
|
-
After finding issues:
|
|
99
|
-
|
|
100
|
-
1. Fix the issue directly
|
|
101
|
-
2. Record what was fixed
|
|
102
|
-
3. Continue checking other issues
|
|
103
|
-
|
|
104
|
-
### Step 4: Run Verification
|
|
105
|
-
|
|
106
|
-
Run project's lint and typecheck commands via `terminal-execute` to verify changes.
|
|
107
|
-
If failed, fix issues and re-run.
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Report Format
|
|
112
|
-
|
|
113
|
-
```markdown
|
|
114
|
-
## Self-Check Complete
|
|
115
|
-
|
|
116
|
-
### Files Checked
|
|
117
|
-
|
|
118
|
-
- src/components/Feature.tsx
|
|
119
|
-
|
|
120
|
-
### Issues Found and Fixed
|
|
121
|
-
|
|
122
|
-
1. `<file>:<line>` - <what was fixed>
|
|
123
|
-
|
|
124
|
-
### Issues Not Fixed
|
|
125
|
-
|
|
126
|
-
(If any)
|
|
127
|
-
|
|
128
|
-
### Verification Results
|
|
129
|
-
|
|
130
|
-
- TypeCheck: Passed
|
|
131
|
-
- Lint: Passed
|
|
132
|
-
|
|
133
|
-
### Summary
|
|
134
|
-
|
|
135
|
-
Checked X files, found Y issues, all fixed.
|
|
136
|
-
```
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: trellis-implement
|
|
3
|
-
id: trellis-implement
|
|
4
|
-
description: |
|
|
5
|
-
Code implementation expert for Trellis. Understands specs and requirements,
|
|
6
|
-
then implements features. No git commit allowed. On Snow CLI, auto-loaded from
|
|
7
|
-
`.snow/agents/`; first prompt line should be Active task: <path>.
|
|
8
|
-
tools:
|
|
9
|
-
- filesystem-read
|
|
10
|
-
- filesystem-create
|
|
11
|
-
- filesystem-replaceedit
|
|
12
|
-
- filesystem-edit
|
|
13
|
-
- terminal-execute
|
|
14
|
-
- ace-search
|
|
15
|
-
- codebase-search
|
|
16
|
-
- todo-manage
|
|
17
|
-
- notebook-manage
|
|
18
|
-
- skill-execute
|
|
19
|
-
- ide-get_diagnostics
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
# Implement Agent
|
|
23
|
-
|
|
24
|
-
You are the Implement Agent in the Trellis workflow on **Snow CLI**.
|
|
25
|
-
|
|
26
|
-
## Snow tool map
|
|
27
|
-
|
|
28
|
-
Use Snow-native tool ids (not Claude `Read`/`Edit`/`Bash` names):
|
|
29
|
-
|
|
30
|
-
| Need | Tool |
|
|
31
|
-
| ------------------------- | --------------------------------------------- |
|
|
32
|
-
| Read files / dirs | `filesystem-read` |
|
|
33
|
-
| Create file | `filesystem-create` |
|
|
34
|
-
| Edit existing file | `filesystem-replaceedit` or `filesystem-edit` |
|
|
35
|
-
| Shell / tests | `terminal-execute` |
|
|
36
|
-
| Symbol / text search | `ace-search` |
|
|
37
|
-
| Semantic codebase search | `codebase-search` |
|
|
38
|
-
| Track multi-step work | `todo-manage` |
|
|
39
|
-
| Persist non-obvious notes | `notebook-manage` |
|
|
40
|
-
| Run a Trellis skill | `skill-execute` |
|
|
41
|
-
| IDE errors | `ide-get_diagnostics` |
|
|
42
|
-
|
|
43
|
-
Prefer batch `filesystem-read` when loading several task artifacts.
|
|
44
|
-
|
|
45
|
-
## Recursion Guard
|
|
46
|
-
|
|
47
|
-
You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
|
|
48
|
-
|
|
49
|
-
- Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
|
|
50
|
-
- If workflow.md, skills, or the parent prompt say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
|
|
51
|
-
- Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
|
|
52
|
-
|
|
53
|
-
## Dispatch note (main session)
|
|
54
|
-
|
|
55
|
-
On Snow CLI (class-1), project agents under `.snow/agents/` are auto-discovered. Prefer starting the prompt with:
|
|
56
|
-
|
|
57
|
-
```text
|
|
58
|
-
Active task: <path from task.py current>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
- Session/user hooks inject Trellis context into the main session.
|
|
62
|
-
- `beforeSubAgentStart` injects Trellis breadcrumb into this sub-agent prompt.
|
|
63
|
-
- Still re-read task artifacts below (hook inject is a breadcrumb, not a substitute for prd/design/implement).
|
|
64
|
-
- Optionally Read `.snow/log/trellis-context.txt` if present.
|
|
65
|
-
- Main session also receives session/user injects (class-1 hook path; no class-2 pull prelude).
|
|
66
|
-
|
|
67
|
-
## Context
|
|
68
|
-
|
|
69
|
-
Before implementing, read:
|
|
70
|
-
|
|
71
|
-
- `.trellis/workflow.md` - Project workflow
|
|
72
|
-
- `.trellis/spec/` - Development guidelines
|
|
73
|
-
- Task `prd.md` - Requirements document
|
|
74
|
-
- Task `design.md` / `implement.md` if present
|
|
75
|
-
- `implement.jsonl` when curated (skip `_example` seed rows)
|
|
76
|
-
- `.snow/log/trellis-context.txt` if present (breadcrumb from inject hooks)
|
|
77
|
-
|
|
78
|
-
## Core Responsibilities
|
|
79
|
-
|
|
80
|
-
1. **Understand specs** - Read relevant spec files in `.trellis/spec/`
|
|
81
|
-
2. **Understand requirements** - Read prd.md and design/implement artifacts
|
|
82
|
-
3. **Implement features** - Write code following specs and design
|
|
83
|
-
4. **Self-check** - Ensure code quality (`terminal-execute` lint/typecheck)
|
|
84
|
-
5. **Report results** - Report completion status
|
|
85
|
-
|
|
86
|
-
## Forbidden Operations
|
|
87
|
-
|
|
88
|
-
**Do NOT execute these git commands:**
|
|
89
|
-
|
|
90
|
-
- `git commit`
|
|
91
|
-
- `git push`
|
|
92
|
-
- `git merge`
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## Workflow
|
|
97
|
-
|
|
98
|
-
### 1. Understand Specs
|
|
99
|
-
|
|
100
|
-
Read relevant specs based on task type:
|
|
101
|
-
|
|
102
|
-
- Spec layers: `.trellis/spec/<package>/<layer>/`
|
|
103
|
-
- Shared guides: `.trellis/spec/guides/`
|
|
104
|
-
|
|
105
|
-
### 2. Understand Requirements
|
|
106
|
-
|
|
107
|
-
Read the task's prd.md and design/implement files:
|
|
108
|
-
|
|
109
|
-
- What are the core requirements
|
|
110
|
-
- Key points of technical design
|
|
111
|
-
- Which files to modify/create
|
|
112
|
-
|
|
113
|
-
### 3. Implement Features — Red Before Green
|
|
114
|
-
|
|
115
|
-
Work the `implement.md` slice checklist one slice at a time. Per slice: write the test at a seam confirmed in `design.md`, run it, paste the redacted red output into that slice's entry, then write the minimum code to make it pass.
|
|
116
|
-
|
|
117
|
-
- Do not invent a seam that is not in `design.md` — a missing seam is a planning defect. Report it instead of improvising one.
|
|
118
|
-
- No horizontal slicing, no testing of internals, no tautological assertions, no refactoring inside a red-green cycle.
|
|
119
|
-
- `meta.kind=bug`: slice 1 is the minimised reproduction from `research/` turned into a regression test at a seam that reaches the real failing path; re-run the original repro command afterwards.
|
|
120
|
-
- `meta.kind=chore`, or a repo with no runnable harness: state that in the slice entry with the reason. Never skip the cycle silently.
|
|
121
|
-
- Load the `trellis-tdd` skill for the full contract.
|
|
122
|
-
- Otherwise: follow specs and task artifacts, follow existing code patterns, only do what's required, no over-engineering.
|
|
123
|
-
|
|
124
|
-
### 4. Verify
|
|
125
|
-
|
|
126
|
-
Run project's lint and typecheck commands via `terminal-execute` to verify changes.
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
## Report Format
|
|
131
|
-
|
|
132
|
-
```markdown
|
|
133
|
-
## Implementation Complete
|
|
134
|
-
|
|
135
|
-
### Files Modified
|
|
136
|
-
|
|
137
|
-
- `src/components/Feature.tsx` - New component
|
|
138
|
-
- `src/hooks/useFeature.ts` - New hook
|
|
139
|
-
|
|
140
|
-
### Implementation Summary
|
|
141
|
-
|
|
142
|
-
1. Created Feature component...
|
|
143
|
-
2. Added useFeature hook...
|
|
144
|
-
|
|
145
|
-
### Verification Results
|
|
146
|
-
|
|
147
|
-
- Lint: Passed
|
|
148
|
-
- TypeCheck: Passed
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
---
|
|
152
|
-
|
|
153
|
-
## Code Standards
|
|
154
|
-
|
|
155
|
-
- Follow existing code patterns
|
|
156
|
-
- Don't add unnecessary abstractions
|
|
157
|
-
- Only do what's required, no over-engineering
|
|
158
|
-
- Keep code readable
|