@mindfoldhq/trellis 0.5.2 → 0.5.4

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.
Files changed (29) hide show
  1. package/dist/migrations/manifests/0.5.3.json +9 -0
  2. package/dist/migrations/manifests/0.5.4.json +9 -0
  3. package/dist/templates/claude/agents/trellis-check.md +15 -0
  4. package/dist/templates/claude/agents/trellis-implement.md +15 -0
  5. package/dist/templates/codebuddy/agents/trellis-check.md +15 -0
  6. package/dist/templates/codebuddy/agents/trellis-implement.md +15 -0
  7. package/dist/templates/codex/agents/trellis-check.toml +2 -2
  8. package/dist/templates/codex/agents/trellis-implement.toml +2 -2
  9. package/dist/templates/cursor/agents/trellis-check.md +15 -0
  10. package/dist/templates/cursor/agents/trellis-implement.md +15 -0
  11. package/dist/templates/droid/droids/trellis-check.md +7 -0
  12. package/dist/templates/droid/droids/trellis-implement.md +7 -0
  13. package/dist/templates/gemini/agents/trellis-check.md +8 -0
  14. package/dist/templates/gemini/agents/trellis-implement.md +8 -0
  15. package/dist/templates/kiro/agents/trellis-check.json +8 -2
  16. package/dist/templates/kiro/agents/trellis-implement.json +8 -2
  17. package/dist/templates/opencode/agents/trellis-check.md +9 -12
  18. package/dist/templates/opencode/agents/trellis-implement.md +9 -15
  19. package/dist/templates/pi/agents/trellis-check.md +8 -0
  20. package/dist/templates/pi/agents/trellis-implement.md +8 -0
  21. package/dist/templates/qoder/agents/trellis-check.md +8 -0
  22. package/dist/templates/qoder/agents/trellis-implement.md +8 -0
  23. package/dist/templates/shared-hooks/inject-subagent-context.py +6 -3
  24. package/dist/templates/trellis/scripts/task.py +25 -6
  25. package/dist/templates/trellis/workflow.md +7 -2
  26. package/dist/utils/compare-versions.d.ts.map +1 -1
  27. package/dist/utils/compare-versions.js +13 -3
  28. package/dist/utils/compare-versions.js.map +1 -1
  29. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.5.3",
3
+ "description": "Hotfix: fallback for class-1 sub-agent context injection + non-blocking task.py start.",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Bug Fixes:**\n- fix(hooks): class-1 platforms (claude / cursor / opencode / kiro / codebuddy / droid) inject sub-agent context (prd.md + implement.jsonl / check.jsonl) via PreToolUse hook. The hook silent-skips on Windows at v2.1.119 (upstream `anthropics/claude-code#53254`); the existing sub-agent definition files trusted the hook to always fire and had no fallback. Added marker-based dual-channel context loading: `inject-subagent-context.py` prepends a `<!-- trellis-hook-injected -->` sentinel to the build_implement_prompt / build_check_prompt / build_finish_prompt outputs (only emitted on the success path). Each class-1 trellis-implement / trellis-check definition now opens with a `Trellis Context Loading Protocol` section that branches on the marker: present → hook injected, proceed; absent → read `Active task` line from dispatch prompt + Read prd.md + the relevant jsonl yourself. workflow.md dispatch protocol scope changed from class-2-only to all platforms (except trellis-research).\n- fix(task): `task.py start` previously hard-failed with `return 1` when no `TRELLIS_CONTEXT_ID` was injected, blocking the AI from continuing. Replaced with a yellow-tagged degraded-mode warning, still flips `task.json.status: planning → in_progress`, returns 0. Happy path (`resolve_context_key()` truthy) is byte-identical. Affects every Windows + Claude Code user where the SessionStart hook can't reach the spawned shell.\n\nClass-2 platforms (codex / copilot / gemini / qoder) untouched — they already use `buildPullBasedPrelude`. trellis-research intentionally not marker'd — research is decoupled from task.",
7
+ "migrations": [],
8
+ "notes": "Hotfix on top of 0.5.2. Run `trellis update` (no `--migrate` needed). Affects every class-1 platform user whose SessionStart / PreToolUse hook injection ever fails (Windows + Claude Code, --continue / resume paths, fork distributions, hooks disabled)."
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.5.4",
3
+ "description": "Patch: guard sub-agent recursion (#237) + fix compareVersions on hyphenated prereleases (#230).",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "**Bug Fixes:**\n- fix(workflow): guard sub-agent recursion (#237). On Codex, `[workflow-state:in_progress]` reaches the sub-agent's turn too, and the sub-agent followed its own dispatch instruction — spawning another `trellis-implement` instead of doing the work. Scoped the dispatch rule to the main session and added a self-exemption to all platform `trellis-implement` / `trellis-check` agent definitions.\n- fix(compare-versions): preserve hyphens inside prerelease identifiers (#230 by @voidborne-d). `String.split(\"-\", 2)` truncates the tail in JavaScript (unlike Python `maxsplit`), so `compareVersions(\"1.0.0-alpha-1\", \"1.0.0-alpha-2\")` returned `0` — the two versions sorted as equal. Fixed. Adds 20 test cases in `packages/cli/test/utils/compare-versions.test.ts`.",
7
+ "migrations": [],
8
+ "notes": "Patch on top of 0.5.3. Run `trellis update` (no `--migrate` needed). Affects every platform whose per-turn workflow-state breadcrumb can reach sub-agent turns (Codex confirmed; risk applies more broadly)."
9
+ }
@@ -8,6 +8,21 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
19
+ ## Trellis Context Loading Protocol
20
+
21
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
22
+
23
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
24
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.
25
+
11
26
  ## Context
