@tec-explorer/skillpot 0.5.1 → 0.7.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 +26 -1
- package/README.md +26 -8
- package/dist/cli.mjs +420 -204
- package/dist/gui/assets/index-CQEycW9r.js +40 -0
- package/dist/gui/assets/index-D5a5y70Q.css +1 -0
- package/dist/gui/index.html +2 -2
- package/package.json +1 -1
- 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";
|
|
@@ -38680,15 +38683,15 @@ var AGENTS = [
|
|
|
38680
38683
|
binaries: ["dsh"],
|
|
38681
38684
|
fingerprints: (home) => [path2.join(home, ".dsh")],
|
|
38682
38685
|
skillsDir: (home) => path2.join(home, ".dsh", "skills"),
|
|
38683
|
-
verified: "\u76EE\u5F55\
|
|
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"
|
|
38684
38687
|
},
|
|
38685
38688
|
{
|
|
38686
38689
|
id: "cursor",
|
|
38687
38690
|
name: "Cursor",
|
|
38688
38691
|
binaries: ["cursor"],
|
|
38689
38692
|
fingerprints: (home) => [path2.join(home, ".cursor")],
|
|
38690
|
-
skillsDir: (home) => path2.join(home, ".cursor", "skills
|
|
38691
|
-
verified: "\
|
|
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"
|
|
38692
38695
|
}
|
|
38693
38696
|
];
|
|
38694
38697
|
function getAgent(id) {
|
|
@@ -38768,14 +38771,18 @@ var import_yaml = __toESM(require_dist());
|
|
|
38768
38771
|
import fs2 from "node:fs";
|
|
38769
38772
|
import path4 from "node:path";
|
|
38770
38773
|
function emptyConfig() {
|
|
38771
|
-
return { version: 1, skills: {} };
|
|
38774
|
+
return { version: 1, skills: {}, sources: [] };
|
|
38772
38775
|
}
|
|
38773
38776
|
function loadConfig() {
|
|
38774
38777
|
const p = configPath();
|
|
38775
38778
|
if (!fs2.existsSync(p)) return emptyConfig();
|
|
38776
38779
|
const data = (0, import_yaml.parse)(fs2.readFileSync(p, "utf8"));
|
|
38777
38780
|
if (!data || typeof data !== "object") return emptyConfig();
|
|
38778
|
-
return {
|
|
38781
|
+
return {
|
|
38782
|
+
version: 1,
|
|
38783
|
+
skills: data.skills ?? {},
|
|
38784
|
+
sources: Array.isArray(data.sources) ? data.sources : []
|
|
38785
|
+
};
|
|
38779
38786
|
}
|
|
38780
38787
|
function lockPath() {
|
|
38781
38788
|
return path4.join(skillpotHome(), "skillspot.lock.json");
|
|
@@ -38915,7 +38922,10 @@ async function installFromGit(repoSpec, nameOverride) {
|
|
|
38915
38922
|
const [url, sub] = repoSpec.split("#");
|
|
38916
38923
|
const tmp = fs4.mkdtempSync(path6.join(os2.tmpdir(), "skillpot-clone-"));
|
|
38917
38924
|
try {
|
|
38918
|
-
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
|
+
});
|
|
38919
38929
|
const srcDir = sub ? path6.join(tmp, sub) : tmp;
|
|
38920
38930
|
return installFromLocal(srcDir, nameOverride);
|
|
38921
38931
|
} finally {
|
|
@@ -39209,25 +39219,126 @@ function uninstallSkill(name) {
|
|
|
39209
39219
|
saveConfig(config);
|
|
39210
39220
|
}
|
|
39211
39221
|
|
|
39212
|
-
// src/core/
|
|
39222
|
+
// src/core/market.ts
|
|
39223
|
+
import crypto2 from "node:crypto";
|
|
39213
39224
|
import fs7 from "node:fs";
|
|
39214
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 BUILTIN_SOURCES = [
|
|
39231
|
+
{ name: "Anthropic \u5B98\u65B9\u6280\u80FD\u5E93", url: OFFICIAL_URL, builtin: true },
|
|
39232
|
+
{ name: "Vercel \u5B98\u65B9\u6280\u80FD\u96C6", url: "https://github.com/vercel-labs/agent-skills.git", builtin: true },
|
|
39233
|
+
{ name: "Superpowers \u793E\u533A\u6280\u80FD\u96C6", url: "https://github.com/obra/superpowers.git", builtin: true },
|
|
39234
|
+
{ name: "Matt Pocock \u6280\u80FD\u96C6", url: "https://github.com/mattpocock/skills.git", builtin: true }
|
|
39235
|
+
];
|
|
39236
|
+
function listSources() {
|
|
39237
|
+
const config = loadConfig();
|
|
39238
|
+
return [...BUILTIN_SOURCES, ...(config.sources ?? []).map((s) => ({ name: s.name ?? urlLabel(s.url), url: s.url, builtin: false }))];
|
|
39239
|
+
}
|
|
39240
|
+
function urlLabel(url) {
|
|
39241
|
+
const tail = url.replace(/\.git$/, "").replace(/\/+$/, "");
|
|
39242
|
+
return tail.split("/").pop() ?? tail;
|
|
39243
|
+
}
|
|
39244
|
+
function addSource(url, name) {
|
|
39245
|
+
if (!isGitSource(url)) throw new Error(`\u4E0D\u662F\u5408\u6CD5\u7684 git \u5730\u5740\uFF1A${url}`);
|
|
39246
|
+
if (BUILTIN_SOURCES.some((s) => s.url === url)) throw new Error("\u5185\u7F6E\u6E90\u5DF2\u5B58\u5728\uFF0C\u65E0\u9700\u6DFB\u52A0");
|
|
39247
|
+
const config = loadConfig();
|
|
39248
|
+
config.sources = config.sources ?? [];
|
|
39249
|
+
if (config.sources.some((s) => s.url === url)) throw new Error(`\u6E90\u5DF2\u5B58\u5728\uFF1A${url}`);
|
|
39250
|
+
const entry = {
|
|
39251
|
+
url,
|
|
39252
|
+
name: name?.trim() || void 0,
|
|
39253
|
+
added_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
39254
|
+
};
|
|
39255
|
+
config.sources.push(entry);
|
|
39256
|
+
saveConfig(config);
|
|
39257
|
+
return { name: entry.name ?? urlLabel(url), url, builtin: false };
|
|
39258
|
+
}
|
|
39259
|
+
function removeSource(url) {
|
|
39260
|
+
if (BUILTIN_SOURCES.some((s) => s.url === url)) throw new Error("\u5185\u7F6E\u6E90\u4E0D\u53EF\u79FB\u9664");
|
|
39261
|
+
const config = loadConfig();
|
|
39262
|
+
const before = (config.sources ?? []).length;
|
|
39263
|
+
config.sources = (config.sources ?? []).filter((s) => s.url !== url);
|
|
39264
|
+
if (config.sources.length === before) throw new Error(`\u6E90\u4E0D\u5B58\u5728\uFF1A${url}`);
|
|
39265
|
+
saveConfig(config);
|
|
39266
|
+
fs7.rmSync(cacheDirFor(url), { recursive: true, force: true });
|
|
39267
|
+
}
|
|
39268
|
+
var IGNORED = /* @__PURE__ */ new Set([".git", ".github", "node_modules"]);
|
|
39269
|
+
function cacheDirFor(url) {
|
|
39270
|
+
const hash = crypto2.createHash("sha256").update(url).digest("hex").slice(0, 16);
|
|
39271
|
+
return path10.join(marketCacheDir(), hash);
|
|
39272
|
+
}
|
|
39273
|
+
async function scanSource(url, opts = {}) {
|
|
39274
|
+
if (!isGitSource(url)) throw new Error(`\u4E0D\u662F\u5408\u6CD5\u7684 git \u5730\u5740\uFF1A${url}`);
|
|
39275
|
+
const dir = cacheDirFor(url);
|
|
39276
|
+
let cloned = false;
|
|
39277
|
+
if (opts.refresh || !fs7.existsSync(path10.join(dir, ".git"))) {
|
|
39278
|
+
fs7.rmSync(dir, { recursive: true, force: true });
|
|
39279
|
+
const tmp = `${dir}.tmp-${crypto2.randomBytes(4).toString("hex")}`;
|
|
39280
|
+
fs7.mkdirSync(path10.dirname(dir), { recursive: true });
|
|
39281
|
+
try {
|
|
39282
|
+
await execFileP2("git", ["clone", "--depth", "1", url, tmp], {
|
|
39283
|
+
timeout: 3e5,
|
|
39284
|
+
maxBuffer: 16 * 1024 * 1024
|
|
39285
|
+
});
|
|
39286
|
+
await fs7.promises.rename(tmp, dir);
|
|
39287
|
+
} catch (e) {
|
|
39288
|
+
fs7.rmSync(tmp, { recursive: true, force: true });
|
|
39289
|
+
throw new Error(`\u514B\u9686\u5931\u8D25\uFF1A${e instanceof Error ? e.message : String(e)}`);
|
|
39290
|
+
}
|
|
39291
|
+
cloned = true;
|
|
39292
|
+
}
|
|
39293
|
+
const config = loadConfig();
|
|
39294
|
+
const skills = [];
|
|
39295
|
+
const walk = (d) => {
|
|
39296
|
+
for (const e of fs7.readdirSync(d, { withFileTypes: true })) {
|
|
39297
|
+
if (e.name.startsWith(".") || IGNORED.has(e.name)) continue;
|
|
39298
|
+
const p = path10.join(d, e.name);
|
|
39299
|
+
if (!e.isDirectory()) continue;
|
|
39300
|
+
if (fs7.existsSync(path10.join(p, "SKILL.md"))) {
|
|
39301
|
+
const meta = readSkillMeta(p);
|
|
39302
|
+
const name = String(meta?.name ?? e.name);
|
|
39303
|
+
skills.push({
|
|
39304
|
+
name,
|
|
39305
|
+
subdir: path10.relative(dir, p).split(path10.sep).join("/"),
|
|
39306
|
+
description: String(meta?.description ?? ""),
|
|
39307
|
+
installed: !!config.skills[name]
|
|
39308
|
+
});
|
|
39309
|
+
}
|
|
39310
|
+
walk(p);
|
|
39311
|
+
}
|
|
39312
|
+
};
|
|
39313
|
+
walk(dir);
|
|
39314
|
+
return { url, skills, cloned };
|
|
39315
|
+
}
|
|
39316
|
+
async function installFromMarket(url, subdir, opts = {}) {
|
|
39317
|
+
if (!subdir || subdir.includes("..") || subdir.startsWith("/")) {
|
|
39318
|
+
throw new Error(`\u975E\u6CD5\u5B50\u76EE\u5F55\uFF1A${subdir}`);
|
|
39319
|
+
}
|
|
39320
|
+
return addSkill(`${url}#${subdir}`, { name: opts.name, for: opts.for });
|
|
39321
|
+
}
|
|
39322
|
+
|
|
39323
|
+
// src/core/doctor.ts
|
|
39324
|
+
import fs8 from "node:fs";
|
|
39325
|
+
import path11 from "node:path";
|
|
39215
39326
|
function runDoctor() {
|
|
39216
39327
|
const issues = [];
|
|
39217
39328
|
const config = loadConfig();
|
|
39218
39329
|
const state = loadState();
|
|
39219
39330
|
const home = agentHome();
|
|
39220
39331
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39221
|
-
if (!
|
|
39332
|
+
if (!fs8.existsSync(path11.join(skillDir(name), "SKILL.md"))) {
|
|
39222
39333
|
issues.push({
|
|
39223
39334
|
level: "error",
|
|
39224
39335
|
message: `config \u4E2D\u7684 '${name}' \u5728\u4E2D\u592E\u4ED3\u5E93\u7F3A\u5931\uFF08source=${entry.source}\uFF09`
|
|
39225
39336
|
});
|
|
39226
39337
|
}
|
|
39227
39338
|
}
|
|
39228
|
-
if (
|
|
39229
|
-
for (const e of
|
|
39230
|
-
if (e.isDirectory() && !config.skills[e.name] &&
|
|
39339
|
+
if (fs8.existsSync(storeDir())) {
|
|
39340
|
+
for (const e of fs8.readdirSync(storeDir(), { withFileTypes: true })) {
|
|
39341
|
+
if (e.isDirectory() && !config.skills[e.name] && fs8.existsSync(path11.join(storeDir(), e.name, "SKILL.md"))) {
|
|
39231
39342
|
issues.push({
|
|
39232
39343
|
level: "warn",
|
|
39233
39344
|
message: `\u4E2D\u592E\u4ED3\u5E93\u4E2D\u7684 '${e.name}' \u672A\u767B\u8BB0\u8FDB config\uFF08\u624B\u52A8\u62F7\u5165\uFF1F\uFF09`,
|
|
@@ -39239,7 +39350,7 @@ function runDoctor() {
|
|
|
39239
39350
|
for (const link2 of state.links) {
|
|
39240
39351
|
let st = null;
|
|
39241
39352
|
try {
|
|
39242
|
-
st =
|
|
39353
|
+
st = fs8.lstatSync(link2.link_path);
|
|
39243
39354
|
} catch {
|
|
39244
39355
|
}
|
|
39245
39356
|
if (!st) {
|
|
@@ -39257,7 +39368,7 @@ function runDoctor() {
|
|
|
39257
39368
|
});
|
|
39258
39369
|
continue;
|
|
39259
39370
|
}
|
|
39260
|
-
if (!
|
|
39371
|
+
if (!fs8.existsSync(link2.link_path)) {
|
|
39261
39372
|
issues.push({
|
|
39262
39373
|
level: "error",
|
|
39263
39374
|
message: `\u65AD\u94FE\uFF1A${link2.link_path} \u6307\u5411\u7684\u76EE\u6807\u4E0D\u5B58\u5728`,
|
|
@@ -39267,19 +39378,19 @@ function runDoctor() {
|
|
|
39267
39378
|
}
|
|
39268
39379
|
for (const agent of AGENTS) {
|
|
39269
39380
|
const dir = agent.skillsDir(home);
|
|
39270
|
-
if (!
|
|
39381
|
+
if (!fs8.existsSync(dir)) continue;
|
|
39271
39382
|
let entries = [];
|
|
39272
39383
|
try {
|
|
39273
|
-
entries =
|
|
39384
|
+
entries = fs8.readdirSync(dir, { withFileTypes: true });
|
|
39274
39385
|
} catch {
|
|
39275
39386
|
continue;
|
|
39276
39387
|
}
|
|
39277
39388
|
for (const e of entries) {
|
|
39278
39389
|
if (!e.isSymbolicLink()) continue;
|
|
39279
|
-
const linkPath =
|
|
39390
|
+
const linkPath = path11.join(dir, e.name);
|
|
39280
39391
|
let target = "";
|
|
39281
39392
|
try {
|
|
39282
|
-
target =
|
|
39393
|
+
target = fs8.readlinkSync(linkPath);
|
|
39283
39394
|
} catch {
|
|
39284
39395
|
continue;
|
|
39285
39396
|
}
|
|
@@ -39295,8 +39406,8 @@ function runDoctor() {
|
|
|
39295
39406
|
}
|
|
39296
39407
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39297
39408
|
for (const agent of AGENTS) {
|
|
39298
|
-
const target =
|
|
39299
|
-
const exposed =
|
|
39409
|
+
const target = path11.join(agent.skillsDir(home), name);
|
|
39410
|
+
const exposed = fs8.existsSync(target);
|
|
39300
39411
|
const wanted = entry.expose[agent.id] === true;
|
|
39301
39412
|
if (wanted && !exposed) {
|
|
39302
39413
|
issues.push({
|
|
@@ -39321,7 +39432,7 @@ function fixDoctor() {
|
|
|
39321
39432
|
state.links = state.links.filter((l) => {
|
|
39322
39433
|
let ok = false;
|
|
39323
39434
|
try {
|
|
39324
|
-
ok =
|
|
39435
|
+
ok = fs8.existsSync(l.link_path) && fs8.lstatSync(l.link_path).isSymbolicLink();
|
|
39325
39436
|
} catch {
|
|
39326
39437
|
ok = false;
|
|
39327
39438
|
}
|
|
@@ -39334,10 +39445,10 @@ function fixDoctor() {
|
|
|
39334
39445
|
saveState(state);
|
|
39335
39446
|
const config = loadConfig();
|
|
39336
39447
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39337
|
-
if (!
|
|
39448
|
+
if (!fs8.existsSync(path11.join(skillDir(name), "SKILL.md"))) continue;
|
|
39338
39449
|
for (const agent of AGENTS) {
|
|
39339
|
-
const target =
|
|
39340
|
-
const exposed =
|
|
39450
|
+
const target = path11.join(agent.skillsDir(agentHome()), name);
|
|
39451
|
+
const exposed = fs8.existsSync(target);
|
|
39341
39452
|
const wanted = entry.expose[agent.id] === true;
|
|
39342
39453
|
if (wanted && !exposed) {
|
|
39343
39454
|
try {
|
|
@@ -39359,7 +39470,7 @@ function fixDoctor() {
|
|
|
39359
39470
|
function isOurSymlink(target, state, skill, agentId) {
|
|
39360
39471
|
let isLink = false;
|
|
39361
39472
|
try {
|
|
39362
|
-
isLink =
|
|
39473
|
+
isLink = fs8.lstatSync(target).isSymbolicLink();
|
|
39363
39474
|
} catch {
|
|
39364
39475
|
return false;
|
|
39365
39476
|
}
|
|
@@ -39370,13 +39481,13 @@ function isOurSymlink(target, state, skill, agentId) {
|
|
|
39370
39481
|
if (inLedger) return true;
|
|
39371
39482
|
let real = null;
|
|
39372
39483
|
try {
|
|
39373
|
-
real =
|
|
39484
|
+
real = fs8.realpathSync(target);
|
|
39374
39485
|
} catch {
|
|
39375
39486
|
return false;
|
|
39376
39487
|
}
|
|
39377
39488
|
let storeReal = null;
|
|
39378
39489
|
try {
|
|
39379
|
-
storeReal =
|
|
39490
|
+
storeReal = fs8.realpathSync(skillDir(skill));
|
|
39380
39491
|
} catch {
|
|
39381
39492
|
return false;
|
|
39382
39493
|
}
|
|
@@ -39384,21 +39495,21 @@ function isOurSymlink(target, state, skill, agentId) {
|
|
|
39384
39495
|
}
|
|
39385
39496
|
function sameRealPath(a, b) {
|
|
39386
39497
|
try {
|
|
39387
|
-
return
|
|
39498
|
+
return fs8.realpathSync(a) === fs8.realpathSync(b);
|
|
39388
39499
|
} catch {
|
|
39389
39500
|
return false;
|
|
39390
39501
|
}
|
|
39391
39502
|
}
|
|
39392
39503
|
|
|
39393
39504
|
// src/core/adopt.ts
|
|
39394
|
-
import
|
|
39395
|
-
import
|
|
39505
|
+
import fs9 from "node:fs";
|
|
39506
|
+
import path12 from "node:path";
|
|
39396
39507
|
function isManagedByStore(dir) {
|
|
39397
39508
|
try {
|
|
39398
|
-
if (!
|
|
39399
|
-
const real =
|
|
39400
|
-
const storeReal =
|
|
39401
|
-
return real === storeReal || real.startsWith(storeReal +
|
|
39509
|
+
if (!fs9.lstatSync(dir).isSymbolicLink()) return false;
|
|
39510
|
+
const real = fs9.realpathSync(dir);
|
|
39511
|
+
const storeReal = fs9.realpathSync(storeDir());
|
|
39512
|
+
return real === storeReal || real.startsWith(storeReal + path12.sep);
|
|
39402
39513
|
} catch {
|
|
39403
39514
|
return false;
|
|
39404
39515
|
}
|
|
@@ -39407,13 +39518,13 @@ function scanAgentSkills(agentId) {
|
|
|
39407
39518
|
const agent = getAgent(agentId);
|
|
39408
39519
|
if (!agent) throw new Error(`\u672A\u77E5 agent '${agentId}'`);
|
|
39409
39520
|
const dir = agent.skillsDir(agentHome());
|
|
39410
|
-
if (!
|
|
39521
|
+
if (!fs9.existsSync(dir)) return [];
|
|
39411
39522
|
const out = [];
|
|
39412
|
-
for (const e of
|
|
39523
|
+
for (const e of fs9.readdirSync(dir, { withFileTypes: true })) {
|
|
39413
39524
|
if (e.name.startsWith(".")) continue;
|
|
39414
39525
|
if (!e.isDirectory() && !e.isSymbolicLink()) continue;
|
|
39415
|
-
const p =
|
|
39416
|
-
if (!
|
|
39526
|
+
const p = path12.join(dir, e.name);
|
|
39527
|
+
if (!fs9.existsSync(path12.join(p, "SKILL.md"))) continue;
|
|
39417
39528
|
out.push({ name: e.name, path: p });
|
|
39418
39529
|
}
|
|
39419
39530
|
return out;
|
|
@@ -39421,7 +39532,7 @@ function scanAgentSkills(agentId) {
|
|
|
39421
39532
|
function scanAdoptable(agentId) {
|
|
39422
39533
|
return scanAgentSkills(agentId).filter((s) => {
|
|
39423
39534
|
try {
|
|
39424
|
-
return !
|
|
39535
|
+
return !fs9.lstatSync(s.path).isSymbolicLink();
|
|
39425
39536
|
} catch {
|
|
39426
39537
|
return false;
|
|
39427
39538
|
}
|
|
@@ -39452,7 +39563,7 @@ function adoptSkills(opts = {}) {
|
|
|
39452
39563
|
}
|
|
39453
39564
|
let isOwnSymlink = false;
|
|
39454
39565
|
try {
|
|
39455
|
-
isOwnSymlink =
|
|
39566
|
+
isOwnSymlink = fs9.lstatSync(skill.path).isSymbolicLink();
|
|
39456
39567
|
} catch {
|
|
39457
39568
|
}
|
|
39458
39569
|
if (isOwnSymlink) {
|
|
@@ -39472,7 +39583,7 @@ function adoptSkills(opts = {}) {
|
|
|
39472
39583
|
items.push({ agent: agentId, name: skill.name, path: skill.path, status: "skipped-invalid", detail: "\u76EE\u5F55\u540D\u4E0D\u5408\u6CD5" });
|
|
39473
39584
|
continue;
|
|
39474
39585
|
}
|
|
39475
|
-
const existsInStore = !!config.skills[name] ||
|
|
39586
|
+
const existsInStore = !!config.skills[name] || fs9.existsSync(skillDir(name));
|
|
39476
39587
|
if (opts.dryRun) {
|
|
39477
39588
|
items.push({
|
|
39478
39589
|
agent: agentId,
|
|
@@ -39529,7 +39640,7 @@ function adoptSkills(opts = {}) {
|
|
|
39529
39640
|
saveConfig(config);
|
|
39530
39641
|
for (const mv of pendingMoves) {
|
|
39531
39642
|
try {
|
|
39532
|
-
|
|
39643
|
+
fs9.rmSync(mv.path, { recursive: true, force: true });
|
|
39533
39644
|
enableSkill(mv.name, [mv.agentId]);
|
|
39534
39645
|
items.push({
|
|
39535
39646
|
agent: mv.agentId,
|
|
@@ -39564,27 +39675,30 @@ function adoptSkills(opts = {}) {
|
|
|
39564
39675
|
}
|
|
39565
39676
|
|
|
39566
39677
|
// src/core/update.ts
|
|
39567
|
-
import
|
|
39678
|
+
import fs10 from "node:fs";
|
|
39568
39679
|
import os3 from "node:os";
|
|
39569
|
-
import
|
|
39570
|
-
import { execFile as
|
|
39571
|
-
import { promisify as
|
|
39572
|
-
var
|
|
39680
|
+
import path13 from "node:path";
|
|
39681
|
+
import { execFile as execFile3 } from "node:child_process";
|
|
39682
|
+
import { promisify as promisify3 } from "node:util";
|
|
39683
|
+
var execFileP3 = promisify3(execFile3);
|
|
39573
39684
|
function parseGitSource(source) {
|
|
39574
39685
|
return source.startsWith("git:") ? source.slice(4) : null;
|
|
39575
39686
|
}
|
|
39576
39687
|
async function fetchRemote(repoSpec) {
|
|
39577
39688
|
const [url, sub] = repoSpec.split("#");
|
|
39578
|
-
const cloneDir =
|
|
39689
|
+
const cloneDir = fs10.mkdtempSync(path13.join(os3.tmpdir(), "skillpot-update-"));
|
|
39579
39690
|
try {
|
|
39580
|
-
await
|
|
39581
|
-
|
|
39582
|
-
|
|
39691
|
+
await execFileP3("git", ["clone", "--depth", "1", url, cloneDir], {
|
|
39692
|
+
timeout: 3e5,
|
|
39693
|
+
maxBuffer: 16 * 1024 * 1024
|
|
39694
|
+
});
|
|
39695
|
+
const contentDir = sub ? path13.join(cloneDir, sub) : cloneDir;
|
|
39696
|
+
if (!fs10.existsSync(path13.join(contentDir, "SKILL.md"))) {
|
|
39583
39697
|
throw new Error(`\u8FDC\u7AEF ${sub ? `#${sub} ` : ""}\u4E2D\u6CA1\u6709 SKILL.md`);
|
|
39584
39698
|
}
|
|
39585
39699
|
return { checksum: dirChecksum(contentDir), cloneDir, sub };
|
|
39586
39700
|
} catch (e) {
|
|
39587
|
-
|
|
39701
|
+
fs10.rmSync(cloneDir, { recursive: true, force: true });
|
|
39588
39702
|
throw e;
|
|
39589
39703
|
}
|
|
39590
39704
|
}
|
|
@@ -39603,7 +39717,7 @@ async function updateSkills(name, opts = {}) {
|
|
|
39603
39717
|
results.push({ skill: n, status: "local", detail: entry.source });
|
|
39604
39718
|
continue;
|
|
39605
39719
|
}
|
|
39606
|
-
if (!
|
|
39720
|
+
if (!fs10.existsSync(skillDir(n))) {
|
|
39607
39721
|
results.push({ skill: n, status: "error", detail: "\u4E2D\u592E\u4ED3\u5E93\u7F3A\u5931" });
|
|
39608
39722
|
continue;
|
|
39609
39723
|
}
|
|
@@ -39618,20 +39732,20 @@ async function updateSkills(name, opts = {}) {
|
|
|
39618
39732
|
results.push({ skill: n, status: "outdated", detail: `\u8FDC\u7AEF ${fetched.checksum.slice(0, 15)}` });
|
|
39619
39733
|
continue;
|
|
39620
39734
|
}
|
|
39621
|
-
const staging =
|
|
39735
|
+
const staging = fs10.mkdtempSync(path13.join(os3.tmpdir(), "skillpot-new-"));
|
|
39622
39736
|
try {
|
|
39623
|
-
const srcDir = fetched.sub ?
|
|
39624
|
-
|
|
39625
|
-
|
|
39626
|
-
|
|
39737
|
+
const srcDir = fetched.sub ? path13.join(fetched.cloneDir, fetched.sub) : fetched.cloneDir;
|
|
39738
|
+
fs10.cpSync(srcDir, staging, { recursive: true });
|
|
39739
|
+
fs10.rmSync(skillDir(n), { recursive: true, force: true });
|
|
39740
|
+
fs10.cpSync(staging, skillDir(n), { recursive: true });
|
|
39627
39741
|
} finally {
|
|
39628
|
-
|
|
39742
|
+
fs10.rmSync(staging, { recursive: true, force: true });
|
|
39629
39743
|
}
|
|
39630
39744
|
entry.checksum = dirChecksum(skillDir(n));
|
|
39631
39745
|
entry.installed_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
39632
39746
|
results.push({ skill: n, status: "updated", detail: entry.checksum.slice(0, 15) });
|
|
39633
39747
|
} finally {
|
|
39634
|
-
|
|
39748
|
+
fs10.rmSync(fetched.cloneDir, { recursive: true, force: true });
|
|
39635
39749
|
}
|
|
39636
39750
|
} catch (e) {
|
|
39637
39751
|
results.push({ skill: n, status: "error", detail: e instanceof Error ? e.message : String(e) });
|
|
@@ -39645,21 +39759,21 @@ async function updateSkills(name, opts = {}) {
|
|
|
39645
39759
|
import readline from "node:readline";
|
|
39646
39760
|
|
|
39647
39761
|
// src/core/skill-detail.ts
|
|
39648
|
-
import
|
|
39649
|
-
import
|
|
39762
|
+
import fs11 from "node:fs";
|
|
39763
|
+
import path14 from "node:path";
|
|
39650
39764
|
function readSkillDetail(name) {
|
|
39651
39765
|
const dir = skillDir(name);
|
|
39652
|
-
const mdPath =
|
|
39653
|
-
if (!
|
|
39766
|
+
const mdPath = path14.join(dir, "SKILL.md");
|
|
39767
|
+
if (!fs11.existsSync(mdPath)) return null;
|
|
39654
39768
|
const files = [];
|
|
39655
39769
|
const walk = (d) => {
|
|
39656
|
-
for (const e of
|
|
39657
|
-
const p =
|
|
39770
|
+
for (const e of fs11.readdirSync(d, { withFileTypes: true })) {
|
|
39771
|
+
const p = path14.join(d, e.name);
|
|
39658
39772
|
if (e.isDirectory()) {
|
|
39659
|
-
files.push(
|
|
39773
|
+
files.push(path14.relative(dir, p) + "/");
|
|
39660
39774
|
walk(p);
|
|
39661
39775
|
} else {
|
|
39662
|
-
files.push(
|
|
39776
|
+
files.push(path14.relative(dir, p));
|
|
39663
39777
|
}
|
|
39664
39778
|
}
|
|
39665
39779
|
};
|
|
@@ -39668,7 +39782,7 @@ function readSkillDetail(name) {
|
|
|
39668
39782
|
name,
|
|
39669
39783
|
meta: readSkillMeta(dir),
|
|
39670
39784
|
files: files.sort(),
|
|
39671
|
-
skillMd:
|
|
39785
|
+
skillMd: fs11.readFileSync(mdPath, "utf8")
|
|
39672
39786
|
};
|
|
39673
39787
|
}
|
|
39674
39788
|
|
|
@@ -39798,16 +39912,16 @@ function startMcpServer() {
|
|
|
39798
39912
|
}
|
|
39799
39913
|
|
|
39800
39914
|
// src/core/gui-server.ts
|
|
39801
|
-
import
|
|
39802
|
-
import
|
|
39915
|
+
import crypto3 from "node:crypto";
|
|
39916
|
+
import fs13 from "node:fs";
|
|
39803
39917
|
import http from "node:http";
|
|
39804
|
-
import
|
|
39918
|
+
import path16 from "node:path";
|
|
39805
39919
|
import { spawn } from "node:child_process";
|
|
39806
39920
|
import { fileURLToPath } from "node:url";
|
|
39807
39921
|
|
|
39808
39922
|
// src/tui/matrix.ts
|
|
39809
|
-
import
|
|
39810
|
-
import
|
|
39923
|
+
import fs12 from "node:fs";
|
|
39924
|
+
import path15 from "node:path";
|
|
39811
39925
|
function deriveMatrix(agents) {
|
|
39812
39926
|
const config = loadConfig();
|
|
39813
39927
|
const skills = Object.keys(config.skills).sort();
|
|
@@ -39821,13 +39935,13 @@ function deriveMatrix(agents) {
|
|
|
39821
39935
|
for (const s of skills) {
|
|
39822
39936
|
cells[s] = {};
|
|
39823
39937
|
for (const a of list) {
|
|
39824
|
-
const target =
|
|
39938
|
+
const target = path15.join(a.skillsDir, s);
|
|
39825
39939
|
let actual = false;
|
|
39826
39940
|
let managed = false;
|
|
39827
39941
|
try {
|
|
39828
|
-
const st =
|
|
39942
|
+
const st = fs12.lstatSync(target);
|
|
39829
39943
|
actual = true;
|
|
39830
|
-
managed = st.isSymbolicLink() &&
|
|
39944
|
+
managed = st.isSymbolicLink() && fs12.realpathSync(target) === fs12.realpathSync(skillDir(s));
|
|
39831
39945
|
} catch {
|
|
39832
39946
|
}
|
|
39833
39947
|
cells[s][a.id] = {
|
|
@@ -39950,7 +40064,7 @@ async function handleApiRequest(method, pathname, query, body, expectedToken, go
|
|
|
39950
40064
|
let inStore = false;
|
|
39951
40065
|
try {
|
|
39952
40066
|
const n = sanitizeSkillName(s.name);
|
|
39953
|
-
inStore = !!config.skills[n] ||
|
|
40067
|
+
inStore = !!config.skills[n] || fs13.existsSync(skillDir(n));
|
|
39954
40068
|
} catch {
|
|
39955
40069
|
valid = false;
|
|
39956
40070
|
}
|
|
@@ -40006,6 +40120,60 @@ async function handleApiRequest(method, pathname, query, body, expectedToken, go
|
|
|
40006
40120
|
uninstallSkill(b.skill);
|
|
40007
40121
|
return { status: 200, body: { ok: true, message: `\u5DF2\u5378\u8F7D ${b.skill}` } };
|
|
40008
40122
|
}
|
|
40123
|
+
if (method === "POST" && pathname === "/api/bulk") {
|
|
40124
|
+
const b = body ?? {};
|
|
40125
|
+
if (typeof b.agent !== "string" || typeof b.enable !== "boolean") {
|
|
40126
|
+
return { status: 400, body: { error: "\u9700\u8981 agent \u5B57\u7B26\u4E32\u4E0E enable \u5E03\u5C14\u5B57\u6BB5" } };
|
|
40127
|
+
}
|
|
40128
|
+
const names = Object.keys(loadConfig().skills).sort();
|
|
40129
|
+
const changed = [];
|
|
40130
|
+
const skipped = [];
|
|
40131
|
+
for (const n of names) {
|
|
40132
|
+
try {
|
|
40133
|
+
const r = b.enable ? enableSkill(n, [b.agent]) : disableSkill(n, [b.agent]);
|
|
40134
|
+
if (r.linked.length) changed.push(n);
|
|
40135
|
+
else if (r.skipped.length) skipped.push({ skill: n, reason: r.skipped[0].reason });
|
|
40136
|
+
} catch (e) {
|
|
40137
|
+
skipped.push({ skill: n, reason: e instanceof Error ? e.message : String(e) });
|
|
40138
|
+
}
|
|
40139
|
+
}
|
|
40140
|
+
return { status: 200, body: { changed, skipped } };
|
|
40141
|
+
}
|
|
40142
|
+
if (method === "GET" && pathname === "/api/market/sources") {
|
|
40143
|
+
return { status: 200, body: { sources: listSources() } };
|
|
40144
|
+
}
|
|
40145
|
+
if (method === "POST" && pathname === "/api/market/sources/add") {
|
|
40146
|
+
const b = body ?? {};
|
|
40147
|
+
if (typeof b.url !== "string") return { status: 400, body: { error: "\u9700\u8981 url \u5B57\u6BB5" } };
|
|
40148
|
+
const src = addSource(
|
|
40149
|
+
b.url.trim(),
|
|
40150
|
+
typeof b.name === "string" && b.name.trim() ? b.name.trim() : void 0
|
|
40151
|
+
);
|
|
40152
|
+
return { status: 200, body: { source: src } };
|
|
40153
|
+
}
|
|
40154
|
+
if (method === "POST" && pathname === "/api/market/sources/remove") {
|
|
40155
|
+
const b = body ?? {};
|
|
40156
|
+
if (typeof b.url !== "string") return { status: 400, body: { error: "\u9700\u8981 url \u5B57\u6BB5" } };
|
|
40157
|
+
removeSource(b.url);
|
|
40158
|
+
return { status: 200, body: { ok: true } };
|
|
40159
|
+
}
|
|
40160
|
+
if (method === "GET" && pathname === "/api/market/scan") {
|
|
40161
|
+
const url = query.get("url");
|
|
40162
|
+
if (!url) return { status: 400, body: { error: "\u9700\u8981 url \u67E5\u8BE2\u53C2\u6570" } };
|
|
40163
|
+
const result = await scanSource(url, { refresh: query.get("refresh") === "1" });
|
|
40164
|
+
return { status: 200, body: result };
|
|
40165
|
+
}
|
|
40166
|
+
if (method === "POST" && pathname === "/api/market/install") {
|
|
40167
|
+
const b = body ?? {};
|
|
40168
|
+
if (typeof b.url !== "string" || typeof b.subdir !== "string") {
|
|
40169
|
+
return { status: 400, body: { error: "\u9700\u8981 url \u4E0E subdir \u5B57\u6BB5" } };
|
|
40170
|
+
}
|
|
40171
|
+
const result = await installFromMarket(b.url, b.subdir, {
|
|
40172
|
+
name: typeof b.name === "string" && b.name.trim() ? b.name.trim() : void 0,
|
|
40173
|
+
for: Array.isArray(b.for) ? b.for.filter((x) => typeof x === "string") : void 0
|
|
40174
|
+
});
|
|
40175
|
+
return { status: 200, body: result };
|
|
40176
|
+
}
|
|
40009
40177
|
if (method === "GET" && pathname === "/api/doctor") {
|
|
40010
40178
|
return { status: 200, body: { issues: runDoctor() } };
|
|
40011
40179
|
}
|
|
@@ -40067,40 +40235,40 @@ function openBrowser(url) {
|
|
|
40067
40235
|
}
|
|
40068
40236
|
function guiDistDir() {
|
|
40069
40237
|
const candidates = [
|
|
40070
|
-
|
|
40071
|
-
|
|
40238
|
+
path16.resolve(fileURLToPath(new URL("./gui/", import.meta.url))),
|
|
40239
|
+
path16.resolve(fileURLToPath(new URL("../../dist/gui/", import.meta.url)))
|
|
40072
40240
|
];
|
|
40073
40241
|
for (const dir of candidates) {
|
|
40074
|
-
if (
|
|
40242
|
+
if (fs13.existsSync(path16.join(dir, "index.html"))) return dir;
|
|
40075
40243
|
}
|
|
40076
40244
|
return candidates[0];
|
|
40077
40245
|
}
|
|
40078
40246
|
function serveStatic(pathname, res) {
|
|
40079
40247
|
const root = guiDistDir();
|
|
40080
|
-
if (!
|
|
40248
|
+
if (!fs13.existsSync(path16.join(root, "index.html"))) {
|
|
40081
40249
|
res.writeHead(503, { "content-type": "text/plain; charset=utf-8" });
|
|
40082
40250
|
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");
|
|
40083
40251
|
return;
|
|
40084
40252
|
}
|
|
40085
40253
|
const rel = pathname === "/" ? "index.html" : pathname.replace(/^\/+/, "");
|
|
40086
|
-
let file =
|
|
40087
|
-
if (!file.startsWith(root +
|
|
40254
|
+
let file = path16.resolve(root, rel);
|
|
40255
|
+
if (!file.startsWith(root + path16.sep) && file !== root) {
|
|
40088
40256
|
res.writeHead(403, { "content-type": "text/plain; charset=utf-8" });
|
|
40089
40257
|
res.end("forbidden");
|
|
40090
40258
|
return;
|
|
40091
40259
|
}
|
|
40092
|
-
if (!
|
|
40093
|
-
file =
|
|
40260
|
+
if (!fs13.existsSync(file) || fs13.statSync(file).isDirectory()) {
|
|
40261
|
+
file = path16.join(root, "index.html");
|
|
40094
40262
|
}
|
|
40095
|
-
const ext =
|
|
40263
|
+
const ext = path16.extname(file).toLowerCase();
|
|
40096
40264
|
res.writeHead(200, {
|
|
40097
40265
|
"content-type": MIME[ext] ?? "application/octet-stream",
|
|
40098
40266
|
"cache-control": rel.startsWith("assets/") ? "public, max-age=31536000, immutable" : "no-store"
|
|
40099
40267
|
});
|
|
40100
|
-
|
|
40268
|
+
fs13.createReadStream(file).pipe(res);
|
|
40101
40269
|
}
|
|
40102
40270
|
async function startGuiServer(opts = {}) {
|
|
40103
|
-
const token =
|
|
40271
|
+
const token = crypto3.randomBytes(16).toString("hex");
|
|
40104
40272
|
const host = opts.host ?? "127.0.0.1";
|
|
40105
40273
|
const readAuthRequired = !["127.0.0.1", "localhost", "::1"].includes(host);
|
|
40106
40274
|
const sseClients = /* @__PURE__ */ new Set();
|
|
@@ -44781,7 +44949,7 @@ var FocusContext_default = FocusContext;
|
|
|
44781
44949
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
44782
44950
|
var import_react8 = __toESM(require_react(), 1);
|
|
44783
44951
|
var import_stack_utils = __toESM(require_stack_utils(), 1);
|
|
44784
|
-
import * as
|
|
44952
|
+
import * as fs14 from "node:fs";
|
|
44785
44953
|
import { cwd } from "node:process";
|
|
44786
44954
|
|
|
44787
44955
|
// node_modules/convert-to-spaces/dist/index.js
|
|
@@ -44871,8 +45039,8 @@ function Text({ color, backgroundColor, dimColor = false, bold = false, italic =
|
|
|
44871
45039
|
}
|
|
44872
45040
|
|
|
44873
45041
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
44874
|
-
var cleanupPath = (
|
|
44875
|
-
return
|
|
45042
|
+
var cleanupPath = (path17) => {
|
|
45043
|
+
return path17?.replace(`file://${cwd()}/`, "");
|
|
44876
45044
|
};
|
|
44877
45045
|
var stackUtils = new import_stack_utils.default({
|
|
44878
45046
|
cwd: cwd(),
|
|
@@ -44884,8 +45052,8 @@ function ErrorOverview({ error }) {
|
|
|
44884
45052
|
const filePath = cleanupPath(origin?.file);
|
|
44885
45053
|
let excerpt;
|
|
44886
45054
|
let lineWidth = 0;
|
|
44887
|
-
if (filePath && origin?.line &&
|
|
44888
|
-
const sourceCode =
|
|
45055
|
+
if (filePath && origin?.line && fs14.existsSync(filePath)) {
|
|
45056
|
+
const sourceCode = fs14.readFileSync(filePath, "utf8");
|
|
44889
45057
|
excerpt = dist_default3(sourceCode, origin.line);
|
|
44890
45058
|
if (excerpt) {
|
|
44891
45059
|
for (const { line } of excerpt) {
|
|
@@ -46246,6 +46414,54 @@ program2.command("gui").description("\u542F\u52A8\u672C\u5730 Web \u63A7\u5236\u
|
|
|
46246
46414
|
console.log(import_picocolors2.default.dim("\u6309 Ctrl+C \u9000\u51FA"));
|
|
46247
46415
|
})
|
|
46248
46416
|
);
|
|
46417
|
+
var sourceCmd = program2.command("source").description("\u7BA1\u7406\u5E02\u573A\u6280\u80FD\u6E90\uFF08git \u4ED3\u5E93\uFF09");
|
|
46418
|
+
sourceCmd.command("list").description("\u5217\u51FA\u5DF2\u914D\u7F6E\u7684\u6280\u80FD\u6E90").action(
|
|
46419
|
+
run(() => {
|
|
46420
|
+
const rows = listSources().map((s) => [s.name, s.url, s.builtin ? "\u5185\u7F6E" : "\u81EA\u5B9A\u4E49"]);
|
|
46421
|
+
console.log(renderTable(["\u540D\u79F0", "URL", "\u7C7B\u578B"], rows));
|
|
46422
|
+
})
|
|
46423
|
+
);
|
|
46424
|
+
sourceCmd.command("add <url> [name]").description("\u6DFB\u52A0\u81EA\u5B9A\u4E49\u6280\u80FD\u6E90\uFF08git \u4ED3\u5E93\u5730\u5740\uFF09").action(
|
|
46425
|
+
run(async (url, name) => {
|
|
46426
|
+
const s = addSource(url, name);
|
|
46427
|
+
console.log(import_picocolors2.default.green(`\u2714 \u5DF2\u6DFB\u52A0\u6E90 ${s.name}\uFF1A${s.url}`));
|
|
46428
|
+
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`));
|
|
46429
|
+
})
|
|
46430
|
+
);
|
|
46431
|
+
sourceCmd.command("remove <url>").description("\u79FB\u9664\u81EA\u5B9A\u4E49\u6280\u80FD\u6E90").action(
|
|
46432
|
+
run((url) => {
|
|
46433
|
+
removeSource(url);
|
|
46434
|
+
console.log(import_picocolors2.default.green(`\u2714 \u5DF2\u79FB\u9664\u6E90 ${url}`));
|
|
46435
|
+
})
|
|
46436
|
+
);
|
|
46437
|
+
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(
|
|
46438
|
+
run(async (url, opts) => {
|
|
46439
|
+
const targets = url ? [url] : listSources().map((s) => s.url);
|
|
46440
|
+
for (const t of targets) {
|
|
46441
|
+
const r = await scanSource(t, { refresh: opts.refresh });
|
|
46442
|
+
console.log(
|
|
46443
|
+
import_picocolors2.default.bold(`${t}\uFF08${r.skills.length} \u4E2A skill\uFF0C${r.cloned ? "\u5DF2\u91CD\u65B0\u514B\u9686" : "\u672C\u5730\u7F13\u5B58"}\uFF09`)
|
|
46444
|
+
);
|
|
46445
|
+
if (r.skills.length) {
|
|
46446
|
+
console.log(
|
|
46447
|
+
renderTable(
|
|
46448
|
+
["Skill", "\u8BF4\u660E", "\u5B50\u76EE\u5F55", "\u5DF2\u88C5"],
|
|
46449
|
+
r.skills.map((s) => [
|
|
46450
|
+
s.name,
|
|
46451
|
+
s.description.slice(0, 56),
|
|
46452
|
+
s.subdir,
|
|
46453
|
+
s.installed ? "\u2713" : ""
|
|
46454
|
+
])
|
|
46455
|
+
)
|
|
46456
|
+
);
|
|
46457
|
+
}
|
|
46458
|
+
console.log();
|
|
46459
|
+
}
|
|
46460
|
+
console.log(
|
|
46461
|
+
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`)
|
|
46462
|
+
);
|
|
46463
|
+
})
|
|
46464
|
+
);
|
|
46249
46465
|
for (const cmd of program2.commands) cmd.allowExcessArguments(false);
|
|
46250
46466
|
await program2.parseAsync(process.argv);
|
|
46251
46467
|
/*! Bundled license information:
|