@kynetic-ai/spec 0.1.2 → 0.3.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 (510) hide show
  1. package/README.md +250 -17
  2. package/dist/acp/client.d.ts +18 -4
  3. package/dist/acp/client.d.ts.map +1 -1
  4. package/dist/acp/client.js +44 -26
  5. package/dist/acp/client.js.map +1 -1
  6. package/dist/acp/framing.d.ts +2 -2
  7. package/dist/acp/framing.d.ts.map +1 -1
  8. package/dist/acp/framing.js +37 -29
  9. package/dist/acp/framing.js.map +1 -1
  10. package/dist/acp/index.d.ts +6 -7
  11. package/dist/acp/index.d.ts.map +1 -1
  12. package/dist/acp/index.js +3 -3
  13. package/dist/acp/index.js.map +1 -1
  14. package/dist/acp/types.d.ts +5 -5
  15. package/dist/acp/types.d.ts.map +1 -1
  16. package/dist/acp/types.js +18 -18
  17. package/dist/acp/types.js.map +1 -1
  18. package/dist/agents/adapters.d.ts.map +1 -1
  19. package/dist/agents/adapters.js +24 -13
  20. package/dist/agents/adapters.js.map +1 -1
  21. package/dist/agents/index.d.ts +2 -2
  22. package/dist/agents/index.js +2 -2
  23. package/dist/agents/spawner.d.ts +4 -4
  24. package/dist/agents/spawner.d.ts.map +1 -1
  25. package/dist/agents/spawner.js +6 -6
  26. package/dist/agents/spawner.js.map +1 -1
  27. package/dist/cli/batch-context.d.ts +43 -0
  28. package/dist/cli/batch-context.d.ts.map +1 -0
  29. package/dist/cli/batch-context.js +93 -0
  30. package/dist/cli/batch-context.js.map +1 -0
  31. package/dist/cli/batch-exec.d.ts +116 -0
  32. package/dist/cli/batch-exec.d.ts.map +1 -0
  33. package/dist/cli/batch-exec.js +694 -0
  34. package/dist/cli/batch-exec.js.map +1 -0
  35. package/dist/cli/batch.d.ts +4 -2
  36. package/dist/cli/batch.d.ts.map +1 -1
  37. package/dist/cli/batch.js +15 -14
  38. package/dist/cli/batch.js.map +1 -1
  39. package/dist/cli/command-annotations.d.ts +23 -0
  40. package/dist/cli/command-annotations.d.ts.map +1 -0
  41. package/dist/cli/command-annotations.js +27 -0
  42. package/dist/cli/command-annotations.js.map +1 -0
  43. package/dist/cli/commands/agents.d.ts +46 -0
  44. package/dist/cli/commands/agents.d.ts.map +1 -0
  45. package/dist/cli/commands/agents.js +377 -0
  46. package/dist/cli/commands/agents.js.map +1 -0
  47. package/dist/cli/commands/batch.d.ts +20 -0
  48. package/dist/cli/commands/batch.d.ts.map +1 -0
  49. package/dist/cli/commands/batch.js +214 -0
  50. package/dist/cli/commands/batch.js.map +1 -0
  51. package/dist/cli/commands/clone-for-testing.d.ts +1 -1
  52. package/dist/cli/commands/clone-for-testing.d.ts.map +1 -1
  53. package/dist/cli/commands/clone-for-testing.js +37 -47
  54. package/dist/cli/commands/clone-for-testing.js.map +1 -1
  55. package/dist/cli/commands/derive.d.ts +1 -1
  56. package/dist/cli/commands/derive.d.ts.map +1 -1
  57. package/dist/cli/commands/derive.js +140 -88
  58. package/dist/cli/commands/derive.js.map +1 -1
  59. package/dist/cli/commands/doctor.d.ts +11 -0
  60. package/dist/cli/commands/doctor.d.ts.map +1 -0
  61. package/dist/cli/commands/doctor.js +152 -0
  62. package/dist/cli/commands/doctor.js.map +1 -0
  63. package/dist/cli/commands/export.d.ts +12 -0
  64. package/dist/cli/commands/export.d.ts.map +1 -0
  65. package/dist/cli/commands/export.js +134 -0
  66. package/dist/cli/commands/export.js.map +1 -0
  67. package/dist/cli/commands/help.d.ts +1 -1
  68. package/dist/cli/commands/help.d.ts.map +1 -1
  69. package/dist/cli/commands/help.js +163 -37
  70. package/dist/cli/commands/help.js.map +1 -1
  71. package/dist/cli/commands/inbox.d.ts +1 -1
  72. package/dist/cli/commands/inbox.d.ts.map +1 -1
  73. package/dist/cli/commands/inbox.js +178 -56
  74. package/dist/cli/commands/inbox.js.map +1 -1
  75. package/dist/cli/commands/index.d.ts +31 -19
  76. package/dist/cli/commands/index.d.ts.map +1 -1
  77. package/dist/cli/commands/index.js +31 -19
  78. package/dist/cli/commands/index.js.map +1 -1
  79. package/dist/cli/commands/init.d.ts +5 -1
  80. package/dist/cli/commands/init.d.ts.map +1 -1
  81. package/dist/cli/commands/init.js +108 -57
  82. package/dist/cli/commands/init.js.map +1 -1
  83. package/dist/cli/commands/item.d.ts +1 -1
  84. package/dist/cli/commands/item.d.ts.map +1 -1
  85. package/dist/cli/commands/item.js +557 -274
  86. package/dist/cli/commands/item.js.map +1 -1
  87. package/dist/cli/commands/link.d.ts +1 -1
  88. package/dist/cli/commands/link.d.ts.map +1 -1
  89. package/dist/cli/commands/link.js +55 -46
  90. package/dist/cli/commands/link.js.map +1 -1
  91. package/dist/cli/commands/log.d.ts +1 -1
  92. package/dist/cli/commands/log.d.ts.map +1 -1
  93. package/dist/cli/commands/log.js +57 -51
  94. package/dist/cli/commands/log.js.map +1 -1
  95. package/dist/cli/commands/merge-driver.d.ts +19 -0
  96. package/dist/cli/commands/merge-driver.d.ts.map +1 -0
  97. package/dist/cli/commands/merge-driver.js +398 -0
  98. package/dist/cli/commands/merge-driver.js.map +1 -0
  99. package/dist/cli/commands/meta.d.ts +1 -1
  100. package/dist/cli/commands/meta.d.ts.map +1 -1
  101. package/dist/cli/commands/meta.js +533 -399
  102. package/dist/cli/commands/meta.js.map +1 -1
  103. package/dist/cli/commands/module.d.ts +1 -1
  104. package/dist/cli/commands/module.d.ts.map +1 -1
  105. package/dist/cli/commands/module.js +30 -25
  106. package/dist/cli/commands/module.js.map +1 -1
  107. package/dist/cli/commands/plan-import.d.ts +11 -0
  108. package/dist/cli/commands/plan-import.d.ts.map +1 -0
  109. package/dist/cli/commands/plan-import.js +516 -0
  110. package/dist/cli/commands/plan-import.js.map +1 -0
  111. package/dist/cli/commands/plan.d.ts +10 -0
  112. package/dist/cli/commands/plan.d.ts.map +1 -0
  113. package/dist/cli/commands/plan.js +421 -0
  114. package/dist/cli/commands/plan.js.map +1 -0
  115. package/dist/cli/commands/ralph.d.ts +1 -1
  116. package/dist/cli/commands/ralph.d.ts.map +1 -1
  117. package/dist/cli/commands/ralph.js +1097 -169
  118. package/dist/cli/commands/ralph.js.map +1 -1
  119. package/dist/cli/commands/refs.d.ts +13 -0
  120. package/dist/cli/commands/refs.d.ts.map +1 -0
  121. package/dist/cli/commands/refs.js +283 -0
  122. package/dist/cli/commands/refs.js.map +1 -0
  123. package/dist/cli/commands/search.d.ts +1 -1
  124. package/dist/cli/commands/search.d.ts.map +1 -1
  125. package/dist/cli/commands/search.js +199 -37
  126. package/dist/cli/commands/search.js.map +1 -1
  127. package/dist/cli/commands/serve.d.ts +10 -0
  128. package/dist/cli/commands/serve.d.ts.map +1 -0
  129. package/dist/cli/commands/serve.js +491 -0
  130. package/dist/cli/commands/serve.js.map +1 -0
  131. package/dist/cli/commands/session.d.ts +25 -6
  132. package/dist/cli/commands/session.d.ts.map +1 -1
  133. package/dist/cli/commands/session.js +811 -127
  134. package/dist/cli/commands/session.js.map +1 -1
  135. package/dist/cli/commands/setup-seeding.d.ts +81 -0
  136. package/dist/cli/commands/setup-seeding.d.ts.map +1 -0
  137. package/dist/cli/commands/setup-seeding.js +292 -0
  138. package/dist/cli/commands/setup-seeding.js.map +1 -0
  139. package/dist/cli/commands/setup.d.ts +77 -3
  140. package/dist/cli/commands/setup.d.ts.map +1 -1
  141. package/dist/cli/commands/setup.js +1233 -274
  142. package/dist/cli/commands/setup.js.map +1 -1
  143. package/dist/cli/commands/shadow.d.ts +1 -1
  144. package/dist/cli/commands/shadow.d.ts.map +1 -1
  145. package/dist/cli/commands/shadow.js +70 -50
  146. package/dist/cli/commands/shadow.js.map +1 -1
  147. package/dist/cli/commands/skill-crud.d.ts +58 -0
  148. package/dist/cli/commands/skill-crud.d.ts.map +1 -0
  149. package/dist/cli/commands/skill-crud.js +753 -0
  150. package/dist/cli/commands/skill-crud.js.map +1 -0
  151. package/dist/cli/commands/skill-diff.d.ts +27 -0
  152. package/dist/cli/commands/skill-diff.d.ts.map +1 -0
  153. package/dist/cli/commands/skill-diff.js +840 -0
  154. package/dist/cli/commands/skill-diff.js.map +1 -0
  155. package/dist/cli/commands/skill-install.d.ts +53 -0
  156. package/dist/cli/commands/skill-install.d.ts.map +1 -0
  157. package/dist/cli/commands/skill-install.js +452 -0
  158. package/dist/cli/commands/skill-install.js.map +1 -0
  159. package/dist/cli/commands/skill.d.ts +20 -0
  160. package/dist/cli/commands/skill.d.ts.map +1 -0
  161. package/dist/cli/commands/skill.js +36 -0
  162. package/dist/cli/commands/skill.js.map +1 -0
  163. package/dist/cli/commands/task.d.ts +1 -1
  164. package/dist/cli/commands/task.d.ts.map +1 -1
  165. package/dist/cli/commands/task.js +569 -346
  166. package/dist/cli/commands/task.js.map +1 -1
  167. package/dist/cli/commands/tasks.d.ts +26 -1
  168. package/dist/cli/commands/tasks.d.ts.map +1 -1
  169. package/dist/cli/commands/tasks.js +227 -122
  170. package/dist/cli/commands/tasks.js.map +1 -1
  171. package/dist/cli/commands/trait.d.ts +1 -1
  172. package/dist/cli/commands/trait.d.ts.map +1 -1
  173. package/dist/cli/commands/trait.js +166 -101
  174. package/dist/cli/commands/trait.js.map +1 -1
  175. package/dist/cli/commands/triage.d.ts +7 -0
  176. package/dist/cli/commands/triage.d.ts.map +1 -0
  177. package/dist/cli/commands/triage.js +569 -0
  178. package/dist/cli/commands/triage.js.map +1 -0
  179. package/dist/cli/commands/util.d.ts +7 -0
  180. package/dist/cli/commands/util.d.ts.map +1 -0
  181. package/dist/cli/commands/util.js +30 -0
  182. package/dist/cli/commands/util.js.map +1 -0
  183. package/dist/cli/commands/validate.d.ts +1 -1
  184. package/dist/cli/commands/validate.d.ts.map +1 -1
  185. package/dist/cli/commands/validate.js +264 -83
  186. package/dist/cli/commands/validate.js.map +1 -1
  187. package/dist/cli/commands/workflow.d.ts +16 -0
  188. package/dist/cli/commands/workflow.d.ts.map +1 -0
  189. package/dist/cli/commands/workflow.js +851 -0
  190. package/dist/cli/commands/workflow.js.map +1 -0
  191. package/dist/cli/exit-codes.d.ts +7 -0
  192. package/dist/cli/exit-codes.d.ts.map +1 -1
  193. package/dist/cli/exit-codes.js +26 -18
  194. package/dist/cli/exit-codes.js.map +1 -1
  195. package/dist/cli/help/content.d.ts.map +1 -1
  196. package/dist/cli/help/content.js +86 -71
  197. package/dist/cli/help/content.js.map +1 -1
  198. package/dist/cli/index.d.ts +1 -1
  199. package/dist/cli/index.d.ts.map +1 -1
  200. package/dist/cli/index.js +131 -19
  201. package/dist/cli/index.js.map +1 -1
  202. package/dist/cli/introspection.d.ts +6 -2
  203. package/dist/cli/introspection.d.ts.map +1 -1
  204. package/dist/cli/introspection.js +11 -8
  205. package/dist/cli/introspection.js.map +1 -1
  206. package/dist/cli/output.d.ts +64 -4
  207. package/dist/cli/output.d.ts.map +1 -1
  208. package/dist/cli/output.js +235 -85
  209. package/dist/cli/output.js.map +1 -1
  210. package/dist/cli/parse-utils.d.ts +21 -0
  211. package/dist/cli/parse-utils.d.ts.map +1 -0
  212. package/dist/cli/parse-utils.js +32 -0
  213. package/dist/cli/parse-utils.js.map +1 -0
  214. package/dist/cli/pid-utils.d.ts +72 -0
  215. package/dist/cli/pid-utils.d.ts.map +1 -0
  216. package/dist/cli/pid-utils.js +174 -0
  217. package/dist/cli/pid-utils.js.map +1 -0
  218. package/dist/cli/suggest.d.ts.map +1 -1
  219. package/dist/cli/suggest.js +1 -2
  220. package/dist/cli/suggest.js.map +1 -1
  221. package/dist/cli/validators.d.ts +43 -0
  222. package/dist/cli/validators.d.ts.map +1 -0
  223. package/dist/cli/validators.js +84 -0
  224. package/dist/cli/validators.js.map +1 -0
  225. package/dist/daemon/index.ts +52 -0
  226. package/dist/daemon/middleware/project-context.ts +126 -0
  227. package/dist/daemon/pid.ts +179 -0
  228. package/dist/daemon/project-context.ts +343 -0
  229. package/dist/daemon/routes/inbox.ts +164 -0
  230. package/dist/daemon/routes/items.ts +322 -0
  231. package/dist/daemon/routes/meta.ts +118 -0
  232. package/dist/daemon/routes/projects.ts +162 -0
  233. package/dist/daemon/routes/tasks.ts +327 -0
  234. package/dist/daemon/routes/triage.ts +468 -0
  235. package/dist/daemon/routes/validation.ts +248 -0
  236. package/dist/daemon/server.ts +408 -0
  237. package/dist/daemon/watcher.ts +195 -0
  238. package/dist/daemon/websocket/handler.ts +138 -0
  239. package/dist/daemon/websocket/heartbeat.ts +71 -0
  240. package/dist/daemon/websocket/pubsub.ts +125 -0
  241. package/dist/daemon/websocket/types.ts +66 -0
  242. package/dist/export/html.d.ts +19 -0
  243. package/dist/export/html.d.ts.map +1 -0
  244. package/dist/export/html.js +239 -0
  245. package/dist/export/html.js.map +1 -0
  246. package/dist/export/index.d.ts +10 -0
  247. package/dist/export/index.d.ts.map +1 -0
  248. package/dist/export/index.js +10 -0
  249. package/dist/export/index.js.map +1 -0
  250. package/dist/export/json.d.ts +24 -0
  251. package/dist/export/json.d.ts.map +1 -0
  252. package/dist/export/json.js +198 -0
  253. package/dist/export/json.js.map +1 -0
  254. package/dist/export/triage.d.ts +51 -0
  255. package/dist/export/triage.d.ts.map +1 -0
  256. package/dist/export/triage.js +83 -0
  257. package/dist/export/triage.js.map +1 -0
  258. package/dist/export/types.d.ts +122 -0
  259. package/dist/export/types.d.ts.map +1 -0
  260. package/dist/export/types.js +9 -0
  261. package/dist/export/types.js.map +1 -0
  262. package/dist/index.d.ts +2 -2
  263. package/dist/index.js +2 -2
  264. package/dist/lib/claude-plugin-registry.d.ts +66 -0
  265. package/dist/lib/claude-plugin-registry.d.ts.map +1 -0
  266. package/dist/lib/claude-plugin-registry.js +318 -0
  267. package/dist/lib/claude-plugin-registry.js.map +1 -0
  268. package/dist/merge/arrays.d.ts +87 -0
  269. package/dist/merge/arrays.d.ts.map +1 -0
  270. package/dist/merge/arrays.js +164 -0
  271. package/dist/merge/arrays.js.map +1 -0
  272. package/dist/merge/file-type.d.ts +32 -0
  273. package/dist/merge/file-type.d.ts.map +1 -0
  274. package/dist/merge/file-type.js +70 -0
  275. package/dist/merge/file-type.js.map +1 -0
  276. package/dist/merge/index.d.ts +14 -0
  277. package/dist/merge/index.d.ts.map +1 -0
  278. package/dist/merge/index.js +11 -0
  279. package/dist/merge/index.js.map +1 -0
  280. package/dist/merge/objects.d.ts +46 -0
  281. package/dist/merge/objects.d.ts.map +1 -0
  282. package/dist/merge/objects.js +193 -0
  283. package/dist/merge/objects.js.map +1 -0
  284. package/dist/merge/parse.d.ts +23 -0
  285. package/dist/merge/parse.d.ts.map +1 -0
  286. package/dist/merge/parse.js +78 -0
  287. package/dist/merge/parse.js.map +1 -0
  288. package/dist/merge/resolve.d.ts +66 -0
  289. package/dist/merge/resolve.d.ts.map +1 -0
  290. package/dist/merge/resolve.js +189 -0
  291. package/dist/merge/resolve.js.map +1 -0
  292. package/dist/merge/types.d.ts +82 -0
  293. package/dist/merge/types.d.ts.map +1 -0
  294. package/dist/merge/types.js +8 -0
  295. package/dist/merge/types.js.map +1 -0
  296. package/dist/parser/agent-data-sections.d.ts +53 -0
  297. package/dist/parser/agent-data-sections.d.ts.map +1 -0
  298. package/dist/parser/agent-data-sections.js +118 -0
  299. package/dist/parser/agent-data-sections.js.map +1 -0
  300. package/dist/parser/alignment.d.ts +4 -4
  301. package/dist/parser/alignment.d.ts.map +1 -1
  302. package/dist/parser/alignment.js +27 -22
  303. package/dist/parser/alignment.js.map +1 -1
  304. package/dist/parser/assess.d.ts +5 -5
  305. package/dist/parser/assess.d.ts.map +1 -1
  306. package/dist/parser/assess.js +36 -32
  307. package/dist/parser/assess.js.map +1 -1
  308. package/dist/parser/config.d.ts +351 -0
  309. package/dist/parser/config.d.ts.map +1 -0
  310. package/dist/parser/config.js +326 -0
  311. package/dist/parser/config.js.map +1 -0
  312. package/dist/parser/convention-validation.d.ts +1 -1
  313. package/dist/parser/convention-validation.d.ts.map +1 -1
  314. package/dist/parser/convention-validation.js +21 -16
  315. package/dist/parser/convention-validation.js.map +1 -1
  316. package/dist/parser/coverage-cache.d.ts +49 -0
  317. package/dist/parser/coverage-cache.d.ts.map +1 -0
  318. package/dist/parser/coverage-cache.js +123 -0
  319. package/dist/parser/coverage-cache.js.map +1 -0
  320. package/dist/parser/daemon-status.d.ts +37 -0
  321. package/dist/parser/daemon-status.d.ts.map +1 -0
  322. package/dist/parser/daemon-status.js +67 -0
  323. package/dist/parser/daemon-status.js.map +1 -0
  324. package/dist/parser/doctor.d.ts +107 -0
  325. package/dist/parser/doctor.d.ts.map +1 -0
  326. package/dist/parser/doctor.js +366 -0
  327. package/dist/parser/doctor.js.map +1 -0
  328. package/dist/parser/fix.d.ts +1 -1
  329. package/dist/parser/fix.d.ts.map +1 -1
  330. package/dist/parser/fix.js +31 -27
  331. package/dist/parser/fix.js.map +1 -1
  332. package/dist/parser/index.d.ts +16 -11
  333. package/dist/parser/index.d.ts.map +1 -1
  334. package/dist/parser/index.js +16 -11
  335. package/dist/parser/index.js.map +1 -1
  336. package/dist/parser/items.d.ts +8 -2
  337. package/dist/parser/items.d.ts.map +1 -1
  338. package/dist/parser/items.js +71 -35
  339. package/dist/parser/items.js.map +1 -1
  340. package/dist/parser/meta.d.ts +167 -9
  341. package/dist/parser/meta.d.ts.map +1 -1
  342. package/dist/parser/meta.js +379 -46
  343. package/dist/parser/meta.js.map +1 -1
  344. package/dist/parser/plan-document.d.ts +189 -0
  345. package/dist/parser/plan-document.d.ts.map +1 -0
  346. package/dist/parser/plan-document.js +340 -0
  347. package/dist/parser/plan-document.js.map +1 -0
  348. package/dist/parser/plans.d.ts +59 -0
  349. package/dist/parser/plans.d.ts.map +1 -0
  350. package/dist/parser/plans.js +239 -0
  351. package/dist/parser/plans.js.map +1 -0
  352. package/dist/parser/refs.d.ts +22 -9
  353. package/dist/parser/refs.d.ts.map +1 -1
  354. package/dist/parser/refs.js +102 -50
  355. package/dist/parser/refs.js.map +1 -1
  356. package/dist/parser/setup-status.d.ts +71 -0
  357. package/dist/parser/setup-status.d.ts.map +1 -0
  358. package/dist/parser/setup-status.js +269 -0
  359. package/dist/parser/setup-status.js.map +1 -0
  360. package/dist/parser/shadow.d.ts +150 -19
  361. package/dist/parser/shadow.d.ts.map +1 -1
  362. package/dist/parser/shadow.js +548 -187
  363. package/dist/parser/shadow.js.map +1 -1
  364. package/dist/parser/skill-render.d.ts +317 -0
  365. package/dist/parser/skill-render.d.ts.map +1 -0
  366. package/dist/parser/skill-render.js +943 -0
  367. package/dist/parser/skill-render.js.map +1 -0
  368. package/dist/parser/traits.d.ts +3 -3
  369. package/dist/parser/traits.d.ts.map +1 -1
  370. package/dist/parser/traits.js +2 -2
  371. package/dist/parser/traits.js.map +1 -1
  372. package/dist/parser/validate-skills.d.ts +32 -0
  373. package/dist/parser/validate-skills.d.ts.map +1 -0
  374. package/dist/parser/validate-skills.js +202 -0
  375. package/dist/parser/validate-skills.js.map +1 -0
  376. package/dist/parser/validate.d.ts +45 -3
  377. package/dist/parser/validate.d.ts.map +1 -1
  378. package/dist/parser/validate.js +622 -105
  379. package/dist/parser/validate.js.map +1 -1
  380. package/dist/parser/yaml.d.ts +83 -19
  381. package/dist/parser/yaml.d.ts.map +1 -1
  382. package/dist/parser/yaml.js +478 -173
  383. package/dist/parser/yaml.js.map +1 -1
  384. package/dist/ralph/cli-renderer.d.ts +8 -1
  385. package/dist/ralph/cli-renderer.d.ts.map +1 -1
  386. package/dist/ralph/cli-renderer.js +105 -34
  387. package/dist/ralph/cli-renderer.js.map +1 -1
  388. package/dist/ralph/events.d.ts +10 -10
  389. package/dist/ralph/events.d.ts.map +1 -1
  390. package/dist/ralph/events.js +277 -98
  391. package/dist/ralph/events.js.map +1 -1
  392. package/dist/ralph/index.d.ts +5 -2
  393. package/dist/ralph/index.d.ts.map +1 -1
  394. package/dist/ralph/index.js +9 -3
  395. package/dist/ralph/index.js.map +1 -1
  396. package/dist/ralph/loop-errors.d.ts +83 -0
  397. package/dist/ralph/loop-errors.d.ts.map +1 -0
  398. package/dist/ralph/loop-errors.js +150 -0
  399. package/dist/ralph/loop-errors.js.map +1 -0
  400. package/dist/ralph/subagent.d.ts +83 -0
  401. package/dist/ralph/subagent.d.ts.map +1 -0
  402. package/dist/ralph/subagent.js +174 -0
  403. package/dist/ralph/subagent.js.map +1 -0
  404. package/dist/ralph/wrap-up.d.ts +125 -0
  405. package/dist/ralph/wrap-up.d.ts.map +1 -0
  406. package/dist/ralph/wrap-up.js +270 -0
  407. package/dist/ralph/wrap-up.js.map +1 -0
  408. package/dist/schema/batch.d.ts +95 -0
  409. package/dist/schema/batch.d.ts.map +1 -0
  410. package/dist/schema/batch.js +24 -0
  411. package/dist/schema/batch.js.map +1 -0
  412. package/dist/schema/common.d.ts +2 -2
  413. package/dist/schema/common.d.ts.map +1 -1
  414. package/dist/schema/common.js +34 -31
  415. package/dist/schema/common.js.map +1 -1
  416. package/dist/schema/inbox.d.ts +12 -12
  417. package/dist/schema/inbox.js +4 -4
  418. package/dist/schema/inbox.js.map +1 -1
  419. package/dist/schema/index.d.ts +8 -5
  420. package/dist/schema/index.d.ts.map +1 -1
  421. package/dist/schema/index.js +8 -5
  422. package/dist/schema/index.js.map +1 -1
  423. package/dist/schema/meta.d.ts +1454 -27
  424. package/dist/schema/meta.d.ts.map +1 -1
  425. package/dist/schema/meta.js +198 -21
  426. package/dist/schema/meta.js.map +1 -1
  427. package/dist/schema/plan.d.ts +285 -0
  428. package/dist/schema/plan.d.ts.map +1 -0
  429. package/dist/schema/plan.js +81 -0
  430. package/dist/schema/plan.js.map +1 -0
  431. package/dist/schema/spec.d.ts +72 -33
  432. package/dist/schema/spec.d.ts.map +1 -1
  433. package/dist/schema/spec.js +22 -9
  434. package/dist/schema/spec.js.map +1 -1
  435. package/dist/schema/task.d.ts +172 -161
  436. package/dist/schema/task.d.ts.map +1 -1
  437. package/dist/schema/task.js +21 -12
  438. package/dist/schema/task.js.map +1 -1
  439. package/dist/schema/triage.d.ts +266 -0
  440. package/dist/schema/triage.d.ts.map +1 -0
  441. package/dist/schema/triage.js +134 -0
  442. package/dist/schema/triage.js.map +1 -0
  443. package/dist/sessions/index.d.ts +2 -2
  444. package/dist/sessions/index.d.ts.map +1 -1
  445. package/dist/sessions/index.js +3 -3
  446. package/dist/sessions/index.js.map +1 -1
  447. package/dist/sessions/store.d.ts +233 -1
  448. package/dist/sessions/store.d.ts.map +1 -1
  449. package/dist/sessions/store.js +628 -31
  450. package/dist/sessions/store.js.map +1 -1
  451. package/dist/sessions/types.d.ts +10 -10
  452. package/dist/sessions/types.d.ts.map +1 -1
  453. package/dist/sessions/types.js +10 -9
  454. package/dist/sessions/types.js.map +1 -1
  455. package/dist/strings/errors.d.ts +51 -0
  456. package/dist/strings/errors.d.ts.map +1 -1
  457. package/dist/strings/errors.js +136 -106
  458. package/dist/strings/errors.js.map +1 -1
  459. package/dist/strings/guidance.d.ts.map +1 -1
  460. package/dist/strings/guidance.js +16 -16
  461. package/dist/strings/guidance.js.map +1 -1
  462. package/dist/strings/index.d.ts +4 -4
  463. package/dist/strings/index.d.ts.map +1 -1
  464. package/dist/strings/index.js +4 -4
  465. package/dist/strings/index.js.map +1 -1
  466. package/dist/strings/labels.d.ts +4 -0
  467. package/dist/strings/labels.d.ts.map +1 -1
  468. package/dist/strings/labels.js +45 -41
  469. package/dist/strings/labels.js.map +1 -1
  470. package/dist/strings/validation.d.ts.map +1 -1
  471. package/dist/strings/validation.js +71 -71
  472. package/dist/strings/validation.js.map +1 -1
  473. package/dist/utils/commit.d.ts +1 -1
  474. package/dist/utils/commit.d.ts.map +1 -1
  475. package/dist/utils/commit.js +28 -26
  476. package/dist/utils/commit.js.map +1 -1
  477. package/dist/utils/git.d.ts +1 -1
  478. package/dist/utils/git.d.ts.map +1 -1
  479. package/dist/utils/git.js +40 -38
  480. package/dist/utils/git.js.map +1 -1
  481. package/dist/utils/grep.js +11 -11
  482. package/dist/utils/grep.js.map +1 -1
  483. package/dist/utils/index.d.ts +7 -7
  484. package/dist/utils/index.d.ts.map +1 -1
  485. package/dist/utils/index.js +4 -4
  486. package/dist/utils/index.js.map +1 -1
  487. package/dist/utils/time.d.ts.map +1 -1
  488. package/dist/utils/time.js +10 -10
  489. package/dist/utils/time.js.map +1 -1
  490. package/package.json +28 -5
  491. package/plugin/.claude-plugin/marketplace.json +17 -0
  492. package/plugin/.claude-plugin/plugin.json +5 -0
  493. package/plugin/plugins/kspec/skills/help/SKILL.md +42 -0
  494. package/plugin/plugins/kspec/skills/triage/SKILL.md +206 -0
  495. package/plugin/plugins/kspec/skills/triage/docs/automation.md +120 -0
  496. package/plugin/plugins/kspec/skills/triage/docs/inbox.md +144 -0
  497. package/plugin/plugins/kspec/skills/triage/docs/observations.md +85 -0
  498. package/templates/agents-sections/01-quick-start.md +22 -0
  499. package/templates/agents-sections/02-shadow-branch.md +34 -0
  500. package/templates/agents-sections/03-task-lifecycle.md +48 -0
  501. package/templates/agents-sections/04-pr-workflow.md +17 -0
  502. package/templates/agents-sections/05-commit-convention.md +27 -0
  503. package/templates/agents-sections/06-ralph-loop.md +45 -0
  504. package/templates/hooks/pre-commit +34 -0
  505. package/templates/skills/help/SKILL.md +37 -0
  506. package/templates/skills/manifest.yaml +15 -0
  507. package/templates/skills/triage/SKILL.md +199 -0
  508. package/templates/skills/triage/docs/automation.md +120 -0
  509. package/templates/skills/triage/docs/inbox.md +144 -0
  510. package/templates/skills/triage/docs/observations.md +85 -0
