@ai-primitives-hub/app 0.2.1 → 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,868 @@
|
|
|
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.CollectionEditorService = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* Use-case service for inspecting, mutating, validating, and scaffolding
|
|
39
|
+
* `.collection.yml` documents and their referenced primitive files across the
|
|
40
|
+
* Visual Collection Editor, Collections Tree View, and YAML Text Editor Intelligence.
|
|
41
|
+
* @module collection-editor/collection-editor-service
|
|
42
|
+
*/
|
|
43
|
+
const fs = __importStar(require("node:fs"));
|
|
44
|
+
const path = __importStar(require("node:path"));
|
|
45
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
46
|
+
const infra_1 = require("@ai-primitives-hub/infra");
|
|
47
|
+
const yaml = __importStar(require("js-yaml"));
|
|
48
|
+
const create_plugin_1 = require("../collection/create-plugin");
|
|
49
|
+
const PRIMITIVE_SCAN_DIRS = [
|
|
50
|
+
'prompts',
|
|
51
|
+
'instructions',
|
|
52
|
+
'agents',
|
|
53
|
+
'chat-modes',
|
|
54
|
+
'chatmodes',
|
|
55
|
+
'skills',
|
|
56
|
+
'plugins',
|
|
57
|
+
'hooks',
|
|
58
|
+
'mcp-servers',
|
|
59
|
+
'knowledge',
|
|
60
|
+
'playbooks',
|
|
61
|
+
'powers',
|
|
62
|
+
'.kiro/steering',
|
|
63
|
+
'.kiro/specs',
|
|
64
|
+
'.claude/commands',
|
|
65
|
+
'.claude/output-styles',
|
|
66
|
+
'.cursor/rules',
|
|
67
|
+
'.opencode/tools'
|
|
68
|
+
];
|
|
69
|
+
const humanizeSlug = (slug) => slug
|
|
70
|
+
.replace(/\.(?:prompt|instructions?|agent|chatmode|skill|hook|mcp)\.(?:md|json)$/i, '')
|
|
71
|
+
.replace(/\.(?:md|mdc|json|py|ts|js)$/i, '')
|
|
72
|
+
.split(/[-_./]+/)
|
|
73
|
+
.filter((w) => w.length > 0)
|
|
74
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
75
|
+
.join(' ');
|
|
76
|
+
const WORKSPACE_SCAN_CACHE_TTL_MS = 2000;
|
|
77
|
+
class CollectionEditorService {
|
|
78
|
+
primitivesCacheByWorkspace = new Map();
|
|
79
|
+
siblingsCacheByDir = new Map();
|
|
80
|
+
buildFileProbe(workspaceRoot) {
|
|
81
|
+
if (!workspaceRoot) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return (relPath) => {
|
|
85
|
+
try {
|
|
86
|
+
const normalized = (0, core_1.normalizeRepoRelativePath)(relPath);
|
|
87
|
+
const abs = (0, infra_1.resolveWorkspacePath)(workspaceRoot, normalized);
|
|
88
|
+
if (!fs.existsSync(abs)) {
|
|
89
|
+
return { exists: false };
|
|
90
|
+
}
|
|
91
|
+
const stat = fs.statSync(abs);
|
|
92
|
+
const isFile = stat.isFile();
|
|
93
|
+
const content = isFile ? fs.readFileSync(abs, 'utf8') : undefined;
|
|
94
|
+
return {
|
|
95
|
+
exists: true,
|
|
96
|
+
isFile,
|
|
97
|
+
content
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return { exists: false };
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
collectSiblingSummaries(workspaceRoot, collectionsPath = 'collections', excludeFilePath) {
|
|
106
|
+
if (!workspaceRoot) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
const dir = (0, infra_1.resolveWorkspacePath)(workspaceRoot, collectionsPath);
|
|
110
|
+
const cacheKey = path.resolve(dir);
|
|
111
|
+
const now = Date.now();
|
|
112
|
+
const cached = this.siblingsCacheByDir.get(cacheKey);
|
|
113
|
+
let allSiblings;
|
|
114
|
+
if (cached && now - cached.cachedAt < WORKSPACE_SCAN_CACHE_TTL_MS) {
|
|
115
|
+
allSiblings = cached.siblings;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
if (!fs.existsSync(dir)) {
|
|
119
|
+
return [];
|
|
120
|
+
}
|
|
121
|
+
let entries = [];
|
|
122
|
+
try {
|
|
123
|
+
entries = fs.readdirSync(dir).filter((f) => /\.collection\.ya?ml$/i.test(f));
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
allSiblings = [];
|
|
129
|
+
for (const fileName of entries) {
|
|
130
|
+
const relLabel = `${collectionsPath}/${fileName}`.replaceAll('\\', '/');
|
|
131
|
+
try {
|
|
132
|
+
const absPath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, `${collectionsPath}/${fileName}`);
|
|
133
|
+
const parsed = yaml.load(fs.readFileSync(absPath, 'utf8'));
|
|
134
|
+
allSiblings.push({
|
|
135
|
+
file: relLabel,
|
|
136
|
+
id: typeof parsed?.id === 'string' ? parsed.id : undefined,
|
|
137
|
+
name: typeof parsed?.name === 'string' ? parsed.name : undefined
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
allSiblings.push({ file: relLabel });
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
this.siblingsCacheByDir.set(cacheKey, { siblings: allSiblings, cachedAt: now });
|
|
145
|
+
}
|
|
146
|
+
if (!excludeFilePath) {
|
|
147
|
+
return allSiblings;
|
|
148
|
+
}
|
|
149
|
+
const excludedRel = this.toWorkspaceRelativeLabel(workspaceRoot, excludeFilePath);
|
|
150
|
+
return allSiblings.filter((s) => s.file !== excludedRel);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Workspace-relative, forward-slash label for a file. The root and parent
|
|
154
|
+
* directory are compared by realpath so OS path aliases (macOS `/var` →
|
|
155
|
+
* `/private/var`, Windows 8.3 short names) still yield `collections/<file>`;
|
|
156
|
+
* the file name itself is kept, so a symlinked collection keeps its own label.
|
|
157
|
+
* @param workspaceRoot Workspace root directory.
|
|
158
|
+
* @param filePath File path inside the workspace.
|
|
159
|
+
*/
|
|
160
|
+
toWorkspaceRelativeLabel(workspaceRoot, filePath) {
|
|
161
|
+
const parent = path.dirname(filePath);
|
|
162
|
+
return (fs.existsSync(parent)
|
|
163
|
+
? path.relative(fs.realpathSync.native(workspaceRoot), path.join(fs.realpathSync.native(parent), path.basename(filePath)))
|
|
164
|
+
: path.relative(workspaceRoot, filePath)).replaceAll('\\', '/');
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Invalidate cached workspace primitive and sibling collection scans.
|
|
168
|
+
* @param workspaceRoot Optional workspace root path to clear; clears all when omitted.
|
|
169
|
+
*/
|
|
170
|
+
clearWorkspaceCache(workspaceRoot) {
|
|
171
|
+
if (!workspaceRoot) {
|
|
172
|
+
this.primitivesCacheByWorkspace.clear();
|
|
173
|
+
this.siblingsCacheByDir.clear();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const normalizedRoot = path.resolve(workspaceRoot);
|
|
177
|
+
this.primitivesCacheByWorkspace.delete(normalizedRoot);
|
|
178
|
+
for (const key of this.siblingsCacheByDir.keys()) {
|
|
179
|
+
if (key.startsWith(normalizedRoot)) {
|
|
180
|
+
this.siblingsCacheByDir.delete(key);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Discover all candidate primitive files across standard repository folders.
|
|
186
|
+
* @param workspaceRoot Repository root path.
|
|
187
|
+
*/
|
|
188
|
+
discoverWorkspacePrimitives(workspaceRoot) {
|
|
189
|
+
if (!workspaceRoot || !fs.existsSync(workspaceRoot)) {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
const cacheKey = path.resolve(workspaceRoot);
|
|
193
|
+
const now = Date.now();
|
|
194
|
+
const cached = this.primitivesCacheByWorkspace.get(cacheKey);
|
|
195
|
+
if (cached && now - cached.cachedAt < WORKSPACE_SCAN_CACHE_TTL_MS) {
|
|
196
|
+
return cached.candidates;
|
|
197
|
+
}
|
|
198
|
+
const candidates = [];
|
|
199
|
+
const seen = new Set();
|
|
200
|
+
const addCandidate = (relPath) => {
|
|
201
|
+
const normalized = relPath.replaceAll('\\', '/');
|
|
202
|
+
if (seen.has(normalized)) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
seen.add(normalized);
|
|
206
|
+
const kind = (0, core_1.inferPrimitiveKindFromPath)(normalized);
|
|
207
|
+
let title = humanizeSlug(kind === 'skill' || kind === 'plugin' || kind === 'power'
|
|
208
|
+
? path.basename(path.dirname(normalized))
|
|
209
|
+
: path.basename(normalized));
|
|
210
|
+
let description;
|
|
211
|
+
try {
|
|
212
|
+
const abs = (0, infra_1.resolveWorkspacePath)(workspaceRoot, normalized);
|
|
213
|
+
if (fs.existsSync(abs) && fs.statSync(abs).isFile()) {
|
|
214
|
+
const text = fs.readFileSync(abs, 'utf8');
|
|
215
|
+
if (normalized.endsWith('.json')) {
|
|
216
|
+
const jsonObj = JSON.parse(text);
|
|
217
|
+
if (typeof jsonObj.name === 'string' && jsonObj.name) {
|
|
218
|
+
title = jsonObj.name;
|
|
219
|
+
}
|
|
220
|
+
if (typeof jsonObj.description === 'string' && jsonObj.description) {
|
|
221
|
+
description = jsonObj.description;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
const fm = (0, core_1.parsePrimitiveFrontmatter)(text);
|
|
226
|
+
if (typeof fm.frontmatter.name === 'string' && fm.frontmatter.name) {
|
|
227
|
+
title = fm.frontmatter.name;
|
|
228
|
+
}
|
|
229
|
+
else if (typeof fm.frontmatter.title === 'string' && fm.frontmatter.title) {
|
|
230
|
+
title = fm.frontmatter.title;
|
|
231
|
+
}
|
|
232
|
+
if (typeof fm.frontmatter.description === 'string' && fm.frontmatter.description) {
|
|
233
|
+
description = fm.frontmatter.description;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
// Fallback to humanized slug
|
|
240
|
+
}
|
|
241
|
+
candidates.push({
|
|
242
|
+
path: normalized,
|
|
243
|
+
kind,
|
|
244
|
+
title,
|
|
245
|
+
description
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
const walkDir = (absDir, maxDepth = 3) => {
|
|
249
|
+
if (maxDepth < 0 || !fs.existsSync(absDir)) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
let entries = [];
|
|
253
|
+
try {
|
|
254
|
+
entries = fs.readdirSync(absDir, { withFileTypes: true });
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
for (const entry of entries) {
|
|
260
|
+
const childAbs = path.join(absDir, entry.name);
|
|
261
|
+
const rel = path.relative(fs.realpathSync.native(workspaceRoot), childAbs).replaceAll('\\', '/');
|
|
262
|
+
if (entry.isDirectory()) {
|
|
263
|
+
// If it's a skill directory with SKILL.md, register SKILL.md directly
|
|
264
|
+
const skillMd = path.join(childAbs, 'SKILL.md');
|
|
265
|
+
if (fs.existsSync(skillMd) && fs.statSync(skillMd).isFile()) {
|
|
266
|
+
addCandidate(path.relative(fs.realpathSync.native(workspaceRoot), skillMd).replaceAll('\\', '/'));
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
// If it's a plugin directory with plugin.json, register plugin.json directly
|
|
270
|
+
const pluginJson = path.join(childAbs, 'plugin.json');
|
|
271
|
+
if (fs.existsSync(pluginJson) && fs.statSync(pluginJson).isFile()) {
|
|
272
|
+
addCandidate(path.relative(fs.realpathSync.native(workspaceRoot), pluginJson).replaceAll('\\', '/'));
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
// If it's a power directory with POWER.md, register POWER.md directly
|
|
276
|
+
const powerMd = path.join(childAbs, 'POWER.md');
|
|
277
|
+
if (fs.existsSync(powerMd) && fs.statSync(powerMd).isFile()) {
|
|
278
|
+
addCandidate(path.relative(fs.realpathSync.native(workspaceRoot), powerMd).replaceAll('\\', '/'));
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
walkDir(childAbs, maxDepth - 1);
|
|
282
|
+
}
|
|
283
|
+
else if (entry.isFile() && /\.(?:md|mdc|json|py|ts|js)$/i.test(entry.name)) {
|
|
284
|
+
addCandidate(rel);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
for (const scanRel of PRIMITIVE_SCAN_DIRS) {
|
|
289
|
+
walkDir((0, infra_1.resolveWorkspacePath)(workspaceRoot, scanRel), 3);
|
|
290
|
+
}
|
|
291
|
+
const sortedCandidates = candidates.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
292
|
+
this.primitivesCacheByWorkspace.set(cacheKey, {
|
|
293
|
+
candidates: sortedCandidates,
|
|
294
|
+
cachedAt: Date.now()
|
|
295
|
+
});
|
|
296
|
+
return sortedCandidates;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Inspect a `.collection.yml` document string and resolve item statuses,
|
|
300
|
+
* diagnostics, inline decorations, and unassigned workspace primitives.
|
|
301
|
+
* @param content Raw YAML document string.
|
|
302
|
+
* @param options Optional file path, workspace root, sibling summaries, and pre-discovered primitives.
|
|
303
|
+
* @param options.filePath
|
|
304
|
+
* @param options.workspaceRoot
|
|
305
|
+
* @param options.siblingCollections
|
|
306
|
+
* @param options.workspacePrimitives
|
|
307
|
+
*/
|
|
308
|
+
inspectDocument(content, options) {
|
|
309
|
+
const workspaceRoot = options?.workspaceRoot
|
|
310
|
+
?? (options?.filePath ? path.resolve(path.dirname(options.filePath), '..') : undefined);
|
|
311
|
+
const fileLabel = (options?.filePath && workspaceRoot)
|
|
312
|
+
? this.toWorkspaceRelativeLabel(workspaceRoot, options.filePath)
|
|
313
|
+
: (options?.filePath ? path.basename(options.filePath) : 'collection.yml');
|
|
314
|
+
const checkFile = this.buildFileProbe(workspaceRoot);
|
|
315
|
+
const siblingCollections = options?.siblingCollections
|
|
316
|
+
?? this.collectSiblingSummaries(workspaceRoot, 'collections', options?.filePath);
|
|
317
|
+
const validation = (0, infra_1.validateCollectionYaml)(content, {
|
|
318
|
+
fileLabel,
|
|
319
|
+
checkFile,
|
|
320
|
+
siblingCollections
|
|
321
|
+
});
|
|
322
|
+
const manifest = validation.manifest;
|
|
323
|
+
const items = Array.isArray(manifest?.items) ? manifest.items : [];
|
|
324
|
+
const workspacePrimitives = options?.workspacePrimitives
|
|
325
|
+
?? (workspaceRoot ? this.discoverWorkspacePrimitives(workspaceRoot) : []);
|
|
326
|
+
const primitiveByPath = new Map(workspacePrimitives.map((p) => [p.path, p]));
|
|
327
|
+
const assignedPaths = new Set();
|
|
328
|
+
const itemStatuses = items.map((item, idx) => {
|
|
329
|
+
const rawPath = typeof item?.path === 'string' ? item.path : '';
|
|
330
|
+
let normalizedPath = rawPath;
|
|
331
|
+
try {
|
|
332
|
+
normalizedPath = (0, core_1.normalizeRepoRelativePath)(rawPath);
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
// Keep rawPath
|
|
336
|
+
}
|
|
337
|
+
if (normalizedPath) {
|
|
338
|
+
assignedPaths.add(normalizedPath);
|
|
339
|
+
}
|
|
340
|
+
const probe = (checkFile && normalizedPath && (0, core_1.isSafeRepoRelativePath)(normalizedPath))
|
|
341
|
+
? checkFile(normalizedPath)
|
|
342
|
+
: { exists: false };
|
|
343
|
+
const routeMismatch = validation.diagnostics.some((d) => d.code === 'COLLECTION_KIND_ROUTE_MISMATCH' && d.jsonPath[0] === 'items' && d.jsonPath[1] === idx);
|
|
344
|
+
const candidateMeta = primitiveByPath.get(normalizedPath);
|
|
345
|
+
return {
|
|
346
|
+
index: idx,
|
|
347
|
+
path: rawPath,
|
|
348
|
+
kind: typeof item?.kind === 'string' ? item.kind : 'prompt',
|
|
349
|
+
inferredKind: (0, core_1.inferPrimitiveKindFromPath)(normalizedPath || rawPath),
|
|
350
|
+
title: item?.title ?? item?.name,
|
|
351
|
+
description: item?.description,
|
|
352
|
+
tags: item?.tags,
|
|
353
|
+
exists: probe.exists,
|
|
354
|
+
routeMismatch,
|
|
355
|
+
previewTitle: item?.title ?? item?.name ?? candidateMeta?.title,
|
|
356
|
+
previewDescription: item?.description ?? candidateMeta?.description
|
|
357
|
+
};
|
|
358
|
+
});
|
|
359
|
+
let readmeExists = false;
|
|
360
|
+
if (manifest?.readme?.path && (0, core_1.isSafeRepoRelativePath)(manifest.readme.path) && checkFile) {
|
|
361
|
+
readmeExists = checkFile((0, core_1.normalizeRepoRelativePath)(manifest.readme.path)).exists;
|
|
362
|
+
}
|
|
363
|
+
const unassignedPrimitives = workspacePrimitives.filter((p) => !assignedPaths.has(p.path));
|
|
364
|
+
return {
|
|
365
|
+
valid: validation.valid,
|
|
366
|
+
manifest,
|
|
367
|
+
errors: validation.errors,
|
|
368
|
+
warnings: validation.warnings,
|
|
369
|
+
diagnostics: validation.diagnostics,
|
|
370
|
+
inlineDecorations: validation.inlineDecorations,
|
|
371
|
+
nodeRanges: validation.nodeRanges,
|
|
372
|
+
itemStatuses,
|
|
373
|
+
readmeExists,
|
|
374
|
+
unassignedPrimitives
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Detect and inspect all `*.collection.{yml,yaml}` files in a workspace.
|
|
379
|
+
* @param workspaceRoot Workspace root directory.
|
|
380
|
+
* @param collectionsPath Relative collections folder (default `'collections'`).
|
|
381
|
+
*/
|
|
382
|
+
detectWorkspaceCollections(workspaceRoot, collectionsPath = 'collections') {
|
|
383
|
+
const collectionsDir = (0, infra_1.resolveWorkspacePath)(workspaceRoot, collectionsPath);
|
|
384
|
+
const workspacePrimitives = this.discoverWorkspacePrimitives(workspaceRoot);
|
|
385
|
+
if (!fs.existsSync(collectionsDir)) {
|
|
386
|
+
return {
|
|
387
|
+
workspaceRoot,
|
|
388
|
+
collectionsPath,
|
|
389
|
+
collections: [],
|
|
390
|
+
workspacePrimitives,
|
|
391
|
+
totalErrors: 0,
|
|
392
|
+
totalWarnings: 0,
|
|
393
|
+
valid: true
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
const files = fs.readdirSync(collectionsDir)
|
|
397
|
+
.filter((f) => /\.collection\.ya?ml$/i.test(f))
|
|
398
|
+
.toSorted();
|
|
399
|
+
const rawContentsByFile = new Map();
|
|
400
|
+
const siblingCollections = files.map((fileName) => {
|
|
401
|
+
const absPath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, `${collectionsPath}/${fileName}`);
|
|
402
|
+
const relPath = `${collectionsPath}/${fileName}`.replaceAll('\\', '/');
|
|
403
|
+
try {
|
|
404
|
+
const text = fs.readFileSync(absPath, 'utf8');
|
|
405
|
+
rawContentsByFile.set(fileName, text);
|
|
406
|
+
const parsed = yaml.load(text);
|
|
407
|
+
return {
|
|
408
|
+
file: relPath,
|
|
409
|
+
id: typeof parsed?.id === 'string' ? parsed.id : undefined,
|
|
410
|
+
name: typeof parsed?.name === 'string' ? parsed.name : undefined
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
catch {
|
|
414
|
+
return { file: relPath };
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
this.siblingsCacheByDir.set(path.resolve(collectionsDir), {
|
|
418
|
+
siblings: siblingCollections,
|
|
419
|
+
cachedAt: Date.now()
|
|
420
|
+
});
|
|
421
|
+
const collections = [];
|
|
422
|
+
let totalErrors = 0;
|
|
423
|
+
let totalWarnings = 0;
|
|
424
|
+
for (const fileName of files) {
|
|
425
|
+
// Logical path (not the symlink target) so it matches the sibling labels.
|
|
426
|
+
const filePath = path.join(collectionsDir, fileName);
|
|
427
|
+
const relPath = `${collectionsPath}/${fileName}`.replaceAll('\\', '/');
|
|
428
|
+
const content = rawContentsByFile.get(fileName)
|
|
429
|
+
?? fs.readFileSync((0, infra_1.resolveWorkspacePath)(workspaceRoot, relPath), 'utf8');
|
|
430
|
+
const inspection = this.inspectDocument(content, {
|
|
431
|
+
filePath,
|
|
432
|
+
workspaceRoot,
|
|
433
|
+
siblingCollections,
|
|
434
|
+
workspacePrimitives
|
|
435
|
+
});
|
|
436
|
+
const manifest = inspection.manifest;
|
|
437
|
+
const errorCount = inspection.diagnostics.filter((d) => d.severity === 'error').length;
|
|
438
|
+
const warningCount = inspection.diagnostics.filter((d) => d.severity === 'warning').length;
|
|
439
|
+
totalErrors += errorCount;
|
|
440
|
+
totalWarnings += warningCount;
|
|
441
|
+
collections.push({
|
|
442
|
+
filePath,
|
|
443
|
+
relPath,
|
|
444
|
+
id: manifest?.id ?? fileName.replace(/\.collection\.ya?ml$/i, ''),
|
|
445
|
+
name: manifest?.name ?? fileName,
|
|
446
|
+
version: manifest?.version ?? '1.0.0',
|
|
447
|
+
description: manifest?.description ?? '',
|
|
448
|
+
itemCount: Array.isArray(manifest?.items) ? manifest.items.length : 0,
|
|
449
|
+
mcpServerCount: manifest?.mcp?.items ? Object.keys(manifest.mcp.items).length : 0,
|
|
450
|
+
valid: inspection.valid,
|
|
451
|
+
errorCount,
|
|
452
|
+
warningCount,
|
|
453
|
+
inspection
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
return {
|
|
457
|
+
workspaceRoot,
|
|
458
|
+
collectionsPath,
|
|
459
|
+
collections,
|
|
460
|
+
workspacePrimitives,
|
|
461
|
+
totalErrors,
|
|
462
|
+
totalWarnings,
|
|
463
|
+
valid: totalErrors === 0
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Apply a comment-preserving YAML mutation and re-inspect the document.
|
|
468
|
+
* @param content Current YAML content.
|
|
469
|
+
* @param mutation Mutation payload.
|
|
470
|
+
* @param options Inspection context options.
|
|
471
|
+
* @param options.filePath
|
|
472
|
+
* @param options.workspaceRoot
|
|
473
|
+
* @param options.siblingCollections
|
|
474
|
+
*/
|
|
475
|
+
applyMutation(content, mutation, options) {
|
|
476
|
+
const updatedContent = (0, infra_1.applyCollectionYamlMutation)(content, mutation);
|
|
477
|
+
const inspection = this.inspectDocument(updatedContent, options);
|
|
478
|
+
return {
|
|
479
|
+
updatedContent,
|
|
480
|
+
inspection
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
locateCursor(content, line) {
|
|
484
|
+
return (0, infra_1.locateCollectionYamlCursor)(content, line);
|
|
485
|
+
}
|
|
486
|
+
summarizeChanges(baseContent, currentContent) {
|
|
487
|
+
return (0, infra_1.summarizeCollectionYamlChanges)(baseContent, currentContent);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Create a new `.collection.yml` file (and optional starter README) on disk.
|
|
491
|
+
* @param workspaceRoot Workspace root directory.
|
|
492
|
+
* @param input New collection configuration.
|
|
493
|
+
*/
|
|
494
|
+
createCollectionFile(workspaceRoot, input) {
|
|
495
|
+
const id = (0, core_1.generateSanitizedId)(input.id) || 'my-collection';
|
|
496
|
+
const collectionsPath = input.collectionsPath?.trim() || 'collections';
|
|
497
|
+
const filePath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, `${collectionsPath}/${id}.collection.yml`);
|
|
498
|
+
if (fs.existsSync(filePath)) {
|
|
499
|
+
throw new Error(`Collection '${id}' already exists at ${filePath}`);
|
|
500
|
+
}
|
|
501
|
+
const name = input.name?.trim() || `${humanizeSlug(id)} Collection`;
|
|
502
|
+
const description = input.description?.trim() || `Curated AI primitives for ${name}.`;
|
|
503
|
+
const version = input.version?.trim() || '1.0.0';
|
|
504
|
+
const author = input.author?.trim() || 'Team';
|
|
505
|
+
const tags = (input.tags ?? ['ai', 'prompts']).map((t) => t.trim()).filter((t) => t.length > 0);
|
|
506
|
+
const readmeRelPath = `docs/${id}/README.md`;
|
|
507
|
+
if (input.createReadme !== false) {
|
|
508
|
+
const readmeAbs = (0, infra_1.resolveWorkspacePath)(workspaceRoot, readmeRelPath);
|
|
509
|
+
if (!fs.existsSync(readmeAbs)) {
|
|
510
|
+
fs.mkdirSync(path.dirname(readmeAbs), { recursive: true });
|
|
511
|
+
fs.writeFileSync(readmeAbs, `# ${name}\n\n${description}\n\n## Included Primitives\n\nAdd prompts, instructions, agents, skills, or plugins using the Visual Collection Editor.\n`, { encoding: 'utf8', flag: 'wx' });
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const lines = [
|
|
515
|
+
'# yaml-language-server: $schema=../schemas/collection.schema.json',
|
|
516
|
+
`id: ${id}`,
|
|
517
|
+
`name: ${JSON.stringify(name)}`,
|
|
518
|
+
`description: ${JSON.stringify(description)}`,
|
|
519
|
+
`version: ${version}`,
|
|
520
|
+
`author: ${JSON.stringify(author)}`,
|
|
521
|
+
'tags:',
|
|
522
|
+
...tags.map((t) => ` - ${t}`),
|
|
523
|
+
...(input.createReadme === false
|
|
524
|
+
? []
|
|
525
|
+
: ['readme:', ` path: ${readmeRelPath}`]),
|
|
526
|
+
'display:',
|
|
527
|
+
' ordering: manual',
|
|
528
|
+
' show_badge: true',
|
|
529
|
+
'items: []',
|
|
530
|
+
''
|
|
531
|
+
];
|
|
532
|
+
const content = lines.join('\n');
|
|
533
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
534
|
+
fs.writeFileSync(filePath, content, { encoding: 'utf8', flag: 'wx' });
|
|
535
|
+
this.clearWorkspaceCache(workspaceRoot);
|
|
536
|
+
const relPath = `${collectionsPath}/${id}.collection.yml`.replaceAll('\\', '/');
|
|
537
|
+
const inspection = this.inspectDocument(content, { filePath, workspaceRoot });
|
|
538
|
+
return {
|
|
539
|
+
filePath,
|
|
540
|
+
relPath,
|
|
541
|
+
content,
|
|
542
|
+
inspection
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Duplicate an existing `.collection.yml` file under a new `id` and `name`.
|
|
547
|
+
* @param workspaceRoot Workspace root directory.
|
|
548
|
+
* @param sourceFilePath Existing `.collection.yml` path (absolute or relative).
|
|
549
|
+
* @param newId New collection ID.
|
|
550
|
+
* @param newName Optional new collection display name.
|
|
551
|
+
*/
|
|
552
|
+
duplicateCollectionFile(workspaceRoot, sourceFilePath, newId, newName) {
|
|
553
|
+
const sourceRel = path.isAbsolute(sourceFilePath)
|
|
554
|
+
? path.relative(fs.realpathSync.native(workspaceRoot), fs.realpathSync.native(sourceFilePath))
|
|
555
|
+
: sourceFilePath;
|
|
556
|
+
const absSource = (0, infra_1.resolveWorkspacePath)(workspaceRoot, sourceRel);
|
|
557
|
+
if (!fs.existsSync(absSource)) {
|
|
558
|
+
throw new Error(`Source collection file not found: ${sourceFilePath}`);
|
|
559
|
+
}
|
|
560
|
+
const sanitizedId = (0, core_1.generateSanitizedId)(newId) || 'duplicated-collection';
|
|
561
|
+
const targetFilePath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, path.relative(fs.realpathSync.native(workspaceRoot), path.join(path.dirname(absSource), `${sanitizedId}.collection.yml`)));
|
|
562
|
+
if (fs.existsSync(targetFilePath)) {
|
|
563
|
+
throw new Error(`Collection '${sanitizedId}' already exists at ${targetFilePath}`);
|
|
564
|
+
}
|
|
565
|
+
const sourceContent = fs.readFileSync(absSource, 'utf8');
|
|
566
|
+
const displayName = newName?.trim() || `${humanizeSlug(sanitizedId)} Collection`;
|
|
567
|
+
const updatedContent = (0, infra_1.applyCollectionYamlMutation)(sourceContent, {
|
|
568
|
+
kind: 'update-metadata',
|
|
569
|
+
metadata: {
|
|
570
|
+
id: sanitizedId,
|
|
571
|
+
name: displayName
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
fs.writeFileSync(targetFilePath, updatedContent, { encoding: 'utf8', flag: 'wx' });
|
|
575
|
+
this.clearWorkspaceCache(workspaceRoot);
|
|
576
|
+
const relPath = path.relative(fs.realpathSync.native(workspaceRoot), targetFilePath).replaceAll('\\', '/');
|
|
577
|
+
const inspection = this.inspectDocument(updatedContent, {
|
|
578
|
+
filePath: targetFilePath,
|
|
579
|
+
workspaceRoot
|
|
580
|
+
});
|
|
581
|
+
return {
|
|
582
|
+
filePath: targetFilePath,
|
|
583
|
+
relPath,
|
|
584
|
+
content: updatedContent,
|
|
585
|
+
inspection
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Delete a `.collection.yml` file from disk.
|
|
590
|
+
* @param workspaceRoot Workspace root directory.
|
|
591
|
+
* @param filePath Collection file path (absolute or relative).
|
|
592
|
+
*/
|
|
593
|
+
deleteCollectionFile(workspaceRoot, filePath) {
|
|
594
|
+
const root = path.resolve(workspaceRoot);
|
|
595
|
+
const abs = path.resolve(root, filePath);
|
|
596
|
+
let rel = path.relative(root, abs);
|
|
597
|
+
if (rel === '..' || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel)) {
|
|
598
|
+
rel = path.relative(fs.realpathSync.native(root), abs);
|
|
599
|
+
}
|
|
600
|
+
if (rel === '..' || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel)) {
|
|
601
|
+
throw new Error(`Refusing to delete '${filePath}': path is outside the workspace.`);
|
|
602
|
+
}
|
|
603
|
+
if (!/\.collection\.ya?ml$/i.test(abs)) {
|
|
604
|
+
throw new Error(`Refusing to delete '${filePath}': not a .collection.yml or .collection.yaml file.`);
|
|
605
|
+
}
|
|
606
|
+
(0, infra_1.resolveWorkspacePath)(root, rel);
|
|
607
|
+
if (fs.existsSync(abs)) {
|
|
608
|
+
fs.unlinkSync(abs);
|
|
609
|
+
}
|
|
610
|
+
this.clearWorkspaceCache(workspaceRoot);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Scaffold a new or missing primitive file (`prompt`, `instruction`, `agent`,
|
|
614
|
+
* `skill`, `plugin`, `hook`, `readme`, etc.) on disk and optionally add it to
|
|
615
|
+
* the collection manifest.
|
|
616
|
+
* @param workspaceRoot Workspace root directory.
|
|
617
|
+
* @param collectionContent Current `.collection.yml` content.
|
|
618
|
+
* @param input Scaffolding parameters.
|
|
619
|
+
* @param options Optional inspection options.
|
|
620
|
+
* @param options.filePath
|
|
621
|
+
* @param options.siblingCollections
|
|
622
|
+
*/
|
|
623
|
+
async scaffoldPrimitiveForCollection(workspaceRoot, collectionContent, input, options) {
|
|
624
|
+
const kind = input.kind.trim().toLowerCase();
|
|
625
|
+
if (kind === 'readme') {
|
|
626
|
+
const readmePath = input.customRelPath?.trim() || `docs/${(0, core_1.generateSanitizedId)(input.name || 'collection')}/README.md`;
|
|
627
|
+
const readmeAbsPath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, readmePath);
|
|
628
|
+
const readmeRelPath = (0, core_1.normalizeRepoRelativePath)(readmePath);
|
|
629
|
+
if (!fs.existsSync(readmeAbsPath)) {
|
|
630
|
+
fs.mkdirSync(path.dirname(readmeAbsPath), { recursive: true });
|
|
631
|
+
const body = input.body?.trim()
|
|
632
|
+
|| `# ${input.name || 'Collection Documentation'}\n\n${input.description || 'Overview and usage guide for this collection.'}\n`;
|
|
633
|
+
fs.writeFileSync(readmeAbsPath, body.endsWith('\n') ? body : `${body}\n`, { encoding: 'utf8', flag: 'wx' });
|
|
634
|
+
}
|
|
635
|
+
const readmeUpdatedYaml = (0, infra_1.applyCollectionYamlMutation)(collectionContent, {
|
|
636
|
+
kind: 'update-readme',
|
|
637
|
+
path: readmeRelPath
|
|
638
|
+
});
|
|
639
|
+
this.clearWorkspaceCache(workspaceRoot);
|
|
640
|
+
const readmeInspection = this.inspectDocument(readmeUpdatedYaml, {
|
|
641
|
+
filePath: options?.filePath,
|
|
642
|
+
workspaceRoot,
|
|
643
|
+
siblingCollections: options?.siblingCollections
|
|
644
|
+
});
|
|
645
|
+
return {
|
|
646
|
+
createdFileRelPath: readmeRelPath,
|
|
647
|
+
createdFileAbsPath: readmeAbsPath,
|
|
648
|
+
updatedCollectionContent: readmeUpdatedYaml,
|
|
649
|
+
inspection: readmeInspection
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
const canonicalKind = (0, core_1.normalizePrimitiveKind)(kind) ?? 'prompt';
|
|
653
|
+
const slug = (0, core_1.generateSanitizedId)(input.name) || 'example';
|
|
654
|
+
const primitivePath = input.customRelPath?.trim() || (0, core_1.defaultPathForPrimitiveKind)(canonicalKind, slug);
|
|
655
|
+
const absPath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, primitivePath);
|
|
656
|
+
const relPath = (0, core_1.normalizeRepoRelativePath)(primitivePath);
|
|
657
|
+
if (canonicalKind === 'plugin' && !fs.existsSync(absPath)) {
|
|
658
|
+
const pluginName = path.basename(path.dirname(absPath));
|
|
659
|
+
const parentDir = path.dirname(path.dirname(absPath));
|
|
660
|
+
fs.mkdirSync(parentDir, { recursive: true });
|
|
661
|
+
const res = await (0, create_plugin_1.createPlugin)({
|
|
662
|
+
parentDir,
|
|
663
|
+
name: pluginName,
|
|
664
|
+
description: input.description || `A ${pluginName} plugin`,
|
|
665
|
+
author: input.author || 'Author'
|
|
666
|
+
});
|
|
667
|
+
if (!res.success && !fs.existsSync(absPath)) {
|
|
668
|
+
fs.mkdirSync(path.dirname(absPath), { recursive: true });
|
|
669
|
+
fs.writeFileSync(absPath, `${JSON.stringify({
|
|
670
|
+
$schema: core_1.AGENT_PLUGIN_MANIFEST_SCHEMA_URI,
|
|
671
|
+
name: pluginName,
|
|
672
|
+
version: '1.0.0',
|
|
673
|
+
description: input.description || `A ${pluginName} plugin`,
|
|
674
|
+
author: { name: input.author || 'Author' }
|
|
675
|
+
}, null, 2)}\n`, { encoding: 'utf8', flag: 'wx' });
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
else if (!fs.existsSync(absPath)) {
|
|
679
|
+
fs.mkdirSync(path.dirname(absPath), { recursive: true });
|
|
680
|
+
if (relPath.endsWith('.json')) {
|
|
681
|
+
const jsonPayload = canonicalKind === 'hook'
|
|
682
|
+
? {
|
|
683
|
+
name: slug,
|
|
684
|
+
description: input.description || `Hook for ${input.name}`,
|
|
685
|
+
event: 'pre-commit',
|
|
686
|
+
command: 'echo "Running hook"'
|
|
687
|
+
}
|
|
688
|
+
: {
|
|
689
|
+
name: slug,
|
|
690
|
+
description: input.description || `Configuration for ${input.name}`
|
|
691
|
+
};
|
|
692
|
+
fs.writeFileSync(absPath, `${JSON.stringify(jsonPayload, null, 2)}\n`, { encoding: 'utf8', flag: 'wx' });
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
const frontmatter = {
|
|
696
|
+
name: canonicalKind === 'skill' ? slug : input.name,
|
|
697
|
+
description: input.description || `Guidance and instructions for ${input.name}.`,
|
|
698
|
+
...(canonicalKind === 'instruction' ? { applyTo: input.applyTo || '**' } : {}),
|
|
699
|
+
...(input.tools && input.tools.length > 0 ? { tools: input.tools } : {}),
|
|
700
|
+
...(input.model ? { model: input.model } : {})
|
|
701
|
+
};
|
|
702
|
+
const defaultBody = input.body?.trim()
|
|
703
|
+
|| `# ${input.name}\n\n${input.description || `Instructions for ${input.name}.`}\n\n## Guidelines\n\n- Follow project conventions.\n`;
|
|
704
|
+
const fileText = (0, core_1.serializePrimitiveFrontmatter)(frontmatter, defaultBody, { forceFrontmatter: true });
|
|
705
|
+
fs.writeFileSync(absPath, fileText, { encoding: 'utf8', flag: 'wx' });
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
let updatedCollectionContent = collectionContent;
|
|
709
|
+
if (input.addToCollection !== false) {
|
|
710
|
+
const currentParsed = (yaml.load(collectionContent) ?? {});
|
|
711
|
+
const alreadyInItems = (currentParsed.items ?? []).some((it) => it?.path === relPath);
|
|
712
|
+
if (!alreadyInItems) {
|
|
713
|
+
updatedCollectionContent = (0, infra_1.applyCollectionYamlMutation)(collectionContent, {
|
|
714
|
+
kind: 'add-item',
|
|
715
|
+
item: {
|
|
716
|
+
path: relPath,
|
|
717
|
+
kind: canonicalKind,
|
|
718
|
+
title: input.name,
|
|
719
|
+
...(input.description ? { description: input.description } : {}),
|
|
720
|
+
...(input.tags && input.tags.length > 0 ? { tags: input.tags } : {})
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
this.clearWorkspaceCache(workspaceRoot);
|
|
726
|
+
const inspection = this.inspectDocument(updatedCollectionContent, {
|
|
727
|
+
filePath: options?.filePath,
|
|
728
|
+
workspaceRoot,
|
|
729
|
+
siblingCollections: options?.siblingCollections
|
|
730
|
+
});
|
|
731
|
+
return {
|
|
732
|
+
createdFileRelPath: relPath,
|
|
733
|
+
createdFileAbsPath: absPath,
|
|
734
|
+
updatedCollectionContent,
|
|
735
|
+
inspection
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Read a referenced primitive file or README into a structured visual model
|
|
740
|
+
* (YAML frontmatter + Markdown body, or parsed `plugin.json`).
|
|
741
|
+
* @param workspaceRoot Workspace root directory.
|
|
742
|
+
* @param relPath Repo-relative path to the primitive file.
|
|
743
|
+
* @param kind Optional primitive kind override.
|
|
744
|
+
*/
|
|
745
|
+
readPrimitiveContent(workspaceRoot, relPath, kind) {
|
|
746
|
+
const normalized = (0, core_1.normalizeRepoRelativePath)(relPath);
|
|
747
|
+
const absPath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, relPath);
|
|
748
|
+
const effectiveKind = kind ?? (0, core_1.inferPrimitiveKindFromPath)(normalized);
|
|
749
|
+
if (!fs.existsSync(absPath) || !fs.statSync(absPath).isFile()) {
|
|
750
|
+
return {
|
|
751
|
+
relPath: normalized,
|
|
752
|
+
absPath,
|
|
753
|
+
kind: effectiveKind,
|
|
754
|
+
exists: false,
|
|
755
|
+
format: normalized.endsWith('plugin.json')
|
|
756
|
+
? 'plugin-json'
|
|
757
|
+
: (normalized.endsWith('.json') ? 'json' : 'markdown-frontmatter'),
|
|
758
|
+
frontmatter: {},
|
|
759
|
+
body: '',
|
|
760
|
+
rawContent: ''
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
const rawContent = fs.readFileSync(absPath, 'utf8');
|
|
764
|
+
if (normalized.endsWith('plugin.json')) {
|
|
765
|
+
let pluginManifest = {};
|
|
766
|
+
try {
|
|
767
|
+
pluginManifest = JSON.parse(rawContent);
|
|
768
|
+
}
|
|
769
|
+
catch {
|
|
770
|
+
pluginManifest = {};
|
|
771
|
+
}
|
|
772
|
+
return {
|
|
773
|
+
relPath: normalized,
|
|
774
|
+
absPath,
|
|
775
|
+
kind: effectiveKind,
|
|
776
|
+
exists: true,
|
|
777
|
+
format: 'plugin-json',
|
|
778
|
+
frontmatter: {},
|
|
779
|
+
body: rawContent,
|
|
780
|
+
rawContent,
|
|
781
|
+
pluginManifest
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
if (normalized.endsWith('.json')) {
|
|
785
|
+
return {
|
|
786
|
+
relPath: normalized,
|
|
787
|
+
absPath,
|
|
788
|
+
kind: effectiveKind,
|
|
789
|
+
exists: true,
|
|
790
|
+
format: 'json',
|
|
791
|
+
frontmatter: {},
|
|
792
|
+
body: rawContent,
|
|
793
|
+
rawContent
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
const parsed = (0, core_1.parsePrimitiveFrontmatter)(rawContent);
|
|
797
|
+
return {
|
|
798
|
+
relPath: normalized,
|
|
799
|
+
absPath,
|
|
800
|
+
kind: effectiveKind,
|
|
801
|
+
exists: true,
|
|
802
|
+
format: 'markdown-frontmatter',
|
|
803
|
+
frontmatter: parsed.frontmatter,
|
|
804
|
+
body: parsed.body.replace(/^\r?\n/, ''),
|
|
805
|
+
rawContent,
|
|
806
|
+
rawFrontmatter: parsed.rawFrontmatter,
|
|
807
|
+
parseError: parsed.parseError
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Write visual edits (frontmatter + Markdown body, `plugin.json` manifest, or
|
|
812
|
+
* raw text) back to a referenced primitive file on disk.
|
|
813
|
+
* @param workspaceRoot Workspace root directory.
|
|
814
|
+
* @param relPath Repo-relative path to the primitive file.
|
|
815
|
+
* @param update Content update payload.
|
|
816
|
+
*/
|
|
817
|
+
writePrimitiveContent(workspaceRoot, relPath, update) {
|
|
818
|
+
const normalized = (0, core_1.normalizeRepoRelativePath)(relPath);
|
|
819
|
+
const absPath = (0, infra_1.resolveWorkspacePath)(workspaceRoot, relPath);
|
|
820
|
+
fs.mkdirSync(path.dirname(absPath), { recursive: true });
|
|
821
|
+
let nextRaw;
|
|
822
|
+
if (update.rawContent !== undefined) {
|
|
823
|
+
nextRaw = update.rawContent;
|
|
824
|
+
}
|
|
825
|
+
else if (normalized.endsWith('plugin.json') && update.pluginManifest) {
|
|
826
|
+
const existing = this.readPrimitiveContent(workspaceRoot, normalized, update.kind);
|
|
827
|
+
const existingAuthor = (existing.pluginManifest?.author && typeof existing.pluginManifest.author === 'object')
|
|
828
|
+
? existing.pluginManifest.author
|
|
829
|
+
: {};
|
|
830
|
+
const incomingAuthor = (update.pluginManifest.author && typeof update.pluginManifest.author === 'object')
|
|
831
|
+
? update.pluginManifest.author
|
|
832
|
+
: {};
|
|
833
|
+
const mergedAuthor = {
|
|
834
|
+
...existingAuthor,
|
|
835
|
+
...Object.fromEntries(Object.entries(incomingAuthor).filter(([, val]) => val !== undefined && val !== ''))
|
|
836
|
+
};
|
|
837
|
+
const merged = {
|
|
838
|
+
$schema: core_1.AGENT_PLUGIN_MANIFEST_SCHEMA_URI,
|
|
839
|
+
...existing.pluginManifest,
|
|
840
|
+
...update.pluginManifest,
|
|
841
|
+
...(Object.keys(mergedAuthor).length > 0 ? { author: mergedAuthor } : {})
|
|
842
|
+
};
|
|
843
|
+
nextRaw = `${JSON.stringify(merged, null, 2)}\n`;
|
|
844
|
+
}
|
|
845
|
+
else {
|
|
846
|
+
const existing = this.readPrimitiveContent(workspaceRoot, normalized, update.kind);
|
|
847
|
+
const body = update.body ?? existing.body;
|
|
848
|
+
const incomingEntries = Object.entries(update.frontmatter ?? {}).filter(([, val]) => val !== undefined && val !== '' && (!Array.isArray(val) || val.length > 0));
|
|
849
|
+
if (existing.parseError && existing.rawFrontmatter !== undefined && incomingEntries.length === 0) {
|
|
850
|
+
const normalizedBody = body.replace(/^\r?\n/, '');
|
|
851
|
+
const full = `---\n${existing.rawFrontmatter}\n---\n\n${normalizedBody}`;
|
|
852
|
+
nextRaw = full.endsWith('\n') ? full : `${full}\n`;
|
|
853
|
+
}
|
|
854
|
+
else {
|
|
855
|
+
const mergedFrontmatter = {
|
|
856
|
+
...existing.frontmatter,
|
|
857
|
+
...update.frontmatter
|
|
858
|
+
};
|
|
859
|
+
nextRaw = (0, core_1.serializePrimitiveFrontmatter)(mergedFrontmatter, body);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
fs.writeFileSync(absPath, nextRaw, 'utf8');
|
|
863
|
+
this.clearWorkspaceCache(workspaceRoot);
|
|
864
|
+
return this.readPrimitiveContent(workspaceRoot, normalized, update.kind);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
exports.CollectionEditorService = CollectionEditorService;
|
|
868
|
+
//# sourceMappingURL=collection-editor-service.js.map
|