@ariestools/toolchain 10.0.7 → 10.0.8
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/actions/lintNextWorker.d.ts +8 -0
- package/dist/actions/lintNextWorker.d.ts.map +1 -1
- package/dist/actions/skills/detectProfile.d.ts +11 -0
- package/dist/actions/skills/detectProfile.d.ts.map +1 -1
- package/dist/actions/skills/lint.d.ts +7 -3
- package/dist/actions/skills/lint.d.ts.map +1 -1
- package/dist/actions/skills/packageSkills.d.ts +25 -0
- package/dist/actions/skills/packageSkills.d.ts.map +1 -0
- package/dist/actions/skills/skillRules.d.ts +6 -0
- package/dist/actions/skills/skillRules.d.ts.map +1 -1
- package/dist/bin/package/build.mjs +2 -2
- package/dist/bin/package/build.mjs.map +1 -1
- package/dist/bin/package/clean.mjs +2 -2
- package/dist/bin/package/clean.mjs.map +1 -1
- package/dist/bin/package/compile.mjs +2 -2
- package/dist/bin/package/compile.mjs.map +1 -1
- package/dist/bin/package/publint.mjs +2 -2
- package/dist/bin/package/publint.mjs.map +1 -1
- package/dist/bin/package/recompile.mjs +2 -2
- package/dist/bin/package/recompile.mjs.map +1 -1
- package/dist/bin/package/sync-layout.mjs +2 -2
- package/dist/bin/package/sync-layout.mjs.map +1 -1
- package/dist/bin/skills.mjs +462 -52
- package/dist/bin/skills.mjs.map +1 -1
- package/dist/bin/xy.mjs +420 -114
- package/dist/bin/xy.mjs.map +1 -1
- package/dist/bin/xyex.mjs +420 -114
- package/dist/bin/xyex.mjs.map +1 -1
- package/dist/xy/common/skills/index.d.ts.map +1 -1
- package/package.json +12 -12
package/dist/bin/skills.mjs
CHANGED
|
@@ -5,10 +5,10 @@ import process$1, { stdin, stdout } from "node:process";
|
|
|
5
5
|
import * as l from "node:readline";
|
|
6
6
|
import l__default from "node:readline";
|
|
7
7
|
import { ReadStream } from "node:tty";
|
|
8
|
-
import Pr, { basename, dirname, join, normalize, posix, resolve, sep, win32 } from "node:path";
|
|
8
|
+
import Pr, { basename, dirname, join, normalize, posix, relative, resolve, sep, win32 } from "node:path";
|
|
9
9
|
import { execFile, spawn, spawnSync } from "child_process";
|
|
10
10
|
import { EventEmitter } from "node:events";
|
|
11
|
-
import path, { basename as basename$1, dirname as dirname$1, extname, isAbsolute, join as join$1, normalize as normalize$1, parse, relative, resolve as resolve$1, sep as sep$1 } from "path";
|
|
11
|
+
import path, { basename as basename$1, dirname as dirname$1, extname, isAbsolute, join as join$1, normalize as normalize$1, parse, relative as relative$1, resolve as resolve$1, sep as sep$1 } from "path";
|
|
12
12
|
import os, { homedir, platform, tmpdir } from "os";
|
|
13
13
|
import I, { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
|
|
14
14
|
import { fileURLToPath } from "url";
|
|
@@ -19,7 +19,7 @@ import { promisify } from "util";
|
|
|
19
19
|
import { access, chmod, cp, lstat, mkdir, mkdtemp, readFile, readdir, readlink, realpath, rm, stat, symlink, writeFile } from "fs/promises";
|
|
20
20
|
import { Buffer as Buffer$1 } from "buffer";
|
|
21
21
|
import { createHash } from "crypto";
|
|
22
|
-
import ro, { mkdir as mkdir$1, mkdtemp as mkdtemp$1, readFile as readFile$1, rm as rm$1, stat as stat$1, writeFile as writeFile$1 } from "node:fs/promises";
|
|
22
|
+
import ro, { cp as cp$1, mkdir as mkdir$1, mkdtemp as mkdtemp$1, readFile as readFile$1, rm as rm$1, stat as stat$1, writeFile as writeFile$1 } from "node:fs/promises";
|
|
23
23
|
import { createHash as createHash$1, randomBytes } from "node:crypto";
|
|
24
24
|
import { crc32, gunzipSync, inflateRawSync } from "node:zlib";
|
|
25
25
|
import { tmpdir as tmpdir$1 } from "node:os";
|
|
@@ -31,7 +31,7 @@ import zi from "assert";
|
|
|
31
31
|
import * as Ps from "zlib";
|
|
32
32
|
import en from "zlib";
|
|
33
33
|
import co from "node:assert";
|
|
34
|
-
import { execFile as execFile$1 } from "node:child_process";
|
|
34
|
+
import { execFile as execFile$1, spawn as spawn$1 } from "node:child_process";
|
|
35
35
|
//#region \0rolldown/runtime.js
|
|
36
36
|
var __defProp$2 = Object.defineProperty;
|
|
37
37
|
var __esmMin = (fn, res, err) => () => {
|
|
@@ -54,7 +54,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
54
54
|
};
|
|
55
55
|
var __require$1 = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
56
56
|
//#endregion
|
|
57
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
57
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/rolldown-runtime.mjs
|
|
58
58
|
var __create, __defProp$1, __getOwnPropDesc$1, __getOwnPropNames$1, __getProtoOf, __hasOwnProp$1, __commonJSMin, __copyProps$1, __toESM, __require;
|
|
59
59
|
var init_rolldown_runtime = __esmMin((() => {
|
|
60
60
|
__create = Object.create;
|
|
@@ -81,7 +81,7 @@ var init_rolldown_runtime = __esmMin((() => {
|
|
|
81
81
|
__require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
82
82
|
}));
|
|
83
83
|
//#endregion
|
|
84
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
84
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/@clack/core.mjs
|
|
85
85
|
function wrapAnsi(string, columns, options) {
|
|
86
86
|
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
87
87
|
}
|
|
@@ -780,7 +780,7 @@ var init_core = __esmMin((() => {
|
|
|
780
780
|
};
|
|
781
781
|
}));
|
|
782
782
|
//#endregion
|
|
783
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
783
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/@clack/prompts.mjs
|
|
784
784
|
function isUnicodeSupported() {
|
|
785
785
|
if (process$1.platform !== "win32") return process$1.env.TERM !== "linux";
|
|
786
786
|
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
@@ -1227,7 +1227,7 @@ ${b}
|
|
|
1227
1227
|
`${styleText("gray", S_BAR$1)}`;
|
|
1228
1228
|
}));
|
|
1229
1229
|
//#endregion
|
|
1230
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
1230
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/picocolors.mjs
|
|
1231
1231
|
var require_picocolors;
|
|
1232
1232
|
var init_picocolors = __esmMin((() => {
|
|
1233
1233
|
init_rolldown_runtime();
|
|
@@ -1301,7 +1301,7 @@ var init_picocolors = __esmMin((() => {
|
|
|
1301
1301
|
}));
|
|
1302
1302
|
}));
|
|
1303
1303
|
//#endregion
|
|
1304
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
1304
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/@kwsites/file-exists.mjs
|
|
1305
1305
|
var require_ms, require_common, require_browser, require_node, require_src$1, require_src, require_dist$3;
|
|
1306
1306
|
var init_file_exists = __esmMin((() => {
|
|
1307
1307
|
init_rolldown_runtime();
|
|
@@ -1867,7 +1867,7 @@ var init_file_exists = __esmMin((() => {
|
|
|
1867
1867
|
}));
|
|
1868
1868
|
}));
|
|
1869
1869
|
//#endregion
|
|
1870
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
1870
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/@simple-git/args-pathspec.mjs
|
|
1871
1871
|
function c$1(...n) {
|
|
1872
1872
|
const e = new String(n);
|
|
1873
1873
|
return t.set(e, n), e;
|
|
@@ -1883,7 +1883,7 @@ var init_args_pathspec = __esmMin((() => {
|
|
|
1883
1883
|
t = /* @__PURE__ */ new WeakMap();
|
|
1884
1884
|
}));
|
|
1885
1885
|
//#endregion
|
|
1886
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
1886
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/@kwsites/promise-deferred.mjs
|
|
1887
1887
|
var require_dist$2;
|
|
1888
1888
|
var init_promise_deferred = __esmMin((() => {
|
|
1889
1889
|
init_rolldown_runtime();
|
|
@@ -1924,7 +1924,7 @@ var init_promise_deferred = __esmMin((() => {
|
|
|
1924
1924
|
}));
|
|
1925
1925
|
}));
|
|
1926
1926
|
//#endregion
|
|
1927
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
1927
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/@simple-git/argv-parser.mjs
|
|
1928
1928
|
function* U$1(e, t) {
|
|
1929
1929
|
const n = t === "global";
|
|
1930
1930
|
for (const o of e) o.isGlobal === n && (yield o);
|
|
@@ -2399,7 +2399,7 @@ var init_argv_parser = __esmMin((() => {
|
|
|
2399
2399
|
};
|
|
2400
2400
|
}));
|
|
2401
2401
|
//#endregion
|
|
2402
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
2402
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/simple-git.mjs
|
|
2403
2403
|
function asFunction(source) {
|
|
2404
2404
|
if (typeof source !== "function") return NOOP;
|
|
2405
2405
|
return source;
|
|
@@ -5909,7 +5909,7 @@ var init_simple_git = __esmMin((() => {
|
|
|
5909
5909
|
esm_default = gitInstanceFactory;
|
|
5910
5910
|
}));
|
|
5911
5911
|
//#endregion
|
|
5912
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
5912
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/xdg-basedir.mjs
|
|
5913
5913
|
var homeDirectory, env, xdgData, xdgConfig, xdgDataDirectories, xdgConfigDirectories;
|
|
5914
5914
|
var init_xdg_basedir = __esmMin((() => {
|
|
5915
5915
|
homeDirectory = os.homedir();
|
|
@@ -5925,7 +5925,7 @@ var init_xdg_basedir = __esmMin((() => {
|
|
|
5925
5925
|
if (xdgConfig) xdgConfigDirectories.unshift(xdgConfig);
|
|
5926
5926
|
}));
|
|
5927
5927
|
//#endregion
|
|
5928
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
5928
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/_chunks/libs/@vercel/detect-agent.mjs
|
|
5929
5929
|
var require_dist$1;
|
|
5930
5930
|
var init_detect_agent = __esmMin((() => {
|
|
5931
5931
|
init_rolldown_runtime();
|
|
@@ -16027,7 +16027,7 @@ while (this[Zs](this[st].shift()));
|
|
|
16027
16027
|
};
|
|
16028
16028
|
}));
|
|
16029
16029
|
//#endregion
|
|
16030
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
16030
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/dist/cli.mjs
|
|
16031
16031
|
var cli_exports = /* @__PURE__ */ __exportAll({});
|
|
16032
16032
|
function getGitHubHost() {
|
|
16033
16033
|
const configuredHost = process.env.GH_HOST?.trim();
|
|
@@ -16091,6 +16091,46 @@ function sanitizeSubpath(subpath) {
|
|
|
16091
16091
|
for (const segment of segments) if (segment === "..") throw new Error(`Unsafe subpath: "${subpath}" contains path traversal segments. Subpaths must not contain ".." components.`);
|
|
16092
16092
|
return subpath;
|
|
16093
16093
|
}
|
|
16094
|
+
function azureReposVersionToRef(version) {
|
|
16095
|
+
if (!version) return;
|
|
16096
|
+
return /^(?:GB|GT)(.+)$/i.exec(version)?.[1] || void 0;
|
|
16097
|
+
}
|
|
16098
|
+
function parseAzureReposSource(input, fragmentRef, fragmentSkillFilter) {
|
|
16099
|
+
if (!input.startsWith("http://") && !input.startsWith("https://")) return null;
|
|
16100
|
+
let parsed;
|
|
16101
|
+
try {
|
|
16102
|
+
parsed = new URL(input);
|
|
16103
|
+
} catch {
|
|
16104
|
+
return null;
|
|
16105
|
+
}
|
|
16106
|
+
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
16107
|
+
const gitIndex = segments.indexOf("_git");
|
|
16108
|
+
if (gitIndex < 0 || gitIndex === segments.length - 1) return null;
|
|
16109
|
+
const repo = segments[gitIndex + 1].replace(/\.git$/, "");
|
|
16110
|
+
if (!repo) return null;
|
|
16111
|
+
const clonePath = "/" + [
|
|
16112
|
+
...segments.slice(0, gitIndex),
|
|
16113
|
+
"_git",
|
|
16114
|
+
repo
|
|
16115
|
+
].map((segment) => {
|
|
16116
|
+
try {
|
|
16117
|
+
return encodeURIComponent(decodeURIComponent(segment));
|
|
16118
|
+
} catch {
|
|
16119
|
+
return encodeURIComponent(segment);
|
|
16120
|
+
}
|
|
16121
|
+
}).join("/");
|
|
16122
|
+
const cloneUrl = `${parsed.protocol}//${parsed.host}${clonePath}`;
|
|
16123
|
+
const ref = azureReposVersionToRef(parsed.searchParams.get("version")) || fragmentRef;
|
|
16124
|
+
const pathParam = parsed.searchParams.get("path");
|
|
16125
|
+
const subpath = pathParam ? sanitizeSubpath(pathParam.replace(/^\/+/, "")) : void 0;
|
|
16126
|
+
return {
|
|
16127
|
+
type: "git",
|
|
16128
|
+
url: cloneUrl,
|
|
16129
|
+
...ref ? { ref } : {},
|
|
16130
|
+
...subpath ? { subpath } : {},
|
|
16131
|
+
...fragmentSkillFilter ? { skillFilter: fragmentSkillFilter } : {}
|
|
16132
|
+
};
|
|
16133
|
+
}
|
|
16094
16134
|
function isLocalPath(input) {
|
|
16095
16135
|
return isAbsolute(input) || input.startsWith("./") || input.startsWith("../") || input === "." || input === ".." || /^[a-zA-Z]:[/\\]/.test(input);
|
|
16096
16136
|
}
|
|
@@ -16109,6 +16149,9 @@ function looksLikeGitSource(input) {
|
|
|
16109
16149
|
const pathname = parsed.pathname;
|
|
16110
16150
|
if (isGitHubHost(parsed.host)) return /^\/[^/]+\/[^/]+(?:\.git)?(?:\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(pathname);
|
|
16111
16151
|
if (parsed.hostname === "gitlab.com") return /^\/.+?\/[^/]+(?:\.git)?(?:\/-\/tree\/[^/]+(?:\/.*)?)?\/?$/.test(pathname);
|
|
16152
|
+
const azureSegments = pathname.split("/").filter(Boolean);
|
|
16153
|
+
const azureGitIndex = azureSegments.indexOf("_git");
|
|
16154
|
+
if (azureGitIndex >= 0 && azureGitIndex < azureSegments.length - 1) return true;
|
|
16112
16155
|
} catch {}
|
|
16113
16156
|
if (/^https?:\/\/.+\.git(?:$|[/?])/i.test(input)) return true;
|
|
16114
16157
|
return !input.includes(":") && !input.startsWith(".") && !input.startsWith("/") && /^([^/]+)\/([^/]+)(?:\/(.+)|@(.+))?$/.test(input);
|
|
@@ -16241,6 +16284,8 @@ function parseSource(input) {
|
|
|
16241
16284
|
...fragmentRef ? { ref: fragmentRef } : {}
|
|
16242
16285
|
};
|
|
16243
16286
|
}
|
|
16287
|
+
const azureRepos = parseAzureReposSource(input, fragmentRef, fragmentSkillFilter);
|
|
16288
|
+
if (azureRepos) return azureRepos;
|
|
16244
16289
|
const githubHost = getGitHubHost();
|
|
16245
16290
|
const shorthandSourceType = githubHost === "github.com" ? "github" : "git";
|
|
16246
16291
|
const atSkillMatch = input.match(/^([^/]+)\/([^/@]+)@(.+)$/);
|
|
@@ -17037,7 +17082,7 @@ async function writeLocalLock(lock, cwd) {
|
|
|
17037
17082
|
}
|
|
17038
17083
|
function getPortableLocalSource(source, lockDir) {
|
|
17039
17084
|
const absoluteSource = isAbsolute(source) ? source : resolve$1(lockDir, source);
|
|
17040
|
-
const relativeSource = relative(lockDir, absoluteSource);
|
|
17085
|
+
const relativeSource = relative$1(lockDir, absoluteSource);
|
|
17041
17086
|
if (isAbsolute(relativeSource)) return absoluteSource.split(sep$1).join("/");
|
|
17042
17087
|
const portableSource = relativeSource.split(sep$1).join("/");
|
|
17043
17088
|
if (!portableSource) return ".";
|
|
@@ -17064,7 +17109,7 @@ async function collectFiles(baseDir, currentDir, results) {
|
|
|
17064
17109
|
await collectFiles(baseDir, fullPath, results);
|
|
17065
17110
|
} else if (entry.isFile()) {
|
|
17066
17111
|
const content = await readFile(fullPath);
|
|
17067
|
-
const relativePath = relative(baseDir, fullPath).split("\\").join("/");
|
|
17112
|
+
const relativePath = relative$1(baseDir, fullPath).split("\\").join("/");
|
|
17068
17113
|
results.push({
|
|
17069
17114
|
relativePath,
|
|
17070
17115
|
content
|
|
@@ -17096,7 +17141,7 @@ function normalizeSkillName$1(name) {
|
|
|
17096
17141
|
function normalizeRelativePath(path) {
|
|
17097
17142
|
return path.split(sep$1).join("/").replace(/\/+/g, "/");
|
|
17098
17143
|
}
|
|
17099
|
-
function isRecord(value) {
|
|
17144
|
+
function isRecord$1(value) {
|
|
17100
17145
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17101
17146
|
}
|
|
17102
17147
|
function shouldInstallInternalSkills() {
|
|
@@ -17139,7 +17184,7 @@ async function parseSkillMd(skillMdPath, options) {
|
|
|
17139
17184
|
warnSkippedSkill(skillMdPath, `frontmatter "name" and "description" must be strings (got ${typeof data.name} and ${typeof data.description})`);
|
|
17140
17185
|
return null;
|
|
17141
17186
|
}
|
|
17142
|
-
const metadata = isRecord(data.metadata) ? data.metadata : void 0;
|
|
17187
|
+
const metadata = isRecord$1(data.metadata) ? data.metadata : void 0;
|
|
17143
17188
|
if (metadata?.internal === true && !shouldInstallInternalSkills() && !options?.includeInternal) return null;
|
|
17144
17189
|
return {
|
|
17145
17190
|
name: sanitizeMetadata(data.name),
|
|
@@ -17181,7 +17226,7 @@ async function discoverSkills(basePath, subpath, options) {
|
|
|
17181
17226
|
};
|
|
17182
17227
|
const isInstalledProjectSkill = (skill) => {
|
|
17183
17228
|
if (lockedSkillNames.size === 0) return false;
|
|
17184
|
-
const relativeDir = normalizeRelativePath(relative(basePath, skill.path));
|
|
17229
|
+
const relativeDir = normalizeRelativePath(relative$1(basePath, skill.path));
|
|
17185
17230
|
if (!AGENT_PROJECT_SKILL_DIRS.some((dir) => relativeDir === dir || relativeDir.startsWith(`${dir}/`))) return false;
|
|
17186
17231
|
const skillName = normalizeSkillName$1(skill.name);
|
|
17187
17232
|
const directoryName = normalizeSkillName$1(basename$1(skill.path));
|
|
@@ -17396,7 +17441,7 @@ async function createSymlink(target, linkPath) {
|
|
|
17396
17441
|
}
|
|
17397
17442
|
const linkDir = dirname$1(linkPath);
|
|
17398
17443
|
await mkdir(linkDir, { recursive: true });
|
|
17399
|
-
const relativePath = relative(await resolveParentSymlinks(linkDir), target);
|
|
17444
|
+
const relativePath = relative$1(await resolveParentSymlinks(linkDir), target);
|
|
17400
17445
|
const symlinkType = platform() === "win32" ? "junction" : void 0;
|
|
17401
17446
|
await symlink(symlinkType === "junction" ? resolvedTarget : relativePath, linkPath, symlinkType);
|
|
17402
17447
|
return true;
|
|
@@ -18181,17 +18226,20 @@ function computeWellKnownSkillDigest(skill) {
|
|
|
18181
18226
|
}
|
|
18182
18227
|
return `sha256:${hash.digest("hex")}`;
|
|
18183
18228
|
}
|
|
18229
|
+
function positiveIntegerOr(value, fallback) {
|
|
18230
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : fallback;
|
|
18231
|
+
}
|
|
18184
18232
|
function getPositiveIntegerEnv(name, fallback) {
|
|
18185
18233
|
const raw = process.env[name];
|
|
18186
18234
|
if (!raw) return fallback;
|
|
18187
18235
|
const parsed = Number.parseInt(raw, 10);
|
|
18188
18236
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
18189
18237
|
}
|
|
18190
|
-
function getDownloadLimits() {
|
|
18238
|
+
function getDownloadLimits(options) {
|
|
18191
18239
|
return {
|
|
18192
|
-
downloadMaxBytes: getPositiveIntegerEnv("SKILLS_DOWNLOAD_MAX_BYTES", DEFAULT_DOWNLOAD_MAX_BYTES),
|
|
18193
|
-
extractMaxBytes: getPositiveIntegerEnv("SKILLS_EXTRACT_MAX_BYTES", DEFAULT_EXTRACT_MAX_BYTES),
|
|
18194
|
-
extractMaxFiles: getPositiveIntegerEnv("SKILLS_EXTRACT_MAX_FILES", DEFAULT_EXTRACT_MAX_FILES)
|
|
18240
|
+
downloadMaxBytes: getPositiveIntegerEnv("SKILLS_DOWNLOAD_MAX_BYTES", positiveIntegerOr(options.downloadMaxBytes, DEFAULT_DOWNLOAD_MAX_BYTES)),
|
|
18241
|
+
extractMaxBytes: getPositiveIntegerEnv("SKILLS_EXTRACT_MAX_BYTES", positiveIntegerOr(options.extractMaxBytes, DEFAULT_EXTRACT_MAX_BYTES)),
|
|
18242
|
+
extractMaxFiles: getPositiveIntegerEnv("SKILLS_EXTRACT_MAX_FILES", positiveIntegerOr(options.extractMaxFiles, DEFAULT_EXTRACT_MAX_FILES))
|
|
18195
18243
|
};
|
|
18196
18244
|
}
|
|
18197
18245
|
function isPathSafe$1(basePath, targetPath) {
|
|
@@ -18325,8 +18373,8 @@ async function getSingleTopLevelDirectory(dir) {
|
|
|
18325
18373
|
if (visibleEntries.length !== 1 || !visibleEntries[0].isDirectory()) return null;
|
|
18326
18374
|
return join(dir, visibleEntries[0].name);
|
|
18327
18375
|
}
|
|
18328
|
-
async function downloadSource(url) {
|
|
18329
|
-
const limits = getDownloadLimits();
|
|
18376
|
+
async function downloadSource(url, options = {}) {
|
|
18377
|
+
const limits = getDownloadLimits(options);
|
|
18330
18378
|
const tempDir = await mkdtemp$1(join(tmpdir$1(), "skills-download-"));
|
|
18331
18379
|
const downloadedFile = join(tempDir, "source.download");
|
|
18332
18380
|
const extractDir = join(tempDir, "extract");
|
|
@@ -18739,6 +18787,339 @@ async function tryBlobInstall(ownerRepo, options = {}) {
|
|
|
18739
18787
|
tree
|
|
18740
18788
|
};
|
|
18741
18789
|
}
|
|
18790
|
+
function isRecord(value) {
|
|
18791
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
18792
|
+
}
|
|
18793
|
+
function assertString(value, field) {
|
|
18794
|
+
if (typeof value !== "string" || value.length === 0) throw new Error(`Notion Agent Plugins response is missing ${field}`);
|
|
18795
|
+
return value;
|
|
18796
|
+
}
|
|
18797
|
+
function optionalMetadata(value, field) {
|
|
18798
|
+
if (value === void 0 || value === null) return "";
|
|
18799
|
+
if (typeof value !== "string") throw new Error(`Notion Agent Plugins response has an invalid ${field}`);
|
|
18800
|
+
return sanitizeMetadata(value);
|
|
18801
|
+
}
|
|
18802
|
+
function parsePack(value) {
|
|
18803
|
+
if (!isRecord(value)) throw new Error("Notion Agent Plugins response contains an invalid pack");
|
|
18804
|
+
if (typeof value.name !== "string") throw new Error("Notion Agent Plugins response is missing pack.name");
|
|
18805
|
+
const name = sanitizeMetadata(value.name);
|
|
18806
|
+
if (!name) return null;
|
|
18807
|
+
return {
|
|
18808
|
+
id: assertString(value.id, "pack.id"),
|
|
18809
|
+
name,
|
|
18810
|
+
description: optionalMetadata(value.description, "pack.description"),
|
|
18811
|
+
version_id: assertString(value.version_id, "pack.version_id")
|
|
18812
|
+
};
|
|
18813
|
+
}
|
|
18814
|
+
function parsePackList(value) {
|
|
18815
|
+
if (!isRecord(value) || !Array.isArray(value.results)) throw new Error("Notion Agent Plugins list response is invalid");
|
|
18816
|
+
if (typeof value.has_more !== "boolean") throw new Error("Notion Agent Plugins list response is missing has_more");
|
|
18817
|
+
const nextCursor = value.next_cursor;
|
|
18818
|
+
if (nextCursor !== null && typeof nextCursor !== "string") throw new Error("Notion Agent Plugins list response has an invalid next_cursor");
|
|
18819
|
+
return {
|
|
18820
|
+
results: value.results.map(parsePack).filter((pack) => pack !== null),
|
|
18821
|
+
next_cursor: nextCursor,
|
|
18822
|
+
has_more: value.has_more
|
|
18823
|
+
};
|
|
18824
|
+
}
|
|
18825
|
+
function parseDirectory(value, label) {
|
|
18826
|
+
if (!isRecord(value)) throw new Error(`Notion ${label} directory response is invalid`);
|
|
18827
|
+
return {
|
|
18828
|
+
id: assertString(value.id, `${label} directory id`),
|
|
18829
|
+
version_id: assertString(value.version_id, `${label} directory version_id`),
|
|
18830
|
+
url: assertString(value.url, `${label} directory url`)
|
|
18831
|
+
};
|
|
18832
|
+
}
|
|
18833
|
+
function downloadNotionDirectory(url) {
|
|
18834
|
+
return downloadSource(url, {
|
|
18835
|
+
downloadMaxBytes: NOTION_DOWNLOAD_MAX_BYTES,
|
|
18836
|
+
extractMaxBytes: NOTION_EXTRACT_MAX_BYTES,
|
|
18837
|
+
extractMaxFiles: NOTION_EXTRACT_MAX_FILES
|
|
18838
|
+
});
|
|
18839
|
+
}
|
|
18840
|
+
function debugNtn(args) {
|
|
18841
|
+
if (process.env.SKILLS_DEBUG === "1") console.error(`[notion] ntn ${args.join(" ")}`);
|
|
18842
|
+
}
|
|
18843
|
+
async function runNtnApi(args) {
|
|
18844
|
+
debugNtn(args);
|
|
18845
|
+
return new Promise((resolve, reject) => {
|
|
18846
|
+
const child = spawn$1("ntn", args, {
|
|
18847
|
+
env: process.env,
|
|
18848
|
+
stdio: [
|
|
18849
|
+
"ignore",
|
|
18850
|
+
"pipe",
|
|
18851
|
+
"pipe"
|
|
18852
|
+
]
|
|
18853
|
+
});
|
|
18854
|
+
const stdoutChunks = [];
|
|
18855
|
+
const stderrChunks = [];
|
|
18856
|
+
let outputBytes = 0;
|
|
18857
|
+
let settled = false;
|
|
18858
|
+
const finish = (callback) => {
|
|
18859
|
+
if (settled) return;
|
|
18860
|
+
settled = true;
|
|
18861
|
+
clearTimeout(timeout);
|
|
18862
|
+
callback();
|
|
18863
|
+
};
|
|
18864
|
+
const fail = (message) => finish(() => reject(new Error(message)));
|
|
18865
|
+
const append = (chunks, chunk) => {
|
|
18866
|
+
outputBytes += chunk.length;
|
|
18867
|
+
if (outputBytes > NTN_MAX_BUFFER_BYTES) {
|
|
18868
|
+
child.kill("SIGTERM");
|
|
18869
|
+
fail("ntn api output exceeded 10 MiB");
|
|
18870
|
+
return;
|
|
18871
|
+
}
|
|
18872
|
+
chunks.push(chunk);
|
|
18873
|
+
};
|
|
18874
|
+
const timeout = setTimeout(() => {
|
|
18875
|
+
child.kill("SIGTERM");
|
|
18876
|
+
fail(`ntn api timed out after ${NTN_TIMEOUT_MS / 1e3} seconds`);
|
|
18877
|
+
}, NTN_TIMEOUT_MS);
|
|
18878
|
+
child.stdout.on("data", (chunk) => append(stdoutChunks, chunk));
|
|
18879
|
+
child.stderr.on("data", (chunk) => append(stderrChunks, chunk));
|
|
18880
|
+
child.on("error", (error) => {
|
|
18881
|
+
if (error.code === "ENOENT") {
|
|
18882
|
+
fail("Notion CLI (ntn) is required. Install it from:\nhttps://developers.notion.com/cli/get-started/overview\nThen run `ntn login`.");
|
|
18883
|
+
return;
|
|
18884
|
+
}
|
|
18885
|
+
fail(`Unable to start ntn: ${stripTerminalEscapes(error.message)}`);
|
|
18886
|
+
});
|
|
18887
|
+
child.on("close", (code) => {
|
|
18888
|
+
const stdout = Buffer.concat(stdoutChunks).toString("utf8");
|
|
18889
|
+
const stderr = stripTerminalEscapes(Buffer.concat(stderrChunks).toString("utf8")).trim();
|
|
18890
|
+
if (code === 0) {
|
|
18891
|
+
finish(() => resolve(stdout));
|
|
18892
|
+
return;
|
|
18893
|
+
}
|
|
18894
|
+
fail(`ntn api failed${stderr ? `: ${stderr}` : ` with exit code ${code ?? "unknown"}`}`);
|
|
18895
|
+
});
|
|
18896
|
+
});
|
|
18897
|
+
}
|
|
18898
|
+
async function fetchNotionJson(args, label, runNtn = runNtnApi) {
|
|
18899
|
+
const output = await runNtn([
|
|
18900
|
+
"api",
|
|
18901
|
+
...args,
|
|
18902
|
+
"--notion-version",
|
|
18903
|
+
NOTION_API_VERSION
|
|
18904
|
+
]);
|
|
18905
|
+
try {
|
|
18906
|
+
return JSON.parse(output);
|
|
18907
|
+
} catch (error) {
|
|
18908
|
+
if (error instanceof SyntaxError) throw new Error(`ntn returned invalid JSON for ${label}`);
|
|
18909
|
+
throw error;
|
|
18910
|
+
}
|
|
18911
|
+
}
|
|
18912
|
+
async function fetchNotionPacks(options = {}) {
|
|
18913
|
+
const runNtn = options.runNtn ?? runNtnApi;
|
|
18914
|
+
const packs = [];
|
|
18915
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
18916
|
+
let cursor = null;
|
|
18917
|
+
do {
|
|
18918
|
+
const args = ["/v1/ai/plugins", "page_size==100"];
|
|
18919
|
+
if (cursor) args.push(`start_cursor==${cursor}`);
|
|
18920
|
+
const page = parsePackList(await fetchNotionJson(args, "the Notion packs list", runNtn));
|
|
18921
|
+
packs.push(...page.results);
|
|
18922
|
+
if (!page.has_more) break;
|
|
18923
|
+
if (!page.next_cursor || seenCursors.has(page.next_cursor)) throw new Error("Notion Agent Plugins pagination returned an invalid cursor");
|
|
18924
|
+
cursor = page.next_cursor;
|
|
18925
|
+
seenCursors.add(cursor);
|
|
18926
|
+
} while (cursor);
|
|
18927
|
+
return packs;
|
|
18928
|
+
}
|
|
18929
|
+
async function fetchNotionPackDirectory(pack, options = {}) {
|
|
18930
|
+
const directory = parseDirectory(await fetchNotionJson([`/v1/ai/plugins/${encodeURIComponent(pack.id)}`], `Notion pack ${JSON.stringify(pack.name)}`, options.runNtn), "pack");
|
|
18931
|
+
if (directory.id !== pack.id || directory.version_id !== pack.version_id) throw new Error(`Notion pack ${JSON.stringify(pack.name)} changed while preparing installation`);
|
|
18932
|
+
return directory;
|
|
18933
|
+
}
|
|
18934
|
+
async function fetchNotionWorkspaceName(options = {}) {
|
|
18935
|
+
const runNtn = options.runNtn ?? runNtnApi;
|
|
18936
|
+
try {
|
|
18937
|
+
const value = JSON.parse(await runNtn([
|
|
18938
|
+
"api",
|
|
18939
|
+
"/v1/users/me",
|
|
18940
|
+
"--notion-version",
|
|
18941
|
+
NOTION_API_VERSION
|
|
18942
|
+
]));
|
|
18943
|
+
if (!isRecord(value) || !isRecord(value.bot)) return null;
|
|
18944
|
+
const name = value.bot.workspace_name;
|
|
18945
|
+
return typeof name === "string" && name.length > 0 ? sanitizeMetadata(name) : null;
|
|
18946
|
+
} catch {
|
|
18947
|
+
return null;
|
|
18948
|
+
}
|
|
18949
|
+
}
|
|
18950
|
+
function inWorkspace(workspace) {
|
|
18951
|
+
return workspace ? ` in workspace ${import_picocolors.default.cyan(workspace)}` : "";
|
|
18952
|
+
}
|
|
18953
|
+
function isNotionSource(source) {
|
|
18954
|
+
return source.toLowerCase() === "notion";
|
|
18955
|
+
}
|
|
18956
|
+
function formatPageId(rawId) {
|
|
18957
|
+
const hex = rawId.replace(/-/g, "");
|
|
18958
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
18959
|
+
}
|
|
18960
|
+
function parseNotionSkillUrl(source) {
|
|
18961
|
+
let url;
|
|
18962
|
+
try {
|
|
18963
|
+
url = new URL(source);
|
|
18964
|
+
} catch {
|
|
18965
|
+
return null;
|
|
18966
|
+
}
|
|
18967
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return null;
|
|
18968
|
+
if (!NOTION_HOSTNAME.test(url.hostname.toLowerCase())) return null;
|
|
18969
|
+
const lastSegment = url.pathname.split("/").filter(Boolean).pop();
|
|
18970
|
+
if (!lastSegment) return null;
|
|
18971
|
+
let decoded;
|
|
18972
|
+
try {
|
|
18973
|
+
decoded = decodeURIComponent(lastSegment);
|
|
18974
|
+
} catch {
|
|
18975
|
+
decoded = lastSegment;
|
|
18976
|
+
}
|
|
18977
|
+
const match = decoded.toLowerCase().match(NOTION_PAGE_ID);
|
|
18978
|
+
return match ? formatPageId(match[1]) : null;
|
|
18979
|
+
}
|
|
18980
|
+
async function fetchNotionSkillDirectory(pageId, options = {}) {
|
|
18981
|
+
return parseDirectory(await fetchNotionJson([`/v1/ai/skills/${encodeURIComponent(pageId)}`], `Notion skill ${pageId}`, options.runNtn), "skill");
|
|
18982
|
+
}
|
|
18983
|
+
async function prepareNotionSkillSource(pageId, options = {}) {
|
|
18984
|
+
const download = options.download ?? downloadNotionDirectory;
|
|
18985
|
+
const spinner$4 = spinner();
|
|
18986
|
+
spinner$4.start("Fetching Notion skill with ntn…");
|
|
18987
|
+
try {
|
|
18988
|
+
const [directory, workspace] = await Promise.all([fetchNotionSkillDirectory(pageId, { runNtn: options.runNtn }), fetchNotionWorkspaceName({ runNtn: options.runNtn })]);
|
|
18989
|
+
const downloaded = await download(directory.url);
|
|
18990
|
+
spinner$4.stop(`Downloaded skill from Notion${inWorkspace(workspace)}`);
|
|
18991
|
+
return {
|
|
18992
|
+
rootDir: downloaded.rootDir,
|
|
18993
|
+
tempDir: downloaded.tempDir
|
|
18994
|
+
};
|
|
18995
|
+
} catch (error) {
|
|
18996
|
+
spinner$4.stop(import_picocolors.default.red("Failed to prepare Notion skill"));
|
|
18997
|
+
throw error;
|
|
18998
|
+
}
|
|
18999
|
+
}
|
|
19000
|
+
function normalizeSelector(value) {
|
|
19001
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
19002
|
+
}
|
|
19003
|
+
function filterPacks(packs, selectors) {
|
|
19004
|
+
if (selectors.includes("*")) return packs;
|
|
19005
|
+
const normalized = new Set(selectors.map(normalizeSelector));
|
|
19006
|
+
return packs.filter((pack) => normalized.has(normalizeSelector(pack.name)) || normalized.has(pack.id.toLowerCase()));
|
|
19007
|
+
}
|
|
19008
|
+
function sortedPacks(packs) {
|
|
19009
|
+
return [...packs].sort((a, b) => a.name.localeCompare(b.name));
|
|
19010
|
+
}
|
|
19011
|
+
function printAvailablePacks(packs) {
|
|
19012
|
+
console.log();
|
|
19013
|
+
log.step(import_picocolors.default.bold("Available Notion packs"));
|
|
19014
|
+
for (const pack of sortedPacks(packs)) {
|
|
19015
|
+
log.message(import_picocolors.default.cyan(pack.name));
|
|
19016
|
+
if (pack.description) log.message(` ${import_picocolors.default.dim(pack.description)}`);
|
|
19017
|
+
}
|
|
19018
|
+
}
|
|
19019
|
+
async function prepareNotionPackSource(options = {}) {
|
|
19020
|
+
const spinner$5 = spinner();
|
|
19021
|
+
spinner$5.start("Fetching Notion packs with ntn…");
|
|
19022
|
+
let packs;
|
|
19023
|
+
let workspace = null;
|
|
19024
|
+
try {
|
|
19025
|
+
[packs, workspace] = await Promise.all([fetchNotionPacks({ runNtn: options.runNtn }), fetchNotionWorkspaceName({ runNtn: options.runNtn })]);
|
|
19026
|
+
} catch (error) {
|
|
19027
|
+
spinner$5.stop(import_picocolors.default.red("Failed to load Notion packs"));
|
|
19028
|
+
throw error;
|
|
19029
|
+
}
|
|
19030
|
+
spinner$5.stop(`Found ${import_picocolors.default.green(packs.length)} Notion pack${packs.length === 1 ? "" : "s"}${inWorkspace(workspace)}`);
|
|
19031
|
+
if (packs.length === 0) throw new Error("Notion returned no packs for the authenticated workspace");
|
|
19032
|
+
if (options.list) {
|
|
19033
|
+
printAvailablePacks(packs);
|
|
19034
|
+
outro(import_picocolors.default.dim("Select a pack by running the command without --list."));
|
|
19035
|
+
return null;
|
|
19036
|
+
}
|
|
19037
|
+
let selectedPacks;
|
|
19038
|
+
if (options.skill && options.skill.length > 0) {
|
|
19039
|
+
selectedPacks = filterPacks(packs, options.skill);
|
|
19040
|
+
if (selectedPacks.length === 0) throw new Error(`No matching Notion packs found for: ${options.skill.join(", ")}`);
|
|
19041
|
+
} else if (options.yes || !process.stdin.isTTY) selectedPacks = packs;
|
|
19042
|
+
else {
|
|
19043
|
+
const selected = await searchMultiselect({
|
|
19044
|
+
message: `Select Notion packs to install ${import_picocolors.default.dim("(space to toggle)")}`,
|
|
19045
|
+
items: sortedPacks(packs).map((pack) => ({
|
|
19046
|
+
value: pack,
|
|
19047
|
+
label: pack.name,
|
|
19048
|
+
detail: pack.description || "Notion plugin pack"
|
|
19049
|
+
})),
|
|
19050
|
+
required: true,
|
|
19051
|
+
maxVisible: 20,
|
|
19052
|
+
searchable: false,
|
|
19053
|
+
showDetail: true,
|
|
19054
|
+
showSelectedSummary: false
|
|
19055
|
+
});
|
|
19056
|
+
if (typeof selected === "symbol") {
|
|
19057
|
+
cancel("Selection cancelled");
|
|
19058
|
+
return null;
|
|
19059
|
+
}
|
|
19060
|
+
selectedPacks = selected;
|
|
19061
|
+
}
|
|
19062
|
+
note(selectedPacks.map((pack) => import_picocolors.default.cyan(pack.name)).join("\n"), `Selected ${selectedPacks.length} Notion pack${selectedPacks.length === 1 ? "" : "s"}`);
|
|
19063
|
+
const stagingDir = await mkdtemp$1(join(tmpdir$1(), "skills-notion-"));
|
|
19064
|
+
const packsDir = join(stagingDir, "packs");
|
|
19065
|
+
const manifestPlugins = [];
|
|
19066
|
+
const download = options.download ?? downloadNotionDirectory;
|
|
19067
|
+
const discover = options.discover ?? discoverSkills;
|
|
19068
|
+
let skillCount = 0;
|
|
19069
|
+
spinner$5.start("Preparing selected Notion packs…");
|
|
19070
|
+
try {
|
|
19071
|
+
await mkdir$1(packsDir, { recursive: true });
|
|
19072
|
+
for (const [index, pack] of selectedPacks.entries()) {
|
|
19073
|
+
let downloaded = null;
|
|
19074
|
+
try {
|
|
19075
|
+
downloaded = await download((await fetchNotionPackDirectory(pack, { runNtn: options.runNtn })).url);
|
|
19076
|
+
const skills = await discover(downloaded.rootDir, void 0, {
|
|
19077
|
+
includeInternal: true,
|
|
19078
|
+
fullDepth: true
|
|
19079
|
+
});
|
|
19080
|
+
if (skills.length === 0) throw new Error("pack contains no valid skills");
|
|
19081
|
+
const directoryName = `pack-${index + 1}-${sanitizeName(pack.name).slice(0, 100)}`;
|
|
19082
|
+
const targetDir = join(packsDir, directoryName);
|
|
19083
|
+
await cp$1(downloaded.rootDir, targetDir, {
|
|
19084
|
+
recursive: true,
|
|
19085
|
+
force: false,
|
|
19086
|
+
errorOnExist: true
|
|
19087
|
+
});
|
|
19088
|
+
manifestPlugins.push({
|
|
19089
|
+
name: pack.name,
|
|
19090
|
+
source: `./${directoryName}`,
|
|
19091
|
+
skills: skills.map((skill) => {
|
|
19092
|
+
const skillPath = relative(downloaded.rootDir, skill.path).split(sep).join("/");
|
|
19093
|
+
return skillPath ? `./${skillPath}` : "./.";
|
|
19094
|
+
})
|
|
19095
|
+
});
|
|
19096
|
+
skillCount += skills.length;
|
|
19097
|
+
} catch (error) {
|
|
19098
|
+
const detail = error instanceof Error ? error.message : "Unknown error";
|
|
19099
|
+
throw new Error(`Failed to prepare Notion pack ${JSON.stringify(pack.name)}: ${detail}`);
|
|
19100
|
+
} finally {
|
|
19101
|
+
if (downloaded) await cleanupTempDir(downloaded.tempDir).catch(() => {});
|
|
19102
|
+
}
|
|
19103
|
+
}
|
|
19104
|
+
const manifestDir = join(stagingDir, ".claude-plugin");
|
|
19105
|
+
await mkdir$1(manifestDir, { recursive: true });
|
|
19106
|
+
await writeFile$1(join(manifestDir, "marketplace.json"), `${JSON.stringify({
|
|
19107
|
+
metadata: { pluginRoot: "./packs" },
|
|
19108
|
+
plugins: manifestPlugins
|
|
19109
|
+
}, null, 2)}\n`, "utf8");
|
|
19110
|
+
spinner$5.stop(`Prepared ${import_picocolors.default.green(selectedPacks.length)} Notion pack${selectedPacks.length === 1 ? "" : "s"} with ${import_picocolors.default.green(skillCount)} skill${skillCount === 1 ? "" : "s"}`);
|
|
19111
|
+
return {
|
|
19112
|
+
rootDir: stagingDir,
|
|
19113
|
+
tempDir: stagingDir,
|
|
19114
|
+
packCount: selectedPacks.length,
|
|
19115
|
+
skillCount
|
|
19116
|
+
};
|
|
19117
|
+
} catch (error) {
|
|
19118
|
+
spinner$5.stop(import_picocolors.default.red("Failed to prepare Notion packs"));
|
|
19119
|
+
await cleanupTempDir(stagingDir).catch(() => {});
|
|
19120
|
+
throw error;
|
|
19121
|
+
}
|
|
19122
|
+
}
|
|
18742
19123
|
async function isSourcePrivate(source) {
|
|
18743
19124
|
const ownerRepo = parseOwnerRepo(source);
|
|
18744
19125
|
if (!ownerRepo) return false;
|
|
@@ -18976,6 +19357,15 @@ function isSkillsShPackUrl(url) {
|
|
|
18976
19357
|
return false;
|
|
18977
19358
|
}
|
|
18978
19359
|
}
|
|
19360
|
+
function logAutoSelectedSkills(entries) {
|
|
19361
|
+
const only = entries.length === 1 ? entries[0] : null;
|
|
19362
|
+
if (!only) {
|
|
19363
|
+
log.info(`Installing all ${entries.length} skills`);
|
|
19364
|
+
return;
|
|
19365
|
+
}
|
|
19366
|
+
log.info(`Skill: ${import_picocolors.default.cyan(only.label)}`);
|
|
19367
|
+
if (only.description) log.message(import_picocolors.default.dim(only.description));
|
|
19368
|
+
}
|
|
18979
19369
|
async function handleWellKnownSkills(source, url, options, spinner) {
|
|
18980
19370
|
spinner.start("Discovering skills from well-known endpoint...");
|
|
18981
19371
|
let skills = [];
|
|
@@ -19011,9 +19401,13 @@ async function handleWellKnownSkills(source, url, options, spinner) {
|
|
|
19011
19401
|
process.exit(0);
|
|
19012
19402
|
}
|
|
19013
19403
|
let selectedSkills;
|
|
19404
|
+
const logWellKnown = (chosen) => logAutoSelectedSkills(chosen.map((s) => ({
|
|
19405
|
+
label: s.installName,
|
|
19406
|
+
description: s.description
|
|
19407
|
+
})));
|
|
19014
19408
|
if (options.skill?.includes("*")) {
|
|
19015
19409
|
selectedSkills = skills;
|
|
19016
|
-
|
|
19410
|
+
logWellKnown(selectedSkills);
|
|
19017
19411
|
} else if (options.skill && options.skill.length > 0) {
|
|
19018
19412
|
selectedSkills = skills.filter((s) => options.skill.some((name) => s.installName.toLowerCase() === name.toLowerCase() || s.name.toLowerCase() === name.toLowerCase()));
|
|
19019
19413
|
if (selectedSkills.length === 0) {
|
|
@@ -19022,13 +19416,9 @@ async function handleWellKnownSkills(source, url, options, spinner) {
|
|
|
19022
19416
|
for (const s of skills) log.message(` - ${s.installName}`);
|
|
19023
19417
|
process.exit(1);
|
|
19024
19418
|
}
|
|
19025
|
-
} else if (skills.length === 1) {
|
|
19026
|
-
selectedSkills = skills;
|
|
19027
|
-
const firstSkill = skills[0];
|
|
19028
|
-
log.info(`Skill: ${import_picocolors.default.cyan(firstSkill.installName)}`);
|
|
19029
|
-
} else if (options.yes) {
|
|
19419
|
+
} else if (skills.length === 1 || options.yes) {
|
|
19030
19420
|
selectedSkills = skills;
|
|
19031
|
-
|
|
19421
|
+
logWellKnown(selectedSkills);
|
|
19032
19422
|
} else {
|
|
19033
19423
|
const selected = await searchMultiselect({
|
|
19034
19424
|
message: "Select skills to install",
|
|
@@ -19337,15 +19727,26 @@ async function runAdd(args, options = {}) {
|
|
|
19337
19727
|
else if (!process.stdin.isTTY) showInstallTip();
|
|
19338
19728
|
let tempDir = null;
|
|
19339
19729
|
try {
|
|
19730
|
+
let effectiveSource = source;
|
|
19731
|
+
let notionSourceLabel = null;
|
|
19732
|
+
const notionSkillPageId = parseNotionSkillUrl(source);
|
|
19733
|
+
if (isNotionSource(source) || notionSkillPageId) {
|
|
19734
|
+
const prepared = notionSkillPageId ? await prepareNotionSkillSource(notionSkillPageId) : await prepareNotionPackSource(options);
|
|
19735
|
+
if (!prepared) return;
|
|
19736
|
+
effectiveSource = prepared.rootDir;
|
|
19737
|
+
tempDir = prepared.tempDir;
|
|
19738
|
+
notionSourceLabel = "packCount" in prepared ? `${prepared.packCount} selected Notion pack${prepared.packCount === 1 ? "" : "s"}` : "Notion page";
|
|
19739
|
+
options.skill = ["*"];
|
|
19740
|
+
}
|
|
19340
19741
|
const spinner$3 = jsonMode ? {
|
|
19341
19742
|
start: () => {},
|
|
19342
19743
|
stop: () => {},
|
|
19343
19744
|
message: () => {}
|
|
19344
19745
|
} : spinner();
|
|
19345
19746
|
spinner$3.start("Parsing source…");
|
|
19346
|
-
const parsed = parseSource(
|
|
19347
|
-
let directDownload = parsed.type === "download";
|
|
19348
|
-
spinner$3.stop(`Source: ${parsed.type === "local" ? parsed.localPath : parsed.url}${parsed.ref ? ` @ ${import_picocolors.default.yellow(parsed.ref)}` : ""}${parsed.subpath ? ` (${parsed.subpath})` : ""}${parsed.skillFilter ? ` ${import_picocolors.default.dim("@")}${import_picocolors.default.cyan(parsed.skillFilter)}` : ""}`);
|
|
19747
|
+
const parsed = parseSource(effectiveSource);
|
|
19748
|
+
let directDownload = parsed.type === "download" || notionSourceLabel !== null;
|
|
19749
|
+
spinner$3.stop(notionSourceLabel !== null ? `Source: ${notionSourceLabel}` : `Source: ${parsed.type === "local" ? parsed.localPath : parsed.url}${parsed.ref ? ` @ ${import_picocolors.default.yellow(parsed.ref)}` : ""}${parsed.subpath ? ` (${parsed.subpath})` : ""}${parsed.skillFilter ? ` ${import_picocolors.default.dim("@")}${import_picocolors.default.cyan(parsed.skillFilter)}` : ""}`);
|
|
19349
19750
|
const ownerRepoRaw = parsed.type === "well-known" || parsed.type === "download" ? null : getOwnerRepo(parsed);
|
|
19350
19751
|
const repoPrivacyPromise = (() => {
|
|
19351
19752
|
if (parsed.type !== "github") return Promise.resolve(null);
|
|
@@ -19475,9 +19876,13 @@ async function runAdd(args, options = {}) {
|
|
|
19475
19876
|
emitJsonAndExit(0);
|
|
19476
19877
|
}
|
|
19477
19878
|
let selectedSkills;
|
|
19879
|
+
const logChosen = (chosen) => logAutoSelectedSkills(chosen.map((s) => ({
|
|
19880
|
+
label: getSkillDisplayName(s),
|
|
19881
|
+
description: s.description
|
|
19882
|
+
})));
|
|
19478
19883
|
if (options.skill?.includes("*")) {
|
|
19479
19884
|
selectedSkills = skills;
|
|
19480
|
-
|
|
19885
|
+
logChosen(selectedSkills);
|
|
19481
19886
|
} else if (options.skill && options.skill.length > 0) {
|
|
19482
19887
|
selectedSkills = filterSkills(skills, options.skill);
|
|
19483
19888
|
if (jsonMode) {
|
|
@@ -19495,14 +19900,9 @@ async function runAdd(args, options = {}) {
|
|
|
19495
19900
|
emitJsonAndExit(1, `No matching skills found for: ${options.skill.join(", ")}`);
|
|
19496
19901
|
}
|
|
19497
19902
|
log.info(`Selected ${selectedSkills.length} skill${selectedSkills.length !== 1 ? "s" : ""}: ${selectedSkills.map((s) => import_picocolors.default.cyan(getSkillDisplayName(s))).join(", ")}`);
|
|
19498
|
-
} else if (skills.length === 1) {
|
|
19499
|
-
selectedSkills = skills;
|
|
19500
|
-
const firstSkill = skills[0];
|
|
19501
|
-
log.info(`Skill: ${import_picocolors.default.cyan(getSkillDisplayName(firstSkill))}`);
|
|
19502
|
-
log.message(import_picocolors.default.dim(firstSkill.description));
|
|
19503
|
-
} else if (options.yes) {
|
|
19903
|
+
} else if (skills.length === 1 || options.yes) {
|
|
19504
19904
|
selectedSkills = skills;
|
|
19505
|
-
|
|
19905
|
+
logChosen(selectedSkills);
|
|
19506
19906
|
} else {
|
|
19507
19907
|
const sortedSkills = [...skills].sort((a, b) => {
|
|
19508
19908
|
if (a.pluginName && !b.pluginName) return -1;
|
|
@@ -21561,7 +21961,7 @@ async function updateGlobalSkills(options = {}) {
|
|
|
21561
21961
|
includeDuplicateNames: true
|
|
21562
21962
|
})).map((skill) => ({
|
|
21563
21963
|
name: skill.name,
|
|
21564
|
-
skillPath: join$1(relative(tempDir, skill.path), "SKILL.md").split(sep$1).join("/")
|
|
21964
|
+
skillPath: join$1(relative$1(tempDir, skill.path), "SKILL.md").split(sep$1).join("/")
|
|
21565
21965
|
}));
|
|
21566
21966
|
const resolution = await checkAndPromptForDeletions(source, Object.entries(lock.skills).filter(([_, entry]) => entry.source === source && entry.ref === firstEntry.ref).map(([name, _]) => name), lock.skills, true, options, discoveredLocations);
|
|
21567
21967
|
const deletedSkillSet = new Set(resolution.deletedSkills);
|
|
@@ -21767,7 +22167,7 @@ async function updateProjectSkills(options = {}) {
|
|
|
21767
22167
|
includeDuplicateNames: true
|
|
21768
22168
|
})).map((skill) => ({
|
|
21769
22169
|
name: skill.name,
|
|
21770
|
-
skillPath: join$1(relative(tempDir, skill.path), "SKILL.md").split(sep$1).join("/")
|
|
22170
|
+
skillPath: join$1(relative$1(tempDir, skill.path), "SKILL.md").split(sep$1).join("/")
|
|
21771
22171
|
}));
|
|
21772
22172
|
const resolution = await checkAndPromptForDeletions(source, allLockedForSource, localLock.skills, false, options, discoveredLocations);
|
|
21773
22173
|
deletedSkills = resolution.deletedSkills;
|
|
@@ -22214,7 +22614,7 @@ async function containsSupportingFiles(rootDir, currentDir) {
|
|
|
22214
22614
|
const entries = await readdir(currentDir, { withFileTypes: true });
|
|
22215
22615
|
for (const entry of entries) {
|
|
22216
22616
|
const entryPath = join$1(currentDir, entry.name);
|
|
22217
|
-
const relPath = relative(rootDir, entryPath).split(sep$1).join("/");
|
|
22617
|
+
const relPath = relative$1(rootDir, entryPath).split(sep$1).join("/");
|
|
22218
22618
|
if (entry.isDirectory()) {
|
|
22219
22619
|
if (await containsSupportingFiles(rootDir, entryPath)) return true;
|
|
22220
22620
|
} else if (relPath.toLowerCase() !== "skill.md") return true;
|
|
@@ -22285,6 +22685,8 @@ ${BOLD}Usage:${RESET} skills <command> [options]
|
|
|
22285
22685
|
${BOLD}Manage Skills:${RESET}
|
|
22286
22686
|
add <package> Add a skill package (alias: a)
|
|
22287
22687
|
e.g. vercel-labs/agent-skills
|
|
22688
|
+
notion
|
|
22689
|
+
https://notion.so/<skill-page>
|
|
22288
22690
|
https://github.com/vercel-labs/agent-skills
|
|
22289
22691
|
use <package>@<skill>
|
|
22290
22692
|
Generate a prompt for using one skill without installing it
|
|
@@ -22540,7 +22942,7 @@ async function main() {
|
|
|
22540
22942
|
process.exitCode = 1;
|
|
22541
22943
|
}
|
|
22542
22944
|
}
|
|
22543
|
-
var import_dist, import_picocolors, DEFAULT_GITHUB_HOST, SOURCE_ALIASES, CSI_RE, OSC_RE, DCS_PM_APC_RE, SIMPLE_ESC_RE, C1_RE, CONTROL_RE, silentOutput, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_SUBMIT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_BULLET, S_BAR, S_BAR_H, cancelSymbol, DEFAULT_CLONE_TIMEOUT_MS, ALLOWED_GIT_PROTOCOLS, CLONE_TIMEOUT_MS, execFileAsync, GitCloneError, LOCAL_LOCK_FILE, CURRENT_VERSION$1, AGENTS_DIR$1, SKILLS_SUBDIR, SKIP_DIRS, AGENT_PROJECT_SKILL_DIRS, home, configHome, codexHome, claudeHome, vibeHome, hermesHome, autohandHome, grokHome, sarvamHome, zedAppDataHome, zedFlatpakConfigHome, agents, EVE_SUBAGENTS_DIR, EXCLUDE_FILES$1, EXCLUDE_DIRS$1, isExcluded$1, TELEMETRY_URL, AUDIT_URL, cliVersion, detectedAgentName, pendingTelemetry, import_dist$1, cachedResult, agentNameToType, ProviderRegistryImpl, ZIP_LOCAL_FILE_HEADER, ZIP_CENTRAL_DIRECTORY_HEADER, ZIP_END_OF_CENTRAL_DIRECTORY, ZIP64_END_OF_CENTRAL_DIRECTORY, ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR, ZIP_END_MIN_SIZE, ZIP_MAX_COMMENT_SIZE, CP437_HIGH_BYTES, ArchiveValidationError, DISCOVERY_SCHEMA_V2, MAX_ARCHIVE_UNPACKED_BYTES, MAX_ARCHIVE_FILES, DISCOVERY_TIMEOUT_MS, WellKnownScopeNotFoundError, WellKnownProvider, wellKnownProvider, DEFAULT_DOWNLOAD_MAX_BYTES, DEFAULT_EXTRACT_MAX_BYTES, DEFAULT_EXTRACT_MAX_FILES, FETCH_TIMEOUT_MS, AGENTS_DIR, LOCK_FILE, CURRENT_VERSION, DOWNLOAD_BASE_URL, BLOB_ALLOWED_REPOS, FETCH_TIMEOUT, GH_API_MAX_BUFFER, _rateLimitedThisSession, PRIORITY_PREFIXES, SNAPSHOT_EXCLUDED_FILES, SNAPSHOT_EXCLUDED_DIRS, version$1, isCancelled$1, EVE_AGENT_LABEL, RESET$3, BOLD$3, DIM$3, TEXT$2, CYAN$1, SEARCH_API_BASE, SEARCH_RESULT_LIMIT, GITHUB_OWNER_PATTERN, HIDE_CURSOR, SHOW_CURSOR, CLEAR_DOWN, MOVE_UP, MOVE_TO_COL, isCancelled, RESET$2, BOLD$2, DIM$2, CYAN, YELLOW, __dirname$1, RESET$1, BOLD$1, DIM$1, TEXT$1, BLOB_ALLOWED_OWNERS, EXCLUDE_FILES, EXCLUDE_DIRS, USE_AGENT_CONFIGS, SUPPORTED_USE_AGENTS, UseCommandError, __dirname, VERSION, RESET, BOLD, DIM, TEXT, LOGO_LINES, GRAYS;
|
|
22945
|
+
var import_dist, import_picocolors, DEFAULT_GITHUB_HOST, SOURCE_ALIASES, CSI_RE, OSC_RE, DCS_PM_APC_RE, SIMPLE_ESC_RE, C1_RE, CONTROL_RE, silentOutput, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_SUBMIT, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_BULLET, S_BAR, S_BAR_H, cancelSymbol, DEFAULT_CLONE_TIMEOUT_MS, ALLOWED_GIT_PROTOCOLS, CLONE_TIMEOUT_MS, execFileAsync, GitCloneError, LOCAL_LOCK_FILE, CURRENT_VERSION$1, AGENTS_DIR$1, SKILLS_SUBDIR, SKIP_DIRS, AGENT_PROJECT_SKILL_DIRS, home, configHome, codexHome, claudeHome, vibeHome, hermesHome, autohandHome, grokHome, sarvamHome, zedAppDataHome, zedFlatpakConfigHome, agents, EVE_SUBAGENTS_DIR, EXCLUDE_FILES$1, EXCLUDE_DIRS$1, isExcluded$1, TELEMETRY_URL, AUDIT_URL, cliVersion, detectedAgentName, pendingTelemetry, import_dist$1, cachedResult, agentNameToType, ProviderRegistryImpl, ZIP_LOCAL_FILE_HEADER, ZIP_CENTRAL_DIRECTORY_HEADER, ZIP_END_OF_CENTRAL_DIRECTORY, ZIP64_END_OF_CENTRAL_DIRECTORY, ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR, ZIP_END_MIN_SIZE, ZIP_MAX_COMMENT_SIZE, CP437_HIGH_BYTES, ArchiveValidationError, DISCOVERY_SCHEMA_V2, MAX_ARCHIVE_UNPACKED_BYTES, MAX_ARCHIVE_FILES, DISCOVERY_TIMEOUT_MS, WellKnownScopeNotFoundError, WellKnownProvider, wellKnownProvider, DEFAULT_DOWNLOAD_MAX_BYTES, DEFAULT_EXTRACT_MAX_BYTES, DEFAULT_EXTRACT_MAX_FILES, FETCH_TIMEOUT_MS, AGENTS_DIR, LOCK_FILE, CURRENT_VERSION, DOWNLOAD_BASE_URL, BLOB_ALLOWED_REPOS, FETCH_TIMEOUT, GH_API_MAX_BUFFER, _rateLimitedThisSession, PRIORITY_PREFIXES, SNAPSHOT_EXCLUDED_FILES, SNAPSHOT_EXCLUDED_DIRS, version$1, NOTION_API_VERSION, NTN_TIMEOUT_MS, NTN_MAX_BUFFER_BYTES, NOTION_DOWNLOAD_MAX_BYTES, NOTION_EXTRACT_MAX_BYTES, NOTION_EXTRACT_MAX_FILES, NOTION_HOSTNAME, NOTION_PAGE_ID, isCancelled$1, EVE_AGENT_LABEL, RESET$3, BOLD$3, DIM$3, TEXT$2, CYAN$1, SEARCH_API_BASE, SEARCH_RESULT_LIMIT, GITHUB_OWNER_PATTERN, HIDE_CURSOR, SHOW_CURSOR, CLEAR_DOWN, MOVE_UP, MOVE_TO_COL, isCancelled, RESET$2, BOLD$2, DIM$2, CYAN, YELLOW, __dirname$1, RESET$1, BOLD$1, DIM$1, TEXT$1, BLOB_ALLOWED_OWNERS, EXCLUDE_FILES, EXCLUDE_DIRS, USE_AGENT_CONFIGS, SUPPORTED_USE_AGENTS, UseCommandError, __dirname, VERSION, RESET, BOLD, DIM, TEXT, LOGO_LINES, GRAYS;
|
|
22544
22946
|
var init_cli = __esmMin((() => {
|
|
22545
22947
|
init_rolldown_runtime();
|
|
22546
22948
|
init_core();
|
|
@@ -23938,7 +24340,15 @@ var init_cli = __esmMin((() => {
|
|
|
23938
24340
|
"__pycache__",
|
|
23939
24341
|
"__pypackages__"
|
|
23940
24342
|
]);
|
|
23941
|
-
version$1 = "1.
|
|
24343
|
+
version$1 = "1.7.0";
|
|
24344
|
+
NOTION_API_VERSION = "2026-03-11";
|
|
24345
|
+
NTN_TIMEOUT_MS = 3e4;
|
|
24346
|
+
NTN_MAX_BUFFER_BYTES = 10485760;
|
|
24347
|
+
NOTION_DOWNLOAD_MAX_BYTES = 52428800;
|
|
24348
|
+
NOTION_EXTRACT_MAX_BYTES = 104857600;
|
|
24349
|
+
NOTION_EXTRACT_MAX_FILES = 5e3;
|
|
24350
|
+
NOTION_HOSTNAME = /(^|\.)notion\.(so|com)$/;
|
|
24351
|
+
NOTION_PAGE_ID = /(?:^|-)([0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/;
|
|
23942
24352
|
isCancelled$1 = (value) => typeof value === "symbol";
|
|
23943
24353
|
EVE_AGENT_LABEL = "eve agent";
|
|
23944
24354
|
setVersion(version$1);
|
|
@@ -24020,7 +24430,7 @@ var init_cli = __esmMin((() => {
|
|
|
24020
24430
|
main().finally(() => flushTelemetry().then(() => process.exit(process.exitCode ?? 0)));
|
|
24021
24431
|
}));
|
|
24022
24432
|
//#endregion
|
|
24023
|
-
//#region ../../node_modules/.pnpm/skills@1.
|
|
24433
|
+
//#region ../../node_modules/.pnpm/skills@1.7.0/node_modules/skills/bin/cli.mjs
|
|
24024
24434
|
if (module.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) try {
|
|
24025
24435
|
module.enableCompileCache();
|
|
24026
24436
|
} catch {}
|