@sentry/warden 0.0.0 → 0.1.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 (546) hide show
  1. package/.github/workflows/ci.yml +1 -1
  2. package/.github/workflows/release.yml +6 -1
  3. package/.github/workflows/warden.yml +1 -1
  4. package/dist/action/159.index.js +523 -0
  5. package/dist/action/159.index.js.map +1 -0
  6. package/dist/action/action/index.d.ts +2 -0
  7. package/dist/action/action/index.d.ts.map +1 -0
  8. package/dist/action/action/main.d.ts +2 -0
  9. package/dist/action/action/main.d.ts.map +1 -0
  10. package/dist/action/cli/args.d.ts +74 -0
  11. package/dist/action/cli/args.d.ts.map +1 -0
  12. package/dist/action/cli/args.test.d.ts +2 -0
  13. package/dist/action/cli/args.test.d.ts.map +1 -0
  14. package/dist/action/cli/commands/add.d.ts +7 -0
  15. package/dist/action/cli/commands/add.d.ts.map +1 -0
  16. package/dist/action/cli/commands/init.d.ts +10 -0
  17. package/dist/action/cli/commands/init.d.ts.map +1 -0
  18. package/dist/action/cli/commands/init.test.d.ts +2 -0
  19. package/dist/action/cli/commands/init.test.d.ts.map +1 -0
  20. package/dist/action/cli/commands/setup-app/browser.d.ts +9 -0
  21. package/dist/action/cli/commands/setup-app/browser.d.ts.map +1 -0
  22. package/dist/action/cli/commands/setup-app/credentials.d.ts +15 -0
  23. package/dist/action/cli/commands/setup-app/credentials.d.ts.map +1 -0
  24. package/dist/action/cli/commands/setup-app/manifest.d.ts +24 -0
  25. package/dist/action/cli/commands/setup-app/manifest.d.ts.map +1 -0
  26. package/dist/action/cli/commands/setup-app/server.d.ts +28 -0
  27. package/dist/action/cli/commands/setup-app/server.d.ts.map +1 -0
  28. package/dist/action/cli/commands/setup-app.d.ts +11 -0
  29. package/dist/action/cli/commands/setup-app.d.ts.map +1 -0
  30. package/dist/action/cli/commands/sync.d.ts +9 -0
  31. package/dist/action/cli/commands/sync.d.ts.map +1 -0
  32. package/dist/action/cli/context.d.ts +27 -0
  33. package/dist/action/cli/context.d.ts.map +1 -0
  34. package/dist/action/cli/files.d.ts +22 -0
  35. package/dist/action/cli/files.d.ts.map +1 -0
  36. package/dist/action/cli/files.test.d.ts +2 -0
  37. package/dist/action/cli/files.test.d.ts.map +1 -0
  38. package/dist/action/cli/fix.d.ts +41 -0
  39. package/dist/action/cli/fix.d.ts.map +1 -0
  40. package/dist/action/cli/fix.test.d.ts +2 -0
  41. package/dist/action/cli/fix.test.d.ts.map +1 -0
  42. package/dist/action/cli/git.d.ts +73 -0
  43. package/dist/action/cli/git.d.ts.map +1 -0
  44. package/dist/action/cli/git.test.d.ts +2 -0
  45. package/dist/action/cli/git.test.d.ts.map +1 -0
  46. package/dist/action/cli/index.d.ts +3 -0
  47. package/dist/action/cli/index.d.ts.map +1 -0
  48. package/dist/action/cli/main.d.ts +7 -0
  49. package/dist/action/cli/main.d.ts.map +1 -0
  50. package/dist/action/cli/output/box.d.ts +75 -0
  51. package/dist/action/cli/output/box.d.ts.map +1 -0
  52. package/dist/action/cli/output/formatters.d.ts +90 -0
  53. package/dist/action/cli/output/formatters.d.ts.map +1 -0
  54. package/dist/action/cli/output/formatters.test.d.ts +2 -0
  55. package/dist/action/cli/output/formatters.test.d.ts.map +1 -0
  56. package/dist/action/cli/output/icons.d.ts +11 -0
  57. package/dist/action/cli/output/icons.d.ts.map +1 -0
  58. package/dist/action/cli/output/index.d.ts +10 -0
  59. package/dist/action/cli/output/index.d.ts.map +1 -0
  60. package/dist/action/cli/output/ink-runner.d.ts +9 -0
  61. package/dist/action/cli/output/ink-runner.d.ts.map +1 -0
  62. package/dist/action/cli/output/jsonl.d.ts +43 -0
  63. package/dist/action/cli/output/jsonl.d.ts.map +1 -0
  64. package/dist/action/cli/output/jsonl.test.d.ts +2 -0
  65. package/dist/action/cli/output/jsonl.test.d.ts.map +1 -0
  66. package/dist/action/cli/output/reporter.d.ts +108 -0
  67. package/dist/action/cli/output/reporter.d.ts.map +1 -0
  68. package/dist/action/cli/output/tasks.d.ts +89 -0
  69. package/dist/action/cli/output/tasks.d.ts.map +1 -0
  70. package/dist/action/cli/output/tty.d.ts +21 -0
  71. package/dist/action/cli/output/tty.d.ts.map +1 -0
  72. package/dist/action/cli/output/tty.test.d.ts +2 -0
  73. package/dist/action/cli/output/tty.test.d.ts.map +1 -0
  74. package/dist/action/cli/output/verbosity.d.ts +20 -0
  75. package/dist/action/cli/output/verbosity.d.ts.map +1 -0
  76. package/dist/action/cli/output/verbosity.test.d.ts +2 -0
  77. package/dist/action/cli/output/verbosity.test.d.ts.map +1 -0
  78. package/dist/action/cli/terminal.d.ts +19 -0
  79. package/dist/action/cli/terminal.d.ts.map +1 -0
  80. package/dist/action/cli/terminal.test.d.ts +2 -0
  81. package/dist/action/cli/terminal.test.d.ts.map +1 -0
  82. package/dist/action/config/index.d.ts +4 -0
  83. package/dist/action/config/index.d.ts.map +1 -0
  84. package/dist/action/config/loader.d.ts +27 -0
  85. package/dist/action/config/loader.d.ts.map +1 -0
  86. package/dist/action/config/loader.test.d.ts +2 -0
  87. package/dist/action/config/loader.test.d.ts.map +1 -0
  88. package/dist/action/config/schema.d.ts +318 -0
  89. package/dist/action/config/schema.d.ts.map +1 -0
  90. package/dist/action/config/writer.d.ts +11 -0
  91. package/dist/action/config/writer.d.ts.map +1 -0
  92. package/dist/action/config/writer.test.d.ts +2 -0
  93. package/dist/action/config/writer.test.d.ts.map +1 -0
  94. package/dist/action/diff/classify.d.ts +29 -0
  95. package/dist/action/diff/classify.d.ts.map +1 -0
  96. package/dist/action/diff/classify.test.d.ts +2 -0
  97. package/dist/action/diff/classify.test.d.ts.map +1 -0
  98. package/dist/action/diff/coalesce.d.ts +42 -0
  99. package/dist/action/diff/coalesce.d.ts.map +1 -0
  100. package/dist/action/diff/coalesce.test.d.ts +2 -0
  101. package/dist/action/diff/coalesce.test.d.ts.map +1 -0
  102. package/dist/action/diff/context.d.ts +30 -0
  103. package/dist/action/diff/context.d.ts.map +1 -0
  104. package/dist/action/diff/context.test.d.ts +2 -0
  105. package/dist/action/diff/context.test.d.ts.map +1 -0
  106. package/dist/action/diff/index.d.ts +5 -0
  107. package/dist/action/diff/index.d.ts.map +1 -0
  108. package/dist/action/diff/parser.d.ts +52 -0
  109. package/dist/action/diff/parser.d.ts.map +1 -0
  110. package/dist/action/diff/parser.test.d.ts +2 -0
  111. package/dist/action/diff/parser.test.d.ts.map +1 -0
  112. package/dist/action/event/context.d.ts +9 -0
  113. package/dist/action/event/context.d.ts.map +1 -0
  114. package/dist/action/event/index.d.ts +3 -0
  115. package/dist/action/event/index.d.ts.map +1 -0
  116. package/dist/action/event/schedule-context.d.ts +30 -0
  117. package/dist/action/event/schedule-context.d.ts.map +1 -0
  118. package/dist/action/examples/examples.integration.test.d.ts +2 -0
  119. package/dist/action/examples/examples.integration.test.d.ts.map +1 -0
  120. package/dist/action/examples/index.d.ts +50 -0
  121. package/dist/action/examples/index.d.ts.map +1 -0
  122. package/dist/action/examples/index.test.d.ts +2 -0
  123. package/dist/action/examples/index.test.d.ts.map +1 -0
  124. package/dist/action/examples/setup.d.ts +2 -0
  125. package/dist/action/examples/setup.d.ts.map +1 -0
  126. package/dist/action/index.d.ts +11 -0
  127. package/dist/action/index.d.ts.map +1 -0
  128. package/dist/action/index.js +38231 -0
  129. package/dist/action/index.js.map +1 -0
  130. package/dist/action/licenses.txt +992 -0
  131. package/dist/action/main.d.ts +2 -0
  132. package/dist/action/main.d.ts.map +1 -0
  133. package/dist/action/main.js +707 -0
  134. package/dist/action/main.js.map +1 -0
  135. package/dist/action/output/dedup.d.ts +153 -0
  136. package/dist/action/output/dedup.d.ts.map +1 -0
  137. package/dist/action/output/dedup.test.d.ts +2 -0
  138. package/dist/action/output/dedup.test.d.ts.map +1 -0
  139. package/dist/action/output/github-checks.d.ts +106 -0
  140. package/dist/action/output/github-checks.d.ts.map +1 -0
  141. package/dist/action/output/github-checks.test.d.ts +2 -0
  142. package/dist/action/output/github-checks.test.d.ts.map +1 -0
  143. package/dist/action/output/github-issues.d.ts +35 -0
  144. package/dist/action/output/github-issues.d.ts.map +1 -0
  145. package/dist/action/output/index.d.ts +6 -0
  146. package/dist/action/output/index.d.ts.map +1 -0
  147. package/dist/action/output/issue-renderer.d.ts +20 -0
  148. package/dist/action/output/issue-renderer.d.ts.map +1 -0
  149. package/dist/action/output/renderer.d.ts +4 -0
  150. package/dist/action/output/renderer.d.ts.map +1 -0
  151. package/dist/action/output/renderer.test.d.ts +2 -0
  152. package/dist/action/output/renderer.test.d.ts.map +1 -0
  153. package/dist/action/output/stale.d.ts +31 -0
  154. package/dist/action/output/stale.d.ts.map +1 -0
  155. package/dist/action/output/stale.test.d.ts +2 -0
  156. package/dist/action/output/stale.test.d.ts.map +1 -0
  157. package/dist/action/output/types.d.ts +31 -0
  158. package/dist/action/output/types.d.ts.map +1 -0
  159. package/dist/action/package.json +3 -0
  160. package/dist/action/sdk/index.d.ts +2 -0
  161. package/dist/action/sdk/index.d.ts.map +1 -0
  162. package/dist/action/sdk/runner.d.ts +202 -0
  163. package/dist/action/sdk/runner.d.ts.map +1 -0
  164. package/dist/action/sdk/runner.test.d.ts +2 -0
  165. package/dist/action/sdk/runner.test.d.ts.map +1 -0
  166. package/dist/action/skills/index.d.ts +5 -0
  167. package/dist/action/skills/index.d.ts.map +1 -0
  168. package/dist/action/skills/loader.d.ts +111 -0
  169. package/dist/action/skills/loader.d.ts.map +1 -0
  170. package/dist/action/skills/loader.test.d.ts +2 -0
  171. package/dist/action/skills/loader.test.d.ts.map +1 -0
  172. package/dist/action/skills/remote.d.ts +117 -0
  173. package/dist/action/skills/remote.d.ts.map +1 -0
  174. package/dist/action/skills/remote.test.d.ts +2 -0
  175. package/dist/action/skills/remote.test.d.ts.map +1 -0
  176. package/dist/action/sourcemap-register.cjs +1 -0
  177. package/dist/action/triggers/matcher.d.ts +30 -0
  178. package/dist/action/triggers/matcher.d.ts.map +1 -0
  179. package/dist/action/triggers/matcher.test.d.ts +2 -0
  180. package/dist/action/triggers/matcher.test.d.ts.map +1 -0
  181. package/dist/action/types/index.d.ts +269 -0
  182. package/dist/action/types/index.d.ts.map +1 -0
  183. package/dist/action/utils/async.d.ts +5 -0
  184. package/dist/action/utils/async.d.ts.map +1 -0
  185. package/dist/action/utils/index.d.ts +16 -0
  186. package/dist/action/utils/index.d.ts.map +1 -0
  187. package/dist/action/utils/index.test.d.ts +2 -0
  188. package/dist/action/utils/index.test.d.ts.map +1 -0
  189. package/dist/action/utils/version.d.ts +3 -0
  190. package/dist/action/utils/version.d.ts.map +1 -0
  191. package/dist/cli/args.d.ts +74 -0
  192. package/dist/cli/args.d.ts.map +1 -0
  193. package/dist/cli/args.js +359 -0
  194. package/dist/cli/args.js.map +1 -0
  195. package/dist/cli/args.test.d.ts +2 -0
  196. package/dist/cli/args.test.d.ts.map +1 -0
  197. package/dist/cli/args.test.js +392 -0
  198. package/dist/cli/args.test.js.map +1 -0
  199. package/dist/cli/commands/add.d.ts +7 -0
  200. package/dist/cli/commands/add.d.ts.map +1 -0
  201. package/dist/cli/commands/add.js +380 -0
  202. package/dist/cli/commands/add.js.map +1 -0
  203. package/dist/cli/commands/init.d.ts +10 -0
  204. package/dist/cli/commands/init.d.ts.map +1 -0
  205. package/dist/cli/commands/init.js +113 -0
  206. package/dist/cli/commands/init.js.map +1 -0
  207. package/dist/cli/commands/init.test.d.ts +2 -0
  208. package/dist/cli/commands/init.test.d.ts.map +1 -0
  209. package/dist/cli/commands/init.test.js +117 -0
  210. package/dist/cli/commands/init.test.js.map +1 -0
  211. package/dist/cli/commands/setup-app/browser.d.ts +9 -0
  212. package/dist/cli/commands/setup-app/browser.d.ts.map +1 -0
  213. package/dist/cli/commands/setup-app/browser.js +36 -0
  214. package/dist/cli/commands/setup-app/browser.js.map +1 -0
  215. package/dist/cli/commands/setup-app/credentials.d.ts +15 -0
  216. package/dist/cli/commands/setup-app/credentials.d.ts.map +1 -0
  217. package/dist/cli/commands/setup-app/credentials.js +29 -0
  218. package/dist/cli/commands/setup-app/credentials.js.map +1 -0
  219. package/dist/cli/commands/setup-app/manifest.d.ts +24 -0
  220. package/dist/cli/commands/setup-app/manifest.d.ts.map +1 -0
  221. package/dist/cli/commands/setup-app/manifest.js +29 -0
  222. package/dist/cli/commands/setup-app/manifest.js.map +1 -0
  223. package/dist/cli/commands/setup-app/server.d.ts +28 -0
  224. package/dist/cli/commands/setup-app/server.d.ts.map +1 -0
  225. package/dist/cli/commands/setup-app/server.js +136 -0
  226. package/dist/cli/commands/setup-app/server.js.map +1 -0
  227. package/dist/cli/commands/setup-app.d.ts +11 -0
  228. package/dist/cli/commands/setup-app.d.ts.map +1 -0
  229. package/dist/cli/commands/setup-app.js +139 -0
  230. package/dist/cli/commands/setup-app.js.map +1 -0
  231. package/dist/cli/commands/sync.d.ts +9 -0
  232. package/dist/cli/commands/sync.d.ts.map +1 -0
  233. package/dist/cli/commands/sync.js +96 -0
  234. package/dist/cli/commands/sync.js.map +1 -0
  235. package/dist/cli/context.d.ts +27 -0
  236. package/dist/cli/context.d.ts.map +1 -0
  237. package/dist/cli/context.js +101 -0
  238. package/dist/cli/context.js.map +1 -0
  239. package/dist/cli/files.d.ts +22 -0
  240. package/dist/cli/files.d.ts.map +1 -0
  241. package/dist/cli/files.js +66 -0
  242. package/dist/cli/files.js.map +1 -0
  243. package/dist/cli/files.test.d.ts +2 -0
  244. package/dist/cli/files.test.d.ts.map +1 -0
  245. package/dist/cli/files.test.js +117 -0
  246. package/dist/cli/files.test.js.map +1 -0
  247. package/dist/cli/fix.d.ts +41 -0
  248. package/dist/cli/fix.d.ts.map +1 -0
  249. package/dist/cli/fix.js +320 -0
  250. package/dist/cli/fix.js.map +1 -0
  251. package/dist/cli/fix.test.d.ts +2 -0
  252. package/dist/cli/fix.test.d.ts.map +1 -0
  253. package/dist/cli/fix.test.js +251 -0
  254. package/dist/cli/fix.test.js.map +1 -0
  255. package/dist/cli/git.d.ts +73 -0
  256. package/dist/cli/git.d.ts.map +1 -0
  257. package/dist/cli/git.js +267 -0
  258. package/dist/cli/git.js.map +1 -0
  259. package/dist/cli/git.test.d.ts +2 -0
  260. package/dist/cli/git.test.d.ts.map +1 -0
  261. package/dist/cli/git.test.js +96 -0
  262. package/dist/cli/git.test.js.map +1 -0
  263. package/dist/cli/index.d.ts +3 -0
  264. package/dist/cli/index.d.ts.map +1 -0
  265. package/dist/cli/index.js +13 -0
  266. package/dist/cli/index.js.map +1 -0
  267. package/dist/cli/main.d.ts +7 -0
  268. package/dist/cli/main.d.ts.map +1 -0
  269. package/dist/cli/main.js +560 -0
  270. package/dist/cli/main.js.map +1 -0
  271. package/dist/cli/output/box.d.ts +75 -0
  272. package/dist/cli/output/box.d.ts.map +1 -0
  273. package/dist/cli/output/box.js +191 -0
  274. package/dist/cli/output/box.js.map +1 -0
  275. package/dist/cli/output/formatters.d.ts +90 -0
  276. package/dist/cli/output/formatters.d.ts.map +1 -0
  277. package/dist/cli/output/formatters.js +248 -0
  278. package/dist/cli/output/formatters.js.map +1 -0
  279. package/dist/cli/output/formatters.test.d.ts +2 -0
  280. package/dist/cli/output/formatters.test.d.ts.map +1 -0
  281. package/dist/cli/output/formatters.test.js +152 -0
  282. package/dist/cli/output/formatters.test.js.map +1 -0
  283. package/dist/cli/output/icons.d.ts +11 -0
  284. package/dist/cli/output/icons.d.ts.map +1 -0
  285. package/dist/cli/output/icons.js +11 -0
  286. package/dist/cli/output/icons.js.map +1 -0
  287. package/dist/cli/output/index.d.ts +10 -0
  288. package/dist/cli/output/index.d.ts.map +1 -0
  289. package/dist/cli/output/index.js +10 -0
  290. package/dist/cli/output/index.js.map +1 -0
  291. package/dist/cli/output/ink-runner.d.ts +9 -0
  292. package/dist/cli/output/ink-runner.d.ts.map +1 -0
  293. package/dist/cli/output/ink-runner.js +207 -0
  294. package/dist/cli/output/ink-runner.js.map +1 -0
  295. package/dist/cli/output/jsonl.d.ts +43 -0
  296. package/dist/cli/output/jsonl.d.ts.map +1 -0
  297. package/dist/cli/output/jsonl.js +89 -0
  298. package/dist/cli/output/jsonl.js.map +1 -0
  299. package/dist/cli/output/jsonl.test.d.ts +2 -0
  300. package/dist/cli/output/jsonl.test.d.ts.map +1 -0
  301. package/dist/cli/output/jsonl.test.js +284 -0
  302. package/dist/cli/output/jsonl.test.js.map +1 -0
  303. package/dist/cli/output/reporter.d.ts +108 -0
  304. package/dist/cli/output/reporter.d.ts.map +1 -0
  305. package/dist/cli/output/reporter.js +378 -0
  306. package/dist/cli/output/reporter.js.map +1 -0
  307. package/dist/cli/output/tasks.d.ts +89 -0
  308. package/dist/cli/output/tasks.d.ts.map +1 -0
  309. package/dist/cli/output/tasks.js +251 -0
  310. package/dist/cli/output/tasks.js.map +1 -0
  311. package/dist/cli/output/tty.d.ts +21 -0
  312. package/dist/cli/output/tty.d.ts.map +1 -0
  313. package/dist/cli/output/tty.js +44 -0
  314. package/dist/cli/output/tty.js.map +1 -0
  315. package/dist/cli/output/tty.test.d.ts +2 -0
  316. package/dist/cli/output/tty.test.d.ts.map +1 -0
  317. package/dist/cli/output/tty.test.js +105 -0
  318. package/dist/cli/output/tty.test.js.map +1 -0
  319. package/dist/cli/output/verbosity.d.ts +20 -0
  320. package/dist/cli/output/verbosity.d.ts.map +1 -0
  321. package/dist/cli/output/verbosity.js +32 -0
  322. package/dist/cli/output/verbosity.js.map +1 -0
  323. package/dist/cli/output/verbosity.test.d.ts +2 -0
  324. package/dist/cli/output/verbosity.test.d.ts.map +1 -0
  325. package/dist/cli/output/verbosity.test.js +35 -0
  326. package/dist/cli/output/verbosity.test.js.map +1 -0
  327. package/dist/cli/terminal.d.ts +19 -0
  328. package/dist/cli/terminal.d.ts.map +1 -0
  329. package/dist/cli/terminal.js +247 -0
  330. package/dist/cli/terminal.js.map +1 -0
  331. package/dist/cli/terminal.test.d.ts +2 -0
  332. package/dist/cli/terminal.test.d.ts.map +1 -0
  333. package/dist/cli/terminal.test.js +123 -0
  334. package/dist/cli/terminal.test.js.map +1 -0
  335. package/dist/config/index.d.ts +4 -0
  336. package/dist/config/index.d.ts.map +1 -0
  337. package/dist/config/index.js +4 -0
  338. package/dist/config/index.js.map +1 -0
  339. package/dist/config/loader.d.ts +27 -0
  340. package/dist/config/loader.d.ts.map +1 -0
  341. package/dist/config/loader.js +77 -0
  342. package/dist/config/loader.js.map +1 -0
  343. package/dist/config/loader.test.d.ts +2 -0
  344. package/dist/config/loader.test.d.ts.map +1 -0
  345. package/dist/config/loader.test.js +263 -0
  346. package/dist/config/loader.test.js.map +1 -0
  347. package/dist/config/schema.d.ts +318 -0
  348. package/dist/config/schema.d.ts.map +1 -0
  349. package/dist/config/schema.js +137 -0
  350. package/dist/config/schema.js.map +1 -0
  351. package/dist/config/writer.d.ts +11 -0
  352. package/dist/config/writer.d.ts.map +1 -0
  353. package/dist/config/writer.js +74 -0
  354. package/dist/config/writer.js.map +1 -0
  355. package/dist/config/writer.test.d.ts +2 -0
  356. package/dist/config/writer.test.d.ts.map +1 -0
  357. package/dist/config/writer.test.js +98 -0
  358. package/dist/config/writer.test.js.map +1 -0
  359. package/dist/diff/classify.d.ts +29 -0
  360. package/dist/diff/classify.d.ts.map +1 -0
  361. package/dist/diff/classify.js +74 -0
  362. package/dist/diff/classify.js.map +1 -0
  363. package/dist/diff/classify.test.d.ts +2 -0
  364. package/dist/diff/classify.test.d.ts.map +1 -0
  365. package/dist/diff/classify.test.js +140 -0
  366. package/dist/diff/classify.test.js.map +1 -0
  367. package/dist/diff/coalesce.d.ts +42 -0
  368. package/dist/diff/coalesce.d.ts.map +1 -0
  369. package/dist/diff/coalesce.js +104 -0
  370. package/dist/diff/coalesce.js.map +1 -0
  371. package/dist/diff/coalesce.test.d.ts +2 -0
  372. package/dist/diff/coalesce.test.d.ts.map +1 -0
  373. package/dist/diff/coalesce.test.js +159 -0
  374. package/dist/diff/coalesce.test.js.map +1 -0
  375. package/dist/diff/context.d.ts +30 -0
  376. package/dist/diff/context.d.ts.map +1 -0
  377. package/dist/diff/context.js +144 -0
  378. package/dist/diff/context.js.map +1 -0
  379. package/dist/diff/context.test.d.ts +2 -0
  380. package/dist/diff/context.test.d.ts.map +1 -0
  381. package/dist/diff/context.test.js +190 -0
  382. package/dist/diff/context.test.js.map +1 -0
  383. package/dist/diff/index.d.ts +5 -0
  384. package/dist/diff/index.d.ts.map +1 -0
  385. package/dist/diff/index.js +5 -0
  386. package/dist/diff/index.js.map +1 -0
  387. package/dist/diff/parser.d.ts +52 -0
  388. package/dist/diff/parser.d.ts.map +1 -0
  389. package/dist/diff/parser.js +95 -0
  390. package/dist/diff/parser.js.map +1 -0
  391. package/dist/diff/parser.test.d.ts +2 -0
  392. package/dist/diff/parser.test.d.ts.map +1 -0
  393. package/dist/diff/parser.test.js +178 -0
  394. package/dist/diff/parser.test.js.map +1 -0
  395. package/dist/event/context.d.ts +9 -0
  396. package/dist/event/context.d.ts.map +1 -0
  397. package/dist/event/context.js +94 -0
  398. package/dist/event/context.js.map +1 -0
  399. package/dist/event/index.d.ts +3 -0
  400. package/dist/event/index.d.ts.map +1 -0
  401. package/dist/event/index.js +3 -0
  402. package/dist/event/index.js.map +1 -0
  403. package/dist/event/schedule-context.d.ts +30 -0
  404. package/dist/event/schedule-context.d.ts.map +1 -0
  405. package/dist/event/schedule-context.js +57 -0
  406. package/dist/event/schedule-context.js.map +1 -0
  407. package/dist/examples/examples.integration.test.d.ts +2 -0
  408. package/dist/examples/examples.integration.test.d.ts.map +1 -0
  409. package/dist/examples/examples.integration.test.js +55 -0
  410. package/dist/examples/examples.integration.test.js.map +1 -0
  411. package/dist/examples/index.d.ts +50 -0
  412. package/dist/examples/index.d.ts.map +1 -0
  413. package/dist/examples/index.js +104 -0
  414. package/dist/examples/index.js.map +1 -0
  415. package/dist/examples/index.test.d.ts +2 -0
  416. package/dist/examples/index.test.d.ts.map +1 -0
  417. package/dist/examples/index.test.js +88 -0
  418. package/dist/examples/index.test.js.map +1 -0
  419. package/dist/examples/setup.d.ts +2 -0
  420. package/dist/examples/setup.d.ts.map +1 -0
  421. package/dist/examples/setup.js +22 -0
  422. package/dist/examples/setup.js.map +1 -0
  423. package/dist/index.d.ts +12 -0
  424. package/dist/index.d.ts.map +1 -0
  425. package/dist/index.js +57 -0
  426. package/dist/index.js.map +1 -0
  427. package/dist/output/dedup.d.ts +153 -0
  428. package/dist/output/dedup.d.ts.map +1 -0
  429. package/dist/output/dedup.js +416 -0
  430. package/dist/output/dedup.js.map +1 -0
  431. package/dist/output/dedup.test.d.ts +2 -0
  432. package/dist/output/dedup.test.d.ts.map +1 -0
  433. package/dist/output/dedup.test.js +357 -0
  434. package/dist/output/dedup.test.js.map +1 -0
  435. package/dist/output/github-checks.d.ts +106 -0
  436. package/dist/output/github-checks.d.ts.map +1 -0
  437. package/dist/output/github-checks.js +321 -0
  438. package/dist/output/github-checks.js.map +1 -0
  439. package/dist/output/github-checks.test.d.ts +2 -0
  440. package/dist/output/github-checks.test.d.ts.map +1 -0
  441. package/dist/output/github-checks.test.js +255 -0
  442. package/dist/output/github-checks.test.js.map +1 -0
  443. package/dist/output/github-issues.d.ts +35 -0
  444. package/dist/output/github-issues.d.ts.map +1 -0
  445. package/dist/output/github-issues.js +246 -0
  446. package/dist/output/github-issues.js.map +1 -0
  447. package/dist/output/index.d.ts +6 -0
  448. package/dist/output/index.d.ts.map +1 -0
  449. package/dist/output/index.js +6 -0
  450. package/dist/output/index.js.map +1 -0
  451. package/dist/output/issue-renderer.d.ts +20 -0
  452. package/dist/output/issue-renderer.d.ts.map +1 -0
  453. package/dist/output/issue-renderer.js +154 -0
  454. package/dist/output/issue-renderer.js.map +1 -0
  455. package/dist/output/renderer.d.ts +4 -0
  456. package/dist/output/renderer.d.ts.map +1 -0
  457. package/dist/output/renderer.js +168 -0
  458. package/dist/output/renderer.js.map +1 -0
  459. package/dist/output/renderer.test.d.ts +2 -0
  460. package/dist/output/renderer.test.d.ts.map +1 -0
  461. package/dist/output/renderer.test.js +645 -0
  462. package/dist/output/renderer.test.js.map +1 -0
  463. package/dist/output/stale.d.ts +31 -0
  464. package/dist/output/stale.d.ts.map +1 -0
  465. package/dist/output/stale.js +114 -0
  466. package/dist/output/stale.js.map +1 -0
  467. package/dist/output/stale.test.d.ts +2 -0
  468. package/dist/output/stale.test.d.ts.map +1 -0
  469. package/dist/output/stale.test.js +330 -0
  470. package/dist/output/stale.test.js.map +1 -0
  471. package/dist/output/types.d.ts +31 -0
  472. package/dist/output/types.d.ts.map +1 -0
  473. package/dist/output/types.js +2 -0
  474. package/dist/output/types.js.map +1 -0
  475. package/dist/sdk/index.d.ts +2 -0
  476. package/dist/sdk/index.d.ts.map +1 -0
  477. package/dist/sdk/index.js +2 -0
  478. package/dist/sdk/index.js.map +1 -0
  479. package/dist/sdk/runner.d.ts +202 -0
  480. package/dist/sdk/runner.d.ts.map +1 -0
  481. package/dist/sdk/runner.js +888 -0
  482. package/dist/sdk/runner.js.map +1 -0
  483. package/dist/sdk/runner.test.d.ts +2 -0
  484. package/dist/sdk/runner.test.d.ts.map +1 -0
  485. package/dist/sdk/runner.test.js +677 -0
  486. package/dist/sdk/runner.test.js.map +1 -0
  487. package/dist/skills/index.d.ts +5 -0
  488. package/dist/skills/index.d.ts.map +1 -0
  489. package/dist/skills/index.js +3 -0
  490. package/dist/skills/index.js.map +1 -0
  491. package/dist/skills/loader.d.ts +111 -0
  492. package/dist/skills/loader.d.ts.map +1 -0
  493. package/dist/skills/loader.js +319 -0
  494. package/dist/skills/loader.js.map +1 -0
  495. package/dist/skills/loader.test.d.ts +2 -0
  496. package/dist/skills/loader.test.d.ts.map +1 -0
  497. package/dist/skills/loader.test.js +241 -0
  498. package/dist/skills/loader.test.js.map +1 -0
  499. package/dist/skills/remote.d.ts +117 -0
  500. package/dist/skills/remote.d.ts.map +1 -0
  501. package/dist/skills/remote.js +496 -0
  502. package/dist/skills/remote.js.map +1 -0
  503. package/dist/skills/remote.test.d.ts +2 -0
  504. package/dist/skills/remote.test.d.ts.map +1 -0
  505. package/dist/skills/remote.test.js +582 -0
  506. package/dist/skills/remote.test.js.map +1 -0
  507. package/dist/triggers/matcher.d.ts +30 -0
  508. package/dist/triggers/matcher.d.ts.map +1 -0
  509. package/dist/triggers/matcher.js +122 -0
  510. package/dist/triggers/matcher.js.map +1 -0
  511. package/dist/triggers/matcher.test.d.ts +2 -0
  512. package/dist/triggers/matcher.test.d.ts.map +1 -0
  513. package/dist/triggers/matcher.test.js +234 -0
  514. package/dist/triggers/matcher.test.js.map +1 -0
  515. package/dist/types/index.d.ts +269 -0
  516. package/dist/types/index.d.ts.map +1 -0
  517. package/dist/types/index.js +162 -0
  518. package/dist/types/index.js.map +1 -0
  519. package/dist/utils/async.d.ts +5 -0
  520. package/dist/utils/async.d.ts.map +1 -0
  521. package/dist/utils/async.js +13 -0
  522. package/dist/utils/async.js.map +1 -0
  523. package/dist/utils/index.d.ts +16 -0
  524. package/dist/utils/index.d.ts.map +1 -0
  525. package/dist/utils/index.js +44 -0
  526. package/dist/utils/index.js.map +1 -0
  527. package/dist/utils/index.test.d.ts +2 -0
  528. package/dist/utils/index.test.d.ts.map +1 -0
  529. package/dist/utils/index.test.js +68 -0
  530. package/dist/utils/index.test.js.map +1 -0
  531. package/dist/utils/version.d.ts +3 -0
  532. package/dist/utils/version.d.ts.map +1 -0
  533. package/dist/utils/version.js +16 -0
  534. package/dist/utils/version.js.map +1 -0
  535. package/docs/src/pages/config.astro +2 -1
  536. package/docs/src/pages/guide.astro +2 -1
  537. package/docs/src/utils/version.ts +6 -0
  538. package/package.json +12 -2
  539. package/src/cli/args.ts +2 -3
  540. package/src/cli/commands/init.test.ts +2 -1
  541. package/src/cli/commands/init.ts +3 -1
  542. package/src/cli/output/reporter.ts +3 -4
  543. package/src/utils/index.ts +1 -0
  544. package/src/utils/version.ts +17 -0
  545. package/.claude/settings.local.json +0 -88
  546. package/docs/.claude/settings.local.json +0 -11
