@mindfoldhq/trellis 0.3.10-beta.0 → 0.3.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.
Files changed (173) hide show
  1. package/dist/cli/index.js +0 -2
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/commands/init.d.ts +0 -1
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js +31 -203
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/commands/update.d.ts.map +1 -1
  8. package/dist/commands/update.js +6 -154
  9. package/dist/commands/update.js.map +1 -1
  10. package/dist/configurators/workflow.d.ts +2 -6
  11. package/dist/configurators/workflow.d.ts.map +1 -1
  12. package/dist/configurators/workflow.js +58 -88
  13. package/dist/configurators/workflow.js.map +1 -1
  14. package/dist/migrations/index.d.ts +0 -1
  15. package/dist/migrations/index.d.ts.map +1 -1
  16. package/dist/migrations/index.js +0 -2
  17. package/dist/migrations/index.js.map +1 -1
  18. package/dist/migrations/manifests/0.3.10.json +9 -0
  19. package/dist/templates/claude/agents/dispatch.md +2 -1
  20. package/dist/templates/claude/agents/implement.md +3 -2
  21. package/dist/templates/claude/commands/trellis/before-backend-dev.md +13 -0
  22. package/dist/templates/claude/commands/trellis/before-frontend-dev.md +13 -0
  23. package/dist/templates/claude/commands/trellis/check-backend.md +13 -0
  24. package/dist/templates/claude/commands/trellis/check-frontend.md +13 -0
  25. package/dist/templates/claude/commands/trellis/create-command.md +2 -2
  26. package/dist/templates/claude/commands/trellis/onboard.md +13 -13
  27. package/dist/templates/claude/commands/trellis/parallel.md +2 -1
  28. package/dist/templates/claude/commands/trellis/record-session.md +2 -2
  29. package/dist/templates/claude/commands/trellis/start.md +4 -8
  30. package/dist/templates/claude/hooks/inject-subagent-context.py +13 -21
  31. package/dist/templates/claude/hooks/session-start.py +2 -170
  32. package/dist/templates/codex/skills/before-backend-dev/SKILL.md +18 -0
  33. package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +18 -0
  34. package/dist/templates/codex/skills/check-backend/SKILL.md +18 -0
  35. package/dist/templates/codex/skills/check-frontend/SKILL.md +18 -0
  36. package/dist/templates/codex/skills/create-command/SKILL.md +2 -2
  37. package/dist/templates/codex/skills/onboard/SKILL.md +11 -11
  38. package/dist/templates/codex/skills/record-session/SKILL.md +2 -2
  39. package/dist/templates/codex/skills/start/SKILL.md +3 -8
  40. package/dist/templates/cursor/commands/trellis-before-backend-dev.md +13 -0
  41. package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +13 -0
  42. package/dist/templates/cursor/commands/trellis-check-backend.md +13 -0
  43. package/dist/templates/cursor/commands/trellis-check-frontend.md +13 -0
  44. package/dist/templates/cursor/commands/trellis-create-command.md +2 -2
  45. package/dist/templates/cursor/commands/trellis-onboard.md +13 -13
  46. package/dist/templates/cursor/commands/trellis-record-session.md +2 -2
  47. package/dist/templates/cursor/commands/trellis-start.md +16 -7
  48. package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +17 -0
  49. package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +17 -0
  50. package/dist/templates/gemini/commands/trellis/check-backend.toml +17 -0
  51. package/dist/templates/gemini/commands/trellis/check-frontend.toml +17 -0
  52. package/dist/templates/gemini/commands/trellis/create-command.toml +2 -2
  53. package/dist/templates/gemini/commands/trellis/onboard.toml +2 -2
  54. package/dist/templates/gemini/commands/trellis/record-session.toml +2 -2
  55. package/dist/templates/gemini/commands/trellis/start.toml +4 -9
  56. package/dist/templates/iflow/agents/dispatch.md +2 -1
  57. package/dist/templates/iflow/agents/implement.md +3 -2
  58. package/dist/templates/iflow/commands/trellis/before-backend-dev.md +13 -0
  59. package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +13 -0
  60. package/dist/templates/iflow/commands/trellis/check-backend.md +13 -0
  61. package/dist/templates/iflow/commands/trellis/check-frontend.md +13 -0
  62. package/dist/templates/iflow/commands/trellis/create-command.md +2 -2
  63. package/dist/templates/iflow/commands/trellis/onboard.md +13 -13
  64. package/dist/templates/iflow/commands/trellis/parallel.md +2 -1
  65. package/dist/templates/iflow/commands/trellis/record-session.md +2 -2
  66. package/dist/templates/iflow/commands/trellis/start.md +4 -8
  67. package/dist/templates/iflow/hooks/inject-subagent-context.py +13 -21
  68. package/dist/templates/iflow/hooks/session-start.py +1 -156
  69. package/dist/templates/kilo/workflows/before-backend-dev.md +13 -0
  70. package/dist/templates/kilo/workflows/before-frontend-dev.md +13 -0
  71. package/dist/templates/kilo/workflows/check-backend.md +13 -0
  72. package/dist/templates/kilo/workflows/check-frontend.md +13 -0
  73. package/dist/templates/kilo/workflows/create-command.md +2 -2
  74. package/dist/templates/kilo/workflows/onboard.md +13 -13
  75. package/dist/templates/kilo/workflows/parallel.md +2 -1
  76. package/dist/templates/kilo/workflows/record-session.md +2 -2
  77. package/dist/templates/kilo/workflows/start.md +3 -8
  78. package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +18 -0
  79. package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +18 -0
  80. package/dist/templates/kiro/skills/check-backend/SKILL.md +18 -0
  81. package/dist/templates/kiro/skills/check-frontend/SKILL.md +18 -0
  82. package/dist/templates/kiro/skills/create-command/SKILL.md +2 -2
  83. package/dist/templates/kiro/skills/onboard/SKILL.md +11 -11
  84. package/dist/templates/kiro/skills/record-session/SKILL.md +2 -2
  85. package/dist/templates/kiro/skills/start/SKILL.md +3 -8
  86. package/dist/templates/markdown/spec/backend/script-conventions.md +0 -93
  87. package/dist/templates/opencode/agents/dispatch.md +2 -1
  88. package/dist/templates/opencode/agents/implement.md +2 -2
  89. package/dist/templates/opencode/agents/research.md +2 -1
  90. package/dist/templates/opencode/commands/trellis/before-backend-dev.md +13 -0
  91. package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +13 -0
  92. package/dist/templates/opencode/commands/trellis/check-backend.md +13 -0
  93. package/dist/templates/opencode/commands/trellis/check-frontend.md +13 -0
  94. package/dist/templates/opencode/commands/trellis/create-command.md +2 -2
  95. package/dist/templates/opencode/commands/trellis/onboard.md +13 -13
  96. package/dist/templates/opencode/commands/trellis/parallel.md +2 -1
  97. package/dist/templates/opencode/commands/trellis/record-session.md +2 -2
  98. package/dist/templates/opencode/commands/trellis/start.md +3 -8
  99. package/dist/templates/opencode/plugin/inject-subagent-context.js +18 -45
  100. package/dist/templates/opencode/plugin/session-start.js +1 -149
  101. package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +18 -0
  102. package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +18 -0
  103. package/dist/templates/qoder/skills/check-backend/SKILL.md +18 -0
  104. package/dist/templates/qoder/skills/check-frontend/SKILL.md +18 -0
  105. package/dist/templates/qoder/skills/create-command/SKILL.md +2 -2
  106. package/dist/templates/qoder/skills/onboard/SKILL.md +13 -13
  107. package/dist/templates/qoder/skills/record-session/SKILL.md +2 -2
  108. package/dist/templates/qoder/skills/start/SKILL.md +3 -8
  109. package/dist/templates/trellis/config.yaml +0 -20
  110. package/dist/templates/trellis/index.d.ts +0 -11
  111. package/dist/templates/trellis/index.d.ts.map +1 -1
  112. package/dist/templates/trellis/index.js +0 -22
  113. package/dist/templates/trellis/index.js.map +1 -1
  114. package/dist/templates/trellis/scripts/add_session.py +7 -52
  115. package/dist/templates/trellis/scripts/common/cli_adapter.py +45 -33
  116. package/dist/templates/trellis/scripts/common/config.py +0 -152
  117. package/dist/templates/trellis/scripts/common/git_context.py +586 -23
  118. package/dist/templates/trellis/scripts/common/paths.py +0 -46
  119. package/dist/templates/trellis/scripts/common/phase.py +49 -50
  120. package/dist/templates/trellis/scripts/common/registry.py +72 -41
  121. package/dist/templates/trellis/scripts/common/task_queue.py +98 -27
  122. package/dist/templates/trellis/scripts/common/task_utils.py +6 -96
  123. package/dist/templates/trellis/scripts/create_bootstrap.py +26 -31
  124. package/dist/templates/trellis/scripts/multi_agent/cleanup.py +48 -43
  125. package/dist/templates/trellis/scripts/multi_agent/create_pr.py +45 -336
  126. package/dist/templates/trellis/scripts/multi_agent/plan.py +26 -2
  127. package/dist/templates/trellis/scripts/multi_agent/start.py +57 -126
  128. package/dist/templates/trellis/scripts/multi_agent/status.py +753 -12
  129. package/dist/templates/trellis/scripts/task.py +975 -50
  130. package/dist/templates/trellis/workflow.md +34 -21
  131. package/dist/types/migration.d.ts +1 -3
  132. package/dist/types/migration.d.ts.map +1 -1
  133. package/dist/utils/project-detector.d.ts +0 -23
  134. package/dist/utils/project-detector.d.ts.map +1 -1
  135. package/dist/utils/project-detector.js +0 -364
  136. package/dist/utils/project-detector.js.map +1 -1
  137. package/dist/utils/template-fetcher.d.ts +10 -2
  138. package/dist/utils/template-fetcher.d.ts.map +1 -1
  139. package/dist/utils/template-fetcher.js +43 -12
  140. package/dist/utils/template-fetcher.js.map +1 -1
  141. package/package.json +1 -1
  142. package/dist/migrations/manifests/0.4.0-beta.1.json +0 -228
  143. package/dist/templates/claude/commands/trellis/before-dev.md +0 -29
  144. package/dist/templates/claude/commands/trellis/check.md +0 -25
  145. package/dist/templates/codex/skills/before-dev/SKILL.md +0 -34
  146. package/dist/templates/codex/skills/check/SKILL.md +0 -30
  147. package/dist/templates/cursor/commands/trellis-before-dev.md +0 -29
  148. package/dist/templates/cursor/commands/trellis-check.md +0 -25
  149. package/dist/templates/gemini/commands/trellis/before-dev.toml +0 -33
  150. package/dist/templates/gemini/commands/trellis/check.toml +0 -29
  151. package/dist/templates/iflow/commands/trellis/before-dev.md +0 -29
  152. package/dist/templates/iflow/commands/trellis/check.md +0 -25
  153. package/dist/templates/kilo/workflows/before-dev.md +0 -29
  154. package/dist/templates/kilo/workflows/check.md +0 -25
  155. package/dist/templates/kiro/skills/before-dev/SKILL.md +0 -34
  156. package/dist/templates/kiro/skills/check/SKILL.md +0 -30
  157. package/dist/templates/opencode/commands/trellis/before-dev.md +0 -29
  158. package/dist/templates/opencode/commands/trellis/check.md +0 -25
  159. package/dist/templates/qoder/skills/before-dev/SKILL.md +0 -34
  160. package/dist/templates/qoder/skills/check/SKILL.md +0 -30
  161. package/dist/templates/trellis/scripts/common/git.py +0 -31
  162. package/dist/templates/trellis/scripts/common/io.py +0 -37
  163. package/dist/templates/trellis/scripts/common/log.py +0 -45
  164. package/dist/templates/trellis/scripts/common/packages_context.py +0 -233
  165. package/dist/templates/trellis/scripts/common/session_context.py +0 -466
  166. package/dist/templates/trellis/scripts/common/task_context.py +0 -384
  167. package/dist/templates/trellis/scripts/common/task_store.py +0 -534
  168. package/dist/templates/trellis/scripts/common/tasks.py +0 -109
  169. package/dist/templates/trellis/scripts/common/types.py +0 -112
  170. package/dist/templates/trellis/scripts/hooks/linear_sync.py +0 -243
  171. package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +0 -17
  172. package/dist/templates/trellis/scripts/multi_agent/status_display.py +0 -542
  173. package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +0 -225
