@hasna/skills 0.1.61 → 0.1.63

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 (523) hide show
  1. package/README.md +10 -6
  2. package/bin/index.js +14271 -21602
  3. package/bin/mcp.js +3527 -11449
  4. package/bin/migrate.js +53 -3
  5. package/bin/server.js +5140 -2675
  6. package/bin/worker.js +4542 -2129
  7. package/dist/cli/commands/publish.d.ts +2 -0
  8. package/dist/cli/components/App.d.ts +2 -1
  9. package/dist/cli/components/CategorySelect.d.ts +2 -1
  10. package/dist/cli/components/Header.d.ts +2 -1
  11. package/dist/cli/components/InstallProgress.d.ts +2 -1
  12. package/dist/cli/components/SearchView.d.ts +2 -1
  13. package/dist/cli/components/SkillSelect.d.ts +2 -1
  14. package/dist/index.d.ts +4 -1
  15. package/dist/index.js +5094 -13755
  16. package/dist/lib/agent-sync.d.ts +38 -3
  17. package/dist/lib/home-adoption.d.ts +91 -0
  18. package/dist/lib/home-census.d.ts +22 -0
  19. package/dist/lib/home-migration.d.ts +61 -0
  20. package/dist/lib/portable-skills-files.d.ts +21 -1
  21. package/dist/lib/portable-skills-types.d.ts +46 -0
  22. package/dist/lib/pull.d.ts +66 -0
  23. package/dist/lib/remote-client.d.ts +6 -0
  24. package/dist/lib/run-state.d.ts +5 -0
  25. package/dist/lib/skill-bundles.d.ts +54 -0
  26. package/dist/lib/skill-contract.d.ts +35 -0
  27. package/dist/lib/skill-hash.d.ts +77 -0
  28. package/dist/sdk/cancel.d.ts +30 -0
  29. package/dist/sdk/dispatcher.d.ts +40 -0
  30. package/dist/sdk/event-sink.d.ts +2 -0
  31. package/dist/sdk/events.d.ts +79 -0
  32. package/dist/sdk/execution/admission.d.ts +44 -0
  33. package/dist/sdk/execution/dispatchers/e2b.d.ts +17 -0
  34. package/dist/sdk/execution/dispatchers/ecs.d.ts +151 -0
  35. package/dist/sdk/execution/image-profile.d.ts +73 -0
  36. package/dist/sdk/execution/index.d.ts +15 -0
  37. package/dist/sdk/execution/receipts.d.ts +44 -0
  38. package/dist/sdk/execution/state-machine.d.ts +38 -0
  39. package/dist/sdk/execution/storage.d.ts +158 -0
  40. package/dist/sdk/execution/types.d.ts +130 -0
  41. package/dist/sdk/executor.d.ts +17 -0
  42. package/dist/sdk/governance-store.d.ts +156 -0
  43. package/dist/sdk/governance.d.ts +92 -0
  44. package/dist/sdk/index.d.ts +26 -0
  45. package/dist/sdk/index.js +48730 -0
  46. package/dist/sdk/offline.d.ts +16 -0
  47. package/dist/sdk/outputs.d.ts +71 -0
  48. package/dist/sdk/registry.d.ts +28 -0
  49. package/dist/sdk/runs.d.ts +229 -0
  50. package/dist/sdk/server.d.ts +35 -0
  51. package/dist/sdk/spend.d.ts +36 -0
  52. package/dist/sdk/storage.d.ts +25 -0
  53. package/dist/server/app.d.ts +42 -0
  54. package/dist/server/artifact-storage.d.ts +102 -0
  55. package/dist/server/auth.d.ts +5 -0
  56. package/dist/server/config.d.ts +40 -0
  57. package/dist/server/database-url.d.ts +42 -0
  58. package/dist/server/handlers.d.ts +3 -0
  59. package/dist/server/index.d.ts +2 -0
  60. package/dist/server/migrate.d.ts +13 -0
  61. package/dist/server/migrations-dir.d.ts +18 -0
  62. package/dist/server/redaction.d.ts +1 -0
  63. package/dist/server/registry.d.ts +5 -0
  64. package/dist/server/rows.d.ts +23 -0
  65. package/dist/server/skills-api.d.ts +68 -0
  66. package/dist/server/sqlite-store.d.ts +114 -0
  67. package/dist/server/store-fixtures.d.ts +25 -0
  68. package/dist/server/store.d.ts +144 -0
  69. package/dist/server/types.d.ts +242 -0
  70. package/dist/server/worker.d.ts +4 -0
  71. package/dist/storage.js +32 -0
  72. package/docs/skill-standard.md +211 -39
  73. package/migrations/postgres/0003_run_outputs_governance.sql +83 -0
  74. package/migrations/sqlite/0003_run_outputs_governance.sql +58 -0
  75. package/package.json +11 -8
  76. package/schemas/skill.schema.json +181 -0
  77. package/agent-skills/README.md +0 -41
  78. package/agent-skills/fleet-package-rollout/SKILL.md +0 -169
  79. package/agent-skills/inbox/SKILL.md +0 -25
  80. package/agent-skills/inbox/scripts/inbox +0 -109
  81. package/agent-skills/inbox/tests/test_registered_sender_id.sh +0 -92
  82. package/agent-skills/inbox-monitor/SKILL.md +0 -41
  83. package/agent-skills/inbox-monitor/scripts/inbox_monitor.sh +0 -91
  84. package/agent-skills/inbox-monitor/scripts/test_inbox_monitor.sh +0 -71
  85. package/agent-skills/merge-pr/SKILL.md +0 -85
  86. package/agent-skills/merge-pr/references/merge-safety.md +0 -82
  87. package/agent-skills/merge-pr/scripts/merge_pr_guard.py +0 -694
  88. package/agent-skills/merge-pr/scripts/test_merge_pr_guard.py +0 -647
  89. package/agent-skills/merge-pr/tests/fixtures/multi-commit-synthesized.json +0 -28
  90. package/agent-skills/merge-pr/tests/fixtures/trailer-free-provider.json +0 -28
  91. package/agent-skills/skill-goal-execute/SKILL.md +0 -115
  92. package/agent-skills/skill-login/SKILL.md +0 -109
  93. package/agent-skills/skill-project-create/SKILL.md +0 -91
  94. package/agent-skills/skill-publish/SKILL.md +0 -207
  95. package/skills/_common/auth.ts +0 -45
  96. package/skills/_common/http-client.ts +0 -143
  97. package/skills/_common/index.ts +0 -26
  98. package/skills/_common/install.sh +0 -7
  99. package/skills/_common/installer.ts +0 -72
  100. package/skills/_common/skill-install.ts +0 -37
  101. package/skills/_common/vision.ts +0 -374
  102. package/skills/ad-creative-pack/SKILL.md +0 -55
  103. package/skills/ad-creative-pack/package.json +0 -10
  104. package/skills/analyze-data/CLAUDE.md +0 -16
  105. package/skills/analyze-data/SKILL.md +0 -112
  106. package/skills/analyze-data/package.json +0 -23
  107. package/skills/analyze-data/src/analysis.ts +0 -401
  108. package/skills/analyze-data/src/cli.ts +0 -66
  109. package/skills/analyze-data/src/formatters.ts +0 -235
  110. package/skills/analyze-data/src/index.ts +0 -74
  111. package/skills/analyze-data/src/logger.ts +0 -36
  112. package/skills/analyze-data/src/parsers.ts +0 -57
  113. package/skills/analyze-data/src/stats.ts +0 -151
  114. package/skills/analyze-data/src/types.ts +0 -85
  115. package/skills/analyze-data/tsconfig.json +0 -19
  116. package/skills/api-docs-portal/SKILL.md +0 -84
  117. package/skills/api-docs-portal/package.json +0 -35
  118. package/skills/api-docs-portal/src/index.ts +0 -919
  119. package/skills/api-docs-portal/tsconfig.json +0 -17
  120. package/skills/api-test-suite/CLAUDE.md +0 -19
  121. package/skills/api-test-suite/package.json +0 -27
  122. package/skills/api-test-suite/src/index.ts +0 -381
  123. package/skills/api-test-suite/tsconfig.json +0 -10
  124. package/skills/audio-extract/CLAUDE.md +0 -9
  125. package/skills/audio-extract/SKILL.md +0 -73
  126. package/skills/audio-extract/package.json +0 -23
  127. package/skills/audio-extract/src/index.ts +0 -323
  128. package/skills/audio-extract/tsconfig.json +0 -11
  129. package/skills/bio-sequence-tool/CLAUDE.md +0 -19
  130. package/skills/bio-sequence-tool/package.json +0 -27
  131. package/skills/bio-sequence-tool/src/index.ts +0 -85
  132. package/skills/bio-sequence-tool/tsconfig.json +0 -10
  133. package/skills/blog-article/CLAUDE.md +0 -12
  134. package/skills/blog-article/SKILL.md +0 -55
  135. package/skills/blog-article/package.json +0 -10
  136. package/skills/blog-article/tsconfig.json +0 -10
  137. package/skills/brand-assets/SKILL.md +0 -118
  138. package/skills/brand-assets/package.json +0 -35
  139. package/skills/brand-assets/src/cli.ts +0 -155
  140. package/skills/brand-assets/src/constants.ts +0 -8
  141. package/skills/brand-assets/src/extract.ts +0 -236
  142. package/skills/brand-assets/src/index.ts +0 -668
  143. package/skills/brand-assets/src/types.ts +0 -59
  144. package/skills/brand-assets/tsconfig.json +0 -17
  145. package/skills/brand-kit/SKILL.md +0 -54
  146. package/skills/brand-kit/package.json +0 -10
  147. package/skills/businessactivity/CLAUDE.md +0 -176
  148. package/skills/businessactivity/LICENSE +0 -192
  149. package/skills/businessactivity/README.md +0 -287
  150. package/skills/businessactivity/package.json +0 -25
  151. package/skills/businessactivity/scripts/publish.ts +0 -210
  152. package/skills/businessactivity/src/commands/activity.ts +0 -211
  153. package/skills/businessactivity/src/commands/function.ts +0 -227
  154. package/skills/businessactivity/src/commands/owner.ts +0 -193
  155. package/skills/businessactivity/src/commands/profile.ts +0 -121
  156. package/skills/businessactivity/src/commands/responsibility.ts +0 -264
  157. package/skills/businessactivity/src/commands/team.ts +0 -244
  158. package/skills/businessactivity/src/commands/workflow.ts +0 -359
  159. package/skills/businessactivity/src/index.ts +0 -3
  160. package/skills/businessactivity/src/lib/config.ts +0 -167
  161. package/skills/businessactivity/src/lib/output.ts +0 -76
  162. package/skills/businessactivity/src/lib/paths.ts +0 -79
  163. package/skills/businessactivity/src/lib/storage.ts +0 -95
  164. package/skills/businessactivity/src/types/index.ts +0 -86
  165. package/skills/businessactivity/tsconfig.json +0 -29
  166. package/skills/codefix/LICENSE +0 -192
  167. package/skills/codefix/README.md +0 -232
  168. package/skills/codefix/SKILL.md +0 -94
  169. package/skills/codefix/package.json +0 -21
  170. package/skills/codefix/src/fixers/batch.ts +0 -213
  171. package/skills/codefix/src/fixers/detector.ts +0 -160
  172. package/skills/codefix/src/fixers/index.ts +0 -7
  173. package/skills/codefix/src/fixers/runner.ts +0 -522
  174. package/skills/codefix/src/index-local.ts +0 -431
  175. package/skills/codefix/src/index.ts +0 -4
  176. package/skills/codefix/src/types.ts +0 -211
  177. package/skills/codefix/tsconfig.json +0 -15
  178. package/skills/commitpush/SKILL.md +0 -57
  179. package/skills/commitpush/package.json +0 -33
  180. package/skills/commitpush/src/index.ts +0 -34
  181. package/skills/commitpush/tsconfig.json +0 -17
  182. package/skills/commitpushpr/SKILL.md +0 -55
  183. package/skills/commitpushpr/package.json +0 -33
  184. package/skills/commitpushpr/src/index.ts +0 -34
  185. package/skills/commitpushpr/tsconfig.json +0 -17
  186. package/skills/compress-video/CLAUDE.md +0 -9
  187. package/skills/compress-video/SKILL.md +0 -79
  188. package/skills/compress-video/package.json +0 -23
  189. package/skills/compress-video/src/index.ts +0 -473
  190. package/skills/compress-video/tsconfig.json +0 -11
  191. package/skills/contract-review-report/SKILL.md +0 -52
  192. package/skills/contract-review-report/package.json +0 -10
  193. package/skills/customer-feedback-report/SKILL.md +0 -52
  194. package/skills/customer-feedback-report/package.json +0 -10
  195. package/skills/dashboard-builder/CLAUDE.md +0 -19
  196. package/skills/dashboard-builder/package.json +0 -29
  197. package/skills/dashboard-builder/src/index.ts +0 -150
  198. package/skills/dashboard-builder/tsconfig.json +0 -10
  199. package/skills/data-anonymizer/CLAUDE.md +0 -19
  200. package/skills/data-anonymizer/package.json +0 -27
  201. package/skills/data-anonymizer/src/index.ts +0 -183
  202. package/skills/data-anonymizer/tsconfig.json +0 -10
  203. package/skills/database-explorer/CLAUDE.md +0 -19
  204. package/skills/database-explorer/package.json +0 -29
  205. package/skills/database-explorer/src/index.ts +0 -95
  206. package/skills/database-explorer/tsconfig.json +0 -10
  207. package/skills/diff-viewer/CLAUDE.md +0 -19
  208. package/skills/diff-viewer/package.json +0 -30
  209. package/skills/diff-viewer/src/index.ts +0 -164
  210. package/skills/diff-viewer/tsconfig.json +0 -10
  211. package/skills/doc-read/SKILL.md +0 -45
  212. package/skills/doc-read/package.json +0 -29
  213. package/skills/doc-read/src/index.ts +0 -324
  214. package/skills/doc-read/tsconfig.json +0 -8
  215. package/skills/domainpurchase/LICENSE +0 -192
  216. package/skills/domainpurchase/SKILL.md +0 -29
  217. package/skills/domainpurchase/package.json +0 -30
  218. package/skills/domainpurchase/src/index.ts +0 -3
  219. package/skills/domainpurchase/tsconfig.json +0 -21
  220. package/skills/email-sequence/SKILL.md +0 -53
  221. package/skills/email-sequence/package.json +0 -10
  222. package/skills/experiment-power-calculator/CLAUDE.md +0 -19
  223. package/skills/experiment-power-calculator/package.json +0 -29
  224. package/skills/experiment-power-calculator/src/index.ts +0 -86
  225. package/skills/experiment-power-calculator/tsconfig.json +0 -10
  226. package/skills/extract-frames/CLAUDE.md +0 -19
  227. package/skills/extract-frames/package.json +0 -27
  228. package/skills/extract-frames/src/index.ts +0 -616
  229. package/skills/extract-frames/tsconfig.json +0 -10
  230. package/skills/file-organizer/CLAUDE.md +0 -19
  231. package/skills/file-organizer/package.json +0 -27
  232. package/skills/file-organizer/src/index.ts +0 -91
  233. package/skills/file-organizer/tsconfig.json +0 -10
  234. package/skills/folder-tree/CLAUDE.md +0 -19
  235. package/skills/folder-tree/package.json +0 -29
  236. package/skills/folder-tree/src/index.ts +0 -568
  237. package/skills/folder-tree/tsconfig.json +0 -10
  238. package/skills/form-filler/CLAUDE.md +0 -19
  239. package/skills/form-filler/package.json +0 -29
  240. package/skills/form-filler/src/index.ts +0 -81
  241. package/skills/form-filler/tsconfig.json +0 -10
  242. package/skills/generate-api-client/CLAUDE.md +0 -19
  243. package/skills/generate-api-client/package.json +0 -29
  244. package/skills/generate-api-client/src/generator.ts +0 -47
  245. package/skills/generate-api-client/src/index.ts +0 -92
  246. package/skills/generate-api-client/src/logger.ts +0 -34
  247. package/skills/generate-api-client/src/python-generator.ts +0 -245
  248. package/skills/generate-api-client/src/spec-loader.ts +0 -48
  249. package/skills/generate-api-client/src/type-mappers.ts +0 -79
  250. package/skills/generate-api-client/src/types.ts +0 -76
  251. package/skills/generate-api-client/src/typescript-generator.ts +0 -247
  252. package/skills/generate-api-client/tsconfig.json +0 -10
  253. package/skills/generate-chart/CLAUDE.md +0 -19
  254. package/skills/generate-chart/package.json +0 -27
  255. package/skills/generate-chart/src/index.ts +0 -510
  256. package/skills/generate-chart/tsconfig.json +0 -10
  257. package/skills/generate-dockerfile/CLAUDE.md +0 -19
  258. package/skills/generate-dockerfile/package.json +0 -27
  259. package/skills/generate-dockerfile/src/cli.ts +0 -78
  260. package/skills/generate-dockerfile/src/dockerfile-templates.ts +0 -392
  261. package/skills/generate-dockerfile/src/index.ts +0 -81
  262. package/skills/generate-dockerfile/src/logger.ts +0 -30
  263. package/skills/generate-dockerfile/src/project-detection.ts +0 -68
  264. package/skills/generate-dockerfile/src/support-files.ts +0 -171
  265. package/skills/generate-dockerfile/src/types.ts +0 -29
  266. package/skills/generate-dockerfile/tsconfig.json +0 -10
  267. package/skills/generate-env/CLAUDE.md +0 -19
  268. package/skills/generate-env/package.json +0 -29
  269. package/skills/generate-env/src/cli.ts +0 -85
  270. package/skills/generate-env/src/detection.ts +0 -161
  271. package/skills/generate-env/src/env-data.ts +0 -66
  272. package/skills/generate-env/src/generators.ts +0 -240
  273. package/skills/generate-env/src/index.ts +0 -120
  274. package/skills/generate-env/src/runtime.ts +0 -30
  275. package/skills/generate-env/src/types.ts +0 -32
  276. package/skills/generate-env/tsconfig.json +0 -10
  277. package/skills/generate-favicon/CLAUDE.md +0 -19
  278. package/skills/generate-favicon/package.json +0 -29
  279. package/skills/generate-favicon/src/index.ts +0 -421
  280. package/skills/generate-favicon/tsconfig.json +0 -10
  281. package/skills/generate-qrcode/CLAUDE.md +0 -19
  282. package/skills/generate-qrcode/package.json +0 -30
  283. package/skills/generate-qrcode/src/index.ts +0 -584
  284. package/skills/generate-qrcode/tsconfig.json +0 -10
  285. package/skills/generate-resume/CLAUDE.md +0 -19
  286. package/skills/generate-resume/package.json +0 -27
  287. package/skills/generate-resume/src/cli.ts +0 -157
  288. package/skills/generate-resume/src/index.ts +0 -178
  289. package/skills/generate-resume/src/parsers.ts +0 -95
  290. package/skills/generate-resume/src/renderers.ts +0 -538
  291. package/skills/generate-resume/src/security.ts +0 -39
  292. package/skills/generate-resume/src/types.ts +0 -86
  293. package/skills/generate-resume/tsconfig.json +0 -10
  294. package/skills/generate-sitemap/CLAUDE.md +0 -19
  295. package/skills/generate-sitemap/package.json +0 -27
  296. package/skills/generate-sitemap/src/index.ts +0 -626
  297. package/skills/generate-sitemap/tsconfig.json +0 -10
  298. package/skills/gif-maker/CLAUDE.md +0 -19
  299. package/skills/gif-maker/package.json +0 -30
  300. package/skills/gif-maker/src/index.ts +0 -600
  301. package/skills/gif-maker/tsconfig.json +0 -10
  302. package/skills/hook/LICENSE +0 -192
  303. package/skills/hook/README.md +0 -74
  304. package/skills/hook/SKILL.md +0 -85
  305. package/skills/hook/bunfig.toml +0 -5
  306. package/skills/hook/package.json +0 -28
  307. package/skills/hook/src/commands/create.ts +0 -112
  308. package/skills/hook/src/commands/events.ts +0 -37
  309. package/skills/hook/src/commands/validate.ts +0 -117
  310. package/skills/hook/src/index.ts +0 -118
  311. package/skills/hook/src/templates/root.ts +0 -196
  312. package/skills/hook/src/templates/source.ts +0 -647
  313. package/skills/hook/tsconfig.json +0 -18
  314. package/skills/http-server/CLAUDE.md +0 -19
  315. package/skills/http-server/package.json +0 -29
  316. package/skills/http-server/src/index.ts +0 -51
  317. package/skills/http-server/tsconfig.json +0 -10
  318. package/skills/implementation/LICENSE +0 -192
  319. package/skills/implementation/README.md +0 -53
  320. package/skills/implementation/SKILL.md +0 -57
  321. package/skills/implementation/bunfig.toml +0 -5
  322. package/skills/implementation/package.json +0 -28
  323. package/skills/implementation/src/commands/create.ts +0 -187
  324. package/skills/implementation/src/index.ts +0 -62
  325. package/skills/implementation/tsconfig.json +0 -18
  326. package/skills/implementation-plan/CLAUDE.md +0 -19
  327. package/skills/implementation-plan/package.json +0 -29
  328. package/skills/implementation-plan/src/index.ts +0 -520
  329. package/skills/implementation-plan/tsconfig.json +0 -10
  330. package/skills/implementation-todo/CLAUDE.md +0 -19
  331. package/skills/implementation-todo/package.json +0 -29
  332. package/skills/implementation-todo/src/index.ts +0 -429
  333. package/skills/implementation-todo/tsconfig.json +0 -10
  334. package/skills/invoice/.env.example +0 -3
  335. package/skills/invoice/CLAUDE.md +0 -31
  336. package/skills/invoice/LICENSE +0 -192
  337. package/skills/invoice/README.md +0 -70
  338. package/skills/invoice/package.json +0 -26
  339. package/skills/invoice/src/commands/companies.ts +0 -202
  340. package/skills/invoice/src/commands/config.ts +0 -132
  341. package/skills/invoice/src/commands/generate.ts +0 -177
  342. package/skills/invoice/src/commands/invoices.ts +0 -218
  343. package/skills/invoice/src/index.ts +0 -3
  344. package/skills/invoice/src/lib/api.ts +0 -124
  345. package/skills/invoice/src/lib/storage.ts +0 -171
  346. package/skills/invoice/src/types/index.ts +0 -86
  347. package/skills/invoice/src/utils/logger.ts +0 -33
  348. package/skills/invoice/src/utils/paths.ts +0 -25
  349. package/skills/invoice/tsconfig.json +0 -23
  350. package/skills/invoice-reconciliation/SKILL.md +0 -98
  351. package/skills/invoice-reconciliation/package.json +0 -36
  352. package/skills/invoice-reconciliation/src/index.ts +0 -743
  353. package/skills/invoice-reconciliation/tsconfig.json +0 -17
  354. package/skills/landing-page-pack/SKILL.md +0 -55
  355. package/skills/landing-page-pack/package.json +0 -10
  356. package/skills/latex-table-generator/CLAUDE.md +0 -19
  357. package/skills/latex-table-generator/package.json +0 -29
  358. package/skills/latex-table-generator/src/index.ts +0 -113
  359. package/skills/latex-table-generator/tsconfig.json +0 -10
  360. package/skills/logo-design/SKILL.md +0 -94
  361. package/skills/logo-design/package.json +0 -35
  362. package/skills/logo-design/src/cli.ts +0 -132
  363. package/skills/logo-design/src/constants.ts +0 -5
  364. package/skills/logo-design/src/docs.ts +0 -102
  365. package/skills/logo-design/src/geometry.ts +0 -324
  366. package/skills/logo-design/src/index.ts +0 -212
  367. package/skills/logo-design/src/palette.ts +0 -258
  368. package/skills/logo-design/src/types.ts +0 -50
  369. package/skills/logo-design/tsconfig.json +0 -17
  370. package/skills/lorem-generator/CLAUDE.md +0 -19
  371. package/skills/lorem-generator/package.json +0 -29
  372. package/skills/lorem-generator/src/index.ts +0 -59
  373. package/skills/lorem-generator/tsconfig.json +0 -10
  374. package/skills/managemcp/CLAUDE.md +0 -14
  375. package/skills/managemcp/README.md +0 -24
  376. package/skills/managemcp/package.json +0 -16
  377. package/skills/managemcp/src/index.ts +0 -3
  378. package/skills/managemcp/tsconfig.json +0 -27
  379. package/skills/markdown-validator/CLAUDE.md +0 -19
  380. package/skills/markdown-validator/package.json +0 -29
  381. package/skills/markdown-validator/src/index.ts +0 -92
  382. package/skills/markdown-validator/tsconfig.json +0 -10
  383. package/skills/market-research-report/SKILL.md +0 -51
  384. package/skills/market-research-report/package.json +0 -10
  385. package/skills/meeting-pack/SKILL.md +0 -52
  386. package/skills/meeting-pack/package.json +0 -10
  387. package/skills/merge-pdfs/CLAUDE.md +0 -19
  388. package/skills/merge-pdfs/package.json +0 -31
  389. package/skills/merge-pdfs/src/index.ts +0 -427
  390. package/skills/merge-pdfs/tsconfig.json +0 -10
  391. package/skills/migration-plan-pack/SKILL.md +0 -56
  392. package/skills/migration-plan-pack/package.json +0 -10
  393. package/skills/monitor/SKILL.md +0 -69
  394. package/skills/monitor/package.json +0 -33
  395. package/skills/monitor/src/index.ts +0 -34
  396. package/skills/monitor/tsconfig.json +0 -17
  397. package/skills/one-page-website/SKILL.md +0 -128
  398. package/skills/one-page-website/package.json +0 -34
  399. package/skills/one-page-website/src/design.ts +0 -336
  400. package/skills/one-page-website/src/docs.ts +0 -159
  401. package/skills/one-page-website/src/index.ts +0 -357
  402. package/skills/one-page-website/src/page.ts +0 -340
  403. package/skills/one-page-website/src/styles.ts +0 -508
  404. package/skills/one-page-website/src/types.ts +0 -78
  405. package/skills/one-page-website/tsconfig.json +0 -17
  406. package/skills/pdf-generate/CLAUDE.md +0 -19
  407. package/skills/pdf-generate/SKILL.md +0 -86
  408. package/skills/pdf-generate/package.json +0 -21
  409. package/skills/pdf-generate/src/cli.ts +0 -162
  410. package/skills/pdf-generate/src/html.ts +0 -84
  411. package/skills/pdf-generate/src/index.ts +0 -62
  412. package/skills/pdf-generate/src/markdown.ts +0 -27
  413. package/skills/pdf-generate/src/pdf-writer.ts +0 -78
  414. package/skills/pdf-generate/src/runtime.ts +0 -34
  415. package/skills/pdf-generate/src/security.ts +0 -37
  416. package/skills/pdf-generate/src/templates.ts +0 -311
  417. package/skills/pdf-generate/src/types.ts +0 -28
  418. package/skills/pdf-generate/tsconfig.json +0 -16
  419. package/skills/pdf-to-dataset/SKILL.md +0 -88
  420. package/skills/pdf-to-dataset/package.json +0 -37
  421. package/skills/pdf-to-dataset/src/index.ts +0 -790
  422. package/skills/pdf-to-dataset/tsconfig.json +0 -17
  423. package/skills/pdf-to-markdown/SKILL.md +0 -81
  424. package/skills/pdf-to-markdown/package.json +0 -35
  425. package/skills/pdf-to-markdown/src/index.ts +0 -694
  426. package/skills/pdf-to-markdown/tsconfig.json +0 -17
  427. package/skills/performance-audit-report/SKILL.md +0 -49
  428. package/skills/performance-audit-report/package.json +0 -10
  429. package/skills/pitch-deck/SKILL.md +0 -51
  430. package/skills/pitch-deck/package.json +0 -10
  431. package/skills/product-mockup/SKILL.md +0 -107
  432. package/skills/product-mockup/package.json +0 -32
  433. package/skills/product-mockup/src/cli.ts +0 -150
  434. package/skills/product-mockup/src/design.ts +0 -151
  435. package/skills/product-mockup/src/docs.ts +0 -134
  436. package/skills/product-mockup/src/index.ts +0 -182
  437. package/skills/product-mockup/src/render.ts +0 -407
  438. package/skills/product-mockup/src/types.ts +0 -66
  439. package/skills/product-mockup/tsconfig.json +0 -17
  440. package/skills/proposal-pack/SKILL.md +0 -53
  441. package/skills/proposal-pack/package.json +0 -10
  442. package/skills/read-csv/SKILL.md +0 -62
  443. package/skills/read-csv/package.json +0 -37
  444. package/skills/read-csv/src/index.ts +0 -356
  445. package/skills/read-csv/tsconfig.json +0 -17
  446. package/skills/read-excel/SKILL.md +0 -64
  447. package/skills/read-excel/package.json +0 -36
  448. package/skills/read-excel/src/index.ts +0 -266
  449. package/skills/read-excel/tsconfig.json +0 -17
  450. package/skills/regex-tester/CLAUDE.md +0 -19
  451. package/skills/regex-tester/package.json +0 -27
  452. package/skills/regex-tester/src/index.ts +0 -183
  453. package/skills/regex-tester/tsconfig.json +0 -10
  454. package/skills/repo-onboarding-report/SKILL.md +0 -52
  455. package/skills/repo-onboarding-report/package.json +0 -10
  456. package/skills/scancommitpr/SKILL.md +0 -178
  457. package/skills/scancommitpr/package.json +0 -34
  458. package/skills/scancommitpr/src/index.ts +0 -44
  459. package/skills/scancommitpr/tsconfig.json +0 -13
  460. package/skills/scancommitpush/SKILL.md +0 -174
  461. package/skills/scancommitpush/package.json +0 -32
  462. package/skills/scancommitpush/src/index.ts +0 -44
  463. package/skills/scancommitpush/tsconfig.json +0 -13
  464. package/skills/scientific-figure-check/CLAUDE.md +0 -19
  465. package/skills/scientific-figure-check/package.json +0 -29
  466. package/skills/scientific-figure-check/src/index.ts +0 -83
  467. package/skills/scientific-figure-check/tsconfig.json +0 -10
  468. package/skills/security-audit/CLAUDE.md +0 -19
  469. package/skills/security-audit/package.json +0 -27
  470. package/skills/security-audit/src/index.ts +0 -145
  471. package/skills/security-audit/tsconfig.json +0 -10
  472. package/skills/security-audit-report/SKILL.md +0 -52
  473. package/skills/security-audit-report/package.json +0 -10
  474. package/skills/seo-content-pack/SKILL.md +0 -54
  475. package/skills/seo-content-pack/package.json +0 -10
  476. package/skills/siteanalyze/SKILL.md +0 -25
  477. package/skills/siteanalyze/package.json +0 -27
  478. package/skills/siteanalyze/src/index.ts +0 -592
  479. package/skills/slide-deck-generator/SKILL.md +0 -93
  480. package/skills/slide-deck-generator/package.json +0 -38
  481. package/skills/slide-deck-generator/src/cli.ts +0 -133
  482. package/skills/slide-deck-generator/src/index.ts +0 -148
  483. package/skills/slide-deck-generator/src/model.ts +0 -307
  484. package/skills/slide-deck-generator/src/pptx.ts +0 -143
  485. package/skills/slide-deck-generator/src/render.ts +0 -248
  486. package/skills/slide-deck-generator/src/types.ts +0 -114
  487. package/skills/slide-deck-generator/src/utils.ts +0 -53
  488. package/skills/slide-deck-generator/tsconfig.json +0 -17
  489. package/skills/social-content-calendar/SKILL.md +0 -54
  490. package/skills/social-content-calendar/package.json +0 -10
  491. package/skills/split-pdf/CLAUDE.md +0 -19
  492. package/skills/split-pdf/package.json +0 -30
  493. package/skills/split-pdf/src/index.ts +0 -301
  494. package/skills/split-pdf/tsconfig.json +0 -10
  495. package/skills/statistical-test-selector/CLAUDE.md +0 -19
  496. package/skills/statistical-test-selector/package.json +0 -27
  497. package/skills/statistical-test-selector/src/index.ts +0 -75
  498. package/skills/statistical-test-selector/tsconfig.json +0 -10
  499. package/skills/test-suite-generator/SKILL.md +0 -51
  500. package/skills/test-suite-generator/package.json +0 -10
  501. package/skills/tmux-session/SKILL.md +0 -109
  502. package/skills/tmux-session/package.json +0 -33
  503. package/skills/tmux-session/src/index.ts +0 -34
  504. package/skills/tmux-session/tsconfig.json +0 -17
  505. package/skills/todos-plan/SKILL.md +0 -363
  506. package/skills/todos-plan/agents/openai.yaml +0 -4
  507. package/skills/todos-plan/package.json +0 -9
  508. package/skills/todos-plan/src/index.ts +0 -68
  509. package/skills/tsconfig.base.json +0 -12
  510. package/skills/validate-config/CLAUDE.md +0 -19
  511. package/skills/validate-config/package.json +0 -29
  512. package/skills/validate-config/src/index.ts +0 -56
  513. package/skills/validate-config/tsconfig.json +0 -10
  514. package/skills/video-downloader/CLAUDE.md +0 -19
  515. package/skills/video-downloader/package.json +0 -29
  516. package/skills/video-downloader/src/index.ts +0 -561
  517. package/skills/video-downloader/tsconfig.json +0 -10
  518. package/skills/video-highlight-pack/SKILL.md +0 -54
  519. package/skills/video-highlight-pack/package.json +0 -10
  520. package/skills/watermark/CLAUDE.md +0 -19
  521. package/skills/watermark/package.json +0 -32
  522. package/skills/watermark/src/index.ts +0 -587
  523. package/skills/watermark/tsconfig.json +0 -10
