@lesliechan721/aw 0.1.0-beta.9 → 0.1.0-beta.91

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 (829) hide show
  1. package/dist/authoring/assets/aw-config.mjs +100 -501
  2. package/dist/authoring/assets/aw-config.mjs.map +1 -1
  3. package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
  4. package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
  5. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
  6. package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
  7. package/dist/authoring/assets/command-runtime-config.mjs +134 -0
  8. package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
  9. package/dist/authoring/scripts/add-skill.mjs +15 -38
  10. package/dist/authoring/scripts/add-skill.mjs.map +1 -1
  11. package/dist/authoring/scripts/init-plugin.mjs +72 -96
  12. package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
  13. package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
  14. package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
  15. package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
  16. package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
  17. package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
  18. package/dist/authoring/scripts/lib/skill-scaffold.d.mts +2 -2
  19. package/dist/authoring/scripts/lib/skill-scaffold.mjs +4 -7
  20. package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
  21. package/dist/authoring/scripts/remove-plugin.mjs +1 -1
  22. package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
  23. package/dist/authoring/scripts/validate-plugin.mjs +416 -1995
  24. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  25. package/dist/authoring/scripts/validate-skill.mjs +1 -1
  26. package/dist/index.js +2 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/native-runtime/reader-runtime.mjs +34 -0
  29. package/dist/native-runtime/reader.d.mts +6 -0
  30. package/dist/native-runtime/reader.mjs +11 -0
  31. package/dist/scripts/aw-skill-eval-materializer.d.ts +11 -1
  32. package/dist/scripts/aw-skill-eval-materializer.js +118 -115
  33. package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
  34. package/dist/scripts/bundle-plugins.js +25 -7
  35. package/dist/scripts/bundle-plugins.js.map +1 -1
  36. package/dist/scripts/plugin-staging.d.ts +7 -7
  37. package/dist/scripts/plugin-staging.js +10 -8
  38. package/dist/scripts/plugin-staging.js.map +1 -1
  39. package/dist/scripts/plugin-test-reporter.d.mts +2 -0
  40. package/dist/scripts/plugin-test-reporter.mjs +21 -0
  41. package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
  42. package/dist/scripts/test-plugin-scripts.d.ts +5 -0
  43. package/dist/scripts/test-plugin-scripts.js +284 -78
  44. package/dist/scripts/test-plugin-scripts.js.map +1 -1
  45. package/dist/scripts/test-workers.d.mts +24 -0
  46. package/dist/scripts/test-workers.mjs +59 -0
  47. package/dist/scripts/test-workers.mjs.map +1 -0
  48. package/dist/src/adapters/helpers.d.ts +7 -0
  49. package/dist/src/adapters/helpers.js.map +1 -1
  50. package/dist/src/authoring/workspace-commands.d.ts +3 -0
  51. package/dist/src/authoring/workspace-commands.js +7 -2
  52. package/dist/src/authoring/workspace-commands.js.map +1 -1
  53. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  54. package/dist/src/commands/aw-capabilities.js +42 -21
  55. package/dist/src/commands/aw-capabilities.js.map +1 -1
  56. package/dist/src/commands/catalog-dev-source.d.ts +42 -3
  57. package/dist/src/commands/catalog-dev-source.js +351 -43
  58. package/dist/src/commands/catalog-dev-source.js.map +1 -1
  59. package/dist/src/commands/catalog-generation.d.ts +8 -0
  60. package/dist/src/commands/catalog-generation.js +1 -5
  61. package/dist/src/commands/catalog-generation.js.map +1 -1
  62. package/dist/src/commands/catalog-publication-inspection.d.ts +42 -3
  63. package/dist/src/commands/catalog-publication-inspection.js +379 -48
  64. package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
  65. package/dist/src/commands/catalog-publication-journal.d.ts +23 -4
  66. package/dist/src/commands/catalog-publication-journal.js +165 -20
  67. package/dist/src/commands/catalog-publication-journal.js.map +1 -1
  68. package/dist/src/commands/catalog-publish.d.ts +34 -3
  69. package/dist/src/commands/catalog-publish.js +311 -165
  70. package/dist/src/commands/catalog-publish.js.map +1 -1
  71. package/dist/src/commands/catalog-source.d.ts +54 -8
  72. package/dist/src/commands/catalog-source.js +277 -15
  73. package/dist/src/commands/catalog-source.js.map +1 -1
  74. package/dist/src/commands/catalog-status.js +2 -2
  75. package/dist/src/commands/catalog-status.js.map +1 -1
  76. package/dist/src/commands/catalog-store.d.ts +104 -0
  77. package/dist/src/commands/catalog-store.js +685 -0
  78. package/dist/src/commands/catalog-store.js.map +1 -0
  79. package/dist/src/commands/catalog-workspace-resolution.d.ts +4 -0
  80. package/dist/src/commands/catalog-workspace-resolution.js +18 -3
  81. package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
  82. package/dist/src/commands/console.js +33 -20
  83. package/dist/src/commands/console.js.map +1 -1
  84. package/dist/src/commands/dependency-operation-plan.d.ts +14 -56
  85. package/dist/src/commands/dependency-operation-plan.js +90 -133
  86. package/dist/src/commands/dependency-operation-plan.js.map +1 -1
  87. package/dist/src/commands/deployment-confirmation.d.ts +11 -0
  88. package/dist/src/commands/deployment-confirmation.js +88 -0
  89. package/dist/src/commands/deployment-confirmation.js.map +1 -0
  90. package/dist/src/commands/init.js +1 -1
  91. package/dist/src/commands/init.js.map +1 -1
  92. package/dist/src/commands/intent-command.d.ts +34 -0
  93. package/dist/src/commands/intent-command.js +174 -0
  94. package/dist/src/commands/intent-command.js.map +1 -0
  95. package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
  96. package/dist/src/commands/lifecycle-command-package.js +199 -0
  97. package/dist/src/commands/lifecycle-command-package.js.map +1 -0
  98. package/dist/src/commands/managed-commands.d.ts +41 -0
  99. package/dist/src/commands/managed-commands.js +404 -0
  100. package/dist/src/commands/managed-commands.js.map +1 -0
  101. package/dist/src/commands/offline-cleanup-evidence.d.ts +29 -3
  102. package/dist/src/commands/offline-cleanup-evidence.js +80 -10
  103. package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
  104. package/dist/src/commands/operation-plan.d.ts +191 -0
  105. package/dist/src/commands/operation-plan.js +96 -0
  106. package/dist/src/commands/operation-plan.js.map +1 -0
  107. package/dist/src/commands/operation-planner.d.ts +47 -0
  108. package/dist/src/commands/operation-planner.js +142 -0
  109. package/dist/src/commands/operation-planner.js.map +1 -0
  110. package/dist/src/commands/options.d.ts +11 -20
  111. package/dist/src/commands/options.js +31 -36
  112. package/dist/src/commands/options.js.map +1 -1
  113. package/dist/src/commands/permission-batch.d.ts +5 -0
  114. package/dist/src/commands/permission-batch.js +80 -0
  115. package/dist/src/commands/permission-batch.js.map +1 -0
  116. package/dist/src/commands/plugin-capabilities.js +96 -46
  117. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  118. package/dist/src/commands/public-config-confirmation.d.ts +14 -0
  119. package/dist/src/commands/public-config-confirmation.js +73 -0
  120. package/dist/src/commands/public-config-confirmation.js.map +1 -0
  121. package/dist/src/commands/public-interruption.d.ts +9 -0
  122. package/dist/src/commands/public-interruption.js +23 -0
  123. package/dist/src/commands/public-interruption.js.map +1 -0
  124. package/dist/src/commands/public-lifecycle-result.d.ts +106 -0
  125. package/dist/src/commands/public-lifecycle-result.js +518 -0
  126. package/dist/src/commands/public-lifecycle-result.js.map +1 -0
  127. package/dist/src/commands/public-lifecycle.d.ts +27 -0
  128. package/dist/src/commands/public-lifecycle.js +563 -0
  129. package/dist/src/commands/public-lifecycle.js.map +1 -0
  130. package/dist/src/commands/public-plugin-query.d.ts +16 -0
  131. package/dist/src/commands/public-plugin-query.js +230 -0
  132. package/dist/src/commands/public-plugin-query.js.map +1 -0
  133. package/dist/src/commands/rebuild-command.d.ts +176 -25
  134. package/dist/src/commands/rebuild-command.js +3989 -1392
  135. package/dist/src/commands/rebuild-command.js.map +1 -1
  136. package/dist/src/commands/rebuild-integration.d.ts +133 -52
  137. package/dist/src/commands/rebuild-integration.js +1097 -2692
  138. package/dist/src/commands/rebuild-integration.js.map +1 -1
  139. package/dist/src/commands/rebuild-operations.d.ts +74 -23
  140. package/dist/src/commands/rebuild-operations.js +334 -227
  141. package/dist/src/commands/rebuild-operations.js.map +1 -1
  142. package/dist/src/commands/rebuild-platform-integration.d.ts +81 -0
  143. package/dist/src/commands/rebuild-platform-integration.js +1992 -0
  144. package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
  145. package/dist/src/commands/reconcile-operation-plan.d.ts +31 -0
  146. package/dist/src/commands/reconcile-operation-plan.js +48 -0
  147. package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
  148. package/dist/src/commands/review-inspection.d.ts +60 -0
  149. package/dist/src/commands/review-inspection.js +436 -0
  150. package/dist/src/commands/review-inspection.js.map +1 -0
  151. package/dist/src/commands/review-preparation.d.ts +51 -0
  152. package/dist/src/commands/review-preparation.js +400 -0
  153. package/dist/src/commands/review-preparation.js.map +1 -0
  154. package/dist/src/commands/runtime.d.ts +6 -6
  155. package/dist/src/commands/runtime.js +44 -24
  156. package/dist/src/commands/runtime.js.map +1 -1
  157. package/dist/src/commands/skill-eval.d.ts +8 -0
  158. package/dist/src/commands/skill-eval.js +126 -73
  159. package/dist/src/commands/skill-eval.js.map +1 -1
  160. package/dist/src/commands/status-v6.d.ts +185 -68
  161. package/dist/src/commands/status-v6.js +1592 -499
  162. package/dist/src/commands/status-v6.js.map +1 -1
  163. package/dist/src/commands/targets-command.d.ts +38 -0
  164. package/dist/src/commands/targets-command.js +182 -0
  165. package/dist/src/commands/targets-command.js.map +1 -0
  166. package/dist/src/commands/wizard.d.ts +8 -5
  167. package/dist/src/commands/wizard.js +7 -4
  168. package/dist/src/commands/wizard.js.map +1 -1
  169. package/dist/src/commands/write-commands.d.ts +9 -3
  170. package/dist/src/commands/write-commands.js +144 -44
  171. package/dist/src/commands/write-commands.js.map +1 -1
  172. package/dist/src/constants.d.ts +2 -3
  173. package/dist/src/constants.js +2 -3
  174. package/dist/src/constants.js.map +1 -1
  175. package/dist/src/eval/manifest-v1.d.ts +6 -2
  176. package/dist/src/eval/manifest-v1.js +58 -26
  177. package/dist/src/eval/manifest-v1.js.map +1 -1
  178. package/dist/src/generators/local-plugin.d.ts +4 -2
  179. package/dist/src/generators/local-plugin.js +207 -346
  180. package/dist/src/generators/local-plugin.js.map +1 -1
  181. package/dist/src/generators/permissions.d.ts +20 -2
  182. package/dist/src/generators/permissions.js +82 -15
  183. package/dist/src/generators/permissions.js.map +1 -1
  184. package/dist/src/index.d.ts +3 -33
  185. package/dist/src/index.js +1786 -1945
  186. package/dist/src/index.js.map +1 -1
  187. package/dist/src/intent/deployment-preferences.d.ts +63 -0
  188. package/dist/src/intent/deployment-preferences.js +170 -0
  189. package/dist/src/intent/deployment-preferences.js.map +1 -0
  190. package/dist/src/intent/diagnostics.d.ts +11 -0
  191. package/dist/src/intent/diagnostics.js +14 -0
  192. package/dist/src/intent/diagnostics.js.map +1 -0
  193. package/dist/src/intent/intent-codec.d.ts +19 -0
  194. package/dist/src/intent/intent-codec.js +117 -0
  195. package/dist/src/intent/intent-codec.js.map +1 -0
  196. package/dist/src/intent/intent-store.d.ts +43 -0
  197. package/dist/src/intent/intent-store.js +118 -0
  198. package/dist/src/intent/intent-store.js.map +1 -0
  199. package/dist/src/intent/scope-context.d.ts +35 -0
  200. package/dist/src/intent/scope-context.js +179 -0
  201. package/dist/src/intent/scope-context.js.map +1 -0
  202. package/dist/src/intent/work-context.d.ts +13 -0
  203. package/dist/src/intent/work-context.js +22 -0
  204. package/dist/src/intent/work-context.js.map +1 -0
  205. package/dist/src/output/command-receipt.d.ts +37 -86
  206. package/dist/src/output/command-receipt.js +257 -179
  207. package/dist/src/output/command-receipt.js.map +1 -1
  208. package/dist/src/output/component-delivery.d.ts +28 -0
  209. package/dist/src/output/component-delivery.js +138 -0
  210. package/dist/src/output/component-delivery.js.map +1 -0
  211. package/dist/src/output/public-result.d.ts +69 -0
  212. package/dist/src/output/public-result.js +403 -0
  213. package/dist/src/output/public-result.js.map +1 -0
  214. package/dist/src/output/rebuild-progress.d.ts +3 -0
  215. package/dist/src/output/rebuild-progress.js +34 -16
  216. package/dist/src/output/rebuild-progress.js.map +1 -1
  217. package/dist/src/output/receipt-projection.d.ts +7 -0
  218. package/dist/src/output/receipt-projection.js +664 -0
  219. package/dist/src/output/receipt-projection.js.map +1 -0
  220. package/dist/src/output/skill-invocation-notices.d.ts +18 -0
  221. package/dist/src/output/skill-invocation-notices.js +84 -0
  222. package/dist/src/output/skill-invocation-notices.js.map +1 -0
  223. package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
  224. package/dist/src/platforms/antigravity-permissions.js +388 -0
  225. package/dist/src/platforms/antigravity-permissions.js.map +1 -0
  226. package/dist/src/platforms/capabilities.d.ts +17 -0
  227. package/dist/src/platforms/capabilities.js +328 -0
  228. package/dist/src/platforms/capabilities.js.map +1 -0
  229. package/dist/src/platforms/contracts.d.ts +402 -0
  230. package/dist/src/platforms/contracts.js +2 -0
  231. package/dist/src/platforms/contracts.js.map +1 -0
  232. package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
  233. package/dist/src/platforms/cursor-workspace-hook.js +198 -0
  234. package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
  235. package/dist/src/platforms/discovery.d.ts +98 -0
  236. package/dist/src/platforms/discovery.js +777 -0
  237. package/dist/src/platforms/discovery.js.map +1 -0
  238. package/dist/src/platforms/grok-permission-config.d.ts +23 -0
  239. package/dist/src/platforms/grok-permission-config.js +184 -0
  240. package/dist/src/platforms/grok-permission-config.js.map +1 -0
  241. package/dist/src/platforms/grok-permission-document.d.ts +4 -0
  242. package/dist/src/platforms/grok-permission-document.js +145 -0
  243. package/dist/src/platforms/grok-permission-document.js.map +1 -0
  244. package/dist/src/platforms/grok-permissions.d.ts +17 -0
  245. package/dist/src/platforms/grok-permissions.js +311 -0
  246. package/dist/src/platforms/grok-permissions.js.map +1 -0
  247. package/dist/src/platforms/host-permission-policy.d.ts +38 -0
  248. package/dist/src/platforms/host-permission-policy.js +86 -0
  249. package/dist/src/platforms/host-permission-policy.js.map +1 -0
  250. package/dist/src/platforms/identity.d.ts +4 -0
  251. package/dist/src/platforms/identity.js +22 -0
  252. package/dist/src/platforms/identity.js.map +1 -0
  253. package/dist/src/platforms/inspection-grok.d.ts +4 -0
  254. package/dist/src/platforms/inspection-grok.js +366 -0
  255. package/dist/src/platforms/inspection-grok.js.map +1 -0
  256. package/dist/src/platforms/inspection-native.d.ts +6 -0
  257. package/dist/src/platforms/inspection-native.js +373 -0
  258. package/dist/src/platforms/inspection-native.js.map +1 -0
  259. package/dist/src/platforms/inspection-opencode.d.ts +4 -0
  260. package/dist/src/platforms/inspection-opencode.js +98 -0
  261. package/dist/src/platforms/inspection-opencode.js.map +1 -0
  262. package/dist/src/platforms/inspection-pi.d.ts +9 -0
  263. package/dist/src/platforms/inspection-pi.js +482 -0
  264. package/dist/src/platforms/inspection-pi.js.map +1 -0
  265. package/dist/src/platforms/inspection-query.d.ts +24 -0
  266. package/dist/src/platforms/inspection-query.js +119 -0
  267. package/dist/src/platforms/inspection-query.js.map +1 -0
  268. package/dist/src/platforms/inspection.d.ts +20 -0
  269. package/dist/src/platforms/inspection.js +259 -0
  270. package/dist/src/platforms/inspection.js.map +1 -0
  271. package/dist/src/platforms/layout.d.ts +35 -0
  272. package/dist/src/platforms/layout.js +317 -0
  273. package/dist/src/platforms/layout.js.map +1 -0
  274. package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
  275. package/dist/src/platforms/lifecycle-native-services.js +147 -0
  276. package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
  277. package/dist/src/platforms/lifecycle-native.d.ts +14 -0
  278. package/dist/src/platforms/lifecycle-native.js +223 -0
  279. package/dist/src/platforms/lifecycle-native.js.map +1 -0
  280. package/dist/src/platforms/lifecycle.d.ts +27 -0
  281. package/dist/src/platforms/lifecycle.js +567 -0
  282. package/dist/src/platforms/lifecycle.js.map +1 -0
  283. package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
  284. package/dist/src/platforms/opencode-permission-config.js +253 -0
  285. package/dist/src/platforms/opencode-permission-config.js.map +1 -0
  286. package/dist/src/platforms/opencode-permissions.d.ts +39 -0
  287. package/dist/src/platforms/opencode-permissions.js +212 -0
  288. package/dist/src/platforms/opencode-permissions.js.map +1 -0
  289. package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
  290. package/dist/src/platforms/opencode-related-permissions.js +177 -0
  291. package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
  292. package/dist/src/platforms/permission-ownership.d.ts +89 -0
  293. package/dist/src/platforms/permission-ownership.js +543 -0
  294. package/dist/src/platforms/permission-ownership.js.map +1 -0
  295. package/dist/src/platforms/permission-sidecar.d.ts +70 -0
  296. package/dist/src/platforms/permission-sidecar.js +215 -0
  297. package/dist/src/platforms/permission-sidecar.js.map +1 -0
  298. package/dist/src/platforms/projection-code-extension.d.ts +8 -0
  299. package/dist/src/platforms/projection-code-extension.js +126 -0
  300. package/dist/src/platforms/projection-code-extension.js.map +1 -0
  301. package/dist/src/platforms/projection-command-resources.d.ts +7 -0
  302. package/dist/src/platforms/projection-command-resources.js +74 -0
  303. package/dist/src/platforms/projection-command-resources.js.map +1 -0
  304. package/dist/src/platforms/projection-files.d.ts +27 -0
  305. package/dist/src/platforms/projection-files.js +111 -0
  306. package/dist/src/platforms/projection-files.js.map +1 -0
  307. package/dist/src/platforms/projection-marketplace.d.ts +19 -0
  308. package/dist/src/platforms/projection-marketplace.js +42 -0
  309. package/dist/src/platforms/projection-marketplace.js.map +1 -0
  310. package/dist/src/platforms/projection.d.ts +13 -0
  311. package/dist/src/platforms/projection.js +576 -0
  312. package/dist/src/platforms/projection.js.map +1 -0
  313. package/dist/src/platforms/registry.d.ts +4 -0
  314. package/dist/src/platforms/registry.js +30 -0
  315. package/dist/src/platforms/registry.js.map +1 -0
  316. package/dist/src/platforms/supplement-layout.d.ts +20 -0
  317. package/dist/src/platforms/supplement-layout.js +53 -0
  318. package/dist/src/platforms/supplement-layout.js.map +1 -0
  319. package/dist/src/platforms/supplement-state.d.ts +13 -0
  320. package/dist/src/platforms/supplement-state.js +93 -0
  321. package/dist/src/platforms/supplement-state.js.map +1 -0
  322. package/dist/src/portable/commands.d.ts +58 -11
  323. package/dist/src/portable/commands.js +99 -345
  324. package/dist/src/portable/commands.js.map +1 -1
  325. package/dist/src/portable/historical-materialization.d.ts +22 -0
  326. package/dist/src/portable/historical-materialization.js +124 -0
  327. package/dist/src/portable/historical-materialization.js.map +1 -0
  328. package/dist/src/portable/materializer.d.ts +29 -1
  329. package/dist/src/portable/materializer.js +197 -258
  330. package/dist/src/portable/materializer.js.map +1 -1
  331. package/dist/src/portable/recovery-layout.d.ts +17 -0
  332. package/dist/src/portable/recovery-layout.js +42 -0
  333. package/dist/src/portable/recovery-layout.js.map +1 -0
  334. package/dist/src/portable/recovery.d.ts +176 -0
  335. package/dist/src/portable/recovery.js +556 -0
  336. package/dist/src/portable/recovery.js.map +1 -0
  337. package/dist/src/portable/writer.d.ts +67 -0
  338. package/dist/src/portable/writer.js +321 -0
  339. package/dist/src/portable/writer.js.map +1 -0
  340. package/dist/src/recovery/coordinator.d.ts +168 -0
  341. package/dist/src/recovery/coordinator.js +1558 -0
  342. package/dist/src/recovery/coordinator.js.map +1 -0
  343. package/dist/src/recovery/demand.d.ts +53 -0
  344. package/dist/src/recovery/demand.js +189 -0
  345. package/dist/src/recovery/demand.js.map +1 -0
  346. package/dist/src/recovery/install-concurrency.d.ts +48 -0
  347. package/dist/src/recovery/install-concurrency.js +196 -0
  348. package/dist/src/recovery/install-concurrency.js.map +1 -0
  349. package/dist/src/recovery/interruption.d.ts +19 -0
  350. package/dist/src/recovery/interruption.js +43 -0
  351. package/dist/src/recovery/interruption.js.map +1 -0
  352. package/dist/src/recovery/joint-coordinator.d.ts +46 -0
  353. package/dist/src/recovery/joint-coordinator.js +1641 -0
  354. package/dist/src/recovery/joint-coordinator.js.map +1 -0
  355. package/dist/src/recovery/joint-demand.d.ts +72 -0
  356. package/dist/src/recovery/joint-demand.js +332 -0
  357. package/dist/src/recovery/joint-demand.js.map +1 -0
  358. package/dist/src/recovery/joint-install-execution.d.ts +19 -0
  359. package/dist/src/recovery/joint-install-execution.js +308 -0
  360. package/dist/src/recovery/joint-install-execution.js.map +1 -0
  361. package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
  362. package/dist/src/recovery/joint-install-native-rebase.js +67 -0
  363. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
  364. package/dist/src/recovery/performance.d.ts +4 -0
  365. package/dist/src/recovery/performance.js +26 -0
  366. package/dist/src/recovery/performance.js.map +1 -0
  367. package/dist/src/recovery/receipt.d.ts +129 -0
  368. package/dist/src/recovery/receipt.js +91 -0
  369. package/dist/src/recovery/receipt.js.map +1 -0
  370. package/dist/src/recovery/retirement.d.ts +47 -0
  371. package/dist/src/recovery/retirement.js +463 -0
  372. package/dist/src/recovery/retirement.js.map +1 -0
  373. package/dist/src/recovery/status.d.ts +143 -0
  374. package/dist/src/recovery/status.js +1517 -0
  375. package/dist/src/recovery/status.js.map +1 -0
  376. package/dist/src/recovery/types.d.ts +85 -0
  377. package/dist/src/recovery/types.js +2 -0
  378. package/dist/src/recovery/types.js.map +1 -0
  379. package/dist/src/review/eval-source-input.d.ts +44 -0
  380. package/dist/src/review/eval-source-input.js +213 -0
  381. package/dist/src/review/eval-source-input.js.map +1 -0
  382. package/dist/src/review/platform-profile.d.ts +6 -0
  383. package/dist/src/review/platform-profile.js +24 -0
  384. package/dist/src/review/platform-profile.js.map +1 -0
  385. package/dist/src/review/review-profile.d.ts +20 -0
  386. package/dist/src/review/review-profile.js +276 -0
  387. package/dist/src/review/review-profile.js.map +1 -0
  388. package/dist/src/review/review-selection.d.ts +20 -0
  389. package/dist/src/review/review-selection.js +502 -0
  390. package/dist/src/review/review-selection.js.map +1 -0
  391. package/dist/src/review/review-types.d.ts +71 -0
  392. package/dist/src/review/review-types.js +16 -0
  393. package/dist/src/review/review-types.js.map +1 -0
  394. package/dist/src/review/skill-materialization.d.ts +65 -0
  395. package/dist/src/review/skill-materialization.js +228 -0
  396. package/dist/src/review/skill-materialization.js.map +1 -0
  397. package/dist/src/review/source-binding.d.ts +201 -0
  398. package/dist/src/review/source-binding.js +782 -0
  399. package/dist/src/review/source-binding.js.map +1 -0
  400. package/dist/src/tui/agent-management.d.ts +23 -0
  401. package/dist/src/tui/agent-management.js +319 -0
  402. package/dist/src/tui/agent-management.js.map +1 -0
  403. package/dist/src/tui/agent-settings.d.ts +47 -0
  404. package/dist/src/tui/agent-settings.js +97 -0
  405. package/dist/src/tui/agent-settings.js.map +1 -0
  406. package/dist/src/tui/catalog-freshness.d.ts +1 -0
  407. package/dist/src/tui/catalog-freshness.js +2 -0
  408. package/dist/src/tui/catalog-freshness.js.map +1 -0
  409. package/dist/src/tui/catalog-generation.d.ts +8 -16
  410. package/dist/src/tui/catalog-generation.js +97 -10
  411. package/dist/src/tui/catalog-generation.js.map +1 -1
  412. package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
  413. package/dist/src/tui/catalog-sources/projection.js +17 -0
  414. package/dist/src/tui/catalog-sources/projection.js.map +1 -0
  415. package/dist/src/tui/catalog-sources/review.d.ts +3 -0
  416. package/dist/src/tui/catalog-sources/review.js +13 -0
  417. package/dist/src/tui/catalog-sources/review.js.map +1 -0
  418. package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
  419. package/dist/src/tui/catalog-sources/screens.js +40 -0
  420. package/dist/src/tui/catalog-sources/screens.js.map +1 -0
  421. package/dist/src/tui/catalog-sources/session.d.ts +32 -0
  422. package/dist/src/tui/catalog-sources/session.js +300 -0
  423. package/dist/src/tui/catalog-sources/session.js.map +1 -0
  424. package/dist/src/tui/catalog-sources/types.d.ts +54 -0
  425. package/dist/src/tui/catalog-sources/types.js +2 -0
  426. package/dist/src/tui/catalog-sources/types.js.map +1 -0
  427. package/dist/src/tui/catalog-store-task.d.ts +16 -0
  428. package/dist/src/tui/catalog-store-task.js +19 -0
  429. package/dist/src/tui/catalog-store-task.js.map +1 -0
  430. package/dist/src/tui/clipboard.d.ts +13 -0
  431. package/dist/src/tui/clipboard.js +95 -0
  432. package/dist/src/tui/clipboard.js.map +1 -0
  433. package/dist/src/tui/components.d.ts +113 -3
  434. package/dist/src/tui/components.js +201 -34
  435. package/dist/src/tui/components.js.map +1 -1
  436. package/dist/src/tui/config-array-draft.d.ts +30 -0
  437. package/dist/src/tui/config-array-draft.js +51 -0
  438. package/dist/src/tui/config-array-draft.js.map +1 -0
  439. package/dist/src/tui/config-leaf-editor.d.ts +44 -0
  440. package/dist/src/tui/config-leaf-editor.js +227 -0
  441. package/dist/src/tui/config-leaf-editor.js.map +1 -0
  442. package/dist/src/tui/config-object-suggestions.d.ts +15 -0
  443. package/dist/src/tui/config-object-suggestions.js +71 -0
  444. package/dist/src/tui/config-object-suggestions.js.map +1 -0
  445. package/dist/src/tui/config-references.d.ts +38 -0
  446. package/dist/src/tui/config-references.js +82 -0
  447. package/dist/src/tui/config-references.js.map +1 -0
  448. package/dist/src/tui/config-suggestions.d.ts +27 -0
  449. package/dist/src/tui/config-suggestions.js +62 -0
  450. package/dist/src/tui/config-suggestions.js.map +1 -0
  451. package/dist/src/tui/config-value-presentation.d.ts +21 -0
  452. package/dist/src/tui/config-value-presentation.js +129 -0
  453. package/dist/src/tui/config-value-presentation.js.map +1 -0
  454. package/dist/src/tui/console-app-v4.d.ts +14 -5
  455. package/dist/src/tui/console-app-v4.js +10344 -2133
  456. package/dist/src/tui/console-app-v4.js.map +1 -1
  457. package/dist/src/tui/content-item-card.d.ts +13 -0
  458. package/dist/src/tui/content-item-card.js +51 -0
  459. package/dist/src/tui/content-item-card.js.map +1 -0
  460. package/dist/src/tui/controller-runtime.d.ts +8 -3
  461. package/dist/src/tui/controller-runtime.js +2301 -842
  462. package/dist/src/tui/controller-runtime.js.map +1 -1
  463. package/dist/src/tui/controller.d.ts +664 -79
  464. package/dist/src/tui/controller.js +3670 -830
  465. package/dist/src/tui/controller.js.map +1 -1
  466. package/dist/src/tui/dependency-graph-view.d.ts +39 -0
  467. package/dist/src/tui/dependency-graph-view.js +121 -0
  468. package/dist/src/tui/dependency-graph-view.js.map +1 -0
  469. package/dist/src/tui/dependency-graph.d.ts +81 -0
  470. package/dist/src/tui/dependency-graph.js +452 -0
  471. package/dist/src/tui/dependency-graph.js.map +1 -0
  472. package/dist/src/tui/deployment-view.d.ts +13 -0
  473. package/dist/src/tui/deployment-view.js +155 -0
  474. package/dist/src/tui/deployment-view.js.map +1 -0
  475. package/dist/src/tui/diagnostic-projection.d.ts +31 -0
  476. package/dist/src/tui/diagnostic-projection.js +681 -0
  477. package/dist/src/tui/diagnostic-projection.js.map +1 -0
  478. package/dist/src/tui/diagnostics.d.ts +6 -2
  479. package/dist/src/tui/diagnostics.js +14 -2
  480. package/dist/src/tui/diagnostics.js.map +1 -1
  481. package/dist/src/tui/entity-cards.d.ts +56 -0
  482. package/dist/src/tui/entity-cards.js +321 -0
  483. package/dist/src/tui/entity-cards.js.map +1 -0
  484. package/dist/src/tui/glossary.d.ts +25 -0
  485. package/dist/src/tui/glossary.js +78 -0
  486. package/dist/src/tui/glossary.js.map +1 -0
  487. package/dist/src/tui/guided-setup.d.ts +25 -0
  488. package/dist/src/tui/guided-setup.js +101 -0
  489. package/dist/src/tui/guided-setup.js.map +1 -0
  490. package/dist/src/tui/index.d.ts +5 -1
  491. package/dist/src/tui/index.js +4 -1
  492. package/dist/src/tui/index.js.map +1 -1
  493. package/dist/src/tui/input-display.d.ts +1 -0
  494. package/dist/src/tui/input-display.js +23 -1
  495. package/dist/src/tui/input-display.js.map +1 -1
  496. package/dist/src/tui/keys.d.ts +44 -0
  497. package/dist/src/tui/keys.js +43 -15
  498. package/dist/src/tui/keys.js.map +1 -1
  499. package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
  500. package/dist/src/tui/lifecycle-action-view.js +36 -0
  501. package/dist/src/tui/lifecycle-action-view.js.map +1 -0
  502. package/dist/src/tui/model.d.ts +187 -52
  503. package/dist/src/tui/model.js +1202 -426
  504. package/dist/src/tui/model.js.map +1 -1
  505. package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
  506. package/dist/src/tui/operation-diagnostic-screens.js +76 -0
  507. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
  508. package/dist/src/tui/operation-history.d.ts +91 -0
  509. package/dist/src/tui/operation-history.js +167 -0
  510. package/dist/src/tui/operation-history.js.map +1 -0
  511. package/dist/src/tui/operation-review-planner.d.ts +28 -0
  512. package/dist/src/tui/operation-review-planner.js +1456 -0
  513. package/dist/src/tui/operation-review-planner.js.map +1 -0
  514. package/dist/src/tui/plugin-content.d.ts +33 -0
  515. package/dist/src/tui/plugin-content.js +245 -0
  516. package/dist/src/tui/plugin-content.js.map +1 -0
  517. package/dist/src/tui/plugin-detail.d.ts +75 -0
  518. package/dist/src/tui/plugin-detail.js +267 -0
  519. package/dist/src/tui/plugin-detail.js.map +1 -0
  520. package/dist/src/tui/plugin-write-task.d.ts +69 -0
  521. package/dist/src/tui/plugin-write-task.js +286 -0
  522. package/dist/src/tui/plugin-write-task.js.map +1 -0
  523. package/dist/src/tui/prompt.js +4 -15
  524. package/dist/src/tui/prompt.js.map +1 -1
  525. package/dist/src/tui/query-header.d.ts +30 -0
  526. package/dist/src/tui/query-header.js +40 -0
  527. package/dist/src/tui/query-header.js.map +1 -0
  528. package/dist/src/tui/reader.d.ts +38 -0
  529. package/dist/src/tui/reader.js +49 -0
  530. package/dist/src/tui/reader.js.map +1 -0
  531. package/dist/src/tui/router.d.ts +182 -39
  532. package/dist/src/tui/router.js +338 -50
  533. package/dist/src/tui/router.js.map +1 -1
  534. package/dist/src/tui/scoped-flow.d.ts +49 -0
  535. package/dist/src/tui/scoped-flow.js +212 -0
  536. package/dist/src/tui/scoped-flow.js.map +1 -0
  537. package/dist/src/tui/scoped-inventory.d.ts +131 -0
  538. package/dist/src/tui/scoped-inventory.js +280 -0
  539. package/dist/src/tui/scoped-inventory.js.map +1 -0
  540. package/dist/src/tui/screen-registry.d.ts +696 -0
  541. package/dist/src/tui/screen-registry.js +226 -0
  542. package/dist/src/tui/screen-registry.js.map +1 -0
  543. package/dist/src/tui/session-console-app.d.ts +8 -0
  544. package/dist/src/tui/session-console-app.js +24 -0
  545. package/dist/src/tui/session-console-app.js.map +1 -0
  546. package/dist/src/tui/session-host.d.ts +45 -0
  547. package/dist/src/tui/session-host.js +219 -0
  548. package/dist/src/tui/session-host.js.map +1 -0
  549. package/dist/src/tui/source-detail-card.d.ts +29 -0
  550. package/dist/src/tui/source-detail-card.js +45 -0
  551. package/dist/src/tui/source-detail-card.js.map +1 -0
  552. package/dist/src/tui/theme.d.ts +12 -0
  553. package/dist/src/tui/theme.js +12 -0
  554. package/dist/src/tui/theme.js.map +1 -1
  555. package/dist/src/tui/viewport.d.ts +1 -0
  556. package/dist/src/tui/viewport.js +23 -0
  557. package/dist/src/tui/viewport.js.map +1 -1
  558. package/dist/src/tui/wizard.js +37 -13
  559. package/dist/src/tui/wizard.js.map +1 -1
  560. package/dist/src/types.d.ts +177 -85
  561. package/dist/src/types.js +1 -0
  562. package/dist/src/types.js.map +1 -1
  563. package/dist/src/utils/agent-version.d.ts +10 -4
  564. package/dist/src/utils/agent-version.js +6 -8
  565. package/dist/src/utils/agent-version.js.map +1 -1
  566. package/dist/src/utils/artifact-plan.d.ts +17 -24
  567. package/dist/src/utils/artifact-plan.js +59 -436
  568. package/dist/src/utils/artifact-plan.js.map +1 -1
  569. package/dist/src/utils/artifact-renderer.d.ts +61 -89
  570. package/dist/src/utils/artifact-renderer.js +187 -364
  571. package/dist/src/utils/artifact-renderer.js.map +1 -1
  572. package/dist/src/utils/artifact-request.d.ts +21 -0
  573. package/dist/src/utils/artifact-request.js +57 -0
  574. package/dist/src/utils/artifact-request.js.map +1 -0
  575. package/dist/src/utils/artifact-sources.d.ts +4 -8
  576. package/dist/src/utils/artifact-sources.js +15 -6
  577. package/dist/src/utils/artifact-sources.js.map +1 -1
  578. package/dist/src/utils/aw-home-mutation-lock.js +2 -1
  579. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  580. package/dist/src/utils/bundle-layout.js +59 -173
  581. package/dist/src/utils/bundle-layout.js.map +1 -1
  582. package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
  583. package/dist/src/utils/catalog-capability-projection.js +14 -0
  584. package/dist/src/utils/catalog-capability-projection.js.map +1 -0
  585. package/dist/src/utils/catalog-digests.d.ts +2 -9
  586. package/dist/src/utils/catalog-digests.js +7 -45
  587. package/dist/src/utils/catalog-digests.js.map +1 -1
  588. package/dist/src/utils/catalog-generation-error.d.ts +4 -1
  589. package/dist/src/utils/catalog-generation-error.js +2 -0
  590. package/dist/src/utils/catalog-generation-error.js.map +1 -1
  591. package/dist/src/utils/catalog-generation-resolver.d.ts +32 -3
  592. package/dist/src/utils/catalog-generation-resolver.js +182 -40
  593. package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
  594. package/dist/src/utils/catalog-generation-service.d.ts +142 -2
  595. package/dist/src/utils/catalog-generation-service.js +1146 -171
  596. package/dist/src/utils/catalog-generation-service.js.map +1 -1
  597. package/dist/src/utils/catalog-generation-state.d.ts +5 -0
  598. package/dist/src/utils/catalog-generation-state.js +25 -1
  599. package/dist/src/utils/catalog-generation-state.js.map +1 -1
  600. package/dist/src/utils/catalog-generation-store.d.ts +29 -2
  601. package/dist/src/utils/catalog-generation-store.js +240 -36
  602. package/dist/src/utils/catalog-generation-store.js.map +1 -1
  603. package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
  604. package/dist/src/utils/{catalog-manifest-v6.js → catalog-manifest-v7.js} +23 -23
  605. package/dist/src/utils/{catalog-manifest-v6.js.map → catalog-manifest-v7.js.map} +1 -1
  606. package/dist/src/utils/catalog-operation-context.d.ts +27 -3
  607. package/dist/src/utils/catalog-operation-context.js +75 -4
  608. package/dist/src/utils/catalog-operation-context.js.map +1 -1
  609. package/dist/src/utils/catalog-public-error.js +7 -0
  610. package/dist/src/utils/catalog-public-error.js.map +1 -1
  611. package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
  612. package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
  613. package/dist/src/utils/catalog-snapshot.d.ts +5 -2
  614. package/dist/src/utils/catalog-snapshot.js +4 -1
  615. package/dist/src/utils/catalog-snapshot.js.map +1 -1
  616. package/dist/src/utils/catalog-source-impact.d.ts +21 -0
  617. package/dist/src/utils/catalog-source-impact.js +344 -0
  618. package/dist/src/utils/catalog-source-impact.js.map +1 -0
  619. package/dist/src/utils/catalog-source-references.d.ts +22 -8
  620. package/dist/src/utils/catalog-source-references.js +457 -365
  621. package/dist/src/utils/catalog-source-references.js.map +1 -1
  622. package/dist/src/utils/catalog-sources.d.ts +14 -1
  623. package/dist/src/utils/catalog-sources.js +155 -11
  624. package/dist/src/utils/catalog-sources.js.map +1 -1
  625. package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
  626. package/dist/src/utils/codex-executable-discovery.js +431 -0
  627. package/dist/src/utils/codex-executable-discovery.js.map +1 -0
  628. package/dist/src/utils/codex-manager.d.ts +23 -42
  629. package/dist/src/utils/codex-manager.js +79 -767
  630. package/dist/src/utils/codex-manager.js.map +1 -1
  631. package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
  632. package/dist/src/utils/codex-marketplace-path.js +45 -0
  633. package/dist/src/utils/codex-marketplace-path.js.map +1 -0
  634. package/dist/src/utils/codex-native-observation.d.ts +55 -0
  635. package/dist/src/utils/codex-native-observation.js +198 -0
  636. package/dist/src/utils/codex-native-observation.js.map +1 -0
  637. package/dist/src/utils/codex-reconciler.d.ts +6 -14
  638. package/dist/src/utils/codex-reconciler.js +45 -50
  639. package/dist/src/utils/codex-reconciler.js.map +1 -1
  640. package/dist/src/utils/codex-shared-native.d.ts +28 -39
  641. package/dist/src/utils/codex-shared-native.js +92 -57
  642. package/dist/src/utils/codex-shared-native.js.map +1 -1
  643. package/dist/src/utils/codex-skill-staging.d.ts +4 -3
  644. package/dist/src/utils/codex-skill-staging.js.map +1 -1
  645. package/dist/src/utils/codex-skills-root.d.ts +4 -0
  646. package/dist/src/utils/codex-skills-root.js +25 -0
  647. package/dist/src/utils/codex-skills-root.js.map +1 -0
  648. package/dist/src/utils/codex-surface-analysis.d.ts +8 -3
  649. package/dist/src/utils/codex-surface-analysis.js +35 -62
  650. package/dist/src/utils/codex-surface-analysis.js.map +1 -1
  651. package/dist/src/utils/component-command-preparation.d.ts +31 -0
  652. package/dist/src/utils/component-command-preparation.js +127 -0
  653. package/dist/src/utils/component-command-preparation.js.map +1 -0
  654. package/dist/src/utils/component-gap.d.ts +4 -0
  655. package/dist/src/utils/component-gap.js +20 -0
  656. package/dist/src/utils/component-gap.js.map +1 -0
  657. package/dist/src/utils/component-resources.d.ts +51 -0
  658. package/dist/src/utils/component-resources.js +320 -0
  659. package/dist/src/utils/component-resources.js.map +1 -0
  660. package/dist/src/utils/config-platforms.d.ts +21 -0
  661. package/dist/src/utils/config-platforms.js +51 -0
  662. package/dist/src/utils/config-platforms.js.map +1 -0
  663. package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
  664. package/dist/src/utils/dynamic-skill-tree.js +33 -40
  665. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  666. package/dist/src/utils/git-catalog-provider.d.ts +16 -0
  667. package/dist/src/utils/git-catalog-provider.js +112 -6
  668. package/dist/src/utils/git-catalog-provider.js.map +1 -1
  669. package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
  670. package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
  671. package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
  672. package/dist/src/utils/local-marketplace.d.ts +17 -12
  673. package/dist/src/utils/local-marketplace.js +85 -195
  674. package/dist/src/utils/local-marketplace.js.map +1 -1
  675. package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
  676. package/dist/src/utils/managed-command-cli-review.js +431 -0
  677. package/dist/src/utils/managed-command-cli-review.js.map +1 -0
  678. package/dist/src/utils/managed-command-closure.d.ts +14 -0
  679. package/dist/src/utils/managed-command-closure.js +156 -0
  680. package/dist/src/utils/managed-command-closure.js.map +1 -0
  681. package/dist/src/utils/managed-command-errors.d.ts +5 -0
  682. package/dist/src/utils/managed-command-errors.js +10 -0
  683. package/dist/src/utils/managed-command-errors.js.map +1 -0
  684. package/dist/src/utils/managed-command-materialization.d.ts +90 -0
  685. package/dist/src/utils/managed-command-materialization.js +375 -0
  686. package/dist/src/utils/managed-command-materialization.js.map +1 -0
  687. package/dist/src/utils/managed-command-preparation.d.ts +30 -0
  688. package/dist/src/utils/managed-command-preparation.js +39 -0
  689. package/dist/src/utils/managed-command-preparation.js.map +1 -0
  690. package/dist/src/utils/managed-command-review.d.ts +33 -0
  691. package/dist/src/utils/managed-command-review.js +80 -0
  692. package/dist/src/utils/managed-command-review.js.map +1 -0
  693. package/dist/src/utils/managed-command-runtime.d.ts +36 -0
  694. package/dist/src/utils/managed-command-runtime.js +126 -0
  695. package/dist/src/utils/managed-command-runtime.js.map +1 -0
  696. package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
  697. package/dist/src/utils/managed-command-snapshots.js +89 -0
  698. package/dist/src/utils/managed-command-snapshots.js.map +1 -0
  699. package/dist/src/utils/managed-command-store.d.ts +141 -0
  700. package/dist/src/utils/managed-command-store.js +839 -0
  701. package/dist/src/utils/managed-command-store.js.map +1 -0
  702. package/dist/src/utils/multi-source-catalog.d.ts +4 -0
  703. package/dist/src/utils/multi-source-catalog.js +7 -3
  704. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  705. package/dist/src/utils/native-cli-interruption.d.ts +8 -0
  706. package/dist/src/utils/native-cli-interruption.js +65 -0
  707. package/dist/src/utils/native-cli-interruption.js.map +1 -0
  708. package/dist/src/utils/native-cli.d.ts +37 -6
  709. package/dist/src/utils/native-cli.js +523 -60
  710. package/dist/src/utils/native-cli.js.map +1 -1
  711. package/dist/src/utils/native-demand.d.ts +29 -0
  712. package/dist/src/utils/native-demand.js +4 -0
  713. package/dist/src/utils/native-demand.js.map +1 -0
  714. package/dist/src/utils/native-tool-context.d.ts +17 -0
  715. package/dist/src/utils/native-tool-context.js +40 -0
  716. package/dist/src/utils/native-tool-context.js.map +1 -0
  717. package/dist/src/utils/native-tool-review.d.ts +8 -0
  718. package/dist/src/utils/native-tool-review.js +14 -0
  719. package/dist/src/utils/native-tool-review.js.map +1 -0
  720. package/dist/src/utils/orphan-marketplace-cleanup.js +0 -2
  721. package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
  722. package/dist/src/utils/ownership.d.ts +111 -11
  723. package/dist/src/utils/ownership.js +247 -126
  724. package/dist/src/utils/ownership.js.map +1 -1
  725. package/dist/src/utils/package-content.d.ts +7 -0
  726. package/dist/src/utils/package-content.js +70 -0
  727. package/dist/src/utils/package-content.js.map +1 -0
  728. package/dist/src/utils/path-catalog-provider.js +2 -0
  729. package/dist/src/utils/path-catalog-provider.js.map +1 -1
  730. package/dist/src/utils/paths.d.ts +1 -1
  731. package/dist/src/utils/paths.js +5 -2
  732. package/dist/src/utils/paths.js.map +1 -1
  733. package/dist/src/utils/platform-empty-state.d.ts +69 -0
  734. package/dist/src/utils/platform-empty-state.js +226 -0
  735. package/dist/src/utils/platform-empty-state.js.map +1 -0
  736. package/dist/src/utils/platform-support.d.ts +1 -1
  737. package/dist/src/utils/platform-support.js +1 -1
  738. package/dist/src/utils/platform-support.js.map +1 -1
  739. package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
  740. package/dist/src/utils/plugin-config-command-apply.js +142 -0
  741. package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
  742. package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
  743. package/dist/src/utils/plugin-config-diagnostics.js +44 -0
  744. package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
  745. package/dist/src/utils/plugin-config-impact.d.ts +75 -0
  746. package/dist/src/utils/plugin-config-impact.js +355 -0
  747. package/dist/src/utils/plugin-config-impact.js.map +1 -0
  748. package/dist/src/utils/plugin-config-references.d.ts +96 -0
  749. package/dist/src/utils/plugin-config-references.js +357 -0
  750. package/dist/src/utils/plugin-config-references.js.map +1 -0
  751. package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
  752. package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
  753. package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
  754. package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
  755. package/dist/src/utils/plugin-config-suggestions.js +302 -0
  756. package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
  757. package/dist/src/utils/plugin-config-write.d.ts +123 -31
  758. package/dist/src/utils/plugin-config-write.js +828 -399
  759. package/dist/src/utils/plugin-config-write.js.map +1 -1
  760. package/dist/src/utils/plugin-config.d.ts +192 -109
  761. package/dist/src/utils/plugin-config.js +970 -1150
  762. package/dist/src/utils/plugin-config.js.map +1 -1
  763. package/dist/src/utils/plugin-dependencies.d.ts +1 -1
  764. package/dist/src/utils/plugin-dependencies.js.map +1 -1
  765. package/dist/src/utils/plugin-scripts.d.ts +80 -127
  766. package/dist/src/utils/plugin-scripts.js +655 -524
  767. package/dist/src/utils/plugin-scripts.js.map +1 -1
  768. package/dist/src/utils/process-lock.js +14 -5
  769. package/dist/src/utils/process-lock.js.map +1 -1
  770. package/dist/src/utils/process-tree.d.ts +2 -2
  771. package/dist/src/utils/process-tree.js +1 -1
  772. package/dist/src/utils/process-tree.js.map +1 -1
  773. package/dist/src/utils/project-boundary.d.ts +11 -13
  774. package/dist/src/utils/project-boundary.js +28 -34
  775. package/dist/src/utils/project-boundary.js.map +1 -1
  776. package/dist/src/utils/rendered-contract.js +24 -1
  777. package/dist/src/utils/rendered-contract.js.map +1 -1
  778. package/dist/src/utils/runtime-config.d.ts +18 -0
  779. package/dist/src/utils/runtime-config.js +64 -0
  780. package/dist/src/utils/runtime-config.js.map +1 -0
  781. package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
  782. package/dist/src/utils/runtime-skill-closure.js +47 -6
  783. package/dist/src/utils/runtime-skill-closure.js.map +1 -1
  784. package/dist/src/utils/safe-fs.d.ts +21 -0
  785. package/dist/src/utils/safe-fs.js +111 -0
  786. package/dist/src/utils/safe-fs.js.map +1 -0
  787. package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
  788. package/dist/src/utils/safe-operation-diagnostic.js +33 -0
  789. package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
  790. package/dist/src/utils/sensitive-content.d.ts +4 -0
  791. package/dist/src/utils/sensitive-content.js +36 -0
  792. package/dist/src/utils/sensitive-content.js.map +1 -0
  793. package/dist/src/utils/skill-invocation-warning.d.ts +20 -0
  794. package/dist/src/utils/skill-invocation-warning.js +68 -0
  795. package/dist/src/utils/skill-invocation-warning.js.map +1 -0
  796. package/dist/src/utils/state-paths.d.ts +8 -3
  797. package/dist/src/utils/state-paths.js +53 -16
  798. package/dist/src/utils/state-paths.js.map +1 -1
  799. package/dist/src/utils/target-eligibility.d.ts +3 -3
  800. package/dist/src/utils/target-eligibility.js +11 -6
  801. package/dist/src/utils/target-eligibility.js.map +1 -1
  802. package/dist/src/utils/windows-claude-shim.d.ts +7 -0
  803. package/dist/src/utils/windows-claude-shim.js +10 -0
  804. package/dist/src/utils/windows-claude-shim.js.map +1 -0
  805. package/dist/src/utils/windows-npm-shim.d.ts +16 -0
  806. package/dist/src/utils/windows-npm-shim.js +155 -0
  807. package/dist/src/utils/windows-npm-shim.js.map +1 -0
  808. package/dist/vitest.config.js +106 -9
  809. package/dist/vitest.config.js.map +1 -1
  810. package/package.json +30 -21
  811. package/dist/src/commands/review-publication.d.ts +0 -99
  812. package/dist/src/commands/review-publication.js +0 -904
  813. package/dist/src/commands/review-publication.js.map +0 -1
  814. package/dist/src/commands/sync-command.d.ts +0 -21
  815. package/dist/src/commands/sync-command.js +0 -206
  816. package/dist/src/commands/sync-command.js.map +0 -1
  817. package/dist/src/portable/skills-cli.d.ts +0 -43
  818. package/dist/src/portable/skills-cli.js +0 -148
  819. package/dist/src/portable/skills-cli.js.map +0 -1
  820. package/dist/src/utils/catalog-manifest-v6.d.ts +0 -5
  821. package/dist/src/utils/lifecycle-active-store.d.ts +0 -147
  822. package/dist/src/utils/lifecycle-active-store.js +0 -1064
  823. package/dist/src/utils/lifecycle-active-store.js.map +0 -1
  824. package/dist/src/utils/plugin-intent-state.d.ts +0 -39
  825. package/dist/src/utils/plugin-intent-state.js +0 -325
  826. package/dist/src/utils/plugin-intent-state.js.map +0 -1
  827. package/dist/src/utils/slash-commands.d.ts +0 -1
  828. package/dist/src/utils/slash-commands.js +0 -2
  829. package/dist/src/utils/slash-commands.js.map +0 -1
