@a1st/aix-core 0.0.12 → 0.2.0

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 (366) hide show
  1. package/dist/backup.d.ts.map +1 -1
  2. package/dist/backup.js +13 -14
  3. package/dist/backup.js.map +1 -1
  4. package/dist/cache/cleanup.d.ts.map +1 -1
  5. package/dist/cache/cleanup.js +7 -8
  6. package/dist/cache/cleanup.js.map +1 -1
  7. package/dist/cache/clear.js +4 -4
  8. package/dist/cache/clear.js.map +1 -1
  9. package/dist/cache/status.d.ts.map +1 -1
  10. package/dist/cache/status.js +4 -5
  11. package/dist/cache/status.js.map +1 -1
  12. package/dist/discovery.d.ts.map +1 -1
  13. package/dist/discovery.js +18 -17
  14. package/dist/discovery.js.map +1 -1
  15. package/dist/editors/adapters/base.d.ts +8 -4
  16. package/dist/editors/adapters/base.d.ts.map +1 -1
  17. package/dist/editors/adapters/base.js +131 -40
  18. package/dist/editors/adapters/base.js.map +1 -1
  19. package/dist/editors/adapters/claude-code.d.ts +3 -3
  20. package/dist/editors/adapters/claude-code.d.ts.map +1 -1
  21. package/dist/editors/adapters/claude-code.js +7 -6
  22. package/dist/editors/adapters/claude-code.js.map +1 -1
  23. package/dist/editors/adapters/codex.d.ts +20 -10
  24. package/dist/editors/adapters/codex.d.ts.map +1 -1
  25. package/dist/editors/adapters/codex.js +67 -30
  26. package/dist/editors/adapters/codex.js.map +1 -1
  27. package/dist/editors/adapters/copilot.d.ts +6 -3
  28. package/dist/editors/adapters/copilot.d.ts.map +1 -1
  29. package/dist/editors/adapters/copilot.js +53 -10
  30. package/dist/editors/adapters/copilot.js.map +1 -1
  31. package/dist/editors/adapters/cursor.d.ts +2 -2
  32. package/dist/editors/adapters/cursor.d.ts.map +1 -1
  33. package/dist/editors/adapters/cursor.js +3 -2
  34. package/dist/editors/adapters/cursor.js.map +1 -1
  35. package/dist/editors/adapters/gemini.d.ts +44 -0
  36. package/dist/editors/adapters/gemini.d.ts.map +1 -0
  37. package/dist/editors/adapters/gemini.js +139 -0
  38. package/dist/editors/adapters/gemini.js.map +1 -0
  39. package/dist/editors/adapters/index.d.ts +2 -0
  40. package/dist/editors/adapters/index.d.ts.map +1 -1
  41. package/dist/editors/adapters/index.js +2 -0
  42. package/dist/editors/adapters/index.js.map +1 -1
  43. package/dist/editors/adapters/opencode.d.ts +25 -0
  44. package/dist/editors/adapters/opencode.d.ts.map +1 -0
  45. package/dist/editors/adapters/opencode.js +74 -0
  46. package/dist/editors/adapters/opencode.js.map +1 -0
  47. package/dist/editors/adapters/windsurf.d.ts +1 -1
  48. package/dist/editors/adapters/windsurf.d.ts.map +1 -1
  49. package/dist/editors/adapters/windsurf.js +2 -1
  50. package/dist/editors/adapters/windsurf.js.map +1 -1
  51. package/dist/editors/adapters/zed.d.ts.map +1 -1
  52. package/dist/editors/adapters/zed.js +8 -3
  53. package/dist/editors/adapters/zed.js.map +1 -1
  54. package/dist/editors/import.d.ts +62 -1
  55. package/dist/editors/import.d.ts.map +1 -1
  56. package/dist/editors/import.js +431 -188
  57. package/dist/editors/import.js.map +1 -1
  58. package/dist/editors/index.d.ts +4 -4
  59. package/dist/editors/index.d.ts.map +1 -1
  60. package/dist/editors/index.js +2 -2
  61. package/dist/editors/index.js.map +1 -1
  62. package/dist/editors/install.d.ts.map +1 -1
  63. package/dist/editors/install.js +57 -11
  64. package/dist/editors/install.js.map +1 -1
  65. package/dist/editors/prompt-skill-installer.d.ts +17 -0
  66. package/dist/editors/prompt-skill-installer.d.ts.map +1 -0
  67. package/dist/editors/prompt-skill-installer.js +23 -0
  68. package/dist/editors/prompt-skill-installer.js.map +1 -0
  69. package/dist/editors/section-managed-markdown.d.ts +33 -0
  70. package/dist/editors/section-managed-markdown.d.ts.map +1 -0
  71. package/dist/editors/section-managed-markdown.js +97 -0
  72. package/dist/editors/section-managed-markdown.js.map +1 -0
  73. package/dist/editors/strategies/claude-code/hooks.d.ts +6 -1
  74. package/dist/editors/strategies/claude-code/hooks.d.ts.map +1 -1
  75. package/dist/editors/strategies/claude-code/hooks.js +278 -29
  76. package/dist/editors/strategies/claude-code/hooks.js.map +1 -1
  77. package/dist/editors/strategies/claude-code/mcp.d.ts +3 -2
  78. package/dist/editors/strategies/claude-code/mcp.d.ts.map +1 -1
  79. package/dist/editors/strategies/claude-code/mcp.js +8 -7
  80. package/dist/editors/strategies/claude-code/mcp.js.map +1 -1
  81. package/dist/editors/strategies/claude-code/prompts.d.ts +1 -1
  82. package/dist/editors/strategies/claude-code/prompts.d.ts.map +1 -1
  83. package/dist/editors/strategies/claude-code/prompts.js +18 -39
  84. package/dist/editors/strategies/claude-code/prompts.js.map +1 -1
  85. package/dist/editors/strategies/claude-code/rules.d.ts +1 -0
  86. package/dist/editors/strategies/claude-code/rules.d.ts.map +1 -1
  87. package/dist/editors/strategies/claude-code/rules.js +6 -3
  88. package/dist/editors/strategies/claude-code/rules.js.map +1 -1
  89. package/dist/editors/strategies/codex/prompts.d.ts +6 -5
  90. package/dist/editors/strategies/codex/prompts.d.ts.map +1 -1
  91. package/dist/editors/strategies/codex/prompts.js +34 -55
  92. package/dist/editors/strategies/codex/prompts.js.map +1 -1
  93. package/dist/editors/strategies/codex/rules.d.ts +2 -1
  94. package/dist/editors/strategies/codex/rules.d.ts.map +1 -1
  95. package/dist/editors/strategies/codex/rules.js +22 -0
  96. package/dist/editors/strategies/codex/rules.js.map +1 -1
  97. package/dist/editors/strategies/copilot/hooks.d.ts +8 -4
  98. package/dist/editors/strategies/copilot/hooks.d.ts.map +1 -1
  99. package/dist/editors/strategies/copilot/hooks.js +231 -60
  100. package/dist/editors/strategies/copilot/hooks.js.map +1 -1
  101. package/dist/editors/strategies/copilot/mcp.d.ts +4 -2
  102. package/dist/editors/strategies/copilot/mcp.d.ts.map +1 -1
  103. package/dist/editors/strategies/copilot/mcp.js +83 -41
  104. package/dist/editors/strategies/copilot/mcp.js.map +1 -1
  105. package/dist/editors/strategies/copilot/prompts.d.ts +2 -1
  106. package/dist/editors/strategies/copilot/prompts.d.ts.map +1 -1
  107. package/dist/editors/strategies/copilot/prompts.js +21 -71
  108. package/dist/editors/strategies/copilot/prompts.js.map +1 -1
  109. package/dist/editors/strategies/cursor/hooks.d.ts +8 -2
  110. package/dist/editors/strategies/cursor/hooks.d.ts.map +1 -1
  111. package/dist/editors/strategies/cursor/hooks.js +174 -22
  112. package/dist/editors/strategies/cursor/hooks.js.map +1 -1
  113. package/dist/editors/strategies/cursor/prompts.d.ts.map +1 -1
  114. package/dist/editors/strategies/cursor/prompts.js +11 -44
  115. package/dist/editors/strategies/cursor/prompts.js.map +1 -1
  116. package/dist/editors/strategies/cursor/rules.js +3 -3
  117. package/dist/editors/strategies/cursor/rules.js.map +1 -1
  118. package/dist/editors/strategies/gemini/hooks.d.ts +18 -0
  119. package/dist/editors/strategies/gemini/hooks.d.ts.map +1 -0
  120. package/dist/editors/strategies/gemini/hooks.js +152 -0
  121. package/dist/editors/strategies/gemini/hooks.js.map +1 -0
  122. package/dist/editors/strategies/gemini/index.d.ts +5 -0
  123. package/dist/editors/strategies/gemini/index.d.ts.map +1 -0
  124. package/dist/editors/strategies/gemini/index.js +5 -0
  125. package/dist/editors/strategies/gemini/index.js.map +1 -0
  126. package/dist/editors/strategies/gemini/mcp.d.ts +19 -0
  127. package/dist/editors/strategies/gemini/mcp.d.ts.map +1 -0
  128. package/dist/editors/strategies/gemini/mcp.js +73 -0
  129. package/dist/editors/strategies/gemini/mcp.js.map +1 -0
  130. package/dist/editors/strategies/gemini/prompts.d.ts +34 -0
  131. package/dist/editors/strategies/gemini/prompts.d.ts.map +1 -0
  132. package/dist/editors/strategies/gemini/prompts.js +92 -0
  133. package/dist/editors/strategies/gemini/prompts.js.map +1 -0
  134. package/dist/editors/strategies/gemini/rules.d.ts +19 -0
  135. package/dist/editors/strategies/gemini/rules.d.ts.map +1 -0
  136. package/dist/editors/strategies/gemini/rules.js +58 -0
  137. package/dist/editors/strategies/gemini/rules.js.map +1 -0
  138. package/dist/editors/strategies/index.d.ts +1 -0
  139. package/dist/editors/strategies/index.d.ts.map +1 -1
  140. package/dist/editors/strategies/index.js +1 -0
  141. package/dist/editors/strategies/index.js.map +1 -1
  142. package/dist/editors/strategies/opencode/import-utils.d.ts +5 -0
  143. package/dist/editors/strategies/opencode/import-utils.d.ts.map +1 -0
  144. package/dist/editors/strategies/opencode/import-utils.js +181 -0
  145. package/dist/editors/strategies/opencode/import-utils.js.map +1 -0
  146. package/dist/editors/strategies/opencode/index.d.ts +4 -0
  147. package/dist/editors/strategies/opencode/index.d.ts.map +1 -0
  148. package/dist/editors/strategies/opencode/index.js +4 -0
  149. package/dist/editors/strategies/opencode/index.js.map +1 -0
  150. package/dist/editors/strategies/opencode/mcp.d.ts +19 -0
  151. package/dist/editors/strategies/opencode/mcp.d.ts.map +1 -0
  152. package/dist/editors/strategies/opencode/mcp.js +145 -0
  153. package/dist/editors/strategies/opencode/mcp.js.map +1 -0
  154. package/dist/editors/strategies/opencode/prompts.d.ts +22 -0
  155. package/dist/editors/strategies/opencode/prompts.d.ts.map +1 -0
  156. package/dist/editors/strategies/opencode/prompts.js +102 -0
  157. package/dist/editors/strategies/opencode/prompts.js.map +1 -0
  158. package/dist/editors/strategies/opencode/rules.d.ts +19 -0
  159. package/dist/editors/strategies/opencode/rules.d.ts.map +1 -0
  160. package/dist/editors/strategies/opencode/rules.js +99 -0
  161. package/dist/editors/strategies/opencode/rules.js.map +1 -0
  162. package/dist/editors/strategies/shared/global-mcp.d.ts.map +1 -1
  163. package/dist/editors/strategies/shared/global-mcp.js +4 -6
  164. package/dist/editors/strategies/shared/global-mcp.js.map +1 -1
  165. package/dist/editors/strategies/shared/hook-import-utils.d.ts +21 -0
  166. package/dist/editors/strategies/shared/hook-import-utils.d.ts.map +1 -0
  167. package/dist/editors/strategies/shared/hook-import-utils.js +98 -0
  168. package/dist/editors/strategies/shared/hook-import-utils.js.map +1 -0
  169. package/dist/editors/strategies/shared/native-skills.d.ts +10 -4
  170. package/dist/editors/strategies/shared/native-skills.d.ts.map +1 -1
  171. package/dist/editors/strategies/shared/native-skills.js +29 -23
  172. package/dist/editors/strategies/shared/native-skills.js.map +1 -1
  173. package/dist/editors/strategies/shared/no-hooks.d.ts +8 -3
  174. package/dist/editors/strategies/shared/no-hooks.d.ts.map +1 -1
  175. package/dist/editors/strategies/shared/no-hooks.js +17 -2
  176. package/dist/editors/strategies/shared/no-hooks.js.map +1 -1
  177. package/dist/editors/strategies/shared/pointer-skills.d.ts +7 -2
  178. package/dist/editors/strategies/shared/pointer-skills.d.ts.map +1 -1
  179. package/dist/editors/strategies/shared/pointer-skills.js +21 -10
  180. package/dist/editors/strategies/shared/pointer-skills.js.map +1 -1
  181. package/dist/editors/strategies/shared/prompt-utils.d.ts +30 -0
  182. package/dist/editors/strategies/shared/prompt-utils.d.ts.map +1 -0
  183. package/dist/editors/strategies/shared/prompt-utils.js +101 -0
  184. package/dist/editors/strategies/shared/prompt-utils.js.map +1 -0
  185. package/dist/editors/strategies/types.d.ts +104 -2
  186. package/dist/editors/strategies/types.d.ts.map +1 -1
  187. package/dist/editors/strategies/windsurf/hooks.d.ts +6 -1
  188. package/dist/editors/strategies/windsurf/hooks.d.ts.map +1 -1
  189. package/dist/editors/strategies/windsurf/hooks.js +106 -20
  190. package/dist/editors/strategies/windsurf/hooks.js.map +1 -1
  191. package/dist/editors/strategies/windsurf/prompts.d.ts.map +1 -1
  192. package/dist/editors/strategies/windsurf/prompts.js +14 -62
  193. package/dist/editors/strategies/windsurf/prompts.js.map +1 -1
  194. package/dist/editors/strategies/windsurf/rules.js +3 -3
  195. package/dist/editors/strategies/windsurf/rules.js.map +1 -1
  196. package/dist/editors/strategies/windsurf/skills.d.ts +1 -1
  197. package/dist/editors/strategies/windsurf/skills.d.ts.map +1 -1
  198. package/dist/editors/strategies/windsurf/skills.js +4 -2
  199. package/dist/editors/strategies/windsurf/skills.js.map +1 -1
  200. package/dist/editors/strategies/zed/prompts.d.ts +2 -12
  201. package/dist/editors/strategies/zed/prompts.d.ts.map +1 -1
  202. package/dist/editors/strategies/zed/prompts.js +2 -19
  203. package/dist/editors/strategies/zed/prompts.js.map +1 -1
  204. package/dist/editors/strategies/zed/rules.d.ts +2 -1
  205. package/dist/editors/strategies/zed/rules.d.ts.map +1 -1
  206. package/dist/editors/strategies/zed/rules.js +27 -0
  207. package/dist/editors/strategies/zed/rules.js.map +1 -1
  208. package/dist/editors/types.d.ts +44 -1
  209. package/dist/editors/types.d.ts.map +1 -1
  210. package/dist/entity-hash.d.ts +26 -0
  211. package/dist/entity-hash.d.ts.map +1 -0
  212. package/dist/entity-hash.js +106 -0
  213. package/dist/entity-hash.js.map +1 -0
  214. package/dist/env/ci.d.ts +0 -4
  215. package/dist/env/ci.d.ts.map +1 -1
  216. package/dist/env/ci.js +10 -8
  217. package/dist/env/ci.js.map +1 -1
  218. package/dist/errors.d.ts +5 -0
  219. package/dist/errors.d.ts.map +1 -1
  220. package/dist/errors.js +13 -1
  221. package/dist/errors.js.map +1 -1
  222. package/dist/format-error.d.ts +16 -3
  223. package/dist/format-error.d.ts.map +1 -1
  224. package/dist/format-error.js +101 -22
  225. package/dist/format-error.js.map +1 -1
  226. package/dist/frontmatter-utils.d.ts +7 -2
  227. package/dist/frontmatter-utils.d.ts.map +1 -1
  228. package/dist/frontmatter-utils.js +9 -2
  229. package/dist/frontmatter-utils.js.map +1 -1
  230. package/dist/fs/safe-rm.d.ts +2 -3
  231. package/dist/fs/safe-rm.d.ts.map +1 -1
  232. package/dist/fs/safe-rm.js +21 -10
  233. package/dist/fs/safe-rm.js.map +1 -1
  234. package/dist/git-download.js +4 -4
  235. package/dist/git-download.js.map +1 -1
  236. package/dist/git-loader.d.ts.map +1 -1
  237. package/dist/git-loader.js +5 -6
  238. package/dist/git-loader.js.map +1 -1
  239. package/dist/global/index.d.ts +3 -4
  240. package/dist/global/index.d.ts.map +1 -1
  241. package/dist/global/index.js +2 -3
  242. package/dist/global/index.js.map +1 -1
  243. package/dist/global/processor.d.ts.map +1 -1
  244. package/dist/global/processor.js +21 -59
  245. package/dist/global/processor.js.map +1 -1
  246. package/dist/global/types.d.ts +2 -0
  247. package/dist/global/types.d.ts.map +1 -1
  248. package/dist/import-writer.d.ts +2 -0
  249. package/dist/import-writer.d.ts.map +1 -1
  250. package/dist/import-writer.js +22 -24
  251. package/dist/import-writer.js.map +1 -1
  252. package/dist/index.d.ts +6 -0
  253. package/dist/index.d.ts.map +1 -1
  254. package/dist/index.js +6 -0
  255. package/dist/index.js.map +1 -1
  256. package/dist/inheritance.d.ts.map +1 -1
  257. package/dist/inheritance.js +18 -17
  258. package/dist/inheritance.js.map +1 -1
  259. package/dist/json.js.map +1 -1
  260. package/dist/loader.d.ts +8 -1
  261. package/dist/loader.d.ts.map +1 -1
  262. package/dist/loader.js +25 -12
  263. package/dist/loader.js.map +1 -1
  264. package/dist/lockfile.d.ts +31 -0
  265. package/dist/lockfile.d.ts.map +1 -0
  266. package/dist/lockfile.js +270 -0
  267. package/dist/lockfile.js.map +1 -0
  268. package/dist/mcp/env.d.ts.map +1 -1
  269. package/dist/mcp/env.js +3 -2
  270. package/dist/mcp/env.js.map +1 -1
  271. package/dist/merge.d.ts +9 -5
  272. package/dist/merge.d.ts.map +1 -1
  273. package/dist/merge.js +8 -6
  274. package/dist/merge.js.map +1 -1
  275. package/dist/npm/resolve.d.ts.map +1 -1
  276. package/dist/npm/resolve.js +15 -17
  277. package/dist/npm/resolve.js.map +1 -1
  278. package/dist/prompts/index.d.ts +1 -0
  279. package/dist/prompts/index.d.ts.map +1 -1
  280. package/dist/prompts/index.js +1 -0
  281. package/dist/prompts/index.js.map +1 -1
  282. package/dist/prompts/loader.d.ts.map +1 -1
  283. package/dist/prompts/loader.js +4 -5
  284. package/dist/prompts/loader.js.map +1 -1
  285. package/dist/prompts/to-skills.d.ts +26 -0
  286. package/dist/prompts/to-skills.d.ts.map +1 -0
  287. package/dist/prompts/to-skills.js +87 -0
  288. package/dist/prompts/to-skills.js.map +1 -0
  289. package/dist/reference-resolver.d.ts +86 -0
  290. package/dist/reference-resolver.d.ts.map +1 -0
  291. package/dist/reference-resolver.js +250 -0
  292. package/dist/reference-resolver.js.map +1 -0
  293. package/dist/remote-loader.d.ts.map +1 -1
  294. package/dist/remote-loader.js +35 -19
  295. package/dist/remote-loader.js.map +1 -1
  296. package/dist/rules/loader.d.ts.map +1 -1
  297. package/dist/rules/loader.js +4 -5
  298. package/dist/rules/loader.js.map +1 -1
  299. package/dist/rules/merger.d.ts.map +1 -1
  300. package/dist/rules/merger.js +2 -2
  301. package/dist/rules/merger.js.map +1 -1
  302. package/dist/rules/skill-rules.d.ts.map +1 -1
  303. package/dist/rules/skill-rules.js +2 -2
  304. package/dist/rules/skill-rules.js.map +1 -1
  305. package/dist/rules/utils.js.map +1 -1
  306. package/dist/runtime/browser-dummy.d.ts +3 -0
  307. package/dist/runtime/browser-dummy.d.ts.map +1 -0
  308. package/dist/runtime/browser-dummy.js +46 -0
  309. package/dist/runtime/browser-dummy.js.map +1 -0
  310. package/dist/runtime/index.d.ts +9 -0
  311. package/dist/runtime/index.d.ts.map +1 -0
  312. package/dist/runtime/index.js +23 -0
  313. package/dist/runtime/index.js.map +1 -0
  314. package/dist/runtime/node.d.ts +3 -0
  315. package/dist/runtime/node.d.ts.map +1 -0
  316. package/dist/runtime/node.js +219 -0
  317. package/dist/runtime/node.js.map +1 -0
  318. package/dist/runtime/types.d.ts +130 -0
  319. package/dist/runtime/types.d.ts.map +1 -0
  320. package/dist/runtime/types.js +2 -0
  321. package/dist/runtime/types.js.map +1 -0
  322. package/dist/skills/cache.js +2 -2
  323. package/dist/skills/cache.js.map +1 -1
  324. package/dist/skills/parser.d.ts.map +1 -1
  325. package/dist/skills/parser.js +6 -2
  326. package/dist/skills/parser.js.map +1 -1
  327. package/dist/skills/reference-parser.d.ts.map +1 -1
  328. package/dist/skills/reference-parser.js +6 -6
  329. package/dist/skills/reference-parser.js.map +1 -1
  330. package/dist/skills/resolve.js.map +1 -1
  331. package/dist/skills/resolvers/git.d.ts.map +1 -1
  332. package/dist/skills/resolvers/git.js +4 -5
  333. package/dist/skills/resolvers/git.js.map +1 -1
  334. package/dist/skills/resolvers/local.d.ts.map +1 -1
  335. package/dist/skills/resolvers/local.js +2 -2
  336. package/dist/skills/resolvers/local.js.map +1 -1
  337. package/dist/skills/resolvers/npm.d.ts.map +1 -1
  338. package/dist/skills/resolvers/npm.js +2 -2
  339. package/dist/skills/resolvers/npm.js.map +1 -1
  340. package/dist/skills/validate.d.ts.map +1 -1
  341. package/dist/skills/validate.js +4 -4
  342. package/dist/skills/validate.js.map +1 -1
  343. package/dist/state/index.d.ts +3 -0
  344. package/dist/state/index.d.ts.map +1 -0
  345. package/dist/state/index.js +3 -0
  346. package/dist/state/index.js.map +1 -0
  347. package/dist/state/tracker.d.ts +68 -0
  348. package/dist/state/tracker.d.ts.map +1 -0
  349. package/dist/state/tracker.js +143 -0
  350. package/dist/state/tracker.js.map +1 -0
  351. package/dist/state/types.d.ts +37 -0
  352. package/dist/state/types.d.ts.map +1 -0
  353. package/dist/state/types.js +2 -0
  354. package/dist/state/types.js.map +1 -0
  355. package/dist/updater.d.ts.map +1 -1
  356. package/dist/updater.js +18 -19
  357. package/dist/updater.js.map +1 -1
  358. package/dist/url-parsing.d.ts +12 -1
  359. package/dist/url-parsing.d.ts.map +1 -1
  360. package/dist/url-parsing.js +26 -3
  361. package/dist/url-parsing.js.map +1 -1
  362. package/package.json +14 -5
  363. package/dist/global/tracking.d.ts +0 -109
  364. package/dist/global/tracking.d.ts.map +0 -1
  365. package/dist/global/tracking.js +0 -193
  366. package/dist/global/tracking.js.map +0 -1