@@ -0,0 +1,242 @@
1
+ import type { OwnedBytes } from "../lib/skill-bundle.js";
2
+ export declare const SERVER_RUN_STATUSES: readonly ["queued", "waiting_for_approval", "running", "succeeded", "failed", "cancel_requested", "cancelled", "retrying", "expired", "refunded"];
3
+ export type ServerRunStatus = (typeof SERVER_RUN_STATUSES)[number];
4
+ /**
5
+ * A fenced transition was refused because the run's lease_generation moved on.
6
+ *
7
+ * The worker that throws this is writing against a run it no longer owns: a
8
+ * newer claim took it, or a cancellation fenced it. The run is not missing -
9
+ * that is the null return - it has simply left the writer behind.
10
+ */
11
+ export declare class StaleLeaseGenerationError extends Error {
12
+ readonly runId: string;
13
+ readonly expectedGeneration: number;
14
+ readonly currentGeneration: number;
15
+ readonly status: ServerRunStatus;
16
+ constructor(runId: string, expectedGeneration: number, currentGeneration: number, status: ServerRunStatus);
17
+ }
18
+ export interface ApiPrincipal {
19
+ apiKeyId: string;
20
+ orgId: string;
21
+ orgSlug: string;
22
+ orgName: string;
23
+ userId: string;
24
+ email: string;
25
+ role: string;
26
+ scopes: string[];
27
+ }
28
+ export interface ServerRunRecord {
29
+ id: string;
30
+ orgId: string;
31
+ userId: string;
32
+ skill: string;
33
+ requestedSlug: string;
34
+ status: ServerRunStatus;
35
+ input: Record<string, unknown>;
36
+ args: string[];
37
+ idempotencyKey?: string;
38
+ correlationId: string;
39
+ costCents: number;
40
+ /**
41
+ * The cancellation fence. Bumped by every claim and by every cancellation; a
42
+ * worker that transitions a run while carrying an older generation is writing
43
+ * against a run it no longer owns and is rejected (see transitionRun).
44
+ */
45
+ leaseGeneration: number;
46
+ outputType?: string;
47
+ outputPreview?: string;
48
+ errorCode?: string;
49
+ errorMessage?: string;
50
+ createdAt: string;
51
+ startedAt?: string;
52
+ completedAt?: string;
53
+ }
54
+ export interface ServerRunLog {
55
+ runId: string;
56
+ sequence: number;
57
+ level: "debug" | "info" | "warn" | "error";
58
+ message: string;
59
+ createdAt: string;
60
+ }
61
+ export interface ServerArtifact {
62
+ id: string;
63
+ runId: string;
64
+ orgId: string;
65
+ fileName: string;
66
+ relativePath: string;
67
+ contentType: string;
68
+ byteSize: number;
69
+ sha256: string;
70
+ storageKind: "db" | "s3";
71
+ storageKey?: string;
72
+ bodyText?: string;
73
+ /**
74
+ * Output visibility. Runs' outputs are PRIVATE by default: the value is set at
75
+ * write time from the governance default and persisted, never inferred at read
76
+ * time. "public" is the explicit opt-in for artifacts the tenant intends to
77
+ * share; it is not a default on any path.
78
+ */
79
+ visibility: "private" | "public";
80
+ /**
81
+ * Finite retention, set at write time as createdAt + configured TTL. Absent
82
+ * only when the writing path opted out explicitly; the expiry sweep deletes
83
+ * artifacts whose expiresAt is in the past and records a deletion receipt.
84
+ */
85
+ expiresAt?: string;
86
+ createdAt: string;
87
+ }
88
+ /** Where bytes actually live. Same vocabulary as ServerArtifact, same meaning. */
89
+ export type BlobStorageKind = "db" | "s3";
90
+ /**
91
+ * A skill published to this instance by one organization.
92
+ *
93
+ * Distinct from `SkillMeta` (src/lib/registry-types.ts), which describes a skill the CLI
94
+ * knows about from any source. This is the row: it always belongs to an org, and it
95
+ * always carries the provenance of who put it there.
96
+ */
97
+ export interface ServerSkillRecord {
98
+ orgId: string;
99
+ slug: string;
100
+ displayName: string;
101
+ description: string;
102
+ category: string;
103
+ tags: string[];
104
+ source: string;
105
+ kind: "executable" | "instruction";
106
+ version?: string;
107
+ /** The agent-facing document, served verbatim by GET /skills/:slug/skill.md. */
108
+ skillMd?: string;
109
+ /** Digest of the stored bundle. Absent for a metadata-only publish. */
110
+ bundleSha256?: string;
111
+ bundleByteSize?: number;
112
+ publishedByUserId?: string;
113
+ createdAt: string;
114
+ updatedAt: string;
115
+ }
116
+ /**
117
+ * Bundle bytes, addressed by their own digest.
118
+ *
119
+ * `bytes` is present only when the bundle is stored in the database (`storageKind: "db"`).
120
+ * For S3 the row is a pointer and SkillBundleStorage.read() fetches the object - the same
121
+ * split ServerArtifact makes between `bodyText` and `storageKey`, except that a bundle is
122
+ * a gzipped tar and so cannot be a string at any layer.
123
+ */
124
+ export interface ServerSkillBundle {
125
+ orgId: string;
126
+ sha256: string;
127
+ byteSize: number;
128
+ contentType: string;
129
+ storageKind: BlobStorageKind;
130
+ storageKey?: string;
131
+ bytes?: OwnedBytes;
132
+ createdAt: string;
133
+ }
134
+ export interface PublishSkillInput {
135
+ principal: ApiPrincipal;
136
+ slug: string;
137
+ displayName: string;
138
+ description: string;
139
+ category: string;
140
+ tags: string[];
141
+ source: string;
142
+ kind: ServerSkillRecord["kind"];
143
+ version?: string;
144
+ skillMd?: string;
145
+ /** Omitted for a metadata-only publish or update. */
146
+ bundle?: Omit<ServerSkillBundle, "orgId" | "createdAt">;
147
+ }
148
+ /** Metadata-only patch. Never touches the bundle; republish to change bytes. */
149
+ export type UpdateSkillPatch = Partial<Pick<ServerSkillRecord, "displayName" | "description" | "category" | "tags" | "version" | "kind" | "skillMd">>;
150
+ export interface CreateRunInput {
151
+ principal: ApiPrincipal;
152
+ slug: string;
153
+ input: Record<string, unknown>;
154
+ args: string[];
155
+ idempotencyKey?: string;
156
+ }
157
+ export interface ClaimRunInput {
158
+ workerId: string;
159
+ }
160
+ /**
161
+ * Fields a fenced transition may write, plus the lease_generation the fence
162
+ * itself bumps on cancellation. Everything updateRun can write plus the
163
+ * generation counter; the worker never patches the generation, the cancel
164
+ * service does.
165
+ */
166
+ export type RunTransitionPatch = Partial<Pick<ServerRunRecord, "status" | "outputType" | "outputPreview" | "errorCode" | "errorMessage" | "startedAt" | "completedAt" | "leaseGeneration">>;
167
+ /**
168
+ * What a store is, in the only two dimensions the server needs at boot: which backend
169
+ * it is (for logs and diagnostics) and whether it survives a restart.
170
+ *
171
+ * `durable` exists because the server used to boot onto an in-process Map, report
172
+ * `ok: true` at /health, and lose every run on restart with no warning at any point. A
173
+ * store that knows it is non-durable can now say so, and startSkillsServer() refuses it
174
+ * unless the operator explicitly opted in.
175
+ */
176
+ export interface StoreBackendInfo {
177
+ /**
178
+ * The three bundled backends are named for autocomplete; the open `string` arm is
179
+ * deliberate. This interface is a published seam, and a third-party store must be able
180
+ * to declare what it is - "mysql", "dynamodb" - without either a type error or having
181
+ * to misreport itself as one of ours. A closed union would make the seam implementable
182
+ * only by us, which is the test R3 sets for it.
183
+ */
184
+ kind: "postgres" | "sqlite" | "memory" | (string & {});
185
+ /** False when the data does not survive process exit. */
186
+ durable: boolean;
187
+ /** Credential-free description, safe to put in logs and error messages. */
188
+ label: string;
189
+ }
190
+ export interface SkillsProductStore {
191
+ /**
192
+ * Optional so a third-party store implementing this seam keeps compiling. An
193
+ * undeclared backend is treated as durable: we can refuse what a store tells us is
194
+ * ephemeral, and cannot infer it about somebody else's implementation. The hazard
195
+ * actually being closed is our own default, which is now SQLite on disk.
196
+ */
197
+ readonly backend?: StoreBackendInfo;
198
+ /** Release connections and file handles. Optional; not every backend holds any. */
199
+ close?(): Promise<void>;
200
+ /**
201
+ * Prove the backend is actually reachable, throwing if it is not.
202
+ *
203
+ * Called once at startup. Bun's SQL client connects lazily, so without this a
204
+ * Postgres URL pointing at a dead host produced a server that started happily and
205
+ * then 500ed on the first request.
206
+ */
207
+ verifyConnectivity?(): Promise<void>;
208
+ authenticateApiKeyHash(hash: string): Promise<ApiPrincipal | null>;
209
+ ensureBootstrapApiKey?(token: string, principal?: Partial<ApiPrincipal>): Promise<void>;
210
+ createRun(input: CreateRunInput): Promise<ServerRunRecord>;
211
+ listRuns(principal: ApiPrincipal, limit: number): Promise<ServerRunRecord[]>;
212
+ getRun(principal: ApiPrincipal, runId: string): Promise<ServerRunRecord | null>;
213
+ claimNextRun(input: ClaimRunInput): Promise<ServerRunRecord | null>;
214
+ updateRun(runId: string, patch: Partial<Pick<ServerRunRecord, "status" | "outputType" | "outputPreview" | "errorCode" | "errorMessage" | "startedAt" | "completedAt">>): Promise<ServerRunRecord | null>;
215
+ /**
216
+ * Generation-fenced transition, the cancellation gate.
217
+ *
218
+ * Optional so a third-party store implementing this seam keeps compiling; the
219
+ * cancel service requires it and refuses to run without it (FENCING_UNSUPPORTED)
220
+ * rather than cancelling unfenced. When present it is the ONLY transition the
221
+ * worker paths use: the UPDATE re-asserts `lease_generation = <expected>` and
222
+ * reports zero rows when the generation moved on (a newer claim, or a
223
+ * cancellation), so a late write from a stale worker never lands.
224
+ *
225
+ * Returns null when the run does not exist; throws StaleLeaseGenerationError
226
+ * when the generation no longer matches. The distinction matters: "nothing
227
+ * there" and "you lost the fence" are different facts.
228
+ */
229
+ transitionRun?(runId: string, patch: RunTransitionPatch, expectedGeneration: number): Promise<ServerRunRecord | null>;
230
+ appendLog(runId: string, orgId: string, level: ServerRunLog["level"], message: string): Promise<ServerRunLog>;
231
+ listLogs(principal: ApiPrincipal, runId: string): Promise<ServerRunLog[]>;
232
+ addArtifact(artifact: Omit<ServerArtifact, "createdAt">): Promise<ServerArtifact>;
233
+ listArtifacts(principal: ApiPrincipal, runId: string): Promise<ServerArtifact[]>;
234
+ getArtifact(principal: ApiPrincipal, runId: string, artifactId: string): Promise<ServerArtifact | null>;
235
+ publishSkill(input: PublishSkillInput): Promise<ServerSkillRecord>;
236
+ listSkills(principal: ApiPrincipal): Promise<ServerSkillRecord[]>;
237
+ getSkill(principal: ApiPrincipal, slug: string): Promise<ServerSkillRecord | null>;
238
+ updateSkill(principal: ApiPrincipal, slug: string, patch: UpdateSkillPatch): Promise<ServerSkillRecord | null>;
239
+ /** False when the org has no skill by that slug. Also drops a bundle nothing else references. */
240
+ deleteSkill(principal: ApiPrincipal, slug: string): Promise<boolean>;
241
+ getSkillBundle(principal: ApiPrincipal, sha256: string): Promise<ServerSkillBundle | null>;
242
+ }
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bun
2
+ import { ArtifactStorage } from "../sdk/storage.js";
3
+ import type { SkillsProductStore } from "../sdk/storage.js";
4
+ export declare function runWorkerOnce(store: SkillsProductStore, workerId?: string, storage?: ArtifactStorage): Promise<boolean>;
package/dist/storage.js CHANGED
@@ -1,5 +1,35 @@
1
1
  // @bun
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
2
4
  var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