@@ -21,7 +21,7 @@ jobs:
21
21
 
22
22
  - uses: actions/setup-node@v4
23
23
  with:
24
- node-version: '20'
24
+ node-version: '24'
25
25
  cache: 'pnpm'
26
26
 
27
27
  - run: pnpm install --frozen-lockfile
@@ -7,6 +7,7 @@ on:
7
7
 
8
8
  permissions:
9
9
  contents: write
10
+ id-token: write
10
11
 
11
12
  jobs:
12
13
  release:
@@ -20,13 +21,17 @@ jobs:
20
21
 
21
22
  - uses: actions/setup-node@v4
22
23
  with:
23
- node-version: '20'
24
+ node-version: '24'
24
25
  cache: 'pnpm'
26
+ registry-url: 'https://registry.npmjs.org'
25
27
 
26
28
  - run: pnpm install --frozen-lockfile
27
29
  - run: pnpm build
28
30
  - run: pnpm build:action
29
31
 
32
+ - name: Publish to npm
33
+ run: npm publish --provenance --access public
34
+
30
35
  - name: Get version info
31
36
  id: version
32
37
  run: |
@@ -22,7 +22,7 @@ jobs:
22
22
 
23
23
  - uses: actions/setup-node@v4
24
24
  with:
25
- node-version: '20'
25
+ node-version: '24'
26
26
  cache: 'pnpm'
