@rbbtsn0w/adg 0.8.0-beta.3 → 0.8.0-beta.5
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/dist/src/commands/multiselect-skills.js +3 -2
- package/dist/vendor/skills/src/add.js +92 -15
- package/dist/vendor/skills/src/agents.js +60 -0
- package/dist/vendor/skills/src/archive.js +311 -0
- package/dist/vendor/skills/src/blob.js +58 -22
- package/dist/vendor/skills/src/cli.js +21 -1
- package/dist/vendor/skills/src/constants.js +2 -0
- package/dist/vendor/skills/src/detect-agent.js +24 -1
- package/dist/vendor/skills/src/download-source.js +221 -0
- package/dist/vendor/skills/src/find.js +6 -5
- package/dist/vendor/skills/src/git.js +39 -13
- package/dist/vendor/skills/src/github-host.js +34 -0
- package/dist/vendor/skills/src/install.js +6 -1
- package/dist/vendor/skills/src/installer.js +8 -4
- package/dist/vendor/skills/src/list.js +28 -12
- package/dist/vendor/skills/src/local-lock.js +29 -4
- package/dist/vendor/skills/src/prompts/search-multiselect.js +274 -62
- package/dist/vendor/skills/src/providers/index.js +1 -1
- package/dist/vendor/skills/src/providers/wellknown.js +88 -90
- package/dist/vendor/skills/src/remove.js +98 -11
- package/dist/vendor/skills/src/skills.js +23 -19
- package/dist/vendor/skills/src/source-parser.js +73 -10
- package/dist/vendor/skills/src/sync.js +3 -3
- package/dist/vendor/skills/src/test-utils.js +74 -5
- package/dist/vendor/skills/src/update-source.js +56 -8
- package/dist/vendor/skills/src/update.js +355 -155
- package/dist/vendor/skills/src/use.js +41 -4
- package/package.json +14 -4
- package/vendor/skills/PROVENANCE.md +18 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isAbsolute, resolve } from 'path';
|
|
2
|
+
import { getGitHubHost, isGitHubHost } from "./github-host.js";
|
|
2
3
|
/**
|
|
3
4
|
* Extract owner/repo (or group/subgroup/repo for GitLab) from a parsed source
|
|
4
5
|
* for lockfile tracking and telemetry.
|
|
@@ -6,7 +7,7 @@ import { isAbsolute, resolve } from 'path';
|
|
|
6
7
|
* Supports any Git host with an owner/repo URL structure, including GitLab subgroups.
|
|
7
8
|
*/
|
|
8
9
|
export function getOwnerRepo(parsed) {
|
|
9
|
-
if (parsed.type === 'local') {
|
|
10
|
+
if (parsed.type === 'local' || parsed.type === 'download') {
|
|
10
11
|
return null;
|
|
11
12
|
}
|
|
12
13
|
// Handle Git SSH URLs (e.g., git@gitlab.com:owner/repo.git, git@github.com:owner/repo.git)
|
|
@@ -128,11 +129,13 @@ function isLocalPath(input) {
|
|
|
128
129
|
}
|
|
129
130
|
/**
|
|
130
131
|
* Parse a source string into a structured format
|
|
131
|
-
* Supports: local paths, GitHub URLs, GitLab URLs, GitHub shorthand, well-known URLs,
|
|
132
|
+
* Supports: local paths, GitHub URLs, GitLab URLs, GitHub shorthand, well-known URLs,
|
|
133
|
+
* hosted download URLs, and direct git URLs
|
|
132
134
|
*/
|
|
133
135
|
// Source aliases: map common shorthand to canonical source
|
|
134
136
|
const SOURCE_ALIASES = {
|
|
135
137
|
'coinbase/agentWallet': 'coinbase/agentic-wallet-skills',
|
|
138
|
+
'vercel-labs/vercel-skills': 'vercel-labs/agent-skills',
|
|
136
139
|
};
|
|
137
140
|
function decodeFragmentValue(value) {
|
|
138
141
|
try {
|
|
@@ -154,7 +157,7 @@ function looksLikeGitSource(input) {
|
|
|
154
157
|
const parsed = new URL(input);
|
|
155
158
|
const pathname = parsed.pathname;
|
|
156
159
|
// Only treat GitHub fragments as refs for repo/tree URLs.
|
|
157
|
-
if (parsed.
|
|
160
|
+
if (isGitHubHost(parsed.host)) {
|
|
158
161
|
return /^\/[^/]+\/[^/]+(?:\.git)?(?:\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(pathname);
|
|
159
162
|
}
|
|
160
163
|
// Only treat gitlab.com fragments as refs for repo/tree URLs.
|
|
@@ -207,6 +210,27 @@ function appendFragmentRef(input, ref, skillFilter) {
|
|
|
207
210
|
}
|
|
208
211
|
return `${input}#${ref}${skillFilter ? `@${skillFilter}` : ''}`;
|
|
209
212
|
}
|
|
213
|
+
function isHostedArtifactUrl(input) {
|
|
214
|
+
try {
|
|
215
|
+
const parsed = new URL(input);
|
|
216
|
+
const host = parsed.hostname.toLowerCase();
|
|
217
|
+
if (host === 'raw.githubusercontent.com' ||
|
|
218
|
+
host === 'codeload.github.com' ||
|
|
219
|
+
host === 'objects.githubusercontent.com') {
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
if (host === 'github.com') {
|
|
223
|
+
return /^\/[^/]+\/[^/]+\/(?:archive\/|raw\/|releases\/(?:download\/|latest\/download\/))/.test(parsed.pathname);
|
|
224
|
+
}
|
|
225
|
+
if (host === 'gitlab.com') {
|
|
226
|
+
return /\/-\/(?:archive|raw)\//.test(parsed.pathname);
|
|
227
|
+
}
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
210
234
|
export function parseSource(input) {
|
|
211
235
|
// Local path: absolute, relative, or current directory
|
|
212
236
|
if (isLocalPath(input)) {
|
|
@@ -236,6 +260,40 @@ export function parseSource(input) {
|
|
|
236
260
|
if (gitlabPrefixMatch) {
|
|
237
261
|
return parseSource(appendFragmentRef(`https://gitlab.com/${gitlabPrefixMatch[1]}`, fragmentRef, fragmentSkillFilter));
|
|
238
262
|
}
|
|
263
|
+
// Hosted raw files and archive/release assets must be downloaded directly,
|
|
264
|
+
// not normalized to their parent repository and cloned.
|
|
265
|
+
if (isHostedArtifactUrl(input)) {
|
|
266
|
+
return {
|
|
267
|
+
type: 'download',
|
|
268
|
+
url: input,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
// Explicit GitHub Enterprise URL. Use generic git handling for cloning and
|
|
272
|
+
// updates because the GitHub.com API/blob fast paths target the public host.
|
|
273
|
+
if (getGitHubHost() !== 'github.com' && /^https?:\/\//.test(input)) {
|
|
274
|
+
try {
|
|
275
|
+
const parsedUrl = new URL(input);
|
|
276
|
+
if (isGitHubHost(parsedUrl.host) && parsedUrl.host !== 'github.com') {
|
|
277
|
+
const segments = parsedUrl.pathname.split('/').filter(Boolean);
|
|
278
|
+
const [owner, rawRepo, marker, ref, ...subpathSegments] = segments;
|
|
279
|
+
if (owner && rawRepo) {
|
|
280
|
+
const repo = rawRepo.replace(/\.git$/, '');
|
|
281
|
+
const isTreeUrl = marker === 'tree' && ref;
|
|
282
|
+
return {
|
|
283
|
+
type: 'git',
|
|
284
|
+
url: `${parsedUrl.protocol}//${parsedUrl.host}/${owner}/${repo}.git`,
|
|
285
|
+
...(isTreeUrl ? { ref } : fragmentRef ? { ref: fragmentRef } : {}),
|
|
286
|
+
...(isTreeUrl && subpathSegments.length > 0
|
|
287
|
+
? { subpath: sanitizeSubpath(subpathSegments.join('/')) }
|
|
288
|
+
: {}),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
// Fall through to the remaining source formats.
|
|
295
|
+
}
|
|
296
|
+
}
|
|
239
297
|
// GitHub URL with path: https://github.com/owner/repo/tree/branch/path/to/skill
|
|
240
298
|
const githubTreeWithPathMatch = input.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)/);
|
|
241
299
|
if (githubTreeWithPathMatch) {
|
|
@@ -312,13 +370,18 @@ export function parseSource(input) {
|
|
|
312
370
|
}
|
|
313
371
|
// GitHub shorthand: owner/repo, owner/repo/path/to/skill, or owner/repo@skill-name
|
|
314
372
|
// Exclude paths that start with . or / to avoid matching local paths
|
|
373
|
+
// GH_HOST selects a GitHub Enterprise host for shorthand inputs. Enterprise
|
|
374
|
+
// sources use the generic git path because GitHub.com API optimizations do
|
|
375
|
+
// not apply to them.
|
|
376
|
+
const githubHost = getGitHubHost();
|
|
377
|
+
const shorthandSourceType = githubHost === 'github.com' ? 'github' : 'git';
|
|
315
378
|
// First check for @skill syntax: owner/repo@skill-name
|
|
316
379
|
const atSkillMatch = input.match(/^([^/]+)\/([^/@]+)@(.+)$/);
|
|
317
380
|
if (atSkillMatch && !input.includes(':') && !input.startsWith('.') && !input.startsWith('/')) {
|
|
318
381
|
const [, owner, repo, skillFilter] = atSkillMatch;
|
|
319
382
|
return {
|
|
320
|
-
type:
|
|
321
|
-
url: `https
|
|
383
|
+
type: shorthandSourceType,
|
|
384
|
+
url: `https://${githubHost}/${owner}/${repo}.git`,
|
|
322
385
|
...(fragmentRef ? { ref: fragmentRef } : {}),
|
|
323
386
|
skillFilter: fragmentSkillFilter || skillFilter,
|
|
324
387
|
};
|
|
@@ -327,16 +390,16 @@ export function parseSource(input) {
|
|
|
327
390
|
if (shorthandMatch && !input.includes(':') && !input.startsWith('.') && !input.startsWith('/')) {
|
|
328
391
|
const [, owner, repo, subpath] = shorthandMatch;
|
|
329
392
|
return {
|
|
330
|
-
type:
|
|
331
|
-
url: `https
|
|
393
|
+
type: shorthandSourceType,
|
|
394
|
+
url: `https://${githubHost}/${owner}/${repo}.git`,
|
|
332
395
|
...(fragmentRef ? { ref: fragmentRef } : {}),
|
|
333
396
|
subpath: subpath ? sanitizeSubpath(subpath) : subpath,
|
|
334
397
|
...(fragmentSkillFilter ? { skillFilter: fragmentSkillFilter } : {}),
|
|
335
398
|
};
|
|
336
399
|
}
|
|
337
|
-
// Well-known skills: arbitrary HTTP(S) URLs that aren't GitHub/GitLab
|
|
338
|
-
//
|
|
339
|
-
// then fall back to
|
|
400
|
+
// Well-known skills: arbitrary HTTP(S) URLs that aren't GitHub/GitLab.
|
|
401
|
+
// These are also valid direct download URLs: callers should try well-known
|
|
402
|
+
// discovery first, then fall back to downloading the URL as a SKILL.md or archive.
|
|
340
403
|
if (isWellKnownUrl(input)) {
|
|
341
404
|
return {
|
|
342
405
|
type: 'well-known',
|
|
@@ -140,7 +140,7 @@ export async function runSync(args, options = {}) {
|
|
|
140
140
|
}
|
|
141
141
|
const spinner = p.spinner();
|
|
142
142
|
// 1. Discover skills from node_modules
|
|
143
|
-
spinner.start('Scanning node_modules for skills
|
|
143
|
+
spinner.start('Scanning node_modules for skills…');
|
|
144
144
|
const discoveredSkills = await discoverNodeModuleSkills(cwd);
|
|
145
145
|
if (discoveredSkills.length === 0) {
|
|
146
146
|
spinner.stop(pc.yellow('No skills found'));
|
|
@@ -205,7 +205,7 @@ export async function runSync(args, options = {}) {
|
|
|
205
205
|
targetAgents = options.agent;
|
|
206
206
|
}
|
|
207
207
|
else {
|
|
208
|
-
spinner.start('Loading agents
|
|
208
|
+
spinner.start('Loading agents…');
|
|
209
209
|
const installedAgents = await detectInstalledAgents();
|
|
210
210
|
const totalAgents = Object.keys(agents).length;
|
|
211
211
|
spinner.stop(`${totalAgents} agents`);
|
|
@@ -295,7 +295,7 @@ export async function runSync(args, options = {}) {
|
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
// 5. Install skills (always project-scoped, always symlink)
|
|
298
|
-
spinner.start('Syncing skills
|
|
298
|
+
spinner.start('Syncing skills…');
|
|
299
299
|
const results = [];
|
|
300
300
|
for (const skill of toInstall) {
|
|
301
301
|
for (const agent of targetAgents) {
|
|
@@ -1,8 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execFileSync } from 'child_process';
|
|
2
|
+
import { mkdtempSync, rmSync } from 'fs';
|
|
3
|
+
import { tmpdir } from 'os';
|
|
2
4
|
import { join } from 'path';
|
|
3
5
|
import { stripTerminalEscapes } from "./sanitize.js";
|
|
4
6
|
// const PROJECT_ROOT = join(import.meta.dirname, '..');
|
|
5
7
|
const CLI_PATH = join(import.meta.dirname, 'cli.ts');
|
|
8
|
+
// Keep synchronized with the environment checks in @vercel/detect-agent@1.2.3
|
|
9
|
+
// and the additional Cursor checks in detect-agent.ts. Filesystem-based detection
|
|
10
|
+
// such as /opt/.devin is intentionally outside this environment-isolation helper.
|
|
11
|
+
const AGENT_DETECTION_ENV_VARS = new Set([
|
|
12
|
+
'AI_AGENT',
|
|
13
|
+
'ANTIGRAVITY_AGENT',
|
|
14
|
+
'AUGMENT_AGENT',
|
|
15
|
+
'CLAUDE_CODE',
|
|
16
|
+
'CLAUDE_CODE_IS_COWORK',
|
|
17
|
+
'CLAUDECODE',
|
|
18
|
+
'CODEX_CI',
|
|
19
|
+
'CODEX_SANDBOX',
|
|
20
|
+
'CODEX_THREAD_ID',
|
|
21
|
+
'COPILOT_ALLOW_ALL',
|
|
22
|
+
'COPILOT_GITHUB_TOKEN',
|
|
23
|
+
'COPILOT_MODEL',
|
|
24
|
+
'CURSOR_AGENT',
|
|
25
|
+
'CURSOR_EXTENSION_HOST_ROLE',
|
|
26
|
+
'CURSOR_TRACE_ID',
|
|
27
|
+
'GEMINI_CLI',
|
|
28
|
+
'OPENCODE_CLIENT',
|
|
29
|
+
'REPL_ID',
|
|
30
|
+
].map((name) => name.toUpperCase()));
|
|
31
|
+
function createCliTestEnvironment(overrides) {
|
|
32
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => !AGENT_DETECTION_ENV_VARS.has(name.toUpperCase())));
|
|
33
|
+
return { ...env, ...overrides };
|
|
34
|
+
}
|
|
6
35
|
export function stripAnsi(str) {
|
|
7
36
|
return stripTerminalEscapes(str);
|
|
8
37
|
}
|
|
@@ -16,13 +45,45 @@ export function stripLogo(str) {
|
|
|
16
45
|
export function hasLogo(str) {
|
|
17
46
|
return str.includes('███') || str.includes('╔') || str.includes('╚');
|
|
18
47
|
}
|
|
48
|
+
export function createTestHomeEnvironment(home) {
|
|
49
|
+
return {
|
|
50
|
+
HOME: home,
|
|
51
|
+
USERPROFILE: home,
|
|
52
|
+
XDG_CONFIG_HOME: join(home, '.config'),
|
|
53
|
+
XDG_DATA_HOME: join(home, '.local', 'share'),
|
|
54
|
+
XDG_STATE_HOME: join(home, '.local', 'state'),
|
|
55
|
+
XDG_CACHE_HOME: join(home, '.cache'),
|
|
56
|
+
APPDATA: join(home, 'AppData', 'Roaming'),
|
|
57
|
+
LOCALAPPDATA: join(home, 'AppData', 'Local'),
|
|
58
|
+
CODEX_HOME: join(home, '.codex'),
|
|
59
|
+
CLAUDE_CONFIG_DIR: join(home, '.claude'),
|
|
60
|
+
VIBE_HOME: join(home, '.vibe'),
|
|
61
|
+
HERMES_HOME: join(home, '.hermes'),
|
|
62
|
+
AUTOHAND_HOME: join(home, '.autohand'),
|
|
63
|
+
FLATPAK_XDG_CONFIG_HOME: join(home, '.var', 'app'),
|
|
64
|
+
DISABLE_TELEMETRY: '1',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function createIsolatedTestEnvironment(overrides) {
|
|
68
|
+
const temporaryHome = mkdtempSync(join(tmpdir(), 'skills-cli-test-home-'));
|
|
69
|
+
const home = overrides?.HOME || overrides?.USERPROFILE || temporaryHome;
|
|
70
|
+
return {
|
|
71
|
+
temporaryHome,
|
|
72
|
+
env: {
|
|
73
|
+
...createCliTestEnvironment(),
|
|
74
|
+
...createTestHomeEnvironment(home),
|
|
75
|
+
...overrides,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
19
79
|
export function runCli(args, cwd, env, timeout) {
|
|
80
|
+
const { env: testEnv, temporaryHome } = createIsolatedTestEnvironment(env);
|
|
20
81
|
try {
|
|
21
|
-
const output =
|
|
82
|
+
const output = execFileSync(process.execPath, [CLI_PATH, ...args], {
|
|
22
83
|
encoding: 'utf-8',
|
|
23
84
|
cwd,
|
|
24
85
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
25
|
-
env:
|
|
86
|
+
env: testEnv,
|
|
26
87
|
timeout: timeout ?? 30000,
|
|
27
88
|
});
|
|
28
89
|
return { stdout: stripAnsi(output), stderr: '', exitCode: 0 };
|
|
@@ -34,18 +95,23 @@ export function runCli(args, cwd, env, timeout) {
|
|
|
34
95
|
exitCode: error.status || 1,
|
|
35
96
|
};
|
|
36
97
|
}
|
|
98
|
+
finally {
|
|
99
|
+
rmSync(temporaryHome, { recursive: true, force: true });
|
|
100
|
+
}
|
|
37
101
|
}
|
|
38
102
|
export function runCliOutput(args, cwd) {
|
|
39
103
|
const result = runCli(args, cwd);
|
|
40
104
|
return result.stdout || result.stderr;
|
|
41
105
|
}
|
|
42
|
-
export function runCliWithInput(args, input, cwd) {
|
|
106
|
+
export function runCliWithInput(args, input, cwd, env) {
|
|
107
|
+
const { env: testEnv, temporaryHome } = createIsolatedTestEnvironment(env);
|
|
43
108
|
try {
|
|
44
|
-
const output =
|
|
109
|
+
const output = execFileSync(process.execPath, [CLI_PATH, ...args], {
|
|
45
110
|
encoding: 'utf-8',
|
|
46
111
|
cwd,
|
|
47
112
|
input: input + '\n',
|
|
48
113
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
114
|
+
env: testEnv,
|
|
49
115
|
});
|
|
50
116
|
return { stdout: stripAnsi(output), stderr: '', exitCode: 0 };
|
|
51
117
|
}
|
|
@@ -56,4 +122,7 @@ export function runCliWithInput(args, input, cwd) {
|
|
|
56
122
|
exitCode: error.status || 1,
|
|
57
123
|
};
|
|
58
124
|
}
|
|
125
|
+
finally {
|
|
126
|
+
rmSync(temporaryHome, { recursive: true, force: true });
|
|
127
|
+
}
|
|
59
128
|
}
|
|
@@ -25,12 +25,12 @@ function deriveSkillFolder(skillPath) {
|
|
|
25
25
|
* Whether a skill folder can be safely appended to the given source as a
|
|
26
26
|
* subpath. Only true for sources the source-parser can resolve as a
|
|
27
27
|
* GitHub/GitLab tree URL — owner/repo shorthand or an HTTPS URL on those
|
|
28
|
-
* hosts. Full SSH URLs (`git@host:owner/repo.git`) and generic Git URLs
|
|
28
|
+
* hosts. Full SSH URLs (`git@host:owner/repo.git` or `ssh://...`) and generic Git URLs
|
|
29
29
|
* (anything ending in `.git`, or hosts other than github.com/gitlab.com)
|
|
30
30
|
* cannot have a subpath appended without producing an unclonable URL.
|
|
31
31
|
*/
|
|
32
32
|
function supportsAppendedSubpath(source) {
|
|
33
|
-
if (source.startsWith('git@'))
|
|
33
|
+
if (source.startsWith('git@') || source.startsWith('ssh://'))
|
|
34
34
|
return false;
|
|
35
35
|
if (source.endsWith('.git'))
|
|
36
36
|
return false;
|
|
@@ -45,6 +45,39 @@ function supportsAppendedSubpath(source) {
|
|
|
45
45
|
}
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
|
+
function isBareShorthand(source) {
|
|
49
|
+
return !source.includes(':') && !source.startsWith('.') && !source.startsWith('/');
|
|
50
|
+
}
|
|
51
|
+
function getLocalSource(entry) {
|
|
52
|
+
if (entry.sourceUrl) {
|
|
53
|
+
return entry.sourceUrl;
|
|
54
|
+
}
|
|
55
|
+
// Older project locks normalized both generic Git and GitLab sources to an
|
|
56
|
+
// owner/repo shorthand. Without the original URL, treating either one as a
|
|
57
|
+
// source would incorrectly redirect the operation to GitHub.
|
|
58
|
+
const requiresSourceUrl = entry.sourceType === 'git' || entry.sourceType === 'gitlab';
|
|
59
|
+
if (requiresSourceUrl && isBareShorthand(entry.source)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return entry.source;
|
|
63
|
+
}
|
|
64
|
+
/** Build a cloneable repository URL for project update source checks. */
|
|
65
|
+
export function buildLocalCloneSource(entry) {
|
|
66
|
+
const source = getLocalSource(entry);
|
|
67
|
+
if (!source) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
if (entry.sourceType === 'github' && isBareShorthand(source)) {
|
|
71
|
+
return `https://github.com/${source.replace(/\.git$/, '')}.git`;
|
|
72
|
+
}
|
|
73
|
+
return source;
|
|
74
|
+
}
|
|
75
|
+
export function shouldUseFullDepthForUpdate(entry) {
|
|
76
|
+
if (!entry.skillPath)
|
|
77
|
+
return false;
|
|
78
|
+
const source = entry.sourceType && entry.sourceType !== 'github' ? getLocalSource(entry) : entry.source;
|
|
79
|
+
return source !== null && !supportsAppendedSubpath(source);
|
|
80
|
+
}
|
|
48
81
|
function appendFolderAndRef(source, skillPath, ref) {
|
|
49
82
|
if (!supportsAppendedSubpath(source)) {
|
|
50
83
|
return formatSourceInput(source, ref);
|
|
@@ -59,18 +92,33 @@ function appendFolderAndRef(source, skillPath, ref) {
|
|
|
59
92
|
*/
|
|
60
93
|
export function buildUpdateInstallSource(entry) {
|
|
61
94
|
if (!entry.skillPath) {
|
|
62
|
-
|
|
95
|
+
const source = entry.sourceType && entry.sourceType !== 'github'
|
|
96
|
+
? getLocalSource(entry)
|
|
97
|
+
: entry.sourceUrl || entry.source;
|
|
98
|
+
if (!source) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return formatSourceInput(source, entry.ref);
|
|
102
|
+
}
|
|
103
|
+
const source = entry.sourceType && entry.sourceType !== 'github' ? getLocalSource(entry) : entry.source;
|
|
104
|
+
if (!source) {
|
|
105
|
+
return null;
|
|
63
106
|
}
|
|
64
|
-
return appendFolderAndRef(
|
|
107
|
+
return appendFolderAndRef(source, entry.skillPath, entry.ref);
|
|
65
108
|
}
|
|
66
109
|
/**
|
|
67
110
|
* Build the source argument for `skills add` during project-level update.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
111
|
+
* Returns null for legacy generic-Git or GitLab lock entries whose source was
|
|
112
|
+
* normalized to an ambiguous owner/repo shorthand. Those entries lack the
|
|
113
|
+
* original host, so reinterpreting them as GitHub would be unsafe.
|
|
70
114
|
*/
|
|
71
115
|
export function buildLocalUpdateSource(entry) {
|
|
116
|
+
const source = getLocalSource(entry);
|
|
117
|
+
if (!source) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
72
120
|
if (!entry.skillPath) {
|
|
73
|
-
return formatSourceInput(
|
|
121
|
+
return formatSourceInput(source, entry.ref);
|
|
74
122
|
}
|
|
75
|
-
return appendFolderAndRef(
|
|
123
|
+
return appendFolderAndRef(source, entry.skillPath, entry.ref);
|
|
76
124
|
}
|