@mindfoldhq/trellis 0.3.10 → 0.4.0-beta.10
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 +19 -5
- package/dist/cli/index.js +5 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +240 -43
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +206 -47
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/codebuddy.d.ts +11 -0
- package/dist/configurators/codebuddy.d.ts.map +1 -0
- package/dist/configurators/codebuddy.js +58 -0
- package/dist/configurators/codebuddy.js.map +1 -0
- package/dist/configurators/codex.d.ts +7 -4
- package/dist/configurators/codex.d.ts.map +1 -1
- package/dist/configurators/codex.js +40 -10
- package/dist/configurators/codex.js.map +1 -1
- package/dist/configurators/copilot.d.ts +9 -0
- package/dist/configurators/copilot.d.ts.map +1 -0
- package/dist/configurators/copilot.js +34 -0
- package/dist/configurators/copilot.js.map +1 -0
- package/dist/configurators/index.d.ts +11 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +72 -4
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/opencode.d.ts +1 -1
- package/dist/configurators/opencode.js +1 -1
- package/dist/configurators/windsurf.d.ts +8 -0
- package/dist/configurators/windsurf.d.ts.map +1 -0
- package/dist/configurators/windsurf.js +18 -0
- package/dist/configurators/windsurf.js.map +1 -0
- package/dist/configurators/workflow.d.ts +6 -2
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +90 -58
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +2 -0
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/manifests/0.4.0-beta.1.json +228 -0
- package/dist/migrations/manifests/0.4.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.2.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.3.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.4.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.5.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.6.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.7.json +9 -0
- package/dist/migrations/manifests/0.4.0-beta.8.json +34 -0
- package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
- package/dist/templates/claude/agents/dispatch.md +1 -2
- package/dist/templates/claude/agents/implement.md +2 -3
- package/dist/templates/claude/commands/trellis/before-dev.md +29 -0
- package/dist/templates/claude/commands/trellis/check.md +25 -0
- package/dist/templates/claude/commands/trellis/create-command.md +2 -2
- package/dist/templates/claude/commands/trellis/onboard.md +13 -13
- package/dist/templates/claude/commands/trellis/parallel.md +1 -2
- package/dist/templates/claude/commands/trellis/record-session.md +3 -2
- package/dist/templates/claude/commands/trellis/start.md +8 -4
- package/dist/templates/claude/hooks/inject-subagent-context.py +29 -14
- package/dist/templates/claude/hooks/ralph-loop.py +18 -10
- package/dist/templates/claude/hooks/session-start.py +201 -9
- package/dist/templates/claude/hooks/statusline.py +211 -0
- package/dist/templates/claude/settings.json +4 -0
- package/dist/templates/codebuddy/commands/trellis/before-dev.md +29 -0
- package/dist/templates/codebuddy/commands/trellis/brainstorm.md +487 -0
- package/dist/templates/codebuddy/commands/trellis/break-loop.md +107 -0
- package/dist/templates/codebuddy/commands/trellis/check-cross-layer.md +153 -0
- package/dist/templates/codebuddy/commands/trellis/check.md +25 -0
- package/dist/templates/codebuddy/commands/trellis/create-command.md +154 -0
- package/dist/templates/codebuddy/commands/trellis/finish-work.md +143 -0
- package/dist/templates/codebuddy/commands/trellis/integrate-skill.md +219 -0
- package/dist/templates/codebuddy/commands/trellis/onboard.md +358 -0
- package/dist/templates/codebuddy/commands/trellis/record-session.md +61 -0
- package/dist/templates/codebuddy/commands/trellis/start.md +373 -0
- package/dist/templates/codebuddy/commands/trellis/update-spec.md +354 -0
- package/dist/templates/codebuddy/index.d.ts +25 -0
- package/dist/templates/codebuddy/index.d.ts.map +1 -0
- package/dist/templates/codebuddy/index.js +45 -0
- package/dist/templates/codebuddy/index.js.map +1 -0
- package/dist/templates/codex/agents/check.toml +23 -0
- package/dist/templates/codex/agents/implement.toml +19 -0
- package/dist/templates/codex/agents/research.toml +26 -0
- package/dist/templates/codex/codex-skills/parallel/SKILL.md +194 -0
- package/dist/templates/codex/config.toml +5 -0
- package/dist/templates/codex/hooks/session-start.py +228 -0
- package/dist/templates/codex/hooks.json +16 -0
- package/dist/templates/codex/index.d.ts +27 -5
- package/dist/templates/codex/index.d.ts.map +1 -1
- package/dist/templates/codex/index.js +60 -8
- package/dist/templates/codex/index.js.map +1 -1
- package/dist/templates/codex/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/codex/skills/brainstorm/SKILL.md +1 -1
- package/dist/templates/codex/skills/break-loop/SKILL.md +1 -1
- package/dist/templates/codex/skills/check/SKILL.md +30 -0
- package/dist/templates/codex/skills/check-cross-layer/SKILL.md +1 -1
- package/dist/templates/codex/skills/create-command/SKILL.md +3 -3
- package/dist/templates/codex/skills/finish-work/SKILL.md +1 -1
- package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
- package/dist/templates/codex/skills/integrate-skill/SKILL.md +1 -1
- package/dist/templates/codex/skills/onboard/SKILL.md +12 -12
- package/dist/templates/codex/skills/record-session/SKILL.md +4 -3
- package/dist/templates/codex/skills/start/SKILL.md +9 -4
- package/dist/templates/codex/skills/update-spec/SKILL.md +1 -1
- package/dist/templates/copilot/hooks/session-start.py +218 -0
- package/dist/templates/copilot/hooks.json +11 -0
- package/dist/templates/copilot/index.d.ts +23 -0
- package/dist/templates/copilot/index.d.ts.map +1 -0
- package/dist/templates/copilot/index.js +54 -0
- package/dist/templates/copilot/index.js.map +1 -0
- package/dist/templates/copilot/prompts/before-dev.prompt.md +33 -0
- package/dist/templates/copilot/prompts/brainstorm.prompt.md +491 -0
- package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
- package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
- package/dist/templates/copilot/prompts/check.prompt.md +29 -0
- package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
- package/dist/templates/copilot/prompts/finish-work.prompt.md +157 -0
- package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
- package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
- package/dist/templates/copilot/prompts/parallel.prompt.md +196 -0
- package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
- package/dist/templates/copilot/prompts/start.prompt.md +397 -0
- package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
- package/dist/templates/cursor/commands/trellis-before-dev.md +29 -0
- package/dist/templates/cursor/commands/trellis-check.md +25 -0
- package/dist/templates/cursor/commands/trellis-create-command.md +2 -2
- package/dist/templates/cursor/commands/trellis-onboard.md +13 -13
- package/dist/templates/cursor/commands/trellis-record-session.md +3 -2
- package/dist/templates/cursor/commands/trellis-start.md +7 -16
- package/dist/templates/extract.d.ts +36 -0
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +64 -0
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/gemini/commands/trellis/before-dev.toml +33 -0
- package/dist/templates/gemini/commands/trellis/check.toml +29 -0
- package/dist/templates/gemini/commands/trellis/create-command.toml +2 -2
- package/dist/templates/gemini/commands/trellis/onboard.toml +2 -2
- package/dist/templates/gemini/commands/trellis/record-session.toml +3 -2
- package/dist/templates/gemini/commands/trellis/start.toml +9 -4
- package/dist/templates/iflow/agents/dispatch.md +1 -2
- package/dist/templates/iflow/agents/implement.md +2 -3
- package/dist/templates/iflow/commands/trellis/before-dev.md +29 -0
- package/dist/templates/iflow/commands/trellis/check.md +25 -0
- package/dist/templates/iflow/commands/trellis/create-command.md +2 -2
- package/dist/templates/iflow/commands/trellis/onboard.md +13 -13
- package/dist/templates/iflow/commands/trellis/parallel.md +1 -2
- package/dist/templates/iflow/commands/trellis/record-session.md +3 -2
- package/dist/templates/iflow/commands/trellis/start.md +8 -4
- package/dist/templates/iflow/hooks/inject-subagent-context.py +29 -14
- package/dist/templates/iflow/hooks/ralph-loop.py +8 -1
- package/dist/templates/iflow/hooks/session-start.py +187 -8
- package/dist/templates/kilo/workflows/before-dev.md +29 -0
- package/dist/templates/kilo/workflows/check.md +25 -0
- package/dist/templates/kilo/workflows/create-command.md +2 -2
- package/dist/templates/kilo/workflows/onboard.md +13 -13
- package/dist/templates/kilo/workflows/parallel.md +1 -2
- package/dist/templates/kilo/workflows/record-session.md +3 -2
- package/dist/templates/kilo/workflows/start.md +8 -3
- package/dist/templates/kiro/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/kiro/skills/brainstorm/SKILL.md +1 -1
- package/dist/templates/kiro/skills/break-loop/SKILL.md +1 -1
- package/dist/templates/kiro/skills/check/SKILL.md +30 -0
- package/dist/templates/kiro/skills/check-cross-layer/SKILL.md +1 -1
- package/dist/templates/kiro/skills/create-command/SKILL.md +3 -3
- package/dist/templates/kiro/skills/finish-work/SKILL.md +1 -1
- package/dist/templates/kiro/skills/integrate-skill/SKILL.md +1 -1
- package/dist/templates/kiro/skills/onboard/SKILL.md +12 -12
- package/dist/templates/kiro/skills/record-session/SKILL.md +4 -3
- package/dist/templates/kiro/skills/start/SKILL.md +9 -4
- package/dist/templates/kiro/skills/update-spec/SKILL.md +1 -1
- package/dist/templates/markdown/agents.md +4 -0
- package/dist/templates/markdown/spec/backend/directory-structure.md +1 -1
- package/dist/templates/markdown/spec/backend/script-conventions.md +93 -0
- package/dist/templates/markdown/workspace-index.md +2 -0
- package/dist/templates/opencode/agents/dispatch.md +21 -21
- package/dist/templates/opencode/agents/implement.md +2 -2
- package/dist/templates/opencode/agents/research.md +1 -2
- package/dist/templates/opencode/commands/trellis/before-dev.md +29 -0
- package/dist/templates/opencode/commands/trellis/check.md +25 -0
- package/dist/templates/opencode/commands/trellis/create-command.md +2 -2
- package/dist/templates/opencode/commands/trellis/onboard.md +13 -13
- package/dist/templates/opencode/commands/trellis/parallel.md +1 -2
- package/dist/templates/opencode/commands/trellis/record-session.md +3 -2
- package/dist/templates/opencode/commands/trellis/start.md +8 -3
- package/dist/templates/opencode/lib/trellis-context.js +42 -2
- package/dist/templates/opencode/{plugin → plugins}/inject-subagent-context.js +45 -18
- package/dist/templates/opencode/{plugin → plugins}/session-start.js +156 -28
- package/dist/templates/qoder/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/qoder/skills/brainstorm/SKILL.md +1 -1
- package/dist/templates/qoder/skills/break-loop/SKILL.md +1 -1
- package/dist/templates/qoder/skills/check/SKILL.md +30 -0
- package/dist/templates/qoder/skills/check-cross-layer/SKILL.md +1 -1
- package/dist/templates/qoder/skills/create-command/SKILL.md +3 -3
- package/dist/templates/qoder/skills/finish-work/SKILL.md +1 -1
- package/dist/templates/qoder/skills/integrate-skill/SKILL.md +1 -1
- package/dist/templates/qoder/skills/onboard/SKILL.md +14 -14
- package/dist/templates/qoder/skills/record-session/SKILL.md +4 -3
- package/dist/templates/qoder/skills/start/SKILL.md +9 -4
- package/dist/templates/qoder/skills/update-spec/SKILL.md +1 -1
- package/dist/templates/trellis/config.yaml +20 -0
- package/dist/templates/trellis/index.d.ts +11 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +22 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +111 -13
- package/dist/templates/trellis/scripts/common/__init__.py +2 -0
- package/dist/templates/trellis/scripts/common/cli_adapter.py +164 -64
- package/dist/templates/trellis/scripts/common/config.py +192 -0
- package/dist/templates/trellis/scripts/common/developer.py +2 -2
- package/dist/templates/trellis/scripts/common/git.py +31 -0
- package/dist/templates/trellis/scripts/common/git_context.py +23 -586
- package/dist/templates/trellis/scripts/common/io.py +37 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +238 -0
- package/dist/templates/trellis/scripts/common/paths.py +103 -6
- package/dist/templates/trellis/scripts/common/phase.py +50 -49
- package/dist/templates/trellis/scripts/common/registry.py +41 -72
- package/dist/templates/trellis/scripts/common/session_context.py +562 -0
- package/dist/templates/trellis/scripts/common/task_context.py +410 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +27 -98
- package/dist/templates/trellis/scripts/common/task_store.py +536 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +106 -10
- package/dist/templates/trellis/scripts/common/tasks.py +109 -0
- package/dist/templates/trellis/scripts/common/types.py +112 -0
- package/dist/templates/trellis/scripts/create_bootstrap.py +32 -27
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +17 -0
- package/dist/templates/trellis/scripts/multi_agent/cleanup.py +43 -48
- package/dist/templates/trellis/scripts/multi_agent/create_pr.py +336 -45
- package/dist/templates/trellis/scripts/multi_agent/plan.py +9 -32
- package/dist/templates/trellis/scripts/multi_agent/start.py +142 -68
- package/dist/templates/trellis/scripts/multi_agent/status.py +12 -753
- package/dist/templates/trellis/scripts/multi_agent/status_display.py +542 -0
- package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +225 -0
- package/dist/templates/trellis/scripts/task.py +51 -976
- package/dist/templates/trellis/scripts-shell-archive/create-bootstrap.sh +1 -1
- package/dist/templates/trellis/workflow.md +38 -38
- package/dist/templates/windsurf/index.d.ts +21 -0
- package/dist/templates/windsurf/index.d.ts.map +1 -0
- package/dist/templates/windsurf/index.js +44 -0
- package/dist/templates/windsurf/index.js.map +1 -0
- package/dist/templates/windsurf/workflows/trellis-before-dev.md +31 -0
- package/dist/templates/windsurf/workflows/trellis-brainstorm.md +491 -0
- package/dist/templates/windsurf/workflows/trellis-break-loop.md +111 -0
- package/dist/templates/windsurf/workflows/trellis-check-cross-layer.md +157 -0
- package/dist/templates/windsurf/workflows/trellis-check.md +27 -0
- package/dist/templates/windsurf/workflows/trellis-create-command.md +154 -0
- package/dist/templates/windsurf/workflows/trellis-finish-work.md +147 -0
- package/dist/templates/windsurf/workflows/trellis-integrate-skill.md +220 -0
- package/dist/templates/windsurf/workflows/trellis-onboard.md +362 -0
- package/dist/templates/windsurf/workflows/trellis-record-session.md +66 -0
- package/dist/templates/windsurf/workflows/trellis-start.md +373 -0
- package/dist/templates/windsurf/workflows/trellis-update-spec.md +358 -0
- package/dist/types/ai-tools.d.ts +15 -3
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +42 -2
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/types/migration.d.ts +3 -1
- package/dist/types/migration.d.ts.map +1 -1
- package/dist/utils/project-detector.d.ts +28 -0
- package/dist/utils/project-detector.d.ts.map +1 -1
- package/dist/utils/project-detector.js +371 -0
- package/dist/utils/project-detector.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts +19 -6
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +99 -17
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/claude/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/claude/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/claude/commands/trellis/check-backend.md +0 -13
- package/dist/templates/claude/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/codex/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/codex/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/codex/skills/check-frontend/SKILL.md +0 -18
- package/dist/templates/cursor/commands/trellis-before-backend-dev.md +0 -13
- package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +0 -13
- package/dist/templates/cursor/commands/trellis-check-backend.md +0 -13
- package/dist/templates/cursor/commands/trellis-check-frontend.md +0 -13
- package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +0 -17
- package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +0 -17
- package/dist/templates/gemini/commands/trellis/check-backend.toml +0 -17
- package/dist/templates/gemini/commands/trellis/check-frontend.toml +0 -17
- package/dist/templates/iflow/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/iflow/commands/trellis/check-backend.md +0 -13
- package/dist/templates/iflow/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/kilo/workflows/before-backend-dev.md +0 -13
- package/dist/templates/kilo/workflows/before-frontend-dev.md +0 -13
- package/dist/templates/kilo/workflows/check-backend.md +0 -13
- package/dist/templates/kilo/workflows/check-frontend.md +0 -13
- package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/kiro/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/kiro/skills/check-frontend/SKILL.md +0 -18
- package/dist/templates/opencode/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/opencode/commands/trellis/check-backend.md +0 -13
- package/dist/templates/opencode/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/qoder/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/qoder/skills/check-frontend/SKILL.md +0 -18
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { existsSync, readFileSync, appendFileSync, readdirSync } from "fs"
|
|
14
|
-
import { join } from "path"
|
|
14
|
+
import { isAbsolute, join } from "path"
|
|
15
15
|
import { homedir, platform } from "os"
|
|
16
16
|
import { execSync } from "child_process"
|
|
17
17
|
|
|
@@ -191,12 +191,52 @@ export class TrellisContext {
|
|
|
191
191
|
if (!existsSync(currentTaskPath)) {
|
|
192
192
|
return null
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
const taskRef = readFileSync(currentTaskPath, "utf-8").trim()
|
|
195
|
+
const normalized = this.normalizeTaskRef(taskRef)
|
|
196
|
+
return normalized || null
|
|
195
197
|
} catch {
|
|
196
198
|
return null
|
|
197
199
|
}
|
|
198
200
|
}
|
|
199
201
|
|
|
202
|
+
normalizeTaskRef(taskRef) {
|
|
203
|
+
if (!taskRef) {
|
|
204
|
+
return ""
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (isAbsolute(taskRef)) {
|
|
208
|
+
return taskRef.trim()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let normalized = taskRef.trim().replace(/\\/g, "/")
|
|
212
|
+
while (normalized.startsWith("./")) {
|
|
213
|
+
normalized = normalized.slice(2)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (normalized.startsWith("tasks/")) {
|
|
217
|
+
return `.trellis/${normalized}`
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return normalized
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
resolveTaskDir(taskRef) {
|
|
224
|
+
const normalized = this.normalizeTaskRef(taskRef)
|
|
225
|
+
if (!normalized) {
|
|
226
|
+
return null
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (isAbsolute(normalized)) {
|
|
230
|
+
return normalized
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (normalized.startsWith(".trellis/")) {
|
|
234
|
+
return join(this.directory, normalized)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return join(this.directory, ".trellis", "tasks", normalized)
|
|
238
|
+
}
|
|
239
|
+
|
|
200
240
|
// ============================================================
|
|
201
241
|
// Hook Decision Logic
|
|
202
242
|
// ============================================================
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Otherwise, this plugin handles injection
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { existsSync, writeFileSync } from "fs"
|
|
12
|
+
import { existsSync, writeFileSync, readdirSync } from "fs"
|
|
13
13
|
import { join } from "path"
|
|
14
14
|
import { TrellisContext, debugLog } from "../lib/trellis-context.js"
|
|
15
15
|
|
|
@@ -119,8 +119,7 @@ function getCheckContext(ctx, taskDir) {
|
|
|
119
119
|
const checkFiles = [
|
|
120
120
|
[".opencode/commands/trellis/finish-work.md", "Finish work checklist"],
|
|
121
121
|
[".opencode/commands/trellis/check-cross-layer.md", "Cross-layer check spec"],
|
|
122
|
-
[".opencode/commands/trellis/check
|
|
123
|
-
[".opencode/commands/trellis/check-frontend.md", "Frontend check spec"],
|
|
122
|
+
[".opencode/commands/trellis/check.md", "Check spec"],
|
|
124
123
|
]
|
|
125
124
|
for (const [f, description] of checkFiles) {
|
|
126
125
|
const content = ctx.readProjectFile(f)
|
|
@@ -202,8 +201,7 @@ function getDebugContext(ctx, taskDir) {
|
|
|
202
201
|
}
|
|
203
202
|
|
|
204
203
|
const checkFiles = [
|
|
205
|
-
[".opencode/commands/trellis/check
|
|
206
|
-
[".opencode/commands/trellis/check-frontend.md", "Frontend check spec"],
|
|
204
|
+
[".opencode/commands/trellis/check.md", "Check spec"],
|
|
207
205
|
[".opencode/commands/trellis/check-cross-layer.md", "Cross-layer check spec"],
|
|
208
206
|
]
|
|
209
207
|
for (const [f, description] of checkFiles) {
|
|
@@ -229,17 +227,46 @@ function getDebugContext(ctx, taskDir) {
|
|
|
229
227
|
function getResearchContext(ctx, taskDir) {
|
|
230
228
|
const parts = []
|
|
231
229
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
230
|
+
// Dynamic project structure (scan actual spec directory)
|
|
231
|
+
const specPath = ".trellis/spec"
|
|
232
|
+
const specFull = join(ctx.directory, specPath)
|
|
233
|
+
|
|
234
|
+
const structureLines = [`## Project Spec Directory Structure\n\n\`\`\`\n${specPath}/`]
|
|
235
|
+
if (existsSync(specFull)) {
|
|
236
|
+
try {
|
|
237
|
+
const entries = readdirSync(specFull, { withFileTypes: true })
|
|
238
|
+
.filter(d => d.isDirectory() && !d.name.startsWith("."))
|
|
239
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
240
|
+
|
|
241
|
+
for (const entry of entries) {
|
|
242
|
+
const entryPath = join(specFull, entry.name)
|
|
243
|
+
// Check if this is a direct spec layer (has index.md)
|
|
244
|
+
if (existsSync(join(entryPath, "index.md"))) {
|
|
245
|
+
structureLines.push(`├── ${entry.name}/`)
|
|
246
|
+
} else {
|
|
247
|
+
// Check for nested package dirs (monorepo)
|
|
248
|
+
try {
|
|
249
|
+
const nested = readdirSync(entryPath, { withFileTypes: true })
|
|
250
|
+
.filter(d => d.isDirectory() && existsSync(join(entryPath, d.name, "index.md")))
|
|
251
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
252
|
+
if (nested.length > 0) {
|
|
253
|
+
structureLines.push(`├── ${entry.name}/`)
|
|
254
|
+
for (const n of nested) {
|
|
255
|
+
structureLines.push(`│ ├── ${n.name}/`)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
} catch {
|
|
259
|
+
// Ignore nested read errors
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
} catch {
|
|
264
|
+
// Ignore read errors
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
structureLines.push("```")
|
|
240
268
|
|
|
241
|
-
.
|
|
242
|
-
\`\`\`
|
|
269
|
+
parts.push(structureLines.join("\n") + `
|
|
243
270
|
|
|
244
271
|
## Search Tips
|
|
245
272
|
|
|
@@ -250,10 +277,10 @@ function getResearchContext(ctx, taskDir) {
|
|
|
250
277
|
|
|
251
278
|
if (taskDir) {
|
|
252
279
|
const jsonlPath = join(ctx.directory, taskDir, "research.jsonl")
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
280
|
+
const researchEntries = ctx.readJsonlWithFiles(jsonlPath)
|
|
281
|
+
if (researchEntries.length > 0) {
|
|
255
282
|
parts.push("\n## Additional Search Context\n")
|
|
256
|
-
parts.push(ctx.buildContextFromEntries(
|
|
283
|
+
parts.push(ctx.buildContextFromEntries(researchEntries))
|
|
257
284
|
}
|
|
258
285
|
}
|
|
259
286
|
|
|
@@ -11,44 +11,28 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { existsSync, readFileSync, readdirSync, statSync } from "fs"
|
|
14
|
-
import { join } from "path"
|
|
14
|
+
import { basename, join } from "path"
|
|
15
|
+
import { execFileSync } from "child_process"
|
|
16
|
+
import { platform } from "os"
|
|
15
17
|
import { TrellisContext, contextCollector, debugLog } from "../lib/trellis-context.js"
|
|
16
18
|
|
|
19
|
+
const PYTHON_CMD = platform() === "win32" ? "python" : "python3"
|
|
20
|
+
|
|
17
21
|
|
|
18
22
|
/**
|
|
19
23
|
* Check current task status and return structured status string.
|
|
20
24
|
* JavaScript equivalent of _get_task_status in Claude's session-start.py.
|
|
21
25
|
*/
|
|
22
|
-
function getTaskStatus(
|
|
23
|
-
const
|
|
24
|
-
const currentTaskFile = join(trellisDir, ".current-task")
|
|
25
|
-
|
|
26
|
-
if (!existsSync(currentTaskFile)) {
|
|
27
|
-
return "Status: NO ACTIVE TASK\nNext: Describe what you want to work on"
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let taskRef
|
|
31
|
-
try {
|
|
32
|
-
taskRef = readFileSync(currentTaskFile, "utf-8").trim()
|
|
33
|
-
} catch {
|
|
34
|
-
return "Status: NO ACTIVE TASK\nNext: Describe what you want to work on"
|
|
35
|
-
}
|
|
36
|
-
|
|
26
|
+
function getTaskStatus(ctx) {
|
|
27
|
+
const taskRef = ctx.getCurrentTask()
|
|
37
28
|
if (!taskRef) {
|
|
38
29
|
return "Status: NO ACTIVE TASK\nNext: Describe what you want to work on"
|
|
39
30
|
}
|
|
40
31
|
|
|
41
32
|
// Resolve task directory
|
|
42
|
-
|
|
43
|
-
if (taskRef.startsWith("/")) {
|
|
44
|
-
taskDir = taskRef
|
|
45
|
-
} else if (taskRef.startsWith(".trellis/")) {
|
|
46
|
-
taskDir = join(directory, taskRef)
|
|
47
|
-
} else {
|
|
48
|
-
taskDir = join(trellisDir, "tasks", taskRef)
|
|
49
|
-
}
|
|
33
|
+
const taskDir = ctx.resolveTaskDir(taskRef)
|
|
50
34
|
|
|
51
|
-
if (!existsSync(taskDir)) {
|
|
35
|
+
if (!taskDir || !existsSync(taskDir)) {
|
|
52
36
|
return `Status: STALE POINTER\nTask: ${taskRef}\nNext: Task directory not found. Run: python3 ./.trellis/scripts/task.py finish`
|
|
53
37
|
}
|
|
54
38
|
|
|
@@ -67,7 +51,7 @@ function getTaskStatus(directory) {
|
|
|
67
51
|
const taskStatus = taskData.status || "unknown"
|
|
68
52
|
|
|
69
53
|
if (taskStatus === "completed") {
|
|
70
|
-
const dirName = taskDir
|
|
54
|
+
const dirName = basename(taskDir)
|
|
71
55
|
return `Status: COMPLETED\nTask: ${taskTitle}\nNext: Archive with \`python3 ./.trellis/scripts/task.py archive ${dirName}\` or start a new task`
|
|
72
56
|
}
|
|
73
57
|
|
|
@@ -101,6 +85,124 @@ function getTaskStatus(directory) {
|
|
|
101
85
|
return `Status: READY\nTask: ${taskTitle}\nNext: Continue with implement or check`
|
|
102
86
|
}
|
|
103
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Load Trellis config for session-start decisions.
|
|
90
|
+
* Calls get_context.py --mode packages --json for reliable config data.
|
|
91
|
+
*/
|
|
92
|
+
function loadTrellisConfig(directory) {
|
|
93
|
+
const scriptPath = join(directory, ".trellis", "scripts", "get_context.py")
|
|
94
|
+
if (!existsSync(scriptPath)) {
|
|
95
|
+
return { isMonorepo: false, packages: {}, specScope: null, activeTaskPackage: null, defaultPackage: null }
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const output = execFileSync(PYTHON_CMD, [scriptPath, "--mode", "packages", "--json"], {
|
|
99
|
+
cwd: directory,
|
|
100
|
+
timeout: 5000,
|
|
101
|
+
encoding: "utf-8",
|
|
102
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
103
|
+
})
|
|
104
|
+
const data = JSON.parse(output)
|
|
105
|
+
if (data.mode !== "monorepo") {
|
|
106
|
+
return { isMonorepo: false, packages: {}, specScope: null, activeTaskPackage: null, defaultPackage: null }
|
|
107
|
+
}
|
|
108
|
+
// Convert packages array to dict keyed by name
|
|
109
|
+
const pkgDict = {}
|
|
110
|
+
for (const pkg of (data.packages || [])) {
|
|
111
|
+
pkgDict[pkg.name] = pkg
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
isMonorepo: true,
|
|
115
|
+
packages: pkgDict,
|
|
116
|
+
specScope: data.specScope || null,
|
|
117
|
+
activeTaskPackage: data.activeTaskPackage || null,
|
|
118
|
+
defaultPackage: data.defaultPackage || null,
|
|
119
|
+
}
|
|
120
|
+
} catch (e) {
|
|
121
|
+
debugLog("session", "loadTrellisConfig error:", e.message)
|
|
122
|
+
return { isMonorepo: false, packages: {}, specScope: null, activeTaskPackage: null, defaultPackage: null }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Check for legacy spec directory structure in monorepo.
|
|
129
|
+
*/
|
|
130
|
+
function checkLegacySpec(directory, config) {
|
|
131
|
+
if (!config.isMonorepo || Object.keys(config.packages).length === 0) {
|
|
132
|
+
return null
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const specDir = join(directory, ".trellis", "spec")
|
|
136
|
+
if (!existsSync(specDir)) return null
|
|
137
|
+
|
|
138
|
+
// Check for legacy flat spec dirs
|
|
139
|
+
let hasLegacy = false
|
|
140
|
+
for (const name of ["backend", "frontend"]) {
|
|
141
|
+
if (existsSync(join(specDir, name, "index.md"))) {
|
|
142
|
+
hasLegacy = true
|
|
143
|
+
break
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (!hasLegacy) return null
|
|
147
|
+
|
|
148
|
+
// Check which packages are missing spec/<pkg>/ directory
|
|
149
|
+
const pkgNames = Object.keys(config.packages).sort()
|
|
150
|
+
const missing = pkgNames.filter(name => !existsSync(join(specDir, name)))
|
|
151
|
+
|
|
152
|
+
if (missing.length === 0) return null
|
|
153
|
+
|
|
154
|
+
if (missing.length === pkgNames.length) {
|
|
155
|
+
return (
|
|
156
|
+
`[!] Legacy spec structure detected: found \`spec/backend/\` or \`spec/frontend/\` ` +
|
|
157
|
+
`but no package-scoped \`spec/<package>/\` directories.\n` +
|
|
158
|
+
`Monorepo packages: ${pkgNames.join(", ")}\n` +
|
|
159
|
+
`Please reorganize: \`spec/backend/\` -> \`spec/<package>/backend/\``
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
return (
|
|
163
|
+
`[!] Partial spec migration detected: packages ${missing.join(", ")} ` +
|
|
164
|
+
`still missing \`spec/<pkg>/\` directory.\n` +
|
|
165
|
+
`Please complete migration for all packages.`
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Resolve which packages should have their specs injected.
|
|
172
|
+
* Returns a Set of allowed package names, or null for full scan.
|
|
173
|
+
*/
|
|
174
|
+
function resolveSpecScope(config) {
|
|
175
|
+
if (!config.isMonorepo || Object.keys(config.packages).length === 0) {
|
|
176
|
+
return null
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const { specScope, activeTaskPackage, defaultPackage, packages } = config
|
|
180
|
+
if (specScope == null) return null
|
|
181
|
+
|
|
182
|
+
if (specScope === "active_task") {
|
|
183
|
+
if (activeTaskPackage && activeTaskPackage in packages) return new Set([activeTaskPackage])
|
|
184
|
+
if (defaultPackage && defaultPackage in packages) return new Set([defaultPackage])
|
|
185
|
+
return null
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (Array.isArray(specScope)) {
|
|
189
|
+
const valid = new Set()
|
|
190
|
+
for (const entry of specScope) {
|
|
191
|
+
if (entry in packages) {
|
|
192
|
+
valid.add(entry)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (valid.size > 0) return valid
|
|
196
|
+
// All invalid: fallback
|
|
197
|
+
if (activeTaskPackage && activeTaskPackage in packages) return new Set([activeTaskPackage])
|
|
198
|
+
if (defaultPackage && defaultPackage in packages) return new Set([defaultPackage])
|
|
199
|
+
return null
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return null
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
104
206
|
/**
|
|
105
207
|
* Build session context for injection
|
|
106
208
|
*/
|
|
@@ -110,6 +212,10 @@ function buildSessionContext(ctx) {
|
|
|
110
212
|
const claudeDir = join(directory, ".claude")
|
|
111
213
|
const opencodeDir = join(directory, ".opencode")
|
|
112
214
|
|
|
215
|
+
// Load config for scope filtering and legacy detection
|
|
216
|
+
const config = loadTrellisConfig(directory)
|
|
217
|
+
const allowedPkgs = resolveSpecScope(config)
|
|
218
|
+
|
|
113
219
|
const parts = []
|
|
114
220
|
|
|
115
221
|
// 1. Header
|
|
@@ -118,6 +224,12 @@ You are starting a new session in a Trellis-managed project.
|
|
|
118
224
|
Read and follow all instructions below carefully.
|
|
119
225
|
</trellis-context>`)
|
|
120
226
|
|
|
227
|
+
// Legacy migration warning
|
|
228
|
+
const legacyWarning = checkLegacySpec(directory, config)
|
|
229
|
+
if (legacyWarning) {
|
|
230
|
+
parts.push(`<migration-warning>\n${legacyWarning}\n</migration-warning>`)
|
|
231
|
+
}
|
|
232
|
+
|
|
121
233
|
// 2. Current Context (dynamic)
|
|
122
234
|
const contextScript = join(trellisDir, "scripts", "get_context.py")
|
|
123
235
|
if (existsSync(contextScript)) {
|
|
@@ -155,15 +267,31 @@ Read and follow all instructions below carefully.
|
|
|
155
267
|
}).sort()
|
|
156
268
|
|
|
157
269
|
for (const sub of subs) {
|
|
270
|
+
// Always include guides/ regardless of scope
|
|
271
|
+
if (sub === "guides") {
|
|
272
|
+
const indexFile = join(specDir, sub, "index.md")
|
|
273
|
+
if (existsSync(indexFile)) {
|
|
274
|
+
const content = ctx.readFile(indexFile)
|
|
275
|
+
if (content) {
|
|
276
|
+
parts.push(`## ${sub}\n${content}\n`)
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
continue
|
|
280
|
+
}
|
|
281
|
+
|
|
158
282
|
const indexFile = join(specDir, sub, "index.md")
|
|
159
283
|
if (existsSync(indexFile)) {
|
|
160
|
-
// Flat spec dir: spec/<layer>/index.md
|
|
284
|
+
// Flat spec dir: spec/<layer>/index.md (single-repo)
|
|
161
285
|
const content = ctx.readFile(indexFile)
|
|
162
286
|
if (content) {
|
|
163
287
|
parts.push(`## ${sub}\n${content}\n`)
|
|
164
288
|
}
|
|
165
289
|
} else {
|
|
166
290
|
// Nested package dirs (monorepo): spec/<pkg>/<layer>/index.md
|
|
291
|
+
// Apply scope filter
|
|
292
|
+
if (allowedPkgs !== null && !allowedPkgs.has(sub)) {
|
|
293
|
+
continue
|
|
294
|
+
}
|
|
167
295
|
try {
|
|
168
296
|
const nested = readdirSync(join(specDir, sub)).filter(name => {
|
|
169
297
|
try {
|
|
@@ -206,7 +334,7 @@ Read and follow all instructions below carefully.
|
|
|
206
334
|
}
|
|
207
335
|
|
|
208
336
|
// 6. Task status (R2: check task state for session resume)
|
|
209
|
-
const taskStatus = getTaskStatus(
|
|
337
|
+
const taskStatus = getTaskStatus(ctx)
|
|
210
338
|
parts.push(`<task-status>\n${taskStatus}\n</task-status>`)
|
|
211
339
|
|
|
212
340
|
// 7. Final directive (R3: active, not passive)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: before-dev
|
|
3
|
+
description: "Discovers and injects project-specific coding guidelines from .trellis/spec/ before implementation begins. Reads spec indexes, pre-development checklists, and shared thinking guides for the target package. Use when starting a new coding task, before writing any code, switching to a different package, or needing to refresh project conventions and standards."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Read the relevant development guidelines before starting your task.
|
|
7
|
+
|
|
8
|
+
Execute these steps:
|
|
9
|
+
|
|
10
|
+
1. **Discover packages and their spec layers**:
|
|
11
|
+
```bash
|
|
12
|
+
python3 ./.trellis/scripts/get_context.py --mode packages
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Identify which specs apply** to your task based on:
|
|
16
|
+
- Which package you're modifying (e.g., `cli/`, `docs-site/`)
|
|
17
|
+
- What type of work (backend, frontend, unit-test, docs, etc.)
|
|
18
|
+
|
|
19
|
+
3. **Read the spec index** for each relevant module:
|
|
20
|
+
```bash
|
|
21
|
+
cat .trellis/spec/<package>/<layer>/index.md
|
|
22
|
+
```
|
|
23
|
+
Follow the **"Pre-Development Checklist"** section in the index.
|
|
24
|
+
|
|
25
|
+
4. **Read the specific guideline files** listed in the Pre-Development Checklist that are relevant to your task. The index is NOT the goal — it points you to the actual guideline files (e.g., `error-handling.md`, `conventions.md`, `mock-strategies.md`). Read those files to understand the coding standards and patterns.
|
|
26
|
+
|
|
27
|
+
5. **Always read shared guides**:
|
|
28
|
+
```bash
|
|
29
|
+
cat .trellis/spec/guides/index.md
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
|
|
33
|
+
|
|
34
|
+
This step is **mandatory** before writing any code.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brainstorm
|
|
3
|
-
description: "
|
|
3
|
+
description: "Collaborative requirements discovery session optimized for AI coding workflows. Creates task directories, seeds PRDs, runs codebase research, proposes concrete implementation approaches with trade-offs, and converges on MVP scope through structured Q&A. Use when requirements are unclear, multiple implementation paths exist, trade-offs need evaluation, or a complex feature needs scoping before development."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Brainstorm - Requirements Discovery (AI Coding Enhanced)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: break-loop
|
|
3
|
-
description: "
|
|
3
|
+
description: "Deep post-fix bug analysis across five dimensions: root cause categorization, fix failure analysis, prevention mechanisms, systematic expansion, and knowledge capture. Updates .trellis/spec/ guides with lessons learned to prevent recurring bugs. Use when a debugging session completes, after fixing a tricky bug, when the same class of bug keeps recurring, or when you want to capture debugging insights into project documentation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Break the Loop - Deep Bug Analysis
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: check
|
|
3
|
+
description: "Validates recently written code against project-specific development guidelines from .trellis/spec/. Identifies changed files via git diff, discovers applicable spec modules, runs lint and typecheck, and reports guideline violations. Use when code is written and needs quality verification, to catch context drift during long sessions, or before committing changes."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Check if the code you just wrote follows the development guidelines.
|
|
7
|
+
|
|
8
|
+
Execute these steps:
|
|
9
|
+
|
|
10
|
+
1. **Identify changed files**:
|
|
11
|
+
```bash
|
|
12
|
+
git diff --name-only HEAD
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Determine which spec modules apply** based on the changed file paths:
|
|
16
|
+
```bash
|
|
17
|
+
python3 ./.trellis/scripts/get_context.py --mode packages
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. **Read the spec index** for each relevant module:
|
|
21
|
+
```bash
|
|
22
|
+
cat .trellis/spec/<package>/<layer>/index.md
|
|
23
|
+
```
|
|
24
|
+
Follow the **"Quality Check"** section in the index.
|
|
25
|
+
|
|
26
|
+
4. **Read the specific guideline files** referenced in the Quality Check section (e.g., `quality-guidelines.md`, `conventions.md`). The index is NOT the goal — it points you to the actual guideline files. Read those files and review your code against them.
|
|
27
|
+
|
|
28
|
+
5. **Run lint and typecheck** for the affected package.
|
|
29
|
+
|
|
30
|
+
6. **Report any violations** and fix them if found.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: check-cross-layer
|
|
3
|
-
description: "
|
|
3
|
+
description: "Post-implementation verification across multiple code dimensions: cross-layer data flow, code reuse analysis, import path validation, and same-layer consistency checks. Identifies missed update sites, type mismatches, and duplicated constants. Use when changes span 3+ architectural layers, after modifying shared constants or configs, after batch file modifications, or when creating new utility functions."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Cross-Layer Check
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: create-command
|
|
3
|
-
description: "
|
|
3
|
+
description: "Scaffolds a new skill file with proper naming conventions and structure. Analyzes requirements to determine skill type and generates appropriate content. Use when adding a new developer workflow skill, creating a custom skill, or extending the Trellis skill set."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Create New Skill
|
|
@@ -93,8 +93,8 @@ Description:
|
|
|
93
93
|
| Skill Type | Prefix | Example |
|
|
94
94
|
|------------|--------|---------|
|
|
95
95
|
| Session Start | `start` | `start` |
|
|
96
|
-
| Pre-development | `before-` | `before-
|
|
97
|
-
| Check | `check-` | `check
|
|
96
|
+
| Pre-development | `before-` | `before-dev` |
|
|
97
|
+
| Check | `check-` | `check` |
|
|
98
98
|
| Record | `record-` | `record-session` |
|
|
99
99
|
| Generate | `generate-` | `generate-api-doc` |
|
|
100
100
|
| Update | `update-` | `update-changelog` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: finish-work
|
|
3
|
-
description: "
|
|
3
|
+
description: "Pre-commit quality checklist covering lint, typecheck, tests, code-spec sync, API changes, database migrations, cross-layer verification, and manual testing. Blocks commit if infra or cross-layer specs lack executable depth. Use when code is written and tested but not yet committed, before submitting changes, or as a final review before git commit."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Finish Work - Pre-Commit Checklist
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: integrate-skill
|
|
3
|
-
description: "
|
|
3
|
+
description: "Adapts an external skill into project-specific development guidelines in .trellis/spec/. Creates guideline sections, code example templates with .template suffix, and updates spec indexes. Use when integrating an external skill, adding a new skill's patterns to project conventions, or incorporating third-party skill best practices into .trellis/spec/ documentation."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Integrate Skill into Project Guidelines
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: onboard
|
|
3
|
-
description: "
|
|
3
|
+
description: "Interactive three-part onboarding for new team members to the Trellis AI-assisted workflow system. Covers core philosophy (AI memory, project-specific knowledge, context drift), system structure and command deep-dives, real-world workflow examples, and guideline customization. Use when a new developer joins the project, someone needs to understand the Trellis workflow, or project guidelines need initial setup."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
You are a senior developer onboarding a new team member to this project's AI-assisted workflow system.
|
|
@@ -131,13 +131,13 @@ AI needs the same onboarding - but compressed into seconds at session start.
|
|
|
131
131
|
|
|
132
132
|
---
|
|
133
133
|
|
|
134
|
-
### $before-
|
|
134
|
+
### $before-dev - Inject Specialized Knowledge
|
|
135
135
|
|
|
136
136
|
**WHY IT EXISTS**:
|
|
137
137
|
AI models have "pre-trained knowledge" - general patterns from millions of codebases. But YOUR project has specific conventions that differ from generic patterns.
|
|
138
138
|
|
|
139
139
|
**WHAT IT ACTUALLY DOES**:
|
|
140
|
-
1.
|
|
140
|
+
1. Discovers spec layers via `get_context.py --mode packages` and reads relevant guidelines
|
|
141
141
|
2. Loads project-specific patterns into AI's working context:
|
|
142
142
|
- Component naming conventions
|
|
143
143
|
- State management patterns
|
|
@@ -145,12 +145,12 @@ AI models have "pre-trained knowledge" - general patterns from millions of codeb
|
|
|
145
145
|
- Error handling standards
|
|
146
146
|
|
|
147
147
|
**WHY THIS MATTERS**:
|
|
148
|
-
- Without before
|
|
149
|
-
- With before
|
|
148
|
+
- Without before-dev: AI writes generic code that doesn't match project style.
|
|
149
|
+
- With before-dev: AI writes code that looks like the rest of the codebase.
|
|
150
150
|
|
|
151
151
|
---
|
|
152
152
|
|
|
153
|
-
### $check
|
|
153
|
+
### $check - Combat Context Drift
|
|
154
154
|
|
|
155
155
|
**WHY IT EXISTS**:
|
|
156
156
|
AI context window has limited capacity. As conversation progresses, guidelines injected at session start become less influential. This causes "context drift."
|
|
@@ -216,9 +216,9 @@ All the context AI built during this session will be lost when session ends. The
|
|
|
216
216
|
|
|
217
217
|
**[1/8] $start** - AI needs project context before touching code
|
|
218
218
|
**[2/8] python3 ./.trellis/scripts/task.py create "Fix bug" --slug fix-bug** - Track work for future reference
|
|
219
|
-
**[3/8] $before-
|
|
219
|
+
**[3/8] $before-dev** - Inject project-specific development guidelines
|
|
220
220
|
**[4/8] Investigate and fix the bug** - Actual development work
|
|
221
|
-
**[5/8] $check
|
|
221
|
+
**[5/8] $check** - Re-verify code against guidelines
|
|
222
222
|
**[6/8] $finish-work** - Holistic cross-layer review
|
|
223
223
|
**[7/8] Human tests and commits** - Human validates before code enters repo
|
|
224
224
|
**[8/8] $record-session** - Persist memory for future sessions
|
|
@@ -233,9 +233,9 @@ All the context AI built during this session will be lost when session ends. The
|
|
|
233
233
|
### Example 3: Code Review Fixes
|
|
234
234
|
|
|
235
235
|
**[1/6] $start** - Resume context from previous session
|
|
236
|
-
**[2/6] $before-
|
|
236
|
+
**[2/6] $before-dev** - Re-inject guidelines before fixes
|
|
237
237
|
**[3/6] Fix each CR issue** - Address feedback with guidelines in context
|
|
238
|
-
**[4/6] $check
|
|
238
|
+
**[4/6] $check** - Verify fixes did not introduce new issues
|
|
239
239
|
**[5/6] $finish-work** - Document lessons from CR
|
|
240
240
|
**[6/6] Human commits, then $record-session** - Preserve CR lessons
|
|
241
241
|
|
|
@@ -243,16 +243,16 @@ All the context AI built during this session will be lost when session ends. The
|
|
|
243
243
|
|
|
244
244
|
**[1/5] $start** - Clear baseline before major changes
|
|
245
245
|
**[2/5] Plan phases** - Break into verifiable chunks
|
|
246
|
-
**[3/5] Execute phase by phase with
|
|
246
|
+
**[3/5] Execute phase by phase with $check after each** - Incremental verification
|
|
247
247
|
**[4/5] $finish-work** - Check if new patterns should be documented
|
|
248
248
|
**[5/5] Record with multiple commit hashes** - Link all commits to one feature
|
|
249
249
|
|
|
250
250
|
### Example 5: Debug Session
|
|
251
251
|
|
|
252
252
|
**[1/6] $start** - See if this bug was investigated before
|
|
253
|
-
**[2/6] $before-
|
|
253
|
+
**[2/6] $before-dev** - Guidelines might document known gotchas
|
|
254
254
|
**[3/6] Investigation** - Actual debugging work
|
|
255
|
-
**[4/6] $check
|
|
255
|
+
**[4/6] $check** - Verify debug changes do not break other things
|
|
256
256
|
**[5/6] $finish-work** - Debug findings might need documentation
|
|
257
257
|
**[6/6] Human commits, then $record-session** - Debug knowledge is valuable
|
|
258
258
|
|
|
@@ -261,7 +261,7 @@ All the context AI built during this session will be lost when session ends. The
|
|
|
261
261
|
## KEY RULES TO EMPHASIZE
|
|
262
262
|
|
|
263
263
|
1. **AI NEVER commits** - Human tests and approves. AI prepares, human validates.
|
|
264
|
-
2. **Guidelines before code** -
|
|
264
|
+
2. **Guidelines before code** - $before-dev command injects project knowledge.
|
|
265
265
|
3. **Check after code** - /check-* commands catch context drift.
|
|
266
266
|
4. **Record everything** - $record-session persists memory.
|
|
267
267
|
|