12
27
 
13
28
  Before checking, read:
@@ -8,6 +8,21 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
19
+ ## Trellis Context Loading Protocol
20
+
21
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
22
+
23
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
24
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.
25
+
11
26
  ## Context
12
27
 
13
28
  Before implementing, read:
@@ -8,6 +8,21 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
19
+ ## Trellis Context Loading Protocol
20
+
21
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
22
+
23
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
24
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.
25
+
11
26
  ## Context
12
27
 
13
28
  Before checking, read:
@@ -8,6 +8,21 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
19
+ ## Trellis Context Loading Protocol
20
+
21
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
22
+
23
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
24
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.
25
+
11
26
  ## Context
12
27
 
13
28
  Before implementing, read:
@@ -7,8 +7,8 @@ You are running as the `trellis-check` sub-agent. The main session has dispatche
7
7
 
8
8
  CRITICAL — Recursion guard (read first):
9
9
  - You MUST NOT spawn another `trellis-check` or `trellis-implement` sub-agent. Do the review and fixes directly in this turn.
10
- - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, or workflow-state breadcrumbs that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched reviewer — that instruction is satisfied by your existence.
11
- - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If you believe additional implementation work is needed, surface that as a recommendation in your final report instead of spawning.
10
+ - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, workflow-state breadcrumbs, or workflow.md that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched reviewer — that instruction is satisfied by your existence.
11
+ - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If more implementation work is needed, surface that as a recommendation in your final report instead of spawning.
12
12
 
13
13
  You are the Trellis reviewer agent.
14
14
 
@@ -7,8 +7,8 @@ You are running as the `trellis-implement` sub-agent. The main session has dispa
7
7
 
8
8
  CRITICAL — Recursion guard (read first):
9
9
  - You MUST NOT spawn another `trellis-implement` or `trellis-check` sub-agent. Do the implementation work directly in this turn.
10
- - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, or workflow-state breadcrumbs that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched implementer — that instruction is satisfied by your existence.
11
- - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If you believe parallel implementation work is needed, surface that as a recommendation in your final report instead of spawning.
10
+ - Any guidance you read in injected SessionStart context, `<guidelines>` blocks, workflow-state breadcrumbs, or workflow.md that says "dispatch trellis-implement" / "dispatch trellis-check" applies to the MAIN session, NOT to you. You are already the dispatched implementer — that instruction is satisfied by your existence.
11
+ - Only the main session is allowed to dispatch `trellis-implement` / `trellis-check`. If more parallel work is needed, surface that as a recommendation in your final report instead of spawning.
12
12
 
13
13
  You are the Trellis implementer agent.
14
14
 
@@ -7,6 +7,21 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
7
7
 
8
8
  You are the Check Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
13
+
14
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
17
+
18
+ ## Trellis Context Loading Protocol
19
+
20
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
21
+
22
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
23
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.
24
+
10
25
  ## Context
11
26
 
