@tec-explorer/skillpot 0.5.1 → 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 +15 -1
- package/dist/cli.mjs +400 -204
- 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 +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,125 @@ 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 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";
|
|
39215
39325
|
function runDoctor() {
|
|
39216
39326
|
const issues = [];
|
|
39217
39327
|
const config = loadConfig();
|
|
39218
39328
|
const state = loadState();
|
|
39219
39329
|
const home = agentHome();
|
|
39220
39330
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39221
|
-
if (!
|
|
39331
|
+
if (!fs8.existsSync(path11.join(skillDir(name), "SKILL.md"))) {
|
|
39222
39332
|
issues.push({
|
|
39223
39333
|
level: "error",
|
|
39224
39334
|
message: `config \u4E2D\u7684 '${name}' \u5728\u4E2D\u592E\u4ED3\u5E93\u7F3A\u5931\uFF08source=${entry.source}\uFF09`
|
|
39225
39335
|
});
|
|
39226
39336
|
}
|
|
39227
39337
|
}
|
|
39228
|
-
if (
|
|
39229
|
-
for (const e of
|
|
39230
|
-
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"))) {
|
|
39231
39341
|
issues.push({
|
|
39232
39342
|
level: "warn",
|
|
39233
39343
|
message: `\u4E2D\u592E\u4ED3\u5E93\u4E2D\u7684 '${e.name}' \u672A\u767B\u8BB0\u8FDB config\uFF08\u624B\u52A8\u62F7\u5165\uFF1F\uFF09`,
|
|
@@ -39239,7 +39349,7 @@ function runDoctor() {
|
|
|
39239
39349
|
for (const link2 of state.links) {
|
|
39240
39350
|
let st = null;
|
|
39241
39351
|
try {
|
|
39242
|
-
st =
|
|
39352
|
+
st = fs8.lstatSync(link2.link_path);
|
|
39243
39353
|
} catch {
|
|
39244
39354
|
}
|
|
39245
39355
|
if (!st) {
|
|
@@ -39257,7 +39367,7 @@ function runDoctor() {
|
|
|
39257
39367
|
});
|
|
39258
39368
|
continue;
|
|
39259
39369
|
}
|
|
39260
|
-
if (!
|
|
39370
|
+
if (!fs8.existsSync(link2.link_path)) {
|
|
39261
39371
|
issues.push({
|
|
39262
39372
|
level: "error",
|
|
39263
39373
|
message: `\u65AD\u94FE\uFF1A${link2.link_path} \u6307\u5411\u7684\u76EE\u6807\u4E0D\u5B58\u5728`,
|
|
@@ -39267,19 +39377,19 @@ function runDoctor() {
|
|
|
39267
39377
|
}
|
|
39268
39378
|
for (const agent of AGENTS) {
|
|
39269
39379
|
const dir = agent.skillsDir(home);
|
|
39270
|
-
if (!
|
|
39380
|
+
if (!fs8.existsSync(dir)) continue;
|
|
39271
39381
|
let entries = [];
|
|
39272
39382
|
try {
|
|
39273
|
-
entries =
|
|
39383
|
+
entries = fs8.readdirSync(dir, { withFileTypes: true });
|
|
39274
39384
|
} catch {
|
|
39275
39385
|
continue;
|
|
39276
39386
|
}
|
|
39277
39387
|
for (const e of entries) {
|
|
39278
39388
|
if (!e.isSymbolicLink()) continue;
|
|
39279
|
-
const linkPath =
|
|
39389
|
+
const linkPath = path11.join(dir, e.name);
|
|
39280
39390
|
let target = "";
|
|
39281
39391
|
try {
|
|
39282
|
-
target =
|
|
39392
|
+
target = fs8.readlinkSync(linkPath);
|
|
39283
39393
|
} catch {
|
|
39284
39394
|
continue;
|
|
39285
39395
|
}
|
|
@@ -39295,8 +39405,8 @@ function runDoctor() {
|
|
|
39295
39405
|
}
|
|
39296
39406
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39297
39407
|
for (const agent of AGENTS) {
|
|
39298
|
-
const target =
|
|
39299
|
-
const exposed =
|
|
39408
|
+
const target = path11.join(agent.skillsDir(home), name);
|
|
39409
|
+
const exposed = fs8.existsSync(target);
|
|
39300
39410
|
const wanted = entry.expose[agent.id] === true;
|
|
39301
39411
|
if (wanted && !exposed) {
|
|
39302
39412
|
issues.push({
|
|
@@ -39321,7 +39431,7 @@ function fixDoctor() {
|
|
|
39321
39431
|
state.links = state.links.filter((l) => {
|
|
39322
39432
|
let ok = false;
|
|
39323
39433
|
try {
|
|
39324
|
-
ok =
|
|
39434
|
+
ok = fs8.existsSync(l.link_path) && fs8.lstatSync(l.link_path).isSymbolicLink();
|
|
39325
39435
|
} catch {
|
|
39326
39436
|
ok = false;
|
|
39327
39437
|
}
|
|
@@ -39334,10 +39444,10 @@ function fixDoctor() {
|
|
|
39334
39444
|
saveState(state);
|
|
39335
39445
|
const config = loadConfig();
|
|
39336
39446
|
for (const [name, entry] of Object.entries(config.skills)) {
|
|
39337
|
-
if (!
|
|
39447
|
+
if (!fs8.existsSync(path11.join(skillDir(name), "SKILL.md"))) continue;
|
|
39338
39448
|
for (const agent of AGENTS) {
|
|
39339
|
-
const target =
|
|
39340
|
-
const exposed =
|
|
39449
|
+
const target = path11.join(agent.skillsDir(agentHome()), name);
|
|
39450
|
+
const exposed = fs8.existsSync(target);
|
|
39341
39451
|
const wanted = entry.expose[agent.id] === true;
|
|
39342
39452
|
if (wanted && !exposed) {
|
|
39343
39453
|
try {
|
|
@@ -39359,7 +39469,7 @@ function fixDoctor() {
|
|
|
39359
39469
|
function isOurSymlink(target, state, skill, agentId) {
|
|
39360
39470
|
let isLink = false;
|
|
39361
39471
|
try {
|
|
39362
|
-
isLink =
|
|
39472
|
+
isLink = fs8.lstatSync(target).isSymbolicLink();
|
|
39363
39473
|
} catch {
|
|
39364
39474
|
return false;
|
|
39365
39475
|
}
|
|
@@ -39370,13 +39480,13 @@ function isOurSymlink(target, state, skill, agentId) {
|
|
|
39370
39480
|
if (inLedger) return true;
|
|
39371
39481
|
let real = null;
|
|
39372
39482
|
try {
|
|
39373
|
-
real =
|
|
39483
|
+
real = fs8.realpathSync(target);
|
|
39374
39484
|
} catch {
|
|
39375
39485
|
return false;
|
|
39376
39486
|
}
|
|
39377
39487
|
let storeReal = null;
|
|
39378
39488
|
try {
|
|
39379
|
-
storeReal =
|
|
39489
|
+
storeReal = fs8.realpathSync(skillDir(skill));
|
|
39380
39490
|
} catch {
|
|
39381
39491
|
return false;
|
|
39382
39492
|
}
|
|
@@ -39384,21 +39494,21 @@ function isOurSymlink(target, state, skill, agentId) {
|
|
|
39384
39494
|
}
|
|
39385
39495
|
function sameRealPath(a, b) {
|
|
39386
39496
|
try {
|
|
39387
|
-
return
|
|
39497
|
+
return fs8.realpathSync(a) === fs8.realpathSync(b);
|
|
39388
39498
|
} catch {
|
|
39389
39499
|
return false;
|
|
39390
39500
|
}
|
|
39391
39501
|
}
|
|
39392
39502
|
|
|
39393
39503
|
// src/core/adopt.ts
|
|
39394
|
-
import
|
|
39395
|
-
import
|
|
39504
|
+
import fs9 from "node:fs";
|
|
39505
|
+
import path12 from "node:path";
|
|
39396
39506
|
function isManagedByStore(dir) {
|
|
39397
39507
|
try {
|
|
39398
|
-
if (!
|
|
39399
|
-
const real =
|
|
39400
|
-
const storeReal =
|
|
39401
|
-
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);
|
|
39402
39512
|
} catch {
|
|
39403
39513
|
return false;
|
|
39404
39514
|
}
|
|
@@ -39407,13 +39517,13 @@ function scanAgentSkills(agentId) {
|
|
|
39407
39517
|
const agent = getAgent(agentId);
|
|
39408
39518
|
if (!agent) throw new Error(`\u672A\u77E5 agent '${agentId}'`);
|
|
39409
39519
|
const dir = agent.skillsDir(agentHome());
|
|
39410
|
-
if (!
|
|
39520
|
+
if (!fs9.existsSync(dir)) return [];
|
|
39411
39521
|
const out = [];
|
|
39412
|
-
for (const e of
|
|
39522
|
+
for (const e of fs9.readdirSync(dir, { withFileTypes: true })) {
|
|
39413
39523
|
if (e.name.startsWith(".")) continue;
|
|
39414
39524
|
if (!e.isDirectory() && !e.isSymbolicLink()) continue;
|
|
39415
|
-
const p =
|
|
39416
|
-
if (!
|
|
39525
|
+
const p = path12.join(dir, e.name);
|
|
39526
|
+
if (!fs9.existsSync(path12.join(p, "SKILL.md"))) continue;
|
|
39417
39527
|
out.push({ name: e.name, path: p });
|
|
39418
39528
|
}
|
|
39419
39529
|
return out;
|
|
@@ -39421,7 +39531,7 @@ function scanAgentSkills(agentId) {
|
|
|
39421
39531
|
function scanAdoptable(agentId) {
|
|
39422
39532
|
return scanAgentSkills(agentId).filter((s) => {
|
|
39423
39533
|
try {
|
|
39424
|
-
return !
|
|
39534
|
+
return !fs9.lstatSync(s.path).isSymbolicLink();
|
|
39425
39535
|
} catch {
|
|
39426
39536
|
return false;
|
|
39427
39537
|
}
|
|
@@ -39452,7 +39562,7 @@ function adoptSkills(opts = {}) {
|
|
|
39452
39562
|
}
|
|
39453
39563
|
let isOwnSymlink = false;
|
|
39454
39564
|
try {
|
|
39455
|
-
isOwnSymlink =
|
|
39565
|
+
isOwnSymlink = fs9.lstatSync(skill.path).isSymbolicLink();
|
|
39456
39566
|
} catch {
|
|
39457
39567
|
}
|
|
39458
39568
|
if (isOwnSymlink) {
|
|
@@ -39472,7 +39582,7 @@ function adoptSkills(opts = {}) {
|
|
|
39472
39582
|
items.push({ agent: agentId, name: skill.name, path: skill.path, status: "skipped-invalid", detail: "\u76EE\u5F55\u540D\u4E0D\u5408\u6CD5" });
|
|
39473
39583
|
continue;
|
|
39474
39584
|
}
|
|
39475
|
-
const existsInStore = !!config.skills[name] ||
|
|
39585
|
+
const existsInStore = !!config.skills[name] || fs9.existsSync(skillDir(name));
|
|
39476
39586
|
if (opts.dryRun) {
|
|
39477
39587
|
items.push({
|
|
39478
39588
|
agent: agentId,
|
|
@@ -39529,7 +39639,7 @@ function adoptSkills(opts = {}) {
|
|
|
39529
39639
|
saveConfig(config);
|
|
39530
39640
|
for (const mv of pendingMoves) {
|
|
39531
39641
|
try {
|
|
39532
|
-
|
|
39642
|
+
fs9.rmSync(mv.path, { recursive: true, force: true });
|
|
39533
39643
|
enableSkill(mv.name, [mv.agentId]);
|
|
39534
39644
|
items.push({
|
|
39535
39645
|
agent: mv.agentId,
|
|
@@ -39564,27 +39674,30 @@ function adoptSkills(opts = {}) {
|
|
|
39564
39674
|
}
|
|
39565
39675
|
|
|
39566
39676
|
// src/core/update.ts
|
|
39567
|
-
import
|
|
39677
|
+
import fs10 from "node:fs";
|
|
39568
39678
|
import os3 from "node:os";
|
|
39569
|
-
import
|
|
39570
|
-
import { execFile as
|
|
39571
|
-
import { promisify as
|
|
39572
|
-
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);
|
|
39573
39683
|
function parseGitSource(source) {
|
|
39574
39684
|
return source.startsWith("git:") ? source.slice(4) : null;
|
|
39575
39685
|
}
|
|
39576
39686
|
async function fetchRemote(repoSpec) {
|
|
39577
39687
|
const [url, sub] = repoSpec.split("#");
|
|
39578
|
-
const cloneDir =
|
|
39688
|
+
const cloneDir = fs10.mkdtempSync(path13.join(os3.tmpdir(), "skillpot-update-"));
|
|
39579
39689
|
try {
|
|
39580
|
-
await
|
|
39581
|
-
|
|
39582
|
-
|
|
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"))) {
|
|
39583
39696
|
throw new Error(`\u8FDC\u7AEF ${sub ? `#${sub} ` : ""}\u4E2D\u6CA1\u6709 SKILL.md`);
|
|
39584
39697
|
}
|
|
39585
39698
|
return { checksum: dirChecksum(contentDir), cloneDir, sub };
|
|
39586
39699
|
} catch (e) {
|
|
39587
|
-
|
|
39700
|
+
fs10.rmSync(cloneDir, { recursive: true, force: true });
|
|
39588
39701
|
throw e;
|
|
39589
39702
|
}
|
|
39590
39703
|
}
|
|
@@ -39603,7 +39716,7 @@ async function updateSkills(name, opts = {}) {
|
|
|
39603
39716
|
results.push({ skill: n, status: "local", detail: entry.source });
|
|
39604
39717
|
continue;
|
|
39605
39718
|
}
|
|
39606
|
-
if (!
|
|
39719
|
+
if (!fs10.existsSync(skillDir(n))) {
|
|
39607
39720
|
results.push({ skill: n, status: "error", detail: "\u4E2D\u592E\u4ED3\u5E93\u7F3A\u5931" });
|
|
39608
39721
|
continue;
|
|
39609
39722
|
}
|
|
@@ -39618,20 +39731,20 @@ async function updateSkills(name, opts = {}) {
|
|
|
39618
39731
|
results.push({ skill: n, status: "outdated", detail: `\u8FDC\u7AEF ${fetched.checksum.slice(0, 15)}` });
|
|
39619
39732
|
continue;
|
|
39620
39733
|
}
|
|
39621
|
-
const staging =
|
|
39734
|
+
const staging = fs10.mkdtempSync(path13.join(os3.tmpdir(), "skillpot-new-"));
|
|
39622
39735
|
try {
|
|
39623
|
-
const srcDir = fetched.sub ?
|
|
39624
|
-
|
|
39625
|
-
|
|
39626
|
-
|
|
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 });
|
|
39627
39740
|
} finally {
|
|
39628
|
-
|
|
39741
|
+
fs10.rmSync(staging, { recursive: true, force: true });
|
|
39629
39742
|
}
|
|
39630
39743
|
entry.checksum = dirChecksum(skillDir(n));
|
|
39631
39744
|
entry.installed_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
39632
39745
|
results.push({ skill: n, status: "updated", detail: entry.checksum.slice(0, 15) });
|
|
39633
39746
|
} finally {
|
|
39634
|
-
|
|
39747
|
+
fs10.rmSync(fetched.cloneDir, { recursive: true, force: true });
|
|
39635
39748
|
}
|
|
39636
39749
|
} catch (e) {
|
|
39637
39750
|
results.push({ skill: n, status: "error", detail: e instanceof Error ? e.message : String(e) });
|
|
@@ -39645,21 +39758,21 @@ async function updateSkills(name, opts = {}) {
|
|
|
39645
39758
|
import readline from "node:readline";
|
|
39646
39759
|
|
|
39647
39760
|
// src/core/skill-detail.ts
|
|
39648
|
-
import
|
|
39649
|
-
import
|
|
39761
|
+
import fs11 from "node:fs";
|
|
39762
|
+
import path14 from "node:path";
|
|
39650
39763
|
function readSkillDetail(name) {
|
|
39651
39764
|
const dir = skillDir(name);
|
|
39652
|
-
const mdPath =
|
|
39653
|
-
if (!
|
|
39765
|
+
const mdPath = path14.join(dir, "SKILL.md");
|
|
39766
|
+
if (!fs11.existsSync(mdPath)) return null;
|
|
39654
39767
|
const files = [];
|
|
39655
39768
|
const walk = (d) => {
|
|
39656
|
-
for (const e of
|
|
39657
|
-
const p =
|
|
39769
|
+
for (const e of fs11.readdirSync(d, { withFileTypes: true })) {
|
|
39770
|
+
const p = path14.join(d, e.name);
|
|
39658
39771
|
if (e.isDirectory()) {
|
|
39659
|
-
files.push(
|
|
39772
|
+
files.push(path14.relative(dir, p) + "/");
|
|
39660
39773
|
walk(p);
|
|
39661
39774
|
} else {
|
|
39662
|
-
files.push(
|
|
39775
|
+
files.push(path14.relative(dir, p));
|
|
39663
39776
|
}
|
|
39664
39777
|
}
|
|
39665
39778
|
};
|
|
@@ -39668,7 +39781,7 @@ function readSkillDetail(name) {
|
|
|
39668
39781
|
name,
|
|
39669
39782
|
meta: readSkillMeta(dir),
|
|
39670
39783
|
files: files.sort(),
|
|
39671
|
-
skillMd:
|
|
39784
|
+
skillMd: fs11.readFileSync(mdPath, "utf8")
|
|
39672
39785
|
};
|
|
39673
39786
|
}
|
|
39674
39787
|
|
|
@@ -39798,16 +39911,16 @@ function startMcpServer() {
|
|
|
39798
39911
|
}
|
|
39799
39912
|
|
|
39800
39913
|
// src/core/gui-server.ts
|
|
39801
|
-
import
|
|
39802
|
-
import
|
|
39914
|
+
import crypto3 from "node:crypto";
|
|
39915
|
+
import fs13 from "node:fs";
|
|
39803
39916
|
import http from "node:http";
|
|
39804
|
-
import
|
|
39917
|
+
import path16 from "node:path";
|
|
39805
39918
|
import { spawn } from "node:child_process";
|
|
39806
39919
|
import { fileURLToPath } from "node:url";
|
|
39807
39920
|
|
|
39808
39921
|
// src/tui/matrix.ts
|
|
39809
|
-
import
|
|
39810
|
-
import
|
|
39922
|
+
import fs12 from "node:fs";
|
|
39923
|
+
import path15 from "node:path";
|
|
39811
39924
|
function deriveMatrix(agents) {
|
|
39812
39925
|
const config = loadConfig();
|
|
39813
39926
|
const skills = Object.keys(config.skills).sort();
|
|
@@ -39821,13 +39934,13 @@ function deriveMatrix(agents) {
|
|
|
39821
39934
|
for (const s of skills) {
|
|
39822
39935
|
cells[s] = {};
|
|
39823
39936
|
for (const a of list) {
|
|
39824
|
-
const target =
|
|
39937
|
+
const target = path15.join(a.skillsDir, s);
|
|
39825
39938
|
let actual = false;
|
|
39826
39939
|
let managed = false;
|
|
39827
39940
|
try {
|
|
39828
|
-
const st =
|
|
39941
|
+
const st = fs12.lstatSync(target);
|
|
39829
39942
|
actual = true;
|
|
39830
|
-
managed = st.isSymbolicLink() &&
|
|
39943
|
+
managed = st.isSymbolicLink() && fs12.realpathSync(target) === fs12.realpathSync(skillDir(s));
|
|
39831
39944
|
} catch {
|
|
39832
39945
|
}
|
|
39833
39946
|
cells[s][a.id] = {
|
|
@@ -39950,7 +40063,7 @@ async function handleApiRequest(method, pathname, query, body, expectedToken, go
|
|
|
39950
40063
|
let inStore = false;
|
|
39951
40064
|
try {
|
|
39952
40065
|
const n = sanitizeSkillName(s.name);
|
|
39953
|
-
inStore = !!config.skills[n] ||
|
|
40066
|
+
inStore = !!config.skills[n] || fs13.existsSync(skillDir(n));
|
|
39954
40067
|
} catch {
|
|
39955
40068
|
valid = false;
|
|
39956
40069
|
}
|
|
@@ -40006,6 +40119,41 @@ async function handleApiRequest(method, pathname, query, body, expectedToken, go
|
|
|
40006
40119
|
uninstallSkill(b.skill);
|
|
40007
40120
|
return { status: 200, body: { ok: true, message: `\u5DF2\u5378\u8F7D ${b.skill}` } };
|
|
40008
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
|
+
}
|
|
40009
40157
|
if (method === "GET" && pathname === "/api/doctor") {
|
|
40010
40158
|
return { status: 200, body: { issues: runDoctor() } };
|
|
40011
40159
|
}
|
|
@@ -40067,40 +40215,40 @@ function openBrowser(url) {
|
|
|
40067
40215
|
}
|
|
40068
40216
|
function guiDistDir() {
|
|
40069
40217
|
const candidates = [
|
|
40070
|
-
|
|
40071
|
-
|
|
40218
|
+
path16.resolve(fileURLToPath(new URL("./gui/", import.meta.url))),
|
|
40219
|
+
path16.resolve(fileURLToPath(new URL("../../dist/gui/", import.meta.url)))
|
|
40072
40220
|
];
|
|
40073
40221
|
for (const dir of candidates) {
|
|
40074
|
-
if (
|
|
40222
|
+
if (fs13.existsSync(path16.join(dir, "index.html"))) return dir;
|
|
40075
40223
|
}
|
|
40076
40224
|
return candidates[0];
|
|
40077
40225
|
}
|
|
40078
40226
|
function serveStatic(pathname, res) {
|
|
40079
40227
|
const root = guiDistDir();
|
|
40080
|
-
if (!
|
|
40228
|
+
if (!fs13.existsSync(path16.join(root, "index.html"))) {
|
|
40081
40229
|
res.writeHead(503, { "content-type": "text/plain; charset=utf-8" });
|
|
40082
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");
|
|
40083
40231
|
return;
|
|
40084
40232
|
}
|
|
40085
40233
|
const rel = pathname === "/" ? "index.html" : pathname.replace(/^\/+/, "");
|
|
40086
|
-
let file =
|
|
40087
|
-
if (!file.startsWith(root +
|
|
40234
|
+
let file = path16.resolve(root, rel);
|
|
40235
|
+
if (!file.startsWith(root + path16.sep) && file !== root) {
|
|
40088
40236
|
res.writeHead(403, { "content-type": "text/plain; charset=utf-8" });
|
|
40089
40237
|
res.end("forbidden");
|
|
40090
40238
|
return;
|
|
40091
40239
|
}
|
|
40092
|
-
if (!
|
|
40093
|
-
file =
|
|
40240
|
+
if (!fs13.existsSync(file) || fs13.statSync(file).isDirectory()) {
|
|
40241
|
+
file = path16.join(root, "index.html");
|
|
40094
40242
|
}
|
|
40095
|
-
const ext =
|
|
40243
|
+
const ext = path16.extname(file).toLowerCase();
|
|
40096
40244
|
res.writeHead(200, {
|
|
40097
40245
|
"content-type": MIME[ext] ?? "application/octet-stream",
|
|
40098
40246
|
"cache-control": rel.startsWith("assets/") ? "public, max-age=31536000, immutable" : "no-store"
|
|
40099
40247
|
});
|
|
40100
|
-
|
|
40248
|
+
fs13.createReadStream(file).pipe(res);
|
|
40101
40249
|
}
|
|
40102
40250
|
async function startGuiServer(opts = {}) {
|
|
40103
|
-
const token =
|
|
40251
|
+
const token = crypto3.randomBytes(16).toString("hex");
|
|
40104
40252
|
const host = opts.host ?? "127.0.0.1";
|
|
40105
40253
|
const readAuthRequired = !["127.0.0.1", "localhost", "::1"].includes(host);
|
|
40106
40254
|
const sseClients = /* @__PURE__ */ new Set();
|
|
@@ -44781,7 +44929,7 @@ var FocusContext_default = FocusContext;
|
|
|
44781
44929
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
44782
44930
|
var import_react8 = __toESM(require_react(), 1);
|
|
44783
44931
|
var import_stack_utils = __toESM(require_stack_utils(), 1);
|
|
44784
|
-
import * as
|
|
44932
|
+
import * as fs14 from "node:fs";
|
|
44785
44933
|
import { cwd } from "node:process";
|
|
44786
44934
|
|
|
44787
44935
|
// node_modules/convert-to-spaces/dist/index.js
|
|
@@ -44871,8 +45019,8 @@ function Text({ color, backgroundColor, dimColor = false, bold = false, italic =
|
|
|
44871
45019
|
}
|
|
44872
45020
|
|
|
44873
45021
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
44874
|
-
var cleanupPath = (
|
|
44875
|
-
return
|
|
45022
|
+
var cleanupPath = (path17) => {
|
|
45023
|
+
return path17?.replace(`file://${cwd()}/`, "");
|
|
44876
45024
|
};
|
|
44877
45025
|
var stackUtils = new import_stack_utils.default({
|
|
44878
45026
|
cwd: cwd(),
|
|
@@ -44884,8 +45032,8 @@ function ErrorOverview({ error }) {
|
|
|
44884
45032
|
const filePath = cleanupPath(origin?.file);
|
|
44885
45033
|
let excerpt;
|
|
44886
45034
|
let lineWidth = 0;
|
|
44887
|
-
if (filePath && origin?.line &&
|
|
44888
|
-
const sourceCode =
|
|
45035
|
+
if (filePath && origin?.line && fs14.existsSync(filePath)) {
|
|
45036
|
+
const sourceCode = fs14.readFileSync(filePath, "utf8");
|
|
44889
45037
|
excerpt = dist_default3(sourceCode, origin.line);
|
|
44890
45038
|
if (excerpt) {
|
|
44891
45039
|
for (const { line } of excerpt) {
|
|
@@ -46246,6 +46394,54 @@ program2.command("gui").description("\u542F\u52A8\u672C\u5730 Web \u63A7\u5236\u
|
|
|
46246
46394
|
console.log(import_picocolors2.default.dim("\u6309 Ctrl+C \u9000\u51FA"));
|
|
46247
46395
|
})
|
|
46248
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
|
+
);
|
|
46249
46445
|
for (const cmd of program2.commands) cmd.allowExcessArguments(false);
|
|
46250
46446
|
await program2.parseAsync(process.argv);
|
|
46251
46447
|
/*! Bundled license information:
|