rulesync 7.19.0 → 7.21.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/README.md +1 -0
- package/dist/{chunk-J2ZF4SHC.js → chunk-UYWCICY6.js} +893 -701
- package/dist/cli/index.cjs +1313 -1044
- package/dist/cli/index.js +332 -257
- package/dist/index.cjs +750 -651
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -7
- package/package.json +2 -3
|
@@ -15,190 +15,6 @@ function formatError(error) {
|
|
|
15
15
|
return String(error);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
// src/types/json-output.ts
|
|
19
|
-
var ErrorCodes = {
|
|
20
|
-
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
21
|
-
RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
|
|
22
|
-
INVALID_TARGET: "INVALID_TARGET",
|
|
23
|
-
FETCH_FAILED: "FETCH_FAILED",
|
|
24
|
-
WRITE_FAILED: "WRITE_FAILED",
|
|
25
|
-
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
26
|
-
GENERATION_FAILED: "GENERATION_FAILED",
|
|
27
|
-
IMPORT_FAILED: "IMPORT_FAILED",
|
|
28
|
-
INSTALL_FAILED: "INSTALL_FAILED",
|
|
29
|
-
UPDATE_FAILED: "UPDATE_FAILED",
|
|
30
|
-
GITIGNORE_FAILED: "GITIGNORE_FAILED",
|
|
31
|
-
INIT_FAILED: "INIT_FAILED",
|
|
32
|
-
MCP_FAILED: "MCP_FAILED",
|
|
33
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
34
|
-
};
|
|
35
|
-
var CLIError = class extends Error {
|
|
36
|
-
constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
|
|
37
|
-
super(message);
|
|
38
|
-
this.code = code;
|
|
39
|
-
this.exitCode = exitCode;
|
|
40
|
-
this.name = "CLIError";
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// src/utils/logger.ts
|
|
45
|
-
import { consola } from "consola";
|
|
46
|
-
|
|
47
|
-
// src/utils/vitest.ts
|
|
48
|
-
function isEnvTest() {
|
|
49
|
-
return process.env.NODE_ENV === "test";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// src/utils/logger.ts
|
|
53
|
-
var Logger = class {
|
|
54
|
-
/**
|
|
55
|
-
* Create a new Logger instance
|
|
56
|
-
*/
|
|
57
|
-
constructor(_version = "0.0.0") {
|
|
58
|
-
this._version = _version;
|
|
59
|
-
}
|
|
60
|
-
_verbose = false;
|
|
61
|
-
_silent = false;
|
|
62
|
-
_jsonMode = false;
|
|
63
|
-
_jsonOutputDone = false;
|
|
64
|
-
_commandName = "";
|
|
65
|
-
_jsonData = {};
|
|
66
|
-
console = consola.withDefaults({
|
|
67
|
-
tag: "rulesync"
|
|
68
|
-
});
|
|
69
|
-
/**
|
|
70
|
-
* Configure logger with verbose and silent mode settings.
|
|
71
|
-
* Handles conflicting flags where silent takes precedence.
|
|
72
|
-
*/
|
|
73
|
-
configure({ verbose, silent }) {
|
|
74
|
-
if (verbose && silent) {
|
|
75
|
-
this._silent = false;
|
|
76
|
-
this.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
77
|
-
}
|
|
78
|
-
this._silent = silent;
|
|
79
|
-
this._verbose = verbose && !silent;
|
|
80
|
-
}
|
|
81
|
-
get verbose() {
|
|
82
|
-
return this._verbose;
|
|
83
|
-
}
|
|
84
|
-
get silent() {
|
|
85
|
-
return this._silent;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Enable JSON output mode
|
|
89
|
-
*/
|
|
90
|
-
setJsonMode(enabled, command) {
|
|
91
|
-
this._jsonMode = enabled;
|
|
92
|
-
this._jsonOutputDone = false;
|
|
93
|
-
this._commandName = command;
|
|
94
|
-
if (enabled) {
|
|
95
|
-
this._jsonData = {};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Check if JSON mode is enabled
|
|
100
|
-
*/
|
|
101
|
-
get jsonMode() {
|
|
102
|
-
return this._jsonMode;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Capture data for JSON output
|
|
106
|
-
*/
|
|
107
|
-
captureData(key, value) {
|
|
108
|
-
if (this._jsonMode) {
|
|
109
|
-
this._jsonData[key] = value;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Get captured JSON data
|
|
114
|
-
*/
|
|
115
|
-
getJsonData() {
|
|
116
|
-
return { ...this._jsonData };
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Output final JSON result
|
|
120
|
-
*/
|
|
121
|
-
outputJson(success, error) {
|
|
122
|
-
if (!this._jsonMode || this._jsonOutputDone) return;
|
|
123
|
-
this._jsonOutputDone = true;
|
|
124
|
-
const output = {
|
|
125
|
-
success,
|
|
126
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
127
|
-
command: this._commandName,
|
|
128
|
-
version: this._version
|
|
129
|
-
};
|
|
130
|
-
if (success) {
|
|
131
|
-
output.data = this._jsonData;
|
|
132
|
-
} else if (error) {
|
|
133
|
-
output.error = {
|
|
134
|
-
code: error.code,
|
|
135
|
-
message: error.message
|
|
136
|
-
};
|
|
137
|
-
if (error.details) {
|
|
138
|
-
output.error.details = error.details;
|
|
139
|
-
}
|
|
140
|
-
if (error.stack) {
|
|
141
|
-
output.error.stack = error.stack;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
const jsonStr = JSON.stringify(output, null, 2);
|
|
145
|
-
if (success) {
|
|
146
|
-
console.log(jsonStr);
|
|
147
|
-
} else {
|
|
148
|
-
console.error(jsonStr);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
info(message, ...args) {
|
|
152
|
-
if (isEnvTest() || this._silent) return;
|
|
153
|
-
if (this._jsonMode) return;
|
|
154
|
-
this.console.info(message, ...args);
|
|
155
|
-
}
|
|
156
|
-
success(message, ...args) {
|
|
157
|
-
if (isEnvTest() || this._silent) return;
|
|
158
|
-
if (this._jsonMode) return;
|
|
159
|
-
this.console.success(message, ...args);
|
|
160
|
-
}
|
|
161
|
-
warn(message, ...args) {
|
|
162
|
-
if (isEnvTest() || this._silent) return;
|
|
163
|
-
if (this._jsonMode) return;
|
|
164
|
-
this.console.warn(message, ...args);
|
|
165
|
-
}
|
|
166
|
-
error(message, code, ...args) {
|
|
167
|
-
if (isEnvTest()) return;
|
|
168
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
169
|
-
if (this._jsonMode) {
|
|
170
|
-
const errorInfo = {
|
|
171
|
-
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
172
|
-
message: errorMessage
|
|
173
|
-
};
|
|
174
|
-
if (this._verbose && message instanceof Error && message.stack) {
|
|
175
|
-
errorInfo.stack = message.stack;
|
|
176
|
-
}
|
|
177
|
-
this.outputJson(false, errorInfo);
|
|
178
|
-
} else {
|
|
179
|
-
this.console.error(errorMessage, ...args);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
debug(message, ...args) {
|
|
183
|
-
if (isEnvTest() || this._silent) return;
|
|
184
|
-
if (this._jsonMode) return;
|
|
185
|
-
if (this._verbose) {
|
|
186
|
-
this.console.info(message, ...args);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Get the internal console instance (for testing only)
|
|
191
|
-
* @internal
|
|
192
|
-
*/
|
|
193
|
-
_getConsole() {
|
|
194
|
-
return this.console;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
function createLogger(version) {
|
|
198
|
-
return new Logger(version);
|
|
199
|
-
}
|
|
200
|
-
var logger = new Logger("0.0.0");
|
|
201
|
-
|
|
202
18
|
// src/types/features.ts
|
|
203
19
|
import { z } from "zod/mini";
|
|
204
20
|
var ALL_FEATURES = [
|
|
@@ -231,6 +47,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
231
47
|
"cline",
|
|
232
48
|
"codexcli",
|
|
233
49
|
"copilot",
|
|
50
|
+
"copilotcli",
|
|
234
51
|
"cursor",
|
|
235
52
|
"factorydroid",
|
|
236
53
|
"geminicli",
|
|
@@ -288,6 +105,13 @@ import os from "os";
|
|
|
288
105
|
import { dirname, join as join2, relative, resolve } from "path";
|
|
289
106
|
import { kebabCase } from "es-toolkit";
|
|
290
107
|
import { globbySync } from "globby";
|
|
108
|
+
|
|
109
|
+
// src/utils/vitest.ts
|
|
110
|
+
function isEnvTest() {
|
|
111
|
+
return process.env.NODE_ENV === "test";
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/utils/file.ts
|
|
291
115
|
async function ensureDir(dirPath) {
|
|
292
116
|
try {
|
|
293
117
|
await stat(dirPath);
|
|
@@ -332,7 +156,6 @@ async function directoryExists(dirPath) {
|
|
|
332
156
|
}
|
|
333
157
|
}
|
|
334
158
|
async function readFileContent(filepath) {
|
|
335
|
-
logger.debug(`Reading file: ${filepath}`);
|
|
336
159
|
return readFile(filepath, "utf-8");
|
|
337
160
|
}
|
|
338
161
|
async function readFileContentOrNull(filepath) {
|
|
@@ -342,7 +165,6 @@ async function readFileContentOrNull(filepath) {
|
|
|
342
165
|
return null;
|
|
343
166
|
}
|
|
344
167
|
async function readFileBuffer(filepath) {
|
|
345
|
-
logger.debug(`Reading file buffer: ${filepath}`);
|
|
346
168
|
return readFile(filepath);
|
|
347
169
|
}
|
|
348
170
|
function addTrailingNewline(content) {
|
|
@@ -352,7 +174,6 @@ function addTrailingNewline(content) {
|
|
|
352
174
|
return content.trimEnd() + "\n";
|
|
353
175
|
}
|
|
354
176
|
async function writeFileContent(filepath, content) {
|
|
355
|
-
logger.debug(`Writing file: ${filepath}`);
|
|
356
177
|
await ensureDir(dirname(filepath));
|
|
357
178
|
await writeFile(filepath, content, "utf-8");
|
|
358
179
|
}
|
|
@@ -403,25 +224,21 @@ async function findFilesByGlobs(globs, options = {}) {
|
|
|
403
224
|
async function removeDirectory(dirPath) {
|
|
404
225
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
405
226
|
if (dangerousPaths.includes(dirPath) || dirPath === "") {
|
|
406
|
-
logger.warn(`Skipping deletion of dangerous path: ${dirPath}`);
|
|
407
227
|
return;
|
|
408
228
|
}
|
|
409
229
|
try {
|
|
410
230
|
if (await fileExists(dirPath)) {
|
|
411
231
|
await rm(dirPath, { recursive: true, force: true });
|
|
412
232
|
}
|
|
413
|
-
} catch
|
|
414
|
-
logger.warn(`Failed to remove directory ${dirPath}:`, error);
|
|
233
|
+
} catch {
|
|
415
234
|
}
|
|
416
235
|
}
|
|
417
236
|
async function removeFile(filepath) {
|
|
418
|
-
logger.debug(`Removing file: ${filepath}`);
|
|
419
237
|
try {
|
|
420
238
|
if (await fileExists(filepath)) {
|
|
421
239
|
await rm(filepath);
|
|
422
240
|
}
|
|
423
|
-
} catch
|
|
424
|
-
logger.warn(`Failed to remove file ${filepath}:`, error);
|
|
241
|
+
} catch {
|
|
425
242
|
}
|
|
426
243
|
}
|
|
427
244
|
function getHomeDirectory() {
|
|
@@ -455,9 +272,7 @@ async function createTempDirectory(prefix = "rulesync-fetch-") {
|
|
|
455
272
|
async function removeTempDirectory(tempDir) {
|
|
456
273
|
try {
|
|
457
274
|
await rm(tempDir, { recursive: true, force: true });
|
|
458
|
-
logger.debug(`Removed temp directory: ${tempDir}`);
|
|
459
275
|
} catch {
|
|
460
|
-
logger.debug(`Failed to clean up temp directory: ${tempDir}`);
|
|
461
276
|
}
|
|
462
277
|
}
|
|
463
278
|
|
|
@@ -695,16 +510,11 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
695
510
|
if (!await fileExists(filePath)) {
|
|
696
511
|
return {};
|
|
697
512
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
return configParams;
|
|
704
|
-
} catch (error) {
|
|
705
|
-
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
706
|
-
throw error;
|
|
707
|
-
}
|
|
513
|
+
const fileContent = await readFileContent(filePath);
|
|
514
|
+
const jsonData = parseJsonc(fileContent);
|
|
515
|
+
const parsed = ConfigFileSchema.parse(jsonData);
|
|
516
|
+
const { $schema: _schema, ...configParams } = parsed;
|
|
517
|
+
return configParams;
|
|
708
518
|
};
|
|
709
519
|
var mergeConfigs = (baseConfig, localConfig) => {
|
|
710
520
|
return {
|
|
@@ -785,7 +595,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
785
595
|
}
|
|
786
596
|
|
|
787
597
|
// src/lib/generate.ts
|
|
788
|
-
import { join as
|
|
598
|
+
import { join as join118 } from "path";
|
|
789
599
|
import { intersection } from "es-toolkit";
|
|
790
600
|
|
|
791
601
|
// src/features/commands/commands-processor.ts
|
|
@@ -796,9 +606,15 @@ import { z as z14 } from "zod/mini";
|
|
|
796
606
|
var FeatureProcessor = class {
|
|
797
607
|
baseDir;
|
|
798
608
|
dryRun;
|
|
799
|
-
|
|
609
|
+
logger;
|
|
610
|
+
constructor({
|
|
611
|
+
baseDir = process.cwd(),
|
|
612
|
+
dryRun = false,
|
|
613
|
+
logger
|
|
614
|
+
}) {
|
|
800
615
|
this.baseDir = baseDir;
|
|
801
616
|
this.dryRun = dryRun;
|
|
617
|
+
this.logger = logger;
|
|
802
618
|
}
|
|
803
619
|
/**
|
|
804
620
|
* Return tool targets that this feature supports.
|
|
@@ -821,7 +637,7 @@ var FeatureProcessor = class {
|
|
|
821
637
|
continue;
|
|
822
638
|
}
|
|
823
639
|
if (this.dryRun) {
|
|
824
|
-
logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
640
|
+
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
825
641
|
} else {
|
|
826
642
|
await writeFileContent(filePath, contentWithNewline);
|
|
827
643
|
}
|
|
@@ -845,7 +661,7 @@ var FeatureProcessor = class {
|
|
|
845
661
|
for (const aiFile of orphanFiles) {
|
|
846
662
|
const filePath = aiFile.getFilePath();
|
|
847
663
|
if (this.dryRun) {
|
|
848
|
-
logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
664
|
+
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
849
665
|
} else {
|
|
850
666
|
await removeFile(filePath);
|
|
851
667
|
}
|
|
@@ -3217,9 +3033,10 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3217
3033
|
toolTarget,
|
|
3218
3034
|
global = false,
|
|
3219
3035
|
getFactory = defaultGetFactory,
|
|
3220
|
-
dryRun = false
|
|
3036
|
+
dryRun = false,
|
|
3037
|
+
logger
|
|
3221
3038
|
}) {
|
|
3222
|
-
super({ baseDir, dryRun });
|
|
3039
|
+
super({ baseDir, dryRun, logger });
|
|
3223
3040
|
const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3224
3041
|
if (!result.success) {
|
|
3225
3042
|
throw new Error(
|
|
@@ -3246,7 +3063,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3246
3063
|
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
3247
3064
|
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
3248
3065
|
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
3249
|
-
logger.warn(
|
|
3066
|
+
this.logger.warn(
|
|
3250
3067
|
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}". Only the last processed command will be used.`
|
|
3251
3068
|
);
|
|
3252
3069
|
} else if (!firstOrigin) {
|
|
@@ -3292,7 +3109,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3292
3109
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
3293
3110
|
)
|
|
3294
3111
|
);
|
|
3295
|
-
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3112
|
+
this.logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3296
3113
|
return rulesyncCommands;
|
|
3297
3114
|
}
|
|
3298
3115
|
/**
|
|
@@ -3316,7 +3133,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3316
3133
|
global: this.global
|
|
3317
3134
|
})
|
|
3318
3135
|
).filter((cmd) => cmd.isDeletable());
|
|
3319
|
-
logger.debug(
|
|
3136
|
+
this.logger.debug(
|
|
3137
|
+
`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`
|
|
3138
|
+
);
|
|
3320
3139
|
return toolCommands2;
|
|
3321
3140
|
}
|
|
3322
3141
|
const toolCommands = await Promise.all(
|
|
@@ -3328,7 +3147,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3328
3147
|
})
|
|
3329
3148
|
)
|
|
3330
3149
|
);
|
|
3331
|
-
logger.debug(
|
|
3150
|
+
this.logger.debug(
|
|
3151
|
+
`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`
|
|
3152
|
+
);
|
|
3332
3153
|
return toolCommands;
|
|
3333
3154
|
}
|
|
3334
3155
|
/**
|
|
@@ -3597,7 +3418,8 @@ function isToolMatcherEntry(x) {
|
|
|
3597
3418
|
function canonicalToToolHooks({
|
|
3598
3419
|
config,
|
|
3599
3420
|
toolOverrideHooks,
|
|
3600
|
-
converterConfig
|
|
3421
|
+
converterConfig,
|
|
3422
|
+
logger
|
|
3601
3423
|
}) {
|
|
3602
3424
|
const supported = new Set(converterConfig.supportedEvents);
|
|
3603
3425
|
const sharedHooks = {};
|
|
@@ -3624,7 +3446,7 @@ function canonicalToToolHooks({
|
|
|
3624
3446
|
const isNoMatcherEvent = converterConfig.noMatcherEvents?.has(eventName) ?? false;
|
|
3625
3447
|
for (const [matcherKey, defs] of byMatcher) {
|
|
3626
3448
|
if (isNoMatcherEvent && matcherKey) {
|
|
3627
|
-
logger
|
|
3449
|
+
logger?.warn(
|
|
3628
3450
|
`matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
|
|
3629
3451
|
);
|
|
3630
3452
|
}
|
|
@@ -3821,7 +3643,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3821
3643
|
baseDir = process.cwd(),
|
|
3822
3644
|
rulesyncHooks,
|
|
3823
3645
|
validate = true,
|
|
3824
|
-
global = false
|
|
3646
|
+
global = false,
|
|
3647
|
+
logger
|
|
3825
3648
|
}) {
|
|
3826
3649
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3827
3650
|
const filePath = join22(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -3842,7 +3665,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3842
3665
|
const claudeHooks = canonicalToToolHooks({
|
|
3843
3666
|
config,
|
|
3844
3667
|
toolOverrideHooks: config.claudecode?.hooks,
|
|
3845
|
-
converterConfig: CLAUDE_CONVERTER_CONFIG
|
|
3668
|
+
converterConfig: CLAUDE_CONVERTER_CONFIG,
|
|
3669
|
+
logger
|
|
3846
3670
|
});
|
|
3847
3671
|
const merged = { ...settings, hooks: claudeHooks };
|
|
3848
3672
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -3942,14 +3766,14 @@ function canonicalToCopilotHooks(config) {
|
|
|
3942
3766
|
}
|
|
3943
3767
|
return copilot;
|
|
3944
3768
|
}
|
|
3945
|
-
function resolveImportCommand(entry) {
|
|
3769
|
+
function resolveImportCommand(entry, logger) {
|
|
3946
3770
|
const hasBash = typeof entry.bash === "string";
|
|
3947
3771
|
const hasPowershell = typeof entry.powershell === "string";
|
|
3948
3772
|
if (hasBash && hasPowershell) {
|
|
3949
3773
|
const isWindows = process.platform === "win32";
|
|
3950
3774
|
const chosen = isWindows ? "powershell" : "bash";
|
|
3951
3775
|
const ignored = isWindows ? "bash" : "powershell";
|
|
3952
|
-
logger
|
|
3776
|
+
logger?.warn(
|
|
3953
3777
|
`Copilot hook has both bash and powershell commands; using ${chosen} and ignoring ${ignored} on this platform.`
|
|
3954
3778
|
);
|
|
3955
3779
|
return isWindows ? entry.powershell : entry.bash;
|
|
@@ -3960,7 +3784,7 @@ function resolveImportCommand(entry) {
|
|
|
3960
3784
|
}
|
|
3961
3785
|
return void 0;
|
|
3962
3786
|
}
|
|
3963
|
-
function copilotHooksToCanonical(copilotHooks) {
|
|
3787
|
+
function copilotHooksToCanonical(copilotHooks, logger) {
|
|
3964
3788
|
if (copilotHooks === null || copilotHooks === void 0 || typeof copilotHooks !== "object") {
|
|
3965
3789
|
return {};
|
|
3966
3790
|
}
|
|
@@ -3973,7 +3797,7 @@ function copilotHooksToCanonical(copilotHooks) {
|
|
|
3973
3797
|
const parseResult = CopilotHookEntrySchema.safeParse(rawEntry);
|
|
3974
3798
|
if (!parseResult.success) continue;
|
|
3975
3799
|
const entry = parseResult.data;
|
|
3976
|
-
const command = resolveImportCommand(entry);
|
|
3800
|
+
const command = resolveImportCommand(entry, logger);
|
|
3977
3801
|
const timeout = entry.timeoutSec;
|
|
3978
3802
|
defs.push({
|
|
3979
3803
|
type: "command",
|
|
@@ -4033,7 +3857,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4033
3857
|
validate
|
|
4034
3858
|
});
|
|
4035
3859
|
}
|
|
4036
|
-
toRulesyncHooks() {
|
|
3860
|
+
toRulesyncHooks(options) {
|
|
4037
3861
|
let parsed;
|
|
4038
3862
|
try {
|
|
4039
3863
|
parsed = JSON.parse(this.getFileContent());
|
|
@@ -4045,7 +3869,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4045
3869
|
}
|
|
4046
3870
|
);
|
|
4047
3871
|
}
|
|
4048
|
-
const hooks = copilotHooksToCanonical(parsed.hooks);
|
|
3872
|
+
const hooks = copilotHooksToCanonical(parsed.hooks, options?.logger);
|
|
4049
3873
|
return this.toRulesyncHooksDefault({
|
|
4050
3874
|
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
4051
3875
|
});
|
|
@@ -4217,7 +4041,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4217
4041
|
baseDir = process.cwd(),
|
|
4218
4042
|
rulesyncHooks,
|
|
4219
4043
|
validate = true,
|
|
4220
|
-
global = false
|
|
4044
|
+
global = false,
|
|
4045
|
+
logger
|
|
4221
4046
|
}) {
|
|
4222
4047
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
4223
4048
|
const filePath = join25(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -4238,7 +4063,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4238
4063
|
const factorydroidHooks = canonicalToToolHooks({
|
|
4239
4064
|
config,
|
|
4240
4065
|
toolOverrideHooks: config.factorydroid?.hooks,
|
|
4241
|
-
converterConfig: FACTORYDROID_CONVERTER_CONFIG
|
|
4066
|
+
converterConfig: FACTORYDROID_CONVERTER_CONFIG,
|
|
4067
|
+
logger
|
|
4242
4068
|
});
|
|
4243
4069
|
const merged = { ...settings, hooks: factorydroidHooks };
|
|
4244
4070
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -4737,9 +4563,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4737
4563
|
baseDir = process.cwd(),
|
|
4738
4564
|
toolTarget,
|
|
4739
4565
|
global = false,
|
|
4740
|
-
dryRun = false
|
|
4566
|
+
dryRun = false,
|
|
4567
|
+
logger
|
|
4741
4568
|
}) {
|
|
4742
|
-
super({ baseDir, dryRun });
|
|
4569
|
+
super({ baseDir, dryRun, logger });
|
|
4743
4570
|
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
4744
4571
|
if (!result.success) {
|
|
4745
4572
|
throw new Error(
|
|
@@ -4758,7 +4585,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4758
4585
|
})
|
|
4759
4586
|
];
|
|
4760
4587
|
} catch (error) {
|
|
4761
|
-
logger.error(
|
|
4588
|
+
this.logger.error(
|
|
4762
4589
|
`Failed to load Rulesync hooks file (${RULESYNC_HOOKS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
4763
4590
|
);
|
|
4764
4591
|
return [];
|
|
@@ -4777,7 +4604,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4777
4604
|
global: this.global
|
|
4778
4605
|
});
|
|
4779
4606
|
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
4780
|
-
logger.debug(
|
|
4607
|
+
this.logger.debug(
|
|
4781
4608
|
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
4782
4609
|
);
|
|
4783
4610
|
return list;
|
|
@@ -4787,14 +4614,14 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4787
4614
|
validate: true,
|
|
4788
4615
|
global: this.global
|
|
4789
4616
|
});
|
|
4790
|
-
logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4617
|
+
this.logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4791
4618
|
return [toolHooks];
|
|
4792
4619
|
} catch (error) {
|
|
4793
4620
|
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
4794
4621
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
4795
|
-
logger.debug(msg);
|
|
4622
|
+
this.logger.debug(msg);
|
|
4796
4623
|
} else {
|
|
4797
|
-
logger.error(msg);
|
|
4624
|
+
this.logger.error(msg);
|
|
4798
4625
|
}
|
|
4799
4626
|
return [];
|
|
4800
4627
|
}
|
|
@@ -4815,7 +4642,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4815
4642
|
const configEventNames = new Set(Object.keys(effectiveHooks));
|
|
4816
4643
|
const skipped = [...configEventNames].filter((e) => !supportedEvents.has(e));
|
|
4817
4644
|
if (skipped.length > 0) {
|
|
4818
|
-
logger.warn(
|
|
4645
|
+
this.logger.warn(
|
|
4819
4646
|
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
4820
4647
|
);
|
|
4821
4648
|
}
|
|
@@ -4834,7 +4661,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4834
4661
|
}
|
|
4835
4662
|
}
|
|
4836
4663
|
for (const [hookType, events] of unsupportedTypeToEvents) {
|
|
4837
|
-
logger.warn(
|
|
4664
|
+
this.logger.warn(
|
|
4838
4665
|
`Skipped ${hookType}-type hook(s) for ${this.toolTarget} (not supported): ${Array.from(events).join(", ")}`
|
|
4839
4666
|
);
|
|
4840
4667
|
}
|
|
@@ -4849,7 +4676,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4849
4676
|
}
|
|
4850
4677
|
}
|
|
4851
4678
|
if (eventsWithMatcher.size > 0) {
|
|
4852
|
-
logger.warn(
|
|
4679
|
+
this.logger.warn(
|
|
4853
4680
|
`Skipped matcher hook(s) for ${this.toolTarget} (not supported): ${Array.from(eventsWithMatcher).join(", ")}`
|
|
4854
4681
|
);
|
|
4855
4682
|
}
|
|
@@ -5911,9 +5738,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5911
5738
|
baseDir = process.cwd(),
|
|
5912
5739
|
toolTarget,
|
|
5913
5740
|
getFactory = defaultGetFactory2,
|
|
5914
|
-
dryRun = false
|
|
5741
|
+
dryRun = false,
|
|
5742
|
+
logger
|
|
5915
5743
|
}) {
|
|
5916
|
-
super({ baseDir, dryRun });
|
|
5744
|
+
super({ baseDir, dryRun, logger });
|
|
5917
5745
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
5918
5746
|
if (!result.success) {
|
|
5919
5747
|
throw new Error(
|
|
@@ -5935,7 +5763,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5935
5763
|
try {
|
|
5936
5764
|
return [await RulesyncIgnore.fromFile()];
|
|
5937
5765
|
} catch (error) {
|
|
5938
|
-
logger.error(
|
|
5766
|
+
this.logger.error(
|
|
5939
5767
|
`Failed to load rulesync ignore file (${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
5940
5768
|
);
|
|
5941
5769
|
return [];
|
|
@@ -5965,9 +5793,9 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5965
5793
|
} catch (error) {
|
|
5966
5794
|
const errorMessage = `Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`;
|
|
5967
5795
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
5968
|
-
logger.debug(errorMessage);
|
|
5796
|
+
this.logger.debug(errorMessage);
|
|
5969
5797
|
} else {
|
|
5970
|
-
logger.error(errorMessage);
|
|
5798
|
+
this.logger.error(errorMessage);
|
|
5971
5799
|
}
|
|
5972
5800
|
return [];
|
|
5973
5801
|
}
|
|
@@ -6097,7 +5925,10 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6097
5925
|
}
|
|
6098
5926
|
return { success: true, error: null };
|
|
6099
5927
|
}
|
|
6100
|
-
static async fromFile({
|
|
5928
|
+
static async fromFile({
|
|
5929
|
+
validate = true,
|
|
5930
|
+
logger
|
|
5931
|
+
}) {
|
|
6101
5932
|
const baseDir = process.cwd();
|
|
6102
5933
|
const paths = this.getSettablePaths();
|
|
6103
5934
|
const recommendedPath = join42(
|
|
@@ -6117,7 +5948,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6117
5948
|
});
|
|
6118
5949
|
}
|
|
6119
5950
|
if (await fileExists(legacyPath)) {
|
|
6120
|
-
logger
|
|
5951
|
+
logger?.warn(
|
|
6121
5952
|
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
6122
5953
|
);
|
|
6123
5954
|
const fileContent2 = await readFileContent(legacyPath);
|
|
@@ -6619,75 +6450,74 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6619
6450
|
}
|
|
6620
6451
|
};
|
|
6621
6452
|
|
|
6622
|
-
// src/features/mcp/
|
|
6453
|
+
// src/features/mcp/copilotcli-mcp.ts
|
|
6623
6454
|
import { join as join47 } from "path";
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
}
|
|
6455
|
+
function addTypeField(mcpServers) {
|
|
6456
|
+
const result = {};
|
|
6457
|
+
for (const [name, server] of Object.entries(mcpServers)) {
|
|
6458
|
+
const parsed = McpServerSchema.parse(server);
|
|
6459
|
+
if (!parsed.command) {
|
|
6460
|
+
throw new Error(
|
|
6461
|
+
`MCP server "${name}" is missing a command. GitHub Copilot CLI stdio servers require a non-empty command.`
|
|
6462
|
+
);
|
|
6463
|
+
}
|
|
6464
|
+
let command;
|
|
6465
|
+
let args;
|
|
6466
|
+
if (typeof parsed.command === "string") {
|
|
6467
|
+
command = parsed.command;
|
|
6468
|
+
args = parsed.args;
|
|
6469
|
+
} else {
|
|
6470
|
+
const [cmd, ...cmdArgs] = parsed.command;
|
|
6471
|
+
if (!cmd) {
|
|
6472
|
+
throw new Error(`MCP server "${name}" has an empty command array.`);
|
|
6642
6473
|
}
|
|
6643
|
-
|
|
6644
|
-
|
|
6474
|
+
command = cmd;
|
|
6475
|
+
args = cmdArgs.length > 0 ? [...cmdArgs, ...parsed.args ?? []] : parsed.args;
|
|
6476
|
+
}
|
|
6477
|
+
result[name] = {
|
|
6478
|
+
type: "stdio",
|
|
6479
|
+
command,
|
|
6480
|
+
...args && { args },
|
|
6481
|
+
...parsed.env && { env: parsed.env }
|
|
6482
|
+
};
|
|
6483
|
+
}
|
|
6484
|
+
return result;
|
|
6645
6485
|
}
|
|
6646
|
-
function
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
env: Object.fromEntries(
|
|
6654
|
-
Object.entries(config.env).map(([k, v]) => [
|
|
6655
|
-
k,
|
|
6656
|
-
v.replace(/\$\{(?!env:)([^}:]+)\}/g, "${env:$1}")
|
|
6657
|
-
])
|
|
6658
|
-
)
|
|
6659
|
-
}
|
|
6660
|
-
}
|
|
6661
|
-
])
|
|
6662
|
-
);
|
|
6486
|
+
function removeTypeField(config) {
|
|
6487
|
+
const result = {};
|
|
6488
|
+
for (const [name, server] of Object.entries(config.mcpServers ?? {})) {
|
|
6489
|
+
const { type: _, ...rest } = server;
|
|
6490
|
+
result[name] = rest;
|
|
6491
|
+
}
|
|
6492
|
+
return result;
|
|
6663
6493
|
}
|
|
6664
|
-
var
|
|
6494
|
+
var CopilotcliMcp = class _CopilotcliMcp extends ToolMcp {
|
|
6665
6495
|
json;
|
|
6666
6496
|
constructor(params) {
|
|
6667
6497
|
super(params);
|
|
6668
|
-
|
|
6669
|
-
try {
|
|
6670
|
-
this.json = JSON.parse(this.fileContent);
|
|
6671
|
-
} catch (error) {
|
|
6672
|
-
throw new Error(
|
|
6673
|
-
`Failed to parse Cursor MCP config at ${join47(this.relativeDirPath, this.relativeFilePath)}: ${formatError(error)}`,
|
|
6674
|
-
{ cause: error }
|
|
6675
|
-
);
|
|
6676
|
-
}
|
|
6677
|
-
} else {
|
|
6678
|
-
this.json = {};
|
|
6679
|
-
}
|
|
6498
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
6680
6499
|
}
|
|
6681
6500
|
getJson() {
|
|
6682
6501
|
return this.json;
|
|
6683
6502
|
}
|
|
6503
|
+
/**
|
|
6504
|
+
* In global mode, ~/.copilot/mcp-config.json should not be deleted
|
|
6505
|
+
* as it may contain other user settings.
|
|
6506
|
+
* In local mode, .copilot/mcp-config.json can be safely deleted.
|
|
6507
|
+
*/
|
|
6684
6508
|
isDeletable() {
|
|
6685
6509
|
return !this.global;
|
|
6686
6510
|
}
|
|
6687
|
-
static getSettablePaths(
|
|
6511
|
+
static getSettablePaths({ global } = {}) {
|
|
6512
|
+
if (global) {
|
|
6513
|
+
return {
|
|
6514
|
+
relativeDirPath: ".copilot",
|
|
6515
|
+
relativeFilePath: "mcp-config.json"
|
|
6516
|
+
};
|
|
6517
|
+
}
|
|
6688
6518
|
return {
|
|
6689
|
-
relativeDirPath: ".
|
|
6690
|
-
relativeFilePath: "mcp.json"
|
|
6519
|
+
relativeDirPath: ".copilot",
|
|
6520
|
+
relativeFilePath: "mcp-config.json"
|
|
6691
6521
|
};
|
|
6692
6522
|
}
|
|
6693
6523
|
static async fromFile({
|
|
@@ -6696,19 +6526,10 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6696
6526
|
global = false
|
|
6697
6527
|
}) {
|
|
6698
6528
|
const paths = this.getSettablePaths({ global });
|
|
6699
|
-
const
|
|
6700
|
-
const
|
|
6701
|
-
let json;
|
|
6702
|
-
try {
|
|
6703
|
-
json = JSON.parse(fileContent);
|
|
6704
|
-
} catch (error) {
|
|
6705
|
-
throw new Error(
|
|
6706
|
-
`Failed to parse Cursor MCP config at ${join47(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6707
|
-
{ cause: error }
|
|
6708
|
-
);
|
|
6709
|
-
}
|
|
6529
|
+
const fileContent = await readFileContentOrNull(join47(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6530
|
+
const json = JSON.parse(fileContent);
|
|
6710
6531
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6711
|
-
return new
|
|
6532
|
+
return new _CopilotcliMcp({
|
|
6712
6533
|
baseDir,
|
|
6713
6534
|
relativeDirPath: paths.relativeDirPath,
|
|
6714
6535
|
relativeFilePath: paths.relativeFilePath,
|
|
@@ -6728,12 +6549,159 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6728
6549
|
join47(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6729
6550
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6730
6551
|
);
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6552
|
+
const json = JSON.parse(fileContent);
|
|
6553
|
+
const copilotCliMcpServers = addTypeField(rulesyncMcp.getMcpServers());
|
|
6554
|
+
const mcpJson = { ...json, mcpServers: copilotCliMcpServers };
|
|
6555
|
+
return new _CopilotcliMcp({
|
|
6556
|
+
baseDir,
|
|
6557
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6558
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6559
|
+
fileContent: JSON.stringify(mcpJson, null, 2),
|
|
6560
|
+
validate,
|
|
6561
|
+
global
|
|
6562
|
+
});
|
|
6563
|
+
}
|
|
6564
|
+
toRulesyncMcp() {
|
|
6565
|
+
const mcpServers = removeTypeField(this.json);
|
|
6566
|
+
return this.toRulesyncMcpDefault({
|
|
6567
|
+
fileContent: JSON.stringify({ mcpServers }, null, 2)
|
|
6568
|
+
});
|
|
6569
|
+
}
|
|
6570
|
+
validate() {
|
|
6571
|
+
return { success: true, error: null };
|
|
6572
|
+
}
|
|
6573
|
+
static forDeletion({
|
|
6574
|
+
baseDir = process.cwd(),
|
|
6575
|
+
relativeDirPath,
|
|
6576
|
+
relativeFilePath,
|
|
6577
|
+
global = false
|
|
6578
|
+
}) {
|
|
6579
|
+
return new _CopilotcliMcp({
|
|
6580
|
+
baseDir,
|
|
6581
|
+
relativeDirPath,
|
|
6582
|
+
relativeFilePath,
|
|
6583
|
+
fileContent: "{}",
|
|
6584
|
+
validate: false,
|
|
6585
|
+
global
|
|
6586
|
+
});
|
|
6587
|
+
}
|
|
6588
|
+
};
|
|
6589
|
+
|
|
6590
|
+
// src/features/mcp/cursor-mcp.ts
|
|
6591
|
+
import { join as join48 } from "path";
|
|
6592
|
+
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6593
|
+
function isMcpServers(value) {
|
|
6594
|
+
return value !== void 0 && value !== null && typeof value === "object";
|
|
6595
|
+
}
|
|
6596
|
+
function convertEnvFromCursorFormat(mcpServers) {
|
|
6597
|
+
return Object.fromEntries(
|
|
6598
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
6599
|
+
name,
|
|
6600
|
+
{
|
|
6601
|
+
...config,
|
|
6602
|
+
...config.env && {
|
|
6603
|
+
env: Object.fromEntries(
|
|
6604
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
6605
|
+
k,
|
|
6606
|
+
v.replace(CURSOR_ENV_VAR_PATTERN, "${$1}")
|
|
6607
|
+
])
|
|
6608
|
+
)
|
|
6609
|
+
}
|
|
6610
|
+
}
|
|
6611
|
+
])
|
|
6612
|
+
);
|
|
6613
|
+
}
|
|
6614
|
+
function convertEnvToCursorFormat(mcpServers) {
|
|
6615
|
+
return Object.fromEntries(
|
|
6616
|
+
Object.entries(mcpServers).map(([name, config]) => [
|
|
6617
|
+
name,
|
|
6618
|
+
{
|
|
6619
|
+
...config,
|
|
6620
|
+
...config.env && {
|
|
6621
|
+
env: Object.fromEntries(
|
|
6622
|
+
Object.entries(config.env).map(([k, v]) => [
|
|
6623
|
+
k,
|
|
6624
|
+
v.replace(/\$\{(?!env:)([^}:]+)\}/g, "${env:$1}")
|
|
6625
|
+
])
|
|
6626
|
+
)
|
|
6627
|
+
}
|
|
6628
|
+
}
|
|
6629
|
+
])
|
|
6630
|
+
);
|
|
6631
|
+
}
|
|
6632
|
+
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
6633
|
+
json;
|
|
6634
|
+
constructor(params) {
|
|
6635
|
+
super(params);
|
|
6636
|
+
if (this.fileContent !== void 0) {
|
|
6637
|
+
try {
|
|
6638
|
+
this.json = JSON.parse(this.fileContent);
|
|
6639
|
+
} catch (error) {
|
|
6640
|
+
throw new Error(
|
|
6641
|
+
`Failed to parse Cursor MCP config at ${join48(this.relativeDirPath, this.relativeFilePath)}: ${formatError(error)}`,
|
|
6642
|
+
{ cause: error }
|
|
6643
|
+
);
|
|
6644
|
+
}
|
|
6645
|
+
} else {
|
|
6646
|
+
this.json = {};
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
getJson() {
|
|
6650
|
+
return this.json;
|
|
6651
|
+
}
|
|
6652
|
+
isDeletable() {
|
|
6653
|
+
return !this.global;
|
|
6654
|
+
}
|
|
6655
|
+
static getSettablePaths(_options) {
|
|
6656
|
+
return {
|
|
6657
|
+
relativeDirPath: ".cursor",
|
|
6658
|
+
relativeFilePath: "mcp.json"
|
|
6659
|
+
};
|
|
6660
|
+
}
|
|
6661
|
+
static async fromFile({
|
|
6662
|
+
baseDir = process.cwd(),
|
|
6663
|
+
validate = true,
|
|
6664
|
+
global = false
|
|
6665
|
+
}) {
|
|
6666
|
+
const paths = this.getSettablePaths({ global });
|
|
6667
|
+
const filePath = join48(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6668
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"mcpServers":{}}';
|
|
6669
|
+
let json;
|
|
6670
|
+
try {
|
|
6671
|
+
json = JSON.parse(fileContent);
|
|
6672
|
+
} catch (error) {
|
|
6673
|
+
throw new Error(
|
|
6674
|
+
`Failed to parse Cursor MCP config at ${join48(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6675
|
+
{ cause: error }
|
|
6676
|
+
);
|
|
6677
|
+
}
|
|
6678
|
+
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6679
|
+
return new _CursorMcp({
|
|
6680
|
+
baseDir,
|
|
6681
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6682
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6683
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
6684
|
+
validate,
|
|
6685
|
+
global
|
|
6686
|
+
});
|
|
6687
|
+
}
|
|
6688
|
+
static async fromRulesyncMcp({
|
|
6689
|
+
baseDir = process.cwd(),
|
|
6690
|
+
rulesyncMcp,
|
|
6691
|
+
validate = true,
|
|
6692
|
+
global = false
|
|
6693
|
+
}) {
|
|
6694
|
+
const paths = this.getSettablePaths({ global });
|
|
6695
|
+
const fileContent = await readOrInitializeFileContent(
|
|
6696
|
+
join48(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6697
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6698
|
+
);
|
|
6699
|
+
let json;
|
|
6700
|
+
try {
|
|
6701
|
+
json = JSON.parse(fileContent);
|
|
6734
6702
|
} catch (error) {
|
|
6735
6703
|
throw new Error(
|
|
6736
|
-
`Failed to parse Cursor MCP config at ${
|
|
6704
|
+
`Failed to parse Cursor MCP config at ${join48(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6737
6705
|
{ cause: error }
|
|
6738
6706
|
);
|
|
6739
6707
|
}
|
|
@@ -6782,7 +6750,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6782
6750
|
};
|
|
6783
6751
|
|
|
6784
6752
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6785
|
-
import { join as
|
|
6753
|
+
import { join as join49 } from "path";
|
|
6786
6754
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6787
6755
|
json;
|
|
6788
6756
|
constructor(params) {
|
|
@@ -6803,7 +6771,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6803
6771
|
validate = true
|
|
6804
6772
|
}) {
|
|
6805
6773
|
const fileContent = await readFileContent(
|
|
6806
|
-
|
|
6774
|
+
join49(
|
|
6807
6775
|
baseDir,
|
|
6808
6776
|
this.getSettablePaths().relativeDirPath,
|
|
6809
6777
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6857,7 +6825,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6857
6825
|
};
|
|
6858
6826
|
|
|
6859
6827
|
// src/features/mcp/geminicli-mcp.ts
|
|
6860
|
-
import { join as
|
|
6828
|
+
import { join as join50 } from "path";
|
|
6861
6829
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6862
6830
|
json;
|
|
6863
6831
|
constructor(params) {
|
|
@@ -6885,7 +6853,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6885
6853
|
global = false
|
|
6886
6854
|
}) {
|
|
6887
6855
|
const paths = this.getSettablePaths({ global });
|
|
6888
|
-
const fileContent = await readFileContentOrNull(
|
|
6856
|
+
const fileContent = await readFileContentOrNull(join50(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6889
6857
|
const json = JSON.parse(fileContent);
|
|
6890
6858
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6891
6859
|
return new _GeminiCliMcp({
|
|
@@ -6904,7 +6872,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6904
6872
|
}) {
|
|
6905
6873
|
const paths = this.getSettablePaths({ global });
|
|
6906
6874
|
const fileContent = await readOrInitializeFileContent(
|
|
6907
|
-
|
|
6875
|
+
join50(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6908
6876
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6909
6877
|
);
|
|
6910
6878
|
const json = JSON.parse(fileContent);
|
|
@@ -6949,7 +6917,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6949
6917
|
};
|
|
6950
6918
|
|
|
6951
6919
|
// src/features/mcp/junie-mcp.ts
|
|
6952
|
-
import { join as
|
|
6920
|
+
import { join as join51 } from "path";
|
|
6953
6921
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6954
6922
|
json;
|
|
6955
6923
|
constructor(params) {
|
|
@@ -6961,7 +6929,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6961
6929
|
}
|
|
6962
6930
|
static getSettablePaths() {
|
|
6963
6931
|
return {
|
|
6964
|
-
relativeDirPath:
|
|
6932
|
+
relativeDirPath: join51(".junie", "mcp"),
|
|
6965
6933
|
relativeFilePath: "mcp.json"
|
|
6966
6934
|
};
|
|
6967
6935
|
}
|
|
@@ -6970,7 +6938,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6970
6938
|
validate = true
|
|
6971
6939
|
}) {
|
|
6972
6940
|
const fileContent = await readFileContent(
|
|
6973
|
-
|
|
6941
|
+
join51(
|
|
6974
6942
|
baseDir,
|
|
6975
6943
|
this.getSettablePaths().relativeDirPath,
|
|
6976
6944
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7019,7 +6987,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
7019
6987
|
};
|
|
7020
6988
|
|
|
7021
6989
|
// src/features/mcp/kilo-mcp.ts
|
|
7022
|
-
import { join as
|
|
6990
|
+
import { join as join52 } from "path";
|
|
7023
6991
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
7024
6992
|
json;
|
|
7025
6993
|
constructor(params) {
|
|
@@ -7040,7 +7008,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7040
7008
|
validate = true
|
|
7041
7009
|
}) {
|
|
7042
7010
|
const paths = this.getSettablePaths();
|
|
7043
|
-
const fileContent = await readFileContentOrNull(
|
|
7011
|
+
const fileContent = await readFileContentOrNull(join52(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7044
7012
|
return new _KiloMcp({
|
|
7045
7013
|
baseDir,
|
|
7046
7014
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7088,7 +7056,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7088
7056
|
};
|
|
7089
7057
|
|
|
7090
7058
|
// src/features/mcp/kiro-mcp.ts
|
|
7091
|
-
import { join as
|
|
7059
|
+
import { join as join53 } from "path";
|
|
7092
7060
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
7093
7061
|
json;
|
|
7094
7062
|
constructor(params) {
|
|
@@ -7100,7 +7068,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7100
7068
|
}
|
|
7101
7069
|
static getSettablePaths() {
|
|
7102
7070
|
return {
|
|
7103
|
-
relativeDirPath:
|
|
7071
|
+
relativeDirPath: join53(".kiro", "settings"),
|
|
7104
7072
|
relativeFilePath: "mcp.json"
|
|
7105
7073
|
};
|
|
7106
7074
|
}
|
|
@@ -7109,7 +7077,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7109
7077
|
validate = true
|
|
7110
7078
|
}) {
|
|
7111
7079
|
const paths = this.getSettablePaths();
|
|
7112
|
-
const fileContent = await readFileContentOrNull(
|
|
7080
|
+
const fileContent = await readFileContentOrNull(join53(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7113
7081
|
return new _KiroMcp({
|
|
7114
7082
|
baseDir,
|
|
7115
7083
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7157,7 +7125,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7157
7125
|
};
|
|
7158
7126
|
|
|
7159
7127
|
// src/features/mcp/opencode-mcp.ts
|
|
7160
|
-
import { join as
|
|
7128
|
+
import { join as join54 } from "path";
|
|
7161
7129
|
import { parse as parseJsonc2 } from "jsonc-parser";
|
|
7162
7130
|
import { z as z22 } from "zod/mini";
|
|
7163
7131
|
var OpencodeMcpLocalServerSchema = z22.object({
|
|
@@ -7298,7 +7266,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7298
7266
|
static getSettablePaths({ global } = {}) {
|
|
7299
7267
|
if (global) {
|
|
7300
7268
|
return {
|
|
7301
|
-
relativeDirPath:
|
|
7269
|
+
relativeDirPath: join54(".config", "opencode"),
|
|
7302
7270
|
relativeFilePath: "opencode.json"
|
|
7303
7271
|
};
|
|
7304
7272
|
}
|
|
@@ -7313,11 +7281,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7313
7281
|
global = false
|
|
7314
7282
|
}) {
|
|
7315
7283
|
const basePaths = this.getSettablePaths({ global });
|
|
7316
|
-
const jsonDir =
|
|
7284
|
+
const jsonDir = join54(baseDir, basePaths.relativeDirPath);
|
|
7317
7285
|
let fileContent = null;
|
|
7318
7286
|
let relativeFilePath = "opencode.jsonc";
|
|
7319
|
-
const jsoncPath =
|
|
7320
|
-
const jsonPath =
|
|
7287
|
+
const jsoncPath = join54(jsonDir, "opencode.jsonc");
|
|
7288
|
+
const jsonPath = join54(jsonDir, "opencode.json");
|
|
7321
7289
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7322
7290
|
if (!fileContent) {
|
|
7323
7291
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7343,11 +7311,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7343
7311
|
global = false
|
|
7344
7312
|
}) {
|
|
7345
7313
|
const basePaths = this.getSettablePaths({ global });
|
|
7346
|
-
const jsonDir =
|
|
7314
|
+
const jsonDir = join54(baseDir, basePaths.relativeDirPath);
|
|
7347
7315
|
let fileContent = null;
|
|
7348
7316
|
let relativeFilePath = "opencode.jsonc";
|
|
7349
|
-
const jsoncPath =
|
|
7350
|
-
const jsonPath =
|
|
7317
|
+
const jsoncPath = join54(jsonDir, "opencode.jsonc");
|
|
7318
|
+
const jsonPath = join54(jsonDir, "opencode.json");
|
|
7351
7319
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7352
7320
|
if (!fileContent) {
|
|
7353
7321
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7408,7 +7376,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7408
7376
|
};
|
|
7409
7377
|
|
|
7410
7378
|
// src/features/mcp/roo-mcp.ts
|
|
7411
|
-
import { join as
|
|
7379
|
+
import { join as join55 } from "path";
|
|
7412
7380
|
function isRooMcpServers(value) {
|
|
7413
7381
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7414
7382
|
}
|
|
@@ -7460,7 +7428,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7460
7428
|
validate = true
|
|
7461
7429
|
}) {
|
|
7462
7430
|
const fileContent = await readFileContent(
|
|
7463
|
-
|
|
7431
|
+
join55(
|
|
7464
7432
|
baseDir,
|
|
7465
7433
|
this.getSettablePaths().relativeDirPath,
|
|
7466
7434
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7522,6 +7490,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
7522
7490
|
"cline",
|
|
7523
7491
|
"codexcli",
|
|
7524
7492
|
"copilot",
|
|
7493
|
+
"copilotcli",
|
|
7525
7494
|
"cursor",
|
|
7526
7495
|
"factorydroid",
|
|
7527
7496
|
"geminicli",
|
|
@@ -7593,6 +7562,18 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
7593
7562
|
}
|
|
7594
7563
|
}
|
|
7595
7564
|
],
|
|
7565
|
+
[
|
|
7566
|
+
"copilotcli",
|
|
7567
|
+
{
|
|
7568
|
+
class: CopilotcliMcp,
|
|
7569
|
+
meta: {
|
|
7570
|
+
supportsProject: true,
|
|
7571
|
+
supportsGlobal: true,
|
|
7572
|
+
supportsEnabledTools: false,
|
|
7573
|
+
supportsDisabledTools: false
|
|
7574
|
+
}
|
|
7575
|
+
}
|
|
7576
|
+
],
|
|
7596
7577
|
[
|
|
7597
7578
|
"cursor",
|
|
7598
7579
|
{
|
|
@@ -7715,9 +7696,10 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7715
7696
|
toolTarget,
|
|
7716
7697
|
global = false,
|
|
7717
7698
|
getFactory = defaultGetFactory3,
|
|
7718
|
-
dryRun = false
|
|
7699
|
+
dryRun = false,
|
|
7700
|
+
logger
|
|
7719
7701
|
}) {
|
|
7720
|
-
super({ baseDir, dryRun });
|
|
7702
|
+
super({ baseDir, dryRun, logger });
|
|
7721
7703
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
7722
7704
|
if (!result.success) {
|
|
7723
7705
|
throw new Error(
|
|
@@ -7736,7 +7718,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7736
7718
|
try {
|
|
7737
7719
|
return [await RulesyncMcp.fromFile({})];
|
|
7738
7720
|
} catch (error) {
|
|
7739
|
-
logger.error(
|
|
7721
|
+
this.logger.error(
|
|
7740
7722
|
`Failed to load a Rulesync MCP file (${RULESYNC_MCP_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
7741
7723
|
);
|
|
7742
7724
|
return [];
|
|
@@ -7760,7 +7742,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7760
7742
|
global: this.global
|
|
7761
7743
|
});
|
|
7762
7744
|
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
7763
|
-
logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7745
|
+
this.logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7764
7746
|
return toolMcps2;
|
|
7765
7747
|
}
|
|
7766
7748
|
const toolMcps = [
|
|
@@ -7770,14 +7752,14 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7770
7752
|
global: this.global
|
|
7771
7753
|
})
|
|
7772
7754
|
];
|
|
7773
|
-
logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7755
|
+
this.logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7774
7756
|
return toolMcps;
|
|
7775
7757
|
} catch (error) {
|
|
7776
7758
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
7777
7759
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
7778
|
-
logger.debug(errorMessage);
|
|
7760
|
+
this.logger.debug(errorMessage);
|
|
7779
7761
|
} else {
|
|
7780
|
-
logger.error(errorMessage);
|
|
7762
|
+
this.logger.error(errorMessage);
|
|
7781
7763
|
}
|
|
7782
7764
|
return [];
|
|
7783
7765
|
}
|
|
@@ -7833,7 +7815,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7833
7815
|
};
|
|
7834
7816
|
|
|
7835
7817
|
// src/features/rules/rules-processor.ts
|
|
7836
|
-
import { basename as basename10, dirname as dirname3, join as
|
|
7818
|
+
import { basename as basename10, dirname as dirname3, join as join117, relative as relative5 } from "path";
|
|
7837
7819
|
import { encode } from "@toon-format/toon";
|
|
7838
7820
|
import { z as z57 } from "zod/mini";
|
|
7839
7821
|
|
|
@@ -7841,17 +7823,17 @@ import { z as z57 } from "zod/mini";
|
|
|
7841
7823
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7842
7824
|
|
|
7843
7825
|
// src/features/skills/agentsmd-skill.ts
|
|
7844
|
-
import { join as
|
|
7826
|
+
import { join as join59 } from "path";
|
|
7845
7827
|
|
|
7846
7828
|
// src/features/skills/simulated-skill.ts
|
|
7847
|
-
import { join as
|
|
7829
|
+
import { join as join58 } from "path";
|
|
7848
7830
|
import { z as z24 } from "zod/mini";
|
|
7849
7831
|
|
|
7850
7832
|
// src/features/skills/tool-skill.ts
|
|
7851
|
-
import { join as
|
|
7833
|
+
import { join as join57 } from "path";
|
|
7852
7834
|
|
|
7853
7835
|
// src/types/ai-dir.ts
|
|
7854
|
-
import path2, { basename as basename3, join as
|
|
7836
|
+
import path2, { basename as basename3, join as join56, relative as relative4, resolve as resolve4 } from "path";
|
|
7855
7837
|
var AiDir = class {
|
|
7856
7838
|
/**
|
|
7857
7839
|
* @example "."
|
|
@@ -7945,8 +7927,8 @@ var AiDir = class {
|
|
|
7945
7927
|
* @returns Array of files with their relative paths and buffers
|
|
7946
7928
|
*/
|
|
7947
7929
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7948
|
-
const dirPath =
|
|
7949
|
-
const glob =
|
|
7930
|
+
const dirPath = join56(baseDir, relativeDirPath, dirName);
|
|
7931
|
+
const glob = join56(dirPath, "**", "*");
|
|
7950
7932
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7951
7933
|
const filteredPaths = filePaths.filter((filePath) => basename3(filePath) !== excludeFileName);
|
|
7952
7934
|
const files = await Promise.all(
|
|
@@ -8044,8 +8026,8 @@ var ToolSkill = class extends AiDir {
|
|
|
8044
8026
|
}) {
|
|
8045
8027
|
const settablePaths = getSettablePaths({ global });
|
|
8046
8028
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8047
|
-
const skillDirPath =
|
|
8048
|
-
const skillFilePath =
|
|
8029
|
+
const skillDirPath = join57(baseDir, actualRelativeDirPath, dirName);
|
|
8030
|
+
const skillFilePath = join57(skillDirPath, SKILL_FILE_NAME);
|
|
8049
8031
|
if (!await fileExists(skillFilePath)) {
|
|
8050
8032
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8051
8033
|
}
|
|
@@ -8069,7 +8051,7 @@ var ToolSkill = class extends AiDir {
|
|
|
8069
8051
|
}
|
|
8070
8052
|
requireMainFileFrontmatter() {
|
|
8071
8053
|
if (!this.mainFile?.frontmatter) {
|
|
8072
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
8054
|
+
throw new Error(`Frontmatter is not defined in ${join57(this.relativeDirPath, this.dirName)}`);
|
|
8073
8055
|
}
|
|
8074
8056
|
return this.mainFile.frontmatter;
|
|
8075
8057
|
}
|
|
@@ -8109,7 +8091,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8109
8091
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8110
8092
|
if (!result.success) {
|
|
8111
8093
|
throw new Error(
|
|
8112
|
-
`Invalid frontmatter in ${
|
|
8094
|
+
`Invalid frontmatter in ${join58(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
8113
8095
|
);
|
|
8114
8096
|
}
|
|
8115
8097
|
}
|
|
@@ -8168,8 +8150,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8168
8150
|
}) {
|
|
8169
8151
|
const settablePaths = this.getSettablePaths();
|
|
8170
8152
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8171
|
-
const skillDirPath =
|
|
8172
|
-
const skillFilePath =
|
|
8153
|
+
const skillDirPath = join58(baseDir, actualRelativeDirPath, dirName);
|
|
8154
|
+
const skillFilePath = join58(skillDirPath, SKILL_FILE_NAME);
|
|
8173
8155
|
if (!await fileExists(skillFilePath)) {
|
|
8174
8156
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8175
8157
|
}
|
|
@@ -8246,7 +8228,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8246
8228
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
8247
8229
|
}
|
|
8248
8230
|
return {
|
|
8249
|
-
relativeDirPath:
|
|
8231
|
+
relativeDirPath: join59(".agents", "skills")
|
|
8250
8232
|
};
|
|
8251
8233
|
}
|
|
8252
8234
|
static async fromDir(params) {
|
|
@@ -8273,11 +8255,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8273
8255
|
};
|
|
8274
8256
|
|
|
8275
8257
|
// src/features/skills/factorydroid-skill.ts
|
|
8276
|
-
import { join as
|
|
8258
|
+
import { join as join60 } from "path";
|
|
8277
8259
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
8278
8260
|
static getSettablePaths(_options) {
|
|
8279
8261
|
return {
|
|
8280
|
-
relativeDirPath:
|
|
8262
|
+
relativeDirPath: join60(".factory", "skills")
|
|
8281
8263
|
};
|
|
8282
8264
|
}
|
|
8283
8265
|
static async fromDir(params) {
|
|
@@ -8304,23 +8286,26 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
8304
8286
|
};
|
|
8305
8287
|
|
|
8306
8288
|
// src/features/skills/skills-processor.ts
|
|
8307
|
-
import { basename as basename5, join as
|
|
8289
|
+
import { basename as basename5, join as join78 } from "path";
|
|
8308
8290
|
import { z as z40 } from "zod/mini";
|
|
8309
8291
|
|
|
8310
8292
|
// src/types/dir-feature-processor.ts
|
|
8311
|
-
import { join as
|
|
8293
|
+
import { join as join61 } from "path";
|
|
8312
8294
|
var DirFeatureProcessor = class {
|
|
8313
8295
|
baseDir;
|
|
8314
8296
|
dryRun;
|
|
8315
8297
|
avoidBlockScalars;
|
|
8298
|
+
logger;
|
|
8316
8299
|
constructor({
|
|
8317
8300
|
baseDir = process.cwd(),
|
|
8318
8301
|
dryRun = false,
|
|
8319
|
-
avoidBlockScalars = false
|
|
8302
|
+
avoidBlockScalars = false,
|
|
8303
|
+
logger
|
|
8320
8304
|
}) {
|
|
8321
8305
|
this.baseDir = baseDir;
|
|
8322
8306
|
this.dryRun = dryRun;
|
|
8323
8307
|
this.avoidBlockScalars = avoidBlockScalars;
|
|
8308
|
+
this.logger = logger;
|
|
8324
8309
|
}
|
|
8325
8310
|
/**
|
|
8326
8311
|
* Return tool targets that this feature supports.
|
|
@@ -8345,7 +8330,7 @@ var DirFeatureProcessor = class {
|
|
|
8345
8330
|
const mainFile = aiDir.getMainFile();
|
|
8346
8331
|
let mainFileContent;
|
|
8347
8332
|
if (mainFile) {
|
|
8348
|
-
const mainFilePath =
|
|
8333
|
+
const mainFilePath = join61(dirPath, mainFile.name);
|
|
8349
8334
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
8350
8335
|
avoidBlockScalars: this.avoidBlockScalars
|
|
8351
8336
|
});
|
|
@@ -8361,7 +8346,7 @@ var DirFeatureProcessor = class {
|
|
|
8361
8346
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
8362
8347
|
otherFileContents.push(contentWithNewline);
|
|
8363
8348
|
if (!dirHasChanges) {
|
|
8364
|
-
const filePath =
|
|
8349
|
+
const filePath = join61(dirPath, file.relativeFilePathToDirPath);
|
|
8365
8350
|
const existingContent = await readFileContentOrNull(filePath);
|
|
8366
8351
|
if (existingContent !== contentWithNewline) {
|
|
8367
8352
|
dirHasChanges = true;
|
|
@@ -8373,24 +8358,26 @@ var DirFeatureProcessor = class {
|
|
|
8373
8358
|
}
|
|
8374
8359
|
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
8375
8360
|
if (this.dryRun) {
|
|
8376
|
-
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8361
|
+
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8377
8362
|
if (mainFile) {
|
|
8378
|
-
logger.info(`[DRY RUN] Would write: ${
|
|
8379
|
-
changedPaths.push(
|
|
8363
|
+
this.logger.info(`[DRY RUN] Would write: ${join61(dirPath, mainFile.name)}`);
|
|
8364
|
+
changedPaths.push(join61(relativeDir, mainFile.name));
|
|
8380
8365
|
}
|
|
8381
8366
|
for (const file of otherFiles) {
|
|
8382
|
-
logger.info(
|
|
8383
|
-
|
|
8367
|
+
this.logger.info(
|
|
8368
|
+
`[DRY RUN] Would write: ${join61(dirPath, file.relativeFilePathToDirPath)}`
|
|
8369
|
+
);
|
|
8370
|
+
changedPaths.push(join61(relativeDir, file.relativeFilePathToDirPath));
|
|
8384
8371
|
}
|
|
8385
8372
|
} else {
|
|
8386
8373
|
await ensureDir(dirPath);
|
|
8387
8374
|
if (mainFile && mainFileContent) {
|
|
8388
|
-
const mainFilePath =
|
|
8375
|
+
const mainFilePath = join61(dirPath, mainFile.name);
|
|
8389
8376
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
8390
|
-
changedPaths.push(
|
|
8377
|
+
changedPaths.push(join61(relativeDir, mainFile.name));
|
|
8391
8378
|
}
|
|
8392
8379
|
for (const [i, file] of otherFiles.entries()) {
|
|
8393
|
-
const filePath =
|
|
8380
|
+
const filePath = join61(dirPath, file.relativeFilePathToDirPath);
|
|
8394
8381
|
const content = otherFileContents[i];
|
|
8395
8382
|
if (content === void 0) {
|
|
8396
8383
|
throw new Error(
|
|
@@ -8398,7 +8385,7 @@ var DirFeatureProcessor = class {
|
|
|
8398
8385
|
);
|
|
8399
8386
|
}
|
|
8400
8387
|
await writeFileContent(filePath, content);
|
|
8401
|
-
changedPaths.push(
|
|
8388
|
+
changedPaths.push(join61(relativeDir, file.relativeFilePathToDirPath));
|
|
8402
8389
|
}
|
|
8403
8390
|
}
|
|
8404
8391
|
changedCount++;
|
|
@@ -8420,7 +8407,7 @@ var DirFeatureProcessor = class {
|
|
|
8420
8407
|
for (const aiDir of orphanDirs) {
|
|
8421
8408
|
const dirPath = aiDir.getDirPath();
|
|
8422
8409
|
if (this.dryRun) {
|
|
8423
|
-
logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8410
|
+
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8424
8411
|
} else {
|
|
8425
8412
|
await removeDirectory(dirPath);
|
|
8426
8413
|
}
|
|
@@ -8430,11 +8417,11 @@ var DirFeatureProcessor = class {
|
|
|
8430
8417
|
};
|
|
8431
8418
|
|
|
8432
8419
|
// src/features/skills/agentsskills-skill.ts
|
|
8433
|
-
import { join as
|
|
8420
|
+
import { join as join63 } from "path";
|
|
8434
8421
|
import { z as z26 } from "zod/mini";
|
|
8435
8422
|
|
|
8436
8423
|
// src/features/skills/rulesync-skill.ts
|
|
8437
|
-
import { join as
|
|
8424
|
+
import { join as join62 } from "path";
|
|
8438
8425
|
import { z as z25 } from "zod/mini";
|
|
8439
8426
|
var RulesyncSkillFrontmatterSchemaInternal = z25.looseObject({
|
|
8440
8427
|
name: z25.string(),
|
|
@@ -8503,7 +8490,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8503
8490
|
}
|
|
8504
8491
|
getFrontmatter() {
|
|
8505
8492
|
if (!this.mainFile?.frontmatter) {
|
|
8506
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
8493
|
+
throw new Error(`Frontmatter is not defined in ${join62(this.relativeDirPath, this.dirName)}`);
|
|
8507
8494
|
}
|
|
8508
8495
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8509
8496
|
return result;
|
|
@@ -8529,8 +8516,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8529
8516
|
dirName,
|
|
8530
8517
|
global = false
|
|
8531
8518
|
}) {
|
|
8532
|
-
const skillDirPath =
|
|
8533
|
-
const skillFilePath =
|
|
8519
|
+
const skillDirPath = join62(baseDir, relativeDirPath, dirName);
|
|
8520
|
+
const skillFilePath = join62(skillDirPath, SKILL_FILE_NAME);
|
|
8534
8521
|
if (!await fileExists(skillFilePath)) {
|
|
8535
8522
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8536
8523
|
}
|
|
@@ -8567,7 +8554,7 @@ var AgentsSkillsSkillFrontmatterSchema = z26.looseObject({
|
|
|
8567
8554
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8568
8555
|
constructor({
|
|
8569
8556
|
baseDir = process.cwd(),
|
|
8570
|
-
relativeDirPath =
|
|
8557
|
+
relativeDirPath = join63(".agents", "skills"),
|
|
8571
8558
|
dirName,
|
|
8572
8559
|
frontmatter,
|
|
8573
8560
|
body,
|
|
@@ -8599,7 +8586,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8599
8586
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8600
8587
|
}
|
|
8601
8588
|
return {
|
|
8602
|
-
relativeDirPath:
|
|
8589
|
+
relativeDirPath: join63(".agents", "skills")
|
|
8603
8590
|
};
|
|
8604
8591
|
}
|
|
8605
8592
|
getFrontmatter() {
|
|
@@ -8679,9 +8666,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8679
8666
|
});
|
|
8680
8667
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8681
8668
|
if (!result.success) {
|
|
8682
|
-
const skillDirPath =
|
|
8669
|
+
const skillDirPath = join63(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8683
8670
|
throw new Error(
|
|
8684
|
-
`Invalid frontmatter in ${
|
|
8671
|
+
`Invalid frontmatter in ${join63(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8685
8672
|
);
|
|
8686
8673
|
}
|
|
8687
8674
|
return new _AgentsSkillsSkill({
|
|
@@ -8716,7 +8703,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8716
8703
|
};
|
|
8717
8704
|
|
|
8718
8705
|
// src/features/skills/antigravity-skill.ts
|
|
8719
|
-
import { join as
|
|
8706
|
+
import { join as join64 } from "path";
|
|
8720
8707
|
import { z as z27 } from "zod/mini";
|
|
8721
8708
|
var AntigravitySkillFrontmatterSchema = z27.looseObject({
|
|
8722
8709
|
name: z27.string(),
|
|
@@ -8725,7 +8712,7 @@ var AntigravitySkillFrontmatterSchema = z27.looseObject({
|
|
|
8725
8712
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8726
8713
|
constructor({
|
|
8727
8714
|
baseDir = process.cwd(),
|
|
8728
|
-
relativeDirPath =
|
|
8715
|
+
relativeDirPath = join64(".agent", "skills"),
|
|
8729
8716
|
dirName,
|
|
8730
8717
|
frontmatter,
|
|
8731
8718
|
body,
|
|
@@ -8757,11 +8744,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8757
8744
|
} = {}) {
|
|
8758
8745
|
if (global) {
|
|
8759
8746
|
return {
|
|
8760
|
-
relativeDirPath:
|
|
8747
|
+
relativeDirPath: join64(".gemini", "antigravity", "skills")
|
|
8761
8748
|
};
|
|
8762
8749
|
}
|
|
8763
8750
|
return {
|
|
8764
|
-
relativeDirPath:
|
|
8751
|
+
relativeDirPath: join64(".agent", "skills")
|
|
8765
8752
|
};
|
|
8766
8753
|
}
|
|
8767
8754
|
getFrontmatter() {
|
|
@@ -8841,9 +8828,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8841
8828
|
});
|
|
8842
8829
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8843
8830
|
if (!result.success) {
|
|
8844
|
-
const skillDirPath =
|
|
8831
|
+
const skillDirPath = join64(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8845
8832
|
throw new Error(
|
|
8846
|
-
`Invalid frontmatter in ${
|
|
8833
|
+
`Invalid frontmatter in ${join64(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8847
8834
|
);
|
|
8848
8835
|
}
|
|
8849
8836
|
return new _AntigravitySkill({
|
|
@@ -8877,7 +8864,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8877
8864
|
};
|
|
8878
8865
|
|
|
8879
8866
|
// src/features/skills/claudecode-skill.ts
|
|
8880
|
-
import { join as
|
|
8867
|
+
import { join as join65 } from "path";
|
|
8881
8868
|
import { z as z28 } from "zod/mini";
|
|
8882
8869
|
var ClaudecodeSkillFrontmatterSchema = z28.looseObject({
|
|
8883
8870
|
name: z28.string(),
|
|
@@ -8889,7 +8876,7 @@ var ClaudecodeSkillFrontmatterSchema = z28.looseObject({
|
|
|
8889
8876
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8890
8877
|
constructor({
|
|
8891
8878
|
baseDir = process.cwd(),
|
|
8892
|
-
relativeDirPath =
|
|
8879
|
+
relativeDirPath = join65(".claude", "skills"),
|
|
8893
8880
|
dirName,
|
|
8894
8881
|
frontmatter,
|
|
8895
8882
|
body,
|
|
@@ -8920,7 +8907,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8920
8907
|
global: _global = false
|
|
8921
8908
|
} = {}) {
|
|
8922
8909
|
return {
|
|
8923
|
-
relativeDirPath:
|
|
8910
|
+
relativeDirPath: join65(".claude", "skills")
|
|
8924
8911
|
};
|
|
8925
8912
|
}
|
|
8926
8913
|
getFrontmatter() {
|
|
@@ -9017,9 +9004,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9017
9004
|
});
|
|
9018
9005
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9019
9006
|
if (!result.success) {
|
|
9020
|
-
const skillDirPath =
|
|
9007
|
+
const skillDirPath = join65(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9021
9008
|
throw new Error(
|
|
9022
|
-
`Invalid frontmatter in ${
|
|
9009
|
+
`Invalid frontmatter in ${join65(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9023
9010
|
);
|
|
9024
9011
|
}
|
|
9025
9012
|
return new _ClaudecodeSkill({
|
|
@@ -9053,7 +9040,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9053
9040
|
};
|
|
9054
9041
|
|
|
9055
9042
|
// src/features/skills/cline-skill.ts
|
|
9056
|
-
import { join as
|
|
9043
|
+
import { join as join66 } from "path";
|
|
9057
9044
|
import { z as z29 } from "zod/mini";
|
|
9058
9045
|
var ClineSkillFrontmatterSchema = z29.looseObject({
|
|
9059
9046
|
name: z29.string(),
|
|
@@ -9062,7 +9049,7 @@ var ClineSkillFrontmatterSchema = z29.looseObject({
|
|
|
9062
9049
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
9063
9050
|
constructor({
|
|
9064
9051
|
baseDir = process.cwd(),
|
|
9065
|
-
relativeDirPath =
|
|
9052
|
+
relativeDirPath = join66(".cline", "skills"),
|
|
9066
9053
|
dirName,
|
|
9067
9054
|
frontmatter,
|
|
9068
9055
|
body,
|
|
@@ -9091,7 +9078,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9091
9078
|
}
|
|
9092
9079
|
static getSettablePaths(_options = {}) {
|
|
9093
9080
|
return {
|
|
9094
|
-
relativeDirPath:
|
|
9081
|
+
relativeDirPath: join66(".cline", "skills")
|
|
9095
9082
|
};
|
|
9096
9083
|
}
|
|
9097
9084
|
getFrontmatter() {
|
|
@@ -9179,13 +9166,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9179
9166
|
});
|
|
9180
9167
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9181
9168
|
if (!result.success) {
|
|
9182
|
-
const skillDirPath =
|
|
9169
|
+
const skillDirPath = join66(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9183
9170
|
throw new Error(
|
|
9184
|
-
`Invalid frontmatter in ${
|
|
9171
|
+
`Invalid frontmatter in ${join66(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9185
9172
|
);
|
|
9186
9173
|
}
|
|
9187
9174
|
if (result.data.name !== loaded.dirName) {
|
|
9188
|
-
const skillFilePath =
|
|
9175
|
+
const skillFilePath = join66(
|
|
9189
9176
|
loaded.baseDir,
|
|
9190
9177
|
loaded.relativeDirPath,
|
|
9191
9178
|
loaded.dirName,
|
|
@@ -9226,7 +9213,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9226
9213
|
};
|
|
9227
9214
|
|
|
9228
9215
|
// src/features/skills/codexcli-skill.ts
|
|
9229
|
-
import { join as
|
|
9216
|
+
import { join as join67 } from "path";
|
|
9230
9217
|
import { z as z30 } from "zod/mini";
|
|
9231
9218
|
var CodexCliSkillFrontmatterSchema = z30.looseObject({
|
|
9232
9219
|
name: z30.string(),
|
|
@@ -9240,7 +9227,7 @@ var CodexCliSkillFrontmatterSchema = z30.looseObject({
|
|
|
9240
9227
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
9241
9228
|
constructor({
|
|
9242
9229
|
baseDir = process.cwd(),
|
|
9243
|
-
relativeDirPath =
|
|
9230
|
+
relativeDirPath = join67(".codex", "skills"),
|
|
9244
9231
|
dirName,
|
|
9245
9232
|
frontmatter,
|
|
9246
9233
|
body,
|
|
@@ -9271,7 +9258,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9271
9258
|
global: _global = false
|
|
9272
9259
|
} = {}) {
|
|
9273
9260
|
return {
|
|
9274
|
-
relativeDirPath:
|
|
9261
|
+
relativeDirPath: join67(".codex", "skills")
|
|
9275
9262
|
};
|
|
9276
9263
|
}
|
|
9277
9264
|
getFrontmatter() {
|
|
@@ -9361,9 +9348,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9361
9348
|
});
|
|
9362
9349
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9363
9350
|
if (!result.success) {
|
|
9364
|
-
const skillDirPath =
|
|
9351
|
+
const skillDirPath = join67(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9365
9352
|
throw new Error(
|
|
9366
|
-
`Invalid frontmatter in ${
|
|
9353
|
+
`Invalid frontmatter in ${join67(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9367
9354
|
);
|
|
9368
9355
|
}
|
|
9369
9356
|
return new _CodexCliSkill({
|
|
@@ -9397,7 +9384,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9397
9384
|
};
|
|
9398
9385
|
|
|
9399
9386
|
// src/features/skills/copilot-skill.ts
|
|
9400
|
-
import { join as
|
|
9387
|
+
import { join as join68 } from "path";
|
|
9401
9388
|
import { z as z31 } from "zod/mini";
|
|
9402
9389
|
var CopilotSkillFrontmatterSchema = z31.looseObject({
|
|
9403
9390
|
name: z31.string(),
|
|
@@ -9407,7 +9394,7 @@ var CopilotSkillFrontmatterSchema = z31.looseObject({
|
|
|
9407
9394
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
9408
9395
|
constructor({
|
|
9409
9396
|
baseDir = process.cwd(),
|
|
9410
|
-
relativeDirPath =
|
|
9397
|
+
relativeDirPath = join68(".github", "skills"),
|
|
9411
9398
|
dirName,
|
|
9412
9399
|
frontmatter,
|
|
9413
9400
|
body,
|
|
@@ -9439,7 +9426,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9439
9426
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9440
9427
|
}
|
|
9441
9428
|
return {
|
|
9442
|
-
relativeDirPath:
|
|
9429
|
+
relativeDirPath: join68(".github", "skills")
|
|
9443
9430
|
};
|
|
9444
9431
|
}
|
|
9445
9432
|
getFrontmatter() {
|
|
@@ -9525,9 +9512,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9525
9512
|
});
|
|
9526
9513
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9527
9514
|
if (!result.success) {
|
|
9528
|
-
const skillDirPath =
|
|
9515
|
+
const skillDirPath = join68(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9529
9516
|
throw new Error(
|
|
9530
|
-
`Invalid frontmatter in ${
|
|
9517
|
+
`Invalid frontmatter in ${join68(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9531
9518
|
);
|
|
9532
9519
|
}
|
|
9533
9520
|
return new _CopilotSkill({
|
|
@@ -9562,7 +9549,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9562
9549
|
};
|
|
9563
9550
|
|
|
9564
9551
|
// src/features/skills/cursor-skill.ts
|
|
9565
|
-
import { join as
|
|
9552
|
+
import { join as join69 } from "path";
|
|
9566
9553
|
import { z as z32 } from "zod/mini";
|
|
9567
9554
|
var CursorSkillFrontmatterSchema = z32.looseObject({
|
|
9568
9555
|
name: z32.string(),
|
|
@@ -9571,7 +9558,7 @@ var CursorSkillFrontmatterSchema = z32.looseObject({
|
|
|
9571
9558
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9572
9559
|
constructor({
|
|
9573
9560
|
baseDir = process.cwd(),
|
|
9574
|
-
relativeDirPath =
|
|
9561
|
+
relativeDirPath = join69(".cursor", "skills"),
|
|
9575
9562
|
dirName,
|
|
9576
9563
|
frontmatter,
|
|
9577
9564
|
body,
|
|
@@ -9600,7 +9587,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9600
9587
|
}
|
|
9601
9588
|
static getSettablePaths(_options) {
|
|
9602
9589
|
return {
|
|
9603
|
-
relativeDirPath:
|
|
9590
|
+
relativeDirPath: join69(".cursor", "skills")
|
|
9604
9591
|
};
|
|
9605
9592
|
}
|
|
9606
9593
|
getFrontmatter() {
|
|
@@ -9680,9 +9667,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9680
9667
|
});
|
|
9681
9668
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9682
9669
|
if (!result.success) {
|
|
9683
|
-
const skillDirPath =
|
|
9670
|
+
const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9684
9671
|
throw new Error(
|
|
9685
|
-
`Invalid frontmatter in ${
|
|
9672
|
+
`Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9686
9673
|
);
|
|
9687
9674
|
}
|
|
9688
9675
|
return new _CursorSkill({
|
|
@@ -9717,7 +9704,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9717
9704
|
};
|
|
9718
9705
|
|
|
9719
9706
|
// src/features/skills/geminicli-skill.ts
|
|
9720
|
-
import { join as
|
|
9707
|
+
import { join as join70 } from "path";
|
|
9721
9708
|
import { z as z33 } from "zod/mini";
|
|
9722
9709
|
var GeminiCliSkillFrontmatterSchema = z33.looseObject({
|
|
9723
9710
|
name: z33.string(),
|
|
@@ -9757,7 +9744,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9757
9744
|
global: _global = false
|
|
9758
9745
|
} = {}) {
|
|
9759
9746
|
return {
|
|
9760
|
-
relativeDirPath:
|
|
9747
|
+
relativeDirPath: join70(".gemini", "skills")
|
|
9761
9748
|
};
|
|
9762
9749
|
}
|
|
9763
9750
|
getFrontmatter() {
|
|
@@ -9837,9 +9824,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9837
9824
|
});
|
|
9838
9825
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9839
9826
|
if (!result.success) {
|
|
9840
|
-
const skillDirPath =
|
|
9827
|
+
const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9841
9828
|
throw new Error(
|
|
9842
|
-
`Invalid frontmatter in ${
|
|
9829
|
+
`Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9843
9830
|
);
|
|
9844
9831
|
}
|
|
9845
9832
|
return new _GeminiCliSkill({
|
|
@@ -9874,7 +9861,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9874
9861
|
};
|
|
9875
9862
|
|
|
9876
9863
|
// src/features/skills/junie-skill.ts
|
|
9877
|
-
import { join as
|
|
9864
|
+
import { join as join71 } from "path";
|
|
9878
9865
|
import { z as z34 } from "zod/mini";
|
|
9879
9866
|
var JunieSkillFrontmatterSchema = z34.looseObject({
|
|
9880
9867
|
name: z34.string(),
|
|
@@ -9883,7 +9870,7 @@ var JunieSkillFrontmatterSchema = z34.looseObject({
|
|
|
9883
9870
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9884
9871
|
constructor({
|
|
9885
9872
|
baseDir = process.cwd(),
|
|
9886
|
-
relativeDirPath =
|
|
9873
|
+
relativeDirPath = join71(".junie", "skills"),
|
|
9887
9874
|
dirName,
|
|
9888
9875
|
frontmatter,
|
|
9889
9876
|
body,
|
|
@@ -9915,7 +9902,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9915
9902
|
throw new Error("JunieSkill does not support global mode.");
|
|
9916
9903
|
}
|
|
9917
9904
|
return {
|
|
9918
|
-
relativeDirPath:
|
|
9905
|
+
relativeDirPath: join71(".junie", "skills")
|
|
9919
9906
|
};
|
|
9920
9907
|
}
|
|
9921
9908
|
getFrontmatter() {
|
|
@@ -10002,13 +9989,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10002
9989
|
});
|
|
10003
9990
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10004
9991
|
if (!result.success) {
|
|
10005
|
-
const skillDirPath =
|
|
9992
|
+
const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10006
9993
|
throw new Error(
|
|
10007
|
-
`Invalid frontmatter in ${
|
|
9994
|
+
`Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10008
9995
|
);
|
|
10009
9996
|
}
|
|
10010
9997
|
if (result.data.name !== loaded.dirName) {
|
|
10011
|
-
const skillFilePath =
|
|
9998
|
+
const skillFilePath = join71(
|
|
10012
9999
|
loaded.baseDir,
|
|
10013
10000
|
loaded.relativeDirPath,
|
|
10014
10001
|
loaded.dirName,
|
|
@@ -10050,7 +10037,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10050
10037
|
};
|
|
10051
10038
|
|
|
10052
10039
|
// src/features/skills/kilo-skill.ts
|
|
10053
|
-
import { join as
|
|
10040
|
+
import { join as join72 } from "path";
|
|
10054
10041
|
import { z as z35 } from "zod/mini";
|
|
10055
10042
|
var KiloSkillFrontmatterSchema = z35.looseObject({
|
|
10056
10043
|
name: z35.string(),
|
|
@@ -10059,7 +10046,7 @@ var KiloSkillFrontmatterSchema = z35.looseObject({
|
|
|
10059
10046
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
10060
10047
|
constructor({
|
|
10061
10048
|
baseDir = process.cwd(),
|
|
10062
|
-
relativeDirPath =
|
|
10049
|
+
relativeDirPath = join72(".kilocode", "skills"),
|
|
10063
10050
|
dirName,
|
|
10064
10051
|
frontmatter,
|
|
10065
10052
|
body,
|
|
@@ -10090,7 +10077,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10090
10077
|
global: _global = false
|
|
10091
10078
|
} = {}) {
|
|
10092
10079
|
return {
|
|
10093
|
-
relativeDirPath:
|
|
10080
|
+
relativeDirPath: join72(".kilocode", "skills")
|
|
10094
10081
|
};
|
|
10095
10082
|
}
|
|
10096
10083
|
getFrontmatter() {
|
|
@@ -10178,13 +10165,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10178
10165
|
});
|
|
10179
10166
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10180
10167
|
if (!result.success) {
|
|
10181
|
-
const skillDirPath =
|
|
10168
|
+
const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10182
10169
|
throw new Error(
|
|
10183
|
-
`Invalid frontmatter in ${
|
|
10170
|
+
`Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10184
10171
|
);
|
|
10185
10172
|
}
|
|
10186
10173
|
if (result.data.name !== loaded.dirName) {
|
|
10187
|
-
const skillFilePath =
|
|
10174
|
+
const skillFilePath = join72(
|
|
10188
10175
|
loaded.baseDir,
|
|
10189
10176
|
loaded.relativeDirPath,
|
|
10190
10177
|
loaded.dirName,
|
|
@@ -10225,7 +10212,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10225
10212
|
};
|
|
10226
10213
|
|
|
10227
10214
|
// src/features/skills/kiro-skill.ts
|
|
10228
|
-
import { join as
|
|
10215
|
+
import { join as join73 } from "path";
|
|
10229
10216
|
import { z as z36 } from "zod/mini";
|
|
10230
10217
|
var KiroSkillFrontmatterSchema = z36.looseObject({
|
|
10231
10218
|
name: z36.string(),
|
|
@@ -10234,7 +10221,7 @@ var KiroSkillFrontmatterSchema = z36.looseObject({
|
|
|
10234
10221
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
10235
10222
|
constructor({
|
|
10236
10223
|
baseDir = process.cwd(),
|
|
10237
|
-
relativeDirPath =
|
|
10224
|
+
relativeDirPath = join73(".kiro", "skills"),
|
|
10238
10225
|
dirName,
|
|
10239
10226
|
frontmatter,
|
|
10240
10227
|
body,
|
|
@@ -10266,7 +10253,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10266
10253
|
throw new Error("KiroSkill does not support global mode.");
|
|
10267
10254
|
}
|
|
10268
10255
|
return {
|
|
10269
|
-
relativeDirPath:
|
|
10256
|
+
relativeDirPath: join73(".kiro", "skills")
|
|
10270
10257
|
};
|
|
10271
10258
|
}
|
|
10272
10259
|
getFrontmatter() {
|
|
@@ -10354,13 +10341,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10354
10341
|
});
|
|
10355
10342
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10356
10343
|
if (!result.success) {
|
|
10357
|
-
const skillDirPath =
|
|
10344
|
+
const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10358
10345
|
throw new Error(
|
|
10359
|
-
`Invalid frontmatter in ${
|
|
10346
|
+
`Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10360
10347
|
);
|
|
10361
10348
|
}
|
|
10362
10349
|
if (result.data.name !== loaded.dirName) {
|
|
10363
|
-
const skillFilePath =
|
|
10350
|
+
const skillFilePath = join73(
|
|
10364
10351
|
loaded.baseDir,
|
|
10365
10352
|
loaded.relativeDirPath,
|
|
10366
10353
|
loaded.dirName,
|
|
@@ -10402,7 +10389,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10402
10389
|
};
|
|
10403
10390
|
|
|
10404
10391
|
// src/features/skills/opencode-skill.ts
|
|
10405
|
-
import { join as
|
|
10392
|
+
import { join as join74 } from "path";
|
|
10406
10393
|
import { z as z37 } from "zod/mini";
|
|
10407
10394
|
var OpenCodeSkillFrontmatterSchema = z37.looseObject({
|
|
10408
10395
|
name: z37.string(),
|
|
@@ -10412,7 +10399,7 @@ var OpenCodeSkillFrontmatterSchema = z37.looseObject({
|
|
|
10412
10399
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
10413
10400
|
constructor({
|
|
10414
10401
|
baseDir = process.cwd(),
|
|
10415
|
-
relativeDirPath =
|
|
10402
|
+
relativeDirPath = join74(".opencode", "skill"),
|
|
10416
10403
|
dirName,
|
|
10417
10404
|
frontmatter,
|
|
10418
10405
|
body,
|
|
@@ -10441,7 +10428,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10441
10428
|
}
|
|
10442
10429
|
static getSettablePaths({ global = false } = {}) {
|
|
10443
10430
|
return {
|
|
10444
|
-
relativeDirPath: global ?
|
|
10431
|
+
relativeDirPath: global ? join74(".config", "opencode", "skill") : join74(".opencode", "skill")
|
|
10445
10432
|
};
|
|
10446
10433
|
}
|
|
10447
10434
|
getFrontmatter() {
|
|
@@ -10527,9 +10514,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10527
10514
|
});
|
|
10528
10515
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10529
10516
|
if (!result.success) {
|
|
10530
|
-
const skillDirPath =
|
|
10517
|
+
const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10531
10518
|
throw new Error(
|
|
10532
|
-
`Invalid frontmatter in ${
|
|
10519
|
+
`Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10533
10520
|
);
|
|
10534
10521
|
}
|
|
10535
10522
|
return new _OpenCodeSkill({
|
|
@@ -10563,7 +10550,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10563
10550
|
};
|
|
10564
10551
|
|
|
10565
10552
|
// src/features/skills/replit-skill.ts
|
|
10566
|
-
import { join as
|
|
10553
|
+
import { join as join75 } from "path";
|
|
10567
10554
|
import { z as z38 } from "zod/mini";
|
|
10568
10555
|
var ReplitSkillFrontmatterSchema = z38.looseObject({
|
|
10569
10556
|
name: z38.string(),
|
|
@@ -10572,7 +10559,7 @@ var ReplitSkillFrontmatterSchema = z38.looseObject({
|
|
|
10572
10559
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
10573
10560
|
constructor({
|
|
10574
10561
|
baseDir = process.cwd(),
|
|
10575
|
-
relativeDirPath =
|
|
10562
|
+
relativeDirPath = join75(".agents", "skills"),
|
|
10576
10563
|
dirName,
|
|
10577
10564
|
frontmatter,
|
|
10578
10565
|
body,
|
|
@@ -10604,7 +10591,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10604
10591
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10605
10592
|
}
|
|
10606
10593
|
return {
|
|
10607
|
-
relativeDirPath:
|
|
10594
|
+
relativeDirPath: join75(".agents", "skills")
|
|
10608
10595
|
};
|
|
10609
10596
|
}
|
|
10610
10597
|
getFrontmatter() {
|
|
@@ -10684,9 +10671,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10684
10671
|
});
|
|
10685
10672
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10686
10673
|
if (!result.success) {
|
|
10687
|
-
const skillDirPath =
|
|
10674
|
+
const skillDirPath = join75(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10688
10675
|
throw new Error(
|
|
10689
|
-
`Invalid frontmatter in ${
|
|
10676
|
+
`Invalid frontmatter in ${join75(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10690
10677
|
);
|
|
10691
10678
|
}
|
|
10692
10679
|
return new _ReplitSkill({
|
|
@@ -10721,7 +10708,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10721
10708
|
};
|
|
10722
10709
|
|
|
10723
10710
|
// src/features/skills/roo-skill.ts
|
|
10724
|
-
import { join as
|
|
10711
|
+
import { join as join76 } from "path";
|
|
10725
10712
|
import { z as z39 } from "zod/mini";
|
|
10726
10713
|
var RooSkillFrontmatterSchema = z39.looseObject({
|
|
10727
10714
|
name: z39.string(),
|
|
@@ -10730,7 +10717,7 @@ var RooSkillFrontmatterSchema = z39.looseObject({
|
|
|
10730
10717
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10731
10718
|
constructor({
|
|
10732
10719
|
baseDir = process.cwd(),
|
|
10733
|
-
relativeDirPath =
|
|
10720
|
+
relativeDirPath = join76(".roo", "skills"),
|
|
10734
10721
|
dirName,
|
|
10735
10722
|
frontmatter,
|
|
10736
10723
|
body,
|
|
@@ -10761,7 +10748,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10761
10748
|
global: _global = false
|
|
10762
10749
|
} = {}) {
|
|
10763
10750
|
return {
|
|
10764
|
-
relativeDirPath:
|
|
10751
|
+
relativeDirPath: join76(".roo", "skills")
|
|
10765
10752
|
};
|
|
10766
10753
|
}
|
|
10767
10754
|
getFrontmatter() {
|
|
@@ -10849,13 +10836,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10849
10836
|
});
|
|
10850
10837
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10851
10838
|
if (!result.success) {
|
|
10852
|
-
const skillDirPath =
|
|
10839
|
+
const skillDirPath = join76(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10853
10840
|
throw new Error(
|
|
10854
|
-
`Invalid frontmatter in ${
|
|
10841
|
+
`Invalid frontmatter in ${join76(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10855
10842
|
);
|
|
10856
10843
|
}
|
|
10857
10844
|
if (result.data.name !== loaded.dirName) {
|
|
10858
|
-
const skillFilePath =
|
|
10845
|
+
const skillFilePath = join76(
|
|
10859
10846
|
loaded.baseDir,
|
|
10860
10847
|
loaded.relativeDirPath,
|
|
10861
10848
|
loaded.dirName,
|
|
@@ -10896,14 +10883,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10896
10883
|
};
|
|
10897
10884
|
|
|
10898
10885
|
// src/features/skills/skills-utils.ts
|
|
10899
|
-
import { basename as basename4, join as
|
|
10886
|
+
import { basename as basename4, join as join77 } from "path";
|
|
10900
10887
|
async function getLocalSkillDirNames(baseDir) {
|
|
10901
|
-
const skillsDir =
|
|
10888
|
+
const skillsDir = join77(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10902
10889
|
const names = /* @__PURE__ */ new Set();
|
|
10903
10890
|
if (!await directoryExists(skillsDir)) {
|
|
10904
10891
|
return names;
|
|
10905
10892
|
}
|
|
10906
|
-
const dirPaths = await findFilesByGlobs(
|
|
10893
|
+
const dirPaths = await findFilesByGlobs(join77(skillsDir, "*"), { type: "dir" });
|
|
10907
10894
|
for (const dirPath of dirPaths) {
|
|
10908
10895
|
const name = basename4(dirPath);
|
|
10909
10896
|
if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
@@ -11085,9 +11072,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11085
11072
|
toolTarget,
|
|
11086
11073
|
global = false,
|
|
11087
11074
|
getFactory = defaultGetFactory4,
|
|
11088
|
-
dryRun = false
|
|
11075
|
+
dryRun = false,
|
|
11076
|
+
logger
|
|
11089
11077
|
}) {
|
|
11090
|
-
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor" });
|
|
11078
|
+
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor", logger });
|
|
11091
11079
|
const result = SkillsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
11092
11080
|
if (!result.success) {
|
|
11093
11081
|
throw new Error(
|
|
@@ -11120,7 +11108,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11120
11108
|
const rulesyncSkills = [];
|
|
11121
11109
|
for (const toolSkill of toolSkills) {
|
|
11122
11110
|
if (toolSkill instanceof SimulatedSkill) {
|
|
11123
|
-
logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11111
|
+
this.logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11124
11112
|
continue;
|
|
11125
11113
|
}
|
|
11126
11114
|
rulesyncSkills.push(toolSkill.toRulesyncSkill());
|
|
@@ -11141,14 +11129,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11141
11129
|
)
|
|
11142
11130
|
);
|
|
11143
11131
|
const localSkillNames = new Set(localDirNames);
|
|
11144
|
-
const curatedDirPath =
|
|
11132
|
+
const curatedDirPath = join78(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
11145
11133
|
let curatedSkills = [];
|
|
11146
11134
|
if (await directoryExists(curatedDirPath)) {
|
|
11147
|
-
const curatedDirPaths = await findFilesByGlobs(
|
|
11135
|
+
const curatedDirPaths = await findFilesByGlobs(join78(curatedDirPath, "*"), { type: "dir" });
|
|
11148
11136
|
const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
|
|
11149
11137
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
11150
11138
|
if (localSkillNames.has(name)) {
|
|
11151
|
-
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11139
|
+
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11152
11140
|
return false;
|
|
11153
11141
|
}
|
|
11154
11142
|
return true;
|
|
@@ -11166,7 +11154,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11166
11154
|
);
|
|
11167
11155
|
}
|
|
11168
11156
|
const allSkills = [...localSkills, ...curatedSkills];
|
|
11169
|
-
logger.debug(
|
|
11157
|
+
this.logger.debug(
|
|
11170
11158
|
`Successfully loaded ${allSkills.length} rulesync skills (${localSkills.length} local, ${curatedSkills.length} curated)`
|
|
11171
11159
|
);
|
|
11172
11160
|
return allSkills;
|
|
@@ -11178,8 +11166,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11178
11166
|
async loadToolDirs() {
|
|
11179
11167
|
const factory = this.getFactory(this.toolTarget);
|
|
11180
11168
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11181
|
-
const skillsDirPath =
|
|
11182
|
-
const dirPaths = await findFilesByGlobs(
|
|
11169
|
+
const skillsDirPath = join78(this.baseDir, paths.relativeDirPath);
|
|
11170
|
+
const dirPaths = await findFilesByGlobs(join78(skillsDirPath, "*"), { type: "dir" });
|
|
11183
11171
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
11184
11172
|
const toolSkills = await Promise.all(
|
|
11185
11173
|
dirNames.map(
|
|
@@ -11190,14 +11178,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11190
11178
|
})
|
|
11191
11179
|
)
|
|
11192
11180
|
);
|
|
11193
|
-
logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11181
|
+
this.logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11194
11182
|
return toolSkills;
|
|
11195
11183
|
}
|
|
11196
11184
|
async loadToolDirsToDelete() {
|
|
11197
11185
|
const factory = this.getFactory(this.toolTarget);
|
|
11198
11186
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11199
|
-
const skillsDirPath =
|
|
11200
|
-
const dirPaths = await findFilesByGlobs(
|
|
11187
|
+
const skillsDirPath = join78(this.baseDir, paths.relativeDirPath);
|
|
11188
|
+
const dirPaths = await findFilesByGlobs(join78(skillsDirPath, "*"), { type: "dir" });
|
|
11201
11189
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
11202
11190
|
const toolSkills = dirNames.map(
|
|
11203
11191
|
(dirName) => factory.class.forDeletion({
|
|
@@ -11207,7 +11195,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11207
11195
|
global: this.global
|
|
11208
11196
|
})
|
|
11209
11197
|
);
|
|
11210
|
-
logger.debug(
|
|
11198
|
+
this.logger.debug(
|
|
11211
11199
|
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
11212
11200
|
);
|
|
11213
11201
|
return toolSkills;
|
|
@@ -11259,10 +11247,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11259
11247
|
};
|
|
11260
11248
|
|
|
11261
11249
|
// src/features/subagents/agentsmd-subagent.ts
|
|
11262
|
-
import { join as
|
|
11250
|
+
import { join as join80 } from "path";
|
|
11263
11251
|
|
|
11264
11252
|
// src/features/subagents/simulated-subagent.ts
|
|
11265
|
-
import { basename as basename6, join as
|
|
11253
|
+
import { basename as basename6, join as join79 } from "path";
|
|
11266
11254
|
import { z as z41 } from "zod/mini";
|
|
11267
11255
|
|
|
11268
11256
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -11327,7 +11315,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11327
11315
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11328
11316
|
if (!result.success) {
|
|
11329
11317
|
throw new Error(
|
|
11330
|
-
`Invalid frontmatter in ${
|
|
11318
|
+
`Invalid frontmatter in ${join79(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11331
11319
|
);
|
|
11332
11320
|
}
|
|
11333
11321
|
}
|
|
@@ -11378,7 +11366,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11378
11366
|
return {
|
|
11379
11367
|
success: false,
|
|
11380
11368
|
error: new Error(
|
|
11381
|
-
`Invalid frontmatter in ${
|
|
11369
|
+
`Invalid frontmatter in ${join79(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11382
11370
|
)
|
|
11383
11371
|
};
|
|
11384
11372
|
}
|
|
@@ -11388,7 +11376,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11388
11376
|
relativeFilePath,
|
|
11389
11377
|
validate = true
|
|
11390
11378
|
}) {
|
|
11391
|
-
const filePath =
|
|
11379
|
+
const filePath = join79(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
11392
11380
|
const fileContent = await readFileContent(filePath);
|
|
11393
11381
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11394
11382
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11424,7 +11412,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11424
11412
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
11425
11413
|
static getSettablePaths() {
|
|
11426
11414
|
return {
|
|
11427
|
-
relativeDirPath:
|
|
11415
|
+
relativeDirPath: join80(".agents", "subagents")
|
|
11428
11416
|
};
|
|
11429
11417
|
}
|
|
11430
11418
|
static async fromFile(params) {
|
|
@@ -11447,11 +11435,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
11447
11435
|
};
|
|
11448
11436
|
|
|
11449
11437
|
// src/features/subagents/factorydroid-subagent.ts
|
|
11450
|
-
import { join as
|
|
11438
|
+
import { join as join81 } from "path";
|
|
11451
11439
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
11452
11440
|
static getSettablePaths(_options) {
|
|
11453
11441
|
return {
|
|
11454
|
-
relativeDirPath:
|
|
11442
|
+
relativeDirPath: join81(".factory", "droids")
|
|
11455
11443
|
};
|
|
11456
11444
|
}
|
|
11457
11445
|
static async fromFile(params) {
|
|
@@ -11474,11 +11462,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
11474
11462
|
};
|
|
11475
11463
|
|
|
11476
11464
|
// src/features/subagents/geminicli-subagent.ts
|
|
11477
|
-
import { join as
|
|
11465
|
+
import { join as join82 } from "path";
|
|
11478
11466
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
11479
11467
|
static getSettablePaths() {
|
|
11480
11468
|
return {
|
|
11481
|
-
relativeDirPath:
|
|
11469
|
+
relativeDirPath: join82(".gemini", "subagents")
|
|
11482
11470
|
};
|
|
11483
11471
|
}
|
|
11484
11472
|
static async fromFile(params) {
|
|
@@ -11501,11 +11489,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
11501
11489
|
};
|
|
11502
11490
|
|
|
11503
11491
|
// src/features/subagents/roo-subagent.ts
|
|
11504
|
-
import { join as
|
|
11492
|
+
import { join as join83 } from "path";
|
|
11505
11493
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
11506
11494
|
static getSettablePaths() {
|
|
11507
11495
|
return {
|
|
11508
|
-
relativeDirPath:
|
|
11496
|
+
relativeDirPath: join83(".roo", "subagents")
|
|
11509
11497
|
};
|
|
11510
11498
|
}
|
|
11511
11499
|
static async fromFile(params) {
|
|
@@ -11528,15 +11516,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
11528
11516
|
};
|
|
11529
11517
|
|
|
11530
11518
|
// src/features/subagents/subagents-processor.ts
|
|
11531
|
-
import { basename as basename9, join as
|
|
11519
|
+
import { basename as basename9, join as join92 } from "path";
|
|
11532
11520
|
import { z as z50 } from "zod/mini";
|
|
11533
11521
|
|
|
11534
11522
|
// src/features/subagents/claudecode-subagent.ts
|
|
11535
|
-
import { join as
|
|
11523
|
+
import { join as join85 } from "path";
|
|
11536
11524
|
import { z as z43 } from "zod/mini";
|
|
11537
11525
|
|
|
11538
11526
|
// src/features/subagents/rulesync-subagent.ts
|
|
11539
|
-
import { basename as basename7, join as
|
|
11527
|
+
import { basename as basename7, join as join84 } from "path";
|
|
11540
11528
|
import { z as z42 } from "zod/mini";
|
|
11541
11529
|
var RulesyncSubagentFrontmatterSchema = z42.looseObject({
|
|
11542
11530
|
targets: z42._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -11550,7 +11538,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11550
11538
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11551
11539
|
if (!parseResult.success && rest.validate !== false) {
|
|
11552
11540
|
throw new Error(
|
|
11553
|
-
`Invalid frontmatter in ${
|
|
11541
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11554
11542
|
);
|
|
11555
11543
|
}
|
|
11556
11544
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -11583,7 +11571,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11583
11571
|
return {
|
|
11584
11572
|
success: false,
|
|
11585
11573
|
error: new Error(
|
|
11586
|
-
`Invalid frontmatter in ${
|
|
11574
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11587
11575
|
)
|
|
11588
11576
|
};
|
|
11589
11577
|
}
|
|
@@ -11591,7 +11579,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11591
11579
|
static async fromFile({
|
|
11592
11580
|
relativeFilePath
|
|
11593
11581
|
}) {
|
|
11594
|
-
const filePath =
|
|
11582
|
+
const filePath = join84(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
11595
11583
|
const fileContent = await readFileContent(filePath);
|
|
11596
11584
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11597
11585
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11626,7 +11614,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11626
11614
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11627
11615
|
if (!result.success) {
|
|
11628
11616
|
throw new Error(
|
|
11629
|
-
`Invalid frontmatter in ${
|
|
11617
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11630
11618
|
);
|
|
11631
11619
|
}
|
|
11632
11620
|
}
|
|
@@ -11638,7 +11626,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11638
11626
|
}
|
|
11639
11627
|
static getSettablePaths(_options = {}) {
|
|
11640
11628
|
return {
|
|
11641
|
-
relativeDirPath:
|
|
11629
|
+
relativeDirPath: join85(".claude", "agents")
|
|
11642
11630
|
};
|
|
11643
11631
|
}
|
|
11644
11632
|
getFrontmatter() {
|
|
@@ -11717,7 +11705,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11717
11705
|
return {
|
|
11718
11706
|
success: false,
|
|
11719
11707
|
error: new Error(
|
|
11720
|
-
`Invalid frontmatter in ${
|
|
11708
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11721
11709
|
)
|
|
11722
11710
|
};
|
|
11723
11711
|
}
|
|
@@ -11735,7 +11723,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11735
11723
|
global = false
|
|
11736
11724
|
}) {
|
|
11737
11725
|
const paths = this.getSettablePaths({ global });
|
|
11738
|
-
const filePath =
|
|
11726
|
+
const filePath = join85(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11739
11727
|
const fileContent = await readFileContent(filePath);
|
|
11740
11728
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11741
11729
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11770,7 +11758,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11770
11758
|
};
|
|
11771
11759
|
|
|
11772
11760
|
// src/features/subagents/codexcli-subagent.ts
|
|
11773
|
-
import { join as
|
|
11761
|
+
import { join as join86 } from "path";
|
|
11774
11762
|
import * as smolToml2 from "smol-toml";
|
|
11775
11763
|
import { z as z44 } from "zod/mini";
|
|
11776
11764
|
var CodexCliSubagentTomlSchema = z44.looseObject({
|
|
@@ -11790,7 +11778,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11790
11778
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11791
11779
|
} catch (error) {
|
|
11792
11780
|
throw new Error(
|
|
11793
|
-
`Invalid TOML in ${
|
|
11781
|
+
`Invalid TOML in ${join86(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11794
11782
|
{ cause: error }
|
|
11795
11783
|
);
|
|
11796
11784
|
}
|
|
@@ -11802,7 +11790,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11802
11790
|
}
|
|
11803
11791
|
static getSettablePaths(_options = {}) {
|
|
11804
11792
|
return {
|
|
11805
|
-
relativeDirPath:
|
|
11793
|
+
relativeDirPath: join86(".codex", "agents")
|
|
11806
11794
|
};
|
|
11807
11795
|
}
|
|
11808
11796
|
getBody() {
|
|
@@ -11814,7 +11802,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11814
11802
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11815
11803
|
} catch (error) {
|
|
11816
11804
|
throw new Error(
|
|
11817
|
-
`Failed to parse TOML in ${
|
|
11805
|
+
`Failed to parse TOML in ${join86(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11818
11806
|
{ cause: error }
|
|
11819
11807
|
);
|
|
11820
11808
|
}
|
|
@@ -11895,7 +11883,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11895
11883
|
global = false
|
|
11896
11884
|
}) {
|
|
11897
11885
|
const paths = this.getSettablePaths({ global });
|
|
11898
|
-
const filePath =
|
|
11886
|
+
const filePath = join86(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11899
11887
|
const fileContent = await readFileContent(filePath);
|
|
11900
11888
|
const subagent = new _CodexCliSubagent({
|
|
11901
11889
|
baseDir,
|
|
@@ -11933,7 +11921,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11933
11921
|
};
|
|
11934
11922
|
|
|
11935
11923
|
// src/features/subagents/copilot-subagent.ts
|
|
11936
|
-
import { join as
|
|
11924
|
+
import { join as join87 } from "path";
|
|
11937
11925
|
import { z as z45 } from "zod/mini";
|
|
11938
11926
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11939
11927
|
var CopilotSubagentFrontmatterSchema = z45.looseObject({
|
|
@@ -11959,7 +11947,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11959
11947
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11960
11948
|
if (!result.success) {
|
|
11961
11949
|
throw new Error(
|
|
11962
|
-
`Invalid frontmatter in ${
|
|
11950
|
+
`Invalid frontmatter in ${join87(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11963
11951
|
);
|
|
11964
11952
|
}
|
|
11965
11953
|
}
|
|
@@ -11971,7 +11959,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11971
11959
|
}
|
|
11972
11960
|
static getSettablePaths(_options = {}) {
|
|
11973
11961
|
return {
|
|
11974
|
-
relativeDirPath:
|
|
11962
|
+
relativeDirPath: join87(".github", "agents")
|
|
11975
11963
|
};
|
|
11976
11964
|
}
|
|
11977
11965
|
getFrontmatter() {
|
|
@@ -12045,7 +12033,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12045
12033
|
return {
|
|
12046
12034
|
success: false,
|
|
12047
12035
|
error: new Error(
|
|
12048
|
-
`Invalid frontmatter in ${
|
|
12036
|
+
`Invalid frontmatter in ${join87(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12049
12037
|
)
|
|
12050
12038
|
};
|
|
12051
12039
|
}
|
|
@@ -12063,7 +12051,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12063
12051
|
global = false
|
|
12064
12052
|
}) {
|
|
12065
12053
|
const paths = this.getSettablePaths({ global });
|
|
12066
|
-
const filePath =
|
|
12054
|
+
const filePath = join87(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12067
12055
|
const fileContent = await readFileContent(filePath);
|
|
12068
12056
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12069
12057
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12099,7 +12087,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12099
12087
|
};
|
|
12100
12088
|
|
|
12101
12089
|
// src/features/subagents/cursor-subagent.ts
|
|
12102
|
-
import { join as
|
|
12090
|
+
import { join as join88 } from "path";
|
|
12103
12091
|
import { z as z46 } from "zod/mini";
|
|
12104
12092
|
var CursorSubagentFrontmatterSchema = z46.looseObject({
|
|
12105
12093
|
name: z46.string(),
|
|
@@ -12113,7 +12101,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12113
12101
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12114
12102
|
if (!result.success) {
|
|
12115
12103
|
throw new Error(
|
|
12116
|
-
`Invalid frontmatter in ${
|
|
12104
|
+
`Invalid frontmatter in ${join88(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12117
12105
|
);
|
|
12118
12106
|
}
|
|
12119
12107
|
}
|
|
@@ -12125,7 +12113,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12125
12113
|
}
|
|
12126
12114
|
static getSettablePaths(_options = {}) {
|
|
12127
12115
|
return {
|
|
12128
|
-
relativeDirPath:
|
|
12116
|
+
relativeDirPath: join88(".cursor", "agents")
|
|
12129
12117
|
};
|
|
12130
12118
|
}
|
|
12131
12119
|
getFrontmatter() {
|
|
@@ -12192,7 +12180,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12192
12180
|
return {
|
|
12193
12181
|
success: false,
|
|
12194
12182
|
error: new Error(
|
|
12195
|
-
`Invalid frontmatter in ${
|
|
12183
|
+
`Invalid frontmatter in ${join88(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12196
12184
|
)
|
|
12197
12185
|
};
|
|
12198
12186
|
}
|
|
@@ -12210,7 +12198,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12210
12198
|
global = false
|
|
12211
12199
|
}) {
|
|
12212
12200
|
const paths = this.getSettablePaths({ global });
|
|
12213
|
-
const filePath =
|
|
12201
|
+
const filePath = join88(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12214
12202
|
const fileContent = await readFileContent(filePath);
|
|
12215
12203
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12216
12204
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12246,7 +12234,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12246
12234
|
};
|
|
12247
12235
|
|
|
12248
12236
|
// src/features/subagents/junie-subagent.ts
|
|
12249
|
-
import { join as
|
|
12237
|
+
import { join as join89 } from "path";
|
|
12250
12238
|
import { z as z47 } from "zod/mini";
|
|
12251
12239
|
var JunieSubagentFrontmatterSchema = z47.looseObject({
|
|
12252
12240
|
name: z47.optional(z47.string()),
|
|
@@ -12260,7 +12248,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12260
12248
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12261
12249
|
if (!result.success) {
|
|
12262
12250
|
throw new Error(
|
|
12263
|
-
`Invalid frontmatter in ${
|
|
12251
|
+
`Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12264
12252
|
);
|
|
12265
12253
|
}
|
|
12266
12254
|
}
|
|
@@ -12275,7 +12263,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12275
12263
|
throw new Error("JunieSubagent does not support global mode.");
|
|
12276
12264
|
}
|
|
12277
12265
|
return {
|
|
12278
|
-
relativeDirPath:
|
|
12266
|
+
relativeDirPath: join89(".junie", "agents")
|
|
12279
12267
|
};
|
|
12280
12268
|
}
|
|
12281
12269
|
getFrontmatter() {
|
|
@@ -12351,7 +12339,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12351
12339
|
return {
|
|
12352
12340
|
success: false,
|
|
12353
12341
|
error: new Error(
|
|
12354
|
-
`Invalid frontmatter in ${
|
|
12342
|
+
`Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12355
12343
|
)
|
|
12356
12344
|
};
|
|
12357
12345
|
}
|
|
@@ -12369,7 +12357,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12369
12357
|
global = false
|
|
12370
12358
|
}) {
|
|
12371
12359
|
const paths = this.getSettablePaths({ global });
|
|
12372
|
-
const filePath =
|
|
12360
|
+
const filePath = join89(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12373
12361
|
const fileContent = await readFileContent(filePath);
|
|
12374
12362
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12375
12363
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12404,7 +12392,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12404
12392
|
};
|
|
12405
12393
|
|
|
12406
12394
|
// src/features/subagents/kiro-subagent.ts
|
|
12407
|
-
import { join as
|
|
12395
|
+
import { join as join90 } from "path";
|
|
12408
12396
|
import { z as z48 } from "zod/mini";
|
|
12409
12397
|
var KiroCliSubagentJsonSchema = z48.looseObject({
|
|
12410
12398
|
name: z48.string(),
|
|
@@ -12431,7 +12419,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12431
12419
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
12432
12420
|
} catch (error) {
|
|
12433
12421
|
throw new Error(
|
|
12434
|
-
`Invalid JSON in ${
|
|
12422
|
+
`Invalid JSON in ${join90(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12435
12423
|
{ cause: error }
|
|
12436
12424
|
);
|
|
12437
12425
|
}
|
|
@@ -12443,7 +12431,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12443
12431
|
}
|
|
12444
12432
|
static getSettablePaths(_options = {}) {
|
|
12445
12433
|
return {
|
|
12446
|
-
relativeDirPath:
|
|
12434
|
+
relativeDirPath: join90(".kiro", "agents")
|
|
12447
12435
|
};
|
|
12448
12436
|
}
|
|
12449
12437
|
getBody() {
|
|
@@ -12455,7 +12443,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12455
12443
|
parsed = JSON.parse(this.body);
|
|
12456
12444
|
} catch (error) {
|
|
12457
12445
|
throw new Error(
|
|
12458
|
-
`Failed to parse JSON in ${
|
|
12446
|
+
`Failed to parse JSON in ${join90(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12459
12447
|
{ cause: error }
|
|
12460
12448
|
);
|
|
12461
12449
|
}
|
|
@@ -12536,7 +12524,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12536
12524
|
global = false
|
|
12537
12525
|
}) {
|
|
12538
12526
|
const paths = this.getSettablePaths({ global });
|
|
12539
|
-
const filePath =
|
|
12527
|
+
const filePath = join90(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12540
12528
|
const fileContent = await readFileContent(filePath);
|
|
12541
12529
|
const subagent = new _KiroSubagent({
|
|
12542
12530
|
baseDir,
|
|
@@ -12574,7 +12562,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12574
12562
|
};
|
|
12575
12563
|
|
|
12576
12564
|
// src/features/subagents/opencode-subagent.ts
|
|
12577
|
-
import { basename as basename8, join as
|
|
12565
|
+
import { basename as basename8, join as join91 } from "path";
|
|
12578
12566
|
import { z as z49 } from "zod/mini";
|
|
12579
12567
|
var OpenCodeSubagentFrontmatterSchema = z49.looseObject({
|
|
12580
12568
|
description: z49.optional(z49.string()),
|
|
@@ -12589,7 +12577,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12589
12577
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12590
12578
|
if (!result.success) {
|
|
12591
12579
|
throw new Error(
|
|
12592
|
-
`Invalid frontmatter in ${
|
|
12580
|
+
`Invalid frontmatter in ${join91(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12593
12581
|
);
|
|
12594
12582
|
}
|
|
12595
12583
|
}
|
|
@@ -12603,7 +12591,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12603
12591
|
global = false
|
|
12604
12592
|
} = {}) {
|
|
12605
12593
|
return {
|
|
12606
|
-
relativeDirPath: global ?
|
|
12594
|
+
relativeDirPath: global ? join91(".config", "opencode", "agent") : join91(".opencode", "agent")
|
|
12607
12595
|
};
|
|
12608
12596
|
}
|
|
12609
12597
|
getFrontmatter() {
|
|
@@ -12669,7 +12657,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12669
12657
|
return {
|
|
12670
12658
|
success: false,
|
|
12671
12659
|
error: new Error(
|
|
12672
|
-
`Invalid frontmatter in ${
|
|
12660
|
+
`Invalid frontmatter in ${join91(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12673
12661
|
)
|
|
12674
12662
|
};
|
|
12675
12663
|
}
|
|
@@ -12686,7 +12674,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12686
12674
|
global = false
|
|
12687
12675
|
}) {
|
|
12688
12676
|
const paths = this.getSettablePaths({ global });
|
|
12689
|
-
const filePath =
|
|
12677
|
+
const filePath = join91(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12690
12678
|
const fileContent = await readFileContent(filePath);
|
|
12691
12679
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12692
12680
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12853,9 +12841,10 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12853
12841
|
toolTarget,
|
|
12854
12842
|
global = false,
|
|
12855
12843
|
getFactory = defaultGetFactory5,
|
|
12856
|
-
dryRun = false
|
|
12844
|
+
dryRun = false,
|
|
12845
|
+
logger
|
|
12857
12846
|
}) {
|
|
12858
|
-
super({ baseDir, dryRun });
|
|
12847
|
+
super({ baseDir, dryRun, logger });
|
|
12859
12848
|
const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
12860
12849
|
if (!result.success) {
|
|
12861
12850
|
throw new Error(
|
|
@@ -12891,7 +12880,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12891
12880
|
const rulesyncSubagents = [];
|
|
12892
12881
|
for (const toolSubagent of toolSubagents) {
|
|
12893
12882
|
if (toolSubagent instanceof SimulatedSubagent) {
|
|
12894
|
-
logger.debug(
|
|
12883
|
+
this.logger.debug(
|
|
12895
12884
|
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
12896
12885
|
);
|
|
12897
12886
|
continue;
|
|
@@ -12905,39 +12894,39 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12905
12894
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12906
12895
|
*/
|
|
12907
12896
|
async loadRulesyncFiles() {
|
|
12908
|
-
const subagentsDir =
|
|
12897
|
+
const subagentsDir = join92(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12909
12898
|
const dirExists = await directoryExists(subagentsDir);
|
|
12910
12899
|
if (!dirExists) {
|
|
12911
|
-
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12900
|
+
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12912
12901
|
return [];
|
|
12913
12902
|
}
|
|
12914
12903
|
const entries = await listDirectoryFiles(subagentsDir);
|
|
12915
12904
|
const mdFiles = entries.filter((file) => file.endsWith(".md"));
|
|
12916
12905
|
if (mdFiles.length === 0) {
|
|
12917
|
-
logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12906
|
+
this.logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12918
12907
|
return [];
|
|
12919
12908
|
}
|
|
12920
|
-
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12909
|
+
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12921
12910
|
const rulesyncSubagents = [];
|
|
12922
12911
|
for (const mdFile of mdFiles) {
|
|
12923
|
-
const filepath =
|
|
12912
|
+
const filepath = join92(subagentsDir, mdFile);
|
|
12924
12913
|
try {
|
|
12925
12914
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12926
12915
|
relativeFilePath: mdFile,
|
|
12927
12916
|
validate: true
|
|
12928
12917
|
});
|
|
12929
12918
|
rulesyncSubagents.push(rulesyncSubagent);
|
|
12930
|
-
logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12919
|
+
this.logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12931
12920
|
} catch (error) {
|
|
12932
|
-
logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12921
|
+
this.logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12933
12922
|
continue;
|
|
12934
12923
|
}
|
|
12935
12924
|
}
|
|
12936
12925
|
if (rulesyncSubagents.length === 0) {
|
|
12937
|
-
logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12926
|
+
this.logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12938
12927
|
return [];
|
|
12939
12928
|
}
|
|
12940
|
-
logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12929
|
+
this.logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12941
12930
|
return rulesyncSubagents;
|
|
12942
12931
|
}
|
|
12943
12932
|
/**
|
|
@@ -12950,7 +12939,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12950
12939
|
const factory = this.getFactory(this.toolTarget);
|
|
12951
12940
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12952
12941
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12953
|
-
|
|
12942
|
+
join92(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12954
12943
|
);
|
|
12955
12944
|
if (forDeletion) {
|
|
12956
12945
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -12961,7 +12950,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12961
12950
|
global: this.global
|
|
12962
12951
|
})
|
|
12963
12952
|
).filter((subagent) => subagent.isDeletable());
|
|
12964
|
-
logger.debug(
|
|
12953
|
+
this.logger.debug(
|
|
12965
12954
|
`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`
|
|
12966
12955
|
);
|
|
12967
12956
|
return toolSubagents2;
|
|
@@ -12975,7 +12964,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12975
12964
|
})
|
|
12976
12965
|
)
|
|
12977
12966
|
);
|
|
12978
|
-
logger.debug(
|
|
12967
|
+
this.logger.debug(
|
|
12968
|
+
`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`
|
|
12969
|
+
);
|
|
12979
12970
|
return toolSubagents;
|
|
12980
12971
|
}
|
|
12981
12972
|
/**
|
|
@@ -13015,13 +13006,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
13015
13006
|
};
|
|
13016
13007
|
|
|
13017
13008
|
// src/features/rules/agentsmd-rule.ts
|
|
13018
|
-
import { join as
|
|
13009
|
+
import { join as join95 } from "path";
|
|
13019
13010
|
|
|
13020
13011
|
// src/features/rules/tool-rule.ts
|
|
13021
|
-
import { join as
|
|
13012
|
+
import { join as join94 } from "path";
|
|
13022
13013
|
|
|
13023
13014
|
// src/features/rules/rulesync-rule.ts
|
|
13024
|
-
import { join as
|
|
13015
|
+
import { join as join93 } from "path";
|
|
13025
13016
|
import { z as z51 } from "zod/mini";
|
|
13026
13017
|
var RulesyncRuleFrontmatterSchema = z51.object({
|
|
13027
13018
|
root: z51.optional(z51.boolean()),
|
|
@@ -13068,7 +13059,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13068
13059
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13069
13060
|
if (!parseResult.success && rest.validate !== false) {
|
|
13070
13061
|
throw new Error(
|
|
13071
|
-
`Invalid frontmatter in ${
|
|
13062
|
+
`Invalid frontmatter in ${join93(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
13072
13063
|
);
|
|
13073
13064
|
}
|
|
13074
13065
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -13103,7 +13094,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13103
13094
|
return {
|
|
13104
13095
|
success: false,
|
|
13105
13096
|
error: new Error(
|
|
13106
|
-
`Invalid frontmatter in ${
|
|
13097
|
+
`Invalid frontmatter in ${join93(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13107
13098
|
)
|
|
13108
13099
|
};
|
|
13109
13100
|
}
|
|
@@ -13112,7 +13103,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13112
13103
|
relativeFilePath,
|
|
13113
13104
|
validate = true
|
|
13114
13105
|
}) {
|
|
13115
|
-
const filePath =
|
|
13106
|
+
const filePath = join93(
|
|
13116
13107
|
process.cwd(),
|
|
13117
13108
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
13118
13109
|
relativeFilePath
|
|
@@ -13214,7 +13205,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13214
13205
|
rulesyncRule,
|
|
13215
13206
|
validate = true,
|
|
13216
13207
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
13217
|
-
nonRootPath = { relativeDirPath:
|
|
13208
|
+
nonRootPath = { relativeDirPath: join94(".agents", "memories") }
|
|
13218
13209
|
}) {
|
|
13219
13210
|
const params = this.buildToolRuleParamsDefault({
|
|
13220
13211
|
baseDir,
|
|
@@ -13225,7 +13216,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13225
13216
|
});
|
|
13226
13217
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
13227
13218
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
13228
|
-
params.relativeDirPath =
|
|
13219
|
+
params.relativeDirPath = join94(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
13229
13220
|
params.relativeFilePath = "AGENTS.md";
|
|
13230
13221
|
}
|
|
13231
13222
|
return params;
|
|
@@ -13274,7 +13265,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13274
13265
|
}
|
|
13275
13266
|
};
|
|
13276
13267
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
13277
|
-
return excludeToolDir ? subDir :
|
|
13268
|
+
return excludeToolDir ? subDir : join94(toolDir, subDir);
|
|
13278
13269
|
}
|
|
13279
13270
|
|
|
13280
13271
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -13303,8 +13294,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13303
13294
|
validate = true
|
|
13304
13295
|
}) {
|
|
13305
13296
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
13306
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
13307
|
-
const fileContent = await readFileContent(
|
|
13297
|
+
const relativePath = isRoot ? "AGENTS.md" : join95(".agents", "memories", relativeFilePath);
|
|
13298
|
+
const fileContent = await readFileContent(join95(baseDir, relativePath));
|
|
13308
13299
|
return new _AgentsMdRule({
|
|
13309
13300
|
baseDir,
|
|
13310
13301
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13359,7 +13350,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13359
13350
|
};
|
|
13360
13351
|
|
|
13361
13352
|
// src/features/rules/antigravity-rule.ts
|
|
13362
|
-
import { join as
|
|
13353
|
+
import { join as join96 } from "path";
|
|
13363
13354
|
import { z as z52 } from "zod/mini";
|
|
13364
13355
|
var AntigravityRuleFrontmatterSchema = z52.looseObject({
|
|
13365
13356
|
trigger: z52.optional(
|
|
@@ -13518,7 +13509,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13518
13509
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13519
13510
|
if (!result.success) {
|
|
13520
13511
|
throw new Error(
|
|
13521
|
-
`Invalid frontmatter in ${
|
|
13512
|
+
`Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13522
13513
|
);
|
|
13523
13514
|
}
|
|
13524
13515
|
}
|
|
@@ -13542,7 +13533,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13542
13533
|
relativeFilePath,
|
|
13543
13534
|
validate = true
|
|
13544
13535
|
}) {
|
|
13545
|
-
const filePath =
|
|
13536
|
+
const filePath = join96(
|
|
13546
13537
|
baseDir,
|
|
13547
13538
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13548
13539
|
relativeFilePath
|
|
@@ -13682,7 +13673,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13682
13673
|
};
|
|
13683
13674
|
|
|
13684
13675
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
13685
|
-
import { join as
|
|
13676
|
+
import { join as join97 } from "path";
|
|
13686
13677
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
13687
13678
|
toRulesyncRule() {
|
|
13688
13679
|
const rulesyncFrontmatter = {
|
|
@@ -13742,8 +13733,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13742
13733
|
}) {
|
|
13743
13734
|
const settablePaths = this.getSettablePaths();
|
|
13744
13735
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
13745
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
13746
|
-
const fileContent = await readFileContent(
|
|
13736
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join97(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13737
|
+
const fileContent = await readFileContent(join97(baseDir, relativePath));
|
|
13747
13738
|
return new _AugmentcodeLegacyRule({
|
|
13748
13739
|
baseDir,
|
|
13749
13740
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -13772,7 +13763,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13772
13763
|
};
|
|
13773
13764
|
|
|
13774
13765
|
// src/features/rules/augmentcode-rule.ts
|
|
13775
|
-
import { join as
|
|
13766
|
+
import { join as join98 } from "path";
|
|
13776
13767
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
13777
13768
|
toRulesyncRule() {
|
|
13778
13769
|
return this.toRulesyncRuleDefault();
|
|
@@ -13803,7 +13794,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13803
13794
|
relativeFilePath,
|
|
13804
13795
|
validate = true
|
|
13805
13796
|
}) {
|
|
13806
|
-
const filePath =
|
|
13797
|
+
const filePath = join98(
|
|
13807
13798
|
baseDir,
|
|
13808
13799
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13809
13800
|
relativeFilePath
|
|
@@ -13843,7 +13834,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13843
13834
|
};
|
|
13844
13835
|
|
|
13845
13836
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13846
|
-
import { join as
|
|
13837
|
+
import { join as join99 } from "path";
|
|
13847
13838
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13848
13839
|
static getSettablePaths({
|
|
13849
13840
|
global,
|
|
@@ -13885,7 +13876,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13885
13876
|
if (isRoot) {
|
|
13886
13877
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13887
13878
|
const fileContent2 = await readFileContent(
|
|
13888
|
-
|
|
13879
|
+
join99(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13889
13880
|
);
|
|
13890
13881
|
return new _ClaudecodeLegacyRule({
|
|
13891
13882
|
baseDir,
|
|
@@ -13899,8 +13890,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13899
13890
|
if (!paths.nonRoot) {
|
|
13900
13891
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13901
13892
|
}
|
|
13902
|
-
const relativePath =
|
|
13903
|
-
const fileContent = await readFileContent(
|
|
13893
|
+
const relativePath = join99(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13894
|
+
const fileContent = await readFileContent(join99(baseDir, relativePath));
|
|
13904
13895
|
return new _ClaudecodeLegacyRule({
|
|
13905
13896
|
baseDir,
|
|
13906
13897
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13959,7 +13950,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13959
13950
|
};
|
|
13960
13951
|
|
|
13961
13952
|
// src/features/rules/claudecode-rule.ts
|
|
13962
|
-
import { join as
|
|
13953
|
+
import { join as join100 } from "path";
|
|
13963
13954
|
import { z as z53 } from "zod/mini";
|
|
13964
13955
|
var ClaudecodeRuleFrontmatterSchema = z53.object({
|
|
13965
13956
|
paths: z53.optional(z53.array(z53.string()))
|
|
@@ -14000,7 +13991,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14000
13991
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14001
13992
|
if (!result.success) {
|
|
14002
13993
|
throw new Error(
|
|
14003
|
-
`Invalid frontmatter in ${
|
|
13994
|
+
`Invalid frontmatter in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14004
13995
|
);
|
|
14005
13996
|
}
|
|
14006
13997
|
}
|
|
@@ -14030,7 +14021,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14030
14021
|
if (isRoot) {
|
|
14031
14022
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
14032
14023
|
const fileContent2 = await readFileContent(
|
|
14033
|
-
|
|
14024
|
+
join100(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
14034
14025
|
);
|
|
14035
14026
|
return new _ClaudecodeRule({
|
|
14036
14027
|
baseDir,
|
|
@@ -14045,8 +14036,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14045
14036
|
if (!paths.nonRoot) {
|
|
14046
14037
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14047
14038
|
}
|
|
14048
|
-
const relativePath =
|
|
14049
|
-
const filePath =
|
|
14039
|
+
const relativePath = join100(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14040
|
+
const filePath = join100(baseDir, relativePath);
|
|
14050
14041
|
const fileContent = await readFileContent(filePath);
|
|
14051
14042
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14052
14043
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14157,7 +14148,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14157
14148
|
return {
|
|
14158
14149
|
success: false,
|
|
14159
14150
|
error: new Error(
|
|
14160
|
-
`Invalid frontmatter in ${
|
|
14151
|
+
`Invalid frontmatter in ${join100(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14161
14152
|
)
|
|
14162
14153
|
};
|
|
14163
14154
|
}
|
|
@@ -14177,7 +14168,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14177
14168
|
};
|
|
14178
14169
|
|
|
14179
14170
|
// src/features/rules/cline-rule.ts
|
|
14180
|
-
import { join as
|
|
14171
|
+
import { join as join101 } from "path";
|
|
14181
14172
|
import { z as z54 } from "zod/mini";
|
|
14182
14173
|
var ClineRuleFrontmatterSchema = z54.object({
|
|
14183
14174
|
description: z54.string()
|
|
@@ -14223,7 +14214,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14223
14214
|
validate = true
|
|
14224
14215
|
}) {
|
|
14225
14216
|
const fileContent = await readFileContent(
|
|
14226
|
-
|
|
14217
|
+
join101(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14227
14218
|
);
|
|
14228
14219
|
return new _ClineRule({
|
|
14229
14220
|
baseDir,
|
|
@@ -14249,7 +14240,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14249
14240
|
};
|
|
14250
14241
|
|
|
14251
14242
|
// src/features/rules/codexcli-rule.ts
|
|
14252
|
-
import { join as
|
|
14243
|
+
import { join as join102 } from "path";
|
|
14253
14244
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
14254
14245
|
static getSettablePaths({
|
|
14255
14246
|
global,
|
|
@@ -14284,7 +14275,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14284
14275
|
if (isRoot) {
|
|
14285
14276
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14286
14277
|
const fileContent2 = await readFileContent(
|
|
14287
|
-
|
|
14278
|
+
join102(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14288
14279
|
);
|
|
14289
14280
|
return new _CodexcliRule({
|
|
14290
14281
|
baseDir,
|
|
@@ -14298,8 +14289,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14298
14289
|
if (!paths.nonRoot) {
|
|
14299
14290
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14300
14291
|
}
|
|
14301
|
-
const relativePath =
|
|
14302
|
-
const fileContent = await readFileContent(
|
|
14292
|
+
const relativePath = join102(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14293
|
+
const fileContent = await readFileContent(join102(baseDir, relativePath));
|
|
14303
14294
|
return new _CodexcliRule({
|
|
14304
14295
|
baseDir,
|
|
14305
14296
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14358,7 +14349,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14358
14349
|
};
|
|
14359
14350
|
|
|
14360
14351
|
// src/features/rules/copilot-rule.ts
|
|
14361
|
-
import { join as
|
|
14352
|
+
import { join as join103 } from "path";
|
|
14362
14353
|
import { z as z55 } from "zod/mini";
|
|
14363
14354
|
var CopilotRuleFrontmatterSchema = z55.object({
|
|
14364
14355
|
description: z55.optional(z55.string()),
|
|
@@ -14395,7 +14386,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14395
14386
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14396
14387
|
if (!result.success) {
|
|
14397
14388
|
throw new Error(
|
|
14398
|
-
`Invalid frontmatter in ${
|
|
14389
|
+
`Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14399
14390
|
);
|
|
14400
14391
|
}
|
|
14401
14392
|
}
|
|
@@ -14485,8 +14476,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14485
14476
|
const paths = this.getSettablePaths({ global });
|
|
14486
14477
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14487
14478
|
if (isRoot) {
|
|
14488
|
-
const relativePath2 =
|
|
14489
|
-
const filePath2 =
|
|
14479
|
+
const relativePath2 = join103(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14480
|
+
const filePath2 = join103(baseDir, relativePath2);
|
|
14490
14481
|
const fileContent2 = await readFileContent(filePath2);
|
|
14491
14482
|
return new _CopilotRule({
|
|
14492
14483
|
baseDir,
|
|
@@ -14501,8 +14492,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14501
14492
|
if (!paths.nonRoot) {
|
|
14502
14493
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14503
14494
|
}
|
|
14504
|
-
const relativePath =
|
|
14505
|
-
const filePath =
|
|
14495
|
+
const relativePath = join103(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14496
|
+
const filePath = join103(baseDir, relativePath);
|
|
14506
14497
|
const fileContent = await readFileContent(filePath);
|
|
14507
14498
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14508
14499
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14548,7 +14539,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14548
14539
|
return {
|
|
14549
14540
|
success: false,
|
|
14550
14541
|
error: new Error(
|
|
14551
|
-
`Invalid frontmatter in ${
|
|
14542
|
+
`Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14552
14543
|
)
|
|
14553
14544
|
};
|
|
14554
14545
|
}
|
|
@@ -14568,7 +14559,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14568
14559
|
};
|
|
14569
14560
|
|
|
14570
14561
|
// src/features/rules/cursor-rule.ts
|
|
14571
|
-
import { join as
|
|
14562
|
+
import { join as join104 } from "path";
|
|
14572
14563
|
import { z as z56 } from "zod/mini";
|
|
14573
14564
|
var CursorRuleFrontmatterSchema = z56.object({
|
|
14574
14565
|
description: z56.optional(z56.string()),
|
|
@@ -14590,7 +14581,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14590
14581
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14591
14582
|
if (!result.success) {
|
|
14592
14583
|
throw new Error(
|
|
14593
|
-
`Invalid frontmatter in ${
|
|
14584
|
+
`Invalid frontmatter in ${join104(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14594
14585
|
);
|
|
14595
14586
|
}
|
|
14596
14587
|
}
|
|
@@ -14706,7 +14697,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14706
14697
|
relativeFilePath,
|
|
14707
14698
|
validate = true
|
|
14708
14699
|
}) {
|
|
14709
|
-
const filePath =
|
|
14700
|
+
const filePath = join104(
|
|
14710
14701
|
baseDir,
|
|
14711
14702
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14712
14703
|
relativeFilePath
|
|
@@ -14716,7 +14707,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14716
14707
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14717
14708
|
if (!result.success) {
|
|
14718
14709
|
throw new Error(
|
|
14719
|
-
`Invalid frontmatter in ${
|
|
14710
|
+
`Invalid frontmatter in ${join104(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
14720
14711
|
);
|
|
14721
14712
|
}
|
|
14722
14713
|
return new _CursorRule({
|
|
@@ -14753,7 +14744,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14753
14744
|
return {
|
|
14754
14745
|
success: false,
|
|
14755
14746
|
error: new Error(
|
|
14756
|
-
`Invalid frontmatter in ${
|
|
14747
|
+
`Invalid frontmatter in ${join104(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14757
14748
|
)
|
|
14758
14749
|
};
|
|
14759
14750
|
}
|
|
@@ -14773,7 +14764,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14773
14764
|
};
|
|
14774
14765
|
|
|
14775
14766
|
// src/features/rules/factorydroid-rule.ts
|
|
14776
|
-
import { join as
|
|
14767
|
+
import { join as join105 } from "path";
|
|
14777
14768
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
14778
14769
|
constructor({ fileContent, root, ...rest }) {
|
|
14779
14770
|
super({
|
|
@@ -14813,8 +14804,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14813
14804
|
const paths = this.getSettablePaths({ global });
|
|
14814
14805
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14815
14806
|
if (isRoot) {
|
|
14816
|
-
const relativePath2 =
|
|
14817
|
-
const fileContent2 = await readFileContent(
|
|
14807
|
+
const relativePath2 = join105(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14808
|
+
const fileContent2 = await readFileContent(join105(baseDir, relativePath2));
|
|
14818
14809
|
return new _FactorydroidRule({
|
|
14819
14810
|
baseDir,
|
|
14820
14811
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14827,8 +14818,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14827
14818
|
if (!paths.nonRoot) {
|
|
14828
14819
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14829
14820
|
}
|
|
14830
|
-
const relativePath =
|
|
14831
|
-
const fileContent = await readFileContent(
|
|
14821
|
+
const relativePath = join105(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14822
|
+
const fileContent = await readFileContent(join105(baseDir, relativePath));
|
|
14832
14823
|
return new _FactorydroidRule({
|
|
14833
14824
|
baseDir,
|
|
14834
14825
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14887,7 +14878,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14887
14878
|
};
|
|
14888
14879
|
|
|
14889
14880
|
// src/features/rules/geminicli-rule.ts
|
|
14890
|
-
import { join as
|
|
14881
|
+
import { join as join106 } from "path";
|
|
14891
14882
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14892
14883
|
static getSettablePaths({
|
|
14893
14884
|
global,
|
|
@@ -14922,7 +14913,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14922
14913
|
if (isRoot) {
|
|
14923
14914
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14924
14915
|
const fileContent2 = await readFileContent(
|
|
14925
|
-
|
|
14916
|
+
join106(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14926
14917
|
);
|
|
14927
14918
|
return new _GeminiCliRule({
|
|
14928
14919
|
baseDir,
|
|
@@ -14936,8 +14927,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14936
14927
|
if (!paths.nonRoot) {
|
|
14937
14928
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14938
14929
|
}
|
|
14939
|
-
const relativePath =
|
|
14940
|
-
const fileContent = await readFileContent(
|
|
14930
|
+
const relativePath = join106(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14931
|
+
const fileContent = await readFileContent(join106(baseDir, relativePath));
|
|
14941
14932
|
return new _GeminiCliRule({
|
|
14942
14933
|
baseDir,
|
|
14943
14934
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14996,7 +14987,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14996
14987
|
};
|
|
14997
14988
|
|
|
14998
14989
|
// src/features/rules/goose-rule.ts
|
|
14999
|
-
import { join as
|
|
14990
|
+
import { join as join107 } from "path";
|
|
15000
14991
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
15001
14992
|
static getSettablePaths({
|
|
15002
14993
|
global,
|
|
@@ -15031,7 +15022,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15031
15022
|
if (isRoot) {
|
|
15032
15023
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15033
15024
|
const fileContent2 = await readFileContent(
|
|
15034
|
-
|
|
15025
|
+
join107(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15035
15026
|
);
|
|
15036
15027
|
return new _GooseRule({
|
|
15037
15028
|
baseDir,
|
|
@@ -15045,8 +15036,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15045
15036
|
if (!paths.nonRoot) {
|
|
15046
15037
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15047
15038
|
}
|
|
15048
|
-
const relativePath =
|
|
15049
|
-
const fileContent = await readFileContent(
|
|
15039
|
+
const relativePath = join107(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15040
|
+
const fileContent = await readFileContent(join107(baseDir, relativePath));
|
|
15050
15041
|
return new _GooseRule({
|
|
15051
15042
|
baseDir,
|
|
15052
15043
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15105,7 +15096,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15105
15096
|
};
|
|
15106
15097
|
|
|
15107
15098
|
// src/features/rules/junie-rule.ts
|
|
15108
|
-
import { join as
|
|
15099
|
+
import { join as join108 } from "path";
|
|
15109
15100
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
15110
15101
|
static getSettablePaths(_options = {}) {
|
|
15111
15102
|
return {
|
|
@@ -15124,8 +15115,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15124
15115
|
validate = true
|
|
15125
15116
|
}) {
|
|
15126
15117
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
15127
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
15128
|
-
const fileContent = await readFileContent(
|
|
15118
|
+
const relativePath = isRoot ? "guidelines.md" : join108(".junie", "memories", relativeFilePath);
|
|
15119
|
+
const fileContent = await readFileContent(join108(baseDir, relativePath));
|
|
15129
15120
|
return new _JunieRule({
|
|
15130
15121
|
baseDir,
|
|
15131
15122
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15180,7 +15171,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15180
15171
|
};
|
|
15181
15172
|
|
|
15182
15173
|
// src/features/rules/kilo-rule.ts
|
|
15183
|
-
import { join as
|
|
15174
|
+
import { join as join109 } from "path";
|
|
15184
15175
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
15185
15176
|
static getSettablePaths(_options = {}) {
|
|
15186
15177
|
return {
|
|
@@ -15195,7 +15186,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15195
15186
|
validate = true
|
|
15196
15187
|
}) {
|
|
15197
15188
|
const fileContent = await readFileContent(
|
|
15198
|
-
|
|
15189
|
+
join109(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15199
15190
|
);
|
|
15200
15191
|
return new _KiloRule({
|
|
15201
15192
|
baseDir,
|
|
@@ -15247,7 +15238,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15247
15238
|
};
|
|
15248
15239
|
|
|
15249
15240
|
// src/features/rules/kiro-rule.ts
|
|
15250
|
-
import { join as
|
|
15241
|
+
import { join as join110 } from "path";
|
|
15251
15242
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
15252
15243
|
static getSettablePaths(_options = {}) {
|
|
15253
15244
|
return {
|
|
@@ -15262,7 +15253,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15262
15253
|
validate = true
|
|
15263
15254
|
}) {
|
|
15264
15255
|
const fileContent = await readFileContent(
|
|
15265
|
-
|
|
15256
|
+
join110(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15266
15257
|
);
|
|
15267
15258
|
return new _KiroRule({
|
|
15268
15259
|
baseDir,
|
|
@@ -15316,7 +15307,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15316
15307
|
};
|
|
15317
15308
|
|
|
15318
15309
|
// src/features/rules/opencode-rule.ts
|
|
15319
|
-
import { join as
|
|
15310
|
+
import { join as join111 } from "path";
|
|
15320
15311
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
15321
15312
|
static getSettablePaths({
|
|
15322
15313
|
global,
|
|
@@ -15351,7 +15342,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15351
15342
|
if (isRoot) {
|
|
15352
15343
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15353
15344
|
const fileContent2 = await readFileContent(
|
|
15354
|
-
|
|
15345
|
+
join111(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15355
15346
|
);
|
|
15356
15347
|
return new _OpenCodeRule({
|
|
15357
15348
|
baseDir,
|
|
@@ -15365,8 +15356,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15365
15356
|
if (!paths.nonRoot) {
|
|
15366
15357
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15367
15358
|
}
|
|
15368
|
-
const relativePath =
|
|
15369
|
-
const fileContent = await readFileContent(
|
|
15359
|
+
const relativePath = join111(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15360
|
+
const fileContent = await readFileContent(join111(baseDir, relativePath));
|
|
15370
15361
|
return new _OpenCodeRule({
|
|
15371
15362
|
baseDir,
|
|
15372
15363
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15425,7 +15416,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15425
15416
|
};
|
|
15426
15417
|
|
|
15427
15418
|
// src/features/rules/qwencode-rule.ts
|
|
15428
|
-
import { join as
|
|
15419
|
+
import { join as join112 } from "path";
|
|
15429
15420
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
15430
15421
|
static getSettablePaths(_options = {}) {
|
|
15431
15422
|
return {
|
|
@@ -15444,8 +15435,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15444
15435
|
validate = true
|
|
15445
15436
|
}) {
|
|
15446
15437
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
15447
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
15448
|
-
const fileContent = await readFileContent(
|
|
15438
|
+
const relativePath = isRoot ? "QWEN.md" : join112(".qwen", "memories", relativeFilePath);
|
|
15439
|
+
const fileContent = await readFileContent(join112(baseDir, relativePath));
|
|
15449
15440
|
return new _QwencodeRule({
|
|
15450
15441
|
baseDir,
|
|
15451
15442
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15497,7 +15488,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15497
15488
|
};
|
|
15498
15489
|
|
|
15499
15490
|
// src/features/rules/replit-rule.ts
|
|
15500
|
-
import { join as
|
|
15491
|
+
import { join as join113 } from "path";
|
|
15501
15492
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
15502
15493
|
static getSettablePaths(_options = {}) {
|
|
15503
15494
|
return {
|
|
@@ -15519,7 +15510,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15519
15510
|
}
|
|
15520
15511
|
const relativePath = paths.root.relativeFilePath;
|
|
15521
15512
|
const fileContent = await readFileContent(
|
|
15522
|
-
|
|
15513
|
+
join113(baseDir, paths.root.relativeDirPath, relativePath)
|
|
15523
15514
|
);
|
|
15524
15515
|
return new _ReplitRule({
|
|
15525
15516
|
baseDir,
|
|
@@ -15585,7 +15576,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15585
15576
|
};
|
|
15586
15577
|
|
|
15587
15578
|
// src/features/rules/roo-rule.ts
|
|
15588
|
-
import { join as
|
|
15579
|
+
import { join as join114 } from "path";
|
|
15589
15580
|
var RooRule = class _RooRule extends ToolRule {
|
|
15590
15581
|
static getSettablePaths(_options = {}) {
|
|
15591
15582
|
return {
|
|
@@ -15600,7 +15591,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15600
15591
|
validate = true
|
|
15601
15592
|
}) {
|
|
15602
15593
|
const fileContent = await readFileContent(
|
|
15603
|
-
|
|
15594
|
+
join114(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15604
15595
|
);
|
|
15605
15596
|
return new _RooRule({
|
|
15606
15597
|
baseDir,
|
|
@@ -15669,7 +15660,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15669
15660
|
};
|
|
15670
15661
|
|
|
15671
15662
|
// src/features/rules/warp-rule.ts
|
|
15672
|
-
import { join as
|
|
15663
|
+
import { join as join115 } from "path";
|
|
15673
15664
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
15674
15665
|
constructor({ fileContent, root, ...rest }) {
|
|
15675
15666
|
super({
|
|
@@ -15695,8 +15686,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15695
15686
|
validate = true
|
|
15696
15687
|
}) {
|
|
15697
15688
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
15698
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
15699
|
-
const fileContent = await readFileContent(
|
|
15689
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join115(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15690
|
+
const fileContent = await readFileContent(join115(baseDir, relativePath));
|
|
15700
15691
|
return new _WarpRule({
|
|
15701
15692
|
baseDir,
|
|
15702
15693
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -15751,7 +15742,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15751
15742
|
};
|
|
15752
15743
|
|
|
15753
15744
|
// src/features/rules/windsurf-rule.ts
|
|
15754
|
-
import { join as
|
|
15745
|
+
import { join as join116 } from "path";
|
|
15755
15746
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
15756
15747
|
static getSettablePaths(_options = {}) {
|
|
15757
15748
|
return {
|
|
@@ -15766,7 +15757,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
15766
15757
|
validate = true
|
|
15767
15758
|
}) {
|
|
15768
15759
|
const fileContent = await readFileContent(
|
|
15769
|
-
|
|
15760
|
+
join116(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15770
15761
|
);
|
|
15771
15762
|
return new _WindsurfRule({
|
|
15772
15763
|
baseDir,
|
|
@@ -15843,7 +15834,7 @@ var rulesProcessorToolTargets = [
|
|
|
15843
15834
|
"windsurf"
|
|
15844
15835
|
];
|
|
15845
15836
|
var RulesProcessorToolTargetSchema = z57.enum(rulesProcessorToolTargets);
|
|
15846
|
-
var formatRulePaths = (rules) => rules.map((r) =>
|
|
15837
|
+
var formatRulePaths = (rules) => rules.map((r) => join117(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15847
15838
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15848
15839
|
[
|
|
15849
15840
|
"agentsmd",
|
|
@@ -16130,9 +16121,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16130
16121
|
global = false,
|
|
16131
16122
|
getFactory = defaultGetFactory6,
|
|
16132
16123
|
skills,
|
|
16133
|
-
dryRun = false
|
|
16124
|
+
dryRun = false,
|
|
16125
|
+
logger
|
|
16134
16126
|
}) {
|
|
16135
|
-
super({ baseDir, dryRun });
|
|
16127
|
+
super({ baseDir, dryRun, logger });
|
|
16136
16128
|
const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
|
|
16137
16129
|
if (!result.success) {
|
|
16138
16130
|
throw new Error(
|
|
@@ -16218,7 +16210,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16218
16210
|
}).relativeDirPath;
|
|
16219
16211
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
16220
16212
|
const frontmatter = skill.getFrontmatter();
|
|
16221
|
-
const relativePath =
|
|
16213
|
+
const relativePath = join117(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
16222
16214
|
return {
|
|
16223
16215
|
name: frontmatter.name,
|
|
16224
16216
|
description: frontmatter.description,
|
|
@@ -16331,9 +16323,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16331
16323
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
16332
16324
|
*/
|
|
16333
16325
|
async loadRulesyncFiles() {
|
|
16334
|
-
const rulesyncBaseDir =
|
|
16335
|
-
const files = await findFilesByGlobs(
|
|
16336
|
-
logger.debug(`Found ${files.length} rulesync files`);
|
|
16326
|
+
const rulesyncBaseDir = join117(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
16327
|
+
const files = await findFilesByGlobs(join117(rulesyncBaseDir, "**", "*.md"));
|
|
16328
|
+
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
16337
16329
|
const rulesyncRules = await Promise.all(
|
|
16338
16330
|
files.map((file) => {
|
|
16339
16331
|
const relativeFilePath = relative5(rulesyncBaseDir, file);
|
|
@@ -16357,7 +16349,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16357
16349
|
);
|
|
16358
16350
|
}
|
|
16359
16351
|
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
16360
|
-
logger.warn(
|
|
16352
|
+
this.logger.warn(
|
|
16361
16353
|
`No root rulesync rule file found for target '${this.toolTarget}'. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
16362
16354
|
);
|
|
16363
16355
|
}
|
|
@@ -16382,12 +16374,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16382
16374
|
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
16383
16375
|
);
|
|
16384
16376
|
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
16385
|
-
logger.warn(
|
|
16377
|
+
this.logger.warn(
|
|
16386
16378
|
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
16387
16379
|
);
|
|
16388
16380
|
}
|
|
16389
16381
|
if (targetedLocalRootRules.length > 0) {
|
|
16390
|
-
logger.warn(
|
|
16382
|
+
this.logger.warn(
|
|
16391
16383
|
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
16392
16384
|
);
|
|
16393
16385
|
}
|
|
@@ -16429,13 +16421,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16429
16421
|
return [];
|
|
16430
16422
|
}
|
|
16431
16423
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
16432
|
-
|
|
16424
|
+
join117(
|
|
16433
16425
|
this.baseDir,
|
|
16434
16426
|
settablePaths.root.relativeDirPath ?? ".",
|
|
16435
16427
|
settablePaths.root.relativeFilePath
|
|
16436
16428
|
),
|
|
16437
16429
|
settablePaths.alternativeRoots,
|
|
16438
|
-
(alt) =>
|
|
16430
|
+
(alt) => join117(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
16439
16431
|
);
|
|
16440
16432
|
if (forDeletion) {
|
|
16441
16433
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -16468,7 +16460,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16468
16460
|
})
|
|
16469
16461
|
);
|
|
16470
16462
|
})();
|
|
16471
|
-
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16463
|
+
this.logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16472
16464
|
const localRootToolRules = await (async () => {
|
|
16473
16465
|
if (!forDeletion) {
|
|
16474
16466
|
return [];
|
|
@@ -16480,9 +16472,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16480
16472
|
return [];
|
|
16481
16473
|
}
|
|
16482
16474
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
16483
|
-
|
|
16475
|
+
join117(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
16484
16476
|
settablePaths.alternativeRoots,
|
|
16485
|
-
(alt) =>
|
|
16477
|
+
(alt) => join117(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
16486
16478
|
);
|
|
16487
16479
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
16488
16480
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -16498,14 +16490,16 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16498
16490
|
});
|
|
16499
16491
|
}).filter((rule) => rule.isDeletable());
|
|
16500
16492
|
})();
|
|
16501
|
-
logger.debug(
|
|
16493
|
+
this.logger.debug(
|
|
16494
|
+
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
16495
|
+
);
|
|
16502
16496
|
const nonRootToolRules = await (async () => {
|
|
16503
16497
|
if (!settablePaths.nonRoot) {
|
|
16504
16498
|
return [];
|
|
16505
16499
|
}
|
|
16506
|
-
const nonRootBaseDir =
|
|
16500
|
+
const nonRootBaseDir = join117(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
16507
16501
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
16508
|
-
|
|
16502
|
+
join117(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
16509
16503
|
);
|
|
16510
16504
|
if (forDeletion) {
|
|
16511
16505
|
return nonRootFilePaths.map((filePath) => {
|
|
@@ -16537,10 +16531,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16537
16531
|
})
|
|
16538
16532
|
);
|
|
16539
16533
|
})();
|
|
16540
|
-
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16534
|
+
this.logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16541
16535
|
return [...rootToolRules, ...localRootToolRules, ...nonRootToolRules];
|
|
16542
16536
|
} catch (error) {
|
|
16543
|
-
logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16537
|
+
this.logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16544
16538
|
return [];
|
|
16545
16539
|
}
|
|
16546
16540
|
}
|
|
@@ -16637,14 +16631,14 @@ s/<command> [arguments]
|
|
|
16637
16631
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
16638
16632
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
16639
16633
|
|
|
16640
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
16634
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join117(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
16641
16635
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
16642
16636
|
|
|
16643
16637
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
16644
16638
|
|
|
16645
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
16639
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join117(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
16646
16640
|
|
|
16647
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
16641
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join117(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
16648
16642
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
16649
16643
|
const result = [
|
|
16650
16644
|
overview,
|
|
@@ -16716,7 +16710,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16716
16710
|
return { count: totalCount, paths: [], hasDiff };
|
|
16717
16711
|
}
|
|
16718
16712
|
function warnUnsupportedTargets(params) {
|
|
16719
|
-
const { config, supportedTargets, featureName } = params;
|
|
16713
|
+
const { config, supportedTargets, featureName, logger } = params;
|
|
16720
16714
|
for (const target of config.getTargets()) {
|
|
16721
16715
|
if (!supportedTargets.includes(target) && config.getFeatures(target).includes(featureName)) {
|
|
16722
16716
|
logger.warn(`Target '${target}' does not support the feature '${featureName}'. Skipping.`);
|
|
@@ -16724,17 +16718,17 @@ function warnUnsupportedTargets(params) {
|
|
|
16724
16718
|
}
|
|
16725
16719
|
}
|
|
16726
16720
|
async function checkRulesyncDirExists(params) {
|
|
16727
|
-
return fileExists(
|
|
16721
|
+
return fileExists(join118(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16728
16722
|
}
|
|
16729
16723
|
async function generate(params) {
|
|
16730
|
-
const { config } = params;
|
|
16731
|
-
const ignoreResult = await generateIgnoreCore({ config });
|
|
16732
|
-
const mcpResult = await generateMcpCore({ config });
|
|
16733
|
-
const commandsResult = await generateCommandsCore({ config });
|
|
16734
|
-
const subagentsResult = await generateSubagentsCore({ config });
|
|
16735
|
-
const skillsResult = await generateSkillsCore({ config });
|
|
16736
|
-
const hooksResult = await generateHooksCore({ config });
|
|
16737
|
-
const rulesResult = await generateRulesCore({ config, skills: skillsResult.skills });
|
|
16724
|
+
const { config, logger } = params;
|
|
16725
|
+
const ignoreResult = await generateIgnoreCore({ config, logger });
|
|
16726
|
+
const mcpResult = await generateMcpCore({ config, logger });
|
|
16727
|
+
const commandsResult = await generateCommandsCore({ config, logger });
|
|
16728
|
+
const subagentsResult = await generateSubagentsCore({ config, logger });
|
|
16729
|
+
const skillsResult = await generateSkillsCore({ config, logger });
|
|
16730
|
+
const hooksResult = await generateHooksCore({ config, logger });
|
|
16731
|
+
const rulesResult = await generateRulesCore({ config, logger, skills: skillsResult.skills });
|
|
16738
16732
|
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
16739
16733
|
return {
|
|
16740
16734
|
rulesCount: rulesResult.count,
|
|
@@ -16756,13 +16750,13 @@ async function generate(params) {
|
|
|
16756
16750
|
};
|
|
16757
16751
|
}
|
|
16758
16752
|
async function generateRulesCore(params) {
|
|
16759
|
-
const { config, skills } = params;
|
|
16753
|
+
const { config, logger, skills } = params;
|
|
16760
16754
|
let totalCount = 0;
|
|
16761
16755
|
const allPaths = [];
|
|
16762
16756
|
let hasDiff = false;
|
|
16763
16757
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16764
16758
|
const toolTargets = intersection(config.getTargets(), supportedTargets);
|
|
16765
|
-
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules" });
|
|
16759
|
+
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger });
|
|
16766
16760
|
for (const baseDir of config.getBaseDirs()) {
|
|
16767
16761
|
for (const toolTarget of toolTargets) {
|
|
16768
16762
|
if (!config.getFeatures(toolTarget).includes("rules")) {
|
|
@@ -16776,7 +16770,8 @@ async function generateRulesCore(params) {
|
|
|
16776
16770
|
simulateSubagents: config.getSimulateSubagents(),
|
|
16777
16771
|
simulateSkills: config.getSimulateSkills(),
|
|
16778
16772
|
skills,
|
|
16779
|
-
dryRun: config.isPreviewMode()
|
|
16773
|
+
dryRun: config.isPreviewMode(),
|
|
16774
|
+
logger
|
|
16780
16775
|
});
|
|
16781
16776
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16782
16777
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16793,12 +16788,13 @@ async function generateRulesCore(params) {
|
|
|
16793
16788
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16794
16789
|
}
|
|
16795
16790
|
async function generateIgnoreCore(params) {
|
|
16796
|
-
const { config } = params;
|
|
16791
|
+
const { config, logger } = params;
|
|
16797
16792
|
const supportedIgnoreTargets = IgnoreProcessor.getToolTargets();
|
|
16798
16793
|
warnUnsupportedTargets({
|
|
16799
16794
|
config,
|
|
16800
16795
|
supportedTargets: supportedIgnoreTargets,
|
|
16801
|
-
featureName: "ignore"
|
|
16796
|
+
featureName: "ignore",
|
|
16797
|
+
logger
|
|
16802
16798
|
});
|
|
16803
16799
|
if (config.getGlobal()) {
|
|
16804
16800
|
return { count: 0, paths: [], hasDiff: false };
|
|
@@ -16815,7 +16811,8 @@ async function generateIgnoreCore(params) {
|
|
|
16815
16811
|
const processor = new IgnoreProcessor({
|
|
16816
16812
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
16817
16813
|
toolTarget,
|
|
16818
|
-
dryRun: config.isPreviewMode()
|
|
16814
|
+
dryRun: config.isPreviewMode(),
|
|
16815
|
+
logger
|
|
16819
16816
|
});
|
|
16820
16817
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16821
16818
|
let result;
|
|
@@ -16846,13 +16843,18 @@ async function generateIgnoreCore(params) {
|
|
|
16846
16843
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16847
16844
|
}
|
|
16848
16845
|
async function generateMcpCore(params) {
|
|
16849
|
-
const { config } = params;
|
|
16846
|
+
const { config, logger } = params;
|
|
16850
16847
|
let totalCount = 0;
|
|
16851
16848
|
const allPaths = [];
|
|
16852
16849
|
let hasDiff = false;
|
|
16853
16850
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16854
16851
|
const toolTargets = intersection(config.getTargets(), supportedMcpTargets);
|
|
16855
|
-
warnUnsupportedTargets({
|
|
16852
|
+
warnUnsupportedTargets({
|
|
16853
|
+
config,
|
|
16854
|
+
supportedTargets: supportedMcpTargets,
|
|
16855
|
+
featureName: "mcp",
|
|
16856
|
+
logger
|
|
16857
|
+
});
|
|
16856
16858
|
for (const baseDir of config.getBaseDirs()) {
|
|
16857
16859
|
for (const toolTarget of toolTargets) {
|
|
16858
16860
|
if (!config.getFeatures(toolTarget).includes("mcp")) {
|
|
@@ -16862,7 +16864,8 @@ async function generateMcpCore(params) {
|
|
|
16862
16864
|
baseDir,
|
|
16863
16865
|
toolTarget,
|
|
16864
16866
|
global: config.getGlobal(),
|
|
16865
|
-
dryRun: config.isPreviewMode()
|
|
16867
|
+
dryRun: config.isPreviewMode(),
|
|
16868
|
+
logger
|
|
16866
16869
|
});
|
|
16867
16870
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16868
16871
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16879,7 +16882,7 @@ async function generateMcpCore(params) {
|
|
|
16879
16882
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16880
16883
|
}
|
|
16881
16884
|
async function generateCommandsCore(params) {
|
|
16882
|
-
const { config } = params;
|
|
16885
|
+
const { config, logger } = params;
|
|
16883
16886
|
let totalCount = 0;
|
|
16884
16887
|
const allPaths = [];
|
|
16885
16888
|
let hasDiff = false;
|
|
@@ -16891,7 +16894,8 @@ async function generateCommandsCore(params) {
|
|
|
16891
16894
|
warnUnsupportedTargets({
|
|
16892
16895
|
config,
|
|
16893
16896
|
supportedTargets: supportedCommandsTargets,
|
|
16894
|
-
featureName: "commands"
|
|
16897
|
+
featureName: "commands",
|
|
16898
|
+
logger
|
|
16895
16899
|
});
|
|
16896
16900
|
for (const baseDir of config.getBaseDirs()) {
|
|
16897
16901
|
for (const toolTarget of toolTargets) {
|
|
@@ -16902,7 +16906,8 @@ async function generateCommandsCore(params) {
|
|
|
16902
16906
|
baseDir,
|
|
16903
16907
|
toolTarget,
|
|
16904
16908
|
global: config.getGlobal(),
|
|
16905
|
-
dryRun: config.isPreviewMode()
|
|
16909
|
+
dryRun: config.isPreviewMode(),
|
|
16910
|
+
logger
|
|
16906
16911
|
});
|
|
16907
16912
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16908
16913
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16919,7 +16924,7 @@ async function generateCommandsCore(params) {
|
|
|
16919
16924
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16920
16925
|
}
|
|
16921
16926
|
async function generateSubagentsCore(params) {
|
|
16922
|
-
const { config } = params;
|
|
16927
|
+
const { config, logger } = params;
|
|
16923
16928
|
let totalCount = 0;
|
|
16924
16929
|
const allPaths = [];
|
|
16925
16930
|
let hasDiff = false;
|
|
@@ -16931,7 +16936,8 @@ async function generateSubagentsCore(params) {
|
|
|
16931
16936
|
warnUnsupportedTargets({
|
|
16932
16937
|
config,
|
|
16933
16938
|
supportedTargets: supportedSubagentsTargets,
|
|
16934
|
-
featureName: "subagents"
|
|
16939
|
+
featureName: "subagents",
|
|
16940
|
+
logger
|
|
16935
16941
|
});
|
|
16936
16942
|
for (const baseDir of config.getBaseDirs()) {
|
|
16937
16943
|
for (const toolTarget of toolTargets) {
|
|
@@ -16942,7 +16948,8 @@ async function generateSubagentsCore(params) {
|
|
|
16942
16948
|
baseDir,
|
|
16943
16949
|
toolTarget,
|
|
16944
16950
|
global: config.getGlobal(),
|
|
16945
|
-
dryRun: config.isPreviewMode()
|
|
16951
|
+
dryRun: config.isPreviewMode(),
|
|
16952
|
+
logger
|
|
16946
16953
|
});
|
|
16947
16954
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16948
16955
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16959,7 +16966,7 @@ async function generateSubagentsCore(params) {
|
|
|
16959
16966
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16960
16967
|
}
|
|
16961
16968
|
async function generateSkillsCore(params) {
|
|
16962
|
-
const { config } = params;
|
|
16969
|
+
const { config, logger } = params;
|
|
16963
16970
|
let totalCount = 0;
|
|
16964
16971
|
const allPaths = [];
|
|
16965
16972
|
let hasDiff = false;
|
|
@@ -16972,7 +16979,8 @@ async function generateSkillsCore(params) {
|
|
|
16972
16979
|
warnUnsupportedTargets({
|
|
16973
16980
|
config,
|
|
16974
16981
|
supportedTargets: supportedSkillsTargets,
|
|
16975
|
-
featureName: "skills"
|
|
16982
|
+
featureName: "skills",
|
|
16983
|
+
logger
|
|
16976
16984
|
});
|
|
16977
16985
|
for (const baseDir of config.getBaseDirs()) {
|
|
16978
16986
|
for (const toolTarget of toolTargets) {
|
|
@@ -16983,7 +16991,8 @@ async function generateSkillsCore(params) {
|
|
|
16983
16991
|
baseDir,
|
|
16984
16992
|
toolTarget,
|
|
16985
16993
|
global: config.getGlobal(),
|
|
16986
|
-
dryRun: config.isPreviewMode()
|
|
16994
|
+
dryRun: config.isPreviewMode(),
|
|
16995
|
+
logger
|
|
16987
16996
|
});
|
|
16988
16997
|
const rulesyncDirs = await processor.loadRulesyncDirs();
|
|
16989
16998
|
for (const rulesyncDir of rulesyncDirs) {
|
|
@@ -17005,13 +17014,18 @@ async function generateSkillsCore(params) {
|
|
|
17005
17014
|
return { count: totalCount, paths: allPaths, skills: allSkills, hasDiff };
|
|
17006
17015
|
}
|
|
17007
17016
|
async function generateHooksCore(params) {
|
|
17008
|
-
const { config } = params;
|
|
17017
|
+
const { config, logger } = params;
|
|
17009
17018
|
let totalCount = 0;
|
|
17010
17019
|
const allPaths = [];
|
|
17011
17020
|
let hasDiff = false;
|
|
17012
17021
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
17013
17022
|
const toolTargets = intersection(config.getTargets(), supportedHooksTargets);
|
|
17014
|
-
warnUnsupportedTargets({
|
|
17023
|
+
warnUnsupportedTargets({
|
|
17024
|
+
config,
|
|
17025
|
+
supportedTargets: supportedHooksTargets,
|
|
17026
|
+
featureName: "hooks",
|
|
17027
|
+
logger
|
|
17028
|
+
});
|
|
17015
17029
|
for (const baseDir of config.getBaseDirs()) {
|
|
17016
17030
|
for (const toolTarget of toolTargets) {
|
|
17017
17031
|
if (!config.getFeatures(toolTarget).includes("hooks")) {
|
|
@@ -17021,7 +17035,8 @@ async function generateHooksCore(params) {
|
|
|
17021
17035
|
baseDir,
|
|
17022
17036
|
toolTarget,
|
|
17023
17037
|
global: config.getGlobal(),
|
|
17024
|
-
dryRun: config.isPreviewMode()
|
|
17038
|
+
dryRun: config.isPreviewMode(),
|
|
17039
|
+
logger
|
|
17025
17040
|
});
|
|
17026
17041
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
17027
17042
|
let result;
|
|
@@ -17048,14 +17063,14 @@ async function generateHooksCore(params) {
|
|
|
17048
17063
|
|
|
17049
17064
|
// src/lib/import.ts
|
|
17050
17065
|
async function importFromTool(params) {
|
|
17051
|
-
const { config, tool } = params;
|
|
17052
|
-
const rulesCount = await importRulesCore({ config, tool });
|
|
17053
|
-
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
17054
|
-
const mcpCount = await importMcpCore({ config, tool });
|
|
17055
|
-
const commandsCount = await importCommandsCore({ config, tool });
|
|
17056
|
-
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
17057
|
-
const skillsCount = await importSkillsCore({ config, tool });
|
|
17058
|
-
const hooksCount = await importHooksCore({ config, tool });
|
|
17066
|
+
const { config, tool, logger } = params;
|
|
17067
|
+
const rulesCount = await importRulesCore({ config, tool, logger });
|
|
17068
|
+
const ignoreCount = await importIgnoreCore({ config, tool, logger });
|
|
17069
|
+
const mcpCount = await importMcpCore({ config, tool, logger });
|
|
17070
|
+
const commandsCount = await importCommandsCore({ config, tool, logger });
|
|
17071
|
+
const subagentsCount = await importSubagentsCore({ config, tool, logger });
|
|
17072
|
+
const skillsCount = await importSkillsCore({ config, tool, logger });
|
|
17073
|
+
const hooksCount = await importHooksCore({ config, tool, logger });
|
|
17059
17074
|
return {
|
|
17060
17075
|
rulesCount,
|
|
17061
17076
|
ignoreCount,
|
|
@@ -17067,7 +17082,7 @@ async function importFromTool(params) {
|
|
|
17067
17082
|
};
|
|
17068
17083
|
}
|
|
17069
17084
|
async function importRulesCore(params) {
|
|
17070
|
-
const { config, tool } = params;
|
|
17085
|
+
const { config, tool, logger } = params;
|
|
17071
17086
|
if (!config.getFeatures(tool).includes("rules")) {
|
|
17072
17087
|
return 0;
|
|
17073
17088
|
}
|
|
@@ -17079,7 +17094,8 @@ async function importRulesCore(params) {
|
|
|
17079
17094
|
const rulesProcessor = new RulesProcessor({
|
|
17080
17095
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17081
17096
|
toolTarget: tool,
|
|
17082
|
-
global
|
|
17097
|
+
global,
|
|
17098
|
+
logger
|
|
17083
17099
|
});
|
|
17084
17100
|
const toolFiles = await rulesProcessor.loadToolFiles();
|
|
17085
17101
|
if (toolFiles.length === 0) {
|
|
@@ -17094,7 +17110,7 @@ async function importRulesCore(params) {
|
|
|
17094
17110
|
return writtenCount;
|
|
17095
17111
|
}
|
|
17096
17112
|
async function importIgnoreCore(params) {
|
|
17097
|
-
const { config, tool } = params;
|
|
17113
|
+
const { config, tool, logger } = params;
|
|
17098
17114
|
if (!config.getFeatures(tool).includes("ignore")) {
|
|
17099
17115
|
return 0;
|
|
17100
17116
|
}
|
|
@@ -17107,7 +17123,8 @@ async function importIgnoreCore(params) {
|
|
|
17107
17123
|
}
|
|
17108
17124
|
const ignoreProcessor = new IgnoreProcessor({
|
|
17109
17125
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17110
|
-
toolTarget: tool
|
|
17126
|
+
toolTarget: tool,
|
|
17127
|
+
logger
|
|
17111
17128
|
});
|
|
17112
17129
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
17113
17130
|
if (toolFiles.length === 0) {
|
|
@@ -17125,7 +17142,7 @@ async function importIgnoreCore(params) {
|
|
|
17125
17142
|
return writtenCount;
|
|
17126
17143
|
}
|
|
17127
17144
|
async function importMcpCore(params) {
|
|
17128
|
-
const { config, tool } = params;
|
|
17145
|
+
const { config, tool, logger } = params;
|
|
17129
17146
|
if (!config.getFeatures(tool).includes("mcp")) {
|
|
17130
17147
|
return 0;
|
|
17131
17148
|
}
|
|
@@ -17137,7 +17154,8 @@ async function importMcpCore(params) {
|
|
|
17137
17154
|
const mcpProcessor = new McpProcessor({
|
|
17138
17155
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17139
17156
|
toolTarget: tool,
|
|
17140
|
-
global
|
|
17157
|
+
global,
|
|
17158
|
+
logger
|
|
17141
17159
|
});
|
|
17142
17160
|
const toolFiles = await mcpProcessor.loadToolFiles();
|
|
17143
17161
|
if (toolFiles.length === 0) {
|
|
@@ -17152,7 +17170,7 @@ async function importMcpCore(params) {
|
|
|
17152
17170
|
return writtenCount;
|
|
17153
17171
|
}
|
|
17154
17172
|
async function importCommandsCore(params) {
|
|
17155
|
-
const { config, tool } = params;
|
|
17173
|
+
const { config, tool, logger } = params;
|
|
17156
17174
|
if (!config.getFeatures(tool).includes("commands")) {
|
|
17157
17175
|
return 0;
|
|
17158
17176
|
}
|
|
@@ -17164,7 +17182,8 @@ async function importCommandsCore(params) {
|
|
|
17164
17182
|
const commandsProcessor = new CommandsProcessor({
|
|
17165
17183
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17166
17184
|
toolTarget: tool,
|
|
17167
|
-
global
|
|
17185
|
+
global,
|
|
17186
|
+
logger
|
|
17168
17187
|
});
|
|
17169
17188
|
const toolFiles = await commandsProcessor.loadToolFiles();
|
|
17170
17189
|
if (toolFiles.length === 0) {
|
|
@@ -17179,7 +17198,7 @@ async function importCommandsCore(params) {
|
|
|
17179
17198
|
return writtenCount;
|
|
17180
17199
|
}
|
|
17181
17200
|
async function importSubagentsCore(params) {
|
|
17182
|
-
const { config, tool } = params;
|
|
17201
|
+
const { config, tool, logger } = params;
|
|
17183
17202
|
if (!config.getFeatures(tool).includes("subagents")) {
|
|
17184
17203
|
return 0;
|
|
17185
17204
|
}
|
|
@@ -17191,7 +17210,8 @@ async function importSubagentsCore(params) {
|
|
|
17191
17210
|
const subagentsProcessor = new SubagentsProcessor({
|
|
17192
17211
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17193
17212
|
toolTarget: tool,
|
|
17194
|
-
global: config.getGlobal()
|
|
17213
|
+
global: config.getGlobal(),
|
|
17214
|
+
logger
|
|
17195
17215
|
});
|
|
17196
17216
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
17197
17217
|
if (toolFiles.length === 0) {
|
|
@@ -17206,7 +17226,7 @@ async function importSubagentsCore(params) {
|
|
|
17206
17226
|
return writtenCount;
|
|
17207
17227
|
}
|
|
17208
17228
|
async function importSkillsCore(params) {
|
|
17209
|
-
const { config, tool } = params;
|
|
17229
|
+
const { config, tool, logger } = params;
|
|
17210
17230
|
if (!config.getFeatures(tool).includes("skills")) {
|
|
17211
17231
|
return 0;
|
|
17212
17232
|
}
|
|
@@ -17218,7 +17238,8 @@ async function importSkillsCore(params) {
|
|
|
17218
17238
|
const skillsProcessor = new SkillsProcessor({
|
|
17219
17239
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17220
17240
|
toolTarget: tool,
|
|
17221
|
-
global
|
|
17241
|
+
global,
|
|
17242
|
+
logger
|
|
17222
17243
|
});
|
|
17223
17244
|
const toolDirs = await skillsProcessor.loadToolDirs();
|
|
17224
17245
|
if (toolDirs.length === 0) {
|
|
@@ -17233,7 +17254,7 @@ async function importSkillsCore(params) {
|
|
|
17233
17254
|
return writtenCount;
|
|
17234
17255
|
}
|
|
17235
17256
|
async function importHooksCore(params) {
|
|
17236
|
-
const { config, tool } = params;
|
|
17257
|
+
const { config, tool, logger } = params;
|
|
17237
17258
|
if (!config.getFeatures(tool).includes("hooks")) {
|
|
17238
17259
|
return 0;
|
|
17239
17260
|
}
|
|
@@ -17250,7 +17271,8 @@ async function importHooksCore(params) {
|
|
|
17250
17271
|
const hooksProcessor = new HooksProcessor({
|
|
17251
17272
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17252
17273
|
toolTarget: tool,
|
|
17253
|
-
global
|
|
17274
|
+
global,
|
|
17275
|
+
logger
|
|
17254
17276
|
});
|
|
17255
17277
|
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
17256
17278
|
if (toolFiles.length === 0) {
|
|
@@ -17265,6 +17287,176 @@ async function importHooksCore(params) {
|
|
|
17265
17287
|
return writtenCount;
|
|
17266
17288
|
}
|
|
17267
17289
|
|
|
17290
|
+
// src/types/json-output.ts
|
|
17291
|
+
var ErrorCodes = {
|
|
17292
|
+
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
17293
|
+
RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
|
|
17294
|
+
INVALID_TARGET: "INVALID_TARGET",
|
|
17295
|
+
FETCH_FAILED: "FETCH_FAILED",
|
|
17296
|
+
WRITE_FAILED: "WRITE_FAILED",
|
|
17297
|
+
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
17298
|
+
GENERATION_FAILED: "GENERATION_FAILED",
|
|
17299
|
+
IMPORT_FAILED: "IMPORT_FAILED",
|
|
17300
|
+
INSTALL_FAILED: "INSTALL_FAILED",
|
|
17301
|
+
UPDATE_FAILED: "UPDATE_FAILED",
|
|
17302
|
+
GITIGNORE_FAILED: "GITIGNORE_FAILED",
|
|
17303
|
+
INIT_FAILED: "INIT_FAILED",
|
|
17304
|
+
MCP_FAILED: "MCP_FAILED",
|
|
17305
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
17306
|
+
};
|
|
17307
|
+
var CLIError = class extends Error {
|
|
17308
|
+
constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
|
|
17309
|
+
super(message);
|
|
17310
|
+
this.code = code;
|
|
17311
|
+
this.exitCode = exitCode;
|
|
17312
|
+
this.name = "CLIError";
|
|
17313
|
+
}
|
|
17314
|
+
};
|
|
17315
|
+
|
|
17316
|
+
// src/utils/logger.ts
|
|
17317
|
+
var BaseLogger = class {
|
|
17318
|
+
_verbose = false;
|
|
17319
|
+
_silent = false;
|
|
17320
|
+
constructor({ verbose = false, silent = false } = {}) {
|
|
17321
|
+
this._silent = silent;
|
|
17322
|
+
this._verbose = verbose && !silent;
|
|
17323
|
+
}
|
|
17324
|
+
get verbose() {
|
|
17325
|
+
return this._verbose;
|
|
17326
|
+
}
|
|
17327
|
+
get silent() {
|
|
17328
|
+
return this._silent;
|
|
17329
|
+
}
|
|
17330
|
+
configure({ verbose, silent }) {
|
|
17331
|
+
if (verbose && silent) {
|
|
17332
|
+
this._silent = false;
|
|
17333
|
+
if (!isEnvTest()) {
|
|
17334
|
+
this.onConflictingFlags();
|
|
17335
|
+
}
|
|
17336
|
+
}
|
|
17337
|
+
this._silent = silent;
|
|
17338
|
+
this._verbose = verbose && !silent;
|
|
17339
|
+
}
|
|
17340
|
+
onConflictingFlags() {
|
|
17341
|
+
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
17342
|
+
}
|
|
17343
|
+
};
|
|
17344
|
+
var ConsoleLogger = class extends BaseLogger {
|
|
17345
|
+
isSuppressed() {
|
|
17346
|
+
return isEnvTest() || this._silent;
|
|
17347
|
+
}
|
|
17348
|
+
get jsonMode() {
|
|
17349
|
+
return false;
|
|
17350
|
+
}
|
|
17351
|
+
captureData(_key, _value) {
|
|
17352
|
+
}
|
|
17353
|
+
getJsonData() {
|
|
17354
|
+
return {};
|
|
17355
|
+
}
|
|
17356
|
+
outputJson(_success, _error) {
|
|
17357
|
+
}
|
|
17358
|
+
info(message, ...args) {
|
|
17359
|
+
if (this.isSuppressed()) return;
|
|
17360
|
+
console.log(message, ...args);
|
|
17361
|
+
}
|
|
17362
|
+
success(message, ...args) {
|
|
17363
|
+
if (this.isSuppressed()) return;
|
|
17364
|
+
console.log(message, ...args);
|
|
17365
|
+
}
|
|
17366
|
+
warn(message, ...args) {
|
|
17367
|
+
if (this.isSuppressed()) return;
|
|
17368
|
+
console.warn(message, ...args);
|
|
17369
|
+
}
|
|
17370
|
+
// Errors are always emitted, even in silent mode
|
|
17371
|
+
error(message, _code, ...args) {
|
|
17372
|
+
if (isEnvTest()) return;
|
|
17373
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
17374
|
+
console.error(errorMessage, ...args);
|
|
17375
|
+
}
|
|
17376
|
+
debug(message, ...args) {
|
|
17377
|
+
if (!this._verbose || this.isSuppressed()) return;
|
|
17378
|
+
console.log(message, ...args);
|
|
17379
|
+
}
|
|
17380
|
+
};
|
|
17381
|
+
var JsonLogger = class extends BaseLogger {
|
|
17382
|
+
_jsonOutputDone = false;
|
|
17383
|
+
_jsonData = {};
|
|
17384
|
+
_commandName;
|
|
17385
|
+
_version;
|
|
17386
|
+
constructor({
|
|
17387
|
+
command,
|
|
17388
|
+
version,
|
|
17389
|
+
verbose = false,
|
|
17390
|
+
silent = false
|
|
17391
|
+
}) {
|
|
17392
|
+
super({ verbose, silent });
|
|
17393
|
+
this._commandName = command;
|
|
17394
|
+
this._version = version;
|
|
17395
|
+
}
|
|
17396
|
+
// Suppress raw console.warn in JSON mode to avoid non-JSON text on stderr
|
|
17397
|
+
onConflictingFlags() {
|
|
17398
|
+
}
|
|
17399
|
+
get jsonMode() {
|
|
17400
|
+
return true;
|
|
17401
|
+
}
|
|
17402
|
+
captureData(key, value) {
|
|
17403
|
+
this._jsonData[key] = value;
|
|
17404
|
+
}
|
|
17405
|
+
getJsonData() {
|
|
17406
|
+
return { ...this._jsonData };
|
|
17407
|
+
}
|
|
17408
|
+
outputJson(success, error) {
|
|
17409
|
+
if (this._jsonOutputDone) return;
|
|
17410
|
+
this._jsonOutputDone = true;
|
|
17411
|
+
const output = {
|
|
17412
|
+
success,
|
|
17413
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17414
|
+
command: this._commandName,
|
|
17415
|
+
version: this._version
|
|
17416
|
+
};
|
|
17417
|
+
if (success) {
|
|
17418
|
+
output.data = this._jsonData;
|
|
17419
|
+
} else if (error) {
|
|
17420
|
+
output.error = {
|
|
17421
|
+
code: error.code,
|
|
17422
|
+
message: error.message
|
|
17423
|
+
};
|
|
17424
|
+
if (error.details) {
|
|
17425
|
+
output.error.details = error.details;
|
|
17426
|
+
}
|
|
17427
|
+
if (error.stack) {
|
|
17428
|
+
output.error.stack = error.stack;
|
|
17429
|
+
}
|
|
17430
|
+
}
|
|
17431
|
+
const jsonStr = JSON.stringify(output, null, 2);
|
|
17432
|
+
if (success) {
|
|
17433
|
+
console.log(jsonStr);
|
|
17434
|
+
} else {
|
|
17435
|
+
console.error(jsonStr);
|
|
17436
|
+
}
|
|
17437
|
+
}
|
|
17438
|
+
info(_message, ..._args) {
|
|
17439
|
+
}
|
|
17440
|
+
success(_message, ..._args) {
|
|
17441
|
+
}
|
|
17442
|
+
warn(_message, ..._args) {
|
|
17443
|
+
}
|
|
17444
|
+
error(message, code, ..._args) {
|
|
17445
|
+
if (isEnvTest()) return;
|
|
17446
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
17447
|
+
const errorInfo = {
|
|
17448
|
+
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
17449
|
+
message: errorMessage
|
|
17450
|
+
};
|
|
17451
|
+
if (this._verbose && message instanceof Error && message.stack) {
|
|
17452
|
+
errorInfo.stack = message.stack;
|
|
17453
|
+
}
|
|
17454
|
+
this.outputJson(false, errorInfo);
|
|
17455
|
+
}
|
|
17456
|
+
debug(_message, ..._args) {
|
|
17457
|
+
}
|
|
17458
|
+
};
|
|
17459
|
+
|
|
17268
17460
|
export {
|
|
17269
17461
|
RULESYNC_CONFIG_RELATIVE_FILE_PATH,
|
|
17270
17462
|
RULESYNC_RELATIVE_DIR_PATH,
|
|
@@ -17287,10 +17479,6 @@ export {
|
|
|
17287
17479
|
MAX_FILE_SIZE,
|
|
17288
17480
|
FETCH_CONCURRENCY_LIMIT,
|
|
17289
17481
|
formatError,
|
|
17290
|
-
ErrorCodes,
|
|
17291
|
-
CLIError,
|
|
17292
|
-
createLogger,
|
|
17293
|
-
logger,
|
|
17294
17482
|
ensureDir,
|
|
17295
17483
|
checkPathTraversal,
|
|
17296
17484
|
directoryExists,
|
|
@@ -17334,5 +17522,9 @@ export {
|
|
|
17334
17522
|
RulesProcessor,
|
|
17335
17523
|
checkRulesyncDirExists,
|
|
17336
17524
|
generate,
|
|
17337
|
-
importFromTool
|
|
17525
|
+
importFromTool,
|
|
17526
|
+
ErrorCodes,
|
|
17527
|
+
CLIError,
|
|
17528
|
+
ConsoleLogger,
|
|
17529
|
+
JsonLogger
|
|
17338
17530
|
};
|