@@ -6,7 +6,8 @@ import { createRequire } from 'node:module';
6
6
  import * as os from 'node:os';
7
7
  import * as path from 'node:path';
8
8
  import { fileURLToPath, pathToFileURL } from 'node:url';
9
- import { getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, } from '@lesliechan721/aw-plugin-core/manifest';
9
+ import { assertPluginConfigReferenceSchemas, assertPluginConfigSuggestionProviders, AW_RUNTIME_CONFIG_READER_PATH, createNativeToolReaderSource, getCommandPackageInjectedReaders, getPluginConfigSuggestions, isInjectedCommandReaderImport, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, normalizePluginConfigDefinition, compilePluginConfigDefinition, validatePluginConfigCandidate, renderTemplate, resolveSupportedPlatforms, PLATFORM_TARGETS, isPortablePlatformTarget, isAuthorOnlySkillDirectory, SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION, } from '@lesliechan721/aw-plugin-core/manifest';
10
+ import { readCatalogWorkspace } from '@lesliechan721/aw-plugin-core';
10
11
  import { checkPluginVersions } from './lib/plugin-version-check.mjs';
11
12
  import { scanJavaScriptImportSpecifiers } from './lib/javascript-import-scanner.mjs';
12
13
  import { assertAuthoringPluginPathFence, assertCanonicalAuthoringPluginRoot, } from './lib/plugin-root.mjs';