@@ -7,34 +7,80 @@
7
7
  * - Conventions: project rules and standards
8
8
  * - Observations: feedback about processes
9
9
  */
10
- import * as fs from 'node:fs/promises';
11
- import * as path from 'node:path';
12
- import { ulid } from 'ulid';
13
- import { MetaManifestSchema, AgentSchema, WorkflowSchema, ConventionSchema, ObservationSchema, SessionContextSchema, getMetaItemType, } from '../schema/index.js';
14
- import { readYamlFile, writeYamlFilePreserveFormat, expandIncludePattern, getAuthor } from './yaml.js';
10
+ import * as fs from "node:fs/promises";
11
+ import * as path from "node:path";
12
+ import { ulid } from "ulid";
13
+ import { AgentSchema, ConventionSchema, getMetaItemType, isSkill, MetaManifestSchema, ObservationSchema, SessionContextSchema, SkillSchema, WorkflowRunsFileSchema, WorkflowSchema, } from "../schema/index.js";
14
+ import { expandIncludePattern, getAuthor, readYamlFile, writeYamlFilePreserveFormat, } from "./yaml.js";
15
15
  /**
16
- * Find the meta manifest file (kynetic.meta.yaml)
16
+ * Find the meta manifest file.
17
+ *
18
+ * Discovery algorithm:
19
+ * 1. Check for explicit name: kynetic.meta.yaml (backward compat)
20
+ * 2. If not found, scan directory for *.meta.yaml files
21
+ * 3. For each candidate, validate it contains a 'kynetic_meta:' version field
22
+ * 4. Return first valid match (alphabetically after explicit name)
23
+ *
24
+ * AC: @meta-manifest-discovery ac-1, ac-2, ac-3
17
25
  */
