@solaqua/skul 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +282 -0
- package/bin/skul.js +13 -0
- package/dist/bundle-discovery.d.ts +30 -0
- package/dist/bundle-discovery.js +284 -0
- package/dist/bundle-discovery.js.map +1 -0
- package/dist/bundle-fetch.d.ts +67 -0
- package/dist/bundle-fetch.js +378 -0
- package/dist/bundle-fetch.js.map +1 -0
- package/dist/bundle-items.d.ts +34 -0
- package/dist/bundle-items.js +149 -0
- package/dist/bundle-items.js.map +1 -0
- package/dist/bundle-manifest.d.ts +26 -0
- package/dist/bundle-manifest.js +196 -0
- package/dist/bundle-manifest.js.map +1 -0
- package/dist/bundle-materialization.d.ts +52 -0
- package/dist/bundle-materialization.js +587 -0
- package/dist/bundle-materialization.js.map +1 -0
- package/dist/bundle-translation.d.ts +38 -0
- package/dist/bundle-translation.js +502 -0
- package/dist/bundle-translation.js.map +1 -0
- package/dist/cli.d.ts +126 -0
- package/dist/cli.js +648 -0
- package/dist/cli.js.map +1 -0
- package/dist/fs-utils.d.ts +7 -0
- package/dist/fs-utils.js +27 -0
- package/dist/fs-utils.js.map +1 -0
- package/dist/git-context.d.ts +14 -0
- package/dist/git-context.js +53 -0
- package/dist/git-context.js.map +1 -0
- package/dist/git-exclude.d.ts +13 -0
- package/dist/git-exclude.js +76 -0
- package/dist/git-exclude.js.map +1 -0
- package/dist/git-index.d.ts +106 -0
- package/dist/git-index.js +224 -0
- package/dist/git-index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +4190 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +91 -0
- package/dist/registry.js +551 -0
- package/dist/registry.js.map +1 -0
- package/dist/root-instruction-content.d.ts +11 -0
- package/dist/root-instruction-content.js +61 -0
- package/dist/root-instruction-content.js.map +1 -0
- package/dist/root-instruction-render.d.ts +31 -0
- package/dist/root-instruction-render.js +121 -0
- package/dist/root-instruction-render.js.map +1 -0
- package/dist/root-instruction-state.d.ts +41 -0
- package/dist/root-instruction-state.js +273 -0
- package/dist/root-instruction-state.js.map +1 -0
- package/dist/state-layout.d.ts +11 -0
- package/dist/state-layout.js +26 -0
- package/dist/state-layout.js.map +1 -0
- package/dist/tool-mapping.d.ts +35 -0
- package/dist/tool-mapping.js +227 -0
- package/dist/tool-mapping.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface FetchRemoteSourceOptions {
|
|
2
|
+
/** Normalized source identifier, e.g. "github.com/owner/repo" */
|
|
3
|
+
source: string;
|
|
4
|
+
libraryDir: string;
|
|
5
|
+
/** Transport protocol to use when cloning. Defaults to "https". */
|
|
6
|
+
protocol?: "https" | "ssh";
|
|
7
|
+
}
|
|
8
|
+
export interface FetchRemoteSourceResult {
|
|
9
|
+
/** true if a fresh clone was performed; false if the cache already existed */
|
|
10
|
+
cloned: boolean;
|
|
11
|
+
targetDir: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CachedSourceRevision {
|
|
14
|
+
cached: boolean;
|
|
15
|
+
targetDir: string;
|
|
16
|
+
currentCommit?: string;
|
|
17
|
+
currentRef?: string;
|
|
18
|
+
remoteUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface RemoteSourceStatus extends CachedSourceRevision {
|
|
21
|
+
remoteCommit: string;
|
|
22
|
+
refKind: "branch" | "tag" | "commit";
|
|
23
|
+
resolvedRef?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UpdateCachedRemoteSourceResult extends RemoteSourceStatus {
|
|
26
|
+
previousCommit?: string;
|
|
27
|
+
updated: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Ensures a remote git source is present in the local library cache.
|
|
31
|
+
* If the target directory already exists the operation is a no-op (returns cloned: false).
|
|
32
|
+
* Otherwise the repo is shallow-cloned into libraryDir/host/owner/repo using
|
|
33
|
+
* HTTPS (default) or SSH when protocol is "ssh".
|
|
34
|
+
*/
|
|
35
|
+
export declare function fetchRemoteSource(options: FetchRemoteSourceOptions): FetchRemoteSourceResult;
|
|
36
|
+
/** Reads the currently cached commit, ref, and remote URL for one source. */
|
|
37
|
+
export declare function readCachedSourceRevision(options: FetchRemoteSourceOptions): CachedSourceRevision;
|
|
38
|
+
/** Resolves the remote state for one source and optional ref selector without mutating the cache. */
|
|
39
|
+
export declare function inspectRemoteSource(options: FetchRemoteSourceOptions & {
|
|
40
|
+
ref?: string;
|
|
41
|
+
}): RemoteSourceStatus;
|
|
42
|
+
/** Updates a cached remote source to the latest commit for its selected ref. */
|
|
43
|
+
export declare function updateCachedRemoteSource(options: FetchRemoteSourceOptions & {
|
|
44
|
+
ref?: string;
|
|
45
|
+
}): UpdateCachedRemoteSourceResult;
|
|
46
|
+
/** Moves a cached source checkout back to a previously recorded revision. */
|
|
47
|
+
export declare function restoreCachedRemoteSourceRevision(options: FetchRemoteSourceOptions & {
|
|
48
|
+
ref?: string;
|
|
49
|
+
commit: string;
|
|
50
|
+
refName?: string;
|
|
51
|
+
}): void;
|
|
52
|
+
/** Deletes one cached source checkout without reporting whether it existed. */
|
|
53
|
+
export declare function removeCachedRemoteSource(options: FetchRemoteSourceOptions): void;
|
|
54
|
+
/**
|
|
55
|
+
* Clears the cached clone for a source and re-clones it fresh at HEAD.
|
|
56
|
+
*
|
|
57
|
+
* Clones into a sibling `.tmp` directory first so the existing cache survives
|
|
58
|
+
* any network or authentication failure — the working copy is only replaced
|
|
59
|
+
* after the clone succeeds.
|
|
60
|
+
*
|
|
61
|
+
* Respects protocol switching: if the stored origin URL uses a different
|
|
62
|
+
* transport than `options.protocol` (e.g. the cache was SSH but the caller
|
|
63
|
+
* requests HTTPS), a fresh URL is constructed from the source identifier so the
|
|
64
|
+
* new protocol takes effect. Local-path remotes used in tests are left as-is
|
|
65
|
+
* because they don't start with `git@` and therefore match `"https"` by default.
|
|
66
|
+
*/
|
|
67
|
+
export declare function clearAndRefetchCachedRemoteSource(options: FetchRemoteSourceOptions): void;
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.fetchRemoteSource = fetchRemoteSource;
|
|
7
|
+
exports.readCachedSourceRevision = readCachedSourceRevision;
|
|
8
|
+
exports.inspectRemoteSource = inspectRemoteSource;
|
|
9
|
+
exports.updateCachedRemoteSource = updateCachedRemoteSource;
|
|
10
|
+
exports.restoreCachedRemoteSourceRevision = restoreCachedRemoteSourceRevision;
|
|
11
|
+
exports.removeCachedRemoteSource = removeCachedRemoteSource;
|
|
12
|
+
exports.clearAndRefetchCachedRemoteSource = clearAndRefetchCachedRemoteSource;
|
|
13
|
+
const node_child_process_1 = require("node:child_process");
|
|
14
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const fs_utils_1 = require("./fs-utils");
|
|
17
|
+
const SAFE_SOURCE_RE = /^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/;
|
|
18
|
+
const SSH_AUTH_FAILURE_RE = /permission denied|could not read from remote repository|host key verification failed/i;
|
|
19
|
+
/**
|
|
20
|
+
* Ensures a remote git source is present in the local library cache.
|
|
21
|
+
* If the target directory already exists the operation is a no-op (returns cloned: false).
|
|
22
|
+
* Otherwise the repo is shallow-cloned into libraryDir/host/owner/repo using
|
|
23
|
+
* HTTPS (default) or SSH when protocol is "ssh".
|
|
24
|
+
*/
|
|
25
|
+
function fetchRemoteSource(options) {
|
|
26
|
+
const targetDir = getTargetDir(options);
|
|
27
|
+
if (node_fs_1.default.existsSync(targetDir)) {
|
|
28
|
+
return { cloned: false, targetDir };
|
|
29
|
+
}
|
|
30
|
+
const cloneUrl = getCloneUrl(options.source, options.protocol);
|
|
31
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(targetDir), { recursive: true });
|
|
32
|
+
try {
|
|
33
|
+
runGit(["clone", "--depth=1", cloneUrl, targetDir]);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
node_fs_1.default.rmSync(targetDir, { recursive: true, force: true });
|
|
37
|
+
throw normalizeGitError(error, `Failed to clone ${cloneUrl}`, {
|
|
38
|
+
source: options.source,
|
|
39
|
+
protocol: options.protocol,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return { cloned: true, targetDir };
|
|
43
|
+
}
|
|
44
|
+
/** Reads the currently cached commit, ref, and remote URL for one source. */
|
|
45
|
+
function readCachedSourceRevision(options) {
|
|
46
|
+
const targetDir = getTargetDir(options);
|
|
47
|
+
if (!node_fs_1.default.existsSync(targetDir)) {
|
|
48
|
+
return { cached: false, targetDir };
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
cached: true,
|
|
52
|
+
targetDir,
|
|
53
|
+
currentCommit: tryRunGit(["-C", targetDir, "rev-parse", "HEAD"]),
|
|
54
|
+
currentRef: normalizeCurrentRef(tryRunGit([
|
|
55
|
+
"-C",
|
|
56
|
+
targetDir,
|
|
57
|
+
"symbolic-ref",
|
|
58
|
+
"--quiet",
|
|
59
|
+
"--short",
|
|
60
|
+
"HEAD",
|
|
61
|
+
])),
|
|
62
|
+
remoteUrl: tryRunGit(["-C", targetDir, "remote", "get-url", "origin"]),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Resolves the remote state for one source and optional ref selector without mutating the cache. */
|
|
66
|
+
function inspectRemoteSource(options) {
|
|
67
|
+
const cached = readCachedSourceRevision(options);
|
|
68
|
+
const remoteUrl = cached.remoteUrl ?? getCloneUrl(options.source, options.protocol);
|
|
69
|
+
let resolvedRemote;
|
|
70
|
+
try {
|
|
71
|
+
resolvedRemote = resolveRemoteRef(remoteUrl, options.ref);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
throw normalizeGitError(error, `Failed to inspect ${options.source}`, {
|
|
75
|
+
source: options.source,
|
|
76
|
+
protocol: options.protocol,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
...cached,
|
|
81
|
+
remoteCommit: resolvedRemote.commit,
|
|
82
|
+
refKind: resolvedRemote.kind,
|
|
83
|
+
...(resolvedRemote.resolvedRef !== undefined
|
|
84
|
+
? { resolvedRef: resolvedRemote.resolvedRef }
|
|
85
|
+
: {}),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Updates a cached remote source to the latest commit for its selected ref. */
|
|
89
|
+
function updateCachedRemoteSource(options) {
|
|
90
|
+
const initialRevision = readCachedSourceRevision(options);
|
|
91
|
+
if (!initialRevision.cached) {
|
|
92
|
+
fetchRemoteSource(options);
|
|
93
|
+
}
|
|
94
|
+
const targetDir = getTargetDir(options);
|
|
95
|
+
let status;
|
|
96
|
+
try {
|
|
97
|
+
status = inspectRemoteSource(options);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
throw rewriteInspectFailureForUpdate(error, options.source);
|
|
101
|
+
}
|
|
102
|
+
const requiresCheckoutRealignment = status.refKind === "branch"
|
|
103
|
+
? status.currentRef !== status.resolvedRef
|
|
104
|
+
: status.currentRef !== undefined;
|
|
105
|
+
if (status.currentCommit === status.remoteCommit &&
|
|
106
|
+
!requiresCheckoutRealignment) {
|
|
107
|
+
return {
|
|
108
|
+
...status,
|
|
109
|
+
previousCommit: status.currentCommit,
|
|
110
|
+
updated: false,
|
|
111
|
+
currentCommit: status.remoteCommit,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
if (status.refKind === "branch") {
|
|
116
|
+
runGit([
|
|
117
|
+
"-C",
|
|
118
|
+
targetDir,
|
|
119
|
+
"fetch",
|
|
120
|
+
"--depth=1",
|
|
121
|
+
"origin",
|
|
122
|
+
`refs/heads/${status.resolvedRef}`,
|
|
123
|
+
]);
|
|
124
|
+
runGit([
|
|
125
|
+
"-C",
|
|
126
|
+
targetDir,
|
|
127
|
+
"checkout",
|
|
128
|
+
"-B",
|
|
129
|
+
status.resolvedRef,
|
|
130
|
+
"FETCH_HEAD",
|
|
131
|
+
]);
|
|
132
|
+
}
|
|
133
|
+
else if (status.refKind === "tag") {
|
|
134
|
+
runGit([
|
|
135
|
+
"-C",
|
|
136
|
+
targetDir,
|
|
137
|
+
"fetch",
|
|
138
|
+
"--depth=1",
|
|
139
|
+
"origin",
|
|
140
|
+
`refs/tags/${status.resolvedRef}`,
|
|
141
|
+
]);
|
|
142
|
+
runGit(["-C", targetDir, "checkout", "--detach", "FETCH_HEAD"]);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
runGit([
|
|
146
|
+
"-C",
|
|
147
|
+
targetDir,
|
|
148
|
+
"fetch",
|
|
149
|
+
"--depth=1",
|
|
150
|
+
"origin",
|
|
151
|
+
status.remoteCommit,
|
|
152
|
+
]);
|
|
153
|
+
runGit(["-C", targetDir, "checkout", "--detach", "FETCH_HEAD"]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
throw normalizeGitError(error, `Failed to update ${options.source}`, {
|
|
158
|
+
source: options.source,
|
|
159
|
+
protocol: options.protocol,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const refreshed = readCachedSourceRevision(options);
|
|
163
|
+
return {
|
|
164
|
+
...status,
|
|
165
|
+
currentCommit: refreshed.currentCommit ?? status.remoteCommit,
|
|
166
|
+
currentRef: refreshed.currentRef,
|
|
167
|
+
remoteUrl: refreshed.remoteUrl ?? status.remoteUrl,
|
|
168
|
+
previousCommit: initialRevision.currentCommit,
|
|
169
|
+
updated: status.currentCommit !== status.remoteCommit ||
|
|
170
|
+
requiresCheckoutRealignment,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function rewriteInspectFailureForUpdate(error, source) {
|
|
174
|
+
if (error instanceof Error &&
|
|
175
|
+
error.message.startsWith(`Failed to inspect ${source}`)) {
|
|
176
|
+
return new Error(error.message.replace(`Failed to inspect ${source}`, `Failed to update ${source}`));
|
|
177
|
+
}
|
|
178
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
179
|
+
}
|
|
180
|
+
/** Moves a cached source checkout back to a previously recorded revision. */
|
|
181
|
+
function restoreCachedRemoteSourceRevision(options) {
|
|
182
|
+
const targetDir = getTargetDir(options);
|
|
183
|
+
if (options.refName) {
|
|
184
|
+
runGit([
|
|
185
|
+
"-C",
|
|
186
|
+
targetDir,
|
|
187
|
+
"checkout",
|
|
188
|
+
"-B",
|
|
189
|
+
options.refName,
|
|
190
|
+
options.commit,
|
|
191
|
+
]);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
runGit(["-C", targetDir, "checkout", "--detach", options.commit]);
|
|
195
|
+
}
|
|
196
|
+
/** Deletes one cached source checkout without reporting whether it existed. */
|
|
197
|
+
function removeCachedRemoteSource(options) {
|
|
198
|
+
node_fs_1.default.rmSync(getTargetDir(options), { recursive: true, force: true });
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Clears the cached clone for a source and re-clones it fresh at HEAD.
|
|
202
|
+
*
|
|
203
|
+
* Clones into a sibling `.tmp` directory first so the existing cache survives
|
|
204
|
+
* any network or authentication failure — the working copy is only replaced
|
|
205
|
+
* after the clone succeeds.
|
|
206
|
+
*
|
|
207
|
+
* Respects protocol switching: if the stored origin URL uses a different
|
|
208
|
+
* transport than `options.protocol` (e.g. the cache was SSH but the caller
|
|
209
|
+
* requests HTTPS), a fresh URL is constructed from the source identifier so the
|
|
210
|
+
* new protocol takes effect. Local-path remotes used in tests are left as-is
|
|
211
|
+
* because they don't start with `git@` and therefore match `"https"` by default.
|
|
212
|
+
*/
|
|
213
|
+
function clearAndRefetchCachedRemoteSource(options) {
|
|
214
|
+
const targetDir = getTargetDir(options);
|
|
215
|
+
const revision = readCachedSourceRevision(options);
|
|
216
|
+
const isStoredSsh = revision.remoteUrl?.startsWith("git@") ?? false;
|
|
217
|
+
const cloneUrl = revision.remoteUrl && isStoredSsh === (options.protocol === "ssh")
|
|
218
|
+
? revision.remoteUrl
|
|
219
|
+
: getCloneUrl(options.source, options.protocol);
|
|
220
|
+
const tempDir = `${targetDir}.tmp`;
|
|
221
|
+
node_fs_1.default.rmSync(tempDir, { recursive: true, force: true });
|
|
222
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(targetDir), { recursive: true });
|
|
223
|
+
try {
|
|
224
|
+
runGit(["clone", "--depth=1", cloneUrl, tempDir]);
|
|
225
|
+
node_fs_1.default.rmSync(targetDir, { recursive: true, force: true });
|
|
226
|
+
node_fs_1.default.renameSync(tempDir, targetDir);
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
node_fs_1.default.rmSync(tempDir, { recursive: true, force: true });
|
|
230
|
+
throw normalizeGitError(error, `Failed to clone ${cloneUrl}`, {
|
|
231
|
+
source: options.source,
|
|
232
|
+
protocol: options.protocol,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function getTargetDir(options) {
|
|
237
|
+
assertSafeSource(options.source);
|
|
238
|
+
return node_path_1.default.join(options.libraryDir, ...options.source.split("/"));
|
|
239
|
+
}
|
|
240
|
+
function getCloneUrl(source, protocol = "https") {
|
|
241
|
+
assertSafeSource(source);
|
|
242
|
+
const [host, owner, repo] = source.split("/");
|
|
243
|
+
return protocol === "ssh"
|
|
244
|
+
? `git@${host}:${owner}/${repo}.git`
|
|
245
|
+
: `https://${source}`;
|
|
246
|
+
}
|
|
247
|
+
function resolveRemoteRef(remoteUrl, requestedRef) {
|
|
248
|
+
if (requestedRef && isCommitSha(requestedRef)) {
|
|
249
|
+
return { kind: "commit", commit: requestedRef };
|
|
250
|
+
}
|
|
251
|
+
if (requestedRef) {
|
|
252
|
+
const branchCommit = parseFirstSha(runGit(["ls-remote", remoteUrl, `refs/heads/${requestedRef}`]));
|
|
253
|
+
if (branchCommit) {
|
|
254
|
+
return {
|
|
255
|
+
kind: "branch",
|
|
256
|
+
resolvedRef: requestedRef,
|
|
257
|
+
commit: branchCommit,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const tagOutput = runGit([
|
|
261
|
+
"ls-remote",
|
|
262
|
+
remoteUrl,
|
|
263
|
+
`refs/tags/${requestedRef}`,
|
|
264
|
+
`refs/tags/${requestedRef}^{}`,
|
|
265
|
+
]);
|
|
266
|
+
const tagCommit = parsePreferredTagSha(tagOutput, requestedRef);
|
|
267
|
+
if (tagCommit) {
|
|
268
|
+
return { kind: "tag", resolvedRef: requestedRef, commit: tagCommit };
|
|
269
|
+
}
|
|
270
|
+
throw new Error(`Remote ref not found: ${requestedRef}`);
|
|
271
|
+
}
|
|
272
|
+
const headOutput = runGit(["ls-remote", "--symref", remoteUrl, "HEAD"]);
|
|
273
|
+
const headRef = parseHeadRef(headOutput);
|
|
274
|
+
const headCommit = parseHeadCommit(headOutput);
|
|
275
|
+
if (!headRef || !headCommit) {
|
|
276
|
+
throw new Error(`Failed to resolve remote HEAD for ${remoteUrl}`);
|
|
277
|
+
}
|
|
278
|
+
return { kind: "branch", resolvedRef: headRef, commit: headCommit };
|
|
279
|
+
}
|
|
280
|
+
function parseHeadRef(output) {
|
|
281
|
+
for (const line of output.split("\n")) {
|
|
282
|
+
const match = line.match(/^ref:\s+refs\/heads\/(.+)\s+HEAD$/);
|
|
283
|
+
if (match) {
|
|
284
|
+
return match[1];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return undefined;
|
|
288
|
+
}
|
|
289
|
+
function parseHeadCommit(output) {
|
|
290
|
+
for (const line of output.split("\n")) {
|
|
291
|
+
const match = line.match(/^([0-9a-f]{7,40})\s+HEAD$/i);
|
|
292
|
+
if (match) {
|
|
293
|
+
return match[1];
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
function parsePreferredTagSha(output, tagName) {
|
|
299
|
+
const peeledPattern = new RegExp(`^([0-9a-f]{7,40})\\s+refs/tags/${(0, fs_utils_1.escapeRegExp)(tagName)}\\^{}$`, "i");
|
|
300
|
+
const directPattern = new RegExp(`^([0-9a-f]{7,40})\\s+refs/tags/${(0, fs_utils_1.escapeRegExp)(tagName)}$`, "i");
|
|
301
|
+
let directCommit;
|
|
302
|
+
for (const line of output.split("\n")) {
|
|
303
|
+
const peeledMatch = line.match(peeledPattern);
|
|
304
|
+
if (peeledMatch) {
|
|
305
|
+
return peeledMatch[1];
|
|
306
|
+
}
|
|
307
|
+
const directMatch = line.match(directPattern);
|
|
308
|
+
if (directMatch) {
|
|
309
|
+
directCommit = directMatch[1];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return directCommit;
|
|
313
|
+
}
|
|
314
|
+
function parseFirstSha(output) {
|
|
315
|
+
for (const line of output.split("\n")) {
|
|
316
|
+
const match = line.match(/^([0-9a-f]{7,40})\s+/i);
|
|
317
|
+
if (match) {
|
|
318
|
+
return match[1];
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return undefined;
|
|
322
|
+
}
|
|
323
|
+
function normalizeCurrentRef(value) {
|
|
324
|
+
if (!value) {
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
return value.replace(/^heads\//, "");
|
|
328
|
+
}
|
|
329
|
+
function runGit(args) {
|
|
330
|
+
try {
|
|
331
|
+
return String((0, node_child_process_1.execFileSync)("git", args, {
|
|
332
|
+
encoding: "utf8",
|
|
333
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
334
|
+
})).trim();
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
if (error instanceof Error &&
|
|
338
|
+
"code" in error &&
|
|
339
|
+
error.code === "ENOENT") {
|
|
340
|
+
throw new Error("git is not installed or not on PATH. Install git to fetch remote bundles.");
|
|
341
|
+
}
|
|
342
|
+
throw error;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function tryRunGit(args) {
|
|
346
|
+
try {
|
|
347
|
+
const result = runGit(args);
|
|
348
|
+
return result === "" ? undefined : result;
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
return undefined;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function normalizeGitError(error, prefix, context) {
|
|
355
|
+
if (error instanceof Error &&
|
|
356
|
+
"code" in error &&
|
|
357
|
+
error.code === "ENOENT") {
|
|
358
|
+
return new Error("git is not installed or not on PATH. Install git to fetch remote bundles.");
|
|
359
|
+
}
|
|
360
|
+
const stderr = error instanceof Error && "stderr" in error
|
|
361
|
+
? String(error.stderr).trim()
|
|
362
|
+
: String(error);
|
|
363
|
+
let message = `${prefix}${stderr ? `:\n${stderr}` : ""}`;
|
|
364
|
+
if ((context.protocol ?? "https") === "ssh" &&
|
|
365
|
+
SSH_AUTH_FAILURE_RE.test(stderr)) {
|
|
366
|
+
message += `\nHint: SSH authentication failed. To clone via HTTPS instead, omit --ssh:\n skul add ${context.source}`;
|
|
367
|
+
}
|
|
368
|
+
return new Error(message);
|
|
369
|
+
}
|
|
370
|
+
function assertSafeSource(source) {
|
|
371
|
+
if (!SAFE_SOURCE_RE.test(source)) {
|
|
372
|
+
throw new Error(`Invalid bundle source: ${source}`);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function isCommitSha(value) {
|
|
376
|
+
return /^[0-9a-f]{7,40}$/i.test(value);
|
|
377
|
+
}
|
|
378
|
+
//# sourceMappingURL=bundle-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-fetch.js","sourceRoot":"","sources":["../src/bundle-fetch.ts"],"names":[],"mappings":";;;;;AAiDA,8CAwBC;AAGD,4DAyBC;AAGD,kDA6BC;AAGD,4DA4FC;AAmBD,8EAsBC;AAGD,4DAIC;AAeD,8EA0BC;AA7TD,2D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E,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,KAAK,KAAK;QACvC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAChC,CAAC;QACD,OAAO,IAAI,0FAA0F,OAAO,CAAC,MAAM,EAAE,CAAC;IACxH,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc;IACtC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BundleManifest } from "./bundle-manifest";
|
|
2
|
+
import { type ToolName, type ToolTargetName } from "./tool-mapping";
|
|
3
|
+
export type BundleItemSelector = string;
|
|
4
|
+
/** Normalizes one user-facing bundle item selector. */
|
|
5
|
+
export declare function normalizeBundleItemSelector(selector: string): BundleItemSelector;
|
|
6
|
+
/** Normalizes and deduplicates bundle item selectors while preserving order. */
|
|
7
|
+
export declare function normalizeBundleItemSelectors(selectors: string[]): BundleItemSelector[];
|
|
8
|
+
/** Returns true when a root-instruction target should be materialized. */
|
|
9
|
+
export declare function isRootInstructionItemSelected(selectors: BundleItemSelector[] | undefined): boolean;
|
|
10
|
+
/** Returns true when a directory target item should be materialized. */
|
|
11
|
+
export declare function isDirectoryItemSelected(options: {
|
|
12
|
+
selectors: BundleItemSelector[] | undefined;
|
|
13
|
+
targetName: ToolTargetName;
|
|
14
|
+
entryName: string;
|
|
15
|
+
}): boolean;
|
|
16
|
+
/** Lists installable item selectors available from a cached bundle. */
|
|
17
|
+
export declare function listSelectableBundleItems(options: {
|
|
18
|
+
bundleDir: string;
|
|
19
|
+
manifest: BundleManifest;
|
|
20
|
+
tools?: ToolName[];
|
|
21
|
+
}): BundleItemSelector[];
|
|
22
|
+
/** Throws when requested item selectors are not present in the selected bundle scope. */
|
|
23
|
+
export declare function assertBundleSupportsRequestedItems(options: {
|
|
24
|
+
requestedItems: BundleItemSelector[];
|
|
25
|
+
availableItems: BundleItemSelector[];
|
|
26
|
+
}): void;
|
|
27
|
+
/** Merges item selections, returning undefined when the whole bundle is selected. */
|
|
28
|
+
export declare function mergeDesiredBundleItems(options: {
|
|
29
|
+
existingItems?: BundleItemSelector[];
|
|
30
|
+
requestedItems?: BundleItemSelector[];
|
|
31
|
+
replace?: boolean;
|
|
32
|
+
}): BundleItemSelector[] | undefined;
|
|
33
|
+
/** Returns true when two optional selector lists describe the same bundle item set. */
|
|
34
|
+
export declare function bundleItemSelectionsEqual(left?: BundleItemSelector[], right?: BundleItemSelector[]): boolean;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.normalizeBundleItemSelector = normalizeBundleItemSelector;
|
|
7
|
+
exports.normalizeBundleItemSelectors = normalizeBundleItemSelectors;
|
|
8
|
+
exports.isRootInstructionItemSelected = isRootInstructionItemSelected;
|
|
9
|
+
exports.isDirectoryItemSelected = isDirectoryItemSelected;
|
|
10
|
+
exports.listSelectableBundleItems = listSelectableBundleItems;
|
|
11
|
+
exports.assertBundleSupportsRequestedItems = assertBundleSupportsRequestedItems;
|
|
12
|
+
exports.mergeDesiredBundleItems = mergeDesiredBundleItems;
|
|
13
|
+
exports.bundleItemSelectionsEqual = bundleItemSelectionsEqual;
|
|
14
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
15
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
16
|
+
const tool_mapping_1 = require("./tool-mapping");
|
|
17
|
+
const ROOT_INSTRUCTION_SELECTOR = "root-instruction";
|
|
18
|
+
const DIRECTORY_TARGET_NAMES = new Set([
|
|
19
|
+
"skills",
|
|
20
|
+
"commands",
|
|
21
|
+
"agents",
|
|
22
|
+
]);
|
|
23
|
+
/** Normalizes one user-facing bundle item selector. */
|
|
24
|
+
function normalizeBundleItemSelector(selector) {
|
|
25
|
+
const value = selector.trim().replaceAll("\\", "/");
|
|
26
|
+
if (value === ROOT_INSTRUCTION_SELECTOR ||
|
|
27
|
+
value === "AGENTS.md" ||
|
|
28
|
+
value === "CLAUDE.md" ||
|
|
29
|
+
value === "GEMINI.md" ||
|
|
30
|
+
value === ".github/copilot-instructions.md") {
|
|
31
|
+
return ROOT_INSTRUCTION_SELECTOR;
|
|
32
|
+
}
|
|
33
|
+
const [targetName, itemName, ...rest] = value.split("/");
|
|
34
|
+
if (rest.length > 0) {
|
|
35
|
+
throw new Error(`Bundle item selector must target one top-level item: ${selector}`);
|
|
36
|
+
}
|
|
37
|
+
if (!isDirectoryTargetName(targetName)) {
|
|
38
|
+
throw new Error(`Bundle item selector must start with skills/, commands/, agents/, or be root-instruction: ${selector}`);
|
|
39
|
+
}
|
|
40
|
+
return `${targetName}/${normalizeBundleItemName(itemName, selector)}`;
|
|
41
|
+
}
|
|
42
|
+
function isDirectoryTargetName(value) {
|
|
43
|
+
return (value !== undefined && DIRECTORY_TARGET_NAMES.has(value));
|
|
44
|
+
}
|
|
45
|
+
function normalizeBundleItemName(value, originalSelector) {
|
|
46
|
+
if (!value || value === "." || value === "..") {
|
|
47
|
+
throw new Error(`Bundle item selector is missing an item name: ${originalSelector}`);
|
|
48
|
+
}
|
|
49
|
+
return stripKnownItemExtension(value);
|
|
50
|
+
}
|
|
51
|
+
function stripKnownItemExtension(value) {
|
|
52
|
+
if (value.endsWith(".agent.md")) {
|
|
53
|
+
return value.slice(0, -".agent.md".length);
|
|
54
|
+
}
|
|
55
|
+
return value.replace(/\.(md|toml|yaml|yml|json)$/i, "");
|
|
56
|
+
}
|
|
57
|
+
/** Normalizes and deduplicates bundle item selectors while preserving order. */
|
|
58
|
+
function normalizeBundleItemSelectors(selectors) {
|
|
59
|
+
const normalized = selectors.map(normalizeBundleItemSelector);
|
|
60
|
+
return Array.from(new Set(normalized));
|
|
61
|
+
}
|
|
62
|
+
/** Returns true when a root-instruction target should be materialized. */
|
|
63
|
+
function isRootInstructionItemSelected(selectors) {
|
|
64
|
+
return !selectors || selectors.includes(ROOT_INSTRUCTION_SELECTOR);
|
|
65
|
+
}
|
|
66
|
+
/** Returns true when a directory target item should be materialized. */
|
|
67
|
+
function isDirectoryItemSelected(options) {
|
|
68
|
+
if (!options.selectors) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
return options.selectors.includes(`${options.targetName}/${stripKnownItemExtension(options.entryName)}`);
|
|
72
|
+
}
|
|
73
|
+
/** Lists installable item selectors available from a cached bundle. */
|
|
74
|
+
function listSelectableBundleItems(options) {
|
|
75
|
+
const selectors = new Set();
|
|
76
|
+
const toolEntries = selectManifestToolEntries(options.manifest, options.tools);
|
|
77
|
+
for (const [toolName, targets] of toolEntries) {
|
|
78
|
+
for (const [targetName, target] of Object.entries(targets)) {
|
|
79
|
+
if (targetName === "root_instruction") {
|
|
80
|
+
selectors.add(ROOT_INSTRUCTION_SELECTOR);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (!isDirectoryTargetName(targetName)) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const targetDefinition = (0, tool_mapping_1.getToolDefinition)(toolName)?.targets[targetName];
|
|
87
|
+
if (targetDefinition?.kind !== "directory") {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
for (const itemName of listTargetItemNames({
|
|
91
|
+
sourceDir: node_path_1.default.join(options.bundleDir, target.path),
|
|
92
|
+
targetName,
|
|
93
|
+
})) {
|
|
94
|
+
selectors.add(`${targetName}/${itemName}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return Array.from(selectors).sort((left, right) => left.localeCompare(right));
|
|
99
|
+
}
|
|
100
|
+
function selectManifestToolEntries(manifest, tools) {
|
|
101
|
+
return (tools && tools.length > 0
|
|
102
|
+
? Object.entries(manifest.tools).filter(([toolName]) => tools.includes(toolName))
|
|
103
|
+
: Object.entries(manifest.tools));
|
|
104
|
+
}
|
|
105
|
+
function listTargetItemNames(options) {
|
|
106
|
+
if (!node_fs_1.default.existsSync(options.sourceDir)) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
return node_fs_1.default
|
|
110
|
+
.readdirSync(options.sourceDir, { withFileTypes: true })
|
|
111
|
+
.filter((entry) => isSelectableTargetEntry(entry, options.targetName))
|
|
112
|
+
.map((entry) => stripKnownItemExtension(entry.name));
|
|
113
|
+
}
|
|
114
|
+
function isSelectableTargetEntry(entry, targetName) {
|
|
115
|
+
if (targetName === "skills") {
|
|
116
|
+
return entry.isDirectory();
|
|
117
|
+
}
|
|
118
|
+
return entry.isFile();
|
|
119
|
+
}
|
|
120
|
+
/** Throws when requested item selectors are not present in the selected bundle scope. */
|
|
121
|
+
function assertBundleSupportsRequestedItems(options) {
|
|
122
|
+
const unsupportedItems = options.requestedItems.filter((item) => !options.availableItems.includes(item));
|
|
123
|
+
if (unsupportedItems.length === 0) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
throw new Error(`Bundle does not include item(s): ${unsupportedItems.join(", ")}\nAvailable items: ${options.availableItems.join(", ")}`);
|
|
127
|
+
}
|
|
128
|
+
/** Merges item selections, returning undefined when the whole bundle is selected. */
|
|
129
|
+
function mergeDesiredBundleItems(options) {
|
|
130
|
+
if (options.requestedItems === undefined) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
if (options.replace) {
|
|
134
|
+
return [...options.requestedItems];
|
|
135
|
+
}
|
|
136
|
+
return Array.from(new Set([...(options.existingItems ?? []), ...options.requestedItems]));
|
|
137
|
+
}
|
|
138
|
+
/** Returns true when two optional selector lists describe the same bundle item set. */
|
|
139
|
+
function bundleItemSelectionsEqual(left, right) {
|
|
140
|
+
if (!left && !right) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
if (!left || !right || left.length !== right.length) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
const rightSet = new Set(right);
|
|
147
|
+
return left.every((item) => rightSet.has(item));
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=bundle-items.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-items.js","sourceRoot":"","sources":["../src/bundle-items.ts"],"names":[],"mappings":";;;;;AAoBA,kEA8BC;AAgCD,oEAKC;AAGD,sEAIC;AAGD,0DAYC;AAGD,8DAsCC;AAyCD,gFAeC;AAGD,0DAgBC;AAGD,8DAcC;AAlPD,sDAAyB;AACzB,0DAA6B;AAG7B,iDAIwB;AAIxB,MAAM,yBAAyB,GAAG,kBAAkB,CAAC;AACrD,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAiB;IACrD,QAAQ;IACR,UAAU;IACV,QAAQ;CACT,CAAC,CAAC;AAEH,uDAAuD;AACvD,SAAgB,2BAA2B,CACzC,QAAgB;IAEhB,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAEpD,IACE,KAAK,KAAK,yBAAyB;QACnC,KAAK,KAAK,WAAW;QACrB,KAAK,KAAK,WAAW;QACrB,KAAK,KAAK,WAAW;QACrB,KAAK,KAAK,iCAAiC,EAC3C,CAAC;QACD,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEzD,IAAI,IAAI,CAAC,MAAM,GAAG,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