@grekt/cli 6.34.0 → 6.35.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 +757 -148
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -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 });
|
|
@@ -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,235 @@ 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/mcp/mcp.config.ts
|
|
96748
|
+
var MCP_CONFIGS = {
|
|
96749
|
+
claude: claudeMcpConfig,
|
|
96750
|
+
cursor: cursorMcpConfig,
|
|
96751
|
+
copilot: copilotMcpConfig,
|
|
96752
|
+
amazonq: amazonqMcpConfig,
|
|
96753
|
+
opencode: opencodeMcpConfig,
|
|
96754
|
+
kiro: kiroMcpConfig,
|
|
96755
|
+
gemini: geminiMcpConfig,
|
|
96756
|
+
roocode: roocodeMcpConfig,
|
|
96757
|
+
kilocode: kilocodeMcpConfig,
|
|
96758
|
+
amp: ampMcpConfig
|
|
96759
|
+
};
|
|
96760
|
+
function getMcpConfig(targetId) {
|
|
96761
|
+
return MCP_CONFIGS[targetId];
|
|
96762
|
+
}
|
|
96763
|
+
function getMcpTargetIds() {
|
|
96764
|
+
return Object.keys(MCP_CONFIGS);
|
|
96765
|
+
}
|
|
96766
|
+
|
|
96767
|
+
// src/sync/mcp/mcp.ts
|
|
96768
|
+
var SERVER_NAME_SEPARATOR = "--";
|
|
96769
|
+
var KEY_SEPARATOR = ".";
|
|
96770
|
+
function buildServerName(artifactId, mcpName) {
|
|
96771
|
+
return `grekt${SERVER_NAME_SEPARATOR}${artifactId}${SERVER_NAME_SEPARATOR}${mcpName}`;
|
|
96772
|
+
}
|
|
96773
|
+
function isOwnedByArtifact(serverName, artifactId) {
|
|
96774
|
+
return serverName.startsWith(`grekt${SERVER_NAME_SEPARATOR}${artifactId}${SERVER_NAME_SEPARATOR}`);
|
|
96775
|
+
}
|
|
96776
|
+
function getNestedValue(obj, key) {
|
|
96777
|
+
if (!key.includes(KEY_SEPARATOR))
|
|
96778
|
+
return obj[key];
|
|
96779
|
+
const parts = key.split(KEY_SEPARATOR);
|
|
96780
|
+
let current = obj;
|
|
96781
|
+
for (const part of parts) {
|
|
96782
|
+
if (current === null || current === undefined || typeof current !== "object")
|
|
96783
|
+
return;
|
|
96784
|
+
current = current[part];
|
|
96785
|
+
}
|
|
96786
|
+
return current;
|
|
96787
|
+
}
|
|
96788
|
+
function setNestedValue(obj, key, value) {
|
|
96789
|
+
if (!key.includes(KEY_SEPARATOR)) {
|
|
96790
|
+
obj[key] = value;
|
|
96791
|
+
return;
|
|
96792
|
+
}
|
|
96793
|
+
const parts = key.split(KEY_SEPARATOR);
|
|
96794
|
+
const lastPart = parts.pop();
|
|
96795
|
+
if (!lastPart)
|
|
96796
|
+
return;
|
|
96797
|
+
let current = obj;
|
|
96798
|
+
for (const part of parts) {
|
|
96799
|
+
if (!current[part] || typeof current[part] !== "object") {
|
|
96800
|
+
current[part] = {};
|
|
96801
|
+
}
|
|
96802
|
+
current = current[part];
|
|
96803
|
+
}
|
|
96804
|
+
current[lastPart] = value;
|
|
96805
|
+
}
|
|
96806
|
+
function deleteNestedValue(obj, key) {
|
|
96807
|
+
if (!key.includes(KEY_SEPARATOR)) {
|
|
96808
|
+
delete obj[key];
|
|
96809
|
+
return;
|
|
96810
|
+
}
|
|
96811
|
+
const parts = key.split(KEY_SEPARATOR);
|
|
96812
|
+
const lastPart = parts.pop();
|
|
96813
|
+
if (!lastPart)
|
|
96814
|
+
return;
|
|
96815
|
+
const parents = [];
|
|
96816
|
+
let current = obj;
|
|
96817
|
+
for (const part of parts) {
|
|
96818
|
+
if (!current[part] || typeof current[part] !== "object")
|
|
96819
|
+
return;
|
|
96820
|
+
parents.push({ obj: current, key: part });
|
|
96821
|
+
current = current[part];
|
|
96822
|
+
}
|
|
96823
|
+
delete current[lastPart];
|
|
96824
|
+
for (let i = parents.length - 1;i >= 0; i--) {
|
|
96825
|
+
const parent = parents[i];
|
|
96826
|
+
if (!parent)
|
|
96827
|
+
continue;
|
|
96828
|
+
const child = parent.obj[parent.key];
|
|
96829
|
+
if (typeof child === "object" && child !== null && Object.keys(child).length === 0) {
|
|
96830
|
+
delete parent.obj[parent.key];
|
|
96831
|
+
}
|
|
96832
|
+
}
|
|
96833
|
+
}
|
|
96834
|
+
function readConfigFile(projectRoot, configFile) {
|
|
96835
|
+
const fullPath = join25(projectRoot, configFile);
|
|
96836
|
+
if (!fs.exists(fullPath)) {
|
|
96837
|
+
return {};
|
|
96838
|
+
}
|
|
96839
|
+
try {
|
|
96840
|
+
return JSON.parse(fs.readFile(fullPath));
|
|
96841
|
+
} catch {
|
|
96842
|
+
return {};
|
|
96843
|
+
}
|
|
96844
|
+
}
|
|
96845
|
+
function writeConfigFile(projectRoot, configFile, data) {
|
|
96846
|
+
const fullPath = join25(projectRoot, configFile);
|
|
96847
|
+
const dir = dirname8(fullPath);
|
|
96848
|
+
if (!fs.exists(dir)) {
|
|
96849
|
+
fs.mkdir(dir, { recursive: true });
|
|
96850
|
+
}
|
|
96851
|
+
fs.writeFile(fullPath, JSON.stringify(data, null, 2) + `
|
|
96852
|
+
`);
|
|
96853
|
+
}
|
|
96854
|
+
function resolveExecutablePath(projectRoot, artifactId, content) {
|
|
96855
|
+
if (content.command) {
|
|
96856
|
+
const artifactMcpDir = join25(projectRoot, ARTIFACTS_DIR, artifactId, "mcps");
|
|
96857
|
+
const execPath = join25(artifactMcpDir, content.command);
|
|
96858
|
+
return relative6(projectRoot, execPath);
|
|
96859
|
+
}
|
|
96860
|
+
return "";
|
|
96861
|
+
}
|
|
96862
|
+
function extractMcpInfo(mcpFile) {
|
|
96863
|
+
const name2 = mcpFile.parsed.frontmatter["grk-name"];
|
|
96864
|
+
const content = mcpFile.parsed.content;
|
|
96865
|
+
return { name: name2, content };
|
|
96866
|
+
}
|
|
96867
|
+
function getMcpType(content) {
|
|
96868
|
+
return content.url ? "http" : "stdio";
|
|
96869
|
+
}
|
|
96870
|
+
function collectTargetConfigs(activeTargets) {
|
|
96871
|
+
const targetIds = getMcpTargetIds();
|
|
96872
|
+
const configs = new Map;
|
|
96873
|
+
for (const targetId of targetIds) {
|
|
96874
|
+
if (!activeTargets.includes(targetId))
|
|
96875
|
+
continue;
|
|
96876
|
+
const config = getMcpConfig(targetId);
|
|
96877
|
+
if (config) {
|
|
96878
|
+
configs.set(targetId, config);
|
|
96879
|
+
}
|
|
96880
|
+
}
|
|
96881
|
+
return configs;
|
|
96882
|
+
}
|
|
96883
|
+
function installMcps(projectRoot, artifactId, mcpFiles, activeTargets) {
|
|
96884
|
+
const result = { installed: 0, targets: [] };
|
|
96885
|
+
const targetConfigs = collectTargetConfigs(activeTargets);
|
|
96886
|
+
if (targetConfigs.size === 0 || mcpFiles.length === 0) {
|
|
96887
|
+
return result;
|
|
96888
|
+
}
|
|
96889
|
+
for (const [targetId, mcpConfig] of targetConfigs) {
|
|
96890
|
+
if (mcpConfig.format && mcpConfig.format !== "json")
|
|
96891
|
+
continue;
|
|
96892
|
+
const configData = readConfigFile(projectRoot, mcpConfig.configFile);
|
|
96893
|
+
const servers = getNestedValue(configData, mcpConfig.serverKey) ?? {};
|
|
96894
|
+
for (const serverName of Object.keys(servers)) {
|
|
96895
|
+
if (isOwnedByArtifact(serverName, artifactId)) {
|
|
96896
|
+
delete servers[serverName];
|
|
96897
|
+
}
|
|
96898
|
+
}
|
|
96899
|
+
for (const mcpFile of mcpFiles) {
|
|
96900
|
+
const { name: name2, content } = extractMcpInfo(mcpFile);
|
|
96901
|
+
const serverName = buildServerName(artifactId, name2);
|
|
96902
|
+
const executablePath = resolveExecutablePath(projectRoot, artifactId, content);
|
|
96903
|
+
servers[serverName] = mcpConfig.transform(serverName, content, executablePath);
|
|
96904
|
+
}
|
|
96905
|
+
setNestedValue(configData, mcpConfig.serverKey, servers);
|
|
96906
|
+
writeConfigFile(projectRoot, mcpConfig.configFile, configData);
|
|
96907
|
+
result.targets.push(targetId);
|
|
96908
|
+
result.installed += mcpFiles.length;
|
|
96909
|
+
}
|
|
96910
|
+
return result;
|
|
96911
|
+
}
|
|
96912
|
+
function uninstallMcps(projectRoot, artifactId, activeTargets) {
|
|
96913
|
+
let removedCount = 0;
|
|
96914
|
+
const targetConfigs = collectTargetConfigs(activeTargets);
|
|
96915
|
+
for (const [_targetId, mcpConfig] of targetConfigs) {
|
|
96916
|
+
if (mcpConfig.format && mcpConfig.format !== "json")
|
|
96917
|
+
continue;
|
|
96918
|
+
const configData = readConfigFile(projectRoot, mcpConfig.configFile);
|
|
96919
|
+
const servers = getNestedValue(configData, mcpConfig.serverKey);
|
|
96920
|
+
if (!servers)
|
|
96921
|
+
continue;
|
|
96922
|
+
let changed = false;
|
|
96923
|
+
for (const serverName of Object.keys(servers)) {
|
|
96924
|
+
if (isOwnedByArtifact(serverName, artifactId)) {
|
|
96925
|
+
delete servers[serverName];
|
|
96926
|
+
changed = true;
|
|
96927
|
+
removedCount++;
|
|
96928
|
+
}
|
|
96929
|
+
}
|
|
96930
|
+
if (changed) {
|
|
96931
|
+
if (Object.keys(servers).length > 0) {
|
|
96932
|
+
setNestedValue(configData, mcpConfig.serverKey, servers);
|
|
96933
|
+
} else {
|
|
96934
|
+
deleteNestedValue(configData, mcpConfig.serverKey);
|
|
96935
|
+
}
|
|
96936
|
+
writeConfigFile(projectRoot, mcpConfig.configFile, configData);
|
|
96937
|
+
}
|
|
96938
|
+
}
|
|
96939
|
+
return removedCount;
|
|
96940
|
+
}
|
|
96941
|
+
function getMcpSummary(mcpFiles) {
|
|
96942
|
+
return mcpFiles.map((mcpFile) => {
|
|
96943
|
+
const { name: name2, content } = extractMcpInfo(mcpFile);
|
|
96944
|
+
return { name: name2, type: getMcpType(content) };
|
|
96945
|
+
});
|
|
96946
|
+
}
|
|
96947
|
+
// src/sync/mcp/mcp.prompt.ts
|
|
96948
|
+
async function promptAndInstallMcps(projectRoot, artifactId, mcpFiles, activeTargets) {
|
|
96949
|
+
newline();
|
|
96950
|
+
const summary = getMcpSummary(mcpFiles);
|
|
96951
|
+
log(`${colors5.bold("MCP servers")} to install:`);
|
|
96952
|
+
for (const entry of summary) {
|
|
96953
|
+
const typeLabel = colors5.dim(`(${entry.type})`);
|
|
96954
|
+
log(` ${colors5.dim("-")} ${entry.name} ${typeLabel}`);
|
|
96955
|
+
}
|
|
96956
|
+
newline();
|
|
96957
|
+
const shouldInstall = await esm_default3({
|
|
96958
|
+
message: "Install these MCP servers?",
|
|
96959
|
+
default: true
|
|
96960
|
+
});
|
|
96961
|
+
if (!shouldInstall) {
|
|
96962
|
+
info("MCP servers skipped");
|
|
96963
|
+
return false;
|
|
96964
|
+
}
|
|
96965
|
+
const result = installMcps(projectRoot, artifactId, mcpFiles, activeTargets);
|
|
96966
|
+
if (result.installed > 0) {
|
|
96967
|
+
success(`Installed ${summary.length} MCP server(s) for ${result.targets.join(", ")}`);
|
|
96968
|
+
} else {
|
|
96969
|
+
info("No active targets support MCP distribution");
|
|
96970
|
+
}
|
|
96971
|
+
return result.installed > 0;
|
|
96972
|
+
}
|
|
96372
96973
|
// src/commands/add.ts
|
|
96373
96974
|
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
96975
|
if (!sourceArg) {
|
|
@@ -96534,12 +97135,16 @@ var addCommand = new Command("add").description("Add an artifact from registry,
|
|
|
96534
97135
|
if (artifactInfo.hooks.length > 0) {
|
|
96535
97136
|
await promptAndInstallHooks(projectRoot, resolvedArtifactId, artifactInfo.hooks);
|
|
96536
97137
|
}
|
|
97138
|
+
if (artifactInfo.mcps.length > 0) {
|
|
97139
|
+
const allTargets = [...config.targets, ...Object.keys(config.customTargets ?? {})];
|
|
97140
|
+
await promptAndInstallMcps(projectRoot, resolvedArtifactId, artifactInfo.mcps, allTargets);
|
|
97141
|
+
}
|
|
96537
97142
|
await syncToTargets(config, lockfile, projectRoot);
|
|
96538
97143
|
});
|
|
96539
97144
|
|
|
96540
97145
|
// src/registry/download/download.ts
|
|
96541
97146
|
import { tmpdir as tmpdir2 } from "os";
|
|
96542
|
-
import { join as
|
|
97147
|
+
import { join as join26 } from "path";
|
|
96543
97148
|
|
|
96544
97149
|
// src/shared/security/url-validation.ts
|
|
96545
97150
|
var BLOCKED_IPV4_PATTERNS = [
|
|
@@ -96641,7 +97246,7 @@ async function downloadAndExtractTarball2(url, targetDir, options2 = {}) {
|
|
|
96641
97246
|
"User-Agent": "grekt-cli",
|
|
96642
97247
|
...headers
|
|
96643
97248
|
};
|
|
96644
|
-
const tempTarball =
|
|
97249
|
+
const tempTarball = join26(tmpdir2(), `grekt-${cryptoProvider.randomUUID()}.tar.gz`);
|
|
96645
97250
|
const controller = new AbortController;
|
|
96646
97251
|
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
96647
97252
|
try {
|
|
@@ -97174,7 +97779,7 @@ var checkCommand = new Command("check").description("Check artifact integrity, s
|
|
|
97174
97779
|
});
|
|
97175
97780
|
|
|
97176
97781
|
// src/commands/remove.ts
|
|
97177
|
-
import { dirname as
|
|
97782
|
+
import { dirname as dirname9 } from "path";
|
|
97178
97783
|
var SYNCABLE_CATEGORIES3 = getCategoriesForFormat("md");
|
|
97179
97784
|
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
97785
|
await withPromptHandler(async () => {
|
|
@@ -97226,6 +97831,7 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97226
97831
|
}
|
|
97227
97832
|
}
|
|
97228
97833
|
const removed = [];
|
|
97834
|
+
const allTargets = [...config.targets, ...Object.keys(config.customTargets ?? {})];
|
|
97229
97835
|
const hookFiles = artifactInfo?.hooks ?? [];
|
|
97230
97836
|
if (hookFiles.length > 0) {
|
|
97231
97837
|
const hooksRemoved = uninstallHooks(projectRoot, artifactId, hookFiles);
|
|
@@ -97233,16 +97839,19 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97233
97839
|
removed.push(`${hooksRemoved} hook target(s) cleaned`);
|
|
97234
97840
|
}
|
|
97235
97841
|
}
|
|
97842
|
+
const mcpsRemoved = uninstallMcps(projectRoot, artifactId, allTargets);
|
|
97843
|
+
if (mcpsRemoved > 0) {
|
|
97844
|
+
removed.push(`${mcpsRemoved} MCP server(s) cleaned`);
|
|
97845
|
+
}
|
|
97236
97846
|
if (fs.exists(artifactDir)) {
|
|
97237
97847
|
fs.rmdir(artifactDir, { recursive: true });
|
|
97238
97848
|
removed.push(`${ARTIFACTS_DIR}/${artifactId}`);
|
|
97239
|
-
const scopeDir =
|
|
97849
|
+
const scopeDir = dirname9(artifactDir);
|
|
97240
97850
|
const artifactsFullPath = `${projectRoot}/${ARTIFACTS_DIR}`;
|
|
97241
97851
|
if (scopeDir !== artifactsFullPath) {
|
|
97242
97852
|
cleanEmptyDir(scopeDir);
|
|
97243
97853
|
}
|
|
97244
97854
|
}
|
|
97245
|
-
const allTargets = [...config.targets, ...Object.keys(config.customTargets ?? {})];
|
|
97246
97855
|
for (const target of allTargets) {
|
|
97247
97856
|
const plugin = getPlugin(target, config.customTargets);
|
|
97248
97857
|
const syncPaths = plugin.getSyncPaths();
|
|
@@ -97259,7 +97868,7 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97259
97868
|
if (fs.exists(targetPath)) {
|
|
97260
97869
|
fs.unlink(targetPath);
|
|
97261
97870
|
removed.push(`${categoryDir}/${targetName}`);
|
|
97262
|
-
const targetDir =
|
|
97871
|
+
const targetDir = dirname9(targetPath);
|
|
97263
97872
|
const categoryFullPath = `${projectRoot}/${categoryDir}`;
|
|
97264
97873
|
if (targetDir !== categoryFullPath) {
|
|
97265
97874
|
cleanEmptyDir(targetDir);
|
|
@@ -97288,17 +97897,17 @@ var removeCommand = new Command("remove").alias("rm").description("Remove an ins
|
|
|
97288
97897
|
|
|
97289
97898
|
// src/artifact/tarball/tarball.ts
|
|
97290
97899
|
import { tmpdir as tmpdir3 } from "os";
|
|
97291
|
-
import { basename as
|
|
97900
|
+
import { basename as basename10, dirname as dirname10, join as join27, sep as sep3 } from "path";
|
|
97292
97901
|
var TARBALL_DIR = ".grekt/tmp";
|
|
97293
97902
|
function ensureTarballDir(projectRoot) {
|
|
97294
|
-
const tarballDir =
|
|
97903
|
+
const tarballDir = join27(projectRoot, TARBALL_DIR);
|
|
97295
97904
|
if (!fs.exists(tarballDir)) {
|
|
97296
97905
|
fs.mkdir(tarballDir, { recursive: true });
|
|
97297
97906
|
}
|
|
97298
97907
|
return tarballDir;
|
|
97299
97908
|
}
|
|
97300
97909
|
function injectComponentsIntoManifest(artifactPath, components) {
|
|
97301
|
-
const manifestPath =
|
|
97910
|
+
const manifestPath = join27(artifactPath, "grekt.yaml");
|
|
97302
97911
|
const content = fs.readFile(manifestPath);
|
|
97303
97912
|
const manifest = $parse2(content);
|
|
97304
97913
|
manifest.components = components;
|
|
@@ -97308,14 +97917,14 @@ function createTarball(options2) {
|
|
|
97308
97917
|
const { artifactPath, artifactId, projectRoot, components } = options2;
|
|
97309
97918
|
const tarballDir = ensureTarballDir(projectRoot);
|
|
97310
97919
|
const tarballName = `${artifactId.replace("/", "-")}.tar.gz`;
|
|
97311
|
-
const outputPath =
|
|
97920
|
+
const outputPath = join27(tarballDir, tarballName);
|
|
97312
97921
|
let sourcePath = artifactPath;
|
|
97313
97922
|
let tempDir = null;
|
|
97314
97923
|
try {
|
|
97315
97924
|
if (components) {
|
|
97316
|
-
const artifactDirName =
|
|
97317
|
-
tempDir =
|
|
97318
|
-
const tempArtifactPath =
|
|
97925
|
+
const artifactDirName = basename10(artifactPath);
|
|
97926
|
+
tempDir = join27(tmpdir3(), `grekt-tmp-${Date.now()}`);
|
|
97927
|
+
const tempArtifactPath = join27(tempDir, artifactDirName);
|
|
97319
97928
|
fs.mkdir(tempDir, { recursive: true });
|
|
97320
97929
|
fs.copy(artifactPath, tempArtifactPath, {
|
|
97321
97930
|
recursive: true,
|
|
@@ -97324,8 +97933,8 @@ function createTarball(options2) {
|
|
|
97324
97933
|
injectComponentsIntoManifest(tempArtifactPath, components);
|
|
97325
97934
|
sourcePath = tempArtifactPath;
|
|
97326
97935
|
}
|
|
97327
|
-
const artifactDir =
|
|
97328
|
-
const parentDir =
|
|
97936
|
+
const artifactDir = basename10(sourcePath);
|
|
97937
|
+
const parentDir = dirname10(sourcePath);
|
|
97329
97938
|
tarOps.create({
|
|
97330
97939
|
outputPath,
|
|
97331
97940
|
sourceDir: parentDir,
|
|
@@ -100245,14 +100854,14 @@ async function publishArtifact(publisher, ctx) {
|
|
|
100245
100854
|
|
|
100246
100855
|
// src/workspace/workspace.ts
|
|
100247
100856
|
var import_fast_glob = __toESM(require_out4(), 1);
|
|
100248
|
-
import { join as
|
|
100857
|
+
import { join as join28 } from "path";
|
|
100249
100858
|
var WORKSPACE_CONFIG_FILE2 = "grekt-workspace.yaml";
|
|
100250
100859
|
var ARTIFACT_MANIFEST_FILE2 = "grekt.yaml";
|
|
100251
100860
|
async function loadWorkspace(cwd) {
|
|
100252
100861
|
if (!isWorkspaceRoot(fs, cwd)) {
|
|
100253
100862
|
return null;
|
|
100254
100863
|
}
|
|
100255
|
-
const configPath =
|
|
100864
|
+
const configPath = join28(cwd, WORKSPACE_CONFIG_FILE2);
|
|
100256
100865
|
const configContent = fs.readFile(configPath);
|
|
100257
100866
|
const result = parseWorkspaceConfig(configContent, configPath);
|
|
100258
100867
|
if (!result.success) {
|
|
@@ -100269,7 +100878,7 @@ async function loadWorkspace(cwd) {
|
|
|
100269
100878
|
absolute: true
|
|
100270
100879
|
});
|
|
100271
100880
|
for (const fullPath of matches) {
|
|
100272
|
-
const manifestPath =
|
|
100881
|
+
const manifestPath = join28(fullPath, ARTIFACT_MANIFEST_FILE2);
|
|
100273
100882
|
if (fs.exists(manifestPath)) {
|
|
100274
100883
|
artifactPaths.push(fullPath);
|
|
100275
100884
|
}
|
|
@@ -100283,7 +100892,7 @@ async function loadWorkspace(cwd) {
|
|
|
100283
100892
|
}
|
|
100284
100893
|
function generatePackageJsonFiles(artifacts) {
|
|
100285
100894
|
for (const artifact of artifacts) {
|
|
100286
|
-
const packageJsonPath =
|
|
100895
|
+
const packageJsonPath = join28(artifact.path, "package.json");
|
|
100287
100896
|
const packageJson = {
|
|
100288
100897
|
name: artifact.manifest.name,
|
|
100289
100898
|
version: artifact.manifest.version,
|
|
@@ -100296,8 +100905,8 @@ function generatePackageJsonFiles(artifacts) {
|
|
|
100296
100905
|
function syncVersionsToManifest(artifacts) {
|
|
100297
100906
|
let updated = 0;
|
|
100298
100907
|
for (const artifact of artifacts) {
|
|
100299
|
-
const packageJsonPath =
|
|
100300
|
-
const manifestPath =
|
|
100908
|
+
const packageJsonPath = join28(artifact.path, "package.json");
|
|
100909
|
+
const manifestPath = join28(artifact.path, ARTIFACT_MANIFEST_FILE2);
|
|
100301
100910
|
if (!fs.exists(packageJsonPath))
|
|
100302
100911
|
continue;
|
|
100303
100912
|
const packageJson = JSON.parse(fs.readFile(packageJsonPath));
|
|
@@ -100314,7 +100923,7 @@ function syncVersionsToManifest(artifacts) {
|
|
|
100314
100923
|
}
|
|
100315
100924
|
function cleanPackageJsonFiles(artifacts) {
|
|
100316
100925
|
for (const artifact of artifacts) {
|
|
100317
|
-
const packageJsonPath =
|
|
100926
|
+
const packageJsonPath = join28(artifact.path, "package.json");
|
|
100318
100927
|
if (fs.exists(packageJsonPath)) {
|
|
100319
100928
|
fs.unlink(packageJsonPath);
|
|
100320
100929
|
}
|
|
@@ -101114,7 +101723,7 @@ function displayUpgradeSummary(results) {
|
|
|
101114
101723
|
}
|
|
101115
101724
|
|
|
101116
101725
|
// src/commands/version.ts
|
|
101117
|
-
import { join as
|
|
101726
|
+
import { join as join29, resolve as resolve6 } from "path";
|
|
101118
101727
|
import { spawnSync } from "child_process";
|
|
101119
101728
|
var MANIFEST_FILE = "grekt.yaml";
|
|
101120
101729
|
var BUMP_TYPES = ["patch", "minor", "major", "prerelease"];
|
|
@@ -101167,7 +101776,7 @@ var versionCommand = new Command("version").description("Bump artifact versions
|
|
|
101167
101776
|
log("");
|
|
101168
101777
|
let updated = 0;
|
|
101169
101778
|
for (const artifactPath of artifactPaths) {
|
|
101170
|
-
const manifestPath =
|
|
101779
|
+
const manifestPath = join29(artifactPath, MANIFEST_FILE);
|
|
101171
101780
|
const manifestContent = fs.readFile(manifestPath);
|
|
101172
101781
|
const result = safeParseYaml(manifestContent, ProjectConfigSchema, manifestPath);
|
|
101173
101782
|
if (!result.success) {
|
|
@@ -101268,7 +101877,7 @@ async function handleExecMode(options2) {
|
|
|
101268
101877
|
}
|
|
101269
101878
|
function findArtifacts(basePath) {
|
|
101270
101879
|
const artifacts = [];
|
|
101271
|
-
if (fs.exists(
|
|
101880
|
+
if (fs.exists(join29(basePath, MANIFEST_FILE))) {
|
|
101272
101881
|
artifacts.push(basePath);
|
|
101273
101882
|
return artifacts;
|
|
101274
101883
|
}
|
|
@@ -101277,9 +101886,9 @@ function findArtifacts(basePath) {
|
|
|
101277
101886
|
for (const entry of entries) {
|
|
101278
101887
|
if (entry.startsWith("."))
|
|
101279
101888
|
continue;
|
|
101280
|
-
const subPath =
|
|
101889
|
+
const subPath = join29(basePath, entry);
|
|
101281
101890
|
const stat = fs.stat(subPath);
|
|
101282
|
-
if (stat.isDirectory && fs.exists(
|
|
101891
|
+
if (stat.isDirectory && fs.exists(join29(subPath, MANIFEST_FILE))) {
|
|
101283
101892
|
artifacts.push(subPath);
|
|
101284
101893
|
}
|
|
101285
101894
|
}
|
|
@@ -101310,7 +101919,7 @@ var listSubcommand = new Command("list").description("List all artifacts in the
|
|
|
101310
101919
|
});
|
|
101311
101920
|
var workspaceCommand = new Command("workspace").description("Manage monorepo workspaces").addCommand(listSubcommand);
|
|
101312
101921
|
// src/commands/worktree/worktree.ts
|
|
101313
|
-
import { join as
|
|
101922
|
+
import { join as join30, dirname as dirname11, isAbsolute as isAbsolute4 } from "path";
|
|
101314
101923
|
var GREKT_DIR2 = ".grekt";
|
|
101315
101924
|
function getGitCommonDir() {
|
|
101316
101925
|
try {
|
|
@@ -101327,8 +101936,8 @@ function getWorktreeRoot() {
|
|
|
101327
101936
|
}
|
|
101328
101937
|
}
|
|
101329
101938
|
function resolveOriginalRepoRoot(commonDir, worktreeRoot) {
|
|
101330
|
-
const absoluteCommonDir = isAbsolute4(commonDir) ? commonDir :
|
|
101331
|
-
return
|
|
101939
|
+
const absoluteCommonDir = isAbsolute4(commonDir) ? commonDir : join30(worktreeRoot, commonDir);
|
|
101940
|
+
return dirname11(absoluteCommonDir);
|
|
101332
101941
|
}
|
|
101333
101942
|
function isInsideWorktree(commonDir) {
|
|
101334
101943
|
return commonDir !== ".git";
|
|
@@ -101350,8 +101959,8 @@ var syncSubcommand = new Command("sync").description("Copy .grekt/ from the orig
|
|
|
101350
101959
|
process.exit(1);
|
|
101351
101960
|
}
|
|
101352
101961
|
const originalRepoRoot = resolveOriginalRepoRoot(commonDir, worktreeRoot);
|
|
101353
|
-
const sourcePath =
|
|
101354
|
-
const destPath =
|
|
101962
|
+
const sourcePath = join30(originalRepoRoot, GREKT_DIR2);
|
|
101963
|
+
const destPath = join30(worktreeRoot, GREKT_DIR2);
|
|
101355
101964
|
if (!fs.exists(sourcePath)) {
|
|
101356
101965
|
info("No .grekt/ directory found in the original repository");
|
|
101357
101966
|
process.exit(0);
|
|
@@ -101374,7 +101983,7 @@ var syncSubcommand = new Command("sync").description("Copy .grekt/ from the orig
|
|
|
101374
101983
|
});
|
|
101375
101984
|
var worktreeCommand = new Command("worktree").description("Manage git worktree integration").addCommand(syncSubcommand);
|
|
101376
101985
|
// src/commands/scan.ts
|
|
101377
|
-
import { join as
|
|
101986
|
+
import { join as join31, resolve as resolve7 } from "path";
|
|
101378
101987
|
var VALID_BADGES = ["certified", "conditional", "suspicious", "rejected"];
|
|
101379
101988
|
var BADGE_COLORS = {
|
|
101380
101989
|
certified: colors5.success,
|
|
@@ -101470,7 +102079,7 @@ var scanCommand = new Command("scan").description("Scan artifacts for security i
|
|
|
101470
102079
|
});
|
|
101471
102080
|
async function scanRemoteArtifact(source, projectRoot, jsonOutput, failOnThreshold) {
|
|
101472
102081
|
const displayName = getSourceDisplayName(source);
|
|
101473
|
-
const tempDir =
|
|
102082
|
+
const tempDir = join31(projectRoot, ARTIFACTS_DIR, `.tmp-scan-${cryptoProvider.randomUUID()}`);
|
|
101474
102083
|
try {
|
|
101475
102084
|
if (!jsonOutput) {
|
|
101476
102085
|
const spin = spinner(`Downloading ${colors5.highlight(displayName)}...`);
|
|
@@ -101596,14 +102205,14 @@ async function scanAllInstalled(projectRoot, jsonOutput, failOnThreshold) {
|
|
|
101596
102205
|
}
|
|
101597
102206
|
const config = getConfig(projectRoot);
|
|
101598
102207
|
const trustKey = process.env.GREKT_TRUST_KEY;
|
|
101599
|
-
const artifactsDir =
|
|
102208
|
+
const artifactsDir = join31(projectRoot, ARTIFACTS_DIR);
|
|
101600
102209
|
const results = [];
|
|
101601
102210
|
const errors4 = [];
|
|
101602
102211
|
if (!jsonOutput) {
|
|
101603
102212
|
log(`Scanning ${colors5.bold(String(artifactIds.length))} artifact${artifactIds.length === 1 ? "" : "s"}...`);
|
|
101604
102213
|
}
|
|
101605
102214
|
for (const artifactId of artifactIds) {
|
|
101606
|
-
const artifactDir =
|
|
102215
|
+
const artifactDir = join31(artifactsDir, artifactId);
|
|
101607
102216
|
if (!fs.exists(artifactDir)) {
|
|
101608
102217
|
errors4.push({ artifactId, message: "Not installed (directory missing)" });
|
|
101609
102218
|
continue;
|
|
@@ -101940,7 +102549,7 @@ var whoamiCommand = new Command("whoami").description("Show current user").actio
|
|
|
101940
102549
|
// package.json
|
|
101941
102550
|
var package_default = {
|
|
101942
102551
|
name: "@grekt/cli",
|
|
101943
|
-
version: "6.
|
|
102552
|
+
version: "6.35.0",
|
|
101944
102553
|
description: "AI tools versioned, synced, and shared across tools and teams",
|
|
101945
102554
|
type: "module",
|
|
101946
102555
|
bin: {
|
|
@@ -101976,7 +102585,7 @@ var package_default = {
|
|
|
101976
102585
|
},
|
|
101977
102586
|
dependencies: {
|
|
101978
102587
|
"@aws-sdk/client-s3": "^3.971.0",
|
|
101979
|
-
"@grekt-labs/cli-engine": "6.
|
|
102588
|
+
"@grekt-labs/cli-engine": "6.1.0",
|
|
101980
102589
|
"@inquirer/prompts": "^7.2.0",
|
|
101981
102590
|
"@supabase/supabase-js": "^2.91.0",
|
|
101982
102591
|
chalk: "^5.4.1",
|
|
@@ -102006,13 +102615,13 @@ var package_default = {
|
|
|
102006
102615
|
// src/update-check/update-check.ts
|
|
102007
102616
|
import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
102008
102617
|
import { homedir as homedir3 } from "os";
|
|
102009
|
-
import { join as
|
|
102618
|
+
import { join as join32 } from "path";
|
|
102010
102619
|
var CACHE_FILENAME = ".update-check";
|
|
102011
102620
|
var STALENESS_MS = 24 * 60 * 60 * 1000;
|
|
102012
102621
|
var FETCH_TIMEOUT_MS = 1500;
|
|
102013
102622
|
var GITHUB_RELEASES_URL = "https://api.github.com/repos/grekt-labs/cli/releases/latest";
|
|
102014
102623
|
function getCachePath() {
|
|
102015
|
-
return
|
|
102624
|
+
return join32(homedir3(), ".grekt", CACHE_FILENAME);
|
|
102016
102625
|
}
|
|
102017
102626
|
function isOptedOut() {
|
|
102018
102627
|
return process.env.GREKT_NO_UPDATE_CHECK === "1";
|
|
@@ -102031,7 +102640,7 @@ function readCache() {
|
|
|
102031
102640
|
}
|
|
102032
102641
|
function writeCache(cache2) {
|
|
102033
102642
|
try {
|
|
102034
|
-
const dir =
|
|
102643
|
+
const dir = join32(homedir3(), ".grekt");
|
|
102035
102644
|
if (!existsSync2(dir)) {
|
|
102036
102645
|
mkdirSync3(dir, { recursive: true });
|
|
102037
102646
|
}
|