@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,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Hub types.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the production shape at `src/types/hub.ts` so the extension's
|
|
5
|
+
* `HubManager` can eventually delegate here with zero field-mapping
|
|
6
|
+
* (migration plan §7.5).
|
|
7
|
+
* @module domain/hub/types
|
|
8
|
+
*/
|
|
9
|
+
import type { Profile } from '../registry/types';
|
|
10
|
+
import type { RegistrySource } from '../source/types';
|
|
11
|
+
/**
|
|
12
|
+
* Reserved hub id for the synthetic, auto-managed hub that holds
|
|
13
|
+
* "detached" sources/profiles added directly via `source add`/
|
|
14
|
+
* `profile create` rather than imported from a real hub reference.
|
|
15
|
+
* `HubManager.importHub` refuses this id for real imports.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_LOCAL_HUB_ID = "default-local";
|
|
18
|
+
/**
|
|
19
|
+
* Reference to a hub's location.
|
|
20
|
+
*/
|
|
21
|
+
export interface HubReference {
|
|
22
|
+
type: 'github' | 'local' | 'url';
|
|
23
|
+
location: string;
|
|
24
|
+
/** Git ref for GitHub sources (branch, tag, or commit). */
|
|
25
|
+
ref?: string;
|
|
26
|
+
autoSync?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Elastic Search telemetry configuration for a hub. Authentication is
|
|
30
|
+
* handled by the es-telemetry-proxy — no credentials configured here.
|
|
31
|
+
*/
|
|
32
|
+
export interface ElasticSearchConfig {
|
|
33
|
+
/** Elastic Search proxy URL, e.g. `https://es-proxy.internal:8080`. */
|
|
34
|
+
node: string;
|
|
35
|
+
/** Custom index prefix (default: `ai-primitives-hub-telemetry`). */
|
|
36
|
+
indexPrefix?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A source, as provisioned by a hub.
|
|
40
|
+
*/
|
|
41
|
+
export interface HubSource extends RegistrySource {
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
/** Higher priority wins on conflict. */
|
|
44
|
+
priority: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A bundle reference within a hub-provided profile.
|
|
48
|
+
*/
|
|
49
|
+
export interface HubProfileBundle {
|
|
50
|
+
id: string;
|
|
51
|
+
version: string;
|
|
52
|
+
source: string;
|
|
53
|
+
required: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A profile, as provisioned by a hub.
|
|
57
|
+
*/
|
|
58
|
+
export interface HubProfile extends Profile {
|
|
59
|
+
bundles: HubProfileBundle[];
|
|
60
|
+
/** Path segments for nested profile organization in UI trees. */
|
|
61
|
+
path?: string[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A `HubProfile` decorated with the hub it came from — the shape
|
|
65
|
+
* `RegistryManager.listProfiles()` needs to merge hub-provided
|
|
66
|
+
* profiles alongside local ones. Mirrors the production shape at
|
|
67
|
+
* `src/services/hub-manager.ts`'s `HubProfileWithMetadata`.
|
|
68
|
+
*/
|
|
69
|
+
export interface HubProfileWithMetadata extends HubProfile {
|
|
70
|
+
hubId: string;
|
|
71
|
+
hubName: string;
|
|
72
|
+
}
|
|
73
|
+
export interface HubMetadata {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
maintainer: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
/** `sha256:<hash>` or `sha512:<hash>`. */
|
|
79
|
+
checksum?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface RegistryConfiguration {
|
|
82
|
+
autoSync?: boolean;
|
|
83
|
+
syncInterval?: number;
|
|
84
|
+
/** Enforce profile bundles strictly (no ad-hoc extras). */
|
|
85
|
+
strictMode?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Parsed hub configuration.
|
|
89
|
+
*/
|
|
90
|
+
export interface HubConfig {
|
|
91
|
+
version: string;
|
|
92
|
+
metadata: HubMetadata;
|
|
93
|
+
sources: HubSource[];
|
|
94
|
+
profiles: HubProfile[];
|
|
95
|
+
configuration?: RegistryConfiguration;
|
|
96
|
+
telemetry?: {
|
|
97
|
+
elasticSearch?: ElasticSearchConfig;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface ProfileActivationState {
|
|
101
|
+
hubId: string;
|
|
102
|
+
profileId: string;
|
|
103
|
+
activatedAt: string;
|
|
104
|
+
/** @deprecated Kept for backward compatibility; prefer `syncedBundleVersions`. */
|
|
105
|
+
syncedBundles: string[];
|
|
106
|
+
syncedBundleVersions?: Record<string, string>;
|
|
107
|
+
}
|
|
108
|
+
export interface ProfileActivationOptions {
|
|
109
|
+
installBundles: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface ProfileActivationResult {
|
|
112
|
+
success: boolean;
|
|
113
|
+
hubId: string;
|
|
114
|
+
profileId: string;
|
|
115
|
+
resolvedBundles: {
|
|
116
|
+
bundle: HubProfileBundle;
|
|
117
|
+
url: string;
|
|
118
|
+
}[];
|
|
119
|
+
error?: string;
|
|
120
|
+
}
|
|
121
|
+
export interface ProfileDeactivationResult {
|
|
122
|
+
success: boolean;
|
|
123
|
+
hubId: string;
|
|
124
|
+
profileId: string;
|
|
125
|
+
removedBundles?: string[];
|
|
126
|
+
error?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface ProfileChanges {
|
|
129
|
+
bundlesAdded?: HubProfileBundle[];
|
|
130
|
+
bundlesRemoved?: string[];
|
|
131
|
+
bundlesUpdated?: {
|
|
132
|
+
id: string;
|
|
133
|
+
oldVersion: string;
|
|
134
|
+
newVersion: string;
|
|
135
|
+
}[];
|
|
136
|
+
metadataChanged?: {
|
|
137
|
+
name?: boolean;
|
|
138
|
+
description?: boolean;
|
|
139
|
+
icon?: boolean;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export interface DialogOption {
|
|
143
|
+
label: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
action: 'sync' | 'review' | 'cancel';
|
|
146
|
+
}
|
|
147
|
+
export interface ConflictResolutionDialog {
|
|
148
|
+
title: string;
|
|
149
|
+
message?: string;
|
|
150
|
+
options: DialogOption[];
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Plugin item kinds understood by the awesome-copilot plugin format.
|
|
154
|
+
* Closed set; mirrors PR #245 of the upstream repo.
|
|
155
|
+
*
|
|
156
|
+
* Note: this is a **subset** of `domain/primitive/PrimitiveKind` (which
|
|
157
|
+
* also includes `mcp-server`). Plugins describe primitives by file path;
|
|
158
|
+
* `mcp-server` is described separately under the manifest's `mcp` /
|
|
159
|
+
* `mcpServers` keys, not as a `PluginItem`.
|
|
160
|
+
*/
|
|
161
|
+
export type PluginItemKind = 'prompt' | 'instruction' | 'chat-mode' | 'agent' | 'skill';
|
|
162
|
+
/**
|
|
163
|
+
* A resolved plugin item in the harvester's canonical shape. The
|
|
164
|
+
* companion `derivePluginItems(manifest)` helper in
|
|
165
|
+
* `infra/harvest/plugin-manifest.ts` produces these from the various
|
|
166
|
+
* input formats the upstream plugin schema permits.
|
|
167
|
+
*/
|
|
168
|
+
export interface PluginItem {
|
|
169
|
+
kind: PluginItemKind;
|
|
170
|
+
/** Path relative to the plugin root (may start with `./`). */
|
|
171
|
+
path: string;
|
|
172
|
+
description?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Superset of the awesome-copilot `plugin.json` on-disk schema.
|
|
176
|
+
*
|
|
177
|
+
* Permissive by design: any unknown keys (`[key: string]: unknown`) are
|
|
178
|
+
* preserved so feature-layer parsers can read forward-compat fields
|
|
179
|
+
* without forcing a schema bump here.
|
|
180
|
+
*
|
|
181
|
+
* Read-only — the harvester never produces these, only consumes them.
|
|
182
|
+
*/
|
|
183
|
+
export interface PluginManifest {
|
|
184
|
+
id?: string;
|
|
185
|
+
name?: string;
|
|
186
|
+
description?: string;
|
|
187
|
+
version?: string;
|
|
188
|
+
tags?: string[];
|
|
189
|
+
keywords?: string[];
|
|
190
|
+
itemCount?: number;
|
|
191
|
+
path?: string;
|
|
192
|
+
/** Our format: explicit items with `kind`/`path`. */
|
|
193
|
+
items?: unknown[];
|
|
194
|
+
/** Upstream format: agent path refs. */
|
|
195
|
+
agents?: unknown[];
|
|
196
|
+
/** Upstream format: skill path refs. */
|
|
197
|
+
skills?: unknown[];
|
|
198
|
+
/** MCP server configs (see `mcp.schema.json`). */
|
|
199
|
+
mcp?: {
|
|
200
|
+
items?: Record<string, unknown>;
|
|
201
|
+
};
|
|
202
|
+
mcpServers?: Record<string, unknown>;
|
|
203
|
+
featured?: boolean;
|
|
204
|
+
external?: boolean;
|
|
205
|
+
repository?: string;
|
|
206
|
+
homepage?: string;
|
|
207
|
+
license?: string;
|
|
208
|
+
/** Anything else we don't care about on the read path. */
|
|
209
|
+
[key: string]: unknown;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* A parsed-and-normalised hub source, as consumed by the harvest
|
|
213
|
+
* pipeline (`infra/harvest/hub-config-parser.ts`, `extra-source.ts`,
|
|
214
|
+
* `hub-harvester.ts`, and the GitHub/awesome-copilot bundle providers).
|
|
215
|
+
*
|
|
216
|
+
* Distinct from `HubSource` above: `HubSource` is the *installed-hub*
|
|
217
|
+
* shape (extends `RegistrySource`, tracks `enabled`/`priority` for the
|
|
218
|
+
* extension's registry sync). `HubSourceSpec` is the *harvester's* own
|
|
219
|
+
* narrower, GitHub-specific shape — owner/repo already split out, a
|
|
220
|
+
* closed `type` union of only the three source kinds the harvester
|
|
221
|
+
* walks. The two are populated from the same `hub-config.yml`, by two
|
|
222
|
+
* different parsers, for two different consumers.
|
|
223
|
+
*/
|
|
224
|
+
export interface HubSourceSpec {
|
|
225
|
+
/** Stable identifier; defaults to `${owner}-${repo}` when omitted in config. */
|
|
226
|
+
id: string;
|
|
227
|
+
/** Human-readable name; defaults to the config `id` or the repo segment. */
|
|
228
|
+
name: string;
|
|
229
|
+
/** Source type tag; only the three listed types are wired today. */
|
|
230
|
+
type: 'github' | 'awesome-copilot' | 'awesome-copilot-plugin';
|
|
231
|
+
/** Original config URL string (used for diagnostics / display). */
|
|
232
|
+
url: string;
|
|
233
|
+
/** GitHub owner segment derived from `url`. */
|
|
234
|
+
owner: string;
|
|
235
|
+
/** GitHub repo segment derived from `url`. */
|
|
236
|
+
repo: string;
|
|
237
|
+
/** Branch (defaults to `main`). */
|
|
238
|
+
branch: string;
|
|
239
|
+
/** For `awesome-copilot` sources: subdir containing collection bundles. */
|
|
240
|
+
collectionsPath?: string;
|
|
241
|
+
/**
|
|
242
|
+
* For `awesome-copilot-plugin` sources: subdir containing plugin
|
|
243
|
+
* roots (each plugin is `<pluginsPath>/<id>/.github/plugin/plugin.json`).
|
|
244
|
+
* Defaults to "plugins" per upstream PR #245 convention.
|
|
245
|
+
*/
|
|
246
|
+
pluginsPath?: string;
|
|
247
|
+
/**
|
|
248
|
+
* Forward-compat: arbitrary `config.*` keys preserved verbatim so
|
|
249
|
+
* downstream experiments can consume new fields without forcing a
|
|
250
|
+
* schema bump here.
|
|
251
|
+
*/
|
|
252
|
+
rawConfig?: Record<string, unknown>;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/domain/hub/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EACV,OAAO,EACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAA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,gFAAgF;IAChF,EAAE,EAAE,MAAM,CAAC;IACX,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,wBAAwB,CAAC;IAC9D,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_LOCAL_HUB_ID = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Reserved hub id for the synthetic, auto-managed hub that holds
|
|
6
|
+
* "detached" sources/profiles added directly via `source add`/
|
|
7
|
+
* `profile create` rather than imported from a real hub reference.
|
|
8
|
+
* `HubManager.importHub` refuses this id for real imports.
|
|
9
|
+
*/
|
|
10
|
+
exports.DEFAULT_LOCAL_HUB_ID = 'default-local';
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/domain/hub/types.ts"],"names":[],"mappings":";;;AAeA;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer — Hub validation.
|
|
3
|
+
*
|
|
4
|
+
* Pure, side-effect-free validators ported from `src/types/hub.ts`
|
|
5
|
+
* (`validateHubReference`, `sanitizeHubId`, `hasPathTraversal`,
|
|
6
|
+
* `isValidProtocol`). These operate on already-typed values.
|
|
7
|
+
*
|
|
8
|
+
* `validateHubConfig` (main's version validates a raw, untrusted, just-
|
|
9
|
+
* parsed YAML node typed `any`) is deliberately **not** ported here — that
|
|
10
|
+
* kind of "parse, don't validate blindly" boundary check belongs next to
|
|
11
|
+
* wherever the untrusted YAML is actually parsed, i.e. `infra`'s hub-config
|
|
12
|
+
* parser (Phase 3), not in `core`'s pure domain layer.
|
|
13
|
+
* @module domain/hub/validate
|
|
14
|
+
*/
|
|
15
|
+
import type { HubReference } from './types';
|
|
16
|
+
/**
|
|
17
|
+
* Check whether a path contains directory-traversal sequences, including
|
|
18
|
+
* the URL-encoded form.
|
|
19
|
+
* @param path - Path to inspect.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hasPathTraversal(path: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Only HTTPS is an acceptable protocol for a hub `url` reference.
|
|
24
|
+
* @param protocol - Protocol string, e.g. `https:`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isValidProtocol(protocol: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Validate a hub ID: non-empty, ≤255 chars, no path separators or
|
|
29
|
+
* traversal, alphanumeric/dash/underscore only.
|
|
30
|
+
* @param hubId - Hub ID to validate.
|
|
31
|
+
* @throws {Error} if the ID is invalid.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sanitizeHubId(hubId: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Validate a hub reference's `location` against its `type`.
|
|
36
|
+
* @param ref - Hub reference to validate.
|
|
37
|
+
* @throws {Error} if validation fails.
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateHubReference(ref: HubReference): void;
|
|
40
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/domain/hub/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EACV,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAStD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAajD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,CAkC5D"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasPathTraversal = hasPathTraversal;
|
|
4
|
+
exports.isValidProtocol = isValidProtocol;
|
|
5
|
+
exports.sanitizeHubId = sanitizeHubId;
|
|
6
|
+
exports.validateHubReference = validateHubReference;
|
|
7
|
+
/**
|
|
8
|
+
* Check whether a path contains directory-traversal sequences, including
|
|
9
|
+
* the URL-encoded form.
|
|
10
|
+
* @param path - Path to inspect.
|
|
11
|
+
*/
|
|
12
|
+
function hasPathTraversal(path) {
|
|
13
|
+
if (!path) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (path.includes('..')) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
const decoded = decodeURIComponent(path);
|
|
20
|
+
return decoded.includes('..');
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Only HTTPS is an acceptable protocol for a hub `url` reference.
|
|
24
|
+
* @param protocol - Protocol string, e.g. `https:`.
|
|
25
|
+
*/
|
|
26
|
+
function isValidProtocol(protocol) {
|
|
27
|
+
return protocol === 'https:';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validate a hub ID: non-empty, ≤255 chars, no path separators or
|
|
31
|
+
* traversal, alphanumeric/dash/underscore only.
|
|
32
|
+
* @param hubId - Hub ID to validate.
|
|
33
|
+
* @throws {Error} if the ID is invalid.
|
|
34
|
+
*/
|
|
35
|
+
function sanitizeHubId(hubId) {
|
|
36
|
+
if (!hubId) {
|
|
37
|
+
throw new Error('Invalid hub ID: cannot be empty');
|
|
38
|
+
}
|
|
39
|
+
if (hubId.length > 255) {
|
|
40
|
+
throw new Error('Invalid hub ID: too long (max 255 characters)');
|
|
41
|
+
}
|
|
42
|
+
if (hubId.includes('..') || hubId.includes('/') || hubId.includes('\\')) {
|
|
43
|
+
throw new Error('Invalid hub ID: path traversal detected');
|
|
44
|
+
}
|
|
45
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(hubId)) {
|
|
46
|
+
throw new Error('Invalid hub ID: only alphanumeric characters, dash, and underscore allowed');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate a hub reference's `location` against its `type`.
|
|
51
|
+
* @param ref - Hub reference to validate.
|
|
52
|
+
* @throws {Error} if validation fails.
|
|
53
|
+
*/
|
|
54
|
+
function validateHubReference(ref) {
|
|
55
|
+
if (ref.location === null || ref.location === undefined) {
|
|
56
|
+
throw new Error('Location is required');
|
|
57
|
+
}
|
|
58
|
+
if (ref.location === '') {
|
|
59
|
+
throw new Error('Location cannot be empty');
|
|
60
|
+
}
|
|
61
|
+
switch (ref.type) {
|
|
62
|
+
case 'github': {
|
|
63
|
+
if (!/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/.test(ref.location)) {
|
|
64
|
+
throw new Error('Invalid GitHub repository format. Expected: owner/repo');
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
case 'local': {
|
|
69
|
+
if (hasPathTraversal(ref.location)) {
|
|
70
|
+
throw new Error('Path traversal detected in local path');
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case 'url': {
|
|
75
|
+
let url;
|
|
76
|
+
try {
|
|
77
|
+
url = new URL(ref.location);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
throw new Error('Invalid URL format');
|
|
81
|
+
}
|
|
82
|
+
if (!isValidProtocol(url.protocol)) {
|
|
83
|
+
throw new Error('Only HTTPS URLs are allowed for security');
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/domain/hub/validate.ts"],"names":[],"mappings":";;AAuBA,4CASC;AAMD,0CAEC;AAQD,sCAaC;AAOD,oDAkCC;AApFD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC9C,OAAO,QAAQ,KAAK,QAAQ,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,G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AAoB,CAAC,CAAC;YACxC,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC9D,CAAC;YACD,MAAM;QACR,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain layer barrel export.
|
|
3
|
+
* @module domain
|
|
4
|
+
*/
|
|
5
|
+
export * from './bundle/types';
|
|
6
|
+
export * from './bundle/id';
|
|
7
|
+
export * from './bundle/version';
|
|
8
|
+
export * from './bundle/identity-matcher';
|
|
9
|
+
export * from './collection/types';
|
|
10
|
+
export * from './collection/validate';
|
|
11
|
+
export * from './collection/manifest-validator';
|
|
12
|
+
export * from './scaffold';
|
|
13
|
+
export * from './discovery/types';
|
|
14
|
+
export * from './errors';
|
|
15
|
+
export * from './registry-error';
|
|
16
|
+
export * from './source/types';
|
|
17
|
+
export * from './source-id';
|
|
18
|
+
export * from './install/types';
|
|
19
|
+
export * from './install/target';
|
|
20
|
+
export * from './install/installable';
|
|
21
|
+
export * from './install/copilot-file-type';
|
|
22
|
+
export * from './install/layout';
|
|
23
|
+
export * from './install/transform';
|
|
24
|
+
export * from './registry/types';
|
|
25
|
+
export * from './registry/guards';
|
|
26
|
+
export * from './registry/settings';
|
|
27
|
+
export * from './hub/types';
|
|
28
|
+
export * from './hub/validate';
|
|
29
|
+
export * from './primitive/types';
|
|
30
|
+
export * from './skill/validate';
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAChD,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Domain layer barrel export.
|
|
19
|
+
* @module domain
|
|
20
|
+
*/
|
|
21
|
+
__exportStar(require("./bundle/types"), exports);
|
|
22
|
+
__exportStar(require("./bundle/id"), exports);
|
|
23
|
+
__exportStar(require("./bundle/version"), exports);
|
|
24
|
+
__exportStar(require("./bundle/identity-matcher"), exports);
|
|
25
|
+
__exportStar(require("./collection/types"), exports);
|
|
26
|
+
__exportStar(require("./collection/validate"), exports);
|
|
27
|
+
__exportStar(require("./collection/manifest-validator"), exports);
|
|
28
|
+
__exportStar(require("./scaffold"), exports);
|
|
29
|
+
__exportStar(require("./discovery/types"), exports);
|
|
30
|
+
__exportStar(require("./errors"), exports);
|
|
31
|
+
__exportStar(require("./registry-error"), exports);
|
|
32
|
+
__exportStar(require("./source/types"), exports);
|
|
33
|
+
__exportStar(require("./source-id"), exports);
|
|
34
|
+
__exportStar(require("./install/types"), exports);
|
|
35
|
+
__exportStar(require("./install/target"), exports);
|
|
36
|
+
__exportStar(require("./install/installable"), exports);
|
|
37
|
+
__exportStar(require("./install/copilot-file-type"), exports);
|
|
38
|
+
__exportStar(require("./install/layout"), exports);
|
|
39
|
+
__exportStar(require("./install/transform"), exports);
|
|
40
|
+
__exportStar(require("./registry/types"), exports);
|
|
41
|
+
__exportStar(require("./registry/guards"), exports);
|
|
42
|
+
__exportStar(require("./registry/settings"), exports);
|
|
43
|
+
__exportStar(require("./hub/types"), exports);
|
|
44
|
+
__exportStar(require("./hub/validate"), exports);
|
|
45
|
+
__exportStar(require("./primitive/types"), exports);
|
|
46
|
+
__exportStar(require("./skill/validate"), exports);
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/domain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;GAGG;AACH,iDAA+B;AAC/B,8CAA4B;AAC5B,mDAAiC;AACjC,4DAA0C;AAC1C,qDAAmC;AACnC,wDAAsC;AACtC,kEAAgD;AAChD,6CAA2B;AAC3B,oDAAkC;AAClC,2CAAyB;AACzB,mDAAiC;AACjC,iDAA+B;AAC/B,8CAA4B;AAC5B,kDAAgC;AAChC,mDAAiC;AACjC,wDAAsC;AACtC,8DAA4C;AAC5C,mDAAiC;AACjC,sDAAoC;AACpC,mDAAiC;AACjC,oDAAkC;AAClC,sDAAoC;AACpC,8CAA4B;AAC5B,iDAA+B;AAC/B,oDAAkC;AAClC,mDAAiC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copilot file type domain logic.
|
|
3
|
+
*
|
|
4
|
+
* Pure classification/naming rules for GitHub Copilot customization files
|
|
5
|
+
* (prompts, instructions, chatmodes, agents, skills): given a manifest
|
|
6
|
+
* item's file name/tags, decide its `CopilotFileType`, and given an id +
|
|
7
|
+
* type, compute the canonical on-disk file name.
|
|
8
|
+
*
|
|
9
|
+
* Ported verbatim from the extension's `src/utils/copilot-file-type-utils.ts`
|
|
10
|
+
* (migration plan §7.5 item 2) — that module becomes a thin re-export of
|
|
11
|
+
* this one. No IO, no framework imports: safe for both the extension and
|
|
12
|
+
* the CLI to depend on directly.
|
|
13
|
+
* @module domain/install/copilot-file-type
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Normalize a prompt ID to a safe string for use in file names.
|
|
17
|
+
*
|
|
18
|
+
* Replaces any characters that are not alphanumeric, hyphens, or underscores
|
|
19
|
+
* with hyphens. Also handles YAML parsing numeric-looking IDs as numbers.
|
|
20
|
+
* @param id - The prompt ID to normalize (can be string or number from YAML parsing)
|
|
21
|
+
* @returns A normalized string safe for use in file names
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalizePromptId(id: string | number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Supported Copilot file types
|
|
26
|
+
*/
|
|
27
|
+
export type CopilotFileType = 'prompt' | 'instructions' | 'chatmode' | 'agent' | 'skill';
|
|
28
|
+
/**
|
|
29
|
+
* Check if a path represents a skill directory.
|
|
30
|
+
*
|
|
31
|
+
* Skill directories are identified by:
|
|
32
|
+
* 1. Being under a 'skills/' parent directory
|
|
33
|
+
* 2. Containing a SKILL.md file (when checking contents)
|
|
34
|
+
* @param filePath - The path to check
|
|
35
|
+
* @returns True if the path represents a skill directory
|
|
36
|
+
*/
|
|
37
|
+
export declare function isSkillDirectory(filePath: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Extract the skill name from a skill directory path.
|
|
40
|
+
*
|
|
41
|
+
* Given a path like 'skills/my-skill' or 'path/to/skills/my-skill',
|
|
42
|
+
* returns 'my-skill'.
|
|
43
|
+
* @param skillPath - The path to the skill directory
|
|
44
|
+
* @returns The skill name, or null if not a valid skill path
|
|
45
|
+
*/
|
|
46
|
+
export declare function getSkillName(skillPath: string): string | null;
|
|
47
|
+
/**
|
|
48
|
+
* Determine the Copilot file type from a file name and optional tags.
|
|
49
|
+
*
|
|
50
|
+
* Detection priority:
|
|
51
|
+
* 1. File extension patterns (e.g., .prompt.md, .agent.md)
|
|
52
|
+
* 2. Directory-based detection (e.g., any .md file in an agents/ directory)
|
|
53
|
+
* 3. Special file names (e.g., SKILL.md)
|
|
54
|
+
* 4. Tags from manifest
|
|
55
|
+
* 5. Filename patterns (e.g., contains "instructions")
|
|
56
|
+
* 6. Default to 'prompt'
|
|
57
|
+
* @param fileName - The file name or path to analyze
|
|
58
|
+
* @param tags - Optional tags from the manifest
|
|
59
|
+
* @returns The detected CopilotFileType
|
|
60
|
+
*/
|
|
61
|
+
export declare function determineFileType(fileName: string, tags?: string[]): CopilotFileType;
|
|
62
|
+
/**
|
|
63
|
+
* Generate the target file name for a given ID and file type.
|
|
64
|
+
* @param id - The prompt/agent/etc. identifier
|
|
65
|
+
* @param type - The Copilot file type
|
|
66
|
+
* @returns The target file name with appropriate extension
|
|
67
|
+
*/
|
|
68
|
+
export declare function getTargetFileName(id: string, type: CopilotFileType): string;
|
|
69
|
+
/**
|
|
70
|
+
* Get the repository target directory for a given file type.
|
|
71
|
+
*
|
|
72
|
+
* Returns the appropriate .github/ subdirectory where files of this type
|
|
73
|
+
* should be placed for repository-level installation.
|
|
74
|
+
* @param type - The Copilot file type
|
|
75
|
+
* @returns The repository directory path (e.g., '.github/prompts/')
|
|
76
|
+
*/
|
|
77
|
+
export declare function getRepositoryTargetDirectory(type: CopilotFileType): string;
|
|
78
|
+
/**
|
|
79
|
+
* Get the file extension for a given Copilot file type.
|
|
80
|
+
* @param type - The Copilot file type
|
|
81
|
+
* @returns The file extension (e.g., '.prompt.md') or empty string for skills
|
|
82
|
+
*/
|
|
83
|
+
export declare function getFileExtension(type: CopilotFileType): string;
|
|
84
|
+
//# sourceMappingURL=copilot-file-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-file-type.d.ts","sourceRoot":"","sources":["../../../src/domain/install/copilot-file-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE7D;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAiCzF;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK1D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,eAAe,CAwDpF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,CAO3E;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAE9D"}
|