@ai-primitives-hub/core 0.2.0 → 0.2.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/domain/bundle/version.d.ts +13 -0
- package/dist/domain/bundle/version.d.ts.map +1 -1
- package/dist/domain/bundle/version.js +27 -0
- package/dist/domain/bundle/version.js.map +1 -1
- package/dist/domain/collection/apm-release-plan.d.ts +39 -0
- package/dist/domain/collection/apm-release-plan.d.ts.map +1 -0
- package/dist/domain/collection/apm-release-plan.js +185 -0
- package/dist/domain/collection/apm-release-plan.js.map +1 -0
- package/dist/domain/collection/contribution.d.ts +126 -0
- package/dist/domain/collection/contribution.d.ts.map +1 -0
- package/dist/domain/collection/contribution.js +462 -0
- package/dist/domain/collection/contribution.js.map +1 -0
- package/dist/domain/collection/diagnostics.d.ts +166 -0
- package/dist/domain/collection/diagnostics.d.ts.map +1 -0
- package/dist/domain/collection/diagnostics.js +3 -0
- package/dist/domain/collection/diagnostics.js.map +1 -0
- package/dist/domain/collection/manifest-validator.d.ts +3 -2
- package/dist/domain/collection/manifest-validator.d.ts.map +1 -1
- package/dist/domain/collection/manifest-validator.js +99 -17
- package/dist/domain/collection/manifest-validator.js.map +1 -1
- package/dist/domain/collection/release-manifest-plan.d.ts +9 -0
- package/dist/domain/collection/release-manifest-plan.d.ts.map +1 -1
- package/dist/domain/collection/release-manifest-plan.js +45 -14
- package/dist/domain/collection/release-manifest-plan.js.map +1 -1
- package/dist/domain/collection/validate.d.ts +5 -0
- package/dist/domain/collection/validate.d.ts.map +1 -1
- package/dist/domain/collection/validate.js +7 -2
- package/dist/domain/collection/validate.js.map +1 -1
- package/dist/domain/diagnostics/primitives/catalogue.d.ts +40 -0
- package/dist/domain/diagnostics/primitives/catalogue.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/catalogue.js +78 -0
- package/dist/domain/diagnostics/primitives/catalogue.js.map +1 -0
- package/dist/domain/diagnostics/primitives/classifier.d.ts +81 -0
- package/dist/domain/diagnostics/primitives/classifier.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/classifier.js +138 -0
- package/dist/domain/diagnostics/primitives/classifier.js.map +1 -0
- package/dist/domain/diagnostics/primitives/evaluators.d.ts +138 -0
- package/dist/domain/diagnostics/primitives/evaluators.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/evaluators.js +485 -0
- package/dist/domain/diagnostics/primitives/evaluators.js.map +1 -0
- package/dist/domain/diagnostics/primitives/fixture.d.ts +97 -0
- package/dist/domain/diagnostics/primitives/fixture.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/fixture.js +265 -0
- package/dist/domain/diagnostics/primitives/fixture.js.map +1 -0
- package/dist/domain/diagnostics/primitives/index.d.ts +18 -0
- package/dist/domain/diagnostics/primitives/index.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/index.js +34 -0
- package/dist/domain/diagnostics/primitives/index.js.map +1 -0
- package/dist/domain/diagnostics/primitives/known-gaps.d.ts +50 -0
- package/dist/domain/diagnostics/primitives/known-gaps.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/known-gaps.js +148 -0
- package/dist/domain/diagnostics/primitives/known-gaps.js.map +1 -0
- package/dist/domain/diagnostics/primitives/manifest-view.d.ts +28 -0
- package/dist/domain/diagnostics/primitives/manifest-view.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/manifest-view.js +50 -0
- package/dist/domain/diagnostics/primitives/manifest-view.js.map +1 -0
- package/dist/domain/diagnostics/primitives/placements.d.ts +51 -0
- package/dist/domain/diagnostics/primitives/placements.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/placements.js +76 -0
- package/dist/domain/diagnostics/primitives/placements.js.map +1 -0
- package/dist/domain/diagnostics/primitives/planner.d.ts +60 -0
- package/dist/domain/diagnostics/primitives/planner.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/planner.js +60 -0
- package/dist/domain/diagnostics/primitives/planner.js.map +1 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.d.ts +38 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.js +173 -0
- package/dist/domain/diagnostics/primitives/plugin-projection.js.map +1 -0
- package/dist/domain/diagnostics/primitives/report.d.ts +122 -0
- package/dist/domain/diagnostics/primitives/report.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/report.js +85 -0
- package/dist/domain/diagnostics/primitives/report.js.map +1 -0
- package/dist/domain/diagnostics/primitives/sandbox.d.ts +59 -0
- package/dist/domain/diagnostics/primitives/sandbox.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/sandbox.js +193 -0
- package/dist/domain/diagnostics/primitives/sandbox.js.map +1 -0
- package/dist/domain/diagnostics/primitives/support-matrix.d.ts +36 -0
- package/dist/domain/diagnostics/primitives/support-matrix.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/support-matrix.js +69 -0
- package/dist/domain/diagnostics/primitives/support-matrix.js.map +1 -0
- package/dist/domain/diagnostics/primitives/types.d.ts +117 -0
- package/dist/domain/diagnostics/primitives/types.d.ts.map +1 -0
- package/dist/domain/diagnostics/primitives/types.js +62 -0
- package/dist/domain/diagnostics/primitives/types.js.map +1 -0
- package/dist/domain/governance/catalogue.d.ts +11 -0
- package/dist/domain/governance/catalogue.d.ts.map +1 -0
- package/dist/domain/governance/catalogue.js +45 -0
- package/dist/domain/governance/catalogue.js.map +1 -0
- package/dist/domain/governance/effective-rules.d.ts +19 -0
- package/dist/domain/governance/effective-rules.d.ts.map +1 -0
- package/dist/domain/governance/effective-rules.js +49 -0
- package/dist/domain/governance/effective-rules.js.map +1 -0
- package/dist/domain/governance/evaluate.d.ts +16 -0
- package/dist/domain/governance/evaluate.d.ts.map +1 -0
- package/dist/domain/governance/evaluate.js +34 -0
- package/dist/domain/governance/evaluate.js.map +1 -0
- package/dist/domain/governance/hub-scope.d.ts +74 -0
- package/dist/domain/governance/hub-scope.d.ts.map +1 -0
- package/dist/domain/governance/hub-scope.js +202 -0
- package/dist/domain/governance/hub-scope.js.map +1 -0
- package/dist/domain/governance/hub-scoped-inventory.d.ts +22 -0
- package/dist/domain/governance/hub-scoped-inventory.d.ts.map +1 -0
- package/dist/domain/governance/hub-scoped-inventory.js +59 -0
- package/dist/domain/governance/hub-scoped-inventory.js.map +1 -0
- package/dist/domain/governance/index.d.ts +15 -0
- package/dist/domain/governance/index.d.ts.map +1 -0
- package/dist/domain/governance/index.js +31 -0
- package/dist/domain/governance/index.js.map +1 -0
- package/dist/domain/governance/rule-registry.d.ts +20 -0
- package/dist/domain/governance/rule-registry.d.ts.map +1 -0
- package/dist/domain/governance/rule-registry.js +40 -0
- package/dist/domain/governance/rule-registry.js.map +1 -0
- package/dist/domain/governance/rules/collection.d.ts +32 -0
- package/dist/domain/governance/rules/collection.d.ts.map +1 -0
- package/dist/domain/governance/rules/collection.js +153 -0
- package/dist/domain/governance/rules/collection.js.map +1 -0
- package/dist/domain/governance/rules/config.d.ts +15 -0
- package/dist/domain/governance/rules/config.d.ts.map +1 -0
- package/dist/domain/governance/rules/config.js +38 -0
- package/dist/domain/governance/rules/config.js.map +1 -0
- package/dist/domain/governance/rules/hub.d.ts +7 -0
- package/dist/domain/governance/rules/hub.d.ts.map +1 -0
- package/dist/domain/governance/rules/hub.js +10 -0
- package/dist/domain/governance/rules/hub.js.map +1 -0
- package/dist/domain/governance/types.d.ts +70 -0
- package/dist/domain/governance/types.d.ts.map +1 -0
- package/dist/domain/governance/types.js +7 -0
- package/dist/domain/governance/types.js.map +1 -0
- package/dist/domain/hub/diagnostics.d.ts +92 -0
- package/dist/domain/hub/diagnostics.d.ts.map +1 -0
- package/dist/domain/hub/diagnostics.js +11 -0
- package/dist/domain/hub/diagnostics.js.map +1 -0
- package/dist/domain/hub/profile-requirements.d.ts +16 -0
- package/dist/domain/hub/profile-requirements.d.ts.map +1 -0
- package/dist/domain/hub/profile-requirements.js +16 -0
- package/dist/domain/hub/profile-requirements.js.map +1 -0
- package/dist/domain/hub/replicate.d.ts +23 -0
- package/dist/domain/hub/replicate.d.ts.map +1 -1
- package/dist/domain/hub/replicate.js +13 -0
- package/dist/domain/hub/replicate.js.map +1 -1
- package/dist/domain/hub/types.d.ts +2 -0
- package/dist/domain/hub/types.d.ts.map +1 -1
- package/dist/domain/hub/validate.d.ts +150 -2
- package/dist/domain/hub/validate.d.ts.map +1 -1
- package/dist/domain/hub/validate.js +421 -37
- package/dist/domain/hub/validate.js.map +1 -1
- package/dist/domain/index.d.ts +17 -0
- package/dist/domain/index.d.ts.map +1 -1
- package/dist/domain/index.js +17 -0
- package/dist/domain/index.js.map +1 -1
- package/dist/domain/install/category.d.ts +31 -0
- package/dist/domain/install/category.d.ts.map +1 -0
- package/dist/domain/install/category.js +33 -0
- package/dist/domain/install/category.js.map +1 -0
- package/dist/domain/install/file-mode.d.ts +49 -0
- package/dist/domain/install/file-mode.d.ts.map +1 -0
- package/dist/domain/install/file-mode.js +54 -0
- package/dist/domain/install/file-mode.js.map +1 -0
- package/dist/domain/install/git-exclude.d.ts +22 -0
- package/dist/domain/install/git-exclude.d.ts.map +1 -0
- package/dist/domain/install/git-exclude.js +56 -0
- package/dist/domain/install/git-exclude.js.map +1 -0
- package/dist/domain/install/installable.d.ts +2 -0
- package/dist/domain/install/installable.d.ts.map +1 -1
- package/dist/domain/install/kind-route.d.ts +80 -0
- package/dist/domain/install/kind-route.d.ts.map +1 -0
- package/dist/domain/install/kind-route.js +135 -0
- package/dist/domain/install/kind-route.js.map +1 -0
- package/dist/domain/install/record-errors.d.ts +53 -0
- package/dist/domain/install/record-errors.d.ts.map +1 -0
- package/dist/domain/install/record-errors.js +104 -0
- package/dist/domain/install/record-errors.js.map +1 -0
- package/dist/domain/install/record-object.d.ts +21 -0
- package/dist/domain/install/record-object.d.ts.map +1 -0
- package/dist/domain/install/record-object.js +38 -0
- package/dist/domain/install/record-object.js.map +1 -0
- package/dist/domain/install/record-parse.d.ts +23 -0
- package/dist/domain/install/record-parse.d.ts.map +1 -0
- package/dist/domain/install/record-parse.js +73 -0
- package/dist/domain/install/record-parse.js.map +1 -0
- package/dist/domain/install/record-path.d.ts +26 -0
- package/dist/domain/install/record-path.d.ts.map +1 -0
- package/dist/domain/install/record-path.js +130 -0
- package/dist/domain/install/record-path.js.map +1 -0
- package/dist/domain/install/record-types.d.ts +183 -0
- package/dist/domain/install/record-types.d.ts.map +1 -0
- package/dist/domain/install/record-types.js +92 -0
- package/dist/domain/install/record-types.js.map +1 -0
- package/dist/domain/install/types.d.ts +2 -0
- package/dist/domain/install/types.d.ts.map +1 -1
- package/dist/domain/mcp/index.d.ts +1 -0
- package/dist/domain/mcp/index.d.ts.map +1 -1
- package/dist/domain/mcp/index.js +1 -0
- package/dist/domain/mcp/index.js.map +1 -1
- package/dist/domain/mcp/server-key.d.ts +35 -0
- package/dist/domain/mcp/server-key.d.ts.map +1 -0
- package/dist/domain/mcp/server-key.js +44 -0
- package/dist/domain/mcp/server-key.js.map +1 -0
- package/dist/domain/plugin/agent-plugin-spec.d.ts +8 -0
- package/dist/domain/plugin/agent-plugin-spec.d.ts.map +1 -1
- package/dist/domain/plugin/agent-plugin-spec.js +22 -8
- package/dist/domain/plugin/agent-plugin-spec.js.map +1 -1
- package/dist/domain/registry-error.d.ts +1 -1
- package/dist/domain/registry-error.d.ts.map +1 -1
- package/dist/domain/registry-error.js +2 -1
- package/dist/domain/registry-error.js.map +1 -1
- package/dist/domain/security/fingerprint.d.ts +18 -0
- package/dist/domain/security/fingerprint.d.ts.map +1 -0
- package/dist/domain/security/fingerprint.js +34 -0
- package/dist/domain/security/fingerprint.js.map +1 -0
- package/dist/domain/security/high-impact-rules.d.ts +30 -0
- package/dist/domain/security/high-impact-rules.d.ts.map +1 -0
- package/dist/domain/security/high-impact-rules.js +160 -0
- package/dist/domain/security/high-impact-rules.js.map +1 -0
- package/dist/domain/security/index.d.ts +10 -0
- package/dist/domain/security/index.d.ts.map +1 -0
- package/dist/domain/security/index.js +26 -0
- package/dist/domain/security/index.js.map +1 -0
- package/dist/domain/security/markdown-context.d.ts +17 -0
- package/dist/domain/security/markdown-context.d.ts.map +1 -0
- package/dist/domain/security/markdown-context.js +74 -0
- package/dist/domain/security/markdown-context.js.map +1 -0
- package/dist/domain/security/policy.d.ts +17 -0
- package/dist/domain/security/policy.d.ts.map +1 -0
- package/dist/domain/security/policy.js +31 -0
- package/dist/domain/security/policy.js.map +1 -0
- package/dist/domain/security/rating/findings-document.d.ts +22 -0
- package/dist/domain/security/rating/findings-document.d.ts.map +1 -0
- package/dist/domain/security/rating/findings-document.js +57 -0
- package/dist/domain/security/rating/findings-document.js.map +1 -0
- package/dist/domain/security/rating/index.d.ts +5 -0
- package/dist/domain/security/rating/index.d.ts.map +1 -0
- package/dist/domain/security/rating/index.js +21 -0
- package/dist/domain/security/rating/index.js.map +1 -0
- package/dist/domain/security/rating/scoring.d.ts +83 -0
- package/dist/domain/security/rating/scoring.d.ts.map +1 -0
- package/dist/domain/security/rating/scoring.js +115 -0
- package/dist/domain/security/rating/scoring.js.map +1 -0
- package/dist/domain/security/rating/security-rating-report.d.ts +111 -0
- package/dist/domain/security/rating/security-rating-report.d.ts.map +1 -0
- package/dist/domain/security/rating/security-rating-report.js +152 -0
- package/dist/domain/security/rating/security-rating-report.js.map +1 -0
- package/dist/domain/security/rating/types.d.ts +22 -0
- package/dist/domain/security/rating/types.d.ts.map +1 -0
- package/dist/domain/security/rating/types.js +11 -0
- package/dist/domain/security/rating/types.js.map +1 -0
- package/dist/domain/security/remediations.d.ts +17 -0
- package/dist/domain/security/remediations.d.ts.map +1 -0
- package/dist/domain/security/remediations.js +61 -0
- package/dist/domain/security/remediations.js.map +1 -0
- package/dist/domain/security/rule-engine.d.ts +8 -0
- package/dist/domain/security/rule-engine.d.ts.map +1 -0
- package/dist/domain/security/rule-engine.js +875 -0
- package/dist/domain/security/rule-engine.js.map +1 -0
- package/dist/domain/security/suppression.d.ts +19 -0
- package/dist/domain/security/suppression.d.ts.map +1 -0
- package/dist/domain/security/suppression.js +78 -0
- package/dist/domain/security/suppression.js.map +1 -0
- package/dist/domain/security/types.d.ts +91 -0
- package/dist/domain/security/types.d.ts.map +1 -0
- package/dist/domain/security/types.js +10 -0
- package/dist/domain/security/types.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/ports/app-storage.d.ts +11 -15
- package/dist/ports/app-storage.d.ts.map +1 -1
- package/dist/ports/app-storage.js +8 -8
- package/dist/ports/argv-process-runner.d.ts +6 -0
- package/dist/ports/argv-process-runner.d.ts.map +1 -0
- package/dist/ports/argv-process-runner.js +3 -0
- package/dist/ports/argv-process-runner.js.map +1 -0
- package/dist/ports/bundle-extractor.d.ts +16 -3
- package/dist/ports/bundle-extractor.d.ts.map +1 -1
- package/dist/ports/collection-contribution.d.ts +36 -0
- package/dist/ports/collection-contribution.d.ts.map +1 -0
- package/dist/ports/collection-contribution.js +3 -0
- package/dist/ports/collection-contribution.js.map +1 -0
- package/dist/ports/filesystem.d.ts +12 -0
- package/dist/ports/filesystem.d.ts.map +1 -1
- package/dist/ports/hub-collection-index.d.ts +27 -0
- package/dist/ports/hub-collection-index.d.ts.map +1 -0
- package/dist/ports/hub-collection-index.js +3 -0
- package/dist/ports/hub-collection-index.js.map +1 -0
- package/dist/ports/hub-contribution.d.ts +158 -0
- package/dist/ports/hub-contribution.d.ts.map +1 -0
- package/dist/ports/hub-contribution.js +3 -0
- package/dist/ports/hub-contribution.js.map +1 -0
- package/dist/ports/index.d.ts +12 -0
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +12 -0
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/primitive-diagnostics-driver.d.ts +96 -0
- package/dist/ports/primitive-diagnostics-driver.d.ts.map +1 -0
- package/dist/ports/primitive-diagnostics-driver.js +3 -0
- package/dist/ports/primitive-diagnostics-driver.js.map +1 -0
- package/dist/ports/record-fs.d.ts +46 -0
- package/dist/ports/record-fs.d.ts.map +1 -0
- package/dist/ports/record-fs.js +9 -0
- package/dist/ports/record-fs.js.map +1 -0
- package/dist/ports/registry-operations.d.ts +3 -2
- package/dist/ports/registry-operations.d.ts.map +1 -1
- package/dist/ports/release-lookup.d.ts +24 -0
- package/dist/ports/release-lookup.d.ts.map +1 -0
- package/dist/ports/release-lookup.js +7 -0
- package/dist/ports/release-lookup.js.map +1 -0
- package/dist/ports/release-source.d.ts +17 -3
- package/dist/ports/release-source.d.ts.map +1 -1
- package/dist/ports/repository-exclusion.d.ts +30 -0
- package/dist/ports/repository-exclusion.d.ts.map +1 -0
- package/dist/ports/repository-exclusion.js +3 -0
- package/dist/ports/repository-exclusion.js.map +1 -0
- package/dist/ports/schema-validator.d.ts +25 -0
- package/dist/ports/schema-validator.d.ts.map +1 -0
- package/dist/ports/schema-validator.js +7 -0
- package/dist/ports/schema-validator.js.map +1 -0
- package/dist/ports/security-report-store.d.ts +9 -0
- package/dist/ports/security-report-store.d.ts.map +1 -0
- package/dist/ports/security-report-store.js +4 -0
- package/dist/ports/security-report-store.js.map +1 -0
- package/dist/ports/security-scan-engine.d.ts +32 -0
- package/dist/ports/security-scan-engine.d.ts.map +1 -0
- package/dist/ports/security-scan-engine.js +6 -0
- package/dist/ports/security-scan-engine.js.map +1 -0
- package/dist/ports/security-scan-input.d.ts +63 -0
- package/dist/ports/security-scan-input.d.ts.map +1 -0
- package/dist/ports/security-scan-input.js +3 -0
- package/dist/ports/security-scan-input.js.map +1 -0
- package/dist/ports/source-adapter.d.ts +11 -0
- package/dist/ports/source-adapter.d.ts.map +1 -1
- package/dist/public/schemas/collection.schema.json +0 -1
- package/dist/public/schemas/hub-governance.schema.json +21 -0
- package/dist/public/schemas/install-record.schema.json +343 -0
- package/dist/public/schemas/security-rating-report.schema.json +113 -0
- package/package.json +2 -2
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isContributableCollectionSource = isContributableCollectionSource;
|
|
37
|
+
exports.resolveCollectionIdFromBundle = resolveCollectionIdFromBundle;
|
|
38
|
+
exports.inferPrimitiveKindFromPath = inferPrimitiveKindFromPath;
|
|
39
|
+
exports.defaultPathForPrimitiveKind = defaultPathForPrimitiveKind;
|
|
40
|
+
exports.bumpCollectionVersion = bumpCollectionVersion;
|
|
41
|
+
exports.parsePrimitiveFrontmatter = parsePrimitiveFrontmatter;
|
|
42
|
+
exports.serializePrimitiveFrontmatter = serializePrimitiveFrontmatter;
|
|
43
|
+
/**
|
|
44
|
+
* Domain layer — Collection contribution eligibility, bundle-to-collection ID
|
|
45
|
+
* resolution, primitive path/kind inference, semver bumping, and primitive
|
|
46
|
+
* Markdown frontmatter parsing/serialization.
|
|
47
|
+
*
|
|
48
|
+
* Pure domain functions with zero filesystem or network IO.
|
|
49
|
+
* @module domain/collection/contribution
|
|
50
|
+
*/
|
|
51
|
+
const yaml = __importStar(require("js-yaml"));
|
|
52
|
+
const version_1 = require("../bundle/version");
|
|
53
|
+
const validate_1 = require("../hub/validate");
|
|
54
|
+
const types_1 = require("../primitive/types");
|
|
55
|
+
const scaffold_1 = require("../scaffold");
|
|
56
|
+
const validate_2 = require("./validate");
|
|
57
|
+
const DEFAULT_COLLECTIONS_PATH = 'collections';
|
|
58
|
+
const normalizeCollectionsPath = (rawPath) => {
|
|
59
|
+
if (typeof rawPath !== 'string' || rawPath.trim().length === 0) {
|
|
60
|
+
return DEFAULT_COLLECTIONS_PATH;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return (0, validate_2.normalizeRepoRelativePath)(rawPath.trim()).replace(/\/+$/, '');
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return DEFAULT_COLLECTIONS_PATH;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Determine whether a configured registry source is eligible for the
|
|
71
|
+
* Collection Contributor Workflow (`Fork -> Clone -> Branch -> Open PR`) and
|
|
72
|
+
* Visual Collection Editor.
|
|
73
|
+
*
|
|
74
|
+
* Rules:
|
|
75
|
+
* - `artifactory` sources are read-only replicas populated by promotion
|
|
76
|
+
* (ADR-0008) and are strictly rejected.
|
|
77
|
+
* - `github` and `awesome-copilot` sources are eligible when their `url`
|
|
78
|
+
* points to a valid GitHub `owner/repo`.
|
|
79
|
+
* - `local` and `local-awesome-copilot` sources are eligible when their local
|
|
80
|
+
* Git checkout has a valid GitHub `owner/repo` remote (`resolvedGitHubRemoteSlug`).
|
|
81
|
+
* - Non-collection source types (`apm`, `local-apm`, `skills`, `local-skills`,
|
|
82
|
+
* `azure-devops`) are rejected with an explanatory message.
|
|
83
|
+
* @param source Registry source descriptor.
|
|
84
|
+
* @param source.type
|
|
85
|
+
* @param source.url
|
|
86
|
+
* @param source.config
|
|
87
|
+
* @param resolvedGitHubRemoteSlug Optional `owner/repo` resolved from a local git checkout's remotes.
|
|
88
|
+
* @returns Eligibility verdict, resolved `owner/repo` slug, and `collectionsPath`.
|
|
89
|
+
*/
|
|
90
|
+
function isContributableCollectionSource(source, resolvedGitHubRemoteSlug) {
|
|
91
|
+
const collectionsPath = normalizeCollectionsPath(source?.config?.collectionsPath);
|
|
92
|
+
const branch = typeof source?.config?.branch === 'string' && source.config.branch.trim().length > 0
|
|
93
|
+
? source.config.branch.trim()
|
|
94
|
+
: undefined;
|
|
95
|
+
if (!source || !source.type) {
|
|
96
|
+
return {
|
|
97
|
+
contributable: false,
|
|
98
|
+
collectionsPath,
|
|
99
|
+
branch,
|
|
100
|
+
reason: 'Source is missing a valid type.'
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (source.type === 'artifactory') {
|
|
104
|
+
return {
|
|
105
|
+
contributable: false,
|
|
106
|
+
collectionsPath,
|
|
107
|
+
branch,
|
|
108
|
+
reason: 'Artifactory sources are read-only replicas populated by the promotion pipeline and cannot be edited directly.'
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (source.type === 'github' || source.type === 'awesome-copilot') {
|
|
112
|
+
const parsed = (0, validate_1.parseGitHubOwnerRepo)(source.url ?? '');
|
|
113
|
+
if (!parsed
|
|
114
|
+
|| (parsed.host !== 'github.com' && !parsed.host.endsWith('.github.com') && !parsed.host.endsWith('.githubusercontent.com'))
|
|
115
|
+
|| !(0, validate_1.isValidGitHubOwner)(parsed.owner)
|
|
116
|
+
|| !(0, validate_1.isValidGitHubRepo)(parsed.repo)) {
|
|
117
|
+
return {
|
|
118
|
+
contributable: false,
|
|
119
|
+
collectionsPath,
|
|
120
|
+
branch,
|
|
121
|
+
reason: `Source URL '${source.url ?? ''}' is not a valid GitHub repository (expected owner/repo).`
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
contributable: true,
|
|
126
|
+
repositorySlug: `${parsed.owner}/${parsed.repo}`,
|
|
127
|
+
collectionsPath,
|
|
128
|
+
branch
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (source.type === 'local' || source.type === 'local-awesome-copilot') {
|
|
132
|
+
if (!resolvedGitHubRemoteSlug) {
|
|
133
|
+
return {
|
|
134
|
+
contributable: false,
|
|
135
|
+
collectionsPath,
|
|
136
|
+
branch,
|
|
137
|
+
reason: 'Local collection source is not connected to a GitHub remote repository.'
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const parsed = (0, validate_1.parseGitHubOwnerRepo)(resolvedGitHubRemoteSlug);
|
|
141
|
+
if (!parsed || !(0, validate_1.isValidGitHubOwner)(parsed.owner) || !(0, validate_1.isValidGitHubRepo)(parsed.repo)) {
|
|
142
|
+
return {
|
|
143
|
+
contributable: false,
|
|
144
|
+
collectionsPath,
|
|
145
|
+
branch,
|
|
146
|
+
reason: 'Local collection source does not have a valid GitHub remote (owner/repo).'
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
contributable: true,
|
|
151
|
+
repositorySlug: `${parsed.owner}/${parsed.repo}`,
|
|
152
|
+
collectionsPath,
|
|
153
|
+
branch
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
contributable: false,
|
|
158
|
+
collectionsPath,
|
|
159
|
+
branch,
|
|
160
|
+
reason: `Source type '${source.type}' does not use .collection.yml manifests for collection collaboration.`
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Resolve the canonical `<collectionId>` and repo-relative `.collection.yml`
|
|
165
|
+
* path from a Marketplace or Registry Explorer bundle identifier.
|
|
166
|
+
*
|
|
167
|
+
* Examples:
|
|
168
|
+
* - `github` source (`https://github.com/acme/my-prompts`):
|
|
169
|
+
* `acme-my-prompts-python-dev-1.2.0` -> `{ collectionId: 'python-dev', collectionFilePath: 'collections/python-dev.collection.yml' }`
|
|
170
|
+
* `acme-my-prompts-python-dev` -> `{ collectionId: 'python-dev', collectionFilePath: 'collections/python-dev.collection.yml' }`
|
|
171
|
+
* - `awesome-copilot` source (`config.collectionsPath = 'collections'`):
|
|
172
|
+
* `python-dev` -> `{ collectionId: 'python-dev', collectionFilePath: 'collections/python-dev.collection.yml' }`
|
|
173
|
+
* @param bundleId Marketplace or installed bundle identifier.
|
|
174
|
+
* @param source Optional source descriptor providing `type`, `url`, and `config.collectionsPath`.
|
|
175
|
+
* @param source.type
|
|
176
|
+
* @param source.url
|
|
177
|
+
* @param source.repository
|
|
178
|
+
* @param source.config
|
|
179
|
+
* @param source.config.collectionsPath
|
|
180
|
+
* @returns Resolved collection ID and relative `.collection.yml` path, or `null` when `bundleId` is empty.
|
|
181
|
+
*/
|
|
182
|
+
function resolveCollectionIdFromBundle(bundleId, source) {
|
|
183
|
+
if (typeof bundleId !== 'string' || bundleId.trim().length === 0) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const collectionsPath = normalizeCollectionsPath(source?.config?.collectionsPath);
|
|
187
|
+
let candidate = bundleId.trim();
|
|
188
|
+
// Strip trailing -vX.Y.Z or -X.Y.Z release suffix first
|
|
189
|
+
candidate = (0, version_1.extractBundleIdentity)(candidate, 'github').replace(/-v\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/i, '');
|
|
190
|
+
const effectiveUrl = typeof source?.url === 'string' && source.url.length > 0
|
|
191
|
+
? source.url
|
|
192
|
+
: (typeof source?.repository === 'string' && source.repository.length > 0
|
|
193
|
+
? `https://github.com/${source.repository}`
|
|
194
|
+
: '');
|
|
195
|
+
if (effectiveUrl) {
|
|
196
|
+
const parsed = (0, validate_1.parseGitHubOwnerRepo)(effectiveUrl);
|
|
197
|
+
if (parsed) {
|
|
198
|
+
const ghPrefix = `${parsed.owner}-${parsed.repo}-`;
|
|
199
|
+
const skPrefix = (0, validate_1.skillsBundlePrefix)(effectiveUrl) ?? `skills-${parsed.owner}-${parsed.repo}-`;
|
|
200
|
+
if (candidate.toLowerCase().startsWith(skPrefix.toLowerCase()) && candidate.length > skPrefix.length) {
|
|
201
|
+
candidate = candidate.slice(skPrefix.length);
|
|
202
|
+
}
|
|
203
|
+
else if (candidate.toLowerCase().startsWith(ghPrefix.toLowerCase()) && candidate.length > ghPrefix.length) {
|
|
204
|
+
candidate = candidate.slice(ghPrefix.length);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
const fallbackPrefix = (0, validate_1.githubBundlePrefix)(effectiveUrl);
|
|
209
|
+
if (fallbackPrefix && candidate.toLowerCase().startsWith(fallbackPrefix.toLowerCase()) && candidate.length > fallbackPrefix.length) {
|
|
210
|
+
candidate = candidate.slice(fallbackPrefix.length);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const sanitized = candidate
|
|
215
|
+
.replace(/\.collection\.ya?ml$/i, '')
|
|
216
|
+
.trim();
|
|
217
|
+
if (!sanitized || (0, validate_1.hasPathTraversal)(sanitized)) {
|
|
218
|
+
return null;
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
collectionId: sanitized,
|
|
222
|
+
collectionsPath,
|
|
223
|
+
collectionFilePath: `${collectionsPath}/${sanitized}.collection.yml`
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Infer a canonical `PrimitiveKind` from a repository-relative file path.
|
|
228
|
+
* @param relPath Repo-relative path (e.g. `prompts/review.prompt.md`, `skills/foo/SKILL.md`).
|
|
229
|
+
* @returns Inferred `PrimitiveKind`, defaulting to `'prompt'` when ambiguous.
|
|
230
|
+
*/
|
|
231
|
+
function inferPrimitiveKindFromPath(relPath) {
|
|
232
|
+
const normalized = relPath.trim().replaceAll('\\', '/').replace(/^\/+/, '');
|
|
233
|
+
const lower = normalized.toLowerCase();
|
|
234
|
+
if (lower.endsWith('/plugin.json') || lower === 'plugin.json' || lower.startsWith('plugins/')) {
|
|
235
|
+
return 'plugin';
|
|
236
|
+
}
|
|
237
|
+
if (lower.endsWith('/skill.md') || lower.endsWith('.skill.md') || lower.startsWith('skills/')) {
|
|
238
|
+
return 'skill';
|
|
239
|
+
}
|
|
240
|
+
if (lower.endsWith('.instructions.md') || lower.endsWith('.instruction.md') || lower.startsWith('instructions/')) {
|
|
241
|
+
return 'instruction';
|
|
242
|
+
}
|
|
243
|
+
if (lower.endsWith('.agent.md') || lower.startsWith('agents/')) {
|
|
244
|
+
return 'agent';
|
|
245
|
+
}
|
|
246
|
+
if (lower.endsWith('.chatmode.md') || lower.startsWith('chat-modes/') || lower.startsWith('chatmodes/')) {
|
|
247
|
+
return 'chat-mode';
|
|
248
|
+
}
|
|
249
|
+
if (lower.endsWith('.hook.json') || lower.startsWith('hooks/')) {
|
|
250
|
+
return 'hook';
|
|
251
|
+
}
|
|
252
|
+
if (lower.endsWith('.mcp.json') || lower.startsWith('mcp-servers/') || lower.startsWith('mcp/')) {
|
|
253
|
+
return 'mcp-server';
|
|
254
|
+
}
|
|
255
|
+
if (lower.startsWith('.kiro/steering/') || lower.startsWith('steering/')) {
|
|
256
|
+
return 'steering';
|
|
257
|
+
}
|
|
258
|
+
if (lower.startsWith('.kiro/specs/') || lower.startsWith('specs/')) {
|
|
259
|
+
return 'spec';
|
|
260
|
+
}
|
|
261
|
+
if (lower.startsWith('.claude/output-styles/') || lower.startsWith('output-styles/')) {
|
|
262
|
+
return 'output-style';
|
|
263
|
+
}
|
|
264
|
+
if (lower.startsWith('.claude/commands/') || lower.startsWith('.cursor/commands/') || lower.startsWith('commands/')) {
|
|
265
|
+
return 'command';
|
|
266
|
+
}
|
|
267
|
+
if (lower.endsWith('.mdc') || lower.startsWith('.cursor/rules/') || lower.startsWith('rules/')) {
|
|
268
|
+
return 'rule';
|
|
269
|
+
}
|
|
270
|
+
if (lower.startsWith('.opencode/tools/') || lower.startsWith('tools/')) {
|
|
271
|
+
return 'tool';
|
|
272
|
+
}
|
|
273
|
+
if (lower.endsWith('/power.md') || lower.startsWith('powers/')) {
|
|
274
|
+
return 'power';
|
|
275
|
+
}
|
|
276
|
+
if (lower.startsWith('knowledge/') || lower.startsWith('.devin/knowledge/')) {
|
|
277
|
+
return 'knowledge';
|
|
278
|
+
}
|
|
279
|
+
if (lower.startsWith('playbooks/') || lower.startsWith('.devin/playbooks/')) {
|
|
280
|
+
return 'playbook';
|
|
281
|
+
}
|
|
282
|
+
return 'prompt';
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Generate the canonical repository-relative path for a newly created primitive
|
|
286
|
+
* of a given `kind` and human name/slug.
|
|
287
|
+
* @param kind Target primitive kind.
|
|
288
|
+
* @param rawName Human-readable name or slug.
|
|
289
|
+
* @returns Canonical repo-relative file path.
|
|
290
|
+
*/
|
|
291
|
+
function defaultPathForPrimitiveKind(kind, rawName) {
|
|
292
|
+
const slug = (0, scaffold_1.generateSanitizedId)(rawName) || 'example';
|
|
293
|
+
const normalizedKind = (0, types_1.normalizePrimitiveKind)(kind) ?? 'prompt';
|
|
294
|
+
switch (normalizedKind) {
|
|
295
|
+
case 'prompt': {
|
|
296
|
+
return `prompts/${slug}.prompt.md`;
|
|
297
|
+
}
|
|
298
|
+
case 'instruction': {
|
|
299
|
+
return `instructions/${slug}.instructions.md`;
|
|
300
|
+
}
|
|
301
|
+
case 'agent': {
|
|
302
|
+
return `agents/${slug}.agent.md`;
|
|
303
|
+
}
|
|
304
|
+
case 'chat-mode': {
|
|
305
|
+
return `chat-modes/${slug}.chatmode.md`;
|
|
306
|
+
}
|
|
307
|
+
case 'skill': {
|
|
308
|
+
return `skills/${slug}/SKILL.md`;
|
|
309
|
+
}
|
|
310
|
+
case 'plugin': {
|
|
311
|
+
return `plugins/${slug}/plugin.json`;
|
|
312
|
+
}
|
|
313
|
+
case 'hook': {
|
|
314
|
+
return `hooks/${slug}.hook.json`;
|
|
315
|
+
}
|
|
316
|
+
case 'mcp-server': {
|
|
317
|
+
return `mcp-servers/${slug}.mcp.json`;
|
|
318
|
+
}
|
|
319
|
+
case 'steering': {
|
|
320
|
+
return `.kiro/steering/${slug}.md`;
|
|
321
|
+
}
|
|
322
|
+
case 'spec': {
|
|
323
|
+
return `.kiro/specs/${slug}/requirements.md`;
|
|
324
|
+
}
|
|
325
|
+
case 'command': {
|
|
326
|
+
return `.claude/commands/${slug}.md`;
|
|
327
|
+
}
|
|
328
|
+
case 'rule': {
|
|
329
|
+
return `.cursor/rules/${slug}.mdc`;
|
|
330
|
+
}
|
|
331
|
+
case 'output-style': {
|
|
332
|
+
return `.claude/output-styles/${slug}.md`;
|
|
333
|
+
}
|
|
334
|
+
case 'tool': {
|
|
335
|
+
return `.opencode/tools/${slug}.ts`;
|
|
336
|
+
}
|
|
337
|
+
case 'power': {
|
|
338
|
+
return `powers/${slug}/POWER.md`;
|
|
339
|
+
}
|
|
340
|
+
case 'knowledge': {
|
|
341
|
+
return `knowledge/${slug}.md`;
|
|
342
|
+
}
|
|
343
|
+
case 'playbook': {
|
|
344
|
+
return `playbooks/${slug}.md`;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Bump a collection semantic version (`X.Y.Z`) by `'patch'`, `'minor'`, or `'major'`.
|
|
350
|
+
* Falls back to bumping from `'1.0.0'` if the input is undefined or non-semver.
|
|
351
|
+
* @param currentVersion Current version string.
|
|
352
|
+
* @param bump Bump level.
|
|
353
|
+
* @returns Incremented `X.Y.Z` string.
|
|
354
|
+
*/
|
|
355
|
+
function bumpCollectionVersion(currentVersion, bump) {
|
|
356
|
+
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec((currentVersion ?? '').trim());
|
|
357
|
+
if (!match) {
|
|
358
|
+
switch (bump) {
|
|
359
|
+
case 'major': {
|
|
360
|
+
return '2.0.0';
|
|
361
|
+
}
|
|
362
|
+
case 'minor': {
|
|
363
|
+
return '1.1.0';
|
|
364
|
+
}
|
|
365
|
+
case 'patch': {
|
|
366
|
+
return '1.0.1';
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
const major = Number(match[1]);
|
|
371
|
+
const minor = Number(match[2]);
|
|
372
|
+
const patch = Number(match[3]);
|
|
373
|
+
switch (bump) {
|
|
374
|
+
case 'major': {
|
|
375
|
+
return `${major + 1}.0.0`;
|
|
376
|
+
}
|
|
377
|
+
case 'minor': {
|
|
378
|
+
return `${major}.${minor + 1}.0`;
|
|
379
|
+
}
|
|
380
|
+
case 'patch': {
|
|
381
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
const FRONTMATTER_REGEX = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/;
|
|
386
|
+
/**
|
|
387
|
+
* Parse a Markdown primitive file (`.prompt.md`, `.instructions.md`, `.agent.md`,
|
|
388
|
+
* `SKILL.md`, etc.) into its structured YAML frontmatter object and Markdown body.
|
|
389
|
+
* @param content Raw file content.
|
|
390
|
+
* @returns Parsed frontmatter and body.
|
|
391
|
+
*/
|
|
392
|
+
function parsePrimitiveFrontmatter(content) {
|
|
393
|
+
const match = FRONTMATTER_REGEX.exec(content);
|
|
394
|
+
if (!match) {
|
|
395
|
+
return {
|
|
396
|
+
hasFrontmatter: false,
|
|
397
|
+
frontmatter: {},
|
|
398
|
+
body: content
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
const [, rawYaml, body] = match;
|
|
402
|
+
let parseError;
|
|
403
|
+
try {
|
|
404
|
+
const parsed = yaml.load(rawYaml);
|
|
405
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
406
|
+
return {
|
|
407
|
+
hasFrontmatter: true,
|
|
408
|
+
frontmatter: { ...parsed },
|
|
409
|
+
body,
|
|
410
|
+
rawFrontmatter: rawYaml
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
parseError = 'Frontmatter is not a YAML mapping';
|
|
414
|
+
}
|
|
415
|
+
catch (err) {
|
|
416
|
+
parseError = err instanceof Error ? err.message : String(err);
|
|
417
|
+
}
|
|
418
|
+
return {
|
|
419
|
+
hasFrontmatter: true,
|
|
420
|
+
frontmatter: {},
|
|
421
|
+
body,
|
|
422
|
+
rawFrontmatter: rawYaml,
|
|
423
|
+
parseError
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Serialize structured frontmatter fields and a Markdown body back into a
|
|
428
|
+
* well-formed Markdown primitive file.
|
|
429
|
+
*
|
|
430
|
+
* Empty/undefined frontmatter values are pruned; if no frontmatter keys remain
|
|
431
|
+
* and `forceFrontmatter` is false, only the Markdown body is returned.
|
|
432
|
+
* @param frontmatter Frontmatter key-value map (`name`, `description`, `applyTo`, `tools`, `model`, etc.).
|
|
433
|
+
* @param body Markdown body content.
|
|
434
|
+
* @param options Serialization options.
|
|
435
|
+
* @param options.forceFrontmatter Keep `---\n---` even when frontmatter is empty.
|
|
436
|
+
* @returns Formatted Markdown string.
|
|
437
|
+
*/
|
|
438
|
+
function serializePrimitiveFrontmatter(frontmatter, body, options) {
|
|
439
|
+
const cleaned = {};
|
|
440
|
+
for (const [key, value] of Object.entries(frontmatter)) {
|
|
441
|
+
if (value === undefined || value === null || value === '') {
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
cleaned[key] = value;
|
|
448
|
+
}
|
|
449
|
+
const normalizedBody = body.replace(/^\r?\n/, '');
|
|
450
|
+
if (Object.keys(cleaned).length === 0 && !options?.forceFrontmatter) {
|
|
451
|
+
return normalizedBody.endsWith('\n') ? normalizedBody : `${normalizedBody}\n`;
|
|
452
|
+
}
|
|
453
|
+
const dumpedFrontmatter = Object.keys(cleaned).length > 0
|
|
454
|
+
? yaml.dump(cleaned, { indent: 2, lineWidth: -1, noRefs: true }).trimEnd()
|
|
455
|
+
: '';
|
|
456
|
+
const header = dumpedFrontmatter.length > 0
|
|
457
|
+
? `---\n${dumpedFrontmatter}\n---\n\n`
|
|
458
|
+
: `---\n---\n\n`;
|
|
459
|
+
const full = `${header}${normalizedBody}`;
|
|
460
|
+
return full.endsWith('\n') ? full : `${full}\n`;
|
|
461
|
+
}
|
|
462
|
+
//# sourceMappingURL=contribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contribution.js","sourceRoot":"","sources":["../../../src/domain/collection/contribution.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,0EAmFC;AA8BD,sEAuDC;AAOD,gEAqDC;AASD,kEAyDC;AASD,sDAkCC;AAqBD,8DAkCC;AAcD,sEA+BC;AArgBD;;;;;;;GAOG;AACH,8CAAgC;AAChC,+CAE2B;AAC3B,8CAOyB;AACzB,8CAG4B;AAC5B,0CAEqB;AAIrB,yCAEoB;AAcpB,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAE/C,MAAM,wBAAwB,GAAG,CAAC,OAAiB,EAAU,EAAE;IAC7D,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/D,OAAO,wBAAwB,CAAC;IAClC,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAA,oCAAy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GAAG,cAAc,IAAI,CAAC;IAChF,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC;QACvD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;QAC1E,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC;QACzC,CAAC,CAAC,QAAQ,iBAAiB,WAAW;QACtC,CAAC,CAAC,cAAc,CAAC;IAEnB,MAAM,IAAI,GAAG,GAAG,MAAM,GAAG,cAAc,EAAE,CAAC;IAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Structured collection manifest diagnostics, quick-fix
|
|
3
|
+
* descriptors, inline decorations, cursor context, change summaries, and
|
|
4
|
+
* full author-facing collection manifest types.
|
|
5
|
+
*
|
|
6
|
+
* Used across `@ai-primitives-hub/infra`, `@ai-primitives-hub/app`, and the
|
|
7
|
+
* VS Code extension's Visual Collection Editor, Collections Tree View, and
|
|
8
|
+
* live YAML intelligence.
|
|
9
|
+
* @module domain/collection/diagnostics
|
|
10
|
+
*/
|
|
11
|
+
import type { SourceRange } from '../hub/diagnostics';
|
|
12
|
+
/**
|
|
13
|
+
* Machine-readable diagnostic codes for collection manifest validation.
|
|
14
|
+
*/
|
|
15
|
+
export type CollectionDiagnosticCode = 'COLLECTION_YAML_SYNTAX_ERROR' | 'COLLECTION_SCHEMA_VIOLATION' | 'COLLECTION_MISSING_REQUIRED_FIELD' | 'COLLECTION_INVALID_ID' | 'COLLECTION_INVALID_VERSION' | 'COLLECTION_INVALID_ITEM_KIND' | 'COLLECTION_DEPRECATED_ITEM_KIND' | 'COLLECTION_INVALID_PATH' | 'COLLECTION_ITEM_FILE_NOT_FOUND' | 'COLLECTION_README_MISSING' | 'COLLECTION_README_FILE_NOT_FOUND' | 'COLLECTION_KIND_ROUTE_MISMATCH' | 'COLLECTION_PLUGIN_MANIFEST_ERROR' | 'COLLECTION_PLUGIN_MANIFEST_WARNING' | 'COLLECTION_DUPLICATE_ID' | 'COLLECTION_DUPLICATE_NAME' | 'COLLECTION_DUPLICATE_ITEM_PATH' | 'COLLECTION_TAG_WARNING' | 'COLLECTION_MCP_INVALID';
|
|
16
|
+
/**
|
|
17
|
+
* Actionable quick fix attached to a collection validation diagnostic.
|
|
18
|
+
*/
|
|
19
|
+
export interface CollectionValidationQuickFix {
|
|
20
|
+
/** Human-readable title displayed in VS Code Quick Fix menu or Visual Editor. */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Quick fix kind identifier. */
|
|
23
|
+
kind: 'fix-deprecated-kind' | 'fix-kind-route' | 'sanitize-collection-id' | 'fix-version' | 'scaffold-missing-item' | 'scaffold-missing-readme';
|
|
24
|
+
/** Target JSON path within `.collection.yml`. */
|
|
25
|
+
jsonPath: (string | number)[];
|
|
26
|
+
/** Replacement value or payload used by the document mutator. */
|
|
27
|
+
replacementValue?: unknown;
|
|
28
|
+
/** Optional repo-relative file path to scaffold on disk. */
|
|
29
|
+
filePath?: string;
|
|
30
|
+
/** Optional item kind when scaffolding a missing item file. */
|
|
31
|
+
itemKind?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Structured validation diagnostic with JSON path, YAML source range, and
|
|
35
|
+
* optional quick-fix metadata.
|
|
36
|
+
*/
|
|
37
|
+
export interface CollectionValidationDiagnostic {
|
|
38
|
+
code: CollectionDiagnosticCode;
|
|
39
|
+
severity: 'error' | 'warning' | 'info';
|
|
40
|
+
message: string;
|
|
41
|
+
jsonPath: (string | number)[];
|
|
42
|
+
range?: SourceRange;
|
|
43
|
+
quickFix?: CollectionValidationQuickFix;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Inline hint decoration model for a YAML line in `.collection.yml`.
|
|
47
|
+
*/
|
|
48
|
+
export interface CollectionInlineDecoration {
|
|
49
|
+
line: number;
|
|
50
|
+
text: string;
|
|
51
|
+
status: 'ok' | 'warning' | 'error' | 'info';
|
|
52
|
+
jsonPath: (string | number)[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Semantic entity enclosing a cursor line in `.collection.yml`.
|
|
56
|
+
*/
|
|
57
|
+
export type CollectionCursorNodeContext = {
|
|
58
|
+
section: 'root';
|
|
59
|
+
} | {
|
|
60
|
+
section: 'metadata';
|
|
61
|
+
} | {
|
|
62
|
+
section: 'readme';
|
|
63
|
+
} | {
|
|
64
|
+
section: 'display';
|
|
65
|
+
} | {
|
|
66
|
+
section: 'items-header';
|
|
67
|
+
} | {
|
|
68
|
+
section: 'item';
|
|
69
|
+
index: number;
|
|
70
|
+
path?: string;
|
|
71
|
+
kind?: string;
|
|
72
|
+
} | {
|
|
73
|
+
section: 'mcp-header';
|
|
74
|
+
} | {
|
|
75
|
+
section: 'mcp-input';
|
|
76
|
+
index: number;
|
|
77
|
+
id?: string;
|
|
78
|
+
} | {
|
|
79
|
+
section: 'mcp-server';
|
|
80
|
+
key: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* MCP input definition inside `.collection.yml` (`mcp.inputs[]`).
|
|
84
|
+
*/
|
|
85
|
+
export interface CollectionMcpInput {
|
|
86
|
+
id: string;
|
|
87
|
+
type: 'promptString' | 'pickString' | 'command';
|
|
88
|
+
description?: string;
|
|
89
|
+
password?: boolean;
|
|
90
|
+
default?: string;
|
|
91
|
+
options?: string[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* MCP server definition inside `.collection.yml` (`mcp.items.<serverKey>`).
|
|
95
|
+
*/
|
|
96
|
+
export interface CollectionMcpServerConfig {
|
|
97
|
+
type?: 'stdio' | 'http' | 'sse';
|
|
98
|
+
command?: string;
|
|
99
|
+
args?: string[];
|
|
100
|
+
env?: Record<string, string>;
|
|
101
|
+
envFile?: string;
|
|
102
|
+
url?: string;
|
|
103
|
+
headers?: Record<string, string>;
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
description?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Display preferences inside `.collection.yml` (`display`).
|
|
109
|
+
*/
|
|
110
|
+
export interface CollectionDisplayConfig {
|
|
111
|
+
color?: string;
|
|
112
|
+
icon?: string;
|
|
113
|
+
ordering?: 'manual' | 'alphabetical';
|
|
114
|
+
show_badge?: boolean;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Author-facing item definition inside `.collection.yml` (`items[]`).
|
|
118
|
+
*/
|
|
119
|
+
export interface CollectionItemDefinition {
|
|
120
|
+
path: string;
|
|
121
|
+
kind: string;
|
|
122
|
+
title?: string;
|
|
123
|
+
name?: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
tags?: string[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Full author-facing collection manifest matching `collection.schema.json`.
|
|
129
|
+
*/
|
|
130
|
+
export interface CollectionManifest {
|
|
131
|
+
id: string;
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
version?: string;
|
|
135
|
+
author?: string;
|
|
136
|
+
tags?: string[];
|
|
137
|
+
readme?: {
|
|
138
|
+
path: string;
|
|
139
|
+
};
|
|
140
|
+
items: CollectionItemDefinition[];
|
|
141
|
+
mcp?: {
|
|
142
|
+
inputs?: CollectionMcpInput[];
|
|
143
|
+
items?: Record<string, CollectionMcpServerConfig>;
|
|
144
|
+
};
|
|
145
|
+
display?: CollectionDisplayConfig;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Summary of structural changes between a base `.collection.yml` and an edited
|
|
149
|
+
* `.collection.yml`, used to generate commit messages and pull request bodies.
|
|
150
|
+
*/
|
|
151
|
+
export interface CollectionChangeSummary {
|
|
152
|
+
collectionId: string;
|
|
153
|
+
metadataChanged: boolean;
|
|
154
|
+
itemsAdded: string[];
|
|
155
|
+
itemsModified: string[];
|
|
156
|
+
itemsRemoved: string[];
|
|
157
|
+
mcpServersAdded: string[];
|
|
158
|
+
mcpServersModified: string[];
|
|
159
|
+
mcpServersRemoved: string[];
|
|
160
|
+
mcpInputsAdded: string[];
|
|
161
|
+
mcpInputsRemoved: string[];
|
|
162
|
+
suggestedCommitMessage: string;
|
|
163
|
+
suggestedPrTitle: string;
|
|
164
|
+
suggestedPrBody: string;
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/domain/collection/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAChC,8BAA8B,GAC9B,6BAA6B,GAC7B,mCAAmC,GACnC,uBAAuB,GACvB,4BAA4B,GAC5B,8BAA8B,GAC9B,iCAAiC,GACjC,yBAAyB,GACzB,gCAAgC,GAChC,2BAA2B,GAC3B,kCAAkC,GAClC,gCAAgC,GAChC,kCAAkC,GAClC,oCAAoC,GACpC,yBAAyB,GACzB,2BAA2B,GAC3B,gCAAgC,GAChC,wBAAwB,GACxB,wBAAwB,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,IAAI,EACA,qBAAqB,GACrB,gBAAgB,GAChB,wBAAwB,GACxB,aAAa,GACb,uBAAuB,GACvB,yBAAyB,CAAC;IAC9B,iDAAiD;IACjD,QAA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.ts"],"names":[],"mappings":""}
|