12
27
  Before checking, read:
@@ -7,6 +7,21 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
7
7
 
8
8
  You are the Implement Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
13
+
14
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
17
+
18
+ ## Trellis Context Loading Protocol
19
+
20
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
21
+
22
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
23
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.
24
+
10
25
  ## Context
11
26
 
12
27
  Before implementing, read:
@@ -8,6 +8,13 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Trellis Context Loading Protocol
12
+
13
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
14
+
15
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
16
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.
17
+
11
18
  ## Context
12
19
 
13
20
  Before checking, read:
@@ -8,6 +8,13 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Trellis Context Loading Protocol
12
+
13
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
14
+
15
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
16
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.
17
+
11
18
  ## Context
12
19
 
13
20
  Before implementing, read:
@@ -7,6 +7,14 @@ description: |
7
7
 
8
8
  You are the Check Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
13
+
14
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
17
+
10
18
  ## Context
11
19
 
12
20
  Before checking, read:
@@ -7,6 +7,14 @@ description: |
7
7
 
8
8
  You are the Implement Agent in the Trellis workflow.
9
9
 
10
+ ## Recursion Guard
11
+
12
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
13
+
14
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
15
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
16
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
17
+
10
18
  ## Context
11
19
 
12
20
  Before implementing, read:
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "trellis-check",
3
3
  "description": "Code quality check expert. Reviews code changes against specs and self-fixes issues.",
