@tec-explorer/skillpot 0.5.0 → 0.6.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/CHANGELOG.md +19 -0
- package/dist/cli.mjs +413 -201
- package/dist/gui/assets/index-BrbHzdSV.css +1 -0
- package/dist/gui/assets/index-DoUp5wXM.js +40 -0
- package/dist/gui/index.html +2 -2
- package/package.json +2 -2
- package/dist/gui/assets/index-BIwPQu5N.css +0 -1
- package/dist/gui/assets/index-v6gMshP7.js +0 -40
package/dist/cli.mjs
CHANGED
|
@@ -973,8 +973,8 @@ var require_command = __commonJS({
|
|
|
973
973
|
"node_modules/commander/lib/command.js"(exports) {
|
|
974
974
|
var EventEmitter3 = __require("node:events").EventEmitter;
|
|
975
975
|
var childProcess = __require("node:child_process");
|
|
976
|
-
var
|
|
977
|
-
var
|
|
976
|
+
var path17 = __require("node:path");
|
|
977
|
+
var fs15 = __require("node:fs");
|
|
978
978
|
var process13 = __require("node:process");
|
|
979
979
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
980
980
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1906,11 +1906,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1906
1906
|
let launchWithNode = false;
|
|
1907
1907
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1908
1908
|
function findFile(baseDir, baseName) {
|
|
1909
|
-
const localBin =
|
|
1910
|
-
if (
|
|
1911
|
-
if (sourceExt.includes(
|
|
1909
|
+
const localBin = path17.resolve(baseDir, baseName);
|
|
1910
|
+
if (fs15.existsSync(localBin)) return localBin;
|
|
1911
|
+
if (sourceExt.includes(path17.extname(baseName))) return void 0;
|
|
1912
1912
|
const foundExt = sourceExt.find(
|
|
1913
|
-
(ext) =>
|
|
1913
|
+
(ext) => fs15.existsSync(`${localBin}${ext}`)
|
|
1914
1914
|
);
|
|
1915
1915
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1916
1916
|
return void 0;
|
|
@@ -1922,21 +1922,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1922
1922
|
if (this._scriptPath) {
|
|
1923
1923
|
let resolvedScriptPath;
|
|
1924
1924
|
try {
|
|
1925
|
-
resolvedScriptPath =
|
|
1925
|
+
resolvedScriptPath = fs15.realpathSync(this._scriptPath);
|
|
1926
1926
|
} catch (err) {
|
|
1927
1927
|
resolvedScriptPath = this._scriptPath;
|
|
1928
1928
|
}
|
|
1929
|
-
executableDir =
|
|
1930
|
-
|
|
1929
|
+
executableDir = path17.resolve(
|
|
1930
|
+
path17.dirname(resolvedScriptPath),
|
|
1931
1931
|
executableDir
|
|
1932
1932
|
);
|
|
1933
1933
|
}
|
|
1934
1934
|
if (executableDir) {
|
|
1935
1935
|
let localFile = findFile(executableDir, executableFile);
|
|
1936
1936
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1937
|
-
const legacyName =
|
|
1937
|
+
const legacyName = path17.basename(
|
|
1938
1938
|
this._scriptPath,
|
|
1939
|
-
|
|
1939
|
+
path17.extname(this._scriptPath)
|
|
1940
1940
|
);
|
|
1941
1941
|
if (legacyName !== this._name) {
|
|
1942
1942
|
localFile = findFile(
|
|
@@ -1947,7 +1947,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1947
1947
|
}
|
|
1948
1948
|
executableFile = localFile || executableFile;
|
|
1949
1949
|
}
|
|
1950
|
-
launchWithNode = sourceExt.includes(
|
|
1950
|
+
launchWithNode = sourceExt.includes(path17.extname(executableFile));
|
|
1951
1951
|
let proc;
|
|
1952
1952
|
if (process13.platform !== "win32") {
|
|
1953
1953
|
if (launchWithNode) {
|
|
@@ -2787,7 +2787,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2787
2787
|
* @return {Command}
|
|
2788
2788
|
*/
|
|
2789
2789
|
nameFromFilename(filename) {
|
|
2790
|
-
this._name =
|
|
2790
|
+
this._name = path17.basename(filename, path17.extname(filename));
|
|
2791
2791
|
return this;
|
|
2792
2792
|
}
|
|
2793
2793
|
/**
|
|
@@ -2801,9 +2801,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2801
2801
|
* @param {string} [path]
|
|
2802
2802
|
* @return {(string|null|Command)}
|
|
2803
2803
|
*/
|
|
2804
|
-
executableDir(
|
|
2805
|
-
if (
|
|
2806
|
-
this._executableDir =
|
|
2804
|
+
executableDir(path18) {
|
|
2805
|
+
if (path18 === void 0) return this._executableDir;
|
|
2806
|
+
this._executableDir = path18;
|
|
2807
2807
|
return this;
|
|
2808
2808
|
}
|
|
2809
2809
|
/**
|
|
@@ -3182,17 +3182,17 @@ var require_visit = __commonJS({
|
|
|
3182
3182
|
visit.BREAK = BREAK;
|
|
3183
3183
|
visit.SKIP = SKIP;
|
|
3184
3184
|
visit.REMOVE = REMOVE;
|
|
3185
|
-
function visit_(key, node, visitor,
|
|
3186
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
3185
|
+
function visit_(key, node, visitor, path17) {
|
|
3186
|
+
const ctrl = callVisitor(key, node, visitor, path17);
|
|
3187
3187
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3188
|
-
replaceNode(key,
|
|
3189
|
-
return visit_(key, ctrl, visitor,
|
|
3188
|
+
replaceNode(key, path17, ctrl);
|
|
3189
|
+
return visit_(key, ctrl, visitor, path17);
|
|
3190
3190
|
}
|
|
3191
3191
|
if (typeof ctrl !== "symbol") {
|
|
3192
3192
|
if (identity.isCollection(node)) {
|
|
3193
|
-
|
|
3193
|
+
path17 = Object.freeze(path17.concat(node));
|
|
3194
3194
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3195
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
3195
|
+
const ci = visit_(i, node.items[i], visitor, path17);
|
|
3196
3196
|
if (typeof ci === "number")
|
|
3197
3197
|
i = ci - 1;
|
|
3198
3198
|
else if (ci === BREAK)
|
|
@@ -3203,13 +3203,13 @@ var require_visit = __commonJS({
|
|
|
3203
3203
|
}
|
|
3204
3204
|
}
|
|
3205
3205
|
} else if (identity.isPair(node)) {
|
|
3206
|
-
|
|
3207
|
-
const ck = visit_("key", node.key, visitor,
|
|
3206
|
+
path17 = Object.freeze(path17.concat(node));
|
|
3207
|
+
const ck = visit_("key", node.key, visitor, path17);
|
|
3208
3208
|
if (ck === BREAK)
|
|
3209
3209
|
return BREAK;
|
|
3210
3210
|
else if (ck === REMOVE)
|
|
3211
3211
|
node.key = null;
|
|
3212
|
-
const cv = visit_("value", node.value, visitor,
|
|
3212
|
+
const cv = visit_("value", node.value, visitor, path17);
|
|
3213
3213
|
if (cv === BREAK)
|
|
3214
3214
|
return BREAK;
|
|
3215
3215
|
else if (cv === REMOVE)
|
|
@@ -3230,17 +3230,17 @@ var require_visit = __commonJS({
|
|
|
3230
3230
|
visitAsync.BREAK = BREAK;
|
|
3231
3231
|
visitAsync.SKIP = SKIP;
|
|
3232
3232
|
visitAsync.REMOVE = REMOVE;
|
|
3233
|
-
async function visitAsync_(key, node, visitor,
|
|
3234
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3233
|
+
async function visitAsync_(key, node, visitor, path17) {
|
|
3234
|
+
const ctrl = await callVisitor(key, node, visitor, path17);
|
|
3235
3235
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
3236
|
-
replaceNode(key,
|
|
3237
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3236
|
+
replaceNode(key, path17, ctrl);
|
|
3237
|
+
return visitAsync_(key, ctrl, visitor, path17);
|
|
3238
3238
|
}
|
|
3239
3239
|
if (typeof ctrl !== "symbol") {
|
|
3240
3240
|
if (identity.isCollection(node)) {
|
|
3241
|
-
|
|
3241
|
+
path17 = Object.freeze(path17.concat(node));
|
|
3242
3242
|
for (let i = 0; i < node.items.length; ++i) {
|
|
3243
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
3243
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path17);
|
|
3244
3244
|
if (typeof ci === "number")
|
|
3245
3245
|
i = ci - 1;
|
|
3246
3246
|
else if (ci === BREAK)
|
|
@@ -3251,13 +3251,13 @@ var require_visit = __commonJS({
|
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
3253
|
} else if (identity.isPair(node)) {
|
|
3254
|
-
|
|
3255
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3254
|
+
path17 = Object.freeze(path17.concat(node));
|
|
3255
|
+
const ck = await visitAsync_("key", node.key, visitor, path17);
|
|
3256
3256
|
if (ck === BREAK)
|
|
3257
3257
|
return BREAK;
|
|
3258
3258
|
else if (ck === REMOVE)
|
|
3259
3259
|
node.key = null;
|
|
3260
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3260
|
+
const cv = await visitAsync_("value", node.value, visitor, path17);
|
|
3261
3261
|
if (cv === BREAK)
|
|
3262
3262
|
return BREAK;
|
|
3263
3263
|
else if (cv === REMOVE)
|
|
@@ -3284,23 +3284,23 @@ var require_visit = __commonJS({
|
|
|
3284
3284
|
}
|
|
3285
3285
|
return visitor;
|
|
3286
3286
|
}
|
|
3287
|
-
function callVisitor(key, node, visitor,
|
|
3287
|
+
function callVisitor(key, node, visitor, path17) {
|
|
3288
3288
|
if (typeof visitor === "function")
|
|
3289
|
-
return visitor(key, node,
|
|
3289
|
+
return visitor(key, node, path17);
|
|
3290
3290
|
if (identity.isMap(node))
|
|
3291
|
-
return visitor.Map?.(key, node,
|
|
3291
|
+
return visitor.Map?.(key, node, path17);
|
|
3292
3292
|
if (identity.isSeq(node))
|
|
3293
|
-
return visitor.Seq?.(key, node,
|
|
3293
|
+
return visitor.Seq?.(key, node, path17);
|
|
3294
3294
|
if (identity.isPair(node))
|
|
3295
|
-
return visitor.Pair?.(key, node,
|
|
3295
|
+
return visitor.Pair?.(key, node, path17);
|
|
3296
3296
|
if (identity.isScalar(node))
|
|
3297
|
-
return visitor.Scalar?.(key, node,
|
|
3297
|
+
return visitor.Scalar?.(key, node, path17);
|
|
3298
3298
|
if (identity.isAlias(node))
|
|
3299
|
-
return visitor.Alias?.(key, node,
|
|
3299
|
+
return visitor.Alias?.(key, node, path17);
|
|
3300
3300
|
return void 0;
|
|
3301
3301
|
}
|
|
3302
|
-
function replaceNode(key,
|
|
3303
|
-
const parent =
|
|
3302
|
+
function replaceNode(key, path17, node) {
|
|
3303
|
+
const parent = path17[path17.length - 1];
|
|
3304
3304
|
if (identity.isCollection(parent)) {
|
|
3305
3305
|
parent.items[key] = node;
|
|
3306
3306
|
} else if (identity.isPair(parent)) {
|
|
@@ -3910,10 +3910,10 @@ var require_Collection = __commonJS({
|
|
|
3910
3910
|
var createNode2 = require_createNode();
|
|
3911
3911
|
var identity = require_identity();
|
|
3912
3912
|
var Node = require_Node();
|
|
3913
|
-
function collectionFromPath(schema,
|
|
3913
|
+
function collectionFromPath(schema, path17, value) {
|
|
3914
3914
|
let v = value;
|
|
3915
|
-
for (let i =
|
|
3916
|
-
const k =
|
|
3915
|
+
for (let i = path17.length - 1; i >= 0; --i) {
|
|
3916
|
+
const k = path17[i];
|
|
3917
3917
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
3918
3918
|
const a = [];
|
|
3919
3919
|
a[k] = v;
|
|
@@ -3932,7 +3932,7 @@ var require_Collection = __commonJS({
|
|
|
3932
3932
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
3933
3933
|
});
|
|
3934
3934
|
}
|
|
3935
|
-
var isEmptyPath = (
|
|
3935
|
+
var isEmptyPath = (path17) => path17 == null || typeof path17 === "object" && !!path17[Symbol.iterator]().next().done;
|
|
3936
3936
|
var Collection = class extends Node.NodeBase {
|
|
3937
3937
|
constructor(type, schema) {
|
|
3938
3938
|
super(type);
|
|
@@ -3962,11 +3962,11 @@ var require_Collection = __commonJS({
|
|
|
3962
3962
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
3963
3963
|
* that already exists in the map.
|
|
3964
3964
|
*/
|
|
3965
|
-
addIn(
|
|
3966
|
-
if (isEmptyPath(
|
|
3965
|
+
addIn(path17, value) {
|
|
3966
|
+
if (isEmptyPath(path17))
|
|
3967
3967
|
this.add(value);
|
|
3968
3968
|
else {
|
|
3969
|
-
const [key, ...rest] =
|
|
3969
|
+
const [key, ...rest] = path17;
|
|
3970
3970
|
const node = this.get(key, true);
|
|
3971
3971
|
if (identity.isCollection(node))
|
|
3972
3972
|
node.addIn(rest, value);
|
|
@@ -3980,8 +3980,8 @@ var require_Collection = __commonJS({
|
|
|
3980
3980
|
* Removes a value from the collection.
|
|
3981
3981
|
* @returns `true` if the item was found and removed.
|
|
3982
3982
|
*/
|
|
3983
|
-
deleteIn(
|
|
3984
|
-
const [key, ...rest] =
|
|
3983
|
+
deleteIn(path17) {
|
|
3984
|
+
const [key, ...rest] = path17;
|
|
3985
3985
|
if (rest.length === 0)
|
|
3986
3986
|
return this.delete(key);
|
|
3987
3987
|
const node = this.get(key, true);
|
|
@@ -3995,8 +3995,8 @@ var require_Collection = __commonJS({
|
|
|
3995
3995
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3996
3996
|
* `true` (collections are always returned intact).
|
|
3997
3997
|
*/
|
|
3998
|
-
getIn(
|
|
3999
|
-
const [key, ...rest] =
|
|
3998
|
+
getIn(path17, keepScalar) {
|
|
3999
|
+
const [key, ...rest] = path17;
|
|
4000
4000
|
const node = this.get(key, true);
|
|
4001
4001
|
if (rest.length === 0)
|
|
4002
4002
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -4014,8 +4014,8 @@ var require_Collection = __commonJS({
|
|
|
4014
4014
|
/**
|
|
4015
4015
|
* Checks if the collection includes a value with the key `key`.
|
|
4016
4016
|
*/
|
|
4017
|
-
hasIn(
|
|
4018
|
-
const [key, ...rest] =
|
|
4017
|
+
hasIn(path17) {
|
|
4018
|
+
const [key, ...rest] = path17;
|
|
4019
4019
|
if (rest.length === 0)
|
|
4020
4020
|
return this.has(key);
|
|
4021
4021
|
const node = this.get(key, true);
|
|
@@ -4025,8 +4025,8 @@ var require_Collection = __commonJS({
|
|
|
4025
4025
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
4026
4026
|
* boolean to add/remove the item from the set.
|
|
4027
4027
|
*/
|
|
4028
|
-
setIn(
|
|
4029
|
-
const [key, ...rest] =
|
|
4028
|
+
setIn(path17, value) {
|
|
4029
|
+
const [key, ...rest] = path17;
|
|
4030
4030
|
if (rest.length === 0) {
|
|
4031
4031
|
this.set(key, value);
|
|
4032
4032
|
} else {
|
|
@@ -6541,9 +6541,9 @@ var require_Document = __commonJS({
|
|
|
6541
6541
|
this.contents.add(value);
|
|
6542
6542
|
}
|
|
6543
6543
|
/** Adds a value to the document. */
|
|
6544
|
-
addIn(
|
|
6544
|
+
addIn(path17, value) {
|
|
6545
6545
|
if (assertCollection(this.contents))
|
|
6546
|
-
this.contents.addIn(
|
|
6546
|
+
this.contents.addIn(path17, value);
|
|
6547
6547
|
}
|
|
6548
6548
|
/**
|
|
6549
6549
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -6618,14 +6618,14 @@ var require_Document = __commonJS({
|
|
|
6618
6618
|
* Removes a value from the document.
|
|
6619
6619
|
* @returns `true` if the item was found and removed.
|
|
6620
6620
|
*/
|
|
6621
|
-
deleteIn(
|
|
6622
|
-
if (Collection.isEmptyPath(
|
|
6621
|
+
deleteIn(path17) {
|
|
6622
|
+
if (Collection.isEmptyPath(path17)) {
|
|
6623
6623
|
if (this.contents == null)
|
|
6624
6624
|
return false;
|
|
6625
6625
|
this.contents = null;
|
|
6626
6626
|
return true;
|
|
6627
6627
|
}
|
|
6628
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
6628
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path17) : false;
|
|
6629
6629
|
}
|
|
6630
6630
|
/**
|
|
6631
6631
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -6640,10 +6640,10 @@ var require_Document = __commonJS({
|
|
|
6640
6640
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
6641
6641
|
* `true` (collections are always returned intact).
|
|
6642
6642
|
*/
|
|
6643
|
-
getIn(
|
|
6644
|
-
if (Collection.isEmptyPath(
|
|
6643
|
+
getIn(path17, keepScalar) {
|
|
6644
|
+
if (Collection.isEmptyPath(path17))
|
|
6645
6645
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
6646
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
6646
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path17, keepScalar) : void 0;
|
|
6647
6647
|
}
|
|
6648
6648
|
/**
|
|
6649
6649
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -6654,10 +6654,10 @@ var require_Document = __commonJS({
|
|
|
6654
6654
|
/**
|
|
6655
6655
|
* Checks if the document includes a value at `path`.
|
|
6656
6656
|
*/
|
|
6657
|
-
hasIn(
|
|
6658
|
-
if (Collection.isEmptyPath(
|
|
6657
|
+
hasIn(path17) {
|
|
6658
|
+
if (Collection.isEmptyPath(path17))
|
|
6659
6659
|
return this.contents !== void 0;
|
|
6660
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
6660
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path17) : false;
|
|
6661
6661
|
}
|
|
6662
6662
|
/**
|
|
6663
6663
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -6674,13 +6674,13 @@ var require_Document = __commonJS({
|
|
|
6674
6674
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
6675
6675
|
* boolean to add/remove the item from the set.
|
|
6676
6676
|
*/
|
|
6677
|
-
setIn(
|
|
6678
|
-
if (Collection.isEmptyPath(
|
|
6677
|
+
setIn(path17, value) {
|
|
6678
|
+
if (Collection.isEmptyPath(path17)) {
|
|
6679
6679
|
this.contents = value;
|
|
6680
6680
|
} else if (this.contents == null) {
|
|
6681
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
6681
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path17), value);
|
|
6682
6682
|
} else if (assertCollection(this.contents)) {
|
|
6683
|
-
this.contents.setIn(
|
|
6683
|
+
this.contents.setIn(path17, value);
|
|
6684
6684
|
}
|
|
6685
6685
|
}
|
|
6686
6686
|
/**
|
|
@@ -8640,9 +8640,9 @@ var require_cst_visit = __commonJS({
|
|
|
8640
8640
|
visit.BREAK = BREAK;
|
|
8641
8641
|
visit.SKIP = SKIP;
|
|
8642
8642
|
visit.REMOVE = REMOVE;
|
|
8643
|
-
visit.itemAtPath = (cst,
|
|
8643
|
+
visit.itemAtPath = (cst, path17) => {
|
|
8644
8644
|
let item = cst;
|
|
8645
|
-
for (const [field, index] of
|
|
8645
|
+
for (const [field, index] of path17) {
|
|
8646
8646
|
const tok = item?.[field];
|
|
8647
8647
|
if (tok && "items" in tok) {
|
|
8648
8648
|
item = tok.items[index];
|
|
@@ -8651,23 +8651,23 @@ var require_cst_visit = __commonJS({
|
|
|
8651
8651
|
}
|
|
8652
8652
|
return item;
|
|
8653
8653
|
};
|
|
8654
|
-
visit.parentCollection = (cst,
|
|
8655
|
-
const parent = visit.itemAtPath(cst,
|
|
8656
|
-
const field =
|
|
8654
|
+
visit.parentCollection = (cst, path17) => {
|
|
8655
|
+
const parent = visit.itemAtPath(cst, path17.slice(0, -1));
|
|
8656
|
+
const field = path17[path17.length - 1][0];
|
|
8657
8657
|
const coll = parent?.[field];
|
|
8658
8658
|
if (coll && "items" in coll)
|
|
8659
8659
|
return coll;
|
|
8660
8660
|
throw new Error("Parent collection not found");
|
|
8661
8661
|
};
|
|
8662
|
-
function _visit(
|
|
8663
|
-
let ctrl = visitor(item,
|
|
8662
|
+
function _visit(path17, item, visitor) {
|
|
8663
|
+
let ctrl = visitor(item, path17);
|
|
8664
8664
|
if (typeof ctrl === "symbol")
|
|
8665
8665
|
return ctrl;
|
|
8666
8666
|
for (const field of ["key", "value"]) {
|
|
8667
8667
|
const token = item[field];
|
|
8668
8668
|
if (token && "items" in token) {
|
|
8669
8669
|
for (let i = 0; i < token.items.length; ++i) {
|
|
8670
|
-
const ci = _visit(Object.freeze(
|
|
8670
|
+
const ci = _visit(Object.freeze(path17.concat([[field, i]])), token.items[i], visitor);
|
|
8671
8671
|
if (typeof ci === "number")
|
|
8672
8672
|
i = ci - 1;
|
|
8673
8673
|
else if (ci === BREAK)
|
|
@@ -8678,10 +8678,10 @@ var require_cst_visit = __commonJS({
|
|
|
8678
8678
|
}
|
|
8679
8679
|
}
|
|
8680
8680
|
if (typeof ctrl === "function" && field === "key")
|
|
8681
|
-
ctrl = ctrl(item,
|
|
8681
|
+
ctrl = ctrl(item, path17);
|
|
8682
8682
|
}
|
|
8683
8683
|
}
|
|
8684
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
8684
|
+
return typeof ctrl === "function" ? ctrl(item, path17) : ctrl;
|
|
8685
8685
|
}
|
|
8686
8686
|
exports.visit = visit;
|
|
8687
8687
|
}
|
|
@@ -9983,14 +9983,14 @@ var require_parser = __commonJS({
|
|
|
9983
9983
|
case "scalar":
|
|
9984
9984
|
case "single-quoted-scalar":
|
|
9985
9985
|
case "double-quoted-scalar": {
|
|
9986
|
-
const
|
|
9986
|
+
const fs15 = this.flowScalar(this.type);
|
|
9987
9987
|
if (atNextItem || it.value) {
|
|
9988
|
-
map.items.push({ start, key:
|
|
9988
|
+
map.items.push({ start, key: fs15, sep: [] });
|
|
9989
9989
|
this.onKeyLine = true;
|
|
9990
9990
|
} else if (it.sep) {
|
|
9991
|
-
this.stack.push(
|
|
9991
|
+
this.stack.push(fs15);
|
|
9992
9992
|
} else {
|
|
9993
|
-
Object.assign(it, { key:
|
|
9993
|
+
Object.assign(it, { key: fs15, sep: [] });
|
|
9994
9994
|
this.onKeyLine = true;
|
|
9995
9995
|
}
|
|
9996
9996
|
return;
|
|
@@ -10118,13 +10118,13 @@ var require_parser = __commonJS({
|
|
|
10118
10118
|
case "scalar":
|
|
10119
10119
|
case "single-quoted-scalar":
|
|
10120
10120
|
case "double-quoted-scalar": {
|
|
10121
|
-
const
|
|
10121
|
+
const fs15 = this.flowScalar(this.type);
|
|
10122
10122
|
if (!it || it.value)
|
|
10123
|
-
fc.items.push({ start: [], key:
|
|
10123
|
+
fc.items.push({ start: [], key: fs15, sep: [] });
|
|
10124
10124
|
else if (it.sep)
|
|
10125
|
-
this.stack.push(
|
|
10125
|
+
this.stack.push(fs15);
|
|
10126
10126
|
else
|
|
10127
|
-
Object.assign(it, { key:
|
|
10127
|
+
Object.assign(it, { key: fs15, sep: [] });
|
|
10128
10128
|
return;
|
|
10129
10129
|
}
|
|
10130
10130
|
case "flow-map-end":
|
|
@@ -33138,10 +33138,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
33138
33138
|
var setErrorHandler = null;
|
|
33139
33139
|
var setSuspenseHandler = null;
|
|
33140
33140
|
{
|
|
33141
|
-
var copyWithDeleteImpl = function(obj,
|
|
33142
|
-
var key =
|
|
33141
|
+
var copyWithDeleteImpl = function(obj, path17, index2) {
|
|
33142
|
+
var key = path17[index2];
|
|
33143
33143
|
var updated = isArray(obj) ? obj.slice() : assign({}, obj);
|
|
33144
|
-
if (index2 + 1 ===
|
|
33144
|
+
if (index2 + 1 === path17.length) {
|
|
33145
33145
|
if (isArray(updated)) {
|
|
33146
33146
|
updated.splice(key, 1);
|
|
33147
33147
|
} else {
|
|
@@ -33149,11 +33149,11 @@ var require_react_reconciler_development = __commonJS({
|
|
|
33149
33149
|
}
|
|
33150
33150
|
return updated;
|
|
33151
33151
|
}
|
|
33152
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
33152
|
+
updated[key] = copyWithDeleteImpl(obj[key], path17, index2 + 1);
|
|
33153
33153
|
return updated;
|
|
33154
33154
|
};
|
|
33155
|
-
var copyWithDelete = function(obj,
|
|
33156
|
-
return copyWithDeleteImpl(obj,
|
|
33155
|
+
var copyWithDelete = function(obj, path17) {
|
|
33156
|
+
return copyWithDeleteImpl(obj, path17, 0);
|
|
33157
33157
|
};
|
|
33158
33158
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
33159
33159
|
var oldKey = oldPath[index2];
|
|
@@ -33191,17 +33191,17 @@ var require_react_reconciler_development = __commonJS({
|
|
|
33191
33191
|
}
|
|
33192
33192
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
33193
33193
|
};
|
|
33194
|
-
var copyWithSetImpl = function(obj,
|
|
33195
|
-
if (index2 >=
|
|
33194
|
+
var copyWithSetImpl = function(obj, path17, index2, value) {
|
|
33195
|
+
if (index2 >= path17.length) {
|
|
33196
33196
|
return value;
|
|
33197
33197
|
}
|
|
33198
|
-
var key =
|
|
33198
|
+
var key = path17[index2];
|
|
33199
33199
|
var updated = isArray(obj) ? obj.slice() : assign({}, obj);
|
|
33200
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
33200
|
+
updated[key] = copyWithSetImpl(obj[key], path17, index2 + 1, value);
|
|
33201
33201
|
return updated;
|
|
33202
33202
|
};
|
|
33203
|
-
var copyWithSet = function(obj,
|
|
33204
|
-
return copyWithSetImpl(obj,
|
|
33203
|
+
var copyWithSet = function(obj, path17, value) {
|
|
33204
|
+
return copyWithSetImpl(obj, path17, 0, value);
|
|
33205
33205
|
};
|
|
33206
33206
|
var findHook = function(fiber, id) {
|
|
33207
33207
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -33211,10 +33211,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
33211
33211
|
}
|
|
33212
33212
|
return currentHook2;
|
|
33213
33213
|
};
|
|
33214
|
-
overrideHookState = function(fiber, id,
|
|
33214
|
+
overrideHookState = function(fiber, id, path17, value) {
|
|
33215
33215
|
var hook = findHook(fiber, id);
|
|
33216
33216
|
if (hook !== null) {
|
|
33217
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
33217
|
+
var newState = copyWithSet(hook.memoizedState, path17, value);
|
|
33218
33218
|
hook.memoizedState = newState;
|
|
33219
33219
|
hook.baseState = newState;
|
|
33220
33220
|
fiber.memoizedProps = assign({}, fiber.memoizedProps);
|
|
@@ -33224,10 +33224,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
33224
33224
|
}
|
|
33225
33225
|
}
|
|
33226
33226
|
};
|
|
33227
|
-
overrideHookStateDeletePath = function(fiber, id,
|
|
33227
|
+
overrideHookStateDeletePath = function(fiber, id, path17) {
|
|
33228
33228
|
var hook = findHook(fiber, id);
|
|
33229
33229
|
if (hook !== null) {
|
|
33230
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
33230
|
+
var newState = copyWithDelete(hook.memoizedState, path17);
|
|
33231
33231
|
hook.memoizedState = newState;
|
|
33232
33232
|
hook.baseState = newState;
|
|
33233
33233
|
fiber.memoizedProps = assign({}, fiber.memoizedProps);
|
|
@@ -33250,8 +33250,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
33250
33250
|
}
|
|
33251
33251
|
}
|
|
33252
33252
|
};
|
|
33253
|
-
overrideProps = function(fiber,
|
|
33254
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
33253
|
+
overrideProps = function(fiber, path17, value) {
|
|
33254
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path17, value);
|
|
33255
33255
|
if (fiber.alternate) {
|
|
33256
33256
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
33257
33257
|
}
|
|
@@ -33260,8 +33260,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
33260
33260
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
33261
33261
|
}
|
|
33262
33262
|
};
|
|
33263
|
-
overridePropsDeletePath = function(fiber,
|
|
33264
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
33263
|
+
overridePropsDeletePath = function(fiber, path17) {
|
|
33264
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path17);
|
|
33265
33265
|
if (fiber.alternate) {
|
|
33266
33266
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
33267
33267
|
}
|
|
@@ -38626,6 +38626,9 @@ function configPath() {
|
|
|
38626
38626
|
function statePath() {
|
|
38627
38627
|
return path.join(skillpotHome(), "state.json");
|
|
38628
38628
|
}
|
|
38629
|
+
function marketCacheDir() {
|
|
38630
|
+
return path.join(skillpotHome(), "cache", "market");
|
|
38631
|
+
}
|
|
38629
38632
|
|
|
38630
38633
|
// src/agents/registry.ts
|
|
38631
38634
|
import path2 from "node:path";
|
|
@@ -38673,6 +38676,22 @@ var AGENTS = [
|
|
|
38673
38676
|
fingerprints: (home) => [path2.join(home, ".gemini")],
|
|
38674
38677
|
skillsDir: (home) => path2.join(home, ".gemini", "skills"),
|
|
38675
38678
|
verified: "\u5B98\u65B9\u652F\u6301 Agent Skills\uFF0C\u5F85\u5B9E\u673A\u786E\u8BA4"
|
|
38679
|
+
},
|
|
38680
|
+
{
|
|
38681
|
+
id: "dsh",
|
|
38682
|
+
name: "DeepSeek CLI",
|
|
38683
|
+
binaries: ["dsh"],
|
|
38684
|
+
fingerprints: (home) => [path2.join(home, ".dsh")],
|
|
38685
|
+
skillsDir: (home) => path2.join(home, ".dsh", "skills"),
|
|
38686
|
+
verified: "\u76EE\u5F55\u7EA6\u5B9A\u540C Claude\uFF08~/.dsh/skills + SKILL.md\uFF09\uFF1B\u76EE\u5F55\u5185\u5DF2\u5B58\u5728\u7528\u6237\u624B\u5DE5\u521B\u5EFA\u5E76\u65E5\u5E38\u4F7F\u7528\u7684 symlink\uFF0C\u95F4\u63A5\u4F50\u8BC1 symlink \u53EF\u88AB\u53D1\u73B0\uFF1Bdsh CLI \u672C\u673A\u635F\u574F\uFF08@deepseek-ai/dsh \u6A21\u5757\u7F3A\u5931\uFF09\uFF0C\u5F85\u91CD\u88C5\u540E\u6700\u7EC8\u786E\u8BA4"
|
|
38687
|
+
},
|
|
38688
|
+
{
|
|
38689
|
+
id: "cursor",
|
|
38690
|
+
name: "Cursor",
|
|
38691
|
+
binaries: ["cursor"],
|
|
38692
|
+
fingerprints: (home) => [path2.join(home, ".cursor")],
|
|
38693
|
+
skillsDir: (home) => path2.join(home, ".cursor", "skills"),
|
|
38694
|
+
verified: "\u5B98\u65B9 create-skill \u6280\u80FD\u660E\u786E\uFF1A\u4E2A\u4EBA\u6280\u80FD\u76EE\u5F55\u4E3A ~/.cursor/skills/\uFF08\u9879\u76EE\u4E3A .cursor/skills/\uFF09\uFF1Bsymlink \u53D1\u73B0\u4EFB\u5F85\u5B9E\u673A\u786E\u8BA4"
|
|
38676
38695
|
}
|
|
38677
38696
|
];
|
|
38678
38697
|
function getAgent(id) {
|
|
@@ -38752,14 +38771,18 @@ var import_yaml = __toESM(require_dist());
|
|
|
38752
38771
|
import fs2 from "node:fs";
|
|
38753
38772
|
import path4 from "node:path";
|
|
38754
38773
|
function emptyConfig() {
|
|
38755
|
-
return { version: 1, skills: {} };
|
|
38774
|
+
return { version: 1, skills: {}, sources: [] };
|
|
38756
38775
|
}
|
|
38757
38776
|
function loadConfig() {
|
|
38758
38777
|
const p = configPath();
|
|
38759
38778
|
if (!fs2.existsSync(p)) return emptyConfig();
|
|
38760
38779
|
const data = (0, import_yaml.parse)(fs2.readFileSync(p, "utf8"));
|
|
38761
38780
|
if (!data || typeof data !== "object") return emptyConfig();
|
|
38762
|
-
return {
|
|
38781
|
+
return {
|
|
38782
|
+
version: 1,
|
|
38783
|
+
skills: data.skills ?? {},
|
|
38784
|
+
sources: Array.isArray(data.sources) ? data.sources : []
|
|
38785
|
+
};
|
|
38763
38786
|
}
|
|
38764
38787
|
function lockPath() {
|
|
38765
38788
|
return path4.join(skillpotHome(), "skillspot.lock.json");
|
|
@@ -38899,7 +38922,10 @@ async function installFromGit(repoSpec, nameOverride) {
|
|
|
38899
38922
|
const [url, sub] = repoSpec.split("#");
|
|
38900
38923
|
const tmp = fs4.mkdtempSync(path6.join(os2.tmpdir(), "skillpot-clone-"));
|
|
38901
38924
|
try {
|
|
38902
|
-
await execFileP("git", ["clone", "--depth", "1", url, tmp]
|
|
38925
|
+
await execFileP("git", ["clone", "--depth", "1", url, tmp], {
|
|
38926
|
+
timeout: 3e5,
|
|
38927
|
+
maxBuffer: 16 * 1024 * 1024
|
|
38928
|
+
});
|
|
38903
38929
|
const srcDir = sub ? path6.join(tmp, sub) : tmp;
|
|
38904
38930
|
return installFromLocal(srcDir, nameOverride);
|
|
38905
38931
|
} finally {
|
|
@@ -39193,25 +39219,125 @@ function uninstallSkill(name) {
|
|
|
39193
39219
|
saveConfig(config);
|
|
39194
39220
|
}
|
|
39195
39221
|
|
|
39196
|
-
// src/core/
|
|
39222
|
+
// src/core/market.ts
|
|
39223
|
+
import crypto2 from "node:crypto";
|
|
39197
39224
|
import fs7 from "node:fs";
|
|
39198
39225
|
import path10 from "node:path";
|
|
39226
|
+
import { execFile as execFile2 } from "node:child_process";
|
|
39227
|
+
import { promisify as promisify2 } from "node:util";
|
|
39228
|
+
var execFileP2 = promisify2(execFile2);
|
|
39229
|
+
var OFFICIAL_URL = "https://github.com/anthropics/skills.git";
|
|
39230
|
+
var OFFICIAL = {
|
|
39231
|
+
name: "Anthropic \u5B98\u65B9\u6280\u80FD\u5E93",
|
|
39232
|
+
url: OFFICIAL_URL,
|
|
39233
|
+
builtin: true
|
|
39234
|
+
};
|
|
39235
|
+
function listSources() {
|
|
39236
|
+
const config = loadConfig();
|
|
39237
|
+
return [OFFICIAL, ...(config.sources ?? []).map((s) => ({ name: s.name ?? urlLabel(s.url), url: s.url, builtin: false }))];
|
|
39238
|
+
}
|
|
39239
|
+
function urlLabel(url) {
|
|
39240
|
+
const tail = url.replace(/\.git$/, "").replace(/\/+$/, "");
|
|
39241
|
+
return tail.split("/").pop() ?? tail;
|
|
39242
|
+
}
|
|
39243
|
+
function addSource(url, name) {
|
|
39244
|
+
if (!isGitSource(url)) throw new Error(`\u4E0D\u662F\u5408\u6CD5\u7684 git \u5730\u5740\uFF1A${url}`);
|
|
39245
|
+
if (url === OFFICIAL_URL) throw new Error("\u5B98\u65B9\u6E90\u5DF2\u5185\u7F6E\uFF0C\u65E0\u9700\u6DFB\u52A0");
|
|
39246
|
+
const config = loadConfig();
|
|
39247
|
+
config.sources = config.sources ?? [];
|
|
39248
|
+
if (config.sources.some((s) => s.url === url)) throw new Error(`\u6E90\u5DF2\u5B58\u5728\uFF1A${url}`);
|
|
39249
|
+
const entry = {
|
|
39250
|
+
url,
|
|
39251
|
+
name: name?.trim() || void 0,
|
|
39252
|
+
added_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
39253
|
+
};
|
|
39254
|
+
config.sources.push(entry);
|
|
39255
|
+
saveConfig(config);
|
|
39256
|
+
return { name: entry.name ?? urlLabel(url), url, builtin: false };
|
|
39257
|
+
}
|
|
39258
|
+
function removeSource(url) {
|
|
39259
|
+
if (url === OFFICIAL_URL) throw new Error("\u5185\u7F6E\u6E90\u4E0D\u53EF\u79FB\u9664");
|
|
39260
|
+
const config = loadConfig();
|
|
39261
|
+
const before = (config.sources ?? []).length;
|
|
39262
|
+
config.sources = (config.sources ?? []).filter((s) => s.url !== url);
|
|
39263
|
+
if (config.sources.length === before) throw new Error(`\u6E90\u4E0D\u5B58\u5728\uFF1A${url}`);
|
|
39264
|
+
saveConfig(config);
|
|
39265
|
+
fs7.rmSync(cacheDirFor(url), { recursive: true, force: true });
|
|
39266
|
+
}
|
|
39267
|
+
var IGNORED = /* @__PURE__ */ new Set([".git", ".github", "node_modules"]);
|
|
39268
|
+
function cacheDirFor(url) {
|
|
39269
|
+
const hash = crypto2.createHash("sha256").update(url).digest("hex").slice(0, 16);
|
|
39270
|
+
return path10.join(marketCacheDir(), hash);
|
|
39271
|
+
}
|
|
39272
|
+
async function scanSource(url, opts = {}) {
|
|
39273
|
+
if (!isGitSource(url)) throw new Error(`\u4E0D\u662F\u5408\u6CD5\u7684 git \u5730\u5740\uFF1A${url}`);
|
|
39274
|
+
const dir = cacheDirFor(url);
|
|
39275
|
+
let cloned = false;
|
|
39276
|
+
if (opts.refresh || !fs7.existsSync(path10.join(dir, ".git"))) {
|
|
39277
|
+
fs7.rmSync(dir, { recursive: true, force: true });
|
|
39278
|
+
const tmp = `${dir}.tmp-${crypto2.randomBytes(4).toString("hex")}`;
|
|
39279
|
+
fs7.mkdirSync(path10.dirname(dir), { recursive: true });
|
|
39280
|
+
try {
|
|
39281
|
+
await execFileP2("git", ["clone", "--depth", "1", url, tmp], {
|
|
39282
|
+
timeout: 3e5,
|
|
39283
|
+
maxBuffer: 16 * 1024 * 1024
|
|
39284
|
+
});
|
|
39285
|
+
await fs7.promises.rename(tmp, dir);
|
|
39286
|
+
} catch (e) {
|
|
39287
|
+
fs7.rmSync(tmp, { recursive: true, force: true });
|
|
39288
|
+
throw new Error(`\u514B\u9686\u5931\u8D25\uFF1A${e instanceof Error ? e.message : String(e)}`);
|
|
39289
|
+
}
|
|
39290
|
+
cloned = true;
|
|
39291
|
+
}
|
|
39292
|
+
const config = loadConfig();
|
|
39293
|
+
const skills = [];
|
|
39294
|
+
const walk = (d) => {
|
|
39295
|
+
for (const e of fs7.readdirSync(d, { withFileTypes: true })) {
|
|
39296
|
+
if (e.name.startsWith(".") || IGNORED.has(e.name)) continue;
|
|
39297
|
+
const p = path10.join(d, e.name);
|
|
39298
|
+
if (!e.isDirectory()) continue;
|
|
39299
|
+
if (fs7.existsSync(path10.join(p, "SKILL.md"))) {
|
|
39300
|
+
const meta = readSkillMeta(p);
|
|
39301
|
+
const name = String(meta?.name ?? e.name);
|
|
39302
|
+
skills.push({
|
|
39303
|
+
name,
|
|
39304
|
+
subdir: path10.relative(dir, p).split(path10.sep).join("/"),
|
|
39305
|
+
description: String(meta?.description ?? ""),
|
|
39306
|
+
installed: !!config.skills[name]
|
|
39307
|
+
});
|
|
39308
|
+
}
|
|
39309
|
+
walk(p);
|
|
39310
|
+
}
|
|
39311
|
+
};
|
|
39312
|
+
walk(dir);
|
|
39313
|
+
return { url, skills, cloned };
|
|
39314
|
+
}
|
|
39315
|
+
async function installFromMarket(url, subdir, opts = {}) {
|
|
39316
|
+
if (!subdir || subdir.includes("..") || subdir.startsWith("/")) {
|
|
39317
|
+
throw new Error(`\u975E\u6CD5\u5B50\u76EE\u5F55\uFF1A${subdir}`);
|
|
39318
|
+
}
|
|
39319
|
+
return addSkill(`${url}#${subdir}`, { name: opts.name, for: opts.for });
|
|
39320
|
+
}
|
|
39321
|
+
|
|
39322
|
+
// src/core/doctor.ts
|
|
39323
|
+
import fs8 from "node:fs";
|
|
39324
|
+
import path11 from "node:path";
|
|
39199
39325
|
function runDoctor() {
|
|
39200
39326
|
const issues = [];
|
|
39201
39327
|
const config = loadConfig();
|
|
39202
39328
|
const state = loadState();
|
|
39203
39329
|
const home = agentHome();
|
|
39204
39330
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39205
|
-
if (!
|
|
39331
|
+
if (!fs8.existsSync(path11.join(skillDir(name), "SKILL.md"))) {
|
|
39206
39332
|
issues.push({
|
|
39207
39333
|
level: "error",
|
|
39208
39334
|
message: `config \u4E2D\u7684 '${name}' \u5728\u4E2D\u592E\u4ED3\u5E93\u7F3A\u5931\uFF08source=${entry.source}\uFF09`
|
|
39209
39335
|
});
|
|
39210
39336
|
}
|
|
39211
39337
|
}
|
|
39212
|
-
if (
|
|
39213
|
-
for (const e of
|
|
39214
|
-
if (e.isDirectory() && !config.skills[e.name] &&
|
|
39338
|
+
if (fs8.existsSync(storeDir())) {
|
|
39339
|
+
for (const e of fs8.readdirSync(storeDir(), { withFileTypes: true })) {
|
|
39340
|
+
if (e.isDirectory() && !config.skills[e.name] && fs8.existsSync(path11.join(storeDir(), e.name, "SKILL.md"))) {
|
|
39215
39341
|
issues.push({
|
|
39216
39342
|
level: "warn",
|
|
39217
39343
|
message: `\u4E2D\u592E\u4ED3\u5E93\u4E2D\u7684 '${e.name}' \u672A\u767B\u8BB0\u8FDB config\uFF08\u624B\u52A8\u62F7\u5165\uFF1F\uFF09`,
|
|
@@ -39223,7 +39349,7 @@ function runDoctor() {
|
|
|
39223
39349
|
for (const link2 of state.links) {
|
|
39224
39350
|
let st = null;
|
|
39225
39351
|
try {
|
|
39226
|
-
st =
|
|
39352
|
+
st = fs8.lstatSync(link2.link_path);
|
|
39227
39353
|
} catch {
|
|
39228
39354
|
}
|
|
39229
39355
|
if (!st) {
|
|
@@ -39241,7 +39367,7 @@ function runDoctor() {
|
|
|
39241
39367
|
});
|
|
39242
39368
|
continue;
|
|
39243
39369
|
}
|
|
39244
|
-
if (!
|
|
39370
|
+
if (!fs8.existsSync(link2.link_path)) {
|
|
39245
39371
|
issues.push({
|
|
39246
39372
|
level: "error",
|
|
39247
39373
|
message: `\u65AD\u94FE\uFF1A${link2.link_path} \u6307\u5411\u7684\u76EE\u6807\u4E0D\u5B58\u5728`,
|
|
@@ -39251,19 +39377,19 @@ function runDoctor() {
|
|
|
39251
39377
|
}
|
|
39252
39378
|
for (const agent of AGENTS) {
|
|
39253
39379
|
const dir = agent.skillsDir(home);
|
|
39254
|
-
if (!
|
|
39380
|
+
if (!fs8.existsSync(dir)) continue;
|
|
39255
39381
|
let entries = [];
|
|
39256
39382
|
try {
|
|
39257
|
-
entries =
|
|
39383
|
+
entries = fs8.readdirSync(dir, { withFileTypes: true });
|
|
39258
39384
|
} catch {
|
|
39259
39385
|
continue;
|
|
39260
39386
|
}
|
|
39261
39387
|
for (const e of entries) {
|
|
39262
39388
|
if (!e.isSymbolicLink()) continue;
|
|
39263
|
-
const linkPath =
|
|
39389
|
+
const linkPath = path11.join(dir, e.name);
|
|
39264
39390
|
let target = "";
|
|
39265
39391
|
try {
|
|
39266
|
-
target =
|
|
39392
|
+
target = fs8.readlinkSync(linkPath);
|
|
39267
39393
|
} catch {
|
|
39268
39394
|
continue;
|
|
39269
39395
|
}
|
|
@@ -39279,8 +39405,8 @@ function runDoctor() {
|
|
|
39279
39405
|
}
|
|
39280
39406
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39281
39407
|
for (const agent of AGENTS) {
|
|
39282
|
-
const target =
|
|
39283
|
-
const exposed =
|
|
39408
|
+
const target = path11.join(agent.skillsDir(home), name);
|
|
39409
|
+
const exposed = fs8.existsSync(target);
|
|
39284
39410
|
const wanted = entry.expose[agent.id] === true;
|
|
39285
39411
|
if (wanted && !exposed) {
|
|
39286
39412
|
issues.push({
|
|
@@ -39305,7 +39431,7 @@ function fixDoctor() {
|
|
|
39305
39431
|
state.links = state.links.filter((l) => {
|
|
39306
39432
|
let ok = false;
|
|
39307
39433
|
try {
|
|
39308
|
-
ok =
|
|
39434
|
+
ok = fs8.existsSync(l.link_path) && fs8.lstatSync(l.link_path).isSymbolicLink();
|
|
39309
39435
|
} catch {
|
|
39310
39436
|
ok = false;
|
|
39311
39437
|
}
|
|
@@ -39318,10 +39444,10 @@ function fixDoctor() {
|
|
|
39318
39444
|
saveState(state);
|
|
39319
39445
|
const config = loadConfig();
|
|
39320
39446
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39321
|
-
if (!
|
|
39447
|
+
if (!fs8.existsSync(path11.join(skillDir(name), "SKILL.md"))) continue;
|
|
39322
39448
|
for (const agent of AGENTS) {
|
|
39323
|
-
const target =
|
|
39324
|
-
const exposed =
|
|
39449
|
+
const target = path11.join(agent.skillsDir(agentHome()), name);
|
|
39450
|
+
const exposed = fs8.existsSync(target);
|
|
39325
39451
|
const wanted = entry.expose[agent.id] === true;
|
|
39326
39452
|
if (wanted && !exposed) {
|
|
39327
39453
|
try {
|
|
@@ -39343,7 +39469,7 @@ function fixDoctor() {
|
|
|
39343
39469
|
function isOurSymlink(target, state, skill, agentId) {
|
|
39344
39470
|
let isLink = false;
|
|
39345
39471
|
try {
|
|
39346
|
-
isLink =
|
|
39472
|
+
isLink = fs8.lstatSync(target).isSymbolicLink();
|
|
39347
39473
|
} catch {
|
|
39348
39474
|
return false;
|
|
39349
39475
|
}
|
|
@@ -39354,13 +39480,13 @@ function isOurSymlink(target, state, skill, agentId) {
|
|
|
39354
39480
|
if (inLedger) return true;
|
|
39355
39481
|
let real = null;
|
|
39356
39482
|
try {
|
|
39357
|
-
real =
|
|
39483
|
+
real = fs8.realpathSync(target);
|
|
39358
39484
|
} catch {
|
|
39359
39485
|
return false;
|
|
39360
39486
|
}
|
|
39361
39487
|
let storeReal = null;
|
|
39362
39488
|
try {
|
|
39363
|
-
storeReal =
|
|
39489
|
+
storeReal = fs8.realpathSync(skillDir(skill));
|
|
39364
39490
|
} catch {
|
|
39365
39491
|
return false;
|
|
39366
39492
|
}
|
|
@@ -39368,21 +39494,21 @@ function isOurSymlink(target, state, skill, agentId) {
|
|
|
39368
39494
|
}
|
|
39369
39495
|
function sameRealPath(a, b) {
|
|
39370
39496
|
try {
|
|
39371
|
-
return
|
|
39497
|
+
return fs8.realpathSync(a) === fs8.realpathSync(b);
|
|
39372
39498
|
} catch {
|
|
39373
39499
|
return false;
|
|
39374
39500
|
}
|
|
39375
39501
|
}
|
|
39376
39502
|
|
|
39377
39503
|
// src/core/adopt.ts
|
|
39378
|
-
import
|
|
39379
|
-
import
|
|
39504
|
+
import fs9 from "node:fs";
|
|
39505
|
+
import path12 from "node:path";
|
|
39380
39506
|
function isManagedByStore(dir) {
|
|
39381
39507
|
try {
|
|
39382
|
-
if (!
|
|
39383
|
-
const real =
|
|
39384
|
-
const storeReal =
|
|
39385
|
-
return real === storeReal || real.startsWith(storeReal +
|
|
39508
|
+
if (!fs9.lstatSync(dir).isSymbolicLink()) return false;
|
|
39509
|
+
const real = fs9.realpathSync(dir);
|
|
39510
|
+
const storeReal = fs9.realpathSync(storeDir());
|
|
39511
|
+
return real === storeReal || real.startsWith(storeReal + path12.sep);
|
|
39386
39512
|
} catch {
|
|
39387
39513
|
return false;
|
|
39388
39514
|
}
|
|
@@ -39391,13 +39517,13 @@ function scanAgentSkills(agentId) {
|
|
|
39391
39517
|
const agent = getAgent(agentId);
|
|
39392
39518
|
if (!agent) throw new Error(`\u672A\u77E5 agent '${agentId}'`);
|
|
39393
39519
|
const dir = agent.skillsDir(agentHome());
|
|
39394
|
-
if (!
|
|
39520
|
+
if (!fs9.existsSync(dir)) return [];
|
|
39395
39521
|
const out = [];
|
|
39396
|
-
for (const e of
|
|
39522
|
+
for (const e of fs9.readdirSync(dir, { withFileTypes: true })) {
|
|
39397
39523
|
if (e.name.startsWith(".")) continue;
|
|
39398
39524
|
if (!e.isDirectory() && !e.isSymbolicLink()) continue;
|
|
39399
|
-
const p =
|
|
39400
|
-
if (!
|
|
39525
|
+
const p = path12.join(dir, e.name);
|
|
39526
|
+
if (!fs9.existsSync(path12.join(p, "SKILL.md"))) continue;
|
|
39401
39527
|
out.push({ name: e.name, path: p });
|
|
39402
39528
|
}
|
|
39403
39529
|
return out;
|
|
@@ -39405,7 +39531,7 @@ function scanAgentSkills(agentId) {
|
|
|
39405
39531
|
function scanAdoptable(agentId) {
|
|
39406
39532
|
return scanAgentSkills(agentId).filter((s) => {
|
|
39407
39533
|
try {
|
|
39408
|
-
return !
|
|
39534
|
+
return !fs9.lstatSync(s.path).isSymbolicLink();
|
|
39409
39535
|
} catch {
|
|
39410
39536
|
return false;
|
|
39411
39537
|
}
|
|
@@ -39436,7 +39562,7 @@ function adoptSkills(opts = {}) {
|
|
|
39436
39562
|
}
|
|
39437
39563
|
let isOwnSymlink = false;
|
|
39438
39564
|
try {
|
|
39439
|
-
isOwnSymlink =
|
|
39565
|
+
isOwnSymlink = fs9.lstatSync(skill.path).isSymbolicLink();
|
|
39440
39566
|
} catch {
|
|
39441
39567
|
}
|
|
39442
39568
|
if (isOwnSymlink) {
|
|
@@ -39456,7 +39582,7 @@ function adoptSkills(opts = {}) {
|
|
|
39456
39582
|
items.push({ agent: agentId, name: skill.name, path: skill.path, status: "skipped-invalid", detail: "\u76EE\u5F55\u540D\u4E0D\u5408\u6CD5" });
|
|
39457
39583
|
continue;
|
|
39458
39584
|
}
|
|
39459
|
-
const existsInStore = !!config.skills[name] ||
|
|
39585
|
+
const existsInStore = !!config.skills[name] || fs9.existsSync(skillDir(name));
|
|
39460
39586
|
if (opts.dryRun) {
|
|
39461
39587
|
items.push({
|
|
39462
39588
|
agent: agentId,
|
|
@@ -39513,7 +39639,7 @@ function adoptSkills(opts = {}) {
|
|
|
39513
39639
|
saveConfig(config);
|
|
39514
39640
|
for (const mv of pendingMoves) {
|
|
39515
39641
|
try {
|
|
39516
|
-
|
|
39642
|
+
fs9.rmSync(mv.path, { recursive: true, force: true });
|
|
39517
39643
|
enableSkill(mv.name, [mv.agentId]);
|
|
39518
39644
|
items.push({
|
|
39519
39645
|
agent: mv.agentId,
|
|
@@ -39548,27 +39674,30 @@ function adoptSkills(opts = {}) {
|
|
|
39548
39674
|
}
|
|
39549
39675
|
|
|
39550
39676
|
// src/core/update.ts
|
|
39551
|
-
import
|
|
39677
|
+
import fs10 from "node:fs";
|
|
39552
39678
|
import os3 from "node:os";
|
|
39553
|
-
import
|
|
39554
|
-
import { execFile as
|
|
39555
|
-
import { promisify as
|
|
39556
|
-
var
|
|
39679
|
+
import path13 from "node:path";
|
|
39680
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
39681
|
+
import { promisify as promisify3 } from "node:util";
|
|
39682
|
+
var execFileP3 = promisify3(execFile3);
|
|
39557
39683
|
function parseGitSource(source) {
|
|
39558
39684
|
return source.startsWith("git:") ? source.slice(4) : null;
|
|
39559
39685
|
}
|
|
39560
39686
|
async function fetchRemote(repoSpec) {
|
|
39561
39687
|
const [url, sub] = repoSpec.split("#");
|
|
39562
|
-
const cloneDir =
|
|
39688
|
+
const cloneDir = fs10.mkdtempSync(path13.join(os3.tmpdir(), "skillpot-update-"));
|
|
39563
39689
|
try {
|
|
39564
|
-
await
|
|
39565
|
-
|
|
39566
|
-
|
|
39690
|
+
await execFileP3("git", ["clone", "--depth", "1", url, cloneDir], {
|
|
39691
|
+
timeout: 3e5,
|
|
39692
|
+
maxBuffer: 16 * 1024 * 1024
|
|
39693
|
+
});
|
|
39694
|
+
const contentDir = sub ? path13.join(cloneDir, sub) : cloneDir;
|
|
39695
|
+
if (!fs10.existsSync(path13.join(contentDir, "SKILL.md"))) {
|
|
39567
39696
|
throw new Error(`\u8FDC\u7AEF ${sub ? `#${sub} ` : ""}\u4E2D\u6CA1\u6709 SKILL.md`);
|
|
39568
39697
|
}
|
|
39569
39698
|
return { checksum: dirChecksum(contentDir), cloneDir, sub };
|
|
39570
39699
|
} catch (e) {
|
|
39571
|
-
|
|
39700
|
+
fs10.rmSync(cloneDir, { recursive: true, force: true });
|
|
39572
39701
|
throw e;
|
|
39573
39702
|
}
|
|
39574
39703
|
}
|
|
@@ -39587,7 +39716,7 @@ async function updateSkills(name, opts = {}) {
|
|
|
39587
39716
|
results.push({ skill: n, status: "local", detail: entry.source });
|
|
39588
39717
|
continue;
|
|
39589
39718
|
}
|
|
39590
|
-
if (!
|
|
39719
|
+
if (!fs10.existsSync(skillDir(n))) {
|
|
39591
39720
|
results.push({ skill: n, status: "error", detail: "\u4E2D\u592E\u4ED3\u5E93\u7F3A\u5931" });
|
|
39592
39721
|
continue;
|
|
39593
39722
|
}
|
|
@@ -39602,20 +39731,20 @@ async function updateSkills(name, opts = {}) {
|
|
|
39602
39731
|
results.push({ skill: n, status: "outdated", detail: `\u8FDC\u7AEF ${fetched.checksum.slice(0, 15)}` });
|
|
39603
39732
|
continue;
|
|
39604
39733
|
}
|
|
39605
|
-
const staging =
|
|
39734
|
+
const staging = fs10.mkdtempSync(path13.join(os3.tmpdir(), "skillpot-new-"));
|
|
39606
39735
|
try {
|
|
39607
|
-
const srcDir = fetched.sub ?
|
|
39608
|
-
|
|
39609
|
-
|
|
39610
|
-
|
|
39736
|
+
const srcDir = fetched.sub ? path13.join(fetched.cloneDir, fetched.sub) : fetched.cloneDir;
|
|
39737
|
+
fs10.cpSync(srcDir, staging, { recursive: true });
|
|
39738
|
+
fs10.rmSync(skillDir(n), { recursive: true, force: true });
|
|
39739
|
+
fs10.cpSync(staging, skillDir(n), { recursive: true });
|
|
39611
39740
|
} finally {
|
|
39612
|
-
|
|
39741
|
+
fs10.rmSync(staging, { recursive: true, force: true });
|
|
39613
39742
|
}
|
|
39614
39743
|
entry.checksum = dirChecksum(skillDir(n));
|
|
39615
39744
|
entry.installed_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
39616
39745
|
results.push({ skill: n, status: "updated", detail: entry.checksum.slice(0, 15) });
|
|
39617
39746
|
} finally {
|
|
39618
|
-
|
|
39747
|
+
fs10.rmSync(fetched.cloneDir, { recursive: true, force: true });
|
|
39619
39748
|
}
|
|
39620
39749
|
} catch (e) {
|
|
39621
39750
|
results.push({ skill: n, status: "error", detail: e instanceof Error ? e.message : String(e) });
|
|
@@ -39629,21 +39758,21 @@ async function updateSkills(name, opts = {}) {
|
|
|
39629
39758
|
import readline from "node:readline";
|
|
39630
39759
|
|
|
39631
39760
|
// src/core/skill-detail.ts
|
|
39632
|
-
import
|
|
39633
|
-
import
|
|
39761
|
+
import fs11 from "node:fs";
|
|
39762
|
+
import path14 from "node:path";
|
|
39634
39763
|
function readSkillDetail(name) {
|
|
39635
39764
|
const dir = skillDir(name);
|
|
39636
|
-
const mdPath =
|
|
39637
|
-
if (!
|
|
39765
|
+
const mdPath = path14.join(dir, "SKILL.md");
|
|
39766
|
+
if (!fs11.existsSync(mdPath)) return null;
|
|
39638
39767
|
const files = [];
|
|
39639
39768
|
const walk = (d) => {
|
|
39640
|
-
for (const e of
|
|
39641
|
-
const p =
|
|
39769
|
+
for (const e of fs11.readdirSync(d, { withFileTypes: true })) {
|
|
39770
|
+
const p = path14.join(d, e.name);
|
|
39642
39771
|
if (e.isDirectory()) {
|
|
39643
|
-
files.push(
|
|
39772
|
+
files.push(path14.relative(dir, p) + "/");
|
|
39644
39773
|
walk(p);
|
|
39645
39774
|
} else {
|
|
39646
|
-
files.push(
|
|
39775
|
+
files.push(path14.relative(dir, p));
|
|
39647
39776
|
}
|
|
39648
39777
|
}
|
|
39649
39778
|
};
|
|
@@ -39652,7 +39781,7 @@ function readSkillDetail(name) {
|
|
|
39652
39781
|
name,
|
|
39653
39782
|
meta: readSkillMeta(dir),
|
|
39654
39783
|
files: files.sort(),
|
|
39655
|
-
skillMd:
|
|
39784
|
+
skillMd: fs11.readFileSync(mdPath, "utf8")
|
|
39656
39785
|
};
|
|
39657
39786
|
}
|
|
39658
39787
|
|
|
@@ -39782,16 +39911,16 @@ function startMcpServer() {
|
|
|
39782
39911
|
}
|
|
39783
39912
|
|
|
39784
39913
|
// src/core/gui-server.ts
|
|
39785
|
-
import
|
|
39786
|
-
import
|
|
39914
|
+
import crypto3 from "node:crypto";
|
|
39915
|
+
import fs13 from "node:fs";
|
|
39787
39916
|
import http from "node:http";
|
|
39788
|
-
import
|
|
39917
|
+
import path16 from "node:path";
|
|
39789
39918
|
import { spawn } from "node:child_process";
|
|
39790
39919
|
import { fileURLToPath } from "node:url";
|
|
39791
39920
|
|
|
39792
39921
|
// src/tui/matrix.ts
|
|
39793
|
-
import
|
|
39794
|
-
import
|
|
39922
|
+
import fs12 from "node:fs";
|
|
39923
|
+
import path15 from "node:path";
|
|
39795
39924
|
function deriveMatrix(agents) {
|
|
39796
39925
|
const config = loadConfig();
|
|
39797
39926
|
const skills = Object.keys(config.skills).sort();
|
|
@@ -39805,13 +39934,13 @@ function deriveMatrix(agents) {
|
|
|
39805
39934
|
for (const s of skills) {
|
|
39806
39935
|
cells[s] = {};
|
|
39807
39936
|
for (const a of list) {
|
|
39808
|
-
const target =
|
|
39937
|
+
const target = path15.join(a.skillsDir, s);
|
|
39809
39938
|
let actual = false;
|
|
39810
39939
|
let managed = false;
|
|
39811
39940
|
try {
|
|
39812
|
-
const st =
|
|
39941
|
+
const st = fs12.lstatSync(target);
|
|
39813
39942
|
actual = true;
|
|
39814
|
-
managed = st.isSymbolicLink() &&
|
|
39943
|
+
managed = st.isSymbolicLink() && fs12.realpathSync(target) === fs12.realpathSync(skillDir(s));
|
|
39815
39944
|
} catch {
|
|
39816
39945
|
}
|
|
39817
39946
|
cells[s][a.id] = {
|
|
@@ -39934,7 +40063,7 @@ async function handleApiRequest(method, pathname, query, body, expectedToken, go
|
|
|
39934
40063
|
let inStore = false;
|
|
39935
40064
|
try {
|
|
39936
40065
|
const n = sanitizeSkillName(s.name);
|
|
39937
|
-
inStore = !!config.skills[n] ||
|
|
40066
|
+
inStore = !!config.skills[n] || fs13.existsSync(skillDir(n));
|
|
39938
40067
|
} catch {
|
|
39939
40068
|
valid = false;
|
|
39940
40069
|
}
|
|
@@ -39990,6 +40119,41 @@ async function handleApiRequest(method, pathname, query, body, expectedToken, go
|
|
|
39990
40119
|
uninstallSkill(b.skill);
|
|
39991
40120
|
return { status: 200, body: { ok: true, message: `\u5DF2\u5378\u8F7D ${b.skill}` } };
|
|
39992
40121
|
}
|
|
40122
|
+
if (method === "GET" && pathname === "/api/market/sources") {
|
|
40123
|
+
return { status: 200, body: { sources: listSources() } };
|
|
40124
|
+
}
|
|
40125
|
+
if (method === "POST" && pathname === "/api/market/sources/add") {
|
|
40126
|
+
const b = body ?? {};
|
|
40127
|
+
if (typeof b.url !== "string") return { status: 400, body: { error: "\u9700\u8981 url \u5B57\u6BB5" } };
|
|
40128
|
+
const src = addSource(
|
|
40129
|
+
b.url.trim(),
|
|
40130
|
+
typeof b.name === "string" && b.name.trim() ? b.name.trim() : void 0
|
|
40131
|
+
);
|
|
40132
|
+
return { status: 200, body: { source: src } };
|
|
40133
|
+
}
|
|
40134
|
+
if (method === "POST" && pathname === "/api/market/sources/remove") {
|
|
40135
|
+
const b = body ?? {};
|
|
40136
|
+
if (typeof b.url !== "string") return { status: 400, body: { error: "\u9700\u8981 url \u5B57\u6BB5" } };
|
|
40137
|
+
removeSource(b.url);
|
|
40138
|
+
return { status: 200, body: { ok: true } };
|
|
40139
|
+
}
|
|
40140
|
+
if (method === "GET" && pathname === "/api/market/scan") {
|
|
40141
|
+
const url = query.get("url");
|
|
40142
|
+
if (!url) return { status: 400, body: { error: "\u9700\u8981 url \u67E5\u8BE2\u53C2\u6570" } };
|
|
40143
|
+
const result = await scanSource(url, { refresh: query.get("refresh") === "1" });
|
|
40144
|
+
return { status: 200, body: result };
|
|
40145
|
+
}
|
|
40146
|
+
if (method === "POST" && pathname === "/api/market/install") {
|
|
40147
|
+
const b = body ?? {};
|
|
40148
|
+
if (typeof b.url !== "string" || typeof b.subdir !== "string") {
|
|
40149
|
+
return { status: 400, body: { error: "\u9700\u8981 url \u4E0E subdir \u5B57\u6BB5" } };
|
|
40150
|
+
}
|
|
40151
|
+
const result = await installFromMarket(b.url, b.subdir, {
|
|
40152
|
+
name: typeof b.name === "string" && b.name.trim() ? b.name.trim() : void 0,
|
|
40153
|
+
for: Array.isArray(b.for) ? b.for.filter((x) => typeof x === "string") : void 0
|
|
40154
|
+
});
|
|
40155
|
+
return { status: 200, body: result };
|
|
40156
|
+
}
|
|
39993
40157
|
if (method === "GET" && pathname === "/api/doctor") {
|
|
39994
40158
|
return { status: 200, body: { issues: runDoctor() } };
|
|
39995
40159
|
}
|
|
@@ -40051,40 +40215,40 @@ function openBrowser(url) {
|
|
|
40051
40215
|
}
|
|
40052
40216
|
function guiDistDir() {
|
|
40053
40217
|
const candidates = [
|
|
40054
|
-
|
|
40055
|
-
|
|
40218
|
+
path16.resolve(fileURLToPath(new URL("./gui/", import.meta.url))),
|
|
40219
|
+
path16.resolve(fileURLToPath(new URL("../../dist/gui/", import.meta.url)))
|
|
40056
40220
|
];
|
|
40057
40221
|
for (const dir of candidates) {
|
|
40058
|
-
if (
|
|
40222
|
+
if (fs13.existsSync(path16.join(dir, "index.html"))) return dir;
|
|
40059
40223
|
}
|
|
40060
40224
|
return candidates[0];
|
|
40061
40225
|
}
|
|
40062
40226
|
function serveStatic(pathname, res) {
|
|
40063
40227
|
const root = guiDistDir();
|
|
40064
|
-
if (!
|
|
40228
|
+
if (!fs13.existsSync(path16.join(root, "index.html"))) {
|
|
40065
40229
|
res.writeHead(503, { "content-type": "text/plain; charset=utf-8" });
|
|
40066
40230
|
res.end("GUI \u524D\u7AEF\u672A\u6784\u5EFA\uFF1A\u5728\u9879\u76EE\u6839\u76EE\u5F55\u8FD0\u884C npm run build:gui\uFF08npm \u53D1\u5E03\u5305\u5185\u5DF2\u81EA\u5E26\uFF09\u3002");
|
|
40067
40231
|
return;
|
|
40068
40232
|
}
|
|
40069
40233
|
const rel = pathname === "/" ? "index.html" : pathname.replace(/^\/+/, "");
|
|
40070
|
-
let file =
|
|
40071
|
-
if (!file.startsWith(root +
|
|
40234
|
+
let file = path16.resolve(root, rel);
|
|
40235
|
+
if (!file.startsWith(root + path16.sep) && file !== root) {
|
|
40072
40236
|
res.writeHead(403, { "content-type": "text/plain; charset=utf-8" });
|
|
40073
40237
|
res.end("forbidden");
|
|
40074
40238
|
return;
|
|
40075
40239
|
}
|
|
40076
|
-
if (!
|
|
40077
|
-
file =
|
|
40240
|
+
if (!fs13.existsSync(file) || fs13.statSync(file).isDirectory()) {
|
|
40241
|
+
file = path16.join(root, "index.html");
|
|
40078
40242
|
}
|
|
40079
|
-
const ext =
|
|
40243
|
+
const ext = path16.extname(file).toLowerCase();
|
|
40080
40244
|
res.writeHead(200, {
|
|
40081
40245
|
"content-type": MIME[ext] ?? "application/octet-stream",
|
|
40082
40246
|
"cache-control": rel.startsWith("assets/") ? "public, max-age=31536000, immutable" : "no-store"
|
|
40083
40247
|
});
|
|
40084
|
-
|
|
40248
|
+
fs13.createReadStream(file).pipe(res);
|
|
40085
40249
|
}
|
|
40086
40250
|
async function startGuiServer(opts = {}) {
|
|
40087
|
-
const token =
|
|
40251
|
+
const token = crypto3.randomBytes(16).toString("hex");
|
|
40088
40252
|
const host = opts.host ?? "127.0.0.1";
|
|
40089
40253
|
const readAuthRequired = !["127.0.0.1", "localhost", "::1"].includes(host);
|
|
40090
40254
|
const sseClients = /* @__PURE__ */ new Set();
|
|
@@ -44765,7 +44929,7 @@ var FocusContext_default = FocusContext;
|
|
|
44765
44929
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
44766
44930
|
var import_react8 = __toESM(require_react(), 1);
|
|
44767
44931
|
var import_stack_utils = __toESM(require_stack_utils(), 1);
|
|
44768
|
-
import * as
|
|
44932
|
+
import * as fs14 from "node:fs";
|
|
44769
44933
|
import { cwd } from "node:process";
|
|
44770
44934
|
|
|
44771
44935
|
// node_modules/convert-to-spaces/dist/index.js
|
|
@@ -44855,8 +45019,8 @@ function Text({ color, backgroundColor, dimColor = false, bold = false, italic =
|
|
|
44855
45019
|
}
|
|
44856
45020
|
|
|
44857
45021
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
44858
|
-
var cleanupPath = (
|
|
44859
|
-
return
|
|
45022
|
+
var cleanupPath = (path17) => {
|
|
45023
|
+
return path17?.replace(`file://${cwd()}/`, "");
|
|
44860
45024
|
};
|
|
44861
45025
|
var stackUtils = new import_stack_utils.default({
|
|
44862
45026
|
cwd: cwd(),
|
|
@@ -44868,8 +45032,8 @@ function ErrorOverview({ error }) {
|
|
|
44868
45032
|
const filePath = cleanupPath(origin?.file);
|
|
44869
45033
|
let excerpt;
|
|
44870
45034
|
let lineWidth = 0;
|
|
44871
|
-
if (filePath && origin?.line &&
|
|
44872
|
-
const sourceCode =
|
|
45035
|
+
if (filePath && origin?.line && fs14.existsSync(filePath)) {
|
|
45036
|
+
const sourceCode = fs14.readFileSync(filePath, "utf8");
|
|
44873
45037
|
excerpt = dist_default3(sourceCode, origin.line);
|
|
44874
45038
|
if (excerpt) {
|
|
44875
45039
|
for (const { line } of excerpt) {
|
|
@@ -46230,6 +46394,54 @@ program2.command("gui").description("\u542F\u52A8\u672C\u5730 Web \u63A7\u5236\u
|
|
|
46230
46394
|
console.log(import_picocolors2.default.dim("\u6309 Ctrl+C \u9000\u51FA"));
|
|
46231
46395
|
})
|
|
46232
46396
|
);
|
|
46397
|
+
var sourceCmd = program2.command("source").description("\u7BA1\u7406\u5E02\u573A\u6280\u80FD\u6E90\uFF08git \u4ED3\u5E93\uFF09");
|
|
46398
|
+
sourceCmd.command("list").description("\u5217\u51FA\u5DF2\u914D\u7F6E\u7684\u6280\u80FD\u6E90").action(
|
|
46399
|
+
run(() => {
|
|
46400
|
+
const rows = listSources().map((s) => [s.name, s.url, s.builtin ? "\u5185\u7F6E" : "\u81EA\u5B9A\u4E49"]);
|
|
46401
|
+
console.log(renderTable(["\u540D\u79F0", "URL", "\u7C7B\u578B"], rows));
|
|
46402
|
+
})
|
|
46403
|
+
);
|
|
46404
|
+
sourceCmd.command("add <url> [name]").description("\u6DFB\u52A0\u81EA\u5B9A\u4E49\u6280\u80FD\u6E90\uFF08git \u4ED3\u5E93\u5730\u5740\uFF09").action(
|
|
46405
|
+
run(async (url, name) => {
|
|
46406
|
+
const s = addSource(url, name);
|
|
46407
|
+
console.log(import_picocolors2.default.green(`\u2714 \u5DF2\u6DFB\u52A0\u6E90 ${s.name}\uFF1A${s.url}`));
|
|
46408
|
+
console.log(import_picocolors2.default.dim(`\u9884\u89C8\uFF1Askillpot market ${s.url}\uFF0C\u6216\u5728 GUI\u300C\u5E02\u573A\u300D\u9875\u4E00\u952E\u5B89\u88C5`));
|
|
46409
|
+
})
|
|
46410
|
+
);
|
|
46411
|
+
sourceCmd.command("remove <url>").description("\u79FB\u9664\u81EA\u5B9A\u4E49\u6280\u80FD\u6E90").action(
|
|
46412
|
+
run((url) => {
|
|
46413
|
+
removeSource(url);
|
|
46414
|
+
console.log(import_picocolors2.default.green(`\u2714 \u5DF2\u79FB\u9664\u6E90 ${url}`));
|
|
46415
|
+
})
|
|
46416
|
+
);
|
|
46417
|
+
program2.command("market [url]").description("\u6D4F\u89C8\u6280\u80FD\u6E90\u91CC\u7684 skill\uFF08\u7F3A\u7701\u626B\u63CF\u5168\u90E8\u6E90\uFF1B\u5B98\u65B9\u6E90\u4E3A anthropics/skills\uFF09").option("--refresh", "\u5F3A\u5236\u91CD\u65B0\u514B\u9686\u6E90\u4ED3\u5E93\uFF08\u9ED8\u8BA4\u547D\u4E2D\u672C\u5730\u7F13\u5B58\uFF09").action(
|
|
46418
|
+
run(async (url, opts) => {
|
|
46419
|
+
const targets = url ? [url] : listSources().map((s) => s.url);
|
|
46420
|
+
for (const t of targets) {
|
|
46421
|
+
const r = await scanSource(t, { refresh: opts.refresh });
|
|
46422
|
+
console.log(
|
|
46423
|
+
import_picocolors2.default.bold(`${t}\uFF08${r.skills.length} \u4E2A skill\uFF0C${r.cloned ? "\u5DF2\u91CD\u65B0\u514B\u9686" : "\u672C\u5730\u7F13\u5B58"}\uFF09`)
|
|
46424
|
+
);
|
|
46425
|
+
if (r.skills.length) {
|
|
46426
|
+
console.log(
|
|
46427
|
+
renderTable(
|
|
46428
|
+
["Skill", "\u8BF4\u660E", "\u5B50\u76EE\u5F55", "\u5DF2\u88C5"],
|
|
46429
|
+
r.skills.map((s) => [
|
|
46430
|
+
s.name,
|
|
46431
|
+
s.description.slice(0, 56),
|
|
46432
|
+
s.subdir,
|
|
46433
|
+
s.installed ? "\u2713" : ""
|
|
46434
|
+
])
|
|
46435
|
+
)
|
|
46436
|
+
);
|
|
46437
|
+
}
|
|
46438
|
+
console.log();
|
|
46439
|
+
}
|
|
46440
|
+
console.log(
|
|
46441
|
+
import_picocolors2.default.dim(`\u5B89\u88C5\uFF1Askillpot add <\u6E90\u5730\u5740>#<\u5B50\u76EE\u5F55>\uFF0C\u6216\u5728 GUI\u300C\u5E02\u573A\u300D\u9875\u4E00\u952E\u5B89\u88C5\u5E76\u5F00\u653E`)
|
|
46442
|
+
);
|
|
46443
|
+
})
|
|
46444
|
+
);
|
|
46233
46445
|
for (const cmd of program2.commands) cmd.allowExcessArguments(false);
|
|
46234
46446
|
await program2.parseAsync(process.argv);
|
|
46235
46447
|
/*! Bundled license information:
|