@blulotus/trellis 0.7.0 → 0.7.1

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 (335) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/index.js +2 -29
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/init.d.ts +0 -22
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +5 -12
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/mem.d.ts +2 -2
  9. package/dist/commands/mem.d.ts.map +1 -1
  10. package/dist/commands/mem.js +7 -40
  11. package/dist/commands/mem.js.map +1 -1
  12. package/dist/commands/uninstall.d.ts +1 -1
  13. package/dist/commands/uninstall.d.ts.map +1 -1
  14. package/dist/commands/uninstall.js +4 -34
  15. package/dist/commands/uninstall.js.map +1 -1
  16. package/dist/commands/update.d.ts.map +1 -1
  17. package/dist/commands/update.js +2 -20
  18. package/dist/commands/update.js.map +1 -1
  19. package/dist/configurators/index.d.ts.map +1 -1
  20. package/dist/configurators/index.js +7 -73
  21. package/dist/configurators/index.js.map +1 -1
  22. package/dist/configurators/shared.d.ts +18 -70
  23. package/dist/configurators/shared.d.ts.map +1 -1
  24. package/dist/configurators/shared.js +20 -299
  25. package/dist/configurators/shared.js.map +1 -1
  26. package/dist/migrations/manifests/0.1.9.json +0 -12
  27. package/dist/migrations/manifests/0.2.14.json +0 -84
  28. package/dist/migrations/manifests/0.3.0-beta.0.json +0 -87
  29. package/dist/migrations/manifests/0.3.4.json +1 -13
  30. package/dist/migrations/manifests/0.4.0-beta.1.json +24 -176
  31. package/dist/migrations/manifests/0.5.0-beta.0.json +67 -1203
  32. package/dist/migrations/manifests/0.5.0-beta.15.json +0 -96
  33. package/dist/migrations/manifests/0.5.0-beta.5.json +0 -168
  34. package/dist/migrations/manifests/0.5.0-beta.9.json +0 -20
  35. package/dist/migrations/manifests/0.6.0-beta.23.json +0 -66
  36. package/dist/migrations/manifests/0.6.3.json +1 -16
  37. package/dist/migrations/manifests/0.6.6.json +1 -9
  38. package/dist/migrations/manifests/0.7.0.json +9 -0
  39. package/dist/migrations/manifests/0.7.1.json +9 -0
  40. package/dist/migrations/manifests/0.8.0.json +9 -0
  41. package/dist/templates/codex/hooks/session-start.py +37 -13
  42. package/dist/templates/codex/hooks.json +5 -0
  43. package/dist/templates/common/bundled-skills/trellis-meta/SKILL.md +5 -5
  44. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-agents.md +0 -10
  45. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-hooks.md +1 -1
  46. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/change-skills-or-commands.md +1 -13
  47. package/dist/templates/common/bundled-skills/trellis-meta/references/customize-local/overview.md +2 -2
  48. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/bundled-skills.md +9 -28
  49. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/generated-files.md +5 -5
  50. package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/overview.md +1 -1
  51. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/agents.md +1 -17
  52. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +4 -12
  53. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/overview.md +6 -6
  54. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/platform-map.md +5 -75
  55. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/skills-and-commands.md +0 -16
  56. package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +1 -1
  57. package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +2 -3
  58. package/dist/templates/common/commands/continue.md +24 -4
  59. package/dist/templates/common/commands/finish-work.md +19 -9
  60. package/dist/templates/common/commands/start.md +38 -29
  61. package/dist/templates/extract.d.ts +0 -10
  62. package/dist/templates/extract.d.ts.map +1 -1
  63. package/dist/templates/extract.js +0 -24
  64. package/dist/templates/extract.js.map +1 -1
  65. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +7 -9
  66. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +4 -8
  67. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +5 -5
  68. package/dist/templates/shared-hooks/index.d.ts +11 -43
  69. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  70. package/dist/templates/shared-hooks/index.js +9 -86
  71. package/dist/templates/shared-hooks/index.js.map +1 -1
  72. package/dist/templates/shared-hooks/inject-spec-context.py +1 -1
  73. package/dist/templates/shared-hooks/inject-subagent-context.py +23 -85
  74. package/dist/templates/shared-hooks/inject-workflow-state.py +56 -86
  75. package/dist/templates/shared-hooks/session-start.py +76 -98
  76. package/dist/templates/trellis/index.d.ts +0 -1
  77. package/dist/templates/trellis/index.d.ts.map +1 -1
  78. package/dist/templates/trellis/index.js +0 -2
  79. package/dist/templates/trellis/index.js.map +1 -1
  80. package/dist/templates/trellis/scripts/add_session.py +4 -4
  81. package/dist/templates/trellis/scripts/common/__init__.py +2 -0
  82. package/dist/templates/trellis/scripts/common/active_task.py +80 -152
  83. package/dist/templates/trellis/scripts/common/git_context.py +1 -1
  84. package/dist/templates/trellis/scripts/common/session_context.py +2 -2
  85. package/dist/templates/trellis/scripts/common/spec_inject.py +2 -2
  86. package/dist/templates/trellis/scripts/common/task_store.py +8 -28
  87. package/dist/templates/trellis/scripts/common/workflow_phase.py +4 -8
  88. package/dist/templates/trellis/scripts/get_context.py +2 -2
  89. package/dist/templates/trellis/scripts/init_developer.py +1 -1
  90. package/dist/templates/trellis/scripts/task.py +90 -57
  91. package/dist/templates/trellis/workflow.md +44 -66
  92. package/dist/types/ai-tools.d.ts +10 -10
  93. package/dist/types/ai-tools.d.ts.map +1 -1
  94. package/dist/types/ai-tools.js +3 -434
  95. package/dist/types/ai-tools.js.map +1 -1
  96. package/dist/utils/uninstall-scrubbers.d.ts +3 -18
  97. package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
  98. package/dist/utils/uninstall-scrubbers.js +24 -154
  99. package/dist/utils/uninstall-scrubbers.js.map +1 -1
  100. package/package.json +2 -2
  101. package/dist/configurators/antigravity.d.ts +0 -7
  102. package/dist/configurators/antigravity.d.ts.map +0 -1
  103. package/dist/configurators/antigravity.js +0 -11
  104. package/dist/configurators/antigravity.js.map +0 -1
  105. package/dist/configurators/codebuddy.d.ts +0 -10
  106. package/dist/configurators/codebuddy.d.ts.map +0 -1
  107. package/dist/configurators/codebuddy.js +0 -24
  108. package/dist/configurators/codebuddy.js.map +0 -1
  109. package/dist/configurators/copilot.d.ts +0 -14
  110. package/dist/configurators/copilot.d.ts.map +0 -1
  111. package/dist/configurators/copilot.js +0 -46
  112. package/dist/configurators/copilot.js.map +0 -1
  113. package/dist/configurators/cursor.d.ts +0 -10
  114. package/dist/configurators/cursor.d.ts.map +0 -1
  115. package/dist/configurators/cursor.js +0 -23
  116. package/dist/configurators/cursor.js.map +0 -1
  117. package/dist/configurators/devin.d.ts +0 -8
  118. package/dist/configurators/devin.d.ts.map +0 -1
  119. package/dist/configurators/devin.js +0 -12
  120. package/dist/configurators/devin.js.map +0 -1
  121. package/dist/configurators/droid.d.ts +0 -10
  122. package/dist/configurators/droid.d.ts.map +0 -1
  123. package/dist/configurators/droid.js +0 -24
  124. package/dist/configurators/droid.js.map +0 -1
  125. package/dist/configurators/dsh.d.ts +0 -26
  126. package/dist/configurators/dsh.d.ts.map +0 -1
  127. package/dist/configurators/dsh.js +0 -76
  128. package/dist/configurators/dsh.js.map +0 -1
  129. package/dist/configurators/gemini.d.ts +0 -18
  130. package/dist/configurators/gemini.d.ts.map +0 -1
  131. package/dist/configurators/gemini.js +0 -39
  132. package/dist/configurators/gemini.js.map +0 -1
  133. package/dist/configurators/grok.d.ts +0 -17
  134. package/dist/configurators/grok.d.ts.map +0 -1
  135. package/dist/configurators/grok.js +0 -38
  136. package/dist/configurators/grok.js.map +0 -1
  137. package/dist/configurators/kilo.d.ts +0 -7
  138. package/dist/configurators/kilo.d.ts.map +0 -1
  139. package/dist/configurators/kilo.js +0 -11
  140. package/dist/configurators/kilo.js.map +0 -1
  141. package/dist/configurators/kimi.d.ts +0 -26
  142. package/dist/configurators/kimi.d.ts.map +0 -1
  143. package/dist/configurators/kimi.js +0 -74
  144. package/dist/configurators/kimi.js.map +0 -1
  145. package/dist/configurators/kiro.d.ts +0 -11
  146. package/dist/configurators/kiro.d.ts.map +0 -1
  147. package/dist/configurators/kiro.js +0 -30
  148. package/dist/configurators/kiro.js.map +0 -1
  149. package/dist/configurators/omp.d.ts +0 -6
  150. package/dist/configurators/omp.d.ts.map +0 -1
  151. package/dist/configurators/omp.js +0 -28
  152. package/dist/configurators/omp.js.map +0 -1
  153. package/dist/configurators/opencode.d.ts +0 -5
  154. package/dist/configurators/opencode.d.ts.map +0 -1
  155. package/dist/configurators/opencode.js +0 -84
  156. package/dist/configurators/opencode.js.map +0 -1
  157. package/dist/configurators/pi.d.ts +0 -5
  158. package/dist/configurators/pi.d.ts.map +0 -1
  159. package/dist/configurators/pi.js +0 -39
  160. package/dist/configurators/pi.js.map +0 -1
  161. package/dist/configurators/qoder.d.ts +0 -12
  162. package/dist/configurators/qoder.d.ts.map +0 -1
  163. package/dist/configurators/qoder.js +0 -30
  164. package/dist/configurators/qoder.js.map +0 -1
  165. package/dist/configurators/reasonix.d.ts +0 -17
  166. package/dist/configurators/reasonix.d.ts.map +0 -1
  167. package/dist/configurators/reasonix.js +0 -37
  168. package/dist/configurators/reasonix.js.map +0 -1
  169. package/dist/configurators/snow.d.ts +0 -25
  170. package/dist/configurators/snow.d.ts.map +0 -1
  171. package/dist/configurators/snow.js +0 -69
  172. package/dist/configurators/snow.js.map +0 -1
  173. package/dist/configurators/trae.d.ts +0 -16
  174. package/dist/configurators/trae.d.ts.map +0 -1
  175. package/dist/configurators/trae.js +0 -34
  176. package/dist/configurators/trae.js.map +0 -1
  177. package/dist/configurators/zcode.d.ts +0 -23
  178. package/dist/configurators/zcode.d.ts.map +0 -1
  179. package/dist/configurators/zcode.js +0 -63
  180. package/dist/configurators/zcode.js.map +0 -1
  181. package/dist/templates/codebuddy/agents/trellis-check.md +0 -115
  182. package/dist/templates/codebuddy/agents/trellis-implement.md +0 -115
  183. package/dist/templates/codebuddy/agents/trellis-research.md +0 -137
  184. package/dist/templates/codebuddy/index.d.ts +0 -15
  185. package/dist/templates/codebuddy/index.d.ts.map +0 -1
  186. package/dist/templates/codebuddy/index.js +0 -15
  187. package/dist/templates/codebuddy/index.js.map +0 -1
  188. package/dist/templates/codebuddy/settings.json +0 -69
  189. package/dist/templates/copilot/copilot-instructions.md +0 -11
  190. package/dist/templates/copilot/hooks/session-start.py +0 -564
  191. package/dist/templates/copilot/hooks.json +0 -19
  192. package/dist/templates/copilot/index.d.ts +0 -28
  193. package/dist/templates/copilot/index.d.ts.map +0 -1
  194. package/dist/templates/copilot/index.js +0 -61
  195. package/dist/templates/copilot/index.js.map +0 -1
  196. package/dist/templates/copilot/prompts/before-dev.prompt.md +0 -39
  197. package/dist/templates/copilot/prompts/brainstorm.prompt.md +0 -173
  198. package/dist/templates/copilot/prompts/break-loop.prompt.md +0 -129
  199. package/dist/templates/copilot/prompts/check-cross-layer.prompt.md +0 -170
  200. package/dist/templates/copilot/prompts/check.prompt.md +0 -110
  201. package/dist/templates/copilot/prompts/create-command.prompt.md +0 -116
  202. package/dist/templates/copilot/prompts/finish-work.prompt.md +0 -99
  203. package/dist/templates/copilot/prompts/integrate-skill.prompt.md +0 -223
  204. package/dist/templates/copilot/prompts/onboard.prompt.md +0 -362
  205. package/dist/templates/copilot/prompts/parallel.prompt.md +0 -204
  206. package/dist/templates/copilot/prompts/record-session.prompt.md +0 -66
  207. package/dist/templates/copilot/prompts/start.prompt.md +0 -63
  208. package/dist/templates/copilot/prompts/update-spec.prompt.md +0 -358
  209. package/dist/templates/cursor/agents/trellis-check.md +0 -114
  210. package/dist/templates/cursor/agents/trellis-implement.md +0 -114
  211. package/dist/templates/cursor/agents/trellis-research.md +0 -136
  212. package/dist/templates/cursor/hooks.json +0 -24
  213. package/dist/templates/cursor/index.d.ts +0 -13
  214. package/dist/templates/cursor/index.d.ts.map +0 -1
  215. package/dist/templates/cursor/index.js +0 -13
  216. package/dist/templates/cursor/index.js.map +0 -1
  217. package/dist/templates/droid/droids/trellis-check.md +0 -107
  218. package/dist/templates/droid/droids/trellis-implement.md +0 -107
  219. package/dist/templates/droid/droids/trellis-research.md +0 -137
  220. package/dist/templates/droid/index.d.ts +0 -15
  221. package/dist/templates/droid/index.d.ts.map +0 -1
  222. package/dist/templates/droid/index.js +0 -15
  223. package/dist/templates/droid/index.js.map +0 -1
  224. package/dist/templates/droid/settings.json +0 -69
  225. package/dist/templates/dsh/DSH.md +0 -80
  226. package/dist/templates/dsh/agents/trellis-check.md +0 -99
  227. package/dist/templates/dsh/agents/trellis-implement.md +0 -106
  228. package/dist/templates/dsh/agents/trellis-research.md +0 -134
  229. package/dist/templates/dsh/index.d.ts +0 -22
  230. package/dist/templates/dsh/index.d.ts.map +0 -1
  231. package/dist/templates/dsh/index.js +0 -27
  232. package/dist/templates/dsh/index.js.map +0 -1
  233. package/dist/templates/gemini/agents/trellis-check.md +0 -107
  234. package/dist/templates/gemini/agents/trellis-implement.md +0 -107
  235. package/dist/templates/gemini/agents/trellis-research.md +0 -136
  236. package/dist/templates/gemini/index.d.ts +0 -13
  237. package/dist/templates/gemini/index.d.ts.map +0 -1
  238. package/dist/templates/gemini/index.js +0 -13
  239. package/dist/templates/gemini/index.js.map +0 -1
  240. package/dist/templates/gemini/settings.json +0 -40
  241. package/dist/templates/grok/agents/trellis-check.md +0 -106
  242. package/dist/templates/grok/agents/trellis-implement.md +0 -121
  243. package/dist/templates/grok/agents/trellis-research.md +0 -146
  244. package/dist/templates/grok/index.d.ts +0 -16
  245. package/dist/templates/grok/index.d.ts.map +0 -1
  246. package/dist/templates/grok/index.js +0 -19
  247. package/dist/templates/grok/index.js.map +0 -1
  248. package/dist/templates/kimi/agents/trellis-check.md +0 -104
  249. package/dist/templates/kimi/agents/trellis-implement.md +0 -120
  250. package/dist/templates/kimi/agents/trellis-research.md +0 -144
  251. package/dist/templates/kimi/index.d.ts +0 -20
  252. package/dist/templates/kimi/index.d.ts.map +0 -1
  253. package/dist/templates/kimi/index.js +0 -23
  254. package/dist/templates/kimi/index.js.map +0 -1
  255. package/dist/templates/kiro/agents/trellis-check.json +0 -26
  256. package/dist/templates/kiro/agents/trellis-implement.json +0 -26
  257. package/dist/templates/kiro/agents/trellis-research.json +0 -30
  258. package/dist/templates/kiro/agents/trellis.json +0 -34
  259. package/dist/templates/kiro/hooks/trellis-workflow-state.kiro.hook +0 -14
  260. package/dist/templates/kiro/index.d.ts +0 -32
  261. package/dist/templates/kiro/index.d.ts.map +0 -1
  262. package/dist/templates/kiro/index.js +0 -28
  263. package/dist/templates/kiro/index.js.map +0 -1
  264. package/dist/templates/omp/agents/trellis-check.md +0 -41
  265. package/dist/templates/omp/agents/trellis-implement.md +0 -55
  266. package/dist/templates/omp/agents/trellis-research.md +0 -30
  267. package/dist/templates/omp/extensions/trellis/index.ts.txt +0 -592
  268. package/dist/templates/omp/index.d.ts +0 -4
  269. package/dist/templates/omp/index.d.ts.map +0 -1
  270. package/dist/templates/omp/index.js +0 -9
  271. package/dist/templates/omp/index.js.map +0 -1
  272. package/dist/templates/opencode/agents/trellis-check.md +0 -122
  273. package/dist/templates/opencode/agents/trellis-implement.md +0 -123
  274. package/dist/templates/opencode/agents/trellis-research.md +0 -145
  275. package/dist/templates/opencode/lib/context-visibility.js +0 -86
  276. package/dist/templates/opencode/lib/session-utils.js +0 -526
  277. package/dist/templates/opencode/lib/trellis-context.js +0 -627
  278. package/dist/templates/opencode/package.json +0 -5
  279. package/dist/templates/opencode/plugins/inject-spec-context.js +0 -121
  280. package/dist/templates/opencode/plugins/inject-subagent-context.js +0 -569
  281. package/dist/templates/opencode/plugins/inject-workflow-state.js +0 -340
  282. package/dist/templates/opencode/plugins/session-start.js +0 -74
  283. package/dist/templates/pi/agents/trellis-check.md +0 -37
  284. package/dist/templates/pi/agents/trellis-implement.md +0 -52
  285. package/dist/templates/pi/agents/trellis-research.md +0 -25
  286. package/dist/templates/pi/extensions/trellis/index.ts.txt +0 -2033
  287. package/dist/templates/pi/index.d.ts +0 -5
  288. package/dist/templates/pi/index.d.ts.map +0 -1
  289. package/dist/templates/pi/index.js +0 -12
  290. package/dist/templates/pi/index.js.map +0 -1
  291. package/dist/templates/pi/settings.json +0 -9
  292. package/dist/templates/qoder/agents/trellis-check.md +0 -108
  293. package/dist/templates/qoder/agents/trellis-implement.md +0 -108
  294. package/dist/templates/qoder/agents/trellis-research.md +0 -137
  295. package/dist/templates/qoder/index.d.ts +0 -15
  296. package/dist/templates/qoder/index.d.ts.map +0 -1
  297. package/dist/templates/qoder/index.js +0 -15
  298. package/dist/templates/qoder/index.js.map +0 -1
  299. package/dist/templates/qoder/settings.json +0 -59
  300. package/dist/templates/reasonix/agents/trellis-check.md +0 -36
  301. package/dist/templates/reasonix/agents/trellis-implement.md +0 -51
  302. package/dist/templates/reasonix/index.d.ts +0 -13
  303. package/dist/templates/reasonix/index.d.ts.map +0 -1
  304. package/dist/templates/reasonix/index.js +0 -16
  305. package/dist/templates/reasonix/index.js.map +0 -1
  306. package/dist/templates/shared-hooks/inject-shell-session-context.py +0 -292
  307. package/dist/templates/snow/SNOW.md +0 -86
  308. package/dist/templates/snow/agents/trellis-check.md +0 -136
  309. package/dist/templates/snow/agents/trellis-implement.md +0 -158
  310. package/dist/templates/snow/agents/trellis-research.md +0 -114
  311. package/dist/templates/snow/hooks/beforeSubAgentStart.json +0 -15
  312. package/dist/templates/snow/hooks/onSessionStart.json +0 -15
  313. package/dist/templates/snow/hooks/onUserMessage.json +0 -15
  314. package/dist/templates/snow/hooks/write-trellis-context.py +0 -644
  315. package/dist/templates/snow/index.d.ts +0 -26
  316. package/dist/templates/snow/index.d.ts.map +0 -1
  317. package/dist/templates/snow/index.js +0 -36
  318. package/dist/templates/snow/index.js.map +0 -1
  319. package/dist/templates/trae/agents/trellis-check.md +0 -108
  320. package/dist/templates/trae/agents/trellis-implement.md +0 -108
  321. package/dist/templates/trae/agents/trellis-research.md +0 -137
  322. package/dist/templates/trae/hooks.json +0 -39
  323. package/dist/templates/trae/index.d.ts +0 -15
  324. package/dist/templates/trae/index.d.ts.map +0 -1
  325. package/dist/templates/trae/index.js +0 -15
  326. package/dist/templates/trae/index.js.map +0 -1
  327. package/dist/templates/trellis/scripts/common/cli_adapter.py +0 -982
  328. package/dist/templates/zcode/agents/trellis-check.md +0 -110
  329. package/dist/templates/zcode/agents/trellis-implement.md +0 -116
  330. package/dist/templates/zcode/agents/trellis-research.md +0 -133
  331. package/dist/templates/zcode/config.json +0 -52
  332. package/dist/templates/zcode/index.d.ts +0 -25
  333. package/dist/templates/zcode/index.d.ts.map +0 -1
  334. package/dist/templates/zcode/index.js +0 -29
  335. package/dist/templates/zcode/index.js.map +0 -1