12
+ var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
20
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
21
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
+ for (let key of __getOwnPropNames(mod))
23
+ if (!__hasOwnProp.call(to, key))
24
+ __defProp(to, key, {
25
+ get: __accessProp.bind(mod, key),
26
+ enumerable: true
27
+ });
28
+ if (canCache)
29
+ cache.set(mod, to);
30
+ return to;
31
+ };
32
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3
33
  var __returnValue = (v) => v;
4
34
  function __exportSetter(name, newValue) {
5
35
  this[name] = __returnValue.bind(null, newValue);
@@ -13,6 +43,8 @@ var __export = (target, all) => {
13
43
  set: __exportSetter.bind(all, name)
14
44
  });
15
45
  };
46
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
47
+ var __require = import.meta.require;
16
48
 
17
49
  // src/lib/native-storage.ts
18
50
  import { createHash, createHmac } from "crypto";
@@ -17,9 +17,34 @@ Portable skills live in one folder each:
17
17
  `skills port <path>` and `skills add <path>` copy an existing skill folder into
18
18
  this layout and add missing standard files.
19
19
 
20
+ ## The manifest split
21
+
22
+ Two metadata surfaces exist, with one rule: **portable metadata lives in
23
+ `skill.json`; consumer frontmatter stays minimal.**
24
+
25
+ - `skill.json` is the machine-readable manifest and the **source of truth**
26
+ for everything the fleet needs to know about a skill: identity, version,
27
+ runtime contract, provenance. It is the `hasna.skill.v1` contract defined
28
+ in `schemas/skill.schema.json` (published at
29
+ `https://hasna.dev/schemas/skill.v1.json`).
30
+ - `SKILL.md` is the agent-facing document. Its frontmatter carries only
31
+ `name` and `description` (plus `user_invocable: true` where a Claude
32
+ consumer renderer needs it). Everything else — `kind`, `version`,
33
+ `source`, `category`, `tags`, `displayName` — lives in `skill.json`.
34
+ See `docs/authoring-rule-amendment.md` for the proposed fleet rule text.
35
+
36
+ ```yaml
37
+ ---
38
+ name: my-skill
39
+ description: What this skill does and when to use it.
40
+ ---
41
+ ```
42
+
20
43
  ## Skill Kinds
