@ai-primitives-hub/core 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 +18 -0
- package/dist/domain/bundle/id.d.ts +60 -0
- package/dist/domain/bundle/id.d.ts.map +1 -0
- package/dist/domain/bundle/id.js +75 -0
- package/dist/domain/bundle/id.js.map +1 -0
- package/dist/domain/bundle/identity-matcher.d.ts +48 -0
- package/dist/domain/bundle/identity-matcher.d.ts.map +1 -0
- package/dist/domain/bundle/identity-matcher.js +57 -0
- package/dist/domain/bundle/identity-matcher.js.map +1 -0
- package/dist/domain/bundle/types.d.ts +138 -0
- package/dist/domain/bundle/types.d.ts.map +1 -0
- package/dist/domain/bundle/types.js +17 -0
- package/dist/domain/bundle/types.js.map +1 -0
- package/dist/domain/bundle/version.d.ts +51 -0
- package/dist/domain/bundle/version.d.ts.map +1 -0
- package/dist/domain/bundle/version.js +176 -0
- package/dist/domain/bundle/version.js.map +1 -0
- package/dist/domain/collection/manifest-validator.d.ts +47 -0
- package/dist/domain/collection/manifest-validator.d.ts.map +1 -0
- package/dist/domain/collection/manifest-validator.js +83 -0
- package/dist/domain/collection/manifest-validator.js.map +1 -0
- package/dist/domain/collection/types.d.ts +201 -0
- package/dist/domain/collection/types.d.ts.map +1 -0
- package/dist/domain/collection/types.js +17 -0
- package/dist/domain/collection/types.js.map +1 -0
- package/dist/domain/collection/validate.d.ts +51 -0
- package/dist/domain/collection/validate.d.ts.map +1 -0
- package/dist/domain/collection/validate.js +263 -0
- package/dist/domain/collection/validate.js.map +1 -0
- package/dist/domain/discovery/types.d.ts +95 -0
- package/dist/domain/discovery/types.d.ts.map +1 -0
- package/dist/domain/discovery/types.js +13 -0
- package/dist/domain/discovery/types.js.map +1 -0
- package/dist/domain/errors.d.ts +23 -0
- package/dist/domain/errors.d.ts.map +1 -0
- package/dist/domain/errors.js +41 -0
- package/dist/domain/errors.js.map +1 -0
- package/dist/domain/hub/types.d.ts +254 -0
- package/dist/domain/hub/types.d.ts.map +1 -0
- package/dist/domain/hub/types.js +11 -0
- package/dist/domain/hub/types.js.map +1 -0
- package/dist/domain/hub/validate.d.ts +40 -0
- package/dist/domain/hub/validate.d.ts.map +1 -0
- package/dist/domain/hub/validate.js +89 -0
- package/dist/domain/hub/validate.js.map +1 -0
- package/dist/domain/index.d.ts +31 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +47 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/install/copilot-file-type.d.ts +84 -0
- package/dist/domain/install/copilot-file-type.d.ts.map +1 -0
- package/dist/domain/install/copilot-file-type.js +190 -0
- package/dist/domain/install/copilot-file-type.js.map +1 -0
- package/dist/domain/install/installable.d.ts +58 -0
- package/dist/domain/install/installable.d.ts.map +1 -0
- package/dist/domain/install/installable.js +36 -0
- package/dist/domain/install/installable.js.map +1 -0
- package/dist/domain/install/layout.d.ts +84 -0
- package/dist/domain/install/layout.d.ts.map +1 -0
- package/dist/domain/install/layout.js +70 -0
- package/dist/domain/install/layout.js.map +1 -0
- package/dist/domain/install/target.d.ts +70 -0
- package/dist/domain/install/target.d.ts.map +1 -0
- package/dist/domain/install/target.js +43 -0
- package/dist/domain/install/target.js.map +1 -0
- package/dist/domain/install/transform.d.ts +47 -0
- package/dist/domain/install/transform.d.ts.map +1 -0
- package/dist/domain/install/transform.js +24 -0
- package/dist/domain/install/transform.js.map +1 -0
- package/dist/domain/install/types.d.ts +51 -0
- package/dist/domain/install/types.d.ts.map +1 -0
- package/dist/domain/install/types.js +3 -0
- package/dist/domain/install/types.js.map +1 -0
- package/dist/domain/primitive/types.d.ts +59 -0
- package/dist/domain/primitive/types.d.ts.map +1 -0
- package/dist/domain/primitive/types.js +22 -0
- package/dist/domain/primitive/types.js.map +1 -0
- package/dist/domain/registry/guards.d.ts +28 -0
- package/dist/domain/registry/guards.d.ts.map +1 -0
- package/dist/domain/registry/guards.js +33 -0
- package/dist/domain/registry/guards.js.map +1 -0
- package/dist/domain/registry/settings.d.ts +49 -0
- package/dist/domain/registry/settings.d.ts.map +1 -0
- package/dist/domain/registry/settings.js +3 -0
- package/dist/domain/registry/settings.js.map +1 -0
- package/dist/domain/registry/types.d.ts +91 -0
- package/dist/domain/registry/types.d.ts.map +1 -0
- package/dist/domain/registry/types.js +3 -0
- package/dist/domain/registry/types.js.map +1 -0
- package/dist/domain/registry-error.d.ts +69 -0
- package/dist/domain/registry-error.d.ts.map +1 -0
- package/dist/domain/registry-error.js +87 -0
- package/dist/domain/registry-error.js.map +1 -0
- package/dist/domain/scaffold/index.d.ts +9 -0
- package/dist/domain/scaffold/index.d.ts.map +1 -0
- package/dist/domain/scaffold/index.js +13 -0
- package/dist/domain/scaffold/index.js.map +1 -0
- package/dist/domain/scaffold/types.d.ts +135 -0
- package/dist/domain/scaffold/types.d.ts.map +1 -0
- package/dist/domain/scaffold/types.js +44 -0
- package/dist/domain/scaffold/types.js.map +1 -0
- package/dist/domain/skill/validate.d.ts +52 -0
- package/dist/domain/skill/validate.d.ts.map +1 -0
- package/dist/domain/skill/validate.js +108 -0
- package/dist/domain/skill/validate.js.map +1 -0
- package/dist/domain/source/types.d.ts +72 -0
- package/dist/domain/source/types.d.ts.map +1 -0
- package/dist/domain/source/types.js +14 -0
- package/dist/domain/source/types.js.map +1 -0
- package/dist/domain/source-id.d.ts +41 -0
- package/dist/domain/source-id.d.ts.map +1 -0
- package/dist/domain/source-id.js +90 -0
- package/dist/domain/source-id.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/ports/app-storage.d.ts +65 -0
- package/dist/ports/app-storage.d.ts.map +1 -0
- package/dist/ports/app-storage.js +22 -0
- package/dist/ports/app-storage.js.map +1 -0
- package/dist/ports/bundle-downloader.d.ts +28 -0
- package/dist/ports/bundle-downloader.d.ts.map +1 -0
- package/dist/ports/bundle-downloader.js +3 -0
- package/dist/ports/bundle-downloader.js.map +1 -0
- package/dist/ports/bundle-extractor.d.ts +21 -0
- package/dist/ports/bundle-extractor.d.ts.map +1 -0
- package/dist/ports/bundle-extractor.js +8 -0
- package/dist/ports/bundle-extractor.js.map +1 -0
- package/dist/ports/clock.d.ts +29 -0
- package/dist/ports/clock.d.ts.map +1 -0
- package/dist/ports/clock.js +13 -0
- package/dist/ports/clock.js.map +1 -0
- package/dist/ports/copilot-sdk.d.ts +80 -0
- package/dist/ports/copilot-sdk.d.ts.map +1 -0
- package/dist/ports/copilot-sdk.js +16 -0
- package/dist/ports/copilot-sdk.js.map +1 -0
- package/dist/ports/filesystem.d.ts +53 -0
- package/dist/ports/filesystem.d.ts.map +1 -0
- package/dist/ports/filesystem.js +14 -0
- package/dist/ports/filesystem.js.map +1 -0
- package/dist/ports/github-api.d.ts +62 -0
- package/dist/ports/github-api.d.ts.map +1 -0
- package/dist/ports/github-api.js +19 -0
- package/dist/ports/github-api.js.map +1 -0
- package/dist/ports/http.d.ts +58 -0
- package/dist/ports/http.d.ts.map +1 -0
- package/dist/ports/http.js +12 -0
- package/dist/ports/http.js.map +1 -0
- package/dist/ports/index.d.ts +23 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +39 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/layout-config-loader.d.ts +27 -0
- package/dist/ports/layout-config-loader.d.ts.map +1 -0
- package/dist/ports/layout-config-loader.js +3 -0
- package/dist/ports/layout-config-loader.js.map +1 -0
- package/dist/ports/process-runner.d.ts +31 -0
- package/dist/ports/process-runner.d.ts.map +1 -0
- package/dist/ports/process-runner.js +14 -0
- package/dist/ports/process-runner.js.map +1 -0
- package/dist/ports/registry-operations.d.ts +157 -0
- package/dist/ports/registry-operations.d.ts.map +1 -0
- package/dist/ports/registry-operations.js +3 -0
- package/dist/ports/registry-operations.js.map +1 -0
- package/dist/ports/resource-transformer.d.ts +28 -0
- package/dist/ports/resource-transformer.d.ts.map +1 -0
- package/dist/ports/resource-transformer.js +3 -0
- package/dist/ports/resource-transformer.js.map +1 -0
- package/dist/ports/source-adapter.d.ts +43 -0
- package/dist/ports/source-adapter.d.ts.map +1 -0
- package/dist/ports/source-adapter.js +3 -0
- package/dist/ports/source-adapter.js.map +1 -0
- package/dist/ports/source-resolver.d.ts +19 -0
- package/dist/ports/source-resolver.d.ts.map +1 -0
- package/dist/ports/source-resolver.js +3 -0
- package/dist/ports/source-resolver.js.map +1 -0
- package/dist/ports/target-writer.d.ts +37 -0
- package/dist/ports/target-writer.d.ts.map +1 -0
- package/dist/ports/target-writer.js +3 -0
- package/dist/ports/target-writer.js.map +1 -0
- package/dist/ports/telemetry.d.ts +22 -0
- package/dist/ports/telemetry.d.ts.map +1 -0
- package/dist/ports/telemetry.js +11 -0
- package/dist/ports/telemetry.js.map +1 -0
- package/dist/ports/update-notifier.d.ts +22 -0
- package/dist/ports/update-notifier.d.ts.map +1 -0
- package/dist/ports/update-notifier.js +12 -0
- package/dist/ports/update-notifier.js.map +1 -0
- package/dist/ports/update-store.d.ts +25 -0
- package/dist/ports/update-store.d.ts.map +1 -0
- package/dist/ports/update-store.js +12 -0
- package/dist/ports/update-store.js.map +1 -0
- package/dist/public/schemas/apm.schema.json +59 -0
- package/dist/public/schemas/collection.schema.json +345 -0
- package/dist/public/schemas/default-hubs-config.schema.json +68 -0
- package/dist/public/schemas/hub-config.schema.json +389 -0
- package/dist/public/schemas/lockfile.schema.json +243 -0
- package/package.json +50 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain types for scaffolding collections and primitives.
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure for CLI scaffolding commands,
|
|
5
|
+
* adapted from the VS Code extension's scaffolding implementation
|
|
6
|
+
* but without VS Code-specific dependencies.
|
|
7
|
+
* @module domain/scaffold/types
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Sanitize an ID by converting to lowercase and replacing non-alphanumeric chars with hyphens.
|
|
11
|
+
* @param name - The name to sanitize.
|
|
12
|
+
* @returns Sanitized ID string.
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateSanitizedId(name: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Supported scaffold types for CLI commands.
|
|
17
|
+
*/
|
|
18
|
+
export declare enum ScaffoldType {
|
|
19
|
+
collection = "collection",
|
|
20
|
+
prompt = "prompt",
|
|
21
|
+
instruction = "instruction",
|
|
22
|
+
agent = "agent",
|
|
23
|
+
skill = "skill",
|
|
24
|
+
plugin = "plugin",
|
|
25
|
+
hook = "hook",
|
|
26
|
+
chatMode = "chat-mode",
|
|
27
|
+
projectGitHub = "project-github",
|
|
28
|
+
projectApm = "project-apm"
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Common options for scaffold commands.
|
|
32
|
+
*/
|
|
33
|
+
export interface ScaffoldOptions {
|
|
34
|
+
/** Name of the item being scaffolded */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** Description of the item */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Author name */
|
|
39
|
+
author?: string;
|
|
40
|
+
/** Tags (comma-separated string or array) */
|
|
41
|
+
tags?: string[];
|
|
42
|
+
/** Collection ID (for primitives that belong to collections) */
|
|
43
|
+
collectionId?: string;
|
|
44
|
+
/** Output directory path */
|
|
45
|
+
path?: string;
|
|
46
|
+
/** Whether to use interactive mode */
|
|
47
|
+
interactive?: boolean;
|
|
48
|
+
/** Version (for plugins) */
|
|
49
|
+
version?: string;
|
|
50
|
+
/** Hook type (for hooks) */
|
|
51
|
+
hookType?: string;
|
|
52
|
+
/** GitHub organization (for projects) */
|
|
53
|
+
githubOrg?: string;
|
|
54
|
+
/** GitHub Actions runner (for projects) */
|
|
55
|
+
githubRunner?: string;
|
|
56
|
+
/** Organization name (for InnerSource LICENSE) */
|
|
57
|
+
organizationName?: string;
|
|
58
|
+
/** Internal contact email */
|
|
59
|
+
internalContact?: string;
|
|
60
|
+
/** Legal contact email */
|
|
61
|
+
legalContact?: string;
|
|
62
|
+
/** Organization policy link */
|
|
63
|
+
organizationPolicyLink?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Context variables for template rendering.
|
|
67
|
+
*/
|
|
68
|
+
export interface TemplateContext {
|
|
69
|
+
/** Project name */
|
|
70
|
+
projectName: string;
|
|
71
|
+
/** Sanitized collection/project ID */
|
|
72
|
+
collectionId: string;
|
|
73
|
+
/** Display name */
|
|
74
|
+
name?: string;
|
|
75
|
+
/** Description */
|
|
76
|
+
description?: string;
|
|
77
|
+
/** Author */
|
|
78
|
+
author?: string;
|
|
79
|
+
/** Tags (array) */
|
|
80
|
+
tags?: string[];
|
|
81
|
+
/** Version */
|
|
82
|
+
version?: string;
|
|
83
|
+
/** GitHub organization */
|
|
84
|
+
githubOrg?: string;
|
|
85
|
+
/** GitHub Actions runner */
|
|
86
|
+
githubRunner?: string;
|
|
87
|
+
/** Organization name */
|
|
88
|
+
organizationName?: string;
|
|
89
|
+
/** Internal contact */
|
|
90
|
+
internalContact?: string;
|
|
91
|
+
/** Legal contact */
|
|
92
|
+
legalContact?: string;
|
|
93
|
+
/** Organization policy link */
|
|
94
|
+
organizationPolicyLink?: string;
|
|
95
|
+
/** Additional context variables */
|
|
96
|
+
[key: string]: any;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Template metadata from manifest.json.
|
|
100
|
+
*/
|
|
101
|
+
export interface TemplateInfo {
|
|
102
|
+
/** Relative path to template file */
|
|
103
|
+
path: string;
|
|
104
|
+
/** Human-readable description */
|
|
105
|
+
description: string;
|
|
106
|
+
/** Whether this template is required */
|
|
107
|
+
required: boolean;
|
|
108
|
+
/** Variable names used in this template */
|
|
109
|
+
variables: string[];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Template manifest structure.
|
|
113
|
+
*/
|
|
114
|
+
export interface TemplateManifest {
|
|
115
|
+
/** Manifest version */
|
|
116
|
+
version: string;
|
|
117
|
+
/** Description of the template set */
|
|
118
|
+
description: string;
|
|
119
|
+
/** Template definitions keyed by name */
|
|
120
|
+
templates: {
|
|
121
|
+
[key: string]: TemplateInfo;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Result of a scaffold operation.
|
|
126
|
+
*/
|
|
127
|
+
export interface ScaffoldResult {
|
|
128
|
+
/** Whether scaffolding succeeded */
|
|
129
|
+
success: boolean;
|
|
130
|
+
/** Files that were created */
|
|
131
|
+
createdFiles: string[];
|
|
132
|
+
/** Error message if failed */
|
|
133
|
+
error?: string;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/scaffold/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMxD;AAED;;GAEG;AACH,oBAAY,YAAY;IAEtB,UAAU,eAAe;IAGzB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,cAAc;IAGtB,aAAa,mBAAmB;IAChC,UAAU,gBAAgB;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC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C;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,SAAS,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;KAC7B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Domain types for scaffolding collections and primitives.
|
|
4
|
+
*
|
|
5
|
+
* These types define the structure for CLI scaffolding commands,
|
|
6
|
+
* adapted from the VS Code extension's scaffolding implementation
|
|
7
|
+
* but without VS Code-specific dependencies.
|
|
8
|
+
* @module domain/scaffold/types
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.ScaffoldType = void 0;
|
|
12
|
+
exports.generateSanitizedId = generateSanitizedId;
|
|
13
|
+
/**
|
|
14
|
+
* Sanitize an ID by converting to lowercase and replacing non-alphanumeric chars with hyphens.
|
|
15
|
+
* @param name - The name to sanitize.
|
|
16
|
+
* @returns Sanitized ID string.
|
|
17
|
+
*/
|
|
18
|
+
function generateSanitizedId(name) {
|
|
19
|
+
return name
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.replace(/[^a-z0-9-]/g, '-')
|
|
22
|
+
.replace(/-+/g, '-')
|
|
23
|
+
.replace(/^-|-$/g, '');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Supported scaffold types for CLI commands.
|
|
27
|
+
*/
|
|
28
|
+
var ScaffoldType;
|
|
29
|
+
(function (ScaffoldType) {
|
|
30
|
+
// Collection scaffolding
|
|
31
|
+
ScaffoldType["collection"] = "collection";
|
|
32
|
+
// Primitive scaffolding
|
|
33
|
+
ScaffoldType["prompt"] = "prompt";
|
|
34
|
+
ScaffoldType["instruction"] = "instruction";
|
|
35
|
+
ScaffoldType["agent"] = "agent";
|
|
36
|
+
ScaffoldType["skill"] = "skill";
|
|
37
|
+
ScaffoldType["plugin"] = "plugin";
|
|
38
|
+
ScaffoldType["hook"] = "hook";
|
|
39
|
+
ScaffoldType["chatMode"] = "chat-mode";
|
|
40
|
+
// Project scaffolding
|
|
41
|
+
ScaffoldType["projectGitHub"] = "project-github";
|
|
42
|
+
ScaffoldType["projectApm"] = "project-apm";
|
|
43
|
+
})(ScaffoldType || (exports.ScaffoldType = ScaffoldType = {}));
|
|
44
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/scaffold/types.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAOH,kDAMC;AAXD;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,IAAI;SACR,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,IAAY,YAgBX;AAhBD,WAAY,YAAY;IACtB,yBAAyB;IACzB,yCAAyB,CAAA;IAEzB,wBAAwB;IACxB,iCAAiB,CAAA;IACjB,2CAA2B,CAAA;IAC3B,+BAAe,CAAA;IACf,+BAAe,CAAA;IACf,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IACb,sCAAsB,CAAA;IAEtB,sBAAsB;IACtB,gDAAgC,CAAA;IAChC,0CAA0B,CAAA;AAC5B,CAAC,EAhBW,YAAY,4BAAZ,YAAY,QAgBvB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills validation module (pure functions).
|
|
3
|
+
*
|
|
4
|
+
* Validates skill folders following the Agent Skills specification.
|
|
5
|
+
* File-IO dependent functions belong in the `app` layer.
|
|
6
|
+
*
|
|
7
|
+
* Ported unchanged from the reference branch's
|
|
8
|
+
* `core/src/domain/skill/validate.ts`. Its `parseFrontmatter` is
|
|
9
|
+
* reused as-is by `app/transform/transformers/kiro-transformer.ts`
|
|
10
|
+
* (a generic YAML-frontmatter reader, despite this file's own
|
|
11
|
+
* skill-specific name/home — matches the reference's own reuse).
|
|
12
|
+
* @see https://agentskills.io/specification
|
|
13
|
+
* @module domain/skill/validate
|
|
14
|
+
*/
|
|
15
|
+
export interface SkillMetadata {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface SkillValidationResult {
|
|
21
|
+
skillName: string;
|
|
22
|
+
folderName: string;
|
|
23
|
+
valid: boolean;
|
|
24
|
+
errors: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface AllSkillsValidationResult {
|
|
27
|
+
valid: boolean;
|
|
28
|
+
skills: SkillValidationResult[];
|
|
29
|
+
totalSkills: number;
|
|
30
|
+
validSkills: number;
|
|
31
|
+
invalidSkills: number;
|
|
32
|
+
}
|
|
33
|
+
export declare const SKILL_NAME_MAX_LENGTH = 64;
|
|
34
|
+
export declare const SKILL_DESCRIPTION_MIN_LENGTH = 10;
|
|
35
|
+
export declare const SKILL_DESCRIPTION_MAX_LENGTH = 1024;
|
|
36
|
+
export declare const MAX_ASSET_SIZE: number;
|
|
37
|
+
/**
|
|
38
|
+
* Parse YAML frontmatter from SKILL.md content
|
|
39
|
+
* @param content
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseFrontmatter(content: string): SkillMetadata | null;
|
|
42
|
+
/**
|
|
43
|
+
* Validate skill name format
|
|
44
|
+
* @param name
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateSkillName(name: unknown): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Validate skill description
|
|
49
|
+
* @param description
|
|
50
|
+
*/
|
|
51
|
+
export declare function validateSkillDescription(description: unknown): string | null;
|
|
52
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/domain/skill/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAGD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AACxC,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAC/C,eAAO,MAAM,4BAA4B,OAAO,CAAC;AACjD,eAAO,MAAM,cAAc,QAAkB,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAUtE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAW9D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAW5E"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Skills validation module (pure functions).
|
|
4
|
+
*
|
|
5
|
+
* Validates skill folders following the Agent Skills specification.
|
|
6
|
+
* File-IO dependent functions belong in the `app` layer.
|
|
7
|
+
*
|
|
8
|
+
* Ported unchanged from the reference branch's
|
|
9
|
+
* `core/src/domain/skill/validate.ts`. Its `parseFrontmatter` is
|
|
10
|
+
* reused as-is by `app/transform/transformers/kiro-transformer.ts`
|
|
11
|
+
* (a generic YAML-frontmatter reader, despite this file's own
|
|
12
|
+
* skill-specific name/home — matches the reference's own reuse).
|
|
13
|
+
* @see https://agentskills.io/specification
|
|
14
|
+
* @module domain/skill/validate
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.MAX_ASSET_SIZE = exports.SKILL_DESCRIPTION_MAX_LENGTH = exports.SKILL_DESCRIPTION_MIN_LENGTH = exports.SKILL_NAME_MAX_LENGTH = void 0;
|
|
51
|
+
exports.parseFrontmatter = parseFrontmatter;
|
|
52
|
+
exports.validateSkillName = validateSkillName;
|
|
53
|
+
exports.validateSkillDescription = validateSkillDescription;
|
|
54
|
+
const yaml = __importStar(require("js-yaml"));
|
|
55
|
+
// Constants
|
|
56
|
+
exports.SKILL_NAME_MAX_LENGTH = 64;
|
|
57
|
+
exports.SKILL_DESCRIPTION_MIN_LENGTH = 10;
|
|
58
|
+
exports.SKILL_DESCRIPTION_MAX_LENGTH = 1024;
|
|
59
|
+
exports.MAX_ASSET_SIZE = 5 * 1024 * 1024; // 5 MB
|
|
60
|
+
/**
|
|
61
|
+
* Parse YAML frontmatter from SKILL.md content
|
|
62
|
+
* @param content
|
|
63
|
+
*/
|
|
64
|
+
function parseFrontmatter(content) {
|
|
65
|
+
const match = /^---\n([\s\S]*?)\n---/.exec(content);
|
|
66
|
+
if (!match) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
return yaml.load(match[1]);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Validate skill name format
|
|
78
|
+
* @param name
|
|
79
|
+
*/
|
|
80
|
+
function validateSkillName(name) {
|
|
81
|
+
if (!name || typeof name !== 'string') {
|
|
82
|
+
return 'name is required and must be a string';
|
|
83
|
+
}
|
|
84
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
85
|
+
return 'name must contain only lowercase letters, numbers, and hyphens';
|
|
86
|
+
}
|
|
87
|
+
if (name.length > exports.SKILL_NAME_MAX_LENGTH) {
|
|
88
|
+
return `name must not exceed ${exports.SKILL_NAME_MAX_LENGTH} characters`;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Validate skill description
|
|
94
|
+
* @param description
|
|
95
|
+
*/
|
|
96
|
+
function validateSkillDescription(description) {
|
|
97
|
+
if (!description || typeof description !== 'string') {
|
|
98
|
+
return 'description is required and must be a string';
|
|
99
|
+
}
|
|
100
|
+
if (description.length < exports.SKILL_DESCRIPTION_MIN_LENGTH) {
|
|
101
|
+
return `description must be at least ${exports.SKILL_DESCRIPTION_MIN_LENGTH} characters`;
|
|
102
|
+
}
|
|
103
|
+
if (description.length > exports.SKILL_DESCRIPTION_MAX_LENGTH) {
|
|
104
|
+
return `description must not exceed ${exports.SKILL_DESCRIPTION_MAX_LENGTH} characters`;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/domain/skill/validate.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAm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AAgC,oCAA4B,aAAa,CAAC;IACnF,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,GAAG,oCAA4B,EAAE,CAAC;QACtD,OAAO,+BAA+B,oCAA4B,aAAa,CAAC;IAClF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Source types.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the production shape at `src/types/registry.ts`
|
|
5
|
+
* (`SourceType`, `RegistrySource`, `SourceMetadata`, `SourceSyncedEvent`).
|
|
6
|
+
* `ValidationResult` here consolidates two near-duplicate shapes found on
|
|
7
|
+
* `main` (`src/types/registry.ts` and `src/types/hub.ts`, the latter
|
|
8
|
+
* missing `warnings`/`bundlesFound`) into the one, more complete shape —
|
|
9
|
+
* a superset, so existing `{ valid, errors }` call sites remain compatible.
|
|
10
|
+
* @module domain/source/types
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* All source adapter types known to the registry.
|
|
14
|
+
*/
|
|
15
|
+
export type SourceType = 'github' | 'local' | 'awesome-copilot' | 'local-awesome-copilot' | 'apm' | 'local-apm' | 'skills' | 'local-skills';
|
|
16
|
+
/**
|
|
17
|
+
* A configured bundle source.
|
|
18
|
+
*/
|
|
19
|
+
export interface RegistrySource {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
type: SourceType;
|
|
23
|
+
url: string;
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
priority: number;
|
|
26
|
+
private?: boolean;
|
|
27
|
+
/** Environment variable name or secure-storage key, not the token itself. */
|
|
28
|
+
token?: string;
|
|
29
|
+
/** Hub identifier, when this source was provisioned by a curated hub. */
|
|
30
|
+
hubId?: string;
|
|
31
|
+
metadata?: {
|
|
32
|
+
description?: string;
|
|
33
|
+
homepage?: string;
|
|
34
|
+
contact?: string;
|
|
35
|
+
};
|
|
36
|
+
config?: {
|
|
37
|
+
/** Git branch, for git-based sources. */
|
|
38
|
+
branch?: string;
|
|
39
|
+
/** Collections directory, for awesome-copilot sources. */
|
|
40
|
+
collectionsPath?: string;
|
|
41
|
+
/** Index file name, for awesome-copilot sources. */
|
|
42
|
+
indexFile?: string;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Metadata describing a source as a whole (not a specific bundle).
|
|
48
|
+
*/
|
|
49
|
+
export interface SourceMetadata {
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
bundleCount: number;
|
|
53
|
+
lastUpdated: string;
|
|
54
|
+
version: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Result of validating a source, a hub reference, or a hub config.
|
|
58
|
+
*/
|
|
59
|
+
export interface ValidationResult {
|
|
60
|
+
valid: boolean;
|
|
61
|
+
errors: string[];
|
|
62
|
+
warnings?: string[];
|
|
63
|
+
bundlesFound?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Emitted after a source has been (re)synced.
|
|
67
|
+
*/
|
|
68
|
+
export interface SourceSyncedEvent {
|
|
69
|
+
sourceId: string;
|
|
70
|
+
bundleCount: number;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/source/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,OAAO,GACP,iBAAiB,GACjB,uBAAuB,GACvB,KAAK,GACL,WAAW,GACX,QAAQ,GACR,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,yCAAyC;QACzC,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,0DAA0D;QAC1D,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,oDAAoD;QACpD,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Domain layer — Source types.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the production shape at `src/types/registry.ts`
|
|
6
|
+
* (`SourceType`, `RegistrySource`, `SourceMetadata`, `SourceSyncedEvent`).
|
|
7
|
+
* `ValidationResult` here consolidates two near-duplicate shapes found on
|
|
8
|
+
* `main` (`src/types/registry.ts` and `src/types/hub.ts`, the latter
|
|
9
|
+
* missing `warnings`/`bundlesFound`) into the one, more complete shape —
|
|
10
|
+
* a superset, so existing `{ valid, errors }` call sites remain compatible.
|
|
11
|
+
* @module domain/source/types
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/source/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Optional fields that participate in the hash.
|
|
3
|
+
*/
|
|
4
|
+
export interface SourceIdConfig {
|
|
5
|
+
/** Git branch for git-based sources. Defaults to 'main'; 'master' is canonicalized to 'main'. */
|
|
6
|
+
branch?: string;
|
|
7
|
+
/** Path to the collections directory. Defaults to 'collections'. */
|
|
8
|
+
collectionsPath?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Lowercase host + path; strip protocol + trailing slashes.
|
|
12
|
+
*
|
|
13
|
+
* Falls back to a regex-based normalization when `URL` parsing fails
|
|
14
|
+
* (matches the extension's behaviour for invalid URLs).
|
|
15
|
+
* @param url Raw URL.
|
|
16
|
+
* @returns Normalized URL string.
|
|
17
|
+
*/
|
|
18
|
+
export declare const normalizeUrl: (url: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate a stable sourceId of the form `{type}-{12hex}`.
|
|
21
|
+
*
|
|
22
|
+
* The hash includes (sourceType, normalizedUrl, branch,
|
|
23
|
+
* collectionsPath) so that the same logical source maps to the same
|
|
24
|
+
* id regardless of how the user typed the URL.
|
|
25
|
+
* @param sourceType e.g. 'github', 'awesome-copilot', 'apm'.
|
|
26
|
+
* @param url Source URL.
|
|
27
|
+
* @param config Optional branch + collections path.
|
|
28
|
+
* @returns The sourceId.
|
|
29
|
+
*/
|
|
30
|
+
export declare const generateSourceId: (sourceType: string, url: string, config?: SourceIdConfig) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Generate a hub-key analogue for hubs[] entries in the lockfile.
|
|
33
|
+
*
|
|
34
|
+
* Format: `{12hex}` for main/master/no-branch, `{12hex}-{branch}`
|
|
35
|
+
* otherwise (matches extension's `generateHubKey`).
|
|
36
|
+
* @param url Hub URL.
|
|
37
|
+
* @param branch Optional branch.
|
|
38
|
+
* @returns The hub key.
|
|
39
|
+
*/
|
|
40
|
+
export declare const generateHubKey: (url: string, branch?: string) => string;
|
|
41
|
+
//# sourceMappingURL=source-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-id.d.ts","sourceRoot":"","sources":["../../src/domain/source-id.ts"],"names":[],"mappings":"AAcA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,MAY1C,CAAC;AAcF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,GAC3B,YAAY,MAAM,EAClB,KAAK,MAAM,EACX,SAAS,cAAc,KACtB,MASF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,KAAG,MAQ7D,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateHubKey = exports.generateSourceId = exports.normalizeUrl = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* sourceId helper.
|
|
6
|
+
*
|
|
7
|
+
* Mirrors the algorithm in `src/utils/source-id-utils.ts` of the
|
|
8
|
+
* VS Code extension exactly so that lockfile entries written by the
|
|
9
|
+
* CLI are interchangeable with entries written by the extension.
|
|
10
|
+
*
|
|
11
|
+
* Pure function; no IO; safe to import from anywhere.
|
|
12
|
+
* @module domain/source-id
|
|
13
|
+
*/
|
|
14
|
+
const node_crypto_1 = require("node:crypto");
|
|
15
|
+
/**
|
|
16
|
+
* Lowercase host + path; strip protocol + trailing slashes.
|
|
17
|
+
*
|
|
18
|
+
* Falls back to a regex-based normalization when `URL` parsing fails
|
|
19
|
+
* (matches the extension's behaviour for invalid URLs).
|
|
20
|
+
* @param url Raw URL.
|
|
21
|
+
* @returns Normalized URL string.
|
|
22
|
+
*/
|
|
23
|
+
const normalizeUrl = (url) => {
|
|
24
|
+
try {
|
|
25
|
+
const u = new URL(url);
|
|
26
|
+
const host = u.hostname.toLowerCase();
|
|
27
|
+
const path = u.pathname.toLowerCase().replace(/\/+$/, '');
|
|
28
|
+
return host + path;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return url
|
|
32
|
+
.toLowerCase()
|
|
33
|
+
.replace(/^https?:\/\//, '')
|
|
34
|
+
.replace(/\/+$/, '');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.normalizeUrl = normalizeUrl;
|
|
38
|
+
/**
|
|
39
|
+
* Canonicalize branch name to 'main' if missing or 'master'.
|
|
40
|
+
* @param branch Optional branch name.
|
|
41
|
+
* @returns Canonical branch.
|
|
42
|
+
*/
|
|
43
|
+
const canonicalBranch = (branch) => {
|
|
44
|
+
if (branch === undefined || branch.length === 0 || branch === 'master') {
|
|
45
|
+
return 'main';
|
|
46
|
+
}
|
|
47
|
+
return branch;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Generate a stable sourceId of the form `{type}-{12hex}`.
|
|
51
|
+
*
|
|
52
|
+
* The hash includes (sourceType, normalizedUrl, branch,
|
|
53
|
+
* collectionsPath) so that the same logical source maps to the same
|
|
54
|
+
* id regardless of how the user typed the URL.
|
|
55
|
+
* @param sourceType e.g. 'github', 'awesome-copilot', 'apm'.
|
|
56
|
+
* @param url Source URL.
|
|
57
|
+
* @param config Optional branch + collections path.
|
|
58
|
+
* @returns The sourceId.
|
|
59
|
+
*/
|
|
60
|
+
const generateSourceId = (sourceType, url, config) => {
|
|
61
|
+
const normalizedUrl = (0, exports.normalizeUrl)(url);
|
|
62
|
+
const branch = canonicalBranch(config?.branch);
|
|
63
|
+
const collectionsPath = config?.collectionsPath ?? 'collections';
|
|
64
|
+
const hash = (0, node_crypto_1.createHash)('sha256')
|
|
65
|
+
.update(`${sourceType}:${normalizedUrl}:${branch}:${collectionsPath}`)
|
|
66
|
+
.digest('hex')
|
|
67
|
+
.substring(0, 12);
|
|
68
|
+
return `${sourceType}-${hash}`;
|
|
69
|
+
};
|
|
70
|
+
exports.generateSourceId = generateSourceId;
|
|
71
|
+
/**
|
|
72
|
+
* Generate a hub-key analogue for hubs[] entries in the lockfile.
|
|
73
|
+
*
|
|
74
|
+
* Format: `{12hex}` for main/master/no-branch, `{12hex}-{branch}`
|
|
75
|
+
* otherwise (matches extension's `generateHubKey`).
|
|
76
|
+
* @param url Hub URL.
|
|
77
|
+
* @param branch Optional branch.
|
|
78
|
+
* @returns The hub key.
|
|
79
|
+
*/
|
|
80
|
+
const generateHubKey = (url, branch) => {
|
|
81
|
+
const normalizedUrl = (0, exports.normalizeUrl)(url);
|
|
82
|
+
const hash = (0, node_crypto_1.createHash)('sha256')
|
|
83
|
+
.update(normalizedUrl)
|
|
84
|
+
.digest('hex')
|
|
85
|
+
.substring(0, 12);
|
|
86
|
+
const b = canonicalBranch(branch);
|
|
87
|
+
return b === 'main' ? hash : `${hash}-${b}`;
|
|
88
|
+
};
|
|
89
|
+
exports.generateHubKey = generateHubKey;
|
|
90
|
+
//# sourceMappingURL=source-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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A,wBAAU,EAAC,QAAQ,CAAC;SAC9B,MAAM,CAAC,GAAG,UAAU,IAAI,aAAa,IAAI,MAAM,IAAI,eAAe,EAAE,CAAC;SACrE,MAAM,CAAC,KAAK,CAAC;SACb,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,OAAO,GAAG,UAAU,IAAI,IAAI,EAAE,CAAC;AACjC,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B;AAEF;;;;;;;;GAQG;AACI,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,MAAe,EAAU,EAAE;IACrE,MAAM,aAAa,GAAG,IAAA,oBAAY,EAAC,GAAG,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC;SAC9B,MAAM,CAAC,aAAa,CAAC;SACrB,MAAM,CAAC,KAAK,CAAC;SACb,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAClC,OAAO,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;AAC9C,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './domain';
|
|
2
|
+
export * from './ports';
|
|
3
|
+
/**
|
|
4
|
+
* Public schema directory path.
|
|
5
|
+
* This directory contains JSON schemas for validation.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCHEMA_DIR: string;
|
|
8
|
+
/**
|
|
9
|
+
* Collection schema JSON embedded directly in the bundle.
|
|
10
|
+
* Use this instead of loading from disk to ensure schema is always available
|
|
11
|
+
* in single-executable applications.
|
|
12
|
+
*/
|
|
13
|
+
export { default as COLLECTION_SCHEMA } from './public/schemas/collection.schema.json';
|
|
14
|
+
/**
|
|
15
|
+
* Phase 1 scaffolding marker, kept until `infra`/`app`/`cli` each have real
|
|
16
|
+
* code of their own to depend on instead of this placeholder re-export
|
|
17
|
+
* chain (see those packages' `src/index.ts`) — removed in Phase 5 once
|
|
18
|
+
* `cli` no longer needs it.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CORE_PACKAGE_READY = true;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,UAAU,QAA2C,CAAC;AAEnE;;;;GAIG;AACH,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,OAAO,CAAC"}
|