27
27
 
28
28
  - run: pnpm install --frozen-lockfile
@@ -0,0 +1,523 @@
1
+ export const id = 159;
2
+ export const ids = [159];
3
+ export const modules = {
4
+
5
+ /***/ 2159:
6
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7
+
8
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9
+ /* harmony export */ resolveRemoteSkill: () => (/* binding */ resolveRemoteSkill)
10
+ /* harmony export */ });
11
+ /* unused harmony exports parseRemoteRef, formatRemoteRef, getSkillsCacheDir, getRemotePath, getStatePath, loadState, saveState, getCacheTtlSeconds, shouldRefresh, fetchRemote, discoverRemoteSkills, removeRemote, listCachedRemotes */
12
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3024);
13
+ /* harmony import */ var node_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(node_fs__WEBPACK_IMPORTED_MODULE_0__);
14
+ /* harmony import */ var node_os__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8161);
15
+ /* harmony import */ var node_os__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(node_os__WEBPACK_IMPORTED_MODULE_1__);
16
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6760);
17
+ /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(node_path__WEBPACK_IMPORTED_MODULE_2__);
18
+ /* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1421);
19
+ /* harmony import */ var node_child_process__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(node_child_process__WEBPACK_IMPORTED_MODULE_3__);
20
+ /* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(606);
21
+ /* harmony import */ var _loader_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7081);
22
+
23
+
24
+
25
+
26
+
27
+
28
+ /** Default TTL for unpinned remote skills: 24 hours */
29
+ const DEFAULT_TTL_SECONDS = 86400;
30
+ /** Schema for a single remote entry in state.json */
31
+ const RemoteEntrySchema = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
32
+ sha: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(),
33
+ fetchedAt: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().datetime(),
34
+ });
35
+ /** Schema for the entire state.json file */
36
+ const RemoteStateSchema = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
37
+ remotes: zod__WEBPACK_IMPORTED_MODULE_5__/* .record */ .g1P(zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(), RemoteEntrySchema),
38
+ });
39
+ /** Schema for a plugin in marketplace.json */
40
+ const MarketplacePluginSchema = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
41
+ name: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(),
42
+ source: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(),
43
+ description: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().optional(),
44
+ category: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().optional(),
45
+ });
46
+ /** Schema for .claude-plugin/marketplace.json */
47
+ const MarketplaceConfigSchema = zod__WEBPACK_IMPORTED_MODULE_5__/* .object */ .Ikc({
48
+ $schema: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().optional(),
49
+ name: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP(),
50
+ description: zod__WEBPACK_IMPORTED_MODULE_5__/* .string */ .YjP().optional(),
51
+ plugins: zod__WEBPACK_IMPORTED_MODULE_5__/* .array */ .YOg(MarketplacePluginSchema),
52
+ });
53
+ /**
54
+ * Normalize a GitHub URL to owner/repo format.
55
+ * Returns null if the input is not a recognized GitHub URL.
56
+ *
57
+ * Supports:
58
+ * - https://github.com/owner/repo
59
+ * - https://github.com/owner/repo.git
60
+ * - git@github.com:owner/repo.git
61
+ */
62
+ function normalizeGitHubUrl(input) {
63
+ // HTTPS URL: https://github.com/owner/repo or https://github.com/owner/repo.git
64
+ const httpsMatch = input.match(/^https?:\/\/github\.com\/([^/]+)\/([^/@]+?)(?:\.git)?$/);
65
+ if (httpsMatch) {
66
+ return `${httpsMatch[1]}/${httpsMatch[2]}`;
67
+ }
68
+ // SSH URL: git@github.com:owner/repo.git
69
+ const sshMatch = input.match(/^git@github\.com:([^/]+)\/([^/@]+?)(?:\.git)?$/);
70
+ if (sshMatch) {
71
+ return `${sshMatch[1]}/${sshMatch[2]}`;
72
+ }
73
+ return null;
74
+ }
75
+ /**
76
+ * Parse a remote reference string into its components.
77
+ * Supports formats:
78
+ * - "owner/repo" or "owner/repo@sha"
79
+ * - "https://github.com/owner/repo" or "https://github.com/owner/repo@sha"
80
+ * - "https://github.com/owner/repo.git" or "https://github.com/owner/repo.git@sha"
81
+ * - "git@github.com:owner/repo.git" or "git@github.com:owner/repo.git@sha"
82
+ */
83
+ function parseRemoteRef(ref) {
84
+ let inputRef = ref;
85
+ let sha;
86
+ // Extract SHA suffix from the input before URL normalization.
87
+ // The SHA is always at the end, after a @ that follows the repo name.
88
+ // For git@github.com URLs, we need to find the @ after the colon.
89
+ if (ref.startsWith('git@')) {
90
+ const colonIndex = ref.indexOf(':');
91
+ if (colonIndex !== -1) {
92
+ const afterColon = ref.slice(colonIndex + 1);
93
+ const shaAtIndex = afterColon.lastIndexOf('@');
94
+ if (shaAtIndex !== -1) {
95
+ sha = afterColon.slice(shaAtIndex + 1);
96
+ inputRef = ref.slice(0, colonIndex + 1 + shaAtIndex);
97
+ }
98
+ }
99
+ }
100
+ else {
101
+ const lastAtIndex = ref.lastIndexOf('@');
102
+ if (lastAtIndex !== -1) {
103
+ const potentialSha = ref.slice(lastAtIndex + 1);
104
+ // SHA should not contain : or / (those would indicate URL structure)
105
+ if (!potentialSha.includes(':') && !potentialSha.includes('/')) {
106
+ if (!potentialSha) {
107
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Invalid remote ref: ${ref} (empty SHA after @)`);
108
+ }
109
+ sha = potentialSha;
110
+ inputRef = ref.slice(0, lastAtIndex);
111
+ }
112
+ }
113
+ }
114
+ // Normalize GitHub URLs to owner/repo format
115
+ const repoPath = normalizeGitHubUrl(inputRef) ?? inputRef;
116
+ const slashIndex = repoPath.indexOf('/');
117
+ if (slashIndex === -1) {
118
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Invalid remote ref: ${ref} (expected owner/repo format)`);
119
+ }
120
+ const owner = repoPath.slice(0, slashIndex);
121
+ const repo = repoPath.slice(slashIndex + 1);
122
+ if (!owner || !repo) {
123
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Invalid remote ref: ${ref} (empty owner or repo)`);
124
+ }
125
+ if (repo.includes('/')) {
126
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Invalid remote ref: ${ref} (repo name cannot contain /)`);
127
+ }
128
+ // Security: Prevent git flag injection by rejecting values starting with '-'
129
+ if (owner.startsWith('-')) {
130
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Invalid remote ref: ${ref} (owner cannot start with -)`);
131
+ }
132
+ if (repo.startsWith('-')) {
133
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Invalid remote ref: ${ref} (repo cannot start with -)`);
134
+ }
135
+ if (sha?.startsWith('-')) {
136
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Invalid remote ref: ${ref} (SHA cannot start with -)`);
137
+ }
138
+ return { owner, repo, sha };
139
+ }
140
+ /**
141
+ * Format a parsed remote ref back to string format.
142
+ */
143
+ function formatRemoteRef(parsed) {
144
+ const base = `${parsed.owner}/${parsed.repo}`;
145
+ return parsed.sha ? `${base}@${parsed.sha}` : base;
146
+ }
147
+ /**
148
+ * Get the base directory for caching remote skills.
149
+ * Respects WARDEN_STATE_DIR environment variable.
150
+ * Default: ~/.local/warden/skills/
151
+ */
152
+ function getSkillsCacheDir() {
153
+ const stateDir = process.env['WARDEN_STATE_DIR'];
154
+ if (stateDir) {
155
+ return (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(stateDir, 'skills');
156
+ }
157
+ return (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)((0,node_os__WEBPACK_IMPORTED_MODULE_1__.homedir)(), '.local', 'warden', 'skills');
158
+ }
159
+ /**
160
+ * Get the cache path for a specific remote ref.
161
+ * - Unpinned: ~/.local/warden/skills/owner/repo/
162
+ * - Pinned: ~/.local/warden/skills/owner/repo@sha/
163
+ */
164
+ function getRemotePath(ref) {
165
+ const parsed = parseRemoteRef(ref);
166
+ const cacheDir = getSkillsCacheDir();
167
+ if (parsed.sha) {
168
+ return (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(cacheDir, parsed.owner, `${parsed.repo}@${parsed.sha}`);
169
+ }
170
+ return (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(cacheDir, parsed.owner, parsed.repo);
171
+ }
172
+ /**
173
+ * Get the path to the state.json file.
174
+ */
175
+ function getStatePath() {
176
+ return (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(getSkillsCacheDir(), 'state.json');
177
+ }
178
+ /**
179
+ * Load the remote state from state.json.
180
+ * Returns an empty state if the file doesn't exist.
181
+ */
182
+ function loadState() {
183
+ const statePath = getStatePath();
184
+ if (!(0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(statePath)) {
185
+ return { remotes: {} };
186
+ }
187
+ try {
188
+ const content = (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(statePath, 'utf-8');
189
+ const data = JSON.parse(content);
190
+ return RemoteStateSchema.parse(data);
191
+ }
192
+ catch (error) {
193
+ // If state is corrupted, start fresh
194
+ const message = error instanceof Error ? error.message : String(error);
195
+ console.warn(`Warning: Failed to load state.json, starting fresh: ${message}`);
196
+ return { remotes: {} };
197
+ }
198
+ }
199
+ /**
200
+ * Save the remote state to state.json.
201
+ * Uses atomic write (write to temp, then rename).
202
+ */
203
+ function saveState(state) {
204
+ const statePath = getStatePath();
205
+ const stateDir = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.dirname)(statePath);
206
+ // Ensure directory exists
207
+ if (!(0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(stateDir)) {
208
+ (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(stateDir, { recursive: true });
209
+ }
210
+ // Write atomically
211
+ const tempPath = `${statePath}.tmp`;
212
+ (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.writeFileSync)(tempPath, JSON.stringify(state, null, 2), 'utf-8');
213
+ // Rename is atomic on most filesystems
214
+ (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.renameSync)(tempPath, statePath);
215
+ }
216
+ /**
217
+ * Get the TTL for remote skill cache in seconds.
218
+ * Respects WARDEN_SKILL_CACHE_TTL environment variable.
219
+ */
220
+ function getCacheTtlSeconds() {
221
+ const envTtl = process.env['WARDEN_SKILL_CACHE_TTL'];
222
+ if (envTtl) {
223
+ const parsed = parseInt(envTtl, 10);
224
+ if (!isNaN(parsed) && parsed > 0) {
225
+ return parsed;
226
+ }
227
+ }
228
+ return DEFAULT_TTL_SECONDS;
229
+ }
230
+ /**
231
+ * Check if an unpinned remote ref needs to be refreshed.
232
+ * Pinned refs (with @sha) never need refresh.
233
+ */
234
+ function shouldRefresh(ref, state) {
235
+ const parsed = parseRemoteRef(ref);
236
+ // Pinned refs are immutable - never refresh
237
+ if (parsed.sha) {
238
+ return false;
239
+ }
240
+ const entry = state.remotes[ref];
241
+ if (!entry) {
242
+ return true; // Not cached, needs fetch
243
+ }
244
+ const fetchedAt = new Date(entry.fetchedAt).getTime();
245
+ const now = Date.now();
246
+ const ttl = getCacheTtlSeconds() * 1000;
247
+ return now - fetchedAt > ttl;
248
+ }
249
+ /**
250
+ * Execute a git command and return stdout.
251
+ * Uses execFileSync to avoid shell injection vulnerabilities.
252
+ * Throws SkillLoaderError on failure.
253
+ */
254
+ function execGit(args, options) {
255
+ try {
256
+ return (0,node_child_process__WEBPACK_IMPORTED_MODULE_3__.execFileSync)('git', args, {
257
+ encoding: 'utf-8',
258
+ cwd: options?.cwd,
259
+ stdio: ['pipe', 'pipe', 'pipe'],
260
+ }).trim();
261
+ }
262
+ catch (error) {
263
+ const message = error instanceof Error ? error.message : String(error);
264
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Git command failed: git ${args.join(' ')}: ${message}`);
265
+ }
266
+ }
267
+ /**
268
+ * Clone or update a remote repository to the cache.
269
+ * Returns the SHA of the fetched commit.
270
+ */
271
+ async function fetchRemote(ref, options = {}) {
272
+ const { force = false, offline = false, onProgress } = options;
273
+ const parsed = parseRemoteRef(ref);
274
+ const remotePath = getRemotePath(ref);
275
+ const state = loadState();
276
+ const isPinned = !!parsed.sha;
277
+ const isCached = (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(remotePath);
278
+ const needsRefresh = shouldRefresh(ref, state);
279
+ // Check if we have a valid cache (directory exists AND state entry exists)
280
+ const stateEntry = state.remotes[ref];
281
+ const hasValidCache = isCached && !!stateEntry;
282
+ // Handle offline mode
283
+ if (offline) {
284
+ if (hasValidCache) {
285
+ return stateEntry.sha;
286
+ }
287
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Remote skill not cached and offline mode enabled: ${ref}`);
288
+ }
289
+ // Pinned + valid cache = use cache (SHA is immutable)
290
+ if (isPinned && hasValidCache && !force && parsed.sha) {
291
+ return parsed.sha;
292
+ }
293
+ // Unpinned + valid cache + fresh = use cache
294
+ if (!isPinned && hasValidCache && !needsRefresh && !force) {
295
+ return stateEntry.sha;
296
+ }
297
+ const repoUrl = `https://github.com/${parsed.owner}/${parsed.repo}.git`;
298
+ // Clone or update
299
+ if (!isCached) {
300
+ onProgress?.(`Cloning ${ref}...`);
301
+ // Ensure parent directory exists
302
+ const parentDir = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.dirname)(remotePath);
303
+ if (!(0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(parentDir)) {
304
+ (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.mkdirSync)(parentDir, { recursive: true });
305
+ }
306
+ // Clone with minimal depth for unpinned refs
307
+ // Note: '--' separates flags from positional args to prevent flag injection
308
+ if (isPinned && parsed.sha) {
309
+ // For pinned refs, we need full history to checkout the specific SHA
310
+ // Use a shallow clone then deepen if needed
311
+ execGit(['clone', '--depth=1', '--', repoUrl, remotePath]);
312
+ try {
313
+ // Try to checkout the pinned SHA
314
+ // Note: 'checkout' without '--' treats arg as ref; with '--' it's a file path
315
+ execGit(['fetch', '--depth=1', 'origin', '--', parsed.sha], { cwd: remotePath });
316
+ execGit(['checkout', parsed.sha], { cwd: remotePath });
317
+ }
318
+ catch {
319
+ // If SHA not found, do a full fetch and retry
320
+ execGit(['fetch', '--unshallow'], { cwd: remotePath });
321
+ execGit(['checkout', parsed.sha], { cwd: remotePath });
322
+ }
323
+ }
324
+ else if (!isPinned) {
325
+ // For unpinned refs, shallow clone of default branch
326
+ execGit(['clone', '--depth=1', '--', repoUrl, remotePath]);
327
+ }
328
+ }
329
+ else {
330
+ // Update existing cache
331
+ onProgress?.(`Updating ${ref}...`);
332
+ if (!isPinned) {
333
+ // For unpinned refs, pull latest
334
+ execGit(['fetch', '--depth=1', 'origin'], { cwd: remotePath });
335
+ execGit(['reset', '--hard', 'origin/HEAD'], { cwd: remotePath });
336
+ }
337
+ // Pinned refs don't need updates - SHA is immutable
338
+ }
339
+ // Get the current HEAD SHA
340
+ const sha = execGit(['rev-parse', 'HEAD'], { cwd: remotePath });
341
+ // Update state
342
+ state.remotes[ref] = {
343
+ sha,
344
+ fetchedAt: new Date().toISOString(),
345
+ };
346
+ saveState(state);
347
+ return sha;
348
+ }
349
+ /**
350
+ * Parse marketplace.json from a remote repository if it exists.
351
+ * Returns null if the file doesn't exist or is invalid.
352
+ */
353
+ function parseMarketplaceConfig(remotePath) {
354
+ const marketplacePath = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(remotePath, '.claude-plugin', 'marketplace.json');
355
+ if (!(0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(marketplacePath)) {
356
+ return null;
357
+ }
358
+ try {
359
+ const content = (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync)(marketplacePath, 'utf-8');
360
+ const data = JSON.parse(content);
361
+ return MarketplaceConfigSchema.parse(data);
362
+ }
363
+ catch {
364
+ // Invalid or malformed marketplace.json - fall back to traditional discovery
365
+ return null;
366
+ }
367
+ }
368
+ /** Directories to search for skills in remote repositories */
369
+ const REMOTE_SKILL_DIRECTORIES = [
370
+ '', // root level
371
+ 'skills', // skills/ subdirectory
372
+ '.warden/skills', // Warden-specific
373
+ '.agents/skills', // General agent skills
374
+ '.claude/skills', // Claude Code skills
375
+ ];
376
+ /**
377
+ * Discover skills using traditional directory layout.
378
+ * Searches root level, skills/, and conventional skill directories.
379
+ */
380
+ async function discoverTraditionalSkills(remotePath) {
381
+ const skills = [];
382
+ const seenNames = new Set();
383
+ for (const subdir of REMOTE_SKILL_DIRECTORIES) {
384
+ const searchPath = subdir ? (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(remotePath, subdir) : remotePath;
385
+ if (!(0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(searchPath))
386
+ continue;
387
+ const entries = (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync)(searchPath);
388
+ for (const entry of entries) {
389
+ if (entry.startsWith('.'))
390
+ continue;
391
+ const entryPath = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(searchPath, entry);
392
+ const stat = (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.statSync)(entryPath);
393
+ if (stat.isDirectory()) {
394
+ const skillMdPath = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(entryPath, 'SKILL.md');
395
+ if ((0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(skillMdPath)) {
396
+ try {
397
+ const skill = await (0,_loader_js__WEBPACK_IMPORTED_MODULE_4__/* .loadSkillFromMarkdown */ .hl)(skillMdPath);
398
+ // First occurrence wins (root takes precedence over skills/)
399
+ if (!seenNames.has(skill.name)) {
400
+ seenNames.add(skill.name);
401
+ skills.push({
402
+ name: skill.name,
403
+ description: skill.description,
404
+ path: entryPath,
405
+ });
406
+ }
407
+ }
408
+ catch {
409
+ // Skip invalid skill directories
410
+ }
411
+ }
412
+ }
413
+ }
414
+ }
415
+ return skills;
416
+ }
417
+ /**
418
+ * Discover skills using marketplace format.
419
+ * Searches plugins/{plugin}/skills/ for each plugin defined in marketplace.json.
420
+ */
421
+ async function discoverMarketplaceSkills(remotePath, config) {
422
+ const skills = [];
423
+ const seenNames = new Set();
424
+ for (const plugin of config.plugins) {
425
+ // Resolve plugin source path (e.g., "./plugins/sentry-skills" -> "plugins/sentry-skills")
426
+ const pluginSource = plugin.source.replace(/^\.\//, '');
427
+ const skillsPath = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(remotePath, pluginSource, 'skills');
428
+ if (!(0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(skillsPath))
429
+ continue;
430
+ const entries = (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync)(skillsPath);
431
+ for (const entry of entries) {
432
+ if (entry.startsWith('.'))
433
+ continue;
434
+ const entryPath = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(skillsPath, entry);
435
+ const stat = (0,node_fs__WEBPACK_IMPORTED_MODULE_0__.statSync)(entryPath);
436
+ if (stat.isDirectory()) {
437
+ const skillMdPath = (0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(entryPath, 'SKILL.md');
438
+ if ((0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(skillMdPath)) {
439
+ try {
440
+ const skill = await (0,_loader_js__WEBPACK_IMPORTED_MODULE_4__/* .loadSkillFromMarkdown */ .hl)(skillMdPath);
441
+ // First plugin wins for duplicate skill names
442
+ if (!seenNames.has(skill.name)) {
443
+ seenNames.add(skill.name);
444
+ skills.push({
445
+ name: skill.name,
446
+ description: skill.description,
447
+ path: entryPath,
448
+ pluginName: plugin.name,
449
+ });
450
+ }
451
+ }
452
+ catch {
453
+ // Skip invalid skill directories
454
+ }
455
+ }
456
+ }
457
+ }
458
+ }
459
+ return skills;
460
+ }
461
+ /**
462
+ * Discover all skills in a cached remote repository.
463
+ * Detects format and delegates to appropriate discovery function:
464
+ * - If .claude-plugin/marketplace.json exists, uses marketplace discovery
465
+ * - Otherwise, uses traditional discovery (root, skills/, .warden/skills, etc.)
466
+ */
467
+ async function discoverRemoteSkills(ref) {
468
+ const remotePath = getRemotePath(ref);
469
+ if (!(0,node_fs__WEBPACK_IMPORTED_MODULE_0__.existsSync)(remotePath)) {
470
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Remote not cached: ${ref}. Run fetch first.`);
471
+ }
472
+ // Check for marketplace format
473
+ const marketplaceConfig = parseMarketplaceConfig(remotePath);
474
+ if (marketplaceConfig) {
475
+ return discoverMarketplaceSkills(remotePath, marketplaceConfig);
476
+ }
477
+ // Fall back to traditional discovery
478
+ return discoverTraditionalSkills(remotePath);
479
+ }
480
+ /**
481
+ * Resolve a skill from a remote repository.
482
+ * Ensures the remote is fetched/cached, then loads the skill.
483
+ * Matches by skill name (from SKILL.md), not directory name.
484
+ */
485
+ async function resolveRemoteSkill(ref, skillName, options = {}) {
486
+ await fetchRemote(ref, options);
487
+ const availableSkills = await discoverRemoteSkills(ref);
488
+ const match = availableSkills.find((s) => s.name === skillName);
489
+ if (match) {
490
+ return (0,_loader_js__WEBPACK_IMPORTED_MODULE_4__/* .loadSkillFromMarkdown */ .hl)((0,node_path__WEBPACK_IMPORTED_MODULE_2__.join)(match.path, 'SKILL.md'));
491
+ }
492
+ if (availableSkills.length === 0) {
493
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`No skills found in remote: ${ref}`);
494
+ }
495
+ throw new _loader_js__WEBPACK_IMPORTED_MODULE_4__/* .SkillLoaderError */ .vN(`Skill '${skillName}' not found in remote: ${ref}. Available skills: ${availableSkills.map((s) => s.name).join(', ')}`);
496
+ }
497
+ /**
498
+ * Remove a remote from the cache.
499
+ */
500
+ function removeRemote(ref) {
501
+ const remotePath = getRemotePath(ref);
502
+ if (existsSync(remotePath)) {
503
+ rmSync(remotePath, { recursive: true, force: true });
504
+ }
505
+ const state = loadState();
506
+ const { [ref]: _removed, ...remainingRemotes } = state.remotes;
507
+ state.remotes = remainingRemotes;
508
+ saveState(state);
509
+ }
510
+ /**
511
+ * List all cached remotes with their metadata.
512
+ */
513
+ function listCachedRemotes() {
514
+ const state = loadState();
515
+ return Object.entries(state.remotes).map(([ref, entry]) => ({ ref, entry }));
516
+ }
517
+
518
+
519
+ /***/ })
520
+
521
+ };
522
+
523
+ //# sourceMappingURL=159.index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"159.index.js","mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;;;;;;;AAOA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;;AAEA;AACA;AACA;AACA;AACA;AAEA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;AAIA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;AAEA;AACA;AACA;AACA;AAEA;;;AAGA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;AAGA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAWA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAUA;;;AAGA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAEA;AAEA;AACA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;;;AAGA;AACA;AAIA;AACA;AAEA;AACA;AACA;AACA;AAEA;AAAA;AAEA;AAEA;AACA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;;;;;AAKA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;;;;AAIA;AACA;AAKA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAGA;AAEA;;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;;AAEA;AACA;AACA;AACA;AACA","sources":[".././src/skills/remote.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync, renameSync, readdirSync, statSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, join } from 'node:path';\nimport { execFileSync } from 'node:child_process';\nimport { z } from 'zod';\nimport { loadSkillFromMarkdown, SkillLoaderError } from './loader.js';\nimport type { SkillDefinition } from '../config/schema.js';\n\n/** Default TTL for unpinned remote skills: 24 hours */\nconst DEFAULT_TTL_SECONDS = 86400;\n\n/** Schema for a single remote entry in state.json */\nconst RemoteEntrySchema = z.object({\n sha: z.string(),\n fetchedAt: z.string().datetime(),\n});\n\n/** Schema for the entire state.json file */\nconst RemoteStateSchema = z.object({\n remotes: z.record(z.string(), RemoteEntrySchema),\n});\n\nexport type RemoteEntry = z.infer<typeof RemoteEntrySchema>;\nexport type RemoteState = z.infer<typeof RemoteStateSchema>;\n\n/** Schema for a plugin in marketplace.json */\nconst MarketplacePluginSchema = z.object({\n name: z.string(),\n source: z.string(),\n description: z.string().optional(),\n category: z.string().optional(),\n});\n\n/** Schema for .claude-plugin/marketplace.json */\nconst MarketplaceConfigSchema = z.object({\n $schema: z.string().optional(),\n name: z.string(),\n description: z.string().optional(),\n plugins: z.array(MarketplacePluginSchema),\n});\n\ntype MarketplaceConfig = z.infer<typeof MarketplaceConfigSchema>;\n\n/** Parsed remote reference */\nexport interface ParsedRemoteRef {\n owner: string;\n repo: string;\n sha?: string;\n}\n\n/**\n * Normalize a GitHub URL to owner/repo format.\n * Returns null if the input is not a recognized GitHub URL.\n *\n * Supports:\n * - https://github.com/owner/repo\n * - https://github.com/owner/repo.git\n * - git@github.com:owner/repo.git\n */\nfunction normalizeGitHubUrl(input: string): string | null {\n // HTTPS URL: https://github.com/owner/repo or https://github.com/owner/repo.git\n const httpsMatch = input.match(/^https?:\\/\\/github\\.com\\/([^/]+)\\/([^/@]+?)(?:\\.git)?$/);\n if (httpsMatch) {\n return `${httpsMatch[1]}/${httpsMatch[2]}`;\n }\n\n // SSH URL: git@github.com:owner/repo.git\n const sshMatch = input.match(/^git@github\\.com:([^/]+)\\/([^/@]+?)(?:\\.git)?$/);\n if (sshMatch) {\n return `${sshMatch[1]}/${sshMatch[2]}`;\n }\n\n return null;\n}\n\n/**\n * Parse a remote reference string into its components.\n * Supports formats:\n * - \"owner/repo\" or \"owner/repo@sha\"\n * - \"https://github.com/owner/repo\" or \"https://github.com/owner/repo@sha\"\n * - \"https://github.com/owner/repo.git\" or \"https://github.com/owner/repo.git@sha\"\n * - \"git@github.com:owner/repo.git\" or \"git@github.com:owner/repo.git@sha\"\n */\nexport function parseRemoteRef(ref: string): ParsedRemoteRef {\n let inputRef = ref;\n let sha: string | undefined;\n\n // Extract SHA suffix from the input before URL normalization.\n // The SHA is always at the end, after a @ that follows the repo name.\n // For git@github.com URLs, we need to find the @ after the colon.\n if (ref.startsWith('git@')) {\n const colonIndex = ref.indexOf(':');\n if (colonIndex !== -1) {\n const afterColon = ref.slice(colonIndex + 1);\n const shaAtIndex = afterColon.lastIndexOf('@');\n if (shaAtIndex !== -1) {\n sha = afterColon.slice(shaAtIndex + 1);\n inputRef = ref.slice(0, colonIndex + 1 + shaAtIndex);\n }\n }\n } else {\n const lastAtIndex = ref.lastIndexOf('@');\n if (lastAtIndex !== -1) {\n const potentialSha = ref.slice(lastAtIndex + 1);\n // SHA should not contain : or / (those would indicate URL structure)\n if (!potentialSha.includes(':') && !potentialSha.includes('/')) {\n if (!potentialSha) {\n throw new SkillLoaderError(`Invalid remote ref: ${ref} (empty SHA after @)`);\n }\n sha = potentialSha;\n inputRef = ref.slice(0, lastAtIndex);\n }\n }\n }\n\n // Normalize GitHub URLs to owner/repo format\n const repoPath = normalizeGitHubUrl(inputRef) ?? inputRef;\n\n const slashIndex = repoPath.indexOf('/');\n if (slashIndex === -1) {\n throw new SkillLoaderError(`Invalid remote ref: ${ref} (expected owner/repo format)`);\n }\n\n const owner = repoPath.slice(0, slashIndex);\n const repo = repoPath.slice(slashIndex + 1);\n\n if (!owner || !repo) {\n throw new SkillLoaderError(`Invalid remote ref: ${ref} (empty owner or repo)`);\n }\n\n if (repo.includes('/')) {\n throw new SkillLoaderError(`Invalid remote ref: ${ref} (repo name cannot contain /)`);\n }\n\n // Security: Prevent git flag injection by rejecting values starting with '-'\n if (owner.startsWith('-')) {\n throw new SkillLoaderError(`Invalid remote ref: ${ref} (owner cannot start with -)`);\n }\n if (repo.startsWith('-')) {\n throw new SkillLoaderError(`Invalid remote ref: ${ref} (repo cannot start with -)`);\n }\n if (sha?.startsWith('-')) {\n throw new SkillLoaderError(`Invalid remote ref: ${ref} (SHA cannot start with -)`);\n }\n\n return { owner, repo, sha };\n}\n\n/**\n * Format a parsed remote ref back to string format.\n */\nexport function formatRemoteRef(parsed: ParsedRemoteRef): string {\n const base = `${parsed.owner}/${parsed.repo}`;\n return parsed.sha ? `${base}@${parsed.sha}` : base;\n}\n\n/**\n * Get the base directory for caching remote skills.\n * Respects WARDEN_STATE_DIR environment variable.\n * Default: ~/.local/warden/skills/\n */\nexport function getSkillsCacheDir(): string {\n const stateDir = process.env['WARDEN_STATE_DIR'];\n if (stateDir) {\n return join(stateDir, 'skills');\n }\n return join(homedir(), '.local', 'warden', 'skills');\n}\n\n/**\n * Get the cache path for a specific remote ref.\n * - Unpinned: ~/.local/warden/skills/owner/repo/\n * - Pinned: ~/.local/warden/skills/owner/repo@sha/\n */\nexport function getRemotePath(ref: string): string {\n const parsed = parseRemoteRef(ref);\n const cacheDir = getSkillsCacheDir();\n\n if (parsed.sha) {\n return join(cacheDir, parsed.owner, `${parsed.repo}@${parsed.sha}`);\n }\n return join(cacheDir, parsed.owner, parsed.repo);\n}\n\n/**\n * Get the path to the state.json file.\n */\nexport function getStatePath(): string {\n return join(getSkillsCacheDir(), 'state.json');\n}\n\n/**\n * Load the remote state from state.json.\n * Returns an empty state if the file doesn't exist.\n */\nexport function loadState(): RemoteState {\n const statePath = getStatePath();\n\n if (!existsSync(statePath)) {\n return { remotes: {} };\n }\n\n try {\n const content = readFileSync(statePath, 'utf-8');\n const data = JSON.parse(content);\n return RemoteStateSchema.parse(data);\n } catch (error) {\n // If state is corrupted, start fresh\n const message = error instanceof Error ? error.message : String(error);\n console.warn(`Warning: Failed to load state.json, starting fresh: ${message}`);\n return { remotes: {} };\n }\n}\n\n/**\n * Save the remote state to state.json.\n * Uses atomic write (write to temp, then rename).\n */\nexport function saveState(state: RemoteState): void {\n const statePath = getStatePath();\n const stateDir = dirname(statePath);\n\n // Ensure directory exists\n if (!existsSync(stateDir)) {\n mkdirSync(stateDir, { recursive: true });\n }\n\n // Write atomically\n const tempPath = `${statePath}.tmp`;\n writeFileSync(tempPath, JSON.stringify(state, null, 2), 'utf-8');\n\n // Rename is atomic on most filesystems\n renameSync(tempPath, statePath);\n}\n\n/**\n * Get the TTL for remote skill cache in seconds.\n * Respects WARDEN_SKILL_CACHE_TTL environment variable.\n */\nexport function getCacheTtlSeconds(): number {\n const envTtl = process.env['WARDEN_SKILL_CACHE_TTL'];\n if (envTtl) {\n const parsed = parseInt(envTtl, 10);\n if (!isNaN(parsed) && parsed > 0) {\n return parsed;\n }\n }\n return DEFAULT_TTL_SECONDS;\n}\n\n/**\n * Check if an unpinned remote ref needs to be refreshed.\n * Pinned refs (with @sha) never need refresh.\n */\nexport function shouldRefresh(ref: string, state: RemoteState): boolean {\n const parsed = parseRemoteRef(ref);\n\n // Pinned refs are immutable - never refresh\n if (parsed.sha) {\n return false;\n }\n\n const entry = state.remotes[ref];\n if (!entry) {\n return true; // Not cached, needs fetch\n }\n\n const fetchedAt = new Date(entry.fetchedAt).getTime();\n const now = Date.now();\n const ttl = getCacheTtlSeconds() * 1000;\n\n return now - fetchedAt > ttl;\n}\n\nexport interface FetchRemoteOptions {\n /** Force refresh even if cache is valid */\n force?: boolean;\n /** Skip network operations - only use cache */\n offline?: boolean;\n /** Callback for progress messages */\n onProgress?: (message: string) => void;\n}\n\n/**\n * Execute a git command and return stdout.\n * Uses execFileSync to avoid shell injection vulnerabilities.\n * Throws SkillLoaderError on failure.\n */\nfunction execGit(args: string[], options?: { cwd?: string }): string {\n try {\n return execFileSync('git', args, {\n encoding: 'utf-8',\n cwd: options?.cwd,\n stdio: ['pipe', 'pipe', 'pipe'],\n }).trim();\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new SkillLoaderError(`Git command failed: git ${args.join(' ')}: ${message}`);\n }\n}\n\n/**\n * Clone or update a remote repository to the cache.\n * Returns the SHA of the fetched commit.\n */\nexport async function fetchRemote(ref: string, options: FetchRemoteOptions = {}): Promise<string> {\n const { force = false, offline = false, onProgress } = options;\n const parsed = parseRemoteRef(ref);\n const remotePath = getRemotePath(ref);\n const state = loadState();\n\n const isPinned = !!parsed.sha;\n const isCached = existsSync(remotePath);\n const needsRefresh = shouldRefresh(ref, state);\n\n // Check if we have a valid cache (directory exists AND state entry exists)\n const stateEntry = state.remotes[ref];\n const hasValidCache = isCached && !!stateEntry;\n\n // Handle offline mode\n if (offline) {\n if (hasValidCache) {\n return stateEntry.sha;\n }\n throw new SkillLoaderError(`Remote skill not cached and offline mode enabled: ${ref}`);\n }\n\n // Pinned + valid cache = use cache (SHA is immutable)\n if (isPinned && hasValidCache && !force && parsed.sha) {\n return parsed.sha;\n }\n\n // Unpinned + valid cache + fresh = use cache\n if (!isPinned && hasValidCache && !needsRefresh && !force) {\n return stateEntry.sha;\n }\n\n const repoUrl = `https://github.com/${parsed.owner}/${parsed.repo}.git`;\n\n // Clone or update\n if (!isCached) {\n onProgress?.(`Cloning ${ref}...`);\n\n // Ensure parent directory exists\n const parentDir = dirname(remotePath);\n if (!existsSync(parentDir)) {\n mkdirSync(parentDir, { recursive: true });\n }\n\n // Clone with minimal depth for unpinned refs\n // Note: '--' separates flags from positional args to prevent flag injection\n if (isPinned && parsed.sha) {\n // For pinned refs, we need full history to checkout the specific SHA\n // Use a shallow clone then deepen if needed\n execGit(['clone', '--depth=1', '--', repoUrl, remotePath]);\n\n try {\n // Try to checkout the pinned SHA\n // Note: 'checkout' without '--' treats arg as ref; with '--' it's a file path\n execGit(['fetch', '--depth=1', 'origin', '--', parsed.sha], { cwd: remotePath });\n execGit(['checkout', parsed.sha], { cwd: remotePath });\n } catch {\n // If SHA not found, do a full fetch and retry\n execGit(['fetch', '--unshallow'], { cwd: remotePath });\n execGit(['checkout', parsed.sha], { cwd: remotePath });\n }\n } else if (!isPinned) {\n // For unpinned refs, shallow clone of default branch\n execGit(['clone', '--depth=1', '--', repoUrl, remotePath]);\n }\n } else {\n // Update existing cache\n onProgress?.(`Updating ${ref}...`);\n\n if (!isPinned) {\n // For unpinned refs, pull latest\n execGit(['fetch', '--depth=1', 'origin'], { cwd: remotePath });\n execGit(['reset', '--hard', 'origin/HEAD'], { cwd: remotePath });\n }\n // Pinned refs don't need updates - SHA is immutable\n }\n\n // Get the current HEAD SHA\n const sha = execGit(['rev-parse', 'HEAD'], { cwd: remotePath });\n\n // Update state\n state.remotes[ref] = {\n sha,\n fetchedAt: new Date().toISOString(),\n };\n saveState(state);\n\n return sha;\n}\n\nexport interface DiscoveredRemoteSkill {\n name: string;\n description: string;\n path: string;\n /** Plugin name for marketplace format skills */\n pluginName?: string;\n}\n\n/**\n * Parse marketplace.json from a remote repository if it exists.\n * Returns null if the file doesn't exist or is invalid.\n */\nfunction parseMarketplaceConfig(remotePath: string): MarketplaceConfig | null {\n const marketplacePath = join(remotePath, '.claude-plugin', 'marketplace.json');\n\n if (!existsSync(marketplacePath)) {\n return null;\n }\n\n try {\n const content = readFileSync(marketplacePath, 'utf-8');\n const data = JSON.parse(content);\n return MarketplaceConfigSchema.parse(data);\n } catch {\n // Invalid or malformed marketplace.json - fall back to traditional discovery\n return null;\n }\n}\n\n/** Directories to search for skills in remote repositories */\nconst REMOTE_SKILL_DIRECTORIES = [\n '', // root level\n 'skills', // skills/ subdirectory\n '.warden/skills', // Warden-specific\n '.agents/skills', // General agent skills\n '.claude/skills', // Claude Code skills\n];\n\n/**\n * Discover skills using traditional directory layout.\n * Searches root level, skills/, and conventional skill directories.\n */\nasync function discoverTraditionalSkills(remotePath: string): Promise<DiscoveredRemoteSkill[]> {\n const skills: DiscoveredRemoteSkill[] = [];\n const seenNames = new Set<string>();\n\n for (const subdir of REMOTE_SKILL_DIRECTORIES) {\n const searchPath = subdir ? join(remotePath, subdir) : remotePath;\n if (!existsSync(searchPath)) continue;\n\n const entries = readdirSync(searchPath);\n\n for (const entry of entries) {\n if (entry.startsWith('.')) continue;\n\n const entryPath = join(searchPath, entry);\n const stat = statSync(entryPath);\n\n if (stat.isDirectory()) {\n const skillMdPath = join(entryPath, 'SKILL.md');\n if (existsSync(skillMdPath)) {\n try {\n const skill = await loadSkillFromMarkdown(skillMdPath);\n // First occurrence wins (root takes precedence over skills/)\n if (!seenNames.has(skill.name)) {\n seenNames.add(skill.name);\n skills.push({\n name: skill.name,\n description: skill.description,\n path: entryPath,\n });\n }\n } catch {\n // Skip invalid skill directories\n }\n }\n }\n }\n }\n\n return skills;\n}\n\n/**\n * Discover skills using marketplace format.\n * Searches plugins/{plugin}/skills/ for each plugin defined in marketplace.json.\n */\nasync function discoverMarketplaceSkills(\n remotePath: string,\n config: MarketplaceConfig\n): Promise<DiscoveredRemoteSkill[]> {\n const skills: DiscoveredRemoteSkill[] = [];\n const seenNames = new Set<string>();\n\n for (const plugin of config.plugins) {\n // Resolve plugin source path (e.g., \"./plugins/sentry-skills\" -> \"plugins/sentry-skills\")\n const pluginSource = plugin.source.replace(/^\\.\\//, '');\n const skillsPath = join(remotePath, pluginSource, 'skills');\n\n if (!existsSync(skillsPath)) continue;\n\n const entries = readdirSync(skillsPath);\n\n for (const entry of entries) {\n if (entry.startsWith('.')) continue;\n\n const entryPath = join(skillsPath, entry);\n const stat = statSync(entryPath);\n\n if (stat.isDirectory()) {\n const skillMdPath = join(entryPath, 'SKILL.md');\n if (existsSync(skillMdPath)) {\n try {\n const skill = await loadSkillFromMarkdown(skillMdPath);\n // First plugin wins for duplicate skill names\n if (!seenNames.has(skill.name)) {\n seenNames.add(skill.name);\n skills.push({\n name: skill.name,\n description: skill.description,\n path: entryPath,\n pluginName: plugin.name,\n });\n }\n } catch {\n // Skip invalid skill directories\n }\n }\n }\n }\n }\n\n return skills;\n}\n\n/**\n * Discover all skills in a cached remote repository.\n * Detects format and delegates to appropriate discovery function:\n * - If .claude-plugin/marketplace.json exists, uses marketplace discovery\n * - Otherwise, uses traditional discovery (root, skills/, .warden/skills, etc.)\n */\nexport async function discoverRemoteSkills(ref: string): Promise<DiscoveredRemoteSkill[]> {\n const remotePath = getRemotePath(ref);\n\n if (!existsSync(remotePath)) {\n throw new SkillLoaderError(`Remote not cached: ${ref}. Run fetch first.`);\n }\n\n // Check for marketplace format\n const marketplaceConfig = parseMarketplaceConfig(remotePath);\n if (marketplaceConfig) {\n return discoverMarketplaceSkills(remotePath, marketplaceConfig);\n }\n\n // Fall back to traditional discovery\n return discoverTraditionalSkills(remotePath);\n}\n\n/**\n * Resolve a skill from a remote repository.\n * Ensures the remote is fetched/cached, then loads the skill.\n * Matches by skill name (from SKILL.md), not directory name.\n */\nexport async function resolveRemoteSkill(\n ref: string,\n skillName: string,\n options: FetchRemoteOptions = {}\n): Promise<SkillDefinition> {\n await fetchRemote(ref, options);\n\n const availableSkills = await discoverRemoteSkills(ref);\n const match = availableSkills.find((s) => s.name === skillName);\n\n if (match) {\n return loadSkillFromMarkdown(join(match.path, 'SKILL.md'));\n }\n\n if (availableSkills.length === 0) {\n throw new SkillLoaderError(`No skills found in remote: ${ref}`);\n }\n\n throw new SkillLoaderError(\n `Skill '${skillName}' not found in remote: ${ref}. Available skills: ${availableSkills.map((s) => s.name).join(', ')}`\n );\n}\n\n/**\n * Remove a remote from the cache.\n */\nexport function removeRemote(ref: string): void {\n const remotePath = getRemotePath(ref);\n\n if (existsSync(remotePath)) {\n rmSync(remotePath, { recursive: true, force: true });\n }\n\n const state = loadState();\n const { [ref]: _removed, ...remainingRemotes } = state.remotes;\n state.remotes = remainingRemotes;\n saveState(state);\n}\n\n/**\n * List all cached remotes with their metadata.\n */\nexport function listCachedRemotes(): { ref: string; entry: RemoteEntry }[] {\n const state = loadState();\n return Object.entries(state.remotes).map(([ref, entry]) => ({ ref, entry }));\n}\n"],"names":[],"sourceRoot":""}
@@ -0,0 +1,2 @@
1
+ export * from './main.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["file:///home/runner/work/warden/warden/src/action/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["file:///home/runner/work/warden/warden/src/action/main.ts"],"names":[],"mappings":""}