@mindfoldhq/trellis 0.5.0-beta.9 → 0.5.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -95
- package/dist/cli/index.js +7 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +117 -117
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +289 -33
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/antigravity.d.ts.map +1 -1
- package/dist/configurators/antigravity.js +2 -8
- package/dist/configurators/antigravity.js.map +1 -1
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +4 -10
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/codebuddy.d.ts.map +1 -1
- package/dist/configurators/codebuddy.js +3 -3
- package/dist/configurators/codebuddy.js.map +1 -1
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +5 -13
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts.map +1 -1
- package/dist/configurators/copilot.js +5 -19
- package/dist/configurators/copilot.js.map +1 -1
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +3 -3
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/droid.d.ts.map +1 -1
- package/dist/configurators/droid.js +3 -3
- package/dist/configurators/droid.js.map +1 -1
- package/dist/configurators/gemini.d.ts.map +1 -1
- package/dist/configurators/gemini.js +3 -5
- package/dist/configurators/gemini.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +37 -49
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/kilo.d.ts.map +1 -1
- package/dist/configurators/kilo.js +2 -8
- package/dist/configurators/kilo.js.map +1 -1
- package/dist/configurators/kiro.d.ts.map +1 -1
- package/dist/configurators/kiro.js +3 -3
- package/dist/configurators/kiro.js.map +1 -1
- package/dist/configurators/opencode.d.ts.map +1 -1
- package/dist/configurators/opencode.js +7 -4
- package/dist/configurators/opencode.js.map +1 -1
- package/dist/configurators/pi.d.ts +3 -0
- package/dist/configurators/pi.d.ts.map +1 -0
- package/dist/configurators/pi.js +44 -0
- package/dist/configurators/pi.js.map +1 -0
- package/dist/configurators/qoder.d.ts.map +1 -1
- package/dist/configurators/qoder.js +3 -5
- package/dist/configurators/qoder.js.map +1 -1
- package/dist/configurators/shared.d.ts +28 -6
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +47 -15
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/windsurf.d.ts.map +1 -1
- package/dist/configurators/windsurf.js +2 -8
- package/dist/configurators/windsurf.js.map +1 -1
- package/dist/constants/paths.d.ts +2 -0
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +2 -0
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/manifests/0.5.0-beta.0.json +2 -0
- package/dist/migrations/manifests/0.5.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.15.json +116 -0
- package/dist/migrations/manifests/0.5.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.17.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.18.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.19.json +9 -0
- package/dist/migrations/manifests/0.5.0-beta.5.json +2 -0
- package/dist/migrations/manifests/0.5.0-rc.0.json +9 -0
- package/dist/templates/claude/agents/trellis-research.md +1 -1
- package/dist/templates/claude/settings.json +0 -4
- package/dist/templates/codebuddy/agents/trellis-research.md +1 -1
- package/dist/templates/codex/agents/trellis-research.toml +3 -2
- package/dist/templates/codex/hooks/session-start.py +126 -26
- package/dist/templates/codex/skills/finish-work/SKILL.md +41 -109
- package/dist/templates/codex/skills/start/SKILL.md +12 -9
- package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +73 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/add-project-local-conventions.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +54 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-context-loading.md +81 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +57 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +78 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-spec-structure.md +83 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-task-lifecycle.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-workflow.md +64 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +55 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/context-injection.md +68 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +80 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +51 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/spec-system.md +102 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +101 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workflow.md +75 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/workspace-memory.md +71 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +79 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +69 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +74 -0
- package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +83 -0
- package/dist/templates/common/commands/continue.md +9 -5
- package/dist/templates/common/commands/finish-work.md +34 -10
- package/dist/templates/common/index.d.ts +22 -2
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +53 -4
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/skills/brainstorm.md +3 -0
- package/dist/templates/copilot/hooks/session-start.py +127 -30
- package/dist/templates/copilot/prompts/finish-work.prompt.md +44 -112
- package/dist/templates/copilot/prompts/start.prompt.md +12 -9
- package/dist/templates/cursor/agents/trellis-check.md +1 -1
- package/dist/templates/cursor/agents/trellis-implement.md +1 -1
- package/dist/templates/cursor/agents/trellis-research.md +2 -2
- package/dist/templates/cursor/hooks.json +7 -1
- package/dist/templates/droid/droids/trellis-research.md +1 -1
- package/dist/templates/extract.d.ts +6 -0
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +14 -0
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/gemini/agents/trellis-research.md +1 -1
- package/dist/templates/kiro/agents/trellis-research.json +1 -1
- package/dist/templates/markdown/agents.md +19 -12
- package/dist/templates/markdown/gitignore.txt +3 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +24 -0
- package/dist/templates/opencode/agents/trellis-check.md +1 -1
- package/dist/templates/opencode/agents/trellis-implement.md +7 -4
- package/dist/templates/opencode/agents/trellis-research.md +2 -2
- package/dist/templates/opencode/lib/trellis-context.js +100 -13
- package/dist/templates/opencode/plugins/inject-subagent-context.js +70 -5
- package/dist/templates/opencode/plugins/inject-workflow-state.js +38 -58
- package/dist/templates/opencode/plugins/session-start.js +76 -31
- package/dist/templates/pi/agents/trellis-check.md +28 -0
- package/dist/templates/pi/agents/trellis-implement.md +33 -0
- package/dist/templates/pi/agents/trellis-research.md +25 -0
- package/dist/templates/pi/extensions/trellis/index.ts.txt +997 -0
- package/dist/templates/pi/index.d.ts +5 -0
- package/dist/templates/pi/index.d.ts.map +1 -0
- package/dist/templates/pi/index.js +12 -0
- package/dist/templates/pi/index.js.map +1 -0
- package/dist/templates/pi/settings.json +12 -0
- package/dist/templates/qoder/agents/trellis-research.md +1 -1
- package/dist/templates/shared-hooks/index.d.ts +31 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +59 -0
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/inject-shell-session-context.py +180 -0
- package/dist/templates/shared-hooks/inject-subagent-context.py +156 -27
- package/dist/templates/shared-hooks/inject-workflow-state.py +85 -105
- package/dist/templates/shared-hooks/session-start.py +222 -36
- package/dist/templates/trellis/gitignore.txt +3 -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/common/__init__.py +8 -0
- package/dist/templates/trellis/scripts/common/active_task.py +593 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +72 -14
- package/dist/templates/trellis/scripts/common/paths.py +61 -58
- package/dist/templates/trellis/scripts/common/session_context.py +12 -0
- package/dist/templates/trellis/scripts/common/task_context.py +27 -194
- package/dist/templates/trellis/scripts/common/task_store.py +102 -26
- package/dist/templates/trellis/scripts/common/tasks.py +4 -1
- package/dist/templates/trellis/scripts/common/workflow_phase.py +15 -3
- package/dist/templates/trellis/scripts/task.py +99 -34
- package/dist/templates/trellis/workflow.md +332 -69
- package/dist/types/ai-tools.d.ts +12 -3
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +29 -0
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/file-writer.d.ts.map +1 -1
- package/dist/utils/file-writer.js +7 -2
- package/dist/utils/file-writer.js.map +1 -1
- package/dist/utils/posix.d.ts +13 -0
- package/dist/utils/posix.d.ts.map +1 -0
- package/dist/utils/posix.js +15 -0
- package/dist/utils/posix.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +22 -6
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +405 -27
- package/dist/utils/template-fetcher.js.map +1 -1
- package/dist/utils/template-hash.d.ts +22 -3
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +99 -19
- package/dist/utils/template-hash.js.map +1 -1
- package/package.json +7 -7
- package/dist/templates/shared-hooks/statusline.py +0 -218
|
@@ -44,14 +44,16 @@ Every task has its own directory under `.trellis/tasks/{MM-DD-name}/` holding `p
|
|
|
44
44
|
```bash
|
|
45
45
|
# Task lifecycle
|
|
46
46
|
python3 ./.trellis/scripts/task.py create "<title>" [--slug <name>] [--parent <dir>]
|
|
47
|
-
python3 ./.trellis/scripts/task.py start <name> # set
|
|
48
|
-
python3 ./.trellis/scripts/task.py
|
|
47
|
+
python3 ./.trellis/scripts/task.py start <name> # set active task (session-scoped when available)
|
|
48
|
+
python3 ./.trellis/scripts/task.py current --source # show active task and source
|
|
49
|
+
python3 ./.trellis/scripts/task.py finish # clear active task (triggers after_finish hooks)
|
|
49
50
|
python3 ./.trellis/scripts/task.py archive <name> # move to archive/{year-month}/
|
|
50
51
|
python3 ./.trellis/scripts/task.py list [--mine] [--status <s>]
|
|
51
52
|
python3 ./.trellis/scripts/task.py list-archive
|
|
52
53
|
|
|
53
|
-
# Code-spec context (injected into implement/check agents via JSONL)
|
|
54
|
-
|
|
54
|
+
# Code-spec context (injected into implement/check agents via JSONL).
|
|
55
|
+
# `implement.jsonl` / `check.jsonl` are seeded on `task create` for sub-agent-capable
|
|
56
|
+
# platforms; the AI curates real spec + research entries during Phase 1.3.
|
|
55
57
|
python3 ./.trellis/scripts/task.py add-context <name> <action> <file> <reason>
|
|
56
58
|
python3 ./.trellis/scripts/task.py list-context <name> [action]
|
|
57
59
|
python3 ./.trellis/scripts/task.py validate <name>
|
|
@@ -71,7 +73,7 @@ python3 ./.trellis/scripts/task.py create-pr [name] [--dry-run]
|
|
|
71
73
|
|
|
72
74
|
> Run `python3 ./.trellis/scripts/task.py --help` to see the authoritative, up-to-date list.
|
|
73
75
|
|
|
74
|
-
**Current-task mechanism**: `task.py start` writes the task
|
|
76
|
+
**Current-task mechanism**: `task.py create` creates the task directory and (when session identity is available) auto-sets the per-session active-task pointer so the planning breadcrumb fires immediately. `task.py start` writes the same pointer (idempotent if already set) and flips `task.json.status` from `planning` to `in_progress`. State is stored under `.trellis/.runtime/sessions/`. If no context key is available from hook input, `TRELLIS_CONTEXT_ID`, or a platform-native session environment variable, there is no active task and `task.py start` fails with a session identity hint. `task.py finish` deletes the current session file (status unchanged). `task.py archive <task>` writes `status=completed`, moves the directory to `archive/`, and deletes any runtime session files that still point at the archived task.
|
|
75
77
|
|
|
76
78
|
### Workspace System
|
|
77
79
|
|
|
@@ -87,13 +89,56 @@ python3 ./.trellis/scripts/add_session.py --title "Title" --commit "hash" --summ
|
|
|
87
89
|
### Context Script
|
|
88
90
|
|
|
89
91
|
```bash
|
|
90
|
-
python3 ./.trellis/scripts/get_context.py # full session
|
|
92
|
+
python3 ./.trellis/scripts/get_context.py # full session runtime
|
|
91
93
|
python3 ./.trellis/scripts/get_context.py --mode packages # available packages + spec layers
|
|
92
94
|
python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y> # detailed guide for a workflow step
|
|
93
95
|
```
|
|
94
96
|
|
|
95
97
|
---
|
|
96
98
|
|
|
99
|
+
<!--
|
|
100
|
+
WORKFLOW-STATE BREADCRUMB CONTRACT (read this before editing the tag blocks below)
|
|
101
|
+
|
|
102
|
+
The 4 [workflow-state:STATUS] blocks embedded in the ## Phase Index section
|
|
103
|
+
below are the SINGLE source of truth for the per-turn `<workflow-state>`
|
|
104
|
+
breadcrumb that every supported AI platform's UserPromptSubmit hook
|
|
105
|
+
reads. inject-workflow-state.py (Python platforms) and
|
|
106
|
+
inject-workflow-state.js (OpenCode plugin) only parse them — there is no
|
|
107
|
+
fallback dict baked into the scripts after v0.5.0-rc.0.
|
|
108
|
+
|
|
109
|
+
STATUS charset: [A-Za-z0-9_-]+. When the hook can't find a tag, it
|
|
110
|
+
degrades to a generic "Refer to workflow.md for current step." line —
|
|
111
|
+
intentionally visible so users notice and fix a broken workflow.md.
|
|
112
|
+
|
|
113
|
+
INVARIANT (test/regression.test.ts):
|
|
114
|
+
Every workflow-walkthrough step marked `[required · once]` must have a
|
|
115
|
+
matching enforcement line in its phase's [workflow-state:*] block. The
|
|
116
|
+
breadcrumb is the only per-turn channel; if a mandatory step isn't
|
|
117
|
+
mentioned there, the AI silently skips it (Phase 1.3 jsonl curation
|
|
118
|
+
skip and Phase 3.4 commit skip both manifested via this gap).
|
|
119
|
+
|
|
120
|
+
TAG ↔ PHASE scoping:
|
|
121
|
+
[workflow-state:no_task] → no active task; before Phase 1
|
|
122
|
+
[workflow-state:planning] → all of Phase 1 (status='planning')
|
|
123
|
+
[workflow-state:in_progress] → Phase 2 + Phase 3.1-3.4
|
|
124
|
+
(status stays 'in_progress' from
|
|
125
|
+
task.py start until task.py archive)
|
|
126
|
+
[workflow-state:completed] → currently DEAD: cmd_archive flips
|
|
127
|
+
status and moves the dir in the same
|
|
128
|
+
call, so the resolver loses the
|
|
129
|
+
pointer (block kept for a future
|
|
130
|
+
explicit in_progress→completed
|
|
131
|
+
transition)
|
|
132
|
+
|
|
133
|
+
Editing checklist:
|
|
134
|
+
- When you change a [workflow-state:STATUS] block, also check the
|
|
135
|
+
matching phase's `[required · once]` walkthrough steps for sync
|
|
136
|
+
- Run `trellis update` after editing to push the new bodies to
|
|
137
|
+
downstream user projects (block-level managed replacement)
|
|
138
|
+
- Full runtime contract:
|
|
139
|
+
.trellis/spec/cli/backend/workflow-state-contract.md
|
|
140
|
+
-->
|
|
141
|
+
|
|
97
142
|
## Phase Index
|
|
98
143
|
|
|
99
144
|
```
|
|
@@ -102,51 +147,129 @@ Phase 2: Execute → write code and pass quality checks
|
|
|
102
147
|
Phase 3: Finish → distill lessons + wrap-up
|
|
103
148
|
```
|
|
104
149
|
|
|
150
|
+
<!-- Per-turn breadcrumb: shown when there is no active task (before Phase 1) -->
|
|
151
|
+
|
|
152
|
+
[workflow-state:no_task]
|
|
153
|
+
No active task. **A Direct answer** — pure Q&A / explanation / lookup / chat; no file writes + one-line answer + repo reads ≤ 2 files → AI judges, no override needed.
|
|
154
|
+
**B Create a task** — any implementation / code change / build / refactor work. Entry sequence: (1) `python3 ./.trellis/scripts/task.py create "<title>"` to create the task (status=planning, breadcrumb switches to [workflow-state:planning] for brainstorm + jsonl phase guidance) → (2) load `trellis-brainstorm` skill to discuss requirements with the user and iterate on prd.md → (3) once prd is done and jsonl is curated, run `task.py start <task-dir>` to enter [workflow-state:in_progress] for the implementation skeleton. For research-heavy work, dispatch `trellis-research` sub-agents — main agent must NOT do 3+ inline WebFetch / WebSearch / `gh api` calls. **"It looks small" is NOT grounds for downgrading B to A or C**.
|
|
155
|
+
**C Inline change** (per-turn only, escape hatch for B) — the user's CURRENT message MUST contain one of: "skip trellis" / "no task" / "just do it" / "don't create a task" / "跳过 trellis" / "别走流程" / "小修一下" / "直接改" / "先别建任务" → briefly acknowledge ("ok, skipping trellis flow this turn"), then inline. **Without seeing one of these phrases you must NOT inline on your own**; do not invent an override the user never said.
|
|
156
|
+
[/workflow-state:no_task]
|
|
157
|
+
|
|
105
158
|
### Phase 1: Plan
|
|
106
|
-
- 1.0 Create task `[required · once]`
|
|
159
|
+
- 1.0 Create task `[required · once]` (just `task.py create`; status enters planning)
|
|
107
160
|
- 1.1 Requirement exploration `[required · repeatable]`
|
|
108
161
|
- 1.2 Research `[optional · repeatable]`
|
|
109
|
-
- 1.3 Configure context `[required · once]` — Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid
|
|
110
|
-
- 1.4
|
|
162
|
+
- 1.3 Configure context `[required · once]` — Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi
|
|
163
|
+
- 1.4 Activate task `[required · once]` (run `task.py start`; status → in_progress)
|
|
164
|
+
- 1.5 Completion criteria
|
|
165
|
+
|
|
166
|
+
<!-- Per-turn breadcrumb: shown throughout Phase 1 (status='planning') -->
|
|
167
|
+
|
|
168
|
+
[workflow-state:planning]
|
|
169
|
+
Load the `trellis-brainstorm` skill and iterate on prd.md with the user.
|
|
170
|
+
Phase 1.3 (required, once): before `task.py start`, you MUST curate `implement.jsonl` and `check.jsonl` — list the spec / research files sub-agents need so they get the right context injected. You may skip only if the jsonl already has agent-curated entries (the seed `_example` row alone doesn't count).
|
|
171
|
+
Then run `task.py start <task-dir>` to flip status to in_progress.
|
|
172
|
+
Research output **must** land in `{task_dir}/research/*.md`, written by `trellis-research` sub-agents. The main agent should not inline WebFetch / WebSearch — the PRD only links to research files.
|
|
173
|
+
[/workflow-state:planning]
|
|
111
174
|
|
|
112
175
|
### Phase 2: Execute
|
|
113
176
|
- 2.1 Implement `[required · repeatable]`
|
|
114
177
|
- 2.2 Quality check `[required · repeatable]`
|
|
115
178
|
- 2.3 Rollback `[on demand]`
|
|
116
179
|
|
|
180
|
+
<!-- Per-turn breadcrumb: shown while status='in_progress'.
|
|
181
|
+
Scope: all of Phase 2 + Phase 3.1-3.4 (status stays 'in_progress' from
|
|
182
|
+
task.py start until task.py archive; only archive flips it). The body
|
|
183
|
+
therefore must cover every required step from implementation through
|
|
184
|
+
commit, including Phase 3.3 spec update and Phase 3.4 commit. -->
|
|
185
|
+
|
|
186
|
+
[workflow-state:in_progress]
|
|
187
|
+
**Flow**: trellis-implement → trellis-check → trellis-update-spec → commit (Phase 3.4) → `/trellis:finish-work`.
|
|
188
|
+
**Default (no override)**: dispatch the `trellis-implement` / `trellis-check` sub-agents — the main agent does NOT edit code by default. Phase 3.4 commit (required, once): after trellis-update-spec, or whenever implementation is verifiably complete, the main agent **drives the commit** — state the commit plan in user-facing text, then run `git commit` — BEFORE suggesting `/trellis:finish-work`. `/finish-work` refuses to run on a dirty working tree (paths outside `.trellis/workspace/` and `.trellis/tasks/`).
|
|
189
|
+
**Inline override** (per-turn only, escape hatch for sub-agent dispatch): the user's CURRENT message MUST explicitly contain one of: "do it inline" / "no sub-agent" / "你直接改" / "别派 sub-agent" / "main session 写就行" / "不用 sub-agent". **Without seeing one of these phrases you must NOT inline on your own**; do not invent an override the user never said.
|
|
190
|
+
[/workflow-state:in_progress]
|
|
191
|
+
|
|
117
192
|
### Phase 3: Finish
|
|
118
193
|
- 3.1 Quality verification `[required · repeatable]`
|
|
119
194
|
- 3.2 Debug retrospective `[on demand]`
|
|
120
195
|
- 3.3 Spec update `[required · once]`
|
|
121
|
-
- 3.4
|
|
196
|
+
- 3.4 Commit changes `[required · once]`
|
|
197
|
+
- 3.5 Wrap-up reminder
|
|
198
|
+
|
|
199
|
+
<!-- Per-turn breadcrumb: shown while status='completed'.
|
|
200
|
+
Currently DEAD in normal flow: cmd_archive writes status='completed' in
|
|
201
|
+
the same call that moves the task dir to archive/, so the active-task
|
|
202
|
+
resolver loses the pointer and the hook never fires on archived tasks.
|
|
203
|
+
Block preserved for a future status-transition redesign (e.g. an
|
|
204
|
+
explicit in_progress→completed command). Edit through the same spec
|
|
205
|
+
channel as the live blocks. -->
|
|
206
|
+
|
|
207
|
+
[workflow-state:completed]
|
|
208
|
+
Code committed via Phase 3.4; run `/trellis:finish-work` to wrap up (archive the task + record session).
|
|
209
|
+
If you reach this state with uncommitted code, return to Phase 3.4 first — `/finish-work` refuses to run on a dirty working tree.
|
|
210
|
+
`task.py archive` deletes any runtime session files that still point at the archived task.
|
|
211
|
+
[/workflow-state:completed]
|
|
122
212
|
|
|
123
213
|
### Rules
|
|
124
214
|
|
|
125
215
|
1. Identify which Phase you're in, then continue from the next step there
|
|
126
216
|
2. Run steps in order inside each Phase; `[required]` steps can't be skipped
|
|
127
217
|
3. Phases can roll back (e.g., Execute reveals a prd defect → return to Plan to fix, then re-enter Execute)
|
|
128
|
-
4. Steps tagged `[once]` are skipped if already
|
|
218
|
+
4. Steps tagged `[once]` are skipped if the output already exists; don't re-run
|
|
129
219
|
|
|
130
220
|
### Skill Routing
|
|
131
221
|
|
|
132
|
-
When a user request matches one of these intents, load the corresponding skill first — do not skip skills.
|
|
222
|
+
When a user request matches one of these intents, load the corresponding skill (or dispatch the corresponding sub-agent) first — do not skip skills.
|
|
223
|
+
|
|
224
|
+
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
225
|
+
|
|
226
|
+
| User intent | Route |
|
|
227
|
+
|---|---|
|
|
228
|
+
| Wants a new feature / requirement unclear | `trellis-brainstorm` |
|
|
229
|
+
| About to write code / start implementing | Dispatch the `trellis-implement` sub-agent per Phase 2.1 |
|
|
230
|
+
| Finished writing / want to verify | Dispatch the `trellis-check` sub-agent per Phase 2.2 |
|
|
231
|
+
| Stuck / fixed same bug several times | `trellis-break-loop` |
|
|
232
|
+
| Spec needs update | `trellis-update-spec` |
|
|
233
|
+
|
|
234
|
+
**Why `trellis-before-dev` is NOT in this table:** you are not the one writing code — the `trellis-implement` sub-agent is. Sub-agent platforms get spec context via `implement.jsonl` injection / prelude, not via the main thread loading `trellis-before-dev`.
|
|
235
|
+
|
|
236
|
+
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
237
|
+
|
|
238
|
+
[Kilo, Antigravity, Windsurf]
|
|
133
239
|
|
|
134
240
|
| User intent | Skill |
|
|
135
241
|
|---|---|
|
|
136
|
-
| Wants a new feature / requirement unclear | trellis-brainstorm |
|
|
137
|
-
| About to write code / start implementing | trellis-before-dev |
|
|
138
|
-
| Finished writing / want to verify | trellis-check |
|
|
139
|
-
| Stuck / fixed same bug several times | trellis-break-loop |
|
|
140
|
-
| Spec needs update | trellis-update-spec |
|
|
242
|
+
| Wants a new feature / requirement unclear | `trellis-brainstorm` |
|
|
243
|
+
| About to write code / start implementing | `trellis-before-dev` (then implement directly in the main session) |
|
|
244
|
+
| Finished writing / want to verify | `trellis-check` |
|
|
245
|
+
| Stuck / fixed same bug several times | `trellis-break-loop` |
|
|
246
|
+
| Spec needs update | `trellis-update-spec` |
|
|
247
|
+
|
|
248
|
+
[/Kilo, Antigravity, Windsurf]
|
|
141
249
|
|
|
142
250
|
### DO NOT skip skills
|
|
143
251
|
|
|
252
|
+
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
253
|
+
|
|
144
254
|
| What you're thinking | Why it's wrong |
|
|
145
255
|
|---|---|
|
|
146
|
-
| "This is simple, just code it" |
|
|
256
|
+
| "This is simple, I'll just code it in the main thread" | Dispatching `trellis-implement` is the cheap path; skipping it tempts you to write code in the main thread and lose spec context — sub-agents get `implement.jsonl` injected, you don't |
|
|
147
257
|
| "I already thought it through in plan mode" | Plan-mode output lives in memory — sub-agents can't see it; must be persisted to prd.md |
|
|
258
|
+
| "I already know the spec" | The spec may have been updated since you last read it; the sub-agent gets the fresh copy, you may not |
|
|
259
|
+
| "Code first, check later" | `trellis-check` surfaces issues you won't notice yourself; earlier is cheaper |
|
|
260
|
+
|
|
261
|
+
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
262
|
+
|
|
263
|
+
[Kilo, Antigravity, Windsurf]
|
|
264
|
+
|
|
265
|
+
| What you're thinking | Why it's wrong |
|
|
266
|
+
|---|---|
|
|
267
|
+
| "This is simple, just code it" | Simple tasks often grow complex; `trellis-before-dev` takes under a minute and loads the spec context you'll need |
|
|
268
|
+
| "I already thought it through in plan mode" | Plan-mode output lives in memory — must be persisted to prd.md before code |
|
|
148
269
|
| "I already know the spec" | The spec may have been updated since you last read it; read again |
|
|
149
|
-
| "Code first, check later" | `check` surfaces issues you won't notice yourself; earlier is cheaper |
|
|
270
|
+
| "Code first, check later" | `trellis-check` surfaces issues you won't notice yourself; earlier is cheaper |
|
|
271
|
+
|
|
272
|
+
[/Kilo, Antigravity, Windsurf]
|
|
150
273
|
|
|
151
274
|
### Loading Step Detail
|
|
152
275
|
|
|
@@ -165,14 +288,19 @@ Goal: figure out what to build, produce a clear requirements doc and the context
|
|
|
165
288
|
|
|
166
289
|
#### 1.0 Create task `[required · once]`
|
|
167
290
|
|
|
168
|
-
Create the task directory
|
|
291
|
+
Create the task directory (status enters `planning`, the session active-task pointer auto-targets the new task when session identity is available):
|
|
169
292
|
|
|
170
293
|
```bash
|
|
171
294
|
python3 ./.trellis/scripts/task.py create "<task title>" --slug <name>
|
|
172
|
-
python3 ./.trellis/scripts/task.py start <task-dir>
|
|
173
295
|
```
|
|
174
296
|
|
|
175
|
-
|
|
297
|
+
`--slug` is the human-readable name only. Do **not** include the `MM-DD-` date prefix; `task.py create` adds that prefix automatically.
|
|
298
|
+
|
|
299
|
+
After this command succeeds, the per-turn breadcrumb auto-switches to `[workflow-state:planning]`, telling the AI to enter the brainstorm + jsonl curation phase.
|
|
300
|
+
|
|
301
|
+
⚠️ **Run only `create` here — do not also run `start`**. `start` flips status to `in_progress`, which switches the breadcrumb to the implementation phase before brainstorm + jsonl are done — the AI will silently skip them. Save `start` for step 1.4, after jsonl curation is complete.
|
|
302
|
+
|
|
303
|
+
Skip when `python3 ./.trellis/scripts/task.py current --source` already points to a task.
|
|
176
304
|
|
|
177
305
|
#### 1.1 Requirement exploration `[required · repeatable]`
|
|
178
306
|
|
|
@@ -190,7 +318,7 @@ Return to this step whenever requirements change and revise `prd.md`.
|
|
|
190
318
|
|
|
191
319
|
Research can happen at any time during requirement exploration. It isn't limited to local code — you can use any available tool (MCP servers, skills, web search, etc.) to look up external information, including third-party library docs, industry practices, API references, etc.
|
|
192
320
|
|
|
193
|
-
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid]
|
|
321
|
+
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
194
322
|
|
|
195
323
|
Spawn the research sub-agent:
|
|
196
324
|
|
|
@@ -198,7 +326,7 @@ Spawn the research sub-agent:
|
|
|
198
326
|
- **Task description**: Research <specific question>
|
|
199
327
|
- **Key requirement**: Research output MUST be persisted to `{TASK_DIR}/research/`
|
|
200
328
|
|
|
201
|
-
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid]
|
|
329
|
+
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
202
330
|
|
|
203
331
|
[Kilo, Antigravity, Windsurf]
|
|
204
332
|
|
|
@@ -217,27 +345,48 @@ Brainstorm and research can interleave freely — pause to research a technical
|
|
|
217
345
|
|
|
218
346
|
#### 1.3 Configure context `[required · once]`
|
|
219
347
|
|
|
220
|
-
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid]
|
|
348
|
+
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
349
|
+
|
|
350
|
+
Curate `implement.jsonl` and `check.jsonl` so the Phase 2 sub-agents get the right spec context. These files were seeded on `task create` with a single self-describing `_example` line; your job here is to fill in real entries.
|
|
351
|
+
|
|
352
|
+
**Location**: `{TASK_DIR}/implement.jsonl` and `{TASK_DIR}/check.jsonl` (already exist).
|
|
353
|
+
|
|
354
|
+
**Format**: one JSON object per line — `{"file": "<path>", "reason": "<why>"}`. Paths are repo-root relative.
|
|
221
355
|
|
|
222
|
-
|
|
356
|
+
**What to put in**:
|
|
357
|
+
- **Spec files** — `.trellis/spec/<package>/<layer>/index.md` and any specific guideline files (`error-handling.md`, `conventions.md`, etc.) relevant to this task
|
|
358
|
+
- **Research files** — `{TASK_DIR}/research/*.md` that the sub-agent will need to consult
|
|
359
|
+
|
|
360
|
+
**What NOT to put in**:
|
|
361
|
+
- Code files (`src/**`, `packages/**/*.ts`, etc.) — those are read by the sub-agent during implementation, not pre-registered here
|
|
362
|
+
- Files you're about to modify — same reason
|
|
363
|
+
|
|
364
|
+
**Split between the two files**:
|
|
365
|
+
- `implement.jsonl` → specs + research the implement sub-agent needs to write code correctly
|
|
366
|
+
- `check.jsonl` → specs for the check sub-agent (quality guidelines, check conventions, same research if needed)
|
|
367
|
+
|
|
368
|
+
**How to discover relevant specs**:
|
|
223
369
|
|
|
224
370
|
```bash
|
|
225
|
-
python3 ./.trellis/scripts/
|
|
226
|
-
# type: backend | frontend | fullstack
|
|
371
|
+
python3 ./.trellis/scripts/get_context.py --mode packages
|
|
227
372
|
```
|
|
228
373
|
|
|
229
|
-
|
|
374
|
+
Lists every package + its spec layers with paths. Pick the entries that match this task's domain.
|
|
375
|
+
|
|
376
|
+
**How to append entries**:
|
|
230
377
|
|
|
231
|
-
|
|
378
|
+
Either edit the jsonl file directly in your editor, or use:
|
|
232
379
|
|
|
233
380
|
```bash
|
|
234
381
|
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" implement "<path>" "<reason>"
|
|
235
382
|
python3 ./.trellis/scripts/task.py add-context "$TASK_DIR" check "<path>" "<reason>"
|
|
236
383
|
```
|
|
237
384
|
|
|
238
|
-
|
|
385
|
+
Delete the seed `_example` line once real entries exist (optional — it's skipped automatically by consumers).
|
|
239
386
|
|
|
240
|
-
|
|
387
|
+
Skip when: `implement.jsonl` has agent-curated entries (the seed row alone doesn't count).
|
|
388
|
+
|
|
389
|
+
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
241
390
|
|
|
242
391
|
[Kilo, Antigravity, Windsurf]
|
|
243
392
|
|
|
@@ -245,20 +394,33 @@ Skip this step. Context is loaded directly by the `trellis-before-dev` skill in
|
|
|
245
394
|
|
|
246
395
|
[/Kilo, Antigravity, Windsurf]
|
|
247
396
|
|
|
248
|
-
#### 1.4
|
|
397
|
+
#### 1.4 Activate task `[required · once]`
|
|
398
|
+
|
|
399
|
+
Once prd.md is complete and 1.3 jsonl curation is done, flip the task status to `in_progress`:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
python3 ./.trellis/scripts/task.py start <task-dir>
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
After this command succeeds, the breadcrumb auto-switches to `[workflow-state:in_progress]`, and the rest of Phase 2 / 3 follows.
|
|
406
|
+
|
|
407
|
+
If `task.py start` errors with a session-identity message (no context key from hook input, `TRELLIS_CONTEXT_ID`, or platform-native session env), follow the hint in the error to set up session identity, then retry.
|
|
408
|
+
|
|
409
|
+
#### 1.5 Completion criteria
|
|
249
410
|
|
|
250
411
|
| Condition | Required |
|
|
251
412
|
|------|:---:|
|
|
252
413
|
| `prd.md` exists | ✅ |
|
|
253
414
|
| User confirms requirements | ✅ |
|
|
415
|
+
| `task.py start` has been run (status = in_progress) | ✅ |
|
|
254
416
|
| `research/` has artifacts (complex tasks) | recommended |
|
|
255
417
|
| `info.md` technical design (complex tasks) | optional |
|
|
256
418
|
|
|
257
|
-
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid]
|
|
419
|
+
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
258
420
|
|
|
259
|
-
| `implement.jsonl`
|
|
421
|
+
| `implement.jsonl` has agent-curated entries (not just the seed row) | ✅ |
|
|
260
422
|
|
|
261
|
-
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid]
|
|
423
|
+
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
262
424
|
|
|
263
425
|
---
|
|
264
426
|
|
|
@@ -268,18 +430,44 @@ Goal: turn the prd into code that passes quality checks.
|
|
|
268
430
|
|
|
269
431
|
#### 2.1 Implement `[required · repeatable]`
|
|
270
432
|
|
|
271
|
-
[Claude Code, Cursor, OpenCode,
|
|
433
|
+
[Claude Code, Cursor, OpenCode, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
272
434
|
|
|
273
435
|
Spawn the implement sub-agent:
|
|
274
436
|
|
|
275
437
|
- **Agent type**: `trellis-implement`
|
|
276
438
|
- **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
|
|
277
439
|
|
|
278
|
-
The platform hook auto-handles:
|
|
440
|
+
The platform hook/plugin auto-handles:
|
|
279
441
|
- Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
|
|
280
442
|
- Injects prd.md content
|
|
281
443
|
|
|
282
|
-
[/Claude Code, Cursor, OpenCode,
|
|
444
|
+
[/Claude Code, Cursor, OpenCode, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
445
|
+
|
|
446
|
+
[Codex]
|
|
447
|
+
|
|
448
|
+
Spawn the implement sub-agent:
|
|
449
|
+
|
|
450
|
+
- **Agent type**: `trellis-implement`
|
|
451
|
+
- **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
|
|
452
|
+
|
|
453
|
+
The Codex sub-agent definition auto-handles the context load requirement:
|
|
454
|
+
- Resolves the active task with `task.py current --source`, then reads `prd.md` and `info.md` if present
|
|
455
|
+
- Reads `implement.jsonl` and requires the agent to load each referenced spec file before coding
|
|
456
|
+
|
|
457
|
+
[/Codex]
|
|
458
|
+
|
|
459
|
+
[Kiro]
|
|
460
|
+
|
|
461
|
+
Spawn the implement sub-agent:
|
|
462
|
+
|
|
463
|
+
- **Agent type**: `trellis-implement`
|
|
464
|
+
- **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
|
|
465
|
+
|
|
466
|
+
The platform prelude auto-handles the context load requirement:
|
|
467
|
+
- Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
|
|
468
|
+
- Injects prd.md content
|
|
469
|
+
|
|
470
|
+
[/Kiro]
|
|
283
471
|
|
|
284
472
|
[Kilo, Antigravity, Windsurf]
|
|
285
473
|
|
|
@@ -293,7 +481,7 @@ The platform hook auto-handles:
|
|
|
293
481
|
|
|
294
482
|
#### 2.2 Quality check `[required · repeatable]`
|
|
295
483
|
|
|
296
|
-
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid]
|
|
484
|
+
[Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
297
485
|
|
|
298
486
|
Spawn the check sub-agent:
|
|
299
487
|
|
|
@@ -305,7 +493,7 @@ The check agent's job:
|
|
|
305
493
|
- Auto-fix issues it finds
|
|
306
494
|
- Run lint and typecheck to verify
|
|
307
495
|
|
|
308
|
-
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid]
|
|
496
|
+
[/Claude Code, Cursor, OpenCode, Codex, Kiro, Gemini, Qoder, CodeBuddy, Copilot, Droid, Pi]
|
|
309
497
|
|
|
310
498
|
[Kilo, Antigravity, Windsurf]
|
|
311
499
|
|
|
@@ -357,42 +545,117 @@ Load the `trellis-update-spec` skill and review whether this task produced new k
|
|
|
357
545
|
|
|
358
546
|
Update the docs under `.trellis/spec/` accordingly. Even if the conclusion is "nothing to update", walk through the judgment.
|
|
359
547
|
|
|
360
|
-
#### 3.4
|
|
548
|
+
#### 3.4 Commit changes `[required · once]`
|
|
549
|
+
|
|
550
|
+
The AI drives a batched commit of this task's code changes so `/finish-work` can run cleanly afterwards. Goal: produce work commits FIRST, then bookkeeping (archive + journal) commits land after — never interleaved.
|
|
551
|
+
|
|
552
|
+
**Step-by-step**:
|
|
553
|
+
|
|
554
|
+
1. **Inspect dirty state**:
|
|
555
|
+
```bash
|
|
556
|
+
git status --porcelain
|
|
557
|
+
```
|
|
558
|
+
Snapshot every dirty path. If the working tree is clean, skip to 3.5.
|
|
559
|
+
|
|
560
|
+
2. **Learn commit style** from recent history (so drafted messages blend in):
|
|
561
|
+
```bash
|
|
562
|
+
git log --oneline -5
|
|
563
|
+
```
|
|
564
|
+
Note the prefix convention (`feat:` / `fix:` / `chore:` / `docs:` ...), language (中文/English), and length style.
|
|
565
|
+
|
|
566
|
+
3. **Classify dirty files into two groups**:
|
|
567
|
+
- **AI-edited this session** — files you wrote/edited via Edit/Write/Bash tool calls in this session. You know what changed and why.
|
|
568
|
+
- **Unrecognized** — dirty files you did NOT touch this session (could be the user's manual edits, leftover WIP from a previous session, or unrelated work). Do NOT silently include these.
|
|
569
|
+
|
|
570
|
+
4. **Draft a commit plan**. Group AI-edited files into logical commits (1 commit per coherent change unit, not 1 commit per file). Each entry: `<commit message>` + file list. List unrecognized files separately at the bottom.
|
|
571
|
+
|
|
572
|
+
5. **Present the plan once, ask for one-shot confirmation**. Format:
|
|
573
|
+
```
|
|
574
|
+
Proposed commits (in order):
|
|
575
|
+
1. <message>
|
|
576
|
+
- <file>
|
|
577
|
+
- <file>
|
|
578
|
+
2. <message>
|
|
579
|
+
- <file>
|
|
580
|
+
|
|
581
|
+
Unrecognized dirty files (NOT in any commit — confirm include/exclude):
|
|
582
|
+
- <file>
|
|
583
|
+
- <file>
|
|
584
|
+
|
|
585
|
+
Reply 'ok' / '行' to execute. Reply with edits, or '我自己来' / 'manual' to abort.
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
6. **On confirmation**: run `git add <files>` + `git commit -m "<msg>"` for each batch in order. Do not amend. Do not push.
|
|
589
|
+
|
|
590
|
+
7. **On rejection** (user replies "不行" / "我自己来" / "manual" / any pushback on the plan): stop. Do not attempt a second plan. The user will commit by hand; you skip ahead to 3.5 once they confirm.
|
|
591
|
+
|
|
592
|
+
**Rules**:
|
|
593
|
+
- No `git commit --amend` anywhere — three-stage three-commit flow (work commits → archive commit → journal commit).
|
|
594
|
+
- Never push to remote in this step.
|
|
595
|
+
- If the user wants different message wording but accepts the file grouping, edit the message and re-confirm once — but if they reject the grouping, exit to manual mode.
|
|
596
|
+
- The batched plan is one prompt; do not prompt per commit.
|
|
597
|
+
|
|
598
|
+
#### 3.5 Wrap-up reminder
|
|
361
599
|
|
|
362
600
|
After the above, remind the user they can run `/finish-work` to wrap up (archive the task, record the session).
|
|
363
601
|
|
|
364
602
|
---
|
|
365
603
|
|
|
366
|
-
##
|
|
604
|
+
## Customizing Trellis (for forks)
|
|
367
605
|
|
|
368
|
-
|
|
369
|
-
Edit the text inside each [workflow-state:STATUS]...[/workflow-state:STATUS]
|
|
370
|
-
block to customize per-task-status flow reminders. Users who fork the
|
|
371
|
-
Trellis workflow only need to edit this file, not the hook script.
|
|
606
|
+
This section is for developers who want to modify the Trellis workflow itself. All customization is done by editing this file; the scripts are parsers only.
|
|
372
607
|
|
|
373
|
-
|
|
374
|
-
in_progress / completed. Add custom status blocks as needed (hyphens
|
|
375
|
-
and underscores allowed). Hook falls back to built-in defaults when
|
|
376
|
-
a status has no tag block. -->
|
|
608
|
+
### Changing what a step means
|
|
377
609
|
|
|
378
|
-
[workflow-state:
|
|
379
|
-
No active task.
|
|
380
|
-
Trigger words in the user message that REQUIRE creating a task (non-negotiable, do NOT self-exempt): 重构 / 抽成 / 独立 / 分发 / 拆出来 / 搞一个 / 做成 / 接入 / 集成 / refactor / rewrite / extract / productize / publish / build X / design Y.
|
|
381
|
-
Task is NOT required ONLY if ALL three hold: (a) zero file writes this turn, (b) answer fits in one reply with no multi-round plan, (c) no research beyond reading 1-2 repo files.
|
|
382
|
-
When in doubt: create task. Over-tasking is cheap; under-tasking leaks plans and research into main context.
|
|
383
|
-
Flow: load `trellis-brainstorm` skill → it creates the task via `python3 ./.trellis/scripts/task.py create` and drives requirements Q&A. For research-heavy work (tool comparison, docs, cross-platform survey), spawn `trellis-research` sub-agents via Task tool — NEVER do 3+ inline WebFetch/WebSearch/`gh api` calls in the main conversation.
|
|
384
|
-
[/workflow-state:no_task]
|
|
610
|
+
Edit the corresponding step's walkthrough body in the Phase 1 / 2 / 3 sections above. **Critical constraint**: if you change a step's `[required · once]` marker or add a new `[required · once]` step, you MUST also add a matching enforcement line to that phase's `[workflow-state:STATUS]` tag block — otherwise the per-turn breadcrumb omits the reinforcement, and the AI silently skips the step. The regression tests assert this.
|
|
385
611
|
|
|
386
|
-
|
|
387
|
-
Complete prd.md via trellis-brainstorm skill; then run task.py start.
|
|
388
|
-
Research belongs in `{task_dir}/research/*.md`, written by `trellis-research` sub-agents. Do NOT inline WebFetch/WebSearch in main session — PRD only links to research files.
|
|
389
|
-
[/workflow-state:planning]
|
|
612
|
+
All 4 tag blocks live in the `## Phase Index` section above, immediately after each phase summary:
|
|
390
613
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
[
|
|
614
|
+
| Scope | Corresponding tag |
|
|
615
|
+
|---|---|
|
|
616
|
+
| No active task (before Phase 1) | `[workflow-state:no_task]` (after the Phase Index ASCII art) |
|
|
617
|
+
| All of Phase 1 (task created → ready for implementation) | `[workflow-state:planning]` (after Phase 1 summary) |
|
|
618
|
+
| Phase 2 + Phase 3.1–3.4 (implementation + check + wrap-up) | `[workflow-state:in_progress]` (after Phase 2 summary) |
|
|
619
|
+
| After Phase 3.5 (archived) | `[workflow-state:completed]` (after Phase 3 summary; **currently DEAD**) |
|
|
395
620
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
[
|
|
621
|
+
### Changing the per-turn prompt text
|
|
622
|
+
|
|
623
|
+
Directly edit the body of the corresponding `[workflow-state:STATUS]` block. After editing, run `trellis update` (if you're a template maintainer) or restart your AI session (if you're customizing your own project) — no script changes required.
|
|
624
|
+
|
|
625
|
+
### Adding a custom status
|
|
626
|
+
|
|
627
|
+
Add a new block:
|
|
628
|
+
|
|
629
|
+
```
|
|
630
|
+
[workflow-state:my-status]
|
|
631
|
+
your per-turn prompt text
|
|
632
|
+
[/workflow-state:my-status]
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
Constraints:
|
|
636
|
+
- STATUS charset: `[A-Za-z0-9_-]+` (underscores and hyphens allowed, e.g. `in-review`, `blocked-by-team`)
|
|
637
|
+
- A lifecycle hook must write `task.json.status` to your custom value, otherwise the tag is never read
|
|
638
|
+
- Lifecycle hooks live in `task.json.hooks.after_*` and bind to one of `after_create / after_start / after_finish / after_archive`
|
|
639
|
+
|
|
640
|
+
### Adding a lifecycle hook
|
|
641
|
+
|
|
642
|
+
Add a `hooks` field to your `task.json`:
|
|
643
|
+
|
|
644
|
+
```json
|
|
645
|
+
{
|
|
646
|
+
"hooks": {
|
|
647
|
+
"after_finish": [
|
|
648
|
+
"your-script-or-command-here"
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
Supported events: `after_create / after_start / after_finish / after_archive`. Note that `after_finish` ≠ a status change (it only clears the active-task pointer); use `after_archive` for "task is done" notifications.
|
|
655
|
+
|
|
656
|
+
### Full contract
|
|
657
|
+
|
|
658
|
+
For the workflow state machine's runtime contract, the locations of all status writers, pseudo-statuses (`no_task` / `stale_<source_type>`), the hook reachability matrix, and other deep details, see:
|
|
659
|
+
|
|
660
|
+
- `.trellis/spec/cli/backend/workflow-state-contract.md` — runtime contract + writer table + test invariants
|
|
661
|
+
- `.trellis/scripts/inject-workflow-state.py` — actual parser (reads workflow.md only, no embedded text)
|
package/dist/types/ai-tools.d.ts
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Supported AI coding tools
|
|
8
8
|
*/
|
|
9
|
-
export type AITool = "claude-code" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid";
|
|
9
|
+
export type AITool = "claude-code" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi";
|
|
10
10
|
/**
|
|
11
11
|
* Template directory categories
|
|
12
12
|
*/
|
|
13
|
-
export type TemplateDir = "common" | "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid";
|
|
13
|
+
export type TemplateDir = "common" | "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi";
|
|
14
14
|
/**
|
|
15
15
|
* CLI flag names for platform selection (e.g., --claude, --cursor, --kilo, --kiro, --gemini, --antigravity)
|
|
16
16
|
* Must match keys in InitOptions (src/commands/init.ts)
|
|
17
17
|
*/
|
|
18
|
-
export type CliFlag = "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid";
|
|
18
|
+
export type CliFlag = "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi";
|
|
19
19
|
/**
|
|
20
20
|
* Template context for placeholder resolution.
|
|
21
21
|
* Controls how common templates are rendered per platform.
|
|
@@ -31,6 +31,15 @@ export interface TemplateContext {
|
|
|
31
31
|
agentCapable: boolean;
|
|
32
32
|
/** Platform has hook system (SessionStart, PreToolUse) */
|
|
33
33
|
hasHooks: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* CLI flag value for this platform (e.g. "claude", "codex", "kiro").
|
|
36
|
+
* Substituted into template commands via {{CLI_FLAG}} so rendered skill /
|
|
37
|
+
* command files can pass `--platform <flag>` to scripts that need to know
|
|
38
|
+
* the invoking platform, removing the need to re-detect at runtime.
|
|
39
|
+
* Duplicates the top-level `AIToolConfig.cliFlag` for convenience — the
|
|
40
|
+
* invariant is maintained in `AI_TOOLS` config blocks.
|
|
41
|
+
*/
|
|
42
|
+
cliFlag: CliFlag;
|
|
34
43
|
}
|
|
35
44
|
/**
|
|
36
45
|
* Configuration for an AI tool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-tools.d.ts","sourceRoot":"","sources":["../../src/types/ai-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,aAAa,GACb,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-tools.d.ts","sourceRoot":"","sources":["../../src/types/ai-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,aAAa,GACb,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,IAAI,CAAC;AAET;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,IAAI,CAAC;AAET;;;GAGG;AACH,MAAM,MAAM,OAAO,GACf,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,IAAI,CAAC;AAET;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,YAAY,EAAE,WAAW,GAAG,WAAW,GAAG,GAAG,GAAG,GAAG,CAAC;IACpD,8DAA8D;IAC9D,UAAU,EACN,4BAA4B,GAC5B,4BAA4B,GAC5B,4BAA4B,CAAC;IACjC,uCAAuC;IACvC,eAAe,EAAE,gBAAgB,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;IACvE,kEAAkE;IAClE,YAAY,EAAE,OAAO,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,kFAAkF;IAClF,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,yEAAyE;IACzE,cAAc,EAAE,OAAO,CAAC;IACxB,+EAA+E;IAC/E,cAAc,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,eAAe,EAAE,eAAe,CAAC;CAClC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CA2OjD,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAExD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAUtD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAE3D"}
|