@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.
Files changed (304) hide show
  1. package/README.md +19 -5
  2. package/dist/cli/index.js +5 -0
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +4 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +240 -43
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/update.d.ts.map +1 -1
  9. package/dist/commands/update.js +206 -47
  10. package/dist/commands/update.js.map +1 -1
  11. package/dist/configurators/codebuddy.d.ts +11 -0
  12. package/dist/configurators/codebuddy.d.ts.map +1 -0
  13. package/dist/configurators/codebuddy.js +58 -0
  14. package/dist/configurators/codebuddy.js.map +1 -0
  15. package/dist/configurators/codex.d.ts +7 -4
  16. package/dist/configurators/codex.d.ts.map +1 -1
  17. package/dist/configurators/codex.js +40 -10
  18. package/dist/configurators/codex.js.map +1 -1
  19. package/dist/configurators/copilot.d.ts +9 -0
  20. package/dist/configurators/copilot.d.ts.map +1 -0
  21. package/dist/configurators/copilot.js +34 -0
  22. package/dist/configurators/copilot.js.map +1 -0
  23. package/dist/configurators/index.d.ts +11 -1
  24. package/dist/configurators/index.d.ts.map +1 -1
  25. package/dist/configurators/index.js +72 -4
  26. package/dist/configurators/index.js.map +1 -1
  27. package/dist/configurators/opencode.d.ts +1 -1
  28. package/dist/configurators/opencode.js +1 -1
  29. package/dist/configurators/windsurf.d.ts +8 -0
  30. package/dist/configurators/windsurf.d.ts.map +1 -0
  31. package/dist/configurators/windsurf.js +18 -0
  32. package/dist/configurators/windsurf.js.map +1 -0
  33. package/dist/configurators/workflow.d.ts +6 -2
  34. package/dist/configurators/workflow.d.ts.map +1 -1
  35. package/dist/configurators/workflow.js +90 -58
  36. package/dist/configurators/workflow.js.map +1 -1
  37. package/dist/migrations/index.d.ts +1 -0
  38. package/dist/migrations/index.d.ts.map +1 -1
  39. package/dist/migrations/index.js +2 -0
  40. package/dist/migrations/index.js.map +1 -1
  41. package/dist/migrations/manifests/0.4.0-beta.1.json +228 -0
  42. package/dist/migrations/manifests/0.4.0-beta.10.json +9 -0
  43. package/dist/migrations/manifests/0.4.0-beta.2.json +9 -0
  44. package/dist/migrations/manifests/0.4.0-beta.3.json +9 -0
  45. package/dist/migrations/manifests/0.4.0-beta.4.json +9 -0
  46. package/dist/migrations/manifests/0.4.0-beta.5.json +9 -0
  47. package/dist/migrations/manifests/0.4.0-beta.6.json +9 -0
  48. package/dist/migrations/manifests/0.4.0-beta.7.json +9 -0
  49. package/dist/migrations/manifests/0.4.0-beta.8.json +34 -0
  50. package/dist/migrations/manifests/0.4.0-beta.9.json +9 -0
  51. package/dist/templates/claude/agents/dispatch.md +1 -2
  52. package/dist/templates/claude/agents/implement.md +2 -3
  53. package/dist/templates/claude/commands/trellis/before-dev.md +29 -0
  54. package/dist/templates/claude/commands/trellis/check.md +25 -0
  55. package/dist/templates/claude/commands/trellis/create-command.md +2 -2
  56. package/dist/templates/claude/commands/trellis/onboard.md +13 -13
  57. package/dist/templates/claude/commands/trellis/parallel.md +1 -2
  58. package/dist/templates/claude/commands/trellis/record-session.md +3 -2
  59. package/dist/templates/claude/commands/trellis/start.md +8 -4
  60. package/dist/templates/claude/hooks/inject-subagent-context.py +29 -14
  61. package/dist/templates/claude/hooks/ralph-loop.py +18 -10
  62. package/dist/templates/claude/hooks/session-start.py +201 -9
  63. package/dist/templates/claude/hooks/statusline.py +211 -0
  64. package/dist/templates/claude/settings.json +4 -0
  65. package/dist/templates/codebuddy/commands/trellis/before-dev.md +29 -0
  66. package/dist/templates/codebuddy/commands/trellis/brainstorm.md +487 -0
  67. package/dist/templates/codebuddy/commands/trellis/break-loop.md +107 -0
  68. package/dist/templates/codebuddy/commands/trellis/check-cross-layer.md +153 -0
  69. package/dist/templates/codebuddy/commands/trellis/check.md +25 -0
  70. package/dist/templates/codebuddy/commands/trellis/create-command.md +154 -0
  71. package/dist/templates/codebuddy/commands/trellis/finish-work.md +143 -0
  72. package/dist/templates/codebuddy/commands/trellis/integrate-skill.md +219 -0
  73. package/dist/templates/codebuddy/commands/trellis/onboard.md +358 -0
  74. package/dist/templates/codebuddy/commands/trellis/record-session.md +61 -0
  75. package/dist/templates/codebuddy/commands/trellis/start.md +373 -0
  76. package/dist/templates/codebuddy/commands/trellis/update-spec.md +354 -0
  77. package/dist/templates/codebuddy/index.d.ts +25 -0
  78. package/dist/templates/codebuddy/index.d.ts.map +1 -0
  79. package/dist/templates/codebuddy/index.js +45 -0
  80. package/dist/templates/codebuddy/index.js.map +1 -0
  81. package/dist/templates/codex/agents/check.toml +23 -0
  82. package/dist/templates/codex/agents/implement.toml +19 -0
  83. package/dist/templates/codex/agents/research.toml +26 -0
  84. package/dist/templates/codex/codex-skills/parallel/SKILL.md +194 -0
  85. package/dist/templates/codex/config.toml +5 -0
  86. package/dist/templates/codex/hooks/session-start.py +228 -0
  87. package/dist/templates/codex/hooks.json +16 -0
  88. package/dist/templates/codex/index.d.ts +27 -5
  89. package/dist/templates/codex/index.d.ts.map +1 -1
  90. package/dist/templates/codex/index.js +60 -8
  91. package/dist/templates/codex/index.js.map +1 -1
  92. package/dist/templates/codex/skills/before-dev/SKILL.md +34 -0
  93. package/dist/templates/codex/skills/brainstorm/SKILL.md +1 -1
  94. package/dist/templates/codex/skills/break-loop/SKILL.md +1 -1
  95. package/dist/templates/codex/skills/check/SKILL.md +30 -0
  96. package/dist/templates/codex/skills/check-cross-layer/SKILL.md +1 -1
  97. package/dist/templates/codex/skills/create-command/SKILL.md +3 -3
  98. package/dist/templates/codex/skills/finish-work/SKILL.md +1 -1
  99. package/dist/templates/codex/skills/improve-ut/SKILL.md +69 -0
  100. package/dist/templates/codex/skills/integrate-skill/SKILL.md +1 -1
  101. package/dist/templates/codex/skills/onboard/SKILL.md +12 -12
  102. package/dist/templates/codex/skills/record-session/SKILL.md +4 -3
  103. package/dist/templates/codex/skills/start/SKILL.md +9 -4
  104. package/dist/templates/codex/skills/update-spec/SKILL.md +1 -1
  105. package/dist/templates/copilot/hooks/session-start.py +218 -0
  106. package/dist/templates/copilot/hooks.json +11 -0
  107. package/dist/templates/copilot/index.d.ts +23 -0
  108. package/dist/templates/copilot/index.d.ts.map +1 -0
  109. package/dist/templates/copilot/index.js +54 -0
  110. package/dist/templates/copilot/index.js.map +1 -0
  111. package/dist/templates/copilot/prompts/before-dev.prompt.md +33 -0
  112. package/dist/templates/copilot/prompts/brainstorm.prompt.md +491 -0
  113. package/dist/templates/copilot/prompts/break-loop.prompt.md +129 -0
  114. package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +157 -0
  115. package/dist/templates/copilot/prompts/check.prompt.md +29 -0
  116. package/dist/templates/copilot/prompts/create-command.prompt.md +116 -0
  117. package/dist/templates/copilot/prompts/finish-work.prompt.md +157 -0
  118. package/dist/templates/copilot/prompts/integrate-skill.prompt.md +223 -0
  119. package/dist/templates/copilot/prompts/onboard.prompt.md +362 -0
  120. package/dist/templates/copilot/prompts/parallel.prompt.md +196 -0
  121. package/dist/templates/copilot/prompts/record-session.prompt.md +66 -0
  122. package/dist/templates/copilot/prompts/start.prompt.md +397 -0
  123. package/dist/templates/copilot/prompts/update-spec.prompt.md +358 -0
  124. package/dist/templates/cursor/commands/trellis-before-dev.md +29 -0
  125. package/dist/templates/cursor/commands/trellis-check.md +25 -0
  126. package/dist/templates/cursor/commands/trellis-create-command.md +2 -2
  127. package/dist/templates/cursor/commands/trellis-onboard.md +13 -13
  128. package/dist/templates/cursor/commands/trellis-record-session.md +3 -2
  129. package/dist/templates/cursor/commands/trellis-start.md +7 -16
  130. package/dist/templates/extract.d.ts +36 -0
  131. package/dist/templates/extract.d.ts.map +1 -1
  132. package/dist/templates/extract.js +64 -0
  133. package/dist/templates/extract.js.map +1 -1
  134. package/dist/templates/gemini/commands/trellis/before-dev.toml +33 -0
  135. package/dist/templates/gemini/commands/trellis/check.toml +29 -0
  136. package/dist/templates/gemini/commands/trellis/create-command.toml +2 -2
  137. package/dist/templates/gemini/commands/trellis/onboard.toml +2 -2
  138. package/dist/templates/gemini/commands/trellis/record-session.toml +3 -2
  139. package/dist/templates/gemini/commands/trellis/start.toml +9 -4
  140. package/dist/templates/iflow/agents/dispatch.md +1 -2
  141. package/dist/templates/iflow/agents/implement.md +2 -3
  142. package/dist/templates/iflow/commands/trellis/before-dev.md +29 -0
  143. package/dist/templates/iflow/commands/trellis/check.md +25 -0
  144. package/dist/templates/iflow/commands/trellis/create-command.md +2 -2
  145. package/dist/templates/iflow/commands/trellis/onboard.md +13 -13
  146. package/dist/templates/iflow/commands/trellis/parallel.md +1 -2
  147. package/dist/templates/iflow/commands/trellis/record-session.md +3 -2
  148. package/dist/templates/iflow/commands/trellis/start.md +8 -4
  149. package/dist/templates/iflow/hooks/inject-subagent-context.py +29 -14
  150. package/dist/templates/iflow/hooks/ralph-loop.py +8 -1
  151. package/dist/templates/iflow/hooks/session-start.py +187 -8
  152. package/dist/templates/kilo/workflows/before-dev.md +29 -0
  153. package/dist/templates/kilo/workflows/check.md +25 -0
  154. package/dist/templates/kilo/workflows/create-command.md +2 -2
  155. package/dist/templates/kilo/workflows/onboard.md +13 -13
  156. package/dist/templates/kilo/workflows/parallel.md +1 -2
  157. package/dist/templates/kilo/workflows/record-session.md +3 -2
  158. package/dist/templates/kilo/workflows/start.md +8 -3
  159. package/dist/templates/kiro/skills/before-dev/SKILL.md +34 -0
  160. package/dist/templates/kiro/skills/brainstorm/SKILL.md +1 -1
  161. package/dist/templates/kiro/skills/break-loop/SKILL.md +1 -1
  162. package/dist/templates/kiro/skills/check/SKILL.md +30 -0
  163. package/dist/templates/kiro/skills/check-cross-layer/SKILL.md +1 -1
  164. package/dist/templates/kiro/skills/create-command/SKILL.md +3 -3
  165. package/dist/templates/kiro/skills/finish-work/SKILL.md +1 -1
  166. package/dist/templates/kiro/skills/integrate-skill/SKILL.md +1 -1
  167. package/dist/templates/kiro/skills/onboard/SKILL.md +12 -12
  168. package/dist/templates/kiro/skills/record-session/SKILL.md +4 -3
  169. package/dist/templates/kiro/skills/start/SKILL.md +9 -4
  170. package/dist/templates/kiro/skills/update-spec/SKILL.md +1 -1
  171. package/dist/templates/markdown/agents.md +4 -0
  172. package/dist/templates/markdown/spec/backend/directory-structure.md +1 -1
  173. package/dist/templates/markdown/spec/backend/script-conventions.md +93 -0
  174. package/dist/templates/markdown/workspace-index.md +2 -0
  175. package/dist/templates/opencode/agents/dispatch.md +21 -21
  176. package/dist/templates/opencode/agents/implement.md +2 -2
  177. package/dist/templates/opencode/agents/research.md +1 -2
  178. package/dist/templates/opencode/commands/trellis/before-dev.md +29 -0
  179. package/dist/templates/opencode/commands/trellis/check.md +25 -0
  180. package/dist/templates/opencode/commands/trellis/create-command.md +2 -2
  181. package/dist/templates/opencode/commands/trellis/onboard.md +13 -13
  182. package/dist/templates/opencode/commands/trellis/parallel.md +1 -2
  183. package/dist/templates/opencode/commands/trellis/record-session.md +3 -2
  184. package/dist/templates/opencode/commands/trellis/start.md +8 -3
  185. package/dist/templates/opencode/lib/trellis-context.js +42 -2
  186. package/dist/templates/opencode/{plugin → plugins}/inject-subagent-context.js +45 -18
  187. package/dist/templates/opencode/{plugin → plugins}/session-start.js +156 -28
  188. package/dist/templates/qoder/skills/before-dev/SKILL.md +34 -0
  189. package/dist/templates/qoder/skills/brainstorm/SKILL.md +1 -1
  190. package/dist/templates/qoder/skills/break-loop/SKILL.md +1 -1
  191. package/dist/templates/qoder/skills/check/SKILL.md +30 -0
  192. package/dist/templates/qoder/skills/check-cross-layer/SKILL.md +1 -1
  193. package/dist/templates/qoder/skills/create-command/SKILL.md +3 -3
  194. package/dist/templates/qoder/skills/finish-work/SKILL.md +1 -1
  195. package/dist/templates/qoder/skills/integrate-skill/SKILL.md +1 -1
  196. package/dist/templates/qoder/skills/onboard/SKILL.md +14 -14
  197. package/dist/templates/qoder/skills/record-session/SKILL.md +4 -3
  198. package/dist/templates/qoder/skills/start/SKILL.md +9 -4
  199. package/dist/templates/qoder/skills/update-spec/SKILL.md +1 -1
  200. package/dist/templates/trellis/config.yaml +20 -0
  201. package/dist/templates/trellis/index.d.ts +11 -0
  202. package/dist/templates/trellis/index.d.ts.map +1 -1
  203. package/dist/templates/trellis/index.js +22 -0
  204. package/dist/templates/trellis/index.js.map +1 -1
  205. package/dist/templates/trellis/scripts/add_session.py +111 -13
  206. package/dist/templates/trellis/scripts/common/__init__.py +2 -0
  207. package/dist/templates/trellis/scripts/common/cli_adapter.py +164 -64
  208. package/dist/templates/trellis/scripts/common/config.py +192 -0
  209. package/dist/templates/trellis/scripts/common/developer.py +2 -2
  210. package/dist/templates/trellis/scripts/common/git.py +31 -0
  211. package/dist/templates/trellis/scripts/common/git_context.py +23 -586
  212. package/dist/templates/trellis/scripts/common/io.py +37 -0
  213. package/dist/templates/trellis/scripts/common/log.py +45 -0
  214. package/dist/templates/trellis/scripts/common/packages_context.py +238 -0
  215. package/dist/templates/trellis/scripts/common/paths.py +103 -6
  216. package/dist/templates/trellis/scripts/common/phase.py +50 -49
  217. package/dist/templates/trellis/scripts/common/registry.py +41 -72
  218. package/dist/templates/trellis/scripts/common/session_context.py +562 -0
  219. package/dist/templates/trellis/scripts/common/task_context.py +410 -0
  220. package/dist/templates/trellis/scripts/common/task_queue.py +27 -98
  221. package/dist/templates/trellis/scripts/common/task_store.py +536 -0
  222. package/dist/templates/trellis/scripts/common/task_utils.py +106 -10
  223. package/dist/templates/trellis/scripts/common/tasks.py +109 -0
  224. package/dist/templates/trellis/scripts/common/types.py +112 -0
  225. package/dist/templates/trellis/scripts/create_bootstrap.py +32 -27
  226. package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
  227. package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +17 -0
  228. package/dist/templates/trellis/scripts/multi_agent/cleanup.py +43 -48
  229. package/dist/templates/trellis/scripts/multi_agent/create_pr.py +336 -45
  230. package/dist/templates/trellis/scripts/multi_agent/plan.py +9 -32
  231. package/dist/templates/trellis/scripts/multi_agent/start.py +142 -68
  232. package/dist/templates/trellis/scripts/multi_agent/status.py +12 -753
  233. package/dist/templates/trellis/scripts/multi_agent/status_display.py +542 -0
  234. package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +225 -0
  235. package/dist/templates/trellis/scripts/task.py +51 -976
  236. package/dist/templates/trellis/scripts-shell-archive/create-bootstrap.sh +1 -1
  237. package/dist/templates/trellis/workflow.md +38 -38
  238. package/dist/templates/windsurf/index.d.ts +21 -0
  239. package/dist/templates/windsurf/index.d.ts.map +1 -0
  240. package/dist/templates/windsurf/index.js +44 -0
  241. package/dist/templates/windsurf/index.js.map +1 -0
  242. package/dist/templates/windsurf/workflows/trellis-before-dev.md +31 -0
  243. package/dist/templates/windsurf/workflows/trellis-brainstorm.md +491 -0
  244. package/dist/templates/windsurf/workflows/trellis-break-loop.md +111 -0
  245. package/dist/templates/windsurf/workflows/trellis-check-cross-layer.md +157 -0
  246. package/dist/templates/windsurf/workflows/trellis-check.md +27 -0
  247. package/dist/templates/windsurf/workflows/trellis-create-command.md +154 -0
  248. package/dist/templates/windsurf/workflows/trellis-finish-work.md +147 -0
  249. package/dist/templates/windsurf/workflows/trellis-integrate-skill.md +220 -0
  250. package/dist/templates/windsurf/workflows/trellis-onboard.md +362 -0
  251. package/dist/templates/windsurf/workflows/trellis-record-session.md +66 -0
  252. package/dist/templates/windsurf/workflows/trellis-start.md +373 -0
  253. package/dist/templates/windsurf/workflows/trellis-update-spec.md +358 -0
  254. package/dist/types/ai-tools.d.ts +15 -3
  255. package/dist/types/ai-tools.d.ts.map +1 -1
  256. package/dist/types/ai-tools.js +42 -2
  257. package/dist/types/ai-tools.js.map +1 -1
  258. package/dist/types/migration.d.ts +3 -1
  259. package/dist/types/migration.d.ts.map +1 -1
  260. package/dist/utils/project-detector.d.ts +28 -0
  261. package/dist/utils/project-detector.d.ts.map +1 -1
  262. package/dist/utils/project-detector.js +371 -0
  263. package/dist/utils/project-detector.js.map +1 -1
  264. package/dist/utils/template-fetcher.d.ts +19 -6
  265. package/dist/utils/template-fetcher.d.ts.map +1 -1
  266. package/dist/utils/template-fetcher.js +99 -17
  267. package/dist/utils/template-fetcher.js.map +1 -1
  268. package/package.json +1 -1
  269. package/dist/templates/claude/commands/trellis/before-backend-dev.md +0 -13
  270. package/dist/templates/claude/commands/trellis/before-frontend-dev.md +0 -13
  271. package/dist/templates/claude/commands/trellis/check-backend.md +0 -13
  272. package/dist/templates/claude/commands/trellis/check-frontend.md +0 -13
  273. package/dist/templates/codex/skills/before-backend-dev/SKILL.md +0 -18
  274. package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +0 -18
  275. package/dist/templates/codex/skills/check-backend/SKILL.md +0 -18
  276. package/dist/templates/codex/skills/check-frontend/SKILL.md +0 -18
  277. package/dist/templates/cursor/commands/trellis-before-backend-dev.md +0 -13
  278. package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +0 -13
  279. package/dist/templates/cursor/commands/trellis-check-backend.md +0 -13
  280. package/dist/templates/cursor/commands/trellis-check-frontend.md +0 -13
  281. package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +0 -17
  282. package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +0 -17
  283. package/dist/templates/gemini/commands/trellis/check-backend.toml +0 -17
  284. package/dist/templates/gemini/commands/trellis/check-frontend.toml +0 -17
  285. package/dist/templates/iflow/commands/trellis/before-backend-dev.md +0 -13
  286. package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +0 -13
  287. package/dist/templates/iflow/commands/trellis/check-backend.md +0 -13
  288. package/dist/templates/iflow/commands/trellis/check-frontend.md +0 -13
  289. package/dist/templates/kilo/workflows/before-backend-dev.md +0 -13
  290. package/dist/templates/kilo/workflows/before-frontend-dev.md +0 -13
  291. package/dist/templates/kilo/workflows/check-backend.md +0 -13
  292. package/dist/templates/kilo/workflows/check-frontend.md +0 -13
  293. package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +0 -18
  294. package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +0 -18
  295. package/dist/templates/kiro/skills/check-backend/SKILL.md +0 -18
  296. package/dist/templates/kiro/skills/check-frontend/SKILL.md +0 -18
  297. package/dist/templates/opencode/commands/trellis/before-backend-dev.md +0 -13
  298. package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +0 -13
  299. package/dist/templates/opencode/commands/trellis/check-backend.md +0 -13
  300. package/dist/templates/opencode/commands/trellis/check-frontend.md +0 -13
  301. package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +0 -18
  302. package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +0 -18
  303. package/dist/templates/qoder/skills/check-backend/SKILL.md +0 -18
  304. package/dist/templates/qoder/skills/check-frontend/SKILL.md +0 -18