@@ -18,7 +19,6 @@ const CLI_PACKAGE_ROOT = path.basename(authoringRuntimeRoot) === 'dist'
18
19
  : authoringRuntimeRoot;
19
20
  const errors = [];
20
21
  const warnings = [];
21
- const SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION = 9;
22
22
  let capabilityDiagnostic = null;
23
23
  const MAX_SKILL_NAME_LEN = 64;
24
24
  const MAX_SKILL_DESCRIPTION_LEN = 1024;
@@ -36,13 +36,6 @@ const MAX_OPENAI_DEPENDENCY_DESCRIPTION_LEN = 1024;
36
36
  const MAX_OPENAI_DEPENDENCY_COMMAND_LEN = 1024;
37
37
  const MAX_OPENAI_DEPENDENCY_URL_LEN = 1024;
38
38
  const CLAUDE_FRONTMATTER_SHELLS = new Set(['bash', 'powershell']);
39
- const CLAUDE_SLASH_COMMAND_ONLY_FIELDS = new Set([
40
- 'allowed-tools',
41
- 'model',
42
- 'argument-hint',
43
- 'disable-model-invocation',
44
- 'shell',
45
- ]);
46
39
  const CODEX_POLICY_PRODUCTS = new Set([
47
40
  'atlas',
48
41
  'ATLAS',
@@ -51,104 +44,13 @@ const CODEX_POLICY_PRODUCTS = new Set([
51
44
  'codex',
52
45
  'CODEX',
53
46
  ]);
54
- const MANIFEST_POLICY_PRODUCTS = new Set(getPluginAuthoringAcceptedValues('manifest', 'marketplace.policy.products'));
47
+ const MANIFEST_PLATFORMS = new Set(getPluginAuthoringAcceptedValues('manifest', 'platforms'));
55
48
  const MARKETPLACE_AUTHENTICATION_POLICIES = new Set(getPluginAuthoringAcceptedValues('manifest', 'marketplace.policy.authentication'));
56
49
  const MARKETPLACE_INSTALLATION_POLICIES = new Set(getPluginAuthoringAcceptedValues('manifest', 'marketplace.policy.installation'));
57
- const PUBLIC_HOOK_EVENTS = new Set(['before_tool', 'after_tool', 'session_start']);
58
- const PUBLIC_SESSION_START_SOURCES = new Set(['startup', 'resume', 'clear']);
59
- const PUBLIC_SESSION_START_DEFAULT_MATCHER = 'startup|resume|clear';
60
- const PUBLIC_HOOK_RENDER_MAP = {
61
- claude: {
62
- before_tool: 'PreToolUse',
63
- after_tool: 'PostToolUse',
64
- session_start: 'SessionStart',
65
- },
66
- codex: {
67
- before_tool: 'PreToolUse',
68
- after_tool: 'PostToolUse',
69
- session_start: 'SessionStart',
70
- },
71
- };
72
- const NATIVE_HOOK_EVENTS = {
73
- claude: new Set([
74
- 'PreToolUse',
75
- 'PostToolUse',
76
- 'PostToolUseFailure',
77
- 'Notification',
78
- 'UserPromptSubmit',
79
- 'SessionStart',
80
- 'SessionEnd',
81
- 'Stop',
82
- 'StopFailure',
83
- 'SubagentStart',
84
- 'SubagentStop',
85
- 'PreCompact',
86
- 'PostCompact',
87
- 'PermissionRequest',
88
- 'PermissionDenied',
89
- 'Setup',
90
- 'TeammateIdle',
91
- 'TaskCreated',
92
- 'TaskCompleted',
93
- 'Elicitation',
94
- 'ElicitationResult',
95
- 'ConfigChange',
96
- 'WorktreeCreate',
97
- 'WorktreeRemove',
98
- 'InstructionsLoaded',
99
- 'CwdChanged',
100
- 'FileChanged',
101
- ]),
102
- codex: new Set([
103
- 'PreToolUse',
104
- 'PermissionRequest',
105
- 'PostToolUse',
106
- 'SessionStart',
107
- 'UserPromptSubmit',
108
- 'Stop',
109
- ]),
110
- };
111
- const MATCHERLESS_NATIVE_HOOK_EVENTS = {
112
- claude: new Set([
113
- 'UserPromptSubmit',
114
- 'Stop',
115
- 'TeammateIdle',
116
- 'TaskCreated',
117
- 'TaskCompleted',
118
- 'WorktreeCreate',
119
- 'WorktreeRemove',
120
- 'CwdChanged',
121
- ]),
122
- codex: new Set(['UserPromptSubmit', 'Stop']),
123
- };
124
50
  const TEMPLATE_TEXT_FILE_EXTENSIONS = /\.(md|markdown|txt|json|yaml|yml|toml|rules)$/i;
125
- const SLASH_COMMAND_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
126
- const DEFAULT_SLASH_COMMANDS_DIR = 'slash-commands';
127
51
  const SCRIPT_NODE_EXTENSIONS = new Set(['.js', '.mjs', '.cjs']);
128
- const SCRIPT_AUTO_EXTENSIONS = new Set(['.js', '.mjs', '.cjs', '.sh', '.ps1', '.cmd', '.bat']);
129
- const SCRIPT_RUNNERS = new Set(['node', 'sh', 'bash', 'pwsh', 'powershell', 'cmd', 'auto']);
130
- const SCRIPT_OS_SELECTORS = new Set(['default', 'unix', 'windows', 'linux', 'darwin', 'win32']);
131
- const SCRIPT_LIFECYCLE_EVENTS = new Set(['install', 'upgrade', 'uninstall']);
132
52
  const SCRIPT_TIMEOUT_MIN_MS = 1000;
133
- const SCRIPT_TIMEOUT_MAX_MS = 300000;
134
- const CONFIG_FIELD_TYPES = new Set(getPluginAuthoringAcceptedValues('config', 'config.schema.<key>.type'));
135
- const ARTIFACT_TARGETS = new Set(getPluginAuthoringAcceptedValues('artifacts', 'artifacts.targets[].target'));
136
- const ARTIFACT_STATES = new Set(getPluginAuthoringAcceptedValues('artifacts', 'artifacts.targets[].states'));
137
- const ARTIFACT_SCOPES = new Set(['user', 'project']);
138
- const ARTIFACT_KINDS = new Set(['instruction', 'codexRole', 'skill']);
139
- const ARTIFACT_PROJECT_MANAGED_KINDS = new Set(['instruction', 'agent', 'skill']);
140
- const ARTIFACT_KIND_BY_TARGET = {
141
- 'codex.developerInstructionsBlock': 'instruction',
142
- 'codex.agentRole': 'codexRole',
143
- 'codex.skill': 'skill',
144
- 'claude.skill': 'skill',
145
- 'agent-skills.skill': 'skill',
146
- };
147
- const ARTIFACT_PROJECT_MANAGED_KIND_BY_TARGET = {
148
- 'codex.developerInstructionsBlock': 'instruction',
149
- 'codex.agentRole': 'agent',
150
- 'codex.skill': 'skill',
151
- };
53
+ const SCRIPT_TIMEOUT_MAX_MS = 1800000;
152
54
  const PLUGIN_NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
153
55
  let yamlParser = null;
154
56
  let pluginVersionCheckResult = null;
@@ -229,56 +131,12 @@ function templateIncludesPath(manifest, relativePath) {
229
131
  return false;
230
132
  return include.some((pattern) => matchesGlob(normalized, pattern));
231
133
  }
232
- function resolveTemplateValue(vars, platform) {
233
- const resolved = {};
234
- for (const [key, entry] of Object.entries(vars)) {
235
- if (entry && typeof entry === 'object' && !Array.isArray(entry)) {
236
- resolved[key] = entry[platform];
237
- }
238
- }
239
- return resolved;
240
- }
241
- function replaceConditionalBlocks(input, resolvedVars, tagName) {
242
- const pattern = new RegExp(`{{#${tagName}\\s+([a-zA-Z0-9_]+)}}([\\s\\S]*?){{\\/${tagName}}}`, 'g');
243
- return input.replace(pattern, (_match, rawKey, blockContent) => {
244
- const truthy = resolvedVars[rawKey] === true;
245
- if (tagName === 'if') {
246
- return truthy ? blockContent : '';
247
- }
248
- return truthy ? '' : blockContent;
249
- });
250
- }
251
- function renderTemplate(content, vars, platform) {
252
- const resolvedVars = resolveTemplateValue(vars, platform);
253
- const withConditionals = replaceConditionalBlocks(replaceConditionalBlocks(content, resolvedVars, 'if'), resolvedVars, 'unless');
254
- return withConditionals.replace(/{{([a-zA-Z0-9_]+)}}/g, (_match, rawKey) => {
255
- const value = resolvedVars[rawKey];
256
- if (value === undefined)
257
- return '';
258
- return String(value);
259
- });
260
- }
261
134
  function renderTemplateForPlatform(manifest, relativePath, content, platform) {
262
135
  if (!templateIncludesPath(manifest, relativePath))
263
136
  return content;
264
137
  const vars = manifest.buildConfig?.templates?.vars ?? {};
265
138
  return renderTemplate(content, vars, platform);
266
139
  }
267
- function renderedContentVariants(manifest, relativePath, content, platforms) {
268
- if (!templateIncludesPath(manifest, relativePath)) {
269
- return [{ content, platform: null }];
270
- }
271
- const seen = new Set();
272
- const variants = [];
273
- for (const platform of platforms) {
274
- const rendered = renderTemplateForPlatform(manifest, relativePath, content, platform);
275
- if (seen.has(rendered))
276
- continue;
277
- seen.add(rendered);
278
- variants.push({ content: rendered, platform });
279
- }
280
- return variants;
281
- }
282
140
  function formatYamlError(parseError, lineCounter, sourceName) {
283
141
  let location = '';
284
142
  if (Array.isArray(parseError.pos) && Number.isInteger(parseError.pos[0])) {
@@ -320,28 +178,38 @@ async function tryLoadCliManifestTools() {
320
178
  const manifestModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'manifest.js');
321
179
  const runtimeProjectionModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'catalog-runtime-projection.js');
322
180
  const capabilityModulePath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'commands', 'aw-capabilities.js');
181
+ const materializationPath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'review', 'skill-materialization.js');
182
+ const commandMaterializationPath = path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'managed-command-materialization.js');
323
183
  if (!fs.existsSync(manifestModulePath)
324
184
  || !fs.existsSync(runtimeProjectionModulePath)
325
185
  || !fs.existsSync(capabilityModulePath))
326
186
  return null;