@@ -1,564 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- """
4
- Copilot Session Start Hook - Emit Trellis session-start context.
5
-
6
- Microsoft VS Code Agent hooks are in preview and have been documented since
7
- VS Code 1.110 (February 2026). The official documentation
8
- (https://code.visualstudio.com/docs/copilot/customization/hooks) defines
9
- `SessionStart.hookSpecificOutput.additionalContext` as the field used to inject
10
- additional context into the agent's conversation.
11
-
12
- This script emits the spec-compliant SessionStart payload. Whether Copilot
13
- actually consumes `additionalContext` depends on the user's installed VS Code
14
- and Copilot versions, which is outside Trellis's control. UserPromptSubmit
15
- breadcrumbs remain available as a per-turn complement.
16
- """
17
-
18
- from __future__ import annotations
19
-
20
- import sys
21
-
22
- # Force UTF-8 on stdin/stdout/stderr on Windows. Default codepage there is
23
- # cp936 / cp1252 / etc. — non-ASCII content (Chinese task names, prd snippets)
24
- # both in stdin (hook payload from host CLI) and stdout (our emitted blocks)
25
- # raises UnicodeDecodeError / UnicodeEncodeError. Equivalent to `python -X utf8`
26
- # but applied per-stream so we don't depend on host CLI's command wiring.
27
- if sys.platform.startswith("win"):
28
- import io as _io
29
- for _stream_name in ("stdin", "stdout", "stderr"):
30
- _stream = getattr(sys, _stream_name, None)
31
- if _stream is None:
32
- continue
33
- if hasattr(_stream, "reconfigure"):
34
- try:
35
- _stream.reconfigure(encoding="utf-8", errors="replace") # type: ignore[union-attr]
36
- except Exception:
37
- pass # Optional Windows stream setup; keep hook startup non-fatal.
38
- elif hasattr(_stream, "detach"):
39
- try:
40
- setattr(sys, _stream_name, _io.TextIOWrapper(_stream.detach(), encoding="utf-8", errors="replace"))
41
- except Exception:
42
- pass # Optional Windows stream setup; keep hook startup non-fatal.
43
-
44
- import json
45
- import os
46
- import re
47
- import subprocess
48
- import sys
49
- import warnings
50
- from io import StringIO
51
- from pathlib import Path
52
-
53
-
54
- def _normalize_windows_shell_path(path_str: str) -> str:
55
- """Normalize Unix-style shell paths to real Windows paths.
56
-
57
- On Windows, shells like Git Bash / MSYS2 / Cygwin may report paths like
58
- `/d/Users/...` or `/cygdrive/d/Users/...`. `Path.resolve()` will misinterpret
59
- these as `D:/d/Users...` on drive D: (or similar), breaking repo root
60
- detection.
61
-
62
- This function is intentionally conservative: it only rewrites patterns that
63
- unambiguously represent a drive letter mount.
64
- """
65
- if not isinstance(path_str, str) or not path_str:
66
- return path_str
67
-
68
- # Only relevant on Windows; keep other platforms untouched.
69
- if not sys.platform.startswith("win"):
70
- return path_str
71
-
72
- p = path_str.strip()
73
-
74
- # Already a Windows drive path (C:\... or C:/...)
75
- if re.match(r"^[A-Za-z]:[\/]", p):
76
- return p
77
-
78
- # MSYS/Git-Bash style: /c/Users/... or /d/Work/...
79
- m = re.match(r"^/([A-Za-z])/(.*)", p)
80
- if m:
81
- drive, rest = m.group(1).upper(), m.group(2)
82
- rest = rest.replace('/', '\\')
83
- return f"{drive}:\\{rest}"
84
-
85
- # Cygwin style: /cygdrive/c/Users/...
86
- m = re.match(r"^/cygdrive/([A-Za-z])/(.*)", p)
87
- if m:
88
- drive, rest = m.group(1).upper(), m.group(2)
89
- rest = rest.replace('/', '\\')
90
- return f"{drive}:\\{rest}"
91
-
92
- # WSL mounted drive (sometimes leaked into env): /mnt/c/Users/...
93
- m = re.match(r"^/mnt/([A-Za-z])/(.*)", p)
94
- if m:
95
- drive, rest = m.group(1).upper(), m.group(2)
96
- rest = rest.replace('/', '\\')
97
- return f"{drive}:\\{rest}"
98
-
99
- return path_str
100
-
101
-
102
- warnings.filterwarnings("ignore")
103
-
104
-
105
- def should_skip_injection() -> bool:
106
- if os.environ.get("TRELLIS_HOOKS") == "0":
107
- return True
108
- if os.environ.get("TRELLIS_DISABLE_HOOKS") == "1":
109
- return True
110
- return os.environ.get("COPILOT_NON_INTERACTIVE") == "1"
111
-
112
-
113
- def configure_project_encoding(project_dir: Path) -> None:
114
- """Reuse Trellis' shared Windows stdio encoding helper before JSON output."""
115
- scripts_dir = project_dir / ".trellis" / "scripts"
116
- if str(scripts_dir) not in sys.path:
117
- sys.path.insert(0, str(scripts_dir))
118
-
119
- try:
120
- from common import configure_encoding # type: ignore[import-not-found]
121
-
122
- configure_encoding()
123
- except Exception:
124
- pass # Optional encoding helper; host defaults are still usable.
125
-
126
-
127
- def _has_curated_jsonl_entry(jsonl_path: Path) -> bool:
128
- """Return True iff jsonl has at least one row with a ``file`` field.
129
-
130
- A freshly seeded jsonl only contains a ``{"_example": ...}`` row (no
131
- ``file`` key) — that is NOT "ready". Readiness requires at least one
132
- curated entry. Matches the contract used by ``inject-subagent-context.py``.
133
- """
134
- try:
135
- for line in jsonl_path.read_text(encoding="utf-8").splitlines():
136
- line = line.strip()
137
- if not line:
138
- continue
139
- try:
140
- row = json.loads(line)
141
- except json.JSONDecodeError:
142
- continue
143
- if isinstance(row, dict) and row.get("file"):
144
- return True
145
- except (OSError, UnicodeDecodeError):
146
- return False
147
- return False
148
-
149
-
150
- def read_file(path: Path, fallback: str = "") -> str:
151
- try:
152
- return path.read_text(encoding="utf-8")
153
- except (FileNotFoundError, PermissionError):
154
- return fallback
155
-
156
-
157
- def _resolve_context_key(project_dir: Path, hook_input: dict) -> str | None:
158
- scripts_dir = project_dir / ".trellis" / "scripts"
159
- if str(scripts_dir) not in sys.path:
160
- sys.path.insert(0, str(scripts_dir))
161
- try:
162
- from common.active_task import resolve_context_key # type: ignore[import-not-found]
163
- except Exception:
164
- return None
165
- return resolve_context_key(hook_input, platform="copilot")
166
-
167
-
168
- def _resolve_active_task(trellis_dir: Path, hook_input: dict):
169
- scripts_dir = trellis_dir / "scripts"
170
- if str(scripts_dir) not in sys.path:
171
- sys.path.insert(0, str(scripts_dir))
172
- from common.active_task import resolve_active_task # type: ignore[import-not-found]
173
-
174
- return resolve_active_task(trellis_dir.parent, hook_input, platform="copilot")
175
-
176
-
177
- def run_script(script_path: Path, context_key: str | None = None) -> str:
178
- try:
179
- env = os.environ.copy()
180
- env["PYTHONIOENCODING"] = "utf-8"
181
- if context_key:
182
- env["TRELLIS_CONTEXT_ID"] = context_key
183
- cmd = [sys.executable, "-W", "ignore", str(script_path)]
184
- result = subprocess.run(
185
- cmd,
186
- capture_output=True,
187
- text=True,
188
- encoding="utf-8",
189
- errors="replace",
190
- timeout=5,
191
- cwd=str(script_path.parent.parent.parent),
192
- env=env,
193
- )
194
- return result.stdout if result.returncode == 0 else "No context available"
195
- except (subprocess.TimeoutExpired, FileNotFoundError, PermissionError):
196
- return "No context available"
197
-
198
-
199
- def _normalize_task_ref(task_ref: str) -> str:
200
- normalized = task_ref.strip()
201
- if not normalized:
202
- return ""
203
-
204
- path_obj = Path(normalized)
205
- if path_obj.is_absolute():
206
- return str(path_obj)
207
-
208
- normalized = normalized.replace("\\", "/")
209
- while normalized.startswith("./"):
210
- normalized = normalized[2:]
211
-
212
- if normalized.startswith("tasks/"):
213
- return f".trellis/{normalized}"
214
-
215
- return normalized
216
-
217
-
218
- def _resolve_task_dir(trellis_dir: Path, task_ref: str) -> Path:
219
- normalized = _normalize_task_ref(task_ref)
220
- path_obj = Path(normalized)
221
- if path_obj.is_absolute():
222
- return path_obj
223
- if normalized.startswith(".trellis/"):
224
- return trellis_dir.parent / path_obj
225
- return trellis_dir / "tasks" / path_obj
226
-
227
-
228
- def _get_task_status(trellis_dir: Path, hook_input: dict) -> str:
229
- active = _resolve_active_task(trellis_dir, hook_input)
230
- if not active.task_path:
231
- return (
232
- "Status: NO ACTIVE TASK\n"
233
- "Next: Work inline. Create a Trellis task only if the user explicitly asks for one."
234
- )
235
-
236
- task_ref = active.task_path
237
- task_dir = _resolve_task_dir(trellis_dir, task_ref)
238
- if active.stale or not task_dir.is_dir():
239
- return (
240
- f"Status: STALE POINTER\nTask: {task_ref}\n"
241
- "Next: Task directory not found. Run: python3 ./.trellis/scripts/task.py finish"
242
- )
243
-
244
- task_json_path = task_dir / "task.json"
245
- task_data: dict = {}
246
- if task_json_path.is_file():
247
- try:
248
- task_data = json.loads(task_json_path.read_text(encoding="utf-8"))
249
- except (json.JSONDecodeError, PermissionError):
250
- pass # Optional task metadata; fall back to generic status.
251
-
252
- task_title = task_data.get("title", task_ref)
253
- task_status = task_data.get("status", "unknown")
254
-
255
- if task_status == "completed":
256
- return (
257
- f"Status: COMPLETED\nTask: {task_title}\n"
258
- f"Next: Archive with `python3 ./.trellis/scripts/task.py archive {task_dir.name}` "
259
- "or start a new task."
260
- )
261
-
262
- has_prd = (task_dir / "prd.md").is_file()
263
- has_design = (task_dir / "design.md").is_file()
264
- has_implement = (task_dir / "implement.md").is_file()
265
- present = [
266
- name
267
- for name in ("prd.md", "design.md", "implement.md", "implement.jsonl", "check.jsonl")
268
- if (task_dir / name).is_file()
269
- ]
270
- present_line = ", ".join(present) if present else "none"
271
-
272
- if not has_prd:
273
- return (
274
- f"Status: PLANNING\nTask: {task_title}\nPresent: {present_line}\n"
275
- "Next: Load trellis-brainstorm and write prd.md. Stay in planning."
276
- )
277
-
278
- if task_status == "planning":
279
- if has_design and has_implement:
280
- next_action = "Review planning artifacts with the user before `task.py start`."
281
- else:
282
- next_action = (
283
- "Planning is incomplete: add design.md and implement.md before `task.py start`."
284
- )
285
- return (
286
- f"Status: PLANNING\nTask: {task_title}\nPresent: {present_line}\n"
287
- f"Next: {next_action}"
288
- )
289
-
290
- return (
291
- f"Status: {task_status.upper()}\nTask: {task_title}\nPresent: {present_line}\n"
292
- "Next: Follow the matching per-turn workflow-state. Context order is jsonl entries, "
293
- "prd.md, design.md if present, implement.md if present."
294
- )
295
-
296
-
297
- def _run_git(repo_root: Path, args: list[str]) -> str:
298
- try:
299
- result = subprocess.run(
300
- ["git", *args],
301
- capture_output=True,
302
- text=True,
303
- encoding="utf-8",
304
- errors="replace",
305
- timeout=3,
306
- cwd=str(repo_root),
307
- )
308
- except (subprocess.TimeoutExpired, FileNotFoundError, PermissionError):
309
- return ""
310
- if result.returncode != 0:
311
- return ""
312
- return result.stdout.strip()
313
-
314
-
315
- def _format_git_state(repo_root: Path) -> str:
316
- branch = _run_git(repo_root, ["branch", "--show-current"]) or "(detached)"
317
- dirty_lines = [
318
- line for line in _run_git(repo_root, ["status", "--porcelain"]).splitlines()
319
- if line.strip()
320
- ]
321
- dirty_text = "clean" if not dirty_lines else f"dirty {len(dirty_lines)} paths"
322
- return f"Git: branch {branch}; {dirty_text}."
323
-
324
-
325
- def _repo_relative(repo_root: Path, path: Path) -> str:
326
- try:
327
- return path.relative_to(repo_root).as_posix()
328
- except ValueError:
329
- return str(path)
330
-
331
-
332
- def _collect_spec_index_paths(trellis_dir: Path) -> list[str]:
333
- paths: list[str] = []
334
- guides_index = trellis_dir / "spec" / "guides" / "index.md"
335
- if guides_index.is_file():
336
- paths.append(".trellis/spec/guides/index.md")
337
-
338
- spec_dir = trellis_dir / "spec"
339
- if not spec_dir.is_dir():
340
- return paths
341
-
342
- for sub in sorted(spec_dir.iterdir()):
343
- if not sub.is_dir() or sub.name.startswith(".") or sub.name == "guides":
344
- continue
345
- index_file = sub / "index.md"
346
- if index_file.is_file():
347
- paths.append(f".trellis/spec/{sub.name}/index.md")
348
- continue
349
- for nested in sorted(sub.iterdir()):
350
- if not nested.is_dir():
351
- continue
352
- nested_index = nested / "index.md"
353
- if nested_index.is_file():
354
- paths.append(f".trellis/spec/{sub.name}/{nested.name}/index.md")
355
-
356
- return paths
357
-
358
-
359
- def _build_compact_current_state(
360
- trellis_dir: Path,
361
- hook_input: dict,
362
- spec_index_paths: list[str],
363
- ) -> str:
364
- repo_root = trellis_dir.parent
365
- lines: list[str] = []
366
-
367
- try:
368
- from common.paths import get_active_journal_file, get_developer, get_tasks_dir, count_lines # type: ignore[import-not-found]
369
- from common.tasks import iter_active_tasks # type: ignore[import-not-found]
370
- except Exception:
371
- get_active_journal_file = None # type: ignore[assignment]
372
- get_developer = None # type: ignore[assignment]
373
- get_tasks_dir = None # type: ignore[assignment]
374
- count_lines = None # type: ignore[assignment]
375
- iter_active_tasks = None # type: ignore[assignment]
376
-
377
- developer = get_developer(repo_root) if get_developer else None
378
- lines.append(f"Developer: {developer or '(not initialized)'}")
379
- lines.append(_format_git_state(repo_root))
380
-
381
- active = _resolve_active_task(trellis_dir, hook_input)
382
- if active.task_path:
383
- task_dir = _resolve_task_dir(trellis_dir, active.task_path)
384
- status = "unknown"
385
- task_json = task_dir / "task.json"
386
- if task_json.is_file():
387
- try:
388
- data = json.loads(task_json.read_text(encoding="utf-8"))
389
- if isinstance(data, dict):
390
- status = str(data.get("status") or "unknown")
391
- except (json.JSONDecodeError, OSError):
392
- pass # Optional task metadata; fall back to generic status.
393
- lines.append(f"Current task: {_repo_relative(repo_root, task_dir)}; status={status}.")
394
- else:
395
- lines.append("Current task: none.")
396
-
397
- if get_tasks_dir and iter_active_tasks:
398
- try:
399
- task_count = sum(1 for _ in iter_active_tasks(get_tasks_dir(repo_root)))
400
- lines.append(
401
- f"Active tasks: {task_count} total. Use `python3 ./.trellis/scripts/task.py list --mine` only if needed."
402
- )
403
- except Exception:
404
- pass # Optional task summary; keep compact state available.
405
-
406
- if get_active_journal_file and count_lines:
407
- journal = get_active_journal_file(repo_root)
408
- if journal:
409
- lines.append(
410
- f"Journal: {_repo_relative(repo_root, journal)}, {count_lines(journal)} / 2000 lines."
411
- )
412
-
413
- if spec_index_paths:
414
- lines.append(f"Spec indexes: {len(spec_index_paths)} available.")
415
-
416
- return "\n".join(lines)
417
-
418
-
419
- def _extract_range(content: str, start_header: str, end_header: str) -> str:
420
- """Extract lines starting at `## start_header` up to (but excluding) `## end_header`."""
421
- lines = content.splitlines()
422
- start: "int | None" = None
423
- end: int = len(lines)
424
- start_match = f"## {start_header}"
425
- end_match = f"## {end_header}"
426
- for i, line in enumerate(lines):
427
- stripped = line.strip()
428
- if start is None and stripped == start_match:
429
- start = i
430
- continue
431
- if start is not None and stripped == end_match:
432
- end = i
433
- break
434
- if start is None:
435
- return ""
436
- return "\n".join(lines[start:end]).rstrip()
437
-
438
-
439
- _BREADCRUMB_TAG_RE = re.compile(
440
- r"\[workflow-state:([A-Za-z0-9_-]+)\]\s*\n.*?\n\s*\[/workflow-state:\1\]",
441
- re.DOTALL,
442
- )
443
-
444
-
445
- def _strip_breadcrumb_tag_blocks(content: str) -> str:
446
- stripped = _BREADCRUMB_TAG_RE.sub("", content)
447
- stripped = re.sub(r"<!--.*?-->", "", stripped, flags=re.DOTALL)
448
- stripped = re.sub(r"^\[(?!/?workflow-state:)/?[^\]\n]+\]\s*\n?", "", stripped, flags=re.MULTILINE)
449
- return re.sub(r"\n{3,}", "\n\n", stripped).strip()
450
-
451
-
452
- def _resolve_workflow_md(root: Path, input_data: dict) -> Path:
453
- """Resolve the active task's workflow file, falling back to the global one.
454
-
455
- The per-task resolution rule lives in common.workflow_selection inside
456
- .trellis/scripts. Older installed projects may not ship that module, and
457
- hooks must never crash the session — ANY failure (import error, old
458
- scripts tree, resolver bug) falls back to the global workflow.md.
459
- """
460
- try:
461
- scripts_dir = root / ".trellis" / "scripts"
462
- if str(scripts_dir) not in sys.path:
463
- sys.path.insert(0, str(scripts_dir))
464
- from common.workflow_selection import resolve_workflow_md # type: ignore[import-not-found]
465
-
466
- return resolve_workflow_md(root, input_data, platform="copilot")
467
- except Exception:
468
- return root / ".trellis" / "workflow.md"
469
-
470
-
471
- def _build_workflow_toc(workflow_path: Path) -> str:
472
- """Inject only the compact Phase Index summary for SessionStart."""
473
- content = read_file(workflow_path)
474
- if not content:
475
- return "No workflow.md found"
476
-
477
- out_lines = [
478
- "# Development Workflow - Session Summary",
479
- "Full guide: .trellis/workflow.md. Step detail: `python3 ./.trellis/scripts/get_context.py --mode phase --step <X.Y>`.",
480
- "",
481
- ]
482
-
483
- phases = _extract_range(content, "Phase Index", "Phase 1: Plan")
484
- if phases:
485
- out_lines.append(_strip_breadcrumb_tag_blocks(phases).rstrip())
486
-
487
- return "\n".join(out_lines).rstrip()
488
-
489
-
490
- def main() -> None:
491
- if should_skip_injection():
492
- sys.exit(0)
493
-
494
- # Read hook input from stdin
495
- try:
496
- hook_input = json.loads(sys.stdin.read())
497
- if not isinstance(hook_input, dict):
498
- hook_input = {}
499
- project_dir = Path(_normalize_windows_shell_path(hook_input.get("cwd", "."))).resolve()
500
- except (json.JSONDecodeError, KeyError):
501
- hook_input = {}
502
- project_dir = Path(".").resolve()
503
-
504
- configure_project_encoding(project_dir)
505
-
506
- trellis_dir = project_dir / ".trellis"
507
- spec_index_paths = _collect_spec_index_paths(trellis_dir)
508
-
509
- output = StringIO()
510
-
511
- output.write("""<session-context>
512
- Trellis compact SessionStart context. Use it to orient the session; load details on demand.
513
- </session-context>
514
-
515
- """)
516
-
517
- output.write("<current-state>\n")
518
- output.write(_build_compact_current_state(trellis_dir, hook_input, spec_index_paths))
519
- output.write("\n</current-state>\n\n")
520
-
521
- output.write("<trellis-workflow>\n")
522
- output.write(_build_workflow_toc(_resolve_workflow_md(project_dir, hook_input)))
523
- output.write("\n</trellis-workflow>\n\n")
524
-
525
- output.write("<guidelines>\n")
526
- output.write(
527
- "Task context order for implementation/check: jsonl entries -> `prd.md` -> "
528
- "`design.md` -> `implement.md`. All three are required; a missing one means "
529
- "planning is incomplete.\n\n"
530
- )
531
-
532
- if spec_index_paths:
533
- output.write("## Available indexes (read on demand)\n")
534
- for p in spec_index_paths:
535
- output.write(f"- {p}\n")
536
- output.write("\n")
537
-
538
- output.write(
539
- "Discover more via: "
540
- "`python3 ./.trellis/scripts/get_context.py --mode packages`\n"
541
- )
542
- output.write("</guidelines>\n\n")
543
-
544
- task_status = _get_task_status(trellis_dir, hook_input)
545
- output.write(f"<task-status>\n{task_status}\n</task-status>\n\n")
546
-
547
- output.write("""<ready>
548
- Context loaded. Follow <task-status>. Load workflow/spec/task details only when needed.
549
- </ready>""")
550
-
551
- context = output.getvalue()
552
- result = {
553
- "suppressOutput": True,
554
- "hookSpecificOutput": {
555
- "hookEventName": "SessionStart",
556
- "additionalContext": context,
557
- },
558
- }
559
-
560
- print(json.dumps(result, ensure_ascii=False), flush=True)
561
-
562
-
563
- if __name__ == "__main__":
564
- main()
@@ -1,19 +0,0 @@
1
- {
2
- "hooks": {
3
- "SessionStart": [
4
- {
5
- "type": "command",
6
- "command": "{{PYTHON_CMD}} .github/copilot/hooks/session-start.py",
7
- "timeout": 30
8
- }
9
- ],
10
- "userPromptSubmitted": [
11
- {
12
- "type": "command",
13
- "bash": "{{PYTHON_CMD}} .github/copilot/hooks/inject-workflow-state.py",
14
- "powershell": "{{PYTHON_CMD}} .github/copilot/hooks/inject-workflow-state.py",
15
- "timeoutSec": 15
16
- }
17
- ]
18
- }
19
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Copilot templates
3
- *
4
- * These are GENERIC templates for user projects.
5
- *
6
- * Directory structure:
7
- * copilot/
8
- * ├── prompts/ # Slash-command prompts → .github/prompts/*.prompt.md
9
- * ├── hooks/ # Hook scripts → .github/copilot/hooks/
10
- * ├── hooks.json # Hooks config → .github/hooks/trellis.json
11
- * └── copilot-instructions.md → .github/copilot-instructions.md
12
- */
13
- export declare const COPILOT_INSTRUCTIONS_PATH = ".github/copilot-instructions.md";
14
- export declare const COPILOT_INSTRUCTIONS_BLOCK_START = "<!-- TRELLIS:COPILOT-GUIDANCE:START -->";
15
- export declare const COPILOT_INSTRUCTIONS_BLOCK_END = "<!-- TRELLIS:COPILOT-GUIDANCE:END -->";
16
- export interface HookTemplate {
17
- name: string;
18
- content: string;
19
- }
20
- export interface PromptTemplate {
21
- name: string;
22
- content: string;
23
- }
24
- export declare function getAllHooks(): HookTemplate[];
25
- export declare function getHooksConfig(): string;
26
- export declare function getCopilotInstructions(): string;
27
- export declare function getAllPrompts(): PromptTemplate[];
28
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/copilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,eAAO,MAAM,yBAAyB,oCAAoC,CAAC;AAC3E,eAAO,MAAM,gCAAgC,4CACF,CAAC;AAC5C,eAAO,MAAM,8BAA8B,0CACF,CAAC;AAc1C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,IAAI,YAAY,EAAE,CAW5C;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,wBAAgB,aAAa,IAAI,cAAc,EAAE,CAchD"}
@@ -1,61 +0,0 @@
1
- /**
2
- * Copilot templates
3
- *
4
- * These are GENERIC templates for user projects.
5
- *
6
- * Directory structure:
7
- * copilot/
8
- * ├── prompts/ # Slash-command prompts → .github/prompts/*.prompt.md
9
- * ├── hooks/ # Hook scripts → .github/copilot/hooks/
10
- * ├── hooks.json # Hooks config → .github/hooks/trellis.json
11
- * └── copilot-instructions.md → .github/copilot-instructions.md
12
- */
13
- import { readdirSync, readFileSync } from "node:fs";
14
- import { dirname, join } from "node:path";
15
- import { fileURLToPath } from "node:url";
16
- const __filename = fileURLToPath(import.meta.url);
17
- const __dirname = dirname(__filename);
18
- export const COPILOT_INSTRUCTIONS_PATH = ".github/copilot-instructions.md";
19
- export const COPILOT_INSTRUCTIONS_BLOCK_START = "<!-- TRELLIS:COPILOT-GUIDANCE:START -->";
20
- export const COPILOT_INSTRUCTIONS_BLOCK_END = "<!-- TRELLIS:COPILOT-GUIDANCE:END -->";
21
- function readTemplate(relativePath) {
22
- return readFileSync(join(__dirname, relativePath), "utf-8");
23
- }
24
- function listFiles(dir) {
25
- try {
26
- return readdirSync(join(__dirname, dir)).sort();
27
- }
28
- catch {
29
- return [];
30
- }
31
- }
32
- export function getAllHooks() {
33
- const hooks = [];
34
- for (const file of listFiles("hooks")) {
35
- if (!file.endsWith(".py")) {
36
- continue;
37
- }
38
- hooks.push({ name: file, content: readTemplate(`hooks/${file}`) });
39
- }
40
- return hooks;
41
- }
42
- export function getHooksConfig() {
43
- return readTemplate("hooks.json");
44
- }
45
- export function getCopilotInstructions() {
46
- return readTemplate("copilot-instructions.md");
47
- }
48
- export function getAllPrompts() {
49
- const prompts = [];
50
- for (const file of listFiles("prompts")) {
51
- if (!file.endsWith(".prompt.md")) {
52
- continue;
53
- }
54
- prompts.push({
55
- name: file.slice(0, -".prompt.md".length),
56
- content: readTemplate(`prompts/${file}`),
57
- });
58
- }
59
- return prompts;
60
- }
61
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/copilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,yBAAyB,GAAG,iCAAiC,CAAC;AAC3E,MAAM,CAAC,MAAM,gCAAgC,GAC3C,yCAAyC,CAAC;AAC5C,MAAM,CAAC,MAAM,8BAA8B,GACzC,uCAAuC,CAAC;AAE1C,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC5B,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAYD,MAAM,UAAU,WAAW;IACzB,MAAM,KAAK,GAAmB,EAAE,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,CAAC,YAAY,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,YAAY,CAAC,yBAAyB,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAqB,EAAE,CAAC;IAErC,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACjC,SAAS;QACX,CAAC;QACD,OAAO,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC;YACzC,OAAO,EAAE,YAAY,CAAC,WAAW,IAAI,EAAE,CAAC;SACzC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}