@@ -183,4 +183,375 @@ export function getProjectTypeDescription(type) {
183
183
  return "Unknown project type (defaults to fullstack)";
184
184
  }
185
185
  }
186
+ /**
187
+ * Sanitize a package name for use as a directory name.
188
+ * Strips npm scope prefix (@scope/) so "@zhubao/desktop" becomes "desktop".
189
+ */
190
+ export function sanitizePkgName(name) {
191
+ return name.replace(/^@[^/]+\//, "");
192
+ }
193
+ /**
194
+ * Normalize a package path: strip ./ prefix, trailing /, unify separators.
195
+ */
196
+ function normalizePkgPath(p) {
197
+ return p.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
198
+ }
199
+ /**
200
+ * Check if a relative path is an existing directory.
201
+ */
202
+ function dirExists(cwd, relPath) {
203
+ try {
204
+ return fs.statSync(path.join(cwd, relPath)).isDirectory();
205
+ }
206
+ catch {
207
+ return false;
208
+ }
209
+ }
210
+ // --- Glob expansion for workspace patterns ---
211
+ /**
212
+ * Expand workspace glob patterns (e.g. "packages/*") into actual directory paths.
213
+ * Supports ! prefix for exclusion patterns.
214
+ */
215
+ function expandWorkspaceGlobs(cwd, patterns) {
216
+ const included = [];
217
+ const excluded = new Set();
218
+ for (const raw of patterns) {
219
+ const isExclude = raw.startsWith("!");
220
+ const pattern = normalizePkgPath(isExclude ? raw.slice(1) : raw);
221
+ const dirs = pattern.includes("*")
222
+ ? matchGlobSegments(cwd, pattern.split("/"), 0, "")
223
+ : dirExists(cwd, pattern)
224
+ ? [pattern]
225
+ : [];
226
+ for (const d of dirs) {
227
+ if (isExclude)
228
+ excluded.add(d);
229
+ else
230
+ included.push(d);
231
+ }
232
+ }
233
+ return included.filter((p) => !excluded.has(p));
234
+ }
235
+ /**
236
+ * Recursively match glob segments against the filesystem.
237
+ * Handles * as a single-level directory wildcard.
238
+ */
239
+ function matchGlobSegments(cwd, segments, index, current) {
240
+ if (index >= segments.length) {
241
+ return dirExists(cwd, current) ? [current] : [];
242
+ }
243
+ const seg = segments[index];
244
+ if (seg !== "*") {
245
+ const next = current ? `${current}/${seg}` : seg;
246
+ return matchGlobSegments(cwd, segments, index + 1, next);
247
+ }
248
+ // Wildcard: match all direct subdirectories
249
+ const dir = current ? path.join(cwd, current) : cwd;
250
+ try {
251
+ return fs
252
+ .readdirSync(dir, { withFileTypes: true })
253
+ .filter((e) => e.isDirectory() && !e.name.startsWith("."))
254
+ .flatMap((e) => {
255
+ const next = current ? `${current}/${e.name}` : e.name;
256
+ return matchGlobSegments(cwd, segments, index + 1, next);
257
+ });
258
+ }
259
+ catch {
260
+ return [];
261
+ }
262
+ }
263
+ // --- Package name reading ---
264
+ /**
265
+ * Read a package name from various config files in the package directory.
266
+ * Falls back to directory name.
267
+ */
268
+ function readPackageName(cwd, pkgPath) {
269
+ const absPath = path.join(cwd, pkgPath);
270
+ // package.json
271
+ try {
272
+ const pjson = JSON.parse(fs.readFileSync(path.join(absPath, "package.json"), "utf-8"));
273
+ if (pjson.name)
274
+ return pjson.name;
275
+ }
276
+ catch {
277
+ /* continue */
278
+ }
279
+ // Cargo.toml [package] name
280
+ try {
281
+ const cargo = fs.readFileSync(path.join(absPath, "Cargo.toml"), "utf-8");
282
+ const match = cargo.match(/\[package\][\s\S]*?name\s*=\s*"([^"]+)"/);
283
+ if (match)
284
+ return match[1];
285
+ }
286
+ catch {
287
+ /* continue */
288
+ }
289
+ // go.mod module name
290
+ try {
291
+ const gomod = fs.readFileSync(path.join(absPath, "go.mod"), "utf-8");
292
+ const match = gomod.match(/^module\s+(\S+)/m);
293
+ if (match)
294
+ return match[1].split("/").pop() ?? path.basename(pkgPath);
295
+ }
296
+ catch {
297
+ /* continue */
298
+ }
299
+ // pyproject.toml [project] name
300
+ try {
301
+ const pyproj = fs.readFileSync(path.join(absPath, "pyproject.toml"), "utf-8");
302
+ const match = pyproj.match(/\[project\][\s\S]*?name\s*=\s*"([^"]+)"/);
303
+ if (match)
304
+ return match[1];
305
+ }
306
+ catch {
307
+ /* continue */
308
+ }
309
+ return path.basename(pkgPath);
310
+ }
311
+ // --- Workspace format parsers ---
312
+ /** Parse pnpm-workspace.yaml packages list */
313
+ function parsePnpmWorkspace(cwd) {
314
+ try {
315
+ const content = fs.readFileSync(path.join(cwd, "pnpm-workspace.yaml"), "utf-8");
316
+ const patterns = [];
317
+ let inPackages = false;
318
+ for (const line of content.split("\n")) {
319
+ const trimmed = line.trim();
320
+ if (/^packages\s*:/.test(trimmed)) {
321
+ inPackages = true;
322
+ continue;
323
+ }
324
+ if (inPackages) {
325
+ if (trimmed.startsWith("- ")) {
326
+ patterns.push(trimmed
327
+ .slice(2)
328
+ .trim()
329
+ .replace(/^['"]|['"]$/g, ""));
330
+ }
331
+ else if (trimmed && !trimmed.startsWith("#")) {
332
+ break;
333
+ }
334
+ }
335
+ }
336
+ return patterns.length > 0 ? patterns : null;
337
+ }
338
+ catch {
339
+ return null;
340
+ }
341
+ }
342
+ /** Parse package.json workspaces (array or yarn v1 object form) */
343
+ function parseNpmWorkspaces(cwd) {
344
+ try {
345
+ const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf-8"));
346
+ const ws = pkg.workspaces;
347
+ if (!ws)
348
+ return null;
349
+ if (Array.isArray(ws))
350
+ return ws;
351
+ if (ws.packages && Array.isArray(ws.packages))
352
+ return ws.packages;
353
+ return null;
354
+ }
355
+ catch {
356
+ return null;
357
+ }
358
+ }
359
+ /**
360
+ * Parse a TOML inline array from a specific section.
361
+ * Handles both single-line and multi-line arrays.
362
+ */
363
+ function parseTomlArray(content, key, sectionHeader) {
364
+ const sectionIdx = content.indexOf(sectionHeader);
365
+ if (sectionIdx === -1)
366
+ return null;
367
+ const afterSection = content.slice(sectionIdx + sectionHeader.length);
368
+ const nextSection = afterSection.search(/^\[[^[]/m);
369
+ const sectionContent = nextSection === -1 ? afterSection : afterSection.slice(0, nextSection);
370
+ const keyPattern = new RegExp(`${key}\\s*=\\s*\\[`);
371
+ const keyMatch = sectionContent.match(keyPattern);
372
+ if (keyMatch?.index === undefined)
373
+ return null;
374
+ const startIdx = keyMatch.index + keyMatch[0].length;
375
+ const endIdx = sectionContent.indexOf("]", startIdx);
376
+ if (endIdx === -1)
377
+ return null;
378
+ return sectionContent
379
+ .slice(startIdx, endIdx)
380
+ .split(/[,\n]/)
381
+ .map((s) => s.trim().replace(/^["']|["']$/g, ""))
382
+ .filter((s) => s && !s.startsWith("#"));
383
+ }
384
+ /** Parse Cargo.toml workspace members and exclude */
385
+ function parseCargoWorkspace(cwd) {
386
+ try {
387
+ const content = fs.readFileSync(path.join(cwd, "Cargo.toml"), "utf-8");
388
+ if (!/^\[workspace\]\s*$/m.test(content))
389
+ return null;
390
+ const members = parseTomlArray(content, "members", "[workspace]");
391
+ if (!members)
392
+ return null;
393
+ const exclude = parseTomlArray(content, "exclude", "[workspace]") ?? [];
394
+ return { members, exclude };
395
+ }
396
+ catch {
397
+ return null;
398
+ }
399
+ }
400
+ /** Parse go.work use directives (block and single-line forms) */
401
+ function parseGoWork(cwd) {
402
+ try {
403
+ const content = fs.readFileSync(path.join(cwd, "go.work"), "utf-8");
404
+ const paths = [];
405
+ // Block form: use ( ... )
406
+ const blockMatch = content.match(/use\s*\(([\s\S]*?)\)/);
407
+ if (blockMatch) {
408
+ for (const line of blockMatch[1].split("\n")) {
409
+ const trimmed = line.trim();
410
+ if (trimmed && !trimmed.startsWith("//")) {
411
+ paths.push(trimmed);
412
+ }
413
+ }
414
+ }
415
+ // Single-line form: use ./path
416
+ for (const match of content.matchAll(/^use\s+(\S+)\s*$/gm)) {
417
+ if (!match[1].startsWith("(")) {
418
+ paths.push(match[1]);
419
+ }
420
+ }
421
+ return paths.length > 0 ? paths : null;
422
+ }
423
+ catch {
424
+ return null;
425
+ }
426
+ }
427
+ /** Parse pyproject.toml [tool.uv.workspace] members */
428
+ function parseUvWorkspace(cwd) {
429
+ try {
430
+ const content = fs.readFileSync(path.join(cwd, "pyproject.toml"), "utf-8");
431
+ if (!content.includes("[tool.uv.workspace]"))
432
+ return null;
433
+ return parseTomlArray(content, "members", "[tool.uv.workspace]");
434
+ }
435
+ catch {
436
+ return null;
437
+ }
438
+ }
439
+ /** Parse .gitmodules for submodule names and paths */
440
+ function parseGitmodules(cwd) {
441
+ try {
442
+ const content = fs.readFileSync(path.join(cwd, ".gitmodules"), "utf-8");
443
+ const modules = [];
444
+ let currentName = "";
445
+ for (const line of content.split("\n")) {
446
+ const trimmed = line.trim();
447
+ const headerMatch = trimmed.match(/^\[submodule\s+"([^"]+)"]/);
448
+ if (headerMatch) {
449
+ currentName = headerMatch[1];
450
+ continue;
451
+ }
452
+ const pathMatch = trimmed.match(/^path\s*=\s*(.+)/);
453
+ if (pathMatch && currentName) {
454
+ modules.push({ name: currentName, path: pathMatch[1].trim() });
455
+ }
456
+ }
457
+ return modules.length > 0 ? modules : null;
458
+ }
459
+ catch {
460
+ return null;
461
+ }
462
+ }
463
+ // --- Main monorepo detection ---
464
+ /**
465
+ * Detect monorepo workspace configuration and enumerate packages.
466
+ *
467
+ * Checks workspace managers in priority order (pnpm → npm/yarn/bun → Cargo → Go → uv),
468
+ * merges results, and marks git submodules. Returns null if no monorepo detected.
469
+ *
470
+ * @param cwd - Repository root to analyze
471
+ * @returns Array of detected packages, null if not a monorepo, empty array if config exists but no packages found
472
+ */
473
+ export function detectMonorepo(cwd) {
474
+ const packages = new Map();
475
+ let detected = false;
476
+ // 1. Parse .gitmodules first to build submodule path set
477
+ const submodulePaths = new Map();
478
+ const gitmodules = parseGitmodules(cwd);
479
+ if (gitmodules) {
480
+ detected = true;
481
+ for (const mod of gitmodules) {
482
+ const np = normalizePkgPath(mod.path);
483
+ if (np && np !== ".") {
484
+ submodulePaths.set(np, mod.name);
485
+ }
486
+ }
487
+ }
488
+ // 2. Try workspace managers in priority order
489
+ const workspaceParsers = [
490
+ () => {
491
+ const p = parsePnpmWorkspace(cwd);
492
+ return p ? expandWorkspaceGlobs(cwd, p) : null;
493
+ },
494
+ () => {
495
+ const p = parseNpmWorkspaces(cwd);
496
+ return p ? expandWorkspaceGlobs(cwd, p) : null;
497
+ },
498
+ () => {
499
+ const r = parseCargoWorkspace(cwd);
500
+ if (!r)
501
+ return null;
502
+ const inc = expandWorkspaceGlobs(cwd, r.members);
503
+ const exc = new Set(expandWorkspaceGlobs(cwd, r.exclude));
504
+ return inc.filter((p) => !exc.has(p));
505
+ },
506
+ () => {
507
+ const p = parseGoWork(cwd);
508
+ if (!p)
509
+ return null;
510
+ return p
511
+ .map(normalizePkgPath)
512
+ .filter((d) => d && d !== "." && dirExists(cwd, d));
513
+ },
514
+ () => {
515
+ const p = parseUvWorkspace(cwd);
516
+ return p ? expandWorkspaceGlobs(cwd, p) : null;
517
+ },
518
+ ];
519
+ for (const parse of workspaceParsers) {
520
+ const dirs = parse();
521
+ if (!dirs)
522
+ continue;
523
+ detected = true;
524
+ for (const dir of dirs) {
525
+ const np = normalizePkgPath(dir);
526
+ if (!np || np === ".")
527
+ continue;
528
+ if (packages.has(np))
529
+ continue;
530
+ packages.set(np, {
531
+ name: readPackageName(cwd, np),
532
+ path: np,
533
+ type: dirExists(cwd, np)
534
+ ? detectProjectType(path.join(cwd, np))
535
+ : "unknown",
536
+ isSubmodule: submodulePaths.has(np),
537
+ });
538
+ }
539
+ }
540
+ // 3. Add submodule-only packages not already covered by workspace managers
541
+ for (const [np, name] of submodulePaths) {
542
+ if (packages.has(np))
543
+ continue;
544
+ packages.set(np, {
545
+ name,
546
+ path: np,
547
+ type: dirExists(cwd, np)
548
+ ? detectProjectType(path.join(cwd, np))
549
+ : "unknown",
550
+ isSubmodule: true,
551
+ });
552
+ }
553
+ if (!detected)
554
+ return null;
555
+ return Array.from(packages.values());
556
+ }
186
557
  //# sourceMappingURL=project-detector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project-detector.js","sourceRoot":"","sources":["../../src/utils/project-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAO7B;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC1B,sCAAsC;IACtC,cAAc,EAAE,uCAAuC;IACvD,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,kBAAkB;IAClB,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,qBAAqB;IACrB,aAAa;IACb,aAAa;IACb,aAAa;IACb,kBAAkB;IAClB,cAAc;IACd,iBAAiB;IACjB,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,kBAAkB,GAAG;IACzB,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,kBAAkB;IAClB,gBAAgB;IAChB,UAAU;IACV,SAAS;IACT,aAAa;IACb,cAAc;IACd,SAAS;IACT,cAAc;IACd,kBAAkB;IAClB,OAAO;IACP,SAAS;IACT,MAAM;IACN,eAAe;IACf,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,6BAA6B;IAC7B,WAAW;IACX,WAAW;IACX,eAAe;IACf,cAAc,EAAE,yBA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AAI,EAAE,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC;gBAC9B,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC;oBACtB,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;oBACvC,CAAC,CAAC,SAAS;gBACb,WAAW,EAAE,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;aACpC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,KAAK,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,cAAc,EAAE,CAAC;QACxC,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,SAAS;QAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE;YACf,IAAI;YACJ,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC;gBACtB,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBACvC,CAAC,CAAC,SAAS;YACb,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;AACvC,CAAC"}
@@ -2,9 +2,9 @@
2
2
  * Remote template fetcher for Trellis CLI
3
3
  *
4
4
  * Fetches spec templates from the official marketplace:
5
- * https://github.com/mindfold-ai/Trellis/tree/main/marketplace
5
+ * https://github.com/mindfold-ai/marketplace
6
6
  */
7
- export declare const TEMPLATE_INDEX_URL = "https://raw.githubusercontent.com/mindfold-ai/Trellis/main/marketplace/index.json";
7
+ export declare const TEMPLATE_INDEX_URL = "https://raw.githubusercontent.com/mindfold-ai/marketplace/main/index.json";
8
8
  /** Timeout constants for network operations */
9
9
  export declare const TIMEOUTS: {
10
10
  /** Timeout for fetching the template index (ms) */
@@ -34,6 +34,8 @@ export interface RegistrySource {
34
34
  rawBaseUrl: string;
35
35
  /** Full giget source string for downloading */
36
36
  gigetSource: string;
37
+ /** Custom host for self-hosted instances (e.g., "git.company.com"). Undefined for public providers. */
38
+ host?: string;
37
39
  }
38
40
  export declare const SUPPORTED_PROVIDERS: string[];
39
41
  /**
@@ -46,9 +48,20 @@ export declare function normalizeRegistrySource(source: string): string;
46
48
  /**
47
49
  * Parse a giget-style registry source into its components.
48
50
  *
49
- * Supports: gh:user/repo/subdir#ref, gitlab:user/repo/subdir, bitbucket:user/repo/subdir
50
- * Also accepts HTTPS URLs which are auto-converted (e.g. https://github.com/user/repo).
51
+ * Supported input formats:
52
+ * | Format | Example | Provider | Host? |
53
+ * |-------------------------------------|----------------------------------------------|-----------|-----------|
54
+ * | giget prefix | gh:org/repo, gitlab:org/repo#ref | native | no |
55
+ * | Public HTTPS | https://github.com/org/repo | native | no |
56
+ * | Public SSH | git@github.com:org/repo | native | no |
57
+ * | Self-hosted HTTPS | https://git.corp.com/org/repo | gitlab | yes |
58
+ * | Self-hosted SSH | git@git.corp.com:org/repo | gitlab | yes |
59
+ * | ssh:// protocol (with/without port) | ssh://git@host:2222/org/repo | gitlab | yes |
60
+ * | HTTPS with port | https://host:8443/org/repo | gitlab | yes |
61
+ * | GitLab browse URL | https://host/org/repo/-/tree/branch/path | gitlab | yes |
62
+ *
51
63
  * Ref defaults to "main" if not specified.
64
+ * Unknown domains default to GitLab URL patterns (covers self-hosted GitLab CE/EE).
52
65
  *
53
66
  * @throws Error if provider is unsupported
54
67
  */
@@ -104,7 +117,7 @@ export declare function downloadWithStrategy(templatePath: string, destDir: stri
104
117
  * repo as the giget source instead of the default TEMPLATE_REPO.
105
118
  * @returns Object with success status and message
106
119
  */
107
- export declare function downloadTemplateById(cwd: string, templateId: string, strategy: TemplateStrategy, template?: SpecTemplate, registry?: RegistrySource): Promise<{
120
+ export declare function downloadTemplateById(cwd: string, templateId: string, strategy: TemplateStrategy, template?: SpecTemplate, registry?: RegistrySource, destDirOverride?: string): Promise<{
108
121
  success: boolean;
109
122
  message: string;
110
123
  skipped?: boolean;
@@ -113,7 +126,7 @@ export declare function downloadTemplateById(cwd: string, templateId: string, st
113
126
  * Download a registry source directly to the spec directory (no index.json).
114
127
  * Used when the registry source points to a spec directory, not a marketplace.
115
128
  */
116
- export declare function downloadRegistryDirect(cwd: string, registry: RegistrySource, strategy: TemplateStrategy): Promise<{
129
+ export declare function downloadRegistryDirect(cwd: string, registry: RegistrySource, strategy: TemplateStrategy, destDirOverride?: string): Promise<{
117
130
  success: boolean;
118
131
  message: string;
119
132
  skipped?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"template-fetcher.d.ts","sourceRoot":"","sources":["../../src/utils/template-fetcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,eAAO,MAAM,kBAAkB,sFACsD,CAAC;AAYtF,+CAA+C;AAC/C,eAAO,MAAM,QAAQ;IACnB,mDAAmD;;IAEnD,wDAAwD;;CAEhD,CAAC;AAMX,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAOD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,QAAQ,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,UAAU,E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