327
187
  try {
328
- const [manifestModule, runtimeProjectionModule, capabilityModule] = await Promise.all([
188
+ const [manifestModule, runtimeProjectionModule, capabilityModule, materializationModule, commandModule] = await Promise.all([
329
189
  import(pathToFileURL(manifestModulePath).href),
330
190
  import(pathToFileURL(runtimeProjectionModulePath).href),
331
191
  import(pathToFileURL(capabilityModulePath).href),
192
+ import(pathToFileURL(materializationPath).href),
193
+ import(pathToFileURL(commandMaterializationPath).href),
332
194
  ]);
333
195
  if (manifestModule.SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION
334
- !== SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION) {
196
+ !== SOURCE_PLUGIN_MANIFEST_CONTRACT_VERSION
197
+ || typeof materializationModule.materializeProfilePluginComponents !== 'function') {
335
198
  return null;
336
199
  }
337
200
  return {
338
201
  assertPluginInputTree: manifestModule.assertPluginInputTree ?? null,
339
202
  validateSourcePluginManifest: manifestModule.validateSourcePluginManifest ?? null,
203
+ reservedImports: manifestModule.CLI_RESERVED_IMPORTS,
340
204
  readPluginManifest: manifestModule.readPluginManifest ?? null,
341
205
  discoverPlugins: manifestModule.discoverPlugins ?? null,
342
206
  resolvePluginRequirements: manifestModule.resolvePluginRequirements ?? null,
343
207
  implementedCapabilities: capabilityModule.IMPLEMENTED_AW_CAPABILITIES ?? null,
344
208
  createRuntimeResolver: runtimeProjectionModule.createCatalogRuntimeImportResolver ?? null,
209
+ materializeProfilePluginComponents: materializationModule.materializeProfilePluginComponents,
210
+ createIsolatedSkillEnv: materializationModule.createIsolatedSkillEnv,
211
+ prepareManagedCommandPackage: commandModule.prepareManagedCommandPackage,
212
+ validateRuntimeSkillClosure: (await import(pathToFileURL(path.join(CLI_PACKAGE_ROOT, 'dist', 'src', 'utils', 'runtime-skill-closure.js')).href)).validateRuntimeSkillClosure,
345
213
  };
346
214
  }
347
215
  catch {
@@ -484,166 +352,11 @@ function validateStrictSemVerString(value, fieldName) {
484
352
  }
485
353
  return value;
486
354
  }
487
- function validateManifestLightweight(manifest) {
488
- const input = expectRecord(manifest, 'plugin manifest');
489
- if (!input)
490
- return;
491
- if (Object.prototype.hasOwnProperty.call(input, 'commands')) {
492
- error('top-level "commands" has been removed; use "slashCommands" instead');
493
- }
494
- validateAllowedKeys(input, 'plugin manifest', [
495
- 'schemaVersion',
496
- 'name',
497
- 'version',
498
- 'description',
499
- 'dependencies',
500
- 'requires',
501
- 'skills',
502
- 'slashCommands',
503
- 'mcpServers',
504
- 'apps',
505
- 'distributions',
506
- 'marketplace',
507
- 'interface',
508
- 'extensions',
509
- 'buildConfig',
510
- 'scripts',
511
- 'config',
512
- 'artifacts',
513
- ]);
514
- if (manifest.dependencies !== undefined) {
515
- if (!Array.isArray(manifest.dependencies)) {
516
- error('dependencies must be an array');
517
- }
518
- else if (manifest.dependencies.length > 64) {
519
- error('dependencies must contain at most 64 direct plugin dependencies');
520
- }
521
- else {
522
- const seen = new Set();
523
- for (const [index, dependency] of manifest.dependencies.entries()) {
524
- if (typeof dependency !== 'string' || !PLUGIN_NAME_PATTERN.test(dependency)) {
525
- error(`dependencies[${index}] must be an ASCII lowercase hyphen-case plugin name`);
526
- continue;
527
- }
528
- if (dependency === manifest.name) {
529
- error(`plugin "${manifest.name}" cannot depend on itself`);
530
- }
531
- if (seen.has(dependency)) {
532
- error(`dependencies contains duplicate plugin "${dependency}"`);
533
- }
534
- seen.add(dependency);
535
- }
536
- }
537
- }
538
- for (const field of ['name', 'version', 'description', 'marketplace']) {
539
- if (!manifest[field]) {
540
- error(`Missing required field: ${field}`);
541
- }
542
- }
543
- if (manifest.name && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(manifest.name)) {
544
- error(`manifest name "${manifest.name}" is not lowercase-hyphen-case`);
545
- }
546
- if (manifest.version) {
547
- const pluginVersion = parseStrictSemVer(manifest.version);
548
- if (!pluginVersion) {
549
- error(`manifest.version must be a strict SemVer 2.0.0 string, got "${manifest.version}"`);
550
- }
551
- else if (pluginVersion.prerelease.length > 0 || pluginVersion.build.length > 0) {
552
- error('manifest.version must be a stable SemVer without prerelease or build metadata');
553
- }
554
- }
555
- if (manifest.marketplace) {
556
- const mp = manifest.marketplace;
557
- if (!mp.category)
558
- error('marketplace.category is required');
559
- if (typeof mp.strict !== 'boolean')
560
- error('marketplace.strict must be a boolean');
561
- if (!mp.policy || !mp.policy.installation)
562
- error('marketplace.policy.installation is required');
563
- else if (!MARKETPLACE_INSTALLATION_POLICIES.has(mp.policy.installation))
564
- error(`marketplace.policy.installation must be one of ${[...MARKETPLACE_INSTALLATION_POLICIES].map((value) => JSON.stringify(value)).join(', ')}`);
565
- if (!mp.policy || !mp.policy.authentication)
566
- error('marketplace.policy.authentication is required');
567
- else if (!MARKETPLACE_AUTHENTICATION_POLICIES.has(mp.policy.authentication))
568
- error('marketplace.policy.authentication must be "ON_INSTALL" or "ON_USE"');
569
- validateManifestPolicyProducts(mp.policy?.products);
570
- }
571
- for (const field of ['skills', 'slashCommands', 'mcpServers', 'apps']) {
572
- if (manifest[field] && !manifest[field].startsWith('./')) {
573
- error(`${field} path must start with "./", got "${manifest[field]}"`);
574
- }
575
- }
576
- const claudeCommands = manifest.buildConfig?.manifestOverrides?.claude?.commands;
577
- if (claudeCommands !== undefined) {
578
- error('buildConfig.manifestOverrides.claude.commands has been removed; use "slashCommands" instead');
579
- }
580
- for (const platform of ['claude', 'codex']) {
581
- const rules = manifest.buildConfig?.fileRules?.[platform];
582
- if (!rules)
583
- continue;
584
- for (const pattern of [...(rules.include ?? []), ...(rules.exclude ?? [])]) {
585
- const normalized = String(pattern).replace(/\\/g, '/').replace(/^\.\//, '');
586
- if (normalized === 'commands' || normalized.startsWith('commands/')) {
587
- error(`buildConfig.fileRules.${platform} no longer accepts legacy "commands/**" source rules; use "slashCommands" instead`);
588
- }
589
- }
590
- }
591
- validateExtensionsLightweight(manifest.extensions);
592
- validatePlatformFieldSupport(manifest);
593
- }
594
- function validatePortableNativeArtifactCapabilityLightweight(manifest) {
595
- if (manifest.distributions?.agentSkills === undefined)
596
- return;
597
- const hasOtherNativeDeclaration = Boolean(manifest.skills
598
- || manifest.slashCommands
599
- || manifest.mcpServers
600
- || manifest.apps
601
- || (manifest.extensions?.instructions?.length ?? 0) > 0
602
- || (manifest.extensions?.permissions?.length ?? 0) > 0
603
- || (manifest.extensions?.hooks?.length ?? 0) > 0
604
- || (manifest.extensions?.nativeHooks?.claude?.length ?? 0) > 0
605
- || (manifest.extensions?.nativeHooks?.codex?.length ?? 0) > 0
606
- || (manifest.extensions?.agents?.length ?? 0) > 0);
607
- const hasPresentNativeArtifact = (manifest.artifacts?.targets ?? []).some((target) => (target?.platform === 'claude' || target?.platform === 'codex')
608
- && Array.isArray(target.states)
609
- && target.states.includes('present'));
610
- if (!hasOtherNativeDeclaration && !hasPresentNativeArtifact) {
611
- const message = 'Invalid plugin manifest: portable-only plugins are not supported. Declare at least one non-empty native capability.';
612
- if (!errors.includes(message))
613
- error(message);
614
- }
615
- }
616
- function normalizeManifestProductToken(value) {
617
- return String(value).trim().toUpperCase().replace(/[\s-]+/g, '_');
618
- }
619
- function resolveSupportedPlatforms(manifest) {
620
- const products = manifest.marketplace?.policy?.products;
621
- if (!Array.isArray(products) || products.length === 0) {
622
- return new Set(['claude', 'codex']);
623
- }
624
- const supported = new Set();
625
- for (const product of products) {
626
- const normalized = normalizeManifestProductToken(product);
627
- if (normalized === 'CLAUDE')
628
- supported.add('claude');
629
- if (normalized === 'CODEX')
630
- supported.add('codex');
631
- }
632
- return supported;
633
- }
634
355
  function supportsManifestPlatform(manifest, platform) {
635
356
  return resolveSupportedPlatforms(manifest).has(platform);
636
357
  }
637
- function formatManifestProductsForError(manifest) {
638
- const products = manifest.marketplace?.policy?.products;
639
- if (!Array.isArray(products) || products.length === 0) {
640
- return 'marketplace.policy.products=[]';
641
- }
642
- const normalized = [...new Set(products.map(normalizeManifestProductToken))];
643
- return `marketplace.policy.products=[${normalized.join(', ')}]`;
644
- }
645
- function platformProductName(platform) {
646
- return platform === 'claude' ? 'CLAUDE' : 'CODEX';
358
+ function formatManifestPlatformsForError(manifest) {
359
+ return `platforms=[${[...resolveSupportedPlatforms(manifest)].join(', ')}]`;
647
360
  }
648
361
  function pluginNameForError(manifest) {
649
362
  return typeof manifest.name === 'string' && manifest.name.trim()
@@ -653,77 +366,27 @@ function pluginNameForError(manifest) {
653
366
  function assertPlatformFieldSupported(manifest, fieldPath, requiredPlatform) {
654
367
  if (supportsManifestPlatform(manifest, requiredPlatform))
655
368
  return;
656
- error(`Invalid plugin "${pluginNameForError(manifest)}": ${fieldPath} requires ${platformProductName(requiredPlatform)} support, but ${formatManifestProductsForError(manifest)}.`);
369
+ error(`Invalid plugin "${pluginNameForError(manifest)}": ${fieldPath} requires ${requiredPlatform} support, but ${formatManifestPlatformsForError(manifest)}.`);
657
370
  }
658
371
  function hasNonEmptyOverride(value) {
659
372
  return isRecord(value) && Object.keys(value).length > 0;
660
373
  }
661
- function validateManifestPolicyProducts(products) {
662
- if (products === undefined)
663
- return;
664
- if (!Array.isArray(products)) {
665
- error('marketplace.policy.products must be an array');
666
- return;
667
- }
668
- for (const [index, product] of products.entries()) {
669
- const fieldName = `marketplace.policy.products[${index}]`;
670
- if (typeof product !== 'string' || product.trim() === '') {
671
- error(`${fieldName} must be a non-empty string`);
672
- continue;
374
+ function validatePlatformFieldSupport(manifest) {
375
+ for (const platform of PLATFORM_TARGETS) {
376
+ if (manifest.buildConfig?.fileRules?.[platform] !== undefined) {
377
+ assertPlatformFieldSupported(manifest, `buildConfig.fileRules.${platform}`, platform);
673
378
  }
674
- const normalized = normalizeManifestProductToken(product);
675
- if (!MANIFEST_POLICY_PRODUCTS.has(normalized)) {
676
- error(`${fieldName} must be one of "CODEX" or "CLAUDE"`);
379
+ if ((manifest.extensions?.nativeHooks?.[platform]?.length ?? 0) > 0) {
380
+ assertPlatformFieldSupported(manifest, `extensions.nativeHooks.${platform}`, platform);
677
381
  }
678
- }
679
- }
680
- function validatePlatformFieldSupport(manifest) {
681
- if (manifest.buildConfig?.fileRules?.claude !== undefined) {
682
- assertPlatformFieldSupported(manifest, 'buildConfig.fileRules.claude', 'claude');
683
- }
684
- if (manifest.buildConfig?.fileRules?.codex !== undefined) {
685
- assertPlatformFieldSupported(manifest, 'buildConfig.fileRules.codex', 'codex');
686
- }
687
- if (manifest.buildConfig?.manifestOverrides?.claude !== undefined) {
688
- assertPlatformFieldSupported(manifest, 'buildConfig.manifestOverrides.claude', 'claude');
689
- }
690
- if (manifest.buildConfig?.manifestOverrides?.codex !== undefined) {
691
- assertPlatformFieldSupported(manifest, 'buildConfig.manifestOverrides.codex', 'codex');
692
- }
693
- if (manifest.apps) {
694
- assertPlatformFieldSupported(manifest, 'apps', 'codex');
695
- }
696
- if (Array.isArray(manifest.extensions?.nativeHooks?.claude) && manifest.extensions.nativeHooks.claude.length > 0) {
697
- assertPlatformFieldSupported(manifest, 'extensions.nativeHooks.claude', 'claude');
698
- }
699
- if (Array.isArray(manifest.extensions?.nativeHooks?.codex) && manifest.extensions.nativeHooks.codex.length > 0) {
700
- assertPlatformFieldSupported(manifest, 'extensions.nativeHooks.codex', 'codex');
701
- }
702
- for (const [fieldName, entries] of [
703
- ['extensions.instructions', manifest.extensions?.instructions],
704
- ['extensions.permissions', manifest.extensions?.permissions],
705
- ['extensions.hooks', manifest.extensions?.hooks],
706
- ['extensions.agents', manifest.extensions?.agents],
707
- ]) {
708
- if (!Array.isArray(entries))
709
- continue;
710
- entries.forEach((entry, index) => {
711
- if (!isRecord(entry.agentOverrides))
712
- return;
713
- for (const platform of ['claude', 'codex']) {
714
- if (hasNonEmptyOverride(entry.agentOverrides[platform])) {
715
- assertPlatformFieldSupported(manifest, `${fieldName}[${index}].agentOverrides.${platform}`, platform);
382
+ for (const fieldName of ['instructions', 'permissions', 'hooks', 'agents']) {
383
+ for (const [index, entry] of (manifest.extensions?.[fieldName] ?? []).entries()) {
384
+ if (hasNonEmptyOverride(entry.agentOverrides?.[platform])) {
385
+ assertPlatformFieldSupported(manifest, `extensions.${fieldName}[${index}].agentOverrides.${platform}`, platform);
716
386
  }
717
387
  }
718
- });
719
- }
720
- if (!Array.isArray(manifest.artifacts?.targets))
721
- return;
722
- manifest.artifacts.targets.forEach((target, index) => {
723
- if (target?.platform === 'claude' || target?.platform === 'codex') {
724
- assertPlatformFieldSupported(manifest, `artifacts.targets[${index}].platform`, target.platform);
725
388
  }
726
- });
389
+ }
727
390
  }
728
391
  function isTemplateAsset(manifest, relativePath) {
729
392
  return templateIncludesPath(manifest, relativePath);
@@ -743,185 +406,7 @@ function validateManifestString(value, fieldName) {
743
406
  error(`${fieldName} must be a non-empty string`);
744
407
  return null;
745
408
  }
746
- return value;
747
- }
748
- function validatePublicHookEvent(value, fieldName) {
749
- const event = validateManifestString(value, fieldName);
750
- if (!event)
751
- return null;
752
- if (event === 'session_stop') {
753
- error(`${fieldName}: public event "session_stop" has been removed; use extensions.nativeHooks.claude[].event = "Stop" or "SessionEnd", or extensions.nativeHooks.codex[].event = "Stop"`);
754
- return null;
755
- }
756
- if (!PUBLIC_HOOK_EVENTS.has(event)) {
757
- error(`${fieldName}: unsupported public hook event "${event}"`);
758
- return null;
759
- }
760
- return event;
761
- }
762
- function normalizePublicSessionStartMatcher(matcher, fieldName) {
763
- if (matcher === undefined)
764
- return PUBLIC_SESSION_START_DEFAULT_MATCHER;
765
- if (typeof matcher !== 'string' || matcher.trim() === '') {
766
- error(`${fieldName} must be a non-empty string`);
767
- return null;
768
- }
769
- const selected = new Set();
770
- for (const part of matcher.split('|')) {
771
- if (!PUBLIC_SESSION_START_SOURCES.has(part)) {
772
- error(`${fieldName}: public session_start only allows startup, resume, clear, or their "|" union`);
773
- return null;
774
- }
775
- selected.add(part);
776
- }
777
- return ['startup', 'resume', 'clear'].filter((part) => selected.has(part)).join('|');
778
- }
779
- function validatePublicHookMatcher(event, matcher, fieldName) {
780
- if (matcher === undefined)
781
- return event === 'session_start' ? PUBLIC_SESSION_START_DEFAULT_MATCHER : undefined;
782
- if (typeof matcher !== 'string' || matcher.trim() === '') {
783
- error(`${fieldName} must be a non-empty string`);
784
- return null;
785
- }
786
- if (event === 'session_start') {
787
- return normalizePublicSessionStartMatcher(matcher, fieldName);
788
- }
789
- return matcher;
790
- }
791
- function validateNativeHookEvent(value, platform, fieldName) {
792
- const event = validateManifestString(value, fieldName);
793
- if (!event)
794
- return null;
795
- if (!NATIVE_HOOK_EVENTS[platform].has(event)) {
796
- error(`${fieldName}: unsupported ${platform} hook event "${event}"`);
797
- return null;
798
- }
799
- return event;
800
- }
801
- function validateNativeHookMatcher(event, platform, matcher, fieldName) {
802
- if (matcher === undefined)
803
- return undefined;
804
- if (typeof matcher !== 'string' || matcher.trim() === '') {
805
- error(`${fieldName} must be a non-empty string`);
806
- return null;
807
- }
808
- if (MATCHERLESS_NATIVE_HOOK_EVENTS[platform].has(event)) {
809
- error(`${fieldName}: ${platform} event "${event}" does not allow matcher`);
810
- return null;
811
- }
812
- return matcher;
813
- }
814
- function validateHookAgentOverrides(value, baseHook, fieldName, duplicateCollector) {
815
- if (value === undefined) {
816
- for (const platform of ['claude', 'codex']) {
817
- duplicateCollector(platform, baseHook);
818
- }
819
- return;
820
- }
821
- const overrides = expectRecord(value, fieldName);
822
- if (!overrides)
823
- return;
824
- validateAllowedKeys(overrides, fieldName, ['claude', 'codex']);
825
- for (const platform of ['claude', 'codex']) {
826
- const override = overrides[platform];
827
- if (override === null)
828
- continue;
829
- if (override === undefined) {
830
- duplicateCollector(platform, baseHook);
831
- continue;
832
- }
833
- const overrideRecord = expectRecord(override, `${fieldName}.${platform}`);
834
- if (!overrideRecord)
835
- continue;
836
- validateAllowedKeys(overrideRecord, `${fieldName}.${platform}`, ['event', 'matcher', 'command']);
837
- const event = overrideRecord.event === undefined
838
- ? baseHook.event
839
- : validatePublicHookEvent(overrideRecord.event, `${fieldName}.${platform}.event`);
840
- const matcherValue = overrideRecord.matcher === undefined
841
- ? baseHook.matcher
842
- : overrideRecord.matcher;
843
- const matcher = event
844
- ? validatePublicHookMatcher(event, matcherValue, `${fieldName}.${platform}.matcher`)
845
- : null;
846
- const command = overrideRecord.command === undefined
847
- ? baseHook.command
848
- : validateManifestString(overrideRecord.command, `${fieldName}.${platform}.command`);
849
- if (event && matcher !== null && command) {
850
- duplicateCollector(platform, { event, matcher, command });
851
- }
852
- }
853
- }
854
- function validateHookEntryLightweight(entry, fieldName, duplicateCollector) {
855
- const input = expectRecord(entry, fieldName);
856
- if (!input)
857
- return;
858
- validateAllowedKeys(input, fieldName, ['event', 'matcher', 'command', 'agentOverrides']);
859
- const event = validatePublicHookEvent(input.event, `${fieldName}.event`);
860
- const matcher = event
861
- ? validatePublicHookMatcher(event, input.matcher, `${fieldName}.matcher`)
862
- : null;
863
- const command = validateManifestString(input.command, `${fieldName}.command`);
864
- if (!event || matcher === null || !command)
865
- return;
866
- validateHookAgentOverrides(input.agentOverrides, { event, matcher, command }, `${fieldName}.agentOverrides`, duplicateCollector);
867
- }
868
- function validateNativeHookEntryLightweight(entry, platform, fieldName, duplicateCollector) {
869
- const input = expectRecord(entry, fieldName);
870
- if (!input)
871
- return;
872
- validateAllowedKeys(input, fieldName, ['event', 'matcher', 'command']);
873
- const event = validateNativeHookEvent(input.event, platform, `${fieldName}.event`);
874
- const matcher = event
875
- ? validateNativeHookMatcher(event, platform, input.matcher, `${fieldName}.matcher`)
876
- : null;
877
- const command = validateManifestString(input.command, `${fieldName}.command`);
878
- if (!event || matcher === null || !command)
879
- return;
880
- duplicateCollector(platform, { event, matcher, command, native: true });
881
- }
882
- function validateExtensionsLightweight(extensions) {
883
- if (extensions === undefined)
884
- return;
885
- const input = expectRecord(extensions, 'extensions');
886
- if (!input)
887
- return;
888
- validateAllowedKeys(input, 'extensions', ['instructions', 'permissions', 'hooks', 'nativeHooks', 'agents']);
889
- const seenHooks = {
890
- claude: new Set(),
891
- codex: new Set(),
892
- };
893
- const collectHook = (platform, hook) => {
894
- const event = hook.native ? hook.event : PUBLIC_HOOK_RENDER_MAP[platform][hook.event];
895
- const matcher = hook.matcher === '*' ? undefined : hook.matcher;
896
- const key = JSON.stringify([event, matcher ?? null, hook.command]);
897
- if (seenHooks[platform].has(key)) {
898
- error(`extensions has duplicate ${platform} hook for event "${event}" and command "${hook.command}"`);
899
- }
900
- seenHooks[platform].add(key);
901
- };
902
- if (input.hooks !== undefined) {
903
- if (!Array.isArray(input.hooks)) {
904
- error('extensions.hooks must be an array');
905
- }
906
- else {
907
- input.hooks.forEach((entry, index) => validateHookEntryLightweight(entry, `extensions.hooks[${index}]`, collectHook));
908
- }
909
- }
910
- if (input.nativeHooks !== undefined) {
911
- const nativeHooks = expectRecord(input.nativeHooks, 'extensions.nativeHooks');
912
- if (nativeHooks) {
913
- validateAllowedKeys(nativeHooks, 'extensions.nativeHooks', ['claude', 'codex']);
914
- for (const platform of ['claude', 'codex']) {
915
- if (nativeHooks[platform] === undefined)
916
- continue;
917
- if (!Array.isArray(nativeHooks[platform])) {
918
- error(`extensions.nativeHooks.${platform} must be an array`);
919
- continue;
920
- }
921
- nativeHooks[platform].forEach((entry, index) => validateNativeHookEntryLightweight(entry, platform, `extensions.nativeHooks.${platform}[${index}]`, collectHook));
922
- }
923
- }
924
- }
409
+ return value.trim();
925
410
  }
926
411
  function expectRecord(value, fieldName) {
927
412
  if (!isRecord(value)) {
@@ -962,9 +447,9 @@ async function validatePluginEvalManifest(pluginDir, pluginManifest) {
962
447
  if (fs.existsSync(legacyRoot)) {
963
448
  error('Plugin-root evals/ is legacy; put evals/ inside its owning static or dynamic Skill directory.');
964
449
  }
965
- const skillRoots = [...collectDeclaredSkillNames(pluginDir, pluginManifest).all]
966
- .sort()
967
- .map((skill) => ({ skill, root: path.join(pluginDir, 'skills', skill) }));
450
+ const sourceSkills = path.join(pluginDir, 'skills');
451
+ const skillRoots = fs.existsSync(sourceSkills) ? fs.readdirSync(sourceSkills, { withFileTypes: true })
452
+ .filter((entry) => entry.isDirectory()).map((entry) => ({ skill: entry.name, root: path.join(sourceSkills, entry.name) })) : [];
968
453
  const seenSkills = new Set();
969
454
  let manifestTools = null;
970
455
  for (const owner of skillRoots) {
@@ -1268,7 +753,7 @@ function targetedPlatforms(manifest) {
1268
753
  platforms.push('claude');
1269
754
  if (isCodexTargeted(manifest))
1270
755
  platforms.push('codex');
1271
- return platforms.length > 0 ? platforms : ['claude', 'codex'];
756
+ return platforms;
1272
757
  }
1273
758
  // ---------------------------------------------------------------------------
1274
759
  // Supplemental checks (always run — not covered by CLI validator)
@@ -1288,7 +773,7 @@ function validateNoBuildOutputDirs(pluginDir) {
1288
773
  }
1289
774
  }
1290
775
  function validateDeclaredPathsExist(pluginDir, manifest) {
1291
- for (const field of ['skills', 'slashCommands', 'mcpServers', 'apps']) {
776
+ for (const field of ['skills', 'mcpServers']) {
1292
777
  if (!manifest[field])
1293
778
  continue;
1294
779
  const resolved = path.join(pluginDir, manifest[field]);
@@ -1297,7 +782,7 @@ function validateDeclaredPathsExist(pluginDir, manifest) {
1297
782
  }
1298
783
  }
1299
784
  }
1300
- function validateCanonicalSkillLayout(pluginDir, manifest) {
785
+ async function validateCanonicalSkillLayout(pluginDir, manifest) {
1301
786
  if (manifest.skills && normalizeRelativePath(manifest.skills) !== 'skills') {
1302
787
  error('skills must be "./skills"');
1303
788
  }
@@ -1310,18 +795,8 @@ function validateCanonicalSkillLayout(pluginDir, manifest) {
1310
795
  if (content.trim() === '')
1311
796
  error('Plugin root README.md must not be empty');
1312
797
  }
1313
- const declared = collectDeclaredSkillNames(pluginDir, manifest);
1314
- const sourceBackedDynamicSkills = (Array.isArray(manifest.artifacts?.targets)
1315
- ? manifest.artifacts.targets
1316
- : [])
1317
- .filter((target) => target &&
1318
- typeof target === 'object' &&
1319
- (target.target === 'codex.skill' || target.target === 'claude.skill') &&
1320
- typeof target.skillKey === 'string' &&
1321
- Array.isArray(target.sourceDirs) &&
1322
- target.sourceDirs.length > 0)
1323
- .map((target) => target.skillKey.trim());
1324
- for (const skill of new Set([...declared.static, ...sourceBackedDynamicSkills])) {
798
+ const declared = await collectDeclaredSkillNames(pluginDir, manifest);
799
+ for (const skill of declared.static) {
1325
800
  const skillRoot = path.join(pluginDir, 'skills', skill);
1326
801
  if (!fs.statSync(skillRoot, { throwIfNoEntry: false })?.isDirectory()) {
1327
802
  error(`Skill ${JSON.stringify(skill)} must use source root "./skills/${skill}"`);
@@ -1337,101 +812,36 @@ function validateCanonicalSkillLayout(pluginDir, manifest) {
1337
812
  error(`skills/${skill}/README.md must not be empty`);
1338
813
  }
1339
814
  }
1340
- const portableRoot = manifest.distributions?.agentSkills?.skills;
1341
- for (const skill of declared.portable) {
1342
- const skillRoot = path.join(pluginDir, portableRoot, skill);
1343
- const skillReadme = path.join(skillRoot, 'README.md');
1344
- if (!fs.statSync(skillReadme, { throwIfNoEntry: false })?.isFile()) {
1345
- error(`${normalizeRelativePath(path.join(portableRoot, skill, 'README.md'))} is required`);
1346
- continue;
1347
- }
1348
- if (fs.readFileSync(skillReadme, 'utf8').trim() === '') {
1349
- error(`${normalizeRelativePath(path.join(portableRoot, skill, 'README.md'))} must not be empty`);
1350
- }
1351
- }
1352
815
  }
1353
816
  function validateDeclaredNativeAssets(pluginDir, manifest) {
1354
- const defaults = [
1355
- ['skills', 'skills'],
1356
- [DEFAULT_SLASH_COMMANDS_DIR, 'slashCommands'],
1357
- ['.mcp.json', 'mcpServers'],
1358
- ['.app.json', 'apps'],
1359
- ];
1360
- for (const [filename, field] of defaults) {
817
+ for (const [filename, field] of [['skills', 'skills'], ['.mcp.json', 'mcpServers']]) {
1361
818
  const fullPath = path.join(pluginDir, filename);
1362
- if (fs.existsSync(fullPath) && !manifest[field]) {
1363
- if (field === 'skills') {
1364
- const dynamicSkills = new Set((Array.isArray(manifest.artifacts?.targets) ? manifest.artifacts.targets : [])
1365
- .filter((target) => {
1366
- if (!target ||
1367
- typeof target !== 'object' ||
1368
- (target.target !== 'codex.skill' && target.target !== 'claude.skill') ||
1369
- typeof target.skillKey !== 'string' ||
1370
- !Array.isArray(target.sourceDirs) ||
1371
- target.sourceDirs.length === 0)
1372
- return false;
1373
- return target.sourceDirs.every((sourceDir) => typeof sourceDir === 'string' &&
1374
- (normalizeRelativePath(sourceDir) === `skills/${target.skillKey}` ||
1375
- normalizeRelativePath(sourceDir).startsWith(`skills/${target.skillKey}/`)));
1376
- })
1377
- .map((target) => target.skillKey));
1378
- const entries = fs.readdirSync(fullPath, { withFileTypes: true });
1379
- if (entries.length > 0 &&
1380
- entries.every((entry) => entry.isDirectory() && dynamicSkills.has(entry.name))) {
1381
- continue;
1382
- }
1383
- }
1384
- error(`"${filename}" exists but manifest does not declare "${field}" — declare it or remove the file`);
819
+ if (!fs.existsSync(fullPath) || manifest[field])
820
+ continue;
821
+ if (field === 'skills') {
822
+ const sources = (manifest.artifacts?.sourceDirs ?? []).map(normalizeRelativePath);
823
+ const entries = fs.readdirSync(fullPath, { withFileTypes: true });
824
+ if (entries.length && entries.every((entry) => entry.isDirectory() && sources.some((source) => source === 'skills' || source === `skills/${entry.name}`)))
825
+ continue;
1385
826
  }
827
+ error(`"${filename}" exists but manifest does not declare "${field}" or an artifacts.sourceDirs input`);
1386
828
  }
1387
829
  }
1388
- function collectDeclaredSkillNames(pluginDir, manifest) {
1389
- const skillsRoot = typeof manifest.skills === 'string'
1390
- ? path.join(pluginDir, manifest.skills)
1391
- : null;
1392
- const staticSkillNames = skillsRoot && fs.existsSync(skillsRoot)
1393
- ? fs.readdirSync(skillsRoot, { withFileTypes: true })
1394
- .filter((entry) => entry.isDirectory())
1395
- .map((entry) => entry.name)
1396
- .sort()
1397
- : [];
1398
- const staticSkillNameSet = new Set(staticSkillNames);
1399
- const artifactTargets = Array.isArray(manifest.artifacts?.targets)
1400
- ? manifest.artifacts.targets
1401
- : [];
1402
- const dynamicSkillNames = artifactTargets
1403
- .filter((target) => target
1404
- && typeof target === 'object'
1405
- && (target.target === 'codex.skill' || target.target === 'claude.skill')
1406
- && typeof target.skillKey === 'string'
1407
- && target.skillKey.trim() !== '')
1408
- .map((target) => target.skillKey.trim())
1409
- .sort();
1410
- const dynamicSkillNameSet = new Set(dynamicSkillNames);
1411
- const portableRoot = typeof manifest.distributions?.agentSkills?.skills === 'string'
1412
- ? path.join(pluginDir, manifest.distributions.agentSkills.skills)
1413
- : null;
1414
- const portableRootStats = portableRoot
1415
- ? fs.lstatSync(portableRoot, { throwIfNoEntry: false })
1416
- : null;
1417
- const portableSkillNameSet = new Set(portableRootStats?.isDirectory() && !portableRootStats.isSymbolicLink()
1418
- ? fs.readdirSync(portableRoot, { withFileTypes: true })
1419
- .filter((entry) => entry.isDirectory())
1420
- .map((entry) => entry.name)
1421
- : []);
1422
- return {
1423
- static: staticSkillNameSet,
1424
- dynamic: dynamicSkillNameSet,
1425
- portable: portableSkillNameSet,
1426
- all: new Set([...staticSkillNames, ...dynamicSkillNames]),
1427
- };
830
+ async function collectDeclaredSkillNames(pluginDir, manifest) {
831
+ const root = manifest.skills && path.join(pluginDir, manifest.skills);
832
+ const names = [];
833
+ if (root && fs.existsSync(root)) {
834
+ for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
835
+ if (entry.isDirectory() && !await isAuthorOnlySkillDirectory(path.join(root, entry.name)))
836
+ names.push(entry.name);
837
+ }
838
+ }
839
+ names.sort();
840
+ return { static: new Set(names), dynamic: new Set(), all: new Set(names) };
1428
841
  }
1429
842
  function isNodeRunnablePath(relativePath) {
1430
843
  return SCRIPT_NODE_EXTENSIONS.has(path.posix.extname(normalizeRelativePath(relativePath)));
1431
844
  }
1432
- function isAutoRunnablePath(relativePath) {
1433
- return SCRIPT_AUTO_EXTENSIONS.has(path.posix.extname(normalizeRelativePath(relativePath)).toLowerCase());
1434
- }
1435
845
  function normalizePluginScriptPath(pluginDir, value, fieldName) {
1436
846
  if (typeof value !== 'string' || value.trim() === '') {
1437
847
  error(`${fieldName} must be a non-empty string`);
@@ -1480,17 +890,11 @@ function validateScriptEntry(pluginDir, value, fieldName, options = {}) {
1480
890
  }
1481
891
  validateAllowedKeys(entry, fieldName, ['runner', 'path', 'args']);
1482
892
  const runner = validateManifestString(entry.runner, `${fieldName}.runner`);
1483
- if (runner && !SCRIPT_RUNNERS.has(runner)) {
1484
- error(`${fieldName}.runner has unsupported runner "${runner}"`);
1485
- }
1486
- if (options.requireNodeRunner && runner !== 'node') {
893
+ if (runner !== 'node') {
1487
894
  error(`${fieldName}.runner must be "node"`);
1488
895
  }
1489
896
  const relativePath = normalizePluginScriptPath(pluginDir, entry.path, `${fieldName}.path`);
1490
897
  validateDeclaredScriptFile(pluginDir, relativePath, `${fieldName}.path`);
1491
- if (runner === 'auto' && relativePath && !isAutoRunnablePath(relativePath)) {
1492
- error(`${fieldName}.path uses runner "auto" but has no supported extension (${[...SCRIPT_AUTO_EXTENSIONS].join(', ')})`);
1493
- }
1494
898
  if (options.requireNodePath && relativePath && !isNodeRunnablePath(relativePath)) {
1495
899
  error(`${fieldName}.path must use a Node runnable extension (.js, .mjs, or .cjs)`);
1496
900
  }
@@ -1508,51 +912,6 @@ function validateScriptEntry(pluginDir, value, fieldName, options = {}) {
1508
912
  }
1509
913
  return runner && relativePath ? { runner, path: relativePath } : null;
1510
914
  }
1511
- function validateLifecycleDefinition(pluginDir, value, fieldName, runtimeEntries) {
1512
- if (typeof value === 'string') {
1513
- const relativePath = normalizePluginScriptPath(pluginDir, value, fieldName);
1514
- validateDeclaredScriptFile(pluginDir, relativePath, fieldName);
1515
- if (relativePath && !isAutoRunnablePath(relativePath)) {
1516
- error(`${fieldName} uses runner "auto" but has no supported extension (${[...SCRIPT_AUTO_EXTENSIONS].join(', ')})`);
1517
- }
1518
- if (relativePath && isNodeRunnablePath(relativePath)) {
1519
- runtimeEntries.push({ path: relativePath, fieldName });
1520
- }
1521
- return { default: relativePath ? { runner: 'auto', path: relativePath } : null };
1522
- }
1523
- const selector = expectRecord(value, fieldName);
1524
- if (!selector)
1525
- return {};
1526
- if ('runner' in selector || 'path' in selector || 'command' in selector) {
1527
- error(`${fieldName} must declare lifecycle scripts under OS selectors`);
1528
- }
1529
- for (const selectorName of Object.keys(selector)) {
1530
- if (!SCRIPT_OS_SELECTORS.has(selectorName)) {
1531
- error(`${fieldName} has unknown OS selector "${selectorName}"`);
1532
- }
1533
- }
1534
- const normalized = {};
1535
- for (const [selectorName, entryValue] of Object.entries(selector)) {
1536
- const entry = validateScriptEntry(pluginDir, entryValue, `${fieldName}.${selectorName}`);
1537
- if (entry) {
1538
- normalized[selectorName] = entry;
1539
- if (entry.runner === 'node' || (entry.runner === 'auto' && isNodeRunnablePath(entry.path))) {
1540
- runtimeEntries.push({ path: entry.path, fieldName: `${fieldName}.${selectorName}.path` });
1541
- }
1542
- }
1543
- }
1544
- const orders = {
1545
- linux: ['linux', 'unix', 'default'],
1546
- darwin: ['darwin', 'unix', 'default'],
1547
- win32: ['win32', 'windows', 'default'],
1548
- };
1549
- for (const [osName, order] of Object.entries(orders)) {
1550
- if (!order.some((selectorName) => normalized[selectorName])) {
1551
- error(`${fieldName} must include an entry that resolves on ${osName}`);
1552
- }
1553
- }
1554
- return normalized;
1555
- }
1556
915
  function isNonRegistryDependencySpecifier(specifier) {
1557
916
  const trimmed = String(specifier).trim();
1558
917
  return (/^(?:workspace|file|link|portal):/i.test(trimmed) ||
@@ -1690,6 +1049,14 @@ function scanNodeImportContract(pluginDir, entryPaths, options) {
1690
1049
  continue;
1691
1050
  }
1692
1051
  if (!resolved.path) {
1052
+ const requested = path.posix.normalize(path.posix.join(path.posix.dirname(relativePath), specifier));
1053
+ if (options.nativeToolReader && requested === options.nativeToolReader)
1054
+ continue;
1055
+ if (isInjectedCommandReaderImport(options.injectedCommandReaders, relativePath, requested))
1056
+ continue;
1057
+ if ((options.runtimeConfigSkillRoots ?? []).some((root) => (relativePath.startsWith(`${root}/`)
1058
+ && requested === path.posix.join(root, AW_RUNTIME_CONFIG_READER_PATH))))
1059
+ continue;
1693
1060
  error(`${options.label}: unable to resolve relative import "${specifier}" from "${relativePath}"`);
1694
1061
  continue;
1695
1062
  }
@@ -1739,589 +1106,78 @@ function listFilesRecursive(rootDir) {
1739
1106
  walk(rootDir);
1740
1107
  return output;
1741
1108
  }
1742
- function validateConfigValueLightweight(field, value, fieldName) {
1743
- if (!isRecord(field) || !CONFIG_FIELD_TYPES.has(field.type))
1744
- return;
1745
- if (field.type === 'string' || field.type === 'file' || field.type === 'directory') {
1746
- validateManifestString(value, fieldName);
1747
- return;
1748
- }
1749
- if (field.type === 'boolean') {
1750
- if (typeof value !== 'boolean') {
1751
- error(`${fieldName} must be a boolean`);
1752
- }
1753
- return;
1754
- }
1755
- if (field.type === 'number') {
1756
- if (typeof value !== 'number' || !Number.isFinite(value)) {
1757
- error(`${fieldName} must be a finite number`);
1758
- return;
1759
- }
1760
- if (typeof field.min === 'number' && value < field.min) {
1761
- error(`${fieldName} must be greater than or equal to ${field.min}`);
1762
- }
1763
- if (typeof field.max === 'number' && value > field.max) {
1764
- error(`${fieldName} must be less than or equal to ${field.max}`);
1765
- }
1766
- return;
1767
- }
1768
- if (field.type === 'enum') {
1769
- if (typeof value !== 'string' || !Array.isArray(field.values) || !field.values.includes(value)) {
1770
- error(`${fieldName} must be one of config schema values`);
1771
- }
1772
- }
1773
- }
1774
- function validateConfigPresentationLightweight(presentation, schema) {
1775
- if (presentation === undefined)
1776
- return;
1777
- const root = expectRecord(presentation, 'config.presentation');
1778
- if (!root)
1779
- return;
1780
- validateAllowedKeys(root, 'config.presentation', ['groups', 'fields', 'presets']);
1781
- const schemaKeys = new Set(Object.keys(schema));
1782
- if (root.groups !== undefined) {
1783
- if (!Array.isArray(root.groups)) {
1784
- error('config.presentation.groups must be an array');
1785
- }
1786
- else {
1787
- const groupIds = new Set();
1788
- const groupedFields = new Set();
1789
- root.groups.forEach((rawGroup, index) => {
1790
- const fieldName = `config.presentation.groups[${index}]`;
1791
- const group = expectRecord(rawGroup, fieldName);
1792
- if (!group)
1793
- return;
1794
- validateAllowedKeys(group, fieldName, ['id', 'title', 'description', 'fields', 'advanced']);
1795
- const validId = validateManifestString(group.id, `${fieldName}.id`);
1796
- const id = validId ? group.id : null;
1797
- if (id && groupIds.has(id)) {
1798
- error(`${fieldName}.id has duplicate group id "${id}"`);
1799
- }
1800
- else if (id) {
1801
- groupIds.add(id);
1802
- }
1803
- validateManifestString(group.title, `${fieldName}.title`);
1804
- if (group.description !== undefined) {
1805
- validateManifestString(group.description, `${fieldName}.description`);
1806
- }
1807
- if (group.advanced !== undefined && typeof group.advanced !== 'boolean') {
1808
- error(`${fieldName}.advanced must be a boolean`);
1809
- }
1810
- if (!Array.isArray(group.fields)) {
1811
- error(`${fieldName}.fields must be an array`);
1812
- return;
1813
- }
1814
- group.fields.forEach((key, fieldIndex) => {
1815
- const keyFieldName = `${fieldName}.fields[${fieldIndex}]`;
1816
- const validKey = validateManifestString(key, keyFieldName);
1817
- if (!validKey)
1818
- return;
1819
- if (!schemaKeys.has(key)) {
1820
- error(`${keyFieldName} references unknown config key "${key}"`);
1821
- }
1822
- if (groupedFields.has(key)) {
1823
- error(`${keyFieldName} assigns config key "${key}" to more than one group`);
1824
- }
1825
- else {
1826
- groupedFields.add(key);
1827
- }
1828
- });
1829
- });
1830
- }
1831
- }
1832
- if (root.fields !== undefined) {
1833
- const fields = expectRecord(root.fields, 'config.presentation.fields');
1834
- if (fields) {
1835
- for (const [key, rawField] of Object.entries(fields)) {
1836
- const fieldName = `config.presentation.fields.${key}`;
1837
- const schemaField = schema[key];
1838
- if (!schemaKeys.has(key)) {
1839
- error(`config.presentation.fields references unknown config key "${key}"`);
1840
- }
1841
- const field = expectRecord(rawField, fieldName);
1842
- if (!field)
1843
- continue;
1844
- validateAllowedKeys(field, fieldName, [
1845
- 'valueLabels',
1846
- 'recommendedValue',
1847
- 'placeholder',
1848
- 'unit',
1849
- 'advanced',
1850
- ]);
1851
- if (field.placeholder !== undefined) {
1852
- validateManifestString(field.placeholder, `${fieldName}.placeholder`);
1853
- }
1854
- if (field.unit !== undefined) {
1855
- validateManifestString(field.unit, `${fieldName}.unit`);
1856
- }
1857
- if (field.advanced !== undefined && typeof field.advanced !== 'boolean') {
1858
- error(`${fieldName}.advanced must be a boolean`);
1859
- }
1860
- if (field.valueLabels !== undefined) {
1861
- const labels = expectRecord(field.valueLabels, `${fieldName}.valueLabels`);
1862
- if (isRecord(schemaField) && schemaField.type !== 'enum') {
1863
- error(`${fieldName}.valueLabels is only supported for enum config`);
1864
- }
1865
- if (labels) {
1866
- for (const [token, label] of Object.entries(labels)) {
1867
- if (!isRecord(schemaField) || !Array.isArray(schemaField.values) || !schemaField.values.includes(token)) {
1868
- error(`${fieldName}.valueLabels references unknown enum token "${token}"`);
1869
- }
1870
- validateManifestString(label, `${fieldName}.valueLabels.${token}`);
1871
- }
1872
- }
1873
- }
1874
- if (field.recommendedValue !== undefined) {
1875
- validateConfigValueLightweight(schemaField, field.recommendedValue, `${fieldName}.recommendedValue`);
1876
- }
1877
- }
1878
- }
1879
- }
1880
- if (root.presets !== undefined) {
1881
- if (!Array.isArray(root.presets)) {
1882
- error('config.presentation.presets must be an array');
1883
- }
1884
- else {
1885
- const presetIds = new Set();
1886
- root.presets.forEach((rawPreset, index) => {
1887
- const fieldName = `config.presentation.presets[${index}]`;
1888
- const preset = expectRecord(rawPreset, fieldName);
1889
- if (!preset)
1890
- return;
1891
- validateAllowedKeys(preset, fieldName, ['id', 'title', 'description', 'values']);
1892
- const validId = validateManifestString(preset.id, `${fieldName}.id`);
1893
- const id = validId ? preset.id : null;
1894
- if (id && presetIds.has(id)) {
1895
- error(`${fieldName}.id has duplicate preset id "${id}"`);
1896
- }
1897
- else if (id) {
1898
- presetIds.add(id);
1899
- }
1900
- validateManifestString(preset.title, `${fieldName}.title`);
1901
- if (preset.description !== undefined) {
1902
- validateManifestString(preset.description, `${fieldName}.description`);
1903
- }
1904
- const values = expectRecord(preset.values, `${fieldName}.values`);
1905
- if (!values)
1906
- return;
1907
- for (const [key, value] of Object.entries(values)) {
1908
- if (!schemaKeys.has(key)) {
1909
- error(`${fieldName}.values references unknown config key "${key}"`);
1910
- continue;
1911
- }
1912
- const schemaField = schema[key];
1913
- if (isRecord(schemaField)
1914
- && (schemaField.sensitive === true
1915
- || schemaField.type === 'file'
1916
- || schemaField.type === 'directory')) {
1917
- error(`${fieldName}.values.${key} cannot contain sensitive, file, or directory config values`);
1918
- continue;
1919
- }
1920
- validateConfigValueLightweight(schemaField, value, `${fieldName}.values.${key}`);
1921
- }
1922
- });
1923
- }
1924
- }
1925
- }
1926
- function validateConfigSchemaLightweight(config) {
1109
+ function validateConfigSchemaLightweight(config, manifest) {
1927
1110
  if (config === undefined)
1928
1111
  return;
1929
- const configRoot = expectRecord(config, 'config');
1930
- if (!configRoot)
1931
- return;
1932
- validateAllowedKeys(configRoot, 'config', ['schema', 'presentation']);
1933
- const schema = expectRecord(configRoot.schema, 'config.schema');
1934
- if (!schema)
1935
- return;
1936
- for (const [key, rawField] of Object.entries(schema)) {
1937
- if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(key)) {
1938
- error(`config.schema has invalid key "${key}"`);
1939
- }
1940
- const fieldName = `config.schema.${key}`;
1941
- const field = expectRecord(rawField, fieldName);
1942
- if (!field)
1943
- continue;
1944
- validateAllowedKeys(field, fieldName, [
1945
- 'type',
1946
- 'title',
1947
- 'description',
1948
- 'default',
1949
- 'required',
1950
- 'sensitive',
1951
- 'values',
1952
- 'min',
1953
- 'max',
1954
- ]);
1955
- if (typeof field.type !== 'string' || !CONFIG_FIELD_TYPES.has(field.type)) {
1956
- error(`${fieldName}.type must be string, number, boolean, enum, file, or directory`);
1957
- }
1958
- if (field.required !== undefined && typeof field.required !== 'boolean') {
1959
- error(`${fieldName}.required must be a boolean`);
1960
- }
1961
- if (field.sensitive !== undefined && typeof field.sensitive !== 'boolean') {
1962
- error(`${fieldName}.sensitive must be a boolean`);
1963
- }
1964
- if (field.values !== undefined) {
1965
- if (field.type !== 'enum' || !Array.isArray(field.values) || field.values.length === 0) {
1966
- error(`${fieldName}.values is only supported for enum config and must be non-empty`);
1967
- }
1968
- }
1969
- else if (field.type === 'enum') {
1970
- error(`${fieldName}.values is required for enum config`);
1971
- }
1972
- if (field.type !== 'number' && (field.min !== undefined || field.max !== undefined)) {
1973
- error(`${fieldName}.min/max are only supported for number config`);
1974
- }
1975
- if (field.min !== undefined && typeof field.min !== 'number') {
1976
- error(`${fieldName}.min must be a number`);
1977
- }
1978
- if (field.max !== undefined && typeof field.max !== 'number') {
1979
- error(`${fieldName}.max must be a number`);
1980
- }
1981
- if (typeof field.min === 'number' && typeof field.max === 'number' && field.min > field.max) {
1982
- error(`${fieldName}.min must be less than or equal to max`);
1983
- }
1112
+ try {
1113
+ normalizePluginConfigDefinition(config, 'config', {
1114
+ plugin: manifest.name, dependencies: manifest.dependencies ?? [],
1115
+ });
1116
+ }
1117
+ catch (validationError) {
1118
+ error(validationError instanceof Error ? validationError.message : String(validationError));
1984
1119
  }
1985
- validateConfigPresentationLightweight(configRoot.presentation, schema);
1986
- }
1987
- function configSchemaKeys(manifest) {
1988
- const schema = manifest.config?.schema;
1989
- return isRecord(schema) ? new Set(Object.keys(schema)) : new Set();
1990
- }
1991
- function configSchemaField(manifest, key) {
1992
- const field = manifest.config?.schema?.[key];
1993
- return isRecord(field) ? field : null;
1994
1120
  }
1995
- function defaultConfigValues(manifest) {
1996
- const schema = manifest.config?.schema;
1121
+ function defaultConfigValues(manifest, platform) {
1122
+ const schema = compilePluginConfigDefinition(manifest.config ?? { fields: {} }, platform).fields;
1997
1123
  const values = {};
1998
1124
  if (!isRecord(schema))
1999
1125
  return values;
2000
1126
  for (const [key, field] of Object.entries(schema)) {
2001
- if (isRecord(field) && Object.prototype.hasOwnProperty.call(field, 'default')) {
1127
+ if (isRecord(field) && field.default !== undefined) {
2002
1128
  values[key] = field.default;
2003
1129
  }
2004
1130
  }
2005
1131
  return values;
2006
1132
  }
2007
- function validateArtifactId(value, fieldName) {
2008
- const id = validateManifestString(value, fieldName);
2009
- if (!id)
2010
- return null;
2011
- if (!/^[A-Za-z][A-Za-z0-9_.-]*$/.test(id)) {
2012
- error(`${fieldName}: expected a stable id using letters, numbers, ".", "_" or "-"`);
1133
+ function componentFixtureConfig(manifest, platform, definition, referenceContext) {
1134
+ const values = defaultConfigValues(manifest, platform);
1135
+ const sources = Object.fromEntries(Object.keys(values).map((key) => [key, 'default']));
1136
+ // A required container can be configured without inventing a user choice if
1137
+ // its empty value is valid. This is fixture input, never a manifest default.
1138
+ const emptyContainers = {};
1139
+ for (const [key, field] of Object.entries(definition.fields)) {
1140
+ if (!field.required || Object.hasOwn(values, key))
1141
+ continue;
1142
+ if (field.type === 'object')
1143
+ emptyContainers[key] = {};
1144
+ else if (field.type === 'array')
1145
+ emptyContainers[key] = [];
1146
+ }
1147
+ const candidate = { ...values, ...emptyContainers };
1148
+ for (const [key, value] of Object.entries(emptyContainers)) {
1149
+ if (validatePluginConfigCandidate(definition, candidate, [key], referenceContext).length !== 0)
1150
+ continue;
1151
+ values[key] = value;
1152
+ sources[key] = definition.fields[key].platformOnly ? 'platform' : 'common';
2013
1153
  }
2014
- return id;
1154
+ return { values, sources };
2015
1155
  }
2016
- function validateCodexRoleKey(value, fieldName) {
2017
- const roleKey = validateManifestString(value, fieldName);
2018
- if (!roleKey)
2019
- return null;
2020
- if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(roleKey)) {
2021
- error(`${fieldName}: expected a valid Codex role key`);
2022
- }
2023
- return roleKey;
1156
+ function hasCrossPluginValueRef(value) {
1157
+ if (!isRecord(value))
1158
+ return false;
1159
+ if (isRecord(value.valueRef) && value.valueRef.plugin !== undefined)
1160
+ return true;
1161
+ return Object.values(value).some((child) => Array.isArray(child)
1162
+ ? child.some(hasCrossPluginValueRef) : hasCrossPluginValueRef(child));
2024
1163
  }
2025
- function validateCodexSkillKey(value, fieldName) {
2026
- const skillKey = validateManifestString(value, fieldName);
2027
- if (!skillKey)
2028
- return null;
2029
- if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(skillKey)) {
2030
- error(`${fieldName}: expected a valid Codex skill key`);
2031
- }
2032
- return skillKey;
1164
+ function configFieldContainsSensitiveValue(field) {
1165
+ if (!isRecord(field))
1166
+ return false;
1167
+ if (field.sensitive === true)
1168
+ return true;
1169
+ if (field.type !== 'object')
1170
+ return false;
1171
+ return ((isRecord(field.properties)
1172
+ && Object.values(field.properties).some((child) => isRecord(child) && child.sensitive === true))
1173
+ || (isRecord(field.additionalProperties)
1174
+ && field.additionalProperties.sensitive === true));
2033
1175
  }
2034
- function validatePortableSkillKey(value, fieldName) {
2035
- const skillKey = validateManifestString(value, fieldName);
2036
- if (!skillKey)
2037
- return null;
2038
- if (skillKey.length > MAX_SKILL_NAME_LEN || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skillKey)) {
2039
- error(`${fieldName}: expected at most 64 ASCII lowercase hyphen-case characters`);
2040
- }
2041
- return skillKey;
1176
+ function isSkillAuthorOnlyPath(relativePath) {
1177
+ const [topLevel] = relativePath.split('/').filter(Boolean);
1178
+ return topLevel === 'evals' || topLevel === 'reports';
2042
1179
  }
2043
- function validateStringArray(value, fieldName, options = {}) {
2044
- if (!Array.isArray(value)) {
2045
- error(`${fieldName} must be an array`);
2046
- return [];
2047
- }
2048
- const output = [];
2049
- for (const [index, entry] of value.entries()) {
2050
- const itemFieldName = `${fieldName}[${index}]`;
2051
- if (typeof entry !== 'string' || entry.trim() === '') {
2052
- error(`${itemFieldName} must be a non-empty string`);
2053
- continue;
2054
- }
2055
- if (options.allowed && !options.allowed.has(entry)) {
2056
- error(`${itemFieldName}: unsupported ${options.label ?? 'value'} "${entry}"`);
2057
- continue;
2058
- }
2059
- if (!output.includes(entry))
2060
- output.push(entry);
2061
- }
2062
- if (options.requireNonEmpty && output.length === 0) {
2063
- error(`${fieldName} must contain at least one value`);
2064
- }
2065
- return output;
2066
- }
2067
- function validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir) {
2068
- const fieldName = `artifacts.targets[${index}]`;
2069
- const target = expectRecord(entry, fieldName);
2070
- if (!target)
2071
- return null;
2072
- validateAllowedKeys(target, fieldName, [
2073
- 'id',
2074
- 'platform',
2075
- 'distribution',
2076
- 'scopes',
2077
- 'target',
2078
- 'kind',
2079
- 'projectManagedKind',
2080
- 'states',
2081
- 'refreshKeys',
2082
- 'requiresCodexProjectConfig',
2083
- 'roleKey',
2084
- 'skillKey',
2085
- 'sourceDirs',
2086
- 'runtimeImports',
2087
- ]);
2088
- const id = validateArtifactId(target.id, `${fieldName}.id`);
2089
- const artifactTarget = validateManifestString(target.target, `${fieldName}.target`);
2090
- if (artifactTarget && !ARTIFACT_TARGETS.has(artifactTarget)) {
2091
- error(`${fieldName}.target: unsupported artifact target "${artifactTarget}"`);
2092
- }
2093
- const portable = artifactTarget === 'agent-skills.skill';
2094
- const platform = portable || target.platform === undefined
2095
- ? undefined
2096
- : validateManifestString(target.platform, `${fieldName}.platform`);
2097
- const distribution = portable || target.distribution !== undefined
2098
- ? validateManifestString(target.distribution, `${fieldName}.distribution`)
2099
- : undefined;
2100
- if (portable) {
2101
- if (distribution !== 'agent-skills') {
2102
- error(`${fieldName}.distribution: expected "agent-skills"`);
2103
- }
2104
- if (target.platform !== undefined) {
2105
- error(`${fieldName}.platform: distribution targets do not support platform`);
2106
- }
2107
- }
2108
- else {
2109
- const expectedPlatform = artifactTarget === 'claude.skill' ? 'claude' : 'codex';
2110
- if (platform && artifactTarget && platform !== expectedPlatform) {
2111
- error(`${fieldName}.platform: target "${artifactTarget}" must use "${expectedPlatform}"`);
2112
- }
2113
- if (target.distribution !== undefined) {
2114
- error(`${fieldName}.distribution: platform targets do not support distribution`);
2115
- }
2116
- }
2117
- const key = id && artifactTarget ? `${id}:${artifactTarget}` : null;
2118
- if (key) {
2119
- if (seen.has(key)) {
2120
- error(`${fieldName}: duplicate artifact id + target "${key}"`);
2121
- }
2122
- seen.add(key);
2123
- }
2124
- const expectedKind = ARTIFACT_KIND_BY_TARGET[artifactTarget];
2125
- const kind = target.kind === undefined
2126
- ? expectedKind
2127
- : validateManifestString(target.kind, `${fieldName}.kind`);
2128
- if (kind && !ARTIFACT_KINDS.has(kind)) {
2129
- error(`${fieldName}.kind: unsupported artifact kind "${kind}"`);
2130
- }
2131
- if (expectedKind && kind && kind !== expectedKind) {
2132
- error(`${fieldName}.kind: target "${artifactTarget}" requires kind "${expectedKind}"`);
2133
- }
2134
- const expectedProjectManagedKind = ARTIFACT_PROJECT_MANAGED_KIND_BY_TARGET[artifactTarget];
2135
- const projectManagedKind = target.projectManagedKind === undefined
2136
- ? expectedProjectManagedKind
2137
- : validateManifestString(target.projectManagedKind, `${fieldName}.projectManagedKind`);
2138
- if (projectManagedKind && !ARTIFACT_PROJECT_MANAGED_KINDS.has(projectManagedKind)) {
2139
- error(`${fieldName}.projectManagedKind: unsupported Codex project managed kind "${projectManagedKind}"`);
2140
- }
2141
- if (expectedProjectManagedKind &&
2142
- projectManagedKind &&
2143
- projectManagedKind !== expectedProjectManagedKind) {
2144
- error(`${fieldName}.projectManagedKind: target "${artifactTarget}" must map to "${expectedProjectManagedKind}"`);
2145
- }
2146
- if (!expectedProjectManagedKind && projectManagedKind) {
2147
- error(`${fieldName}.projectManagedKind: target "${artifactTarget}" does not support projectManagedKind`);
2148
- }
2149
- const scopes = validateStringArray(target.scopes, `${fieldName}.scopes`, {
2150
- allowed: ARTIFACT_SCOPES,
2151
- label: 'artifact scope',
2152
- requireNonEmpty: true,
2153
- });
2154
- const states = validateStringArray(target.states, `${fieldName}.states`, {
2155
- allowed: ARTIFACT_STATES,
2156
- label: 'artifact state',
2157
- requireNonEmpty: true,
2158
- });
2159
- const refreshKeys = validateStringArray(target.refreshKeys, `${fieldName}.refreshKeys`);
2160
- const schemaKeys = configSchemaKeys(manifest);
2161
- for (const [refreshIndex, refreshKey] of refreshKeys.entries()) {
2162
- if (!schemaKeys.has(refreshKey)) {
2163
- error(`${fieldName}.refreshKeys[${refreshIndex}]: unknown config key "${refreshKey}"`);
2164
- continue;
2165
- }
2166
- const field = configSchemaField(manifest, refreshKey);
2167
- if (scopes.includes('project') &&
2168
- (field?.type === 'file' || field?.type === 'directory')) {
2169
- error(`${fieldName}.refreshKeys[${refreshIndex}]: project-scope repo-visible artifacts cannot depend on "${field.type}" config key "${refreshKey}"; use a portable string key or keep the path in user/project local config for lifecycle/helper code.`);
2170
- }
2171
- }
2172
- if (target.requiresCodexProjectConfig !== undefined &&
2173
- typeof target.requiresCodexProjectConfig !== 'boolean') {
2174
- error(`${fieldName}.requiresCodexProjectConfig must be a boolean`);
2175
- }
2176
- if (artifactTarget === 'codex.skill' && target.requiresCodexProjectConfig === true) {
2177
- error(`${fieldName}.requiresCodexProjectConfig: codex.skill writes the skill runtime and must not require Codex project config preflight`);
2178
- }
2179
- if ((platform === 'claude' || portable) && target.requiresCodexProjectConfig !== undefined) {
2180
- error(`${fieldName}.requiresCodexProjectConfig: this target does not support the field`);
2181
- }
2182
- let roleKey;
2183
- let skillKey;
2184
- if (artifactTarget === 'codex.agentRole') {
2185
- roleKey = validateCodexRoleKey(target.roleKey, `${fieldName}.roleKey`);
2186
- if (!roleKey) {
2187
- error(`${fieldName}.roleKey: codex.agentRole targets must declare a static roleKey`);
2188
- }
2189
- }
2190
- else if (target.roleKey !== undefined) {
2191
- error(`${fieldName}.roleKey: roleKey is only supported for codex.agentRole targets`);
2192
- }
2193
- if (artifactTarget === 'codex.skill' || artifactTarget === 'claude.skill' || portable) {
2194
- skillKey = portable
2195
- ? validatePortableSkillKey(target.skillKey, `${fieldName}.skillKey`)
2196
- : validateCodexSkillKey(target.skillKey, `${fieldName}.skillKey`);
2197
- if (!skillKey) {
2198
- error(`${fieldName}.skillKey: ${artifactTarget} targets must declare a static skillKey`);
2199
- }
2200
- }
2201
- else if (target.skillKey !== undefined) {
2202
- error(`${fieldName}.skillKey: skillKey is only supported for skill targets`);
2203
- }
2204
- const normalizedSourceDirs = Array.isArray(target.sourceDirs)
2205
- ? target.sourceDirs
2206
- .filter((sourceDir) => typeof sourceDir === 'string' && sourceDir.trim() !== '')
2207
- .map((sourceDir) => path.posix.normalize(sourceDir))
2208
- : [];
2209
- if (new Set(normalizedSourceDirs).size !== normalizedSourceDirs.length) {
2210
- error(`${fieldName}.sourceDirs must not contain duplicate directories`);
2211
- }
2212
- const sourceDirs = target.sourceDirs === undefined
2213
- ? []
2214
- : validateStringArray(target.sourceDirs, `${fieldName}.sourceDirs`);
2215
- if (sourceDirs.length > 0 && artifactTarget !== 'codex.skill' && artifactTarget !== 'claude.skill' && !portable) {
2216
- error(`${fieldName}.sourceDirs: sourceDirs are only supported for skill targets`);
2217
- }
2218
- for (const [sourceIndex, sourceDir] of sourceDirs.entries()) {
2219
- const sourceField = `${fieldName}.sourceDirs[${sourceIndex}]`;
2220
- if (!sourceDir.startsWith('./') || path.posix.isAbsolute(sourceDir)) {
2221
- error(`${sourceField} must start with "./" and stay inside the plugin root`);
2222
- continue;
2223
- }
2224
- const normalized = path.posix.normalize(sourceDir);
2225
- if (normalized === '.' || normalized === '..' || normalized.startsWith('../')) {
2226
- error(`${sourceField} must stay inside the plugin root`);
2227
- continue;
2228
- }
2229
- const stats = fs.lstatSync(path.join(pluginDir, normalized), { throwIfNoEntry: false });
2230
- if (!stats?.isDirectory() || stats.isSymbolicLink()) {
2231
- error(`${sourceField} must point to an existing directory`);
2232
- }
2233
- if (skillKey && !portable &&
2234
- normalized !== `skills/${skillKey}` &&
2235
- !normalized.startsWith(`skills/${skillKey}/`)) {
2236
- error(`${sourceField} must stay inside "./skills/${skillKey}"`);
2237
- }
2238
- if (skillKey && !portable &&
2239
- isSkillAuthorOnlyPath(path.posix.relative(`skills/${skillKey}`, normalized))) {
2240
- error(`${sourceField} must not point inside an author-only Skill directory`);
2241
- }
2242
- }
2243
- if (skillKey && !portable &&
2244
- sourceDirs.length > 0 &&
2245
- !normalizedSourceDirs.includes(`skills/${skillKey}`)) {
2246
- error(`${fieldName}.sourceDirs must include "./skills/${skillKey}" so README.md is published`);
2247
- }
2248
- return {
2249
- id,
2250
- platform,
2251
- distribution,
2252
- scopes,
2253
- target: artifactTarget,
2254
- kind,
2255
- projectManagedKind,
2256
- states,
2257
- refreshKeys,
2258
- roleKey,
2259
- skillKey,
2260
- sourceDirs,
2261
- runtimeImports: Array.isArray(target.runtimeImports) ? target.runtimeImports : [],
2262
- };
2263
- }
2264
- function validateArtifactsConfigLightweight(pluginDir, manifest) {
2265
- if (manifest.artifacts === undefined)
2266
- return [];
2267
- const artifacts = expectRecord(manifest.artifacts, 'artifacts');
2268
- if (!artifacts)
2269
- return [];
2270
- validateAllowedKeys(artifacts, 'artifacts', ['targets']);
2271
- if (artifacts.targets === undefined)
2272
- return [];
2273
- if (!Array.isArray(artifacts.targets)) {
2274
- error('artifacts.targets must be an array');
2275
- return [];
2276
- }
2277
- const seen = new Set();
2278
- const declarations = artifacts.targets
2279
- .map((entry, index) => validateArtifactTargetEntry(entry, index, manifest, seen, pluginDir))
2280
- .filter(Boolean);
2281
- const owners = new Map();
2282
- for (const declaration of declarations) {
2283
- if ((declaration.target !== 'codex.skill' && declaration.target !== 'claude.skill' && declaration.target !== 'agent-skills.skill') ||
2284
- !declaration.skillKey) {
2285
- continue;
2286
- }
2287
- for (const scope of declaration.scopes) {
2288
- const ownerKey = `${declaration.platform ?? declaration.distribution}:${scope}:${declaration.skillKey}`;
2289
- const existing = owners.get(ownerKey);
2290
- if (existing) {
2291
- error(`artifacts.targets has duplicate skill ownership "${ownerKey}" in artifacts "${existing}" and "${declaration.id}"`);
2292
- }
2293
- else {
2294
- owners.set(ownerKey, declaration.id);
2295
- }
2296
- }
2297
- }
2298
- return declarations;
2299
- }
2300
- function validateArtifactPlanRefreshKeys(refreshKeys, declaration, fieldName) {
2301
- const keys = validateStringArray(refreshKeys, `${fieldName}.refreshKeys`);
2302
- for (const [index, key] of keys.entries()) {
2303
- if (!declaration.refreshKeys.includes(key)) {
2304
- error(`${fieldName}.refreshKeys[${index}]: "${key}" is not declared for artifact "${declaration.id}"`);
2305
- }
2306
- }
2307
- for (const declaredKey of declaration.refreshKeys) {
2308
- if (!keys.includes(declaredKey)) {
2309
- error(`${fieldName}: artifact "${declaration.id}" must preserve declared refresh key "${declaredKey}"`);
2310
- }
2311
- }
2312
- }
2313
- function isValidArtifactFilePath(relativePath) {
2314
- return (relativePath.trim() !== '' &&
2315
- !relativePath.includes('\\') &&
2316
- !relativePath.startsWith('/') &&
2317
- path.posix.normalize(relativePath) === relativePath &&
2318
- !relativePath.split('/').some((segment) => segment === '' || segment === '.' || segment === '..'));
2319
- }
2320
- function isSkillAuthorOnlyPath(relativePath) {
2321
- const [topLevel] = relativePath.split('/').filter(Boolean);
2322
- return topLevel === 'evals' || topLevel === 'reports';
2323
- }
2324
- function collectArtifactSourceFiles(rootDir, fieldName, files) {
1180
+ function collectArtifactSourceFiles(rootDir, fieldName, files, transform = (_relative, bytes) => bytes) {
2325
1181
  const rootStats = fs.lstatSync(rootDir, { throwIfNoEntry: false });
2326
1182
  if (!rootStats?.isDirectory() || rootStats.isSymbolicLink())
2327
1183
  return;
@@ -2345,39 +1201,21 @@ function collectArtifactSourceFiles(rootDir, fieldName, files) {
2345
1201
  error(`${fieldName} contains unsupported non-regular file "${relativePath}"`);
2346
1202
  continue;
2347
1203
  }
2348
- files.set(relativePath, fs.readFileSync(absolutePath));
1204
+ files.set(relativePath, transform(relativePath, fs.readFileSync(absolutePath)));
2349
1205
  }
2350
1206
  };
2351
1207
  visit(rootDir, '');
2352
1208
  }
2353
- function findArtifactFilePrefixConflict(files) {
2354
- const paths = [...files.keys()].sort();
2355
- for (const [index, relativePath] of paths.entries()) {
2356
- const prefix = paths.slice(0, index).find((candidate) => relativePath.startsWith(`${candidate}/`));
2357
- if (prefix)
2358
- return [prefix, relativePath];
2359
- }
2360
- return null;
2361
- }
2362
- function authorRuntimeImportKey(artifactId, importIndex) {
2363
- return `${artifactId}\0${importIndex}`;
2364
- }
2365
1209
  async function resolveAuthorRuntimeImports(options) {
2366
- const artifactImports = (options.manifest.artifacts?.targets ?? []).flatMap((target) => (target.runtimeImports ?? []).map((reference, importIndex) => ({
2367
- key: authorRuntimeImportKey(target.id, importIndex),
2368
- label: `artifacts target ${JSON.stringify(target.id)} runtime import ${JSON.stringify(reference.name)}`,
2369
- purpose: 'artifact-runtime',
2370
- reference,
2371
- })));
1210
+ const artifactImports = (options.manifest.artifacts?.runtimeImports ?? []).map((reference) => ({
1211
+ key: reference.name,
1212
+ label: `artifacts.runtimeImports ${JSON.stringify(reference.name)}`,
1213
+ purpose: 'artifact-runtime', platforms: [...resolveSupportedPlatforms(options.manifest)], reference,
1214
+ }));
2372
1215
  const skillRuntimeImports = (options.manifest.buildConfig?.skillRuntimeFiles ?? []).flatMap((entry, importIndex) => {
2373
1216
  if (!isRecord(entry.import))
2374
1217
  return [];
2375
- const platforms = [
2376
- ...(entry.platforms !== undefined || entry.distributions === undefined
2377
- ? (entry.platforms ?? [...resolveSupportedPlatforms(options.manifest)])
2378
- : []),
2379
- ...(entry.distributions?.includes('agent-skills') ? [undefined] : []),
2380
- ];
1218
+ const platforms = entry.platforms?.length ? entry.platforms : [...resolveSupportedPlatforms(options.manifest)];
2381
1219
  return platforms.length > 0 ? [{
2382
1220
  key: importIndex,
2383
1221
  label: `buildConfig.skillRuntimeFiles[${importIndex}].import`,
@@ -2394,25 +1232,28 @@ async function resolveAuthorRuntimeImports(options) {
2394
1232
  || typeof options.cliManifestTools?.readPluginManifest !== 'function'
2395
1233
  || typeof options.cliManifestTools?.discoverPlugins !== 'function'
2396
1234
  || typeof options.cliManifestTools?.createRuntimeResolver !== 'function') {
2397
- error('Portable runtime imports require a complete built CLI and canonical same-source Git workspace.');
1235
+ error('Runtime imports require a complete built CLI and canonical same-source Git workspace.');
2398
1236
  return null;
2399
1237
  }
2400
1238
  let consumer;
2401
1239
  let resolver;
1240
+ let referencePlugins;
2402
1241
  try {
2403
1242
  const sourceSet = await options.cliManifestTools.discoverPlugins(options.repoRoot);
2404
1243
  consumer = await options.cliManifestTools.readPluginManifest(options.pluginDir);
2405
1244
  if (!sourceSet.some((candidate) => candidate.manifest.name === consumer.manifest.name)) {
2406
1245
  sourceSet.push(consumer);
2407
1246
  }
1247
+ referencePlugins = sourceSet;
2408
1248
  resolver = options.cliManifestTools.createRuntimeResolver(sourceSet);
2409
1249
  }
2410
1250
  catch {
2411
- error('Portable runtime imports could not load the canonical same-source plugin set.');
1251
+ error('Runtime imports could not load the canonical same-source plugin set.');
2412
1252
  return null;
2413
1253
  }
2414
1254
  const resolvedArtifacts = new Map();
2415
1255
  const resolvedSkillRuntimeFiles = new Map();
1256
+ let unresolved = false;
2416
1257
  for (const request of requested) {
2417
1258
  let value;
2418
1259
  try {
@@ -2434,6 +1275,9 @@ async function resolveAuthorRuntimeImports(options) {
2434
1275
  providerVersion: resolution.providerVersion,
2435
1276
  exportName: resolution.name,
2436
1277
  source: resolution.source,
1278
+ requiredCapabilities: resolution.requiredCapabilities,
1279
+ capabilitySetDigest: resolution.capabilitySetDigest,
1280
+ mode: fs.statSync(resolution.sourcePath).mode & 0o111 ? 0o755 : 0o644,
2437
1281
  };
2438
1282
  if (value && (value.digest !== current.digest
2439
1283
  || value.providerPluginId !== current.providerPluginId
@@ -2453,6 +1297,7 @@ async function resolveAuthorRuntimeImports(options) {
2453
1297
  ? JSON.stringify(request.reference.export)
2454
1298
  : '<invalid-export>';
2455
1299
  error(`Cannot resolve ${request.label} from provider ${provider} export ${exportName}.`);
1300
+ unresolved = true;
2456
1301
  continue;
2457
1302
  }
2458
1303
  if (request.purpose === 'artifact-runtime')
@@ -2460,15 +1305,16 @@ async function resolveAuthorRuntimeImports(options) {
2460
1305
  else
2461
1306
  resolvedSkillRuntimeFiles.set(request.key, value);
2462
1307
  }
2463
- return {
1308
+ return unresolved ? null : {
2464
1309
  artifactImports: resolvedArtifacts,
2465
1310
  skillRuntimeImports: resolvedSkillRuntimeFiles,
1311
+ referencePlugins,
2466
1312
  };
2467
1313
  }
2468
- function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runtimeImports) {
1314
+ function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runtimeImports, platform) {
2469
1315
  for (const [runtimeIndex, runtimeFile] of (manifest.buildConfig?.skillRuntimeFiles ?? []).entries()) {
2470
1316
  if (runtimeFile.skill !== skillKey
2471
- || !runtimeFile.distributions?.includes('agent-skills'))
1317
+ || (runtimeFile.platforms?.length && !runtimeFile.platforms.includes(platform)))
2472
1318
  continue;
2473
1319
  if (typeof runtimeFile.source === 'string') {
2474
1320
  const sourcePath = path.join(pluginDir, normalizeRelativePath(runtimeFile.source));
@@ -2490,444 +1336,189 @@ function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runti
2490
1336
  }
2491
1337
  }
2492
1338
  }
2493
- function validateRenderedSkillTree(options) {
2494
- const { entry, declaration, fieldName, pluginDir, manifest, materializedRoot, skillValidationTools, } = options;
2495
- if (entry.state !== 'present' || !isRecord(entry.content) || !isRecord(entry.content.files)) {
2496
- return;
2497
- }
2498
- const files = new Map();
2499
- declaration.sourceDirs.forEach((sourceDir, index) => {
2500
- collectArtifactSourceFiles(path.join(pluginDir, normalizeRelativePath(sourceDir)), `artifacts.targets sourceDirs[${index}] for artifact "${declaration.id}"`, files);
2501
- });
2502
- if (declaration.target === 'agent-skills.skill') {
2503
- overlayPortableRuntimeFiles(files, manifest, pluginDir, declaration.skillKey, options.runtimeImports);
2504
- }
2505
- for (const [relativePath, content] of Object.entries(entry.content.files)) {
2506
- if (isSkillAuthorOnlyPath(relativePath)) {
2507
- error(`${fieldName}.content.files path "${relativePath}" uses an author-only Skill directory`);
1339
+ async function prepareSourceComponentFixture(root, pluginDir, manifest, runtimeImports, tools) {
1340
+ const packageRoot = manifest.scripts?.node?.packageRoot;
1341
+ if (packageRoot) {
1342
+ const installedModules = path.join(pluginDir, packageRoot, 'node_modules');
1343
+ if (fs.statSync(installedModules, { throwIfNoEntry: false })?.isDirectory()) {
1344
+ const destination = path.join(root, packageRoot, 'node_modules');
1345
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
1346
+ // Source validation uses already installed declared dependencies. It does
1347
+ // not install packages or publish this temporary dependency link.
1348
+ fs.symlinkSync(installedModules, destination, 'junction');
1349
+ }
1350
+ }
1351
+ const fixtureManifest = structuredClone(manifest);
1352
+ for (const reference of fixtureManifest.artifacts?.runtimeImports ?? []) {
1353
+ const input = runtimeImports?.artifactImports.get(reference.name);
1354
+ if (!input)
1355
+ throw new Error(`Unresolved runtime input: ${reference.name}`);
1356
+ const relative = `./.agents-plugin/runtime-imports/${reference.name}`;
1357
+ const destination = path.join(root, relative);
1358
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
1359
+ fs.writeFileSync(destination, input.bytes, { mode: input.mode });
1360
+ reference.resolved = { path: relative, digest: input.digest, providerPluginId: input.providerPluginId,
1361
+ providerVersion: input.providerVersion, source: input.source, requiredCapabilities: input.requiredCapabilities,
1362
+ capabilitySetDigest: input.capabilitySetDigest };
1363
+ }
1364
+ if (manifest.nativeTools) {
1365
+ const reader = path.join(root, normalizeRelativePath(manifest.nativeTools.reader ?? './.aw/native-tool-reader.mjs'));
1366
+ fs.mkdirSync(path.dirname(reader), { recursive: true });
1367
+ fs.writeFileSync(reader, createNativeToolReaderSource());
1368
+ }
1369
+ // Apply the declared static source projection before the shared normalizer reads it.
1370
+ for (const platform of resolveSupportedPlatforms(manifest)) {
1371
+ if (manifest.mcpServers) {
1372
+ const relative = normalizeRelativePath(manifest.mcpServers);
1373
+ const input = fs.readFileSync(path.join(pluginDir, relative), 'utf8');
1374
+ const output = path.join(root, platform, relative);
1375
+ fs.mkdirSync(path.dirname(output), { recursive: true });
1376
+ fs.writeFileSync(output, renderTemplateForPlatform(manifest, relative, input, platform));
1377
+ }
1378
+ const sourceRoot = manifest.skills && path.join(pluginDir, manifest.skills);
1379
+ if (!sourceRoot || !fs.existsSync(sourceRoot))
2508
1380
  continue;
2509
- }
2510
- if (isValidArtifactFilePath(relativePath) && typeof content === 'string') {
2511
- files.set(relativePath, Buffer.from(content, 'utf8'));
2512
- }
2513
- }
2514
- const conflict = findArtifactFilePrefixConflict(files);
2515
- if (conflict) {
2516
- error(`${fieldName} final file tree path "${conflict[0]}" conflicts with "${conflict[1]}"`);
2517
- return;
2518
- }
2519
- const skillFile = files.get('SKILL.md');
2520
- if (!skillFile || skillFile.toString('utf8').trim() === '') {
2521
- error(`${fieldName} final file tree must contain a non-empty SKILL.md`);
2522
- }
2523
- else if (!skillValidationTools) {
2524
- error(`${fieldName} final SKILL.md cannot be validated because the shared CLI Skill validator is unavailable`);
2525
- }
2526
- else {
2527
- const sourcePath = `${fieldName} final SKILL.md`;
2528
- const parsed = skillValidationTools.parseSkillFrontmatter(skillFile.toString('utf8'), sourcePath);
2529
- for (const diagnostic of parsed.errors) {
2530
- error(`${diagnostic.path} [${diagnostic.code}] ${diagnostic.message}`);
2531
- }
2532
- if (parsed.frontmatter) {
2533
- const diagnostics = skillValidationTools.validateSkillFrontmatter(parsed.frontmatter, {
2534
- profile: declaration.platform === 'claude' ? 'claude-2.1.88' : 'portable-agent-skills',
2535
- expectedName: declaration.skillKey,
2536
- sourcePath,
2537
- });
2538
- for (const diagnostic of diagnostics) {
2539
- error(`${diagnostic.path} [${diagnostic.code}] ${diagnostic.message}`);
2540
- }
2541
- }
2542
- }
2543
- const readme = files.get('README.md');
2544
- if (!readme || readme.toString('utf8').trim() === '') {
2545
- error(`${fieldName} final file tree must contain a non-empty README.md`);
2546
- }
2547
- const sensitiveValues = Object.entries(manifest.config?.schema ?? {})
2548
- .filter(([, field]) => isRecord(field) && field.sensitive === true)
2549
- .map(([key, field]) => Object.prototype.hasOwnProperty.call(field, 'default')
2550
- ? String(field.default)
2551
- : String(defaultConfigValues(manifest)[key] ?? ''))
2552
- .filter(Boolean);
2553
- for (const [relativePath, content] of files) {
2554
- const text = content.toString('utf8');
2555
- if (/\{\{[^{}]+\}\}/u.test(text)) {
2556
- error(`${fieldName} final file tree contains an unresolved template in "${relativePath}"`);
2557
- }
2558
- if (sensitiveValues.some((value) => text.includes(value))) {
2559
- error(`${fieldName} final file tree exposes sensitive config in "${relativePath}"`);
2560
- }
2561
- }
2562
- if (declaration.target === 'codex.skill') {
2563
- const openAiYaml = files.get('agents/openai.yaml');
2564
- if (!openAiYaml || openAiYaml.toString('utf8').trim() === '') {
2565
- error(`${fieldName} final file tree must contain a non-empty agents/openai.yaml`);
2566
- }
2567
- }
2568
- fs.rmSync(materializedRoot, { recursive: true, force: true });
2569
- for (const [relativePath, content] of files) {
2570
- const targetPath = path.join(materializedRoot, ...relativePath.split('/'));
2571
- fs.mkdirSync(path.dirname(targetPath), { recursive: true });
2572
- fs.writeFileSync(targetPath, content);
2573
- }
2574
- if (declaration.target === 'codex.skill' && files.has('agents/openai.yaml')) {
2575
- validateOpenAiYaml(path.join(materializedRoot, 'agents', 'openai.yaml'), declaration.skillKey, true, manifest, materializedRoot, skillValidationTools);
2576
- }
2577
- }
2578
- function validateStaticPortableFinalTrees(pluginDir, manifest, runtimeImports, skillValidationTools) {
2579
- const portableRoot = manifest.distributions?.agentSkills?.skills;
2580
- if (typeof portableRoot !== 'string')
2581
- return;
2582
- const rootDir = path.join(pluginDir, normalizeRelativePath(portableRoot));
2583
- const rootStats = fs.lstatSync(rootDir, { throwIfNoEntry: false });
2584
- if (!rootStats?.isDirectory() || rootStats.isSymbolicLink())
2585
- return;
2586
- const dynamicKeys = new Set((manifest.artifacts?.targets ?? [])
2587
- .filter((target) => target.target === 'agent-skills.skill' && typeof target.skillKey === 'string')
2588
- .map((target) => target.skillKey));
2589
- const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aw-static-portable-final-'));
2590
- try {
2591
- for (const entry of fs.readdirSync(rootDir, { withFileTypes: true })) {
2592
- if (!entry.isDirectory() || dynamicKeys.has(entry.name))
1381
+ for (const entry of fs.readdirSync(sourceRoot, { withFileTypes: true })) {
1382
+ if (!entry.isDirectory() || await isAuthorOnlySkillDirectory(path.join(sourceRoot, entry.name)))
2593
1383
  continue;
2594
- validateRenderedSkillTree({
2595
- entry: { state: 'present', content: { files: {} } },
2596
- declaration: {
2597
- id: `static:${entry.name}`,
2598
- distribution: 'agent-skills',
2599
- target: 'agent-skills.skill',
2600
- skillKey: entry.name,
2601
- sourceDirs: [`${portableRoot}/${entry.name}`],
2602
- },
2603
- fieldName: `static portable Skill "${entry.name}"`,
2604
- pluginDir,
2605
- manifest,
2606
- runtimeImports,
2607
- materializedRoot: path.join(tempRoot, entry.name),
2608
- skillValidationTools,
2609
- });
1384
+ const files = new Map();
1385
+ collectArtifactSourceFiles(path.join(sourceRoot, entry.name), `static Skill ${entry.name}`, files, (relative, bytes) => isTemplateTextFile(relative)
1386
+ ? Buffer.from(renderTemplateForPlatform(manifest, `${normalizeRelativePath(manifest.skills)}/${entry.name}/${relative}`, bytes.toString('utf8'), platform)) : bytes);
1387
+ overlayPortableRuntimeFiles(files, manifest, pluginDir, entry.name, runtimeImports, platform);
1388
+ for (const [relative, bytes] of files) {
1389
+ const output = path.join(root, platform, 'skills', entry.name, relative);
1390
+ fs.mkdirSync(path.dirname(output), { recursive: true });
1391
+ const original = path.join(sourceRoot, entry.name, relative);
1392
+ const projection = (manifest.buildConfig?.skillRuntimeFiles ?? []).find((file) => file.skill === entry.name && file.target === relative && (!file.platforms?.length || file.platforms.includes(platform)));
1393
+ const mode = projection?.source ? fs.statSync(path.join(pluginDir, projection.source)).mode
1394
+ : fs.existsSync(original) ? fs.statSync(original).mode : 0o644;
1395
+ fs.writeFileSync(output, bytes, { mode: mode & 0o111 ? 0o755 : 0o644 });
1396
+ }
1397
+ }
1398
+ }
1399
+ for (const platform of resolveSupportedPlatforms(manifest)) {
1400
+ const skillsRoot = path.join(root, platform, 'skills');
1401
+ if (!fs.existsSync(skillsRoot))
1402
+ continue;
1403
+ for (const entry of fs.readdirSync(skillsRoot, { withFileTypes: true })) {
1404
+ if (!entry.isDirectory())
1405
+ continue;
1406
+ const generated = (manifest.buildConfig?.generatedSkillRuntimeFiles ?? [])
1407
+ .filter((file) => file.skill === entry.name && (!file.platforms?.length || file.platforms.includes(platform)))
1408
+ .map((file) => file.target);
1409
+ await tools.validateRuntimeSkillClosure(path.join(skillsRoot, entry.name), { declaredGeneratedFiles: new Set(generated) });
2610
1410
  }
2611
1411
  }
2612
- finally {
2613
- fs.rmSync(tempRoot, { recursive: true, force: true });
2614
- }
1412
+ const manifestPath = path.join(root, '.agents-plugin', 'plugin.json');
1413
+ fs.writeFileSync(manifestPath, JSON.stringify(fixtureManifest));
1414
+ return { rootDir: root, manifestPath, manifest: fixtureManifest };
2615
1415
  }
2616
- function validateRenderedArtifactPlan(plan, declarations, scopeLabel, options) {
2617
- const planField = `scripts.artifacts.render fixture (${scopeLabel})`;
2618
- const root = expectRecord(plan, planField);
2619
- if (!root)
1416
+ async function validateAuthorComponentFixtures(pluginDir, sourceManifest, runtimeImports, tools, referenceContext, referencePlugins, skillValidationTools, validationOptions) {
1417
+ const builtBundle = validationOptions.builtBundle;
1418
+ if (!builtBundle && !sourceManifest.skills && !sourceManifest.artifacts && !sourceManifest.command)
2620
1419
  return;
2621
- validateAllowedKeys(root, planField, ['version', 'artifacts']);
2622
- if (root.version !== 2) {
2623
- error(`${planField}.version must be 2`);
2624
- }
2625
- if (!Array.isArray(root.artifacts)) {
2626
- error(`${planField}.artifacts must be an array`);
1420
+ if (runtimeImports === null)
2627
1421
  return;
2628
- }
2629
- const byKey = new Map(declarations.map((target) => [`${target.id}:${target.target}`, target]));
2630
- const returned = new Set();
2631
- root.artifacts.forEach((artifact, index) => {
2632
- const fieldName = `${planField}.artifacts[${index}]`;
2633
- const entry = expectRecord(artifact, fieldName);
2634
- if (!entry)
2635
- return;
2636
- validateAllowedKeys(entry, fieldName, [
2637
- 'id',
2638
- 'platform',
2639
- 'distribution',
2640
- 'target',
2641
- 'kind',
2642
- 'state',
2643
- 'refreshKeys',
2644
- 'disabledReason',
2645
- 'roleKey',
2646
- 'skillKey',
2647
- 'content',
2648
- ]);
2649
- const id = validateArtifactId(entry.id, `${fieldName}.id`);
2650
- const target = validateManifestString(entry.target, `${fieldName}.target`);
2651
- const key = id && target ? `${id}:${target}` : null;
2652
- const declaration = key ? byKey.get(key) : null;
2653
- if (!declaration) {
2654
- error(`${fieldName}: artifact "${key ?? '<unknown>'}" is not declared for ${scopeLabel}`);
2655
- return;
2656
- }
2657
- if (returned.has(key)) {
2658
- error(`${fieldName}: duplicate artifact id + target "${key}"`);
2659
- }
2660
- returned.add(key);
2661
- if (declaration.distribution) {
2662
- if (entry.distribution !== declaration.distribution) {
2663
- error(`${fieldName}.distribution: expected "${declaration.distribution}"`);
2664
- }
2665
- if (entry.platform !== undefined) {
2666
- error(`${fieldName}.platform: distribution artifacts do not support platform`);
2667
- }
2668
- }
2669
- else if (entry.platform !== declaration.platform) {
2670
- error(`${fieldName}.platform: expected "${declaration.platform}"`);
2671
- }
2672
- if (entry.kind !== declaration.kind) {
2673
- error(`${fieldName}.kind: expected "${declaration.kind}"`);
2674
- }
2675
- if (!declaration.states.includes(entry.state)) {
2676
- error(`${fieldName}.state: "${entry.state}" is not declared for artifact "${declaration.id}"`);
2677
- }
2678
- validateArtifactPlanRefreshKeys(entry.refreshKeys, declaration, fieldName);
2679
- if (entry.state === 'present' && entry.content === undefined) {
2680
- error(`${fieldName}.content is required when state is "present"`);
2681
- }
2682
- if (entry.disabledReason !== undefined &&
2683
- (typeof entry.disabledReason !== 'string' || entry.disabledReason.trim() === '')) {
2684
- error(`${fieldName}.disabledReason must be a non-empty string`);
2685
- }
2686
- if (declaration.target === 'codex.agentRole') {
2687
- if (entry.roleKey !== declaration.roleKey) {
2688
- error(`${fieldName}.roleKey: expected "${declaration.roleKey}" from static metadata`);
2689
- }
2690
- if (isRecord(entry.content)) {
2691
- const registration = entry.content.registration;
2692
- if (isRecord(registration) && registration.config_file !== undefined) {
2693
- error(`${fieldName}.content.registration.config_file must be generated by AW, not renderer`);
2694
- }
2695
- const roleFile = entry.content.roleFile;
2696
- if (isRecord(roleFile) && roleFile.name !== declaration.roleKey) {
2697
- error(`${fieldName}.content.roleFile.name: expected "${declaration.roleKey}"`);
2698
- }
2699
- }
1422
+ const tempRoot = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'aw-author-components-'));
1423
+ let commandPackage;
1424
+ try {
1425
+ const root = path.join(tempRoot, 'plugin');
1426
+ if (builtBundle) {
1427
+ // Preserve the renderer's shipped dependencies without exposing the publication snapshot to writes.
1428
+ fs.cpSync(builtBundle, root, { recursive: true });
2700
1429
  }
2701
- else if (entry.roleKey !== undefined) {
2702
- error(`${fieldName}.roleKey is only supported for codex.agentRole artifacts`);
1430
+ else {
1431
+ fs.cpSync(pluginDir, root, {
1432
+ recursive: true, filter: (source) => !['.git', 'node_modules'].includes(path.basename(source)),
1433
+ });
2703
1434
  }
2704
- if (declaration.target === 'codex.skill' || declaration.target === 'claude.skill' || declaration.target === 'agent-skills.skill') {
2705
- if (entry.skillKey !== declaration.skillKey) {
2706
- error(`${fieldName}.skillKey: expected "${declaration.skillKey}" from static metadata`);
2707
- }
2708
- if (entry.state === 'present') {
2709
- if (!isRecord(entry.content)) {
2710
- error(`${fieldName}.content must be an object for dynamic skill artifacts`);
2711
- }
2712
- else {
2713
- validateAllowedKeys(entry.content, `${fieldName}.content`, ['files']);
2714
- const files = expectRecord(entry.content.files, `${fieldName}.content.files`);
2715
- if (files) {
2716
- const filePaths = Object.keys(files).sort();
2717
- for (const [relativePath, content] of Object.entries(files)) {
2718
- if (!isValidArtifactFilePath(relativePath)) {
2719
- error(`${fieldName}.content.files path "${relativePath}" must be a normalized POSIX relative path`);
2720
- }
2721
- if (typeof content !== 'string') {
2722
- error(`${fieldName}.content.files.${relativePath} must be a string`);
2723
- }
1435
+ const fixture = builtBundle
1436
+ ? await tools.readPluginManifest(root, { mode: 'bundle' })
1437
+ : await prepareSourceComponentFixture(root, pluginDir, sourceManifest, runtimeImports, tools);
1438
+ const { manifest } = fixture;
1439
+ if (manifest.name !== sourceManifest.name)
1440
+ throw new Error('Built bundle plugin does not match the source plugin.');
1441
+ const plugin = { ...fixture, sourceId: 'authoring',
1442
+ sourceIdentity: `sha256:${createHash('sha256').update(fs.realpathSync(pluginDir)).digest('hex')}` };
1443
+ const plugins = [plugin, ...(referencePlugins ?? runtimeImports?.referencePlugins ?? []).filter((entry) => entry.manifest.name !== manifest.name)];
1444
+ const env = await tools.createIsolatedSkillEnv(process.env, path.join(tempRoot, 'state'));
1445
+ if (manifest.command) {
1446
+ commandPackage = await tools.prepareManagedCommandPackage({ plugin, referencePlugins: plugins,
1447
+ operation: { kind: 'materialize' }, cwd: pluginDir, env });
1448
+ }
1449
+ for (const platform of resolveSupportedPlatforms(manifest)) {
1450
+ for (const scope of ['user', 'project']) {
1451
+ const definition = compilePluginConfigDefinition(manifest.config ?? { fields: {} }, platform);
1452
+ const references = referenceContext ? { ...referenceContext, platform, plugins: Object.fromEntries(Object.entries(referenceContext.plugins).map(([name, entry]) => [name, { ...entry,
1453
+ definition: compilePluginConfigDefinition(entry.definition, platform),
1454
+ values: defaultConfigValues({ config: entry.definition }, platform) }])) } : undefined;
1455
+ const { values, sources } = componentFixtureConfig(manifest, platform, definition, references);
1456
+ const config = { mode: 'artifact-render', targetScope: scope, definition, schema: definition.fields, values,
1457
+ sources, issues: [], stores: {}, referenceContext: references };
1458
+ try {
1459
+ const prepared = await tools.materializeProfilePluginComponents({ plugin, plugins, platform, scope,
1460
+ cwd: pluginDir, env, outputRoot: path.join(tempRoot, `${platform}-${scope}`), config,
1461
+ commandRecord: manifest.command?.platforms.includes(platform) ? commandPackage?.record : null });
1462
+ if (prepared.skills.length && !skillValidationTools)
1463
+ throw new Error('Prepared Skills require the shared CLI Skill validator.');
1464
+ for (const skill of prepared.skills) {
1465
+ // These directories retain the component's logical name. Native host
1466
+ // namespacing belongs to the separate platform projection.
1467
+ const sourceName = `component ${skill.id} (${platform}/${scope}) SKILL.md`;
1468
+ const parsed = skillValidationTools.parseSkillFrontmatter(fs.readFileSync(path.join(skill.path, 'SKILL.md'), 'utf8'), sourceName);
1469
+ for (const entry of parsed.errors)
1470
+ error(`${entry.path} [${entry.code}] ${entry.message}`);
1471
+ if (parsed.frontmatter) {
1472
+ for (const entry of skillValidationTools.validateSkillFrontmatter(parsed.frontmatter, {
1473
+ profile: selectSkillFrontmatterProfile(validationOptions, platform), expectedName: skill.name, sourcePath: sourceName,
1474
+ }))
1475
+ error(`${entry.path} [${entry.code}] ${entry.message}`);
2724
1476
  }
2725
- for (const [pathIndex, relativePath] of filePaths.entries()) {
2726
- const conflict = filePaths.slice(0, pathIndex).find((candidate) => relativePath.startsWith(`${candidate}/`));
2727
- if (conflict) {
2728
- error(`${fieldName}.content.files path "${conflict}" conflicts with "${relativePath}"`);
2729
- }
1477
+ }
1478
+ for (const unit of prepared.preparation)
1479
+ for (const gap of unit.unmet) {
1480
+ warn(`component unmet (${platform}/${unit.renderScope}): ${gap.id} [${gap.reasonCode}] ${JSON.stringify(gap.requiredFeatures)}`);
2730
1481
  }
1482
+ }
1483
+ catch (cause) {
1484
+ const pending = (manifest.buildConfig?.generatedSkillRuntimeFiles ?? []).filter((file) => (!file.platforms?.length || file.platforms.includes(platform))
1485
+ && !fs.existsSync(path.join(root, platform, 'skills', file.skill, file.target)));
1486
+ if (!builtBundle && cause.message.startsWith('Invalid runtime Skill closure:') && cause.message.endsWith(' is missing.')
1487
+ && pending.some((file) => cause.message.includes(JSON.stringify(file.target)))) {
1488
+ warn(`component profile unverified (${platform}/${scope}): declared generated runtime files require a staging build; ${cause.message}`);
2731
1489
  }
1490
+ else
1491
+ error(`component profile fixture (${platform}/${scope}): ${cause.message}`);
2732
1492
  }
2733
- validateRenderedSkillTree({
2734
- entry,
2735
- declaration,
2736
- fieldName,
2737
- pluginDir: options.pluginDir,
2738
- manifest: options.manifest,
2739
- runtimeImports: options.runtimeImports,
2740
- materializedRoot: path.join(options.tempRoot, `${declaration.platform ?? declaration.distribution}-${scopeLabel.split('/')[1]}-${index}`),
2741
- skillValidationTools: options.skillValidationTools,
2742
- });
2743
1493
  }
2744
1494
  }
2745
- else if (entry.skillKey !== undefined) {
2746
- error(`${fieldName}.skillKey is only supported for dynamic skill artifacts`);
2747
- }
2748
- });
2749
- for (const declaration of declarations) {
2750
- const key = `${declaration.id}:${declaration.target}`;
2751
- if (!returned.has(key)) {
2752
- error(`${planField}: renderer must return artifact "${declaration.id}" target "${declaration.target}"`);
2753
- }
2754
1495
  }
2755
- }
2756
- function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, resolvedRuntimeImports, skillValidationTools) {
2757
- if (!renderEntry || declarations.length === 0)
2758
- return;
2759
- const surfaceScopes = [...new Set(declarations.flatMap((target) => target.scopes.map((scope) => `${target.platform ?? target.distribution}:${scope}`)))];
2760
- const values = defaultConfigValues(manifest);
2761
- const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'aw-artifact-render-'));
2762
- try {
2763
- for (const surfaceScope of surfaceScopes) {
2764
- const [surface, scope] = surfaceScope.split(':');
2765
- const distribution = surface === 'agent-skills' ? surface : undefined;
2766
- const platform = distribution ? undefined : surface;
2767
- const event = distribution ? 'materialize' : 'install';
2768
- const scopedDeclarations = declarations.filter((target) => (distribution ? target.distribution === distribution : target.platform === platform)
2769
- && target.scopes.includes(scope));
2770
- const contextPath = path.join(tempRoot, `context-${surface}-${scope}.json`);
2771
- const runtimeImports = scopedDeclarations.flatMap((target) => target.runtimeImports.map((runtimeImport, importIndex) => {
2772
- const resolved = resolvedRuntimeImports?.artifactImports.get(authorRuntimeImportKey(target.id, importIndex));
2773
- if (!resolved)
2774
- return null;
2775
- const importPath = path.join(tempRoot, `runtime-${target.id}-${importIndex}`);
2776
- fs.writeFileSync(importPath, resolved.bytes);
2777
- return {
2778
- artifactId: target.id,
2779
- name: runtimeImport.name,
2780
- providerPluginId: resolved.providerPluginId,
2781
- exportName: resolved.exportName,
2782
- path: importPath,
2783
- digest: resolved.digest,
2784
- };
2785
- }).filter(Boolean));
2786
- fs.writeFileSync(contextPath, JSON.stringify({
2787
- event,
2788
- surface: distribution
2789
- ? { kind: 'distribution', name: distribution }
2790
- : { kind: 'platform', name: platform },
2791
- ...(platform ? { platform } : {}),
2792
- ...(distribution ? { distribution } : {}),
2793
- scope,
2794
- plugin: {
2795
- name: manifest.name,
2796
- version: manifest.version,
2797
- rootDir: pluginDir,
2798
- },
2799
- config: {
2800
- mode: 'artifact-render',
2801
- targetScope: scope,
2802
- schema: manifest.config?.schema ?? {},
2803
- values,
2804
- sources: Object.fromEntries(Object.keys(values).map((key) => [key, 'default'])),
2805
- issues: [],
2806
- },
2807
- changedConfigKeys: [],
2808
- previousArtifacts: [],
2809
- artifactSources: scopedDeclarations.map((target) => ({
2810
- id: target.id,
2811
- target: target.target,
2812
- sourceDirs: target.sourceDirs.map((sourceDir) => path.join(pluginDir, normalizeRelativePath(sourceDir))),
2813
- })),
2814
- runtimeImports,
2815
- paths: {
2816
- awHome: path.join(tempRoot, 'aw-home'),
2817
- codexHome: path.join(tempRoot, 'codex-home'),
2818
- claudeHome: path.join(tempRoot, 'claude-home'),
2819
- manifestPath: path.join(pluginDir, '.agents-plugin', 'plugin.json'),
2820
- configStores: {
2821
- user: path.join(tempRoot, 'config-user.json'),
2822
- project: path.join(tempRoot, 'config-project.json'),
2823
- },
2824
- },
2825
- renderer: {
2826
- runner: renderEntry.runner,
2827
- path: renderEntry.path,
2828
- args: renderEntry.args ?? [],
2829
- manifestDigest: 'author-validator-fixture',
2830
- rendererDigest: 'author-validator-fixture',
2831
- },
2832
- }), 'utf8');
2833
- const rendererHome = path.join(tempRoot, 'home');
2834
- const rendererTemp = path.join(tempRoot, 'tmp');
2835
- fs.mkdirSync(rendererHome, { recursive: true });
2836
- fs.mkdirSync(rendererTemp, { recursive: true });
2837
- const rendererEnv = {
2838
- AW_HOME: path.join(tempRoot, 'aw-home'),
2839
- AW_CODEX_HOME: path.join(tempRoot, 'codex-home'),
2840
- AW_CLAUDE_HOME: path.join(tempRoot, 'claude-home'),
2841
- PATH: process.env.PATH ?? process.env.Path ?? '',
2842
- AW_PLUGIN_CONTEXT: contextPath,
2843
- AW_PLUGIN_ROOT: pluginDir,
2844
- AW_PLUGIN_NAME: typeof manifest.name === 'string' ? manifest.name : '',
2845
- AW_PLUGIN_VERSION: typeof manifest.version === 'string' ? manifest.version : '',
2846
- AW_PLUGIN_EVENT: event,
2847
- ...(platform ? { AW_PLUGIN_PLATFORM: platform } : {}),
2848
- ...(distribution ? { AW_PLUGIN_DISTRIBUTION: distribution } : {}),
2849
- AW_PLUGIN_SCOPE: scope,
2850
- };
2851
- if (process.platform === 'win32') {
2852
- rendererEnv.USERPROFILE = rendererHome;
2853
- rendererEnv.TEMP = rendererTemp;
2854
- rendererEnv.TMP = rendererTemp;
2855
- if (process.env.SystemRoot)
2856
- rendererEnv.SystemRoot = process.env.SystemRoot;
2857
- if (process.env.ComSpec)
2858
- rendererEnv.ComSpec = process.env.ComSpec;
2859
- }
2860
- else {
2861
- rendererEnv.HOME = rendererHome;
2862
- rendererEnv.TMPDIR = rendererTemp;
2863
- }
2864
- const result = spawnSync(process.execPath, [path.join(pluginDir, renderEntry.path), ...(renderEntry.args ?? [])], {
2865
- cwd: pluginDir,
2866
- env: rendererEnv,
2867
- encoding: 'utf8',
2868
- timeout: 5000,
2869
- maxBuffer: 1024 * 1024,
2870
- });
2871
- const fieldName = `scripts.artifacts.render fixture (${surface}/${scope})`;
2872
- if (result.error) {
2873
- error(`${fieldName} failed: ${result.error.message}`);
2874
- continue;
2875
- }
2876
- if (result.status !== 0) {
2877
- const stderr = String(result.stderr ?? '').trim().split('\n')[0] ?? '';
2878
- error(`${fieldName} exited with code ${result.status}${stderr ? `: ${stderr}` : ''}`);
2879
- continue;
2880
- }
2881
- let plan;
2882
- try {
2883
- plan = JSON.parse(result.stdout);
2884
- }
2885
- catch (e) {
2886
- error(`${fieldName} stdout must be JSON ArtifactPlan: ${e.message}`);
2887
- continue;
2888
- }
2889
- validateRenderedArtifactPlan(plan, scopedDeclarations, `${surface}/${scope}`, {
2890
- pluginDir,
2891
- manifest,
2892
- runtimeImports: resolvedRuntimeImports,
2893
- tempRoot,
2894
- skillValidationTools,
2895
- });
2896
- }
1496
+ catch (cause) {
1497
+ error(`author component preparation: ${cause.message}`);
2897
1498
  }
2898
1499
  finally {
1500
+ try {
1501
+ await commandPackage?.cleanup();
1502
+ }
1503
+ catch (cause) {
1504
+ error(`author component cleanup: ${cause.message}`);
1505
+ }
2899
1506
  fs.rmSync(tempRoot, { recursive: true, force: true });
2900
1507
  }
2901
1508
  }
2902
- function validateDynamicArtifactsLightweight(pluginDir, manifest, renderEntry, runtimeImports, skillValidationTools) {
2903
- const declarations = validateArtifactsConfigLightweight(pluginDir, manifest);
2904
- const hasTargets = declarations.length > 0;
2905
- const hasRenderer = Boolean(manifest.scripts?.artifacts?.render);
2906
- if (hasTargets && !hasRenderer) {
2907
- error('artifacts.targets requires scripts.artifacts.render');
2908
- }
2909
- if (hasRenderer && !hasTargets) {
2910
- error('scripts.artifacts.render requires artifacts.targets');
2911
- }
2912
- runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, runtimeImports, skillValidationTools);
2913
- }
2914
1509
  function validateScriptsLightweight(pluginDir, manifest) {
2915
- validateConfigSchemaLightweight(manifest.config);
1510
+ validateConfigSchemaLightweight(manifest.config, manifest);
2916
1511
  if (manifest.scripts === undefined)
2917
1512
  return null;
2918
1513
  const scripts = expectRecord(manifest.scripts, 'scripts');
2919
1514
  if (!scripts)
2920
1515
  return null;
2921
- validateAllowedKeys(scripts, 'scripts', ['timeoutMs', 'lifecycle', 'helpers', 'node', 'artifacts', 'tests']);
2922
- if (scripts.timeoutMs !== undefined &&
2923
- (!Number.isInteger(scripts.timeoutMs) ||
2924
- scripts.timeoutMs < SCRIPT_TIMEOUT_MIN_MS ||
2925
- scripts.timeoutMs > SCRIPT_TIMEOUT_MAX_MS)) {
2926
- error(`scripts.timeoutMs must be an integer between ${SCRIPT_TIMEOUT_MIN_MS} and ${SCRIPT_TIMEOUT_MAX_MS}`);
2927
- }
1516
+ validateAllowedKeys(scripts, 'scripts', ['preApply', 'helpers', 'node', 'artifacts', 'config', 'tests']);
2928
1517
  const runtimeNodeEntries = [];
2929
1518
  let artifactRenderEntry = null;
2930
1519
  let packageMeta = null;
1520
+ const nativeToolReader = manifest.nativeTools ? normalizeRelativePath(manifest.nativeTools.reader ?? './.aw/native-tool-reader.mjs') : undefined;
1521
+ const runtimeConfigSkillRoots = (manifest.artifacts?.sourceDirs ?? []).map(normalizeRelativePath);
2931
1522
  if (scripts.helpers !== undefined) {
2932
1523
  const helpers = expectRecord(scripts.helpers, 'scripts.helpers');
2933
1524
  if (helpers) {
@@ -2941,19 +1532,30 @@ function validateScriptsLightweight(pluginDir, manifest) {
2941
1532
  runtimeNodeEntries.push({ path: helperPath, fieldName: 'scripts.helpers.config' });
2942
1533
  }
2943
1534
  }
2944
- if (scripts.lifecycle !== undefined) {
2945
- const lifecycle = expectRecord(scripts.lifecycle, 'scripts.lifecycle');
2946
- if (lifecycle) {
2947
- validateAllowedKeys(lifecycle, 'scripts.lifecycle', [...SCRIPT_LIFECYCLE_EVENTS]);
2948
- for (const [eventName, definition] of Object.entries(lifecycle)) {
2949
- if (!SCRIPT_LIFECYCLE_EVENTS.has(eventName)) {
2950
- error(`scripts.lifecycle has unsupported event "${eventName}"`);
2951
- continue;
2952
- }
2953
- validateLifecycleDefinition(pluginDir, definition, `scripts.lifecycle.${eventName}`, runtimeNodeEntries);
1535
+ if (scripts.preApply !== undefined) {
1536
+ const preApply = expectRecord(scripts.preApply, 'scripts.preApply');
1537
+ if (preApply) {
1538
+ validateAllowedKeys(preApply, 'scripts.preApply', ['path', 'timeoutMs']);
1539
+ const preApplyPath = normalizePluginScriptPath(pluginDir, preApply.path, 'scripts.preApply.path');
1540
+ validateDeclaredScriptFile(pluginDir, preApplyPath, 'scripts.preApply.path');
1541
+ if (preApplyPath && !isNodeRunnablePath(preApplyPath)) {
1542
+ error('scripts.preApply.path must use a Node runnable extension (.js, .mjs, or .cjs)');
1543
+ }
1544
+ if (preApply.timeoutMs !== undefined && (!Number.isInteger(preApply.timeoutMs)
1545
+ || preApply.timeoutMs < SCRIPT_TIMEOUT_MIN_MS || preApply.timeoutMs > SCRIPT_TIMEOUT_MAX_MS)) {
1546
+ error(`scripts.preApply.timeoutMs must be an integer between ${SCRIPT_TIMEOUT_MIN_MS} and ${SCRIPT_TIMEOUT_MAX_MS}`);
2954
1547
  }
1548
+ if (preApplyPath)
1549
+ runtimeNodeEntries.push({ path: preApplyPath, fieldName: 'scripts.preApply.path' });
2955
1550
  }
2956
1551
  }
1552
+ const configSuggestions = scripts.config?.suggestions;
1553
+ if (configSuggestions) {
1554
+ // Core owns the shape, timeout and path contract for this normalized declaration.
1555
+ const fieldName = 'scripts.config.suggestions.path';
1556
+ validateDeclaredScriptFile(pluginDir, configSuggestions.path, fieldName);
1557
+ runtimeNodeEntries.push({ path: configSuggestions.path, fieldName });
1558
+ }
2957
1559
  if (scripts.node !== undefined) {
2958
1560
  const node = expectRecord(scripts.node, 'scripts.node');
2959
1561
  if (node) {
@@ -2971,6 +1573,8 @@ function validateScriptsLightweight(pluginDir, manifest) {
2971
1573
  label: 'scripts.node.build import contract',
2972
1574
  packageMeta,
2973
1575
  allowDevDependencies: true,
1576
+ runtimeConfigSkillRoots,
1577
+ nativeToolReader,
2974
1578
  });
2975
1579
  }
2976
1580
  }
@@ -3020,6 +1624,9 @@ function validateScriptsLightweight(pluginDir, manifest) {
3020
1624
  label: 'scripts.tests.node import contract',
3021
1625
  packageMeta,
3022
1626
  allowDevDependencies: true,
1627
+ runtimeConfigSkillRoots,
1628
+ nativeToolReader,
1629
+ injectedCommandReaders: getCommandPackageInjectedReaders(manifest),
3023
1630
  });
3024
1631
  }
3025
1632
  }
@@ -3029,6 +1636,8 @@ function validateScriptsLightweight(pluginDir, manifest) {
3029
1636
  label: 'runtime Node import contract',
3030
1637
  packageMeta,
3031
1638
  allowDevDependencies: false,
1639
+ runtimeConfigSkillRoots,
1640
+ nativeToolReader,
3032
1641
  });
3033
1642
  return artifactRenderEntry;
3034
1643
  }
@@ -3050,55 +1659,6 @@ function validateMcpContent(pluginDir, manifest) {
3050
1659
  error(`${manifest.mcpServers} is not valid JSON: ${e.message}`);
3051
1660
  }
3052
1661
  }
3053
- function validateAppsContent(pluginDir, manifest) {
3054
- if (!manifest.apps)
3055
- return;
3056
- if (isTemplateAsset(manifest, manifest.apps))
3057
- return;
3058
- const appsPath = path.join(pluginDir, manifest.apps);
3059
- if (!fs.existsSync(appsPath))
3060
- return;
3061
- try {
3062
- const content = JSON.parse(fs.readFileSync(appsPath, 'utf8'));
3063
- if (!content.apps || typeof content.apps !== 'object') {
3064
- error(`${manifest.apps} must have an "apps" top-level key`);
3065
- }
3066
- }
3067
- catch (e) {
3068
- error(`${manifest.apps} is not valid JSON: ${e.message}`);
3069
- }
3070
- }
3071
- function hasCodexRepoManagedSurface(manifest) {
3072
- if (manifest.skills || manifest.slashCommands || manifest.mcpServers) {
3073
- return true;
3074
- }
3075
- if ((manifest.artifacts?.targets ?? []).some((target) => target?.platform === 'codex' &&
3076
- Array.isArray(target.scopes) &&
3077
- target.scopes.includes('project') &&
3078
- typeof target.projectManagedKind === 'string')) {
3079
- return true;
3080
- }
3081
- const extensions = manifest.extensions;
3082
- if (!extensions || typeof extensions !== 'object' || Array.isArray(extensions)) {
3083
- return false;
3084
- }
3085
- return ['instructions', 'permissions', 'hooks', 'agents'].some((key) => Array.isArray(extensions[key]) && extensions[key].length > 0) || (extensions.nativeHooks &&
3086
- typeof extensions.nativeHooks === 'object' &&
3087
- !Array.isArray(extensions.nativeHooks) &&
3088
- Array.isArray(extensions.nativeHooks.codex) &&
3089
- extensions.nativeHooks.codex.length > 0);
3090
- }
3091
- function warnCodexProjectScopeLimitations(manifest) {
3092
- if (!isCodexTargeted(manifest)) {
3093
- return;
3094
- }
3095
- if (manifest.apps) {
3096
- warn('Codex project scope does not support apps; users must install this app surface with `aw install <plugin> -p codex -s user` or split the plugin.');
3097
- }
3098
- if (!hasCodexRepoManagedSurface(manifest)) {
3099
- warn('This Codex-targeted plugin has no repo-managed project surface; Codex project scope will fail fast and only Codex user native install is applicable.');
3100
- }
3101
- }
3102
1662
  function validateExtensionNameUniqueness(manifest) {
3103
1663
  if (!manifest.extensions)
3104
1664
  return;
@@ -3152,14 +1712,17 @@ function validateOpenAiYaml(openaiYamlPath, skillName, required, manifest, plugi
3152
1712
  error(`${fieldName} shared validation failed: ${e.message}`);
3153
1713
  }
3154
1714
  }
3155
- function validateSkills(pluginDir, manifest, options, skillValidationTools) {
1715
+ function selectSkillFrontmatterProfile(options, platform) {
1716
+ return options.strictAgentSkills ? 'portable-agent-skills'
1717
+ : platform === 'claude' && options.claudeSkillProfile === 'minimum'
1718
+ ? 'claude-2.1.88' : 'claude-current';
1719
+ }
1720
+ async function validateSkills(pluginDir, manifest, options, skillValidationTools) {
3156
1721
  if (!manifest.skills)
3157
1722
  return;
3158
1723
  const skillsDir = path.join(pluginDir, manifest.skills);
3159
1724
  if (!fs.existsSync(skillsDir))
3160
1725
  return;
3161
- const requiresCodexMetadata = isCodexTargeted(manifest);
3162
- const targetsClaude = isClaudeTargeted(manifest);
3163
1726
  const skillDirs = fs
3164
1727
  .readdirSync(skillsDir, { withFileTypes: true })
3165
1728
  .filter((d) => d.isDirectory());
@@ -3167,6 +1730,12 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
3167
1730
  error('skills directory exists but contains no skill subdirectories');
3168
1731
  }
3169
1732
  for (const dir of skillDirs) {
1733
+ if (await isAuthorOnlySkillDirectory(path.join(skillsDir, dir.name)))
1734
+ continue;
1735
+ const staticPlatforms = [...resolveSupportedPlatforms(manifest)];
1736
+ if (staticPlatforms.length === 0)
1737
+ continue;
1738
+ const requiresCodexMetadata = staticPlatforms.includes('codex');
3170
1739
  const skillPath = path.join(skillsDir, dir.name);
3171
1740
  const skillMdPath = path.join(skillPath, 'SKILL.md');
3172
1741
  const openaiYamlPath = path.join(skillPath, 'agents', 'openai.yaml');
@@ -3180,9 +1749,23 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
3180
1749
  if (lineCount >= MAX_SKILL_LINES) {
3181
1750
  warn(`skills/${dir.name}/SKILL.md has ${lineCount} lines; Agent Skills recommends keeping SKILL.md under ${MAX_SKILL_LINES} lines`);
3182
1751
  }
3183
- const variants = renderedContentVariants(manifest, skillMdRelativePath, content, targetedPlatforms(manifest));
1752
+ const variants = [];
1753
+ for (const platform of staticPlatforms) {
1754
+ try {
1755
+ variants.push({ platform, content: renderTemplateForPlatform(manifest, skillMdRelativePath, content, platform) });
1756
+ }
1757
+ catch (cause) {
1758
+ error(`${skillMdRelativePath} (${platform} render): ${cause.message}`);
1759
+ }
1760
+ }
1761
+ const validatedVariants = new Set();
3184
1762
  for (const variant of variants) {
3185
- const sourceName = variant.platform
1763
+ const profile = selectSkillFrontmatterProfile(options, variant.platform);
1764
+ const key = JSON.stringify([profile, variant.content]);
1765
+ if (validatedVariants.has(key))
1766
+ continue;
1767
+ validatedVariants.add(key);
1768
+ const sourceName = templateIncludesPath(manifest, skillMdRelativePath)
3186
1769
  ? `skills/${dir.name}/SKILL.md (${variant.platform} render)`
3187
1770
  : `skills/${dir.name}/SKILL.md`;
3188
1771
  if (!skillValidationTools) {
@@ -3194,11 +1777,8 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
3194
1777
  error(`${entry.path} [${entry.code}] ${entry.message}`);
3195
1778
  }
3196
1779
  if (parsed.frontmatter) {
3197
- const profile = options.strictAgentSkills || !targetsClaude
3198
- ? 'portable-agent-skills'
3199
- : options.claudeSkillProfile === 'current'
3200
- ? 'claude-current'
3201
- : 'claude-2.1.88';
1780
+ // Source metadata preserves requested behavior. Host support is checked
1781
+ // later by the selected component profile, including explicit unmet.
3202
1782
  const diagnostics = skillValidationTools.validateSkillFrontmatter(parsed.frontmatter, {
3203
1783
  profile,
3204
1784
  expectedName: dir.name,
@@ -3216,223 +1796,17 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
3216
1796
  }
3217
1797
  }
3218
1798
  }
3219
- function detectCodexSlashCommandForbiddenSyntax(content) {
3220
- const checks = [
3221
- [/\$ARGUMENTS\b/, '$ARGUMENTS'],
3222
- [/\$\d+\b/, '$1'],
3223
- [/```!/, '```!'],
3224
- [/!`[^`\r\n]+`/, '!`command`'],
3225
- ];
3226
- for (const [pattern, label] of checks) {
3227
- if (pattern.test(content)) {
3228
- return label;
3229
- }
3230
- }
3231
- return null;
3232
- }
3233
- function validateSlashCommandAssetReference(commandRoot, commandRelativePath, value, fieldName) {
3234
- if (value === undefined)
3235
- return;
3236
- validateCodexIconPath({ [fieldName]: value }, fieldName, `${commandRelativePath}.codex.interface`);
3237
- if (typeof value !== 'string' || value.trim().length === 0)
3238
- return;
3239
- const normalized = normalizeRelativePath(stripDotSlash(value));
3240
- const absolutePath = path.join(commandRoot, normalized);
3241
- const stats = fs.statSync(absolutePath, { throwIfNoEntry: false });
3242
- if (!stats) {
3243
- error(`${commandRelativePath}.codex.interface.${fieldName} references missing asset "${value}"`);
3244
- return;
3245
- }
3246
- if (!stats.isFile()) {
3247
- error(`${commandRelativePath}.codex.interface.${fieldName} must reference a file, got "${value}"`);
3248
- }
3249
- }
3250
- function validateSlashCommandFrontmatter(commandRoot, commandRelativePath, frontmatter, platform) {
3251
- const fieldName = `${commandRelativePath} frontmatter`;
3252
- const fm = expectRecord(frontmatter, fieldName);
3253
- if (!fm)
3254
- return;
3255
- for (const key of Object.keys(fm)) {
3256
- if (CLAUDE_SLASH_COMMAND_ONLY_FIELDS.has(key)) {
3257
- error(`${fieldName}: "${key}" must be nested under "claude"`);
3258
- }
3259
- }
3260
- validateAllowedKeys(fm, fieldName, ['description', 'claude', 'codex']);
3261
- validateNonEmptyString(fm.description, `${fieldName}.description`, MAX_SKILL_DESCRIPTION_LEN);
3262
- if (platform === 'claude' && fm.claude !== undefined) {
3263
- const claudeBlock = expectRecord(fm.claude, `${fieldName}.claude`);
3264
- if (claudeBlock) {
3265
- validateAllowedKeys(claudeBlock, `${fieldName}.claude`, [
3266
- 'description',
3267
- 'allowed-tools',
3268
- 'model',
3269
- 'argument-hint',
3270
- 'shell',
3271
- ]);
3272
- if (claudeBlock.description !== undefined) {
3273
- validateNonEmptyString(claudeBlock.description, `${fieldName}.claude.description`, MAX_SKILL_DESCRIPTION_LEN);
3274
- }
3275
- if (claudeBlock['allowed-tools'] !== undefined) {
3276
- validateAllowedTools(claudeBlock['allowed-tools'], `${fieldName}.claude.allowed-tools`, { allowArray: true });
3277
- }
3278
- if (claudeBlock.model !== undefined) {
3279
- validateNonEmptyString(claudeBlock.model, `${fieldName}.claude.model`);
3280
- }
3281
- if (claudeBlock['argument-hint'] !== undefined) {
3282
- validateNonEmptyString(claudeBlock['argument-hint'], `${fieldName}.claude.argument-hint`);
3283
- }
3284
- if (claudeBlock.shell !== undefined) {
3285
- if (typeof claudeBlock.shell !== 'string') {
3286
- error(`${fieldName}.claude.shell must be a string`);
3287
- }
3288
- else if (!CLAUDE_FRONTMATTER_SHELLS.has(claudeBlock.shell.trim().toLowerCase())) {
3289
- error(`${fieldName}.claude.shell must be "bash" or "powershell"`);
3290
- }
3291
- }
3292
- }
3293
- }
3294
- if (platform === 'codex' && fm.codex !== undefined) {
3295
- const codexBlock = expectRecord(fm.codex, `${fieldName}.codex`);
3296
- if (codexBlock) {
3297
- if (codexBlock.policy !== undefined) {
3298
- error(`${fieldName}.codex.policy is not supported; generated slashCommands skills are always manual-only`);
3299
- }
3300
- validateAllowedKeys(codexBlock, `${fieldName}.codex`, ['description', 'interface']);
3301
- if (codexBlock.description !== undefined) {
3302
- validateNonEmptyString(codexBlock.description, `${fieldName}.codex.description`, MAX_SKILL_DESCRIPTION_LEN);
3303
- }
3304
- if (codexBlock.interface !== undefined) {
3305
- const interfaceBlock = expectRecord(codexBlock.interface, `${fieldName}.codex.interface`);
3306
- if (interfaceBlock) {
3307
- validateAllowedKeys(interfaceBlock, `${fieldName}.codex.interface`, [
3308
- 'display_name',
3309
- 'short_description',
3310
- 'icon_small',
3311
- 'icon_large',
3312
- 'brand_color',
3313
- 'default_prompt',
3314
- ]);
3315
- validateCodexMetadataString(interfaceBlock, 'display_name', `${fieldName}.codex.interface`, MAX_OPENAI_INTERFACE_NAME_LEN);
3316
- validateCodexShortDescription(interfaceBlock, `${fieldName}.codex.interface`);
3317
- validateCodexDefaultPrompt(interfaceBlock, 'default_prompt', `${fieldName}.codex.interface`, MAX_OPENAI_DEFAULT_PROMPT_LEN, path.basename(commandRelativePath, path.extname(commandRelativePath)));
3318
- validateCodexBrandColor(interfaceBlock, 'brand_color', `${fieldName}.codex.interface`);
3319
- validateSlashCommandAssetReference(commandRoot, commandRelativePath, interfaceBlock.icon_small, 'icon_small');
3320
- validateSlashCommandAssetReference(commandRoot, commandRelativePath, interfaceBlock.icon_large, 'icon_large');
3321
- }
3322
- }
3323
- }
3324
- }
3325
- }
3326
- function validateSlashCommands(pluginDir, manifest) {
3327
- const defaultSlashCommandsDir = path.join(pluginDir, DEFAULT_SLASH_COMMANDS_DIR);
3328
- if (fs.existsSync(defaultSlashCommandsDir) && !manifest.slashCommands) {
3329
- error(`"${DEFAULT_SLASH_COMMANDS_DIR}" exists but manifest does not declare "slashCommands"`);
3330
- }
3331
- if (!manifest.slashCommands)
3332
- return;
3333
- const targetPlatforms = resolveSupportedPlatforms(manifest);
3334
- const slashCommandsRoot = path.join(pluginDir, manifest.slashCommands);
3335
- const stats = fs.statSync(slashCommandsRoot, { throwIfNoEntry: false });
3336
- if (!stats) {
3337
- error(`slashCommands points to "${manifest.slashCommands}" but path does not exist`);
3338
- return;
3339
- }
3340
- if (!stats.isDirectory()) {
3341
- error(`slashCommands must point to a directory, got "${manifest.slashCommands}"`);
3342
- return;
3343
- }
3344
- const skillNames = new Set();
3345
- if (manifest.skills) {
3346
- const skillsRoot = path.join(pluginDir, manifest.skills);
3347
- if (fs.existsSync(skillsRoot)) {
3348
- for (const entry of fs.readdirSync(skillsRoot, { withFileTypes: true })) {
3349
- if (entry.isDirectory()) {
3350
- skillNames.add(entry.name);
3351
- }
3352
- }
3353
- }
3354
- }
3355
- const seenCommands = new Set();
3356
- const commandFiles = [];
3357
- for (const entry of fs.readdirSync(slashCommandsRoot, { withFileTypes: true })) {
3358
- const relativePath = normalizeRelativePath(path.join(stripDotSlash(manifest.slashCommands), entry.name));
3359
- if (entry.isDirectory()) {
3360
- if (entry.name !== 'assets') {
3361
- error(`slashCommands does not support nested directory "${relativePath}"; only root *.md files and assets/ are allowed`);
3362
- }
3363
- continue;
3364
- }
3365
- if (!entry.isFile()) {
3366
- error(`slashCommands has unsupported entry "${relativePath}"`);
3367
- continue;
3368
- }
3369
- if (path.posix.extname(entry.name) !== '.md') {
3370
- error(`slashCommands only accepts root *.md files; found "${relativePath}"`);
3371
- continue;
3372
- }
3373
- commandFiles.push(entry.name);
3374
- }
3375
- if (commandFiles.length === 0) {
3376
- error(`slashCommands "${manifest.slashCommands}" must contain at least one root *.md command file`);
3377
- return;
3378
- }
3379
- for (const fileName of commandFiles.sort()) {
3380
- const commandName = path.posix.basename(fileName, '.md');
3381
- const commandRelativePath = normalizeRelativePath(path.join(stripDotSlash(manifest.slashCommands), fileName));
3382
- if (commandName.length === 0 ||
3383
- commandName.length > 64 ||
3384
- !SLASH_COMMAND_NAME_PATTERN.test(commandName)) {
3385
- error(`${commandRelativePath} command name must use lowercase hyphen-case and be <= 64 characters`);
3386
- continue;
3387
- }
3388
- if (seenCommands.has(commandName)) {
3389
- error(`slashCommands has duplicate command name "${commandName}"`);
3390
- continue;
3391
- }
3392
- if (skillNames.has(commandName)) {
3393
- error(`slashCommands command "${commandName}" conflicts with source skill "${commandName}"`);
3394
- continue;
3395
- }
3396
- seenCommands.add(commandName);
3397
- const absolutePath = path.join(slashCommandsRoot, fileName);
3398
- const rawContent = fs.readFileSync(absolutePath, 'utf8');
3399
- for (const platform of ['claude', 'codex']) {
3400
- if (!targetPlatforms.has(platform))
3401
- continue;
3402
- const rendered = renderTemplateForPlatform(manifest, commandRelativePath, rawContent, platform);
3403
- if (platform === 'codex') {
3404
- const codexForbiddenSyntax = detectCodexSlashCommandForbiddenSyntax(rendered);
3405
- if (codexForbiddenSyntax) {
3406
- error(`${commandRelativePath} Codex render still contains Claude-only syntax "${codexForbiddenSyntax}"`);
3407
- }
3408
- }
3409
- let frontmatter;
3410
- try {
3411
- frontmatter = parseFrontmatter(rendered, `${commandRelativePath} (${platform} render)`);
3412
- }
3413
- catch (parseError) {
3414
- error(`${commandRelativePath} (${platform} render) has invalid YAML frontmatter: ${parseError.message}`);
3415
- continue;
3416
- }
3417
- if (!frontmatter) {
3418
- error(`${commandRelativePath} (${platform} render) is missing YAML frontmatter`);
3419
- continue;
3420
- }
3421
- validateSlashCommandFrontmatter(slashCommandsRoot, commandRelativePath, frontmatter, platform);
3422
- }
3423
- }
3424
- }
3425
1799
  // ---------------------------------------------------------------------------
3426
1800
  // Main
3427
1801
  // ---------------------------------------------------------------------------
3428
1802
  function printUsage() {
3429
1803
  console.log(`Usage:
3430
- aw plugin validate <plugin-directory> [options]
1804
+ aw dev plugin validate <plugin-directory> [options]
3431
1805
 
3432
1806
  Options:
3433
1807
  --strict-agent-skills Allow only Agent Skills portable core frontmatter.
3434
1808
  --claude-skill-profile <minimum|current>
3435
- Validate Claude fields at AW minimum 2.1.88 (default) or current docs.
1809
+ Validate current source fields (default), or explicitly require Claude 2.1.88 fields.
3436
1810
  --version-base <git-ref> Compare the production bundle against this Git base. Default: HEAD.
3437
1811
  --workspace-root <path> Workspace root. Default: current directory.
3438
1812
  --json Emit one machine-readable JSON result to stdout.
@@ -3498,8 +1872,45 @@ async function validatePluginDir(pluginDir, options) {
3498
1872
  }
3499
1873
  }
3500
1874
  const skillValidationTools = await tryLoadCliSkillValidationTools();
1875
+ const sourceConfig = manifest.config;
1876
+ let normalizedManifest;
1877
+ let referenceContext;
1878
+ let referencePlugins;
3501
1879
  try {
3502
- const normalizedManifest = await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
1880
+ normalizedManifest = await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
1881
+ manifest = normalizedManifest;
1882
+ // The Workspace is the sole source of dependency definitions and defaults.
1883
+ // No installed plugin or user config can complete an author fixture.
1884
+ if (manifest.config) {
1885
+ let plugins = [{ manifest, rootDir: pluginDir }];
1886
+ const hasCrossPluginSuggestions = getPluginConfigSuggestions(manifest.config, sourceConfig)
1887
+ .some((declaration) => declaration.plugin !== undefined);
1888
+ if (hasCrossPluginValueRef(sourceConfig) || hasCrossPluginSuggestions) {
1889
+ if (!options.repoRoot)
1890
+ throw new Error('Cross-plugin config validation requires the canonical same-source Workspace.');
1891
+ const workspace = await readCatalogWorkspace(options.repoRoot, {
1892
+ reservedImports: cliManifestTools.reservedImports,
1893
+ });
1894
+ if (!workspace.plugins.some((plugin) => plugin.manifest.name === manifest.name
1895
+ && plugin.rootDir === fs.realpathSync(pluginDir))) {
1896
+ throw new Error('Cross-plugin config validation requires the canonical same-source Workspace plugin.');
1897
+ }
1898
+ plugins = workspace.plugins;
1899
+ }
1900
+ referencePlugins = plugins;
1901
+ if (hasCrossPluginSuggestions)
1902
+ assertPluginConfigSuggestionProviders(manifest, plugins, sourceConfig);
1903
+ referenceContext = {
1904
+ plugin: manifest.name,
1905
+ dependencies: manifest.dependencies ?? [],
1906
+ plugins: Object.fromEntries(plugins.map((plugin) => [plugin.manifest.name, {
1907
+ definition: plugin.manifest.config ?? { fields: {} },
1908
+ dependencies: plugin.manifest.dependencies ?? [],
1909
+ values: defaultConfigValues(plugin.manifest),
1910
+ }])),
1911
+ };
1912
+ assertPluginConfigReferenceSchemas(manifest.config, referenceContext, sourceConfig);
1913
+ }
3503
1914
  const requirements = await cliManifestTools.resolvePluginRequirements({
3504
1915
  pluginRoot: pluginDir,
3505
1916
  manifest: normalizedManifest,
@@ -3523,29 +1934,34 @@ async function validatePluginDir(pluginDir, options) {
3523
1934
  }
3524
1935
  catch (e) {
3525
1936
  error(e.message);
1937
+ return;
1938
+ }
1939
+ if (options.builtBundle) {
1940
+ await validateAuthorComponentFixtures(pluginDir, manifest, undefined, cliManifestTools, referenceContext, referencePlugins, skillValidationTools, options);
1941
+ return;
3526
1942
  }
3527
1943
  validatePlatformFieldSupport(manifest);
3528
- validatePortableNativeArtifactCapabilityLightweight(manifest);
3529
1944
  validateNameMatchesDirectory(pluginDir, manifest);
3530
1945
  validateNoBuildOutputDirs(pluginDir);
3531
1946
  validateDeclaredNativeAssets(pluginDir, manifest);
3532
- validateCanonicalSkillLayout(pluginDir, manifest);
1947
+ await validateCanonicalSkillLayout(pluginDir, manifest);
3533
1948
  await validatePluginEvalManifest(pluginDir, manifest);
3534
- const artifactRenderEntry = validateScriptsLightweight(pluginDir, manifest);
1949
+ validateScriptsLightweight(pluginDir, manifest);
3535
1950
  const runtimeImports = await resolveAuthorRuntimeImports({
3536
1951
  pluginDir,
3537
1952
  manifest,
3538
1953
  repoRoot: options.repoRoot,
3539
1954
  cliManifestTools,
3540
1955
  });
3541
- validateStaticPortableFinalTrees(pluginDir, manifest, runtimeImports, skillValidationTools);
3542
- validateDynamicArtifactsLightweight(pluginDir, manifest, artifactRenderEntry, runtimeImports, skillValidationTools);
1956
+ if (manifest.scripts?.node?.build && manifest.scripts?.artifacts?.render) {
1957
+ warn('Component profiles require a staging build; source validation has not verified them.');
1958
+ }
1959
+ else {
1960
+ await validateAuthorComponentFixtures(pluginDir, manifest, runtimeImports, cliManifestTools, referenceContext, referencePlugins, skillValidationTools, options);
1961
+ }
3543
1962
  validateMcpContent(pluginDir, manifest);
3544
- validateAppsContent(pluginDir, manifest);
3545
- warnCodexProjectScopeLimitations(manifest);
3546
1963
  validateExtensionNameUniqueness(manifest);
3547
- validateSkills(pluginDir, manifest, options, skillValidationTools);
3548
- validateSlashCommands(pluginDir, manifest);
1964
+ await validateSkills(pluginDir, manifest, options, skillValidationTools);
3549
1965
  if (errors.length === 0) {
3550
1966
  const repoRoot = resolveCanonicalRepoRoot(pluginDir, manifest.name ?? '', options.gitRoot);
3551
1967
  if (repoRoot) {
@@ -3581,9 +1997,10 @@ function parseArgs(argv) {
3581
1997
  const options = {
3582
1998
  pluginDir: null,
3583
1999
  strictAgentSkills: false,
3584
- claudeSkillProfile: 'minimum',
2000
+ claudeSkillProfile: 'current',
3585
2001
  versionBase: 'HEAD',
3586
2002
  workspaceRoot: null,
2003
+ builtBundle: null,
3587
2004
  json: args.includes('--json'),
3588
2005
  };
3589
2006
  for (let index = 0; index < args.length; index += 1) {
@@ -3620,13 +2037,16 @@ function parseArgs(argv) {
3620
2037
  options.versionBase = value;
3621
2038
  continue;
3622
2039
  }
3623
- if (arg === '--workspace-root') {
2040
+ if (arg === '--workspace-root' || arg === '--built-bundle') {
3624
2041
  const value = args[index + 1];
3625
2042
  if (!value || value.startsWith('--')) {
3626
- exitCliError('--workspace-root requires a value.', options.json);
2043
+ exitCliError(`${arg} requires a value.`, options.json);
3627
2044
  }
3628
2045
  index += 1;
3629
- options.workspaceRoot = value;
2046
+ if (arg === '--workspace-root')
2047
+ options.workspaceRoot = value;
2048
+ else
2049
+ options.builtBundle = path.resolve(value);
3630
2050
  continue;
3631
2051
  }
3632
2052
  if (!arg.startsWith('--')) {
@@ -3673,6 +2093,7 @@ async function main() {
3673
2093
  repoRoot,
3674
2094
  gitRoot,
3675
2095
  enforceCanonicalRoot: requestedWorkspaceRoot !== null,
2096
+ builtBundle: args.builtBundle,
3676
2097
  });
3677
2098
  if (args.json) {
3678
2099
  console.log(JSON.stringify({