@ai-primitives-hub/app 0.0.1-alpha.1
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 +26 -0
- package/dist/collection/generate-skill.d.ts +43 -0
- package/dist/collection/generate-skill.d.ts.map +1 -0
- package/dist/collection/generate-skill.js +244 -0
- package/dist/collection/generate-skill.js.map +1 -0
- package/dist/collection/index.d.ts +8 -0
- package/dist/collection/index.d.ts.map +1 -0
- package/dist/collection/index.js +23 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/read-collection.d.ts +60 -0
- package/dist/collection/read-collection.d.ts.map +1 -0
- package/dist/collection/read-collection.js +291 -0
- package/dist/collection/read-collection.js.map +1 -0
- package/dist/context-detection/detector.d.ts +126 -0
- package/dist/context-detection/detector.d.ts.map +1 -0
- package/dist/context-detection/detector.js +408 -0
- package/dist/context-detection/detector.js.map +1 -0
- package/dist/context-detection/index.d.ts +11 -0
- package/dist/context-detection/index.d.ts.map +1 -0
- package/dist/context-detection/index.js +14 -0
- package/dist/context-detection/index.js.map +1 -0
- package/dist/context-detection/types.d.ts +74 -0
- package/dist/context-detection/types.d.ts.map +1 -0
- package/dist/context-detection/types.js +13 -0
- package/dist/context-detection/types.js.map +1 -0
- package/dist/discovery/index.d.ts +7 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +23 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/profile-generator.d.ts +31 -0
- package/dist/discovery/profile-generator.d.ts.map +1 -0
- package/dist/discovery/profile-generator.js +55 -0
- package/dist/discovery/profile-generator.js.map +1 -0
- package/dist/discovery/recommendation-engine.d.ts +76 -0
- package/dist/discovery/recommendation-engine.d.ts.map +1 -0
- package/dist/discovery/recommendation-engine.js +210 -0
- package/dist/discovery/recommendation-engine.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/install/index.d.ts +14 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +20 -0
- package/dist/install/index.js.map +1 -0
- package/dist/install/install-bundle.d.ts +31 -0
- package/dist/install/install-bundle.d.ts.map +1 -0
- package/dist/install/install-bundle.js +23 -0
- package/dist/install/install-bundle.js.map +1 -0
- package/dist/install/layout-resolver.d.ts +31 -0
- package/dist/install/layout-resolver.d.ts.map +1 -0
- package/dist/install/layout-resolver.js +70 -0
- package/dist/install/layout-resolver.js.map +1 -0
- package/dist/install/pipeline.d.ts +111 -0
- package/dist/install/pipeline.d.ts.map +1 -0
- package/dist/install/pipeline.js +138 -0
- package/dist/install/pipeline.js.map +1 -0
- package/dist/install/uninstall-bundle.d.ts +36 -0
- package/dist/install/uninstall-bundle.d.ts.map +1 -0
- package/dist/install/uninstall-bundle.js +37 -0
- package/dist/install/uninstall-bundle.js.map +1 -0
- package/dist/install/uninstall-pipeline.d.ts +119 -0
- package/dist/install/uninstall-pipeline.d.ts.map +1 -0
- package/dist/install/uninstall-pipeline.js +187 -0
- package/dist/install/uninstall-pipeline.js.map +1 -0
- package/dist/registry/activate-registry-profile.d.ts +67 -0
- package/dist/registry/activate-registry-profile.d.ts.map +1 -0
- package/dist/registry/activate-registry-profile.js +150 -0
- package/dist/registry/activate-registry-profile.js.map +1 -0
- package/dist/registry/create-source-adapter.d.ts +43 -0
- package/dist/registry/create-source-adapter.d.ts.map +1 -0
- package/dist/registry/create-source-adapter.js +53 -0
- package/dist/registry/create-source-adapter.js.map +1 -0
- package/dist/registry/deactivate-registry-profile.d.ts +38 -0
- package/dist/registry/deactivate-registry-profile.d.ts.map +1 -0
- package/dist/registry/deactivate-registry-profile.js +45 -0
- package/dist/registry/deactivate-registry-profile.js.map +1 -0
- package/dist/registry/detect-updates.d.ts +12 -0
- package/dist/registry/detect-updates.d.ts.map +1 -0
- package/dist/registry/detect-updates.js +76 -0
- package/dist/registry/detect-updates.js.map +1 -0
- package/dist/registry/hub-manager.d.ts +229 -0
- package/dist/registry/hub-manager.d.ts.map +1 -0
- package/dist/registry/hub-manager.js +473 -0
- package/dist/registry/hub-manager.js.map +1 -0
- package/dist/registry/index.d.ts +23 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +39 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/install-registry-bundle.d.ts +56 -0
- package/dist/registry/install-registry-bundle.d.ts.map +1 -0
- package/dist/registry/install-registry-bundle.js +150 -0
- package/dist/registry/install-registry-bundle.js.map +1 -0
- package/dist/registry/list-all-profiles.d.ts +27 -0
- package/dist/registry/list-all-profiles.d.ts.map +1 -0
- package/dist/registry/list-all-profiles.js +52 -0
- package/dist/registry/list-all-profiles.js.map +1 -0
- package/dist/registry/list-installed-bundles.d.ts +37 -0
- package/dist/registry/list-installed-bundles.d.ts.map +1 -0
- package/dist/registry/list-installed-bundles.js +27 -0
- package/dist/registry/list-installed-bundles.js.map +1 -0
- package/dist/registry/load-hub-sources.d.ts +56 -0
- package/dist/registry/load-hub-sources.d.ts.map +1 -0
- package/dist/registry/load-hub-sources.js +123 -0
- package/dist/registry/load-hub-sources.js.map +1 -0
- package/dist/registry/local-profile-crud.d.ts +58 -0
- package/dist/registry/local-profile-crud.d.ts.map +1 -0
- package/dist/registry/local-profile-crud.js +85 -0
- package/dist/registry/local-profile-crud.js.map +1 -0
- package/dist/registry/profile-lifecycle.d.ts +190 -0
- package/dist/registry/profile-lifecycle.d.ts.map +1 -0
- package/dist/registry/profile-lifecycle.js +400 -0
- package/dist/registry/profile-lifecycle.js.map +1 -0
- package/dist/registry/registry-settings.d.ts +32 -0
- package/dist/registry/registry-settings.d.ts.map +1 -0
- package/dist/registry/registry-settings.js +145 -0
- package/dist/registry/registry-settings.js.map +1 -0
- package/dist/registry/resolve-installation-bundle.d.ts +46 -0
- package/dist/registry/resolve-installation-bundle.d.ts.map +1 -0
- package/dist/registry/resolve-installation-bundle.js +98 -0
- package/dist/registry/resolve-installation-bundle.js.map +1 -0
- package/dist/registry/search-registry-bundles.d.ts +47 -0
- package/dist/registry/search-registry-bundles.d.ts.map +1 -0
- package/dist/registry/search-registry-bundles.js +129 -0
- package/dist/registry/search-registry-bundles.js.map +1 -0
- package/dist/registry/uninstall-installed-bundle.d.ts +48 -0
- package/dist/registry/uninstall-installed-bundle.d.ts.map +1 -0
- package/dist/registry/uninstall-installed-bundle.js +45 -0
- package/dist/registry/uninstall-installed-bundle.js.map +1 -0
- package/dist/registry/update-registry-bundle.d.ts +36 -0
- package/dist/registry/update-registry-bundle.d.ts.map +1 -0
- package/dist/registry/update-registry-bundle.js +113 -0
- package/dist/registry/update-registry-bundle.js.map +1 -0
- package/dist/registry/user-config-paths.d.ts +24 -0
- package/dist/registry/user-config-paths.d.ts.map +1 -0
- package/dist/registry/user-config-paths.js +82 -0
- package/dist/registry/user-config-paths.js.map +1 -0
- package/dist/registry/version-consolidator.d.ts +123 -0
- package/dist/registry/version-consolidator.d.ts.map +1 -0
- package/dist/registry/version-consolidator.js +231 -0
- package/dist/registry/version-consolidator.js.map +1 -0
- package/dist/search/export-profile.d.ts +63 -0
- package/dist/search/export-profile.d.ts.map +1 -0
- package/dist/search/export-profile.js +138 -0
- package/dist/search/export-profile.js.map +1 -0
- package/dist/search/index.d.ts +6 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +22 -0
- package/dist/search/index.js.map +1 -0
- package/dist/stores/index.d.ts +8 -0
- package/dist/stores/index.d.ts.map +1 -0
- package/dist/stores/index.js +24 -0
- package/dist/stores/index.js.map +1 -0
- package/dist/stores/json-lockfile-store.d.ts +203 -0
- package/dist/stores/json-lockfile-store.d.ts.map +1 -0
- package/dist/stores/json-lockfile-store.js +277 -0
- package/dist/stores/json-lockfile-store.js.map +1 -0
- package/dist/transform/index.d.ts +10 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +26 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/transformer-registry.d.ts +52 -0
- package/dist/transform/transformer-registry.d.ts.map +1 -0
- package/dist/transform/transformer-registry.js +53 -0
- package/dist/transform/transformer-registry.js.map +1 -0
- package/dist/transform/transformers/claude-code-transformer.d.ts +67 -0
- package/dist/transform/transformers/claude-code-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/claude-code-transformer.js +140 -0
- package/dist/transform/transformers/claude-code-transformer.js.map +1 -0
- package/dist/transform/transformers/kiro-transformer.d.ts +51 -0
- package/dist/transform/transformers/kiro-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/kiro-transformer.js +128 -0
- package/dist/transform/transformers/kiro-transformer.js.map +1 -0
- package/dist/transform/transformers/noop-transformer.d.ts +25 -0
- package/dist/transform/transformers/noop-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/noop-transformer.js +20 -0
- package/dist/transform/transformers/noop-transformer.js.map +1 -0
- package/dist/transform/transformers/windsurf-transformer.d.ts +63 -0
- package/dist/transform/transformers/windsurf-transformer.d.ts.map +1 -0
- package/dist/transform/transformers/windsurf-transformer.js +125 -0
- package/dist/transform/transformers/windsurf-transformer.js.map +1 -0
- package/dist/update/auto-update.d.ts +84 -0
- package/dist/update/auto-update.d.ts.map +1 -0
- package/dist/update/auto-update.js +217 -0
- package/dist/update/auto-update.js.map +1 -0
- package/dist/update/check-updates.d.ts +51 -0
- package/dist/update/check-updates.d.ts.map +1 -0
- package/dist/update/check-updates.js +168 -0
- package/dist/update/check-updates.js.map +1 -0
- package/dist/update/index.d.ts +8 -0
- package/dist/update/index.d.ts.map +1 -0
- package/dist/update/index.js +24 -0
- package/dist/update/index.js.map +1 -0
- package/dist/update/log-event.d.ts +15 -0
- package/dist/update/log-event.d.ts.map +1 -0
- package/dist/update/log-event.js +11 -0
- package/dist/update/log-event.js.map +1 -0
- package/dist/writers/file-tree-writer.d.ts +136 -0
- package/dist/writers/file-tree-writer.d.ts.map +1 -0
- package/dist/writers/file-tree-writer.js +337 -0
- package/dist/writers/file-tree-writer.js.map +1 -0
- package/dist/writers/index.d.ts +7 -0
- package/dist/writers/index.d.ts.map +1 -0
- package/dist/writers/index.js +23 -0
- package/dist/writers/index.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @ai-primitives-hub/app
|
|
2
|
+
|
|
3
|
+
Use-case orchestration for AI Primitives Hub. Depends on `core` and
|
|
4
|
+
`infra`. Consumed by both `cli` and (via the strangler-fig migration,
|
|
5
|
+
Phase 4) the VS Code extension — this is the single shared implementation
|
|
6
|
+
that replaces today's duplicated logic between the two delivery mechanisms.
|
|
7
|
+
|
|
8
|
+
Status: **scaffolding only** (Phase 1 of `.tmp/ai-primitives-hub-next-migration-plan.md`).
|
|
9
|
+
Real orchestration lands in Phase 4 (§7.5): install/uninstall pipelines
|
|
10
|
+
extracted from the extension's `BundleInstaller`/`UserScopeService`/
|
|
11
|
+
`RepositoryScopeService`/`LockfileManager`/`HubManager`/`RegistryManager`,
|
|
12
|
+
discovery/search orchestration over `infra`'s harvest+BM25 engine, and
|
|
13
|
+
per-target content transforms (Kiro real; Windsurf/Claude-Code to be
|
|
14
|
+
written for real, not left as no-ops).
|
|
15
|
+
|
|
16
|
+
Also doubles as the public SDK surface (decision 2 in the migration plan)
|
|
17
|
+
until a standalone `@ai-primitives-hub/sdk` package has a real external
|
|
18
|
+
consumer to justify splitting it out.
|
|
19
|
+
|
|
20
|
+
## Development
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm --filter @ai-primitives-hub/app build
|
|
24
|
+
pnpm --filter @ai-primitives-hub/app test
|
|
25
|
+
pnpm --filter @ai-primitives-hub/app lint
|
|
26
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills file generation utilities (file-IO dependent).
|
|
3
|
+
* @module app/collection/generate-skill
|
|
4
|
+
*
|
|
5
|
+
* File-IO dependent skill generation functions.
|
|
6
|
+
* Pure validation functions are in `@ai-primitives-hub/core`'s
|
|
7
|
+
* `domain/skill/validate.ts`.
|
|
8
|
+
*
|
|
9
|
+
* Ported unchanged from the reference branch's
|
|
10
|
+
* `app/src/collection/generate-skill.ts`.
|
|
11
|
+
*/
|
|
12
|
+
import type { AllSkillsValidationResult, SkillValidationResult } from '@ai-primitives-hub/core';
|
|
13
|
+
/**
|
|
14
|
+
* Validate a single skill folder.
|
|
15
|
+
* @param folderPath
|
|
16
|
+
* @param folderName
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateSkillFolder(folderPath: string, folderName: string): SkillValidationResult;
|
|
19
|
+
/**
|
|
20
|
+
* Validate all skills in a directory.
|
|
21
|
+
* @param repoRoot
|
|
22
|
+
* @param skillsDir
|
|
23
|
+
*/
|
|
24
|
+
export declare function validateAllSkills(repoRoot: string, skillsDir?: string): AllSkillsValidationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Generate SKILL.md content
|
|
27
|
+
* @param name
|
|
28
|
+
* @param description
|
|
29
|
+
*/
|
|
30
|
+
export declare function generateSkillContent(name: string, description: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Create a new skill directory structure
|
|
33
|
+
* @param repoRoot
|
|
34
|
+
* @param skillName
|
|
35
|
+
* @param description
|
|
36
|
+
* @param skillsDir
|
|
37
|
+
*/
|
|
38
|
+
export declare function createSkill(repoRoot: string, skillName: string, description: string, skillsDir?: string): {
|
|
39
|
+
success: boolean;
|
|
40
|
+
path: string;
|
|
41
|
+
error?: string;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=generate-skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-skill.d.ts","sourceRoot":"","sources":["../../src/collection/generate-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EACV,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAQjC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,qBAAqB,CAmEjG;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,SAAW,GAAG,yBAAyB,CA0DnG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAsB9E;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,SAAW,GACrB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAoCpD"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Skills file generation utilities (file-IO dependent).
|
|
4
|
+
* @module app/collection/generate-skill
|
|
5
|
+
*
|
|
6
|
+
* File-IO dependent skill generation functions.
|
|
7
|
+
* Pure validation functions are in `@ai-primitives-hub/core`'s
|
|
8
|
+
* `domain/skill/validate.ts`.
|
|
9
|
+
*
|
|
10
|
+
* Ported unchanged from the reference branch's
|
|
11
|
+
* `app/src/collection/generate-skill.ts`.
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.validateSkillFolder = validateSkillFolder;
|
|
48
|
+
exports.validateAllSkills = validateAllSkills;
|
|
49
|
+
exports.generateSkillContent = generateSkillContent;
|
|
50
|
+
exports.createSkill = createSkill;
|
|
51
|
+
const fs = __importStar(require("node:fs"));
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
54
|
+
/**
|
|
55
|
+
* Validate a single skill folder.
|
|
56
|
+
* @param folderPath
|
|
57
|
+
* @param folderName
|
|
58
|
+
*/
|
|
59
|
+
function validateSkillFolder(folderPath, folderName) {
|
|
60
|
+
const errors = [];
|
|
61
|
+
let skillName = folderName;
|
|
62
|
+
// Check if SKILL.md exists
|
|
63
|
+
const skillFile = path.join(folderPath, 'SKILL.md');
|
|
64
|
+
if (!fs.existsSync(skillFile)) {
|
|
65
|
+
return {
|
|
66
|
+
skillName,
|
|
67
|
+
folderName,
|
|
68
|
+
valid: false,
|
|
69
|
+
errors: ['Missing SKILL.md file']
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
// Read and parse frontmatter
|
|
73
|
+
const content = fs.readFileSync(skillFile, 'utf8');
|
|
74
|
+
const metadata = (0, core_1.parseFrontmatter)(content);
|
|
75
|
+
if (!metadata) {
|
|
76
|
+
return {
|
|
77
|
+
skillName,
|
|
78
|
+
folderName,
|
|
79
|
+
valid: false,
|
|
80
|
+
errors: ['Failed to parse SKILL.md frontmatter']
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
skillName = metadata.name || folderName;
|
|
84
|
+
// Validate name field
|
|
85
|
+
const nameError = (0, core_1.validateSkillName)(metadata.name);
|
|
86
|
+
if (nameError) {
|
|
87
|
+
errors.push(`name: ${nameError}`);
|
|
88
|
+
}
|
|
89
|
+
else if (metadata.name !== folderName) {
|
|
90
|
+
errors.push(`Folder name "${folderName}" does not match skill name "${metadata.name}"`);
|
|
91
|
+
}
|
|
92
|
+
// Validate description field
|
|
93
|
+
const descError = (0, core_1.validateSkillDescription)(metadata.description);
|
|
94
|
+
if (descError) {
|
|
95
|
+
errors.push(`description: ${descError}`);
|
|
96
|
+
}
|
|
97
|
+
// Check for reasonable file sizes in bundled assets
|
|
98
|
+
const files = fs.readdirSync(folderPath);
|
|
99
|
+
for (const file of files) {
|
|
100
|
+
if (file === 'SKILL.md') {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const filePath = path.join(folderPath, file);
|
|
104
|
+
try {
|
|
105
|
+
const stats = fs.statSync(filePath);
|
|
106
|
+
if (stats.isFile() && stats.size > core_1.MAX_ASSET_SIZE) {
|
|
107
|
+
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
108
|
+
errors.push(`Bundled asset "${file}" exceeds maximum size of 5MB (${sizeMB}MB)`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
errors.push(`Cannot access bundled asset "${file}": ${error.message}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
skillName,
|
|
117
|
+
folderName,
|
|
118
|
+
valid: errors.length === 0,
|
|
119
|
+
errors
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Validate all skills in a directory.
|
|
124
|
+
* @param repoRoot
|
|
125
|
+
* @param skillsDir
|
|
126
|
+
*/
|
|
127
|
+
function validateAllSkills(repoRoot, skillsDir = 'skills') {
|
|
128
|
+
const skillsPath = path.join(repoRoot, skillsDir);
|
|
129
|
+
if (!fs.existsSync(skillsPath)) {
|
|
130
|
+
return {
|
|
131
|
+
valid: true,
|
|
132
|
+
skills: [],
|
|
133
|
+
totalSkills: 0,
|
|
134
|
+
validSkills: 0,
|
|
135
|
+
invalidSkills: 0
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const skillFolders = fs.readdirSync(skillsPath).filter((file) => {
|
|
139
|
+
const filePath = path.join(skillsPath, file);
|
|
140
|
+
return fs.statSync(filePath).isDirectory();
|
|
141
|
+
});
|
|
142
|
+
if (skillFolders.length === 0) {
|
|
143
|
+
return {
|
|
144
|
+
valid: true,
|
|
145
|
+
skills: [],
|
|
146
|
+
totalSkills: 0,
|
|
147
|
+
validSkills: 0,
|
|
148
|
+
invalidSkills: 0
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const results = [];
|
|
152
|
+
const usedNames = new Set();
|
|
153
|
+
let hasErrors = false;
|
|
154
|
+
for (const folder of skillFolders) {
|
|
155
|
+
const folderPath = path.join(skillsPath, folder);
|
|
156
|
+
const result = validateSkillFolder(folderPath, folder);
|
|
157
|
+
// Check for duplicate names
|
|
158
|
+
if (result.valid && usedNames.has(result.skillName)) {
|
|
159
|
+
result.valid = false;
|
|
160
|
+
result.errors.push(`Duplicate skill name "${result.skillName}"`);
|
|
161
|
+
}
|
|
162
|
+
else if (result.valid) {
|
|
163
|
+
usedNames.add(result.skillName);
|
|
164
|
+
}
|
|
165
|
+
if (!result.valid) {
|
|
166
|
+
hasErrors = true;
|
|
167
|
+
}
|
|
168
|
+
results.push(result);
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
valid: !hasErrors,
|
|
172
|
+
skills: results,
|
|
173
|
+
totalSkills: results.length,
|
|
174
|
+
validSkills: results.filter((r) => r.valid).length,
|
|
175
|
+
invalidSkills: results.filter((r) => !r.valid).length
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Generate SKILL.md content
|
|
180
|
+
* @param name
|
|
181
|
+
* @param description
|
|
182
|
+
*/
|
|
183
|
+
function generateSkillContent(name, description) {
|
|
184
|
+
return `---
|
|
185
|
+
name: ${name}
|
|
186
|
+
description: "${description}"
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
# ${name}
|
|
190
|
+
|
|
191
|
+
${description}
|
|
192
|
+
|
|
193
|
+
## Capabilities
|
|
194
|
+
|
|
195
|
+
Describe what this skill enables Copilot to do.
|
|
196
|
+
|
|
197
|
+
## Usage
|
|
198
|
+
|
|
199
|
+
Explain when and how Copilot should use this skill.
|
|
200
|
+
|
|
201
|
+
## Examples
|
|
202
|
+
|
|
203
|
+
Provide example interactions or use cases.
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Create a new skill directory structure
|
|
208
|
+
* @param repoRoot
|
|
209
|
+
* @param skillName
|
|
210
|
+
* @param description
|
|
211
|
+
* @param skillsDir
|
|
212
|
+
*/
|
|
213
|
+
function createSkill(repoRoot, skillName, description, skillsDir = 'skills') {
|
|
214
|
+
// Validate inputs
|
|
215
|
+
const nameError = (0, core_1.validateSkillName)(skillName);
|
|
216
|
+
if (nameError) {
|
|
217
|
+
return { success: false, path: '', error: nameError };
|
|
218
|
+
}
|
|
219
|
+
const descError = (0, core_1.validateSkillDescription)(description);
|
|
220
|
+
if (descError) {
|
|
221
|
+
return { success: false, path: '', error: descError };
|
|
222
|
+
}
|
|
223
|
+
const skillsPath = path.join(repoRoot, skillsDir);
|
|
224
|
+
const skillPath = path.join(skillsPath, skillName);
|
|
225
|
+
if (fs.existsSync(skillPath)) {
|
|
226
|
+
return { success: false, path: skillPath, error: `Skill "${skillName}" already exists` };
|
|
227
|
+
}
|
|
228
|
+
try {
|
|
229
|
+
// Ensure skills directory exists
|
|
230
|
+
if (!fs.existsSync(skillsPath)) {
|
|
231
|
+
fs.mkdirSync(skillsPath, { recursive: true });
|
|
232
|
+
}
|
|
233
|
+
// Create skill folder
|
|
234
|
+
fs.mkdirSync(skillPath, { recursive: true });
|
|
235
|
+
// Create SKILL.md
|
|
236
|
+
const content = generateSkillContent(skillName, description);
|
|
237
|
+
fs.writeFileSync(path.join(skillPath, 'SKILL.md'), content);
|
|
238
|
+
return { success: true, path: skillPath };
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
return { success: false, path: skillPath, error: error.message };
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=generate-skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-skill.js","sourceRoot":"","sources":["../../src/collection/generate-skill.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBH,kDAmEC;AAOD,8CA0DC;AAOD,oDAsBC;AASD,kCAyCC;AArOD,4CAA8B;AAC9B,gDAAkC;AAKlC,kDAKiC;AAEjC;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,UAAkB,EAAE,UAAkB;IACxE,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,SAAS,GAAG,UAAU,CAAC;IAE3B,2BAA2B;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpD,IAAI,CAAC,EAA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7B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,SAAS,kBAAkB,EAAE,CAAC;IAC3F,CAAC;IAED,IAAI,CAAC;QACH,iCAAiC;QACjC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,sBAAsB;QACtB,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE7C,kBAAkB;QAClB,MAAM,OAAO,GAAG,oBAAoB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC7D,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;QAE5D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collection use-cases: reading/writing/validating collection YAML files
|
|
3
|
+
* and generating/validating skill folders.
|
|
4
|
+
* @module app/collection
|
|
5
|
+
*/
|
|
6
|
+
export { createSkill, generateSkillContent, validateAllSkills, validateSkillFolder, } from './generate-skill';
|
|
7
|
+
export { generateMarkdown, listCollectionFiles, loadItemKindsFromSchema, readCollection, resolveCollectionItemPaths, validateAllCollections, validateCollectionFile, writeCollection, } from './read-collection';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,GAChB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Collection use-cases: reading/writing/validating collection YAML files
|
|
4
|
+
* and generating/validating skill folders.
|
|
5
|
+
* @module app/collection
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.writeCollection = exports.validateCollectionFile = exports.validateAllCollections = exports.resolveCollectionItemPaths = exports.readCollection = exports.loadItemKindsFromSchema = exports.listCollectionFiles = exports.generateMarkdown = exports.validateSkillFolder = exports.validateAllSkills = exports.generateSkillContent = exports.createSkill = void 0;
|
|
9
|
+
var generate_skill_1 = require("./generate-skill");
|
|
10
|
+
Object.defineProperty(exports, "createSkill", { enumerable: true, get: function () { return generate_skill_1.createSkill; } });
|
|
11
|
+
Object.defineProperty(exports, "generateSkillContent", { enumerable: true, get: function () { return generate_skill_1.generateSkillContent; } });
|
|
12
|
+
Object.defineProperty(exports, "validateAllSkills", { enumerable: true, get: function () { return generate_skill_1.validateAllSkills; } });
|
|
13
|
+
Object.defineProperty(exports, "validateSkillFolder", { enumerable: true, get: function () { return generate_skill_1.validateSkillFolder; } });
|
|
14
|
+
var read_collection_1 = require("./read-collection");
|
|
15
|
+
Object.defineProperty(exports, "generateMarkdown", { enumerable: true, get: function () { return read_collection_1.generateMarkdown; } });
|
|
16
|
+
Object.defineProperty(exports, "listCollectionFiles", { enumerable: true, get: function () { return read_collection_1.listCollectionFiles; } });
|
|
17
|
+
Object.defineProperty(exports, "loadItemKindsFromSchema", { enumerable: true, get: function () { return read_collection_1.loadItemKindsFromSchema; } });
|
|
18
|
+
Object.defineProperty(exports, "readCollection", { enumerable: true, get: function () { return read_collection_1.readCollection; } });
|
|
19
|
+
Object.defineProperty(exports, "resolveCollectionItemPaths", { enumerable: true, get: function () { return read_collection_1.resolveCollectionItemPaths; } });
|
|
20
|
+
Object.defineProperty(exports, "validateAllCollections", { enumerable: true, get: function () { return read_collection_1.validateAllCollections; } });
|
|
21
|
+
Object.defineProperty(exports, "validateCollectionFile", { enumerable: true, get: function () { return read_collection_1.validateCollectionFile; } });
|
|
22
|
+
Object.defineProperty(exports, "writeCollection", { enumerable: true, get: function () { return read_collection_1.writeCollection; } });
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/collection/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mDAK0B;AAJxB,6GAAA,WAAW,OAAA;AACX,sHAAA,oBAAoB,OAAA;AACpB,mHAAA,iBAAiB,OAAA;AACjB,qHAAA,mBAAmB,OAAA;AAErB,qDAS2B;AARzB,mHAAA,gBAAgB,OAAA;AAChB,sHAAA,mBAAmB,OAAA;AACnB,0HAAA,uBAAuB,OAAA;AACvB,iHAAA,cAAc,OAAA;AACd,6HAAA,0BAA0B,OAAA;AAC1B,yHAAA,sBAAsB,OAAA;AACtB,yHAAA,sBAAsB,OAAA;AACtB,kHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { AllCollectionsResult, Collection, FileValidationResult } from '@ai-primitives-hub/core';
|
|
2
|
+
/**
|
|
3
|
+
* Load valid item kinds from the JSON schema (single source of truth).
|
|
4
|
+
* Falls back to a default list if schema cannot be loaded.
|
|
5
|
+
* @param schemaDir - Directory containing the schema file
|
|
6
|
+
* @returns Array of valid item kinds
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadItemKindsFromSchema(schemaDir?: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Validate a collection file from disk.
|
|
11
|
+
* Checks YAML syntax, required fields, and referenced file existence.
|
|
12
|
+
* @param repoRoot - Repository root path
|
|
13
|
+
* @param collectionFile - Collection file path (absolute or repo-relative)
|
|
14
|
+
* @returns Validation result with parsed collection
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateCollectionFile(repoRoot: string, collectionFile: string): FileValidationResult;
|
|
17
|
+
/**
|
|
18
|
+
* Validate all collections in a repository, including duplicate detection.
|
|
19
|
+
* @param repoRoot - Repository root path
|
|
20
|
+
* @param collectionFiles - Array of collection file paths (repo-relative)
|
|
21
|
+
* @returns Validation result
|
|
22
|
+
*/
|
|
23
|
+
export declare function validateAllCollections(repoRoot: string, collectionFiles: string[]): AllCollectionsResult;
|
|
24
|
+
/**
|
|
25
|
+
* Generate markdown content for PR comment from validation result.
|
|
26
|
+
* @param result - Result from validateAllCollections
|
|
27
|
+
* @param totalFiles - Total number of collection files
|
|
28
|
+
* @returns Markdown content
|
|
29
|
+
*/
|
|
30
|
+
export declare function generateMarkdown(result: AllCollectionsResult, totalFiles: number): string;
|
|
31
|
+
/**
|
|
32
|
+
* List all collection files in the repository.
|
|
33
|
+
* @param repoRoot - Repository root path
|
|
34
|
+
* @returns Array of collection file paths (repo-relative)
|
|
35
|
+
*/
|
|
36
|
+
export declare function listCollectionFiles(repoRoot: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Read and parse a collection YAML file.
|
|
39
|
+
* @param repoRoot - Repository root path
|
|
40
|
+
* @param collectionFile - Collection file path (absolute or repo-relative)
|
|
41
|
+
* @returns Parsed collection object
|
|
42
|
+
* @throws {Error} if file is invalid YAML or not an object
|
|
43
|
+
*/
|
|
44
|
+
export declare function readCollection(repoRoot: string, collectionFile: string): Collection;
|
|
45
|
+
/**
|
|
46
|
+
* Write a collection object to a YAML file.
|
|
47
|
+
* @param repoRoot - Repository root path
|
|
48
|
+
* @param collectionFile - Collection file path (absolute or repo-relative)
|
|
49
|
+
* @param collection - Collection object to write
|
|
50
|
+
*/
|
|
51
|
+
export declare function writeCollection(repoRoot: string, collectionFile: string, collection: Collection): void;
|
|
52
|
+
/**
|
|
53
|
+
* Resolve all item paths referenced in a collection.
|
|
54
|
+
* For skills, expands the skill directory to include all files.
|
|
55
|
+
* @param repoRoot - Repository root path
|
|
56
|
+
* @param collection - Parsed collection object
|
|
57
|
+
* @returns Array of normalized repo-relative paths
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveCollectionItemPaths(repoRoot: string, collection: Collection): string[];
|
|
60
|
+
//# sourceMappingURL=read-collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-collection.d.ts","sourceRoot":"","sources":["../../src/collection/read-collection.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAQjC;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBpE;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,oBAAoB,CA2CtB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EAAE,GACxB,oBAAoB,CA8BtB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAczF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAM9D;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,UAAU,CAiBnF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAMtG;AAuBD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,EAAE,CA2B7F"}
|