rulesync 7.20.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-5OPNV62F.js → chunk-UYWCICY6.js} +877 -664
- package/dist/cli/index.cjs +1365 -1071
- package/dist/cli/index.js +330 -253
- package/dist/index.cjs +750 -544
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -7
- package/package.json +1 -1
|
@@ -15,168 +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/vitest.ts
|
|
45
|
-
function isEnvTest() {
|
|
46
|
-
return process.env.NODE_ENV === "test";
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// src/utils/logger.ts
|
|
50
|
-
var BaseLogger = class {
|
|
51
|
-
_verbose = false;
|
|
52
|
-
_silent = false;
|
|
53
|
-
get verbose() {
|
|
54
|
-
return this._verbose;
|
|
55
|
-
}
|
|
56
|
-
get silent() {
|
|
57
|
-
return this._silent;
|
|
58
|
-
}
|
|
59
|
-
configure({ verbose, silent }) {
|
|
60
|
-
if (verbose && silent) {
|
|
61
|
-
this._silent = false;
|
|
62
|
-
if (!isEnvTest()) {
|
|
63
|
-
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
this._silent = silent;
|
|
67
|
-
this._verbose = verbose && !silent;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
var ConsoleLogger = class extends BaseLogger {
|
|
71
|
-
isSuppressed() {
|
|
72
|
-
return isEnvTest() || this._silent;
|
|
73
|
-
}
|
|
74
|
-
get jsonMode() {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
captureData(_key, _value) {
|
|
78
|
-
}
|
|
79
|
-
getJsonData() {
|
|
80
|
-
return {};
|
|
81
|
-
}
|
|
82
|
-
outputJson(_success, _error) {
|
|
83
|
-
}
|
|
84
|
-
info(message, ...args) {
|
|
85
|
-
if (this.isSuppressed()) return;
|
|
86
|
-
console.log(message, ...args);
|
|
87
|
-
}
|
|
88
|
-
success(message, ...args) {
|
|
89
|
-
if (this.isSuppressed()) return;
|
|
90
|
-
console.log(message, ...args);
|
|
91
|
-
}
|
|
92
|
-
warn(message, ...args) {
|
|
93
|
-
if (this.isSuppressed()) return;
|
|
94
|
-
console.warn(message, ...args);
|
|
95
|
-
}
|
|
96
|
-
error(message, _code, ...args) {
|
|
97
|
-
if (isEnvTest()) return;
|
|
98
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
99
|
-
console.error(errorMessage, ...args);
|
|
100
|
-
}
|
|
101
|
-
debug(message, ...args) {
|
|
102
|
-
if (this.isSuppressed()) return;
|
|
103
|
-
if (this._verbose) {
|
|
104
|
-
console.log(message, ...args);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
var JsonLogger = class extends BaseLogger {
|
|
109
|
-
_jsonOutputDone = false;
|
|
110
|
-
_jsonData = {};
|
|
111
|
-
_commandName;
|
|
112
|
-
_version;
|
|
113
|
-
constructor({ command, version }) {
|
|
114
|
-
super();
|
|
115
|
-
this._commandName = command;
|
|
116
|
-
this._version = version;
|
|
117
|
-
}
|
|
118
|
-
get jsonMode() {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
captureData(key, value) {
|
|
122
|
-
this._jsonData[key] = value;
|
|
123
|
-
}
|
|
124
|
-
getJsonData() {
|
|
125
|
-
return { ...this._jsonData };
|
|
126
|
-
}
|
|
127
|
-
outputJson(success, error) {
|
|
128
|
-
if (this._jsonOutputDone) return;
|
|
129
|
-
this._jsonOutputDone = true;
|
|
130
|
-
const output = {
|
|
131
|
-
success,
|
|
132
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
133
|
-
command: this._commandName,
|
|
134
|
-
version: this._version
|
|
135
|
-
};
|
|
136
|
-
if (success) {
|
|
137
|
-
output.data = this._jsonData;
|
|
138
|
-
} else if (error) {
|
|
139
|
-
output.error = {
|
|
140
|
-
code: error.code,
|
|
141
|
-
message: error.message
|
|
142
|
-
};
|
|
143
|
-
if (error.details) {
|
|
144
|
-
output.error.details = error.details;
|
|
145
|
-
}
|
|
146
|
-
if (error.stack) {
|
|
147
|
-
output.error.stack = error.stack;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
const jsonStr = JSON.stringify(output, null, 2);
|
|
151
|
-
if (success) {
|
|
152
|
-
console.log(jsonStr);
|
|
153
|
-
} else {
|
|
154
|
-
console.error(jsonStr);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
info(_message, ..._args) {
|
|
158
|
-
}
|
|
159
|
-
success(_message, ..._args) {
|
|
160
|
-
}
|
|
161
|
-
warn(_message, ..._args) {
|
|
162
|
-
}
|
|
163
|
-
error(message, code, ..._args) {
|
|
164
|
-
if (isEnvTest()) return;
|
|
165
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
166
|
-
const errorInfo = {
|
|
167
|
-
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
168
|
-
message: errorMessage
|
|
169
|
-
};
|
|
170
|
-
if (this._verbose && message instanceof Error && message.stack) {
|
|
171
|
-
errorInfo.stack = message.stack;
|
|
172
|
-
}
|
|
173
|
-
this.outputJson(false, errorInfo);
|
|
174
|
-
}
|
|
175
|
-
debug(_message, ..._args) {
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
var logger = new ConsoleLogger();
|
|
179
|
-
|
|
180
18
|
// src/types/features.ts
|
|
181
19
|
import { z } from "zod/mini";
|
|
182
20
|
var ALL_FEATURES = [
|
|
@@ -209,6 +47,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
209
47
|
"cline",
|
|
210
48
|
"codexcli",
|
|
211
49
|
"copilot",
|
|
50
|
+
"copilotcli",
|
|
212
51
|
"cursor",
|
|
213
52
|
"factorydroid",
|
|
214
53
|
"geminicli",
|
|
@@ -266,6 +105,13 @@ import os from "os";
|
|
|
266
105
|
import { dirname, join as join2, relative, resolve } from "path";
|
|
267
106
|
import { kebabCase } from "es-toolkit";
|
|
268
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
|
|
269
115
|
async function ensureDir(dirPath) {
|
|
270
116
|
try {
|
|
271
117
|
await stat(dirPath);
|
|
@@ -310,7 +156,6 @@ async function directoryExists(dirPath) {
|
|
|
310
156
|
}
|
|
311
157
|
}
|
|
312
158
|
async function readFileContent(filepath) {
|
|
313
|
-
logger.debug(`Reading file: ${filepath}`);
|
|
314
159
|
return readFile(filepath, "utf-8");
|
|
315
160
|
}
|
|
316
161
|
async function readFileContentOrNull(filepath) {
|
|
@@ -320,7 +165,6 @@ async function readFileContentOrNull(filepath) {
|
|
|
320
165
|
return null;
|
|
321
166
|
}
|
|
322
167
|
async function readFileBuffer(filepath) {
|
|
323
|
-
logger.debug(`Reading file buffer: ${filepath}`);
|
|
324
168
|
return readFile(filepath);
|
|
325
169
|
}
|
|
326
170
|
function addTrailingNewline(content) {
|
|
@@ -330,7 +174,6 @@ function addTrailingNewline(content) {
|
|
|
330
174
|
return content.trimEnd() + "\n";
|
|
331
175
|
}
|
|
332
176
|
async function writeFileContent(filepath, content) {
|
|
333
|
-
logger.debug(`Writing file: ${filepath}`);
|
|
334
177
|
await ensureDir(dirname(filepath));
|
|
335
178
|
await writeFile(filepath, content, "utf-8");
|
|
336
179
|
}
|
|
@@ -381,25 +224,21 @@ async function findFilesByGlobs(globs, options = {}) {
|
|
|
381
224
|
async function removeDirectory(dirPath) {
|
|
382
225
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
383
226
|
if (dangerousPaths.includes(dirPath) || dirPath === "") {
|
|
384
|
-
logger.warn(`Skipping deletion of dangerous path: ${dirPath}`);
|
|
385
227
|
return;
|
|
386
228
|
}
|
|
387
229
|
try {
|
|
388
230
|
if (await fileExists(dirPath)) {
|
|
389
231
|
await rm(dirPath, { recursive: true, force: true });
|
|
390
232
|
}
|
|
391
|
-
} catch
|
|
392
|
-
logger.warn(`Failed to remove directory ${dirPath}:`, error);
|
|
233
|
+
} catch {
|
|
393
234
|
}
|
|
394
235
|
}
|
|
395
236
|
async function removeFile(filepath) {
|
|
396
|
-
logger.debug(`Removing file: ${filepath}`);
|
|
397
237
|
try {
|
|
398
238
|
if (await fileExists(filepath)) {
|
|
399
239
|
await rm(filepath);
|
|
400
240
|
}
|
|
401
|
-
} catch
|
|
402
|
-
logger.warn(`Failed to remove file ${filepath}:`, error);
|
|
241
|
+
} catch {
|
|
403
242
|
}
|
|
404
243
|
}
|
|
405
244
|
function getHomeDirectory() {
|
|
@@ -433,9 +272,7 @@ async function createTempDirectory(prefix = "rulesync-fetch-") {
|
|
|
433
272
|
async function removeTempDirectory(tempDir) {
|
|
434
273
|
try {
|
|
435
274
|
await rm(tempDir, { recursive: true, force: true });
|
|
436
|
-
logger.debug(`Removed temp directory: ${tempDir}`);
|
|
437
275
|
} catch {
|
|
438
|
-
logger.debug(`Failed to clean up temp directory: ${tempDir}`);
|
|
439
276
|
}
|
|
440
277
|
}
|
|
441
278
|
|
|
@@ -673,16 +510,11 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
673
510
|
if (!await fileExists(filePath)) {
|
|
674
511
|
return {};
|
|
675
512
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
return configParams;
|
|
682
|
-
} catch (error) {
|
|
683
|
-
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
684
|
-
throw error;
|
|
685
|
-
}
|
|
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;
|
|
686
518
|
};
|
|
687
519
|
var mergeConfigs = (baseConfig, localConfig) => {
|
|
688
520
|
return {
|
|
@@ -763,7 +595,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
763
595
|
}
|
|
764
596
|
|
|
765
597
|
// src/lib/generate.ts
|
|
766
|
-
import { join as
|
|
598
|
+
import { join as join118 } from "path";
|
|
767
599
|
import { intersection } from "es-toolkit";
|
|
768
600
|
|
|
769
601
|
// src/features/commands/commands-processor.ts
|
|
@@ -774,9 +606,15 @@ import { z as z14 } from "zod/mini";
|
|
|
774
606
|
var FeatureProcessor = class {
|
|
775
607
|
baseDir;
|
|
776
608
|
dryRun;
|
|
777
|
-
|
|
609
|
+
logger;
|
|
610
|
+
constructor({
|
|
611
|
+
baseDir = process.cwd(),
|
|
612
|
+
dryRun = false,
|
|
613
|
+
logger
|
|
614
|
+
}) {
|
|
778
615
|
this.baseDir = baseDir;
|
|
779
616
|
this.dryRun = dryRun;
|
|
617
|
+
this.logger = logger;
|
|
780
618
|
}
|
|
781
619
|
/**
|
|
782
620
|
* Return tool targets that this feature supports.
|
|
@@ -799,7 +637,7 @@ var FeatureProcessor = class {
|
|
|
799
637
|
continue;
|
|
800
638
|
}
|
|
801
639
|
if (this.dryRun) {
|
|
802
|
-
logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
640
|
+
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
803
641
|
} else {
|
|
804
642
|
await writeFileContent(filePath, contentWithNewline);
|
|
805
643
|
}
|
|
@@ -823,7 +661,7 @@ var FeatureProcessor = class {
|
|
|
823
661
|
for (const aiFile of orphanFiles) {
|
|
824
662
|
const filePath = aiFile.getFilePath();
|
|
825
663
|
if (this.dryRun) {
|
|
826
|
-
logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
664
|
+
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
827
665
|
} else {
|
|
828
666
|
await removeFile(filePath);
|
|
829
667
|
}
|
|
@@ -3195,9 +3033,10 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3195
3033
|
toolTarget,
|
|
3196
3034
|
global = false,
|
|
3197
3035
|
getFactory = defaultGetFactory,
|
|
3198
|
-
dryRun = false
|
|
3036
|
+
dryRun = false,
|
|
3037
|
+
logger
|
|
3199
3038
|
}) {
|
|
3200
|
-
super({ baseDir, dryRun });
|
|
3039
|
+
super({ baseDir, dryRun, logger });
|
|
3201
3040
|
const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3202
3041
|
if (!result.success) {
|
|
3203
3042
|
throw new Error(
|
|
@@ -3224,7 +3063,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3224
3063
|
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
3225
3064
|
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
3226
3065
|
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
3227
|
-
logger.warn(
|
|
3066
|
+
this.logger.warn(
|
|
3228
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.`
|
|
3229
3068
|
);
|
|
3230
3069
|
} else if (!firstOrigin) {
|
|
@@ -3270,7 +3109,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3270
3109
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
3271
3110
|
)
|
|
3272
3111
|
);
|
|
3273
|
-
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3112
|
+
this.logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3274
3113
|
return rulesyncCommands;
|
|
3275
3114
|
}
|
|
3276
3115
|
/**
|
|
@@ -3294,7 +3133,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3294
3133
|
global: this.global
|
|
3295
3134
|
})
|
|
3296
3135
|
).filter((cmd) => cmd.isDeletable());
|
|
3297
|
-
logger.debug(
|
|
3136
|
+
this.logger.debug(
|
|
3137
|
+
`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`
|
|
3138
|
+
);
|
|
3298
3139
|
return toolCommands2;
|
|
3299
3140
|
}
|
|
3300
3141
|
const toolCommands = await Promise.all(
|
|
@@ -3306,7 +3147,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3306
3147
|
})
|
|
3307
3148
|
)
|
|
3308
3149
|
);
|
|
3309
|
-
logger.debug(
|
|
3150
|
+
this.logger.debug(
|
|
3151
|
+
`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`
|
|
3152
|
+
);
|
|
3310
3153
|
return toolCommands;
|
|
3311
3154
|
}
|
|
3312
3155
|
/**
|
|
@@ -3575,7 +3418,8 @@ function isToolMatcherEntry(x) {
|
|
|
3575
3418
|
function canonicalToToolHooks({
|
|
3576
3419
|
config,
|
|
3577
3420
|
toolOverrideHooks,
|
|
3578
|
-
converterConfig
|
|
3421
|
+
converterConfig,
|
|
3422
|
+
logger
|
|
3579
3423
|
}) {
|
|
3580
3424
|
const supported = new Set(converterConfig.supportedEvents);
|
|
3581
3425
|
const sharedHooks = {};
|
|
@@ -3602,7 +3446,7 @@ function canonicalToToolHooks({
|
|
|
3602
3446
|
const isNoMatcherEvent = converterConfig.noMatcherEvents?.has(eventName) ?? false;
|
|
3603
3447
|
for (const [matcherKey, defs] of byMatcher) {
|
|
3604
3448
|
if (isNoMatcherEvent && matcherKey) {
|
|
3605
|
-
logger
|
|
3449
|
+
logger?.warn(
|
|
3606
3450
|
`matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
|
|
3607
3451
|
);
|
|
3608
3452
|
}
|
|
@@ -3799,7 +3643,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3799
3643
|
baseDir = process.cwd(),
|
|
3800
3644
|
rulesyncHooks,
|
|
3801
3645
|
validate = true,
|
|
3802
|
-
global = false
|
|
3646
|
+
global = false,
|
|
3647
|
+
logger
|
|
3803
3648
|
}) {
|
|
3804
3649
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3805
3650
|
const filePath = join22(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -3820,7 +3665,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3820
3665
|
const claudeHooks = canonicalToToolHooks({
|
|
3821
3666
|
config,
|
|
3822
3667
|
toolOverrideHooks: config.claudecode?.hooks,
|
|
3823
|
-
converterConfig: CLAUDE_CONVERTER_CONFIG
|
|
3668
|
+
converterConfig: CLAUDE_CONVERTER_CONFIG,
|
|
3669
|
+
logger
|
|
3824
3670
|
});
|
|
3825
3671
|
const merged = { ...settings, hooks: claudeHooks };
|
|
3826
3672
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -3920,14 +3766,14 @@ function canonicalToCopilotHooks(config) {
|
|
|
3920
3766
|
}
|
|
3921
3767
|
return copilot;
|
|
3922
3768
|
}
|
|
3923
|
-
function resolveImportCommand(entry) {
|
|
3769
|
+
function resolveImportCommand(entry, logger) {
|
|
3924
3770
|
const hasBash = typeof entry.bash === "string";
|
|
3925
3771
|
const hasPowershell = typeof entry.powershell === "string";
|
|
3926
3772
|
if (hasBash && hasPowershell) {
|
|
3927
3773
|
const isWindows = process.platform === "win32";
|
|
3928
3774
|
const chosen = isWindows ? "powershell" : "bash";
|
|
3929
3775
|
const ignored = isWindows ? "bash" : "powershell";
|
|
3930
|
-
logger
|
|
3776
|
+
logger?.warn(
|
|
3931
3777
|
`Copilot hook has both bash and powershell commands; using ${chosen} and ignoring ${ignored} on this platform.`
|
|
3932
3778
|
);
|
|
3933
3779
|
return isWindows ? entry.powershell : entry.bash;
|
|
@@ -3938,7 +3784,7 @@ function resolveImportCommand(entry) {
|
|
|
3938
3784
|
}
|
|
3939
3785
|
return void 0;
|
|
3940
3786
|
}
|
|
3941
|
-
function copilotHooksToCanonical(copilotHooks) {
|
|
3787
|
+
function copilotHooksToCanonical(copilotHooks, logger) {
|
|
3942
3788
|
if (copilotHooks === null || copilotHooks === void 0 || typeof copilotHooks !== "object") {
|
|
3943
3789
|
return {};
|
|
3944
3790
|
}
|
|
@@ -3951,7 +3797,7 @@ function copilotHooksToCanonical(copilotHooks) {
|
|
|
3951
3797
|
const parseResult = CopilotHookEntrySchema.safeParse(rawEntry);
|
|
3952
3798
|
if (!parseResult.success) continue;
|
|
3953
3799
|
const entry = parseResult.data;
|
|
3954
|
-
const command = resolveImportCommand(entry);
|
|
3800
|
+
const command = resolveImportCommand(entry, logger);
|
|
3955
3801
|
const timeout = entry.timeoutSec;
|
|
3956
3802
|
defs.push({
|
|
3957
3803
|
type: "command",
|
|
@@ -4011,7 +3857,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4011
3857
|
validate
|
|
4012
3858
|
});
|
|
4013
3859
|
}
|
|
4014
|
-
toRulesyncHooks() {
|
|
3860
|
+
toRulesyncHooks(options) {
|
|
4015
3861
|
let parsed;
|
|
4016
3862
|
try {
|
|
4017
3863
|
parsed = JSON.parse(this.getFileContent());
|
|
@@ -4023,7 +3869,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4023
3869
|
}
|
|
4024
3870
|
);
|
|
4025
3871
|
}
|
|
4026
|
-
const hooks = copilotHooksToCanonical(parsed.hooks);
|
|
3872
|
+
const hooks = copilotHooksToCanonical(parsed.hooks, options?.logger);
|
|
4027
3873
|
return this.toRulesyncHooksDefault({
|
|
4028
3874
|
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
4029
3875
|
});
|
|
@@ -4195,7 +4041,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4195
4041
|
baseDir = process.cwd(),
|
|
4196
4042
|
rulesyncHooks,
|
|
4197
4043
|
validate = true,
|
|
4198
|
-
global = false
|
|
4044
|
+
global = false,
|
|
4045
|
+
logger
|
|
4199
4046
|
}) {
|
|
4200
4047
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
4201
4048
|
const filePath = join25(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -4216,7 +4063,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4216
4063
|
const factorydroidHooks = canonicalToToolHooks({
|
|
4217
4064
|
config,
|
|
4218
4065
|
toolOverrideHooks: config.factorydroid?.hooks,
|
|
4219
|
-
converterConfig: FACTORYDROID_CONVERTER_CONFIG
|
|
4066
|
+
converterConfig: FACTORYDROID_CONVERTER_CONFIG,
|
|
4067
|
+
logger
|
|
4220
4068
|
});
|
|
4221
4069
|
const merged = { ...settings, hooks: factorydroidHooks };
|
|
4222
4070
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -4715,9 +4563,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4715
4563
|
baseDir = process.cwd(),
|
|
4716
4564
|
toolTarget,
|
|
4717
4565
|
global = false,
|
|
4718
|
-
dryRun = false
|
|
4566
|
+
dryRun = false,
|
|
4567
|
+
logger
|
|
4719
4568
|
}) {
|
|
4720
|
-
super({ baseDir, dryRun });
|
|
4569
|
+
super({ baseDir, dryRun, logger });
|
|
4721
4570
|
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
4722
4571
|
if (!result.success) {
|
|
4723
4572
|
throw new Error(
|
|
@@ -4736,7 +4585,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4736
4585
|
})
|
|
4737
4586
|
];
|
|
4738
4587
|
} catch (error) {
|
|
4739
|
-
logger.error(
|
|
4588
|
+
this.logger.error(
|
|
4740
4589
|
`Failed to load Rulesync hooks file (${RULESYNC_HOOKS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
4741
4590
|
);
|
|
4742
4591
|
return [];
|
|
@@ -4755,7 +4604,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4755
4604
|
global: this.global
|
|
4756
4605
|
});
|
|
4757
4606
|
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
4758
|
-
logger.debug(
|
|
4607
|
+
this.logger.debug(
|
|
4759
4608
|
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
4760
4609
|
);
|
|
4761
4610
|
return list;
|
|
@@ -4765,14 +4614,14 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4765
4614
|
validate: true,
|
|
4766
4615
|
global: this.global
|
|
4767
4616
|
});
|
|
4768
|
-
logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4617
|
+
this.logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4769
4618
|
return [toolHooks];
|
|
4770
4619
|
} catch (error) {
|
|
4771
4620
|
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
4772
4621
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
4773
|
-
logger.debug(msg);
|
|
4622
|
+
this.logger.debug(msg);
|
|
4774
4623
|
} else {
|
|
4775
|
-
logger.error(msg);
|
|
4624
|
+
this.logger.error(msg);
|
|
4776
4625
|
}
|
|
4777
4626
|
return [];
|
|
4778
4627
|
}
|
|
@@ -4793,7 +4642,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4793
4642
|
const configEventNames = new Set(Object.keys(effectiveHooks));
|
|
4794
4643
|
const skipped = [...configEventNames].filter((e) => !supportedEvents.has(e));
|
|
4795
4644
|
if (skipped.length > 0) {
|
|
4796
|
-
logger.warn(
|
|
4645
|
+
this.logger.warn(
|
|
4797
4646
|
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
4798
4647
|
);
|
|
4799
4648
|
}
|
|
@@ -4812,7 +4661,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4812
4661
|
}
|
|
4813
4662
|
}
|
|
4814
4663
|
for (const [hookType, events] of unsupportedTypeToEvents) {
|
|
4815
|
-
logger.warn(
|
|
4664
|
+
this.logger.warn(
|
|
4816
4665
|
`Skipped ${hookType}-type hook(s) for ${this.toolTarget} (not supported): ${Array.from(events).join(", ")}`
|
|
4817
4666
|
);
|
|
4818
4667
|
}
|
|
@@ -4827,7 +4676,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4827
4676
|
}
|
|
4828
4677
|
}
|
|
4829
4678
|
if (eventsWithMatcher.size > 0) {
|
|
4830
|
-
logger.warn(
|
|
4679
|
+
this.logger.warn(
|
|
4831
4680
|
`Skipped matcher hook(s) for ${this.toolTarget} (not supported): ${Array.from(eventsWithMatcher).join(", ")}`
|
|
4832
4681
|
);
|
|
4833
4682
|
}
|
|
@@ -5889,9 +5738,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5889
5738
|
baseDir = process.cwd(),
|
|
5890
5739
|
toolTarget,
|
|
5891
5740
|
getFactory = defaultGetFactory2,
|
|
5892
|
-
dryRun = false
|
|
5741
|
+
dryRun = false,
|
|
5742
|
+
logger
|
|
5893
5743
|
}) {
|
|
5894
|
-
super({ baseDir, dryRun });
|
|
5744
|
+
super({ baseDir, dryRun, logger });
|
|
5895
5745
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
5896
5746
|
if (!result.success) {
|
|
5897
5747
|
throw new Error(
|
|
@@ -5913,7 +5763,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5913
5763
|
try {
|
|
5914
5764
|
return [await RulesyncIgnore.fromFile()];
|
|
5915
5765
|
} catch (error) {
|
|
5916
|
-
logger.error(
|
|
5766
|
+
this.logger.error(
|
|
5917
5767
|
`Failed to load rulesync ignore file (${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
5918
5768
|
);
|
|
5919
5769
|
return [];
|
|
@@ -5943,9 +5793,9 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5943
5793
|
} catch (error) {
|
|
5944
5794
|
const errorMessage = `Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`;
|
|
5945
5795
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
5946
|
-
logger.debug(errorMessage);
|
|
5796
|
+
this.logger.debug(errorMessage);
|
|
5947
5797
|
} else {
|
|
5948
|
-
logger.error(errorMessage);
|
|
5798
|
+
this.logger.error(errorMessage);
|
|
5949
5799
|
}
|
|
5950
5800
|
return [];
|
|
5951
5801
|
}
|
|
@@ -6075,7 +5925,10 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6075
5925
|
}
|
|
6076
5926
|
return { success: true, error: null };
|
|
6077
5927
|
}
|
|
6078
|
-
static async fromFile({
|
|
5928
|
+
static async fromFile({
|
|
5929
|
+
validate = true,
|
|
5930
|
+
logger
|
|
5931
|
+
}) {
|
|
6079
5932
|
const baseDir = process.cwd();
|
|
6080
5933
|
const paths = this.getSettablePaths();
|
|
6081
5934
|
const recommendedPath = join42(
|
|
@@ -6095,7 +5948,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6095
5948
|
});
|
|
6096
5949
|
}
|
|
6097
5950
|
if (await fileExists(legacyPath)) {
|
|
6098
|
-
logger
|
|
5951
|
+
logger?.warn(
|
|
6099
5952
|
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
6100
5953
|
);
|
|
6101
5954
|
const fileContent2 = await readFileContent(legacyPath);
|
|
@@ -6597,63 +6450,200 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6597
6450
|
}
|
|
6598
6451
|
};
|
|
6599
6452
|
|
|
6600
|
-
// src/features/mcp/
|
|
6453
|
+
// src/features/mcp/copilotcli-mcp.ts
|
|
6601
6454
|
import { join as join47 } from "path";
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
}
|
|
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.`);
|
|
6620
6473
|
}
|
|
6621
|
-
|
|
6622
|
-
|
|
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;
|
|
6623
6485
|
}
|
|
6624
|
-
function
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
env: Object.fromEntries(
|
|
6632
|
-
Object.entries(config.env).map(([k, v]) => [
|
|
6633
|
-
k,
|
|
6634
|
-
v.replace(/\$\{(?!env:)([^}:]+)\}/g, "${env:$1}")
|
|
6635
|
-
])
|
|
6636
|
-
)
|
|
6637
|
-
}
|
|
6638
|
-
}
|
|
6639
|
-
])
|
|
6640
|
-
);
|
|
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;
|
|
6641
6493
|
}
|
|
6642
|
-
var
|
|
6494
|
+
var CopilotcliMcp = class _CopilotcliMcp extends ToolMcp {
|
|
6643
6495
|
json;
|
|
6644
6496
|
constructor(params) {
|
|
6645
6497
|
super(params);
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6498
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
6499
|
+
}
|
|
6500
|
+
getJson() {
|
|
6501
|
+
return this.json;
|
|
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
|
+
*/
|
|
6508
|
+
isDeletable() {
|
|
6509
|
+
return !this.global;
|
|
6510
|
+
}
|
|
6511
|
+
static getSettablePaths({ global } = {}) {
|
|
6512
|
+
if (global) {
|
|
6513
|
+
return {
|
|
6514
|
+
relativeDirPath: ".copilot",
|
|
6515
|
+
relativeFilePath: "mcp-config.json"
|
|
6516
|
+
};
|
|
6517
|
+
}
|
|
6518
|
+
return {
|
|
6519
|
+
relativeDirPath: ".copilot",
|
|
6520
|
+
relativeFilePath: "mcp-config.json"
|
|
6521
|
+
};
|
|
6522
|
+
}
|
|
6523
|
+
static async fromFile({
|
|
6524
|
+
baseDir = process.cwd(),
|
|
6525
|
+
validate = true,
|
|
6526
|
+
global = false
|
|
6527
|
+
}) {
|
|
6528
|
+
const paths = this.getSettablePaths({ global });
|
|
6529
|
+
const fileContent = await readFileContentOrNull(join47(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6530
|
+
const json = JSON.parse(fileContent);
|
|
6531
|
+
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6532
|
+
return new _CopilotcliMcp({
|
|
6533
|
+
baseDir,
|
|
6534
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6535
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6536
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
6537
|
+
validate,
|
|
6538
|
+
global
|
|
6539
|
+
});
|
|
6540
|
+
}
|
|
6541
|
+
static async fromRulesyncMcp({
|
|
6542
|
+
baseDir = process.cwd(),
|
|
6543
|
+
rulesyncMcp,
|
|
6544
|
+
validate = true,
|
|
6545
|
+
global = false
|
|
6546
|
+
}) {
|
|
6547
|
+
const paths = this.getSettablePaths({ global });
|
|
6548
|
+
const fileContent = await readOrInitializeFileContent(
|
|
6549
|
+
join47(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6550
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6551
|
+
);
|
|
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 = {};
|
|
6657
6647
|
}
|
|
6658
6648
|
}
|
|
6659
6649
|
getJson() {
|
|
@@ -6674,14 +6664,14 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6674
6664
|
global = false
|
|
6675
6665
|
}) {
|
|
6676
6666
|
const paths = this.getSettablePaths({ global });
|
|
6677
|
-
const filePath =
|
|
6667
|
+
const filePath = join48(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6678
6668
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"mcpServers":{}}';
|
|
6679
6669
|
let json;
|
|
6680
6670
|
try {
|
|
6681
6671
|
json = JSON.parse(fileContent);
|
|
6682
6672
|
} catch (error) {
|
|
6683
6673
|
throw new Error(
|
|
6684
|
-
`Failed to parse Cursor MCP config at ${
|
|
6674
|
+
`Failed to parse Cursor MCP config at ${join48(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6685
6675
|
{ cause: error }
|
|
6686
6676
|
);
|
|
6687
6677
|
}
|
|
@@ -6703,7 +6693,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6703
6693
|
}) {
|
|
6704
6694
|
const paths = this.getSettablePaths({ global });
|
|
6705
6695
|
const fileContent = await readOrInitializeFileContent(
|
|
6706
|
-
|
|
6696
|
+
join48(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6707
6697
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6708
6698
|
);
|
|
6709
6699
|
let json;
|
|
@@ -6711,7 +6701,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6711
6701
|
json = JSON.parse(fileContent);
|
|
6712
6702
|
} catch (error) {
|
|
6713
6703
|
throw new Error(
|
|
6714
|
-
`Failed to parse Cursor MCP config at ${
|
|
6704
|
+
`Failed to parse Cursor MCP config at ${join48(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6715
6705
|
{ cause: error }
|
|
6716
6706
|
);
|
|
6717
6707
|
}
|
|
@@ -6760,7 +6750,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6760
6750
|
};
|
|
6761
6751
|
|
|
6762
6752
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6763
|
-
import { join as
|
|
6753
|
+
import { join as join49 } from "path";
|
|
6764
6754
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6765
6755
|
json;
|
|
6766
6756
|
constructor(params) {
|
|
@@ -6781,7 +6771,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6781
6771
|
validate = true
|
|
6782
6772
|
}) {
|
|
6783
6773
|
const fileContent = await readFileContent(
|
|
6784
|
-
|
|
6774
|
+
join49(
|
|
6785
6775
|
baseDir,
|
|
6786
6776
|
this.getSettablePaths().relativeDirPath,
|
|
6787
6777
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6835,7 +6825,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6835
6825
|
};
|
|
6836
6826
|
|
|
6837
6827
|
// src/features/mcp/geminicli-mcp.ts
|
|
6838
|
-
import { join as
|
|
6828
|
+
import { join as join50 } from "path";
|
|
6839
6829
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6840
6830
|
json;
|
|
6841
6831
|
constructor(params) {
|
|
@@ -6863,7 +6853,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6863
6853
|
global = false
|
|
6864
6854
|
}) {
|
|
6865
6855
|
const paths = this.getSettablePaths({ global });
|
|
6866
|
-
const fileContent = await readFileContentOrNull(
|
|
6856
|
+
const fileContent = await readFileContentOrNull(join50(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6867
6857
|
const json = JSON.parse(fileContent);
|
|
6868
6858
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6869
6859
|
return new _GeminiCliMcp({
|
|
@@ -6882,7 +6872,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6882
6872
|
}) {
|
|
6883
6873
|
const paths = this.getSettablePaths({ global });
|
|
6884
6874
|
const fileContent = await readOrInitializeFileContent(
|
|
6885
|
-
|
|
6875
|
+
join50(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6886
6876
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6887
6877
|
);
|
|
6888
6878
|
const json = JSON.parse(fileContent);
|
|
@@ -6927,7 +6917,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6927
6917
|
};
|
|
6928
6918
|
|
|
6929
6919
|
// src/features/mcp/junie-mcp.ts
|
|
6930
|
-
import { join as
|
|
6920
|
+
import { join as join51 } from "path";
|
|
6931
6921
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6932
6922
|
json;
|
|
6933
6923
|
constructor(params) {
|
|
@@ -6939,7 +6929,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6939
6929
|
}
|
|
6940
6930
|
static getSettablePaths() {
|
|
6941
6931
|
return {
|
|
6942
|
-
relativeDirPath:
|
|
6932
|
+
relativeDirPath: join51(".junie", "mcp"),
|
|
6943
6933
|
relativeFilePath: "mcp.json"
|
|
6944
6934
|
};
|
|
6945
6935
|
}
|
|
@@ -6948,7 +6938,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6948
6938
|
validate = true
|
|
6949
6939
|
}) {
|
|
6950
6940
|
const fileContent = await readFileContent(
|
|
6951
|
-
|
|
6941
|
+
join51(
|
|
6952
6942
|
baseDir,
|
|
6953
6943
|
this.getSettablePaths().relativeDirPath,
|
|
6954
6944
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6997,7 +6987,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6997
6987
|
};
|
|
6998
6988
|
|
|
6999
6989
|
// src/features/mcp/kilo-mcp.ts
|
|
7000
|
-
import { join as
|
|
6990
|
+
import { join as join52 } from "path";
|
|
7001
6991
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
7002
6992
|
json;
|
|
7003
6993
|
constructor(params) {
|
|
@@ -7018,7 +7008,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7018
7008
|
validate = true
|
|
7019
7009
|
}) {
|
|
7020
7010
|
const paths = this.getSettablePaths();
|
|
7021
|
-
const fileContent = await readFileContentOrNull(
|
|
7011
|
+
const fileContent = await readFileContentOrNull(join52(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7022
7012
|
return new _KiloMcp({
|
|
7023
7013
|
baseDir,
|
|
7024
7014
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7066,7 +7056,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7066
7056
|
};
|
|
7067
7057
|
|
|
7068
7058
|
// src/features/mcp/kiro-mcp.ts
|
|
7069
|
-
import { join as
|
|
7059
|
+
import { join as join53 } from "path";
|
|
7070
7060
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
7071
7061
|
json;
|
|
7072
7062
|
constructor(params) {
|
|
@@ -7078,7 +7068,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7078
7068
|
}
|
|
7079
7069
|
static getSettablePaths() {
|
|
7080
7070
|
return {
|
|
7081
|
-
relativeDirPath:
|
|
7071
|
+
relativeDirPath: join53(".kiro", "settings"),
|
|
7082
7072
|
relativeFilePath: "mcp.json"
|
|
7083
7073
|
};
|
|
7084
7074
|
}
|
|
@@ -7087,7 +7077,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7087
7077
|
validate = true
|
|
7088
7078
|
}) {
|
|
7089
7079
|
const paths = this.getSettablePaths();
|
|
7090
|
-
const fileContent = await readFileContentOrNull(
|
|
7080
|
+
const fileContent = await readFileContentOrNull(join53(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7091
7081
|
return new _KiroMcp({
|
|
7092
7082
|
baseDir,
|
|
7093
7083
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7135,7 +7125,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7135
7125
|
};
|
|
7136
7126
|
|
|
7137
7127
|
// src/features/mcp/opencode-mcp.ts
|
|
7138
|
-
import { join as
|
|
7128
|
+
import { join as join54 } from "path";
|
|
7139
7129
|
import { parse as parseJsonc2 } from "jsonc-parser";
|
|
7140
7130
|
import { z as z22 } from "zod/mini";
|
|
7141
7131
|
var OpencodeMcpLocalServerSchema = z22.object({
|
|
@@ -7276,7 +7266,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7276
7266
|
static getSettablePaths({ global } = {}) {
|
|
7277
7267
|
if (global) {
|
|
7278
7268
|
return {
|
|
7279
|
-
relativeDirPath:
|
|
7269
|
+
relativeDirPath: join54(".config", "opencode"),
|
|
7280
7270
|
relativeFilePath: "opencode.json"
|
|
7281
7271
|
};
|
|
7282
7272
|
}
|
|
@@ -7291,11 +7281,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7291
7281
|
global = false
|
|
7292
7282
|
}) {
|
|
7293
7283
|
const basePaths = this.getSettablePaths({ global });
|
|
7294
|
-
const jsonDir =
|
|
7284
|
+
const jsonDir = join54(baseDir, basePaths.relativeDirPath);
|
|
7295
7285
|
let fileContent = null;
|
|
7296
7286
|
let relativeFilePath = "opencode.jsonc";
|
|
7297
|
-
const jsoncPath =
|
|
7298
|
-
const jsonPath =
|
|
7287
|
+
const jsoncPath = join54(jsonDir, "opencode.jsonc");
|
|
7288
|
+
const jsonPath = join54(jsonDir, "opencode.json");
|
|
7299
7289
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7300
7290
|
if (!fileContent) {
|
|
7301
7291
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7321,11 +7311,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7321
7311
|
global = false
|
|
7322
7312
|
}) {
|
|
7323
7313
|
const basePaths = this.getSettablePaths({ global });
|
|
7324
|
-
const jsonDir =
|
|
7314
|
+
const jsonDir = join54(baseDir, basePaths.relativeDirPath);
|
|
7325
7315
|
let fileContent = null;
|
|
7326
7316
|
let relativeFilePath = "opencode.jsonc";
|
|
7327
|
-
const jsoncPath =
|
|
7328
|
-
const jsonPath =
|
|
7317
|
+
const jsoncPath = join54(jsonDir, "opencode.jsonc");
|
|
7318
|
+
const jsonPath = join54(jsonDir, "opencode.json");
|
|
7329
7319
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7330
7320
|
if (!fileContent) {
|
|
7331
7321
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7386,7 +7376,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7386
7376
|
};
|
|
7387
7377
|
|
|
7388
7378
|
// src/features/mcp/roo-mcp.ts
|
|
7389
|
-
import { join as
|
|
7379
|
+
import { join as join55 } from "path";
|
|
7390
7380
|
function isRooMcpServers(value) {
|
|
7391
7381
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7392
7382
|
}
|
|
@@ -7438,7 +7428,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7438
7428
|
validate = true
|
|
7439
7429
|
}) {
|
|
7440
7430
|
const fileContent = await readFileContent(
|
|
7441
|
-
|
|
7431
|
+
join55(
|
|
7442
7432
|
baseDir,
|
|
7443
7433
|
this.getSettablePaths().relativeDirPath,
|
|
7444
7434
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7500,6 +7490,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
7500
7490
|
"cline",
|
|
7501
7491
|
"codexcli",
|
|
7502
7492
|
"copilot",
|
|
7493
|
+
"copilotcli",
|
|
7503
7494
|
"cursor",
|
|
7504
7495
|
"factorydroid",
|
|
7505
7496
|
"geminicli",
|
|
@@ -7571,6 +7562,18 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
7571
7562
|
}
|
|
7572
7563
|
}
|
|
7573
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
|
+
],
|
|
7574
7577
|
[
|
|
7575
7578
|
"cursor",
|
|
7576
7579
|
{
|
|
@@ -7693,9 +7696,10 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7693
7696
|
toolTarget,
|
|
7694
7697
|
global = false,
|
|
7695
7698
|
getFactory = defaultGetFactory3,
|
|
7696
|
-
dryRun = false
|
|
7699
|
+
dryRun = false,
|
|
7700
|
+
logger
|
|
7697
7701
|
}) {
|
|
7698
|
-
super({ baseDir, dryRun });
|
|
7702
|
+
super({ baseDir, dryRun, logger });
|
|
7699
7703
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
7700
7704
|
if (!result.success) {
|
|
7701
7705
|
throw new Error(
|
|
@@ -7714,7 +7718,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7714
7718
|
try {
|
|
7715
7719
|
return [await RulesyncMcp.fromFile({})];
|
|
7716
7720
|
} catch (error) {
|
|
7717
|
-
logger.error(
|
|
7721
|
+
this.logger.error(
|
|
7718
7722
|
`Failed to load a Rulesync MCP file (${RULESYNC_MCP_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
7719
7723
|
);
|
|
7720
7724
|
return [];
|
|
@@ -7738,7 +7742,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7738
7742
|
global: this.global
|
|
7739
7743
|
});
|
|
7740
7744
|
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
7741
|
-
logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7745
|
+
this.logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7742
7746
|
return toolMcps2;
|
|
7743
7747
|
}
|
|
7744
7748
|
const toolMcps = [
|
|
@@ -7748,14 +7752,14 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7748
7752
|
global: this.global
|
|
7749
7753
|
})
|
|
7750
7754
|
];
|
|
7751
|
-
logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7755
|
+
this.logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7752
7756
|
return toolMcps;
|
|
7753
7757
|
} catch (error) {
|
|
7754
7758
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
7755
7759
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
7756
|
-
logger.debug(errorMessage);
|
|
7760
|
+
this.logger.debug(errorMessage);
|
|
7757
7761
|
} else {
|
|
7758
|
-
logger.error(errorMessage);
|
|
7762
|
+
this.logger.error(errorMessage);
|
|
7759
7763
|
}
|
|
7760
7764
|
return [];
|
|
7761
7765
|
}
|
|
@@ -7811,7 +7815,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7811
7815
|
};
|
|
7812
7816
|
|
|
7813
7817
|
// src/features/rules/rules-processor.ts
|
|
7814
|
-
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";
|
|
7815
7819
|
import { encode } from "@toon-format/toon";
|
|
7816
7820
|
import { z as z57 } from "zod/mini";
|
|
7817
7821
|
|
|
@@ -7819,17 +7823,17 @@ import { z as z57 } from "zod/mini";
|
|
|
7819
7823
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7820
7824
|
|
|
7821
7825
|
// src/features/skills/agentsmd-skill.ts
|
|
7822
|
-
import { join as
|
|
7826
|
+
import { join as join59 } from "path";
|
|
7823
7827
|
|
|
7824
7828
|
// src/features/skills/simulated-skill.ts
|
|
7825
|
-
import { join as
|
|
7829
|
+
import { join as join58 } from "path";
|
|
7826
7830
|
import { z as z24 } from "zod/mini";
|
|
7827
7831
|
|
|
7828
7832
|
// src/features/skills/tool-skill.ts
|
|
7829
|
-
import { join as
|
|
7833
|
+
import { join as join57 } from "path";
|
|
7830
7834
|
|
|
7831
7835
|
// src/types/ai-dir.ts
|
|
7832
|
-
import path2, { basename as basename3, join as
|
|
7836
|
+
import path2, { basename as basename3, join as join56, relative as relative4, resolve as resolve4 } from "path";
|
|
7833
7837
|
var AiDir = class {
|
|
7834
7838
|
/**
|
|
7835
7839
|
* @example "."
|
|
@@ -7923,8 +7927,8 @@ var AiDir = class {
|
|
|
7923
7927
|
* @returns Array of files with their relative paths and buffers
|
|
7924
7928
|
*/
|
|
7925
7929
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7926
|
-
const dirPath =
|
|
7927
|
-
const glob =
|
|
7930
|
+
const dirPath = join56(baseDir, relativeDirPath, dirName);
|
|
7931
|
+
const glob = join56(dirPath, "**", "*");
|
|
7928
7932
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7929
7933
|
const filteredPaths = filePaths.filter((filePath) => basename3(filePath) !== excludeFileName);
|
|
7930
7934
|
const files = await Promise.all(
|
|
@@ -8022,8 +8026,8 @@ var ToolSkill = class extends AiDir {
|
|
|
8022
8026
|
}) {
|
|
8023
8027
|
const settablePaths = getSettablePaths({ global });
|
|
8024
8028
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8025
|
-
const skillDirPath =
|
|
8026
|
-
const skillFilePath =
|
|
8029
|
+
const skillDirPath = join57(baseDir, actualRelativeDirPath, dirName);
|
|
8030
|
+
const skillFilePath = join57(skillDirPath, SKILL_FILE_NAME);
|
|
8027
8031
|
if (!await fileExists(skillFilePath)) {
|
|
8028
8032
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8029
8033
|
}
|
|
@@ -8047,7 +8051,7 @@ var ToolSkill = class extends AiDir {
|
|
|
8047
8051
|
}
|
|
8048
8052
|
requireMainFileFrontmatter() {
|
|
8049
8053
|
if (!this.mainFile?.frontmatter) {
|
|
8050
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
8054
|
+
throw new Error(`Frontmatter is not defined in ${join57(this.relativeDirPath, this.dirName)}`);
|
|
8051
8055
|
}
|
|
8052
8056
|
return this.mainFile.frontmatter;
|
|
8053
8057
|
}
|
|
@@ -8087,7 +8091,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8087
8091
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8088
8092
|
if (!result.success) {
|
|
8089
8093
|
throw new Error(
|
|
8090
|
-
`Invalid frontmatter in ${
|
|
8094
|
+
`Invalid frontmatter in ${join58(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
8091
8095
|
);
|
|
8092
8096
|
}
|
|
8093
8097
|
}
|
|
@@ -8146,8 +8150,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8146
8150
|
}) {
|
|
8147
8151
|
const settablePaths = this.getSettablePaths();
|
|
8148
8152
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8149
|
-
const skillDirPath =
|
|
8150
|
-
const skillFilePath =
|
|
8153
|
+
const skillDirPath = join58(baseDir, actualRelativeDirPath, dirName);
|
|
8154
|
+
const skillFilePath = join58(skillDirPath, SKILL_FILE_NAME);
|
|
8151
8155
|
if (!await fileExists(skillFilePath)) {
|
|
8152
8156
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8153
8157
|
}
|
|
@@ -8224,7 +8228,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8224
8228
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
8225
8229
|
}
|
|
8226
8230
|
return {
|
|
8227
|
-
relativeDirPath:
|
|
8231
|
+
relativeDirPath: join59(".agents", "skills")
|
|
8228
8232
|
};
|
|
8229
8233
|
}
|
|
8230
8234
|
static async fromDir(params) {
|
|
@@ -8251,11 +8255,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8251
8255
|
};
|
|
8252
8256
|
|
|
8253
8257
|
// src/features/skills/factorydroid-skill.ts
|
|
8254
|
-
import { join as
|
|
8258
|
+
import { join as join60 } from "path";
|
|
8255
8259
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
8256
8260
|
static getSettablePaths(_options) {
|
|
8257
8261
|
return {
|
|
8258
|
-
relativeDirPath:
|
|
8262
|
+
relativeDirPath: join60(".factory", "skills")
|
|
8259
8263
|
};
|
|
8260
8264
|
}
|
|
8261
8265
|
static async fromDir(params) {
|
|
@@ -8282,23 +8286,26 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
8282
8286
|
};
|
|
8283
8287
|
|
|
8284
8288
|
// src/features/skills/skills-processor.ts
|
|
8285
|
-
import { basename as basename5, join as
|
|
8289
|
+
import { basename as basename5, join as join78 } from "path";
|
|
8286
8290
|
import { z as z40 } from "zod/mini";
|
|
8287
8291
|
|
|
8288
8292
|
// src/types/dir-feature-processor.ts
|
|
8289
|
-
import { join as
|
|
8293
|
+
import { join as join61 } from "path";
|
|
8290
8294
|
var DirFeatureProcessor = class {
|
|
8291
8295
|
baseDir;
|
|
8292
8296
|
dryRun;
|
|
8293
8297
|
avoidBlockScalars;
|
|
8298
|
+
logger;
|
|
8294
8299
|
constructor({
|
|
8295
8300
|
baseDir = process.cwd(),
|
|
8296
8301
|
dryRun = false,
|
|
8297
|
-
avoidBlockScalars = false
|
|
8302
|
+
avoidBlockScalars = false,
|
|
8303
|
+
logger
|
|
8298
8304
|
}) {
|
|
8299
8305
|
this.baseDir = baseDir;
|
|
8300
8306
|
this.dryRun = dryRun;
|
|
8301
8307
|
this.avoidBlockScalars = avoidBlockScalars;
|
|
8308
|
+
this.logger = logger;
|
|
8302
8309
|
}
|
|
8303
8310
|
/**
|
|
8304
8311
|
* Return tool targets that this feature supports.
|
|
@@ -8323,7 +8330,7 @@ var DirFeatureProcessor = class {
|
|
|
8323
8330
|
const mainFile = aiDir.getMainFile();
|
|
8324
8331
|
let mainFileContent;
|
|
8325
8332
|
if (mainFile) {
|
|
8326
|
-
const mainFilePath =
|
|
8333
|
+
const mainFilePath = join61(dirPath, mainFile.name);
|
|
8327
8334
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
8328
8335
|
avoidBlockScalars: this.avoidBlockScalars
|
|
8329
8336
|
});
|
|
@@ -8339,7 +8346,7 @@ var DirFeatureProcessor = class {
|
|
|
8339
8346
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
8340
8347
|
otherFileContents.push(contentWithNewline);
|
|
8341
8348
|
if (!dirHasChanges) {
|
|
8342
|
-
const filePath =
|
|
8349
|
+
const filePath = join61(dirPath, file.relativeFilePathToDirPath);
|
|
8343
8350
|
const existingContent = await readFileContentOrNull(filePath);
|
|
8344
8351
|
if (existingContent !== contentWithNewline) {
|
|
8345
8352
|
dirHasChanges = true;
|
|
@@ -8351,24 +8358,26 @@ var DirFeatureProcessor = class {
|
|
|
8351
8358
|
}
|
|
8352
8359
|
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
8353
8360
|
if (this.dryRun) {
|
|
8354
|
-
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8361
|
+
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8355
8362
|
if (mainFile) {
|
|
8356
|
-
logger.info(`[DRY RUN] Would write: ${
|
|
8357
|
-
changedPaths.push(
|
|
8363
|
+
this.logger.info(`[DRY RUN] Would write: ${join61(dirPath, mainFile.name)}`);
|
|
8364
|
+
changedPaths.push(join61(relativeDir, mainFile.name));
|
|
8358
8365
|
}
|
|
8359
8366
|
for (const file of otherFiles) {
|
|
8360
|
-
logger.info(
|
|
8361
|
-
|
|
8367
|
+
this.logger.info(
|
|
8368
|
+
`[DRY RUN] Would write: ${join61(dirPath, file.relativeFilePathToDirPath)}`
|
|
8369
|
+
);
|
|
8370
|
+
changedPaths.push(join61(relativeDir, file.relativeFilePathToDirPath));
|
|
8362
8371
|
}
|
|
8363
8372
|
} else {
|
|
8364
8373
|
await ensureDir(dirPath);
|
|
8365
8374
|
if (mainFile && mainFileContent) {
|
|
8366
|
-
const mainFilePath =
|
|
8375
|
+
const mainFilePath = join61(dirPath, mainFile.name);
|
|
8367
8376
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
8368
|
-
changedPaths.push(
|
|
8377
|
+
changedPaths.push(join61(relativeDir, mainFile.name));
|
|
8369
8378
|
}
|
|
8370
8379
|
for (const [i, file] of otherFiles.entries()) {
|
|
8371
|
-
const filePath =
|
|
8380
|
+
const filePath = join61(dirPath, file.relativeFilePathToDirPath);
|
|
8372
8381
|
const content = otherFileContents[i];
|
|
8373
8382
|
if (content === void 0) {
|
|
8374
8383
|
throw new Error(
|
|
@@ -8376,7 +8385,7 @@ var DirFeatureProcessor = class {
|
|
|
8376
8385
|
);
|
|
8377
8386
|
}
|
|
8378
8387
|
await writeFileContent(filePath, content);
|
|
8379
|
-
changedPaths.push(
|
|
8388
|
+
changedPaths.push(join61(relativeDir, file.relativeFilePathToDirPath));
|
|
8380
8389
|
}
|
|
8381
8390
|
}
|
|
8382
8391
|
changedCount++;
|
|
@@ -8398,7 +8407,7 @@ var DirFeatureProcessor = class {
|
|
|
8398
8407
|
for (const aiDir of orphanDirs) {
|
|
8399
8408
|
const dirPath = aiDir.getDirPath();
|
|
8400
8409
|
if (this.dryRun) {
|
|
8401
|
-
logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8410
|
+
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8402
8411
|
} else {
|
|
8403
8412
|
await removeDirectory(dirPath);
|
|
8404
8413
|
}
|
|
@@ -8408,11 +8417,11 @@ var DirFeatureProcessor = class {
|
|
|
8408
8417
|
};
|
|
8409
8418
|
|
|
8410
8419
|
// src/features/skills/agentsskills-skill.ts
|
|
8411
|
-
import { join as
|
|
8420
|
+
import { join as join63 } from "path";
|
|
8412
8421
|
import { z as z26 } from "zod/mini";
|
|
8413
8422
|
|
|
8414
8423
|
// src/features/skills/rulesync-skill.ts
|
|
8415
|
-
import { join as
|
|
8424
|
+
import { join as join62 } from "path";
|
|
8416
8425
|
import { z as z25 } from "zod/mini";
|
|
8417
8426
|
var RulesyncSkillFrontmatterSchemaInternal = z25.looseObject({
|
|
8418
8427
|
name: z25.string(),
|
|
@@ -8481,7 +8490,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8481
8490
|
}
|
|
8482
8491
|
getFrontmatter() {
|
|
8483
8492
|
if (!this.mainFile?.frontmatter) {
|
|
8484
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
8493
|
+
throw new Error(`Frontmatter is not defined in ${join62(this.relativeDirPath, this.dirName)}`);
|
|
8485
8494
|
}
|
|
8486
8495
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8487
8496
|
return result;
|
|
@@ -8507,8 +8516,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8507
8516
|
dirName,
|
|
8508
8517
|
global = false
|
|
8509
8518
|
}) {
|
|
8510
|
-
const skillDirPath =
|
|
8511
|
-
const skillFilePath =
|
|
8519
|
+
const skillDirPath = join62(baseDir, relativeDirPath, dirName);
|
|
8520
|
+
const skillFilePath = join62(skillDirPath, SKILL_FILE_NAME);
|
|
8512
8521
|
if (!await fileExists(skillFilePath)) {
|
|
8513
8522
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8514
8523
|
}
|
|
@@ -8545,7 +8554,7 @@ var AgentsSkillsSkillFrontmatterSchema = z26.looseObject({
|
|
|
8545
8554
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8546
8555
|
constructor({
|
|
8547
8556
|
baseDir = process.cwd(),
|
|
8548
|
-
relativeDirPath =
|
|
8557
|
+
relativeDirPath = join63(".agents", "skills"),
|
|
8549
8558
|
dirName,
|
|
8550
8559
|
frontmatter,
|
|
8551
8560
|
body,
|
|
@@ -8577,7 +8586,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8577
8586
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8578
8587
|
}
|
|
8579
8588
|
return {
|
|
8580
|
-
relativeDirPath:
|
|
8589
|
+
relativeDirPath: join63(".agents", "skills")
|
|
8581
8590
|
};
|
|
8582
8591
|
}
|
|
8583
8592
|
getFrontmatter() {
|
|
@@ -8657,9 +8666,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8657
8666
|
});
|
|
8658
8667
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8659
8668
|
if (!result.success) {
|
|
8660
|
-
const skillDirPath =
|
|
8669
|
+
const skillDirPath = join63(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8661
8670
|
throw new Error(
|
|
8662
|
-
`Invalid frontmatter in ${
|
|
8671
|
+
`Invalid frontmatter in ${join63(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8663
8672
|
);
|
|
8664
8673
|
}
|
|
8665
8674
|
return new _AgentsSkillsSkill({
|
|
@@ -8694,7 +8703,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8694
8703
|
};
|
|
8695
8704
|
|
|
8696
8705
|
// src/features/skills/antigravity-skill.ts
|
|
8697
|
-
import { join as
|
|
8706
|
+
import { join as join64 } from "path";
|
|
8698
8707
|
import { z as z27 } from "zod/mini";
|
|
8699
8708
|
var AntigravitySkillFrontmatterSchema = z27.looseObject({
|
|
8700
8709
|
name: z27.string(),
|
|
@@ -8703,7 +8712,7 @@ var AntigravitySkillFrontmatterSchema = z27.looseObject({
|
|
|
8703
8712
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8704
8713
|
constructor({
|
|
8705
8714
|
baseDir = process.cwd(),
|
|
8706
|
-
relativeDirPath =
|
|
8715
|
+
relativeDirPath = join64(".agent", "skills"),
|
|
8707
8716
|
dirName,
|
|
8708
8717
|
frontmatter,
|
|
8709
8718
|
body,
|
|
@@ -8735,11 +8744,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8735
8744
|
} = {}) {
|
|
8736
8745
|
if (global) {
|
|
8737
8746
|
return {
|
|
8738
|
-
relativeDirPath:
|
|
8747
|
+
relativeDirPath: join64(".gemini", "antigravity", "skills")
|
|
8739
8748
|
};
|
|
8740
8749
|
}
|
|
8741
8750
|
return {
|
|
8742
|
-
relativeDirPath:
|
|
8751
|
+
relativeDirPath: join64(".agent", "skills")
|
|
8743
8752
|
};
|
|
8744
8753
|
}
|
|
8745
8754
|
getFrontmatter() {
|
|
@@ -8819,9 +8828,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8819
8828
|
});
|
|
8820
8829
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8821
8830
|
if (!result.success) {
|
|
8822
|
-
const skillDirPath =
|
|
8831
|
+
const skillDirPath = join64(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8823
8832
|
throw new Error(
|
|
8824
|
-
`Invalid frontmatter in ${
|
|
8833
|
+
`Invalid frontmatter in ${join64(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8825
8834
|
);
|
|
8826
8835
|
}
|
|
8827
8836
|
return new _AntigravitySkill({
|
|
@@ -8855,7 +8864,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8855
8864
|
};
|
|
8856
8865
|
|
|
8857
8866
|
// src/features/skills/claudecode-skill.ts
|
|
8858
|
-
import { join as
|
|
8867
|
+
import { join as join65 } from "path";
|
|
8859
8868
|
import { z as z28 } from "zod/mini";
|
|
8860
8869
|
var ClaudecodeSkillFrontmatterSchema = z28.looseObject({
|
|
8861
8870
|
name: z28.string(),
|
|
@@ -8867,7 +8876,7 @@ var ClaudecodeSkillFrontmatterSchema = z28.looseObject({
|
|
|
8867
8876
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8868
8877
|
constructor({
|
|
8869
8878
|
baseDir = process.cwd(),
|
|
8870
|
-
relativeDirPath =
|
|
8879
|
+
relativeDirPath = join65(".claude", "skills"),
|
|
8871
8880
|
dirName,
|
|
8872
8881
|
frontmatter,
|
|
8873
8882
|
body,
|
|
@@ -8898,7 +8907,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8898
8907
|
global: _global = false
|
|
8899
8908
|
} = {}) {
|
|
8900
8909
|
return {
|
|
8901
|
-
relativeDirPath:
|
|
8910
|
+
relativeDirPath: join65(".claude", "skills")
|
|
8902
8911
|
};
|
|
8903
8912
|
}
|
|
8904
8913
|
getFrontmatter() {
|
|
@@ -8995,9 +9004,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8995
9004
|
});
|
|
8996
9005
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8997
9006
|
if (!result.success) {
|
|
8998
|
-
const skillDirPath =
|
|
9007
|
+
const skillDirPath = join65(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8999
9008
|
throw new Error(
|
|
9000
|
-
`Invalid frontmatter in ${
|
|
9009
|
+
`Invalid frontmatter in ${join65(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9001
9010
|
);
|
|
9002
9011
|
}
|
|
9003
9012
|
return new _ClaudecodeSkill({
|
|
@@ -9031,7 +9040,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9031
9040
|
};
|
|
9032
9041
|
|
|
9033
9042
|
// src/features/skills/cline-skill.ts
|
|
9034
|
-
import { join as
|
|
9043
|
+
import { join as join66 } from "path";
|
|
9035
9044
|
import { z as z29 } from "zod/mini";
|
|
9036
9045
|
var ClineSkillFrontmatterSchema = z29.looseObject({
|
|
9037
9046
|
name: z29.string(),
|
|
@@ -9040,7 +9049,7 @@ var ClineSkillFrontmatterSchema = z29.looseObject({
|
|
|
9040
9049
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
9041
9050
|
constructor({
|
|
9042
9051
|
baseDir = process.cwd(),
|
|
9043
|
-
relativeDirPath =
|
|
9052
|
+
relativeDirPath = join66(".cline", "skills"),
|
|
9044
9053
|
dirName,
|
|
9045
9054
|
frontmatter,
|
|
9046
9055
|
body,
|
|
@@ -9069,7 +9078,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9069
9078
|
}
|
|
9070
9079
|
static getSettablePaths(_options = {}) {
|
|
9071
9080
|
return {
|
|
9072
|
-
relativeDirPath:
|
|
9081
|
+
relativeDirPath: join66(".cline", "skills")
|
|
9073
9082
|
};
|
|
9074
9083
|
}
|
|
9075
9084
|
getFrontmatter() {
|
|
@@ -9157,13 +9166,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9157
9166
|
});
|
|
9158
9167
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9159
9168
|
if (!result.success) {
|
|
9160
|
-
const skillDirPath =
|
|
9169
|
+
const skillDirPath = join66(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9161
9170
|
throw new Error(
|
|
9162
|
-
`Invalid frontmatter in ${
|
|
9171
|
+
`Invalid frontmatter in ${join66(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9163
9172
|
);
|
|
9164
9173
|
}
|
|
9165
9174
|
if (result.data.name !== loaded.dirName) {
|
|
9166
|
-
const skillFilePath =
|
|
9175
|
+
const skillFilePath = join66(
|
|
9167
9176
|
loaded.baseDir,
|
|
9168
9177
|
loaded.relativeDirPath,
|
|
9169
9178
|
loaded.dirName,
|
|
@@ -9204,7 +9213,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9204
9213
|
};
|
|
9205
9214
|
|
|
9206
9215
|
// src/features/skills/codexcli-skill.ts
|
|
9207
|
-
import { join as
|
|
9216
|
+
import { join as join67 } from "path";
|
|
9208
9217
|
import { z as z30 } from "zod/mini";
|
|
9209
9218
|
var CodexCliSkillFrontmatterSchema = z30.looseObject({
|
|
9210
9219
|
name: z30.string(),
|
|
@@ -9218,7 +9227,7 @@ var CodexCliSkillFrontmatterSchema = z30.looseObject({
|
|
|
9218
9227
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
9219
9228
|
constructor({
|
|
9220
9229
|
baseDir = process.cwd(),
|
|
9221
|
-
relativeDirPath =
|
|
9230
|
+
relativeDirPath = join67(".codex", "skills"),
|
|
9222
9231
|
dirName,
|
|
9223
9232
|
frontmatter,
|
|
9224
9233
|
body,
|
|
@@ -9249,7 +9258,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9249
9258
|
global: _global = false
|
|
9250
9259
|
} = {}) {
|
|
9251
9260
|
return {
|
|
9252
|
-
relativeDirPath:
|
|
9261
|
+
relativeDirPath: join67(".codex", "skills")
|
|
9253
9262
|
};
|
|
9254
9263
|
}
|
|
9255
9264
|
getFrontmatter() {
|
|
@@ -9339,9 +9348,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9339
9348
|
});
|
|
9340
9349
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9341
9350
|
if (!result.success) {
|
|
9342
|
-
const skillDirPath =
|
|
9351
|
+
const skillDirPath = join67(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9343
9352
|
throw new Error(
|
|
9344
|
-
`Invalid frontmatter in ${
|
|
9353
|
+
`Invalid frontmatter in ${join67(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9345
9354
|
);
|
|
9346
9355
|
}
|
|
9347
9356
|
return new _CodexCliSkill({
|
|
@@ -9375,7 +9384,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9375
9384
|
};
|
|
9376
9385
|
|
|
9377
9386
|
// src/features/skills/copilot-skill.ts
|
|
9378
|
-
import { join as
|
|
9387
|
+
import { join as join68 } from "path";
|
|
9379
9388
|
import { z as z31 } from "zod/mini";
|
|
9380
9389
|
var CopilotSkillFrontmatterSchema = z31.looseObject({
|
|
9381
9390
|
name: z31.string(),
|
|
@@ -9385,7 +9394,7 @@ var CopilotSkillFrontmatterSchema = z31.looseObject({
|
|
|
9385
9394
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
9386
9395
|
constructor({
|
|
9387
9396
|
baseDir = process.cwd(),
|
|
9388
|
-
relativeDirPath =
|
|
9397
|
+
relativeDirPath = join68(".github", "skills"),
|
|
9389
9398
|
dirName,
|
|
9390
9399
|
frontmatter,
|
|
9391
9400
|
body,
|
|
@@ -9417,7 +9426,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9417
9426
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9418
9427
|
}
|
|
9419
9428
|
return {
|
|
9420
|
-
relativeDirPath:
|
|
9429
|
+
relativeDirPath: join68(".github", "skills")
|
|
9421
9430
|
};
|
|
9422
9431
|
}
|
|
9423
9432
|
getFrontmatter() {
|
|
@@ -9503,9 +9512,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9503
9512
|
});
|
|
9504
9513
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9505
9514
|
if (!result.success) {
|
|
9506
|
-
const skillDirPath =
|
|
9515
|
+
const skillDirPath = join68(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9507
9516
|
throw new Error(
|
|
9508
|
-
`Invalid frontmatter in ${
|
|
9517
|
+
`Invalid frontmatter in ${join68(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9509
9518
|
);
|
|
9510
9519
|
}
|
|
9511
9520
|
return new _CopilotSkill({
|
|
@@ -9540,7 +9549,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9540
9549
|
};
|
|
9541
9550
|
|
|
9542
9551
|
// src/features/skills/cursor-skill.ts
|
|
9543
|
-
import { join as
|
|
9552
|
+
import { join as join69 } from "path";
|
|
9544
9553
|
import { z as z32 } from "zod/mini";
|
|
9545
9554
|
var CursorSkillFrontmatterSchema = z32.looseObject({
|
|
9546
9555
|
name: z32.string(),
|
|
@@ -9549,7 +9558,7 @@ var CursorSkillFrontmatterSchema = z32.looseObject({
|
|
|
9549
9558
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9550
9559
|
constructor({
|
|
9551
9560
|
baseDir = process.cwd(),
|
|
9552
|
-
relativeDirPath =
|
|
9561
|
+
relativeDirPath = join69(".cursor", "skills"),
|
|
9553
9562
|
dirName,
|
|
9554
9563
|
frontmatter,
|
|
9555
9564
|
body,
|
|
@@ -9578,7 +9587,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9578
9587
|
}
|
|
9579
9588
|
static getSettablePaths(_options) {
|
|
9580
9589
|
return {
|
|
9581
|
-
relativeDirPath:
|
|
9590
|
+
relativeDirPath: join69(".cursor", "skills")
|
|
9582
9591
|
};
|
|
9583
9592
|
}
|
|
9584
9593
|
getFrontmatter() {
|
|
@@ -9658,9 +9667,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9658
9667
|
});
|
|
9659
9668
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9660
9669
|
if (!result.success) {
|
|
9661
|
-
const skillDirPath =
|
|
9670
|
+
const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9662
9671
|
throw new Error(
|
|
9663
|
-
`Invalid frontmatter in ${
|
|
9672
|
+
`Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9664
9673
|
);
|
|
9665
9674
|
}
|
|
9666
9675
|
return new _CursorSkill({
|
|
@@ -9695,7 +9704,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9695
9704
|
};
|
|
9696
9705
|
|
|
9697
9706
|
// src/features/skills/geminicli-skill.ts
|
|
9698
|
-
import { join as
|
|
9707
|
+
import { join as join70 } from "path";
|
|
9699
9708
|
import { z as z33 } from "zod/mini";
|
|
9700
9709
|
var GeminiCliSkillFrontmatterSchema = z33.looseObject({
|
|
9701
9710
|
name: z33.string(),
|
|
@@ -9735,7 +9744,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9735
9744
|
global: _global = false
|
|
9736
9745
|
} = {}) {
|
|
9737
9746
|
return {
|
|
9738
|
-
relativeDirPath:
|
|
9747
|
+
relativeDirPath: join70(".gemini", "skills")
|
|
9739
9748
|
};
|
|
9740
9749
|
}
|
|
9741
9750
|
getFrontmatter() {
|
|
@@ -9815,9 +9824,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9815
9824
|
});
|
|
9816
9825
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9817
9826
|
if (!result.success) {
|
|
9818
|
-
const skillDirPath =
|
|
9827
|
+
const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9819
9828
|
throw new Error(
|
|
9820
|
-
`Invalid frontmatter in ${
|
|
9829
|
+
`Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9821
9830
|
);
|
|
9822
9831
|
}
|
|
9823
9832
|
return new _GeminiCliSkill({
|
|
@@ -9852,7 +9861,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9852
9861
|
};
|
|
9853
9862
|
|
|
9854
9863
|
// src/features/skills/junie-skill.ts
|
|
9855
|
-
import { join as
|
|
9864
|
+
import { join as join71 } from "path";
|
|
9856
9865
|
import { z as z34 } from "zod/mini";
|
|
9857
9866
|
var JunieSkillFrontmatterSchema = z34.looseObject({
|
|
9858
9867
|
name: z34.string(),
|
|
@@ -9861,7 +9870,7 @@ var JunieSkillFrontmatterSchema = z34.looseObject({
|
|
|
9861
9870
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9862
9871
|
constructor({
|
|
9863
9872
|
baseDir = process.cwd(),
|
|
9864
|
-
relativeDirPath =
|
|
9873
|
+
relativeDirPath = join71(".junie", "skills"),
|
|
9865
9874
|
dirName,
|
|
9866
9875
|
frontmatter,
|
|
9867
9876
|
body,
|
|
@@ -9893,7 +9902,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9893
9902
|
throw new Error("JunieSkill does not support global mode.");
|
|
9894
9903
|
}
|
|
9895
9904
|
return {
|
|
9896
|
-
relativeDirPath:
|
|
9905
|
+
relativeDirPath: join71(".junie", "skills")
|
|
9897
9906
|
};
|
|
9898
9907
|
}
|
|
9899
9908
|
getFrontmatter() {
|
|
@@ -9980,13 +9989,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9980
9989
|
});
|
|
9981
9990
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9982
9991
|
if (!result.success) {
|
|
9983
|
-
const skillDirPath =
|
|
9992
|
+
const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9984
9993
|
throw new Error(
|
|
9985
|
-
`Invalid frontmatter in ${
|
|
9994
|
+
`Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9986
9995
|
);
|
|
9987
9996
|
}
|
|
9988
9997
|
if (result.data.name !== loaded.dirName) {
|
|
9989
|
-
const skillFilePath =
|
|
9998
|
+
const skillFilePath = join71(
|
|
9990
9999
|
loaded.baseDir,
|
|
9991
10000
|
loaded.relativeDirPath,
|
|
9992
10001
|
loaded.dirName,
|
|
@@ -10028,7 +10037,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10028
10037
|
};
|
|
10029
10038
|
|
|
10030
10039
|
// src/features/skills/kilo-skill.ts
|
|
10031
|
-
import { join as
|
|
10040
|
+
import { join as join72 } from "path";
|
|
10032
10041
|
import { z as z35 } from "zod/mini";
|
|
10033
10042
|
var KiloSkillFrontmatterSchema = z35.looseObject({
|
|
10034
10043
|
name: z35.string(),
|
|
@@ -10037,7 +10046,7 @@ var KiloSkillFrontmatterSchema = z35.looseObject({
|
|
|
10037
10046
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
10038
10047
|
constructor({
|
|
10039
10048
|
baseDir = process.cwd(),
|
|
10040
|
-
relativeDirPath =
|
|
10049
|
+
relativeDirPath = join72(".kilocode", "skills"),
|
|
10041
10050
|
dirName,
|
|
10042
10051
|
frontmatter,
|
|
10043
10052
|
body,
|
|
@@ -10068,7 +10077,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10068
10077
|
global: _global = false
|
|
10069
10078
|
} = {}) {
|
|
10070
10079
|
return {
|
|
10071
|
-
relativeDirPath:
|
|
10080
|
+
relativeDirPath: join72(".kilocode", "skills")
|
|
10072
10081
|
};
|
|
10073
10082
|
}
|
|
10074
10083
|
getFrontmatter() {
|
|
@@ -10156,13 +10165,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10156
10165
|
});
|
|
10157
10166
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10158
10167
|
if (!result.success) {
|
|
10159
|
-
const skillDirPath =
|
|
10168
|
+
const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10160
10169
|
throw new Error(
|
|
10161
|
-
`Invalid frontmatter in ${
|
|
10170
|
+
`Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10162
10171
|
);
|
|
10163
10172
|
}
|
|
10164
10173
|
if (result.data.name !== loaded.dirName) {
|
|
10165
|
-
const skillFilePath =
|
|
10174
|
+
const skillFilePath = join72(
|
|
10166
10175
|
loaded.baseDir,
|
|
10167
10176
|
loaded.relativeDirPath,
|
|
10168
10177
|
loaded.dirName,
|
|
@@ -10203,7 +10212,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10203
10212
|
};
|
|
10204
10213
|
|
|
10205
10214
|
// src/features/skills/kiro-skill.ts
|
|
10206
|
-
import { join as
|
|
10215
|
+
import { join as join73 } from "path";
|
|
10207
10216
|
import { z as z36 } from "zod/mini";
|
|
10208
10217
|
var KiroSkillFrontmatterSchema = z36.looseObject({
|
|
10209
10218
|
name: z36.string(),
|
|
@@ -10212,7 +10221,7 @@ var KiroSkillFrontmatterSchema = z36.looseObject({
|
|
|
10212
10221
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
10213
10222
|
constructor({
|
|
10214
10223
|
baseDir = process.cwd(),
|
|
10215
|
-
relativeDirPath =
|
|
10224
|
+
relativeDirPath = join73(".kiro", "skills"),
|
|
10216
10225
|
dirName,
|
|
10217
10226
|
frontmatter,
|
|
10218
10227
|
body,
|
|
@@ -10244,7 +10253,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10244
10253
|
throw new Error("KiroSkill does not support global mode.");
|
|
10245
10254
|
}
|
|
10246
10255
|
return {
|
|
10247
|
-
relativeDirPath:
|
|
10256
|
+
relativeDirPath: join73(".kiro", "skills")
|
|
10248
10257
|
};
|
|
10249
10258
|
}
|
|
10250
10259
|
getFrontmatter() {
|
|
@@ -10332,13 +10341,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10332
10341
|
});
|
|
10333
10342
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10334
10343
|
if (!result.success) {
|
|
10335
|
-
const skillDirPath =
|
|
10344
|
+
const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10336
10345
|
throw new Error(
|
|
10337
|
-
`Invalid frontmatter in ${
|
|
10346
|
+
`Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10338
10347
|
);
|
|
10339
10348
|
}
|
|
10340
10349
|
if (result.data.name !== loaded.dirName) {
|
|
10341
|
-
const skillFilePath =
|
|
10350
|
+
const skillFilePath = join73(
|
|
10342
10351
|
loaded.baseDir,
|
|
10343
10352
|
loaded.relativeDirPath,
|
|
10344
10353
|
loaded.dirName,
|
|
@@ -10380,7 +10389,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10380
10389
|
};
|
|
10381
10390
|
|
|
10382
10391
|
// src/features/skills/opencode-skill.ts
|
|
10383
|
-
import { join as
|
|
10392
|
+
import { join as join74 } from "path";
|
|
10384
10393
|
import { z as z37 } from "zod/mini";
|
|
10385
10394
|
var OpenCodeSkillFrontmatterSchema = z37.looseObject({
|
|
10386
10395
|
name: z37.string(),
|
|
@@ -10390,7 +10399,7 @@ var OpenCodeSkillFrontmatterSchema = z37.looseObject({
|
|
|
10390
10399
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
10391
10400
|
constructor({
|
|
10392
10401
|
baseDir = process.cwd(),
|
|
10393
|
-
relativeDirPath =
|
|
10402
|
+
relativeDirPath = join74(".opencode", "skill"),
|
|
10394
10403
|
dirName,
|
|
10395
10404
|
frontmatter,
|
|
10396
10405
|
body,
|
|
@@ -10419,7 +10428,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10419
10428
|
}
|
|
10420
10429
|
static getSettablePaths({ global = false } = {}) {
|
|
10421
10430
|
return {
|
|
10422
|
-
relativeDirPath: global ?
|
|
10431
|
+
relativeDirPath: global ? join74(".config", "opencode", "skill") : join74(".opencode", "skill")
|
|
10423
10432
|
};
|
|
10424
10433
|
}
|
|
10425
10434
|
getFrontmatter() {
|
|
@@ -10505,9 +10514,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10505
10514
|
});
|
|
10506
10515
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10507
10516
|
if (!result.success) {
|
|
10508
|
-
const skillDirPath =
|
|
10517
|
+
const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10509
10518
|
throw new Error(
|
|
10510
|
-
`Invalid frontmatter in ${
|
|
10519
|
+
`Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10511
10520
|
);
|
|
10512
10521
|
}
|
|
10513
10522
|
return new _OpenCodeSkill({
|
|
@@ -10541,7 +10550,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10541
10550
|
};
|
|
10542
10551
|
|
|
10543
10552
|
// src/features/skills/replit-skill.ts
|
|
10544
|
-
import { join as
|
|
10553
|
+
import { join as join75 } from "path";
|
|
10545
10554
|
import { z as z38 } from "zod/mini";
|
|
10546
10555
|
var ReplitSkillFrontmatterSchema = z38.looseObject({
|
|
10547
10556
|
name: z38.string(),
|
|
@@ -10550,7 +10559,7 @@ var ReplitSkillFrontmatterSchema = z38.looseObject({
|
|
|
10550
10559
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
10551
10560
|
constructor({
|
|
10552
10561
|
baseDir = process.cwd(),
|
|
10553
|
-
relativeDirPath =
|
|
10562
|
+
relativeDirPath = join75(".agents", "skills"),
|
|
10554
10563
|
dirName,
|
|
10555
10564
|
frontmatter,
|
|
10556
10565
|
body,
|
|
@@ -10582,7 +10591,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10582
10591
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10583
10592
|
}
|
|
10584
10593
|
return {
|
|
10585
|
-
relativeDirPath:
|
|
10594
|
+
relativeDirPath: join75(".agents", "skills")
|
|
10586
10595
|
};
|
|
10587
10596
|
}
|
|
10588
10597
|
getFrontmatter() {
|
|
@@ -10662,9 +10671,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10662
10671
|
});
|
|
10663
10672
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10664
10673
|
if (!result.success) {
|
|
10665
|
-
const skillDirPath =
|
|
10674
|
+
const skillDirPath = join75(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10666
10675
|
throw new Error(
|
|
10667
|
-
`Invalid frontmatter in ${
|
|
10676
|
+
`Invalid frontmatter in ${join75(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10668
10677
|
);
|
|
10669
10678
|
}
|
|
10670
10679
|
return new _ReplitSkill({
|
|
@@ -10699,7 +10708,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10699
10708
|
};
|
|
10700
10709
|
|
|
10701
10710
|
// src/features/skills/roo-skill.ts
|
|
10702
|
-
import { join as
|
|
10711
|
+
import { join as join76 } from "path";
|
|
10703
10712
|
import { z as z39 } from "zod/mini";
|
|
10704
10713
|
var RooSkillFrontmatterSchema = z39.looseObject({
|
|
10705
10714
|
name: z39.string(),
|
|
@@ -10708,7 +10717,7 @@ var RooSkillFrontmatterSchema = z39.looseObject({
|
|
|
10708
10717
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10709
10718
|
constructor({
|
|
10710
10719
|
baseDir = process.cwd(),
|
|
10711
|
-
relativeDirPath =
|
|
10720
|
+
relativeDirPath = join76(".roo", "skills"),
|
|
10712
10721
|
dirName,
|
|
10713
10722
|
frontmatter,
|
|
10714
10723
|
body,
|
|
@@ -10739,7 +10748,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10739
10748
|
global: _global = false
|
|
10740
10749
|
} = {}) {
|
|
10741
10750
|
return {
|
|
10742
|
-
relativeDirPath:
|
|
10751
|
+
relativeDirPath: join76(".roo", "skills")
|
|
10743
10752
|
};
|
|
10744
10753
|
}
|
|
10745
10754
|
getFrontmatter() {
|
|
@@ -10827,13 +10836,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10827
10836
|
});
|
|
10828
10837
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10829
10838
|
if (!result.success) {
|
|
10830
|
-
const skillDirPath =
|
|
10839
|
+
const skillDirPath = join76(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10831
10840
|
throw new Error(
|
|
10832
|
-
`Invalid frontmatter in ${
|
|
10841
|
+
`Invalid frontmatter in ${join76(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10833
10842
|
);
|
|
10834
10843
|
}
|
|
10835
10844
|
if (result.data.name !== loaded.dirName) {
|
|
10836
|
-
const skillFilePath =
|
|
10845
|
+
const skillFilePath = join76(
|
|
10837
10846
|
loaded.baseDir,
|
|
10838
10847
|
loaded.relativeDirPath,
|
|
10839
10848
|
loaded.dirName,
|
|
@@ -10874,14 +10883,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10874
10883
|
};
|
|
10875
10884
|
|
|
10876
10885
|
// src/features/skills/skills-utils.ts
|
|
10877
|
-
import { basename as basename4, join as
|
|
10886
|
+
import { basename as basename4, join as join77 } from "path";
|
|
10878
10887
|
async function getLocalSkillDirNames(baseDir) {
|
|
10879
|
-
const skillsDir =
|
|
10888
|
+
const skillsDir = join77(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10880
10889
|
const names = /* @__PURE__ */ new Set();
|
|
10881
10890
|
if (!await directoryExists(skillsDir)) {
|
|
10882
10891
|
return names;
|
|
10883
10892
|
}
|
|
10884
|
-
const dirPaths = await findFilesByGlobs(
|
|
10893
|
+
const dirPaths = await findFilesByGlobs(join77(skillsDir, "*"), { type: "dir" });
|
|
10885
10894
|
for (const dirPath of dirPaths) {
|
|
10886
10895
|
const name = basename4(dirPath);
|
|
10887
10896
|
if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
@@ -11063,9 +11072,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11063
11072
|
toolTarget,
|
|
11064
11073
|
global = false,
|
|
11065
11074
|
getFactory = defaultGetFactory4,
|
|
11066
|
-
dryRun = false
|
|
11075
|
+
dryRun = false,
|
|
11076
|
+
logger
|
|
11067
11077
|
}) {
|
|
11068
|
-
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor" });
|
|
11078
|
+
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor", logger });
|
|
11069
11079
|
const result = SkillsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
11070
11080
|
if (!result.success) {
|
|
11071
11081
|
throw new Error(
|
|
@@ -11098,7 +11108,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11098
11108
|
const rulesyncSkills = [];
|
|
11099
11109
|
for (const toolSkill of toolSkills) {
|
|
11100
11110
|
if (toolSkill instanceof SimulatedSkill) {
|
|
11101
|
-
logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11111
|
+
this.logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11102
11112
|
continue;
|
|
11103
11113
|
}
|
|
11104
11114
|
rulesyncSkills.push(toolSkill.toRulesyncSkill());
|
|
@@ -11119,14 +11129,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11119
11129
|
)
|
|
11120
11130
|
);
|
|
11121
11131
|
const localSkillNames = new Set(localDirNames);
|
|
11122
|
-
const curatedDirPath =
|
|
11132
|
+
const curatedDirPath = join78(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
11123
11133
|
let curatedSkills = [];
|
|
11124
11134
|
if (await directoryExists(curatedDirPath)) {
|
|
11125
|
-
const curatedDirPaths = await findFilesByGlobs(
|
|
11135
|
+
const curatedDirPaths = await findFilesByGlobs(join78(curatedDirPath, "*"), { type: "dir" });
|
|
11126
11136
|
const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
|
|
11127
11137
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
11128
11138
|
if (localSkillNames.has(name)) {
|
|
11129
|
-
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11139
|
+
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11130
11140
|
return false;
|
|
11131
11141
|
}
|
|
11132
11142
|
return true;
|
|
@@ -11144,7 +11154,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11144
11154
|
);
|
|
11145
11155
|
}
|
|
11146
11156
|
const allSkills = [...localSkills, ...curatedSkills];
|
|
11147
|
-
logger.debug(
|
|
11157
|
+
this.logger.debug(
|
|
11148
11158
|
`Successfully loaded ${allSkills.length} rulesync skills (${localSkills.length} local, ${curatedSkills.length} curated)`
|
|
11149
11159
|
);
|
|
11150
11160
|
return allSkills;
|
|
@@ -11156,8 +11166,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11156
11166
|
async loadToolDirs() {
|
|
11157
11167
|
const factory = this.getFactory(this.toolTarget);
|
|
11158
11168
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11159
|
-
const skillsDirPath =
|
|
11160
|
-
const dirPaths = await findFilesByGlobs(
|
|
11169
|
+
const skillsDirPath = join78(this.baseDir, paths.relativeDirPath);
|
|
11170
|
+
const dirPaths = await findFilesByGlobs(join78(skillsDirPath, "*"), { type: "dir" });
|
|
11161
11171
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
11162
11172
|
const toolSkills = await Promise.all(
|
|
11163
11173
|
dirNames.map(
|
|
@@ -11168,14 +11178,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11168
11178
|
})
|
|
11169
11179
|
)
|
|
11170
11180
|
);
|
|
11171
|
-
logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11181
|
+
this.logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11172
11182
|
return toolSkills;
|
|
11173
11183
|
}
|
|
11174
11184
|
async loadToolDirsToDelete() {
|
|
11175
11185
|
const factory = this.getFactory(this.toolTarget);
|
|
11176
11186
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11177
|
-
const skillsDirPath =
|
|
11178
|
-
const dirPaths = await findFilesByGlobs(
|
|
11187
|
+
const skillsDirPath = join78(this.baseDir, paths.relativeDirPath);
|
|
11188
|
+
const dirPaths = await findFilesByGlobs(join78(skillsDirPath, "*"), { type: "dir" });
|
|
11179
11189
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
11180
11190
|
const toolSkills = dirNames.map(
|
|
11181
11191
|
(dirName) => factory.class.forDeletion({
|
|
@@ -11185,7 +11195,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11185
11195
|
global: this.global
|
|
11186
11196
|
})
|
|
11187
11197
|
);
|
|
11188
|
-
logger.debug(
|
|
11198
|
+
this.logger.debug(
|
|
11189
11199
|
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
11190
11200
|
);
|
|
11191
11201
|
return toolSkills;
|
|
@@ -11237,10 +11247,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11237
11247
|
};
|
|
11238
11248
|
|
|
11239
11249
|
// src/features/subagents/agentsmd-subagent.ts
|
|
11240
|
-
import { join as
|
|
11250
|
+
import { join as join80 } from "path";
|
|
11241
11251
|
|
|
11242
11252
|
// src/features/subagents/simulated-subagent.ts
|
|
11243
|
-
import { basename as basename6, join as
|
|
11253
|
+
import { basename as basename6, join as join79 } from "path";
|
|
11244
11254
|
import { z as z41 } from "zod/mini";
|
|
11245
11255
|
|
|
11246
11256
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -11305,7 +11315,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11305
11315
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11306
11316
|
if (!result.success) {
|
|
11307
11317
|
throw new Error(
|
|
11308
|
-
`Invalid frontmatter in ${
|
|
11318
|
+
`Invalid frontmatter in ${join79(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11309
11319
|
);
|
|
11310
11320
|
}
|
|
11311
11321
|
}
|
|
@@ -11356,7 +11366,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11356
11366
|
return {
|
|
11357
11367
|
success: false,
|
|
11358
11368
|
error: new Error(
|
|
11359
|
-
`Invalid frontmatter in ${
|
|
11369
|
+
`Invalid frontmatter in ${join79(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11360
11370
|
)
|
|
11361
11371
|
};
|
|
11362
11372
|
}
|
|
@@ -11366,7 +11376,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11366
11376
|
relativeFilePath,
|
|
11367
11377
|
validate = true
|
|
11368
11378
|
}) {
|
|
11369
|
-
const filePath =
|
|
11379
|
+
const filePath = join79(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
11370
11380
|
const fileContent = await readFileContent(filePath);
|
|
11371
11381
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11372
11382
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11402,7 +11412,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11402
11412
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
11403
11413
|
static getSettablePaths() {
|
|
11404
11414
|
return {
|
|
11405
|
-
relativeDirPath:
|
|
11415
|
+
relativeDirPath: join80(".agents", "subagents")
|
|
11406
11416
|
};
|
|
11407
11417
|
}
|
|
11408
11418
|
static async fromFile(params) {
|
|
@@ -11425,11 +11435,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
11425
11435
|
};
|
|
11426
11436
|
|
|
11427
11437
|
// src/features/subagents/factorydroid-subagent.ts
|
|
11428
|
-
import { join as
|
|
11438
|
+
import { join as join81 } from "path";
|
|
11429
11439
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
11430
11440
|
static getSettablePaths(_options) {
|
|
11431
11441
|
return {
|
|
11432
|
-
relativeDirPath:
|
|
11442
|
+
relativeDirPath: join81(".factory", "droids")
|
|
11433
11443
|
};
|
|
11434
11444
|
}
|
|
11435
11445
|
static async fromFile(params) {
|
|
@@ -11452,11 +11462,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
11452
11462
|
};
|
|
11453
11463
|
|
|
11454
11464
|
// src/features/subagents/geminicli-subagent.ts
|
|
11455
|
-
import { join as
|
|
11465
|
+
import { join as join82 } from "path";
|
|
11456
11466
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
11457
11467
|
static getSettablePaths() {
|
|
11458
11468
|
return {
|
|
11459
|
-
relativeDirPath:
|
|
11469
|
+
relativeDirPath: join82(".gemini", "subagents")
|
|
11460
11470
|
};
|
|
11461
11471
|
}
|
|
11462
11472
|
static async fromFile(params) {
|
|
@@ -11479,11 +11489,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
11479
11489
|
};
|
|
11480
11490
|
|
|
11481
11491
|
// src/features/subagents/roo-subagent.ts
|
|
11482
|
-
import { join as
|
|
11492
|
+
import { join as join83 } from "path";
|
|
11483
11493
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
11484
11494
|
static getSettablePaths() {
|
|
11485
11495
|
return {
|
|
11486
|
-
relativeDirPath:
|
|
11496
|
+
relativeDirPath: join83(".roo", "subagents")
|
|
11487
11497
|
};
|
|
11488
11498
|
}
|
|
11489
11499
|
static async fromFile(params) {
|
|
@@ -11506,15 +11516,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
11506
11516
|
};
|
|
11507
11517
|
|
|
11508
11518
|
// src/features/subagents/subagents-processor.ts
|
|
11509
|
-
import { basename as basename9, join as
|
|
11519
|
+
import { basename as basename9, join as join92 } from "path";
|
|
11510
11520
|
import { z as z50 } from "zod/mini";
|
|
11511
11521
|
|
|
11512
11522
|
// src/features/subagents/claudecode-subagent.ts
|
|
11513
|
-
import { join as
|
|
11523
|
+
import { join as join85 } from "path";
|
|
11514
11524
|
import { z as z43 } from "zod/mini";
|
|
11515
11525
|
|
|
11516
11526
|
// src/features/subagents/rulesync-subagent.ts
|
|
11517
|
-
import { basename as basename7, join as
|
|
11527
|
+
import { basename as basename7, join as join84 } from "path";
|
|
11518
11528
|
import { z as z42 } from "zod/mini";
|
|
11519
11529
|
var RulesyncSubagentFrontmatterSchema = z42.looseObject({
|
|
11520
11530
|
targets: z42._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -11528,7 +11538,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11528
11538
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11529
11539
|
if (!parseResult.success && rest.validate !== false) {
|
|
11530
11540
|
throw new Error(
|
|
11531
|
-
`Invalid frontmatter in ${
|
|
11541
|
+
`Invalid frontmatter in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11532
11542
|
);
|
|
11533
11543
|
}
|
|
11534
11544
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -11561,7 +11571,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11561
11571
|
return {
|
|
11562
11572
|
success: false,
|
|
11563
11573
|
error: new Error(
|
|
11564
|
-
`Invalid frontmatter in ${
|
|
11574
|
+
`Invalid frontmatter in ${join84(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11565
11575
|
)
|
|
11566
11576
|
};
|
|
11567
11577
|
}
|
|
@@ -11569,7 +11579,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11569
11579
|
static async fromFile({
|
|
11570
11580
|
relativeFilePath
|
|
11571
11581
|
}) {
|
|
11572
|
-
const filePath =
|
|
11582
|
+
const filePath = join84(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
11573
11583
|
const fileContent = await readFileContent(filePath);
|
|
11574
11584
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11575
11585
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11604,7 +11614,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11604
11614
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11605
11615
|
if (!result.success) {
|
|
11606
11616
|
throw new Error(
|
|
11607
|
-
`Invalid frontmatter in ${
|
|
11617
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11608
11618
|
);
|
|
11609
11619
|
}
|
|
11610
11620
|
}
|
|
@@ -11616,7 +11626,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11616
11626
|
}
|
|
11617
11627
|
static getSettablePaths(_options = {}) {
|
|
11618
11628
|
return {
|
|
11619
|
-
relativeDirPath:
|
|
11629
|
+
relativeDirPath: join85(".claude", "agents")
|
|
11620
11630
|
};
|
|
11621
11631
|
}
|
|
11622
11632
|
getFrontmatter() {
|
|
@@ -11695,7 +11705,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11695
11705
|
return {
|
|
11696
11706
|
success: false,
|
|
11697
11707
|
error: new Error(
|
|
11698
|
-
`Invalid frontmatter in ${
|
|
11708
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11699
11709
|
)
|
|
11700
11710
|
};
|
|
11701
11711
|
}
|
|
@@ -11713,7 +11723,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11713
11723
|
global = false
|
|
11714
11724
|
}) {
|
|
11715
11725
|
const paths = this.getSettablePaths({ global });
|
|
11716
|
-
const filePath =
|
|
11726
|
+
const filePath = join85(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11717
11727
|
const fileContent = await readFileContent(filePath);
|
|
11718
11728
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11719
11729
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11748,7 +11758,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11748
11758
|
};
|
|
11749
11759
|
|
|
11750
11760
|
// src/features/subagents/codexcli-subagent.ts
|
|
11751
|
-
import { join as
|
|
11761
|
+
import { join as join86 } from "path";
|
|
11752
11762
|
import * as smolToml2 from "smol-toml";
|
|
11753
11763
|
import { z as z44 } from "zod/mini";
|
|
11754
11764
|
var CodexCliSubagentTomlSchema = z44.looseObject({
|
|
@@ -11768,7 +11778,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11768
11778
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11769
11779
|
} catch (error) {
|
|
11770
11780
|
throw new Error(
|
|
11771
|
-
`Invalid TOML in ${
|
|
11781
|
+
`Invalid TOML in ${join86(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11772
11782
|
{ cause: error }
|
|
11773
11783
|
);
|
|
11774
11784
|
}
|
|
@@ -11780,7 +11790,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11780
11790
|
}
|
|
11781
11791
|
static getSettablePaths(_options = {}) {
|
|
11782
11792
|
return {
|
|
11783
|
-
relativeDirPath:
|
|
11793
|
+
relativeDirPath: join86(".codex", "agents")
|
|
11784
11794
|
};
|
|
11785
11795
|
}
|
|
11786
11796
|
getBody() {
|
|
@@ -11792,7 +11802,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11792
11802
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11793
11803
|
} catch (error) {
|
|
11794
11804
|
throw new Error(
|
|
11795
|
-
`Failed to parse TOML in ${
|
|
11805
|
+
`Failed to parse TOML in ${join86(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11796
11806
|
{ cause: error }
|
|
11797
11807
|
);
|
|
11798
11808
|
}
|
|
@@ -11873,7 +11883,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11873
11883
|
global = false
|
|
11874
11884
|
}) {
|
|
11875
11885
|
const paths = this.getSettablePaths({ global });
|
|
11876
|
-
const filePath =
|
|
11886
|
+
const filePath = join86(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11877
11887
|
const fileContent = await readFileContent(filePath);
|
|
11878
11888
|
const subagent = new _CodexCliSubagent({
|
|
11879
11889
|
baseDir,
|
|
@@ -11911,7 +11921,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11911
11921
|
};
|
|
11912
11922
|
|
|
11913
11923
|
// src/features/subagents/copilot-subagent.ts
|
|
11914
|
-
import { join as
|
|
11924
|
+
import { join as join87 } from "path";
|
|
11915
11925
|
import { z as z45 } from "zod/mini";
|
|
11916
11926
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11917
11927
|
var CopilotSubagentFrontmatterSchema = z45.looseObject({
|
|
@@ -11937,7 +11947,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11937
11947
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11938
11948
|
if (!result.success) {
|
|
11939
11949
|
throw new Error(
|
|
11940
|
-
`Invalid frontmatter in ${
|
|
11950
|
+
`Invalid frontmatter in ${join87(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11941
11951
|
);
|
|
11942
11952
|
}
|
|
11943
11953
|
}
|
|
@@ -11949,7 +11959,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11949
11959
|
}
|
|
11950
11960
|
static getSettablePaths(_options = {}) {
|
|
11951
11961
|
return {
|
|
11952
|
-
relativeDirPath:
|
|
11962
|
+
relativeDirPath: join87(".github", "agents")
|
|
11953
11963
|
};
|
|
11954
11964
|
}
|
|
11955
11965
|
getFrontmatter() {
|
|
@@ -12023,7 +12033,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12023
12033
|
return {
|
|
12024
12034
|
success: false,
|
|
12025
12035
|
error: new Error(
|
|
12026
|
-
`Invalid frontmatter in ${
|
|
12036
|
+
`Invalid frontmatter in ${join87(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12027
12037
|
)
|
|
12028
12038
|
};
|
|
12029
12039
|
}
|
|
@@ -12041,7 +12051,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12041
12051
|
global = false
|
|
12042
12052
|
}) {
|
|
12043
12053
|
const paths = this.getSettablePaths({ global });
|
|
12044
|
-
const filePath =
|
|
12054
|
+
const filePath = join87(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12045
12055
|
const fileContent = await readFileContent(filePath);
|
|
12046
12056
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12047
12057
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12077,7 +12087,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12077
12087
|
};
|
|
12078
12088
|
|
|
12079
12089
|
// src/features/subagents/cursor-subagent.ts
|
|
12080
|
-
import { join as
|
|
12090
|
+
import { join as join88 } from "path";
|
|
12081
12091
|
import { z as z46 } from "zod/mini";
|
|
12082
12092
|
var CursorSubagentFrontmatterSchema = z46.looseObject({
|
|
12083
12093
|
name: z46.string(),
|
|
@@ -12091,7 +12101,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12091
12101
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12092
12102
|
if (!result.success) {
|
|
12093
12103
|
throw new Error(
|
|
12094
|
-
`Invalid frontmatter in ${
|
|
12104
|
+
`Invalid frontmatter in ${join88(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12095
12105
|
);
|
|
12096
12106
|
}
|
|
12097
12107
|
}
|
|
@@ -12103,7 +12113,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12103
12113
|
}
|
|
12104
12114
|
static getSettablePaths(_options = {}) {
|
|
12105
12115
|
return {
|
|
12106
|
-
relativeDirPath:
|
|
12116
|
+
relativeDirPath: join88(".cursor", "agents")
|
|
12107
12117
|
};
|
|
12108
12118
|
}
|
|
12109
12119
|
getFrontmatter() {
|
|
@@ -12170,7 +12180,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12170
12180
|
return {
|
|
12171
12181
|
success: false,
|
|
12172
12182
|
error: new Error(
|
|
12173
|
-
`Invalid frontmatter in ${
|
|
12183
|
+
`Invalid frontmatter in ${join88(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12174
12184
|
)
|
|
12175
12185
|
};
|
|
12176
12186
|
}
|
|
@@ -12188,7 +12198,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12188
12198
|
global = false
|
|
12189
12199
|
}) {
|
|
12190
12200
|
const paths = this.getSettablePaths({ global });
|
|
12191
|
-
const filePath =
|
|
12201
|
+
const filePath = join88(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12192
12202
|
const fileContent = await readFileContent(filePath);
|
|
12193
12203
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12194
12204
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12224,7 +12234,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12224
12234
|
};
|
|
12225
12235
|
|
|
12226
12236
|
// src/features/subagents/junie-subagent.ts
|
|
12227
|
-
import { join as
|
|
12237
|
+
import { join as join89 } from "path";
|
|
12228
12238
|
import { z as z47 } from "zod/mini";
|
|
12229
12239
|
var JunieSubagentFrontmatterSchema = z47.looseObject({
|
|
12230
12240
|
name: z47.optional(z47.string()),
|
|
@@ -12238,7 +12248,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12238
12248
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12239
12249
|
if (!result.success) {
|
|
12240
12250
|
throw new Error(
|
|
12241
|
-
`Invalid frontmatter in ${
|
|
12251
|
+
`Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12242
12252
|
);
|
|
12243
12253
|
}
|
|
12244
12254
|
}
|
|
@@ -12253,7 +12263,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12253
12263
|
throw new Error("JunieSubagent does not support global mode.");
|
|
12254
12264
|
}
|
|
12255
12265
|
return {
|
|
12256
|
-
relativeDirPath:
|
|
12266
|
+
relativeDirPath: join89(".junie", "agents")
|
|
12257
12267
|
};
|
|
12258
12268
|
}
|
|
12259
12269
|
getFrontmatter() {
|
|
@@ -12329,7 +12339,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12329
12339
|
return {
|
|
12330
12340
|
success: false,
|
|
12331
12341
|
error: new Error(
|
|
12332
|
-
`Invalid frontmatter in ${
|
|
12342
|
+
`Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12333
12343
|
)
|
|
12334
12344
|
};
|
|
12335
12345
|
}
|
|
@@ -12347,7 +12357,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12347
12357
|
global = false
|
|
12348
12358
|
}) {
|
|
12349
12359
|
const paths = this.getSettablePaths({ global });
|
|
12350
|
-
const filePath =
|
|
12360
|
+
const filePath = join89(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12351
12361
|
const fileContent = await readFileContent(filePath);
|
|
12352
12362
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12353
12363
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12382,7 +12392,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12382
12392
|
};
|
|
12383
12393
|
|
|
12384
12394
|
// src/features/subagents/kiro-subagent.ts
|
|
12385
|
-
import { join as
|
|
12395
|
+
import { join as join90 } from "path";
|
|
12386
12396
|
import { z as z48 } from "zod/mini";
|
|
12387
12397
|
var KiroCliSubagentJsonSchema = z48.looseObject({
|
|
12388
12398
|
name: z48.string(),
|
|
@@ -12409,7 +12419,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12409
12419
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
12410
12420
|
} catch (error) {
|
|
12411
12421
|
throw new Error(
|
|
12412
|
-
`Invalid JSON in ${
|
|
12422
|
+
`Invalid JSON in ${join90(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12413
12423
|
{ cause: error }
|
|
12414
12424
|
);
|
|
12415
12425
|
}
|
|
@@ -12421,7 +12431,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12421
12431
|
}
|
|
12422
12432
|
static getSettablePaths(_options = {}) {
|
|
12423
12433
|
return {
|
|
12424
|
-
relativeDirPath:
|
|
12434
|
+
relativeDirPath: join90(".kiro", "agents")
|
|
12425
12435
|
};
|
|
12426
12436
|
}
|
|
12427
12437
|
getBody() {
|
|
@@ -12433,7 +12443,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12433
12443
|
parsed = JSON.parse(this.body);
|
|
12434
12444
|
} catch (error) {
|
|
12435
12445
|
throw new Error(
|
|
12436
|
-
`Failed to parse JSON in ${
|
|
12446
|
+
`Failed to parse JSON in ${join90(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12437
12447
|
{ cause: error }
|
|
12438
12448
|
);
|
|
12439
12449
|
}
|
|
@@ -12514,7 +12524,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12514
12524
|
global = false
|
|
12515
12525
|
}) {
|
|
12516
12526
|
const paths = this.getSettablePaths({ global });
|
|
12517
|
-
const filePath =
|
|
12527
|
+
const filePath = join90(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12518
12528
|
const fileContent = await readFileContent(filePath);
|
|
12519
12529
|
const subagent = new _KiroSubagent({
|
|
12520
12530
|
baseDir,
|
|
@@ -12552,7 +12562,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12552
12562
|
};
|
|
12553
12563
|
|
|
12554
12564
|
// src/features/subagents/opencode-subagent.ts
|
|
12555
|
-
import { basename as basename8, join as
|
|
12565
|
+
import { basename as basename8, join as join91 } from "path";
|
|
12556
12566
|
import { z as z49 } from "zod/mini";
|
|
12557
12567
|
var OpenCodeSubagentFrontmatterSchema = z49.looseObject({
|
|
12558
12568
|
description: z49.optional(z49.string()),
|
|
@@ -12567,7 +12577,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12567
12577
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12568
12578
|
if (!result.success) {
|
|
12569
12579
|
throw new Error(
|
|
12570
|
-
`Invalid frontmatter in ${
|
|
12580
|
+
`Invalid frontmatter in ${join91(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12571
12581
|
);
|
|
12572
12582
|
}
|
|
12573
12583
|
}
|
|
@@ -12581,7 +12591,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12581
12591
|
global = false
|
|
12582
12592
|
} = {}) {
|
|
12583
12593
|
return {
|
|
12584
|
-
relativeDirPath: global ?
|
|
12594
|
+
relativeDirPath: global ? join91(".config", "opencode", "agent") : join91(".opencode", "agent")
|
|
12585
12595
|
};
|
|
12586
12596
|
}
|
|
12587
12597
|
getFrontmatter() {
|
|
@@ -12647,7 +12657,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12647
12657
|
return {
|
|
12648
12658
|
success: false,
|
|
12649
12659
|
error: new Error(
|
|
12650
|
-
`Invalid frontmatter in ${
|
|
12660
|
+
`Invalid frontmatter in ${join91(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12651
12661
|
)
|
|
12652
12662
|
};
|
|
12653
12663
|
}
|
|
@@ -12664,7 +12674,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12664
12674
|
global = false
|
|
12665
12675
|
}) {
|
|
12666
12676
|
const paths = this.getSettablePaths({ global });
|
|
12667
|
-
const filePath =
|
|
12677
|
+
const filePath = join91(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12668
12678
|
const fileContent = await readFileContent(filePath);
|
|
12669
12679
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12670
12680
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12831,9 +12841,10 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12831
12841
|
toolTarget,
|
|
12832
12842
|
global = false,
|
|
12833
12843
|
getFactory = defaultGetFactory5,
|
|
12834
|
-
dryRun = false
|
|
12844
|
+
dryRun = false,
|
|
12845
|
+
logger
|
|
12835
12846
|
}) {
|
|
12836
|
-
super({ baseDir, dryRun });
|
|
12847
|
+
super({ baseDir, dryRun, logger });
|
|
12837
12848
|
const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
12838
12849
|
if (!result.success) {
|
|
12839
12850
|
throw new Error(
|
|
@@ -12869,7 +12880,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12869
12880
|
const rulesyncSubagents = [];
|
|
12870
12881
|
for (const toolSubagent of toolSubagents) {
|
|
12871
12882
|
if (toolSubagent instanceof SimulatedSubagent) {
|
|
12872
|
-
logger.debug(
|
|
12883
|
+
this.logger.debug(
|
|
12873
12884
|
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
12874
12885
|
);
|
|
12875
12886
|
continue;
|
|
@@ -12883,39 +12894,39 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12883
12894
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12884
12895
|
*/
|
|
12885
12896
|
async loadRulesyncFiles() {
|
|
12886
|
-
const subagentsDir =
|
|
12897
|
+
const subagentsDir = join92(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12887
12898
|
const dirExists = await directoryExists(subagentsDir);
|
|
12888
12899
|
if (!dirExists) {
|
|
12889
|
-
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12900
|
+
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12890
12901
|
return [];
|
|
12891
12902
|
}
|
|
12892
12903
|
const entries = await listDirectoryFiles(subagentsDir);
|
|
12893
12904
|
const mdFiles = entries.filter((file) => file.endsWith(".md"));
|
|
12894
12905
|
if (mdFiles.length === 0) {
|
|
12895
|
-
logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12906
|
+
this.logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12896
12907
|
return [];
|
|
12897
12908
|
}
|
|
12898
|
-
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12909
|
+
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12899
12910
|
const rulesyncSubagents = [];
|
|
12900
12911
|
for (const mdFile of mdFiles) {
|
|
12901
|
-
const filepath =
|
|
12912
|
+
const filepath = join92(subagentsDir, mdFile);
|
|
12902
12913
|
try {
|
|
12903
12914
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12904
12915
|
relativeFilePath: mdFile,
|
|
12905
12916
|
validate: true
|
|
12906
12917
|
});
|
|
12907
12918
|
rulesyncSubagents.push(rulesyncSubagent);
|
|
12908
|
-
logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12919
|
+
this.logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12909
12920
|
} catch (error) {
|
|
12910
|
-
logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12921
|
+
this.logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12911
12922
|
continue;
|
|
12912
12923
|
}
|
|
12913
12924
|
}
|
|
12914
12925
|
if (rulesyncSubagents.length === 0) {
|
|
12915
|
-
logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12926
|
+
this.logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12916
12927
|
return [];
|
|
12917
12928
|
}
|
|
12918
|
-
logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12929
|
+
this.logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12919
12930
|
return rulesyncSubagents;
|
|
12920
12931
|
}
|
|
12921
12932
|
/**
|
|
@@ -12928,7 +12939,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12928
12939
|
const factory = this.getFactory(this.toolTarget);
|
|
12929
12940
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12930
12941
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12931
|
-
|
|
12942
|
+
join92(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12932
12943
|
);
|
|
12933
12944
|
if (forDeletion) {
|
|
12934
12945
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -12939,7 +12950,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12939
12950
|
global: this.global
|
|
12940
12951
|
})
|
|
12941
12952
|
).filter((subagent) => subagent.isDeletable());
|
|
12942
|
-
logger.debug(
|
|
12953
|
+
this.logger.debug(
|
|
12943
12954
|
`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`
|
|
12944
12955
|
);
|
|
12945
12956
|
return toolSubagents2;
|
|
@@ -12953,7 +12964,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12953
12964
|
})
|
|
12954
12965
|
)
|
|
12955
12966
|
);
|
|
12956
|
-
logger.debug(
|
|
12967
|
+
this.logger.debug(
|
|
12968
|
+
`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`
|
|
12969
|
+
);
|
|
12957
12970
|
return toolSubagents;
|
|
12958
12971
|
}
|
|
12959
12972
|
/**
|
|
@@ -12993,13 +13006,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12993
13006
|
};
|
|
12994
13007
|
|
|
12995
13008
|
// src/features/rules/agentsmd-rule.ts
|
|
12996
|
-
import { join as
|
|
13009
|
+
import { join as join95 } from "path";
|
|
12997
13010
|
|
|
12998
13011
|
// src/features/rules/tool-rule.ts
|
|
12999
|
-
import { join as
|
|
13012
|
+
import { join as join94 } from "path";
|
|
13000
13013
|
|
|
13001
13014
|
// src/features/rules/rulesync-rule.ts
|
|
13002
|
-
import { join as
|
|
13015
|
+
import { join as join93 } from "path";
|
|
13003
13016
|
import { z as z51 } from "zod/mini";
|
|
13004
13017
|
var RulesyncRuleFrontmatterSchema = z51.object({
|
|
13005
13018
|
root: z51.optional(z51.boolean()),
|
|
@@ -13046,7 +13059,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13046
13059
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13047
13060
|
if (!parseResult.success && rest.validate !== false) {
|
|
13048
13061
|
throw new Error(
|
|
13049
|
-
`Invalid frontmatter in ${
|
|
13062
|
+
`Invalid frontmatter in ${join93(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
13050
13063
|
);
|
|
13051
13064
|
}
|
|
13052
13065
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -13081,7 +13094,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13081
13094
|
return {
|
|
13082
13095
|
success: false,
|
|
13083
13096
|
error: new Error(
|
|
13084
|
-
`Invalid frontmatter in ${
|
|
13097
|
+
`Invalid frontmatter in ${join93(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13085
13098
|
)
|
|
13086
13099
|
};
|
|
13087
13100
|
}
|
|
@@ -13090,7 +13103,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13090
13103
|
relativeFilePath,
|
|
13091
13104
|
validate = true
|
|
13092
13105
|
}) {
|
|
13093
|
-
const filePath =
|
|
13106
|
+
const filePath = join93(
|
|
13094
13107
|
process.cwd(),
|
|
13095
13108
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
13096
13109
|
relativeFilePath
|
|
@@ -13192,7 +13205,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13192
13205
|
rulesyncRule,
|
|
13193
13206
|
validate = true,
|
|
13194
13207
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
13195
|
-
nonRootPath = { relativeDirPath:
|
|
13208
|
+
nonRootPath = { relativeDirPath: join94(".agents", "memories") }
|
|
13196
13209
|
}) {
|
|
13197
13210
|
const params = this.buildToolRuleParamsDefault({
|
|
13198
13211
|
baseDir,
|
|
@@ -13203,7 +13216,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13203
13216
|
});
|
|
13204
13217
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
13205
13218
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
13206
|
-
params.relativeDirPath =
|
|
13219
|
+
params.relativeDirPath = join94(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
13207
13220
|
params.relativeFilePath = "AGENTS.md";
|
|
13208
13221
|
}
|
|
13209
13222
|
return params;
|
|
@@ -13252,7 +13265,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13252
13265
|
}
|
|
13253
13266
|
};
|
|
13254
13267
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
13255
|
-
return excludeToolDir ? subDir :
|
|
13268
|
+
return excludeToolDir ? subDir : join94(toolDir, subDir);
|
|
13256
13269
|
}
|
|
13257
13270
|
|
|
13258
13271
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -13281,8 +13294,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13281
13294
|
validate = true
|
|
13282
13295
|
}) {
|
|
13283
13296
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
13284
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
13285
|
-
const fileContent = await readFileContent(
|
|
13297
|
+
const relativePath = isRoot ? "AGENTS.md" : join95(".agents", "memories", relativeFilePath);
|
|
13298
|
+
const fileContent = await readFileContent(join95(baseDir, relativePath));
|
|
13286
13299
|
return new _AgentsMdRule({
|
|
13287
13300
|
baseDir,
|
|
13288
13301
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13337,7 +13350,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13337
13350
|
};
|
|
13338
13351
|
|
|
13339
13352
|
// src/features/rules/antigravity-rule.ts
|
|
13340
|
-
import { join as
|
|
13353
|
+
import { join as join96 } from "path";
|
|
13341
13354
|
import { z as z52 } from "zod/mini";
|
|
13342
13355
|
var AntigravityRuleFrontmatterSchema = z52.looseObject({
|
|
13343
13356
|
trigger: z52.optional(
|
|
@@ -13496,7 +13509,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13496
13509
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13497
13510
|
if (!result.success) {
|
|
13498
13511
|
throw new Error(
|
|
13499
|
-
`Invalid frontmatter in ${
|
|
13512
|
+
`Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13500
13513
|
);
|
|
13501
13514
|
}
|
|
13502
13515
|
}
|
|
@@ -13520,7 +13533,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13520
13533
|
relativeFilePath,
|
|
13521
13534
|
validate = true
|
|
13522
13535
|
}) {
|
|
13523
|
-
const filePath =
|
|
13536
|
+
const filePath = join96(
|
|
13524
13537
|
baseDir,
|
|
13525
13538
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13526
13539
|
relativeFilePath
|
|
@@ -13660,7 +13673,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13660
13673
|
};
|
|
13661
13674
|
|
|
13662
13675
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
13663
|
-
import { join as
|
|
13676
|
+
import { join as join97 } from "path";
|
|
13664
13677
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
13665
13678
|
toRulesyncRule() {
|
|
13666
13679
|
const rulesyncFrontmatter = {
|
|
@@ -13720,8 +13733,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13720
13733
|
}) {
|
|
13721
13734
|
const settablePaths = this.getSettablePaths();
|
|
13722
13735
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
13723
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
13724
|
-
const fileContent = await readFileContent(
|
|
13736
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join97(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13737
|
+
const fileContent = await readFileContent(join97(baseDir, relativePath));
|
|
13725
13738
|
return new _AugmentcodeLegacyRule({
|
|
13726
13739
|
baseDir,
|
|
13727
13740
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -13750,7 +13763,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13750
13763
|
};
|
|
13751
13764
|
|
|
13752
13765
|
// src/features/rules/augmentcode-rule.ts
|
|
13753
|
-
import { join as
|
|
13766
|
+
import { join as join98 } from "path";
|
|
13754
13767
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
13755
13768
|
toRulesyncRule() {
|
|
13756
13769
|
return this.toRulesyncRuleDefault();
|
|
@@ -13781,7 +13794,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13781
13794
|
relativeFilePath,
|
|
13782
13795
|
validate = true
|
|
13783
13796
|
}) {
|
|
13784
|
-
const filePath =
|
|
13797
|
+
const filePath = join98(
|
|
13785
13798
|
baseDir,
|
|
13786
13799
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13787
13800
|
relativeFilePath
|
|
@@ -13821,7 +13834,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13821
13834
|
};
|
|
13822
13835
|
|
|
13823
13836
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13824
|
-
import { join as
|
|
13837
|
+
import { join as join99 } from "path";
|
|
13825
13838
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13826
13839
|
static getSettablePaths({
|
|
13827
13840
|
global,
|
|
@@ -13863,7 +13876,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13863
13876
|
if (isRoot) {
|
|
13864
13877
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13865
13878
|
const fileContent2 = await readFileContent(
|
|
13866
|
-
|
|
13879
|
+
join99(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13867
13880
|
);
|
|
13868
13881
|
return new _ClaudecodeLegacyRule({
|
|
13869
13882
|
baseDir,
|
|
@@ -13877,8 +13890,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13877
13890
|
if (!paths.nonRoot) {
|
|
13878
13891
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13879
13892
|
}
|
|
13880
|
-
const relativePath =
|
|
13881
|
-
const fileContent = await readFileContent(
|
|
13893
|
+
const relativePath = join99(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13894
|
+
const fileContent = await readFileContent(join99(baseDir, relativePath));
|
|
13882
13895
|
return new _ClaudecodeLegacyRule({
|
|
13883
13896
|
baseDir,
|
|
13884
13897
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13937,7 +13950,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13937
13950
|
};
|
|
13938
13951
|
|
|
13939
13952
|
// src/features/rules/claudecode-rule.ts
|
|
13940
|
-
import { join as
|
|
13953
|
+
import { join as join100 } from "path";
|
|
13941
13954
|
import { z as z53 } from "zod/mini";
|
|
13942
13955
|
var ClaudecodeRuleFrontmatterSchema = z53.object({
|
|
13943
13956
|
paths: z53.optional(z53.array(z53.string()))
|
|
@@ -13978,7 +13991,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13978
13991
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13979
13992
|
if (!result.success) {
|
|
13980
13993
|
throw new Error(
|
|
13981
|
-
`Invalid frontmatter in ${
|
|
13994
|
+
`Invalid frontmatter in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13982
13995
|
);
|
|
13983
13996
|
}
|
|
13984
13997
|
}
|
|
@@ -14008,7 +14021,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14008
14021
|
if (isRoot) {
|
|
14009
14022
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
14010
14023
|
const fileContent2 = await readFileContent(
|
|
14011
|
-
|
|
14024
|
+
join100(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
14012
14025
|
);
|
|
14013
14026
|
return new _ClaudecodeRule({
|
|
14014
14027
|
baseDir,
|
|
@@ -14023,8 +14036,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14023
14036
|
if (!paths.nonRoot) {
|
|
14024
14037
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14025
14038
|
}
|
|
14026
|
-
const relativePath =
|
|
14027
|
-
const filePath =
|
|
14039
|
+
const relativePath = join100(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14040
|
+
const filePath = join100(baseDir, relativePath);
|
|
14028
14041
|
const fileContent = await readFileContent(filePath);
|
|
14029
14042
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14030
14043
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14135,7 +14148,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14135
14148
|
return {
|
|
14136
14149
|
success: false,
|
|
14137
14150
|
error: new Error(
|
|
14138
|
-
`Invalid frontmatter in ${
|
|
14151
|
+
`Invalid frontmatter in ${join100(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14139
14152
|
)
|
|
14140
14153
|
};
|
|
14141
14154
|
}
|
|
@@ -14155,7 +14168,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14155
14168
|
};
|
|
14156
14169
|
|
|
14157
14170
|
// src/features/rules/cline-rule.ts
|
|
14158
|
-
import { join as
|
|
14171
|
+
import { join as join101 } from "path";
|
|
14159
14172
|
import { z as z54 } from "zod/mini";
|
|
14160
14173
|
var ClineRuleFrontmatterSchema = z54.object({
|
|
14161
14174
|
description: z54.string()
|
|
@@ -14201,7 +14214,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14201
14214
|
validate = true
|
|
14202
14215
|
}) {
|
|
14203
14216
|
const fileContent = await readFileContent(
|
|
14204
|
-
|
|
14217
|
+
join101(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14205
14218
|
);
|
|
14206
14219
|
return new _ClineRule({
|
|
14207
14220
|
baseDir,
|
|
@@ -14227,7 +14240,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14227
14240
|
};
|
|
14228
14241
|
|
|
14229
14242
|
// src/features/rules/codexcli-rule.ts
|
|
14230
|
-
import { join as
|
|
14243
|
+
import { join as join102 } from "path";
|
|
14231
14244
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
14232
14245
|
static getSettablePaths({
|
|
14233
14246
|
global,
|
|
@@ -14262,7 +14275,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14262
14275
|
if (isRoot) {
|
|
14263
14276
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14264
14277
|
const fileContent2 = await readFileContent(
|
|
14265
|
-
|
|
14278
|
+
join102(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14266
14279
|
);
|
|
14267
14280
|
return new _CodexcliRule({
|
|
14268
14281
|
baseDir,
|
|
@@ -14276,8 +14289,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14276
14289
|
if (!paths.nonRoot) {
|
|
14277
14290
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14278
14291
|
}
|
|
14279
|
-
const relativePath =
|
|
14280
|
-
const fileContent = await readFileContent(
|
|
14292
|
+
const relativePath = join102(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14293
|
+
const fileContent = await readFileContent(join102(baseDir, relativePath));
|
|
14281
14294
|
return new _CodexcliRule({
|
|
14282
14295
|
baseDir,
|
|
14283
14296
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14336,7 +14349,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14336
14349
|
};
|
|
14337
14350
|
|
|
14338
14351
|
// src/features/rules/copilot-rule.ts
|
|
14339
|
-
import { join as
|
|
14352
|
+
import { join as join103 } from "path";
|
|
14340
14353
|
import { z as z55 } from "zod/mini";
|
|
14341
14354
|
var CopilotRuleFrontmatterSchema = z55.object({
|
|
14342
14355
|
description: z55.optional(z55.string()),
|
|
@@ -14373,7 +14386,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14373
14386
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14374
14387
|
if (!result.success) {
|
|
14375
14388
|
throw new Error(
|
|
14376
|
-
`Invalid frontmatter in ${
|
|
14389
|
+
`Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14377
14390
|
);
|
|
14378
14391
|
}
|
|
14379
14392
|
}
|
|
@@ -14463,8 +14476,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14463
14476
|
const paths = this.getSettablePaths({ global });
|
|
14464
14477
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14465
14478
|
if (isRoot) {
|
|
14466
|
-
const relativePath2 =
|
|
14467
|
-
const filePath2 =
|
|
14479
|
+
const relativePath2 = join103(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14480
|
+
const filePath2 = join103(baseDir, relativePath2);
|
|
14468
14481
|
const fileContent2 = await readFileContent(filePath2);
|
|
14469
14482
|
return new _CopilotRule({
|
|
14470
14483
|
baseDir,
|
|
@@ -14479,8 +14492,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14479
14492
|
if (!paths.nonRoot) {
|
|
14480
14493
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14481
14494
|
}
|
|
14482
|
-
const relativePath =
|
|
14483
|
-
const filePath =
|
|
14495
|
+
const relativePath = join103(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14496
|
+
const filePath = join103(baseDir, relativePath);
|
|
14484
14497
|
const fileContent = await readFileContent(filePath);
|
|
14485
14498
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14486
14499
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14526,7 +14539,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14526
14539
|
return {
|
|
14527
14540
|
success: false,
|
|
14528
14541
|
error: new Error(
|
|
14529
|
-
`Invalid frontmatter in ${
|
|
14542
|
+
`Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14530
14543
|
)
|
|
14531
14544
|
};
|
|
14532
14545
|
}
|
|
@@ -14546,7 +14559,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14546
14559
|
};
|
|
14547
14560
|
|
|
14548
14561
|
// src/features/rules/cursor-rule.ts
|
|
14549
|
-
import { join as
|
|
14562
|
+
import { join as join104 } from "path";
|
|
14550
14563
|
import { z as z56 } from "zod/mini";
|
|
14551
14564
|
var CursorRuleFrontmatterSchema = z56.object({
|
|
14552
14565
|
description: z56.optional(z56.string()),
|
|
@@ -14568,7 +14581,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14568
14581
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14569
14582
|
if (!result.success) {
|
|
14570
14583
|
throw new Error(
|
|
14571
|
-
`Invalid frontmatter in ${
|
|
14584
|
+
`Invalid frontmatter in ${join104(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14572
14585
|
);
|
|
14573
14586
|
}
|
|
14574
14587
|
}
|
|
@@ -14684,7 +14697,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14684
14697
|
relativeFilePath,
|
|
14685
14698
|
validate = true
|
|
14686
14699
|
}) {
|
|
14687
|
-
const filePath =
|
|
14700
|
+
const filePath = join104(
|
|
14688
14701
|
baseDir,
|
|
14689
14702
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14690
14703
|
relativeFilePath
|
|
@@ -14694,7 +14707,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14694
14707
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14695
14708
|
if (!result.success) {
|
|
14696
14709
|
throw new Error(
|
|
14697
|
-
`Invalid frontmatter in ${
|
|
14710
|
+
`Invalid frontmatter in ${join104(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
14698
14711
|
);
|
|
14699
14712
|
}
|
|
14700
14713
|
return new _CursorRule({
|
|
@@ -14731,7 +14744,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14731
14744
|
return {
|
|
14732
14745
|
success: false,
|
|
14733
14746
|
error: new Error(
|
|
14734
|
-
`Invalid frontmatter in ${
|
|
14747
|
+
`Invalid frontmatter in ${join104(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14735
14748
|
)
|
|
14736
14749
|
};
|
|
14737
14750
|
}
|
|
@@ -14751,7 +14764,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14751
14764
|
};
|
|
14752
14765
|
|
|
14753
14766
|
// src/features/rules/factorydroid-rule.ts
|
|
14754
|
-
import { join as
|
|
14767
|
+
import { join as join105 } from "path";
|
|
14755
14768
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
14756
14769
|
constructor({ fileContent, root, ...rest }) {
|
|
14757
14770
|
super({
|
|
@@ -14791,8 +14804,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14791
14804
|
const paths = this.getSettablePaths({ global });
|
|
14792
14805
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14793
14806
|
if (isRoot) {
|
|
14794
|
-
const relativePath2 =
|
|
14795
|
-
const fileContent2 = await readFileContent(
|
|
14807
|
+
const relativePath2 = join105(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14808
|
+
const fileContent2 = await readFileContent(join105(baseDir, relativePath2));
|
|
14796
14809
|
return new _FactorydroidRule({
|
|
14797
14810
|
baseDir,
|
|
14798
14811
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14805,8 +14818,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14805
14818
|
if (!paths.nonRoot) {
|
|
14806
14819
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14807
14820
|
}
|
|
14808
|
-
const relativePath =
|
|
14809
|
-
const fileContent = await readFileContent(
|
|
14821
|
+
const relativePath = join105(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14822
|
+
const fileContent = await readFileContent(join105(baseDir, relativePath));
|
|
14810
14823
|
return new _FactorydroidRule({
|
|
14811
14824
|
baseDir,
|
|
14812
14825
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14865,7 +14878,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14865
14878
|
};
|
|
14866
14879
|
|
|
14867
14880
|
// src/features/rules/geminicli-rule.ts
|
|
14868
|
-
import { join as
|
|
14881
|
+
import { join as join106 } from "path";
|
|
14869
14882
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14870
14883
|
static getSettablePaths({
|
|
14871
14884
|
global,
|
|
@@ -14900,7 +14913,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14900
14913
|
if (isRoot) {
|
|
14901
14914
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14902
14915
|
const fileContent2 = await readFileContent(
|
|
14903
|
-
|
|
14916
|
+
join106(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14904
14917
|
);
|
|
14905
14918
|
return new _GeminiCliRule({
|
|
14906
14919
|
baseDir,
|
|
@@ -14914,8 +14927,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14914
14927
|
if (!paths.nonRoot) {
|
|
14915
14928
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14916
14929
|
}
|
|
14917
|
-
const relativePath =
|
|
14918
|
-
const fileContent = await readFileContent(
|
|
14930
|
+
const relativePath = join106(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14931
|
+
const fileContent = await readFileContent(join106(baseDir, relativePath));
|
|
14919
14932
|
return new _GeminiCliRule({
|
|
14920
14933
|
baseDir,
|
|
14921
14934
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14974,7 +14987,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14974
14987
|
};
|
|
14975
14988
|
|
|
14976
14989
|
// src/features/rules/goose-rule.ts
|
|
14977
|
-
import { join as
|
|
14990
|
+
import { join as join107 } from "path";
|
|
14978
14991
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14979
14992
|
static getSettablePaths({
|
|
14980
14993
|
global,
|
|
@@ -15009,7 +15022,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15009
15022
|
if (isRoot) {
|
|
15010
15023
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15011
15024
|
const fileContent2 = await readFileContent(
|
|
15012
|
-
|
|
15025
|
+
join107(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15013
15026
|
);
|
|
15014
15027
|
return new _GooseRule({
|
|
15015
15028
|
baseDir,
|
|
@@ -15023,8 +15036,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15023
15036
|
if (!paths.nonRoot) {
|
|
15024
15037
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15025
15038
|
}
|
|
15026
|
-
const relativePath =
|
|
15027
|
-
const fileContent = await readFileContent(
|
|
15039
|
+
const relativePath = join107(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15040
|
+
const fileContent = await readFileContent(join107(baseDir, relativePath));
|
|
15028
15041
|
return new _GooseRule({
|
|
15029
15042
|
baseDir,
|
|
15030
15043
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15083,7 +15096,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15083
15096
|
};
|
|
15084
15097
|
|
|
15085
15098
|
// src/features/rules/junie-rule.ts
|
|
15086
|
-
import { join as
|
|
15099
|
+
import { join as join108 } from "path";
|
|
15087
15100
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
15088
15101
|
static getSettablePaths(_options = {}) {
|
|
15089
15102
|
return {
|
|
@@ -15102,8 +15115,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15102
15115
|
validate = true
|
|
15103
15116
|
}) {
|
|
15104
15117
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
15105
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
15106
|
-
const fileContent = await readFileContent(
|
|
15118
|
+
const relativePath = isRoot ? "guidelines.md" : join108(".junie", "memories", relativeFilePath);
|
|
15119
|
+
const fileContent = await readFileContent(join108(baseDir, relativePath));
|
|
15107
15120
|
return new _JunieRule({
|
|
15108
15121
|
baseDir,
|
|
15109
15122
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15158,7 +15171,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15158
15171
|
};
|
|
15159
15172
|
|
|
15160
15173
|
// src/features/rules/kilo-rule.ts
|
|
15161
|
-
import { join as
|
|
15174
|
+
import { join as join109 } from "path";
|
|
15162
15175
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
15163
15176
|
static getSettablePaths(_options = {}) {
|
|
15164
15177
|
return {
|
|
@@ -15173,7 +15186,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15173
15186
|
validate = true
|
|
15174
15187
|
}) {
|
|
15175
15188
|
const fileContent = await readFileContent(
|
|
15176
|
-
|
|
15189
|
+
join109(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15177
15190
|
);
|
|
15178
15191
|
return new _KiloRule({
|
|
15179
15192
|
baseDir,
|
|
@@ -15225,7 +15238,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15225
15238
|
};
|
|
15226
15239
|
|
|
15227
15240
|
// src/features/rules/kiro-rule.ts
|
|
15228
|
-
import { join as
|
|
15241
|
+
import { join as join110 } from "path";
|
|
15229
15242
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
15230
15243
|
static getSettablePaths(_options = {}) {
|
|
15231
15244
|
return {
|
|
@@ -15240,7 +15253,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15240
15253
|
validate = true
|
|
15241
15254
|
}) {
|
|
15242
15255
|
const fileContent = await readFileContent(
|
|
15243
|
-
|
|
15256
|
+
join110(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15244
15257
|
);
|
|
15245
15258
|
return new _KiroRule({
|
|
15246
15259
|
baseDir,
|
|
@@ -15294,7 +15307,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15294
15307
|
};
|
|
15295
15308
|
|
|
15296
15309
|
// src/features/rules/opencode-rule.ts
|
|
15297
|
-
import { join as
|
|
15310
|
+
import { join as join111 } from "path";
|
|
15298
15311
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
15299
15312
|
static getSettablePaths({
|
|
15300
15313
|
global,
|
|
@@ -15329,7 +15342,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15329
15342
|
if (isRoot) {
|
|
15330
15343
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15331
15344
|
const fileContent2 = await readFileContent(
|
|
15332
|
-
|
|
15345
|
+
join111(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15333
15346
|
);
|
|
15334
15347
|
return new _OpenCodeRule({
|
|
15335
15348
|
baseDir,
|
|
@@ -15343,8 +15356,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15343
15356
|
if (!paths.nonRoot) {
|
|
15344
15357
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15345
15358
|
}
|
|
15346
|
-
const relativePath =
|
|
15347
|
-
const fileContent = await readFileContent(
|
|
15359
|
+
const relativePath = join111(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15360
|
+
const fileContent = await readFileContent(join111(baseDir, relativePath));
|
|
15348
15361
|
return new _OpenCodeRule({
|
|
15349
15362
|
baseDir,
|
|
15350
15363
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15403,7 +15416,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15403
15416
|
};
|
|
15404
15417
|
|
|
15405
15418
|
// src/features/rules/qwencode-rule.ts
|
|
15406
|
-
import { join as
|
|
15419
|
+
import { join as join112 } from "path";
|
|
15407
15420
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
15408
15421
|
static getSettablePaths(_options = {}) {
|
|
15409
15422
|
return {
|
|
@@ -15422,8 +15435,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15422
15435
|
validate = true
|
|
15423
15436
|
}) {
|
|
15424
15437
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
15425
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
15426
|
-
const fileContent = await readFileContent(
|
|
15438
|
+
const relativePath = isRoot ? "QWEN.md" : join112(".qwen", "memories", relativeFilePath);
|
|
15439
|
+
const fileContent = await readFileContent(join112(baseDir, relativePath));
|
|
15427
15440
|
return new _QwencodeRule({
|
|
15428
15441
|
baseDir,
|
|
15429
15442
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15475,7 +15488,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15475
15488
|
};
|
|
15476
15489
|
|
|
15477
15490
|
// src/features/rules/replit-rule.ts
|
|
15478
|
-
import { join as
|
|
15491
|
+
import { join as join113 } from "path";
|
|
15479
15492
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
15480
15493
|
static getSettablePaths(_options = {}) {
|
|
15481
15494
|
return {
|
|
@@ -15497,7 +15510,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15497
15510
|
}
|
|
15498
15511
|
const relativePath = paths.root.relativeFilePath;
|
|
15499
15512
|
const fileContent = await readFileContent(
|
|
15500
|
-
|
|
15513
|
+
join113(baseDir, paths.root.relativeDirPath, relativePath)
|
|
15501
15514
|
);
|
|
15502
15515
|
return new _ReplitRule({
|
|
15503
15516
|
baseDir,
|
|
@@ -15563,7 +15576,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15563
15576
|
};
|
|
15564
15577
|
|
|
15565
15578
|
// src/features/rules/roo-rule.ts
|
|
15566
|
-
import { join as
|
|
15579
|
+
import { join as join114 } from "path";
|
|
15567
15580
|
var RooRule = class _RooRule extends ToolRule {
|
|
15568
15581
|
static getSettablePaths(_options = {}) {
|
|
15569
15582
|
return {
|
|
@@ -15578,7 +15591,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15578
15591
|
validate = true
|
|
15579
15592
|
}) {
|
|
15580
15593
|
const fileContent = await readFileContent(
|
|
15581
|
-
|
|
15594
|
+
join114(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15582
15595
|
);
|
|
15583
15596
|
return new _RooRule({
|
|
15584
15597
|
baseDir,
|
|
@@ -15647,7 +15660,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15647
15660
|
};
|
|
15648
15661
|
|
|
15649
15662
|
// src/features/rules/warp-rule.ts
|
|
15650
|
-
import { join as
|
|
15663
|
+
import { join as join115 } from "path";
|
|
15651
15664
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
15652
15665
|
constructor({ fileContent, root, ...rest }) {
|
|
15653
15666
|
super({
|
|
@@ -15673,8 +15686,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15673
15686
|
validate = true
|
|
15674
15687
|
}) {
|
|
15675
15688
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
15676
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
15677
|
-
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));
|
|
15678
15691
|
return new _WarpRule({
|
|
15679
15692
|
baseDir,
|
|
15680
15693
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -15729,7 +15742,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15729
15742
|
};
|
|
15730
15743
|
|
|
15731
15744
|
// src/features/rules/windsurf-rule.ts
|
|
15732
|
-
import { join as
|
|
15745
|
+
import { join as join116 } from "path";
|
|
15733
15746
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
15734
15747
|
static getSettablePaths(_options = {}) {
|
|
15735
15748
|
return {
|
|
@@ -15744,7 +15757,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
15744
15757
|
validate = true
|
|
15745
15758
|
}) {
|
|
15746
15759
|
const fileContent = await readFileContent(
|
|
15747
|
-
|
|
15760
|
+
join116(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15748
15761
|
);
|
|
15749
15762
|
return new _WindsurfRule({
|
|
15750
15763
|
baseDir,
|
|
@@ -15821,7 +15834,7 @@ var rulesProcessorToolTargets = [
|
|
|
15821
15834
|
"windsurf"
|
|
15822
15835
|
];
|
|
15823
15836
|
var RulesProcessorToolTargetSchema = z57.enum(rulesProcessorToolTargets);
|
|
15824
|
-
var formatRulePaths = (rules) => rules.map((r) =>
|
|
15837
|
+
var formatRulePaths = (rules) => rules.map((r) => join117(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15825
15838
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15826
15839
|
[
|
|
15827
15840
|
"agentsmd",
|
|
@@ -16108,9 +16121,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16108
16121
|
global = false,
|
|
16109
16122
|
getFactory = defaultGetFactory6,
|
|
16110
16123
|
skills,
|
|
16111
|
-
dryRun = false
|
|
16124
|
+
dryRun = false,
|
|
16125
|
+
logger
|
|
16112
16126
|
}) {
|
|
16113
|
-
super({ baseDir, dryRun });
|
|
16127
|
+
super({ baseDir, dryRun, logger });
|
|
16114
16128
|
const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
|
|
16115
16129
|
if (!result.success) {
|
|
16116
16130
|
throw new Error(
|
|
@@ -16196,7 +16210,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16196
16210
|
}).relativeDirPath;
|
|
16197
16211
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
16198
16212
|
const frontmatter = skill.getFrontmatter();
|
|
16199
|
-
const relativePath =
|
|
16213
|
+
const relativePath = join117(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
16200
16214
|
return {
|
|
16201
16215
|
name: frontmatter.name,
|
|
16202
16216
|
description: frontmatter.description,
|
|
@@ -16309,9 +16323,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16309
16323
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
16310
16324
|
*/
|
|
16311
16325
|
async loadRulesyncFiles() {
|
|
16312
|
-
const rulesyncBaseDir =
|
|
16313
|
-
const files = await findFilesByGlobs(
|
|
16314
|
-
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`);
|
|
16315
16329
|
const rulesyncRules = await Promise.all(
|
|
16316
16330
|
files.map((file) => {
|
|
16317
16331
|
const relativeFilePath = relative5(rulesyncBaseDir, file);
|
|
@@ -16335,7 +16349,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16335
16349
|
);
|
|
16336
16350
|
}
|
|
16337
16351
|
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
16338
|
-
logger.warn(
|
|
16352
|
+
this.logger.warn(
|
|
16339
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}.`
|
|
16340
16354
|
);
|
|
16341
16355
|
}
|
|
@@ -16360,12 +16374,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16360
16374
|
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
16361
16375
|
);
|
|
16362
16376
|
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
16363
|
-
logger.warn(
|
|
16377
|
+
this.logger.warn(
|
|
16364
16378
|
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
16365
16379
|
);
|
|
16366
16380
|
}
|
|
16367
16381
|
if (targetedLocalRootRules.length > 0) {
|
|
16368
|
-
logger.warn(
|
|
16382
|
+
this.logger.warn(
|
|
16369
16383
|
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
16370
16384
|
);
|
|
16371
16385
|
}
|
|
@@ -16407,13 +16421,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16407
16421
|
return [];
|
|
16408
16422
|
}
|
|
16409
16423
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
16410
|
-
|
|
16424
|
+
join117(
|
|
16411
16425
|
this.baseDir,
|
|
16412
16426
|
settablePaths.root.relativeDirPath ?? ".",
|
|
16413
16427
|
settablePaths.root.relativeFilePath
|
|
16414
16428
|
),
|
|
16415
16429
|
settablePaths.alternativeRoots,
|
|
16416
|
-
(alt) =>
|
|
16430
|
+
(alt) => join117(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
16417
16431
|
);
|
|
16418
16432
|
if (forDeletion) {
|
|
16419
16433
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -16446,7 +16460,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16446
16460
|
})
|
|
16447
16461
|
);
|
|
16448
16462
|
})();
|
|
16449
|
-
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16463
|
+
this.logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16450
16464
|
const localRootToolRules = await (async () => {
|
|
16451
16465
|
if (!forDeletion) {
|
|
16452
16466
|
return [];
|
|
@@ -16458,9 +16472,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16458
16472
|
return [];
|
|
16459
16473
|
}
|
|
16460
16474
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
16461
|
-
|
|
16475
|
+
join117(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
16462
16476
|
settablePaths.alternativeRoots,
|
|
16463
|
-
(alt) =>
|
|
16477
|
+
(alt) => join117(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
16464
16478
|
);
|
|
16465
16479
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
16466
16480
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -16476,14 +16490,16 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16476
16490
|
});
|
|
16477
16491
|
}).filter((rule) => rule.isDeletable());
|
|
16478
16492
|
})();
|
|
16479
|
-
logger.debug(
|
|
16493
|
+
this.logger.debug(
|
|
16494
|
+
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
16495
|
+
);
|
|
16480
16496
|
const nonRootToolRules = await (async () => {
|
|
16481
16497
|
if (!settablePaths.nonRoot) {
|
|
16482
16498
|
return [];
|
|
16483
16499
|
}
|
|
16484
|
-
const nonRootBaseDir =
|
|
16500
|
+
const nonRootBaseDir = join117(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
16485
16501
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
16486
|
-
|
|
16502
|
+
join117(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
16487
16503
|
);
|
|
16488
16504
|
if (forDeletion) {
|
|
16489
16505
|
return nonRootFilePaths.map((filePath) => {
|
|
@@ -16515,10 +16531,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16515
16531
|
})
|
|
16516
16532
|
);
|
|
16517
16533
|
})();
|
|
16518
|
-
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16534
|
+
this.logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16519
16535
|
return [...rootToolRules, ...localRootToolRules, ...nonRootToolRules];
|
|
16520
16536
|
} catch (error) {
|
|
16521
|
-
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)}`);
|
|
16522
16538
|
return [];
|
|
16523
16539
|
}
|
|
16524
16540
|
}
|
|
@@ -16615,14 +16631,14 @@ s/<command> [arguments]
|
|
|
16615
16631
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
16616
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.
|
|
16617
16633
|
|
|
16618
|
-
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.` : "";
|
|
16619
16635
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
16620
16636
|
|
|
16621
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.
|
|
16622
16638
|
|
|
16623
|
-
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.
|
|
16624
16640
|
|
|
16625
|
-
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.` : "";
|
|
16626
16642
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
16627
16643
|
const result = [
|
|
16628
16644
|
overview,
|
|
@@ -16694,7 +16710,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16694
16710
|
return { count: totalCount, paths: [], hasDiff };
|
|
16695
16711
|
}
|
|
16696
16712
|
function warnUnsupportedTargets(params) {
|
|
16697
|
-
const { config, supportedTargets, featureName } = params;
|
|
16713
|
+
const { config, supportedTargets, featureName, logger } = params;
|
|
16698
16714
|
for (const target of config.getTargets()) {
|
|
16699
16715
|
if (!supportedTargets.includes(target) && config.getFeatures(target).includes(featureName)) {
|
|
16700
16716
|
logger.warn(`Target '${target}' does not support the feature '${featureName}'. Skipping.`);
|
|
@@ -16702,17 +16718,17 @@ function warnUnsupportedTargets(params) {
|
|
|
16702
16718
|
}
|
|
16703
16719
|
}
|
|
16704
16720
|
async function checkRulesyncDirExists(params) {
|
|
16705
|
-
return fileExists(
|
|
16721
|
+
return fileExists(join118(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16706
16722
|
}
|
|
16707
16723
|
async function generate(params) {
|
|
16708
|
-
const { config } = params;
|
|
16709
|
-
const ignoreResult = await generateIgnoreCore({ config });
|
|
16710
|
-
const mcpResult = await generateMcpCore({ config });
|
|
16711
|
-
const commandsResult = await generateCommandsCore({ config });
|
|
16712
|
-
const subagentsResult = await generateSubagentsCore({ config });
|
|
16713
|
-
const skillsResult = await generateSkillsCore({ config });
|
|
16714
|
-
const hooksResult = await generateHooksCore({ config });
|
|
16715
|
-
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 });
|
|
16716
16732
|
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
16717
16733
|
return {
|
|
16718
16734
|
rulesCount: rulesResult.count,
|
|
@@ -16734,13 +16750,13 @@ async function generate(params) {
|
|
|
16734
16750
|
};
|
|
16735
16751
|
}
|
|
16736
16752
|
async function generateRulesCore(params) {
|
|
16737
|
-
const { config, skills } = params;
|
|
16753
|
+
const { config, logger, skills } = params;
|
|
16738
16754
|
let totalCount = 0;
|
|
16739
16755
|
const allPaths = [];
|
|
16740
16756
|
let hasDiff = false;
|
|
16741
16757
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16742
16758
|
const toolTargets = intersection(config.getTargets(), supportedTargets);
|
|
16743
|
-
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules" });
|
|
16759
|
+
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger });
|
|
16744
16760
|
for (const baseDir of config.getBaseDirs()) {
|
|
16745
16761
|
for (const toolTarget of toolTargets) {
|
|
16746
16762
|
if (!config.getFeatures(toolTarget).includes("rules")) {
|
|
@@ -16754,7 +16770,8 @@ async function generateRulesCore(params) {
|
|
|
16754
16770
|
simulateSubagents: config.getSimulateSubagents(),
|
|
16755
16771
|
simulateSkills: config.getSimulateSkills(),
|
|
16756
16772
|
skills,
|
|
16757
|
-
dryRun: config.isPreviewMode()
|
|
16773
|
+
dryRun: config.isPreviewMode(),
|
|
16774
|
+
logger
|
|
16758
16775
|
});
|
|
16759
16776
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16760
16777
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16771,12 +16788,13 @@ async function generateRulesCore(params) {
|
|
|
16771
16788
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16772
16789
|
}
|
|
16773
16790
|
async function generateIgnoreCore(params) {
|
|
16774
|
-
const { config } = params;
|
|
16791
|
+
const { config, logger } = params;
|
|
16775
16792
|
const supportedIgnoreTargets = IgnoreProcessor.getToolTargets();
|
|
16776
16793
|
warnUnsupportedTargets({
|
|
16777
16794
|
config,
|
|
16778
16795
|
supportedTargets: supportedIgnoreTargets,
|
|
16779
|
-
featureName: "ignore"
|
|
16796
|
+
featureName: "ignore",
|
|
16797
|
+
logger
|
|
16780
16798
|
});
|
|
16781
16799
|
if (config.getGlobal()) {
|
|
16782
16800
|
return { count: 0, paths: [], hasDiff: false };
|
|
@@ -16793,7 +16811,8 @@ async function generateIgnoreCore(params) {
|
|
|
16793
16811
|
const processor = new IgnoreProcessor({
|
|
16794
16812
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
16795
16813
|
toolTarget,
|
|
16796
|
-
dryRun: config.isPreviewMode()
|
|
16814
|
+
dryRun: config.isPreviewMode(),
|
|
16815
|
+
logger
|
|
16797
16816
|
});
|
|
16798
16817
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16799
16818
|
let result;
|
|
@@ -16824,13 +16843,18 @@ async function generateIgnoreCore(params) {
|
|
|
16824
16843
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16825
16844
|
}
|
|
16826
16845
|
async function generateMcpCore(params) {
|
|
16827
|
-
const { config } = params;
|
|
16846
|
+
const { config, logger } = params;
|
|
16828
16847
|
let totalCount = 0;
|
|
16829
16848
|
const allPaths = [];
|
|
16830
16849
|
let hasDiff = false;
|
|
16831
16850
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16832
16851
|
const toolTargets = intersection(config.getTargets(), supportedMcpTargets);
|
|
16833
|
-
warnUnsupportedTargets({
|
|
16852
|
+
warnUnsupportedTargets({
|
|
16853
|
+
config,
|
|
16854
|
+
supportedTargets: supportedMcpTargets,
|
|
16855
|
+
featureName: "mcp",
|
|
16856
|
+
logger
|
|
16857
|
+
});
|
|
16834
16858
|
for (const baseDir of config.getBaseDirs()) {
|
|
16835
16859
|
for (const toolTarget of toolTargets) {
|
|
16836
16860
|
if (!config.getFeatures(toolTarget).includes("mcp")) {
|
|
@@ -16840,7 +16864,8 @@ async function generateMcpCore(params) {
|
|
|
16840
16864
|
baseDir,
|
|
16841
16865
|
toolTarget,
|
|
16842
16866
|
global: config.getGlobal(),
|
|
16843
|
-
dryRun: config.isPreviewMode()
|
|
16867
|
+
dryRun: config.isPreviewMode(),
|
|
16868
|
+
logger
|
|
16844
16869
|
});
|
|
16845
16870
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16846
16871
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16857,7 +16882,7 @@ async function generateMcpCore(params) {
|
|
|
16857
16882
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16858
16883
|
}
|
|
16859
16884
|
async function generateCommandsCore(params) {
|
|
16860
|
-
const { config } = params;
|
|
16885
|
+
const { config, logger } = params;
|
|
16861
16886
|
let totalCount = 0;
|
|
16862
16887
|
const allPaths = [];
|
|
16863
16888
|
let hasDiff = false;
|
|
@@ -16869,7 +16894,8 @@ async function generateCommandsCore(params) {
|
|
|
16869
16894
|
warnUnsupportedTargets({
|
|
16870
16895
|
config,
|
|
16871
16896
|
supportedTargets: supportedCommandsTargets,
|
|
16872
|
-
featureName: "commands"
|
|
16897
|
+
featureName: "commands",
|
|
16898
|
+
logger
|
|
16873
16899
|
});
|
|
16874
16900
|
for (const baseDir of config.getBaseDirs()) {
|
|
16875
16901
|
for (const toolTarget of toolTargets) {
|
|
@@ -16880,7 +16906,8 @@ async function generateCommandsCore(params) {
|
|
|
16880
16906
|
baseDir,
|
|
16881
16907
|
toolTarget,
|
|
16882
16908
|
global: config.getGlobal(),
|
|
16883
|
-
dryRun: config.isPreviewMode()
|
|
16909
|
+
dryRun: config.isPreviewMode(),
|
|
16910
|
+
logger
|
|
16884
16911
|
});
|
|
16885
16912
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16886
16913
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16897,7 +16924,7 @@ async function generateCommandsCore(params) {
|
|
|
16897
16924
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16898
16925
|
}
|
|
16899
16926
|
async function generateSubagentsCore(params) {
|
|
16900
|
-
const { config } = params;
|
|
16927
|
+
const { config, logger } = params;
|
|
16901
16928
|
let totalCount = 0;
|
|
16902
16929
|
const allPaths = [];
|
|
16903
16930
|
let hasDiff = false;
|
|
@@ -16909,7 +16936,8 @@ async function generateSubagentsCore(params) {
|
|
|
16909
16936
|
warnUnsupportedTargets({
|
|
16910
16937
|
config,
|
|
16911
16938
|
supportedTargets: supportedSubagentsTargets,
|
|
16912
|
-
featureName: "subagents"
|
|
16939
|
+
featureName: "subagents",
|
|
16940
|
+
logger
|
|
16913
16941
|
});
|
|
16914
16942
|
for (const baseDir of config.getBaseDirs()) {
|
|
16915
16943
|
for (const toolTarget of toolTargets) {
|
|
@@ -16920,7 +16948,8 @@ async function generateSubagentsCore(params) {
|
|
|
16920
16948
|
baseDir,
|
|
16921
16949
|
toolTarget,
|
|
16922
16950
|
global: config.getGlobal(),
|
|
16923
|
-
dryRun: config.isPreviewMode()
|
|
16951
|
+
dryRun: config.isPreviewMode(),
|
|
16952
|
+
logger
|
|
16924
16953
|
});
|
|
16925
16954
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16926
16955
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16937,7 +16966,7 @@ async function generateSubagentsCore(params) {
|
|
|
16937
16966
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16938
16967
|
}
|
|
16939
16968
|
async function generateSkillsCore(params) {
|
|
16940
|
-
const { config } = params;
|
|
16969
|
+
const { config, logger } = params;
|
|
16941
16970
|
let totalCount = 0;
|
|
16942
16971
|
const allPaths = [];
|
|
16943
16972
|
let hasDiff = false;
|
|
@@ -16950,7 +16979,8 @@ async function generateSkillsCore(params) {
|
|
|
16950
16979
|
warnUnsupportedTargets({
|
|
16951
16980
|
config,
|
|
16952
16981
|
supportedTargets: supportedSkillsTargets,
|
|
16953
|
-
featureName: "skills"
|
|
16982
|
+
featureName: "skills",
|
|
16983
|
+
logger
|
|
16954
16984
|
});
|
|
16955
16985
|
for (const baseDir of config.getBaseDirs()) {
|
|
16956
16986
|
for (const toolTarget of toolTargets) {
|
|
@@ -16961,7 +16991,8 @@ async function generateSkillsCore(params) {
|
|
|
16961
16991
|
baseDir,
|
|
16962
16992
|
toolTarget,
|
|
16963
16993
|
global: config.getGlobal(),
|
|
16964
|
-
dryRun: config.isPreviewMode()
|
|
16994
|
+
dryRun: config.isPreviewMode(),
|
|
16995
|
+
logger
|
|
16965
16996
|
});
|
|
16966
16997
|
const rulesyncDirs = await processor.loadRulesyncDirs();
|
|
16967
16998
|
for (const rulesyncDir of rulesyncDirs) {
|
|
@@ -16983,13 +17014,18 @@ async function generateSkillsCore(params) {
|
|
|
16983
17014
|
return { count: totalCount, paths: allPaths, skills: allSkills, hasDiff };
|
|
16984
17015
|
}
|
|
16985
17016
|
async function generateHooksCore(params) {
|
|
16986
|
-
const { config } = params;
|
|
17017
|
+
const { config, logger } = params;
|
|
16987
17018
|
let totalCount = 0;
|
|
16988
17019
|
const allPaths = [];
|
|
16989
17020
|
let hasDiff = false;
|
|
16990
17021
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16991
17022
|
const toolTargets = intersection(config.getTargets(), supportedHooksTargets);
|
|
16992
|
-
warnUnsupportedTargets({
|
|
17023
|
+
warnUnsupportedTargets({
|
|
17024
|
+
config,
|
|
17025
|
+
supportedTargets: supportedHooksTargets,
|
|
17026
|
+
featureName: "hooks",
|
|
17027
|
+
logger
|
|
17028
|
+
});
|
|
16993
17029
|
for (const baseDir of config.getBaseDirs()) {
|
|
16994
17030
|
for (const toolTarget of toolTargets) {
|
|
16995
17031
|
if (!config.getFeatures(toolTarget).includes("hooks")) {
|
|
@@ -16999,7 +17035,8 @@ async function generateHooksCore(params) {
|
|
|
16999
17035
|
baseDir,
|
|
17000
17036
|
toolTarget,
|
|
17001
17037
|
global: config.getGlobal(),
|
|
17002
|
-
dryRun: config.isPreviewMode()
|
|
17038
|
+
dryRun: config.isPreviewMode(),
|
|
17039
|
+
logger
|
|
17003
17040
|
});
|
|
17004
17041
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
17005
17042
|
let result;
|
|
@@ -17026,14 +17063,14 @@ async function generateHooksCore(params) {
|
|
|
17026
17063
|
|
|
17027
17064
|
// src/lib/import.ts
|
|
17028
17065
|
async function importFromTool(params) {
|
|
17029
|
-
const { config, tool } = params;
|
|
17030
|
-
const rulesCount = await importRulesCore({ config, tool });
|
|
17031
|
-
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
17032
|
-
const mcpCount = await importMcpCore({ config, tool });
|
|
17033
|
-
const commandsCount = await importCommandsCore({ config, tool });
|
|
17034
|
-
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
17035
|
-
const skillsCount = await importSkillsCore({ config, tool });
|
|
17036
|
-
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 });
|
|
17037
17074
|
return {
|
|
17038
17075
|
rulesCount,
|
|
17039
17076
|
ignoreCount,
|
|
@@ -17045,7 +17082,7 @@ async function importFromTool(params) {
|
|
|
17045
17082
|
};
|
|
17046
17083
|
}
|
|
17047
17084
|
async function importRulesCore(params) {
|
|
17048
|
-
const { config, tool } = params;
|
|
17085
|
+
const { config, tool, logger } = params;
|
|
17049
17086
|
if (!config.getFeatures(tool).includes("rules")) {
|
|
17050
17087
|
return 0;
|
|
17051
17088
|
}
|
|
@@ -17057,7 +17094,8 @@ async function importRulesCore(params) {
|
|
|
17057
17094
|
const rulesProcessor = new RulesProcessor({
|
|
17058
17095
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17059
17096
|
toolTarget: tool,
|
|
17060
|
-
global
|
|
17097
|
+
global,
|
|
17098
|
+
logger
|
|
17061
17099
|
});
|
|
17062
17100
|
const toolFiles = await rulesProcessor.loadToolFiles();
|
|
17063
17101
|
if (toolFiles.length === 0) {
|
|
@@ -17072,7 +17110,7 @@ async function importRulesCore(params) {
|
|
|
17072
17110
|
return writtenCount;
|
|
17073
17111
|
}
|
|
17074
17112
|
async function importIgnoreCore(params) {
|
|
17075
|
-
const { config, tool } = params;
|
|
17113
|
+
const { config, tool, logger } = params;
|
|
17076
17114
|
if (!config.getFeatures(tool).includes("ignore")) {
|
|
17077
17115
|
return 0;
|
|
17078
17116
|
}
|
|
@@ -17085,7 +17123,8 @@ async function importIgnoreCore(params) {
|
|
|
17085
17123
|
}
|
|
17086
17124
|
const ignoreProcessor = new IgnoreProcessor({
|
|
17087
17125
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17088
|
-
toolTarget: tool
|
|
17126
|
+
toolTarget: tool,
|
|
17127
|
+
logger
|
|
17089
17128
|
});
|
|
17090
17129
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
17091
17130
|
if (toolFiles.length === 0) {
|
|
@@ -17103,7 +17142,7 @@ async function importIgnoreCore(params) {
|
|
|
17103
17142
|
return writtenCount;
|
|
17104
17143
|
}
|
|
17105
17144
|
async function importMcpCore(params) {
|
|
17106
|
-
const { config, tool } = params;
|
|
17145
|
+
const { config, tool, logger } = params;
|
|
17107
17146
|
if (!config.getFeatures(tool).includes("mcp")) {
|
|
17108
17147
|
return 0;
|
|
17109
17148
|
}
|
|
@@ -17115,7 +17154,8 @@ async function importMcpCore(params) {
|
|
|
17115
17154
|
const mcpProcessor = new McpProcessor({
|
|
17116
17155
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17117
17156
|
toolTarget: tool,
|
|
17118
|
-
global
|
|
17157
|
+
global,
|
|
17158
|
+
logger
|
|
17119
17159
|
});
|
|
17120
17160
|
const toolFiles = await mcpProcessor.loadToolFiles();
|
|
17121
17161
|
if (toolFiles.length === 0) {
|
|
@@ -17130,7 +17170,7 @@ async function importMcpCore(params) {
|
|
|
17130
17170
|
return writtenCount;
|
|
17131
17171
|
}
|
|
17132
17172
|
async function importCommandsCore(params) {
|
|
17133
|
-
const { config, tool } = params;
|
|
17173
|
+
const { config, tool, logger } = params;
|
|
17134
17174
|
if (!config.getFeatures(tool).includes("commands")) {
|
|
17135
17175
|
return 0;
|
|
17136
17176
|
}
|
|
@@ -17142,7 +17182,8 @@ async function importCommandsCore(params) {
|
|
|
17142
17182
|
const commandsProcessor = new CommandsProcessor({
|
|
17143
17183
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17144
17184
|
toolTarget: tool,
|
|
17145
|
-
global
|
|
17185
|
+
global,
|
|
17186
|
+
logger
|
|
17146
17187
|
});
|
|
17147
17188
|
const toolFiles = await commandsProcessor.loadToolFiles();
|
|
17148
17189
|
if (toolFiles.length === 0) {
|
|
@@ -17157,7 +17198,7 @@ async function importCommandsCore(params) {
|
|
|
17157
17198
|
return writtenCount;
|
|
17158
17199
|
}
|
|
17159
17200
|
async function importSubagentsCore(params) {
|
|
17160
|
-
const { config, tool } = params;
|
|
17201
|
+
const { config, tool, logger } = params;
|
|
17161
17202
|
if (!config.getFeatures(tool).includes("subagents")) {
|
|
17162
17203
|
return 0;
|
|
17163
17204
|
}
|
|
@@ -17169,7 +17210,8 @@ async function importSubagentsCore(params) {
|
|
|
17169
17210
|
const subagentsProcessor = new SubagentsProcessor({
|
|
17170
17211
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17171
17212
|
toolTarget: tool,
|
|
17172
|
-
global: config.getGlobal()
|
|
17213
|
+
global: config.getGlobal(),
|
|
17214
|
+
logger
|
|
17173
17215
|
});
|
|
17174
17216
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
17175
17217
|
if (toolFiles.length === 0) {
|
|
@@ -17184,7 +17226,7 @@ async function importSubagentsCore(params) {
|
|
|
17184
17226
|
return writtenCount;
|
|
17185
17227
|
}
|
|
17186
17228
|
async function importSkillsCore(params) {
|
|
17187
|
-
const { config, tool } = params;
|
|
17229
|
+
const { config, tool, logger } = params;
|
|
17188
17230
|
if (!config.getFeatures(tool).includes("skills")) {
|
|
17189
17231
|
return 0;
|
|
17190
17232
|
}
|
|
@@ -17196,7 +17238,8 @@ async function importSkillsCore(params) {
|
|
|
17196
17238
|
const skillsProcessor = new SkillsProcessor({
|
|
17197
17239
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17198
17240
|
toolTarget: tool,
|
|
17199
|
-
global
|
|
17241
|
+
global,
|
|
17242
|
+
logger
|
|
17200
17243
|
});
|
|
17201
17244
|
const toolDirs = await skillsProcessor.loadToolDirs();
|
|
17202
17245
|
if (toolDirs.length === 0) {
|
|
@@ -17211,7 +17254,7 @@ async function importSkillsCore(params) {
|
|
|
17211
17254
|
return writtenCount;
|
|
17212
17255
|
}
|
|
17213
17256
|
async function importHooksCore(params) {
|
|
17214
|
-
const { config, tool } = params;
|
|
17257
|
+
const { config, tool, logger } = params;
|
|
17215
17258
|
if (!config.getFeatures(tool).includes("hooks")) {
|
|
17216
17259
|
return 0;
|
|
17217
17260
|
}
|
|
@@ -17228,7 +17271,8 @@ async function importHooksCore(params) {
|
|
|
17228
17271
|
const hooksProcessor = new HooksProcessor({
|
|
17229
17272
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17230
17273
|
toolTarget: tool,
|
|
17231
|
-
global
|
|
17274
|
+
global,
|
|
17275
|
+
logger
|
|
17232
17276
|
});
|
|
17233
17277
|
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
17234
17278
|
if (toolFiles.length === 0) {
|
|
@@ -17243,6 +17287,176 @@ async function importHooksCore(params) {
|
|
|
17243
17287
|
return writtenCount;
|
|
17244
17288
|
}
|
|
17245
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
|
+
|
|
17246
17460
|
export {
|
|
17247
17461
|
RULESYNC_CONFIG_RELATIVE_FILE_PATH,
|
|
17248
17462
|
RULESYNC_RELATIVE_DIR_PATH,
|
|
@@ -17265,11 +17479,6 @@ export {
|
|
|
17265
17479
|
MAX_FILE_SIZE,
|
|
17266
17480
|
FETCH_CONCURRENCY_LIMIT,
|
|
17267
17481
|
formatError,
|
|
17268
|
-
ErrorCodes,
|
|
17269
|
-
CLIError,
|
|
17270
|
-
ConsoleLogger,
|
|
17271
|
-
JsonLogger,
|
|
17272
|
-
logger,
|
|
17273
17482
|
ensureDir,
|
|
17274
17483
|
checkPathTraversal,
|
|
17275
17484
|
directoryExists,
|
|
@@ -17313,5 +17522,9 @@ export {
|
|
|
17313
17522
|
RulesProcessor,
|
|
17314
17523
|
checkRulesyncDirExists,
|
|
17315
17524
|
generate,
|
|
17316
|
-
importFromTool
|
|
17525
|
+
importFromTool,
|
|
17526
|
+
ErrorCodes,
|
|
17527
|
+
CLIError,
|
|
17528
|
+
ConsoleLogger,
|
|
17529
|
+
JsonLogger
|
|
17317
17530
|
};
|