@@ -1,16 +1,17 @@
1
1
  import type { EditorPrompt } from '../../types.js';
2
2
  import type { ParsedPromptFrontmatter, PromptsStrategy } from '../types.js';
3
3
  /**
4
- * Codex prompts strategy. Codex prompts are global-only (`~/.codex/prompts/`).
5
- * The install flow handles global config management with user confirmation.
4
+ * Codex prompts strategy. Following APM's Codex target mapping, aix does not deploy
5
+ * prompts for Codex; prompt-like reusable behavior should be packaged as skills.
6
6
  */
7
7
  export declare class CodexPromptsStrategy implements PromptsStrategy {
8
8
  /**
9
- * Returns true because prompts ARE supported, just globally.
9
+ * Codex has deprecated user-level custom prompts, but no project-local prompt target.
10
+ * Treat prompts as unsupported so project installs do not mutate `~/.codex/prompts`.
10
11
  */
11
12
  isSupported(): boolean;
12
13
  /**
13
- * Returns true to indicate this editor only supports global prompts.
14
+ * Codex does not get prompt deployment through aix.
14
15
  */
15
16
  isGlobalOnly(): boolean;
16
17
  getPromptsDir(): string;
@@ -29,7 +30,7 @@ export declare class CodexPromptsStrategy implements PromptsStrategy {
29
30
  */
30
31
  readPrompt(name: string): Promise<string | null>;
31
32
  formatPrompt(prompt: EditorPrompt): string;
32
- parseGlobalPrompts(_files: string[], _readFile: (filename: string) => Promise<string>): Promise<{
33
+ parseGlobalPrompts(files: string[], readFile: (filename: string) => Promise<string>): Promise<{
33
34
  prompts: Record<string, string>;
34
35
  warnings: string[];
35
36
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/prompts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG5E;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,eAAe;IACzD;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB,aAAa,IAAI,MAAM;IAIvB,gBAAgB,IAAI,MAAM;IAI1B,oBAAoB,IAAI,MAAM;IAI9B;;OAEG;IACH,qBAAqB,IAAI,MAAM;IAI/B;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMlD;;OAEG;IACG,UAAU,CAAC,IAAI,EAA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AAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAC/C,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IASnE;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAStC;;;OAGG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB;CAG/D"}
@@ -1,24 +1,23 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { existsSync } from 'node:fs';
3
- import { homedir } from 'node:os';
4
1
  import { join } from 'pathe';
5
- import { extractFrontmatter, parseYamlValue } from '../../../frontmatter-utils.js';
2
+ import { getRuntimeAdapter } from '../../../runtime/index.js';
3
+ import { formatPromptFile, hasPromptFrontmatterFields, parsePromptFiles, parsePromptFrontmatter, } from '../shared/prompt-utils.js';
6
4
  /**
7
- * Codex prompts strategy. Codex prompts are global-only (`~/.codex/prompts/`).
8
- * The install flow handles global config management with user confirmation.
5
+ * Codex prompts strategy. Following APM's Codex target mapping, aix does not deploy
6
+ * prompts for Codex; prompt-like reusable behavior should be packaged as skills.
9
7
  */
10
8
  export class CodexPromptsStrategy {
11
9
  /**
12
- * Returns true because prompts ARE supported, just globally.
10
+ * Codex has deprecated user-level custom prompts, but no project-local prompt target.
11
+ * Treat prompts as unsupported so project installs do not mutate `~/.codex/prompts`.
13
12
  */
14
13
  isSupported() {
15
- return true;
14
+ return false;
16
15
  }
17
16
  /**
18
- * Returns true to indicate this editor only supports global prompts.
17
+ * Codex does not get prompt deployment through aix.
19
18
  */
20
19
  isGlobalOnly() {
21
- return true;
20
+ return false;
22
21
  }
23
22
  getPromptsDir() {
24
23
  return '';
@@ -27,90 +26,70 @@ export class CodexPromptsStrategy {
27
26
  return '.md';
28
27
  }
29
28
  getGlobalPromptsPath() {
30
- return '.codex/prompts';
29
+ return '';
31
30
  }
32
31
  /**
33
32
  * Get the absolute path to the global prompts directory.
34
33
  */
35
34
  getAbsoluteGlobalPath() {
36
- return join(homedir(), this.getGlobalPromptsPath());
35
+ return join(getRuntimeAdapter().os.homedir(), this.getGlobalPromptsPath());
37
36
  }
38
37
  /**
39
38
  * Check if a prompt exists in the global prompts directory.
40
39
  */
41
40
  async promptExists(name) {
42
41
  const promptPath = join(this.getAbsoluteGlobalPath(), `${name}.md`);
43
- return existsSync(promptPath);
42
+ return getRuntimeAdapter().fs.existsSync(promptPath);
44
43
  }
45
44
  /**
46
45
  * Read an existing prompt from the global prompts directory.
47
46
  */
48
47
  async readPrompt(name) {
49
48
  const promptPath = join(this.getAbsoluteGlobalPath(), `${name}.md`);
50
- if (!existsSync(promptPath)) {
49
+ if (!getRuntimeAdapter().fs.existsSync(promptPath)) {
51
50
  return null;
52
51
  }
53
52
  try {
54
- return await readFile(promptPath, 'utf-8');
53
+ return await getRuntimeAdapter().fs.readFile(promptPath, 'utf-8');
55
54
  }
56
55
  catch {
57
56
  return null;
58
57
  }
59
58
  }
60
59
  formatPrompt(prompt) {
61
- const frontmatter = {};
62
- if (prompt.description) {
63
- frontmatter.description = prompt.description;
64
- }
65
- if (prompt.argumentHint) {
66
- frontmatter['argument-hint'] = prompt.argumentHint;
67
- }
68
- const lines = [];
69
- if (Object.keys(frontmatter).length > 0) {
70
- lines.push('---');
71
- for (const [key, value] of Object.entries(frontmatter)) {
72
- lines.push(`${key}: ${value}`);
73
- }
74
- lines.push('---', '');
75
- }
76
- lines.push(prompt.content);
77
- return lines.join('\n');
60
+ return formatPromptFile(prompt, {
61
+ frontmatterFields: [
62
+ { key: 'description', value: prompt.description },
63
+ { key: 'argument-hint', value: prompt.argumentHint },
64
+ ],
65
+ });
78
66
  }
79
- async parseGlobalPrompts(_files, _readFile) {
80
- return { prompts: {}, warnings: [] };
67
+ async parseGlobalPrompts(files, readFile) {
68
+ return parsePromptFiles({
69
+ files,
70
+ readFile,
71
+ includeFile: (file) => file.endsWith('.md'),
72
+ stripSuffix: /\.md$/,
73
+ });
81
74
  }
82
75
  /**
83
76
  * Detect if content appears to be in Codex's prompt frontmatter format.
84
77
  * Codex prompts use `description:` and optionally `argument-hint:` fields (similar to GitHub Copilot).
85
78
  */
86
79
  detectFormat(content) {
87
- const { frontmatter, hasFrontmatter } = extractFrontmatter(content);
88
- if (!hasFrontmatter) {
89
- return false;
90
- }
91
- const lines = frontmatter.split('\n');
92
- // Codex uses description/argument-hint but NOT mode/tools (GitHub Copilot) or allowed-tools (Claude)
93
- return parseYamlValue(lines, 'description') !== undefined
94
- && parseYamlValue(lines, 'mode') === undefined
95
- && parseYamlValue(lines, 'tools') === undefined
96
- && parseYamlValue(lines, 'allowed-tools') === undefined
97
- && parseYamlValue(lines, 'context') === undefined;
80
+ return hasPromptFrontmatterFields(content, ['description'], [
81
+ 'mode',
82
+ 'tools',
83
+ 'allowed-tools',
84
+ 'context',
85
+ ]);
98
86
  }
99
87
  /**
100
88
  * Parse Codex-specific frontmatter into unified format.
101
89
  * Extracts `description` and `argument-hint` fields.
102
90
  */
103
91
  parseFrontmatter(rawContent) {
104
- const { frontmatter, content, hasFrontmatter } = extractFrontmatter(rawContent);
105
- if (!hasFrontmatter) {
106
- return { content: rawContent };
107
- }
108
- const lines = frontmatter.split('\n'), description = parseYamlValue(lines, 'description'), argumentHint = parseYamlValue(lines, 'argument-hint');
109
- return {
110
- content,
111
- description,
112
- argumentHint,
113
- };
92
+ return parsePromptFrontmatter(rawContent, ['description', 'argument-hint']);
114
93
  }
115
94
  }
116
95
  //# sourceMappingURL=prompts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,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AK,SAAS;eAC3C,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,SAAS;eAC5C,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,SAAS;eACpD,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,SAAS,CAAC;IACxD,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,UAAkB;QAChC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAEhF,IAAI,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;QAClC,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAC/B,WAAW,GAAG,cAAc,CAAC,KAAK,EAAE,aAAa,CAAuB,EACxE,YAAY,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAuB,CAAC;QAElF,OAAO;YACJ,OAAO;YACP,WAAW;YACX,YAAY;SACd,CAAC;IACL,CAAC;CACH"}
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EACJ,gBAAgB,EAChB,0BAA0B,EAC1B,gBAAgB,EAChB,sBAAsB,GACxB,MAAM,2BAA2B,CAAC;AAEnC;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAC9B;;;OAGG;IACH,WAAW;QACR,OAAO,KAAK,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,YAAY;QACT,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,aAAa;QACV,OAAO,EAAE,CAAC;IACb,CAAC;IAED,gBAAgB;QACb,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,oBAAoB;QACjB,OAA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;YACR,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3C,WAAW,EAAE,OAAO;SACtB,CAAC,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,OAAe;QACzB,OAAO,0BAA0B,CAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE;YACzD,MAAM;YACN,OAAO;YACP,eAAe;YACf,SAAS;SACX,CAAC,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,UAAkB;QAChC,OAAO,sBAAsB,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC;IAC/E,CAAC;CACH"}
@@ -1,4 +1,4 @@
1
- import type { RulesStrategy } from '../types.js';
1
+ import type { ImportedRulesResult, RulesStrategy } from '../types.js';
2
2
  import type { EditorRule } from '../../types.js';
3
3
  /**
4
4
  * Codex CLI rules strategy. Uses `AGENTS.md` files at the project root (and optionally in
@@ -13,6 +13,7 @@ export declare class CodexRulesStrategy implements RulesStrategy {
13
13
  rules: string[];
14
14
  warnings: string[];
15
15
  };
16
+ importProjectRules(projectRoot: string): Promise<ImportedRulesResult>;
16
17
  formatRule(rule: EditorRule): string;
17
18
  }
18
19
  //# sourceMappingURL=rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACrD,WAAW,IAAI,MAAM;IAKrB,gBAAgB,IAAI,MAAM;IAI1B,kBAAkB,IAAI,MAAM,GAAG,IAAI;IAInC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE;IAS1E,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;CActC"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/rules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACrD,WAAW,IAAI,MAAM;IAKrB,gBAAgB,IAAI,MAAM;IAI1B,kBAAkB,IAAI,MAAM,GAAG,IAAI;IAInC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE;IASpE,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAwB3E,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;CActC"}
@@ -1,3 +1,5 @@
1
+ import { join } from 'pathe';
2
+ import { getRuntimeAdapter } from '../../../runtime/index.js';
1
3
  /**
2
4
  * Codex CLI rules strategy. Uses `AGENTS.md` files at the project root (and optionally in
3
5
  * subdirectories for glob-scoped rules). Plain markdown, no frontmatter. The adapter handles
@@ -21,6 +23,26 @@ export class CodexRulesStrategy {
21
23
  }
22
24
  return { rules, warnings: [] };
23
25
  }
26
+ async importProjectRules(projectRoot) {
27
+ const warnings = [], agentsPath = join(projectRoot, 'AGENTS.md');
28
+ try {
29
+ const content = await getRuntimeAdapter().fs.readFile(agentsPath, 'utf-8');
30
+ if (content.trim()) {
31
+ return {
32
+ rules: [{ content: content.trim(), name: 'AGENTS', path: agentsPath, scope: 'project' }],
33
+ paths: { AGENTS: agentsPath },
34
+ scopes: { AGENTS: 'project' },
35
+ warnings,
36
+ };
37
+ }
38
+ }
39
+ catch (err) {
40
+ if (err.code !== 'ENOENT') {
41
+ warnings.push(`Failed to read Codex rules from ${agentsPath}: ${err.message}`);
42
+ }
43
+ }
44
+ return { rules: [], paths: {}, scopes: {}, warnings };
45
+ }
24
46
  formatRule(rule) {
25
47
  const lines = [];
26
48
  // Codex uses plain markdown without frontmatter
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/editors/strategies/codex/rules.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAC5B,WAAW;QACR,kFAAkF;QAClF,OAAO,IAAI,CAAC;IACf,CAAC;IAED,gBAAgB;QACb,OAAO,KAAK,CAAC;IAChB,CAAC;IAED,kBAAkB;QACf,OAAO,kBAAkB,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,OAAe;QAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAClC,CAAC;IAED,UAAU,CAAC,IAAgB;QACxB,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,gDAAgD;QAChD,+FAA+F;QAC/F,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAElE,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC,IAA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,EAAE,MAAM,EAAE,SAAS,EAAE;oBAC7B,QAAQ;iBACV,CAAC;YACL,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACZ,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACpD,QAAQ,CAAC,IAAI,CAAC,mCAAmC,UAAU,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;YAC7F,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IACzD,CAAC;IAED,UAAU,CAAC,IAAgB;QACxB,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,gDAAgD;QAChD,+FAA+F;QAC/F,MAAM,wBAAwB,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAElE,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACH"}
@@ -1,14 +1,18 @@
1
1
  import type { HooksConfig } from '@a1st/aix-schema';
2
- import type { HooksStrategy } from '../types.js';
2
+ import type { HooksStrategy, ParsedHooksImportResult, UnsupportedHookField } from '../types.js';
3
3
  /**
4
- * GitHub Copilot hooks strategy. Writes hooks to `.github/hooks/hooks.json`.
5
- * Translates generic ai.json event names to GitHub Copilot's PascalCase format.
6
- * Uses the same matcher-based structure as Claude Code hooks.
4
+ * GitHub Copilot CLI hooks strategy. Writes hooks to `.github/hooks/hooks.json` (project)
5
+ * or `~/.copilot/hooks/hooks.json` (user). Wraps output with `version: 1`.
7
6
  */
8
7
  export declare class CopilotHooksStrategy implements HooksStrategy {
9
8
  isSupported(): boolean;
10
9
  getConfigPath(): string;
10
+ getGlobalConfigPath(): string;
11
11
  getUnsupportedEvents(hooks: HooksConfig): string[];
12
+ getUnsupportedFields(hooks: HooksConfig): UnsupportedHookField[];
13
+ getSupportedEvents(): readonly string[];
14
+ getNativeEventNames(): readonly string[];
15
+ parseImportedConfig(content: string): ParsedHooksImportResult;
12
16
  formatConfig(hooks: HooksConfig): string;
13
17
  }
14
18
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/copilot/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA2DjD;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACvD,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM;IAKvB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE;IAIlD,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;CA4B1C"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../src/editors/strategies/copilot/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAuNhG;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,aAAa;IACvD,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM;IAKvB,mBAAmB,IAAI,MAAM;IAI7B,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE;IAIlD,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,oBAAoB,EAAE;IAyBhE,kBAAkB,IAAI,SAAS,MAAM,EAAE;IAIvC,mBAAmB,IAAI,SAAS,MAAM,EAAE;IAIxC,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB;IAkB7D,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;CAqD1C"}
@@ -1,95 +1,266 @@
1
+ import { parseHookObject, parseMatcherImportedHooks } from '../shared/hook-import-utils.js';
1
2
  /**
2
- * Map from generic ai.json hook events to GitHub Copilot's PascalCase event names.
3
- * GitHub Copilot supports 8 events: SessionStart, UserPromptSubmit, PreToolUse,
4
- * PostToolUse, PreCompact, SubagentStart, SubagentStop, Stop.
3
+ * Map from generic ai.json hook events to GitHub Copilot CLI's camelCase event names.
4
+ * Source: https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-hooks-reference
5
5
  */
6
6
  const EVENT_MAP = {
7
- pre_tool_use: 'PreToolUse',
8
- post_tool_use: 'PostToolUse',
9
- pre_file_read: 'PreToolUse',
10
- post_file_read: 'PostToolUse',
11
- pre_file_write: 'PreToolUse',
12
- post_file_write: 'PostToolUse',
13
- pre_command: 'PreToolUse',
14
- post_command: 'PostToolUse',
15
- pre_mcp_tool: 'PreToolUse',
16
- post_mcp_tool: 'PostToolUse',
17
- session_start: 'SessionStart',
18
- agent_stop: 'Stop',
19
- pre_prompt: 'UserPromptSubmit',
7
+ pre_tool_use: 'preToolUse',
8
+ post_tool_use: 'postToolUse',
9
+ post_tool_use_failure: 'postToolUseFailure',
10
+ pre_file_read: 'preToolUse',
11
+ post_file_read: 'postToolUse',
12
+ pre_file_write: 'preToolUse',
13
+ post_file_write: 'postToolUse',
14
+ pre_command: 'preToolUse',
15
+ post_command: 'postToolUse',
16
+ pre_mcp_tool: 'preToolUse',
17
+ post_mcp_tool: 'postToolUse',
18
+ permission_request: 'permissionRequest',
19
+ notification: 'notification',
20
+ session_start: 'sessionStart',
21
+ session_end: 'sessionEnd',
22
+ agent_stop: 'agentStop',
23
+ pre_prompt: 'userPromptSubmitted',
24
+ pre_compact: 'preCompact',
25
+ subagent_start: 'subagentStart',
26
+ subagent_stop: 'subagentStop',
27
+ error_occurred: 'errorOccurred',
20
28
  };
21
29
  /**
22
- * Tool-name matchers to inject for events that target a specific GitHub Copilot tool.
23
- * GitHub Copilot uses the same tool naming convention as Claude Code for hook matchers.
24
- * Events not listed here use the user-supplied matcher (or empty string for all tools).
30
+ * Tool-name matchers for Copilot CLI's tool registry. Tool names taken from the docs:
31
+ * `ask_user`, `bash`, `create`, `edit`, `glob`, `grep`, `powershell`, `task`, `view`,
32
+ * `web_fetch`.
25
33
  */
26
34
  const TOOL_MATCHER_MAP = {
27
- pre_command: 'Bash',
28
- post_command: 'Bash',
29
- pre_file_read: 'Read',
30
- post_file_read: 'Read',
31
- pre_file_write: 'Write|Edit',
32
- post_file_write: 'Write|Edit',
35
+ pre_command: 'bash|powershell',
36
+ post_command: 'bash|powershell',
37
+ pre_file_read: 'view',
38
+ post_file_read: 'view',
39
+ pre_file_write: 'create|edit',
40
+ post_file_write: 'create|edit',
33
41
  pre_mcp_tool: 'mcp__.*',
34
42
  post_mcp_tool: 'mcp__.*',
35
43
  };
36
- /**
37
- * Events that GitHub Copilot supports.
38
- * GitHub Copilot does not support `session_end`.
39
- */
40
- const SUPPORTED_EVENTS = new Set([
41
- 'pre_tool_use',
42
- 'post_tool_use',
43
- 'pre_file_read',
44
- 'post_file_read',
45
- 'pre_file_write',
46
- 'post_file_write',
47
- 'pre_command',
48
- 'post_command',
49
- 'pre_mcp_tool',
50
- 'post_mcp_tool',
51
- 'session_start',
52
- 'agent_stop',
53
- 'pre_prompt',
44
+ const SUPPORTED_EVENTS = new Set(Object.keys(EVENT_MAP));
45
+ /** Fields the Copilot command hook entry surfaces natively. */
46
+ const COPILOT_COMMAND_FIELDS = new Set([
47
+ 'type',
48
+ 'command',
49
+ 'bash',
50
+ 'powershell',
51
+ 'shell',
52
+ 'cwd',
53
+ 'working_directory',
54
+ 'env',
55
+ 'timeout',
56
+ 'description',
57
+ 'name',
58
+ ]);
59
+ /** Fields the Copilot prompt hook entry (sessionStart only) surfaces natively. */
60
+ const COPILOT_PROMPT_FIELDS = new Set([
61
+ 'type',
62
+ 'prompt',
54
63
  ]);
64
+ function buildCommandEntry(action) {
65
+ const useBash = action.shell !== 'powershell', useShell = action.shell !== 'bash', bash = useBash ? action.bash ?? (action.shell !== 'powershell' ? action.command : undefined) : undefined, powershell = useShell
66
+ ? action.powershell ?? (action.shell === 'powershell' ? action.command : undefined)
67
+ : undefined;
68
+ if (!bash && !powershell) {
69
+ return undefined;
70
+ }
71
+ const entry = { type: 'command' };
72
+ if (bash) {
73
+ entry.bash = bash;
74
+ }
75
+ if (powershell) {
76
+ entry.powershell = powershell;
77
+ }
78
+ const cwd = action.cwd ?? action.working_directory;
79
+ if (cwd) {
80
+ entry.cwd = cwd;
81
+ }
82
+ if (action.env) {
83
+ entry.env = action.env;
84
+ }
85
+ if (action.timeout !== undefined) {
86
+ entry.timeoutSec = action.timeout;
87
+ }
88
+ return entry;
89
+ }
90
+ function buildPromptEntry(action) {
91
+ if (!action.prompt) {
92
+ return undefined;
93
+ }
94
+ return { type: 'prompt', prompt: action.prompt };
95
+ }
96
+ function parseCopilotAction(value) {
97
+ if (!value || typeof value !== 'object') {
98
+ return null;
99
+ }
100
+ const entry = value;
101
+ if (entry.type === 'prompt') {
102
+ if (typeof entry.prompt !== 'string' || entry.prompt.length === 0) {
103
+ return null;
104
+ }
105
+ return {
106
+ type: 'prompt',
107
+ prompt: entry.prompt,
108
+ };
109
+ }
110
+ const command = typeof entry.command === 'string' && entry.command.length > 0 ? entry.command : undefined, bash = typeof entry.bash === 'string' && entry.bash.length > 0 ? entry.bash : command, powershell = typeof entry.powershell === 'string' && entry.powershell.length > 0 ? entry.powershell : undefined;
111
+ if (!bash && !powershell) {
112
+ return null;
113
+ }
114
+ const action = {};
115
+ if (command) {
116
+ action.command = command;
117
+ }
118
+ else if (bash) {
119
+ action.bash = bash;
120
+ }
121
+ if (powershell) {
122
+ action.powershell = powershell;
123
+ }
124
+ if (typeof entry.cwd === 'string' && entry.cwd.length > 0) {
125
+ action.cwd = entry.cwd;
126
+ }
127
+ if (isStringRecord(entry.env)) {
128
+ action.env = entry.env;
129
+ }
130
+ if (typeof entry.timeoutSec === 'number' && entry.timeoutSec > 0) {
131
+ action.timeout = entry.timeoutSec;
132
+ }
133
+ else if (typeof entry.timeout === 'number' && entry.timeout > 0) {
134
+ action.timeout = entry.timeout;
135
+ }
136
+ return action;
137
+ }
138
+ function normalizeImportedMatcher(matcher) {
139
+ switch (matcher) {
140
+ case 'Bash':
141
+ return 'bash|powershell';
142
+ case 'Read':
143
+ return 'view';
144
+ case 'Write|Edit':
145
+ return 'create|edit';
146
+ default:
147
+ return matcher;
148
+ }
149
+ }
150
+ function normalizeImportedHookObject(rawHooks) {
151
+ if (rawHooks.stop !== undefined && rawHooks.agentStop === undefined) {
152
+ return {
153
+ ...rawHooks,
154
+ agentStop: rawHooks.stop,
155
+ };
156
+ }
157
+ return rawHooks;
158
+ }
159
+ function isStringRecord(value) {
160
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
161
+ return false;
162
+ }
163
+ return Object.values(value).every((entry) => typeof entry === 'string');
164
+ }
55
165
  /**
56
- * GitHub Copilot hooks strategy. Writes hooks to `.github/hooks/hooks.json`.
57
- * Translates generic ai.json event names to GitHub Copilot's PascalCase format.
58
- * Uses the same matcher-based structure as Claude Code hooks.
166
+ * GitHub Copilot CLI hooks strategy. Writes hooks to `.github/hooks/hooks.json` (project)
167
+ * or `~/.copilot/hooks/hooks.json` (user). Wraps output with `version: 1`.
59
168
  */
60
169
  export class CopilotHooksStrategy {
61
170
  isSupported() {
62
171
  return true;
63
172
  }
64
173
  getConfigPath() {
65
- // GitHub Copilot hooks live in .github/hooks/, not in .vscode/
174
+ // Copilot hooks live in `.github/hooks/`, two levels up from `.vscode/`.
66
175
  return '../.github/hooks/hooks.json';
67
176
  }
177
+ getGlobalConfigPath() {
178
+ return '.copilot/hooks/hooks.json';
179
+ }
68
180
  getUnsupportedEvents(hooks) {
69
181
  return Object.keys(hooks).filter((event) => !SUPPORTED_EVENTS.has(event));
70
182
  }
183
+ getUnsupportedFields(hooks) {
184
+ const result = [];
185
+ for (const [event, matchers] of Object.entries(hooks)) {
186
+ matchers?.forEach((matcher, matcherIndex) => {
187
+ matcher.hooks?.forEach((action, actionIndex) => {
188
+ const type = action.type ?? 'command';
189
+ const recognized = type === 'prompt' ? COPILOT_PROMPT_FIELDS : COPILOT_COMMAND_FIELDS;
190
+ const fields = Object.keys(action)
191
+ .filter((field) => !recognized.has(field));
192
+ if (type === 'prompt' && event !== 'session_start') {
193
+ fields.push('prompt');
194
+ }
195
+ if (fields.length > 0) {
196
+ result.push({ event, matcherIndex, actionIndex, fields });
197
+ }
198
+ });
199
+ });
200
+ }
201
+ return result;
202
+ }
203
+ getSupportedEvents() {
204
+ return Object.keys(EVENT_MAP).toSorted();
205
+ }
206
+ getNativeEventNames() {
207
+ return Array.from(new Set(Object.values(EVENT_MAP))).toSorted();
208
+ }
209
+ parseImportedConfig(content) {
210
+ const parsed = parseHookObject(content);
211
+ if (!parsed.rawHooks) {
212
+ return { hooks: {}, warnings: parsed.warnings };
213
+ }
214
+ return {
215
+ hooks: parseMatcherImportedHooks(normalizeImportedHookObject(parsed.rawHooks), {
216
+ eventMap: EVENT_MAP,
217
+ parseAction: parseCopilotAction,
218
+ toolMatchers: TOOL_MATCHER_MAP,
219
+ normalizeMatcher: normalizeImportedMatcher,
220
+ }),
221
+ warnings: parsed.warnings,
222
+ };
223
+ }
71
224
  formatConfig(hooks) {
72
225
  const copilotHooks = {};
73
226
  for (const [event, matchers] of Object.entries(hooks)) {
74
227
  const copilotEvent = EVENT_MAP[event];
75
- if (!copilotEvent) {
228
+ if (!copilotEvent || !matchers) {
76
229
  continue;
77
230
  }
78
231
  const toolMatcher = TOOL_MATCHER_MAP[event];
79
- const mapped = matchers.map((matcher) => ({
80
- matcher: toolMatcher ?? matcher.matcher ?? '',
81
- hooks: matcher.hooks.map((hook) => ({
82
- type: 'command',
83
- command: hook.command,
84
- ...(hook.timeout && { timeout: hook.timeout }),
85
- })),
86
- }));
87
- if (!copilotHooks[copilotEvent]) {
88
- copilotHooks[copilotEvent] = [];
232
+ const groups = matchers.map((matcher) => {
233
+ const entries = [];
234
+ for (const action of matcher.hooks) {
235
+ const type = action.type ?? 'command';
236
+ if (type === 'prompt' && event === 'session_start') {
237
+ const prompt = buildPromptEntry(action);
238
+ if (prompt) {
239
+ entries.push(prompt);
240
+ }
241
+ continue;
242
+ }
243
+ if (type !== 'command') {
244
+ // Drop unsupported types; user is warned via getUnsupportedFields.
245
+ continue;
246
+ }
247
+ const command = buildCommandEntry(action);
248
+ if (command) {
249
+ entries.push(command);
250
+ }
251
+ }
252
+ return {
253
+ matcher: toolMatcher ?? matcher.matcher ?? '',
254
+ hooks: entries,
255
+ };
256
+ });
257
+ const nonEmpty = groups.filter((group) => group.hooks.length > 0);
258
+ if (nonEmpty.length === 0) {
259
+ continue;
89
260
  }
90
- copilotHooks[copilotEvent].push(...mapped);
261
+ copilotHooks[copilotEvent] = (copilotHooks[copilotEvent] ?? []).concat(nonEmpty);
91
262
  }
92
- return JSON.stringify({ hooks: copilotHooks }, null, 2) + '\n';
263
+ return JSON.stringify({ version: 1, hooks: copilotHooks }, null, 2) + '\n';
93
264
  }
94
265
  }
95
266
  //# sourceMappingURL=hooks.js.map