@lesliechan721/aw 0.1.0-beta.9 → 0.1.0-beta.90
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.
- package/dist/authoring/assets/aw-config.mjs +100 -501
- package/dist/authoring/assets/aw-config.mjs.map +1 -1
- package/dist/authoring/assets/aw-runtime-config.d.mts +13 -0
- package/dist/authoring/assets/aw-runtime-config.mjs +221 -0
- package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -0
- package/dist/authoring/assets/command-runtime-config.d.mts +9 -0
- package/dist/authoring/assets/command-runtime-config.mjs +134 -0
- package/dist/authoring/assets/command-runtime-config.mjs.map +1 -0
- package/dist/authoring/scripts/add-skill.mjs +15 -38
- package/dist/authoring/scripts/add-skill.mjs.map +1 -1
- package/dist/authoring/scripts/init-plugin.mjs +72 -96
- package/dist/authoring/scripts/init-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-root.mjs +4 -4
- package/dist/authoring/scripts/lib/plugin-root.mjs.map +1 -1
- package/dist/authoring/scripts/lib/plugin-version-check.d.mts +1 -0
- package/dist/authoring/scripts/lib/plugin-version-check.mjs +230 -9
- package/dist/authoring/scripts/lib/plugin-version-check.mjs.map +1 -1
- package/dist/authoring/scripts/lib/skill-scaffold.d.mts +2 -2
- package/dist/authoring/scripts/lib/skill-scaffold.mjs +4 -7
- package/dist/authoring/scripts/lib/skill-scaffold.mjs.map +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs +1 -1
- package/dist/authoring/scripts/remove-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +396 -1997
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/authoring/scripts/validate-skill.mjs +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/native-runtime/reader-runtime.mjs +34 -0
- package/dist/native-runtime/reader.d.mts +6 -0
- package/dist/native-runtime/reader.mjs +11 -0
- package/dist/scripts/aw-skill-eval-materializer.d.ts +11 -1
- package/dist/scripts/aw-skill-eval-materializer.js +118 -115
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/bundle-plugins.js +25 -7
- package/dist/scripts/bundle-plugins.js.map +1 -1
- package/dist/scripts/plugin-staging.d.ts +7 -7
- package/dist/scripts/plugin-staging.js +10 -8
- package/dist/scripts/plugin-staging.js.map +1 -1
- package/dist/scripts/plugin-test-reporter.d.mts +2 -0
- package/dist/scripts/plugin-test-reporter.mjs +21 -0
- package/dist/scripts/plugin-test-reporter.mjs.map +1 -0
- package/dist/scripts/test-plugin-scripts.d.ts +5 -0
- package/dist/scripts/test-plugin-scripts.js +284 -78
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/scripts/test-workers.d.mts +24 -0
- package/dist/scripts/test-workers.mjs +59 -0
- package/dist/scripts/test-workers.mjs.map +1 -0
- package/dist/src/adapters/helpers.d.ts +7 -0
- package/dist/src/adapters/helpers.js.map +1 -1
- package/dist/src/authoring/workspace-commands.d.ts +3 -0
- package/dist/src/authoring/workspace-commands.js +7 -2
- package/dist/src/authoring/workspace-commands.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +42 -21
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/catalog-dev-source.d.ts +42 -3
- package/dist/src/commands/catalog-dev-source.js +351 -43
- package/dist/src/commands/catalog-dev-source.js.map +1 -1
- package/dist/src/commands/catalog-generation.d.ts +8 -0
- package/dist/src/commands/catalog-generation.js +1 -5
- package/dist/src/commands/catalog-generation.js.map +1 -1
- package/dist/src/commands/catalog-publication-inspection.d.ts +42 -3
- package/dist/src/commands/catalog-publication-inspection.js +379 -48
- package/dist/src/commands/catalog-publication-inspection.js.map +1 -1
- package/dist/src/commands/catalog-publication-journal.d.ts +23 -4
- package/dist/src/commands/catalog-publication-journal.js +165 -20
- package/dist/src/commands/catalog-publication-journal.js.map +1 -1
- package/dist/src/commands/catalog-publish.d.ts +34 -3
- package/dist/src/commands/catalog-publish.js +311 -165
- package/dist/src/commands/catalog-publish.js.map +1 -1
- package/dist/src/commands/catalog-source.d.ts +54 -8
- package/dist/src/commands/catalog-source.js +277 -15
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/catalog-status.js +2 -2
- package/dist/src/commands/catalog-status.js.map +1 -1
- package/dist/src/commands/catalog-store.d.ts +104 -0
- package/dist/src/commands/catalog-store.js +685 -0
- package/dist/src/commands/catalog-store.js.map +1 -0
- package/dist/src/commands/catalog-workspace-resolution.d.ts +4 -0
- package/dist/src/commands/catalog-workspace-resolution.js +18 -3
- package/dist/src/commands/catalog-workspace-resolution.js.map +1 -1
- package/dist/src/commands/console.js +33 -20
- package/dist/src/commands/console.js.map +1 -1
- package/dist/src/commands/dependency-operation-plan.d.ts +14 -56
- package/dist/src/commands/dependency-operation-plan.js +90 -133
- package/dist/src/commands/dependency-operation-plan.js.map +1 -1
- package/dist/src/commands/deployment-confirmation.d.ts +11 -0
- package/dist/src/commands/deployment-confirmation.js +88 -0
- package/dist/src/commands/deployment-confirmation.js.map +1 -0
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/intent-command.d.ts +34 -0
- package/dist/src/commands/intent-command.js +174 -0
- package/dist/src/commands/intent-command.js.map +1 -0
- package/dist/src/commands/lifecycle-command-package.d.ts +45 -0
- package/dist/src/commands/lifecycle-command-package.js +199 -0
- package/dist/src/commands/lifecycle-command-package.js.map +1 -0
- package/dist/src/commands/managed-commands.d.ts +41 -0
- package/dist/src/commands/managed-commands.js +404 -0
- package/dist/src/commands/managed-commands.js.map +1 -0
- package/dist/src/commands/offline-cleanup-evidence.d.ts +29 -3
- package/dist/src/commands/offline-cleanup-evidence.js +80 -10
- package/dist/src/commands/offline-cleanup-evidence.js.map +1 -1
- package/dist/src/commands/operation-plan.d.ts +191 -0
- package/dist/src/commands/operation-plan.js +96 -0
- package/dist/src/commands/operation-plan.js.map +1 -0
- package/dist/src/commands/operation-planner.d.ts +47 -0
- package/dist/src/commands/operation-planner.js +142 -0
- package/dist/src/commands/operation-planner.js.map +1 -0
- package/dist/src/commands/options.d.ts +11 -20
- package/dist/src/commands/options.js +31 -36
- package/dist/src/commands/options.js.map +1 -1
- package/dist/src/commands/permission-batch.d.ts +5 -0
- package/dist/src/commands/permission-batch.js +80 -0
- package/dist/src/commands/permission-batch.js.map +1 -0
- package/dist/src/commands/plugin-capabilities.js +96 -46
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-config-confirmation.d.ts +14 -0
- package/dist/src/commands/public-config-confirmation.js +73 -0
- package/dist/src/commands/public-config-confirmation.js.map +1 -0
- package/dist/src/commands/public-interruption.d.ts +9 -0
- package/dist/src/commands/public-interruption.js +23 -0
- package/dist/src/commands/public-interruption.js.map +1 -0
- package/dist/src/commands/public-lifecycle-result.d.ts +106 -0
- package/dist/src/commands/public-lifecycle-result.js +518 -0
- package/dist/src/commands/public-lifecycle-result.js.map +1 -0
- package/dist/src/commands/public-lifecycle.d.ts +27 -0
- package/dist/src/commands/public-lifecycle.js +563 -0
- package/dist/src/commands/public-lifecycle.js.map +1 -0
- package/dist/src/commands/public-plugin-query.d.ts +16 -0
- package/dist/src/commands/public-plugin-query.js +230 -0
- package/dist/src/commands/public-plugin-query.js.map +1 -0
- package/dist/src/commands/rebuild-command.d.ts +176 -25
- package/dist/src/commands/rebuild-command.js +3989 -1392
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +133 -52
- package/dist/src/commands/rebuild-integration.js +1097 -2692
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/rebuild-operations.d.ts +74 -23
- package/dist/src/commands/rebuild-operations.js +334 -227
- package/dist/src/commands/rebuild-operations.js.map +1 -1
- package/dist/src/commands/rebuild-platform-integration.d.ts +81 -0
- package/dist/src/commands/rebuild-platform-integration.js +1992 -0
- package/dist/src/commands/rebuild-platform-integration.js.map +1 -0
- package/dist/src/commands/reconcile-operation-plan.d.ts +31 -0
- package/dist/src/commands/reconcile-operation-plan.js +48 -0
- package/dist/src/commands/reconcile-operation-plan.js.map +1 -0
- package/dist/src/commands/review-inspection.d.ts +60 -0
- package/dist/src/commands/review-inspection.js +436 -0
- package/dist/src/commands/review-inspection.js.map +1 -0
- package/dist/src/commands/review-preparation.d.ts +51 -0
- package/dist/src/commands/review-preparation.js +400 -0
- package/dist/src/commands/review-preparation.js.map +1 -0
- package/dist/src/commands/runtime.d.ts +6 -6
- package/dist/src/commands/runtime.js +44 -24
- package/dist/src/commands/runtime.js.map +1 -1
- package/dist/src/commands/skill-eval.d.ts +8 -0
- package/dist/src/commands/skill-eval.js +126 -73
- package/dist/src/commands/skill-eval.js.map +1 -1
- package/dist/src/commands/status-v6.d.ts +185 -68
- package/dist/src/commands/status-v6.js +1592 -499
- package/dist/src/commands/status-v6.js.map +1 -1
- package/dist/src/commands/targets-command.d.ts +38 -0
- package/dist/src/commands/targets-command.js +182 -0
- package/dist/src/commands/targets-command.js.map +1 -0
- package/dist/src/commands/wizard.d.ts +8 -5
- package/dist/src/commands/wizard.js +7 -4
- package/dist/src/commands/wizard.js.map +1 -1
- package/dist/src/commands/write-commands.d.ts +9 -3
- package/dist/src/commands/write-commands.js +144 -44
- package/dist/src/commands/write-commands.js.map +1 -1
- package/dist/src/constants.d.ts +2 -3
- package/dist/src/constants.js +2 -3
- package/dist/src/constants.js.map +1 -1
- package/dist/src/eval/manifest-v1.d.ts +6 -2
- package/dist/src/eval/manifest-v1.js +58 -26
- package/dist/src/eval/manifest-v1.js.map +1 -1
- package/dist/src/generators/local-plugin.d.ts +4 -2
- package/dist/src/generators/local-plugin.js +207 -346
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +20 -2
- package/dist/src/generators/permissions.js +82 -15
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.d.ts +3 -33
- package/dist/src/index.js +1786 -1945
- package/dist/src/index.js.map +1 -1
- package/dist/src/intent/deployment-preferences.d.ts +63 -0
- package/dist/src/intent/deployment-preferences.js +170 -0
- package/dist/src/intent/deployment-preferences.js.map +1 -0
- package/dist/src/intent/diagnostics.d.ts +11 -0
- package/dist/src/intent/diagnostics.js +14 -0
- package/dist/src/intent/diagnostics.js.map +1 -0
- package/dist/src/intent/intent-codec.d.ts +19 -0
- package/dist/src/intent/intent-codec.js +117 -0
- package/dist/src/intent/intent-codec.js.map +1 -0
- package/dist/src/intent/intent-store.d.ts +43 -0
- package/dist/src/intent/intent-store.js +118 -0
- package/dist/src/intent/intent-store.js.map +1 -0
- package/dist/src/intent/scope-context.d.ts +35 -0
- package/dist/src/intent/scope-context.js +179 -0
- package/dist/src/intent/scope-context.js.map +1 -0
- package/dist/src/intent/work-context.d.ts +13 -0
- package/dist/src/intent/work-context.js +22 -0
- package/dist/src/intent/work-context.js.map +1 -0
- package/dist/src/output/command-receipt.d.ts +37 -86
- package/dist/src/output/command-receipt.js +257 -179
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/component-delivery.d.ts +28 -0
- package/dist/src/output/component-delivery.js +138 -0
- package/dist/src/output/component-delivery.js.map +1 -0
- package/dist/src/output/public-result.d.ts +69 -0
- package/dist/src/output/public-result.js +403 -0
- package/dist/src/output/public-result.js.map +1 -0
- package/dist/src/output/rebuild-progress.d.ts +3 -0
- package/dist/src/output/rebuild-progress.js +34 -16
- package/dist/src/output/rebuild-progress.js.map +1 -1
- package/dist/src/output/receipt-projection.d.ts +7 -0
- package/dist/src/output/receipt-projection.js +664 -0
- package/dist/src/output/receipt-projection.js.map +1 -0
- package/dist/src/output/skill-invocation-notices.d.ts +18 -0
- package/dist/src/output/skill-invocation-notices.js +84 -0
- package/dist/src/output/skill-invocation-notices.js.map +1 -0
- package/dist/src/platforms/antigravity-permissions.d.ts +50 -0
- package/dist/src/platforms/antigravity-permissions.js +388 -0
- package/dist/src/platforms/antigravity-permissions.js.map +1 -0
- package/dist/src/platforms/capabilities.d.ts +17 -0
- package/dist/src/platforms/capabilities.js +328 -0
- package/dist/src/platforms/capabilities.js.map +1 -0
- package/dist/src/platforms/contracts.d.ts +402 -0
- package/dist/src/platforms/contracts.js +2 -0
- package/dist/src/platforms/contracts.js.map +1 -0
- package/dist/src/platforms/cursor-workspace-hook.d.ts +28 -0
- package/dist/src/platforms/cursor-workspace-hook.js +198 -0
- package/dist/src/platforms/cursor-workspace-hook.js.map +1 -0
- package/dist/src/platforms/discovery.d.ts +98 -0
- package/dist/src/platforms/discovery.js +777 -0
- package/dist/src/platforms/discovery.js.map +1 -0
- package/dist/src/platforms/grok-permission-config.d.ts +23 -0
- package/dist/src/platforms/grok-permission-config.js +184 -0
- package/dist/src/platforms/grok-permission-config.js.map +1 -0
- package/dist/src/platforms/grok-permission-document.d.ts +4 -0
- package/dist/src/platforms/grok-permission-document.js +145 -0
- package/dist/src/platforms/grok-permission-document.js.map +1 -0
- package/dist/src/platforms/grok-permissions.d.ts +17 -0
- package/dist/src/platforms/grok-permissions.js +311 -0
- package/dist/src/platforms/grok-permissions.js.map +1 -0
- package/dist/src/platforms/host-permission-policy.d.ts +38 -0
- package/dist/src/platforms/host-permission-policy.js +86 -0
- package/dist/src/platforms/host-permission-policy.js.map +1 -0
- package/dist/src/platforms/identity.d.ts +4 -0
- package/dist/src/platforms/identity.js +22 -0
- package/dist/src/platforms/identity.js.map +1 -0
- package/dist/src/platforms/inspection-grok.d.ts +4 -0
- package/dist/src/platforms/inspection-grok.js +366 -0
- package/dist/src/platforms/inspection-grok.js.map +1 -0
- package/dist/src/platforms/inspection-native.d.ts +6 -0
- package/dist/src/platforms/inspection-native.js +373 -0
- package/dist/src/platforms/inspection-native.js.map +1 -0
- package/dist/src/platforms/inspection-opencode.d.ts +4 -0
- package/dist/src/platforms/inspection-opencode.js +98 -0
- package/dist/src/platforms/inspection-opencode.js.map +1 -0
- package/dist/src/platforms/inspection-pi.d.ts +9 -0
- package/dist/src/platforms/inspection-pi.js +482 -0
- package/dist/src/platforms/inspection-pi.js.map +1 -0
- package/dist/src/platforms/inspection-query.d.ts +24 -0
- package/dist/src/platforms/inspection-query.js +119 -0
- package/dist/src/platforms/inspection-query.js.map +1 -0
- package/dist/src/platforms/inspection.d.ts +20 -0
- package/dist/src/platforms/inspection.js +259 -0
- package/dist/src/platforms/inspection.js.map +1 -0
- package/dist/src/platforms/layout.d.ts +35 -0
- package/dist/src/platforms/layout.js +317 -0
- package/dist/src/platforms/layout.js.map +1 -0
- package/dist/src/platforms/lifecycle-native-services.d.ts +3 -0
- package/dist/src/platforms/lifecycle-native-services.js +147 -0
- package/dist/src/platforms/lifecycle-native-services.js.map +1 -0
- package/dist/src/platforms/lifecycle-native.d.ts +14 -0
- package/dist/src/platforms/lifecycle-native.js +223 -0
- package/dist/src/platforms/lifecycle-native.js.map +1 -0
- package/dist/src/platforms/lifecycle.d.ts +27 -0
- package/dist/src/platforms/lifecycle.js +567 -0
- package/dist/src/platforms/lifecycle.js.map +1 -0
- package/dist/src/platforms/opencode-permission-config.d.ts +13 -0
- package/dist/src/platforms/opencode-permission-config.js +253 -0
- package/dist/src/platforms/opencode-permission-config.js.map +1 -0
- package/dist/src/platforms/opencode-permissions.d.ts +39 -0
- package/dist/src/platforms/opencode-permissions.js +212 -0
- package/dist/src/platforms/opencode-permissions.js.map +1 -0
- package/dist/src/platforms/opencode-related-permissions.d.ts +40 -0
- package/dist/src/platforms/opencode-related-permissions.js +177 -0
- package/dist/src/platforms/opencode-related-permissions.js.map +1 -0
- package/dist/src/platforms/permission-ownership.d.ts +89 -0
- package/dist/src/platforms/permission-ownership.js +543 -0
- package/dist/src/platforms/permission-ownership.js.map +1 -0
- package/dist/src/platforms/permission-sidecar.d.ts +70 -0
- package/dist/src/platforms/permission-sidecar.js +215 -0
- package/dist/src/platforms/permission-sidecar.js.map +1 -0
- package/dist/src/platforms/projection-code-extension.d.ts +8 -0
- package/dist/src/platforms/projection-code-extension.js +126 -0
- package/dist/src/platforms/projection-code-extension.js.map +1 -0
- package/dist/src/platforms/projection-command-resources.d.ts +7 -0
- package/dist/src/platforms/projection-command-resources.js +74 -0
- package/dist/src/platforms/projection-command-resources.js.map +1 -0
- package/dist/src/platforms/projection-files.d.ts +27 -0
- package/dist/src/platforms/projection-files.js +111 -0
- package/dist/src/platforms/projection-files.js.map +1 -0
- package/dist/src/platforms/projection-marketplace.d.ts +19 -0
- package/dist/src/platforms/projection-marketplace.js +42 -0
- package/dist/src/platforms/projection-marketplace.js.map +1 -0
- package/dist/src/platforms/projection.d.ts +13 -0
- package/dist/src/platforms/projection.js +576 -0
- package/dist/src/platforms/projection.js.map +1 -0
- package/dist/src/platforms/registry.d.ts +4 -0
- package/dist/src/platforms/registry.js +30 -0
- package/dist/src/platforms/registry.js.map +1 -0
- package/dist/src/platforms/supplement-layout.d.ts +20 -0
- package/dist/src/platforms/supplement-layout.js +53 -0
- package/dist/src/platforms/supplement-layout.js.map +1 -0
- package/dist/src/platforms/supplement-state.d.ts +13 -0
- package/dist/src/platforms/supplement-state.js +93 -0
- package/dist/src/platforms/supplement-state.js.map +1 -0
- package/dist/src/portable/commands.d.ts +58 -11
- package/dist/src/portable/commands.js +99 -345
- package/dist/src/portable/commands.js.map +1 -1
- package/dist/src/portable/historical-materialization.d.ts +22 -0
- package/dist/src/portable/historical-materialization.js +124 -0
- package/dist/src/portable/historical-materialization.js.map +1 -0
- package/dist/src/portable/materializer.d.ts +29 -1
- package/dist/src/portable/materializer.js +197 -258
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/portable/recovery-layout.d.ts +17 -0
- package/dist/src/portable/recovery-layout.js +42 -0
- package/dist/src/portable/recovery-layout.js.map +1 -0
- package/dist/src/portable/recovery.d.ts +176 -0
- package/dist/src/portable/recovery.js +556 -0
- package/dist/src/portable/recovery.js.map +1 -0
- package/dist/src/portable/writer.d.ts +67 -0
- package/dist/src/portable/writer.js +321 -0
- package/dist/src/portable/writer.js.map +1 -0
- package/dist/src/recovery/coordinator.d.ts +168 -0
- package/dist/src/recovery/coordinator.js +1558 -0
- package/dist/src/recovery/coordinator.js.map +1 -0
- package/dist/src/recovery/demand.d.ts +53 -0
- package/dist/src/recovery/demand.js +189 -0
- package/dist/src/recovery/demand.js.map +1 -0
- package/dist/src/recovery/install-concurrency.d.ts +48 -0
- package/dist/src/recovery/install-concurrency.js +196 -0
- package/dist/src/recovery/install-concurrency.js.map +1 -0
- package/dist/src/recovery/interruption.d.ts +19 -0
- package/dist/src/recovery/interruption.js +43 -0
- package/dist/src/recovery/interruption.js.map +1 -0
- package/dist/src/recovery/joint-coordinator.d.ts +46 -0
- package/dist/src/recovery/joint-coordinator.js +1641 -0
- package/dist/src/recovery/joint-coordinator.js.map +1 -0
- package/dist/src/recovery/joint-demand.d.ts +72 -0
- package/dist/src/recovery/joint-demand.js +332 -0
- package/dist/src/recovery/joint-demand.js.map +1 -0
- package/dist/src/recovery/joint-install-execution.d.ts +19 -0
- package/dist/src/recovery/joint-install-execution.js +308 -0
- package/dist/src/recovery/joint-install-execution.js.map +1 -0
- package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
- package/dist/src/recovery/joint-install-native-rebase.js +67 -0
- package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
- package/dist/src/recovery/performance.d.ts +4 -0
- package/dist/src/recovery/performance.js +26 -0
- package/dist/src/recovery/performance.js.map +1 -0
- package/dist/src/recovery/receipt.d.ts +129 -0
- package/dist/src/recovery/receipt.js +91 -0
- package/dist/src/recovery/receipt.js.map +1 -0
- package/dist/src/recovery/retirement.d.ts +47 -0
- package/dist/src/recovery/retirement.js +463 -0
- package/dist/src/recovery/retirement.js.map +1 -0
- package/dist/src/recovery/status.d.ts +143 -0
- package/dist/src/recovery/status.js +1517 -0
- package/dist/src/recovery/status.js.map +1 -0
- package/dist/src/recovery/types.d.ts +85 -0
- package/dist/src/recovery/types.js +2 -0
- package/dist/src/recovery/types.js.map +1 -0
- package/dist/src/review/eval-source-input.d.ts +44 -0
- package/dist/src/review/eval-source-input.js +213 -0
- package/dist/src/review/eval-source-input.js.map +1 -0
- package/dist/src/review/platform-profile.d.ts +6 -0
- package/dist/src/review/platform-profile.js +24 -0
- package/dist/src/review/platform-profile.js.map +1 -0
- package/dist/src/review/review-profile.d.ts +20 -0
- package/dist/src/review/review-profile.js +276 -0
- package/dist/src/review/review-profile.js.map +1 -0
- package/dist/src/review/review-selection.d.ts +20 -0
- package/dist/src/review/review-selection.js +502 -0
- package/dist/src/review/review-selection.js.map +1 -0
- package/dist/src/review/review-types.d.ts +71 -0
- package/dist/src/review/review-types.js +16 -0
- package/dist/src/review/review-types.js.map +1 -0
- package/dist/src/review/skill-materialization.d.ts +65 -0
- package/dist/src/review/skill-materialization.js +228 -0
- package/dist/src/review/skill-materialization.js.map +1 -0
- package/dist/src/review/source-binding.d.ts +201 -0
- package/dist/src/review/source-binding.js +782 -0
- package/dist/src/review/source-binding.js.map +1 -0
- package/dist/src/tui/agent-management.d.ts +23 -0
- package/dist/src/tui/agent-management.js +319 -0
- package/dist/src/tui/agent-management.js.map +1 -0
- package/dist/src/tui/agent-settings.d.ts +47 -0
- package/dist/src/tui/agent-settings.js +97 -0
- package/dist/src/tui/agent-settings.js.map +1 -0
- package/dist/src/tui/catalog-freshness.d.ts +1 -0
- package/dist/src/tui/catalog-freshness.js +2 -0
- package/dist/src/tui/catalog-freshness.js.map +1 -0
- package/dist/src/tui/catalog-generation.d.ts +8 -16
- package/dist/src/tui/catalog-generation.js +97 -10
- package/dist/src/tui/catalog-generation.js.map +1 -1
- package/dist/src/tui/catalog-sources/projection.d.ts +4 -0
- package/dist/src/tui/catalog-sources/projection.js +17 -0
- package/dist/src/tui/catalog-sources/projection.js.map +1 -0
- package/dist/src/tui/catalog-sources/review.d.ts +3 -0
- package/dist/src/tui/catalog-sources/review.js +13 -0
- package/dist/src/tui/catalog-sources/review.js.map +1 -0
- package/dist/src/tui/catalog-sources/screens.d.ts +12 -0
- package/dist/src/tui/catalog-sources/screens.js +40 -0
- package/dist/src/tui/catalog-sources/screens.js.map +1 -0
- package/dist/src/tui/catalog-sources/session.d.ts +32 -0
- package/dist/src/tui/catalog-sources/session.js +300 -0
- package/dist/src/tui/catalog-sources/session.js.map +1 -0
- package/dist/src/tui/catalog-sources/types.d.ts +54 -0
- package/dist/src/tui/catalog-sources/types.js +2 -0
- package/dist/src/tui/catalog-sources/types.js.map +1 -0
- package/dist/src/tui/catalog-store-task.d.ts +16 -0
- package/dist/src/tui/catalog-store-task.js +19 -0
- package/dist/src/tui/catalog-store-task.js.map +1 -0
- package/dist/src/tui/clipboard.d.ts +13 -0
- package/dist/src/tui/clipboard.js +95 -0
- package/dist/src/tui/clipboard.js.map +1 -0
- package/dist/src/tui/components.d.ts +113 -3
- package/dist/src/tui/components.js +201 -34
- package/dist/src/tui/components.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +30 -0
- package/dist/src/tui/config-array-draft.js +51 -0
- package/dist/src/tui/config-array-draft.js.map +1 -0
- package/dist/src/tui/config-leaf-editor.d.ts +44 -0
- package/dist/src/tui/config-leaf-editor.js +227 -0
- package/dist/src/tui/config-leaf-editor.js.map +1 -0
- package/dist/src/tui/config-object-suggestions.d.ts +15 -0
- package/dist/src/tui/config-object-suggestions.js +71 -0
- package/dist/src/tui/config-object-suggestions.js.map +1 -0
- package/dist/src/tui/config-references.d.ts +38 -0
- package/dist/src/tui/config-references.js +82 -0
- package/dist/src/tui/config-references.js.map +1 -0
- package/dist/src/tui/config-suggestions.d.ts +27 -0
- package/dist/src/tui/config-suggestions.js +62 -0
- package/dist/src/tui/config-suggestions.js.map +1 -0
- package/dist/src/tui/config-value-presentation.d.ts +21 -0
- package/dist/src/tui/config-value-presentation.js +129 -0
- package/dist/src/tui/config-value-presentation.js.map +1 -0
- package/dist/src/tui/console-app-v4.d.ts +14 -5
- package/dist/src/tui/console-app-v4.js +10344 -2133
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/content-item-card.d.ts +13 -0
- package/dist/src/tui/content-item-card.js +51 -0
- package/dist/src/tui/content-item-card.js.map +1 -0
- package/dist/src/tui/controller-runtime.d.ts +8 -3
- package/dist/src/tui/controller-runtime.js +2301 -842
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +664 -79
- package/dist/src/tui/controller.js +3670 -830
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/dependency-graph-view.d.ts +39 -0
- package/dist/src/tui/dependency-graph-view.js +121 -0
- package/dist/src/tui/dependency-graph-view.js.map +1 -0
- package/dist/src/tui/dependency-graph.d.ts +81 -0
- package/dist/src/tui/dependency-graph.js +452 -0
- package/dist/src/tui/dependency-graph.js.map +1 -0
- package/dist/src/tui/deployment-view.d.ts +13 -0
- package/dist/src/tui/deployment-view.js +155 -0
- package/dist/src/tui/deployment-view.js.map +1 -0
- package/dist/src/tui/diagnostic-projection.d.ts +31 -0
- package/dist/src/tui/diagnostic-projection.js +681 -0
- package/dist/src/tui/diagnostic-projection.js.map +1 -0
- package/dist/src/tui/diagnostics.d.ts +6 -2
- package/dist/src/tui/diagnostics.js +14 -2
- package/dist/src/tui/diagnostics.js.map +1 -1
- package/dist/src/tui/entity-cards.d.ts +56 -0
- package/dist/src/tui/entity-cards.js +321 -0
- package/dist/src/tui/entity-cards.js.map +1 -0
- package/dist/src/tui/glossary.d.ts +25 -0
- package/dist/src/tui/glossary.js +78 -0
- package/dist/src/tui/glossary.js.map +1 -0
- package/dist/src/tui/guided-setup.d.ts +25 -0
- package/dist/src/tui/guided-setup.js +101 -0
- package/dist/src/tui/guided-setup.js.map +1 -0
- package/dist/src/tui/index.d.ts +5 -1
- package/dist/src/tui/index.js +4 -1
- package/dist/src/tui/index.js.map +1 -1
- package/dist/src/tui/input-display.d.ts +1 -0
- package/dist/src/tui/input-display.js +23 -1
- package/dist/src/tui/input-display.js.map +1 -1
- package/dist/src/tui/keys.d.ts +44 -0
- package/dist/src/tui/keys.js +43 -15
- package/dist/src/tui/keys.js.map +1 -1
- package/dist/src/tui/lifecycle-action-view.d.ts +6 -0
- package/dist/src/tui/lifecycle-action-view.js +36 -0
- package/dist/src/tui/lifecycle-action-view.js.map +1 -0
- package/dist/src/tui/model.d.ts +187 -52
- package/dist/src/tui/model.js +1202 -426
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-diagnostic-screens.d.ts +8 -0
- package/dist/src/tui/operation-diagnostic-screens.js +76 -0
- package/dist/src/tui/operation-diagnostic-screens.js.map +1 -0
- package/dist/src/tui/operation-history.d.ts +91 -0
- package/dist/src/tui/operation-history.js +167 -0
- package/dist/src/tui/operation-history.js.map +1 -0
- package/dist/src/tui/operation-review-planner.d.ts +28 -0
- package/dist/src/tui/operation-review-planner.js +1456 -0
- package/dist/src/tui/operation-review-planner.js.map +1 -0
- package/dist/src/tui/plugin-content.d.ts +33 -0
- package/dist/src/tui/plugin-content.js +245 -0
- package/dist/src/tui/plugin-content.js.map +1 -0
- package/dist/src/tui/plugin-detail.d.ts +75 -0
- package/dist/src/tui/plugin-detail.js +267 -0
- package/dist/src/tui/plugin-detail.js.map +1 -0
- package/dist/src/tui/plugin-write-task.d.ts +69 -0
- package/dist/src/tui/plugin-write-task.js +286 -0
- package/dist/src/tui/plugin-write-task.js.map +1 -0
- package/dist/src/tui/prompt.js +4 -15
- package/dist/src/tui/prompt.js.map +1 -1
- package/dist/src/tui/query-header.d.ts +30 -0
- package/dist/src/tui/query-header.js +40 -0
- package/dist/src/tui/query-header.js.map +1 -0
- package/dist/src/tui/reader.d.ts +38 -0
- package/dist/src/tui/reader.js +49 -0
- package/dist/src/tui/reader.js.map +1 -0
- package/dist/src/tui/router.d.ts +182 -39
- package/dist/src/tui/router.js +338 -50
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/scoped-flow.d.ts +49 -0
- package/dist/src/tui/scoped-flow.js +212 -0
- package/dist/src/tui/scoped-flow.js.map +1 -0
- package/dist/src/tui/scoped-inventory.d.ts +131 -0
- package/dist/src/tui/scoped-inventory.js +280 -0
- package/dist/src/tui/scoped-inventory.js.map +1 -0
- package/dist/src/tui/screen-registry.d.ts +696 -0
- package/dist/src/tui/screen-registry.js +226 -0
- package/dist/src/tui/screen-registry.js.map +1 -0
- package/dist/src/tui/session-console-app.d.ts +8 -0
- package/dist/src/tui/session-console-app.js +24 -0
- package/dist/src/tui/session-console-app.js.map +1 -0
- package/dist/src/tui/session-host.d.ts +45 -0
- package/dist/src/tui/session-host.js +219 -0
- package/dist/src/tui/session-host.js.map +1 -0
- package/dist/src/tui/source-detail-card.d.ts +29 -0
- package/dist/src/tui/source-detail-card.js +45 -0
- package/dist/src/tui/source-detail-card.js.map +1 -0
- package/dist/src/tui/theme.d.ts +12 -0
- package/dist/src/tui/theme.js +12 -0
- package/dist/src/tui/theme.js.map +1 -1
- package/dist/src/tui/viewport.d.ts +1 -0
- package/dist/src/tui/viewport.js +23 -0
- package/dist/src/tui/viewport.js.map +1 -1
- package/dist/src/tui/wizard.js +37 -13
- package/dist/src/tui/wizard.js.map +1 -1
- package/dist/src/types.d.ts +177 -85
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/agent-version.d.ts +10 -4
- package/dist/src/utils/agent-version.js +6 -8
- package/dist/src/utils/agent-version.js.map +1 -1
- package/dist/src/utils/artifact-plan.d.ts +17 -24
- package/dist/src/utils/artifact-plan.js +59 -436
- package/dist/src/utils/artifact-plan.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +61 -89
- package/dist/src/utils/artifact-renderer.js +187 -364
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/artifact-request.d.ts +21 -0
- package/dist/src/utils/artifact-request.js +57 -0
- package/dist/src/utils/artifact-request.js.map +1 -0
- package/dist/src/utils/artifact-sources.d.ts +4 -8
- package/dist/src/utils/artifact-sources.js +15 -6
- package/dist/src/utils/artifact-sources.js.map +1 -1
- package/dist/src/utils/aw-home-mutation-lock.js +2 -1
- package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +59 -173
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/catalog-capability-projection.d.ts +8 -0
- package/dist/src/utils/catalog-capability-projection.js +14 -0
- package/dist/src/utils/catalog-capability-projection.js.map +1 -0
- package/dist/src/utils/catalog-digests.d.ts +2 -9
- package/dist/src/utils/catalog-digests.js +7 -45
- package/dist/src/utils/catalog-digests.js.map +1 -1
- package/dist/src/utils/catalog-generation-error.d.ts +4 -1
- package/dist/src/utils/catalog-generation-error.js +2 -0
- package/dist/src/utils/catalog-generation-error.js.map +1 -1
- package/dist/src/utils/catalog-generation-resolver.d.ts +32 -3
- package/dist/src/utils/catalog-generation-resolver.js +182 -40
- package/dist/src/utils/catalog-generation-resolver.js.map +1 -1
- package/dist/src/utils/catalog-generation-service.d.ts +142 -2
- package/dist/src/utils/catalog-generation-service.js +1146 -171
- package/dist/src/utils/catalog-generation-service.js.map +1 -1
- package/dist/src/utils/catalog-generation-state.d.ts +5 -0
- package/dist/src/utils/catalog-generation-state.js +25 -1
- package/dist/src/utils/catalog-generation-state.js.map +1 -1
- package/dist/src/utils/catalog-generation-store.d.ts +29 -2
- package/dist/src/utils/catalog-generation-store.js +240 -36
- package/dist/src/utils/catalog-generation-store.js.map +1 -1
- package/dist/src/utils/catalog-manifest-v7.d.ts +5 -0
- package/dist/src/utils/{catalog-manifest-v6.js → catalog-manifest-v7.js} +23 -23
- package/dist/src/utils/{catalog-manifest-v6.js.map → catalog-manifest-v7.js.map} +1 -1
- package/dist/src/utils/catalog-operation-context.d.ts +27 -3
- package/dist/src/utils/catalog-operation-context.js +75 -4
- package/dist/src/utils/catalog-operation-context.js.map +1 -1
- package/dist/src/utils/catalog-public-error.js +7 -0
- package/dist/src/utils/catalog-public-error.js.map +1 -1
- package/dist/src/utils/catalog-runtime-projection.d.ts +4 -3
- package/dist/src/utils/catalog-runtime-projection.js.map +1 -1
- package/dist/src/utils/catalog-snapshot.d.ts +5 -2
- package/dist/src/utils/catalog-snapshot.js +4 -1
- package/dist/src/utils/catalog-snapshot.js.map +1 -1
- package/dist/src/utils/catalog-source-impact.d.ts +21 -0
- package/dist/src/utils/catalog-source-impact.js +344 -0
- package/dist/src/utils/catalog-source-impact.js.map +1 -0
- package/dist/src/utils/catalog-source-references.d.ts +22 -8
- package/dist/src/utils/catalog-source-references.js +457 -365
- package/dist/src/utils/catalog-source-references.js.map +1 -1
- package/dist/src/utils/catalog-sources.d.ts +14 -1
- package/dist/src/utils/catalog-sources.js +155 -11
- package/dist/src/utils/catalog-sources.js.map +1 -1
- package/dist/src/utils/codex-executable-discovery.d.ts +28 -0
- package/dist/src/utils/codex-executable-discovery.js +431 -0
- package/dist/src/utils/codex-executable-discovery.js.map +1 -0
- package/dist/src/utils/codex-manager.d.ts +23 -42
- package/dist/src/utils/codex-manager.js +79 -767
- package/dist/src/utils/codex-manager.js.map +1 -1
- package/dist/src/utils/codex-marketplace-path.d.ts +5 -0
- package/dist/src/utils/codex-marketplace-path.js +45 -0
- package/dist/src/utils/codex-marketplace-path.js.map +1 -0
- package/dist/src/utils/codex-native-observation.d.ts +55 -0
- package/dist/src/utils/codex-native-observation.js +198 -0
- package/dist/src/utils/codex-native-observation.js.map +1 -0
- package/dist/src/utils/codex-reconciler.d.ts +6 -14
- package/dist/src/utils/codex-reconciler.js +45 -50
- package/dist/src/utils/codex-reconciler.js.map +1 -1
- package/dist/src/utils/codex-shared-native.d.ts +28 -39
- package/dist/src/utils/codex-shared-native.js +92 -57
- package/dist/src/utils/codex-shared-native.js.map +1 -1
- package/dist/src/utils/codex-skill-staging.d.ts +4 -3
- package/dist/src/utils/codex-skill-staging.js.map +1 -1
- package/dist/src/utils/codex-skills-root.d.ts +4 -0
- package/dist/src/utils/codex-skills-root.js +25 -0
- package/dist/src/utils/codex-skills-root.js.map +1 -0
- package/dist/src/utils/codex-surface-analysis.d.ts +8 -3
- package/dist/src/utils/codex-surface-analysis.js +35 -62
- package/dist/src/utils/codex-surface-analysis.js.map +1 -1
- package/dist/src/utils/component-command-preparation.d.ts +31 -0
- package/dist/src/utils/component-command-preparation.js +127 -0
- package/dist/src/utils/component-command-preparation.js.map +1 -0
- package/dist/src/utils/component-gap.d.ts +4 -0
- package/dist/src/utils/component-gap.js +20 -0
- package/dist/src/utils/component-gap.js.map +1 -0
- package/dist/src/utils/component-resources.d.ts +51 -0
- package/dist/src/utils/component-resources.js +320 -0
- package/dist/src/utils/component-resources.js.map +1 -0
- package/dist/src/utils/config-platforms.d.ts +21 -0
- package/dist/src/utils/config-platforms.js +51 -0
- package/dist/src/utils/config-platforms.js.map +1 -0
- package/dist/src/utils/dynamic-skill-tree.d.ts +18 -6
- package/dist/src/utils/dynamic-skill-tree.js +33 -40
- package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
- package/dist/src/utils/git-catalog-provider.d.ts +16 -0
- package/dist/src/utils/git-catalog-provider.js +112 -6
- package/dist/src/utils/git-catalog-provider.js.map +1 -1
- package/dist/src/utils/inventory-recovery-diagnostic.d.ts +4 -0
- package/dist/src/utils/inventory-recovery-diagnostic.js +15 -0
- package/dist/src/utils/inventory-recovery-diagnostic.js.map +1 -0
- package/dist/src/utils/local-marketplace.d.ts +17 -12
- package/dist/src/utils/local-marketplace.js +85 -195
- package/dist/src/utils/local-marketplace.js.map +1 -1
- package/dist/src/utils/managed-command-cli-review.d.ts +53 -0
- package/dist/src/utils/managed-command-cli-review.js +431 -0
- package/dist/src/utils/managed-command-cli-review.js.map +1 -0
- package/dist/src/utils/managed-command-closure.d.ts +14 -0
- package/dist/src/utils/managed-command-closure.js +156 -0
- package/dist/src/utils/managed-command-closure.js.map +1 -0
- package/dist/src/utils/managed-command-errors.d.ts +5 -0
- package/dist/src/utils/managed-command-errors.js +10 -0
- package/dist/src/utils/managed-command-errors.js.map +1 -0
- package/dist/src/utils/managed-command-materialization.d.ts +90 -0
- package/dist/src/utils/managed-command-materialization.js +375 -0
- package/dist/src/utils/managed-command-materialization.js.map +1 -0
- package/dist/src/utils/managed-command-preparation.d.ts +30 -0
- package/dist/src/utils/managed-command-preparation.js +39 -0
- package/dist/src/utils/managed-command-preparation.js.map +1 -0
- package/dist/src/utils/managed-command-review.d.ts +33 -0
- package/dist/src/utils/managed-command-review.js +80 -0
- package/dist/src/utils/managed-command-review.js.map +1 -0
- package/dist/src/utils/managed-command-runtime.d.ts +36 -0
- package/dist/src/utils/managed-command-runtime.js +126 -0
- package/dist/src/utils/managed-command-runtime.js.map +1 -0
- package/dist/src/utils/managed-command-snapshots.d.ts +24 -0
- package/dist/src/utils/managed-command-snapshots.js +89 -0
- package/dist/src/utils/managed-command-snapshots.js.map +1 -0
- package/dist/src/utils/managed-command-store.d.ts +141 -0
- package/dist/src/utils/managed-command-store.js +839 -0
- package/dist/src/utils/managed-command-store.js.map +1 -0
- package/dist/src/utils/multi-source-catalog.d.ts +4 -0
- package/dist/src/utils/multi-source-catalog.js +7 -3
- package/dist/src/utils/multi-source-catalog.js.map +1 -1
- package/dist/src/utils/native-cli-interruption.d.ts +8 -0
- package/dist/src/utils/native-cli-interruption.js +65 -0
- package/dist/src/utils/native-cli-interruption.js.map +1 -0
- package/dist/src/utils/native-cli.d.ts +37 -6
- package/dist/src/utils/native-cli.js +523 -60
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/native-demand.d.ts +29 -0
- package/dist/src/utils/native-demand.js +4 -0
- package/dist/src/utils/native-demand.js.map +1 -0
- package/dist/src/utils/native-tool-context.d.ts +17 -0
- package/dist/src/utils/native-tool-context.js +40 -0
- package/dist/src/utils/native-tool-context.js.map +1 -0
- package/dist/src/utils/native-tool-review.d.ts +8 -0
- package/dist/src/utils/native-tool-review.js +14 -0
- package/dist/src/utils/native-tool-review.js.map +1 -0
- package/dist/src/utils/orphan-marketplace-cleanup.js +0 -2
- package/dist/src/utils/orphan-marketplace-cleanup.js.map +1 -1
- package/dist/src/utils/ownership.d.ts +111 -11
- package/dist/src/utils/ownership.js +247 -126
- package/dist/src/utils/ownership.js.map +1 -1
- package/dist/src/utils/package-content.d.ts +7 -0
- package/dist/src/utils/package-content.js +70 -0
- package/dist/src/utils/package-content.js.map +1 -0
- package/dist/src/utils/path-catalog-provider.js +2 -0
- package/dist/src/utils/path-catalog-provider.js.map +1 -1
- package/dist/src/utils/paths.d.ts +1 -1
- package/dist/src/utils/paths.js +5 -2
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/platform-empty-state.d.ts +69 -0
- package/dist/src/utils/platform-empty-state.js +226 -0
- package/dist/src/utils/platform-empty-state.js.map +1 -0
- package/dist/src/utils/platform-support.d.ts +1 -1
- package/dist/src/utils/platform-support.js +1 -1
- package/dist/src/utils/platform-support.js.map +1 -1
- package/dist/src/utils/plugin-config-command-apply.d.ts +33 -0
- package/dist/src/utils/plugin-config-command-apply.js +142 -0
- package/dist/src/utils/plugin-config-command-apply.js.map +1 -0
- package/dist/src/utils/plugin-config-diagnostics.d.ts +16 -0
- package/dist/src/utils/plugin-config-diagnostics.js +44 -0
- package/dist/src/utils/plugin-config-diagnostics.js.map +1 -0
- package/dist/src/utils/plugin-config-impact.d.ts +75 -0
- package/dist/src/utils/plugin-config-impact.js +355 -0
- package/dist/src/utils/plugin-config-impact.js.map +1 -0
- package/dist/src/utils/plugin-config-references.d.ts +96 -0
- package/dist/src/utils/plugin-config-references.js +357 -0
- package/dist/src/utils/plugin-config-references.js.map +1 -0
- package/dist/src/utils/plugin-config-suggestion-runner.d.ts +83 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js +308 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
- package/dist/src/utils/plugin-config-suggestions.d.ts +50 -0
- package/dist/src/utils/plugin-config-suggestions.js +302 -0
- package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
- package/dist/src/utils/plugin-config-write.d.ts +123 -31
- package/dist/src/utils/plugin-config-write.js +828 -399
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +192 -109
- package/dist/src/utils/plugin-config.js +970 -1150
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-dependencies.d.ts +1 -1
- package/dist/src/utils/plugin-dependencies.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +80 -127
- package/dist/src/utils/plugin-scripts.js +655 -524
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/process-lock.js +14 -5
- package/dist/src/utils/process-lock.js.map +1 -1
- package/dist/src/utils/process-tree.d.ts +2 -2
- package/dist/src/utils/process-tree.js +1 -1
- package/dist/src/utils/process-tree.js.map +1 -1
- package/dist/src/utils/project-boundary.d.ts +11 -13
- package/dist/src/utils/project-boundary.js +28 -34
- package/dist/src/utils/project-boundary.js.map +1 -1
- package/dist/src/utils/rendered-contract.js +24 -1
- package/dist/src/utils/rendered-contract.js.map +1 -1
- package/dist/src/utils/runtime-config.d.ts +18 -0
- package/dist/src/utils/runtime-config.js +64 -0
- package/dist/src/utils/runtime-config.js.map +1 -0
- package/dist/src/utils/runtime-skill-closure.d.ts +2 -2
- package/dist/src/utils/runtime-skill-closure.js +47 -6
- package/dist/src/utils/runtime-skill-closure.js.map +1 -1
- package/dist/src/utils/safe-fs.d.ts +21 -0
- package/dist/src/utils/safe-fs.js +111 -0
- package/dist/src/utils/safe-fs.js.map +1 -0
- package/dist/src/utils/safe-operation-diagnostic.d.ts +15 -0
- package/dist/src/utils/safe-operation-diagnostic.js +33 -0
- package/dist/src/utils/safe-operation-diagnostic.js.map +1 -0
- package/dist/src/utils/sensitive-content.d.ts +4 -0
- package/dist/src/utils/sensitive-content.js +36 -0
- package/dist/src/utils/sensitive-content.js.map +1 -0
- package/dist/src/utils/skill-invocation-warning.d.ts +20 -0
- package/dist/src/utils/skill-invocation-warning.js +68 -0
- package/dist/src/utils/skill-invocation-warning.js.map +1 -0
- package/dist/src/utils/state-paths.d.ts +8 -3
- package/dist/src/utils/state-paths.js +53 -16
- package/dist/src/utils/state-paths.js.map +1 -1
- package/dist/src/utils/target-eligibility.d.ts +3 -3
- package/dist/src/utils/target-eligibility.js +11 -6
- package/dist/src/utils/target-eligibility.js.map +1 -1
- package/dist/src/utils/windows-claude-shim.d.ts +7 -0
- package/dist/src/utils/windows-claude-shim.js +10 -0
- package/dist/src/utils/windows-claude-shim.js.map +1 -0
- package/dist/src/utils/windows-npm-shim.d.ts +16 -0
- package/dist/src/utils/windows-npm-shim.js +155 -0
- package/dist/src/utils/windows-npm-shim.js.map +1 -0
- package/dist/vitest.config.js +106 -9
- package/dist/vitest.config.js.map +1 -1
- package/package.json +30 -21
- package/dist/src/commands/review-publication.d.ts +0 -99
- package/dist/src/commands/review-publication.js +0 -904
- package/dist/src/commands/review-publication.js.map +0 -1
- package/dist/src/commands/sync-command.d.ts +0 -21
- package/dist/src/commands/sync-command.js +0 -206
- package/dist/src/commands/sync-command.js.map +0 -1
- package/dist/src/portable/skills-cli.d.ts +0 -43
- package/dist/src/portable/skills-cli.js +0 -148
- package/dist/src/portable/skills-cli.js.map +0 -1
- package/dist/src/utils/catalog-manifest-v6.d.ts +0 -5
- package/dist/src/utils/lifecycle-active-store.d.ts +0 -147
- package/dist/src/utils/lifecycle-active-store.js +0 -1064
- package/dist/src/utils/lifecycle-active-store.js.map +0 -1
- package/dist/src/utils/plugin-intent-state.d.ts +0 -39
- package/dist/src/utils/plugin-intent-state.js +0 -325
- package/dist/src/utils/plugin-intent-state.js.map +0 -1
- package/dist/src/utils/slash-commands.d.ts +0 -1
- package/dist/src/utils/slash-commands.js +0 -2
- 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, 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
|
|
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 =
|
|
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
|
|
638
|
-
|
|
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 ${
|
|
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
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
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
|
-
|
|
675
|
-
|
|
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
|
-
|
|
681
|
-
|
|
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
|
|
966
|
-
|
|
967
|
-
.map((
|
|
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
|
|
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', '
|
|
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
|
|
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
|
|
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)
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
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
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
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
|
|
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,55 @@ function listFilesRecursive(rootDir) {
|
|
|
1739
1106
|
walk(rootDir);
|
|
1740
1107
|
return output;
|
|
1741
1108
|
}
|
|
1742
|
-
function
|
|
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
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
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
|
|
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) &&
|
|
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
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
return id;
|
|
2015
|
-
}
|
|
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;
|
|
1133
|
+
function hasCrossPluginValueRef(value) {
|
|
1134
|
+
if (!isRecord(value))
|
|
1135
|
+
return false;
|
|
1136
|
+
if (isRecord(value.valueRef) && value.valueRef.plugin !== undefined)
|
|
1137
|
+
return true;
|
|
1138
|
+
return Object.values(value).some((child) => Array.isArray(child)
|
|
1139
|
+
? child.some(hasCrossPluginValueRef) : hasCrossPluginValueRef(child));
|
|
2024
1140
|
}
|
|
2025
|
-
function
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
return
|
|
1141
|
+
function configFieldContainsSensitiveValue(field) {
|
|
1142
|
+
if (!isRecord(field))
|
|
1143
|
+
return false;
|
|
1144
|
+
if (field.sensitive === true)
|
|
1145
|
+
return true;
|
|
1146
|
+
if (field.type !== 'object')
|
|
1147
|
+
return false;
|
|
1148
|
+
return ((isRecord(field.properties)
|
|
1149
|
+
&& Object.values(field.properties).some((child) => isRecord(child) && child.sensitive === true))
|
|
1150
|
+
|| (isRecord(field.additionalProperties)
|
|
1151
|
+
&& field.additionalProperties.sensitive === true));
|
|
2033
1152
|
}
|
|
2034
|
-
function
|
|
2035
|
-
const
|
|
2036
|
-
|
|
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;
|
|
1153
|
+
function isSkillAuthorOnlyPath(relativePath) {
|
|
1154
|
+
const [topLevel] = relativePath.split('/').filter(Boolean);
|
|
1155
|
+
return topLevel === 'evals' || topLevel === 'reports';
|
|
2042
1156
|
}
|
|
2043
|
-
function
|
|
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) {
|
|
1157
|
+
function collectArtifactSourceFiles(rootDir, fieldName, files, transform = (_relative, bytes) => bytes) {
|
|
2325
1158
|
const rootStats = fs.lstatSync(rootDir, { throwIfNoEntry: false });
|
|
2326
1159
|
if (!rootStats?.isDirectory() || rootStats.isSymbolicLink())
|
|
2327
1160
|
return;
|
|
@@ -2345,39 +1178,21 @@ function collectArtifactSourceFiles(rootDir, fieldName, files) {
|
|
|
2345
1178
|
error(`${fieldName} contains unsupported non-regular file "${relativePath}"`);
|
|
2346
1179
|
continue;
|
|
2347
1180
|
}
|
|
2348
|
-
files.set(relativePath, fs.readFileSync(absolutePath));
|
|
1181
|
+
files.set(relativePath, transform(relativePath, fs.readFileSync(absolutePath)));
|
|
2349
1182
|
}
|
|
2350
1183
|
};
|
|
2351
1184
|
visit(rootDir, '');
|
|
2352
1185
|
}
|
|
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
1186
|
async function resolveAuthorRuntimeImports(options) {
|
|
2366
|
-
const artifactImports = (options.manifest.artifacts?.
|
|
2367
|
-
key:
|
|
2368
|
-
label: `artifacts
|
|
2369
|
-
purpose: 'artifact-runtime',
|
|
2370
|
-
|
|
2371
|
-
})));
|
|
1187
|
+
const artifactImports = (options.manifest.artifacts?.runtimeImports ?? []).map((reference) => ({
|
|
1188
|
+
key: reference.name,
|
|
1189
|
+
label: `artifacts.runtimeImports ${JSON.stringify(reference.name)}`,
|
|
1190
|
+
purpose: 'artifact-runtime', platforms: [...resolveSupportedPlatforms(options.manifest)], reference,
|
|
1191
|
+
}));
|
|
2372
1192
|
const skillRuntimeImports = (options.manifest.buildConfig?.skillRuntimeFiles ?? []).flatMap((entry, importIndex) => {
|
|
2373
1193
|
if (!isRecord(entry.import))
|
|
2374
1194
|
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
|
-
];
|
|
1195
|
+
const platforms = entry.platforms?.length ? entry.platforms : [...resolveSupportedPlatforms(options.manifest)];
|
|
2381
1196
|
return platforms.length > 0 ? [{
|
|
2382
1197
|
key: importIndex,
|
|
2383
1198
|
label: `buildConfig.skillRuntimeFiles[${importIndex}].import`,
|
|
@@ -2394,25 +1209,28 @@ async function resolveAuthorRuntimeImports(options) {
|
|
|
2394
1209
|
|| typeof options.cliManifestTools?.readPluginManifest !== 'function'
|
|
2395
1210
|
|| typeof options.cliManifestTools?.discoverPlugins !== 'function'
|
|
2396
1211
|
|| typeof options.cliManifestTools?.createRuntimeResolver !== 'function') {
|
|
2397
|
-
error('
|
|
1212
|
+
error('Runtime imports require a complete built CLI and canonical same-source Git workspace.');
|
|
2398
1213
|
return null;
|
|
2399
1214
|
}
|
|
2400
1215
|
let consumer;
|
|
2401
1216
|
let resolver;
|
|
1217
|
+
let referencePlugins;
|
|
2402
1218
|
try {
|
|
2403
1219
|
const sourceSet = await options.cliManifestTools.discoverPlugins(options.repoRoot);
|
|
2404
1220
|
consumer = await options.cliManifestTools.readPluginManifest(options.pluginDir);
|
|
2405
1221
|
if (!sourceSet.some((candidate) => candidate.manifest.name === consumer.manifest.name)) {
|
|
2406
1222
|
sourceSet.push(consumer);
|
|
2407
1223
|
}
|
|
1224
|
+
referencePlugins = sourceSet;
|
|
2408
1225
|
resolver = options.cliManifestTools.createRuntimeResolver(sourceSet);
|
|
2409
1226
|
}
|
|
2410
1227
|
catch {
|
|
2411
|
-
error('
|
|
1228
|
+
error('Runtime imports could not load the canonical same-source plugin set.');
|
|
2412
1229
|
return null;
|
|
2413
1230
|
}
|
|
2414
1231
|
const resolvedArtifacts = new Map();
|
|
2415
1232
|
const resolvedSkillRuntimeFiles = new Map();
|
|
1233
|
+
let unresolved = false;
|
|
2416
1234
|
for (const request of requested) {
|
|
2417
1235
|
let value;
|
|
2418
1236
|
try {
|
|
@@ -2434,6 +1252,9 @@ async function resolveAuthorRuntimeImports(options) {
|
|
|
2434
1252
|
providerVersion: resolution.providerVersion,
|
|
2435
1253
|
exportName: resolution.name,
|
|
2436
1254
|
source: resolution.source,
|
|
1255
|
+
requiredCapabilities: resolution.requiredCapabilities,
|
|
1256
|
+
capabilitySetDigest: resolution.capabilitySetDigest,
|
|
1257
|
+
mode: fs.statSync(resolution.sourcePath).mode & 0o111 ? 0o755 : 0o644,
|
|
2437
1258
|
};
|
|
2438
1259
|
if (value && (value.digest !== current.digest
|
|
2439
1260
|
|| value.providerPluginId !== current.providerPluginId
|
|
@@ -2453,6 +1274,7 @@ async function resolveAuthorRuntimeImports(options) {
|
|
|
2453
1274
|
? JSON.stringify(request.reference.export)
|
|
2454
1275
|
: '<invalid-export>';
|
|
2455
1276
|
error(`Cannot resolve ${request.label} from provider ${provider} export ${exportName}.`);
|
|
1277
|
+
unresolved = true;
|
|
2456
1278
|
continue;
|
|
2457
1279
|
}
|
|
2458
1280
|
if (request.purpose === 'artifact-runtime')
|
|
@@ -2460,15 +1282,16 @@ async function resolveAuthorRuntimeImports(options) {
|
|
|
2460
1282
|
else
|
|
2461
1283
|
resolvedSkillRuntimeFiles.set(request.key, value);
|
|
2462
1284
|
}
|
|
2463
|
-
return {
|
|
1285
|
+
return unresolved ? null : {
|
|
2464
1286
|
artifactImports: resolvedArtifacts,
|
|
2465
1287
|
skillRuntimeImports: resolvedSkillRuntimeFiles,
|
|
1288
|
+
referencePlugins,
|
|
2466
1289
|
};
|
|
2467
1290
|
}
|
|
2468
|
-
function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runtimeImports) {
|
|
1291
|
+
function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runtimeImports, platform) {
|
|
2469
1292
|
for (const [runtimeIndex, runtimeFile] of (manifest.buildConfig?.skillRuntimeFiles ?? []).entries()) {
|
|
2470
1293
|
if (runtimeFile.skill !== skillKey
|
|
2471
|
-
|| !runtimeFile.
|
|
1294
|
+
|| (runtimeFile.platforms?.length && !runtimeFile.platforms.includes(platform)))
|
|
2472
1295
|
continue;
|
|
2473
1296
|
if (typeof runtimeFile.source === 'string') {
|
|
2474
1297
|
const sourcePath = path.join(pluginDir, normalizeRelativePath(runtimeFile.source));
|
|
@@ -2490,444 +1313,190 @@ function overlayPortableRuntimeFiles(files, manifest, pluginDir, skillKey, runti
|
|
|
2490
1313
|
}
|
|
2491
1314
|
}
|
|
2492
1315
|
}
|
|
2493
|
-
function
|
|
2494
|
-
const
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
1316
|
+
async function prepareSourceComponentFixture(root, pluginDir, manifest, runtimeImports, tools) {
|
|
1317
|
+
const packageRoot = manifest.scripts?.node?.packageRoot;
|
|
1318
|
+
if (packageRoot) {
|
|
1319
|
+
const installedModules = path.join(pluginDir, packageRoot, 'node_modules');
|
|
1320
|
+
if (fs.statSync(installedModules, { throwIfNoEntry: false })?.isDirectory()) {
|
|
1321
|
+
const destination = path.join(root, packageRoot, 'node_modules');
|
|
1322
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
1323
|
+
// Source validation uses already installed declared dependencies. It does
|
|
1324
|
+
// not install packages or publish this temporary dependency link.
|
|
1325
|
+
fs.symlinkSync(installedModules, destination, 'junction');
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
const fixtureManifest = structuredClone(manifest);
|
|
1329
|
+
for (const reference of fixtureManifest.artifacts?.runtimeImports ?? []) {
|
|
1330
|
+
const input = runtimeImports?.artifactImports.get(reference.name);
|
|
1331
|
+
if (!input)
|
|
1332
|
+
throw new Error(`Unresolved runtime input: ${reference.name}`);
|
|
1333
|
+
const relative = `./.agents-plugin/runtime-imports/${reference.name}`;
|
|
1334
|
+
const destination = path.join(root, relative);
|
|
1335
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
1336
|
+
fs.writeFileSync(destination, input.bytes, { mode: input.mode });
|
|
1337
|
+
reference.resolved = { path: relative, digest: input.digest, providerPluginId: input.providerPluginId,
|
|
1338
|
+
providerVersion: input.providerVersion, source: input.source, requiredCapabilities: input.requiredCapabilities,
|
|
1339
|
+
capabilitySetDigest: input.capabilitySetDigest };
|
|
1340
|
+
}
|
|
1341
|
+
if (manifest.nativeTools) {
|
|
1342
|
+
const reader = path.join(root, normalizeRelativePath(manifest.nativeTools.reader ?? './.aw/native-tool-reader.mjs'));
|
|
1343
|
+
fs.mkdirSync(path.dirname(reader), { recursive: true });
|
|
1344
|
+
fs.writeFileSync(reader, createNativeToolReaderSource());
|
|
1345
|
+
}
|
|
1346
|
+
// Apply the declared static source projection before the shared normalizer reads it.
|
|
1347
|
+
for (const platform of resolveSupportedPlatforms(manifest)) {
|
|
1348
|
+
if (manifest.mcpServers) {
|
|
1349
|
+
const relative = normalizeRelativePath(manifest.mcpServers);
|
|
1350
|
+
const input = fs.readFileSync(path.join(pluginDir, relative), 'utf8');
|
|
1351
|
+
const output = path.join(root, platform, relative);
|
|
1352
|
+
fs.mkdirSync(path.dirname(output), { recursive: true });
|
|
1353
|
+
fs.writeFileSync(output, renderTemplateForPlatform(manifest, relative, input, platform));
|
|
1354
|
+
}
|
|
1355
|
+
const sourceRoot = manifest.skills && path.join(pluginDir, manifest.skills);
|
|
1356
|
+
if (!sourceRoot || !fs.existsSync(sourceRoot))
|
|
2508
1357
|
continue;
|
|
2509
|
-
}
|
|
2510
|
-
|
|
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))
|
|
1358
|
+
for (const entry of fs.readdirSync(sourceRoot, { withFileTypes: true })) {
|
|
1359
|
+
if (!entry.isDirectory() || await isAuthorOnlySkillDirectory(path.join(sourceRoot, entry.name)))
|
|
2593
1360
|
continue;
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
1361
|
+
const files = new Map();
|
|
1362
|
+
collectArtifactSourceFiles(path.join(sourceRoot, entry.name), `static Skill ${entry.name}`, files, (relative, bytes) => isTemplateTextFile(relative)
|
|
1363
|
+
? Buffer.from(renderTemplateForPlatform(manifest, `${normalizeRelativePath(manifest.skills)}/${entry.name}/${relative}`, bytes.toString('utf8'), platform)) : bytes);
|
|
1364
|
+
overlayPortableRuntimeFiles(files, manifest, pluginDir, entry.name, runtimeImports, platform);
|
|
1365
|
+
for (const [relative, bytes] of files) {
|
|
1366
|
+
const output = path.join(root, platform, 'skills', entry.name, relative);
|
|
1367
|
+
fs.mkdirSync(path.dirname(output), { recursive: true });
|
|
1368
|
+
const original = path.join(sourceRoot, entry.name, relative);
|
|
1369
|
+
const projection = (manifest.buildConfig?.skillRuntimeFiles ?? []).find((file) => file.skill === entry.name && file.target === relative && (!file.platforms?.length || file.platforms.includes(platform)));
|
|
1370
|
+
const mode = projection?.source ? fs.statSync(path.join(pluginDir, projection.source)).mode
|
|
1371
|
+
: fs.existsSync(original) ? fs.statSync(original).mode : 0o644;
|
|
1372
|
+
fs.writeFileSync(output, bytes, { mode: mode & 0o111 ? 0o755 : 0o644 });
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
for (const platform of resolveSupportedPlatforms(manifest)) {
|
|
1377
|
+
const skillsRoot = path.join(root, platform, 'skills');
|
|
1378
|
+
if (!fs.existsSync(skillsRoot))
|
|
1379
|
+
continue;
|
|
1380
|
+
for (const entry of fs.readdirSync(skillsRoot, { withFileTypes: true })) {
|
|
1381
|
+
if (!entry.isDirectory())
|
|
1382
|
+
continue;
|
|
1383
|
+
const generated = (manifest.buildConfig?.generatedSkillRuntimeFiles ?? [])
|
|
1384
|
+
.filter((file) => file.skill === entry.name && (!file.platforms?.length || file.platforms.includes(platform)))
|
|
1385
|
+
.map((file) => file.target);
|
|
1386
|
+
await tools.validateRuntimeSkillClosure(path.join(skillsRoot, entry.name), { declaredGeneratedFiles: new Set(generated) });
|
|
2610
1387
|
}
|
|
2611
1388
|
}
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
}
|
|
1389
|
+
const manifestPath = path.join(root, '.agents-plugin', 'plugin.json');
|
|
1390
|
+
fs.writeFileSync(manifestPath, JSON.stringify(fixtureManifest));
|
|
1391
|
+
return { rootDir: root, manifestPath, manifest: fixtureManifest };
|
|
2615
1392
|
}
|
|
2616
|
-
function
|
|
2617
|
-
const
|
|
2618
|
-
|
|
2619
|
-
if (!root)
|
|
1393
|
+
async function validateAuthorComponentFixtures(pluginDir, sourceManifest, runtimeImports, tools, referenceContext, referencePlugins, skillValidationTools, validationOptions) {
|
|
1394
|
+
const builtBundle = validationOptions.builtBundle;
|
|
1395
|
+
if (!builtBundle && !sourceManifest.skills && !sourceManifest.artifacts && !sourceManifest.command)
|
|
2620
1396
|
return;
|
|
2621
|
-
|
|
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`);
|
|
1397
|
+
if (runtimeImports === null)
|
|
2627
1398
|
return;
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
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
|
-
}
|
|
1399
|
+
const tempRoot = fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()), 'aw-author-components-'));
|
|
1400
|
+
let commandPackage;
|
|
1401
|
+
try {
|
|
1402
|
+
const root = path.join(tempRoot, 'plugin');
|
|
1403
|
+
if (builtBundle) {
|
|
1404
|
+
// Preserve the renderer's shipped dependencies without exposing the publication snapshot to writes.
|
|
1405
|
+
fs.cpSync(builtBundle, root, { recursive: true });
|
|
2700
1406
|
}
|
|
2701
|
-
else
|
|
2702
|
-
|
|
1407
|
+
else {
|
|
1408
|
+
fs.cpSync(pluginDir, root, {
|
|
1409
|
+
recursive: true, filter: (source) => !['.git', 'node_modules'].includes(path.basename(source)),
|
|
1410
|
+
});
|
|
2703
1411
|
}
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
1412
|
+
const fixture = builtBundle
|
|
1413
|
+
? await tools.readPluginManifest(root, { mode: 'bundle' })
|
|
1414
|
+
: await prepareSourceComponentFixture(root, pluginDir, sourceManifest, runtimeImports, tools);
|
|
1415
|
+
const { manifest } = fixture;
|
|
1416
|
+
if (manifest.name !== sourceManifest.name)
|
|
1417
|
+
throw new Error('Built bundle plugin does not match the source plugin.');
|
|
1418
|
+
const plugin = { ...fixture, sourceId: 'authoring',
|
|
1419
|
+
sourceIdentity: `sha256:${createHash('sha256').update(fs.realpathSync(pluginDir)).digest('hex')}` };
|
|
1420
|
+
const plugins = [plugin, ...(referencePlugins ?? runtimeImports?.referencePlugins ?? []).filter((entry) => entry.manifest.name !== manifest.name)];
|
|
1421
|
+
const env = await tools.createIsolatedSkillEnv(process.env, path.join(tempRoot, 'state'));
|
|
1422
|
+
if (manifest.command) {
|
|
1423
|
+
commandPackage = await tools.prepareManagedCommandPackage({ plugin, referencePlugins: plugins,
|
|
1424
|
+
operation: { kind: 'materialize' }, cwd: pluginDir, env });
|
|
1425
|
+
}
|
|
1426
|
+
for (const platform of resolveSupportedPlatforms(manifest)) {
|
|
1427
|
+
for (const scope of ['user', 'project']) {
|
|
1428
|
+
const definition = compilePluginConfigDefinition(manifest.config ?? { fields: {} }, platform);
|
|
1429
|
+
const values = defaultConfigValues(manifest, platform);
|
|
1430
|
+
const references = referenceContext ? { ...referenceContext, platform, plugins: Object.fromEntries(Object.entries(referenceContext.plugins).map(([name, entry]) => [name, { ...entry,
|
|
1431
|
+
definition: compilePluginConfigDefinition(entry.definition, platform),
|
|
1432
|
+
values: defaultConfigValues({ config: entry.definition }, platform) }])) } : undefined;
|
|
1433
|
+
const config = { mode: 'artifact-render', targetScope: scope, definition, schema: definition.fields, values,
|
|
1434
|
+
sources: Object.fromEntries(Object.keys(values).map((key) => [key, 'default'])),
|
|
1435
|
+
issues: [], stores: {}, referenceContext: references };
|
|
1436
|
+
try {
|
|
1437
|
+
const prepared = await tools.materializeProfilePluginComponents({ plugin, plugins, platform, scope,
|
|
1438
|
+
cwd: pluginDir, env, outputRoot: path.join(tempRoot, `${platform}-${scope}`), config,
|
|
1439
|
+
commandRecord: manifest.command?.platforms.includes(platform) ? commandPackage?.record : null });
|
|
1440
|
+
if (prepared.skills.length && !skillValidationTools)
|
|
1441
|
+
throw new Error('Prepared Skills require the shared CLI Skill validator.');
|
|
1442
|
+
for (const skill of prepared.skills) {
|
|
1443
|
+
// These directories retain the component's logical name. Native host
|
|
1444
|
+
// namespacing belongs to the separate platform projection.
|
|
1445
|
+
const sourceName = `component ${skill.id} (${platform}/${scope}) SKILL.md`;
|
|
1446
|
+
const parsed = skillValidationTools.parseSkillFrontmatter(fs.readFileSync(path.join(skill.path, 'SKILL.md'), 'utf8'), sourceName);
|
|
1447
|
+
for (const entry of parsed.errors)
|
|
1448
|
+
error(`${entry.path} [${entry.code}] ${entry.message}`);
|
|
1449
|
+
if (parsed.frontmatter) {
|
|
1450
|
+
for (const entry of skillValidationTools.validateSkillFrontmatter(parsed.frontmatter, {
|
|
1451
|
+
profile: selectSkillFrontmatterProfile(validationOptions, platform), expectedName: skill.name, sourcePath: sourceName,
|
|
1452
|
+
}))
|
|
1453
|
+
error(`${entry.path} [${entry.code}] ${entry.message}`);
|
|
2724
1454
|
}
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
}
|
|
1455
|
+
}
|
|
1456
|
+
for (const unit of prepared.preparation)
|
|
1457
|
+
for (const gap of unit.unmet) {
|
|
1458
|
+
warn(`component unmet (${platform}/${unit.renderScope}): ${gap.id} [${gap.reasonCode}] ${JSON.stringify(gap.requiredFeatures)}`);
|
|
2730
1459
|
}
|
|
1460
|
+
}
|
|
1461
|
+
catch (cause) {
|
|
1462
|
+
const pending = (manifest.buildConfig?.generatedSkillRuntimeFiles ?? []).filter((file) => (!file.platforms?.length || file.platforms.includes(platform))
|
|
1463
|
+
&& !fs.existsSync(path.join(root, platform, 'skills', file.skill, file.target)));
|
|
1464
|
+
if (!builtBundle && cause.message.startsWith('Invalid runtime Skill closure:') && cause.message.endsWith(' is missing.')
|
|
1465
|
+
&& pending.some((file) => cause.message.includes(JSON.stringify(file.target)))) {
|
|
1466
|
+
warn(`component profile unverified (${platform}/${scope}): declared generated runtime files require a staging build; ${cause.message}`);
|
|
2731
1467
|
}
|
|
1468
|
+
else
|
|
1469
|
+
error(`component profile fixture (${platform}/${scope}): ${cause.message}`);
|
|
2732
1470
|
}
|
|
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
1471
|
}
|
|
2744
1472
|
}
|
|
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
1473
|
}
|
|
2755
|
-
|
|
2756
|
-
|
|
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
|
-
}
|
|
1474
|
+
catch (cause) {
|
|
1475
|
+
error(`author component preparation: ${cause.message}`);
|
|
2897
1476
|
}
|
|
2898
1477
|
finally {
|
|
1478
|
+
try {
|
|
1479
|
+
await commandPackage?.cleanup();
|
|
1480
|
+
}
|
|
1481
|
+
catch (cause) {
|
|
1482
|
+
error(`author component cleanup: ${cause.message}`);
|
|
1483
|
+
}
|
|
2899
1484
|
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
2900
1485
|
}
|
|
2901
1486
|
}
|
|
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
1487
|
function validateScriptsLightweight(pluginDir, manifest) {
|
|
2915
|
-
validateConfigSchemaLightweight(manifest.config);
|
|
1488
|
+
validateConfigSchemaLightweight(manifest.config, manifest);
|
|
2916
1489
|
if (manifest.scripts === undefined)
|
|
2917
1490
|
return null;
|
|
2918
1491
|
const scripts = expectRecord(manifest.scripts, 'scripts');
|
|
2919
1492
|
if (!scripts)
|
|
2920
1493
|
return null;
|
|
2921
|
-
validateAllowedKeys(scripts, 'scripts', ['
|
|
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
|
-
}
|
|
1494
|
+
validateAllowedKeys(scripts, 'scripts', ['preApply', 'helpers', 'node', 'artifacts', 'config', 'tests']);
|
|
2928
1495
|
const runtimeNodeEntries = [];
|
|
2929
1496
|
let artifactRenderEntry = null;
|
|
2930
1497
|
let packageMeta = null;
|
|
1498
|
+
const nativeToolReader = manifest.nativeTools ? normalizeRelativePath(manifest.nativeTools.reader ?? './.aw/native-tool-reader.mjs') : undefined;
|
|
1499
|
+
const runtimeConfigSkillRoots = (manifest.artifacts?.sourceDirs ?? []).map(normalizeRelativePath);
|
|
2931
1500
|
if (scripts.helpers !== undefined) {
|
|
2932
1501
|
const helpers = expectRecord(scripts.helpers, 'scripts.helpers');
|
|
2933
1502
|
if (helpers) {
|
|
@@ -2941,19 +1510,30 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
2941
1510
|
runtimeNodeEntries.push({ path: helperPath, fieldName: 'scripts.helpers.config' });
|
|
2942
1511
|
}
|
|
2943
1512
|
}
|
|
2944
|
-
if (scripts.
|
|
2945
|
-
const
|
|
2946
|
-
if (
|
|
2947
|
-
validateAllowedKeys(
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
}
|
|
2953
|
-
validateLifecycleDefinition(pluginDir, definition, `scripts.lifecycle.${eventName}`, runtimeNodeEntries);
|
|
1513
|
+
if (scripts.preApply !== undefined) {
|
|
1514
|
+
const preApply = expectRecord(scripts.preApply, 'scripts.preApply');
|
|
1515
|
+
if (preApply) {
|
|
1516
|
+
validateAllowedKeys(preApply, 'scripts.preApply', ['path', 'timeoutMs']);
|
|
1517
|
+
const preApplyPath = normalizePluginScriptPath(pluginDir, preApply.path, 'scripts.preApply.path');
|
|
1518
|
+
validateDeclaredScriptFile(pluginDir, preApplyPath, 'scripts.preApply.path');
|
|
1519
|
+
if (preApplyPath && !isNodeRunnablePath(preApplyPath)) {
|
|
1520
|
+
error('scripts.preApply.path must use a Node runnable extension (.js, .mjs, or .cjs)');
|
|
2954
1521
|
}
|
|
1522
|
+
if (preApply.timeoutMs !== undefined && (!Number.isInteger(preApply.timeoutMs)
|
|
1523
|
+
|| preApply.timeoutMs < SCRIPT_TIMEOUT_MIN_MS || preApply.timeoutMs > SCRIPT_TIMEOUT_MAX_MS)) {
|
|
1524
|
+
error(`scripts.preApply.timeoutMs must be an integer between ${SCRIPT_TIMEOUT_MIN_MS} and ${SCRIPT_TIMEOUT_MAX_MS}`);
|
|
1525
|
+
}
|
|
1526
|
+
if (preApplyPath)
|
|
1527
|
+
runtimeNodeEntries.push({ path: preApplyPath, fieldName: 'scripts.preApply.path' });
|
|
2955
1528
|
}
|
|
2956
1529
|
}
|
|
1530
|
+
const configSuggestions = scripts.config?.suggestions;
|
|
1531
|
+
if (configSuggestions) {
|
|
1532
|
+
// Core owns the shape, timeout and path contract for this normalized declaration.
|
|
1533
|
+
const fieldName = 'scripts.config.suggestions.path';
|
|
1534
|
+
validateDeclaredScriptFile(pluginDir, configSuggestions.path, fieldName);
|
|
1535
|
+
runtimeNodeEntries.push({ path: configSuggestions.path, fieldName });
|
|
1536
|
+
}
|
|
2957
1537
|
if (scripts.node !== undefined) {
|
|
2958
1538
|
const node = expectRecord(scripts.node, 'scripts.node');
|
|
2959
1539
|
if (node) {
|
|
@@ -2971,6 +1551,8 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
2971
1551
|
label: 'scripts.node.build import contract',
|
|
2972
1552
|
packageMeta,
|
|
2973
1553
|
allowDevDependencies: true,
|
|
1554
|
+
runtimeConfigSkillRoots,
|
|
1555
|
+
nativeToolReader,
|
|
2974
1556
|
});
|
|
2975
1557
|
}
|
|
2976
1558
|
}
|
|
@@ -3020,6 +1602,9 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
3020
1602
|
label: 'scripts.tests.node import contract',
|
|
3021
1603
|
packageMeta,
|
|
3022
1604
|
allowDevDependencies: true,
|
|
1605
|
+
runtimeConfigSkillRoots,
|
|
1606
|
+
nativeToolReader,
|
|
1607
|
+
injectedCommandReaders: getCommandPackageInjectedReaders(manifest),
|
|
3023
1608
|
});
|
|
3024
1609
|
}
|
|
3025
1610
|
}
|
|
@@ -3029,6 +1614,8 @@ function validateScriptsLightweight(pluginDir, manifest) {
|
|
|
3029
1614
|
label: 'runtime Node import contract',
|
|
3030
1615
|
packageMeta,
|
|
3031
1616
|
allowDevDependencies: false,
|
|
1617
|
+
runtimeConfigSkillRoots,
|
|
1618
|
+
nativeToolReader,
|
|
3032
1619
|
});
|
|
3033
1620
|
return artifactRenderEntry;
|
|
3034
1621
|
}
|
|
@@ -3050,55 +1637,6 @@ function validateMcpContent(pluginDir, manifest) {
|
|
|
3050
1637
|
error(`${manifest.mcpServers} is not valid JSON: ${e.message}`);
|
|
3051
1638
|
}
|
|
3052
1639
|
}
|
|
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
1640
|
function validateExtensionNameUniqueness(manifest) {
|
|
3103
1641
|
if (!manifest.extensions)
|
|
3104
1642
|
return;
|
|
@@ -3152,14 +1690,17 @@ function validateOpenAiYaml(openaiYamlPath, skillName, required, manifest, plugi
|
|
|
3152
1690
|
error(`${fieldName} shared validation failed: ${e.message}`);
|
|
3153
1691
|
}
|
|
3154
1692
|
}
|
|
3155
|
-
function
|
|
1693
|
+
function selectSkillFrontmatterProfile(options, platform) {
|
|
1694
|
+
return options.strictAgentSkills ? 'portable-agent-skills'
|
|
1695
|
+
: platform === 'claude' && options.claudeSkillProfile === 'minimum'
|
|
1696
|
+
? 'claude-2.1.88' : 'claude-current';
|
|
1697
|
+
}
|
|
1698
|
+
async function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
3156
1699
|
if (!manifest.skills)
|
|
3157
1700
|
return;
|
|
3158
1701
|
const skillsDir = path.join(pluginDir, manifest.skills);
|
|
3159
1702
|
if (!fs.existsSync(skillsDir))
|
|
3160
1703
|
return;
|
|
3161
|
-
const requiresCodexMetadata = isCodexTargeted(manifest);
|
|
3162
|
-
const targetsClaude = isClaudeTargeted(manifest);
|
|
3163
1704
|
const skillDirs = fs
|
|
3164
1705
|
.readdirSync(skillsDir, { withFileTypes: true })
|
|
3165
1706
|
.filter((d) => d.isDirectory());
|
|
@@ -3167,6 +1708,12 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3167
1708
|
error('skills directory exists but contains no skill subdirectories');
|
|
3168
1709
|
}
|
|
3169
1710
|
for (const dir of skillDirs) {
|
|
1711
|
+
if (await isAuthorOnlySkillDirectory(path.join(skillsDir, dir.name)))
|
|
1712
|
+
continue;
|
|
1713
|
+
const staticPlatforms = [...resolveSupportedPlatforms(manifest)];
|
|
1714
|
+
if (staticPlatforms.length === 0)
|
|
1715
|
+
continue;
|
|
1716
|
+
const requiresCodexMetadata = staticPlatforms.includes('codex');
|
|
3170
1717
|
const skillPath = path.join(skillsDir, dir.name);
|
|
3171
1718
|
const skillMdPath = path.join(skillPath, 'SKILL.md');
|
|
3172
1719
|
const openaiYamlPath = path.join(skillPath, 'agents', 'openai.yaml');
|
|
@@ -3180,9 +1727,23 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3180
1727
|
if (lineCount >= MAX_SKILL_LINES) {
|
|
3181
1728
|
warn(`skills/${dir.name}/SKILL.md has ${lineCount} lines; Agent Skills recommends keeping SKILL.md under ${MAX_SKILL_LINES} lines`);
|
|
3182
1729
|
}
|
|
3183
|
-
const variants =
|
|
1730
|
+
const variants = [];
|
|
1731
|
+
for (const platform of staticPlatforms) {
|
|
1732
|
+
try {
|
|
1733
|
+
variants.push({ platform, content: renderTemplateForPlatform(manifest, skillMdRelativePath, content, platform) });
|
|
1734
|
+
}
|
|
1735
|
+
catch (cause) {
|
|
1736
|
+
error(`${skillMdRelativePath} (${platform} render): ${cause.message}`);
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
const validatedVariants = new Set();
|
|
3184
1740
|
for (const variant of variants) {
|
|
3185
|
-
const
|
|
1741
|
+
const profile = selectSkillFrontmatterProfile(options, variant.platform);
|
|
1742
|
+
const key = JSON.stringify([profile, variant.content]);
|
|
1743
|
+
if (validatedVariants.has(key))
|
|
1744
|
+
continue;
|
|
1745
|
+
validatedVariants.add(key);
|
|
1746
|
+
const sourceName = templateIncludesPath(manifest, skillMdRelativePath)
|
|
3186
1747
|
? `skills/${dir.name}/SKILL.md (${variant.platform} render)`
|
|
3187
1748
|
: `skills/${dir.name}/SKILL.md`;
|
|
3188
1749
|
if (!skillValidationTools) {
|
|
@@ -3194,11 +1755,8 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3194
1755
|
error(`${entry.path} [${entry.code}] ${entry.message}`);
|
|
3195
1756
|
}
|
|
3196
1757
|
if (parsed.frontmatter) {
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
: options.claudeSkillProfile === 'current'
|
|
3200
|
-
? 'claude-current'
|
|
3201
|
-
: 'claude-2.1.88';
|
|
1758
|
+
// Source metadata preserves requested behavior. Host support is checked
|
|
1759
|
+
// later by the selected component profile, including explicit unmet.
|
|
3202
1760
|
const diagnostics = skillValidationTools.validateSkillFrontmatter(parsed.frontmatter, {
|
|
3203
1761
|
profile,
|
|
3204
1762
|
expectedName: dir.name,
|
|
@@ -3216,223 +1774,17 @@ function validateSkills(pluginDir, manifest, options, skillValidationTools) {
|
|
|
3216
1774
|
}
|
|
3217
1775
|
}
|
|
3218
1776
|
}
|
|
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
1777
|
// ---------------------------------------------------------------------------
|
|
3426
1778
|
// Main
|
|
3427
1779
|
// ---------------------------------------------------------------------------
|
|
3428
1780
|
function printUsage() {
|
|
3429
1781
|
console.log(`Usage:
|
|
3430
|
-
aw plugin validate <plugin-directory> [options]
|
|
1782
|
+
aw dev plugin validate <plugin-directory> [options]
|
|
3431
1783
|
|
|
3432
1784
|
Options:
|
|
3433
1785
|
--strict-agent-skills Allow only Agent Skills portable core frontmatter.
|
|
3434
1786
|
--claude-skill-profile <minimum|current>
|
|
3435
|
-
Validate
|
|
1787
|
+
Validate current source fields (default), or explicitly require Claude 2.1.88 fields.
|
|
3436
1788
|
--version-base <git-ref> Compare the production bundle against this Git base. Default: HEAD.
|
|
3437
1789
|
--workspace-root <path> Workspace root. Default: current directory.
|
|
3438
1790
|
--json Emit one machine-readable JSON result to stdout.
|
|
@@ -3498,8 +1850,45 @@ async function validatePluginDir(pluginDir, options) {
|
|
|
3498
1850
|
}
|
|
3499
1851
|
}
|
|
3500
1852
|
const skillValidationTools = await tryLoadCliSkillValidationTools();
|
|
1853
|
+
const sourceConfig = manifest.config;
|
|
1854
|
+
let normalizedManifest;
|
|
1855
|
+
let referenceContext;
|
|
1856
|
+
let referencePlugins;
|
|
3501
1857
|
try {
|
|
3502
|
-
|
|
1858
|
+
normalizedManifest = await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
|
|
1859
|
+
manifest = normalizedManifest;
|
|
1860
|
+
// The Workspace is the sole source of dependency definitions and defaults.
|
|
1861
|
+
// No installed plugin or user config can complete an author fixture.
|
|
1862
|
+
if (manifest.config) {
|
|
1863
|
+
let plugins = [{ manifest, rootDir: pluginDir }];
|
|
1864
|
+
const hasCrossPluginSuggestions = getPluginConfigSuggestions(manifest.config, sourceConfig)
|
|
1865
|
+
.some((declaration) => declaration.plugin !== undefined);
|
|
1866
|
+
if (hasCrossPluginValueRef(sourceConfig) || hasCrossPluginSuggestions) {
|
|
1867
|
+
if (!options.repoRoot)
|
|
1868
|
+
throw new Error('Cross-plugin config validation requires the canonical same-source Workspace.');
|
|
1869
|
+
const workspace = await readCatalogWorkspace(options.repoRoot, {
|
|
1870
|
+
reservedImports: cliManifestTools.reservedImports,
|
|
1871
|
+
});
|
|
1872
|
+
if (!workspace.plugins.some((plugin) => plugin.manifest.name === manifest.name
|
|
1873
|
+
&& plugin.rootDir === fs.realpathSync(pluginDir))) {
|
|
1874
|
+
throw new Error('Cross-plugin config validation requires the canonical same-source Workspace plugin.');
|
|
1875
|
+
}
|
|
1876
|
+
plugins = workspace.plugins;
|
|
1877
|
+
}
|
|
1878
|
+
referencePlugins = plugins;
|
|
1879
|
+
if (hasCrossPluginSuggestions)
|
|
1880
|
+
assertPluginConfigSuggestionProviders(manifest, plugins, sourceConfig);
|
|
1881
|
+
referenceContext = {
|
|
1882
|
+
plugin: manifest.name,
|
|
1883
|
+
dependencies: manifest.dependencies ?? [],
|
|
1884
|
+
plugins: Object.fromEntries(plugins.map((plugin) => [plugin.manifest.name, {
|
|
1885
|
+
definition: plugin.manifest.config ?? { fields: {} },
|
|
1886
|
+
dependencies: plugin.manifest.dependencies ?? [],
|
|
1887
|
+
values: defaultConfigValues(plugin.manifest),
|
|
1888
|
+
}])),
|
|
1889
|
+
};
|
|
1890
|
+
assertPluginConfigReferenceSchemas(manifest.config, referenceContext, sourceConfig);
|
|
1891
|
+
}
|
|
3503
1892
|
const requirements = await cliManifestTools.resolvePluginRequirements({
|
|
3504
1893
|
pluginRoot: pluginDir,
|
|
3505
1894
|
manifest: normalizedManifest,
|
|
@@ -3523,29 +1912,34 @@ async function validatePluginDir(pluginDir, options) {
|
|
|
3523
1912
|
}
|
|
3524
1913
|
catch (e) {
|
|
3525
1914
|
error(e.message);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
if (options.builtBundle) {
|
|
1918
|
+
await validateAuthorComponentFixtures(pluginDir, manifest, undefined, cliManifestTools, referenceContext, referencePlugins, skillValidationTools, options);
|
|
1919
|
+
return;
|
|
3526
1920
|
}
|
|
3527
1921
|
validatePlatformFieldSupport(manifest);
|
|
3528
|
-
validatePortableNativeArtifactCapabilityLightweight(manifest);
|
|
3529
1922
|
validateNameMatchesDirectory(pluginDir, manifest);
|
|
3530
1923
|
validateNoBuildOutputDirs(pluginDir);
|
|
3531
1924
|
validateDeclaredNativeAssets(pluginDir, manifest);
|
|
3532
|
-
validateCanonicalSkillLayout(pluginDir, manifest);
|
|
1925
|
+
await validateCanonicalSkillLayout(pluginDir, manifest);
|
|
3533
1926
|
await validatePluginEvalManifest(pluginDir, manifest);
|
|
3534
|
-
|
|
1927
|
+
validateScriptsLightweight(pluginDir, manifest);
|
|
3535
1928
|
const runtimeImports = await resolveAuthorRuntimeImports({
|
|
3536
1929
|
pluginDir,
|
|
3537
1930
|
manifest,
|
|
3538
1931
|
repoRoot: options.repoRoot,
|
|
3539
1932
|
cliManifestTools,
|
|
3540
1933
|
});
|
|
3541
|
-
|
|
3542
|
-
|
|
1934
|
+
if (manifest.scripts?.node?.build && manifest.scripts?.artifacts?.render) {
|
|
1935
|
+
warn('Component profiles require a staging build; source validation has not verified them.');
|
|
1936
|
+
}
|
|
1937
|
+
else {
|
|
1938
|
+
await validateAuthorComponentFixtures(pluginDir, manifest, runtimeImports, cliManifestTools, referenceContext, referencePlugins, skillValidationTools, options);
|
|
1939
|
+
}
|
|
3543
1940
|
validateMcpContent(pluginDir, manifest);
|
|
3544
|
-
validateAppsContent(pluginDir, manifest);
|
|
3545
|
-
warnCodexProjectScopeLimitations(manifest);
|
|
3546
1941
|
validateExtensionNameUniqueness(manifest);
|
|
3547
|
-
validateSkills(pluginDir, manifest, options, skillValidationTools);
|
|
3548
|
-
validateSlashCommands(pluginDir, manifest);
|
|
1942
|
+
await validateSkills(pluginDir, manifest, options, skillValidationTools);
|
|
3549
1943
|
if (errors.length === 0) {
|
|
3550
1944
|
const repoRoot = resolveCanonicalRepoRoot(pluginDir, manifest.name ?? '', options.gitRoot);
|
|
3551
1945
|
if (repoRoot) {
|
|
@@ -3581,9 +1975,10 @@ function parseArgs(argv) {
|
|
|
3581
1975
|
const options = {
|
|
3582
1976
|
pluginDir: null,
|
|
3583
1977
|
strictAgentSkills: false,
|
|
3584
|
-
claudeSkillProfile: '
|
|
1978
|
+
claudeSkillProfile: 'current',
|
|
3585
1979
|
versionBase: 'HEAD',
|
|
3586
1980
|
workspaceRoot: null,
|
|
1981
|
+
builtBundle: null,
|
|
3587
1982
|
json: args.includes('--json'),
|
|
3588
1983
|
};
|
|
3589
1984
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -3620,13 +2015,16 @@ function parseArgs(argv) {
|
|
|
3620
2015
|
options.versionBase = value;
|
|
3621
2016
|
continue;
|
|
3622
2017
|
}
|
|
3623
|
-
if (arg === '--workspace-root') {
|
|
2018
|
+
if (arg === '--workspace-root' || arg === '--built-bundle') {
|
|
3624
2019
|
const value = args[index + 1];
|
|
3625
2020
|
if (!value || value.startsWith('--')) {
|
|
3626
|
-
exitCliError(
|
|
2021
|
+
exitCliError(`${arg} requires a value.`, options.json);
|
|
3627
2022
|
}
|
|
3628
2023
|
index += 1;
|
|
3629
|
-
|
|
2024
|
+
if (arg === '--workspace-root')
|
|
2025
|
+
options.workspaceRoot = value;
|
|
2026
|
+
else
|
|
2027
|
+
options.builtBundle = path.resolve(value);
|
|
3630
2028
|
continue;
|
|
3631
2029
|
}
|
|
3632
2030
|
if (!arg.startsWith('--')) {
|
|
@@ -3673,6 +2071,7 @@ async function main() {
|
|
|
3673
2071
|
repoRoot,
|
|
3674
2072
|
gitRoot,
|
|
3675
2073
|
enforceCanonicalRoot: requestedWorkspaceRoot !== null,
|
|
2074
|
+
builtBundle: args.builtBundle,
|
|
3676
2075
|
});
|
|
3677
2076
|
if (args.json) {
|
|
3678
2077
|
console.log(JSON.stringify({
|