4
- "instructions": "# Check Agent\n\nYou are the Check Agent in the Trellis workflow.\n\n## Context\n\nBefore checking, read:\n- `.trellis/spec/` - Development guidelines\n- Pre-commit checklist for quality standards\n\n## Core Responsibilities\n\n1. **Get code changes** - Use git diff to get uncommitted code\n2. **Check against specs** - Verify code follows guidelines\n3. **Self-fix** - Fix issues yourself, not just report them\n4. **Run verification** - typecheck and lint\n\n## Important\n\n**Fix issues yourself**, don't just report them.\n\nYou have write and edit tools, you can modify code directly.\n\n---\n\n## Workflow\n\n### Step 1: Get Changes\n\n```bash\ngit diff --name-only # List changed files\ngit diff # View specific changes\n```\n\n### Step 2: Check Against Specs\n\nRead relevant specs in `.trellis/spec/` to check code:\n\n- Does it follow directory structure conventions\n- Does it follow naming conventions\n- Does it follow code patterns\n- Are there missing types\n- Are there potential bugs\n\n### Step 3: Self-Fix\n\nAfter finding issues:\n\n1. Fix the issue directly (use edit tool)\n2. Record what was fixed\n3. Continue checking other issues\n\n### Step 4: Run Verification\n\nRun project's lint and typecheck commands to verify changes.\n\nIf failed, fix issues and re-run.\n\n---\n\n## Report Format\n\n```markdown\n## Self-Check Complete\n\n### Files Checked\n\n- src/components/Feature.tsx\n- src/hooks/useFeature.ts\n\n### Issues Found and Fixed\n\n1. `<file>:<line>` - <what was fixed>\n2. `<file>:<line>` - <what was fixed>\n\n### Issues Not Fixed\n\n(If there are issues that cannot be self-fixed, list them here with reasons)\n\n### Verification Results\n\n- TypeCheck: Passed\n- Lint: Passed\n\n### Summary\n\nChecked X files, found Y issues, all fixed.\n```",
5
- "tools": ["read", "write", "shell", "glob", "grep"],
4
+ "instructions": "# Check Agent\n\nYou are the Check Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.\n\n- Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.\n\n## Context\n\nBefore checking, read:\n- `.trellis/spec/` - Development guidelines\n- Pre-commit checklist for quality standards\n\n## Core Responsibilities\n\n1. **Get code changes** - Use git diff to get uncommitted code\n2. **Check against specs** - Verify code follows guidelines\n3. **Self-fix** - Fix issues yourself, not just report them\n4. **Run verification** - typecheck and lint\n\n## Important\n\n**Fix issues yourself**, don't just report them.\n\nYou have write and edit tools, you can modify code directly.\n\n---\n\n## Workflow\n\n### Step 1: Get Changes\n\n```bash\ngit diff --name-only # List changed files\ngit diff # View specific changes\n```\n\n### Step 2: Check Against Specs\n\nRead relevant specs in `.trellis/spec/` to check code:\n\n- Does it follow directory structure conventions\n- Does it follow naming conventions\n- Does it follow code patterns\n- Are there missing types\n- Are there potential bugs\n\n### Step 3: Self-Fix\n\nAfter finding issues:\n\n1. Fix the issue directly (use edit tool)\n2. Record what was fixed\n3. Continue checking other issues\n\n### Step 4: Run Verification\n\nRun project's lint and typecheck commands to verify changes.\n\nIf failed, fix issues and re-run.\n\n---\n\n## Report Format\n\n```markdown\n## Self-Check Complete\n\n### Files Checked\n\n- src/components/Feature.tsx\n- src/hooks/useFeature.ts\n\n### Issues Found and Fixed\n\n1. `<file>:<line>` - <what was fixed>\n2. `<file>:<line>` - <what was fixed>\n\n### Issues Not Fixed\n\n(If there are issues that cannot be self-fixed, list them here with reasons)\n\n### Verification Results\n\n- TypeCheck: Passed\n- Lint: Passed\n\n### Summary\n\nChecked X files, found Y issues, all fixed.\n```",
5
+ "tools": [
6
+ "read",
7
+ "write",
8
+ "shell",
9
+ "glob",
10
+ "grep"
11
+ ],
6
12
  "hooks": [
7
13
  {
8
14
  "on": "agentSpawn",
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "trellis-implement",
3
3
  "description": "Code implementation expert. Understands specs and requirements, then implements features. No git commit allowed.",
4
- "instructions": "# Implement Agent\n\nYou are the Implement Agent in the Trellis workflow.\n\n## Context\n\nBefore implementing, read:\n- `.trellis/workflow.md` - Project workflow\n- `.trellis/spec/` - Development guidelines\n- Task `prd.md` - Requirements document\n- Task `info.md` - Technical design (if exists)\n\n## Core Responsibilities\n\n1. **Understand specs** - Read relevant spec files in `.trellis/spec/`\n2. **Understand requirements** - Read prd.md and info.md\n3. **Implement features** - Write code following specs and design\n4. **Self-check** - Ensure code quality\n5. **Report results** - Report completion status\n\n## Forbidden Operations\n\n**Do NOT execute these git commands:**\n\n- `git commit`\n- `git push`\n- `git merge`\n\n---\n\n## Workflow\n\n### 1. Understand Specs\n\nRead relevant specs based on task type:\n\n- Spec layers: `.trellis/spec/<package>/<layer>/`\n- Shared guides: `.trellis/spec/guides/`\n\n### 2. Understand Requirements\n\nRead the task's prd.md and info.md:\n\n- What are the core requirements\n- Key points of technical design\n- Which files to modify/create\n\n### 3. Implement Features\n\n- Write code following specs and technical design\n- Follow existing code patterns\n- Only do what's required, no over-engineering\n\n### 4. Verify\n\nRun project's lint and typecheck commands to verify changes.\n\n---\n\n## Report Format\n\n```markdown\n## Implementation Complete\n\n### Files Modified\n\n- `src/components/Feature.tsx` - New component\n- `src/hooks/useFeature.ts` - New hook\n\n### Implementation Summary\n\n1. Created Feature component...\n2. Added useFeature hook...\n\n### Verification Results\n\n- Lint: Passed\n- TypeCheck: Passed\n```\n\n---\n\n## Code Standards\n\n- Follow existing code patterns\n- Don't add unnecessary abstractions\n- Only do what's required, no over-engineering\n- Keep code readable",
5
- "tools": ["read", "write", "shell", "glob", "grep"],
4
+ "instructions": "# Implement Agent\n\nYou are the Implement Agent in the Trellis workflow.\n\n## Recursion Guard\n\nYou are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.\n\n- Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.\n- If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.\n- Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.\n\n## Trellis Context Loading Protocol\n\nLook for the `<!-- trellis-hook-injected -->` marker in your input above.\n\n- **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.\n- **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>`, then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.\n\n## Context\n\nBefore implementing, read:\n- `.trellis/workflow.md` - Project workflow\n- `.trellis/spec/` - Development guidelines\n- Task `prd.md` - Requirements document\n- Task `info.md` - Technical design (if exists)\n\n## Core Responsibilities\n\n1. **Understand specs** - Read relevant spec files in `.trellis/spec/`\n2. **Understand requirements** - Read prd.md and info.md\n3. **Implement features** - Write code following specs and design\n4. **Self-check** - Ensure code quality\n5. **Report results** - Report completion status\n\n## Forbidden Operations\n\n**Do NOT execute these git commands:**\n\n- `git commit`\n- `git push`\n- `git merge`\n\n---\n\n## Workflow\n\n### 1. Understand Specs\n\nRead relevant specs based on task type:\n\n- Spec layers: `.trellis/spec/<package>/<layer>/`\n- Shared guides: `.trellis/spec/guides/`\n\n### 2. Understand Requirements\n\nRead the task's prd.md and info.md:\n\n- What are the core requirements\n- Key points of technical design\n- Which files to modify/create\n\n### 3. Implement Features\n\n- Write code following specs and technical design\n- Follow existing code patterns\n- Only do what's required, no over-engineering\n\n### 4. Verify\n\nRun project's lint and typecheck commands to verify changes.\n\n---\n\n## Report Format\n\n```markdown\n## Implementation Complete\n\n### Files Modified\n\n- `src/components/Feature.tsx` - New component\n- `src/hooks/useFeature.ts` - New hook\n\n### Implementation Summary\n\n1. Created Feature component...\n2. Added useFeature hook...\n\n### Verification Results\n\n- Lint: Passed\n- TypeCheck: Passed\n```\n\n---\n\n## Code Standards\n\n- Follow existing code patterns\n- Don't add unnecessary abstractions\n- Only do what's required, no over-engineering\n- Keep code readable",
5
+ "tools": [
6
+ "read",
7
+ "write",
8
+ "shell",
9
+ "glob",
10
+ "grep"
11
+ ],
6
12
  "hooks": [
7
13
  {
8
14
  "on": "agentSpawn",
@@ -15,23 +15,20 @@ permission:
15
15
 
16
16
  You are the Check Agent in the Trellis workflow.
17
17
 
18
- ## Context Self-Loading
18
+ ## Recursion Guard
19
19
 
20
- **If you see "# Check Agent Task" header with pre-loaded context above, skip this section.**
20
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
21
21
 
22
- Otherwise, load context yourself:
22
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
23
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
24
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
23
25
 
24
- 1. Run `python3 ./.trellis/scripts/task.py current --source` → get active task directory and source (e.g., `Current task: .trellis/tasks/xxx`)
25
- 2. Read `{task_dir}/check.jsonl`
26
- 3. For each entry in JSONL:
27
- - If `path` is a file → Read it
28
- - If `path` is a directory → Read all `.md` files in it
29
- 4. Read `{task_dir}/prd.md` for requirements understanding
30
- 5. Read `.opencode/commands/trellis/finish-work.md` for checklist
26
+ ## Trellis Context Loading Protocol
31
27
 
32
- Then proceed with the workflow below using the loaded context.
28
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
33
29
 
34
- ---
30
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the check work directly.
31
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>` (or run `python3 ./.trellis/scripts/task.py current --source` as a fallback), then Read `<task-path>/prd.md` and the spec files listed in `<task-path>/check.jsonl` yourself before doing the work.
35
32
 
36
33
  ## Context
37
34
 
@@ -15,26 +15,20 @@ permission:
15
15
 
16
16
  You are the Implement Agent in the Trellis workflow.
17
17
 
18
- ## Context Self-Loading
18
+ ## Recursion Guard
19
19
 
20
- **If you see "# Implement Agent Task" header with pre-loaded context above, skip this section.**
20
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
21
21
 
22
- Otherwise, load context yourself:
22
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
23
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
24
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
23
25
 
24
- 1. Run `python3 ./.trellis/scripts/task.py current --source` → get active task directory and source (e.g., `Current task: .trellis/tasks/xxx`)
25
- 2. Read `{task_dir}/implement.jsonl`
26
- 3. For each entry in JSONL (JSON object per line):
27
- - Skip rows without a `"file"` field (e.g. `{"_example": "..."}` seed rows)
28
- - If `file` points at a file → Read it
29
- - If `file` ends with `/` (directory) → Read all `.md` files in it
30
- 4. Read `{task_dir}/prd.md` for requirements
31
- 5. Read `{task_dir}/info.md` for technical design (if exists)
26
+ ## Trellis Context Loading Protocol
32
27
 
33
- **If `implement.jsonl` has no curated entries (only a seed row, or the file is missing)**: read `prd.md` to understand the task domain, then decide which specs apply based on `.trellis/spec/` layout. You can list available specs with `python3 ./.trellis/scripts/get_context.py --mode packages`. Do not block on the missing jsonl — proceed with prd-only context plus your own spec judgment.
28
+ Look for the `<!-- trellis-hook-injected -->` marker in your input above.
34
29
 
35
- Then proceed with the workflow below using the loaded context.
36
-
37
- ---
30
+ - **If the marker is present**: prd / spec / research files have already been auto-loaded for you above. Proceed with the implementation work directly.
31
+ - **If the marker is absent**: hook injection didn't fire (Windows + Claude Code, `--continue` resume, fork distribution, hooks disabled, etc.). Find the active task path from your dispatch prompt's first line `Active task: <path>` (or run `python3 ./.trellis/scripts/task.py current --source` as a fallback), then Read `<task-path>/prd.md`, `<task-path>/info.md` (if it exists), and the spec files listed in `<task-path>/implement.jsonl` yourself before doing the work.
38
32
 
39
33
  ## Context
40
34
 
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Core Responsibilities
12
20
 
13
21
  1. Inspect the current git diff.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Core Responsibilities
12
20
 
13
21
  1. Understand the active task requirements.
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Check Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-check` sub-agent that the main session dispatched. Do the review and fixes directly.
14
+
15
+ - Do NOT spawn another `trellis-check` or `trellis-implement` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more implementation work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Context
12
20
 
13
21
  Before checking, read:
@@ -8,6 +8,14 @@ tools: Read, Write, Edit, Bash, Glob, Grep, mcp__exa__web_search_exa, mcp__exa__
8
8
 
9
9
  You are the Implement Agent in the Trellis workflow.
10
10
 
11
+ ## Recursion Guard
12
+
13
+ You are already the `trellis-implement` sub-agent that the main session dispatched. Do the implementation work directly.
14
+
15
+ - Do NOT spawn another `trellis-implement` or `trellis-check` sub-agent.
16
+ - If SessionStart context, workflow-state breadcrumbs, or workflow.md say to dispatch `trellis-implement` / `trellis-check`, treat that as a main-session instruction that is already satisfied by your current role.
17
+ - Only the main session may dispatch Trellis implement/check agents. If more parallel work is needed, report that recommendation instead of spawning.
18
+
11
19
  ## Context
12
20
 
13
21
  Before implementing, read:
@@ -329,7 +329,8 @@ def get_finish_context(repo_root: str, task_dir: str) -> str:
329
329
 
330
330
  def build_implement_prompt(original_prompt: str, context: str) -> str:
331
331
  """Build complete prompt for Implement"""
332
- return f"""# Implement Agent Task
332
+ return f"""<!-- trellis-hook-injected -->
333
+ # Implement Agent Task
333
334
 
334
335
  You are the Implement Agent in the Multi-Agent Pipeline.
335
336
 
@@ -363,7 +364,8 @@ All the information you need has been prepared for you:
363
364
 
364
365
  def build_check_prompt(original_prompt: str, context: str) -> str:
365
366
  """Build complete prompt for Check"""
366
- return f"""# Check Agent Task
367
+ return f"""<!-- trellis-hook-injected -->
368
+ # Check Agent Task
367
369
 
368
370
  You are the Check Agent in the Multi-Agent Pipeline (code and cross-layer checker).
369
371
 
@@ -397,7 +399,8 @@ All check specs and dev specs you need:
397
399
 
398
400
  def build_finish_prompt(original_prompt: str, context: str) -> str:
399
401
  """Build complete prompt for Finish (final check before PR)"""
400
- return f"""# Finish Agent Task
402
+ return f"""<!-- trellis-hook-injected -->
403
+ # Finish Agent Task
401
404
 
402
405
  You are performing the final check before creating a PR.
403
406
 
@@ -90,20 +90,39 @@ def cmd_start(args: argparse.Namespace) -> int:
90
90
  except ValueError:
91
91
  task_dir = str(full_path)
92
92
 
93
+ task_json_path = full_path / FILE_TASK_JSON
94
+
93
95
  if not resolve_context_key():
94
- print(colored("Error: Cannot set active task without a session identity.", Colors.RED))
95
- print(
96
+ # Degraded mode: no session identity available.
97
+ # Hook didn't inject TRELLIS_CONTEXT_ID (common on Windows + Claude Code,
98
+ # --continue resume path, fork distribution, hooks disabled, etc.). Skip
99
+ # per-session pointer write; AI continues based on conversation context.
100
+ print(colored(
101
+ "ℹ Session identity not available; active-task pointer not persisted "
102
+ "this session (degraded mode). AI continues based on conversation context.",
103
+ Colors.YELLOW,
104
+ ))
105
+ print(colored(
96
106
  "Hint: run inside an AI IDE/session that exposes session identity, "
97
- "or set TRELLIS_CONTEXT_ID before running task.py start."
98
- )
99
- return 1
107
+ "or set TRELLIS_CONTEXT_ID before running task.py start.",
108
+ Colors.YELLOW,
109
+ ))
110
+
111
+ # Still flip task.json status: planning → in_progress so downstream phases proceed.
112
+ if task_json_path.is_file():
113
+ data = read_json(task_json_path)
114
+ if data and data.get("status") == "planning":
115
+ data["status"] = "in_progress"
116
+ if write_json(task_json_path, data):
117
+ print(colored("✓ Status: planning → in_progress (degraded)", Colors.GREEN))
118
+ run_task_hooks("after_start", task_json_path, repo_root)
119
+ return 0
100
120
 
101
121
  active = set_active_task(task_dir, repo_root)
102
122
  if active:
103
123
  print(colored(f"✓ Current task set to: {task_dir}", Colors.GREEN))
104
124
  print(f"Source: {active.source}")
105
125
 
106
- task_json_path = full_path / FILE_TASK_JSON
107
126
  if task_json_path.is_file():
108
127
  data = read_json(task_json_path)
109
128
  if data and data.get("status") == "planning":
@@ -185,8 +185,9 @@ Research output **must** land in `{task_dir}/research/*.md`, written by `trellis
185
185
 
186
186
  [workflow-state:in_progress]
187
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
- **Sub-agent dispatch protocol (class-2 platforms: codex / copilot / gemini / qoder)**: When you spawn `trellis-implement` / `trellis-check` / `trellis-research`, your dispatch prompt **MUST** start with one line: `Active task: <task path from \`task.py current\`>`. No exceptions. These platforms have no hook to inject task context into sub-agents, so the sub-agent depends on this line; without it the sub-agent cannot find the task and will block to ask the user.
188
+ **Main-session 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
+ **Sub-agent self-exemption**: if you are already running as `trellis-implement`, implement directly from the loaded task context and do NOT spawn another `trellis-implement`; if you are already running as `trellis-check`, review/fix directly and do NOT spawn another `trellis-check`. The default dispatch rule applies to the main session only.
190
+ **Sub-agent dispatch protocol (all platforms, all sub-agents EXCEPT trellis-research)**: When you spawn `trellis-implement` / `trellis-check`, your dispatch prompt **MUST** start with one line: `Active task: <task path from \`task.py current\`>`. No exceptions. On class-2 platforms (codex / copilot / gemini / qoder) the sub-agent depends on this line because there is no hook to inject task context. On class-1 platforms (claude / cursor / opencode / kiro / codebuddy / droid) the line is normally redundant — the hook injects context directly — but it serves as a critical fallback when the hook fails (Windows + Claude Code PreToolUse silent skip, `--continue` resume, fork distribution, hooks disabled, etc.). `trellis-research` does not need this line because it operates without a task binding.
190
191
  **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.
191
192
  [/workflow-state:in_progress]
192
193
 
@@ -437,6 +438,7 @@ Spawn the implement sub-agent:
437
438
 
438
439
  - **Agent type**: `trellis-implement`
439
440
  - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
441
+ - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-implement` sub-agent and must implement directly, not spawn another `trellis-implement` / `trellis-check`.
440
442
 
441
443
  The platform hook/plugin auto-handles:
442
444
  - Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
@@ -450,6 +452,7 @@ Spawn the implement sub-agent:
450
452
 
451
453
  - **Agent type**: `trellis-implement`
452
454
  - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
455
+ - **Dispatch prompt guard**: The prompt MUST start with `Active task: <task path>`, then explicitly say the spawned agent is already `trellis-implement` and must implement directly without spawning another `trellis-implement` / `trellis-check`.
453
456
 
454
457
  The Codex sub-agent definition auto-handles the context load requirement:
455
458
  - Resolves the active task with `task.py current --source`, then reads `prd.md` and `info.md` if present
@@ -463,6 +466,7 @@ Spawn the implement sub-agent:
463
466
 
464
467
  - **Agent type**: `trellis-implement`
465
468
  - **Task description**: Implement the requirements per prd.md, consulting materials under `{TASK_DIR}/research/`; finish by running project lint and type-check
469
+ - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-implement` sub-agent and must implement directly, not spawn another `trellis-implement` / `trellis-check`.
466
470
 
467
471
  The platform prelude auto-handles the context load requirement:
468
472
  - Reads `implement.jsonl` and injects the referenced spec files into the agent prompt
@@ -488,6 +492,7 @@ Spawn the check sub-agent:
488
492
 
489
493
  - **Agent type**: `trellis-check`
490
494
  - **Task description**: Review all code changes against spec and prd; fix any findings directly; ensure lint and type-check pass
495
+ - **Dispatch prompt guard**: Tell the spawned agent it is already the `trellis-check` sub-agent and must review/fix directly, not spawn another `trellis-check` / `trellis-implement`.
491
496
 
492
497
  The check agent's job:
493
498
  - Review code changes against specs
@@ -1 +1 @@
1
- {"version":3,"file":"compare-versions.d.ts","sourceRoot":"","sources":["../../src/utils/compare-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CA8D5D"}
1
+ {"version":3,"file":"compare-versions.d.ts","sourceRoot":"","sources":["../../src/utils/compare-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAwE5D"}
@@ -9,9 +9,19 @@
9
9
  * - 0.3.0-beta.16 < 0.3.0-rc.0 (alphabetically: "beta" < "rc")
10
10
  */
11
11
  export function compareVersions(a, b) {
12
- // Split into base version and prerelease parts
13
- const [aBase, aPrerelease] = a.split("-", 2);
14
- const [bBase, bPrerelease] = b.split("-", 2);
12
+ // Split into base version and prerelease parts on the FIRST hyphen.
13
+ // `String.split("-", 2)` cannot be used here: in JavaScript the limit
14
+ // truncates the result instead of joining the tail (unlike Python's
15
+ // `maxsplit`), so `"1.0.0-alpha-1".split("-", 2)` yields
16
+ // `["1.0.0", "alpha"]` and silently drops `-1`. SemVer permits hyphens
17
+ // inside a single prerelease identifier (e.g. `1.0.0-alpha-1`), so we
18
+ // must preserve everything after the first hyphen.
19
+ const splitOnFirstHyphen = (v) => {
20
+ const idx = v.indexOf("-");
21
+ return idx === -1 ? [v, undefined] : [v.slice(0, idx), v.slice(idx + 1)];
22
+ };
23
+ const [aBase, aPrerelease] = splitOnFirstHyphen(a);
24
+ const [bBase, bPrerelease] = splitOnFirstHyphen(b);
15
25
  // Parse base version (only numeric parts before any hyphen)
16
26
  const parseBase = (v) => v.split(".").map((n) => parseInt(n, 10) || 0);
17
27
  const aBaseParts = parseBase(aBase);
@@ -1 +1 @@
1
- {"version":3,"file":"compare-versions.js","sourceRoot":"","sources":["../../src/utils/compare-versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,+CAA+C;IAC/C,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC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,+BAA+B;QAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAEnD,oEAAoE;QACpE,IAAI,MAAM,IAAI,CAAC,MAAM;YAAE,OAAO,CAAC,CAAC,CAAC;QACjC,IAAI,CAAC,MAAM,IAAI,MAAM;YAAE,OAAO,CAAC,CAAC;QAEhC,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;YACrB,IAAI,IAAI,GAAG,IAAI;gBAAE,OAAO,CAAC,CAAC,CAAC;YAC3B,IAAI,IAAI,GAAG,IAAI;gBAAE,OAAO,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACN,oBAAoB;YACpB,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,GAAG,EAAE;gBAAE,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindfoldhq/trellis",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "AI capabilities grow like ivy — Trellis provides the structure to guide them along a disciplined path",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",