@grekt/cli 6.34.0 → 6.36.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/dist/index.js +1923 -185
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -34844,7 +34844,7 @@ var require_dist_cjs32 = __commonJS((exports2) => {
|
|
|
34844
34844
|
// node_modules/@aws-sdk/util-arn-parser/dist-cjs/index.js
|
|
34845
34845
|
var require_dist_cjs33 = __commonJS((exports2) => {
|
|
34846
34846
|
var validate2 = (str2) => typeof str2 === "string" && str2.indexOf("arn:") === 0 && str2.split(":").length >= 6;
|
|
34847
|
-
var
|
|
34847
|
+
var parse7 = (arn) => {
|
|
34848
34848
|
const segments = arn.split(":");
|
|
34849
34849
|
if (segments.length < 6 || segments[0] !== "arn")
|
|
34850
34850
|
throw new Error("Malformed ARN");
|
|
@@ -34865,7 +34865,7 @@ var require_dist_cjs33 = __commonJS((exports2) => {
|
|
|
34865
34865
|
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
34866
34866
|
};
|
|
34867
34867
|
exports2.build = build;
|
|
34868
|
-
exports2.parse =
|
|
34868
|
+
exports2.parse = parse7;
|
|
34869
34869
|
exports2.validate = validate2;
|
|
34870
34870
|
});
|
|
34871
34871
|
|
|
@@ -38008,7 +38008,7 @@ var require_dist_cjs49 = __commonJS((exports2) => {
|
|
|
38008
38008
|
// node_modules/@aws-sdk/signature-v4-multi-region/node_modules/@aws-sdk/middleware-sdk-s3/node_modules/@aws-sdk/util-arn-parser/dist-cjs/index.js
|
|
38009
38009
|
var require_dist_cjs50 = __commonJS((exports2) => {
|
|
38010
38010
|
var validate2 = (str2) => typeof str2 === "string" && str2.indexOf("arn:") === 0 && str2.split(":").length >= 6;
|
|
38011
|
-
var
|
|
38011
|
+
var parse7 = (arn) => {
|
|
38012
38012
|
const segments = arn.split(":");
|
|
38013
38013
|
if (segments.length < 6 || segments[0] !== "arn")
|
|
38014
38014
|
throw new Error("Malformed ARN");
|
|
@@ -38029,7 +38029,7 @@ var require_dist_cjs50 = __commonJS((exports2) => {
|
|
|
38029
38029
|
return `arn:${partition}:${service}:${region}:${accountId}:${resource}`;
|
|
38030
38030
|
};
|
|
38031
38031
|
exports2.build = build;
|
|
38032
|
-
exports2.parse =
|
|
38032
|
+
exports2.parse = parse7;
|
|
38033
38033
|
exports2.validate = validate2;
|
|
38034
38034
|
});
|
|
38035
38035
|
|
|
@@ -42010,12 +42010,12 @@ var require_fromHttp = __commonJS((exports2) => {
|
|
|
42010
42010
|
var fromHttp = (options2 = {}) => {
|
|
42011
42011
|
options2.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
|
|
42012
42012
|
let host;
|
|
42013
|
-
const
|
|
42013
|
+
const relative7 = options2.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
|
42014
42014
|
const full = options2.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
|
42015
42015
|
const token = options2.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
|
42016
42016
|
const tokenFile = options2.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
|
42017
42017
|
const warn = options2.logger?.constructor?.name === "NoOpLogger" || !options2.logger?.warn ? console.warn : options2.logger.warn.bind(options2.logger);
|
|
42018
|
-
if (
|
|
42018
|
+
if (relative7 && full) {
|
|
42019
42019
|
warn("@aws-sdk/credential-provider-http: " + "you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
|
42020
42020
|
warn("awsContainerCredentialsFullUri will take precedence.");
|
|
42021
42021
|
}
|
|
@@ -42025,8 +42025,8 @@ var require_fromHttp = __commonJS((exports2) => {
|
|
|
42025
42025
|
}
|
|
42026
42026
|
if (full) {
|
|
42027
42027
|
host = full;
|
|
42028
|
-
} else if (
|
|
42029
|
-
host = `${DEFAULT_LINK_LOCAL_HOST}${
|
|
42028
|
+
} else if (relative7) {
|
|
42029
|
+
host = `${DEFAULT_LINK_LOCAL_HOST}${relative7}`;
|
|
42030
42030
|
} else {
|
|
42031
42031
|
throw new property_provider_1.CredentialsProviderError(`No HTTP credential provider host provided.
|
|
42032
42032
|
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options2.logger });
|
|
@@ -58479,7 +58479,7 @@ var require_utils3 = __commonJS((exports2) => {
|
|
|
58479
58479
|
var require_stringify6 = __commonJS((exports2, module2) => {
|
|
58480
58480
|
var utils = require_utils3();
|
|
58481
58481
|
module2.exports = (ast, options2 = {}) => {
|
|
58482
|
-
const
|
|
58482
|
+
const stringify2 = (node, parent = {}) => {
|
|
58483
58483
|
const invalidBlock = options2.escapeInvalid && utils.isInvalidBrace(parent);
|
|
58484
58484
|
const invalidNode = node.invalid === true && options2.escapeInvalid === true;
|
|
58485
58485
|
let output = "";
|
|
@@ -58494,12 +58494,12 @@ var require_stringify6 = __commonJS((exports2, module2) => {
|
|
|
58494
58494
|
}
|
|
58495
58495
|
if (node.nodes) {
|
|
58496
58496
|
for (const child of node.nodes) {
|
|
58497
|
-
output +=
|
|
58497
|
+
output += stringify2(child);
|
|
58498
58498
|
}
|
|
58499
58499
|
}
|
|
58500
58500
|
return output;
|
|
58501
58501
|
};
|
|
58502
|
-
return
|
|
58502
|
+
return stringify2(ast);
|
|
58503
58503
|
};
|
|
58504
58504
|
});
|
|
58505
58505
|
|
|
@@ -58766,7 +58766,7 @@ var require_fill_range = __commonJS((exports2, module2) => {
|
|
|
58766
58766
|
;
|
|
58767
58767
|
return index > 0;
|
|
58768
58768
|
};
|
|
58769
|
-
var
|
|
58769
|
+
var stringify2 = (start, end, options2) => {
|
|
58770
58770
|
if (typeof start === "string" || typeof end === "string") {
|
|
58771
58771
|
return true;
|
|
58772
58772
|
}
|
|
@@ -58868,7 +58868,7 @@ var require_fill_range = __commonJS((exports2, module2) => {
|
|
|
58868
58868
|
step = Math.max(Math.abs(step), 1);
|
|
58869
58869
|
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
58870
58870
|
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
58871
|
-
let toNumber = padded === false &&
|
|
58871
|
+
let toNumber = padded === false && stringify2(start, end, options2) === false;
|
|
58872
58872
|
let format = options2.transform || transform(toNumber);
|
|
58873
58873
|
if (options2.toRegex && step === 1) {
|
|
58874
58874
|
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options2);
|
|
@@ -58998,7 +58998,7 @@ var require_compile = __commonJS((exports2, module2) => {
|
|
|
58998
58998
|
// node_modules/braces/lib/expand.js
|
|
58999
58999
|
var require_expand = __commonJS((exports2, module2) => {
|
|
59000
59000
|
var fill = require_fill_range();
|
|
59001
|
-
var
|
|
59001
|
+
var stringify2 = require_stringify6();
|
|
59002
59002
|
var utils = require_utils3();
|
|
59003
59003
|
var append = (queue = "", stash = "", enclose = false) => {
|
|
59004
59004
|
const result = [];
|
|
@@ -59035,7 +59035,7 @@ var require_expand = __commonJS((exports2, module2) => {
|
|
|
59035
59035
|
q = p.queue;
|
|
59036
59036
|
}
|
|
59037
59037
|
if (node.invalid || node.dollar) {
|
|
59038
|
-
q.push(append(q.pop(),
|
|
59038
|
+
q.push(append(q.pop(), stringify2(node, options2)));
|
|
59039
59039
|
return;
|
|
59040
59040
|
}
|
|
59041
59041
|
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
@@ -59049,7 +59049,7 @@ var require_expand = __commonJS((exports2, module2) => {
|
|
|
59049
59049
|
}
|
|
59050
59050
|
let range = fill(...args, options2);
|
|
59051
59051
|
if (range.length === 0) {
|
|
59052
|
-
range =
|
|
59052
|
+
range = stringify2(node, options2);
|
|
59053
59053
|
}
|
|
59054
59054
|
q.push(append(q.pop(), range));
|
|
59055
59055
|
node.nodes = [];
|
|
@@ -59143,7 +59143,7 @@ var require_constants4 = __commonJS((exports2, module2) => {
|
|
|
59143
59143
|
|
|
59144
59144
|
// node_modules/braces/lib/parse.js
|
|
59145
59145
|
var require_parse5 = __commonJS((exports2, module2) => {
|
|
59146
|
-
var
|
|
59146
|
+
var stringify2 = require_stringify6();
|
|
59147
59147
|
var {
|
|
59148
59148
|
MAX_LENGTH,
|
|
59149
59149
|
CHAR_BACKSLASH,
|
|
@@ -59161,7 +59161,7 @@ var require_parse5 = __commonJS((exports2, module2) => {
|
|
|
59161
59161
|
CHAR_NO_BREAK_SPACE,
|
|
59162
59162
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
59163
59163
|
} = require_constants4();
|
|
59164
|
-
var
|
|
59164
|
+
var parse7 = (input, options2 = {}) => {
|
|
59165
59165
|
if (typeof input !== "string") {
|
|
59166
59166
|
throw new TypeError("Expected a string");
|
|
59167
59167
|
}
|
|
@@ -59304,7 +59304,7 @@ var require_parse5 = __commonJS((exports2, module2) => {
|
|
|
59304
59304
|
if (block.ranges > 0) {
|
|
59305
59305
|
block.ranges = 0;
|
|
59306
59306
|
const open = block.nodes.shift();
|
|
59307
|
-
block.nodes = [open, { type: "text", value:
|
|
59307
|
+
block.nodes = [open, { type: "text", value: stringify2(block) }];
|
|
59308
59308
|
}
|
|
59309
59309
|
push2({ type: "comma", value });
|
|
59310
59310
|
block.commas++;
|
|
@@ -59365,15 +59365,15 @@ var require_parse5 = __commonJS((exports2, module2) => {
|
|
|
59365
59365
|
push2({ type: "eos" });
|
|
59366
59366
|
return ast;
|
|
59367
59367
|
};
|
|
59368
|
-
module2.exports =
|
|
59368
|
+
module2.exports = parse7;
|
|
59369
59369
|
});
|
|
59370
59370
|
|
|
59371
59371
|
// node_modules/braces/index.js
|
|
59372
59372
|
var require_braces = __commonJS((exports2, module2) => {
|
|
59373
|
-
var
|
|
59373
|
+
var stringify2 = require_stringify6();
|
|
59374
59374
|
var compile = require_compile();
|
|
59375
59375
|
var expand = require_expand();
|
|
59376
|
-
var
|
|
59376
|
+
var parse7 = require_parse5();
|
|
59377
59377
|
var braces = (input, options2 = {}) => {
|
|
59378
59378
|
let output = [];
|
|
59379
59379
|
if (Array.isArray(input)) {
|
|
@@ -59393,12 +59393,12 @@ var require_braces = __commonJS((exports2, module2) => {
|
|
|
59393
59393
|
}
|
|
59394
59394
|
return output;
|
|
59395
59395
|
};
|
|
59396
|
-
braces.parse = (input, options2 = {}) =>
|
|
59396
|
+
braces.parse = (input, options2 = {}) => parse7(input, options2);
|
|
59397
59397
|
braces.stringify = (input, options2 = {}) => {
|
|
59398
59398
|
if (typeof input === "string") {
|
|
59399
|
-
return
|
|
59399
|
+
return stringify2(braces.parse(input, options2), options2);
|
|
59400
59400
|
}
|
|
59401
|
-
return
|
|
59401
|
+
return stringify2(input, options2);
|
|
59402
59402
|
};
|
|
59403
59403
|
braces.compile = (input, options2 = {}) => {
|
|
59404
59404
|
if (typeof input === "string") {
|
|
@@ -59970,7 +59970,7 @@ var require_parse6 = __commonJS((exports2, module2) => {
|
|
|
59970
59970
|
var syntaxError = (type, char) => {
|
|
59971
59971
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
59972
59972
|
};
|
|
59973
|
-
var
|
|
59973
|
+
var parse7 = (input, options2) => {
|
|
59974
59974
|
if (typeof input !== "string") {
|
|
59975
59975
|
throw new TypeError("Expected a string");
|
|
59976
59976
|
}
|
|
@@ -60120,7 +60120,7 @@ var require_parse6 = __commonJS((exports2, module2) => {
|
|
|
60120
60120
|
output = token.close = `)$))${extglobStar}`;
|
|
60121
60121
|
}
|
|
60122
60122
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
60123
|
-
const expression =
|
|
60123
|
+
const expression = parse7(rest, { ...options2, fastpaths: false }).output;
|
|
60124
60124
|
output = token.close = `)${expression})${extglobStar})`;
|
|
60125
60125
|
}
|
|
60126
60126
|
if (token.prev.type === "bos") {
|
|
@@ -60649,7 +60649,7 @@ var require_parse6 = __commonJS((exports2, module2) => {
|
|
|
60649
60649
|
}
|
|
60650
60650
|
return state;
|
|
60651
60651
|
};
|
|
60652
|
-
|
|
60652
|
+
parse7.fastpaths = (input, options2) => {
|
|
60653
60653
|
const opts = { ...options2 };
|
|
60654
60654
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
60655
60655
|
const len = input.length;
|
|
@@ -60718,14 +60718,14 @@ var require_parse6 = __commonJS((exports2, module2) => {
|
|
|
60718
60718
|
}
|
|
60719
60719
|
return source;
|
|
60720
60720
|
};
|
|
60721
|
-
module2.exports =
|
|
60721
|
+
module2.exports = parse7;
|
|
60722
60722
|
});
|
|
60723
60723
|
|
|
60724
60724
|
// node_modules/picomatch/lib/picomatch.js
|
|
60725
60725
|
var require_picomatch = __commonJS((exports2, module2) => {
|
|
60726
60726
|
var path8 = __require("path");
|
|
60727
60727
|
var scan = require_scan();
|
|
60728
|
-
var
|
|
60728
|
+
var parse7 = require_parse6();
|
|
60729
60729
|
var utils = require_utils4();
|
|
60730
60730
|
var constants2 = require_constants5();
|
|
60731
60731
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -60815,7 +60815,7 @@ var require_picomatch = __commonJS((exports2, module2) => {
|
|
|
60815
60815
|
picomatch.parse = (pattern, options2) => {
|
|
60816
60816
|
if (Array.isArray(pattern))
|
|
60817
60817
|
return pattern.map((p) => picomatch.parse(p, options2));
|
|
60818
|
-
return
|
|
60818
|
+
return parse7(pattern, { ...options2, fastpaths: false });
|
|
60819
60819
|
};
|
|
60820
60820
|
picomatch.scan = (input, options2) => scan(input, options2);
|
|
60821
60821
|
picomatch.compileRe = (state, options2, returnOutput = false, returnState = false) => {
|
|
@@ -60841,10 +60841,10 @@ var require_picomatch = __commonJS((exports2, module2) => {
|
|
|
60841
60841
|
}
|
|
60842
60842
|
let parsed = { negated: false, fastpaths: true };
|
|
60843
60843
|
if (options2.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
60844
|
-
parsed.output =
|
|
60844
|
+
parsed.output = parse7.fastpaths(input, options2);
|
|
60845
60845
|
}
|
|
60846
60846
|
if (!parsed.output) {
|
|
60847
|
-
parsed =
|
|
60847
|
+
parsed = parse7(input, options2);
|
|
60848
60848
|
}
|
|
60849
60849
|
return picomatch.compileRe(parsed, options2, returnOutput, returnState);
|
|
60850
60850
|
};
|
|
@@ -61125,8 +61125,8 @@ var require_pattern = __commonJS((exports2) => {
|
|
|
61125
61125
|
}
|
|
61126
61126
|
exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
|
61127
61127
|
function isAffectDepthOfReadingPattern(pattern) {
|
|
61128
|
-
const
|
|
61129
|
-
return endsWithSlashGlobStar(pattern) || isStaticPattern(
|
|
61128
|
+
const basename11 = path8.basename(pattern);
|
|
61129
|
+
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename11);
|
|
61130
61130
|
}
|
|
61131
61131
|
exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
|
61132
61132
|
function expandPatternsWithBraceExpansion(patterns) {
|
|
@@ -61171,15 +61171,15 @@ var require_pattern = __commonJS((exports2) => {
|
|
|
61171
61171
|
exports2.removeDuplicateSlashes = removeDuplicateSlashes;
|
|
61172
61172
|
function partitionAbsoluteAndRelative(patterns) {
|
|
61173
61173
|
const absolute = [];
|
|
61174
|
-
const
|
|
61174
|
+
const relative7 = [];
|
|
61175
61175
|
for (const pattern of patterns) {
|
|
61176
61176
|
if (isAbsolute4(pattern)) {
|
|
61177
61177
|
absolute.push(pattern);
|
|
61178
61178
|
} else {
|
|
61179
|
-
|
|
61179
|
+
relative7.push(pattern);
|
|
61180
61180
|
}
|
|
61181
61181
|
}
|
|
61182
|
-
return [absolute,
|
|
61182
|
+
return [absolute, relative7];
|
|
61183
61183
|
}
|
|
61184
61184
|
exports2.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
|
61185
61185
|
function isAbsolute4(pattern) {
|
|
@@ -63382,7 +63382,7 @@ var {
|
|
|
63382
63382
|
} = import__.default;
|
|
63383
63383
|
|
|
63384
63384
|
// src/commands/init.ts
|
|
63385
|
-
import { basename as
|
|
63385
|
+
import { basename as basename9 } from "path";
|
|
63386
63386
|
|
|
63387
63387
|
// src/context/crypto.ts
|
|
63388
63388
|
import { randomUUID } from "node:crypto";
|
|
@@ -85506,6 +85506,12 @@ function parseJsonComponent(content) {
|
|
|
85506
85506
|
} catch {
|
|
85507
85507
|
return { success: false, reason: "invalid-json" };
|
|
85508
85508
|
}
|
|
85509
|
+
if (!data["grk-type"] && data["type"])
|
|
85510
|
+
data["grk-type"] = data["type"];
|
|
85511
|
+
if (!data["grk-name"] && data["name"])
|
|
85512
|
+
data["grk-name"] = data["name"];
|
|
85513
|
+
if (!data["grk-description"] && data["description"])
|
|
85514
|
+
data["grk-description"] = data["description"];
|
|
85509
85515
|
const missingFields = [];
|
|
85510
85516
|
if (!data["grk-type"])
|
|
85511
85517
|
missingFields.push("grk-type");
|
|
@@ -85531,7 +85537,15 @@ function parseJsonComponent(content) {
|
|
|
85531
85537
|
"grk-name": data["grk-name"],
|
|
85532
85538
|
"grk-description": data["grk-description"]
|
|
85533
85539
|
};
|
|
85534
|
-
const {
|
|
85540
|
+
const {
|
|
85541
|
+
"grk-type": _type,
|
|
85542
|
+
"grk-name": _name,
|
|
85543
|
+
"grk-description": _desc,
|
|
85544
|
+
type: _uType,
|
|
85545
|
+
name: _uName,
|
|
85546
|
+
description: _uDesc,
|
|
85547
|
+
...rest
|
|
85548
|
+
} = data;
|
|
85535
85549
|
return { success: true, parsed: { frontmatter, content: rest } };
|
|
85536
85550
|
}
|
|
85537
85551
|
function scanArtifact(fs12, artifactDir) {
|
|
@@ -93347,7 +93361,7 @@ function removeRegistry(scope, projectRoot = process.cwd()) {
|
|
|
93347
93361
|
}
|
|
93348
93362
|
|
|
93349
93363
|
// src/sync/manager/manager.ts
|
|
93350
|
-
import { dirname as dirname6, join as
|
|
93364
|
+
import { dirname as dirname6, join as join17 } from "path";
|
|
93351
93365
|
|
|
93352
93366
|
// src/sync/plugins/claude/claude.ts
|
|
93353
93367
|
import { basename as basename5, join as join13 } from "path";
|
|
@@ -93962,6 +93976,26 @@ function copySiblingFiles(sourceDir, targetDir, sourceFilePath) {
|
|
|
93962
93976
|
}
|
|
93963
93977
|
}
|
|
93964
93978
|
|
|
93979
|
+
// src/sync/plugins/claude/claude.mcp.ts
|
|
93980
|
+
var claudeMcpConfig = {
|
|
93981
|
+
configFile: ".mcp.json",
|
|
93982
|
+
serverKey: "mcpServers",
|
|
93983
|
+
transform: (_serverName, content, executablePath) => {
|
|
93984
|
+
if (content.url) {
|
|
93985
|
+
return {
|
|
93986
|
+
type: "http",
|
|
93987
|
+
url: content.url,
|
|
93988
|
+
...content.headers && { headers: content.headers }
|
|
93989
|
+
};
|
|
93990
|
+
}
|
|
93991
|
+
return {
|
|
93992
|
+
command: executablePath,
|
|
93993
|
+
...content.args?.length && { args: content.args },
|
|
93994
|
+
...content.env && { env: content.env }
|
|
93995
|
+
};
|
|
93996
|
+
}
|
|
93997
|
+
};
|
|
93998
|
+
|
|
93965
93999
|
// src/sync/plugins/claude/claude.ts
|
|
93966
94000
|
var TARGET_DIR = ".claude";
|
|
93967
94001
|
var ENTRY_POINTS = [join13(TARGET_DIR, "CLAUDE.md"), "CLAUDE.md"];
|
|
@@ -94010,6 +94044,28 @@ var claudePlugin = createFolderPlugin({
|
|
|
94010
94044
|
}
|
|
94011
94045
|
});
|
|
94012
94046
|
|
|
94047
|
+
// src/sync/mcp/mcp.transforms.ts
|
|
94048
|
+
var standardMcpTransform = (_serverName, content, executablePath) => {
|
|
94049
|
+
if (content.url) {
|
|
94050
|
+
return {
|
|
94051
|
+
url: content.url,
|
|
94052
|
+
...content.headers && { headers: content.headers }
|
|
94053
|
+
};
|
|
94054
|
+
}
|
|
94055
|
+
return {
|
|
94056
|
+
command: executablePath,
|
|
94057
|
+
...content.args?.length && { args: content.args },
|
|
94058
|
+
...content.env && { env: content.env }
|
|
94059
|
+
};
|
|
94060
|
+
};
|
|
94061
|
+
|
|
94062
|
+
// src/sync/plugins/cursor/cursor.mcp.ts
|
|
94063
|
+
var cursorMcpConfig = {
|
|
94064
|
+
configFile: ".cursor/mcp.json",
|
|
94065
|
+
serverKey: "mcpServers",
|
|
94066
|
+
transform: standardMcpTransform
|
|
94067
|
+
};
|
|
94068
|
+
|
|
94013
94069
|
// src/sync/plugins/cursor/cursor.ts
|
|
94014
94070
|
var cursorPlugin = createRulesOnlyPlugin({
|
|
94015
94071
|
id: "cursor",
|
|
@@ -94036,6 +94092,25 @@ function writeSkillRouter(projectRoot, targetDir) {
|
|
|
94036
94092
|
fs.writeFile(skillRouterFile, buildStandardSkillRouterContent());
|
|
94037
94093
|
}
|
|
94038
94094
|
|
|
94095
|
+
// src/sync/plugins/opencode/opencode.mcp.ts
|
|
94096
|
+
var opencodeMcpConfig = {
|
|
94097
|
+
configFile: "opencode.json",
|
|
94098
|
+
serverKey: "mcp",
|
|
94099
|
+
transform: (_serverName, content, executablePath) => {
|
|
94100
|
+
if (content.url) {
|
|
94101
|
+
return {
|
|
94102
|
+
url: content.url,
|
|
94103
|
+
...content.headers && { headers: content.headers }
|
|
94104
|
+
};
|
|
94105
|
+
}
|
|
94106
|
+
return {
|
|
94107
|
+
command: executablePath,
|
|
94108
|
+
...content.args?.length && { args: content.args },
|
|
94109
|
+
...content.env && { env: content.env }
|
|
94110
|
+
};
|
|
94111
|
+
}
|
|
94112
|
+
};
|
|
94113
|
+
|
|
94039
94114
|
// src/sync/plugins/opencode/opencode.ts
|
|
94040
94115
|
var TARGET_DIR2 = ".opencode";
|
|
94041
94116
|
var opencodePlugin = createFolderPlugin({
|
|
@@ -94074,6 +94149,26 @@ var clinePlugin = createRulesOnlyPlugin({
|
|
|
94074
94149
|
generateRulesContent: generateDefaultBlockContent
|
|
94075
94150
|
});
|
|
94076
94151
|
|
|
94152
|
+
// src/sync/plugins/copilot/copilot.mcp.ts
|
|
94153
|
+
var copilotMcpConfig = {
|
|
94154
|
+
configFile: ".vscode/mcp.json",
|
|
94155
|
+
serverKey: "servers",
|
|
94156
|
+
transform: (_serverName, content, executablePath) => {
|
|
94157
|
+
if (content.url) {
|
|
94158
|
+
return {
|
|
94159
|
+
type: "http",
|
|
94160
|
+
url: content.url,
|
|
94161
|
+
...content.headers && { headers: content.headers }
|
|
94162
|
+
};
|
|
94163
|
+
}
|
|
94164
|
+
return {
|
|
94165
|
+
command: executablePath,
|
|
94166
|
+
...content.args?.length && { args: content.args },
|
|
94167
|
+
...content.env && { env: content.env }
|
|
94168
|
+
};
|
|
94169
|
+
}
|
|
94170
|
+
};
|
|
94171
|
+
|
|
94077
94172
|
// src/sync/plugins/copilot/copilot.ts
|
|
94078
94173
|
var copilotPlugin = createRulesOnlyPlugin({
|
|
94079
94174
|
id: "copilot",
|
|
@@ -94101,6 +94196,13 @@ var continuePlugin = createFolderPlugin({
|
|
|
94101
94196
|
}
|
|
94102
94197
|
});
|
|
94103
94198
|
|
|
94199
|
+
// src/sync/plugins/amazonq/amazonq.mcp.ts
|
|
94200
|
+
var amazonqMcpConfig = {
|
|
94201
|
+
configFile: ".amazonq/mcp.json",
|
|
94202
|
+
serverKey: "mcpServers",
|
|
94203
|
+
transform: standardMcpTransform
|
|
94204
|
+
};
|
|
94205
|
+
|
|
94104
94206
|
// src/sync/plugins/amazonq/amazonq.ts
|
|
94105
94207
|
var TARGET_DIR5 = ".amazonq";
|
|
94106
94208
|
var amazonqPlugin = createFolderPlugin({
|
|
@@ -94213,11 +94315,21 @@ var openclawPlugin = createFolderPlugin({
|
|
|
94213
94315
|
}
|
|
94214
94316
|
});
|
|
94215
94317
|
|
|
94216
|
-
// src/sync/plugins/
|
|
94318
|
+
// src/sync/plugins/kiro/kiro.ts
|
|
94217
94319
|
var import_gray_matter3 = __toESM(require_gray_matter2(), 1);
|
|
94218
|
-
import { basename as basename7 } from "path";
|
|
94219
|
-
|
|
94220
|
-
|
|
94320
|
+
import { basename as basename7, join as join16 } from "path";
|
|
94321
|
+
|
|
94322
|
+
// src/sync/plugins/kiro/kiro.mcp.ts
|
|
94323
|
+
var kiroMcpConfig = {
|
|
94324
|
+
configFile: ".kiro/settings/mcp.json",
|
|
94325
|
+
serverKey: "mcpServers",
|
|
94326
|
+
transform: standardMcpTransform
|
|
94327
|
+
};
|
|
94328
|
+
|
|
94329
|
+
// src/sync/plugins/kiro/kiro.ts
|
|
94330
|
+
var TARGET_DIR7 = ".kiro";
|
|
94331
|
+
var STEERING_DIR = join16(TARGET_DIR7, "steering");
|
|
94332
|
+
var ENTRY_POINTS3 = [join16(STEERING_DIR, "grekt.md")];
|
|
94221
94333
|
var CLAUDE_SPECIFIC_FIELDS = [
|
|
94222
94334
|
"argument-hint",
|
|
94223
94335
|
"disable-model-invocation",
|
|
@@ -94225,9 +94337,10 @@ var CLAUDE_SPECIFIC_FIELDS = [
|
|
|
94225
94337
|
"model",
|
|
94226
94338
|
"context",
|
|
94227
94339
|
"agent",
|
|
94228
|
-
"hooks"
|
|
94340
|
+
"hooks",
|
|
94341
|
+
"allowed-tools"
|
|
94229
94342
|
];
|
|
94230
|
-
function
|
|
94343
|
+
function transformToKiroFormat(content) {
|
|
94231
94344
|
const { data, content: body } = import_gray_matter3.default(content);
|
|
94232
94345
|
const transformed = {};
|
|
94233
94346
|
transformed["name"] = data["name"] ?? data["grk-name"];
|
|
@@ -94244,16 +94357,77 @@ function transformToAgentSkills(content) {
|
|
|
94244
94357
|
}
|
|
94245
94358
|
return import_gray_matter3.default.stringify(body, transformed);
|
|
94246
94359
|
}
|
|
94360
|
+
function getSkillFolderName3(artifactId, filePath) {
|
|
94361
|
+
const safeName = toSafeName(artifactId);
|
|
94362
|
+
const skillName = basename7(resolveComponentFilename(filePath), ".md");
|
|
94363
|
+
return `${safeName}-${skillName}`;
|
|
94364
|
+
}
|
|
94365
|
+
var kiroPlugin = createFolderPlugin({
|
|
94366
|
+
id: "kiro",
|
|
94367
|
+
name: "Kiro",
|
|
94368
|
+
targetDir: TARGET_DIR7,
|
|
94369
|
+
entryPoints: ENTRY_POINTS3,
|
|
94370
|
+
generateRulesContent: generateDefaultBlockContent,
|
|
94371
|
+
syncCategories: ["skills"],
|
|
94372
|
+
getTargetPath: (artifactId, category, filePath) => {
|
|
94373
|
+
if (category === "skills") {
|
|
94374
|
+
const folderName = getSkillFolderName3(artifactId, filePath);
|
|
94375
|
+
return `${folderName}/SKILL.md`;
|
|
94376
|
+
}
|
|
94377
|
+
return null;
|
|
94378
|
+
},
|
|
94379
|
+
transformContent: (content) => {
|
|
94380
|
+
return transformToKiroFormat(content);
|
|
94381
|
+
},
|
|
94382
|
+
afterFileSync: ({ sourcePath, sourceDir, targetDir }) => {
|
|
94383
|
+
copySiblingFiles(sourceDir, targetDir, sourcePath);
|
|
94384
|
+
},
|
|
94385
|
+
setup: (projectRoot) => {
|
|
94386
|
+
writeSkillRouter(projectRoot, TARGET_DIR7);
|
|
94387
|
+
}
|
|
94388
|
+
});
|
|
94389
|
+
|
|
94390
|
+
// src/sync/plugins/universal/universal.ts
|
|
94391
|
+
var import_gray_matter4 = __toESM(require_gray_matter2(), 1);
|
|
94392
|
+
import { basename as basename8 } from "path";
|
|
94393
|
+
var TARGET_DIR8 = ".agents";
|
|
94394
|
+
var ENTRY_POINTS4 = ["AGENTS.md"];
|
|
94395
|
+
var CLAUDE_SPECIFIC_FIELDS2 = [
|
|
94396
|
+
"argument-hint",
|
|
94397
|
+
"disable-model-invocation",
|
|
94398
|
+
"user-invocable",
|
|
94399
|
+
"model",
|
|
94400
|
+
"context",
|
|
94401
|
+
"agent",
|
|
94402
|
+
"hooks"
|
|
94403
|
+
];
|
|
94404
|
+
function transformToAgentSkills(content) {
|
|
94405
|
+
const { data, content: body } = import_gray_matter4.default(content);
|
|
94406
|
+
const transformed = {};
|
|
94407
|
+
transformed["name"] = data["name"] ?? data["grk-name"];
|
|
94408
|
+
transformed["description"] = data["description"] ?? data["grk-description"];
|
|
94409
|
+
transformed["grk-type"] = data["grk-type"];
|
|
94410
|
+
for (const [key, value] of Object.entries(data)) {
|
|
94411
|
+
if (key === "name" || key === "description" || key === "grk-type")
|
|
94412
|
+
continue;
|
|
94413
|
+
if (key === "grk-name" || key === "grk-description")
|
|
94414
|
+
continue;
|
|
94415
|
+
if (CLAUDE_SPECIFIC_FIELDS2.includes(key))
|
|
94416
|
+
continue;
|
|
94417
|
+
transformed[key] = value;
|
|
94418
|
+
}
|
|
94419
|
+
return import_gray_matter4.default.stringify(body, transformed);
|
|
94420
|
+
}
|
|
94247
94421
|
function getSkillTargetPath(artifactId, filePath) {
|
|
94248
94422
|
const safeName = toSafeName(artifactId);
|
|
94249
|
-
const skillName =
|
|
94423
|
+
const skillName = basename8(filePath, ".md");
|
|
94250
94424
|
return `${safeName}-${skillName}/SKILL.md`;
|
|
94251
94425
|
}
|
|
94252
94426
|
var globalPlugin = createFolderPlugin({
|
|
94253
94427
|
id: "global",
|
|
94254
94428
|
name: "Global (.agents/)",
|
|
94255
|
-
targetDir:
|
|
94256
|
-
entryPoints:
|
|
94429
|
+
targetDir: TARGET_DIR8,
|
|
94430
|
+
entryPoints: ENTRY_POINTS4,
|
|
94257
94431
|
generateRulesContent: generateDefaultBlockContent,
|
|
94258
94432
|
syncCategories: ["skills"],
|
|
94259
94433
|
getTargetPath: (artifactId, _category, filePath) => {
|
|
@@ -94266,37 +94440,134 @@ var globalPlugin = createFolderPlugin({
|
|
|
94266
94440
|
copySiblingFiles(sourceDir, targetDir, sourcePath);
|
|
94267
94441
|
},
|
|
94268
94442
|
setup: (projectRoot) => {
|
|
94269
|
-
writeSkillRouter(projectRoot,
|
|
94443
|
+
writeSkillRouter(projectRoot, TARGET_DIR8);
|
|
94270
94444
|
}
|
|
94271
94445
|
});
|
|
94272
94446
|
|
|
94447
|
+
// src/sync/plugins/codex/codex.ts
|
|
94448
|
+
var codexPlugin = {
|
|
94449
|
+
...globalPlugin,
|
|
94450
|
+
id: "codex",
|
|
94451
|
+
name: "Codex"
|
|
94452
|
+
};
|
|
94453
|
+
|
|
94454
|
+
// src/sync/plugins/gemini/gemini.mcp.ts
|
|
94455
|
+
var geminiMcpConfig = {
|
|
94456
|
+
configFile: ".gemini/settings.json",
|
|
94457
|
+
serverKey: "mcpServers",
|
|
94458
|
+
transform: standardMcpTransform
|
|
94459
|
+
};
|
|
94460
|
+
|
|
94461
|
+
// src/sync/plugins/gemini/gemini.ts
|
|
94462
|
+
var geminiPlugin = {
|
|
94463
|
+
...globalPlugin,
|
|
94464
|
+
id: "gemini",
|
|
94465
|
+
name: "Gemini CLI"
|
|
94466
|
+
};
|
|
94467
|
+
|
|
94468
|
+
// src/sync/plugins/jules/jules.ts
|
|
94469
|
+
var julesPlugin = {
|
|
94470
|
+
...globalPlugin,
|
|
94471
|
+
id: "jules",
|
|
94472
|
+
name: "Jules"
|
|
94473
|
+
};
|
|
94474
|
+
|
|
94475
|
+
// src/sync/plugins/zed/zed.ts
|
|
94476
|
+
var zedPlugin = {
|
|
94477
|
+
...globalPlugin,
|
|
94478
|
+
id: "zed",
|
|
94479
|
+
name: "Zed"
|
|
94480
|
+
};
|
|
94481
|
+
|
|
94482
|
+
// src/sync/plugins/goose/goose.ts
|
|
94483
|
+
var goosePlugin = {
|
|
94484
|
+
...globalPlugin,
|
|
94485
|
+
id: "goose",
|
|
94486
|
+
name: "Goose"
|
|
94487
|
+
};
|
|
94488
|
+
|
|
94489
|
+
// src/sync/plugins/devin/devin.ts
|
|
94490
|
+
var devinPlugin = {
|
|
94491
|
+
...globalPlugin,
|
|
94492
|
+
id: "devin",
|
|
94493
|
+
name: "Devin"
|
|
94494
|
+
};
|
|
94495
|
+
|
|
94496
|
+
// src/sync/plugins/roocode/roocode.mcp.ts
|
|
94497
|
+
var roocodeMcpConfig = {
|
|
94498
|
+
configFile: ".roo/mcp.json",
|
|
94499
|
+
serverKey: "mcpServers",
|
|
94500
|
+
transform: standardMcpTransform
|
|
94501
|
+
};
|
|
94502
|
+
|
|
94503
|
+
// src/sync/plugins/roocode/roocode.ts
|
|
94504
|
+
var roocodePlugin = {
|
|
94505
|
+
...globalPlugin,
|
|
94506
|
+
id: "roocode",
|
|
94507
|
+
name: "RooCode"
|
|
94508
|
+
};
|
|
94509
|
+
|
|
94510
|
+
// src/sync/plugins/kilocode/kilocode.mcp.ts
|
|
94511
|
+
var kilocodeMcpConfig = {
|
|
94512
|
+
configFile: ".kilocode/mcp.json",
|
|
94513
|
+
serverKey: "mcpServers",
|
|
94514
|
+
transform: standardMcpTransform
|
|
94515
|
+
};
|
|
94516
|
+
|
|
94517
|
+
// src/sync/plugins/kilocode/kilocode.ts
|
|
94518
|
+
var kilocodePlugin = {
|
|
94519
|
+
...globalPlugin,
|
|
94520
|
+
id: "kilocode",
|
|
94521
|
+
name: "Kilo Code"
|
|
94522
|
+
};
|
|
94523
|
+
|
|
94524
|
+
// src/sync/plugins/amp/amp.mcp.ts
|
|
94525
|
+
var ampMcpConfig = {
|
|
94526
|
+
configFile: ".amp/settings.json",
|
|
94527
|
+
serverKey: "amp.mcpServers",
|
|
94528
|
+
transform: standardMcpTransform
|
|
94529
|
+
};
|
|
94530
|
+
|
|
94531
|
+
// src/sync/plugins/amp/amp.ts
|
|
94532
|
+
var ampPlugin = {
|
|
94533
|
+
...globalPlugin,
|
|
94534
|
+
id: "amp",
|
|
94535
|
+
name: "Amp"
|
|
94536
|
+
};
|
|
94537
|
+
|
|
94538
|
+
// src/sync/plugins/warp/warp.ts
|
|
94539
|
+
var warpPlugin = {
|
|
94540
|
+
...globalPlugin,
|
|
94541
|
+
id: "warp",
|
|
94542
|
+
name: "Warp"
|
|
94543
|
+
};
|
|
94544
|
+
|
|
94273
94545
|
// src/sync/manager/manager.ts
|
|
94274
94546
|
var builtInPlugins = {
|
|
94275
|
-
global: globalPlugin,
|
|
94276
94547
|
claude: claudePlugin,
|
|
94548
|
+
kiro: kiroPlugin,
|
|
94277
94549
|
cursor: cursorPlugin,
|
|
94550
|
+
copilot: copilotPlugin,
|
|
94278
94551
|
opencode: opencodePlugin,
|
|
94279
94552
|
windsurf: windsurfPlugin,
|
|
94280
94553
|
cline: clinePlugin,
|
|
94281
|
-
copilot: copilotPlugin,
|
|
94282
94554
|
aider: aiderPlugin,
|
|
94283
94555
|
continue: continuePlugin,
|
|
94284
94556
|
amazonq: amazonqPlugin,
|
|
94285
|
-
openclaw: openclawPlugin
|
|
94557
|
+
openclaw: openclawPlugin,
|
|
94558
|
+
codex: codexPlugin,
|
|
94559
|
+
gemini: geminiPlugin,
|
|
94560
|
+
jules: julesPlugin,
|
|
94561
|
+
zed: zedPlugin,
|
|
94562
|
+
goose: goosePlugin,
|
|
94563
|
+
devin: devinPlugin,
|
|
94564
|
+
roocode: roocodePlugin,
|
|
94565
|
+
kilocode: kilocodePlugin,
|
|
94566
|
+
amp: ampPlugin,
|
|
94567
|
+
warp: warpPlugin,
|
|
94568
|
+
global: globalPlugin
|
|
94286
94569
|
};
|
|
94287
94570
|
var GLOBAL_PLUGIN_ID = "global";
|
|
94288
|
-
var GLOBAL_COVERS = [
|
|
94289
|
-
"Codex",
|
|
94290
|
-
"Gemini CLI",
|
|
94291
|
-
"Jules",
|
|
94292
|
-
"Zed",
|
|
94293
|
-
"Goose",
|
|
94294
|
-
"Devin",
|
|
94295
|
-
"RooCode",
|
|
94296
|
-
"Kilo Code",
|
|
94297
|
-
"Amp",
|
|
94298
|
-
"Warp"
|
|
94299
|
-
];
|
|
94300
94571
|
var plugins = new Map(Object.entries(builtInPlugins));
|
|
94301
94572
|
function generateCustomBlockContent(targetDir) {
|
|
94302
94573
|
return () => {
|
|
@@ -94327,7 +94598,7 @@ function createCustomPlugin(id, config) {
|
|
|
94327
94598
|
function buildDefaultPaths(targetId) {
|
|
94328
94599
|
const paths = {};
|
|
94329
94600
|
for (const category of CATEGORIES) {
|
|
94330
|
-
paths[category] =
|
|
94601
|
+
paths[category] = join17(targetId, CATEGORY_CONFIG[category].defaultPath);
|
|
94331
94602
|
}
|
|
94332
94603
|
return paths;
|
|
94333
94604
|
}
|
|
@@ -94359,9 +94630,9 @@ function getDefaultTarget() {
|
|
|
94359
94630
|
}
|
|
94360
94631
|
|
|
94361
94632
|
// src/artifact/index/index.ts
|
|
94362
|
-
import { join as
|
|
94633
|
+
import { join as join18 } from "path";
|
|
94363
94634
|
function generateArtifactIndex(projectRoot, config, lockfile) {
|
|
94364
|
-
const artifactsDir =
|
|
94635
|
+
const artifactsDir = join18(projectRoot, ARTIFACTS_DIR);
|
|
94365
94636
|
lockfile ??= getLockfile2(projectRoot);
|
|
94366
94637
|
const inputs = [];
|
|
94367
94638
|
if (fs.exists(artifactsDir)) {
|
|
@@ -94369,13 +94640,13 @@ function generateArtifactIndex(projectRoot, config, lockfile) {
|
|
|
94369
94640
|
for (const scope of scopes) {
|
|
94370
94641
|
if (!scope.startsWith("@"))
|
|
94371
94642
|
continue;
|
|
94372
|
-
const scopeDir =
|
|
94643
|
+
const scopeDir = join18(artifactsDir, scope);
|
|
94373
94644
|
const stat = fs.stat(scopeDir);
|
|
94374
94645
|
if (!stat.isDirectory)
|
|
94375
94646
|
continue;
|
|
94376
94647
|
const names = fs.readdir(scopeDir);
|
|
94377
94648
|
for (const name2 of names) {
|
|
94378
|
-
const artifactDir =
|
|
94649
|
+
const artifactDir = join18(scopeDir, name2);
|
|
94379
94650
|
const artifactStat = fs.stat(artifactDir);
|
|
94380
94651
|
if (!artifactStat.isDirectory)
|
|
94381
94652
|
continue;
|
|
@@ -94400,13 +94671,13 @@ function generateArtifactIndex(projectRoot, config, lockfile) {
|
|
|
94400
94671
|
}
|
|
94401
94672
|
const index = generateIndex(inputs);
|
|
94402
94673
|
const serialized = serializeIndex(index, { includeTerminology: true });
|
|
94403
|
-
const indexPath =
|
|
94674
|
+
const indexPath = join18(projectRoot, INDEX_FILE);
|
|
94404
94675
|
fs.writeFile(indexPath, serialized);
|
|
94405
94676
|
}
|
|
94406
94677
|
function createEmptyIndex(projectRoot) {
|
|
94407
94678
|
const index = generateIndex([]);
|
|
94408
94679
|
const serialized = serializeIndex(index, { includeTerminology: true });
|
|
94409
|
-
const indexPath =
|
|
94680
|
+
const indexPath = join18(projectRoot, INDEX_FILE);
|
|
94410
94681
|
fs.writeFile(indexPath, serialized);
|
|
94411
94682
|
}
|
|
94412
94683
|
|
|
@@ -94432,6 +94703,135 @@ function ensureGitignore(projectRoot) {
|
|
|
94432
94703
|
success(`Added ${GREKT_DIR} to .gitignore`);
|
|
94433
94704
|
}
|
|
94434
94705
|
|
|
94706
|
+
// src/shared/prompts/searchable-checkbox.ts
|
|
94707
|
+
function isSelectableItem(item) {
|
|
94708
|
+
return !Separator.isSeparator(item) && !item.disabled;
|
|
94709
|
+
}
|
|
94710
|
+
var searchableCheckbox = createPrompt((config, done) => {
|
|
94711
|
+
const { pageSize = 15 } = config;
|
|
94712
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
94713
|
+
const [status, setStatus] = useState("idle");
|
|
94714
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
94715
|
+
const [items, setItems] = useState(() => config.choices.map((choice) => {
|
|
94716
|
+
if (Separator.isSeparator(choice))
|
|
94717
|
+
return choice;
|
|
94718
|
+
return { ...choice, checked: choice.checked ?? false };
|
|
94719
|
+
}));
|
|
94720
|
+
const prefix = usePrefix({ status: status === "done" ? "done" : "idle" });
|
|
94721
|
+
const filteredItems = useMemo(() => {
|
|
94722
|
+
if (!searchTerm)
|
|
94723
|
+
return items;
|
|
94724
|
+
const lower = searchTerm.toLowerCase();
|
|
94725
|
+
return items.filter((item) => {
|
|
94726
|
+
if (Separator.isSeparator(item))
|
|
94727
|
+
return false;
|
|
94728
|
+
return item.name.toLowerCase().includes(lower);
|
|
94729
|
+
});
|
|
94730
|
+
}, [items, searchTerm]);
|
|
94731
|
+
useKeypress((key, rl) => {
|
|
94732
|
+
if (isEnterKey(key)) {
|
|
94733
|
+
const selection = items.filter((item) => !Separator.isSeparator(item) && item.checked).map((item) => item.value);
|
|
94734
|
+
setStatus("done");
|
|
94735
|
+
done(selection);
|
|
94736
|
+
return;
|
|
94737
|
+
}
|
|
94738
|
+
if (isUpKey(key)) {
|
|
94739
|
+
let next = activeIndex - 1;
|
|
94740
|
+
if (next < 0)
|
|
94741
|
+
next = filteredItems.length - 1;
|
|
94742
|
+
const start = next;
|
|
94743
|
+
while (!isSelectableItem(filteredItems[next])) {
|
|
94744
|
+
next--;
|
|
94745
|
+
if (next < 0)
|
|
94746
|
+
next = filteredItems.length - 1;
|
|
94747
|
+
if (next === start)
|
|
94748
|
+
break;
|
|
94749
|
+
}
|
|
94750
|
+
setActiveIndex(next);
|
|
94751
|
+
return;
|
|
94752
|
+
}
|
|
94753
|
+
if (isDownKey(key)) {
|
|
94754
|
+
let next = activeIndex + 1;
|
|
94755
|
+
if (next >= filteredItems.length)
|
|
94756
|
+
next = 0;
|
|
94757
|
+
const start = next;
|
|
94758
|
+
while (!isSelectableItem(filteredItems[next])) {
|
|
94759
|
+
next++;
|
|
94760
|
+
if (next >= filteredItems.length)
|
|
94761
|
+
next = 0;
|
|
94762
|
+
if (next === start)
|
|
94763
|
+
break;
|
|
94764
|
+
}
|
|
94765
|
+
setActiveIndex(next);
|
|
94766
|
+
return;
|
|
94767
|
+
}
|
|
94768
|
+
if (isSpaceKey(key)) {
|
|
94769
|
+
const activeItem = filteredItems[activeIndex];
|
|
94770
|
+
if (activeItem && isSelectableItem(activeItem)) {
|
|
94771
|
+
setItems(items.map((item) => {
|
|
94772
|
+
if (Separator.isSeparator(item))
|
|
94773
|
+
return item;
|
|
94774
|
+
if (item.value === activeItem.value) {
|
|
94775
|
+
return { ...item, checked: !item.checked };
|
|
94776
|
+
}
|
|
94777
|
+
return item;
|
|
94778
|
+
}));
|
|
94779
|
+
}
|
|
94780
|
+
rl.clearLine(0);
|
|
94781
|
+
return;
|
|
94782
|
+
}
|
|
94783
|
+
if (isBackspaceKey(key)) {
|
|
94784
|
+
setSearchTerm(searchTerm.slice(0, -1));
|
|
94785
|
+
setActiveIndex(0);
|
|
94786
|
+
rl.clearLine(0);
|
|
94787
|
+
return;
|
|
94788
|
+
}
|
|
94789
|
+
if (key.name !== "tab" && !key.ctrl && !key.meta && rl.line) {
|
|
94790
|
+
setSearchTerm(rl.line);
|
|
94791
|
+
setActiveIndex(0);
|
|
94792
|
+
}
|
|
94793
|
+
});
|
|
94794
|
+
if (status === "done") {
|
|
94795
|
+
const selection = items.filter((item) => !Separator.isSeparator(item) && item.checked).map((item) => item.name);
|
|
94796
|
+
const answer = selection.length > 0 ? colors5.highlight(selection.join(", ")) : colors5.dim("none");
|
|
94797
|
+
return `${prefix} ${config.message} ${answer}`;
|
|
94798
|
+
}
|
|
94799
|
+
const page = usePagination({
|
|
94800
|
+
items: filteredItems,
|
|
94801
|
+
active: activeIndex,
|
|
94802
|
+
pageSize,
|
|
94803
|
+
renderItem: ({ item, isActive }) => {
|
|
94804
|
+
if (Separator.isSeparator(item)) {
|
|
94805
|
+
return ` ${item.separator}`;
|
|
94806
|
+
}
|
|
94807
|
+
if (item.disabled) {
|
|
94808
|
+
const label = typeof item.disabled === "string" ? item.disabled : "disabled";
|
|
94809
|
+
return colors5.dim(` ${item.name} (${label})`);
|
|
94810
|
+
}
|
|
94811
|
+
const checkbox = item.checked ? colors5.highlight(colors5.bold("◼")) : colors5.dim("◻");
|
|
94812
|
+
const cursor = isActive ? colors5.highlight(colors5.bold("❯")) : " ";
|
|
94813
|
+
const name2 = isActive ? colors5.bold(item.name) : colors5.dim(item.name);
|
|
94814
|
+
return `${cursor} ${checkbox} ${name2}`;
|
|
94815
|
+
}
|
|
94816
|
+
});
|
|
94817
|
+
const searchText = searchTerm || colors5.dim("Search to filter...");
|
|
94818
|
+
const hintsText = `${colors5.highlight("space")} ${colors5.dim("select")} ${colors5.highlight("enter")} ${colors5.dim("confirm")}`;
|
|
94819
|
+
const boxWidth = 36;
|
|
94820
|
+
const searchBox = [
|
|
94821
|
+
` ${colors5.dim("┌" + "─".repeat(boxWidth) + "┐")}`,
|
|
94822
|
+
` ${colors5.dim("│")} ${searchText}${" ".repeat(Math.max(0, boxWidth - 1 - (searchTerm?.length ?? 22)))}${colors5.dim("│")}`,
|
|
94823
|
+
` ${colors5.dim("└" + "─".repeat(boxWidth) + "┘")}`,
|
|
94824
|
+
` ${hintsText}`
|
|
94825
|
+
].join(`
|
|
94826
|
+
`);
|
|
94827
|
+
return [
|
|
94828
|
+
`${prefix} ${config.message}`,
|
|
94829
|
+
searchBox,
|
|
94830
|
+
page
|
|
94831
|
+
].join(`
|
|
94832
|
+
`);
|
|
94833
|
+
});
|
|
94834
|
+
|
|
94435
94835
|
// src/shared/prompts/prompts.ts
|
|
94436
94836
|
async function withPromptHandler(fn) {
|
|
94437
94837
|
try {
|
|
@@ -94493,25 +94893,6 @@ async function promptCustomTarget(builtInIds) {
|
|
|
94493
94893
|
return { id, config };
|
|
94494
94894
|
}
|
|
94495
94895
|
var OTHER_TARGET_VALUE = "__other__";
|
|
94496
|
-
function printGlobalCoversBanner() {
|
|
94497
|
-
const toolList = GLOBAL_COVERS.join(", ") + ", ...";
|
|
94498
|
-
newline();
|
|
94499
|
-
log(colors5.dim("┌ ") + colors5.bold("Global covers:"));
|
|
94500
|
-
log(colors5.dim("│ ") + toolList);
|
|
94501
|
-
log(colors5.dim("└"));
|
|
94502
|
-
}
|
|
94503
|
-
function splitByGroup(pluginChoices) {
|
|
94504
|
-
const globalChoices = [];
|
|
94505
|
-
const toolChoices = [];
|
|
94506
|
-
for (const choice of pluginChoices) {
|
|
94507
|
-
if (choice.value === GLOBAL_PLUGIN_ID) {
|
|
94508
|
-
globalChoices.push(choice);
|
|
94509
|
-
} else {
|
|
94510
|
-
toolChoices.push(choice);
|
|
94511
|
-
}
|
|
94512
|
-
}
|
|
94513
|
-
return { globalChoices, toolChoices };
|
|
94514
|
-
}
|
|
94515
94896
|
async function selectTargets(pluginChoices, options2 = {}) {
|
|
94516
94897
|
const {
|
|
94517
94898
|
currentTargets = [],
|
|
@@ -94519,28 +94900,23 @@ async function selectTargets(pluginChoices, options2 = {}) {
|
|
|
94519
94900
|
defaultCheckedIndex
|
|
94520
94901
|
} = options2;
|
|
94521
94902
|
const currentTargetSet = new Set(currentTargets);
|
|
94522
|
-
const
|
|
94523
|
-
const mapChoice = (choice, index) => ({
|
|
94524
|
-
...choice,
|
|
94525
|
-
checked: currentTargetSet.has(choice.value) || currentTargetSet.size === 0 && index === defaultCheckedIndex
|
|
94526
|
-
});
|
|
94903
|
+
const visibleChoices = pluginChoices.filter((c) => c.value !== GLOBAL_PLUGIN_ID);
|
|
94527
94904
|
const choices = [
|
|
94528
|
-
...
|
|
94529
|
-
|
|
94530
|
-
|
|
94531
|
-
|
|
94905
|
+
...visibleChoices.map((choice, index) => ({
|
|
94906
|
+
...choice,
|
|
94907
|
+
checked: currentTargetSet.has(choice.value) || currentTargetSet.size === 0 && index === defaultCheckedIndex
|
|
94908
|
+
})),
|
|
94909
|
+
new Separator("──────────"),
|
|
94532
94910
|
{
|
|
94533
94911
|
name: "Other (custom)",
|
|
94534
94912
|
value: OTHER_TARGET_VALUE,
|
|
94535
94913
|
checked: false
|
|
94536
94914
|
}
|
|
94537
94915
|
];
|
|
94538
|
-
|
|
94539
|
-
printGlobalCoversBanner();
|
|
94540
|
-
}
|
|
94541
|
-
const selected = await esm_default2({
|
|
94916
|
+
const selected = await searchableCheckbox({
|
|
94542
94917
|
message: "Select AI tools to sync with:",
|
|
94543
|
-
choices
|
|
94918
|
+
choices,
|
|
94919
|
+
pageSize: 15
|
|
94544
94920
|
});
|
|
94545
94921
|
const customTargets = { ...currentCustomTargets };
|
|
94546
94922
|
let targets;
|
|
@@ -94558,8 +94934,8 @@ async function selectTargets(pluginChoices, options2 = {}) {
|
|
|
94558
94934
|
async function selectTargetsToAdd(pluginChoices, currentTargets, currentCustomTargets) {
|
|
94559
94935
|
const currentTargetSet = new Set(currentTargets);
|
|
94560
94936
|
const builtInIds = pluginChoices.map((p) => p.value);
|
|
94937
|
+
const visibleChoices = pluginChoices.filter((c) => c.value !== GLOBAL_PLUGIN_ID);
|
|
94561
94938
|
const existingCustomTargetIds = Object.keys(currentCustomTargets).filter((id) => currentTargets.includes(id));
|
|
94562
|
-
const { globalChoices, toolChoices } = splitByGroup(pluginChoices);
|
|
94563
94939
|
const mapChoice = (choice) => {
|
|
94564
94940
|
const isAlreadyAdded = currentTargetSet.has(choice.value);
|
|
94565
94941
|
return {
|
|
@@ -94569,9 +94945,7 @@ async function selectTargetsToAdd(pluginChoices, currentTargets, currentCustomTa
|
|
|
94569
94945
|
};
|
|
94570
94946
|
};
|
|
94571
94947
|
const choices = [
|
|
94572
|
-
...
|
|
94573
|
-
new Separator("── Tool-specific ──"),
|
|
94574
|
-
...toolChoices.map(mapChoice),
|
|
94948
|
+
...visibleChoices.map(mapChoice),
|
|
94575
94949
|
...existingCustomTargetIds.filter((id) => currentCustomTargets[id] !== undefined).map((id) => {
|
|
94576
94950
|
const customTarget = currentCustomTargets[id];
|
|
94577
94951
|
return {
|
|
@@ -94580,7 +94954,7 @@ async function selectTargetsToAdd(pluginChoices, currentTargets, currentCustomTa
|
|
|
94580
94954
|
disabled: true
|
|
94581
94955
|
};
|
|
94582
94956
|
}),
|
|
94583
|
-
new Separator("
|
|
94957
|
+
new Separator("──────────"),
|
|
94584
94958
|
{
|
|
94585
94959
|
name: "Other (custom)",
|
|
94586
94960
|
value: OTHER_TARGET_VALUE,
|
|
@@ -94591,12 +94965,10 @@ async function selectTargetsToAdd(pluginChoices, currentTargets, currentCustomTa
|
|
|
94591
94965
|
if (!hasAvailableTargets) {
|
|
94592
94966
|
return { newTargets: [], newCustomTargets: {} };
|
|
94593
94967
|
}
|
|
94594
|
-
|
|
94595
|
-
printGlobalCoversBanner();
|
|
94596
|
-
}
|
|
94597
|
-
const selected = await esm_default2({
|
|
94968
|
+
const selected = await searchableCheckbox({
|
|
94598
94969
|
message: "Select AI tools to add:",
|
|
94599
|
-
choices
|
|
94970
|
+
choices,
|
|
94971
|
+
pageSize: 15
|
|
94600
94972
|
});
|
|
94601
94973
|
const newCustomTargets = {};
|
|
94602
94974
|
let newTargets;
|
|
@@ -94632,7 +95004,7 @@ async function selectTargetsToRemove(pluginChoices, currentTargets, currentCusto
|
|
|
94632
95004
|
value: targetId
|
|
94633
95005
|
};
|
|
94634
95006
|
});
|
|
94635
|
-
const selected = await
|
|
95007
|
+
const selected = await searchableCheckbox({
|
|
94636
95008
|
message: "Select targets to remove:",
|
|
94637
95009
|
choices
|
|
94638
95010
|
});
|
|
@@ -94654,7 +95026,7 @@ var initCommand = new Command("init").description("Initialize grekt in the curre
|
|
|
94654
95026
|
if (options2.artifact) {
|
|
94655
95027
|
log(colors5.bold("Artifact manifest:"));
|
|
94656
95028
|
newline();
|
|
94657
|
-
const defaultName =
|
|
95029
|
+
const defaultName = basename9(projectRoot);
|
|
94658
95030
|
const name2 = await esm_default4({
|
|
94659
95031
|
message: "Artifact name:",
|
|
94660
95032
|
default: defaultName,
|
|
@@ -95248,7 +95620,7 @@ var addTargetCommand = new Command("add-target").description("Add new sync targe
|
|
|
95248
95620
|
});
|
|
95249
95621
|
|
|
95250
95622
|
// src/sync/cleaner/cleaner.ts
|
|
95251
|
-
import { join as
|
|
95623
|
+
import { join as join19, resolve as resolve4, sep as sep2 } from "path";
|
|
95252
95624
|
var DANGEROUS_PATHS = new Set([".", "..", "/", ""]);
|
|
95253
95625
|
function isSafeToDelete(projectRoot, relativePath) {
|
|
95254
95626
|
if (DANGEROUS_PATHS.has(relativePath)) {
|
|
@@ -95280,7 +95652,7 @@ function cleanTargetPaths(projectRoot, targetId, customTargets) {
|
|
|
95280
95652
|
}
|
|
95281
95653
|
const { targetDir, entryPoints } = paths;
|
|
95282
95654
|
if (targetDir && isSafeToDelete(projectRoot, targetDir)) {
|
|
95283
|
-
const fullPath =
|
|
95655
|
+
const fullPath = join19(projectRoot, targetDir);
|
|
95284
95656
|
if (fs.exists(fullPath)) {
|
|
95285
95657
|
fs.rmdir(fullPath, { recursive: true });
|
|
95286
95658
|
result.deleted.push(targetDir);
|
|
@@ -95294,7 +95666,7 @@ function cleanTargetPaths(projectRoot, targetId, customTargets) {
|
|
|
95294
95666
|
const isInsideTargetDir = targetDir && entryPoint.startsWith(targetDir + sep2);
|
|
95295
95667
|
if (isInsideTargetDir)
|
|
95296
95668
|
continue;
|
|
95297
|
-
const fullPath =
|
|
95669
|
+
const fullPath = join19(projectRoot, entryPoint);
|
|
95298
95670
|
if (fs.exists(fullPath)) {
|
|
95299
95671
|
fs.unlink(fullPath);
|
|
95300
95672
|
result.deleted.push(entryPoint);
|
|
@@ -95364,12 +95736,12 @@ var removeTargetCommand = new Command("remove-target").description("Remove sync
|
|
|
95364
95736
|
});
|
|
95365
95737
|
|
|
95366
95738
|
// src/config/user/user.ts
|
|
95367
|
-
import { join as
|
|
95739
|
+
import { join as join20 } from "path";
|
|
95368
95740
|
import { homedir } from "os";
|
|
95369
|
-
var USER_CONFIG_DIR =
|
|
95741
|
+
var USER_CONFIG_DIR = join20(homedir(), ".grekt");
|
|
95370
95742
|
var SESSION_FILE = "session.yaml";
|
|
95371
95743
|
function getSessionPath() {
|
|
95372
|
-
return
|
|
95744
|
+
return join20(USER_CONFIG_DIR, SESSION_FILE);
|
|
95373
95745
|
}
|
|
95374
95746
|
function getGlobalSession() {
|
|
95375
95747
|
const filepath = getSessionPath();
|
|
@@ -95762,12 +96134,12 @@ function isEmptySelection(selection) {
|
|
|
95762
96134
|
}
|
|
95763
96135
|
|
|
95764
96136
|
// src/artifact/component-manager/component-manager.ts
|
|
95765
|
-
import { join as
|
|
96137
|
+
import { join as join21 } from "path";
|
|
95766
96138
|
function removeUnselectedFiles(artifactDir, artifactInfo, selection) {
|
|
95767
96139
|
for (const category of CATEGORIES) {
|
|
95768
96140
|
for (const file of artifactInfo[category]) {
|
|
95769
96141
|
if (!selection[category].includes(file.path)) {
|
|
95770
|
-
const filePath =
|
|
96142
|
+
const filePath = join21(artifactDir, file.path);
|
|
95771
96143
|
if (fs.exists(filePath)) {
|
|
95772
96144
|
fs.unlink(filePath);
|
|
95773
96145
|
}
|
|
@@ -96128,7 +96500,7 @@ async function promptStructuralChanges(artifactId, diff, artifactInfo, previousS
|
|
|
96128
96500
|
}
|
|
96129
96501
|
|
|
96130
96502
|
// src/sync/hooks/hooks.ts
|
|
96131
|
-
import { dirname as dirname7, join as
|
|
96503
|
+
import { dirname as dirname7, join as join23 } from "path";
|
|
96132
96504
|
|
|
96133
96505
|
// src/sync/hooks/hooks.config.ts
|
|
96134
96506
|
var HOOK_TARGETS = {
|
|
@@ -96151,7 +96523,7 @@ function resolveEventDefinitions(content) {
|
|
|
96151
96523
|
return content.hooks ?? {};
|
|
96152
96524
|
}
|
|
96153
96525
|
function readSettingsFile(projectRoot, settingsFile) {
|
|
96154
|
-
const fullPath =
|
|
96526
|
+
const fullPath = join23(projectRoot, settingsFile);
|
|
96155
96527
|
if (!fs.exists(fullPath)) {
|
|
96156
96528
|
return {};
|
|
96157
96529
|
}
|
|
@@ -96162,7 +96534,7 @@ function readSettingsFile(projectRoot, settingsFile) {
|
|
|
96162
96534
|
}
|
|
96163
96535
|
}
|
|
96164
96536
|
function writeSettingsFile(projectRoot, settingsFile, data) {
|
|
96165
|
-
const fullPath =
|
|
96537
|
+
const fullPath = join23(projectRoot, settingsFile);
|
|
96166
96538
|
const dir = dirname7(fullPath);
|
|
96167
96539
|
if (!fs.exists(dir)) {
|
|
96168
96540
|
fs.mkdir(dir, { recursive: true });
|
|
@@ -96172,21 +96544,21 @@ function writeSettingsFile(projectRoot, settingsFile, data) {
|
|
|
96172
96544
|
}
|
|
96173
96545
|
function listScriptFiles(projectRoot, artifactId, hookFilePath) {
|
|
96174
96546
|
const hookDir = dirname7(hookFilePath);
|
|
96175
|
-
const artifactHooksPath =
|
|
96547
|
+
const artifactHooksPath = join23(projectRoot, ARTIFACTS_DIR, artifactId, hookDir);
|
|
96176
96548
|
if (!fs.exists(artifactHooksPath)) {
|
|
96177
96549
|
return [];
|
|
96178
96550
|
}
|
|
96179
96551
|
return fs.readdir(artifactHooksPath).filter((file) => {
|
|
96180
96552
|
if (file.endsWith(".json"))
|
|
96181
96553
|
return false;
|
|
96182
|
-
const srcPath =
|
|
96554
|
+
const srcPath = join23(artifactHooksPath, file);
|
|
96183
96555
|
return fs.stat(srcPath).isFile;
|
|
96184
96556
|
});
|
|
96185
96557
|
}
|
|
96186
96558
|
function copyHookFiles(projectRoot, artifactId, hookFilePath, hooksDir) {
|
|
96187
96559
|
const hookDir = dirname7(hookFilePath);
|
|
96188
|
-
const artifactHooksPath =
|
|
96189
|
-
const targetHooksPath =
|
|
96560
|
+
const artifactHooksPath = join23(projectRoot, ARTIFACTS_DIR, artifactId, hookDir);
|
|
96561
|
+
const targetHooksPath = join23(projectRoot, hooksDir);
|
|
96190
96562
|
if (!fs.exists(artifactHooksPath)) {
|
|
96191
96563
|
return { copied: [], collisions: [] };
|
|
96192
96564
|
}
|
|
@@ -96197,8 +96569,8 @@ function copyHookFiles(projectRoot, artifactId, hookFilePath, hooksDir) {
|
|
|
96197
96569
|
const copied = [];
|
|
96198
96570
|
const collisions = [];
|
|
96199
96571
|
for (const file of files) {
|
|
96200
|
-
const srcPath =
|
|
96201
|
-
const destPath =
|
|
96572
|
+
const srcPath = join23(artifactHooksPath, file);
|
|
96573
|
+
const destPath = join23(targetHooksPath, file);
|
|
96202
96574
|
if (fs.exists(destPath)) {
|
|
96203
96575
|
collisions.push(file);
|
|
96204
96576
|
continue;
|
|
@@ -96210,7 +96582,7 @@ function copyHookFiles(projectRoot, artifactId, hookFilePath, hooksDir) {
|
|
|
96210
96582
|
}
|
|
96211
96583
|
function removeHookFiles(projectRoot, hooksDir, files) {
|
|
96212
96584
|
for (const file of files) {
|
|
96213
|
-
const filePath =
|
|
96585
|
+
const filePath = join23(projectRoot, hooksDir, file);
|
|
96214
96586
|
if (fs.exists(filePath)) {
|
|
96215
96587
|
fs.unlink(filePath);
|
|
96216
96588
|
}
|
|
@@ -96369,6 +96741,1363 @@ async function promptAndInstallHooks(projectRoot, artifactId, hookFiles) {
|
|
|
96369
96741
|
}
|
|
96370
96742
|
return true;
|
|
96371
96743
|
}
|
|
96744
|
+
// src/sync/mcp/mcp.ts
|
|
96745
|
+
import { dirname as dirname8, join as join25, relative as relative6 } from "path";
|
|
96746
|
+
|
|
96747
|
+
// src/sync/plugins/codex/codex.mcp.ts
|
|
96748
|
+
var codexMcpTransform = (_serverName, content, executablePath) => {
|
|
96749
|
+
if (content.url) {
|
|
96750
|
+
return {
|
|
96751
|
+
url: content.url,
|
|
96752
|
+
...content.headers && { http_headers: content.headers }
|
|
96753
|
+
};
|
|
96754
|
+
}
|
|
96755
|
+
return {
|
|
96756
|
+
command: executablePath,
|
|
96757
|
+
...content.args?.length && { args: content.args },
|
|
96758
|
+
...content.env && { env: content.env }
|
|
96759
|
+
};
|
|
96760
|
+
};
|
|
96761
|
+
var codexMcpConfig = {
|
|
96762
|
+
configFile: ".codex/config.toml",
|
|
96763
|
+
serverKey: "mcp_servers",
|
|
96764
|
+
format: "toml",
|
|
96765
|
+
transform: codexMcpTransform
|
|
96766
|
+
};
|
|
96767
|
+
|
|
96768
|
+
// src/sync/plugins/zed/zed.mcp.ts
|
|
96769
|
+
var zedMcpConfig = {
|
|
96770
|
+
configFile: ".zed/settings.json",
|
|
96771
|
+
serverKey: "context_servers",
|
|
96772
|
+
transform: standardMcpTransform
|
|
96773
|
+
};
|
|
96774
|
+
|
|
96775
|
+
// src/sync/mcp/mcp.config.ts
|
|
96776
|
+
var MCP_CONFIGS = {
|
|
96777
|
+
claude: claudeMcpConfig,
|
|
96778
|
+
cursor: cursorMcpConfig,
|
|
96779
|
+
copilot: copilotMcpConfig,
|
|
96780
|
+
amazonq: amazonqMcpConfig,
|
|
96781
|
+
opencode: opencodeMcpConfig,
|
|
96782
|
+
kiro: kiroMcpConfig,
|
|
96783
|
+
codex: codexMcpConfig,
|
|
96784
|
+
gemini: geminiMcpConfig,
|
|
96785
|
+
zed: zedMcpConfig,
|
|
96786
|
+
roocode: roocodeMcpConfig,
|
|
96787
|
+
kilocode: kilocodeMcpConfig,
|
|
96788
|
+
amp: ampMcpConfig
|
|
96789
|
+
};
|
|
96790
|
+
function getMcpConfig(targetId) {
|
|
96791
|
+
return MCP_CONFIGS[targetId];
|
|
96792
|
+
}
|
|
96793
|
+
function getMcpTargetIds() {
|
|
96794
|
+
return Object.keys(MCP_CONFIGS);
|
|
96795
|
+
}
|
|
96796
|
+
|
|
96797
|
+
// node_modules/smol-toml/dist/error.js
|
|
96798
|
+
/*!
|
|
96799
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
96800
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
96801
|
+
*
|
|
96802
|
+
* Redistribution and use in source and binary forms, with or without
|
|
96803
|
+
* modification, are permitted provided that the following conditions are met:
|
|
96804
|
+
*
|
|
96805
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
96806
|
+
* list of conditions and the following disclaimer.
|
|
96807
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
96808
|
+
* this list of conditions and the following disclaimer in the
|
|
96809
|
+
* documentation and/or other materials provided with the distribution.
|
|
96810
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
96811
|
+
* may be used to endorse or promote products derived from this software without
|
|
96812
|
+
* specific prior written permission.
|
|
96813
|
+
*
|
|
96814
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
96815
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
96816
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
96817
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
96818
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
96819
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
96820
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
96821
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
96822
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
96823
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
96824
|
+
*/
|
|
96825
|
+
function getLineColFromPtr(string, ptr) {
|
|
96826
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
96827
|
+
return [lines.length, lines.pop().length + 1];
|
|
96828
|
+
}
|
|
96829
|
+
function makeCodeBlock(string, line, column) {
|
|
96830
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
96831
|
+
let codeblock = "";
|
|
96832
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
96833
|
+
for (let i = line - 1;i <= line + 1; i++) {
|
|
96834
|
+
let l = lines[i - 1];
|
|
96835
|
+
if (!l)
|
|
96836
|
+
continue;
|
|
96837
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
96838
|
+
codeblock += ": ";
|
|
96839
|
+
codeblock += l;
|
|
96840
|
+
codeblock += `
|
|
96841
|
+
`;
|
|
96842
|
+
if (i === line) {
|
|
96843
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
96844
|
+
codeblock += `^
|
|
96845
|
+
`;
|
|
96846
|
+
}
|
|
96847
|
+
}
|
|
96848
|
+
return codeblock;
|
|
96849
|
+
}
|
|
96850
|
+
|
|
96851
|
+
class TomlError extends Error {
|
|
96852
|
+
line;
|
|
96853
|
+
column;
|
|
96854
|
+
codeblock;
|
|
96855
|
+
constructor(message, options2) {
|
|
96856
|
+
const [line, column] = getLineColFromPtr(options2.toml, options2.ptr);
|
|
96857
|
+
const codeblock = makeCodeBlock(options2.toml, line, column);
|
|
96858
|
+
super(`Invalid TOML document: ${message}
|
|
96859
|
+
|
|
96860
|
+
${codeblock}`, options2);
|
|
96861
|
+
this.line = line;
|
|
96862
|
+
this.column = column;
|
|
96863
|
+
this.codeblock = codeblock;
|
|
96864
|
+
}
|
|
96865
|
+
}
|
|
96866
|
+
|
|
96867
|
+
// node_modules/smol-toml/dist/util.js
|
|
96868
|
+
/*!
|
|
96869
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
96870
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
96871
|
+
*
|
|
96872
|
+
* Redistribution and use in source and binary forms, with or without
|
|
96873
|
+
* modification, are permitted provided that the following conditions are met:
|
|
96874
|
+
*
|
|
96875
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
96876
|
+
* list of conditions and the following disclaimer.
|
|
96877
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
96878
|
+
* this list of conditions and the following disclaimer in the
|
|
96879
|
+
* documentation and/or other materials provided with the distribution.
|
|
96880
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
96881
|
+
* may be used to endorse or promote products derived from this software without
|
|
96882
|
+
* specific prior written permission.
|
|
96883
|
+
*
|
|
96884
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
96885
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
96886
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
96887
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
96888
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
96889
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
96890
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
96891
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
96892
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
96893
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
96894
|
+
*/
|
|
96895
|
+
function isEscaped(str2, ptr) {
|
|
96896
|
+
let i = 0;
|
|
96897
|
+
while (str2[ptr - ++i] === "\\")
|
|
96898
|
+
;
|
|
96899
|
+
return --i && i % 2;
|
|
96900
|
+
}
|
|
96901
|
+
function indexOfNewline(str2, start = 0, end = str2.length) {
|
|
96902
|
+
let idx = str2.indexOf(`
|
|
96903
|
+
`, start);
|
|
96904
|
+
if (str2[idx - 1] === "\r")
|
|
96905
|
+
idx--;
|
|
96906
|
+
return idx <= end ? idx : -1;
|
|
96907
|
+
}
|
|
96908
|
+
function skipComment(str2, ptr) {
|
|
96909
|
+
for (let i = ptr;i < str2.length; i++) {
|
|
96910
|
+
let c = str2[i];
|
|
96911
|
+
if (c === `
|
|
96912
|
+
`)
|
|
96913
|
+
return i;
|
|
96914
|
+
if (c === "\r" && str2[i + 1] === `
|
|
96915
|
+
`)
|
|
96916
|
+
return i + 1;
|
|
96917
|
+
if (c < " " && c !== "\t" || c === "") {
|
|
96918
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
96919
|
+
toml: str2,
|
|
96920
|
+
ptr
|
|
96921
|
+
});
|
|
96922
|
+
}
|
|
96923
|
+
}
|
|
96924
|
+
return str2.length;
|
|
96925
|
+
}
|
|
96926
|
+
function skipVoid(str2, ptr, banNewLines, banComments) {
|
|
96927
|
+
let c;
|
|
96928
|
+
while ((c = str2[ptr]) === " " || c === "\t" || !banNewLines && (c === `
|
|
96929
|
+
` || c === "\r" && str2[ptr + 1] === `
|
|
96930
|
+
`))
|
|
96931
|
+
ptr++;
|
|
96932
|
+
return banComments || c !== "#" ? ptr : skipVoid(str2, skipComment(str2, ptr), banNewLines);
|
|
96933
|
+
}
|
|
96934
|
+
function skipUntil(str2, ptr, sep3, end, banNewLines = false) {
|
|
96935
|
+
if (!end) {
|
|
96936
|
+
ptr = indexOfNewline(str2, ptr);
|
|
96937
|
+
return ptr < 0 ? str2.length : ptr;
|
|
96938
|
+
}
|
|
96939
|
+
for (let i = ptr;i < str2.length; i++) {
|
|
96940
|
+
let c = str2[i];
|
|
96941
|
+
if (c === "#") {
|
|
96942
|
+
i = indexOfNewline(str2, i);
|
|
96943
|
+
} else if (c === sep3) {
|
|
96944
|
+
return i + 1;
|
|
96945
|
+
} else if (c === end || banNewLines && (c === `
|
|
96946
|
+
` || c === "\r" && str2[i + 1] === `
|
|
96947
|
+
`)) {
|
|
96948
|
+
return i;
|
|
96949
|
+
}
|
|
96950
|
+
}
|
|
96951
|
+
throw new TomlError("cannot find end of structure", {
|
|
96952
|
+
toml: str2,
|
|
96953
|
+
ptr
|
|
96954
|
+
});
|
|
96955
|
+
}
|
|
96956
|
+
function getStringEnd(str2, seek) {
|
|
96957
|
+
let first = str2[seek];
|
|
96958
|
+
let target = first === str2[seek + 1] && str2[seek + 1] === str2[seek + 2] ? str2.slice(seek, seek + 3) : first;
|
|
96959
|
+
seek += target.length - 1;
|
|
96960
|
+
do
|
|
96961
|
+
seek = str2.indexOf(target, ++seek);
|
|
96962
|
+
while (seek > -1 && first !== "'" && isEscaped(str2, seek));
|
|
96963
|
+
if (seek > -1) {
|
|
96964
|
+
seek += target.length;
|
|
96965
|
+
if (target.length > 1) {
|
|
96966
|
+
if (str2[seek] === first)
|
|
96967
|
+
seek++;
|
|
96968
|
+
if (str2[seek] === first)
|
|
96969
|
+
seek++;
|
|
96970
|
+
}
|
|
96971
|
+
}
|
|
96972
|
+
return seek;
|
|
96973
|
+
}
|
|
96974
|
+
|
|
96975
|
+
// node_modules/smol-toml/dist/date.js
|
|
96976
|
+
/*!
|
|
96977
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
96978
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
96979
|
+
*
|
|
96980
|
+
* Redistribution and use in source and binary forms, with or without
|
|
96981
|
+
* modification, are permitted provided that the following conditions are met:
|
|
96982
|
+
*
|
|
96983
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
96984
|
+
* list of conditions and the following disclaimer.
|
|
96985
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
96986
|
+
* this list of conditions and the following disclaimer in the
|
|
96987
|
+
* documentation and/or other materials provided with the distribution.
|
|
96988
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
96989
|
+
* may be used to endorse or promote products derived from this software without
|
|
96990
|
+
* specific prior written permission.
|
|
96991
|
+
*
|
|
96992
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
96993
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
96994
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
96995
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
96996
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
96997
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
96998
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
96999
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97000
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97001
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97002
|
+
*/
|
|
97003
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
97004
|
+
|
|
97005
|
+
class TomlDate extends Date {
|
|
97006
|
+
#hasDate = false;
|
|
97007
|
+
#hasTime = false;
|
|
97008
|
+
#offset = null;
|
|
97009
|
+
constructor(date) {
|
|
97010
|
+
let hasDate = true;
|
|
97011
|
+
let hasTime = true;
|
|
97012
|
+
let offset = "Z";
|
|
97013
|
+
if (typeof date === "string") {
|
|
97014
|
+
let match = date.match(DATE_TIME_RE);
|
|
97015
|
+
if (match) {
|
|
97016
|
+
if (!match[1]) {
|
|
97017
|
+
hasDate = false;
|
|
97018
|
+
date = `0000-01-01T${date}`;
|
|
97019
|
+
}
|
|
97020
|
+
hasTime = !!match[2];
|
|
97021
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
97022
|
+
if (match[2] && +match[2] > 23) {
|
|
97023
|
+
date = "";
|
|
97024
|
+
} else {
|
|
97025
|
+
offset = match[3] || null;
|
|
97026
|
+
date = date.toUpperCase();
|
|
97027
|
+
if (!offset && hasTime)
|
|
97028
|
+
date += "Z";
|
|
97029
|
+
}
|
|
97030
|
+
} else {
|
|
97031
|
+
date = "";
|
|
97032
|
+
}
|
|
97033
|
+
}
|
|
97034
|
+
super(date);
|
|
97035
|
+
if (!isNaN(this.getTime())) {
|
|
97036
|
+
this.#hasDate = hasDate;
|
|
97037
|
+
this.#hasTime = hasTime;
|
|
97038
|
+
this.#offset = offset;
|
|
97039
|
+
}
|
|
97040
|
+
}
|
|
97041
|
+
isDateTime() {
|
|
97042
|
+
return this.#hasDate && this.#hasTime;
|
|
97043
|
+
}
|
|
97044
|
+
isLocal() {
|
|
97045
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
97046
|
+
}
|
|
97047
|
+
isDate() {
|
|
97048
|
+
return this.#hasDate && !this.#hasTime;
|
|
97049
|
+
}
|
|
97050
|
+
isTime() {
|
|
97051
|
+
return this.#hasTime && !this.#hasDate;
|
|
97052
|
+
}
|
|
97053
|
+
isValid() {
|
|
97054
|
+
return this.#hasDate || this.#hasTime;
|
|
97055
|
+
}
|
|
97056
|
+
toISOString() {
|
|
97057
|
+
let iso = super.toISOString();
|
|
97058
|
+
if (this.isDate())
|
|
97059
|
+
return iso.slice(0, 10);
|
|
97060
|
+
if (this.isTime())
|
|
97061
|
+
return iso.slice(11, 23);
|
|
97062
|
+
if (this.#offset === null)
|
|
97063
|
+
return iso.slice(0, -1);
|
|
97064
|
+
if (this.#offset === "Z")
|
|
97065
|
+
return iso;
|
|
97066
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
97067
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
97068
|
+
let offsetDate = new Date(this.getTime() - offset * 60000);
|
|
97069
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
97070
|
+
}
|
|
97071
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
97072
|
+
let date = new TomlDate(jsDate);
|
|
97073
|
+
date.#offset = offset;
|
|
97074
|
+
return date;
|
|
97075
|
+
}
|
|
97076
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
97077
|
+
let date = new TomlDate(jsDate);
|
|
97078
|
+
date.#offset = null;
|
|
97079
|
+
return date;
|
|
97080
|
+
}
|
|
97081
|
+
static wrapAsLocalDate(jsDate) {
|
|
97082
|
+
let date = new TomlDate(jsDate);
|
|
97083
|
+
date.#hasTime = false;
|
|
97084
|
+
date.#offset = null;
|
|
97085
|
+
return date;
|
|
97086
|
+
}
|
|
97087
|
+
static wrapAsLocalTime(jsDate) {
|
|
97088
|
+
let date = new TomlDate(jsDate);
|
|
97089
|
+
date.#hasDate = false;
|
|
97090
|
+
date.#offset = null;
|
|
97091
|
+
return date;
|
|
97092
|
+
}
|
|
97093
|
+
}
|
|
97094
|
+
|
|
97095
|
+
// node_modules/smol-toml/dist/primitive.js
|
|
97096
|
+
/*!
|
|
97097
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97098
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
97099
|
+
*
|
|
97100
|
+
* Redistribution and use in source and binary forms, with or without
|
|
97101
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97102
|
+
*
|
|
97103
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
97104
|
+
* list of conditions and the following disclaimer.
|
|
97105
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
97106
|
+
* this list of conditions and the following disclaimer in the
|
|
97107
|
+
* documentation and/or other materials provided with the distribution.
|
|
97108
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97109
|
+
* may be used to endorse or promote products derived from this software without
|
|
97110
|
+
* specific prior written permission.
|
|
97111
|
+
*
|
|
97112
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97113
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
97114
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
97115
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
97116
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
97117
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
97118
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97119
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97120
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97121
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97122
|
+
*/
|
|
97123
|
+
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
97124
|
+
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
97125
|
+
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
97126
|
+
var ESCAPE_REGEX = /^[0-9a-f]{2,8}$/i;
|
|
97127
|
+
var ESC_MAP = {
|
|
97128
|
+
b: "\b",
|
|
97129
|
+
t: "\t",
|
|
97130
|
+
n: `
|
|
97131
|
+
`,
|
|
97132
|
+
f: "\f",
|
|
97133
|
+
r: "\r",
|
|
97134
|
+
e: "\x1B",
|
|
97135
|
+
'"': '"',
|
|
97136
|
+
"\\": "\\"
|
|
97137
|
+
};
|
|
97138
|
+
function parseString(str2, ptr = 0, endPtr = str2.length) {
|
|
97139
|
+
let isLiteral = str2[ptr] === "'";
|
|
97140
|
+
let isMultiline = str2[ptr++] === str2[ptr] && str2[ptr] === str2[ptr + 1];
|
|
97141
|
+
if (isMultiline) {
|
|
97142
|
+
endPtr -= 2;
|
|
97143
|
+
if (str2[ptr += 2] === "\r")
|
|
97144
|
+
ptr++;
|
|
97145
|
+
if (str2[ptr] === `
|
|
97146
|
+
`)
|
|
97147
|
+
ptr++;
|
|
97148
|
+
}
|
|
97149
|
+
let tmp = 0;
|
|
97150
|
+
let isEscape;
|
|
97151
|
+
let parsed = "";
|
|
97152
|
+
let sliceStart = ptr;
|
|
97153
|
+
while (ptr < endPtr - 1) {
|
|
97154
|
+
let c = str2[ptr++];
|
|
97155
|
+
if (c === `
|
|
97156
|
+
` || c === "\r" && str2[ptr] === `
|
|
97157
|
+
`) {
|
|
97158
|
+
if (!isMultiline) {
|
|
97159
|
+
throw new TomlError("newlines are not allowed in strings", {
|
|
97160
|
+
toml: str2,
|
|
97161
|
+
ptr: ptr - 1
|
|
97162
|
+
});
|
|
97163
|
+
}
|
|
97164
|
+
} else if (c < " " && c !== "\t" || c === "") {
|
|
97165
|
+
throw new TomlError("control characters are not allowed in strings", {
|
|
97166
|
+
toml: str2,
|
|
97167
|
+
ptr: ptr - 1
|
|
97168
|
+
});
|
|
97169
|
+
}
|
|
97170
|
+
if (isEscape) {
|
|
97171
|
+
isEscape = false;
|
|
97172
|
+
if (c === "x" || c === "u" || c === "U") {
|
|
97173
|
+
let code2 = str2.slice(ptr, ptr += c === "x" ? 2 : c === "u" ? 4 : 8);
|
|
97174
|
+
if (!ESCAPE_REGEX.test(code2)) {
|
|
97175
|
+
throw new TomlError("invalid unicode escape", {
|
|
97176
|
+
toml: str2,
|
|
97177
|
+
ptr: tmp
|
|
97178
|
+
});
|
|
97179
|
+
}
|
|
97180
|
+
try {
|
|
97181
|
+
parsed += String.fromCodePoint(parseInt(code2, 16));
|
|
97182
|
+
} catch {
|
|
97183
|
+
throw new TomlError("invalid unicode escape", {
|
|
97184
|
+
toml: str2,
|
|
97185
|
+
ptr: tmp
|
|
97186
|
+
});
|
|
97187
|
+
}
|
|
97188
|
+
} else if (isMultiline && (c === `
|
|
97189
|
+
` || c === " " || c === "\t" || c === "\r")) {
|
|
97190
|
+
ptr = skipVoid(str2, ptr - 1, true);
|
|
97191
|
+
if (str2[ptr] !== `
|
|
97192
|
+
` && str2[ptr] !== "\r") {
|
|
97193
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
97194
|
+
toml: str2,
|
|
97195
|
+
ptr: tmp
|
|
97196
|
+
});
|
|
97197
|
+
}
|
|
97198
|
+
ptr = skipVoid(str2, ptr);
|
|
97199
|
+
} else if (c in ESC_MAP) {
|
|
97200
|
+
parsed += ESC_MAP[c];
|
|
97201
|
+
} else {
|
|
97202
|
+
throw new TomlError("unrecognized escape sequence", {
|
|
97203
|
+
toml: str2,
|
|
97204
|
+
ptr: tmp
|
|
97205
|
+
});
|
|
97206
|
+
}
|
|
97207
|
+
sliceStart = ptr;
|
|
97208
|
+
} else if (!isLiteral && c === "\\") {
|
|
97209
|
+
tmp = ptr - 1;
|
|
97210
|
+
isEscape = true;
|
|
97211
|
+
parsed += str2.slice(sliceStart, tmp);
|
|
97212
|
+
}
|
|
97213
|
+
}
|
|
97214
|
+
return parsed + str2.slice(sliceStart, endPtr - 1);
|
|
97215
|
+
}
|
|
97216
|
+
function parseValue2(value, toml, ptr, integersAsBigInt) {
|
|
97217
|
+
if (value === "true")
|
|
97218
|
+
return true;
|
|
97219
|
+
if (value === "false")
|
|
97220
|
+
return false;
|
|
97221
|
+
if (value === "-inf")
|
|
97222
|
+
return -Infinity;
|
|
97223
|
+
if (value === "inf" || value === "+inf")
|
|
97224
|
+
return Infinity;
|
|
97225
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
97226
|
+
return NaN;
|
|
97227
|
+
if (value === "-0")
|
|
97228
|
+
return integersAsBigInt ? 0n : 0;
|
|
97229
|
+
let isInt = INT_REGEX.test(value);
|
|
97230
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
97231
|
+
if (LEADING_ZERO.test(value)) {
|
|
97232
|
+
throw new TomlError("leading zeroes are not allowed", {
|
|
97233
|
+
toml,
|
|
97234
|
+
ptr
|
|
97235
|
+
});
|
|
97236
|
+
}
|
|
97237
|
+
value = value.replace(/_/g, "");
|
|
97238
|
+
let numeric = +value;
|
|
97239
|
+
if (isNaN(numeric)) {
|
|
97240
|
+
throw new TomlError("invalid number", {
|
|
97241
|
+
toml,
|
|
97242
|
+
ptr
|
|
97243
|
+
});
|
|
97244
|
+
}
|
|
97245
|
+
if (isInt) {
|
|
97246
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
97247
|
+
throw new TomlError("integer value cannot be represented losslessly", {
|
|
97248
|
+
toml,
|
|
97249
|
+
ptr
|
|
97250
|
+
});
|
|
97251
|
+
}
|
|
97252
|
+
if (isInt || integersAsBigInt === true)
|
|
97253
|
+
numeric = BigInt(value);
|
|
97254
|
+
}
|
|
97255
|
+
return numeric;
|
|
97256
|
+
}
|
|
97257
|
+
const date = new TomlDate(value);
|
|
97258
|
+
if (!date.isValid()) {
|
|
97259
|
+
throw new TomlError("invalid value", {
|
|
97260
|
+
toml,
|
|
97261
|
+
ptr
|
|
97262
|
+
});
|
|
97263
|
+
}
|
|
97264
|
+
return date;
|
|
97265
|
+
}
|
|
97266
|
+
|
|
97267
|
+
// node_modules/smol-toml/dist/extract.js
|
|
97268
|
+
/*!
|
|
97269
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97270
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
97271
|
+
*
|
|
97272
|
+
* Redistribution and use in source and binary forms, with or without
|
|
97273
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97274
|
+
*
|
|
97275
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
97276
|
+
* list of conditions and the following disclaimer.
|
|
97277
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
97278
|
+
* this list of conditions and the following disclaimer in the
|
|
97279
|
+
* documentation and/or other materials provided with the distribution.
|
|
97280
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97281
|
+
* may be used to endorse or promote products derived from this software without
|
|
97282
|
+
* specific prior written permission.
|
|
97283
|
+
*
|
|
97284
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97285
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
97286
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
97287
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
97288
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
97289
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
97290
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97291
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97292
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97293
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97294
|
+
*/
|
|
97295
|
+
function sliceAndTrimEndOf(str2, startPtr, endPtr) {
|
|
97296
|
+
let value = str2.slice(startPtr, endPtr);
|
|
97297
|
+
let commentIdx = value.indexOf("#");
|
|
97298
|
+
if (commentIdx > -1) {
|
|
97299
|
+
skipComment(str2, commentIdx);
|
|
97300
|
+
value = value.slice(0, commentIdx);
|
|
97301
|
+
}
|
|
97302
|
+
return [value.trimEnd(), commentIdx];
|
|
97303
|
+
}
|
|
97304
|
+
function extractValue(str2, ptr, end, depth, integersAsBigInt) {
|
|
97305
|
+
if (depth === 0) {
|
|
97306
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
97307
|
+
toml: str2,
|
|
97308
|
+
ptr
|
|
97309
|
+
});
|
|
97310
|
+
}
|
|
97311
|
+
let c = str2[ptr];
|
|
97312
|
+
if (c === "[" || c === "{") {
|
|
97313
|
+
let [value, endPtr2] = c === "[" ? parseArray(str2, ptr, depth, integersAsBigInt) : parseInlineTable(str2, ptr, depth, integersAsBigInt);
|
|
97314
|
+
if (end) {
|
|
97315
|
+
endPtr2 = skipVoid(str2, endPtr2);
|
|
97316
|
+
if (str2[endPtr2] === ",")
|
|
97317
|
+
endPtr2++;
|
|
97318
|
+
else if (str2[endPtr2] !== end) {
|
|
97319
|
+
throw new TomlError("expected comma or end of structure", {
|
|
97320
|
+
toml: str2,
|
|
97321
|
+
ptr: endPtr2
|
|
97322
|
+
});
|
|
97323
|
+
}
|
|
97324
|
+
}
|
|
97325
|
+
return [value, endPtr2];
|
|
97326
|
+
}
|
|
97327
|
+
let endPtr;
|
|
97328
|
+
if (c === '"' || c === "'") {
|
|
97329
|
+
endPtr = getStringEnd(str2, ptr);
|
|
97330
|
+
let parsed = parseString(str2, ptr, endPtr);
|
|
97331
|
+
if (end) {
|
|
97332
|
+
endPtr = skipVoid(str2, endPtr);
|
|
97333
|
+
if (str2[endPtr] && str2[endPtr] !== "," && str2[endPtr] !== end && str2[endPtr] !== `
|
|
97334
|
+
` && str2[endPtr] !== "\r") {
|
|
97335
|
+
throw new TomlError("unexpected character encountered", {
|
|
97336
|
+
toml: str2,
|
|
97337
|
+
ptr: endPtr
|
|
97338
|
+
});
|
|
97339
|
+
}
|
|
97340
|
+
endPtr += +(str2[endPtr] === ",");
|
|
97341
|
+
}
|
|
97342
|
+
return [parsed, endPtr];
|
|
97343
|
+
}
|
|
97344
|
+
endPtr = skipUntil(str2, ptr, ",", end);
|
|
97345
|
+
let slice = sliceAndTrimEndOf(str2, ptr, endPtr - +(str2[endPtr - 1] === ","));
|
|
97346
|
+
if (!slice[0]) {
|
|
97347
|
+
throw new TomlError("incomplete key-value declaration: no value specified", {
|
|
97348
|
+
toml: str2,
|
|
97349
|
+
ptr
|
|
97350
|
+
});
|
|
97351
|
+
}
|
|
97352
|
+
if (end && slice[1] > -1) {
|
|
97353
|
+
endPtr = skipVoid(str2, ptr + slice[1]);
|
|
97354
|
+
endPtr += +(str2[endPtr] === ",");
|
|
97355
|
+
}
|
|
97356
|
+
return [
|
|
97357
|
+
parseValue2(slice[0], str2, ptr, integersAsBigInt),
|
|
97358
|
+
endPtr
|
|
97359
|
+
];
|
|
97360
|
+
}
|
|
97361
|
+
|
|
97362
|
+
// node_modules/smol-toml/dist/struct.js
|
|
97363
|
+
/*!
|
|
97364
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97365
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
97366
|
+
*
|
|
97367
|
+
* Redistribution and use in source and binary forms, with or without
|
|
97368
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97369
|
+
*
|
|
97370
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
97371
|
+
* list of conditions and the following disclaimer.
|
|
97372
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
97373
|
+
* this list of conditions and the following disclaimer in the
|
|
97374
|
+
* documentation and/or other materials provided with the distribution.
|
|
97375
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97376
|
+
* may be used to endorse or promote products derived from this software without
|
|
97377
|
+
* specific prior written permission.
|
|
97378
|
+
*
|
|
97379
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97380
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
97381
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
97382
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
97383
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
97384
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
97385
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97386
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97387
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97388
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97389
|
+
*/
|
|
97390
|
+
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
97391
|
+
function parseKey(str2, ptr, end = "=") {
|
|
97392
|
+
let dot = ptr - 1;
|
|
97393
|
+
let parsed = [];
|
|
97394
|
+
let endPtr = str2.indexOf(end, ptr);
|
|
97395
|
+
if (endPtr < 0) {
|
|
97396
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
97397
|
+
toml: str2,
|
|
97398
|
+
ptr
|
|
97399
|
+
});
|
|
97400
|
+
}
|
|
97401
|
+
do {
|
|
97402
|
+
let c = str2[ptr = ++dot];
|
|
97403
|
+
if (c !== " " && c !== "\t") {
|
|
97404
|
+
if (c === '"' || c === "'") {
|
|
97405
|
+
if (c === str2[ptr + 1] && c === str2[ptr + 2]) {
|
|
97406
|
+
throw new TomlError("multiline strings are not allowed in keys", {
|
|
97407
|
+
toml: str2,
|
|
97408
|
+
ptr
|
|
97409
|
+
});
|
|
97410
|
+
}
|
|
97411
|
+
let eos = getStringEnd(str2, ptr);
|
|
97412
|
+
if (eos < 0) {
|
|
97413
|
+
throw new TomlError("unfinished string encountered", {
|
|
97414
|
+
toml: str2,
|
|
97415
|
+
ptr
|
|
97416
|
+
});
|
|
97417
|
+
}
|
|
97418
|
+
dot = str2.indexOf(".", eos);
|
|
97419
|
+
let strEnd = str2.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
97420
|
+
let newLine = indexOfNewline(strEnd);
|
|
97421
|
+
if (newLine > -1) {
|
|
97422
|
+
throw new TomlError("newlines are not allowed in keys", {
|
|
97423
|
+
toml: str2,
|
|
97424
|
+
ptr: ptr + dot + newLine
|
|
97425
|
+
});
|
|
97426
|
+
}
|
|
97427
|
+
if (strEnd.trimStart()) {
|
|
97428
|
+
throw new TomlError("found extra tokens after the string part", {
|
|
97429
|
+
toml: str2,
|
|
97430
|
+
ptr: eos
|
|
97431
|
+
});
|
|
97432
|
+
}
|
|
97433
|
+
if (endPtr < eos) {
|
|
97434
|
+
endPtr = str2.indexOf(end, eos);
|
|
97435
|
+
if (endPtr < 0) {
|
|
97436
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
97437
|
+
toml: str2,
|
|
97438
|
+
ptr
|
|
97439
|
+
});
|
|
97440
|
+
}
|
|
97441
|
+
}
|
|
97442
|
+
parsed.push(parseString(str2, ptr, eos));
|
|
97443
|
+
} else {
|
|
97444
|
+
dot = str2.indexOf(".", ptr);
|
|
97445
|
+
let part = str2.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
97446
|
+
if (!KEY_PART_RE.test(part)) {
|
|
97447
|
+
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
97448
|
+
toml: str2,
|
|
97449
|
+
ptr
|
|
97450
|
+
});
|
|
97451
|
+
}
|
|
97452
|
+
parsed.push(part.trimEnd());
|
|
97453
|
+
}
|
|
97454
|
+
}
|
|
97455
|
+
} while (dot + 1 && dot < endPtr);
|
|
97456
|
+
return [parsed, skipVoid(str2, endPtr + 1, true, true)];
|
|
97457
|
+
}
|
|
97458
|
+
function parseInlineTable(str2, ptr, depth, integersAsBigInt) {
|
|
97459
|
+
let res = {};
|
|
97460
|
+
let seen = new Set;
|
|
97461
|
+
let c;
|
|
97462
|
+
ptr++;
|
|
97463
|
+
while ((c = str2[ptr++]) !== "}" && c) {
|
|
97464
|
+
if (c === ",") {
|
|
97465
|
+
throw new TomlError("expected value, found comma", {
|
|
97466
|
+
toml: str2,
|
|
97467
|
+
ptr: ptr - 1
|
|
97468
|
+
});
|
|
97469
|
+
} else if (c === "#")
|
|
97470
|
+
ptr = skipComment(str2, ptr);
|
|
97471
|
+
else if (c !== " " && c !== "\t" && c !== `
|
|
97472
|
+
` && c !== "\r") {
|
|
97473
|
+
let k;
|
|
97474
|
+
let t = res;
|
|
97475
|
+
let hasOwn = false;
|
|
97476
|
+
let [key, keyEndPtr] = parseKey(str2, ptr - 1);
|
|
97477
|
+
for (let i = 0;i < key.length; i++) {
|
|
97478
|
+
if (i)
|
|
97479
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
97480
|
+
k = key[i];
|
|
97481
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
97482
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
97483
|
+
toml: str2,
|
|
97484
|
+
ptr
|
|
97485
|
+
});
|
|
97486
|
+
}
|
|
97487
|
+
if (!hasOwn && k === "__proto__") {
|
|
97488
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
97489
|
+
}
|
|
97490
|
+
}
|
|
97491
|
+
if (hasOwn) {
|
|
97492
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
97493
|
+
toml: str2,
|
|
97494
|
+
ptr
|
|
97495
|
+
});
|
|
97496
|
+
}
|
|
97497
|
+
let [value, valueEndPtr] = extractValue(str2, keyEndPtr, "}", depth - 1, integersAsBigInt);
|
|
97498
|
+
seen.add(value);
|
|
97499
|
+
t[k] = value;
|
|
97500
|
+
ptr = valueEndPtr;
|
|
97501
|
+
}
|
|
97502
|
+
}
|
|
97503
|
+
if (!c) {
|
|
97504
|
+
throw new TomlError("unfinished table encountered", {
|
|
97505
|
+
toml: str2,
|
|
97506
|
+
ptr
|
|
97507
|
+
});
|
|
97508
|
+
}
|
|
97509
|
+
return [res, ptr];
|
|
97510
|
+
}
|
|
97511
|
+
function parseArray(str2, ptr, depth, integersAsBigInt) {
|
|
97512
|
+
let res = [];
|
|
97513
|
+
let c;
|
|
97514
|
+
ptr++;
|
|
97515
|
+
while ((c = str2[ptr++]) !== "]" && c) {
|
|
97516
|
+
if (c === ",") {
|
|
97517
|
+
throw new TomlError("expected value, found comma", {
|
|
97518
|
+
toml: str2,
|
|
97519
|
+
ptr: ptr - 1
|
|
97520
|
+
});
|
|
97521
|
+
} else if (c === "#")
|
|
97522
|
+
ptr = skipComment(str2, ptr);
|
|
97523
|
+
else if (c !== " " && c !== "\t" && c !== `
|
|
97524
|
+
` && c !== "\r") {
|
|
97525
|
+
let e = extractValue(str2, ptr - 1, "]", depth - 1, integersAsBigInt);
|
|
97526
|
+
res.push(e[0]);
|
|
97527
|
+
ptr = e[1];
|
|
97528
|
+
}
|
|
97529
|
+
}
|
|
97530
|
+
if (!c) {
|
|
97531
|
+
throw new TomlError("unfinished array encountered", {
|
|
97532
|
+
toml: str2,
|
|
97533
|
+
ptr
|
|
97534
|
+
});
|
|
97535
|
+
}
|
|
97536
|
+
return [res, ptr];
|
|
97537
|
+
}
|
|
97538
|
+
|
|
97539
|
+
// node_modules/smol-toml/dist/parse.js
|
|
97540
|
+
/*!
|
|
97541
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97542
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
97543
|
+
*
|
|
97544
|
+
* Redistribution and use in source and binary forms, with or without
|
|
97545
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97546
|
+
*
|
|
97547
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
97548
|
+
* list of conditions and the following disclaimer.
|
|
97549
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
97550
|
+
* this list of conditions and the following disclaimer in the
|
|
97551
|
+
* documentation and/or other materials provided with the distribution.
|
|
97552
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97553
|
+
* may be used to endorse or promote products derived from this software without
|
|
97554
|
+
* specific prior written permission.
|
|
97555
|
+
*
|
|
97556
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97557
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
97558
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
97559
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
97560
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
97561
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
97562
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97563
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97564
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97565
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97566
|
+
*/
|
|
97567
|
+
function peekTable(key, table, meta, type) {
|
|
97568
|
+
let t = table;
|
|
97569
|
+
let m = meta;
|
|
97570
|
+
let k;
|
|
97571
|
+
let hasOwn = false;
|
|
97572
|
+
let state;
|
|
97573
|
+
for (let i = 0;i < key.length; i++) {
|
|
97574
|
+
if (i) {
|
|
97575
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
97576
|
+
m = (state = m[k]).c;
|
|
97577
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
97578
|
+
return null;
|
|
97579
|
+
}
|
|
97580
|
+
if (state.t === 2) {
|
|
97581
|
+
let l = t.length - 1;
|
|
97582
|
+
t = t[l];
|
|
97583
|
+
m = m[l].c;
|
|
97584
|
+
}
|
|
97585
|
+
}
|
|
97586
|
+
k = key[i];
|
|
97587
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
97588
|
+
return null;
|
|
97589
|
+
}
|
|
97590
|
+
if (!hasOwn) {
|
|
97591
|
+
if (k === "__proto__") {
|
|
97592
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
97593
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
97594
|
+
}
|
|
97595
|
+
m[k] = {
|
|
97596
|
+
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
97597
|
+
d: false,
|
|
97598
|
+
i: 0,
|
|
97599
|
+
c: {}
|
|
97600
|
+
};
|
|
97601
|
+
}
|
|
97602
|
+
}
|
|
97603
|
+
state = m[k];
|
|
97604
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
97605
|
+
return null;
|
|
97606
|
+
}
|
|
97607
|
+
if (type === 2) {
|
|
97608
|
+
if (!state.d) {
|
|
97609
|
+
state.d = true;
|
|
97610
|
+
t[k] = [];
|
|
97611
|
+
}
|
|
97612
|
+
t[k].push(t = {});
|
|
97613
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
97614
|
+
}
|
|
97615
|
+
if (state.d) {
|
|
97616
|
+
return null;
|
|
97617
|
+
}
|
|
97618
|
+
state.d = true;
|
|
97619
|
+
if (type === 1) {
|
|
97620
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
97621
|
+
} else if (type === 0 && hasOwn) {
|
|
97622
|
+
return null;
|
|
97623
|
+
}
|
|
97624
|
+
return [k, t, state.c];
|
|
97625
|
+
}
|
|
97626
|
+
function parse6(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
|
|
97627
|
+
let res = {};
|
|
97628
|
+
let meta = {};
|
|
97629
|
+
let tbl = res;
|
|
97630
|
+
let m = meta;
|
|
97631
|
+
for (let ptr = skipVoid(toml, 0);ptr < toml.length; ) {
|
|
97632
|
+
if (toml[ptr] === "[") {
|
|
97633
|
+
let isTableArray = toml[++ptr] === "[";
|
|
97634
|
+
let k = parseKey(toml, ptr += +isTableArray, "]");
|
|
97635
|
+
if (isTableArray) {
|
|
97636
|
+
if (toml[k[1] - 1] !== "]") {
|
|
97637
|
+
throw new TomlError("expected end of table declaration", {
|
|
97638
|
+
toml,
|
|
97639
|
+
ptr: k[1] - 1
|
|
97640
|
+
});
|
|
97641
|
+
}
|
|
97642
|
+
k[1]++;
|
|
97643
|
+
}
|
|
97644
|
+
let p = peekTable(k[0], res, meta, isTableArray ? 2 : 1);
|
|
97645
|
+
if (!p) {
|
|
97646
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
97647
|
+
toml,
|
|
97648
|
+
ptr
|
|
97649
|
+
});
|
|
97650
|
+
}
|
|
97651
|
+
m = p[2];
|
|
97652
|
+
tbl = p[1];
|
|
97653
|
+
ptr = k[1];
|
|
97654
|
+
} else {
|
|
97655
|
+
let k = parseKey(toml, ptr);
|
|
97656
|
+
let p = peekTable(k[0], tbl, m, 0);
|
|
97657
|
+
if (!p) {
|
|
97658
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
97659
|
+
toml,
|
|
97660
|
+
ptr
|
|
97661
|
+
});
|
|
97662
|
+
}
|
|
97663
|
+
let v = extractValue(toml, k[1], undefined, maxDepth, integersAsBigInt);
|
|
97664
|
+
p[1][p[0]] = v[0];
|
|
97665
|
+
ptr = v[1];
|
|
97666
|
+
}
|
|
97667
|
+
ptr = skipVoid(toml, ptr, true);
|
|
97668
|
+
if (toml[ptr] && toml[ptr] !== `
|
|
97669
|
+
` && toml[ptr] !== "\r") {
|
|
97670
|
+
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
97671
|
+
toml,
|
|
97672
|
+
ptr
|
|
97673
|
+
});
|
|
97674
|
+
}
|
|
97675
|
+
ptr = skipVoid(toml, ptr);
|
|
97676
|
+
}
|
|
97677
|
+
return res;
|
|
97678
|
+
}
|
|
97679
|
+
|
|
97680
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
97681
|
+
/*!
|
|
97682
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97683
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
97684
|
+
*
|
|
97685
|
+
* Redistribution and use in source and binary forms, with or without
|
|
97686
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97687
|
+
*
|
|
97688
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
97689
|
+
* list of conditions and the following disclaimer.
|
|
97690
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
97691
|
+
* this list of conditions and the following disclaimer in the
|
|
97692
|
+
* documentation and/or other materials provided with the distribution.
|
|
97693
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97694
|
+
* may be used to endorse or promote products derived from this software without
|
|
97695
|
+
* specific prior written permission.
|
|
97696
|
+
*
|
|
97697
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97698
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
97699
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
97700
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
97701
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
97702
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
97703
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97704
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97705
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97706
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97707
|
+
*/
|
|
97708
|
+
var BARE_KEY = /^[a-z0-9-_]+$/i;
|
|
97709
|
+
function extendedTypeOf(obj) {
|
|
97710
|
+
let type = typeof obj;
|
|
97711
|
+
if (type === "object") {
|
|
97712
|
+
if (Array.isArray(obj))
|
|
97713
|
+
return "array";
|
|
97714
|
+
if (obj instanceof Date)
|
|
97715
|
+
return "date";
|
|
97716
|
+
}
|
|
97717
|
+
return type;
|
|
97718
|
+
}
|
|
97719
|
+
function isArrayOfTables(obj) {
|
|
97720
|
+
for (let i = 0;i < obj.length; i++) {
|
|
97721
|
+
if (extendedTypeOf(obj[i]) !== "object")
|
|
97722
|
+
return false;
|
|
97723
|
+
}
|
|
97724
|
+
return obj.length != 0;
|
|
97725
|
+
}
|
|
97726
|
+
function formatString(s) {
|
|
97727
|
+
return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
|
|
97728
|
+
}
|
|
97729
|
+
function stringifyValue(val, type, depth, numberAsFloat) {
|
|
97730
|
+
if (depth === 0) {
|
|
97731
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
97732
|
+
}
|
|
97733
|
+
if (type === "number") {
|
|
97734
|
+
if (isNaN(val))
|
|
97735
|
+
return "nan";
|
|
97736
|
+
if (val === Infinity)
|
|
97737
|
+
return "inf";
|
|
97738
|
+
if (val === -Infinity)
|
|
97739
|
+
return "-inf";
|
|
97740
|
+
if (numberAsFloat && Number.isInteger(val))
|
|
97741
|
+
return val.toFixed(1);
|
|
97742
|
+
return val.toString();
|
|
97743
|
+
}
|
|
97744
|
+
if (type === "bigint" || type === "boolean") {
|
|
97745
|
+
return val.toString();
|
|
97746
|
+
}
|
|
97747
|
+
if (type === "string") {
|
|
97748
|
+
return formatString(val);
|
|
97749
|
+
}
|
|
97750
|
+
if (type === "date") {
|
|
97751
|
+
if (isNaN(val.getTime())) {
|
|
97752
|
+
throw new TypeError("cannot serialize invalid date");
|
|
97753
|
+
}
|
|
97754
|
+
return val.toISOString();
|
|
97755
|
+
}
|
|
97756
|
+
if (type === "object") {
|
|
97757
|
+
return stringifyInlineTable(val, depth, numberAsFloat);
|
|
97758
|
+
}
|
|
97759
|
+
if (type === "array") {
|
|
97760
|
+
return stringifyArray(val, depth, numberAsFloat);
|
|
97761
|
+
}
|
|
97762
|
+
}
|
|
97763
|
+
function stringifyInlineTable(obj, depth, numberAsFloat) {
|
|
97764
|
+
let keys = Object.keys(obj);
|
|
97765
|
+
if (keys.length === 0)
|
|
97766
|
+
return "{}";
|
|
97767
|
+
let res = "{ ";
|
|
97768
|
+
for (let i = 0;i < keys.length; i++) {
|
|
97769
|
+
let k = keys[i];
|
|
97770
|
+
if (i)
|
|
97771
|
+
res += ", ";
|
|
97772
|
+
res += BARE_KEY.test(k) ? k : formatString(k);
|
|
97773
|
+
res += " = ";
|
|
97774
|
+
res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
|
|
97775
|
+
}
|
|
97776
|
+
return res + " }";
|
|
97777
|
+
}
|
|
97778
|
+
function stringifyArray(array, depth, numberAsFloat) {
|
|
97779
|
+
if (array.length === 0)
|
|
97780
|
+
return "[]";
|
|
97781
|
+
let res = "[ ";
|
|
97782
|
+
for (let i = 0;i < array.length; i++) {
|
|
97783
|
+
if (i)
|
|
97784
|
+
res += ", ";
|
|
97785
|
+
if (array[i] === null || array[i] === undefined) {
|
|
97786
|
+
throw new TypeError("arrays cannot contain null or undefined values");
|
|
97787
|
+
}
|
|
97788
|
+
res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
|
|
97789
|
+
}
|
|
97790
|
+
return res + " ]";
|
|
97791
|
+
}
|
|
97792
|
+
function stringifyArrayTable(array, key, depth, numberAsFloat) {
|
|
97793
|
+
if (depth === 0) {
|
|
97794
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
97795
|
+
}
|
|
97796
|
+
let res = "";
|
|
97797
|
+
for (let i = 0;i < array.length; i++) {
|
|
97798
|
+
res += `${res && `
|
|
97799
|
+
`}[[${key}]]
|
|
97800
|
+
`;
|
|
97801
|
+
res += stringifyTable(0, array[i], key, depth, numberAsFloat);
|
|
97802
|
+
}
|
|
97803
|
+
return res;
|
|
97804
|
+
}
|
|
97805
|
+
function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
|
|
97806
|
+
if (depth === 0) {
|
|
97807
|
+
throw new Error("Could not stringify the object: maximum object depth exceeded");
|
|
97808
|
+
}
|
|
97809
|
+
let preamble = "";
|
|
97810
|
+
let tables = "";
|
|
97811
|
+
let keys = Object.keys(obj);
|
|
97812
|
+
for (let i = 0;i < keys.length; i++) {
|
|
97813
|
+
let k = keys[i];
|
|
97814
|
+
if (obj[k] !== null && obj[k] !== undefined) {
|
|
97815
|
+
let type = extendedTypeOf(obj[k]);
|
|
97816
|
+
if (type === "symbol" || type === "function") {
|
|
97817
|
+
throw new TypeError(`cannot serialize values of type '${type}'`);
|
|
97818
|
+
}
|
|
97819
|
+
let key = BARE_KEY.test(k) ? k : formatString(k);
|
|
97820
|
+
if (type === "array" && isArrayOfTables(obj[k])) {
|
|
97821
|
+
tables += (tables && `
|
|
97822
|
+
`) + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
|
|
97823
|
+
} else if (type === "object") {
|
|
97824
|
+
let tblKey = prefix ? `${prefix}.${key}` : key;
|
|
97825
|
+
tables += (tables && `
|
|
97826
|
+
`) + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
|
|
97827
|
+
} else {
|
|
97828
|
+
preamble += key;
|
|
97829
|
+
preamble += " = ";
|
|
97830
|
+
preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
|
|
97831
|
+
preamble += `
|
|
97832
|
+
`;
|
|
97833
|
+
}
|
|
97834
|
+
}
|
|
97835
|
+
}
|
|
97836
|
+
if (tableKey && (preamble || !tables))
|
|
97837
|
+
preamble = preamble ? `[${tableKey}]
|
|
97838
|
+
${preamble}` : `[${tableKey}]`;
|
|
97839
|
+
return preamble && tables ? `${preamble}
|
|
97840
|
+
${tables}` : preamble || tables;
|
|
97841
|
+
}
|
|
97842
|
+
function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
|
|
97843
|
+
if (extendedTypeOf(obj) !== "object") {
|
|
97844
|
+
throw new TypeError("stringify can only be called with an object");
|
|
97845
|
+
}
|
|
97846
|
+
let str2 = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
|
|
97847
|
+
if (str2[str2.length - 1] !== `
|
|
97848
|
+
`)
|
|
97849
|
+
return str2 + `
|
|
97850
|
+
`;
|
|
97851
|
+
return str2;
|
|
97852
|
+
}
|
|
97853
|
+
|
|
97854
|
+
// node_modules/smol-toml/dist/index.js
|
|
97855
|
+
/*!
|
|
97856
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
97857
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
97858
|
+
*
|
|
97859
|
+
* Redistribution and use in source and binary forms, with or without
|
|
97860
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97861
|
+
*
|
|
97862
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
97863
|
+
* list of conditions and the following disclaimer.
|
|
97864
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
97865
|
+
* this list of conditions and the following disclaimer in the
|
|
97866
|
+
* documentation and/or other materials provided with the distribution.
|
|
97867
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
97868
|
+
* may be used to endorse or promote products derived from this software without
|
|
97869
|
+
* specific prior written permission.
|
|
97870
|
+
*
|
|
97871
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
97872
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
97873
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
97874
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
97875
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
97876
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
97877
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
97878
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
97879
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
97880
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
97881
|
+
*/
|
|
97882
|
+
|
|
97883
|
+
// src/sync/mcp/mcp.ts
|
|
97884
|
+
var SERVER_NAME_SEPARATOR = "--";
|
|
97885
|
+
var KEY_SEPARATOR = ".";
|
|
97886
|
+
function buildServerName(artifactId, mcpName) {
|
|
97887
|
+
return `grekt${SERVER_NAME_SEPARATOR}${artifactId}${SERVER_NAME_SEPARATOR}${mcpName}`;
|
|
97888
|
+
}
|
|
97889
|
+
function isOwnedByArtifact(serverName, artifactId) {
|
|
97890
|
+
return serverName.startsWith(`grekt${SERVER_NAME_SEPARATOR}${artifactId}${SERVER_NAME_SEPARATOR}`);
|
|
97891
|
+
}
|
|
97892
|
+
function getNestedValue(obj, key) {
|
|
97893
|
+
if (!key.includes(KEY_SEPARATOR))
|
|
97894
|
+
return obj[key];
|
|
97895
|
+
const parts = key.split(KEY_SEPARATOR);
|
|
97896
|
+
let current = obj;
|
|
97897
|
+
for (const part of parts) {
|
|
97898
|
+
if (current === null || current === undefined || typeof current !== "object")
|
|
97899
|
+
return;
|
|
97900
|
+
current = current[part];
|
|
97901
|
+
}
|
|
97902
|
+
return current;
|
|
97903
|
+
}
|
|
97904
|
+
function setNestedValue(obj, key, value) {
|
|
97905
|
+
if (!key.includes(KEY_SEPARATOR)) {
|
|
97906
|
+
obj[key] = value;
|
|
97907
|
+
return;
|
|
97908
|
+
}
|
|
97909
|
+
const parts = key.split(KEY_SEPARATOR);
|
|
97910
|
+
const lastPart = parts.pop();
|
|
97911
|
+
if (!lastPart)
|
|
97912
|
+
return;
|
|
97913
|
+
let current = obj;
|
|
97914
|
+
for (const part of parts) {
|
|
97915
|
+
if (!current[part] || typeof current[part] !== "object") {
|
|
97916
|
+
current[part] = {};
|
|
97917
|
+
}
|
|
97918
|
+
current = current[part];
|
|
97919
|
+
}
|
|
97920
|
+
current[lastPart] = value;
|
|
97921
|
+
}
|
|
97922
|
+
function deleteNestedValue(obj, key) {
|
|
97923
|
+
if (!key.includes(KEY_SEPARATOR)) {
|
|
97924
|
+
delete obj[key];
|
|
97925
|
+
return;
|
|
97926
|
+
}
|
|
97927
|
+
const parts = key.split(KEY_SEPARATOR);
|
|
97928
|
+
const lastPart = parts.pop();
|
|
97929
|
+
if (!lastPart)
|
|
97930
|
+
return;
|
|
97931
|
+
const parents = [];
|
|
97932
|
+
let current = obj;
|
|
97933
|
+
for (const part of parts) {
|
|
97934
|
+
if (!current[part] || typeof current[part] !== "object")
|
|
97935
|
+
return;
|
|
97936
|
+
parents.push({ obj: current, key: part });
|
|
97937
|
+
current = current[part];
|
|
97938
|
+
}
|
|
97939
|
+
delete current[lastPart];
|
|
97940
|
+
for (let i = parents.length - 1;i >= 0; i--) {
|
|
97941
|
+
const parent = parents[i];
|
|
97942
|
+
if (!parent)
|
|
97943
|
+
continue;
|
|
97944
|
+
const child = parent.obj[parent.key];
|
|
97945
|
+
if (typeof child === "object" && child !== null && Object.keys(child).length === 0) {
|
|
97946
|
+
delete parent.obj[parent.key];
|
|
97947
|
+
}
|
|
97948
|
+
}
|
|
97949
|
+
}
|
|
97950
|
+
function resolveFormat(filePath, explicit) {
|
|
97951
|
+
if (explicit)
|
|
97952
|
+
return explicit;
|
|
97953
|
+
return filePath.endsWith(".toml") ? "toml" : "json";
|
|
97954
|
+
}
|
|
97955
|
+
function readConfigFile(options2) {
|
|
97956
|
+
const fullPath = join25(options2.projectRoot, options2.filePath);
|
|
97957
|
+
if (!fs.exists(fullPath)) {
|
|
97958
|
+
return {};
|
|
97959
|
+
}
|
|
97960
|
+
try {
|
|
97961
|
+
const raw2 = fs.readFile(fullPath);
|
|
97962
|
+
const format = resolveFormat(options2.filePath, options2.format);
|
|
97963
|
+
if (format === "toml") {
|
|
97964
|
+
return parse6(raw2);
|
|
97965
|
+
}
|
|
97966
|
+
return JSON.parse(raw2);
|
|
97967
|
+
} catch {
|
|
97968
|
+
return {};
|
|
97969
|
+
}
|
|
97970
|
+
}
|
|
97971
|
+
function writeConfigFile(options2) {
|
|
97972
|
+
const fullPath = join25(options2.projectRoot, options2.filePath);
|
|
97973
|
+
const dir = dirname8(fullPath);
|
|
97974
|
+
if (!fs.exists(dir)) {
|
|
97975
|
+
fs.mkdir(dir, { recursive: true });
|
|
97976
|
+
}
|
|
97977
|
+
const format = resolveFormat(options2.filePath, options2.format);
|
|
97978
|
+
if (format === "toml") {
|
|
97979
|
+
fs.writeFile(fullPath, stringify(options2.data) + `
|
|
97980
|
+
`);
|
|
97981
|
+
return;
|
|
97982
|
+
}
|
|
97983
|
+
fs.writeFile(fullPath, JSON.stringify(options2.data, null, 2) + `
|
|
97984
|
+
`);
|
|
97985
|
+
}
|
|
97986
|
+
function resolveExecutablePath(projectRoot, artifactId, content) {
|
|
97987
|
+
if (content.command) {
|
|
97988
|
+
const artifactMcpDir = join25(projectRoot, ARTIFACTS_DIR, artifactId, "mcps");
|
|
97989
|
+
const execPath = join25(artifactMcpDir, content.command);
|
|
97990
|
+
return relative6(projectRoot, execPath);
|
|
97991
|
+
}
|
|
97992
|
+
return "";
|
|
97993
|
+
}
|
|
97994
|
+
function extractMcpInfo(mcpFile) {
|
|
97995
|
+
const name2 = mcpFile.parsed.frontmatter["grk-name"];
|
|
97996
|
+
const content = mcpFile.parsed.content;
|
|
97997
|
+
return { name: name2, content };
|
|
97998
|
+
}
|
|
97999
|
+
function getMcpType(content) {
|
|
98000
|
+
return content.url ? "http" : "stdio";
|
|
98001
|
+
}
|
|
98002
|
+
function collectTargetConfigs(activeTargets) {
|
|
98003
|
+
const targetIds = getMcpTargetIds();
|
|
98004
|
+
const configs = new Map;
|
|
98005
|
+
for (const targetId of targetIds) {
|
|
98006
|
+
if (!activeTargets.includes(targetId))
|
|
98007
|
+
continue;
|
|
98008
|
+
const config = getMcpConfig(targetId);
|
|
98009
|
+
if (config) {
|
|
98010
|
+
configs.set(targetId, config);
|
|
98011
|
+
}
|
|
98012
|
+
}
|
|
98013
|
+
return configs;
|
|
98014
|
+
}
|
|
98015
|
+
function installMcps(projectRoot, artifactId, mcpFiles, activeTargets) {
|
|
98016
|
+
const result = { installed: 0, targets: [] };
|
|
98017
|
+
const targetConfigs = collectTargetConfigs(activeTargets);
|
|
98018
|
+
if (targetConfigs.size === 0 || mcpFiles.length === 0) {
|
|
98019
|
+
return result;
|
|
98020
|
+
}
|
|
98021
|
+
for (const [targetId, mcpConfig] of targetConfigs) {
|
|
98022
|
+
const configData = readConfigFile({ projectRoot, filePath: mcpConfig.configFile, format: mcpConfig.format });
|
|
98023
|
+
const servers = getNestedValue(configData, mcpConfig.serverKey) ?? {};
|
|
98024
|
+
for (const serverName of Object.keys(servers)) {
|
|
98025
|
+
if (isOwnedByArtifact(serverName, artifactId)) {
|
|
98026
|
+
delete servers[serverName];
|
|
98027
|
+
}
|
|
98028
|
+
}
|
|
98029
|
+
for (const mcpFile of mcpFiles) {
|
|
98030
|
+
const { name: name2, content } = extractMcpInfo(mcpFile);
|
|
98031
|
+
const serverName = buildServerName(artifactId, name2);
|
|
98032
|
+
const executablePath = resolveExecutablePath(projectRoot, artifactId, content);
|
|
98033
|
+
servers[serverName] = mcpConfig.transform(serverName, content, executablePath);
|
|
98034
|
+
}
|
|
98035
|
+
setNestedValue(configData, mcpConfig.serverKey, servers);
|
|
98036
|
+
writeConfigFile({ projectRoot, filePath: mcpConfig.configFile, data: configData, format: mcpConfig.format });
|
|
98037
|
+
result.targets.push(targetId);
|
|
98038
|
+
result.installed += mcpFiles.length;
|
|
98039
|
+
}
|
|
98040
|
+
return result;
|
|
98041
|
+
}
|
|
98042
|
+
function uninstallMcps(projectRoot, artifactId, activeTargets) {
|
|
98043
|
+
let removedCount = 0;
|
|
98044
|
+
const targetConfigs = collectTargetConfigs(activeTargets);
|
|
98045
|
+
for (const [_targetId, mcpConfig] of targetConfigs) {
|
|
98046
|
+
const configData = readConfigFile({ projectRoot, filePath: mcpConfig.configFile, format: mcpConfig.format });
|
|
98047
|
+
const servers = getNestedValue(configData, mcpConfig.serverKey);
|
|
98048
|
+
if (!servers)
|
|
98049
|
+
continue;
|
|
98050
|
+
let changed = false;
|
|
98051
|
+
for (const serverName of Object.keys(servers)) {
|
|
98052
|
+
if (isOwnedByArtifact(serverName, artifactId)) {
|
|
98053
|
+
delete servers[serverName];
|
|
98054
|
+
changed = true;
|
|
98055
|
+
removedCount++;
|
|
98056
|
+
}
|
|
98057
|
+
}
|
|
98058
|
+
if (changed) {
|
|
98059
|
+
if (Object.keys(servers).length > 0) {
|
|
98060
|
+
setNestedValue(configData, mcpConfig.serverKey, servers);
|
|
98061
|
+
} else {
|
|
98062
|
+
deleteNestedValue(configData, mcpConfig.serverKey);
|
|
98063
|
+
}
|
|
98064
|
+
writeConfigFile({ projectRoot, filePath: mcpConfig.configFile, data: configData, format: mcpConfig.format });
|
|
98065
|
+
}
|
|
98066
|
+
}
|
|
98067
|
+
return removedCount;
|
|
98068
|
+
}
|
|
98069
|
+
function getMcpSummary(mcpFiles) {
|
|
98070
|
+
return mcpFiles.map((mcpFile) => {
|
|
98071
|
+
const { name: name2, content } = extractMcpInfo(mcpFile);
|
|
98072
|
+
return { name: name2, type: getMcpType(content) };
|
|
98073
|
+
});
|
|
98074
|
+
}
|
|
98075
|
+
// src/sync/mcp/mcp.prompt.ts
|
|
98076
|
+
async function promptAndInstallMcps(projectRoot, artifactId, mcpFiles, activeTargets) {
|
|
98077
|
+
newline();
|
|
98078
|
+
const summary = getMcpSummary(mcpFiles);
|
|
98079
|
+
log(`${colors5.bold("MCP servers")} to install:`);
|
|
98080
|
+
for (const entry of summary) {
|
|
98081
|
+
const typeLabel = colors5.dim(`(${entry.type})`);
|
|
98082
|
+
log(` ${colors5.dim("-")} ${entry.name} ${typeLabel}`);
|
|
98083
|
+
}
|
|
98084
|
+
newline();
|
|
98085
|
+
const shouldInstall = await esm_default3({
|
|
98086
|
+
message: "Install these MCP servers?",
|
|
98087
|
+
default: true
|
|
98088
|
+
});
|
|
98089
|
+
if (!shouldInstall) {
|
|
98090
|
+
info("MCP servers skipped");
|
|
98091
|
+
return false;
|
|
98092
|
+
}
|
|
98093
|
+
const result = installMcps(projectRoot, artifactId, mcpFiles, activeTargets);
|
|
98094
|
+
if (result.installed > 0) {
|
|
98095
|
+
success(`Installed ${summary.length} MCP server(s) for ${result.targets.join(", ")}`);
|
|
98096
|
+
} else {
|
|
98097
|
+
info("No active targets support MCP distribution");
|
|
98098
|
+
}
|
|
98099
|
+
return result.installed > 0;
|
|
98100
|
+
}
|
|
96372
98101
|
// src/commands/add.ts
|
|
96373
98102
|
var addCommand = new Command("add").description("Add an artifact from registry, GitHub, GitLab, or local path").argument("[source]", "Artifact source (e.g., @grekt/code-reviewer, github:user/repo, gitlab:host/user/repo, ./local/path)").option("-c, --choose", "Choose which components to install").option("--core", "Mark artifact as CORE (copied to target on sync, not just indexed)").option("--core-sym", "Mark artifact as CORE with symlinks (symlinked to target on sync, not copied)").action(async (sourceArg, options2) => {
|
|
96374
98103
|
if (!sourceArg) {
|
|
@@ -96534,12 +98263,16 @@ var addCommand = new Command("add").description("Add an artifact from registry,
|
|
|
96534
98263
|
if (artifactInfo.hooks.length > 0) {
|
|
96535
98264
|
await promptAndInstallHooks(projectRoot, resolvedArtifactId, artifactInfo.hooks);
|
|
96536
98265
|
}
|
|
98266
|
+
if (artifactInfo.mcps.length > 0) {
|
|
98267
|
+
const allTargets = [...config.targets, ...Object.keys(config.customTargets ?? {})];
|
|
98268
|
+
await promptAndInstallMcps(projectRoot, resolvedArtifactId, artifactInfo.mcps, allTargets);
|
|
98269
|
+
}
|
|
96537
98270
|
await syncToTargets(config, lockfile, projectRoot);
|
|
96538
98271
|
});
|
|
96539
98272
|
|
|
96540
98273
|
// src/registry/download/download.ts
|
|
96541
98274
|
import { tmpdir as tmpdir2 } from "os";
|
|
96542
|
-
import { join as
|
|
98275
|
+
import { join as join26 } from "path";
|
|
96543
98276
|
|
|
96544
98277
|
// src/shared/security/url-validation.ts
|
|
96545
98278
|
var BLOCKED_IPV4_PATTERNS = [
|
|
@@ -96641,7 +98374,7 @@ async function downloadAndExtractTarball2(url, targetDir, options2 = {}) {
|
|
|
96641
98374
|
"User-Agent": "grekt-cli",
|
|
96642
98375
|
...headers
|
|
96643
98376
|
};
|
|
96644
|
-
const tempTarball =
|
|
98377
|
+
const tempTarball = join26(tmpdir2(), `grekt-${cryptoProvider.randomUUID()}.tar.gz`);
|
|
96645
98378
|
const controller = new AbortController;
|
|
96646
98379
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
96647
98380
|
try {
|
|
@@ -97174,7 +98907,7 @@ var checkCommand = new Command("check").description("Check artifact integrity, s
|
|
|
97174
98907
|
});
|
|
97175
98908
|
|
|
97176
98909
|
// src/commands/remove.ts
|
|
97177
|
-
import { dirname as
|
|
98910
|
+
import { dirname as dirname9 } from "path";
|
|
97178
98911
|
var SYNCABLE_CATEGORIES3 = getCategoriesForFormat("md");
|
|
97179
98912
|
var removeCommand = new Command("remove").alias("rm").description("Remove an installed artifact").argument("[artifact]", "Artifact ID to remove (e.g., @grekt/code-reviewer)").option("-f, --force", "Skip confirmation prompt").action(async (artifactId, options2) => {
|
|
97180
98913
|
await withPromptHandler(async () => {
|
|
@@ -97226,6 +98959,7 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97226
98959
|
}
|
|
97227
98960
|
}
|
|
97228
98961
|
const removed = [];
|
|
98962
|
+
const allTargets = [...config.targets, ...Object.keys(config.customTargets ?? {})];
|
|
97229
98963
|
const hookFiles = artifactInfo?.hooks ?? [];
|
|
97230
98964
|
if (hookFiles.length > 0) {
|
|
97231
98965
|
const hooksRemoved = uninstallHooks(projectRoot, artifactId, hookFiles);
|
|
@@ -97233,16 +98967,19 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97233
98967
|
removed.push(`${hooksRemoved} hook target(s) cleaned`);
|
|
97234
98968
|
}
|
|
97235
98969
|
}
|
|
98970
|
+
const mcpsRemoved = uninstallMcps(projectRoot, artifactId, allTargets);
|
|
98971
|
+
if (mcpsRemoved > 0) {
|
|
98972
|
+
removed.push(`${mcpsRemoved} MCP server(s) cleaned`);
|
|
98973
|
+
}
|
|
97236
98974
|
if (fs.exists(artifactDir)) {
|
|
97237
98975
|
fs.rmdir(artifactDir, { recursive: true });
|
|
97238
98976
|
removed.push(`${ARTIFACTS_DIR}/${artifactId}`);
|
|
97239
|
-
const scopeDir =
|
|
98977
|
+
const scopeDir = dirname9(artifactDir);
|
|
97240
98978
|
const artifactsFullPath = `${projectRoot}/${ARTIFACTS_DIR}`;
|
|
97241
98979
|
if (scopeDir !== artifactsFullPath) {
|
|
97242
98980
|
cleanEmptyDir(scopeDir);
|
|
97243
98981
|
}
|
|
97244
98982
|
}
|
|
97245
|
-
const allTargets = [...config.targets, ...Object.keys(config.customTargets ?? {})];
|
|
97246
98983
|
for (const target of allTargets) {
|
|
97247
98984
|
const plugin = getPlugin(target, config.customTargets);
|
|
97248
98985
|
const syncPaths = plugin.getSyncPaths();
|
|
@@ -97259,7 +98996,7 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97259
98996
|
if (fs.exists(targetPath)) {
|
|
97260
98997
|
fs.unlink(targetPath);
|
|
97261
98998
|
removed.push(`${categoryDir}/${targetName}`);
|
|
97262
|
-
const targetDir =
|
|
98999
|
+
const targetDir = dirname9(targetPath);
|
|
97263
99000
|
const categoryFullPath = `${projectRoot}/${categoryDir}`;
|
|
97264
99001
|
if (targetDir !== categoryFullPath) {
|
|
97265
99002
|
cleanEmptyDir(targetDir);
|
|
@@ -97288,17 +99025,17 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97288
99025
|
|
|
97289
99026
|
// src/artifact/tarball/tarball.ts
|
|
97290
99027
|
import { tmpdir as tmpdir3 } from "os";
|
|
97291
|
-
import { basename as
|
|
99028
|
+
import { basename as basename10, dirname as dirname10, join as join27, sep as sep3 } from "path";
|
|
97292
99029
|
var TARBALL_DIR = ".grekt/tmp";
|
|
97293
99030
|
function ensureTarballDir(projectRoot) {
|
|
97294
|
-
const tarballDir =
|
|
99031
|
+
const tarballDir = join27(projectRoot, TARBALL_DIR);
|
|
97295
99032
|
if (!fs.exists(tarballDir)) {
|
|
97296
99033
|
fs.mkdir(tarballDir, { recursive: true });
|
|
97297
99034
|
}
|
|
97298
99035
|
return tarballDir;
|
|
97299
99036
|
}
|
|
97300
99037
|
function injectComponentsIntoManifest(artifactPath, components) {
|
|
97301
|
-
const manifestPath =
|
|
99038
|
+
const manifestPath = join27(artifactPath, "grekt.yaml");
|
|
97302
99039
|
const content = fs.readFile(manifestPath);
|
|
97303
99040
|
const manifest = $parse2(content);
|
|
97304
99041
|
manifest.components = components;
|
|
@@ -97308,14 +99045,14 @@ function createTarball(options2) {
|
|
|
97308
99045
|
const { artifactPath, artifactId, projectRoot, components } = options2;
|
|
97309
99046
|
const tarballDir = ensureTarballDir(projectRoot);
|
|
97310
99047
|
const tarballName = `${artifactId.replace("/", "-")}.tar.gz`;
|
|
97311
|
-
const outputPath =
|
|
99048
|
+
const outputPath = join27(tarballDir, tarballName);
|
|
97312
99049
|
let sourcePath = artifactPath;
|
|
97313
99050
|
let tempDir = null;
|
|
97314
99051
|
try {
|
|
97315
99052
|
if (components) {
|
|
97316
|
-
const artifactDirName =
|
|
97317
|
-
tempDir =
|
|
97318
|
-
const tempArtifactPath =
|
|
99053
|
+
const artifactDirName = basename10(artifactPath);
|
|
99054
|
+
tempDir = join27(tmpdir3(), `grekt-tmp-${Date.now()}`);
|
|
99055
|
+
const tempArtifactPath = join27(tempDir, artifactDirName);
|
|
97319
99056
|
fs.mkdir(tempDir, { recursive: true });
|
|
97320
99057
|
fs.copy(artifactPath, tempArtifactPath, {
|
|
97321
99058
|
recursive: true,
|
|
@@ -97324,8 +99061,8 @@ function createTarball(options2) {
|
|
|
97324
99061
|
injectComponentsIntoManifest(tempArtifactPath, components);
|
|
97325
99062
|
sourcePath = tempArtifactPath;
|
|
97326
99063
|
}
|
|
97327
|
-
const artifactDir =
|
|
97328
|
-
const parentDir =
|
|
99064
|
+
const artifactDir = basename10(sourcePath);
|
|
99065
|
+
const parentDir = dirname10(sourcePath);
|
|
97329
99066
|
tarOps.create({
|
|
97330
99067
|
outputPath,
|
|
97331
99068
|
sourceDir: parentDir,
|
|
@@ -97458,8 +99195,8 @@ function resolveRegistry3(scope, localConfig) {
|
|
|
97458
99195
|
}
|
|
97459
99196
|
|
|
97460
99197
|
// node_modules/@supabase/supabase-js/dist/index.mjs
|
|
97461
|
-
var
|
|
97462
|
-
__export(
|
|
99198
|
+
var exports_dist4 = {};
|
|
99199
|
+
__export(exports_dist4, {
|
|
97463
99200
|
createClient: () => createClient,
|
|
97464
99201
|
SupabaseClient: () => SupabaseClient,
|
|
97465
99202
|
PostgrestError: () => PostgrestError,
|
|
@@ -97472,8 +99209,8 @@ __export(exports_dist3, {
|
|
|
97472
99209
|
var import_functions_js = __toESM(require_main(), 1);
|
|
97473
99210
|
|
|
97474
99211
|
// node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
97475
|
-
var
|
|
97476
|
-
__export(
|
|
99212
|
+
var exports_dist2 = {};
|
|
99213
|
+
__export(exports_dist2, {
|
|
97477
99214
|
default: () => src_default,
|
|
97478
99215
|
PostgrestTransformBuilder: () => PostgrestTransformBuilder,
|
|
97479
99216
|
PostgrestQueryBuilder: () => PostgrestQueryBuilder,
|
|
@@ -98082,8 +99819,8 @@ var src_default = {
|
|
|
98082
99819
|
var import_realtime_js = __toESM(require_main2(), 1);
|
|
98083
99820
|
|
|
98084
99821
|
// node_modules/@supabase/storage-js/dist/index.mjs
|
|
98085
|
-
var
|
|
98086
|
-
__export(
|
|
99822
|
+
var exports_dist3 = {};
|
|
99823
|
+
__export(exports_dist3, {
|
|
98087
99824
|
isStorageVectorsError: () => isStorageVectorsError,
|
|
98088
99825
|
isStorageError: () => isStorageError,
|
|
98089
99826
|
VectorIndexScope: () => VectorIndexScope,
|
|
@@ -99380,8 +101117,8 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
99380
101117
|
|
|
99381
101118
|
// node_modules/@supabase/supabase-js/dist/index.mjs
|
|
99382
101119
|
var import_auth_js = __toESM(require_main3(), 1);
|
|
99383
|
-
__reExport(
|
|
99384
|
-
__reExport(
|
|
101120
|
+
__reExport(exports_dist4, __toESM(require_main2(), 1));
|
|
101121
|
+
__reExport(exports_dist4, __toESM(require_main3(), 1));
|
|
99385
101122
|
var version2 = "2.93.3";
|
|
99386
101123
|
var JS_ENV = "";
|
|
99387
101124
|
if (typeof Deno !== "undefined")
|
|
@@ -100245,14 +101982,14 @@ async function publishArtifact(publisher, ctx) {
|
|
|
100245
101982
|
|
|
100246
101983
|
// src/workspace/workspace.ts
|
|
100247
101984
|
var import_fast_glob = __toESM(require_out4(), 1);
|
|
100248
|
-
import { join as
|
|
101985
|
+
import { join as join28 } from "path";
|
|
100249
101986
|
var WORKSPACE_CONFIG_FILE2 = "grekt-workspace.yaml";
|
|
100250
101987
|
var ARTIFACT_MANIFEST_FILE2 = "grekt.yaml";
|
|
100251
101988
|
async function loadWorkspace(cwd) {
|
|
100252
101989
|
if (!isWorkspaceRoot(fs, cwd)) {
|
|
100253
101990
|
return null;
|
|
100254
101991
|
}
|
|
100255
|
-
const configPath =
|
|
101992
|
+
const configPath = join28(cwd, WORKSPACE_CONFIG_FILE2);
|
|
100256
101993
|
const configContent = fs.readFile(configPath);
|
|
100257
101994
|
const result = parseWorkspaceConfig(configContent, configPath);
|
|
100258
101995
|
if (!result.success) {
|
|
@@ -100269,7 +102006,7 @@ async function loadWorkspace(cwd) {
|
|
|
100269
102006
|
absolute: true
|
|
100270
102007
|
});
|
|
100271
102008
|
for (const fullPath of matches) {
|
|
100272
|
-
const manifestPath =
|
|
102009
|
+
const manifestPath = join28(fullPath, ARTIFACT_MANIFEST_FILE2);
|
|
100273
102010
|
if (fs.exists(manifestPath)) {
|
|
100274
102011
|
artifactPaths.push(fullPath);
|
|
100275
102012
|
}
|
|
@@ -100283,7 +102020,7 @@ async function loadWorkspace(cwd) {
|
|
|
100283
102020
|
}
|
|
100284
102021
|
function generatePackageJsonFiles(artifacts) {
|
|
100285
102022
|
for (const artifact of artifacts) {
|
|
100286
|
-
const packageJsonPath =
|
|
102023
|
+
const packageJsonPath = join28(artifact.path, "package.json");
|
|
100287
102024
|
const packageJson = {
|
|
100288
102025
|
name: artifact.manifest.name,
|
|
100289
102026
|
version: artifact.manifest.version,
|
|
@@ -100296,8 +102033,8 @@ function generatePackageJsonFiles(artifacts) {
|
|
|
100296
102033
|
function syncVersionsToManifest(artifacts) {
|
|
100297
102034
|
let updated = 0;
|
|
100298
102035
|
for (const artifact of artifacts) {
|
|
100299
|
-
const packageJsonPath =
|
|
100300
|
-
const manifestPath =
|
|
102036
|
+
const packageJsonPath = join28(artifact.path, "package.json");
|
|
102037
|
+
const manifestPath = join28(artifact.path, ARTIFACT_MANIFEST_FILE2);
|
|
100301
102038
|
if (!fs.exists(packageJsonPath))
|
|
100302
102039
|
continue;
|
|
100303
102040
|
const packageJson = JSON.parse(fs.readFile(packageJsonPath));
|
|
@@ -100314,7 +102051,7 @@ function syncVersionsToManifest(artifacts) {
|
|
|
100314
102051
|
}
|
|
100315
102052
|
function cleanPackageJsonFiles(artifacts) {
|
|
100316
102053
|
for (const artifact of artifacts) {
|
|
100317
|
-
const packageJsonPath =
|
|
102054
|
+
const packageJsonPath = join28(artifact.path, "package.json");
|
|
100318
102055
|
if (fs.exists(packageJsonPath)) {
|
|
100319
102056
|
fs.unlink(packageJsonPath);
|
|
100320
102057
|
}
|
|
@@ -101114,7 +102851,7 @@ function displayUpgradeSummary(results) {
|
|
|
101114
102851
|
}
|
|
101115
102852
|
|
|
101116
102853
|
// src/commands/version.ts
|
|
101117
|
-
import { join as
|
|
102854
|
+
import { join as join29, resolve as resolve6 } from "path";
|
|
101118
102855
|
import { spawnSync } from "child_process";
|
|
101119
102856
|
var MANIFEST_FILE = "grekt.yaml";
|
|
101120
102857
|
var BUMP_TYPES = ["patch", "minor", "major", "prerelease"];
|
|
@@ -101167,7 +102904,7 @@ var versionCommand = new Command("version").description("Bump artifact versions
|
|
|
101167
102904
|
log("");
|
|
101168
102905
|
let updated = 0;
|
|
101169
102906
|
for (const artifactPath of artifactPaths) {
|
|
101170
|
-
const manifestPath =
|
|
102907
|
+
const manifestPath = join29(artifactPath, MANIFEST_FILE);
|
|
101171
102908
|
const manifestContent = fs.readFile(manifestPath);
|
|
101172
102909
|
const result = safeParseYaml(manifestContent, ProjectConfigSchema, manifestPath);
|
|
101173
102910
|
if (!result.success) {
|
|
@@ -101268,7 +103005,7 @@ async function handleExecMode(options2) {
|
|
|
101268
103005
|
}
|
|
101269
103006
|
function findArtifacts(basePath) {
|
|
101270
103007
|
const artifacts = [];
|
|
101271
|
-
if (fs.exists(
|
|
103008
|
+
if (fs.exists(join29(basePath, MANIFEST_FILE))) {
|
|
101272
103009
|
artifacts.push(basePath);
|
|
101273
103010
|
return artifacts;
|
|
101274
103011
|
}
|
|
@@ -101277,9 +103014,9 @@ function findArtifacts(basePath) {
|
|
|
101277
103014
|
for (const entry of entries) {
|
|
101278
103015
|
if (entry.startsWith("."))
|
|
101279
103016
|
continue;
|
|
101280
|
-
const subPath =
|
|
103017
|
+
const subPath = join29(basePath, entry);
|
|
101281
103018
|
const stat = fs.stat(subPath);
|
|
101282
|
-
if (stat.isDirectory && fs.exists(
|
|
103019
|
+
if (stat.isDirectory && fs.exists(join29(subPath, MANIFEST_FILE))) {
|
|
101283
103020
|
artifacts.push(subPath);
|
|
101284
103021
|
}
|
|
101285
103022
|
}
|
|
@@ -101310,7 +103047,7 @@ var listSubcommand = new Command("list").description("List all artifacts in the
|
|
|
101310
103047
|
});
|
|
101311
103048
|
var workspaceCommand = new Command("workspace").description("Manage monorepo workspaces").addCommand(listSubcommand);
|
|
101312
103049
|
// src/commands/worktree/worktree.ts
|
|
101313
|
-
import { join as
|
|
103050
|
+
import { join as join30, dirname as dirname11, isAbsolute as isAbsolute4 } from "path";
|
|
101314
103051
|
var GREKT_DIR2 = ".grekt";
|
|
101315
103052
|
function getGitCommonDir() {
|
|
101316
103053
|
try {
|
|
@@ -101327,8 +103064,8 @@ function getWorktreeRoot() {
|
|
|
101327
103064
|
}
|
|
101328
103065
|
}
|
|
101329
103066
|
function resolveOriginalRepoRoot(commonDir, worktreeRoot) {
|
|
101330
|
-
const absoluteCommonDir = isAbsolute4(commonDir) ? commonDir :
|
|
101331
|
-
return
|
|
103067
|
+
const absoluteCommonDir = isAbsolute4(commonDir) ? commonDir : join30(worktreeRoot, commonDir);
|
|
103068
|
+
return dirname11(absoluteCommonDir);
|
|
101332
103069
|
}
|
|
101333
103070
|
function isInsideWorktree(commonDir) {
|
|
101334
103071
|
return commonDir !== ".git";
|
|
@@ -101350,8 +103087,8 @@ var syncSubcommand = new Command("sync").description("Copy .grekt/ from the orig
|
|
|
101350
103087
|
process.exit(1);
|
|
101351
103088
|
}
|
|
101352
103089
|
const originalRepoRoot = resolveOriginalRepoRoot(commonDir, worktreeRoot);
|
|
101353
|
-
const sourcePath =
|
|
101354
|
-
const destPath =
|
|
103090
|
+
const sourcePath = join30(originalRepoRoot, GREKT_DIR2);
|
|
103091
|
+
const destPath = join30(worktreeRoot, GREKT_DIR2);
|
|
101355
103092
|
if (!fs.exists(sourcePath)) {
|
|
101356
103093
|
info("No .grekt/ directory found in the original repository");
|
|
101357
103094
|
process.exit(0);
|
|
@@ -101374,7 +103111,7 @@ var syncSubcommand = new Command("sync").description("Copy .grekt/ from the orig
|
|
|
101374
103111
|
});
|
|
101375
103112
|
var worktreeCommand = new Command("worktree").description("Manage git worktree integration").addCommand(syncSubcommand);
|
|
101376
103113
|
// src/commands/scan.ts
|
|
101377
|
-
import { join as
|
|
103114
|
+
import { join as join31, resolve as resolve7 } from "path";
|
|
101378
103115
|
var VALID_BADGES = ["certified", "conditional", "suspicious", "rejected"];
|
|
101379
103116
|
var BADGE_COLORS = {
|
|
101380
103117
|
certified: colors5.success,
|
|
@@ -101470,7 +103207,7 @@ var scanCommand = new Command("scan").description("Scan artifacts for security i
|
|
|
101470
103207
|
});
|
|
101471
103208
|
async function scanRemoteArtifact(source, projectRoot, jsonOutput, failOnThreshold) {
|
|
101472
103209
|
const displayName = getSourceDisplayName(source);
|
|
101473
|
-
const tempDir =
|
|
103210
|
+
const tempDir = join31(projectRoot, ARTIFACTS_DIR, `.tmp-scan-${cryptoProvider.randomUUID()}`);
|
|
101474
103211
|
try {
|
|
101475
103212
|
if (!jsonOutput) {
|
|
101476
103213
|
const spin = spinner(`Downloading ${colors5.highlight(displayName)}...`);
|
|
@@ -101596,14 +103333,14 @@ async function scanAllInstalled(projectRoot, jsonOutput, failOnThreshold) {
|
|
|
101596
103333
|
}
|
|
101597
103334
|
const config = getConfig(projectRoot);
|
|
101598
103335
|
const trustKey = process.env.GREKT_TRUST_KEY;
|
|
101599
|
-
const artifactsDir =
|
|
103336
|
+
const artifactsDir = join31(projectRoot, ARTIFACTS_DIR);
|
|
101600
103337
|
const results = [];
|
|
101601
103338
|
const errors4 = [];
|
|
101602
103339
|
if (!jsonOutput) {
|
|
101603
103340
|
log(`Scanning ${colors5.bold(String(artifactIds.length))} artifact${artifactIds.length === 1 ? "" : "s"}...`);
|
|
101604
103341
|
}
|
|
101605
103342
|
for (const artifactId of artifactIds) {
|
|
101606
|
-
const artifactDir =
|
|
103343
|
+
const artifactDir = join31(artifactsDir, artifactId);
|
|
101607
103344
|
if (!fs.exists(artifactDir)) {
|
|
101608
103345
|
errors4.push({ artifactId, message: "Not installed (directory missing)" });
|
|
101609
103346
|
continue;
|
|
@@ -101940,7 +103677,7 @@ var whoamiCommand = new Command("whoami").description("Show current user").actio
|
|
|
101940
103677
|
// package.json
|
|
101941
103678
|
var package_default = {
|
|
101942
103679
|
name: "@grekt/cli",
|
|
101943
|
-
version: "6.
|
|
103680
|
+
version: "6.36.0",
|
|
101944
103681
|
description: "AI tools versioned, synced, and shared across tools and teams",
|
|
101945
103682
|
type: "module",
|
|
101946
103683
|
bin: {
|
|
@@ -101976,7 +103713,7 @@ var package_default = {
|
|
|
101976
103713
|
},
|
|
101977
103714
|
dependencies: {
|
|
101978
103715
|
"@aws-sdk/client-s3": "^3.971.0",
|
|
101979
|
-
"@grekt-labs/cli-engine": "6.
|
|
103716
|
+
"@grekt-labs/cli-engine": "6.1.0",
|
|
101980
103717
|
"@inquirer/prompts": "^7.2.0",
|
|
101981
103718
|
"@supabase/supabase-js": "^2.91.0",
|
|
101982
103719
|
chalk: "^5.4.1",
|
|
@@ -101984,6 +103721,7 @@ var package_default = {
|
|
|
101984
103721
|
"fast-glob": "^3.3.3",
|
|
101985
103722
|
"gray-matter": "^4.0.3",
|
|
101986
103723
|
ora: "^8.1.1",
|
|
103724
|
+
"smol-toml": "^1.6.0",
|
|
101987
103725
|
tar: "^7.4.0",
|
|
101988
103726
|
yaml: "^2.6.1",
|
|
101989
103727
|
zod: "^3.24.1"
|
|
@@ -102006,13 +103744,13 @@ var package_default = {
|
|
|
102006
103744
|
// src/update-check/update-check.ts
|
|
102007
103745
|
import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
102008
103746
|
import { homedir as homedir3 } from "os";
|
|
102009
|
-
import { join as
|
|
103747
|
+
import { join as join32 } from "path";
|
|
102010
103748
|
var CACHE_FILENAME = ".update-check";
|
|
102011
103749
|
var STALENESS_MS = 24 * 60 * 60 * 1000;
|
|
102012
103750
|
var FETCH_TIMEOUT_MS = 1500;
|
|
102013
103751
|
var GITHUB_RELEASES_URL = "https://api.github.com/repos/grekt-labs/cli/releases/latest";
|
|
102014
103752
|
function getCachePath() {
|
|
102015
|
-
return
|
|
103753
|
+
return join32(homedir3(), ".grekt", CACHE_FILENAME);
|
|
102016
103754
|
}
|
|
102017
103755
|
function isOptedOut() {
|
|
102018
103756
|
return process.env.GREKT_NO_UPDATE_CHECK === "1";
|
|
@@ -102031,7 +103769,7 @@ function readCache() {
|
|
|
102031
103769
|
}
|
|
102032
103770
|
function writeCache(cache2) {
|
|
102033
103771
|
try {
|
|
102034
|
-
const dir =
|
|
103772
|
+
const dir = join32(homedir3(), ".grekt");
|
|
102035
103773
|
if (!existsSync2(dir)) {
|
|
102036
103774
|
mkdirSync3(dir, { recursive: true });
|
|
102037
103775
|
}
|