@ai-primitives-hub/app 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/README.md +5 -1
- package/dist/collection/affected-collections.d.ts +11 -0
- package/dist/collection/affected-collections.d.ts.map +1 -0
- package/dist/collection/affected-collections.js +90 -0
- package/dist/collection/affected-collections.js.map +1 -0
- package/dist/collection/create-plugin.d.ts +35 -0
- package/dist/collection/create-plugin.d.ts.map +1 -0
- package/dist/collection/create-plugin.js +118 -0
- package/dist/collection/create-plugin.js.map +1 -0
- package/dist/collection/index.d.ts +4 -2
- package/dist/collection/index.d.ts.map +1 -1
- package/dist/collection/index.js +8 -4
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/kind-route-warning.d.ts +13 -0
- package/dist/collection/kind-route-warning.d.ts.map +1 -0
- package/dist/collection/kind-route-warning.js +40 -0
- package/dist/collection/kind-route-warning.js.map +1 -0
- package/dist/collection/plugin-item-issues.d.ts +36 -0
- package/dist/collection/plugin-item-issues.d.ts.map +1 -0
- package/dist/collection/plugin-item-issues.js +31 -0
- package/dist/collection/plugin-item-issues.js.map +1 -0
- package/dist/collection/read-collection.d.ts +1 -1
- package/dist/collection/read-collection.d.ts.map +1 -1
- package/dist/collection/read-collection.js +14 -15
- package/dist/collection/read-collection.js.map +1 -1
- package/dist/collection-editor/collection-contribution-workflow.d.ts +96 -0
- package/dist/collection-editor/collection-contribution-workflow.d.ts.map +1 -0
- package/dist/collection-editor/collection-contribution-workflow.js +479 -0
- package/dist/collection-editor/collection-contribution-workflow.js.map +1 -0
- package/dist/collection-editor/collection-editor-service.d.ts +232 -0
- package/dist/collection-editor/collection-editor-service.d.ts.map +1 -0
- package/dist/collection-editor/collection-editor-service.js +868 -0
- package/dist/collection-editor/collection-editor-service.js.map +1 -0
- package/dist/collection-editor/index.d.ts +7 -0
- package/dist/collection-editor/index.d.ts.map +1 -0
- package/dist/collection-editor/index.js +12 -0
- package/dist/collection-editor/index.js.map +1 -0
- package/dist/diagnostics/find-ancestor-file.d.ts +13 -0
- package/dist/diagnostics/find-ancestor-file.d.ts.map +1 -0
- package/dist/diagnostics/find-ancestor-file.js +85 -0
- package/dist/diagnostics/find-ancestor-file.js.map +1 -0
- package/dist/diagnostics/index.d.ts +10 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +26 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/diagnostics/run-primitive-diagnostics.d.ts +43 -0
- package/dist/diagnostics/run-primitive-diagnostics.d.ts.map +1 -0
- package/dist/diagnostics/run-primitive-diagnostics.js +413 -0
- package/dist/diagnostics/run-primitive-diagnostics.js.map +1 -0
- package/dist/diagnostics/sandbox-snapshot.d.ts +20 -0
- package/dist/diagnostics/sandbox-snapshot.d.ts.map +1 -0
- package/dist/diagnostics/sandbox-snapshot.js +117 -0
- package/dist/diagnostics/sandbox-snapshot.js.map +1 -0
- package/dist/governance/generate-catalogue.d.ts +16 -0
- package/dist/governance/generate-catalogue.d.ts.map +1 -0
- package/dist/governance/generate-catalogue.js +67 -0
- package/dist/governance/generate-catalogue.js.map +1 -0
- package/dist/governance/hub-scoped-governance.d.ts +37 -0
- package/dist/governance/hub-scoped-governance.d.ts.map +1 -0
- package/dist/governance/hub-scoped-governance.js +110 -0
- package/dist/governance/hub-scoped-governance.js.map +1 -0
- package/dist/governance/index.d.ts +10 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +26 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/load-config.d.ts +45 -0
- package/dist/governance/load-config.d.ts.map +1 -0
- package/dist/governance/load-config.js +137 -0
- package/dist/governance/load-config.js.map +1 -0
- package/dist/governance/pr-scope.d.ts +23 -0
- package/dist/governance/pr-scope.d.ts.map +1 -0
- package/dist/governance/pr-scope.js +22 -0
- package/dist/governance/pr-scope.js.map +1 -0
- package/dist/governance/report.d.ts +23 -0
- package/dist/governance/report.d.ts.map +1 -0
- package/dist/governance/report.js +177 -0
- package/dist/governance/report.js.map +1 -0
- package/dist/governance/run-governance.d.ts +22 -0
- package/dist/governance/run-governance.d.ts.map +1 -0
- package/dist/governance/run-governance.js +78 -0
- package/dist/governance/run-governance.js.map +1 -0
- package/dist/governance/source-checks.d.ts +29 -0
- package/dist/governance/source-checks.d.ts.map +1 -0
- package/dist/governance/source-checks.js +80 -0
- package/dist/governance/source-checks.js.map +1 -0
- package/dist/governance/validate-collection-governance.d.ts +46 -0
- package/dist/governance/validate-collection-governance.d.ts.map +1 -0
- package/dist/governance/validate-collection-governance.js +291 -0
- package/dist/governance/validate-collection-governance.js.map +1 -0
- package/dist/hub-editor/hub-config-editor-service.d.ts +94 -0
- package/dist/hub-editor/hub-config-editor-service.d.ts.map +1 -0
- package/dist/hub-editor/hub-config-editor-service.js +289 -0
- package/dist/hub-editor/hub-config-editor-service.js.map +1 -0
- package/dist/hub-editor/hub-contribution-workflow.d.ts +99 -0
- package/dist/hub-editor/hub-contribution-workflow.d.ts.map +1 -0
- package/dist/hub-editor/hub-contribution-workflow.js +385 -0
- package/dist/hub-editor/hub-contribution-workflow.js.map +1 -0
- package/dist/hub-editor/index.d.ts +7 -0
- package/dist/hub-editor/index.d.ts.map +1 -0
- package/dist/hub-editor/index.js +23 -0
- package/dist/hub-editor/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/install/index.d.ts +2 -0
- package/dist/install/index.d.ts.map +1 -1
- package/dist/install/index.js +3 -1
- package/dist/install/index.js.map +1 -1
- package/dist/install/partial-target-write.d.ts +63 -0
- package/dist/install/partial-target-write.d.ts.map +1 -0
- package/dist/install/partial-target-write.js +128 -0
- package/dist/install/partial-target-write.js.map +1 -0
- package/dist/install/pipeline.d.ts +2 -1
- package/dist/install/pipeline.d.ts.map +1 -1
- package/dist/install/pipeline.js +4 -3
- package/dist/install/pipeline.js.map +1 -1
- package/dist/install/target-write.d.ts +10 -0
- package/dist/install/target-write.d.ts.map +1 -1
- package/dist/install/target-write.js +3 -2
- package/dist/install/target-write.js.map +1 -1
- package/dist/install/uninstall-pipeline.d.ts +11 -10
- package/dist/install/uninstall-pipeline.d.ts.map +1 -1
- package/dist/install/uninstall-pipeline.js +10 -11
- package/dist/install/uninstall-pipeline.js.map +1 -1
- package/dist/records/atomic-write.d.ts +11 -0
- package/dist/records/atomic-write.d.ts.map +1 -0
- package/dist/records/atomic-write.js +66 -0
- package/dist/records/atomic-write.js.map +1 -0
- package/dist/records/confine-path.d.ts +35 -0
- package/dist/records/confine-path.d.ts.map +1 -0
- package/dist/records/confine-path.js +140 -0
- package/dist/records/confine-path.js.map +1 -0
- package/dist/records/git-root.d.ts +66 -0
- package/dist/records/git-root.d.ts.map +1 -0
- package/dist/records/git-root.js +208 -0
- package/dist/records/git-root.js.map +1 -0
- package/dist/records/index.d.ts +30 -0
- package/dist/records/index.d.ts.map +1 -0
- package/dist/records/index.js +46 -0
- package/dist/records/index.js.map +1 -0
- package/dist/records/install-record-service.d.ts +496 -0
- package/dist/records/install-record-service.d.ts.map +1 -0
- package/dist/records/install-record-service.js +1365 -0
- package/dist/records/install-record-service.js.map +1 -0
- package/dist/records/install-record-services.d.ts +29 -0
- package/dist/records/install-record-services.d.ts.map +1 -0
- package/dist/records/install-record-services.js +17 -0
- package/dist/records/install-record-services.js.map +1 -0
- package/dist/records/legacy-shapes.d.ts +18 -0
- package/dist/records/legacy-shapes.d.ts.map +1 -0
- package/dist/records/legacy-shapes.js +30 -0
- package/dist/records/legacy-shapes.js.map +1 -0
- package/dist/records/map-tool-to-target.d.ts +33 -0
- package/dist/records/map-tool-to-target.d.ts.map +1 -0
- package/dist/records/map-tool-to-target.js +98 -0
- package/dist/records/map-tool-to-target.js.map +1 -0
- package/dist/records/mcp-servers.d.ts +116 -0
- package/dist/records/mcp-servers.d.ts.map +1 -0
- package/dist/records/mcp-servers.js +268 -0
- package/dist/records/mcp-servers.js.map +1 -0
- package/dist/records/modified-files.d.ts +32 -0
- package/dist/records/modified-files.d.ts.map +1 -0
- package/dist/records/modified-files.js +146 -0
- package/dist/records/modified-files.js.map +1 -0
- package/dist/records/plan-record-entries.d.ts +76 -0
- package/dist/records/plan-record-entries.d.ts.map +1 -0
- package/dist/records/plan-record-entries.js +84 -0
- package/dist/records/plan-record-entries.js.map +1 -0
- package/dist/records/read-record-text.d.ts +15 -0
- package/dist/records/read-record-text.d.ts.map +1 -0
- package/dist/records/read-record-text.js +36 -0
- package/dist/records/read-record-text.js.map +1 -0
- package/dist/records/record-entry.d.ts +31 -0
- package/dist/records/record-entry.d.ts.map +1 -0
- package/dist/records/record-entry.js +81 -0
- package/dist/records/record-entry.js.map +1 -0
- package/dist/records/record-file-shape.d.ts +90 -0
- package/dist/records/record-file-shape.d.ts.map +1 -0
- package/dist/records/record-file-shape.js +288 -0
- package/dist/records/record-file-shape.js.map +1 -0
- package/dist/records/record-hub.d.ts +42 -0
- package/dist/records/record-hub.d.ts.map +1 -0
- package/dist/records/record-hub.js +85 -0
- package/dist/records/record-hub.js.map +1 -0
- package/dist/records/record-identity.d.ts +14 -0
- package/dist/records/record-identity.d.ts.map +1 -0
- package/dist/records/record-identity.js +41 -0
- package/dist/records/record-identity.js.map +1 -0
- package/dist/records/record-migration.d.ts +118 -0
- package/dist/records/record-migration.d.ts.map +1 -0
- package/dist/records/record-migration.js +454 -0
- package/dist/records/record-migration.js.map +1 -0
- package/dist/records/record-store.d.ts +123 -0
- package/dist/records/record-store.d.ts.map +1 -0
- package/dist/records/record-store.js +291 -0
- package/dist/records/record-store.js.map +1 -0
- package/dist/records/resolve-record-source.d.ts +64 -0
- package/dist/records/resolve-record-source.d.ts.map +1 -0
- package/dist/records/resolve-record-source.js +160 -0
- package/dist/records/resolve-record-source.js.map +1 -0
- package/dist/records/sanitize-source.d.ts +18 -0
- package/dist/records/sanitize-source.d.ts.map +1 -0
- package/dist/records/sanitize-source.js +90 -0
- package/dist/records/sanitize-source.js.map +1 -0
- package/dist/records/select-record.d.ts +54 -0
- package/dist/records/select-record.d.ts.map +1 -0
- package/dist/records/select-record.js +180 -0
- package/dist/records/select-record.js.map +1 -0
- package/dist/records/serialize-record.d.ts +20 -0
- package/dist/records/serialize-record.d.ts.map +1 -0
- package/dist/records/serialize-record.js +100 -0
- package/dist/records/serialize-record.js.map +1 -0
- package/dist/records/source-fields.d.ts +21 -0
- package/dist/records/source-fields.d.ts.map +1 -0
- package/dist/records/source-fields.js +28 -0
- package/dist/records/source-fields.js.map +1 -0
- package/dist/records/to-record-source.d.ts +23 -0
- package/dist/records/to-record-source.d.ts.map +1 -0
- package/dist/records/to-record-source.js +39 -0
- package/dist/records/to-record-source.js.map +1 -0
- package/dist/records/user-home.d.ts +16 -0
- package/dist/records/user-home.d.ts.map +1 -0
- package/dist/records/user-home.js +84 -0
- package/dist/records/user-home.js.map +1 -0
- package/dist/records/writer-group.d.ts +7 -0
- package/dist/records/writer-group.d.ts.map +1 -0
- package/dist/records/writer-group.js +31 -0
- package/dist/records/writer-group.js.map +1 -0
- package/dist/registry/activate-registry-profile.d.ts.map +1 -1
- package/dist/registry/activate-registry-profile.js +4 -1
- package/dist/registry/activate-registry-profile.js.map +1 -1
- package/dist/registry/batch-install-profile.d.ts +76 -0
- package/dist/registry/batch-install-profile.d.ts.map +1 -0
- package/dist/registry/batch-install-profile.js +67 -0
- package/dist/registry/batch-install-profile.js.map +1 -0
- package/dist/registry/create-source-adapter.d.ts +16 -1
- package/dist/registry/create-source-adapter.d.ts.map +1 -1
- package/dist/registry/create-source-adapter.js +76 -3
- package/dist/registry/create-source-adapter.js.map +1 -1
- package/dist/registry/hub-manager.d.ts +41 -0
- package/dist/registry/hub-manager.d.ts.map +1 -1
- package/dist/registry/hub-manager.js +82 -4
- package/dist/registry/hub-manager.js.map +1 -1
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -0
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/install-registry-bundle.js +4 -3
- package/dist/registry/install-registry-bundle.js.map +1 -1
- package/dist/registry/list-installed-bundles.d.ts +2 -3
- package/dist/registry/list-installed-bundles.d.ts.map +1 -1
- package/dist/registry/list-installed-bundles.js.map +1 -1
- package/dist/registry/load-hub-sources.d.ts +8 -0
- package/dist/registry/load-hub-sources.d.ts.map +1 -1
- package/dist/registry/load-hub-sources.js +70 -3
- package/dist/registry/load-hub-sources.js.map +1 -1
- package/dist/registry/profile-lifecycle.d.ts +7 -2
- package/dist/registry/profile-lifecycle.d.ts.map +1 -1
- package/dist/registry/profile-lifecycle.js +82 -11
- package/dist/registry/profile-lifecycle.js.map +1 -1
- package/dist/registry/uninstall-installed-bundle.d.ts +2 -3
- package/dist/registry/uninstall-installed-bundle.d.ts.map +1 -1
- package/dist/registry/uninstall-installed-bundle.js.map +1 -1
- package/dist/registry/update-registry-bundle.d.ts +2 -2
- package/dist/registry/update-registry-bundle.js +2 -2
- package/dist/registry/update-registry-bundle.js.map +1 -1
- package/dist/registry/validate-hub-config-file.d.ts +14 -1
- package/dist/registry/validate-hub-config-file.d.ts.map +1 -1
- package/dist/registry/validate-hub-config-file.js +81 -44
- package/dist/registry/validate-hub-config-file.js.map +1 -1
- package/dist/release/plan-bundle-release.d.ts +6 -12
- package/dist/release/plan-bundle-release.d.ts.map +1 -1
- package/dist/release/plan-bundle-release.js +178 -7
- package/dist/release/plan-bundle-release.js.map +1 -1
- package/dist/replicate/replicate.d.ts +5 -2
- package/dist/replicate/replicate.d.ts.map +1 -1
- package/dist/replicate/replicate.js +121 -17
- package/dist/replicate/replicate.js.map +1 -1
- package/dist/security/index.d.ts +4 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +22 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/rating/bundle-discovery.d.ts +19 -0
- package/dist/security/rating/bundle-discovery.d.ts.map +1 -0
- package/dist/security/rating/bundle-discovery.js +244 -0
- package/dist/security/rating/bundle-discovery.js.map +1 -0
- package/dist/security/rating/index.d.ts +5 -0
- package/dist/security/rating/index.d.ts.map +1 -0
- package/dist/security/rating/index.js +21 -0
- package/dist/security/rating/index.js.map +1 -0
- package/dist/security/rating/security-rating-markdown.d.ts +17 -0
- package/dist/security/rating/security-rating-markdown.d.ts.map +1 -0
- package/dist/security/rating/security-rating-markdown.js +131 -0
- package/dist/security/rating/security-rating-markdown.js.map +1 -0
- package/dist/security/rating/security-rating-scan.d.ts +23 -0
- package/dist/security/rating/security-rating-scan.d.ts.map +1 -0
- package/dist/security/rating/security-rating-scan.js +40 -0
- package/dist/security/rating/security-rating-scan.js.map +1 -0
- package/dist/security/rating/security-rating-templates.d.ts +40 -0
- package/dist/security/rating/security-rating-templates.d.ts.map +1 -0
- package/dist/security/rating/security-rating-templates.js +83 -0
- package/dist/security/rating/security-rating-templates.js.map +1 -0
- package/dist/security/rating/security-rating.d.ts +32 -0
- package/dist/security/rating/security-rating.d.ts.map +1 -0
- package/dist/security/rating/security-rating.js +94 -0
- package/dist/security/rating/security-rating.js.map +1 -0
- package/dist/security/security-scan-use-case.d.ts +101 -0
- package/dist/security/security-scan-use-case.d.ts.map +1 -0
- package/dist/security/security-scan-use-case.js +185 -0
- package/dist/security/security-scan-use-case.js.map +1 -0
- package/dist/stores/json-lockfile-store.d.ts.map +1 -1
- package/dist/stores/json-lockfile-store.js +6 -32
- package/dist/stores/json-lockfile-store.js.map +1 -1
- package/dist/transform/transformer-registry.d.ts.map +1 -1
- package/dist/transform/transformer-registry.js +3 -0
- package/dist/transform/transformer-registry.js.map +1 -1
- package/dist/transform/transformers/windsurf-transformer.d.ts +5 -0
- package/dist/transform/transformers/windsurf-transformer.d.ts.map +1 -1
- package/dist/transform/transformers/windsurf-transformer.js.map +1 -1
- package/dist/writers/file-tree-writer.d.ts +14 -1
- package/dist/writers/file-tree-writer.d.ts.map +1 -1
- package/dist/writers/file-tree-writer.js +23 -71
- package/dist/writers/file-tree-writer.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,67 @@
|
|
|
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.RULE_CATALOGUE_PATH = void 0;
|
|
37
|
+
exports.ruleCatalogue = ruleCatalogue;
|
|
38
|
+
exports.generateRuleCatalogue = generateRuleCatalogue;
|
|
39
|
+
/**
|
|
40
|
+
* Write the committed, generated rule catalogue (`docs/author-guide/rule-catalogue.md`).
|
|
41
|
+
* @module app/governance/generate-catalogue
|
|
42
|
+
*/
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
45
|
+
exports.RULE_CATALOGUE_PATH = 'docs/author-guide/rule-catalogue.md';
|
|
46
|
+
/** The catalogue as it should be committed. */
|
|
47
|
+
function ruleCatalogue() {
|
|
48
|
+
return (0, core_1.renderRuleCatalogue)(core_1.GOVERNANCE_RULES);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Write the catalogue, or only check it when `check` is set.
|
|
52
|
+
* @param fs Filesystem port.
|
|
53
|
+
* @param repoRoot Repository root.
|
|
54
|
+
* @param options `check` compares instead of writing.
|
|
55
|
+
* @param options.check
|
|
56
|
+
* @returns `true` when the committed file is current (check mode) or was written.
|
|
57
|
+
*/
|
|
58
|
+
async function generateRuleCatalogue(fs, repoRoot, options = {}) {
|
|
59
|
+
const target = path.join(repoRoot, exports.RULE_CATALOGUE_PATH);
|
|
60
|
+
const expected = ruleCatalogue();
|
|
61
|
+
if (options.check) {
|
|
62
|
+
return (await fs.exists(target)) && (await fs.readFile(target)) === expected;
|
|
63
|
+
}
|
|
64
|
+
await fs.writeFile(target, expected);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=generate-catalogue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-catalogue.js","sourceRoot":"","sources":["../../src/governance/generate-catalogue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,sCAEC;AAUD,sDAQC;AAlCD;;;GAGG;AACH,gDAAkC;AAClC,kDAIiC;AAEpB,QAAA,mBAAmB,GAAG,qCAAqC,CAAC;AAEzE,+CAA+C;AAC/C,SAAgB,aAAa;IAC3B,OAAO,IAAA,0BAAmB,EAAC,uBAAgB,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,qBAAqB,CAAC,EAAc,EAAE,QAAgB,EAAE,UAA+B,EAAE;IAC7G,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,2BAAmB,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,QAAQ,CAAC;IAC/E,CAAC;IACD,MAAM,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ArgvProcessRunner, type FileSystem, type GovernanceReport, type HubCollectionIndex, type HubScope, type ReleaseLookup } from '@ai-primitives-hub/core';
|
|
2
|
+
import type { SourceAdapterFactoryDeps } from '../registry/create-source-adapter';
|
|
3
|
+
import { type HubValidationProgress } from '../registry/validate-hub-config-file';
|
|
4
|
+
import { createHubGovernanceSourceChecks } from './source-checks';
|
|
5
|
+
export interface HubScopedGovernanceRequest {
|
|
6
|
+
repoRoot: string;
|
|
7
|
+
config?: string;
|
|
8
|
+
baseRef?: string;
|
|
9
|
+
headRef?: string;
|
|
10
|
+
scopeFile?: string;
|
|
11
|
+
processRunner: ArgvProcessRunner;
|
|
12
|
+
/** Governance configuration path. Git mode reads explicit and default policies from the merge base. */
|
|
13
|
+
policy?: string;
|
|
14
|
+
checkSources?: boolean;
|
|
15
|
+
sourceAdapterDeps?: SourceAdapterFactoryDeps;
|
|
16
|
+
collectionIndex?: HubCollectionIndex;
|
|
17
|
+
releaseLookup?: ReleaseLookup;
|
|
18
|
+
/** Overall time limit for reading hub-wide collection ids (COL004). */
|
|
19
|
+
inventoryDeadlineMs?: number;
|
|
20
|
+
onProgress?: (event: HubValidationProgress) => void;
|
|
21
|
+
onInventoryProgress?: Parameters<typeof createHubGovernanceSourceChecks>[3];
|
|
22
|
+
}
|
|
23
|
+
export interface HubScopedGovernanceReport extends GovernanceReport {
|
|
24
|
+
scope?: HubScope & {
|
|
25
|
+
baseRef?: string;
|
|
26
|
+
headRef?: string;
|
|
27
|
+
mergeBase?: string;
|
|
28
|
+
origin: 'git' | 'file';
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Validate only semantic PR changes and dependencies using shared validators.
|
|
33
|
+
* @param fs Filesystem port.
|
|
34
|
+
* @param request Refs or scope file, configuration and options.
|
|
35
|
+
*/
|
|
36
|
+
export declare function runHubScopedGovernance(fs: FileSystem, request: HubScopedGovernanceRequest): Promise<HubScopedGovernanceReport>;
|
|
37
|
+
//# sourceMappingURL=hub-scoped-governance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-scoped-governance.d.ts","sourceRoot":"","sources":["../../src/governance/hub-scoped-governance.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,iBAAiB,EAGtB,KAAK,UAAU,EAEf,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EAGb,KAAK,aAAa,EAEnB,MAAM,yBAAyB,CAAC;AASjC,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EACL,+BAA+B,EAChC,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,iBAAiB,CAAC;IACjC,uGAAuG;IACvG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;IAC7C,eAAe,CAAC,EAAE,kBAAkB,CAAC;IACrC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,uEAAuE;IACvE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACpD,mBAAmB,CAAC,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7E;AACD,MAAM,WAAW,yBAA0B,SAAQ,gBAAgB;IACjE,KAAK,CAAC,EAAE,QAAQ,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC;CACvG;AAID;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA0DpI"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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.runHubScopedGovernance = runHubScopedGovernance;
|
|
37
|
+
/**
|
|
38
|
+
* PR-scoped hub governance: validate only the sources and profiles a PR changed, plus their dependencies.
|
|
39
|
+
* Composes pure scope selection (core), Git/parse boundaries (infra) and the existing validators.
|
|
40
|
+
* @module app/governance/hub-scoped-governance
|
|
41
|
+
*/
|
|
42
|
+
const path = __importStar(require("node:path"));
|
|
43
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
44
|
+
const infra_1 = require("@ai-primitives-hub/infra");
|
|
45
|
+
const validate_hub_config_file_1 = require("../registry/validate-hub-config-file");
|
|
46
|
+
const load_config_1 = require("./load-config");
|
|
47
|
+
const REMOTE_SOURCE_TYPES = new Set(['github', 'awesome-copilot', 'skills']);
|
|
48
|
+
/**
|
|
49
|
+
* Validate only semantic PR changes and dependencies using shared validators.
|
|
50
|
+
* @param fs Filesystem port.
|
|
51
|
+
* @param request Refs or scope file, configuration and options.
|
|
52
|
+
*/
|
|
53
|
+
async function runHubScopedGovernance(fs, request) {
|
|
54
|
+
const findings = [];
|
|
55
|
+
let scope;
|
|
56
|
+
let config = { policy: {}, findings: [] };
|
|
57
|
+
const mode = request.checkSources ? 'sources' : 'offline';
|
|
58
|
+
const errors = (ruleId, messages, map = (message) => message) => findings.push(...messages.map((message) => ({ ruleId, severity: 'error', message: map(message) })));
|
|
59
|
+
try {
|
|
60
|
+
if (request.scopeFile !== undefined && (request.baseRef !== undefined || request.headRef !== undefined)) {
|
|
61
|
+
throw new Error('--scope-file cannot be combined with --base-ref/--head-ref.');
|
|
62
|
+
}
|
|
63
|
+
const configFile = request.config ?? 'hub-config.yml';
|
|
64
|
+
const configPath = path.resolve(request.repoRoot, configFile);
|
|
65
|
+
let head;
|
|
66
|
+
if (request.scopeFile === undefined) {
|
|
67
|
+
if (request.baseRef === undefined || request.headRef === undefined) {
|
|
68
|
+
throw new Error('Both --base-ref and --head-ref are required.');
|
|
69
|
+
}
|
|
70
|
+
const snapshot = await (0, infra_1.readGitHubScope)(request.processRunner, request.repoRoot, configFile, request.baseRef, request.headRef);
|
|
71
|
+
head = snapshot.head;
|
|
72
|
+
scope = { ...(0, core_1.computeHubScope)(snapshot.base, head), origin: 'git', baseRef: snapshot.baseRef, headRef: snapshot.headRef, mergeBase: snapshot.mergeBase };
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
head = (0, infra_1.parseHubScopeDocument)(await fs.readFile(configPath));
|
|
76
|
+
const explicit = (0, infra_1.parseHubScopeFile)(await fs.readFile(path.resolve(request.repoRoot, request.scopeFile)));
|
|
77
|
+
scope = { ...(0, core_1.computeHubScope)(head, head, explicit), origin: 'file' };
|
|
78
|
+
}
|
|
79
|
+
config = await (0, load_config_1.loadScopedGovernanceConfig)(fs, request, scope.mergeBase);
|
|
80
|
+
findings.push(...config.findings);
|
|
81
|
+
const selected = (0, core_1.selectHubScope)(head, scope);
|
|
82
|
+
const staticErrors = (0, infra_1.validateHubScopeDocument)(head, selected).errors;
|
|
83
|
+
errors('HUB001', staticErrors, (0, core_1.hubScopeLocationMapper)(selected, head));
|
|
84
|
+
const shouldCheckSources = config.findings.length === 0 && staticErrors.length === 0 && request.checkSources
|
|
85
|
+
&& !scope.noOp && (scope.sourceIds.length > 0 || scope.references.length > 0);
|
|
86
|
+
if (shouldCheckSources) {
|
|
87
|
+
// Scoped Git validation must never execute APM/PR code or read checkout-local sources.
|
|
88
|
+
if (selected.sources.some((s) => s.enabled && !REMOTE_SOURCE_TYPES.has(String(s.type)))) {
|
|
89
|
+
throw new Error('Scoped deep validation supports remote github, awesome-copilot and skills sources only; local/APM execution is prohibited.');
|
|
90
|
+
}
|
|
91
|
+
if (!request.sourceAdapterDeps) {
|
|
92
|
+
throw new Error('Scoped deep validation requires source adapter dependencies.');
|
|
93
|
+
}
|
|
94
|
+
// Reuse authenticated GET evidence across deep validation and governance.
|
|
95
|
+
// The snapshot belongs to this invocation, never a global/checkout cache.
|
|
96
|
+
const deps = { ...request.sourceAdapterDeps, httpClient: new infra_1.HttpSnapshot(request.sourceAdapterDeps.httpClient) };
|
|
97
|
+
const deepDocument = { ...selected, profiles: selected.profiles.filter((p) => !Array.isArray(p.bundles) || p.bundles.length > 0) };
|
|
98
|
+
const deep = await (0, validate_hub_config_file_1.validateHubConfigFile)((0, infra_1.hubScopeFileSystem)(fs, configPath, deepDocument), configPath, { deep: true, sourceAdapterDeps: deps, onProgress: request.onProgress });
|
|
99
|
+
const locate = (0, core_1.hubScopeLocationMapper)(deepDocument, head);
|
|
100
|
+
errors('HUB001', deep.errors, locate);
|
|
101
|
+
findings.push(...(deep.warnings ?? []).map((message) => ({ ruleId: 'HUB002', severity: 'warning', message: locate(message) })));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
errors('HUB001', [error instanceof Error ? error.message : 'Scoped validation could not complete.']);
|
|
106
|
+
}
|
|
107
|
+
const policy = config.findings.length > 0 ? {} : config.policy;
|
|
108
|
+
return { ...(0, core_1.evaluateGovernance)('hub', (0, load_config_1.withDisplayPaths)(findings, request.repoRoot), policy, { mode, configFile: config.file }), scope };
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=hub-scoped-governance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-scoped-governance.js","sourceRoot":"","sources":["../../src/governance/hub-scoped-governance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,wDA0DC;AAnID;;;;GAIG;AACH,gDAAkC;AAClC,kDAaiC;AACjC,oDAOkC;AAIlC,mFAG8C;AAC9C,+CAIuB;AA2BvB,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7E;;;;GAIG;AACI,KAAK,UAAU,sBAAsB,CAAC,EAAc,EAAE,OAAmC;IAC9F,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,IAAI,KAAyC,CAAC;IAC9C,IAAI,MAAM,GAA2B,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAClE,MAAM,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1D,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,QAAkB,EAAE,MAAmC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,CAC7G,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,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AAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAkB,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3I,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,QAAQ,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC;IACvG,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/D,OAAO,EAAE,GAAG,IAAA,yBAAkB,EAAC,KAAK,EAAE,IAAA,8BAAgB,EAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,EACxF,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Shared hub governance use cases and report generation. */
|
|
2
|
+
export * from './run-governance';
|
|
3
|
+
export * from './report';
|
|
4
|
+
export * from './load-config';
|
|
5
|
+
export * from './generate-catalogue';
|
|
6
|
+
export * from './hub-scoped-governance';
|
|
7
|
+
export * from './pr-scope';
|
|
8
|
+
export * from './validate-collection-governance';
|
|
9
|
+
export * from './source-checks';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,kCAAkC,CAAC;AACjD,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/** Shared hub governance use cases and report generation. */
|
|
18
|
+
__exportStar(require("./run-governance"), exports);
|
|
19
|
+
__exportStar(require("./report"), exports);
|
|
20
|
+
__exportStar(require("./load-config"), exports);
|
|
21
|
+
__exportStar(require("./generate-catalogue"), exports);
|
|
22
|
+
__exportStar(require("./hub-scoped-governance"), exports);
|
|
23
|
+
__exportStar(require("./pr-scope"), exports);
|
|
24
|
+
__exportStar(require("./validate-collection-governance"), exports);
|
|
25
|
+
__exportStar(require("./source-checks"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/governance/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA6D;AAC7D,mDAAiC;AACjC,2CAAyB;AACzB,gDAA8B;AAC9B,uDAAqC;AACrC,0DAAwC;AACxC,6CAA2B;AAC3B,mEAAiD;AACjD,kDAAgC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ArgvProcessRunner, FileSystem, GovernanceFinding, GovernancePolicy } from '@ai-primitives-hub/core';
|
|
2
|
+
/** Discovered at the repository root when no explicit path is given. */
|
|
3
|
+
export declare const GOVERNANCE_CONFIG_FILE = "hub-governance.yml";
|
|
4
|
+
export interface LoadedGovernanceConfig {
|
|
5
|
+
policy: GovernancePolicy;
|
|
6
|
+
/** CFG001 findings; a non-empty list means the policy is ignored. */
|
|
7
|
+
findings: GovernanceFinding[];
|
|
8
|
+
/** Display path of the file that was used, if any. */
|
|
9
|
+
file?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse configuration content that was already read (for example from a Git commit).
|
|
13
|
+
* @param content YAML content, or undefined when the file does not exist.
|
|
14
|
+
* @param file Display path.
|
|
15
|
+
*/
|
|
16
|
+
export declare function governanceConfigFromContent(content: string | undefined, file: string): LoadedGovernanceConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Load an explicit configuration file, or discover `hub-governance.yml` at the repository root.
|
|
19
|
+
* A missing explicit file is a CFG001 error; a missing discovered file means "all defaults".
|
|
20
|
+
* @param fs Filesystem port.
|
|
21
|
+
* @param repoRoot Repository root.
|
|
22
|
+
* @param explicitPath Path given with `--policy`, relative to the root.
|
|
23
|
+
*/
|
|
24
|
+
export declare function loadGovernanceConfig(fs: FileSystem, repoRoot: string, explicitPath?: string): Promise<LoadedGovernanceConfig>;
|
|
25
|
+
/**
|
|
26
|
+
* Read policies from the merge base in Git mode, otherwise from the working tree.
|
|
27
|
+
* @param fs
|
|
28
|
+
* @param request
|
|
29
|
+
* @param request.repoRoot
|
|
30
|
+
* @param request.policy
|
|
31
|
+
* @param request.processRunner
|
|
32
|
+
* @param mergeBase
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadScopedGovernanceConfig(fs: FileSystem, request: {
|
|
35
|
+
repoRoot: string;
|
|
36
|
+
policy?: string;
|
|
37
|
+
processRunner?: ArgvProcessRunner;
|
|
38
|
+
}, mergeBase?: string): Promise<LoadedGovernanceConfig>;
|
|
39
|
+
/**
|
|
40
|
+
* Show paths relative to the repository root so reports never expose runner paths.
|
|
41
|
+
* @param findings
|
|
42
|
+
* @param repoRoot
|
|
43
|
+
*/
|
|
44
|
+
export declare function withDisplayPaths(findings: readonly GovernanceFinding[], repoRoot: string): GovernanceFinding[];
|
|
45
|
+
//# sourceMappingURL=load-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../../src/governance/load-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAMjC,wEAAwE;AACxE,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAE3D,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,gBAAgB,CAAC;IACzB,qEAAqE;IACrE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,sBAAsB,CAM7G;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAcnI;AAED;;;;;;;;GAQG;AACH,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,iBAAiB,CAAA;CAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GACpH,OAAO,CAAC,sBAAsB,CAAC,CAsBjC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAc9G"}
|
|
@@ -0,0 +1,137 @@
|
|
|
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.GOVERNANCE_CONFIG_FILE = void 0;
|
|
37
|
+
exports.governanceConfigFromContent = governanceConfigFromContent;
|
|
38
|
+
exports.loadGovernanceConfig = loadGovernanceConfig;
|
|
39
|
+
exports.loadScopedGovernanceConfig = loadScopedGovernanceConfig;
|
|
40
|
+
exports.withDisplayPaths = withDisplayPaths;
|
|
41
|
+
/**
|
|
42
|
+
* Discover and validate the consumer governance configuration (`hub-governance.yml`).
|
|
43
|
+
* @module app/governance/load-config
|
|
44
|
+
*/
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
46
|
+
const governance_1 = require("@ai-primitives-hub/infra/governance");
|
|
47
|
+
/** Discovered at the repository root when no explicit path is given. */
|
|
48
|
+
exports.GOVERNANCE_CONFIG_FILE = 'hub-governance.yml';
|
|
49
|
+
/**
|
|
50
|
+
* Parse configuration content that was already read (for example from a Git commit).
|
|
51
|
+
* @param content YAML content, or undefined when the file does not exist.
|
|
52
|
+
* @param file Display path.
|
|
53
|
+
*/
|
|
54
|
+
function governanceConfigFromContent(content, file) {
|
|
55
|
+
if (content === undefined) {
|
|
56
|
+
return { policy: {}, findings: [] };
|
|
57
|
+
}
|
|
58
|
+
const parsed = (0, governance_1.parseGovernanceConfig)(content, file);
|
|
59
|
+
return { policy: parsed.policy ?? {}, findings: parsed.findings, file };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Load an explicit configuration file, or discover `hub-governance.yml` at the repository root.
|
|
63
|
+
* A missing explicit file is a CFG001 error; a missing discovered file means "all defaults".
|
|
64
|
+
* @param fs Filesystem port.
|
|
65
|
+
* @param repoRoot Repository root.
|
|
66
|
+
* @param explicitPath Path given with `--policy`, relative to the root.
|
|
67
|
+
*/
|
|
68
|
+
async function loadGovernanceConfig(fs, repoRoot, explicitPath) {
|
|
69
|
+
const file = explicitPath ?? exports.GOVERNANCE_CONFIG_FILE;
|
|
70
|
+
const absolute = path.resolve(repoRoot, file);
|
|
71
|
+
if (explicitPath === undefined && !(await fs.exists(absolute))) {
|
|
72
|
+
return { policy: {}, findings: [] };
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
return governanceConfigFromContent(await fs.readFile(absolute), file);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return { policy: {}, file, findings: [{
|
|
79
|
+
ruleId: 'CFG001', severity: 'error', file,
|
|
80
|
+
message: `Unable to read governance configuration: ${error instanceof Error ? error.message : String(error)}`
|
|
81
|
+
}] };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Read policies from the merge base in Git mode, otherwise from the working tree.
|
|
86
|
+
* @param fs
|
|
87
|
+
* @param request
|
|
88
|
+
* @param request.repoRoot
|
|
89
|
+
* @param request.policy
|
|
90
|
+
* @param request.processRunner
|
|
91
|
+
* @param mergeBase
|
|
92
|
+
*/
|
|
93
|
+
async function loadScopedGovernanceConfig(fs, request, mergeBase) {
|
|
94
|
+
if (mergeBase === undefined) {
|
|
95
|
+
return loadGovernanceConfig(fs, request.repoRoot, request.policy);
|
|
96
|
+
}
|
|
97
|
+
const relative = path.relative(request.repoRoot, path.resolve(request.repoRoot, request.policy ?? exports.GOVERNANCE_CONFIG_FILE));
|
|
98
|
+
const file = relative.split(path.sep).join('/');
|
|
99
|
+
try {
|
|
100
|
+
if (!request.processRunner || !file || path.isAbsolute(relative) || file.split('/').includes('..') || file.includes('\\') || file.includes(':')
|
|
101
|
+
|| [...file].some((char) => char.codePointAt(0) < 32)) {
|
|
102
|
+
throw new Error('Policy must be a safe repository-relative path.');
|
|
103
|
+
}
|
|
104
|
+
const content = await (0, governance_1.readGitBlob)(request.processRunner, request.repoRoot, mergeBase, file);
|
|
105
|
+
if (content === undefined && request.policy !== undefined) {
|
|
106
|
+
throw new Error('Explicit policy is missing from the merge base.');
|
|
107
|
+
}
|
|
108
|
+
return governanceConfigFromContent(content, file);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
const displayFile = file.startsWith('../') || path.isAbsolute(relative) ? path.basename(file) : file;
|
|
112
|
+
return { policy: {}, file: displayFile,
|
|
113
|
+
findings: [{ ruleId: 'CFG001', severity: 'error', file: displayFile,
|
|
114
|
+
message: 'Unable to read governance configuration from the PR base. Explicit policies must exist at the merge base within the repository.' }] };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Show paths relative to the repository root so reports never expose runner paths.
|
|
119
|
+
* @param findings
|
|
120
|
+
* @param repoRoot
|
|
121
|
+
*/
|
|
122
|
+
function withDisplayPaths(findings, repoRoot) {
|
|
123
|
+
const root = path.resolve(repoRoot);
|
|
124
|
+
return findings.map((finding) => {
|
|
125
|
+
if (finding.file === undefined) {
|
|
126
|
+
return finding;
|
|
127
|
+
}
|
|
128
|
+
if (!path.isAbsolute(finding.file)) {
|
|
129
|
+
return { ...finding, file: finding.file.replaceAll('\\', '/') };
|
|
130
|
+
}
|
|
131
|
+
const relative = path.relative(root, finding.file);
|
|
132
|
+
return relative.startsWith('..') || path.isAbsolute(relative)
|
|
133
|
+
? { ...finding, file: path.basename(finding.file) }
|
|
134
|
+
: { ...finding, file: relative.split(path.sep).join('/') };
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=load-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../src/governance/load-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,kEAMC;AASD,oDAcC;AAWD,gEAwBC;AAOD,4CAcC;AArHD;;;GAGG;AACH,gDAAkC;AAOlC,oEAG6C;AAE7C,wEAAwE;AAC3D,QAAA,sBAAsB,GAAG,oBAAoB,CAAC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,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC3D,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnD,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Collection PR scope: validate only files affected by the change. */
|
|
2
|
+
import type { ArgvProcessRunner } from '@ai-primitives-hub/core';
|
|
3
|
+
export interface PrScopeRequest {
|
|
4
|
+
baseRef?: string;
|
|
5
|
+
headRef?: string;
|
|
6
|
+
processRunner?: ArgvProcessRunner;
|
|
7
|
+
}
|
|
8
|
+
/** Report the exact comparison and collections covered by the run. */
|
|
9
|
+
export interface PrScope {
|
|
10
|
+
baseRef: string;
|
|
11
|
+
headRef: string;
|
|
12
|
+
mergeBase: string;
|
|
13
|
+
changedFiles: string[];
|
|
14
|
+
validated: string[];
|
|
15
|
+
sources?: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read changed files when both exact refs are supplied.
|
|
19
|
+
* @param request
|
|
20
|
+
* @param repoRoot
|
|
21
|
+
*/
|
|
22
|
+
export declare function readPrChanges(request: PrScopeRequest, repoRoot: string): Promise<import("@ai-primitives-hub/infra/governance").GitChangedFiles | undefined>;
|
|
23
|
+
//# sourceMappingURL=pr-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-scope.d.ts","sourceRoot":"","sources":["../../src/governance/pr-scope.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,KAAK,EACV,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAKjC,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,iBAAiB,CAAC;CACnC;AAED,sEAAsE;AACtE,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,sFAW5E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readPrChanges = readPrChanges;
|
|
4
|
+
const governance_1 = require("@ai-primitives-hub/infra/governance");
|
|
5
|
+
/**
|
|
6
|
+
* Read changed files when both exact refs are supplied.
|
|
7
|
+
* @param request
|
|
8
|
+
* @param repoRoot
|
|
9
|
+
*/
|
|
10
|
+
async function readPrChanges(request, repoRoot) {
|
|
11
|
+
if (request.baseRef === undefined && request.headRef === undefined) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (request.baseRef === undefined || request.headRef === undefined) {
|
|
15
|
+
throw new Error('Both --base-ref and --head-ref are required for PR validation.');
|
|
16
|
+
}
|
|
17
|
+
if (!request.processRunner) {
|
|
18
|
+
throw new Error('PR validation requires a process runner for Git.');
|
|
19
|
+
}
|
|
20
|
+
return (0, governance_1.readGitChangedFiles)(request.processRunner, repoRoot, request.baseRef, request.headRef);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=pr-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-scope.js","sourceRoot":"","sources":["../../src/governance/pr-scope.ts"],"names":[],"mappings":";;AA6BA,sCAWC;AApCD,oEAE6C;AAkB7C;;;;GAIG;AACI,KAAK,UAAU,aAAa,CAAC,OAAuB,EAAE,QAAgB;IAC3E,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACnE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,IAAA,gCAAmB,EAAC,OAAO,CAAC,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Markdown report formatting for the CLI and external consumers.
|
|
3
|
+
* Every rule that applies is listed with its result; failures and warnings are spelled out per level.
|
|
4
|
+
* @module app/governance/report
|
|
5
|
+
*/
|
|
6
|
+
import { type GovernanceReport, type HubScope } from '@ai-primitives-hub/core';
|
|
7
|
+
import type { PrScope } from './pr-scope';
|
|
8
|
+
/** Minimal view of the hub PR scope attached by scoped hub runs. */
|
|
9
|
+
type HubScopeView = Pick<HubScope, 'sources' | 'profiles' | 'sourceIds' | 'profileIds' | 'noOp'> & {
|
|
10
|
+
mergeBase?: string;
|
|
11
|
+
headRef?: string;
|
|
12
|
+
};
|
|
13
|
+
export type RenderableGovernanceReport = GovernanceReport & {
|
|
14
|
+
scope?: HubScopeView;
|
|
15
|
+
prScope?: PrScope;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Render one safe provider-owned report for the job summary and PR comment.
|
|
19
|
+
* @param report Structured verdict including findings, policy adjustments and optional PR scope.
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderGovernanceMarkdown(report: RenderableGovernanceReport): string;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/governance/report.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,QAAQ,EAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,OAAO,EACR,MAAM,YAAY,CAAC;AAapB,oEAAoE;AACpE,KAAK,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,CAAC,GAAG;IACjG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,GAAG;IAAE,KAAK,CAAC,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAiHxG;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,0BAA0B,GAAG,MAAM,CAyDnF"}
|