21
44
 
22
- A skill declares its artifact class with the `kind` frontmatter field:
45
+ A skill declares its artifact class with the `kind` field in `skill.json`
46
+ (`kind` may also appear in `SKILL.md` frontmatter for compatibility with
47
+ existing Codewith conventions):
23
48
 
24
49
  - `kind: executable` (default when omitted) — a runnable skill folder with
25
50
  `package.json`, a non-empty `bin`, and `src/index.ts`. `skills run` executes it.
@@ -33,45 +58,65 @@ A skill declares its artifact class with the `kind` frontmatter field:
33
58
  Missing `kind` defaults to `executable` so the bundled corpus is unaffected.
34
59
  Migrated operational (prose) skills should set `kind: instruction` explicitly.
35
60
 
36
- Minimum `SKILL.md` frontmatter for an instruction skill:
37
-
38
- ```yaml
39
- ---
40
- name: project
41
- description: Open or resume an existing Hasna repo project using the projects CLI.
42
- kind: instruction
43
- version: 0.1.0
44
- source: private
45
- ---
46
- ```
47
-
48
61
  ## Naming
49
62
 
50
63
  Skill names are lowercase slugs: letters, numbers, dots, underscores, and
51
64
  hyphens. The folder name, `SKILL.md` frontmatter `name`, `skill.json` `name`,
