@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,289 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HubConfigEditorService = exports.consolidateSourceCatalog = void 0;
|
|
4
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
5
|
+
const infra_1 = require("@ai-primitives-hub/infra");
|
|
6
|
+
const create_source_adapter_1 = require("../registry/create-source-adapter");
|
|
7
|
+
const validate_hub_config_file_1 = require("../registry/validate-hub-config-file");
|
|
8
|
+
var core_2 = require("@ai-primitives-hub/core");
|
|
9
|
+
Object.defineProperty(exports, "consolidateSourceCatalog", { enumerable: true, get: function () { return core_2.consolidateSourceCatalog; } });
|
|
10
|
+
class HubConfigEditorService {
|
|
11
|
+
catalogsBySourceId = new Map();
|
|
12
|
+
lastDeepDiagnostics = [];
|
|
13
|
+
lastDeepDecorations = [];
|
|
14
|
+
recordDeepValidationResults(deepResult, config, nodeRanges) {
|
|
15
|
+
const deepDiags = [];
|
|
16
|
+
const deepDecos = [];
|
|
17
|
+
const sourceIndexById = new Map();
|
|
18
|
+
(config?.sources ?? []).forEach((s, idx) => {
|
|
19
|
+
if (s?.id) {
|
|
20
|
+
sourceIndexById.set(s.id, { index: idx, source: s });
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const profileIndexById = new Map();
|
|
24
|
+
(config?.profiles ?? []).forEach((p, idx) => {
|
|
25
|
+
if (p?.id) {
|
|
26
|
+
profileIndexById.set(p.id, { index: idx, profile: p });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
for (const srcResult of deepResult.sources) {
|
|
30
|
+
const srcMeta = sourceIndexById.get(srcResult.sourceId);
|
|
31
|
+
const formattedCatalog = (0, core_1.consolidateSourceCatalog)(srcMeta?.source, srcResult.bundles);
|
|
32
|
+
this.catalogsBySourceId.set(srcResult.sourceId, formattedCatalog);
|
|
33
|
+
if (srcMeta) {
|
|
34
|
+
const range = nodeRanges.get(`sources.${srcMeta.index}`);
|
|
35
|
+
if (!srcResult.valid) {
|
|
36
|
+
for (const errMsg of srcResult.errors) {
|
|
37
|
+
deepDiags.push({
|
|
38
|
+
code: 'HUB_SOURCE_UNREACHABLE',
|
|
39
|
+
severity: 'error',
|
|
40
|
+
message: `Source '${srcResult.sourceId}': ${errMsg}`,
|
|
41
|
+
jsonPath: ['sources', srcMeta.index],
|
|
42
|
+
range
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (range) {
|
|
47
|
+
deepDecos.push({
|
|
48
|
+
line: range.startLine,
|
|
49
|
+
text: srcResult.skipped
|
|
50
|
+
? `${srcResult.sourceType} • skipped (disabled)`
|
|
51
|
+
: (srcResult.valid
|
|
52
|
+
? `✓ ${srcResult.sourceType} • ${formattedCatalog.length} bundle(s) discovered`
|
|
53
|
+
: `✗ ${srcResult.sourceType} • unreachable`),
|
|
54
|
+
status: srcResult.valid ? 'ok' : 'error',
|
|
55
|
+
jsonPath: ['sources', srcMeta.index]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const profResult of deepResult.profiles) {
|
|
61
|
+
const profMeta = profileIndexById.get(profResult.profileId);
|
|
62
|
+
if (!profMeta) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const yamlBundles = Array.isArray(profMeta.profile.bundles) ? profMeta.profile.bundles : [];
|
|
66
|
+
const usedYamlIndices = new Set();
|
|
67
|
+
profResult.bundles.forEach((bResult, bIdx) => {
|
|
68
|
+
let yamlBundleIdx = yamlBundles.findIndex((yb, idx) => !usedYamlIndices.has(idx)
|
|
69
|
+
&& yb?.id === bResult.bundleId
|
|
70
|
+
&& yb?.source === bResult.sourceId
|
|
71
|
+
&& (yb?.version || 'latest') === (bResult.requestedVersion || 'latest'));
|
|
72
|
+
if (yamlBundleIdx === -1) {
|
|
73
|
+
yamlBundleIdx = bIdx;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
usedYamlIndices.add(yamlBundleIdx);
|
|
77
|
+
}
|
|
78
|
+
const bundleRange = nodeRanges.get(`profiles.${profMeta.index}.bundles.${yamlBundleIdx}.id`)
|
|
79
|
+
?? nodeRanges.get(`profiles.${profMeta.index}.bundles.${yamlBundleIdx}`);
|
|
80
|
+
if (!bResult.valid) {
|
|
81
|
+
for (const errMsg of bResult.errors) {
|
|
82
|
+
const isVersionErr = errMsg.includes('available versions are');
|
|
83
|
+
deepDiags.push({
|
|
84
|
+
code: isVersionErr ? 'HUB_BUNDLE_VERSION_NOT_FOUND' : 'HUB_BUNDLE_NOT_FOUND',
|
|
85
|
+
severity: bResult.required ? 'error' : 'warning',
|
|
86
|
+
message: errMsg,
|
|
87
|
+
jsonPath: ['profiles', profMeta.index, 'bundles', yamlBundleIdx, isVersionErr ? 'version' : 'id'],
|
|
88
|
+
range: bundleRange
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else if (bResult.warnings.length > 0) {
|
|
93
|
+
for (const warnMsg of bResult.warnings) {
|
|
94
|
+
deepDiags.push({
|
|
95
|
+
code: 'HUB_BUNDLE_NOT_FOUND',
|
|
96
|
+
severity: 'warning',
|
|
97
|
+
message: warnMsg,
|
|
98
|
+
jsonPath: ['profiles', profMeta.index, 'bundles', yamlBundleIdx, 'id'],
|
|
99
|
+
range: bundleRange
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (bundleRange && bResult.resolvedBundle) {
|
|
104
|
+
deepDecos.push({
|
|
105
|
+
line: bundleRange.startLine,
|
|
106
|
+
text: `✓ resolved v${bResult.resolvedBundle.version} (${bResult.sourceId})`,
|
|
107
|
+
status: 'ok',
|
|
108
|
+
jsonPath: ['profiles', profMeta.index, 'bundles', yamlBundleIdx]
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
this.lastDeepDiagnostics = deepDiags;
|
|
114
|
+
this.lastDeepDecorations = deepDecos;
|
|
115
|
+
}
|
|
116
|
+
remapDeepDiagnostics(nodeRanges) {
|
|
117
|
+
return this.lastDeepDiagnostics.map((d) => ({
|
|
118
|
+
...d,
|
|
119
|
+
range: nodeRanges.get(d.jsonPath.join('.')) ?? d.range
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
mergeDecorations(staticDecos, deepDecos, nodeRanges) {
|
|
123
|
+
const byPath = new Map();
|
|
124
|
+
for (const d of staticDecos) {
|
|
125
|
+
byPath.set(d.jsonPath.join('.'), d);
|
|
126
|
+
}
|
|
127
|
+
for (const d of deepDecos) {
|
|
128
|
+
const key = d.jsonPath.join('.');
|
|
129
|
+
const range = nodeRanges.get(key);
|
|
130
|
+
byPath.set(key, {
|
|
131
|
+
...d,
|
|
132
|
+
line: range ? range.startLine : d.line
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return [...byPath.values()];
|
|
136
|
+
}
|
|
137
|
+
groupProfilesByCategory(profiles) {
|
|
138
|
+
const groups = new Map();
|
|
139
|
+
profiles.forEach((profile, index) => {
|
|
140
|
+
if (!profile || typeof profile !== 'object') {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const category = Array.isArray(profile.path) && profile.path.length > 0
|
|
144
|
+
? profile.path.join(' / ')
|
|
145
|
+
: 'Uncategorized';
|
|
146
|
+
const list = groups.get(category) ?? [];
|
|
147
|
+
list.push({ index, profile });
|
|
148
|
+
groups.set(category, list);
|
|
149
|
+
});
|
|
150
|
+
return [...groups.entries()].map(([category, items]) => ({
|
|
151
|
+
category,
|
|
152
|
+
profiles: items
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Inspect a `hub-config.yml` string offline (syntax, schema, policies, ranges,
|
|
157
|
+
* categories, and any cached deep catalogs/diagnostics).
|
|
158
|
+
* @param content Raw YAML document string.
|
|
159
|
+
* @returns Complete document inspection payload.
|
|
160
|
+
*/
|
|
161
|
+
inspectDocument(content) {
|
|
162
|
+
const staticResult = (0, infra_1.validateHubConfigYaml)(content);
|
|
163
|
+
const config = (staticResult.config && typeof staticResult.config === 'object' && !Array.isArray(staticResult.config))
|
|
164
|
+
? staticResult.config
|
|
165
|
+
: undefined;
|
|
166
|
+
const catalogsRecord = {};
|
|
167
|
+
for (const [sourceId, bundles] of this.catalogsBySourceId.entries()) {
|
|
168
|
+
catalogsRecord[sourceId] = bundles;
|
|
169
|
+
}
|
|
170
|
+
const profileCategories = this.groupProfilesByCategory(config?.profiles ?? []);
|
|
171
|
+
const mergedDiagnostics = [...staticResult.diagnostics, ...this.remapDeepDiagnostics(staticResult.nodeRanges)];
|
|
172
|
+
const mergedDecorations = this.mergeDecorations(staticResult.inlineDecorations, this.lastDeepDecorations, staticResult.nodeRanges);
|
|
173
|
+
const hasErrorDiag = mergedDiagnostics.some((d) => d.severity === 'error');
|
|
174
|
+
return {
|
|
175
|
+
valid: staticResult.valid && !hasErrorDiag,
|
|
176
|
+
config,
|
|
177
|
+
errors: [
|
|
178
|
+
...staticResult.errors,
|
|
179
|
+
...mergedDiagnostics
|
|
180
|
+
.filter((d) => d.severity === 'error' && !staticResult.errors.includes(d.message))
|
|
181
|
+
.map((d) => d.message)
|
|
182
|
+
],
|
|
183
|
+
warnings: staticResult.warnings ?? [],
|
|
184
|
+
diagnostics: mergedDiagnostics,
|
|
185
|
+
inlineDecorations: mergedDecorations,
|
|
186
|
+
nodeRanges: staticResult.nodeRanges,
|
|
187
|
+
catalogsBySourceId: catalogsRecord,
|
|
188
|
+
profileCategories
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Apply a comment-preserving CRUD or quick-fix mutation to `hub-config.yml`
|
|
193
|
+
* and return the updated content along with its fresh inspection.
|
|
194
|
+
* @param content Current YAML content.
|
|
195
|
+
* @param mutation Mutation to apply.
|
|
196
|
+
*/
|
|
197
|
+
applyMutation(content, mutation) {
|
|
198
|
+
this.lastDeepDiagnostics = [];
|
|
199
|
+
this.lastDeepDecorations = [];
|
|
200
|
+
const updatedContent = (0, infra_1.applyHubYamlMutation)(content, mutation);
|
|
201
|
+
return {
|
|
202
|
+
updatedContent,
|
|
203
|
+
inspection: this.inspectDocument(updatedContent)
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Locate the semantic node enclosing a 0-based line number in `hub-config.yml`.
|
|
208
|
+
* @param content Raw YAML content.
|
|
209
|
+
* @param line 0-based line number.
|
|
210
|
+
*/
|
|
211
|
+
locateCursor(content, line) {
|
|
212
|
+
return (0, infra_1.locateHubYamlCursor)(content, line);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Summarize structural changes between a base `hub-config.yml` and an edited
|
|
216
|
+
* `hub-config.yml` for commit messages and PR descriptions.
|
|
217
|
+
* @param baseContent Base YAML content.
|
|
218
|
+
* @param currentContent Edited YAML content.
|
|
219
|
+
*/
|
|
220
|
+
summarizeChanges(baseContent, currentContent) {
|
|
221
|
+
return (0, infra_1.summarizeHubYamlChanges)(baseContent, currentContent);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Validate a single source and discover its bundle catalog for the Bundle Picker.
|
|
225
|
+
* @param source Source definition to probe.
|
|
226
|
+
* @param sourceAdapterDeps Dependencies for creating the source adapter.
|
|
227
|
+
*/
|
|
228
|
+
async discoverSourceBundles(source, sourceAdapterDeps) {
|
|
229
|
+
try {
|
|
230
|
+
const adapter = (0, create_source_adapter_1.createSourceAdapter)(source, sourceAdapterDeps);
|
|
231
|
+
const validation = await adapter.validate();
|
|
232
|
+
if (!validation.valid) {
|
|
233
|
+
this.catalogsBySourceId.delete(source.id);
|
|
234
|
+
return {
|
|
235
|
+
valid: false,
|
|
236
|
+
errors: validation.errors,
|
|
237
|
+
bundles: []
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const rawBundles = adapter.fetchCatalog
|
|
241
|
+
? await adapter.fetchCatalog()
|
|
242
|
+
: await adapter.fetchBundles();
|
|
243
|
+
const catalog = (0, core_1.consolidateSourceCatalog)(source, rawBundles);
|
|
244
|
+
this.catalogsBySourceId.set(source.id, catalog);
|
|
245
|
+
return {
|
|
246
|
+
valid: true,
|
|
247
|
+
errors: [],
|
|
248
|
+
bundles: catalog
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
this.catalogsBySourceId.delete(source.id);
|
|
253
|
+
return {
|
|
254
|
+
valid: false,
|
|
255
|
+
errors: [error instanceof Error ? error.message : String(error)],
|
|
256
|
+
bundles: []
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Run deep hub configuration validation (source reachability, catalog
|
|
262
|
+
* discovery, and profile bundle/version resolution) and map results onto
|
|
263
|
+
* YAML line ranges and inline decorations.
|
|
264
|
+
* @param _fs Filesystem port (retained for signature compatibility).
|
|
265
|
+
* @param filePath Path to `hub-config.yml`.
|
|
266
|
+
* @param content Current YAML content.
|
|
267
|
+
* @param options Deep validation options.
|
|
268
|
+
* @param options.sourceAdapterDeps
|
|
269
|
+
* @param options.onProgress
|
|
270
|
+
*/
|
|
271
|
+
async validateDeep(_fs, filePath, content, options) {
|
|
272
|
+
const staticCheck = (0, infra_1.validateHubConfigYaml)(content);
|
|
273
|
+
if (!staticCheck.valid) {
|
|
274
|
+
return this.inspectDocument(content);
|
|
275
|
+
}
|
|
276
|
+
const result = await (0, validate_hub_config_file_1.validateHubConfigContent)(content, filePath, {
|
|
277
|
+
deep: true,
|
|
278
|
+
sourceAdapterDeps: options.sourceAdapterDeps,
|
|
279
|
+
onProgress: options.onProgress
|
|
280
|
+
});
|
|
281
|
+
if (!('deep' in result) || !result.deep) {
|
|
282
|
+
return this.inspectDocument(content);
|
|
283
|
+
}
|
|
284
|
+
this.recordDeepValidationResults(result, staticCheck.config, staticCheck.nodeRanges);
|
|
285
|
+
return this.inspectDocument(content);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
exports.HubConfigEditorService = HubConfigEditorService;
|
|
289
|
+
//# sourceMappingURL=hub-config-editor-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-config-editor-service.js","sourceRoot":"","sources":["../../src/hub-editor/hub-config-editor-service.ts"],"names":[],"mappings":";;;AAkBA,kDAEiC;AACjC,oDAMkC;AAClC,6EAG2C;AAC3C,mFAI8C;AAE9C,gDAGiC;AAF/B,gHAAA,wBAAwB,OAAA;AAwB1B,MAAa,sBAAsB;IAChB,kBAAkB,GAAG,IAAI,GAAG,EAAmC,CAAC;IACzE,mBAAmB,GAA8B,EAAE,CAAC;IACpD,mBAAmB,GAA0B,EAAE,CAAC;IAEhD,2BAA2B,CACjC,UAAyC,EACzC,MAA6B,EAC7B,UAAoC;QAEpC,MAAM,SAAS,GAA8B,EAAE,CAAC;QAChD,MAAM,SAAS,GAA0B,EAAE,CAAC;QAE5C,MAAM,eAAe,GAAG,IAAI,GAAG,EAAmE,CAAC;QACnG,CAAC,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;YACzC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;gBACV,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkD,CAAC;QACnF,CAAC,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;YAC1C,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;gBACV,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAA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Q,EAAE;YAC/D,IAAI,EAAE,IAAI;YACV,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CAAC;QAEH,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,2BAA2B,CAC9B,MAAM,EACN,WAAW,CAAC,MAA+B,EAC3C,WAAW,CAAC,UAAU,CACvB,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF;AA1UD,wDA0UC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Clock, FileSystem, GitHubAccountResolution, GitHubCollaborationPort, GitWorkspacePort, HubConfig, HubContributionEligibility, HubContributionSession, HubPullRequestInfo, HubReference } from '@ai-primitives-hub/core';
|
|
2
|
+
export interface HubContributionWorkflowDeps {
|
|
3
|
+
fs: FileSystem;
|
|
4
|
+
clock: Clock;
|
|
5
|
+
github: GitHubCollaborationPort;
|
|
6
|
+
git: GitWorkspacePort;
|
|
7
|
+
/** File path where active contribution sessions are persisted. */
|
|
8
|
+
sessionStorePath: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BootstrapHubContributionInput {
|
|
11
|
+
hubId: string;
|
|
12
|
+
hubName: string;
|
|
13
|
+
hubReference: HubReference;
|
|
14
|
+
targetDir: string;
|
|
15
|
+
branchName: string;
|
|
16
|
+
preferredGitHubLogin?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SubmitHubPullRequestInput {
|
|
19
|
+
workspaceDir: string;
|
|
20
|
+
hubConfigFileName?: string;
|
|
21
|
+
commitMessage?: string;
|
|
22
|
+
prTitle?: string;
|
|
23
|
+
prBody?: string;
|
|
24
|
+
draft?: boolean;
|
|
25
|
+
touchUpdatedAt?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface WorkspaceContributionContext {
|
|
28
|
+
isHubWorkspace: boolean;
|
|
29
|
+
workspaceDir: string;
|
|
30
|
+
hubConfigPath: string;
|
|
31
|
+
upstreamSlug?: string;
|
|
32
|
+
forkSlug?: string;
|
|
33
|
+
currentBranch?: string;
|
|
34
|
+
defaultBranch: string;
|
|
35
|
+
hasUncommittedChanges: boolean;
|
|
36
|
+
session?: HubContributionSession;
|
|
37
|
+
}
|
|
38
|
+
export declare class HubContributionWorkflowService {
|
|
39
|
+
private readonly deps;
|
|
40
|
+
constructor(deps: HubContributionWorkflowDeps);
|
|
41
|
+
/**
|
|
42
|
+
* Determine whether a hub is eligible for contribution and visual editing.
|
|
43
|
+
*
|
|
44
|
+
* Only hubs connected with GitHub are qualified. Artifactory hubs are
|
|
45
|
+
* read-only replicas populated by the promotion process and are strictly
|
|
46
|
+
* rejected.
|
|
47
|
+
* @param hub Hub descriptor (`id`, `config`, `reference`).
|
|
48
|
+
* @param hub.id
|
|
49
|
+
* @param hub.config
|
|
50
|
+
* @param hub.reference
|
|
51
|
+
*/
|
|
52
|
+
evaluateHubForContribution(hub: {
|
|
53
|
+
id: string;
|
|
54
|
+
config: HubConfig;
|
|
55
|
+
reference: HubReference;
|
|
56
|
+
}): Promise<HubContributionEligibility>;
|
|
57
|
+
/**
|
|
58
|
+
* Probe available `gh auth` accounts against a target `owner/repo` and
|
|
59
|
+
* optionally switch the active `gh` account to one with verified access.
|
|
60
|
+
* @param repositorySlug Target `owner/repo` slug.
|
|
61
|
+
* @param options Account resolution options.
|
|
62
|
+
* @param options.switchActive
|
|
63
|
+
* @param options.preferredLogin
|
|
64
|
+
*/
|
|
65
|
+
resolveHubGitHubAccount(repositorySlug: string, options?: {
|
|
66
|
+
switchActive?: boolean;
|
|
67
|
+
preferredLogin?: string;
|
|
68
|
+
}): Promise<GitHubAccountResolution | undefined>;
|
|
69
|
+
/**
|
|
70
|
+
* Execute the Fork -> Clone (or Sync existing local clone) -> Branch pipeline
|
|
71
|
+
* and persist the contribution session.
|
|
72
|
+
* @param input Bootstrap parameters.
|
|
73
|
+
*/
|
|
74
|
+
bootstrapContributionWorkspace(input: BootstrapHubContributionInput): Promise<HubContributionSession & {
|
|
75
|
+
accountResolution?: GitHubAccountResolution;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Inspect a local workspace directory to determine its hub contribution state.
|
|
79
|
+
* @param workspaceDir Local workspace root directory.
|
|
80
|
+
*/
|
|
81
|
+
getWorkspaceContributionContext(workspaceDir: string): Promise<WorkspaceContributionContext>;
|
|
82
|
+
/**
|
|
83
|
+
* Validate `hub-config.yml`, touch `metadata.updatedAt`, stage, commit, push
|
|
84
|
+
* to the fork remote, and create a Pull Request against the upstream hub repo.
|
|
85
|
+
* @param input Submission options.
|
|
86
|
+
*/
|
|
87
|
+
submitPullRequest(input: SubmitHubPullRequestInput): Promise<HubPullRequestInfo>;
|
|
88
|
+
/**
|
|
89
|
+
* Refresh the Pull Request and CI check-run status for a local hub workspace.
|
|
90
|
+
* Only open Pull Requests are tracked; if a previously tracked PR has been
|
|
91
|
+
* closed or merged, it is cleared from the active session unless a newer open
|
|
92
|
+
* PR exists for the current branch.
|
|
93
|
+
* @param workspaceDir Local workspace root directory.
|
|
94
|
+
*/
|
|
95
|
+
refreshPullRequestStatus(workspaceDir: string): Promise<HubPullRequestInfo | undefined>;
|
|
96
|
+
loadSession(workspaceDir: string): Promise<HubContributionSession | undefined>;
|
|
97
|
+
saveSession(session: HubContributionSession): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=hub-contribution-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-contribution-workflow.d.ts","sourceRoot":"","sources":["../../src/hub-editor/hub-contribution-workflow.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,KAAK,EACL,UAAU,EACV,uBAAuB,EACvB,uBAAuB,EACvB,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