18
26
  export async function findMetaManifest(specDir) {
19
- const candidates = ['kynetic.meta.yaml'];
20
- for (const candidate of candidates) {
21
- const filePath = path.join(specDir, candidate);
22
- try {
23
- await fs.access(filePath);
24
- return filePath;
25
- }
26
- catch {
27
- // File doesn't exist, try next
27
+ // AC: @meta-manifest-discovery ac-1, ac-3 - explicit name has priority
28
+ const priorityPath = path.join(specDir, "kynetic.meta.yaml");
29
+ try {
30
+ await fs.access(priorityPath);
31
+ return priorityPath;
32
+ }
33
+ catch {
34
+ // Continue to glob fallback
35
+ }
36
+ // AC: @meta-manifest-discovery ac-2, ac-3 - glob fallback with validation
37
+ try {
38
+ const entries = await fs.readdir(specDir);
39
+ // AC: @meta-manifest-discovery ac-3 - alphabetical order
40
+ const candidates = entries
41
+ .filter((f) => f.endsWith(".meta.yaml"))
42
+ .sort();
43
+ for (const candidate of candidates) {
44
+ const filePath = path.join(specDir, candidate);
45
+ try {
46
+ const raw = await readYamlFile(filePath);
47
+ // AC: @meta-manifest-discovery ac-2 - validate kynetic_meta version field
48
+ if (raw && typeof raw === "object" && "kynetic_meta" in raw) {
49
+ return filePath;
50
+ }
51
+ }
52
+ catch {
53
+ // Skip invalid files
54
+ }
28
55
  }
29
56
  }
57
+ catch {
58
+ // Directory read failed
59
+ }
30
60
  return null;
31
61
  }
62
+ /**
63
+ * Get the base name (slug) from a manifest path.
64
+ * E.g., "kynetic.yaml" -> "kynetic", "myproject.spec.yaml" -> "myproject"
65
+ */
66
+ function getManifestBaseName(manifestPath) {
67
+ if (!manifestPath)
68
+ return "kynetic";
69
+ const fileName = path.basename(manifestPath);
70
+ // Remove .yaml extension
71
+ let baseName = fileName.replace(/\.yaml$/, "");
72
+ // Remove .spec suffix if present
73
+ baseName = baseName.replace(/\.spec$/, "");
74
+ return baseName || "kynetic";
75
+ }
32
76
  /**
33
77
  * Get the meta manifest file path.
78
+ * Derives from main manifest name (e.g., myproject.yaml -> myproject.meta.yaml)
34
79
  * Returns path even if file doesn't exist yet.
35
80
  */
36
81
  export function getMetaManifestPath(ctx) {
37
- return path.join(ctx.specDir, 'kynetic.meta.yaml');
82
+ const baseName = getManifestBaseName(ctx.manifestPath);
83
+ return path.join(ctx.specDir, `${baseName}.meta.yaml`);
38
84
  }
39
85
  /**
40
86
  * Load meta items from a single file.
@@ -45,10 +91,11 @@ async function loadMetaFile(filePath) {
45
91
  workflows: [],
46
92
  conventions: [],
47
93
  observations: [],
94
+ skills: [],
48
95
  };
49
96
  try {
50
97
  const raw = await readYamlFile(filePath);
51
- if (!raw || typeof raw !== 'object') {
98
+ if (!raw || typeof raw !== "object") {
52
99
  return result;
53
100
  }
54
101
  const obj = raw;
@@ -88,6 +135,16 @@ async function loadMetaFile(filePath) {
88
135
  }
89
136
  }
90
137
  }
138
+ // Parse skills
139
+ // AC: @skill-meta-type ac-4 - skills loaded with _sourceFile set
140
+ if (Array.isArray(obj.skills)) {
141
+ for (const skill of obj.skills) {
142
+ const parsed = SkillSchema.safeParse(skill);
143
+ if (parsed.success) {
144
+ result.skills.push({ ...parsed.data, _sourceFile: filePath });
145
+ }
146
+ }
147
+ }
91
148
  }
92
149
  catch {
93
150
  // File doesn't exist or parse error
@@ -97,6 +154,7 @@ async function loadMetaFile(filePath) {
97
154
  /**
98
155
  * Load the meta context from a kspec context.
99
156
  * Loads meta manifest and follows includes.
157
+ * AC: @skill-meta-type ac-4 - MetaContext.skills contains LoadedSkill objects with _sourceFile set
100
158
  */
101
159
  export async function loadMetaContext(ctx) {
102
160
  const result = {
@@ -106,6 +164,7 @@ export async function loadMetaContext(ctx) {
106
164
  workflows: [],
107
165
  conventions: [],
108
166
  observations: [],
167
+ skills: [],
109
168
  };
110
169
  const manifestPath = await findMetaManifest(ctx.specDir);
111
170
  if (!manifestPath) {
@@ -122,6 +181,7 @@ export async function loadMetaContext(ctx) {
122
181
  result.workflows.push(...items.workflows);
123
182
  result.conventions.push(...items.conventions);
124
183
  result.observations.push(...items.observations);
184
+ result.skills.push(...items.skills);
125
185
  return result;
126
186
  }
127
187
  result.manifest = parsed.data;
@@ -131,6 +191,7 @@ export async function loadMetaContext(ctx) {
131
191
  result.workflows.push(...manifestItems.workflows);
132
192
  result.conventions.push(...manifestItems.conventions);
133
193
  result.observations.push(...manifestItems.observations);
194
+ result.skills.push(...manifestItems.skills);
134
195
  // Process includes
135
196
  const includes = parsed.data.includes || [];
136
197
  const manifestDir = path.dirname(manifestPath);
@@ -142,6 +203,7 @@ export async function loadMetaContext(ctx) {
142
203
  result.workflows.push(...items.workflows);
143
204
  result.conventions.push(...items.conventions);
144
205
  result.observations.push(...items.observations);
206
+ result.skills.push(...items.skills);
145
207
  }
146
208
  }
147
209
  }
@@ -160,41 +222,68 @@ export function getMetaStats(meta) {
160
222
  conventions: meta.conventions.length,
161
223
  observations: meta.observations.length,
162
224
  unresolvedObservations: meta.observations.filter((o) => !o.resolved).length,
225
+ skills: meta.skills.length,
163
226
  };
164
227
  }
165
228
  /**
166
- * Find a meta item by reference (ULID, short ULID, or id)
229
+ * Resolve a meta reference to its item, type, and ULID.
230
+ *
231
+ * This is the unified resolver for meta items that consolidates various
232
+ * ref-to-item resolution patterns. Handles ULID prefixes, full ULIDs,
233
+ * semantic IDs (id field for agents/workflows/skills), and domains (conventions).
234
+ *
235
+ * AC: @skill-meta-type ac-5 - skills returned by semantic id lookup
236
+ * AC: @skill-meta-type ac-6 - skills returned by ULID prefix lookup
237
+ * AC: @skill-meta-integration ac-4 - skills included in resolution
167
238
  */
168
- export function findMetaItemByRef(meta, ref) {
169
- const cleanRef = ref.startsWith('@') ? ref.slice(1) : ref;
239
+ export function resolveMetaRef(meta, ref) {
240
+ const cleanRef = ref.startsWith("@") ? ref.slice(1) : ref;
170
241
  // Search all item types
171
242
  const allItems = [
172
243
  ...meta.agents,
173
244
  ...meta.workflows,
174
245
  ...meta.conventions,
175
246
  ...meta.observations,
247
+ ...meta.skills,
176
248
  ];
177
249
  for (const item of allItems) {
178
250
  // Match full ULID
179
- if (item._ulid === cleanRef)
180
- return item;
251
+ if (item._ulid === cleanRef) {
252
+ return { item, type: getMetaItemType(item), ulid: item._ulid };
253
+ }
181
254
  // Match short ULID (prefix)
182
- if (item._ulid.toLowerCase().startsWith(cleanRef.toLowerCase()))
183
- return item;
184
- // Match by id (for agents and workflows)
185
- if ('id' in item && item.id === cleanRef)
186
- return item;
255
+ if (item._ulid.toLowerCase().startsWith(cleanRef.toLowerCase())) {
256
+ return { item, type: getMetaItemType(item), ulid: item._ulid };
257
+ }
258
+ // Match by id (for agents, workflows, and skills)
259
+ if ("id" in item && item.id === cleanRef) {
260
+ return { item, type: getMetaItemType(item), ulid: item._ulid };
261
+ }
187
262
  // Match by domain (for conventions)
188
- if ('domain' in item && item.domain === cleanRef)
189
- return item;
263
+ if ("domain" in item && item.domain === cleanRef) {
264
+ return { item, type: getMetaItemType(item), ulid: item._ulid };
265
+ }
190
266
  }
191
- return undefined;
267
+ return null;
268
+ }
269
+ /**
270
+ * Find a meta item by reference (ULID, short ULID, or id)
271
+ *
272
+ * This is a convenience wrapper around resolveMetaRef that returns just the item.
273
+ * Use resolveMetaRef when you also need the type and ULID.
274
+ *
275
+ * AC: @skill-meta-type ac-5 - skills returned by semantic id lookup
276
+ * AC: @skill-meta-type ac-6 - skills returned by ULID prefix lookup
277
+ */
278
+ export function findMetaItemByRef(meta, ref) {
279
+ const result = resolveMetaRef(meta, ref);
280
+ return result?.item;
192
281
  }
193
282
  /**
194
283
  * Determine if an item is a meta item type
195
284
  */
196
285
  export function isMetaItemType(type) {
197
- return ['agent', 'workflow', 'convention', 'observation'].includes(type);
286
+ return ["agent", "workflow", "convention", "observation", "skill"].includes(type);
198
287
  }
199
288
  // ============================================================
200
289
  // META ITEM CRUD
@@ -222,7 +311,7 @@ export function createObservation(type, content, options = {}) {
222
311
  content,
223
312
  workflow_ref: options.workflow_ref,
224
313
  created_at: new Date().toISOString(),
225
- author: options.author ?? getAuthor(),
314
+ author: options.author ?? getAuthor(options.configAuthor),
226
315
  resolved: false,
227
316
  resolution: null,
228
317
  };
@@ -237,11 +326,12 @@ export async function saveObservation(ctx, observation) {
237
326
  await fs.mkdir(dir, { recursive: true });
238
327
  // Load existing manifest
239
328
  let manifest = {
240
- kynetic_meta: '1.0',
329
+ kynetic_meta: "1.0",
241
330
  agents: [],
242
331
  workflows: [],
243
332
  conventions: [],
244
333
  observations: [],
334
+ skills: [],
245
335
  includes: [],
246
336
  };
247
337
  try {
@@ -290,13 +380,142 @@ export async function deleteObservation(ctx, ulid) {
290
380
  return false;
291
381
  }
292
382
  }
293
- // Re-export the getMetaItemType function
294
- export { getMetaItemType };
383
+ /**
384
+ * Get the path for skill content file.
385
+ * Skills are stored in .kspec/skills/<id>/SKILL.md
386
+ */
387
+ export function getSkillContentPath(ctx, skillId) {
388
+ return path.join(ctx.specDir, "skills", skillId, "SKILL.md");
389
+ }
390
+ /**
391
+ * Load skill content from the SKILL.md file.
392
+ * AC: @skill-meta-type ac-3 - loadSkillContent returns full markdown content
393
+ * AC: @skill-content-model ac-1 - loadSkillContent returns markdown content as a string
394
+ */
395
+ export async function loadSkillContent(ctx, skill) {
396
+ const contentPath = getSkillContentPath(ctx, skill.id);
397
+ try {
398
+ const content = await fs.readFile(contentPath, "utf-8");
399
+ return content;
400
+ }
401
+ catch {
402
+ return null;
403
+ }
404
+ }
405
+ /**
406
+ * Get the docs directory path for a skill.
407
+ * Skills can have supporting docs at .kspec/skills/<id>/docs/
408
+ */
409
+ export function getSkillDocsPath(ctx, skillId) {
410
+ return path.join(ctx.specDir, "skills", skillId, "docs");
411
+ }
412
+ /**
413
+ * Load skill documentation files from the docs/ subdirectory.
414
+ * AC: @skill-content-model ac-2 - loadSkillDocs returns array of doc objects
415
+ */
416
+ export async function loadSkillDocs(ctx, skill) {
417
+ const docsPath = getSkillDocsPath(ctx, skill.id);
418
+ const docs = [];
419
+ try {
420
+ const entries = await fs.readdir(docsPath, { withFileTypes: true });
421
+ for (const entry of entries) {
422
+ if (entry.isFile() && entry.name.endsWith(".md")) {
423
+ const filePath = path.join(docsPath, entry.name);
424
+ try {
425
+ const content = await fs.readFile(filePath, "utf-8");
426
+ docs.push({
427
+ name: entry.name,
428
+ path: filePath,
429
+ content,
430
+ });
431
+ }
432
+ catch {
433
+ // Skip files that can't be read
434
+ }
435
+ }
436
+ }
437
+ }
438
+ catch {
439
+ // docs directory doesn't exist or can't be read
440
+ }
441
+ return docs;
442
+ }
443
+ /**
444
+ * Get the path to a supporting directory for a skill.
445
+ * AC: @supporting-files-convention ac-1
446
+ */
447
+ export function getSkillSupportingDirPath(ctx, skillId, dirType) {
448
+ return path.join(ctx.specDir, "skills", skillId, dirType);
449
+ }
450
+ /**
451
+ * Load files from a skill's supporting directory.
452
+ * AC: @supporting-files-convention ac-1 - references files are accessible
453
+ *
454
+ * @param ctx - Kspec context
455
+ * @param skill - The skill to load files from
456
+ * @param dirType - The supporting directory type (references, scripts, assets, docs)
457
+ * @returns Array of files found in the directory
458
+ */
459
+ export async function loadSkillSupportingFiles(ctx, skill, dirType) {
460
+ const dirPath = getSkillSupportingDirPath(ctx, skill.id, dirType);
461
+ const files = [];
462
+ try {
463
+ const entries = await fs.readdir(dirPath, { withFileTypes: true });
464
+ for (const entry of entries) {
465
+ if (entry.isFile()) {
466
+ const filePath = path.join(dirPath, entry.name);
467
+ try {
468
+ const content = await fs.readFile(filePath, "utf-8");
469
+ files.push({
470
+ name: entry.name,
471
+ path: filePath,
472
+ content,
473
+ dirType,
474
+ });
475
+ }
476
+ catch {
477
+ // Skip files that can't be read (e.g., binary files)
478
+ }
479
+ }
480
+ }
481
+ }
482
+ catch {
483
+ // Directory doesn't exist or can't be read - return empty array
484
+ }
485
+ return files;
486
+ }
487
+ /**
488
+ * List which supporting directories exist for a skill.
489
+ * AC: @supporting-files-convention ac-1
490
+ *
491
+ * @returns Array of directory types that exist for the skill
492
+ */
493
+ export async function listSkillSupportingDirs(ctx, skillId) {
494
+ const dirs = [];
495
+ const allDirs = ["references", "scripts", "assets", "docs"];
496
+ for (const dirType of allDirs) {
497
+ const dirPath = getSkillSupportingDirPath(ctx, skillId, dirType);
498
+ try {
499
+ const stat = await fs.stat(dirPath);
500
+ if (stat.isDirectory()) {
501
+ dirs.push(dirType);
502
+ }
503
+ }
504
+ catch {
505
+ // Directory doesn't exist
506
+ }
507
+ }
508
+ return dirs;
509
+ }
510
+ // Re-export the getMetaItemType and isSkill functions
511
+ export { getMetaItemType, isSkill };
295
512
  // ============================================================
296
513
  // GENERIC META ITEM CRUD
297
514
  // ============================================================
298
515
  /**
299
- * Save any meta item (agent, workflow, convention) to the manifest
516
+ * Save any meta item (agent, workflow, convention, skill) to the manifest
517
+ * AC: @skill-parser ac-1 - skill is appended to manifest.skills and written to disk
518
+ * AC: @skill-parser ac-2 - .kspec/skills/<id>/ directory is created for skills
300
519
  */
301
520
  export async function saveMetaItem(ctx, item, itemType) {
302
521
  const manifestPath = getMetaManifestPath(ctx);
@@ -305,11 +524,12 @@ export async function saveMetaItem(ctx, item, itemType) {
305
524
  await fs.mkdir(dir, { recursive: true });
306
525
  // Load existing manifest
307
526
  let manifest = {
308
- kynetic_meta: '1.0',
527
+ kynetic_meta: "1.0",
309
528
  agents: [],
310
529
  workflows: [],
311
530
  conventions: [],
312
531
  observations: [],
532
+ skills: [],
313
533
  includes: [],
314
534
  };
315
535
  try {
@@ -327,12 +547,14 @@ export async function saveMetaItem(ctx, item, itemType) {
327
547
  // Get the appropriate array
328
548
  const getArray = () => {
329
549
  switch (itemType) {
330
- case 'agent':
550
+ case "agent":
331
551
  return manifest.agents;
332
- case 'workflow':
552
+ case "workflow":
333
553
  return manifest.workflows;
334
- case 'convention':
554
+ case "convention":
335
555
  return manifest.conventions;
556
+ case "skill":
557
+ return manifest.skills;
336
558
  }
337
559
  };
338
560
  const array = getArray();
@@ -345,9 +567,16 @@ export async function saveMetaItem(ctx, item, itemType) {
345
567
  array.push(cleanItem);
346
568
  }
347
569
  await saveMetaManifest(manifestPath, manifest);
570
+ // AC: @skill-parser ac-2 - Create skill content directory
571
+ if (itemType === "skill" && "id" in item) {
572
+ const skillDir = path.join(ctx.specDir, "skills", item.id);
573
+ await fs.mkdir(skillDir, { recursive: true });
574
+ }
348
575
  }
349
576
  /**
350
577
  * Delete any meta item from the manifest
578
+ * AC: @skill-parser ac-3 - skill is removed from manifest.skills
579
+ * AC: @skill-parser ac-4 - .kspec/skills/<id>/ directory is deleted for skills
351
580
  */
352
581
  export async function deleteMetaItem(ctx, itemUlid, itemType) {
353
582
  const manifestPath = getMetaManifestPath(ctx);
@@ -360,14 +589,16 @@ export async function deleteMetaItem(ctx, itemUlid, itemType) {
360
589
  const manifest = parsed.data;
361
590
  const getArray = () => {
362
591
  switch (itemType) {
363
- case 'agent':
592
+ case "agent":
364
593
  return manifest.agents;
365
- case 'workflow':
594
+ case "workflow":
366
595
  return manifest.workflows;
367
- case 'convention':
596
+ case "convention":
368
597
  return manifest.conventions;
369
- case 'observation':
598
+ case "observation":
370
599
  return manifest.observations;
600
+ case "skill":
601
+ return manifest.skills;
371
602
  }
372
603
  };
373
604
  const array = getArray();
@@ -375,6 +606,19 @@ export async function deleteMetaItem(ctx, itemUlid, itemType) {
375
606
  if (index < 0) {
376
607
  return false;
377
608
  }
609
+ // AC: @skill-parser ac-4 - Delete skill directory before removing from manifest
610
+ if (itemType === "skill") {
611
+ const skill = array[index];
612
+ if (skill.id) {
613
+ const skillDir = path.join(ctx.specDir, "skills", skill.id);
614
+ try {
615
+ await fs.rm(skillDir, { recursive: true, force: true });
616
+ }
617
+ catch {
618
+ // Directory might not exist, that's fine
619
+ }
620
+ }
621
+ }
378
622
  array.splice(index, 1);
379
623
  await saveMetaManifest(manifestPath, manifest);
380
624
  return true;
@@ -390,7 +634,7 @@ export async function deleteMetaItem(ctx, itemUlid, itemType) {
390
634
  * Get the session context file path
391
635
  */
392
636
  export function getSessionContextPath(ctx) {
393
- return path.join(ctx.specDir, '.kspec-session');
637
+ return path.join(ctx.specDir, ".kspec-session");
394
638
  }
395
639
  /**
396
640
  * Load session context (or return empty context if not exists)
@@ -399,7 +643,7 @@ export async function loadSessionContext(ctx) {
399
643
  const contextPath = getSessionContextPath(ctx);
400
644
  try {
401
645
  const raw = await readYamlFile(contextPath);
402
- if (!raw || typeof raw !== 'object') {
646
+ if (!raw || typeof raw !== "object") {
403
647
  return {
404
648
  focus: null,
405
649
  threads: [],
@@ -438,4 +682,93 @@ export async function saveSessionContext(ctx, context) {
438
682
  context.updated_at = new Date().toISOString();
439
683
  await writeYamlFilePreserveFormat(contextPath, context);
440
684
  }
685
+ // ============================================================
686
+ // WORKFLOW RUNS
687
+ // ============================================================
688
+ /**
689
+ * Get the workflow runs file path.
690
+ * Derives from main manifest name (e.g., myproject.yaml -> myproject.runs.yaml)
691
+ */
692
+ export function getWorkflowRunsPath(ctx) {
693
+ const baseName = getManifestBaseName(ctx.manifestPath);
694
+ return path.join(ctx.specDir, `${baseName}.runs.yaml`);
695
+ }
696
+ /**
697
+ * Load workflow runs from file
698
+ */
699
+ export async function loadWorkflowRuns(ctx) {
700
+ const runsPath = getWorkflowRunsPath(ctx);
701
+ try {
702
+ const raw = await readYamlFile(runsPath);
703
+ const parsed = WorkflowRunsFileSchema.safeParse(raw);
704
+ if (!parsed.success) {
705
+ return [];
706
+ }
707
+ return parsed.data.runs;
708
+ }
709
+ catch {
710
+ // File doesn't exist
711
+ return [];
712
+ }
713
+ }
714
+ /**
715
+ * Save a workflow run (create or update)
716
+ */
717
+ export async function saveWorkflowRun(ctx, run) {
718
+ const runsPath = getWorkflowRunsPath(ctx);
719
+ // Load existing runs
720
+ const runs = await loadWorkflowRuns(ctx);
721
+ // Update or add
722
+ const existingIndex = runs.findIndex((r) => r._ulid === run._ulid);
723
+ if (existingIndex >= 0) {
724
+ runs[existingIndex] = run;
725
+ }
726
+ else {
727
+ runs.push(run);
728
+ }
729
+ // Save back
730
+ const runsFile = {
731
+ kynetic_runs: "1.0",
732
+ runs,
733
+ };
734
+ await writeYamlFilePreserveFormat(runsPath, runsFile);
735
+ }
736
+ /**
737
+ * Update an existing workflow run
738
+ */
739
+ export async function updateWorkflowRun(ctx, run) {
740
+ await saveWorkflowRun(ctx, run);
741
+ }
742
+ /**
743
+ * Find a workflow run by reference (ULID or ULID prefix)
744
+ */
745
+ export async function findWorkflowRunByRef(ctx, ref) {
746
+ const runs = await loadWorkflowRuns(ctx);
747
+ const cleanRef = ref.startsWith("@") ? ref.slice(1) : ref;
748
+ return runs.find((r) => r._ulid === cleanRef ||
749
+ r._ulid.toLowerCase().startsWith(cleanRef.toLowerCase()));
750
+ }
751
+ /**
752
+ * Find active workflow runs
753
+ */
754
+ export async function findActiveRuns(ctx) {
755
+ const runs = await loadWorkflowRuns(ctx);
756
+ return runs.filter((r) => r.status === "active");
757
+ }
758
+ /**
759
+ * Delete workflow runs by ULIDs
760
+ * AC: @workflow-prune ac-1, ac-2, ac-3, ac-4
761
+ */
762
+ export async function deleteWorkflowRuns(ctx, ulidsToDelete) {
763
+ const runsPath = getWorkflowRunsPath(ctx);
764
+ const runs = await loadWorkflowRuns(ctx);
765
+ // Filter out runs to delete
766
+ const remainingRuns = runs.filter((r) => !ulidsToDelete.includes(r._ulid));
767
+ // Save back
768
+ const runsFile = {
769
+ kynetic_runs: "1.0",
770
+ runs: remainingRuns,
771
+ };
772
+ await writeYamlFilePreserveFormat(runsPath, runsFile);
773
+ }
441
774
  //# sourceMappingURL=meta.js.map