52
- and `package.json` `name` should match.
53
-
54
- ## Manifest
55
-
56
- Every portable skill needs a manifest. `skill.json` is the machine-readable
57
- manifest. `SKILL.md` frontmatter stays compatible with existing Codewith
58
- `SKILL.md` conventions and can be used by agents for skill discovery.
59
-
60
- Minimum `SKILL.md` frontmatter:
61
-
62
- ```yaml
63
- ---
64
- name: my-skill
65
- description: What this skill does and when to use it.
66
- version: 0.1.0
67
- source: custom
68
- category: Development Tools
69
- tags:
70
- - custom
71
- ---
72
- ```
73
-
74
- Minimum `skill.json`:
65
+ and `package.json` `name` must match.
66
+
67
+ ## The `hasna.skill.v1` manifest
68
+
69
+ Every portable skill needs a `skill.json` manifest conforming to
70
+ `hasna.skill.v1` (schema: `schemas/skill.schema.json`). The templates always
71
+ emit a complete valid manifest; `skills validate` rejects one that is
72
+ incomplete, invalid, or whose `content_hash` does not match the bundle.
73
+
74
+ ### Required fields
75
+
76
+ | field | type | meaning |
77
+ |---|---|---|
78
+ | `standard` | string | `"hasna.skill.v1"` |
79
+ | `name` | string | Lowercase slug; matches the folder name |
80
+ | `description` | string | What this skill does and when to use it |
81
+ | `version` | string | Semver (e.g. `0.1.0`). Any content change requires a version bump |
82
+ | `runtime` | object | The runtime contract below |
83
+ | `provenance` | object | Source and integrity fields; `content_hash` is required |
84
+
85
+ ### Optional fields (legacy-compatible)
86
+
87
+ | field | type | meaning |
88
+ |---|---|---|
89
+ | `$schema` | string | `https://hasna.dev/schemas/skill.v1.json` |
90
+ | `displayName` | string | Human-facing name |
91
+ | `category` | string | Marketplace / registry category |
92
+ | `tags` | string[] | Searchable tags |
93
+ | `kind` | `"executable" \| "instruction"` | Artifact class |
94
+ | `inputs` | object[] | Declared inputs (`name`, `type`, optional `required`, `description`) |
95
+ | `commands` | object[] | Runnable commands (`name`, `entry`/`command`, optional `args`, `description`) |
96
+
97
+ ### The runtime contract
98
+
99
+ | field | type | default | meaning |
100
+ |---|---|---|---|
101
+ | `runtime` | `"bun" \| "node" \| "python3"` | *(required)* | Execution runtime. `bun` is the Hasna default |
102
+ | `version` | string | — | Optional runtime version constraint (e.g. `"22"`, `">=3.12"`) |
103
+ | `entrypoint` | string | `commands[0].entry` | Relative path to the runnable entrypoint |
104
+ | `timeout` | integer | `900` | Max execution seconds, **capped at 900** |
105
+ | `needs_network` | boolean | `false` | Whether execution requires network egress |
106
+ | `env` | string[] | `[]` | **Secret REFERENCE names only, never values** — uppercase identifiers such as `OPENAI_API_KEY` |
107
+ | `sandbox` | `"readonly-fs" \| "workspace-write" \| "full"` | `"readonly-fs"` | Filesystem access granted to execution |
108
+ | `system_deps` | string[] | `[]` | Allowlisted system binaries (see schema for the list) |
109
+ | `artifacts` | string[] | `[]` | Glob patterns of artifacts the skill may produce (e.g. `"out/**"`) |
110
+
111
+ ### The provenance fields
112
+
113
+ | field | type | meaning |
114
+ |---|---|---|
115
+ | `source_commit` | string | Git SHA of the source revision, or `"unknown"` for locally scaffolded skills |
116
+ | `content_hash` | string | **Self-referencing** canonical SHA-256 of the normalized bundle (see below). Required on every manifest |
117
+ | `changelog` | string | Pointer to changelog / release notes (relative path or URL) |
118
+
119
+ ### Example
75
120
 