@@ -1,29 +0,0 @@
1
- description = "Check if the code you just wrote follows the development guidelines"
2
-
3
- prompt = """
4
- Check if the code you just wrote follows the development guidelines.
5
-
6
- Execute these steps:
7
-
8
- 1. **Identify changed files**:
9
- ```bash
10
- git diff --name-only HEAD
11
- ```
12
-
13
- 2. **Determine which spec modules apply** based on the changed file paths:
14
- ```bash
15
- python3 ./.trellis/scripts/get_context.py --mode packages
16
- ```
17
-
18
- 3. **Read the spec index** for each relevant module:
19
- ```bash
20
- cat .trellis/spec/<package>/<layer>/index.md
21
- ```
22
- Follow the **"Quality Check"** section in the index.
23
-
24
- 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.
25
-
26
- 5. **Run lint and typecheck** for the affected package.
27
-
28
- 6. **Report any violations** and fix them if found.
29
- """
@@ -1,29 +0,0 @@
1
- Read the relevant development guidelines before starting your task.
2
-
3
- Execute these steps:
4
-
5
- 1. **Discover packages and their spec layers**:
6
- ```bash
7
- python3 ./.trellis/scripts/get_context.py --mode packages
8
- ```
9
-
10
- 2. **Identify which specs apply** to your task based on:
11
- - Which package you're modifying (e.g., `cli/`, `docs-site/`)
12
- - What type of work (backend, frontend, unit-test, docs, etc.)
13
-
14
- 3. **Read the spec index** for each relevant module:
15
- ```bash
16
- cat .trellis/spec/<package>/<layer>/index.md
17
- ```
18
- Follow the **"Pre-Development Checklist"** section in the index.
19
-
20
- 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.
21
-
22
- 5. **Always read shared guides**:
23
- ```bash
24
- cat .trellis/spec/guides/index.md
25
- ```
26
-
27
- 6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
28
-
29
- This step is **mandatory** before writing any code.
@@ -1,25 +0,0 @@
1
- Check if the code you just wrote follows the development guidelines.
2
-
3
- Execute these steps:
4
-
5
- 1. **Identify changed files**:
6
- ```bash
7
- git diff --name-only HEAD
8
- ```
9
-
10
- 2. **Determine which spec modules apply** based on the changed file paths:
11
- ```bash
12
- python3 ./.trellis/scripts/get_context.py --mode packages
13
- ```
14
-
15
- 3. **Read the spec index** for each relevant module:
16
- ```bash
17
- cat .trellis/spec/<package>/<layer>/index.md
18
- ```
19
- Follow the **"Quality Check"** section in the index.
20
-
21
- 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.
22
-
23
- 5. **Run lint and typecheck** for the affected package.
24
-
25
- 6. **Report any violations** and fix them if found.
@@ -1,29 +0,0 @@
1
- Read the relevant development guidelines before starting your task.
2
-
3
- Execute these steps:
4
-
5
- 1. **Discover packages and their spec layers**:
6
- ```bash
7
- python3 ./.trellis/scripts/get_context.py --mode packages
8
- ```
9
-
10
- 2. **Identify which specs apply** to your task based on:
11
- - Which package you're modifying (e.g., `cli/`, `docs-site/`)
12
- - What type of work (backend, frontend, unit-test, docs, etc.)
13
-
14
- 3. **Read the spec index** for each relevant module:
15
- ```bash
16
- cat .trellis/spec/<package>/<layer>/index.md
17
- ```
18
- Follow the **"Pre-Development Checklist"** section in the index.
19
-
20
- 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.
21
-
22
- 5. **Always read shared guides**:
23
- ```bash
24
- cat .trellis/spec/guides/index.md
25
- ```
26
-
27
- 6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
28
-
29
- This step is **mandatory** before writing any code.
@@ -1,25 +0,0 @@
1
- Check if the code you just wrote follows the development guidelines.
2
-
3
- Execute these steps:
4
-
5
- 1. **Identify changed files**:
6
- ```bash
7
- git diff --name-only HEAD
8
- ```
9
-
10
- 2. **Determine which spec modules apply** based on the changed file paths:
11
- ```bash
12
- python3 ./.trellis/scripts/get_context.py --mode packages
13
- ```
14
-
15
- 3. **Read the spec index** for each relevant module:
16
- ```bash
17
- cat .trellis/spec/<package>/<layer>/index.md
18
- ```
19
- Follow the **"Quality Check"** section in the index.
20
-
21
- 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.
22
-
23
- 5. **Run lint and typecheck** for the affected package.
24
-
25
- 6. **Report any violations** and fix them if found.
@@ -1,34 +0,0 @@
1
- ---
2
- name: before-dev
3
- description: "Read the relevant development guidelines before starting your task."
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,30 +0,0 @@
1
- ---
2
- name: check
3
- description: "Check if the code you just wrote follows the development guidelines."
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,29 +0,0 @@
1
- Read the relevant development guidelines before starting your task.
2
-
3
- Execute these steps:
4
-
5
- 1. **Discover packages and their spec layers**:
6
- ```bash
7
- python3 ./.trellis/scripts/get_context.py --mode packages
8
- ```
9
-
10
- 2. **Identify which specs apply** to your task based on:
11
- - Which package you're modifying (e.g., `cli/`, `docs-site/`)
12
- - What type of work (backend, frontend, unit-test, docs, etc.)
13
-
14
- 3. **Read the spec index** for each relevant module:
15
- ```bash
16
- cat .trellis/spec/<package>/<layer>/index.md
17
- ```
18
- Follow the **"Pre-Development Checklist"** section in the index.
19
-
20
- 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.
21
-
22
- 5. **Always read shared guides**:
23
- ```bash
24
- cat .trellis/spec/guides/index.md
25
- ```
26
-
27
- 6. Understand the coding standards and patterns you need to follow, then proceed with your development plan.
28
-
29
- This step is **mandatory** before writing any code.
@@ -1,25 +0,0 @@
1
- Check if the code you just wrote follows the development guidelines.
2
-
3
- Execute these steps:
4
-
5
- 1. **Identify changed files**:
6
- ```bash
7
- git diff --name-only HEAD
8
- ```
9
-
10
- 2. **Determine which spec modules apply** based on the changed file paths:
11
- ```bash
12
- python3 ./.trellis/scripts/get_context.py --mode packages
13
- ```
14
-
15
- 3. **Read the spec index** for each relevant module:
16
- ```bash
17
- cat .trellis/spec/<package>/<layer>/index.md
18
- ```
19
- Follow the **"Quality Check"** section in the index.
20
-
21
- 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.
22
-
23
- 5. **Run lint and typecheck** for the affected package.
24
-
25
- 6. **Report any violations** and fix them if found.
@@ -1,34 +0,0 @@
1
- ---
2
- name: before-dev
3
- description: "Read the relevant development guidelines before starting your task."
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,30 +0,0 @@
1
- ---
2
- name: check
3
- description: "Check if the code you just wrote follows the development guidelines."
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,31 +0,0 @@
1
- """
2
- Git command execution utility.
3
-
4
- Single source of truth for running git commands across all Trellis scripts.
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- import subprocess
10
- from pathlib import Path
11
-
12
-
13
- def run_git(args: list[str], cwd: Path | None = None) -> tuple[int, str, str]:
14
- """Run a git command and return (returncode, stdout, stderr).
15
-
16
- Uses UTF-8 encoding with -c i18n.logOutputEncoding=UTF-8 to ensure
17
- consistent output across all platforms (Windows, macOS, Linux).
18
- """
19
- try:
20
- git_args = ["git", "-c", "i18n.logOutputEncoding=UTF-8"] + args
21
- result = subprocess.run(
22
- git_args,
23
- cwd=cwd,
24
- capture_output=True,
25
- text=True,
26
- encoding="utf-8",
27
- errors="replace",
28
- )
29
- return result.returncode, result.stdout, result.stderr
30
- except Exception as e:
31
- return 1, "", str(e)
@@ -1,37 +0,0 @@
1
- """
2
- JSON file I/O utilities.
3
-
4
- Provides read_json and write_json as the single source of truth
5
- for JSON file operations across all Trellis scripts.
6
- """
7
-
8
- from __future__ import annotations
9
-
10
- import json
11
- from pathlib import Path
12
-
13
-
14
- def read_json(path: Path) -> dict | None:
15
- """Read and parse a JSON file.
16
-
17
- Returns None if the file doesn't exist, is invalid JSON, or can't be read.
18
- """
19
- try:
20
- return json.loads(path.read_text(encoding="utf-8"))
21
- except (FileNotFoundError, json.JSONDecodeError, OSError):
22
- return None
23
-
24
-
25
- def write_json(path: Path, data: dict) -> bool:
26
- """Write dict to JSON file with pretty formatting.
27
-
28
- Returns True on success, False on error.
29
- """
30
- try:
31
- path.write_text(
32
- json.dumps(data, indent=2, ensure_ascii=False),
33
- encoding="utf-8",
34
- )
35
- return True
36
- except (OSError, IOError):
37
- return False
@@ -1,45 +0,0 @@
1
- """
2
- Terminal output utilities: colors and structured logging.
3
-
4
- Single source of truth for Colors and log_* functions
5
- used across all Trellis scripts.
6
- """
7
-
8
- from __future__ import annotations
9
-
10
-
11
- class Colors:
12
- """ANSI color codes for terminal output."""
13
-
14
- RED = "\033[0;31m"
15
- GREEN = "\033[0;32m"
16
- YELLOW = "\033[1;33m"
17
- BLUE = "\033[0;34m"
18
- CYAN = "\033[0;36m"
19
- DIM = "\033[2m"
20
- NC = "\033[0m" # No Color / Reset
21
-
22
-
23
- def colored(text: str, color: str) -> str:
24
- """Apply ANSI color to text."""
25
- return f"{color}{text}{Colors.NC}"
26
-
27
-
28
- def log_info(msg: str) -> None:
29
- """Print info-level message with [INFO] prefix."""
30
- print(f"{Colors.BLUE}[INFO]{Colors.NC} {msg}")
31
-
32
-
33
- def log_success(msg: str) -> None:
34
- """Print success message with [SUCCESS] prefix."""
35
- print(f"{Colors.GREEN}[SUCCESS]{Colors.NC} {msg}")
36
-
37
-
38
- def log_warn(msg: str) -> None:
39
- """Print warning message with [WARN] prefix."""
40
- print(f"{Colors.YELLOW}[WARN]{Colors.NC} {msg}")
41
-
42
-
43
- def log_error(msg: str) -> None:
44
- """Print error message with [ERROR] prefix."""
45
- print(f"{Colors.RED}[ERROR]{Colors.NC} {msg}")
@@ -1,233 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Package discovery and context output.
4
-
5
- Provides:
6
- get_packages_info - Get structured package info
7
- get_packages_section - Build PACKAGES text section
8
- get_context_packages_text - Full packages text output (--mode packages)
9
- get_context_packages_json - Full packages JSON output (--mode packages --json)
10
- """
11
-
12
- from __future__ import annotations
13
-
14
- from pathlib import Path
15
-
16
- from .config import get_default_package, get_packages, get_spec_scope
17
- from .paths import (
18
- DIR_SPEC,
19
- DIR_WORKFLOW,
20
- get_current_task,
21
- get_repo_root,
22
- )
23
- from .tasks import load_task
24
-
25
-
26
- # =============================================================================
27
- # Internal Helpers
28
- # =============================================================================
29
-
30
- def _scan_spec_layers(spec_dir: Path, package: str | None = None) -> list[str]:
31
- """Scan spec directory for available layers (subdirectories).
32
-
33
- For monorepo: scans spec/<package>/
34
- For single-repo: scans spec/
35
- """
36
- target = spec_dir / package if package else spec_dir
37
- if not target.is_dir():
38
- return []
39
- return sorted(
40
- d.name for d in target.iterdir() if d.is_dir() and d.name != "guides"
41
- )
42
-
43
-
44
- def _get_active_task_package(repo_root: Path) -> str | None:
45
- """Get the package field from the active task's task.json."""
46
- current = get_current_task(repo_root)
47
- if not current:
48
- return None
49
- ct = load_task(repo_root / current)
50
- return ct.package if ct and ct.package else None
51
-
52
-
53
- def _resolve_scope_set(
54
- packages: dict,
55
- spec_scope,
56
- task_pkg: str | None,
57
- default_pkg: str | None,
58
- ) -> set | None:
59
- """Resolve spec_scope to a set of allowed package names, or None for full scan."""
60
- if not packages:
61
- return None
62
-
63
- if spec_scope is None:
64
- return None
65
-
66
- if isinstance(spec_scope, str) and spec_scope == "active_task":
67
- if task_pkg and task_pkg in packages:
68
- return {task_pkg}
69
- if default_pkg and default_pkg in packages:
70
- return {default_pkg}
71
- return None
72
-
73
- if isinstance(spec_scope, list):
74
- valid = {e for e in spec_scope if e in packages}
75
- if valid:
76
- return valid
77
- # All invalid: fallback
78
- if task_pkg and task_pkg in packages:
79
- return {task_pkg}
80
- if default_pkg and default_pkg in packages:
81
- return {default_pkg}
82
- return None
83
-
84
- return None
85
-
86
-
87
- # =============================================================================
88
- # Public Functions
89
- # =============================================================================
90
-
91
- def get_packages_info(repo_root: Path) -> list[dict]:
92
- """Get structured package info for monorepo projects.
93
-
94
- Returns list of dicts with keys: name, path, type, default, specLayers, isSubmodule.
95
- Returns empty list for single-repo projects.
96
- """
97
- packages = get_packages(repo_root)
98
- if not packages:
99
- return []
100
-
101
- default_pkg = get_default_package(repo_root)
102
- spec_dir = repo_root / DIR_WORKFLOW / DIR_SPEC
103
- result = []
104
-
105
- for pkg_name, pkg_config in packages.items():
106
- pkg_path = pkg_config.get("path", pkg_name) if isinstance(pkg_config, dict) else str(pkg_config)
107
- pkg_type = pkg_config.get("type", "local") if isinstance(pkg_config, dict) else "local"
108
- layers = _scan_spec_layers(spec_dir, pkg_name)
109
-
110
- result.append({
111
- "name": pkg_name,
112
- "path": pkg_path,
113
- "type": pkg_type,
114
- "default": pkg_name == default_pkg,
115
- "specLayers": layers,
116
- "isSubmodule": pkg_type == "submodule",
117
- })
118
-
119
- return result
120
-
121
-
122
- def get_packages_section(repo_root: Path) -> str:
123
- """Build the PACKAGES section for text output."""
124
- spec_dir = repo_root / DIR_WORKFLOW / DIR_SPEC
125
- pkg_info = get_packages_info(repo_root)
126
-
127
- lines: list[str] = []
128
- lines.append("## PACKAGES")
129
-
130
- if not pkg_info:
131
- lines.append("(single-repo mode)")
132
- layers = _scan_spec_layers(spec_dir)
133
- if layers:
134
- lines.append(f"Spec layers: {', '.join(layers)}")
135
- return "\n".join(lines)
136
-
137
- default_pkg = get_default_package(repo_root)
138
-
139
- for pkg in pkg_info:
140
- layers_str = f" [{', '.join(pkg['specLayers'])}]" if pkg["specLayers"] else ""
141
- submodule_tag = " (submodule)" if pkg["isSubmodule"] else ""
142
- default_tag = " *" if pkg["default"] else ""
143
- lines.append(
144
- f"- {pkg['name']:<16} {pkg['path']:<20}{layers_str}{submodule_tag}{default_tag}"
145
- )
146
-
147
- if default_pkg:
148
- lines.append(f"Default package: {default_pkg}")
149
-
150
- return "\n".join(lines)
151
-
152
-
153
- def get_context_packages_text(repo_root: Path | None = None) -> str:
154
- """Get packages context as formatted text (for --mode packages)."""
155
- if repo_root is None:
156
- repo_root = get_repo_root()
157
-
158
- pkg_info = get_packages_info(repo_root)
159
- lines: list[str] = []
160
-
161
- if not pkg_info:
162
- spec_dir = repo_root / DIR_WORKFLOW / DIR_SPEC
163
- lines.append("Single-repo project (no packages configured)")
164
- lines.append("")
165
- layers = _scan_spec_layers(spec_dir)
166
- if layers:
167
- lines.append(f"Spec layers: {', '.join(layers)}")
168
- return "\n".join(lines)
169
-
170
- # Resolve scope for annotations
171
- packages_dict = get_packages(repo_root) or {}
172
- default_pkg = get_default_package(repo_root)
173
- spec_scope = get_spec_scope(repo_root)
174
- task_pkg = _get_active_task_package(repo_root)
175
- scope_set = _resolve_scope_set(packages_dict, spec_scope, task_pkg, default_pkg)
176
-
177
- lines.append("## PACKAGES")
178
- lines.append("")
179
- for pkg in pkg_info:
180
- default_tag = " (default)" if pkg["default"] else ""
181
- type_tag = f" [{pkg['type']}]" if pkg["type"] != "local" else ""
182
-
183
- # Scope annotation
184
- scope_tag = ""
185
- if scope_set is not None and pkg["name"] not in scope_set:
186
- scope_tag = " (out of scope)"
187
-
188
- lines.append(f"### {pkg['name']}{default_tag}{type_tag}{scope_tag}")
189
- lines.append(f"Path: {pkg['path']}")
190
- if pkg["specLayers"]:
191
- lines.append(f"Spec layers: {', '.join(pkg['specLayers'])}")
192
- for layer in pkg["specLayers"]:
193
- lines.append(f" - .trellis/spec/{pkg['name']}/{layer}/index.md")
194
- else:
195
- lines.append("Spec: not configured")
196
- lines.append("")
197
-
198
- # Also show shared guides
199
- guides_dir = repo_root / DIR_WORKFLOW / DIR_SPEC / "guides"
200
- if guides_dir.is_dir():
201
- lines.append("### Shared Guides (always included)")
202
- lines.append("Path: .trellis/spec/guides/index.md")
203
- lines.append("")
204
-
205
- return "\n".join(lines)
206
-
207
-
208
- def get_context_packages_json(repo_root: Path | None = None) -> dict:
209
- """Get packages context as a dictionary (for --mode packages --json)."""
210
- if repo_root is None:
211
- repo_root = get_repo_root()
212
-
213
- pkg_info = get_packages_info(repo_root)
214
-
215
- if not pkg_info:
216
- spec_dir = repo_root / DIR_WORKFLOW / DIR_SPEC
217
- layers = _scan_spec_layers(spec_dir)
218
- return {
219
- "mode": "single-repo",
220
- "specLayers": layers,
221
- }
222
-
223
- default_pkg = get_default_package(repo_root)
224
- spec_scope = get_spec_scope(repo_root)
225
- task_pkg = _get_active_task_package(repo_root)
226
-
227
- return {
228
- "mode": "monorepo",
229
- "packages": pkg_info,
230
- "defaultPackage": default_pkg,
231
- "specScope": spec_scope,
232
- "activeTaskPackage": task_pkg,
233
- }