76
121
  ```json
77
122
  {
@@ -80,6 +125,9 @@ Minimum `skill.json`:
80
125
  "name": "my-skill",
81
126
  "description": "What this skill does and when to use it.",
82
127
  "version": "0.1.0",
128
+ "displayName": "My Skill",
129
+ "category": "Development Tools",
130
+ "tags": ["custom"],
83
131
  "inputs": [
84
132
  {
85
133
  "name": "args",
@@ -95,13 +143,61 @@ Minimum `skill.json`:
95
143
  "description": "Run my-skill.",
96
144
  "args": ["...args"]
97
145
  }
98
- ]
146
+ ],
147
+ "runtime": {
148
+ "runtime": "bun",
149
+ "entrypoint": "src/index.ts",
150
+ "timeout": 900,
151
+ "needs_network": false,
152
+ "env": [],
153
+ "sandbox": "readonly-fs",
154
+ "system_deps": [],
155
+ "artifacts": []
156
+ },
157
+ "provenance": {
158
+ "source_commit": "unknown",
159
+ "content_hash": "<64 lowercase hex chars>",
160
+ "changelog": "CHANGELOG.md"
161
+ }
99
162
  }
100
163
  ```
101
164
 
102
165
  If `skill.json` is absent, the CLI can infer a portable manifest from
103
166
  `SKILL.md` frontmatter plus `package.json` `bin`, but scaffolded and ported
104
- skills should keep `skill.json` checked in.
167
+ skills always keep a complete `skill.json` checked in. A manifest present
168
+ without a valid `content_hash` is rejected by `skills validate`.
169
+
170
+ ## Canonical content hashing
171
+
172
+ `content_hash` is a **self-referencing** SHA-256 over the normalized skill
173
+ bundle:
174
+
175
+ 1. **Coverage** — every file at the skill root (`SKILL.md`, `skill.json`,
176
+ `AGENTS.md`, `package.json`, `tsconfig.json`) plus every file under
177
+ `src/`, `scripts/`, `assets/`, and `references/`, recursively.
178
+ 2. **Exclusions** — `node_modules`, `.git`, `dist`, `build`, `.turbo`,
179
+ dot-entries, and symlinks never enter the hash.
180
+ 3. **Normalization** — line endings are normalized to LF; for `skill.json`
181
+ the manifest is **blank-canonicalized**: parsed, its own `content_hash`
182
+ field (top-level or under `provenance`) removed, and re-serialized with
183
+ sorted keys. Key order, CRLF, and the hash's own presence therefore never
184
+ change the digest.
185
+ 4. **Determinism** — files are hashed in sorted relative-path order (posix
186
+ separators), each entry length-prefixed, so the digest is identical on
187
+ every platform for the same logical content.
188
+ 5. **Verification** — `skills validate` recomputes the hash and rejects any
189
+ manifest whose declared `content_hash` does not match, with the computed
190
+ value in the error message.
191
+
192
+ ### Versioning rule
193
+
194
+ **A content change requires a version bump; the same version with different
195
+ content is rejected.** Enforcement is structural: any content change alters
196
+ the canonical bundle, so the declared `content_hash` no longer matches and
197
+ `skills validate` fails (`contract.content_hash_mismatch`). Re-hashing
198
+ without a version bump is still a rejection signal for the registry/server
199
+ later, which pins by version + hash — same semver + different hash is
200
+ unpublishable.
105
201
 
106
202
  ## Agent Handoff
107
203
 
@@ -136,6 +232,11 @@ Validation checks:
136
232
 
137
233
  - folder and name safety;
138
234
  - `SKILL.md` frontmatter compatibility (including a valid `kind`);
235
+ - the `hasna.skill.v1` contract: `standard`, `name`, `description`, `version`
236
+ (semver), the runtime contract (runtime, timeout cap, sandbox, env reference
237
+ names, system-deps allowlist), and provenance;
238
+ - the canonical `content_hash`: present, well-formed, and matching the bundle
239
+ (`contract.content_hash_mismatch` on drift);
139
240
  - `skill.json` standard, version, inputs, and commands (relaxed for
140
241
  `kind: instruction`, which needs neither `commands`, `inputs`, nor `AGENTS.md`);
141
242
  - `AGENTS.md` presence (executable skills only);
@@ -143,6 +244,8 @@ Validation checks:
143
244
  optional for `kind: instruction`);
144
245
  - no reserved files such as `.env` or symlinks.
145
246
 
247
+ An invalid manifest exits non-zero with the exact field errors.
248
+
146
249
  ## Porting Existing Skills
147
250
 
148
251
  ```bash
@@ -153,4 +256,73 @@ skills add ./old-skill --name new-name
153
256
  Porting copies the folder into `~/.hasna/skills/<name>/`, skips generated and
154
257
  dependency directories such as `node_modules`, `dist`, and `.git`, then adds or
155
258
  normalizes `skill.json`, `AGENTS.md`, `package.json`, `tsconfig.json`, and an
156
- entrypoint when they are missing.
259
+ entrypoint when they are missing. Missing contract fields (runtime defaults,
260
+ provenance) are filled and the `content_hash` is recomputed over the ported
261
+ bundle; unknown keys in an existing `skill.json` are preserved.
262
+
263
+ ## Machine Layout
264
+
265
+ The skills app folder (`~/.hasna/skills/`, relocatable with
266
+ `$HASNA_SKILLS_DIR`) hosts the owner layout:
267
+
268
+ ```text
269
+ ~/.hasna/skills/
270
+ ├── skills/ canonical corpus cache — the sync source
271
+ ├── logs/ run/sync logs (created lazily)
272
+ ├── outputs/ run outputs (created lazily)
273
+ ├── custom/ experiments, retained as-is
274
+ ├── config.json
275
+ └── skills.db
276
+ ```
277
+
278
+ `skills/` replaces the older `installed/` corpus home, and legacy flat skill
279
+ dirs that predate `installed/` migrate into it. Both moves are opt-in and
280
+ idempotent:
281
+
282
+ ```bash
283
+ skills storage migrate # installed/ + legacy dirs -> skills/, creates logs/ + outputs/
284
+ skills storage migrate --dry-run # show what would move, write nothing
285
+ ```
286
+
287
+ Migration refuses to run against a non-empty `skills/` that carries no
288
+ migration record (`skills/.layout-migration.json`), and never touches
289
+ `custom/`. After a successful migration `skills sync` reads the corpus from
290
+ the new cache automatically.
291
+
292
+ ### Unmarked-home adoption
293
+
294
+ Agent homes are full of skill directories the CLI never wrote (the ad-hoc
295
+ sed/scp/rsync era). Those carry no `.hasna-skills.json` marker and sync leaves
296
+ them alone by design. Adoption is the migration mode for that population:
297
+
298
+ ```bash
299
+ skills sync --adopt # dry-run: hash unmarked home skills vs the corpus
300
+ skills sync --adopt --apply # write markers for exact matches; ledger the rest
301
+ ```
302
+
303
+ Each unmarked home skill's `SKILL.md` is hashed (line endings normalized,
304
+ `user_invocable` stripped) and compared against the canonical corpus cache:
305
+
306
+ - exact match -> a marker is written and the dir is adopted;
307
+ - content differs -> recorded in `~/.hasna/skills/conflicts.json` (home, skill,
308
+ hash, canonical hash, mtime) and skipped — an unmarked dir is never
309
+ overwritten;
310
+ - no canonical entry -> reported as unknown and skipped.
311
+
312
+ Every written marker is listed in a rollback record under
313
+ `~/.hasna/skills/rollback/`. Nothing is ever deleted by adoption.
314
+
315
+ ### Home drift census
316
+
317
+ ```bash
318
+ skills sync --check # exits non-zero while drift exists
319
+ ```
320
+
321
+ Compares each existing agent home against the canonical corpus and lists
322
+ `missing-from-home`, `stray-in-home` (marked dir, no canonical entry), and
323
+ `diverged` (marked dir whose hash differs). Unmarked dirs are adoption
324
+ candidates, not drift. `skills diff <name>` and `skills outdated` use the same
325
+ home-vs-canonical comparison; the pinned-skill version comparison remains as a
326
+ subset. `skills sync --prune [--apply]` removes only marked-and-stray dirs,
327
+ recording each removal in the rollback store before it happens.
328
+
@@ -0,0 +1,83 @@
1
+ -- Run outputs governance: privacy, retention, cancellation fencing, spend.
2
+ --
3
+ -- Postgres dialect of 0003_run_outputs_governance. Read the SQLite file for why
4
+ -- the migration is additive; the rationale is not repeated here, only the
5
+ -- dialect differences are:
6
+ -- * timestamptz -> text holding a UTC ISO-8601 instant (expires_at, reconciled_at).
7
+ -- * text JSON -> jsonb (metadata_json).
8
+ --
9
+ -- SQLite has no row-level security; tenant isolation there rests on the
10
+ -- org-scoped predicates in the store and the service-layer negative tests. This
11
+ -- dialect additionally arms PostgreSQL RLS on the two tenant tables, so a
12
+ -- statement that never set the tenant context sees zero rows (fail closed):
13
+ --
14
+ -- CREATE POLICY ... USING (
15
+ -- org_id = current_setting('app.skills_org_id', true)
16
+ -- OR current_setting('app.skills_claim_context', true) = 'worker'
17
+ -- )
18
+ --
19
+ -- The first clause is the principal path: the store runs every tenant-facing
20
+ -- read under SET LOCAL app.skills_org_id = <org>, and an unset setting matches
21
+ -- nothing. The second clause is the worker path, stated as the deliberate
22
+ -- exception it is: skills-worker claims and finalises runs for every org on the
23
+ -- instance (claimNextRun is not org-scoped by design), so it writes under an
24
+ -- explicit claim context rather than a tenant context. Both clauses must be
25
+ -- present for the shipped server to work at all, and neither weakens the tenant
26
+ -- fence: a caller with no context and no claim role reads no tenant rows.
27
+
28
+ ALTER TABLE skills_runs ADD COLUMN lease_generation integer NOT NULL DEFAULT 0;
29
+
30
+ ALTER TABLE skills_artifacts ADD COLUMN visibility text NOT NULL DEFAULT 'private';
31
+ ALTER TABLE skills_artifacts ADD COLUMN expires_at timestamptz;
32
+
33
+ CREATE TABLE IF NOT EXISTS skills_lifecycle_receipts (
34
+ id text PRIMARY KEY,
35
+ kind text NOT NULL,
36
+ org_id text NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
37
+ run_id text NOT NULL REFERENCES skills_runs(id) ON DELETE CASCADE,
38
+ artifact_id text,
39
+ requested_by text NOT NULL,
40
+ metadata_json jsonb NOT NULL DEFAULT '{}'::jsonb,
41
+ created_at timestamptz NOT NULL DEFAULT now(),
42
+ CHECK (kind IN ('delete','quarantine','cancel'))
43
+ );
44
+
45
+ CREATE INDEX IF NOT EXISTS skills_lifecycle_receipts_org_run_idx
46
+ ON skills_lifecycle_receipts (org_id, run_id);
47
+
48
+ CREATE TABLE IF NOT EXISTS skills_credit_reservations (
49
+ id text PRIMARY KEY,
50
+ org_id text NOT NULL REFERENCES organizations(id) ON DELETE CASCADE,
51
+ run_id text NOT NULL REFERENCES skills_runs(id) ON DELETE CASCADE,
52
+ estimated_cents integer NOT NULL,
53
+ actual_cents integer,
54
+ status text NOT NULL,
55
+ created_at timestamptz NOT NULL DEFAULT now(),
56
+ reconciled_at timestamptz,
57
+ CHECK (status IN ('reserved','charged','released'))
58
+ );
59
+
60
+ CREATE INDEX IF NOT EXISTS skills_credit_reservations_org_run_idx
61
+ ON skills_credit_reservations (org_id, run_id);
62
+
63
+ ALTER TABLE skills_runs ENABLE ROW LEVEL SECURITY;
64
+ ALTER TABLE skills_artifacts ENABLE ROW LEVEL SECURITY;
65
+
66
+ -- FORCE closes the owner exemption: Postgres exempts a table's owner from RLS,
67
+ -- and this instance runs migrations and the server as one role, so without
68
+ -- FORCE the fence would not bind the app path. With FORCE the store's
69
+ -- tenant/worker contexts apply to that role like any other.
70
+ ALTER TABLE skills_runs FORCE ROW LEVEL SECURITY;
71
+ ALTER TABLE skills_artifacts FORCE ROW LEVEL SECURITY;
72
+
73
+ CREATE POLICY skills_runs_tenant_isolation ON skills_runs
74
+ USING (
75
+ org_id = current_setting('app.skills_org_id', true)
76
+ OR current_setting('app.skills_claim_context', true) = 'worker'
77
+ );
78
+
79
+ CREATE POLICY skills_artifacts_tenant_isolation ON skills_artifacts
80
+ USING (
81
+ org_id = current_setting('app.skills_org_id', true)
82
+ OR current_setting('app.skills_claim_context', true) = 'worker'
83
+ );