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
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,13 @@ var RULESYNC_MCP_FILE_NAME = "mcp.json";
|
|
|
64
64
|
var RULESYNC_MCP_SCHEMA_URL = "https://github.com/dyoshikawa/rulesync/releases/latest/download/mcp-schema.json";
|
|
65
65
|
var MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
66
66
|
|
|
67
|
+
// src/utils/file.ts
|
|
68
|
+
var import_promises = require("fs/promises");
|
|
69
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
70
|
+
var import_node_path2 = require("path");
|
|
71
|
+
var import_es_toolkit = require("es-toolkit");
|
|
72
|
+
var import_globby = require("globby");
|
|
73
|
+
|
|
67
74
|
// src/utils/error.ts
|
|
68
75
|
var import_zod = require("zod");
|
|
69
76
|
function isZodErrorLike(error) {
|
|
@@ -81,79 +88,11 @@ function formatError(error) {
|
|
|
81
88
|
return String(error);
|
|
82
89
|
}
|
|
83
90
|
|
|
84
|
-
// src/utils/file.ts
|
|
85
|
-
var import_promises = require("fs/promises");
|
|
86
|
-
var import_node_os = __toESM(require("os"), 1);
|
|
87
|
-
var import_node_path2 = require("path");
|
|
88
|
-
var import_es_toolkit = require("es-toolkit");
|
|
89
|
-
var import_globby = require("globby");
|
|
90
|
-
|
|
91
91
|
// src/utils/vitest.ts
|
|
92
92
|
function isEnvTest() {
|
|
93
93
|
return process.env.NODE_ENV === "test";
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// src/utils/logger.ts
|
|
97
|
-
var BaseLogger = class {
|
|
98
|
-
_verbose = false;
|
|
99
|
-
_silent = false;
|
|
100
|
-
get verbose() {
|
|
101
|
-
return this._verbose;
|
|
102
|
-
}
|
|
103
|
-
get silent() {
|
|
104
|
-
return this._silent;
|
|
105
|
-
}
|
|
106
|
-
configure({ verbose, silent }) {
|
|
107
|
-
if (verbose && silent) {
|
|
108
|
-
this._silent = false;
|
|
109
|
-
if (!isEnvTest()) {
|
|
110
|
-
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
this._silent = silent;
|
|
114
|
-
this._verbose = verbose && !silent;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
var ConsoleLogger = class extends BaseLogger {
|
|
118
|
-
isSuppressed() {
|
|
119
|
-
return isEnvTest() || this._silent;
|
|
120
|
-
}
|
|
121
|
-
get jsonMode() {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
captureData(_key, _value) {
|
|
125
|
-
}
|
|
126
|
-
getJsonData() {
|
|
127
|
-
return {};
|
|
128
|
-
}
|
|
129
|
-
outputJson(_success, _error) {
|
|
130
|
-
}
|
|
131
|
-
info(message, ...args) {
|
|
132
|
-
if (this.isSuppressed()) return;
|
|
133
|
-
console.log(message, ...args);
|
|
134
|
-
}
|
|
135
|
-
success(message, ...args) {
|
|
136
|
-
if (this.isSuppressed()) return;
|
|
137
|
-
console.log(message, ...args);
|
|
138
|
-
}
|
|
139
|
-
warn(message, ...args) {
|
|
140
|
-
if (this.isSuppressed()) return;
|
|
141
|
-
console.warn(message, ...args);
|
|
142
|
-
}
|
|
143
|
-
error(message, _code, ...args) {
|
|
144
|
-
if (isEnvTest()) return;
|
|
145
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
146
|
-
console.error(errorMessage, ...args);
|
|
147
|
-
}
|
|
148
|
-
debug(message, ...args) {
|
|
149
|
-
if (this.isSuppressed()) return;
|
|
150
|
-
if (this._verbose) {
|
|
151
|
-
console.log(message, ...args);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
var logger = new ConsoleLogger();
|
|
156
|
-
|
|
157
96
|
// src/utils/file.ts
|
|
158
97
|
async function ensureDir(dirPath) {
|
|
159
98
|
try {
|
|
@@ -199,7 +138,6 @@ async function directoryExists(dirPath) {
|
|
|
199
138
|
}
|
|
200
139
|
}
|
|
201
140
|
async function readFileContent(filepath) {
|
|
202
|
-
logger.debug(`Reading file: ${filepath}`);
|
|
203
141
|
return (0, import_promises.readFile)(filepath, "utf-8");
|
|
204
142
|
}
|
|
205
143
|
async function readFileContentOrNull(filepath) {
|
|
@@ -209,7 +147,6 @@ async function readFileContentOrNull(filepath) {
|
|
|
209
147
|
return null;
|
|
210
148
|
}
|
|
211
149
|
async function readFileBuffer(filepath) {
|
|
212
|
-
logger.debug(`Reading file buffer: ${filepath}`);
|
|
213
150
|
return (0, import_promises.readFile)(filepath);
|
|
214
151
|
}
|
|
215
152
|
function addTrailingNewline(content) {
|
|
@@ -219,7 +156,6 @@ function addTrailingNewline(content) {
|
|
|
219
156
|
return content.trimEnd() + "\n";
|
|
220
157
|
}
|
|
221
158
|
async function writeFileContent(filepath, content) {
|
|
222
|
-
logger.debug(`Writing file: ${filepath}`);
|
|
223
159
|
await ensureDir((0, import_node_path2.dirname)(filepath));
|
|
224
160
|
await (0, import_promises.writeFile)(filepath, content, "utf-8");
|
|
225
161
|
}
|
|
@@ -252,25 +188,21 @@ async function findFilesByGlobs(globs, options = {}) {
|
|
|
252
188
|
async function removeDirectory(dirPath) {
|
|
253
189
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
254
190
|
if (dangerousPaths.includes(dirPath) || dirPath === "") {
|
|
255
|
-
logger.warn(`Skipping deletion of dangerous path: ${dirPath}`);
|
|
256
191
|
return;
|
|
257
192
|
}
|
|
258
193
|
try {
|
|
259
194
|
if (await fileExists(dirPath)) {
|
|
260
195
|
await (0, import_promises.rm)(dirPath, { recursive: true, force: true });
|
|
261
196
|
}
|
|
262
|
-
} catch
|
|
263
|
-
logger.warn(`Failed to remove directory ${dirPath}:`, error);
|
|
197
|
+
} catch {
|
|
264
198
|
}
|
|
265
199
|
}
|
|
266
200
|
async function removeFile(filepath) {
|
|
267
|
-
logger.debug(`Removing file: ${filepath}`);
|
|
268
201
|
try {
|
|
269
202
|
if (await fileExists(filepath)) {
|
|
270
203
|
await (0, import_promises.rm)(filepath);
|
|
271
204
|
}
|
|
272
|
-
} catch
|
|
273
|
-
logger.warn(`Failed to remove file ${filepath}:`, error);
|
|
205
|
+
} catch {
|
|
274
206
|
}
|
|
275
207
|
}
|
|
276
208
|
function getHomeDirectory() {
|
|
@@ -335,6 +267,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
335
267
|
"cline",
|
|
336
268
|
"codexcli",
|
|
337
269
|
"copilot",
|
|
270
|
+
"copilotcli",
|
|
338
271
|
"cursor",
|
|
339
272
|
"factorydroid",
|
|
340
273
|
"geminicli",
|
|
@@ -585,16 +518,11 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
585
518
|
if (!await fileExists(filePath)) {
|
|
586
519
|
return {};
|
|
587
520
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
return configParams;
|
|
594
|
-
} catch (error) {
|
|
595
|
-
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
596
|
-
throw error;
|
|
597
|
-
}
|
|
521
|
+
const fileContent = await readFileContent(filePath);
|
|
522
|
+
const jsonData = (0, import_jsonc_parser.parse)(fileContent);
|
|
523
|
+
const parsed = ConfigFileSchema.parse(jsonData);
|
|
524
|
+
const { $schema: _schema, ...configParams } = parsed;
|
|
525
|
+
return configParams;
|
|
598
526
|
};
|
|
599
527
|
var mergeConfigs = (baseConfig, localConfig) => {
|
|
600
528
|
return {
|
|
@@ -675,7 +603,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
675
603
|
}
|
|
676
604
|
|
|
677
605
|
// src/lib/generate.ts
|
|
678
|
-
var
|
|
606
|
+
var import_node_path120 = require("path");
|
|
679
607
|
var import_es_toolkit4 = require("es-toolkit");
|
|
680
608
|
|
|
681
609
|
// src/features/commands/commands-processor.ts
|
|
@@ -686,9 +614,15 @@ var import_mini14 = require("zod/mini");
|
|
|
686
614
|
var FeatureProcessor = class {
|
|
687
615
|
baseDir;
|
|
688
616
|
dryRun;
|
|
689
|
-
|
|
617
|
+
logger;
|
|
618
|
+
constructor({
|
|
619
|
+
baseDir = process.cwd(),
|
|
620
|
+
dryRun = false,
|
|
621
|
+
logger
|
|
622
|
+
}) {
|
|
690
623
|
this.baseDir = baseDir;
|
|
691
624
|
this.dryRun = dryRun;
|
|
625
|
+
this.logger = logger;
|
|
692
626
|
}
|
|
693
627
|
/**
|
|
694
628
|
* Return tool targets that this feature supports.
|
|
@@ -711,7 +645,7 @@ var FeatureProcessor = class {
|
|
|
711
645
|
continue;
|
|
712
646
|
}
|
|
713
647
|
if (this.dryRun) {
|
|
714
|
-
logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
648
|
+
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
715
649
|
} else {
|
|
716
650
|
await writeFileContent(filePath, contentWithNewline);
|
|
717
651
|
}
|
|
@@ -735,7 +669,7 @@ var FeatureProcessor = class {
|
|
|
735
669
|
for (const aiFile of orphanFiles) {
|
|
736
670
|
const filePath = aiFile.getFilePath();
|
|
737
671
|
if (this.dryRun) {
|
|
738
|
-
logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
672
|
+
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
739
673
|
} else {
|
|
740
674
|
await removeFile(filePath);
|
|
741
675
|
}
|
|
@@ -3107,9 +3041,10 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3107
3041
|
toolTarget,
|
|
3108
3042
|
global = false,
|
|
3109
3043
|
getFactory = defaultGetFactory,
|
|
3110
|
-
dryRun = false
|
|
3044
|
+
dryRun = false,
|
|
3045
|
+
logger
|
|
3111
3046
|
}) {
|
|
3112
|
-
super({ baseDir, dryRun });
|
|
3047
|
+
super({ baseDir, dryRun, logger });
|
|
3113
3048
|
const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3114
3049
|
if (!result.success) {
|
|
3115
3050
|
throw new Error(
|
|
@@ -3136,7 +3071,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3136
3071
|
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
3137
3072
|
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
3138
3073
|
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
3139
|
-
logger.warn(
|
|
3074
|
+
this.logger.warn(
|
|
3140
3075
|
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}". Only the last processed command will be used.`
|
|
3141
3076
|
);
|
|
3142
3077
|
} else if (!firstOrigin) {
|
|
@@ -3182,7 +3117,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3182
3117
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
3183
3118
|
)
|
|
3184
3119
|
);
|
|
3185
|
-
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3120
|
+
this.logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3186
3121
|
return rulesyncCommands;
|
|
3187
3122
|
}
|
|
3188
3123
|
/**
|
|
@@ -3206,7 +3141,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3206
3141
|
global: this.global
|
|
3207
3142
|
})
|
|
3208
3143
|
).filter((cmd) => cmd.isDeletable());
|
|
3209
|
-
logger.debug(
|
|
3144
|
+
this.logger.debug(
|
|
3145
|
+
`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`
|
|
3146
|
+
);
|
|
3210
3147
|
return toolCommands2;
|
|
3211
3148
|
}
|
|
3212
3149
|
const toolCommands = await Promise.all(
|
|
@@ -3218,7 +3155,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3218
3155
|
})
|
|
3219
3156
|
)
|
|
3220
3157
|
);
|
|
3221
|
-
logger.debug(
|
|
3158
|
+
this.logger.debug(
|
|
3159
|
+
`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`
|
|
3160
|
+
);
|
|
3222
3161
|
return toolCommands;
|
|
3223
3162
|
}
|
|
3224
3163
|
/**
|
|
@@ -3487,7 +3426,8 @@ function isToolMatcherEntry(x) {
|
|
|
3487
3426
|
function canonicalToToolHooks({
|
|
3488
3427
|
config,
|
|
3489
3428
|
toolOverrideHooks,
|
|
3490
|
-
converterConfig
|
|
3429
|
+
converterConfig,
|
|
3430
|
+
logger
|
|
3491
3431
|
}) {
|
|
3492
3432
|
const supported = new Set(converterConfig.supportedEvents);
|
|
3493
3433
|
const sharedHooks = {};
|
|
@@ -3514,7 +3454,7 @@ function canonicalToToolHooks({
|
|
|
3514
3454
|
const isNoMatcherEvent = converterConfig.noMatcherEvents?.has(eventName) ?? false;
|
|
3515
3455
|
for (const [matcherKey, defs] of byMatcher) {
|
|
3516
3456
|
if (isNoMatcherEvent && matcherKey) {
|
|
3517
|
-
logger
|
|
3457
|
+
logger?.warn(
|
|
3518
3458
|
`matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
|
|
3519
3459
|
);
|
|
3520
3460
|
}
|
|
@@ -3711,7 +3651,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3711
3651
|
baseDir = process.cwd(),
|
|
3712
3652
|
rulesyncHooks,
|
|
3713
3653
|
validate = true,
|
|
3714
|
-
global = false
|
|
3654
|
+
global = false,
|
|
3655
|
+
logger
|
|
3715
3656
|
}) {
|
|
3716
3657
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3717
3658
|
const filePath = (0, import_node_path24.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -3732,7 +3673,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3732
3673
|
const claudeHooks = canonicalToToolHooks({
|
|
3733
3674
|
config,
|
|
3734
3675
|
toolOverrideHooks: config.claudecode?.hooks,
|
|
3735
|
-
converterConfig: CLAUDE_CONVERTER_CONFIG
|
|
3676
|
+
converterConfig: CLAUDE_CONVERTER_CONFIG,
|
|
3677
|
+
logger
|
|
3736
3678
|
});
|
|
3737
3679
|
const merged = { ...settings, hooks: claudeHooks };
|
|
3738
3680
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -3832,14 +3774,14 @@ function canonicalToCopilotHooks(config) {
|
|
|
3832
3774
|
}
|
|
3833
3775
|
return copilot;
|
|
3834
3776
|
}
|
|
3835
|
-
function resolveImportCommand(entry) {
|
|
3777
|
+
function resolveImportCommand(entry, logger) {
|
|
3836
3778
|
const hasBash = typeof entry.bash === "string";
|
|
3837
3779
|
const hasPowershell = typeof entry.powershell === "string";
|
|
3838
3780
|
if (hasBash && hasPowershell) {
|
|
3839
3781
|
const isWindows = process.platform === "win32";
|
|
3840
3782
|
const chosen = isWindows ? "powershell" : "bash";
|
|
3841
3783
|
const ignored = isWindows ? "bash" : "powershell";
|
|
3842
|
-
logger
|
|
3784
|
+
logger?.warn(
|
|
3843
3785
|
`Copilot hook has both bash and powershell commands; using ${chosen} and ignoring ${ignored} on this platform.`
|
|
3844
3786
|
);
|
|
3845
3787
|
return isWindows ? entry.powershell : entry.bash;
|
|
@@ -3850,7 +3792,7 @@ function resolveImportCommand(entry) {
|
|
|
3850
3792
|
}
|
|
3851
3793
|
return void 0;
|
|
3852
3794
|
}
|
|
3853
|
-
function copilotHooksToCanonical(copilotHooks) {
|
|
3795
|
+
function copilotHooksToCanonical(copilotHooks, logger) {
|
|
3854
3796
|
if (copilotHooks === null || copilotHooks === void 0 || typeof copilotHooks !== "object") {
|
|
3855
3797
|
return {};
|
|
3856
3798
|
}
|
|
@@ -3863,7 +3805,7 @@ function copilotHooksToCanonical(copilotHooks) {
|
|
|
3863
3805
|
const parseResult = CopilotHookEntrySchema.safeParse(rawEntry);
|
|
3864
3806
|
if (!parseResult.success) continue;
|
|
3865
3807
|
const entry = parseResult.data;
|
|
3866
|
-
const command = resolveImportCommand(entry);
|
|
3808
|
+
const command = resolveImportCommand(entry, logger);
|
|
3867
3809
|
const timeout = entry.timeoutSec;
|
|
3868
3810
|
defs.push({
|
|
3869
3811
|
type: "command",
|
|
@@ -3923,7 +3865,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3923
3865
|
validate
|
|
3924
3866
|
});
|
|
3925
3867
|
}
|
|
3926
|
-
toRulesyncHooks() {
|
|
3868
|
+
toRulesyncHooks(options) {
|
|
3927
3869
|
let parsed;
|
|
3928
3870
|
try {
|
|
3929
3871
|
parsed = JSON.parse(this.getFileContent());
|
|
@@ -3935,7 +3877,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3935
3877
|
}
|
|
3936
3878
|
);
|
|
3937
3879
|
}
|
|
3938
|
-
const hooks = copilotHooksToCanonical(parsed.hooks);
|
|
3880
|
+
const hooks = copilotHooksToCanonical(parsed.hooks, options?.logger);
|
|
3939
3881
|
return this.toRulesyncHooksDefault({
|
|
3940
3882
|
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
3941
3883
|
});
|
|
@@ -4107,7 +4049,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4107
4049
|
baseDir = process.cwd(),
|
|
4108
4050
|
rulesyncHooks,
|
|
4109
4051
|
validate = true,
|
|
4110
|
-
global = false
|
|
4052
|
+
global = false,
|
|
4053
|
+
logger
|
|
4111
4054
|
}) {
|
|
4112
4055
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
4113
4056
|
const filePath = (0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -4128,7 +4071,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4128
4071
|
const factorydroidHooks = canonicalToToolHooks({
|
|
4129
4072
|
config,
|
|
4130
4073
|
toolOverrideHooks: config.factorydroid?.hooks,
|
|
4131
|
-
converterConfig: FACTORYDROID_CONVERTER_CONFIG
|
|
4074
|
+
converterConfig: FACTORYDROID_CONVERTER_CONFIG,
|
|
4075
|
+
logger
|
|
4132
4076
|
});
|
|
4133
4077
|
const merged = { ...settings, hooks: factorydroidHooks };
|
|
4134
4078
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -4627,9 +4571,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4627
4571
|
baseDir = process.cwd(),
|
|
4628
4572
|
toolTarget,
|
|
4629
4573
|
global = false,
|
|
4630
|
-
dryRun = false
|
|
4574
|
+
dryRun = false,
|
|
4575
|
+
logger
|
|
4631
4576
|
}) {
|
|
4632
|
-
super({ baseDir, dryRun });
|
|
4577
|
+
super({ baseDir, dryRun, logger });
|
|
4633
4578
|
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
4634
4579
|
if (!result.success) {
|
|
4635
4580
|
throw new Error(
|
|
@@ -4648,7 +4593,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4648
4593
|
})
|
|
4649
4594
|
];
|
|
4650
4595
|
} catch (error) {
|
|
4651
|
-
logger.error(
|
|
4596
|
+
this.logger.error(
|
|
4652
4597
|
`Failed to load Rulesync hooks file (${RULESYNC_HOOKS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
4653
4598
|
);
|
|
4654
4599
|
return [];
|
|
@@ -4667,7 +4612,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4667
4612
|
global: this.global
|
|
4668
4613
|
});
|
|
4669
4614
|
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
4670
|
-
logger.debug(
|
|
4615
|
+
this.logger.debug(
|
|
4671
4616
|
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
4672
4617
|
);
|
|
4673
4618
|
return list;
|
|
@@ -4677,14 +4622,14 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4677
4622
|
validate: true,
|
|
4678
4623
|
global: this.global
|
|
4679
4624
|
});
|
|
4680
|
-
logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4625
|
+
this.logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4681
4626
|
return [toolHooks];
|
|
4682
4627
|
} catch (error) {
|
|
4683
4628
|
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
4684
4629
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
4685
|
-
logger.debug(msg);
|
|
4630
|
+
this.logger.debug(msg);
|
|
4686
4631
|
} else {
|
|
4687
|
-
logger.error(msg);
|
|
4632
|
+
this.logger.error(msg);
|
|
4688
4633
|
}
|
|
4689
4634
|
return [];
|
|
4690
4635
|
}
|
|
@@ -4705,7 +4650,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4705
4650
|
const configEventNames = new Set(Object.keys(effectiveHooks));
|
|
4706
4651
|
const skipped = [...configEventNames].filter((e) => !supportedEvents.has(e));
|
|
4707
4652
|
if (skipped.length > 0) {
|
|
4708
|
-
logger.warn(
|
|
4653
|
+
this.logger.warn(
|
|
4709
4654
|
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
4710
4655
|
);
|
|
4711
4656
|
}
|
|
@@ -4724,7 +4669,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4724
4669
|
}
|
|
4725
4670
|
}
|
|
4726
4671
|
for (const [hookType, events] of unsupportedTypeToEvents) {
|
|
4727
|
-
logger.warn(
|
|
4672
|
+
this.logger.warn(
|
|
4728
4673
|
`Skipped ${hookType}-type hook(s) for ${this.toolTarget} (not supported): ${Array.from(events).join(", ")}`
|
|
4729
4674
|
);
|
|
4730
4675
|
}
|
|
@@ -4739,7 +4684,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4739
4684
|
}
|
|
4740
4685
|
}
|
|
4741
4686
|
if (eventsWithMatcher.size > 0) {
|
|
4742
|
-
logger.warn(
|
|
4687
|
+
this.logger.warn(
|
|
4743
4688
|
`Skipped matcher hook(s) for ${this.toolTarget} (not supported): ${Array.from(eventsWithMatcher).join(", ")}`
|
|
4744
4689
|
);
|
|
4745
4690
|
}
|
|
@@ -5801,9 +5746,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5801
5746
|
baseDir = process.cwd(),
|
|
5802
5747
|
toolTarget,
|
|
5803
5748
|
getFactory = defaultGetFactory2,
|
|
5804
|
-
dryRun = false
|
|
5749
|
+
dryRun = false,
|
|
5750
|
+
logger
|
|
5805
5751
|
}) {
|
|
5806
|
-
super({ baseDir, dryRun });
|
|
5752
|
+
super({ baseDir, dryRun, logger });
|
|
5807
5753
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
5808
5754
|
if (!result.success) {
|
|
5809
5755
|
throw new Error(
|
|
@@ -5825,7 +5771,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5825
5771
|
try {
|
|
5826
5772
|
return [await RulesyncIgnore.fromFile()];
|
|
5827
5773
|
} catch (error) {
|
|
5828
|
-
logger.error(
|
|
5774
|
+
this.logger.error(
|
|
5829
5775
|
`Failed to load rulesync ignore file (${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
5830
5776
|
);
|
|
5831
5777
|
return [];
|
|
@@ -5855,9 +5801,9 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5855
5801
|
} catch (error) {
|
|
5856
5802
|
const errorMessage = `Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`;
|
|
5857
5803
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
5858
|
-
logger.debug(errorMessage);
|
|
5804
|
+
this.logger.debug(errorMessage);
|
|
5859
5805
|
} else {
|
|
5860
|
-
logger.error(errorMessage);
|
|
5806
|
+
this.logger.error(errorMessage);
|
|
5861
5807
|
}
|
|
5862
5808
|
return [];
|
|
5863
5809
|
}
|
|
@@ -5987,7 +5933,10 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
5987
5933
|
}
|
|
5988
5934
|
return { success: true, error: null };
|
|
5989
5935
|
}
|
|
5990
|
-
static async fromFile({
|
|
5936
|
+
static async fromFile({
|
|
5937
|
+
validate = true,
|
|
5938
|
+
logger
|
|
5939
|
+
}) {
|
|
5991
5940
|
const baseDir = process.cwd();
|
|
5992
5941
|
const paths = this.getSettablePaths();
|
|
5993
5942
|
const recommendedPath = (0, import_node_path44.join)(
|
|
@@ -6007,7 +5956,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6007
5956
|
});
|
|
6008
5957
|
}
|
|
6009
5958
|
if (await fileExists(legacyPath)) {
|
|
6010
|
-
logger
|
|
5959
|
+
logger?.warn(
|
|
6011
5960
|
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
6012
5961
|
);
|
|
6013
5962
|
const fileContent2 = await readFileContent(legacyPath);
|
|
@@ -6509,8 +6458,145 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6509
6458
|
}
|
|
6510
6459
|
};
|
|
6511
6460
|
|
|
6512
|
-
// src/features/mcp/
|
|
6461
|
+
// src/features/mcp/copilotcli-mcp.ts
|
|
6513
6462
|
var import_node_path49 = require("path");
|
|
6463
|
+
function addTypeField(mcpServers) {
|
|
6464
|
+
const result = {};
|
|
6465
|
+
for (const [name, server] of Object.entries(mcpServers)) {
|
|
6466
|
+
const parsed = McpServerSchema.parse(server);
|
|
6467
|
+
if (!parsed.command) {
|
|
6468
|
+
throw new Error(
|
|
6469
|
+
`MCP server "${name}" is missing a command. GitHub Copilot CLI stdio servers require a non-empty command.`
|
|
6470
|
+
);
|
|
6471
|
+
}
|
|
6472
|
+
let command;
|
|
6473
|
+
let args;
|
|
6474
|
+
if (typeof parsed.command === "string") {
|
|
6475
|
+
command = parsed.command;
|
|
6476
|
+
args = parsed.args;
|
|
6477
|
+
} else {
|
|
6478
|
+
const [cmd, ...cmdArgs] = parsed.command;
|
|
6479
|
+
if (!cmd) {
|
|
6480
|
+
throw new Error(`MCP server "${name}" has an empty command array.`);
|
|
6481
|
+
}
|
|
6482
|
+
command = cmd;
|
|
6483
|
+
args = cmdArgs.length > 0 ? [...cmdArgs, ...parsed.args ?? []] : parsed.args;
|
|
6484
|
+
}
|
|
6485
|
+
result[name] = {
|
|
6486
|
+
type: "stdio",
|
|
6487
|
+
command,
|
|
6488
|
+
...args && { args },
|
|
6489
|
+
...parsed.env && { env: parsed.env }
|
|
6490
|
+
};
|
|
6491
|
+
}
|
|
6492
|
+
return result;
|
|
6493
|
+
}
|
|
6494
|
+
function removeTypeField(config) {
|
|
6495
|
+
const result = {};
|
|
6496
|
+
for (const [name, server] of Object.entries(config.mcpServers ?? {})) {
|
|
6497
|
+
const { type: _, ...rest } = server;
|
|
6498
|
+
result[name] = rest;
|
|
6499
|
+
}
|
|
6500
|
+
return result;
|
|
6501
|
+
}
|
|
6502
|
+
var CopilotcliMcp = class _CopilotcliMcp extends ToolMcp {
|
|
6503
|
+
json;
|
|
6504
|
+
constructor(params) {
|
|
6505
|
+
super(params);
|
|
6506
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
6507
|
+
}
|
|
6508
|
+
getJson() {
|
|
6509
|
+
return this.json;
|
|
6510
|
+
}
|
|
6511
|
+
/**
|
|
6512
|
+
* In global mode, ~/.copilot/mcp-config.json should not be deleted
|
|
6513
|
+
* as it may contain other user settings.
|
|
6514
|
+
* In local mode, .copilot/mcp-config.json can be safely deleted.
|
|
6515
|
+
*/
|
|
6516
|
+
isDeletable() {
|
|
6517
|
+
return !this.global;
|
|
6518
|
+
}
|
|
6519
|
+
static getSettablePaths({ global } = {}) {
|
|
6520
|
+
if (global) {
|
|
6521
|
+
return {
|
|
6522
|
+
relativeDirPath: ".copilot",
|
|
6523
|
+
relativeFilePath: "mcp-config.json"
|
|
6524
|
+
};
|
|
6525
|
+
}
|
|
6526
|
+
return {
|
|
6527
|
+
relativeDirPath: ".copilot",
|
|
6528
|
+
relativeFilePath: "mcp-config.json"
|
|
6529
|
+
};
|
|
6530
|
+
}
|
|
6531
|
+
static async fromFile({
|
|
6532
|
+
baseDir = process.cwd(),
|
|
6533
|
+
validate = true,
|
|
6534
|
+
global = false
|
|
6535
|
+
}) {
|
|
6536
|
+
const paths = this.getSettablePaths({ global });
|
|
6537
|
+
const fileContent = await readFileContentOrNull((0, import_node_path49.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6538
|
+
const json = JSON.parse(fileContent);
|
|
6539
|
+
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6540
|
+
return new _CopilotcliMcp({
|
|
6541
|
+
baseDir,
|
|
6542
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6543
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6544
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
6545
|
+
validate,
|
|
6546
|
+
global
|
|
6547
|
+
});
|
|
6548
|
+
}
|
|
6549
|
+
static async fromRulesyncMcp({
|
|
6550
|
+
baseDir = process.cwd(),
|
|
6551
|
+
rulesyncMcp,
|
|
6552
|
+
validate = true,
|
|
6553
|
+
global = false
|
|
6554
|
+
}) {
|
|
6555
|
+
const paths = this.getSettablePaths({ global });
|
|
6556
|
+
const fileContent = await readOrInitializeFileContent(
|
|
6557
|
+
(0, import_node_path49.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6558
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6559
|
+
);
|
|
6560
|
+
const json = JSON.parse(fileContent);
|
|
6561
|
+
const copilotCliMcpServers = addTypeField(rulesyncMcp.getMcpServers());
|
|
6562
|
+
const mcpJson = { ...json, mcpServers: copilotCliMcpServers };
|
|
6563
|
+
return new _CopilotcliMcp({
|
|
6564
|
+
baseDir,
|
|
6565
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6566
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6567
|
+
fileContent: JSON.stringify(mcpJson, null, 2),
|
|
6568
|
+
validate,
|
|
6569
|
+
global
|
|
6570
|
+
});
|
|
6571
|
+
}
|
|
6572
|
+
toRulesyncMcp() {
|
|
6573
|
+
const mcpServers = removeTypeField(this.json);
|
|
6574
|
+
return this.toRulesyncMcpDefault({
|
|
6575
|
+
fileContent: JSON.stringify({ mcpServers }, null, 2)
|
|
6576
|
+
});
|
|
6577
|
+
}
|
|
6578
|
+
validate() {
|
|
6579
|
+
return { success: true, error: null };
|
|
6580
|
+
}
|
|
6581
|
+
static forDeletion({
|
|
6582
|
+
baseDir = process.cwd(),
|
|
6583
|
+
relativeDirPath,
|
|
6584
|
+
relativeFilePath,
|
|
6585
|
+
global = false
|
|
6586
|
+
}) {
|
|
6587
|
+
return new _CopilotcliMcp({
|
|
6588
|
+
baseDir,
|
|
6589
|
+
relativeDirPath,
|
|
6590
|
+
relativeFilePath,
|
|
6591
|
+
fileContent: "{}",
|
|
6592
|
+
validate: false,
|
|
6593
|
+
global
|
|
6594
|
+
});
|
|
6595
|
+
}
|
|
6596
|
+
};
|
|
6597
|
+
|
|
6598
|
+
// src/features/mcp/cursor-mcp.ts
|
|
6599
|
+
var import_node_path50 = require("path");
|
|
6514
6600
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6515
6601
|
function isMcpServers(value) {
|
|
6516
6602
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -6560,7 +6646,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6560
6646
|
this.json = JSON.parse(this.fileContent);
|
|
6561
6647
|
} catch (error) {
|
|
6562
6648
|
throw new Error(
|
|
6563
|
-
`Failed to parse Cursor MCP config at ${(0,
|
|
6649
|
+
`Failed to parse Cursor MCP config at ${(0, import_node_path50.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(error)}`,
|
|
6564
6650
|
{ cause: error }
|
|
6565
6651
|
);
|
|
6566
6652
|
}
|
|
@@ -6586,14 +6672,14 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6586
6672
|
global = false
|
|
6587
6673
|
}) {
|
|
6588
6674
|
const paths = this.getSettablePaths({ global });
|
|
6589
|
-
const filePath = (0,
|
|
6675
|
+
const filePath = (0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6590
6676
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"mcpServers":{}}';
|
|
6591
6677
|
let json;
|
|
6592
6678
|
try {
|
|
6593
6679
|
json = JSON.parse(fileContent);
|
|
6594
6680
|
} catch (error) {
|
|
6595
6681
|
throw new Error(
|
|
6596
|
-
`Failed to parse Cursor MCP config at ${(0,
|
|
6682
|
+
`Failed to parse Cursor MCP config at ${(0, import_node_path50.join)(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6597
6683
|
{ cause: error }
|
|
6598
6684
|
);
|
|
6599
6685
|
}
|
|
@@ -6615,7 +6701,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6615
6701
|
}) {
|
|
6616
6702
|
const paths = this.getSettablePaths({ global });
|
|
6617
6703
|
const fileContent = await readOrInitializeFileContent(
|
|
6618
|
-
(0,
|
|
6704
|
+
(0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6619
6705
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6620
6706
|
);
|
|
6621
6707
|
let json;
|
|
@@ -6623,7 +6709,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6623
6709
|
json = JSON.parse(fileContent);
|
|
6624
6710
|
} catch (error) {
|
|
6625
6711
|
throw new Error(
|
|
6626
|
-
`Failed to parse Cursor MCP config at ${(0,
|
|
6712
|
+
`Failed to parse Cursor MCP config at ${(0, import_node_path50.join)(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6627
6713
|
{ cause: error }
|
|
6628
6714
|
);
|
|
6629
6715
|
}
|
|
@@ -6672,7 +6758,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6672
6758
|
};
|
|
6673
6759
|
|
|
6674
6760
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6675
|
-
var
|
|
6761
|
+
var import_node_path51 = require("path");
|
|
6676
6762
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6677
6763
|
json;
|
|
6678
6764
|
constructor(params) {
|
|
@@ -6693,7 +6779,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6693
6779
|
validate = true
|
|
6694
6780
|
}) {
|
|
6695
6781
|
const fileContent = await readFileContent(
|
|
6696
|
-
(0,
|
|
6782
|
+
(0, import_node_path51.join)(
|
|
6697
6783
|
baseDir,
|
|
6698
6784
|
this.getSettablePaths().relativeDirPath,
|
|
6699
6785
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6747,7 +6833,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6747
6833
|
};
|
|
6748
6834
|
|
|
6749
6835
|
// src/features/mcp/geminicli-mcp.ts
|
|
6750
|
-
var
|
|
6836
|
+
var import_node_path52 = require("path");
|
|
6751
6837
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6752
6838
|
json;
|
|
6753
6839
|
constructor(params) {
|
|
@@ -6775,7 +6861,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6775
6861
|
global = false
|
|
6776
6862
|
}) {
|
|
6777
6863
|
const paths = this.getSettablePaths({ global });
|
|
6778
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6864
|
+
const fileContent = await readFileContentOrNull((0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6779
6865
|
const json = JSON.parse(fileContent);
|
|
6780
6866
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6781
6867
|
return new _GeminiCliMcp({
|
|
@@ -6794,7 +6880,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6794
6880
|
}) {
|
|
6795
6881
|
const paths = this.getSettablePaths({ global });
|
|
6796
6882
|
const fileContent = await readOrInitializeFileContent(
|
|
6797
|
-
(0,
|
|
6883
|
+
(0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6798
6884
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6799
6885
|
);
|
|
6800
6886
|
const json = JSON.parse(fileContent);
|
|
@@ -6839,7 +6925,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6839
6925
|
};
|
|
6840
6926
|
|
|
6841
6927
|
// src/features/mcp/junie-mcp.ts
|
|
6842
|
-
var
|
|
6928
|
+
var import_node_path53 = require("path");
|
|
6843
6929
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6844
6930
|
json;
|
|
6845
6931
|
constructor(params) {
|
|
@@ -6851,7 +6937,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6851
6937
|
}
|
|
6852
6938
|
static getSettablePaths() {
|
|
6853
6939
|
return {
|
|
6854
|
-
relativeDirPath: (0,
|
|
6940
|
+
relativeDirPath: (0, import_node_path53.join)(".junie", "mcp"),
|
|
6855
6941
|
relativeFilePath: "mcp.json"
|
|
6856
6942
|
};
|
|
6857
6943
|
}
|
|
@@ -6860,7 +6946,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6860
6946
|
validate = true
|
|
6861
6947
|
}) {
|
|
6862
6948
|
const fileContent = await readFileContent(
|
|
6863
|
-
(0,
|
|
6949
|
+
(0, import_node_path53.join)(
|
|
6864
6950
|
baseDir,
|
|
6865
6951
|
this.getSettablePaths().relativeDirPath,
|
|
6866
6952
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6909,7 +6995,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6909
6995
|
};
|
|
6910
6996
|
|
|
6911
6997
|
// src/features/mcp/kilo-mcp.ts
|
|
6912
|
-
var
|
|
6998
|
+
var import_node_path54 = require("path");
|
|
6913
6999
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
6914
7000
|
json;
|
|
6915
7001
|
constructor(params) {
|
|
@@ -6930,7 +7016,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6930
7016
|
validate = true
|
|
6931
7017
|
}) {
|
|
6932
7018
|
const paths = this.getSettablePaths();
|
|
6933
|
-
const fileContent = await readFileContentOrNull((0,
|
|
7019
|
+
const fileContent = await readFileContentOrNull((0, import_node_path54.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6934
7020
|
return new _KiloMcp({
|
|
6935
7021
|
baseDir,
|
|
6936
7022
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6978,7 +7064,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6978
7064
|
};
|
|
6979
7065
|
|
|
6980
7066
|
// src/features/mcp/kiro-mcp.ts
|
|
6981
|
-
var
|
|
7067
|
+
var import_node_path55 = require("path");
|
|
6982
7068
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
6983
7069
|
json;
|
|
6984
7070
|
constructor(params) {
|
|
@@ -6990,7 +7076,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6990
7076
|
}
|
|
6991
7077
|
static getSettablePaths() {
|
|
6992
7078
|
return {
|
|
6993
|
-
relativeDirPath: (0,
|
|
7079
|
+
relativeDirPath: (0, import_node_path55.join)(".kiro", "settings"),
|
|
6994
7080
|
relativeFilePath: "mcp.json"
|
|
6995
7081
|
};
|
|
6996
7082
|
}
|
|
@@ -6999,7 +7085,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6999
7085
|
validate = true
|
|
7000
7086
|
}) {
|
|
7001
7087
|
const paths = this.getSettablePaths();
|
|
7002
|
-
const fileContent = await readFileContentOrNull((0,
|
|
7088
|
+
const fileContent = await readFileContentOrNull((0, import_node_path55.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7003
7089
|
return new _KiroMcp({
|
|
7004
7090
|
baseDir,
|
|
7005
7091
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7047,7 +7133,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7047
7133
|
};
|
|
7048
7134
|
|
|
7049
7135
|
// src/features/mcp/opencode-mcp.ts
|
|
7050
|
-
var
|
|
7136
|
+
var import_node_path56 = require("path");
|
|
7051
7137
|
var import_jsonc_parser2 = require("jsonc-parser");
|
|
7052
7138
|
var import_mini22 = require("zod/mini");
|
|
7053
7139
|
var OpencodeMcpLocalServerSchema = import_mini22.z.object({
|
|
@@ -7188,7 +7274,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7188
7274
|
static getSettablePaths({ global } = {}) {
|
|
7189
7275
|
if (global) {
|
|
7190
7276
|
return {
|
|
7191
|
-
relativeDirPath: (0,
|
|
7277
|
+
relativeDirPath: (0, import_node_path56.join)(".config", "opencode"),
|
|
7192
7278
|
relativeFilePath: "opencode.json"
|
|
7193
7279
|
};
|
|
7194
7280
|
}
|
|
@@ -7203,11 +7289,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7203
7289
|
global = false
|
|
7204
7290
|
}) {
|
|
7205
7291
|
const basePaths = this.getSettablePaths({ global });
|
|
7206
|
-
const jsonDir = (0,
|
|
7292
|
+
const jsonDir = (0, import_node_path56.join)(baseDir, basePaths.relativeDirPath);
|
|
7207
7293
|
let fileContent = null;
|
|
7208
7294
|
let relativeFilePath = "opencode.jsonc";
|
|
7209
|
-
const jsoncPath = (0,
|
|
7210
|
-
const jsonPath = (0,
|
|
7295
|
+
const jsoncPath = (0, import_node_path56.join)(jsonDir, "opencode.jsonc");
|
|
7296
|
+
const jsonPath = (0, import_node_path56.join)(jsonDir, "opencode.json");
|
|
7211
7297
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7212
7298
|
if (!fileContent) {
|
|
7213
7299
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7233,11 +7319,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7233
7319
|
global = false
|
|
7234
7320
|
}) {
|
|
7235
7321
|
const basePaths = this.getSettablePaths({ global });
|
|
7236
|
-
const jsonDir = (0,
|
|
7322
|
+
const jsonDir = (0, import_node_path56.join)(baseDir, basePaths.relativeDirPath);
|
|
7237
7323
|
let fileContent = null;
|
|
7238
7324
|
let relativeFilePath = "opencode.jsonc";
|
|
7239
|
-
const jsoncPath = (0,
|
|
7240
|
-
const jsonPath = (0,
|
|
7325
|
+
const jsoncPath = (0, import_node_path56.join)(jsonDir, "opencode.jsonc");
|
|
7326
|
+
const jsonPath = (0, import_node_path56.join)(jsonDir, "opencode.json");
|
|
7241
7327
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7242
7328
|
if (!fileContent) {
|
|
7243
7329
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7298,7 +7384,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7298
7384
|
};
|
|
7299
7385
|
|
|
7300
7386
|
// src/features/mcp/roo-mcp.ts
|
|
7301
|
-
var
|
|
7387
|
+
var import_node_path57 = require("path");
|
|
7302
7388
|
function isRooMcpServers(value) {
|
|
7303
7389
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7304
7390
|
}
|
|
@@ -7350,7 +7436,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7350
7436
|
validate = true
|
|
7351
7437
|
}) {
|
|
7352
7438
|
const fileContent = await readFileContent(
|
|
7353
|
-
(0,
|
|
7439
|
+
(0, import_node_path57.join)(
|
|
7354
7440
|
baseDir,
|
|
7355
7441
|
this.getSettablePaths().relativeDirPath,
|
|
7356
7442
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7412,6 +7498,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
7412
7498
|
"cline",
|
|
7413
7499
|
"codexcli",
|
|
7414
7500
|
"copilot",
|
|
7501
|
+
"copilotcli",
|
|
7415
7502
|
"cursor",
|
|
7416
7503
|
"factorydroid",
|
|
7417
7504
|
"geminicli",
|
|
@@ -7483,6 +7570,18 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
7483
7570
|
}
|
|
7484
7571
|
}
|
|
7485
7572
|
],
|
|
7573
|
+
[
|
|
7574
|
+
"copilotcli",
|
|
7575
|
+
{
|
|
7576
|
+
class: CopilotcliMcp,
|
|
7577
|
+
meta: {
|
|
7578
|
+
supportsProject: true,
|
|
7579
|
+
supportsGlobal: true,
|
|
7580
|
+
supportsEnabledTools: false,
|
|
7581
|
+
supportsDisabledTools: false
|
|
7582
|
+
}
|
|
7583
|
+
}
|
|
7584
|
+
],
|
|
7486
7585
|
[
|
|
7487
7586
|
"cursor",
|
|
7488
7587
|
{
|
|
@@ -7605,9 +7704,10 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7605
7704
|
toolTarget,
|
|
7606
7705
|
global = false,
|
|
7607
7706
|
getFactory = defaultGetFactory3,
|
|
7608
|
-
dryRun = false
|
|
7707
|
+
dryRun = false,
|
|
7708
|
+
logger
|
|
7609
7709
|
}) {
|
|
7610
|
-
super({ baseDir, dryRun });
|
|
7710
|
+
super({ baseDir, dryRun, logger });
|
|
7611
7711
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
7612
7712
|
if (!result.success) {
|
|
7613
7713
|
throw new Error(
|
|
@@ -7626,7 +7726,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7626
7726
|
try {
|
|
7627
7727
|
return [await RulesyncMcp.fromFile({})];
|
|
7628
7728
|
} catch (error) {
|
|
7629
|
-
logger.error(
|
|
7729
|
+
this.logger.error(
|
|
7630
7730
|
`Failed to load a Rulesync MCP file (${RULESYNC_MCP_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
7631
7731
|
);
|
|
7632
7732
|
return [];
|
|
@@ -7650,7 +7750,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7650
7750
|
global: this.global
|
|
7651
7751
|
});
|
|
7652
7752
|
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
7653
|
-
logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7753
|
+
this.logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7654
7754
|
return toolMcps2;
|
|
7655
7755
|
}
|
|
7656
7756
|
const toolMcps = [
|
|
@@ -7660,14 +7760,14 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7660
7760
|
global: this.global
|
|
7661
7761
|
})
|
|
7662
7762
|
];
|
|
7663
|
-
logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7763
|
+
this.logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7664
7764
|
return toolMcps;
|
|
7665
7765
|
} catch (error) {
|
|
7666
7766
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
7667
7767
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
7668
|
-
logger.debug(errorMessage);
|
|
7768
|
+
this.logger.debug(errorMessage);
|
|
7669
7769
|
} else {
|
|
7670
|
-
logger.error(errorMessage);
|
|
7770
|
+
this.logger.error(errorMessage);
|
|
7671
7771
|
}
|
|
7672
7772
|
return [];
|
|
7673
7773
|
}
|
|
@@ -7723,7 +7823,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7723
7823
|
};
|
|
7724
7824
|
|
|
7725
7825
|
// src/features/rules/rules-processor.ts
|
|
7726
|
-
var
|
|
7826
|
+
var import_node_path119 = require("path");
|
|
7727
7827
|
var import_toon = require("@toon-format/toon");
|
|
7728
7828
|
var import_mini57 = require("zod/mini");
|
|
7729
7829
|
|
|
@@ -7731,17 +7831,17 @@ var import_mini57 = require("zod/mini");
|
|
|
7731
7831
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7732
7832
|
|
|
7733
7833
|
// src/features/skills/agentsmd-skill.ts
|
|
7734
|
-
var
|
|
7834
|
+
var import_node_path61 = require("path");
|
|
7735
7835
|
|
|
7736
7836
|
// src/features/skills/simulated-skill.ts
|
|
7737
|
-
var
|
|
7837
|
+
var import_node_path60 = require("path");
|
|
7738
7838
|
var import_mini24 = require("zod/mini");
|
|
7739
7839
|
|
|
7740
7840
|
// src/features/skills/tool-skill.ts
|
|
7741
|
-
var
|
|
7841
|
+
var import_node_path59 = require("path");
|
|
7742
7842
|
|
|
7743
7843
|
// src/types/ai-dir.ts
|
|
7744
|
-
var
|
|
7844
|
+
var import_node_path58 = __toESM(require("path"), 1);
|
|
7745
7845
|
var AiDir = class {
|
|
7746
7846
|
/**
|
|
7747
7847
|
* @example "."
|
|
@@ -7775,7 +7875,7 @@ var AiDir = class {
|
|
|
7775
7875
|
otherFiles = [],
|
|
7776
7876
|
global = false
|
|
7777
7877
|
}) {
|
|
7778
|
-
if (dirName.includes(
|
|
7878
|
+
if (dirName.includes(import_node_path58.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
7779
7879
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
7780
7880
|
}
|
|
7781
7881
|
this.baseDir = baseDir;
|
|
@@ -7798,11 +7898,11 @@ var AiDir = class {
|
|
|
7798
7898
|
return this.dirName;
|
|
7799
7899
|
}
|
|
7800
7900
|
getDirPath() {
|
|
7801
|
-
const fullPath =
|
|
7802
|
-
const resolvedFull = (0,
|
|
7803
|
-
const resolvedBase = (0,
|
|
7804
|
-
const rel = (0,
|
|
7805
|
-
if (rel.startsWith("..") ||
|
|
7901
|
+
const fullPath = import_node_path58.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
7902
|
+
const resolvedFull = (0, import_node_path58.resolve)(fullPath);
|
|
7903
|
+
const resolvedBase = (0, import_node_path58.resolve)(this.baseDir);
|
|
7904
|
+
const rel = (0, import_node_path58.relative)(resolvedBase, resolvedFull);
|
|
7905
|
+
if (rel.startsWith("..") || import_node_path58.default.isAbsolute(rel)) {
|
|
7806
7906
|
throw new Error(
|
|
7807
7907
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
7808
7908
|
);
|
|
@@ -7816,7 +7916,7 @@ var AiDir = class {
|
|
|
7816
7916
|
return this.otherFiles;
|
|
7817
7917
|
}
|
|
7818
7918
|
getRelativePathFromCwd() {
|
|
7819
|
-
return
|
|
7919
|
+
return import_node_path58.default.join(this.relativeDirPath, this.dirName);
|
|
7820
7920
|
}
|
|
7821
7921
|
getGlobal() {
|
|
7822
7922
|
return this.global;
|
|
@@ -7835,15 +7935,15 @@ var AiDir = class {
|
|
|
7835
7935
|
* @returns Array of files with their relative paths and buffers
|
|
7836
7936
|
*/
|
|
7837
7937
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7838
|
-
const dirPath = (0,
|
|
7839
|
-
const glob = (0,
|
|
7938
|
+
const dirPath = (0, import_node_path58.join)(baseDir, relativeDirPath, dirName);
|
|
7939
|
+
const glob = (0, import_node_path58.join)(dirPath, "**", "*");
|
|
7840
7940
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7841
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
7941
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path58.basename)(filePath) !== excludeFileName);
|
|
7842
7942
|
const files = await Promise.all(
|
|
7843
7943
|
filteredPaths.map(async (filePath) => {
|
|
7844
7944
|
const fileBuffer = await readFileBuffer(filePath);
|
|
7845
7945
|
return {
|
|
7846
|
-
relativeFilePathToDirPath: (0,
|
|
7946
|
+
relativeFilePathToDirPath: (0, import_node_path58.relative)(dirPath, filePath),
|
|
7847
7947
|
fileBuffer
|
|
7848
7948
|
};
|
|
7849
7949
|
})
|
|
@@ -7934,8 +8034,8 @@ var ToolSkill = class extends AiDir {
|
|
|
7934
8034
|
}) {
|
|
7935
8035
|
const settablePaths = getSettablePaths({ global });
|
|
7936
8036
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7937
|
-
const skillDirPath = (0,
|
|
7938
|
-
const skillFilePath = (0,
|
|
8037
|
+
const skillDirPath = (0, import_node_path59.join)(baseDir, actualRelativeDirPath, dirName);
|
|
8038
|
+
const skillFilePath = (0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7939
8039
|
if (!await fileExists(skillFilePath)) {
|
|
7940
8040
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7941
8041
|
}
|
|
@@ -7959,7 +8059,7 @@ var ToolSkill = class extends AiDir {
|
|
|
7959
8059
|
}
|
|
7960
8060
|
requireMainFileFrontmatter() {
|
|
7961
8061
|
if (!this.mainFile?.frontmatter) {
|
|
7962
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
8062
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path59.join)(this.relativeDirPath, this.dirName)}`);
|
|
7963
8063
|
}
|
|
7964
8064
|
return this.mainFile.frontmatter;
|
|
7965
8065
|
}
|
|
@@ -7999,7 +8099,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7999
8099
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8000
8100
|
if (!result.success) {
|
|
8001
8101
|
throw new Error(
|
|
8002
|
-
`Invalid frontmatter in ${(0,
|
|
8102
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
8003
8103
|
);
|
|
8004
8104
|
}
|
|
8005
8105
|
}
|
|
@@ -8058,8 +8158,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8058
8158
|
}) {
|
|
8059
8159
|
const settablePaths = this.getSettablePaths();
|
|
8060
8160
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8061
|
-
const skillDirPath = (0,
|
|
8062
|
-
const skillFilePath = (0,
|
|
8161
|
+
const skillDirPath = (0, import_node_path60.join)(baseDir, actualRelativeDirPath, dirName);
|
|
8162
|
+
const skillFilePath = (0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME);
|
|
8063
8163
|
if (!await fileExists(skillFilePath)) {
|
|
8064
8164
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8065
8165
|
}
|
|
@@ -8136,7 +8236,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8136
8236
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
8137
8237
|
}
|
|
8138
8238
|
return {
|
|
8139
|
-
relativeDirPath: (0,
|
|
8239
|
+
relativeDirPath: (0, import_node_path61.join)(".agents", "skills")
|
|
8140
8240
|
};
|
|
8141
8241
|
}
|
|
8142
8242
|
static async fromDir(params) {
|
|
@@ -8163,11 +8263,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8163
8263
|
};
|
|
8164
8264
|
|
|
8165
8265
|
// src/features/skills/factorydroid-skill.ts
|
|
8166
|
-
var
|
|
8266
|
+
var import_node_path62 = require("path");
|
|
8167
8267
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
8168
8268
|
static getSettablePaths(_options) {
|
|
8169
8269
|
return {
|
|
8170
|
-
relativeDirPath: (0,
|
|
8270
|
+
relativeDirPath: (0, import_node_path62.join)(".factory", "skills")
|
|
8171
8271
|
};
|
|
8172
8272
|
}
|
|
8173
8273
|
static async fromDir(params) {
|
|
@@ -8194,23 +8294,26 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
8194
8294
|
};
|
|
8195
8295
|
|
|
8196
8296
|
// src/features/skills/skills-processor.ts
|
|
8197
|
-
var
|
|
8297
|
+
var import_node_path80 = require("path");
|
|
8198
8298
|
var import_mini40 = require("zod/mini");
|
|
8199
8299
|
|
|
8200
8300
|
// src/types/dir-feature-processor.ts
|
|
8201
|
-
var
|
|
8301
|
+
var import_node_path63 = require("path");
|
|
8202
8302
|
var DirFeatureProcessor = class {
|
|
8203
8303
|
baseDir;
|
|
8204
8304
|
dryRun;
|
|
8205
8305
|
avoidBlockScalars;
|
|
8306
|
+
logger;
|
|
8206
8307
|
constructor({
|
|
8207
8308
|
baseDir = process.cwd(),
|
|
8208
8309
|
dryRun = false,
|
|
8209
|
-
avoidBlockScalars = false
|
|
8310
|
+
avoidBlockScalars = false,
|
|
8311
|
+
logger
|
|
8210
8312
|
}) {
|
|
8211
8313
|
this.baseDir = baseDir;
|
|
8212
8314
|
this.dryRun = dryRun;
|
|
8213
8315
|
this.avoidBlockScalars = avoidBlockScalars;
|
|
8316
|
+
this.logger = logger;
|
|
8214
8317
|
}
|
|
8215
8318
|
/**
|
|
8216
8319
|
* Return tool targets that this feature supports.
|
|
@@ -8235,7 +8338,7 @@ var DirFeatureProcessor = class {
|
|
|
8235
8338
|
const mainFile = aiDir.getMainFile();
|
|
8236
8339
|
let mainFileContent;
|
|
8237
8340
|
if (mainFile) {
|
|
8238
|
-
const mainFilePath = (0,
|
|
8341
|
+
const mainFilePath = (0, import_node_path63.join)(dirPath, mainFile.name);
|
|
8239
8342
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
8240
8343
|
avoidBlockScalars: this.avoidBlockScalars
|
|
8241
8344
|
});
|
|
@@ -8251,7 +8354,7 @@ var DirFeatureProcessor = class {
|
|
|
8251
8354
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
8252
8355
|
otherFileContents.push(contentWithNewline);
|
|
8253
8356
|
if (!dirHasChanges) {
|
|
8254
|
-
const filePath = (0,
|
|
8357
|
+
const filePath = (0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath);
|
|
8255
8358
|
const existingContent = await readFileContentOrNull(filePath);
|
|
8256
8359
|
if (existingContent !== contentWithNewline) {
|
|
8257
8360
|
dirHasChanges = true;
|
|
@@ -8263,24 +8366,26 @@ var DirFeatureProcessor = class {
|
|
|
8263
8366
|
}
|
|
8264
8367
|
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
8265
8368
|
if (this.dryRun) {
|
|
8266
|
-
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8369
|
+
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8267
8370
|
if (mainFile) {
|
|
8268
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
8269
|
-
changedPaths.push((0,
|
|
8371
|
+
this.logger.info(`[DRY RUN] Would write: ${(0, import_node_path63.join)(dirPath, mainFile.name)}`);
|
|
8372
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, mainFile.name));
|
|
8270
8373
|
}
|
|
8271
8374
|
for (const file of otherFiles) {
|
|
8272
|
-
logger.info(
|
|
8273
|
-
|
|
8375
|
+
this.logger.info(
|
|
8376
|
+
`[DRY RUN] Would write: ${(0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath)}`
|
|
8377
|
+
);
|
|
8378
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
8274
8379
|
}
|
|
8275
8380
|
} else {
|
|
8276
8381
|
await ensureDir(dirPath);
|
|
8277
8382
|
if (mainFile && mainFileContent) {
|
|
8278
|
-
const mainFilePath = (0,
|
|
8383
|
+
const mainFilePath = (0, import_node_path63.join)(dirPath, mainFile.name);
|
|
8279
8384
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
8280
|
-
changedPaths.push((0,
|
|
8385
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, mainFile.name));
|
|
8281
8386
|
}
|
|
8282
8387
|
for (const [i, file] of otherFiles.entries()) {
|
|
8283
|
-
const filePath = (0,
|
|
8388
|
+
const filePath = (0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath);
|
|
8284
8389
|
const content = otherFileContents[i];
|
|
8285
8390
|
if (content === void 0) {
|
|
8286
8391
|
throw new Error(
|
|
@@ -8288,7 +8393,7 @@ var DirFeatureProcessor = class {
|
|
|
8288
8393
|
);
|
|
8289
8394
|
}
|
|
8290
8395
|
await writeFileContent(filePath, content);
|
|
8291
|
-
changedPaths.push((0,
|
|
8396
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
8292
8397
|
}
|
|
8293
8398
|
}
|
|
8294
8399
|
changedCount++;
|
|
@@ -8310,7 +8415,7 @@ var DirFeatureProcessor = class {
|
|
|
8310
8415
|
for (const aiDir of orphanDirs) {
|
|
8311
8416
|
const dirPath = aiDir.getDirPath();
|
|
8312
8417
|
if (this.dryRun) {
|
|
8313
|
-
logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8418
|
+
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8314
8419
|
} else {
|
|
8315
8420
|
await removeDirectory(dirPath);
|
|
8316
8421
|
}
|
|
@@ -8320,11 +8425,11 @@ var DirFeatureProcessor = class {
|
|
|
8320
8425
|
};
|
|
8321
8426
|
|
|
8322
8427
|
// src/features/skills/agentsskills-skill.ts
|
|
8323
|
-
var
|
|
8428
|
+
var import_node_path65 = require("path");
|
|
8324
8429
|
var import_mini26 = require("zod/mini");
|
|
8325
8430
|
|
|
8326
8431
|
// src/features/skills/rulesync-skill.ts
|
|
8327
|
-
var
|
|
8432
|
+
var import_node_path64 = require("path");
|
|
8328
8433
|
var import_mini25 = require("zod/mini");
|
|
8329
8434
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini25.z.looseObject({
|
|
8330
8435
|
name: import_mini25.z.string(),
|
|
@@ -8393,7 +8498,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8393
8498
|
}
|
|
8394
8499
|
getFrontmatter() {
|
|
8395
8500
|
if (!this.mainFile?.frontmatter) {
|
|
8396
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
8501
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path64.join)(this.relativeDirPath, this.dirName)}`);
|
|
8397
8502
|
}
|
|
8398
8503
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8399
8504
|
return result;
|
|
@@ -8419,8 +8524,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8419
8524
|
dirName,
|
|
8420
8525
|
global = false
|
|
8421
8526
|
}) {
|
|
8422
|
-
const skillDirPath = (0,
|
|
8423
|
-
const skillFilePath = (0,
|
|
8527
|
+
const skillDirPath = (0, import_node_path64.join)(baseDir, relativeDirPath, dirName);
|
|
8528
|
+
const skillFilePath = (0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME);
|
|
8424
8529
|
if (!await fileExists(skillFilePath)) {
|
|
8425
8530
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8426
8531
|
}
|
|
@@ -8457,7 +8562,7 @@ var AgentsSkillsSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
|
8457
8562
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8458
8563
|
constructor({
|
|
8459
8564
|
baseDir = process.cwd(),
|
|
8460
|
-
relativeDirPath = (0,
|
|
8565
|
+
relativeDirPath = (0, import_node_path65.join)(".agents", "skills"),
|
|
8461
8566
|
dirName,
|
|
8462
8567
|
frontmatter,
|
|
8463
8568
|
body,
|
|
@@ -8489,7 +8594,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8489
8594
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8490
8595
|
}
|
|
8491
8596
|
return {
|
|
8492
|
-
relativeDirPath: (0,
|
|
8597
|
+
relativeDirPath: (0, import_node_path65.join)(".agents", "skills")
|
|
8493
8598
|
};
|
|
8494
8599
|
}
|
|
8495
8600
|
getFrontmatter() {
|
|
@@ -8569,9 +8674,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8569
8674
|
});
|
|
8570
8675
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8571
8676
|
if (!result.success) {
|
|
8572
|
-
const skillDirPath = (0,
|
|
8677
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8573
8678
|
throw new Error(
|
|
8574
|
-
`Invalid frontmatter in ${(0,
|
|
8679
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8575
8680
|
);
|
|
8576
8681
|
}
|
|
8577
8682
|
return new _AgentsSkillsSkill({
|
|
@@ -8606,7 +8711,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8606
8711
|
};
|
|
8607
8712
|
|
|
8608
8713
|
// src/features/skills/antigravity-skill.ts
|
|
8609
|
-
var
|
|
8714
|
+
var import_node_path66 = require("path");
|
|
8610
8715
|
var import_mini27 = require("zod/mini");
|
|
8611
8716
|
var AntigravitySkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8612
8717
|
name: import_mini27.z.string(),
|
|
@@ -8615,7 +8720,7 @@ var AntigravitySkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
|
8615
8720
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8616
8721
|
constructor({
|
|
8617
8722
|
baseDir = process.cwd(),
|
|
8618
|
-
relativeDirPath = (0,
|
|
8723
|
+
relativeDirPath = (0, import_node_path66.join)(".agent", "skills"),
|
|
8619
8724
|
dirName,
|
|
8620
8725
|
frontmatter,
|
|
8621
8726
|
body,
|
|
@@ -8647,11 +8752,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8647
8752
|
} = {}) {
|
|
8648
8753
|
if (global) {
|
|
8649
8754
|
return {
|
|
8650
|
-
relativeDirPath: (0,
|
|
8755
|
+
relativeDirPath: (0, import_node_path66.join)(".gemini", "antigravity", "skills")
|
|
8651
8756
|
};
|
|
8652
8757
|
}
|
|
8653
8758
|
return {
|
|
8654
|
-
relativeDirPath: (0,
|
|
8759
|
+
relativeDirPath: (0, import_node_path66.join)(".agent", "skills")
|
|
8655
8760
|
};
|
|
8656
8761
|
}
|
|
8657
8762
|
getFrontmatter() {
|
|
@@ -8731,9 +8836,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8731
8836
|
});
|
|
8732
8837
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8733
8838
|
if (!result.success) {
|
|
8734
|
-
const skillDirPath = (0,
|
|
8839
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8735
8840
|
throw new Error(
|
|
8736
|
-
`Invalid frontmatter in ${(0,
|
|
8841
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8737
8842
|
);
|
|
8738
8843
|
}
|
|
8739
8844
|
return new _AntigravitySkill({
|
|
@@ -8767,7 +8872,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8767
8872
|
};
|
|
8768
8873
|
|
|
8769
8874
|
// src/features/skills/claudecode-skill.ts
|
|
8770
|
-
var
|
|
8875
|
+
var import_node_path67 = require("path");
|
|
8771
8876
|
var import_mini28 = require("zod/mini");
|
|
8772
8877
|
var ClaudecodeSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8773
8878
|
name: import_mini28.z.string(),
|
|
@@ -8779,7 +8884,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
|
8779
8884
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8780
8885
|
constructor({
|
|
8781
8886
|
baseDir = process.cwd(),
|
|
8782
|
-
relativeDirPath = (0,
|
|
8887
|
+
relativeDirPath = (0, import_node_path67.join)(".claude", "skills"),
|
|
8783
8888
|
dirName,
|
|
8784
8889
|
frontmatter,
|
|
8785
8890
|
body,
|
|
@@ -8810,7 +8915,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8810
8915
|
global: _global = false
|
|
8811
8916
|
} = {}) {
|
|
8812
8917
|
return {
|
|
8813
|
-
relativeDirPath: (0,
|
|
8918
|
+
relativeDirPath: (0, import_node_path67.join)(".claude", "skills")
|
|
8814
8919
|
};
|
|
8815
8920
|
}
|
|
8816
8921
|
getFrontmatter() {
|
|
@@ -8907,9 +9012,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8907
9012
|
});
|
|
8908
9013
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8909
9014
|
if (!result.success) {
|
|
8910
|
-
const skillDirPath = (0,
|
|
9015
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8911
9016
|
throw new Error(
|
|
8912
|
-
`Invalid frontmatter in ${(0,
|
|
9017
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8913
9018
|
);
|
|
8914
9019
|
}
|
|
8915
9020
|
return new _ClaudecodeSkill({
|
|
@@ -8943,7 +9048,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8943
9048
|
};
|
|
8944
9049
|
|
|
8945
9050
|
// src/features/skills/cline-skill.ts
|
|
8946
|
-
var
|
|
9051
|
+
var import_node_path68 = require("path");
|
|
8947
9052
|
var import_mini29 = require("zod/mini");
|
|
8948
9053
|
var ClineSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
8949
9054
|
name: import_mini29.z.string(),
|
|
@@ -8952,7 +9057,7 @@ var ClineSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
|
8952
9057
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
8953
9058
|
constructor({
|
|
8954
9059
|
baseDir = process.cwd(),
|
|
8955
|
-
relativeDirPath = (0,
|
|
9060
|
+
relativeDirPath = (0, import_node_path68.join)(".cline", "skills"),
|
|
8956
9061
|
dirName,
|
|
8957
9062
|
frontmatter,
|
|
8958
9063
|
body,
|
|
@@ -8981,7 +9086,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8981
9086
|
}
|
|
8982
9087
|
static getSettablePaths(_options = {}) {
|
|
8983
9088
|
return {
|
|
8984
|
-
relativeDirPath: (0,
|
|
9089
|
+
relativeDirPath: (0, import_node_path68.join)(".cline", "skills")
|
|
8985
9090
|
};
|
|
8986
9091
|
}
|
|
8987
9092
|
getFrontmatter() {
|
|
@@ -9069,13 +9174,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9069
9174
|
});
|
|
9070
9175
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9071
9176
|
if (!result.success) {
|
|
9072
|
-
const skillDirPath = (0,
|
|
9177
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9073
9178
|
throw new Error(
|
|
9074
|
-
`Invalid frontmatter in ${(0,
|
|
9179
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9075
9180
|
);
|
|
9076
9181
|
}
|
|
9077
9182
|
if (result.data.name !== loaded.dirName) {
|
|
9078
|
-
const skillFilePath = (0,
|
|
9183
|
+
const skillFilePath = (0, import_node_path68.join)(
|
|
9079
9184
|
loaded.baseDir,
|
|
9080
9185
|
loaded.relativeDirPath,
|
|
9081
9186
|
loaded.dirName,
|
|
@@ -9116,7 +9221,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9116
9221
|
};
|
|
9117
9222
|
|
|
9118
9223
|
// src/features/skills/codexcli-skill.ts
|
|
9119
|
-
var
|
|
9224
|
+
var import_node_path69 = require("path");
|
|
9120
9225
|
var import_mini30 = require("zod/mini");
|
|
9121
9226
|
var CodexCliSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
9122
9227
|
name: import_mini30.z.string(),
|
|
@@ -9130,7 +9235,7 @@ var CodexCliSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
|
9130
9235
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
9131
9236
|
constructor({
|
|
9132
9237
|
baseDir = process.cwd(),
|
|
9133
|
-
relativeDirPath = (0,
|
|
9238
|
+
relativeDirPath = (0, import_node_path69.join)(".codex", "skills"),
|
|
9134
9239
|
dirName,
|
|
9135
9240
|
frontmatter,
|
|
9136
9241
|
body,
|
|
@@ -9161,7 +9266,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9161
9266
|
global: _global = false
|
|
9162
9267
|
} = {}) {
|
|
9163
9268
|
return {
|
|
9164
|
-
relativeDirPath: (0,
|
|
9269
|
+
relativeDirPath: (0, import_node_path69.join)(".codex", "skills")
|
|
9165
9270
|
};
|
|
9166
9271
|
}
|
|
9167
9272
|
getFrontmatter() {
|
|
@@ -9251,9 +9356,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9251
9356
|
});
|
|
9252
9357
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9253
9358
|
if (!result.success) {
|
|
9254
|
-
const skillDirPath = (0,
|
|
9359
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9255
9360
|
throw new Error(
|
|
9256
|
-
`Invalid frontmatter in ${(0,
|
|
9361
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9257
9362
|
);
|
|
9258
9363
|
}
|
|
9259
9364
|
return new _CodexCliSkill({
|
|
@@ -9287,7 +9392,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9287
9392
|
};
|
|
9288
9393
|
|
|
9289
9394
|
// src/features/skills/copilot-skill.ts
|
|
9290
|
-
var
|
|
9395
|
+
var import_node_path70 = require("path");
|
|
9291
9396
|
var import_mini31 = require("zod/mini");
|
|
9292
9397
|
var CopilotSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9293
9398
|
name: import_mini31.z.string(),
|
|
@@ -9297,7 +9402,7 @@ var CopilotSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
|
9297
9402
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
9298
9403
|
constructor({
|
|
9299
9404
|
baseDir = process.cwd(),
|
|
9300
|
-
relativeDirPath = (0,
|
|
9405
|
+
relativeDirPath = (0, import_node_path70.join)(".github", "skills"),
|
|
9301
9406
|
dirName,
|
|
9302
9407
|
frontmatter,
|
|
9303
9408
|
body,
|
|
@@ -9329,7 +9434,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9329
9434
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9330
9435
|
}
|
|
9331
9436
|
return {
|
|
9332
|
-
relativeDirPath: (0,
|
|
9437
|
+
relativeDirPath: (0, import_node_path70.join)(".github", "skills")
|
|
9333
9438
|
};
|
|
9334
9439
|
}
|
|
9335
9440
|
getFrontmatter() {
|
|
@@ -9415,9 +9520,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9415
9520
|
});
|
|
9416
9521
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9417
9522
|
if (!result.success) {
|
|
9418
|
-
const skillDirPath = (0,
|
|
9523
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9419
9524
|
throw new Error(
|
|
9420
|
-
`Invalid frontmatter in ${(0,
|
|
9525
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9421
9526
|
);
|
|
9422
9527
|
}
|
|
9423
9528
|
return new _CopilotSkill({
|
|
@@ -9452,7 +9557,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9452
9557
|
};
|
|
9453
9558
|
|
|
9454
9559
|
// src/features/skills/cursor-skill.ts
|
|
9455
|
-
var
|
|
9560
|
+
var import_node_path71 = require("path");
|
|
9456
9561
|
var import_mini32 = require("zod/mini");
|
|
9457
9562
|
var CursorSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9458
9563
|
name: import_mini32.z.string(),
|
|
@@ -9461,7 +9566,7 @@ var CursorSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
|
9461
9566
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9462
9567
|
constructor({
|
|
9463
9568
|
baseDir = process.cwd(),
|
|
9464
|
-
relativeDirPath = (0,
|
|
9569
|
+
relativeDirPath = (0, import_node_path71.join)(".cursor", "skills"),
|
|
9465
9570
|
dirName,
|
|
9466
9571
|
frontmatter,
|
|
9467
9572
|
body,
|
|
@@ -9490,7 +9595,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9490
9595
|
}
|
|
9491
9596
|
static getSettablePaths(_options) {
|
|
9492
9597
|
return {
|
|
9493
|
-
relativeDirPath: (0,
|
|
9598
|
+
relativeDirPath: (0, import_node_path71.join)(".cursor", "skills")
|
|
9494
9599
|
};
|
|
9495
9600
|
}
|
|
9496
9601
|
getFrontmatter() {
|
|
@@ -9570,9 +9675,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9570
9675
|
});
|
|
9571
9676
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9572
9677
|
if (!result.success) {
|
|
9573
|
-
const skillDirPath = (0,
|
|
9678
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9574
9679
|
throw new Error(
|
|
9575
|
-
`Invalid frontmatter in ${(0,
|
|
9680
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9576
9681
|
);
|
|
9577
9682
|
}
|
|
9578
9683
|
return new _CursorSkill({
|
|
@@ -9607,7 +9712,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9607
9712
|
};
|
|
9608
9713
|
|
|
9609
9714
|
// src/features/skills/geminicli-skill.ts
|
|
9610
|
-
var
|
|
9715
|
+
var import_node_path72 = require("path");
|
|
9611
9716
|
var import_mini33 = require("zod/mini");
|
|
9612
9717
|
var GeminiCliSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9613
9718
|
name: import_mini33.z.string(),
|
|
@@ -9647,7 +9752,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9647
9752
|
global: _global = false
|
|
9648
9753
|
} = {}) {
|
|
9649
9754
|
return {
|
|
9650
|
-
relativeDirPath: (0,
|
|
9755
|
+
relativeDirPath: (0, import_node_path72.join)(".gemini", "skills")
|
|
9651
9756
|
};
|
|
9652
9757
|
}
|
|
9653
9758
|
getFrontmatter() {
|
|
@@ -9727,9 +9832,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9727
9832
|
});
|
|
9728
9833
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9729
9834
|
if (!result.success) {
|
|
9730
|
-
const skillDirPath = (0,
|
|
9835
|
+
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9731
9836
|
throw new Error(
|
|
9732
|
-
`Invalid frontmatter in ${(0,
|
|
9837
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9733
9838
|
);
|
|
9734
9839
|
}
|
|
9735
9840
|
return new _GeminiCliSkill({
|
|
@@ -9764,7 +9869,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9764
9869
|
};
|
|
9765
9870
|
|
|
9766
9871
|
// src/features/skills/junie-skill.ts
|
|
9767
|
-
var
|
|
9872
|
+
var import_node_path73 = require("path");
|
|
9768
9873
|
var import_mini34 = require("zod/mini");
|
|
9769
9874
|
var JunieSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9770
9875
|
name: import_mini34.z.string(),
|
|
@@ -9773,7 +9878,7 @@ var JunieSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
|
9773
9878
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9774
9879
|
constructor({
|
|
9775
9880
|
baseDir = process.cwd(),
|
|
9776
|
-
relativeDirPath = (0,
|
|
9881
|
+
relativeDirPath = (0, import_node_path73.join)(".junie", "skills"),
|
|
9777
9882
|
dirName,
|
|
9778
9883
|
frontmatter,
|
|
9779
9884
|
body,
|
|
@@ -9805,7 +9910,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9805
9910
|
throw new Error("JunieSkill does not support global mode.");
|
|
9806
9911
|
}
|
|
9807
9912
|
return {
|
|
9808
|
-
relativeDirPath: (0,
|
|
9913
|
+
relativeDirPath: (0, import_node_path73.join)(".junie", "skills")
|
|
9809
9914
|
};
|
|
9810
9915
|
}
|
|
9811
9916
|
getFrontmatter() {
|
|
@@ -9892,13 +9997,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9892
9997
|
});
|
|
9893
9998
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9894
9999
|
if (!result.success) {
|
|
9895
|
-
const skillDirPath = (0,
|
|
10000
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9896
10001
|
throw new Error(
|
|
9897
|
-
`Invalid frontmatter in ${(0,
|
|
10002
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9898
10003
|
);
|
|
9899
10004
|
}
|
|
9900
10005
|
if (result.data.name !== loaded.dirName) {
|
|
9901
|
-
const skillFilePath = (0,
|
|
10006
|
+
const skillFilePath = (0, import_node_path73.join)(
|
|
9902
10007
|
loaded.baseDir,
|
|
9903
10008
|
loaded.relativeDirPath,
|
|
9904
10009
|
loaded.dirName,
|
|
@@ -9940,7 +10045,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9940
10045
|
};
|
|
9941
10046
|
|
|
9942
10047
|
// src/features/skills/kilo-skill.ts
|
|
9943
|
-
var
|
|
10048
|
+
var import_node_path74 = require("path");
|
|
9944
10049
|
var import_mini35 = require("zod/mini");
|
|
9945
10050
|
var KiloSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
9946
10051
|
name: import_mini35.z.string(),
|
|
@@ -9949,7 +10054,7 @@ var KiloSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
|
9949
10054
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
9950
10055
|
constructor({
|
|
9951
10056
|
baseDir = process.cwd(),
|
|
9952
|
-
relativeDirPath = (0,
|
|
10057
|
+
relativeDirPath = (0, import_node_path74.join)(".kilocode", "skills"),
|
|
9953
10058
|
dirName,
|
|
9954
10059
|
frontmatter,
|
|
9955
10060
|
body,
|
|
@@ -9980,7 +10085,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9980
10085
|
global: _global = false
|
|
9981
10086
|
} = {}) {
|
|
9982
10087
|
return {
|
|
9983
|
-
relativeDirPath: (0,
|
|
10088
|
+
relativeDirPath: (0, import_node_path74.join)(".kilocode", "skills")
|
|
9984
10089
|
};
|
|
9985
10090
|
}
|
|
9986
10091
|
getFrontmatter() {
|
|
@@ -10068,13 +10173,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10068
10173
|
});
|
|
10069
10174
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10070
10175
|
if (!result.success) {
|
|
10071
|
-
const skillDirPath = (0,
|
|
10176
|
+
const skillDirPath = (0, import_node_path74.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10072
10177
|
throw new Error(
|
|
10073
|
-
`Invalid frontmatter in ${(0,
|
|
10178
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10074
10179
|
);
|
|
10075
10180
|
}
|
|
10076
10181
|
if (result.data.name !== loaded.dirName) {
|
|
10077
|
-
const skillFilePath = (0,
|
|
10182
|
+
const skillFilePath = (0, import_node_path74.join)(
|
|
10078
10183
|
loaded.baseDir,
|
|
10079
10184
|
loaded.relativeDirPath,
|
|
10080
10185
|
loaded.dirName,
|
|
@@ -10115,7 +10220,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10115
10220
|
};
|
|
10116
10221
|
|
|
10117
10222
|
// src/features/skills/kiro-skill.ts
|
|
10118
|
-
var
|
|
10223
|
+
var import_node_path75 = require("path");
|
|
10119
10224
|
var import_mini36 = require("zod/mini");
|
|
10120
10225
|
var KiroSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
10121
10226
|
name: import_mini36.z.string(),
|
|
@@ -10124,7 +10229,7 @@ var KiroSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
|
10124
10229
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
10125
10230
|
constructor({
|
|
10126
10231
|
baseDir = process.cwd(),
|
|
10127
|
-
relativeDirPath = (0,
|
|
10232
|
+
relativeDirPath = (0, import_node_path75.join)(".kiro", "skills"),
|
|
10128
10233
|
dirName,
|
|
10129
10234
|
frontmatter,
|
|
10130
10235
|
body,
|
|
@@ -10156,7 +10261,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10156
10261
|
throw new Error("KiroSkill does not support global mode.");
|
|
10157
10262
|
}
|
|
10158
10263
|
return {
|
|
10159
|
-
relativeDirPath: (0,
|
|
10264
|
+
relativeDirPath: (0, import_node_path75.join)(".kiro", "skills")
|
|
10160
10265
|
};
|
|
10161
10266
|
}
|
|
10162
10267
|
getFrontmatter() {
|
|
@@ -10244,13 +10349,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10244
10349
|
});
|
|
10245
10350
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10246
10351
|
if (!result.success) {
|
|
10247
|
-
const skillDirPath = (0,
|
|
10352
|
+
const skillDirPath = (0, import_node_path75.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10248
10353
|
throw new Error(
|
|
10249
|
-
`Invalid frontmatter in ${(0,
|
|
10354
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10250
10355
|
);
|
|
10251
10356
|
}
|
|
10252
10357
|
if (result.data.name !== loaded.dirName) {
|
|
10253
|
-
const skillFilePath = (0,
|
|
10358
|
+
const skillFilePath = (0, import_node_path75.join)(
|
|
10254
10359
|
loaded.baseDir,
|
|
10255
10360
|
loaded.relativeDirPath,
|
|
10256
10361
|
loaded.dirName,
|
|
@@ -10292,7 +10397,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10292
10397
|
};
|
|
10293
10398
|
|
|
10294
10399
|
// src/features/skills/opencode-skill.ts
|
|
10295
|
-
var
|
|
10400
|
+
var import_node_path76 = require("path");
|
|
10296
10401
|
var import_mini37 = require("zod/mini");
|
|
10297
10402
|
var OpenCodeSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10298
10403
|
name: import_mini37.z.string(),
|
|
@@ -10302,7 +10407,7 @@ var OpenCodeSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
|
10302
10407
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
10303
10408
|
constructor({
|
|
10304
10409
|
baseDir = process.cwd(),
|
|
10305
|
-
relativeDirPath = (0,
|
|
10410
|
+
relativeDirPath = (0, import_node_path76.join)(".opencode", "skill"),
|
|
10306
10411
|
dirName,
|
|
10307
10412
|
frontmatter,
|
|
10308
10413
|
body,
|
|
@@ -10331,7 +10436,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10331
10436
|
}
|
|
10332
10437
|
static getSettablePaths({ global = false } = {}) {
|
|
10333
10438
|
return {
|
|
10334
|
-
relativeDirPath: global ? (0,
|
|
10439
|
+
relativeDirPath: global ? (0, import_node_path76.join)(".config", "opencode", "skill") : (0, import_node_path76.join)(".opencode", "skill")
|
|
10335
10440
|
};
|
|
10336
10441
|
}
|
|
10337
10442
|
getFrontmatter() {
|
|
@@ -10417,9 +10522,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10417
10522
|
});
|
|
10418
10523
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10419
10524
|
if (!result.success) {
|
|
10420
|
-
const skillDirPath = (0,
|
|
10525
|
+
const skillDirPath = (0, import_node_path76.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10421
10526
|
throw new Error(
|
|
10422
|
-
`Invalid frontmatter in ${(0,
|
|
10527
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10423
10528
|
);
|
|
10424
10529
|
}
|
|
10425
10530
|
return new _OpenCodeSkill({
|
|
@@ -10453,7 +10558,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10453
10558
|
};
|
|
10454
10559
|
|
|
10455
10560
|
// src/features/skills/replit-skill.ts
|
|
10456
|
-
var
|
|
10561
|
+
var import_node_path77 = require("path");
|
|
10457
10562
|
var import_mini38 = require("zod/mini");
|
|
10458
10563
|
var ReplitSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
10459
10564
|
name: import_mini38.z.string(),
|
|
@@ -10462,7 +10567,7 @@ var ReplitSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
|
10462
10567
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
10463
10568
|
constructor({
|
|
10464
10569
|
baseDir = process.cwd(),
|
|
10465
|
-
relativeDirPath = (0,
|
|
10570
|
+
relativeDirPath = (0, import_node_path77.join)(".agents", "skills"),
|
|
10466
10571
|
dirName,
|
|
10467
10572
|
frontmatter,
|
|
10468
10573
|
body,
|
|
@@ -10494,7 +10599,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10494
10599
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10495
10600
|
}
|
|
10496
10601
|
return {
|
|
10497
|
-
relativeDirPath: (0,
|
|
10602
|
+
relativeDirPath: (0, import_node_path77.join)(".agents", "skills")
|
|
10498
10603
|
};
|
|
10499
10604
|
}
|
|
10500
10605
|
getFrontmatter() {
|
|
@@ -10574,9 +10679,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10574
10679
|
});
|
|
10575
10680
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10576
10681
|
if (!result.success) {
|
|
10577
|
-
const skillDirPath = (0,
|
|
10682
|
+
const skillDirPath = (0, import_node_path77.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10578
10683
|
throw new Error(
|
|
10579
|
-
`Invalid frontmatter in ${(0,
|
|
10684
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10580
10685
|
);
|
|
10581
10686
|
}
|
|
10582
10687
|
return new _ReplitSkill({
|
|
@@ -10611,7 +10716,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10611
10716
|
};
|
|
10612
10717
|
|
|
10613
10718
|
// src/features/skills/roo-skill.ts
|
|
10614
|
-
var
|
|
10719
|
+
var import_node_path78 = require("path");
|
|
10615
10720
|
var import_mini39 = require("zod/mini");
|
|
10616
10721
|
var RooSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
10617
10722
|
name: import_mini39.z.string(),
|
|
@@ -10620,7 +10725,7 @@ var RooSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
|
10620
10725
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10621
10726
|
constructor({
|
|
10622
10727
|
baseDir = process.cwd(),
|
|
10623
|
-
relativeDirPath = (0,
|
|
10728
|
+
relativeDirPath = (0, import_node_path78.join)(".roo", "skills"),
|
|
10624
10729
|
dirName,
|
|
10625
10730
|
frontmatter,
|
|
10626
10731
|
body,
|
|
@@ -10651,7 +10756,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10651
10756
|
global: _global = false
|
|
10652
10757
|
} = {}) {
|
|
10653
10758
|
return {
|
|
10654
|
-
relativeDirPath: (0,
|
|
10759
|
+
relativeDirPath: (0, import_node_path78.join)(".roo", "skills")
|
|
10655
10760
|
};
|
|
10656
10761
|
}
|
|
10657
10762
|
getFrontmatter() {
|
|
@@ -10739,13 +10844,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10739
10844
|
});
|
|
10740
10845
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10741
10846
|
if (!result.success) {
|
|
10742
|
-
const skillDirPath = (0,
|
|
10847
|
+
const skillDirPath = (0, import_node_path78.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10743
10848
|
throw new Error(
|
|
10744
|
-
`Invalid frontmatter in ${(0,
|
|
10849
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10745
10850
|
);
|
|
10746
10851
|
}
|
|
10747
10852
|
if (result.data.name !== loaded.dirName) {
|
|
10748
|
-
const skillFilePath = (0,
|
|
10853
|
+
const skillFilePath = (0, import_node_path78.join)(
|
|
10749
10854
|
loaded.baseDir,
|
|
10750
10855
|
loaded.relativeDirPath,
|
|
10751
10856
|
loaded.dirName,
|
|
@@ -10786,17 +10891,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10786
10891
|
};
|
|
10787
10892
|
|
|
10788
10893
|
// src/features/skills/skills-utils.ts
|
|
10789
|
-
var
|
|
10894
|
+
var import_node_path79 = require("path");
|
|
10790
10895
|
async function getLocalSkillDirNames(baseDir) {
|
|
10791
|
-
const skillsDir = (0,
|
|
10896
|
+
const skillsDir = (0, import_node_path79.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10792
10897
|
const names = /* @__PURE__ */ new Set();
|
|
10793
10898
|
if (!await directoryExists(skillsDir)) {
|
|
10794
10899
|
return names;
|
|
10795
10900
|
}
|
|
10796
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10901
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path79.join)(skillsDir, "*"), { type: "dir" });
|
|
10797
10902
|
for (const dirPath of dirPaths) {
|
|
10798
|
-
const name = (0,
|
|
10799
|
-
if (name === (0,
|
|
10903
|
+
const name = (0, import_node_path79.basename)(dirPath);
|
|
10904
|
+
if (name === (0, import_node_path79.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
10800
10905
|
names.add(name);
|
|
10801
10906
|
}
|
|
10802
10907
|
return names;
|
|
@@ -10975,9 +11080,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10975
11080
|
toolTarget,
|
|
10976
11081
|
global = false,
|
|
10977
11082
|
getFactory = defaultGetFactory4,
|
|
10978
|
-
dryRun = false
|
|
11083
|
+
dryRun = false,
|
|
11084
|
+
logger
|
|
10979
11085
|
}) {
|
|
10980
|
-
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor" });
|
|
11086
|
+
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor", logger });
|
|
10981
11087
|
const result = SkillsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
10982
11088
|
if (!result.success) {
|
|
10983
11089
|
throw new Error(
|
|
@@ -11010,7 +11116,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11010
11116
|
const rulesyncSkills = [];
|
|
11011
11117
|
for (const toolSkill of toolSkills) {
|
|
11012
11118
|
if (toolSkill instanceof SimulatedSkill) {
|
|
11013
|
-
logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11119
|
+
this.logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11014
11120
|
continue;
|
|
11015
11121
|
}
|
|
11016
11122
|
rulesyncSkills.push(toolSkill.toRulesyncSkill());
|
|
@@ -11031,14 +11137,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11031
11137
|
)
|
|
11032
11138
|
);
|
|
11033
11139
|
const localSkillNames = new Set(localDirNames);
|
|
11034
|
-
const curatedDirPath = (0,
|
|
11140
|
+
const curatedDirPath = (0, import_node_path80.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
11035
11141
|
let curatedSkills = [];
|
|
11036
11142
|
if (await directoryExists(curatedDirPath)) {
|
|
11037
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
11038
|
-
const curatedDirNames = curatedDirPaths.map((path3) => (0,
|
|
11143
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path80.join)(curatedDirPath, "*"), { type: "dir" });
|
|
11144
|
+
const curatedDirNames = curatedDirPaths.map((path3) => (0, import_node_path80.basename)(path3));
|
|
11039
11145
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
11040
11146
|
if (localSkillNames.has(name)) {
|
|
11041
|
-
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11147
|
+
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11042
11148
|
return false;
|
|
11043
11149
|
}
|
|
11044
11150
|
return true;
|
|
@@ -11056,7 +11162,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11056
11162
|
);
|
|
11057
11163
|
}
|
|
11058
11164
|
const allSkills = [...localSkills, ...curatedSkills];
|
|
11059
|
-
logger.debug(
|
|
11165
|
+
this.logger.debug(
|
|
11060
11166
|
`Successfully loaded ${allSkills.length} rulesync skills (${localSkills.length} local, ${curatedSkills.length} curated)`
|
|
11061
11167
|
);
|
|
11062
11168
|
return allSkills;
|
|
@@ -11068,9 +11174,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11068
11174
|
async loadToolDirs() {
|
|
11069
11175
|
const factory = this.getFactory(this.toolTarget);
|
|
11070
11176
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11071
|
-
const skillsDirPath = (0,
|
|
11072
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
11073
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
11177
|
+
const skillsDirPath = (0, import_node_path80.join)(this.baseDir, paths.relativeDirPath);
|
|
11178
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path80.join)(skillsDirPath, "*"), { type: "dir" });
|
|
11179
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path80.basename)(path3));
|
|
11074
11180
|
const toolSkills = await Promise.all(
|
|
11075
11181
|
dirNames.map(
|
|
11076
11182
|
(dirName) => factory.class.fromDir({
|
|
@@ -11080,15 +11186,15 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11080
11186
|
})
|
|
11081
11187
|
)
|
|
11082
11188
|
);
|
|
11083
|
-
logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11189
|
+
this.logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11084
11190
|
return toolSkills;
|
|
11085
11191
|
}
|
|
11086
11192
|
async loadToolDirsToDelete() {
|
|
11087
11193
|
const factory = this.getFactory(this.toolTarget);
|
|
11088
11194
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11089
|
-
const skillsDirPath = (0,
|
|
11090
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
11091
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
11195
|
+
const skillsDirPath = (0, import_node_path80.join)(this.baseDir, paths.relativeDirPath);
|
|
11196
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path80.join)(skillsDirPath, "*"), { type: "dir" });
|
|
11197
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path80.basename)(path3));
|
|
11092
11198
|
const toolSkills = dirNames.map(
|
|
11093
11199
|
(dirName) => factory.class.forDeletion({
|
|
11094
11200
|
baseDir: this.baseDir,
|
|
@@ -11097,7 +11203,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11097
11203
|
global: this.global
|
|
11098
11204
|
})
|
|
11099
11205
|
);
|
|
11100
|
-
logger.debug(
|
|
11206
|
+
this.logger.debug(
|
|
11101
11207
|
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
11102
11208
|
);
|
|
11103
11209
|
return toolSkills;
|
|
@@ -11149,10 +11255,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11149
11255
|
};
|
|
11150
11256
|
|
|
11151
11257
|
// src/features/subagents/agentsmd-subagent.ts
|
|
11152
|
-
var
|
|
11258
|
+
var import_node_path82 = require("path");
|
|
11153
11259
|
|
|
11154
11260
|
// src/features/subagents/simulated-subagent.ts
|
|
11155
|
-
var
|
|
11261
|
+
var import_node_path81 = require("path");
|
|
11156
11262
|
var import_mini41 = require("zod/mini");
|
|
11157
11263
|
|
|
11158
11264
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -11217,7 +11323,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11217
11323
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11218
11324
|
if (!result.success) {
|
|
11219
11325
|
throw new Error(
|
|
11220
|
-
`Invalid frontmatter in ${(0,
|
|
11326
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11221
11327
|
);
|
|
11222
11328
|
}
|
|
11223
11329
|
}
|
|
@@ -11268,7 +11374,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11268
11374
|
return {
|
|
11269
11375
|
success: false,
|
|
11270
11376
|
error: new Error(
|
|
11271
|
-
`Invalid frontmatter in ${(0,
|
|
11377
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11272
11378
|
)
|
|
11273
11379
|
};
|
|
11274
11380
|
}
|
|
@@ -11278,7 +11384,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11278
11384
|
relativeFilePath,
|
|
11279
11385
|
validate = true
|
|
11280
11386
|
}) {
|
|
11281
|
-
const filePath = (0,
|
|
11387
|
+
const filePath = (0, import_node_path81.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
11282
11388
|
const fileContent = await readFileContent(filePath);
|
|
11283
11389
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11284
11390
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11288,7 +11394,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11288
11394
|
return {
|
|
11289
11395
|
baseDir,
|
|
11290
11396
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
11291
|
-
relativeFilePath: (0,
|
|
11397
|
+
relativeFilePath: (0, import_node_path81.basename)(relativeFilePath),
|
|
11292
11398
|
frontmatter: result.data,
|
|
11293
11399
|
body: content.trim(),
|
|
11294
11400
|
validate
|
|
@@ -11314,7 +11420,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11314
11420
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
11315
11421
|
static getSettablePaths() {
|
|
11316
11422
|
return {
|
|
11317
|
-
relativeDirPath: (0,
|
|
11423
|
+
relativeDirPath: (0, import_node_path82.join)(".agents", "subagents")
|
|
11318
11424
|
};
|
|
11319
11425
|
}
|
|
11320
11426
|
static async fromFile(params) {
|
|
@@ -11337,11 +11443,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
11337
11443
|
};
|
|
11338
11444
|
|
|
11339
11445
|
// src/features/subagents/factorydroid-subagent.ts
|
|
11340
|
-
var
|
|
11446
|
+
var import_node_path83 = require("path");
|
|
11341
11447
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
11342
11448
|
static getSettablePaths(_options) {
|
|
11343
11449
|
return {
|
|
11344
|
-
relativeDirPath: (0,
|
|
11450
|
+
relativeDirPath: (0, import_node_path83.join)(".factory", "droids")
|
|
11345
11451
|
};
|
|
11346
11452
|
}
|
|
11347
11453
|
static async fromFile(params) {
|
|
@@ -11364,11 +11470,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
11364
11470
|
};
|
|
11365
11471
|
|
|
11366
11472
|
// src/features/subagents/geminicli-subagent.ts
|
|
11367
|
-
var
|
|
11473
|
+
var import_node_path84 = require("path");
|
|
11368
11474
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
11369
11475
|
static getSettablePaths() {
|
|
11370
11476
|
return {
|
|
11371
|
-
relativeDirPath: (0,
|
|
11477
|
+
relativeDirPath: (0, import_node_path84.join)(".gemini", "subagents")
|
|
11372
11478
|
};
|
|
11373
11479
|
}
|
|
11374
11480
|
static async fromFile(params) {
|
|
@@ -11391,11 +11497,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
11391
11497
|
};
|
|
11392
11498
|
|
|
11393
11499
|
// src/features/subagents/roo-subagent.ts
|
|
11394
|
-
var
|
|
11500
|
+
var import_node_path85 = require("path");
|
|
11395
11501
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
11396
11502
|
static getSettablePaths() {
|
|
11397
11503
|
return {
|
|
11398
|
-
relativeDirPath: (0,
|
|
11504
|
+
relativeDirPath: (0, import_node_path85.join)(".roo", "subagents")
|
|
11399
11505
|
};
|
|
11400
11506
|
}
|
|
11401
11507
|
static async fromFile(params) {
|
|
@@ -11418,15 +11524,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
11418
11524
|
};
|
|
11419
11525
|
|
|
11420
11526
|
// src/features/subagents/subagents-processor.ts
|
|
11421
|
-
var
|
|
11527
|
+
var import_node_path94 = require("path");
|
|
11422
11528
|
var import_mini50 = require("zod/mini");
|
|
11423
11529
|
|
|
11424
11530
|
// src/features/subagents/claudecode-subagent.ts
|
|
11425
|
-
var
|
|
11531
|
+
var import_node_path87 = require("path");
|
|
11426
11532
|
var import_mini43 = require("zod/mini");
|
|
11427
11533
|
|
|
11428
11534
|
// src/features/subagents/rulesync-subagent.ts
|
|
11429
|
-
var
|
|
11535
|
+
var import_node_path86 = require("path");
|
|
11430
11536
|
var import_mini42 = require("zod/mini");
|
|
11431
11537
|
var RulesyncSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
11432
11538
|
targets: import_mini42.z._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -11440,7 +11546,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11440
11546
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11441
11547
|
if (!parseResult.success && rest.validate !== false) {
|
|
11442
11548
|
throw new Error(
|
|
11443
|
-
`Invalid frontmatter in ${(0,
|
|
11549
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11444
11550
|
);
|
|
11445
11551
|
}
|
|
11446
11552
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -11473,7 +11579,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11473
11579
|
return {
|
|
11474
11580
|
success: false,
|
|
11475
11581
|
error: new Error(
|
|
11476
|
-
`Invalid frontmatter in ${(0,
|
|
11582
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11477
11583
|
)
|
|
11478
11584
|
};
|
|
11479
11585
|
}
|
|
@@ -11481,14 +11587,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11481
11587
|
static async fromFile({
|
|
11482
11588
|
relativeFilePath
|
|
11483
11589
|
}) {
|
|
11484
|
-
const filePath = (0,
|
|
11590
|
+
const filePath = (0, import_node_path86.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
11485
11591
|
const fileContent = await readFileContent(filePath);
|
|
11486
11592
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11487
11593
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11488
11594
|
if (!result.success) {
|
|
11489
11595
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
11490
11596
|
}
|
|
11491
|
-
const filename = (0,
|
|
11597
|
+
const filename = (0, import_node_path86.basename)(relativeFilePath);
|
|
11492
11598
|
return new _RulesyncSubagent({
|
|
11493
11599
|
baseDir: process.cwd(),
|
|
11494
11600
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -11516,7 +11622,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11516
11622
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11517
11623
|
if (!result.success) {
|
|
11518
11624
|
throw new Error(
|
|
11519
|
-
`Invalid frontmatter in ${(0,
|
|
11625
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11520
11626
|
);
|
|
11521
11627
|
}
|
|
11522
11628
|
}
|
|
@@ -11528,7 +11634,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11528
11634
|
}
|
|
11529
11635
|
static getSettablePaths(_options = {}) {
|
|
11530
11636
|
return {
|
|
11531
|
-
relativeDirPath: (0,
|
|
11637
|
+
relativeDirPath: (0, import_node_path87.join)(".claude", "agents")
|
|
11532
11638
|
};
|
|
11533
11639
|
}
|
|
11534
11640
|
getFrontmatter() {
|
|
@@ -11607,7 +11713,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11607
11713
|
return {
|
|
11608
11714
|
success: false,
|
|
11609
11715
|
error: new Error(
|
|
11610
|
-
`Invalid frontmatter in ${(0,
|
|
11716
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11611
11717
|
)
|
|
11612
11718
|
};
|
|
11613
11719
|
}
|
|
@@ -11625,7 +11731,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11625
11731
|
global = false
|
|
11626
11732
|
}) {
|
|
11627
11733
|
const paths = this.getSettablePaths({ global });
|
|
11628
|
-
const filePath = (0,
|
|
11734
|
+
const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11629
11735
|
const fileContent = await readFileContent(filePath);
|
|
11630
11736
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11631
11737
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11660,7 +11766,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11660
11766
|
};
|
|
11661
11767
|
|
|
11662
11768
|
// src/features/subagents/codexcli-subagent.ts
|
|
11663
|
-
var
|
|
11769
|
+
var import_node_path88 = require("path");
|
|
11664
11770
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
11665
11771
|
var import_mini44 = require("zod/mini");
|
|
11666
11772
|
var CodexCliSubagentTomlSchema = import_mini44.z.looseObject({
|
|
@@ -11680,7 +11786,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11680
11786
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11681
11787
|
} catch (error) {
|
|
11682
11788
|
throw new Error(
|
|
11683
|
-
`Invalid TOML in ${(0,
|
|
11789
|
+
`Invalid TOML in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11684
11790
|
{ cause: error }
|
|
11685
11791
|
);
|
|
11686
11792
|
}
|
|
@@ -11692,7 +11798,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11692
11798
|
}
|
|
11693
11799
|
static getSettablePaths(_options = {}) {
|
|
11694
11800
|
return {
|
|
11695
|
-
relativeDirPath: (0,
|
|
11801
|
+
relativeDirPath: (0, import_node_path88.join)(".codex", "agents")
|
|
11696
11802
|
};
|
|
11697
11803
|
}
|
|
11698
11804
|
getBody() {
|
|
@@ -11704,7 +11810,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11704
11810
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11705
11811
|
} catch (error) {
|
|
11706
11812
|
throw new Error(
|
|
11707
|
-
`Failed to parse TOML in ${(0,
|
|
11813
|
+
`Failed to parse TOML in ${(0, import_node_path88.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11708
11814
|
{ cause: error }
|
|
11709
11815
|
);
|
|
11710
11816
|
}
|
|
@@ -11785,7 +11891,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11785
11891
|
global = false
|
|
11786
11892
|
}) {
|
|
11787
11893
|
const paths = this.getSettablePaths({ global });
|
|
11788
|
-
const filePath = (0,
|
|
11894
|
+
const filePath = (0, import_node_path88.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11789
11895
|
const fileContent = await readFileContent(filePath);
|
|
11790
11896
|
const subagent = new _CodexCliSubagent({
|
|
11791
11897
|
baseDir,
|
|
@@ -11823,7 +11929,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11823
11929
|
};
|
|
11824
11930
|
|
|
11825
11931
|
// src/features/subagents/copilot-subagent.ts
|
|
11826
|
-
var
|
|
11932
|
+
var import_node_path89 = require("path");
|
|
11827
11933
|
var import_mini45 = require("zod/mini");
|
|
11828
11934
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11829
11935
|
var CopilotSubagentFrontmatterSchema = import_mini45.z.looseObject({
|
|
@@ -11849,7 +11955,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11849
11955
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11850
11956
|
if (!result.success) {
|
|
11851
11957
|
throw new Error(
|
|
11852
|
-
`Invalid frontmatter in ${(0,
|
|
11958
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11853
11959
|
);
|
|
11854
11960
|
}
|
|
11855
11961
|
}
|
|
@@ -11861,7 +11967,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11861
11967
|
}
|
|
11862
11968
|
static getSettablePaths(_options = {}) {
|
|
11863
11969
|
return {
|
|
11864
|
-
relativeDirPath: (0,
|
|
11970
|
+
relativeDirPath: (0, import_node_path89.join)(".github", "agents")
|
|
11865
11971
|
};
|
|
11866
11972
|
}
|
|
11867
11973
|
getFrontmatter() {
|
|
@@ -11935,7 +12041,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11935
12041
|
return {
|
|
11936
12042
|
success: false,
|
|
11937
12043
|
error: new Error(
|
|
11938
|
-
`Invalid frontmatter in ${(0,
|
|
12044
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11939
12045
|
)
|
|
11940
12046
|
};
|
|
11941
12047
|
}
|
|
@@ -11953,7 +12059,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11953
12059
|
global = false
|
|
11954
12060
|
}) {
|
|
11955
12061
|
const paths = this.getSettablePaths({ global });
|
|
11956
|
-
const filePath = (0,
|
|
12062
|
+
const filePath = (0, import_node_path89.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11957
12063
|
const fileContent = await readFileContent(filePath);
|
|
11958
12064
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11959
12065
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11989,7 +12095,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11989
12095
|
};
|
|
11990
12096
|
|
|
11991
12097
|
// src/features/subagents/cursor-subagent.ts
|
|
11992
|
-
var
|
|
12098
|
+
var import_node_path90 = require("path");
|
|
11993
12099
|
var import_mini46 = require("zod/mini");
|
|
11994
12100
|
var CursorSubagentFrontmatterSchema = import_mini46.z.looseObject({
|
|
11995
12101
|
name: import_mini46.z.string(),
|
|
@@ -12003,7 +12109,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12003
12109
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12004
12110
|
if (!result.success) {
|
|
12005
12111
|
throw new Error(
|
|
12006
|
-
`Invalid frontmatter in ${(0,
|
|
12112
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12007
12113
|
);
|
|
12008
12114
|
}
|
|
12009
12115
|
}
|
|
@@ -12015,7 +12121,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12015
12121
|
}
|
|
12016
12122
|
static getSettablePaths(_options = {}) {
|
|
12017
12123
|
return {
|
|
12018
|
-
relativeDirPath: (0,
|
|
12124
|
+
relativeDirPath: (0, import_node_path90.join)(".cursor", "agents")
|
|
12019
12125
|
};
|
|
12020
12126
|
}
|
|
12021
12127
|
getFrontmatter() {
|
|
@@ -12082,7 +12188,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12082
12188
|
return {
|
|
12083
12189
|
success: false,
|
|
12084
12190
|
error: new Error(
|
|
12085
|
-
`Invalid frontmatter in ${(0,
|
|
12191
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12086
12192
|
)
|
|
12087
12193
|
};
|
|
12088
12194
|
}
|
|
@@ -12100,7 +12206,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12100
12206
|
global = false
|
|
12101
12207
|
}) {
|
|
12102
12208
|
const paths = this.getSettablePaths({ global });
|
|
12103
|
-
const filePath = (0,
|
|
12209
|
+
const filePath = (0, import_node_path90.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12104
12210
|
const fileContent = await readFileContent(filePath);
|
|
12105
12211
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12106
12212
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12136,7 +12242,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12136
12242
|
};
|
|
12137
12243
|
|
|
12138
12244
|
// src/features/subagents/junie-subagent.ts
|
|
12139
|
-
var
|
|
12245
|
+
var import_node_path91 = require("path");
|
|
12140
12246
|
var import_mini47 = require("zod/mini");
|
|
12141
12247
|
var JunieSubagentFrontmatterSchema = import_mini47.z.looseObject({
|
|
12142
12248
|
name: import_mini47.z.optional(import_mini47.z.string()),
|
|
@@ -12150,7 +12256,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12150
12256
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12151
12257
|
if (!result.success) {
|
|
12152
12258
|
throw new Error(
|
|
12153
|
-
`Invalid frontmatter in ${(0,
|
|
12259
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12154
12260
|
);
|
|
12155
12261
|
}
|
|
12156
12262
|
}
|
|
@@ -12165,7 +12271,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12165
12271
|
throw new Error("JunieSubagent does not support global mode.");
|
|
12166
12272
|
}
|
|
12167
12273
|
return {
|
|
12168
|
-
relativeDirPath: (0,
|
|
12274
|
+
relativeDirPath: (0, import_node_path91.join)(".junie", "agents")
|
|
12169
12275
|
};
|
|
12170
12276
|
}
|
|
12171
12277
|
getFrontmatter() {
|
|
@@ -12241,7 +12347,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12241
12347
|
return {
|
|
12242
12348
|
success: false,
|
|
12243
12349
|
error: new Error(
|
|
12244
|
-
`Invalid frontmatter in ${(0,
|
|
12350
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12245
12351
|
)
|
|
12246
12352
|
};
|
|
12247
12353
|
}
|
|
@@ -12259,7 +12365,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12259
12365
|
global = false
|
|
12260
12366
|
}) {
|
|
12261
12367
|
const paths = this.getSettablePaths({ global });
|
|
12262
|
-
const filePath = (0,
|
|
12368
|
+
const filePath = (0, import_node_path91.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12263
12369
|
const fileContent = await readFileContent(filePath);
|
|
12264
12370
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12265
12371
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12294,7 +12400,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12294
12400
|
};
|
|
12295
12401
|
|
|
12296
12402
|
// src/features/subagents/kiro-subagent.ts
|
|
12297
|
-
var
|
|
12403
|
+
var import_node_path92 = require("path");
|
|
12298
12404
|
var import_mini48 = require("zod/mini");
|
|
12299
12405
|
var KiroCliSubagentJsonSchema = import_mini48.z.looseObject({
|
|
12300
12406
|
name: import_mini48.z.string(),
|
|
@@ -12321,7 +12427,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12321
12427
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
12322
12428
|
} catch (error) {
|
|
12323
12429
|
throw new Error(
|
|
12324
|
-
`Invalid JSON in ${(0,
|
|
12430
|
+
`Invalid JSON in ${(0, import_node_path92.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12325
12431
|
{ cause: error }
|
|
12326
12432
|
);
|
|
12327
12433
|
}
|
|
@@ -12333,7 +12439,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12333
12439
|
}
|
|
12334
12440
|
static getSettablePaths(_options = {}) {
|
|
12335
12441
|
return {
|
|
12336
|
-
relativeDirPath: (0,
|
|
12442
|
+
relativeDirPath: (0, import_node_path92.join)(".kiro", "agents")
|
|
12337
12443
|
};
|
|
12338
12444
|
}
|
|
12339
12445
|
getBody() {
|
|
@@ -12345,7 +12451,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12345
12451
|
parsed = JSON.parse(this.body);
|
|
12346
12452
|
} catch (error) {
|
|
12347
12453
|
throw new Error(
|
|
12348
|
-
`Failed to parse JSON in ${(0,
|
|
12454
|
+
`Failed to parse JSON in ${(0, import_node_path92.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12349
12455
|
{ cause: error }
|
|
12350
12456
|
);
|
|
12351
12457
|
}
|
|
@@ -12426,7 +12532,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12426
12532
|
global = false
|
|
12427
12533
|
}) {
|
|
12428
12534
|
const paths = this.getSettablePaths({ global });
|
|
12429
|
-
const filePath = (0,
|
|
12535
|
+
const filePath = (0, import_node_path92.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12430
12536
|
const fileContent = await readFileContent(filePath);
|
|
12431
12537
|
const subagent = new _KiroSubagent({
|
|
12432
12538
|
baseDir,
|
|
@@ -12464,7 +12570,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12464
12570
|
};
|
|
12465
12571
|
|
|
12466
12572
|
// src/features/subagents/opencode-subagent.ts
|
|
12467
|
-
var
|
|
12573
|
+
var import_node_path93 = require("path");
|
|
12468
12574
|
var import_mini49 = require("zod/mini");
|
|
12469
12575
|
var OpenCodeSubagentFrontmatterSchema = import_mini49.z.looseObject({
|
|
12470
12576
|
description: import_mini49.z.optional(import_mini49.z.string()),
|
|
@@ -12479,7 +12585,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12479
12585
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12480
12586
|
if (!result.success) {
|
|
12481
12587
|
throw new Error(
|
|
12482
|
-
`Invalid frontmatter in ${(0,
|
|
12588
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12483
12589
|
);
|
|
12484
12590
|
}
|
|
12485
12591
|
}
|
|
@@ -12493,7 +12599,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12493
12599
|
global = false
|
|
12494
12600
|
} = {}) {
|
|
12495
12601
|
return {
|
|
12496
|
-
relativeDirPath: global ? (0,
|
|
12602
|
+
relativeDirPath: global ? (0, import_node_path93.join)(".config", "opencode", "agent") : (0, import_node_path93.join)(".opencode", "agent")
|
|
12497
12603
|
};
|
|
12498
12604
|
}
|
|
12499
12605
|
getFrontmatter() {
|
|
@@ -12506,7 +12612,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12506
12612
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
12507
12613
|
const rulesyncFrontmatter = {
|
|
12508
12614
|
targets: ["*"],
|
|
12509
|
-
name: name ?? (0,
|
|
12615
|
+
name: name ?? (0, import_node_path93.basename)(this.getRelativeFilePath(), ".md"),
|
|
12510
12616
|
description,
|
|
12511
12617
|
opencode: { mode, ...opencodeSection }
|
|
12512
12618
|
};
|
|
@@ -12559,7 +12665,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12559
12665
|
return {
|
|
12560
12666
|
success: false,
|
|
12561
12667
|
error: new Error(
|
|
12562
|
-
`Invalid frontmatter in ${(0,
|
|
12668
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12563
12669
|
)
|
|
12564
12670
|
};
|
|
12565
12671
|
}
|
|
@@ -12576,7 +12682,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12576
12682
|
global = false
|
|
12577
12683
|
}) {
|
|
12578
12684
|
const paths = this.getSettablePaths({ global });
|
|
12579
|
-
const filePath = (0,
|
|
12685
|
+
const filePath = (0, import_node_path93.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12580
12686
|
const fileContent = await readFileContent(filePath);
|
|
12581
12687
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12582
12688
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12743,9 +12849,10 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12743
12849
|
toolTarget,
|
|
12744
12850
|
global = false,
|
|
12745
12851
|
getFactory = defaultGetFactory5,
|
|
12746
|
-
dryRun = false
|
|
12852
|
+
dryRun = false,
|
|
12853
|
+
logger
|
|
12747
12854
|
}) {
|
|
12748
|
-
super({ baseDir, dryRun });
|
|
12855
|
+
super({ baseDir, dryRun, logger });
|
|
12749
12856
|
const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
12750
12857
|
if (!result.success) {
|
|
12751
12858
|
throw new Error(
|
|
@@ -12781,7 +12888,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12781
12888
|
const rulesyncSubagents = [];
|
|
12782
12889
|
for (const toolSubagent of toolSubagents) {
|
|
12783
12890
|
if (toolSubagent instanceof SimulatedSubagent) {
|
|
12784
|
-
logger.debug(
|
|
12891
|
+
this.logger.debug(
|
|
12785
12892
|
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
12786
12893
|
);
|
|
12787
12894
|
continue;
|
|
@@ -12795,39 +12902,39 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12795
12902
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12796
12903
|
*/
|
|
12797
12904
|
async loadRulesyncFiles() {
|
|
12798
|
-
const subagentsDir = (0,
|
|
12905
|
+
const subagentsDir = (0, import_node_path94.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12799
12906
|
const dirExists = await directoryExists(subagentsDir);
|
|
12800
12907
|
if (!dirExists) {
|
|
12801
|
-
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12908
|
+
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12802
12909
|
return [];
|
|
12803
12910
|
}
|
|
12804
12911
|
const entries = await listDirectoryFiles(subagentsDir);
|
|
12805
12912
|
const mdFiles = entries.filter((file) => file.endsWith(".md"));
|
|
12806
12913
|
if (mdFiles.length === 0) {
|
|
12807
|
-
logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12914
|
+
this.logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12808
12915
|
return [];
|
|
12809
12916
|
}
|
|
12810
|
-
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12917
|
+
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12811
12918
|
const rulesyncSubagents = [];
|
|
12812
12919
|
for (const mdFile of mdFiles) {
|
|
12813
|
-
const filepath = (0,
|
|
12920
|
+
const filepath = (0, import_node_path94.join)(subagentsDir, mdFile);
|
|
12814
12921
|
try {
|
|
12815
12922
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12816
12923
|
relativeFilePath: mdFile,
|
|
12817
12924
|
validate: true
|
|
12818
12925
|
});
|
|
12819
12926
|
rulesyncSubagents.push(rulesyncSubagent);
|
|
12820
|
-
logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12927
|
+
this.logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12821
12928
|
} catch (error) {
|
|
12822
|
-
logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12929
|
+
this.logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12823
12930
|
continue;
|
|
12824
12931
|
}
|
|
12825
12932
|
}
|
|
12826
12933
|
if (rulesyncSubagents.length === 0) {
|
|
12827
|
-
logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12934
|
+
this.logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12828
12935
|
return [];
|
|
12829
12936
|
}
|
|
12830
|
-
logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12937
|
+
this.logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12831
12938
|
return rulesyncSubagents;
|
|
12832
12939
|
}
|
|
12833
12940
|
/**
|
|
@@ -12840,18 +12947,18 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12840
12947
|
const factory = this.getFactory(this.toolTarget);
|
|
12841
12948
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12842
12949
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12843
|
-
(0,
|
|
12950
|
+
(0, import_node_path94.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12844
12951
|
);
|
|
12845
12952
|
if (forDeletion) {
|
|
12846
12953
|
const toolSubagents2 = subagentFilePaths.map(
|
|
12847
12954
|
(path3) => factory.class.forDeletion({
|
|
12848
12955
|
baseDir: this.baseDir,
|
|
12849
12956
|
relativeDirPath: paths.relativeDirPath,
|
|
12850
|
-
relativeFilePath: (0,
|
|
12957
|
+
relativeFilePath: (0, import_node_path94.basename)(path3),
|
|
12851
12958
|
global: this.global
|
|
12852
12959
|
})
|
|
12853
12960
|
).filter((subagent) => subagent.isDeletable());
|
|
12854
|
-
logger.debug(
|
|
12961
|
+
this.logger.debug(
|
|
12855
12962
|
`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`
|
|
12856
12963
|
);
|
|
12857
12964
|
return toolSubagents2;
|
|
@@ -12860,12 +12967,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12860
12967
|
subagentFilePaths.map(
|
|
12861
12968
|
(path3) => factory.class.fromFile({
|
|
12862
12969
|
baseDir: this.baseDir,
|
|
12863
|
-
relativeFilePath: (0,
|
|
12970
|
+
relativeFilePath: (0, import_node_path94.basename)(path3),
|
|
12864
12971
|
global: this.global
|
|
12865
12972
|
})
|
|
12866
12973
|
)
|
|
12867
12974
|
);
|
|
12868
|
-
logger.debug(
|
|
12975
|
+
this.logger.debug(
|
|
12976
|
+
`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`
|
|
12977
|
+
);
|
|
12869
12978
|
return toolSubagents;
|
|
12870
12979
|
}
|
|
12871
12980
|
/**
|
|
@@ -12905,13 +13014,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12905
13014
|
};
|
|
12906
13015
|
|
|
12907
13016
|
// src/features/rules/agentsmd-rule.ts
|
|
12908
|
-
var
|
|
13017
|
+
var import_node_path97 = require("path");
|
|
12909
13018
|
|
|
12910
13019
|
// src/features/rules/tool-rule.ts
|
|
12911
|
-
var
|
|
13020
|
+
var import_node_path96 = require("path");
|
|
12912
13021
|
|
|
12913
13022
|
// src/features/rules/rulesync-rule.ts
|
|
12914
|
-
var
|
|
13023
|
+
var import_node_path95 = require("path");
|
|
12915
13024
|
var import_mini51 = require("zod/mini");
|
|
12916
13025
|
var RulesyncRuleFrontmatterSchema = import_mini51.z.object({
|
|
12917
13026
|
root: import_mini51.z.optional(import_mini51.z.boolean()),
|
|
@@ -12958,7 +13067,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12958
13067
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12959
13068
|
if (!parseResult.success && rest.validate !== false) {
|
|
12960
13069
|
throw new Error(
|
|
12961
|
-
`Invalid frontmatter in ${(0,
|
|
13070
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12962
13071
|
);
|
|
12963
13072
|
}
|
|
12964
13073
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -12993,7 +13102,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12993
13102
|
return {
|
|
12994
13103
|
success: false,
|
|
12995
13104
|
error: new Error(
|
|
12996
|
-
`Invalid frontmatter in ${(0,
|
|
13105
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12997
13106
|
)
|
|
12998
13107
|
};
|
|
12999
13108
|
}
|
|
@@ -13002,7 +13111,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13002
13111
|
relativeFilePath,
|
|
13003
13112
|
validate = true
|
|
13004
13113
|
}) {
|
|
13005
|
-
const filePath = (0,
|
|
13114
|
+
const filePath = (0, import_node_path95.join)(
|
|
13006
13115
|
process.cwd(),
|
|
13007
13116
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
13008
13117
|
relativeFilePath
|
|
@@ -13104,7 +13213,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13104
13213
|
rulesyncRule,
|
|
13105
13214
|
validate = true,
|
|
13106
13215
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
13107
|
-
nonRootPath = { relativeDirPath: (0,
|
|
13216
|
+
nonRootPath = { relativeDirPath: (0, import_node_path96.join)(".agents", "memories") }
|
|
13108
13217
|
}) {
|
|
13109
13218
|
const params = this.buildToolRuleParamsDefault({
|
|
13110
13219
|
baseDir,
|
|
@@ -13115,7 +13224,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13115
13224
|
});
|
|
13116
13225
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
13117
13226
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
13118
|
-
params.relativeDirPath = (0,
|
|
13227
|
+
params.relativeDirPath = (0, import_node_path96.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
13119
13228
|
params.relativeFilePath = "AGENTS.md";
|
|
13120
13229
|
}
|
|
13121
13230
|
return params;
|
|
@@ -13164,7 +13273,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13164
13273
|
}
|
|
13165
13274
|
};
|
|
13166
13275
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
13167
|
-
return excludeToolDir ? subDir : (0,
|
|
13276
|
+
return excludeToolDir ? subDir : (0, import_node_path96.join)(toolDir, subDir);
|
|
13168
13277
|
}
|
|
13169
13278
|
|
|
13170
13279
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -13193,8 +13302,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13193
13302
|
validate = true
|
|
13194
13303
|
}) {
|
|
13195
13304
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
13196
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
13197
|
-
const fileContent = await readFileContent((0,
|
|
13305
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path97.join)(".agents", "memories", relativeFilePath);
|
|
13306
|
+
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
13198
13307
|
return new _AgentsMdRule({
|
|
13199
13308
|
baseDir,
|
|
13200
13309
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13249,7 +13358,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13249
13358
|
};
|
|
13250
13359
|
|
|
13251
13360
|
// src/features/rules/antigravity-rule.ts
|
|
13252
|
-
var
|
|
13361
|
+
var import_node_path98 = require("path");
|
|
13253
13362
|
var import_mini52 = require("zod/mini");
|
|
13254
13363
|
var AntigravityRuleFrontmatterSchema = import_mini52.z.looseObject({
|
|
13255
13364
|
trigger: import_mini52.z.optional(
|
|
@@ -13408,7 +13517,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13408
13517
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13409
13518
|
if (!result.success) {
|
|
13410
13519
|
throw new Error(
|
|
13411
|
-
`Invalid frontmatter in ${(0,
|
|
13520
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13412
13521
|
);
|
|
13413
13522
|
}
|
|
13414
13523
|
}
|
|
@@ -13432,7 +13541,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13432
13541
|
relativeFilePath,
|
|
13433
13542
|
validate = true
|
|
13434
13543
|
}) {
|
|
13435
|
-
const filePath = (0,
|
|
13544
|
+
const filePath = (0, import_node_path98.join)(
|
|
13436
13545
|
baseDir,
|
|
13437
13546
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13438
13547
|
relativeFilePath
|
|
@@ -13572,7 +13681,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13572
13681
|
};
|
|
13573
13682
|
|
|
13574
13683
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
13575
|
-
var
|
|
13684
|
+
var import_node_path99 = require("path");
|
|
13576
13685
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
13577
13686
|
toRulesyncRule() {
|
|
13578
13687
|
const rulesyncFrontmatter = {
|
|
@@ -13632,8 +13741,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13632
13741
|
}) {
|
|
13633
13742
|
const settablePaths = this.getSettablePaths();
|
|
13634
13743
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
13635
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
13636
|
-
const fileContent = await readFileContent((0,
|
|
13744
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path99.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13745
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
13637
13746
|
return new _AugmentcodeLegacyRule({
|
|
13638
13747
|
baseDir,
|
|
13639
13748
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -13662,7 +13771,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13662
13771
|
};
|
|
13663
13772
|
|
|
13664
13773
|
// src/features/rules/augmentcode-rule.ts
|
|
13665
|
-
var
|
|
13774
|
+
var import_node_path100 = require("path");
|
|
13666
13775
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
13667
13776
|
toRulesyncRule() {
|
|
13668
13777
|
return this.toRulesyncRuleDefault();
|
|
@@ -13693,7 +13802,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13693
13802
|
relativeFilePath,
|
|
13694
13803
|
validate = true
|
|
13695
13804
|
}) {
|
|
13696
|
-
const filePath = (0,
|
|
13805
|
+
const filePath = (0, import_node_path100.join)(
|
|
13697
13806
|
baseDir,
|
|
13698
13807
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13699
13808
|
relativeFilePath
|
|
@@ -13733,7 +13842,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13733
13842
|
};
|
|
13734
13843
|
|
|
13735
13844
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13736
|
-
var
|
|
13845
|
+
var import_node_path101 = require("path");
|
|
13737
13846
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13738
13847
|
static getSettablePaths({
|
|
13739
13848
|
global,
|
|
@@ -13775,7 +13884,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13775
13884
|
if (isRoot) {
|
|
13776
13885
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13777
13886
|
const fileContent2 = await readFileContent(
|
|
13778
|
-
(0,
|
|
13887
|
+
(0, import_node_path101.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13779
13888
|
);
|
|
13780
13889
|
return new _ClaudecodeLegacyRule({
|
|
13781
13890
|
baseDir,
|
|
@@ -13789,8 +13898,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13789
13898
|
if (!paths.nonRoot) {
|
|
13790
13899
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13791
13900
|
}
|
|
13792
|
-
const relativePath = (0,
|
|
13793
|
-
const fileContent = await readFileContent((0,
|
|
13901
|
+
const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13902
|
+
const fileContent = await readFileContent((0, import_node_path101.join)(baseDir, relativePath));
|
|
13794
13903
|
return new _ClaudecodeLegacyRule({
|
|
13795
13904
|
baseDir,
|
|
13796
13905
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13849,7 +13958,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13849
13958
|
};
|
|
13850
13959
|
|
|
13851
13960
|
// src/features/rules/claudecode-rule.ts
|
|
13852
|
-
var
|
|
13961
|
+
var import_node_path102 = require("path");
|
|
13853
13962
|
var import_mini53 = require("zod/mini");
|
|
13854
13963
|
var ClaudecodeRuleFrontmatterSchema = import_mini53.z.object({
|
|
13855
13964
|
paths: import_mini53.z.optional(import_mini53.z.array(import_mini53.z.string()))
|
|
@@ -13890,7 +13999,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13890
13999
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13891
14000
|
if (!result.success) {
|
|
13892
14001
|
throw new Error(
|
|
13893
|
-
`Invalid frontmatter in ${(0,
|
|
14002
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13894
14003
|
);
|
|
13895
14004
|
}
|
|
13896
14005
|
}
|
|
@@ -13920,7 +14029,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13920
14029
|
if (isRoot) {
|
|
13921
14030
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13922
14031
|
const fileContent2 = await readFileContent(
|
|
13923
|
-
(0,
|
|
14032
|
+
(0, import_node_path102.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13924
14033
|
);
|
|
13925
14034
|
return new _ClaudecodeRule({
|
|
13926
14035
|
baseDir,
|
|
@@ -13935,8 +14044,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13935
14044
|
if (!paths.nonRoot) {
|
|
13936
14045
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13937
14046
|
}
|
|
13938
|
-
const relativePath = (0,
|
|
13939
|
-
const filePath = (0,
|
|
14047
|
+
const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14048
|
+
const filePath = (0, import_node_path102.join)(baseDir, relativePath);
|
|
13940
14049
|
const fileContent = await readFileContent(filePath);
|
|
13941
14050
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13942
14051
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14047,7 +14156,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14047
14156
|
return {
|
|
14048
14157
|
success: false,
|
|
14049
14158
|
error: new Error(
|
|
14050
|
-
`Invalid frontmatter in ${(0,
|
|
14159
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14051
14160
|
)
|
|
14052
14161
|
};
|
|
14053
14162
|
}
|
|
@@ -14067,7 +14176,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14067
14176
|
};
|
|
14068
14177
|
|
|
14069
14178
|
// src/features/rules/cline-rule.ts
|
|
14070
|
-
var
|
|
14179
|
+
var import_node_path103 = require("path");
|
|
14071
14180
|
var import_mini54 = require("zod/mini");
|
|
14072
14181
|
var ClineRuleFrontmatterSchema = import_mini54.z.object({
|
|
14073
14182
|
description: import_mini54.z.string()
|
|
@@ -14113,7 +14222,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14113
14222
|
validate = true
|
|
14114
14223
|
}) {
|
|
14115
14224
|
const fileContent = await readFileContent(
|
|
14116
|
-
(0,
|
|
14225
|
+
(0, import_node_path103.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14117
14226
|
);
|
|
14118
14227
|
return new _ClineRule({
|
|
14119
14228
|
baseDir,
|
|
@@ -14139,7 +14248,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14139
14248
|
};
|
|
14140
14249
|
|
|
14141
14250
|
// src/features/rules/codexcli-rule.ts
|
|
14142
|
-
var
|
|
14251
|
+
var import_node_path104 = require("path");
|
|
14143
14252
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
14144
14253
|
static getSettablePaths({
|
|
14145
14254
|
global,
|
|
@@ -14174,7 +14283,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14174
14283
|
if (isRoot) {
|
|
14175
14284
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14176
14285
|
const fileContent2 = await readFileContent(
|
|
14177
|
-
(0,
|
|
14286
|
+
(0, import_node_path104.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14178
14287
|
);
|
|
14179
14288
|
return new _CodexcliRule({
|
|
14180
14289
|
baseDir,
|
|
@@ -14188,8 +14297,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14188
14297
|
if (!paths.nonRoot) {
|
|
14189
14298
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14190
14299
|
}
|
|
14191
|
-
const relativePath = (0,
|
|
14192
|
-
const fileContent = await readFileContent((0,
|
|
14300
|
+
const relativePath = (0, import_node_path104.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14301
|
+
const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
|
|
14193
14302
|
return new _CodexcliRule({
|
|
14194
14303
|
baseDir,
|
|
14195
14304
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14248,7 +14357,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14248
14357
|
};
|
|
14249
14358
|
|
|
14250
14359
|
// src/features/rules/copilot-rule.ts
|
|
14251
|
-
var
|
|
14360
|
+
var import_node_path105 = require("path");
|
|
14252
14361
|
var import_mini55 = require("zod/mini");
|
|
14253
14362
|
var CopilotRuleFrontmatterSchema = import_mini55.z.object({
|
|
14254
14363
|
description: import_mini55.z.optional(import_mini55.z.string()),
|
|
@@ -14285,7 +14394,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14285
14394
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14286
14395
|
if (!result.success) {
|
|
14287
14396
|
throw new Error(
|
|
14288
|
-
`Invalid frontmatter in ${(0,
|
|
14397
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14289
14398
|
);
|
|
14290
14399
|
}
|
|
14291
14400
|
}
|
|
@@ -14375,8 +14484,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14375
14484
|
const paths = this.getSettablePaths({ global });
|
|
14376
14485
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14377
14486
|
if (isRoot) {
|
|
14378
|
-
const relativePath2 = (0,
|
|
14379
|
-
const filePath2 = (0,
|
|
14487
|
+
const relativePath2 = (0, import_node_path105.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14488
|
+
const filePath2 = (0, import_node_path105.join)(baseDir, relativePath2);
|
|
14380
14489
|
const fileContent2 = await readFileContent(filePath2);
|
|
14381
14490
|
return new _CopilotRule({
|
|
14382
14491
|
baseDir,
|
|
@@ -14391,8 +14500,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14391
14500
|
if (!paths.nonRoot) {
|
|
14392
14501
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14393
14502
|
}
|
|
14394
|
-
const relativePath = (0,
|
|
14395
|
-
const filePath = (0,
|
|
14503
|
+
const relativePath = (0, import_node_path105.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14504
|
+
const filePath = (0, import_node_path105.join)(baseDir, relativePath);
|
|
14396
14505
|
const fileContent = await readFileContent(filePath);
|
|
14397
14506
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14398
14507
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14438,7 +14547,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14438
14547
|
return {
|
|
14439
14548
|
success: false,
|
|
14440
14549
|
error: new Error(
|
|
14441
|
-
`Invalid frontmatter in ${(0,
|
|
14550
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14442
14551
|
)
|
|
14443
14552
|
};
|
|
14444
14553
|
}
|
|
@@ -14458,7 +14567,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14458
14567
|
};
|
|
14459
14568
|
|
|
14460
14569
|
// src/features/rules/cursor-rule.ts
|
|
14461
|
-
var
|
|
14570
|
+
var import_node_path106 = require("path");
|
|
14462
14571
|
var import_mini56 = require("zod/mini");
|
|
14463
14572
|
var CursorRuleFrontmatterSchema = import_mini56.z.object({
|
|
14464
14573
|
description: import_mini56.z.optional(import_mini56.z.string()),
|
|
@@ -14480,7 +14589,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14480
14589
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14481
14590
|
if (!result.success) {
|
|
14482
14591
|
throw new Error(
|
|
14483
|
-
`Invalid frontmatter in ${(0,
|
|
14592
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14484
14593
|
);
|
|
14485
14594
|
}
|
|
14486
14595
|
}
|
|
@@ -14596,7 +14705,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14596
14705
|
relativeFilePath,
|
|
14597
14706
|
validate = true
|
|
14598
14707
|
}) {
|
|
14599
|
-
const filePath = (0,
|
|
14708
|
+
const filePath = (0, import_node_path106.join)(
|
|
14600
14709
|
baseDir,
|
|
14601
14710
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14602
14711
|
relativeFilePath
|
|
@@ -14606,7 +14715,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14606
14715
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14607
14716
|
if (!result.success) {
|
|
14608
14717
|
throw new Error(
|
|
14609
|
-
`Invalid frontmatter in ${(0,
|
|
14718
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
14610
14719
|
);
|
|
14611
14720
|
}
|
|
14612
14721
|
return new _CursorRule({
|
|
@@ -14643,7 +14752,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14643
14752
|
return {
|
|
14644
14753
|
success: false,
|
|
14645
14754
|
error: new Error(
|
|
14646
|
-
`Invalid frontmatter in ${(0,
|
|
14755
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14647
14756
|
)
|
|
14648
14757
|
};
|
|
14649
14758
|
}
|
|
@@ -14663,7 +14772,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14663
14772
|
};
|
|
14664
14773
|
|
|
14665
14774
|
// src/features/rules/factorydroid-rule.ts
|
|
14666
|
-
var
|
|
14775
|
+
var import_node_path107 = require("path");
|
|
14667
14776
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
14668
14777
|
constructor({ fileContent, root, ...rest }) {
|
|
14669
14778
|
super({
|
|
@@ -14703,8 +14812,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14703
14812
|
const paths = this.getSettablePaths({ global });
|
|
14704
14813
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14705
14814
|
if (isRoot) {
|
|
14706
|
-
const relativePath2 = (0,
|
|
14707
|
-
const fileContent2 = await readFileContent((0,
|
|
14815
|
+
const relativePath2 = (0, import_node_path107.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14816
|
+
const fileContent2 = await readFileContent((0, import_node_path107.join)(baseDir, relativePath2));
|
|
14708
14817
|
return new _FactorydroidRule({
|
|
14709
14818
|
baseDir,
|
|
14710
14819
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14717,8 +14826,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14717
14826
|
if (!paths.nonRoot) {
|
|
14718
14827
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14719
14828
|
}
|
|
14720
|
-
const relativePath = (0,
|
|
14721
|
-
const fileContent = await readFileContent((0,
|
|
14829
|
+
const relativePath = (0, import_node_path107.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14830
|
+
const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
|
|
14722
14831
|
return new _FactorydroidRule({
|
|
14723
14832
|
baseDir,
|
|
14724
14833
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14777,7 +14886,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14777
14886
|
};
|
|
14778
14887
|
|
|
14779
14888
|
// src/features/rules/geminicli-rule.ts
|
|
14780
|
-
var
|
|
14889
|
+
var import_node_path108 = require("path");
|
|
14781
14890
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14782
14891
|
static getSettablePaths({
|
|
14783
14892
|
global,
|
|
@@ -14812,7 +14921,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14812
14921
|
if (isRoot) {
|
|
14813
14922
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14814
14923
|
const fileContent2 = await readFileContent(
|
|
14815
|
-
(0,
|
|
14924
|
+
(0, import_node_path108.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14816
14925
|
);
|
|
14817
14926
|
return new _GeminiCliRule({
|
|
14818
14927
|
baseDir,
|
|
@@ -14826,8 +14935,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14826
14935
|
if (!paths.nonRoot) {
|
|
14827
14936
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14828
14937
|
}
|
|
14829
|
-
const relativePath = (0,
|
|
14830
|
-
const fileContent = await readFileContent((0,
|
|
14938
|
+
const relativePath = (0, import_node_path108.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14939
|
+
const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
|
|
14831
14940
|
return new _GeminiCliRule({
|
|
14832
14941
|
baseDir,
|
|
14833
14942
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14886,7 +14995,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14886
14995
|
};
|
|
14887
14996
|
|
|
14888
14997
|
// src/features/rules/goose-rule.ts
|
|
14889
|
-
var
|
|
14998
|
+
var import_node_path109 = require("path");
|
|
14890
14999
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14891
15000
|
static getSettablePaths({
|
|
14892
15001
|
global,
|
|
@@ -14921,7 +15030,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14921
15030
|
if (isRoot) {
|
|
14922
15031
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14923
15032
|
const fileContent2 = await readFileContent(
|
|
14924
|
-
(0,
|
|
15033
|
+
(0, import_node_path109.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14925
15034
|
);
|
|
14926
15035
|
return new _GooseRule({
|
|
14927
15036
|
baseDir,
|
|
@@ -14935,8 +15044,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14935
15044
|
if (!paths.nonRoot) {
|
|
14936
15045
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14937
15046
|
}
|
|
14938
|
-
const relativePath = (0,
|
|
14939
|
-
const fileContent = await readFileContent((0,
|
|
15047
|
+
const relativePath = (0, import_node_path109.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15048
|
+
const fileContent = await readFileContent((0, import_node_path109.join)(baseDir, relativePath));
|
|
14940
15049
|
return new _GooseRule({
|
|
14941
15050
|
baseDir,
|
|
14942
15051
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14995,7 +15104,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14995
15104
|
};
|
|
14996
15105
|
|
|
14997
15106
|
// src/features/rules/junie-rule.ts
|
|
14998
|
-
var
|
|
15107
|
+
var import_node_path110 = require("path");
|
|
14999
15108
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
15000
15109
|
static getSettablePaths(_options = {}) {
|
|
15001
15110
|
return {
|
|
@@ -15014,8 +15123,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15014
15123
|
validate = true
|
|
15015
15124
|
}) {
|
|
15016
15125
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
15017
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
15018
|
-
const fileContent = await readFileContent((0,
|
|
15126
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path110.join)(".junie", "memories", relativeFilePath);
|
|
15127
|
+
const fileContent = await readFileContent((0, import_node_path110.join)(baseDir, relativePath));
|
|
15019
15128
|
return new _JunieRule({
|
|
15020
15129
|
baseDir,
|
|
15021
15130
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15070,7 +15179,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15070
15179
|
};
|
|
15071
15180
|
|
|
15072
15181
|
// src/features/rules/kilo-rule.ts
|
|
15073
|
-
var
|
|
15182
|
+
var import_node_path111 = require("path");
|
|
15074
15183
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
15075
15184
|
static getSettablePaths(_options = {}) {
|
|
15076
15185
|
return {
|
|
@@ -15085,7 +15194,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15085
15194
|
validate = true
|
|
15086
15195
|
}) {
|
|
15087
15196
|
const fileContent = await readFileContent(
|
|
15088
|
-
(0,
|
|
15197
|
+
(0, import_node_path111.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15089
15198
|
);
|
|
15090
15199
|
return new _KiloRule({
|
|
15091
15200
|
baseDir,
|
|
@@ -15137,7 +15246,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15137
15246
|
};
|
|
15138
15247
|
|
|
15139
15248
|
// src/features/rules/kiro-rule.ts
|
|
15140
|
-
var
|
|
15249
|
+
var import_node_path112 = require("path");
|
|
15141
15250
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
15142
15251
|
static getSettablePaths(_options = {}) {
|
|
15143
15252
|
return {
|
|
@@ -15152,7 +15261,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15152
15261
|
validate = true
|
|
15153
15262
|
}) {
|
|
15154
15263
|
const fileContent = await readFileContent(
|
|
15155
|
-
(0,
|
|
15264
|
+
(0, import_node_path112.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15156
15265
|
);
|
|
15157
15266
|
return new _KiroRule({
|
|
15158
15267
|
baseDir,
|
|
@@ -15206,7 +15315,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15206
15315
|
};
|
|
15207
15316
|
|
|
15208
15317
|
// src/features/rules/opencode-rule.ts
|
|
15209
|
-
var
|
|
15318
|
+
var import_node_path113 = require("path");
|
|
15210
15319
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
15211
15320
|
static getSettablePaths({
|
|
15212
15321
|
global,
|
|
@@ -15241,7 +15350,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15241
15350
|
if (isRoot) {
|
|
15242
15351
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15243
15352
|
const fileContent2 = await readFileContent(
|
|
15244
|
-
(0,
|
|
15353
|
+
(0, import_node_path113.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15245
15354
|
);
|
|
15246
15355
|
return new _OpenCodeRule({
|
|
15247
15356
|
baseDir,
|
|
@@ -15255,8 +15364,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15255
15364
|
if (!paths.nonRoot) {
|
|
15256
15365
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15257
15366
|
}
|
|
15258
|
-
const relativePath = (0,
|
|
15259
|
-
const fileContent = await readFileContent((0,
|
|
15367
|
+
const relativePath = (0, import_node_path113.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15368
|
+
const fileContent = await readFileContent((0, import_node_path113.join)(baseDir, relativePath));
|
|
15260
15369
|
return new _OpenCodeRule({
|
|
15261
15370
|
baseDir,
|
|
15262
15371
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15315,7 +15424,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15315
15424
|
};
|
|
15316
15425
|
|
|
15317
15426
|
// src/features/rules/qwencode-rule.ts
|
|
15318
|
-
var
|
|
15427
|
+
var import_node_path114 = require("path");
|
|
15319
15428
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
15320
15429
|
static getSettablePaths(_options = {}) {
|
|
15321
15430
|
return {
|
|
@@ -15334,8 +15443,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15334
15443
|
validate = true
|
|
15335
15444
|
}) {
|
|
15336
15445
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
15337
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
15338
|
-
const fileContent = await readFileContent((0,
|
|
15446
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path114.join)(".qwen", "memories", relativeFilePath);
|
|
15447
|
+
const fileContent = await readFileContent((0, import_node_path114.join)(baseDir, relativePath));
|
|
15339
15448
|
return new _QwencodeRule({
|
|
15340
15449
|
baseDir,
|
|
15341
15450
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15387,7 +15496,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15387
15496
|
};
|
|
15388
15497
|
|
|
15389
15498
|
// src/features/rules/replit-rule.ts
|
|
15390
|
-
var
|
|
15499
|
+
var import_node_path115 = require("path");
|
|
15391
15500
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
15392
15501
|
static getSettablePaths(_options = {}) {
|
|
15393
15502
|
return {
|
|
@@ -15409,7 +15518,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15409
15518
|
}
|
|
15410
15519
|
const relativePath = paths.root.relativeFilePath;
|
|
15411
15520
|
const fileContent = await readFileContent(
|
|
15412
|
-
(0,
|
|
15521
|
+
(0, import_node_path115.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
15413
15522
|
);
|
|
15414
15523
|
return new _ReplitRule({
|
|
15415
15524
|
baseDir,
|
|
@@ -15475,7 +15584,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15475
15584
|
};
|
|
15476
15585
|
|
|
15477
15586
|
// src/features/rules/roo-rule.ts
|
|
15478
|
-
var
|
|
15587
|
+
var import_node_path116 = require("path");
|
|
15479
15588
|
var RooRule = class _RooRule extends ToolRule {
|
|
15480
15589
|
static getSettablePaths(_options = {}) {
|
|
15481
15590
|
return {
|
|
@@ -15490,7 +15599,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15490
15599
|
validate = true
|
|
15491
15600
|
}) {
|
|
15492
15601
|
const fileContent = await readFileContent(
|
|
15493
|
-
(0,
|
|
15602
|
+
(0, import_node_path116.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15494
15603
|
);
|
|
15495
15604
|
return new _RooRule({
|
|
15496
15605
|
baseDir,
|
|
@@ -15559,7 +15668,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15559
15668
|
};
|
|
15560
15669
|
|
|
15561
15670
|
// src/features/rules/warp-rule.ts
|
|
15562
|
-
var
|
|
15671
|
+
var import_node_path117 = require("path");
|
|
15563
15672
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
15564
15673
|
constructor({ fileContent, root, ...rest }) {
|
|
15565
15674
|
super({
|
|
@@ -15585,8 +15694,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15585
15694
|
validate = true
|
|
15586
15695
|
}) {
|
|
15587
15696
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
15588
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
15589
|
-
const fileContent = await readFileContent((0,
|
|
15697
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path117.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15698
|
+
const fileContent = await readFileContent((0, import_node_path117.join)(baseDir, relativePath));
|
|
15590
15699
|
return new _WarpRule({
|
|
15591
15700
|
baseDir,
|
|
15592
15701
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -15641,7 +15750,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15641
15750
|
};
|
|
15642
15751
|
|
|
15643
15752
|
// src/features/rules/windsurf-rule.ts
|
|
15644
|
-
var
|
|
15753
|
+
var import_node_path118 = require("path");
|
|
15645
15754
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
15646
15755
|
static getSettablePaths(_options = {}) {
|
|
15647
15756
|
return {
|
|
@@ -15656,7 +15765,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
15656
15765
|
validate = true
|
|
15657
15766
|
}) {
|
|
15658
15767
|
const fileContent = await readFileContent(
|
|
15659
|
-
(0,
|
|
15768
|
+
(0, import_node_path118.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15660
15769
|
);
|
|
15661
15770
|
return new _WindsurfRule({
|
|
15662
15771
|
baseDir,
|
|
@@ -15733,7 +15842,7 @@ var rulesProcessorToolTargets = [
|
|
|
15733
15842
|
"windsurf"
|
|
15734
15843
|
];
|
|
15735
15844
|
var RulesProcessorToolTargetSchema = import_mini57.z.enum(rulesProcessorToolTargets);
|
|
15736
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
15845
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path119.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15737
15846
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15738
15847
|
[
|
|
15739
15848
|
"agentsmd",
|
|
@@ -16020,9 +16129,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16020
16129
|
global = false,
|
|
16021
16130
|
getFactory = defaultGetFactory6,
|
|
16022
16131
|
skills,
|
|
16023
|
-
dryRun = false
|
|
16132
|
+
dryRun = false,
|
|
16133
|
+
logger
|
|
16024
16134
|
}) {
|
|
16025
|
-
super({ baseDir, dryRun });
|
|
16135
|
+
super({ baseDir, dryRun, logger });
|
|
16026
16136
|
const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
|
|
16027
16137
|
if (!result.success) {
|
|
16028
16138
|
throw new Error(
|
|
@@ -16108,7 +16218,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16108
16218
|
}).relativeDirPath;
|
|
16109
16219
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
16110
16220
|
const frontmatter = skill.getFrontmatter();
|
|
16111
|
-
const relativePath = (0,
|
|
16221
|
+
const relativePath = (0, import_node_path119.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
16112
16222
|
return {
|
|
16113
16223
|
name: frontmatter.name,
|
|
16114
16224
|
description: frontmatter.description,
|
|
@@ -16221,12 +16331,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16221
16331
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
16222
16332
|
*/
|
|
16223
16333
|
async loadRulesyncFiles() {
|
|
16224
|
-
const rulesyncBaseDir = (0,
|
|
16225
|
-
const files = await findFilesByGlobs((0,
|
|
16226
|
-
logger.debug(`Found ${files.length} rulesync files`);
|
|
16334
|
+
const rulesyncBaseDir = (0, import_node_path119.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
16335
|
+
const files = await findFilesByGlobs((0, import_node_path119.join)(rulesyncBaseDir, "**", "*.md"));
|
|
16336
|
+
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
16227
16337
|
const rulesyncRules = await Promise.all(
|
|
16228
16338
|
files.map((file) => {
|
|
16229
|
-
const relativeFilePath = (0,
|
|
16339
|
+
const relativeFilePath = (0, import_node_path119.relative)(rulesyncBaseDir, file);
|
|
16230
16340
|
checkPathTraversal({
|
|
16231
16341
|
relativePath: relativeFilePath,
|
|
16232
16342
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -16247,7 +16357,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16247
16357
|
);
|
|
16248
16358
|
}
|
|
16249
16359
|
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
16250
|
-
logger.warn(
|
|
16360
|
+
this.logger.warn(
|
|
16251
16361
|
`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}.`
|
|
16252
16362
|
);
|
|
16253
16363
|
}
|
|
@@ -16272,12 +16382,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16272
16382
|
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
16273
16383
|
);
|
|
16274
16384
|
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
16275
|
-
logger.warn(
|
|
16385
|
+
this.logger.warn(
|
|
16276
16386
|
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
16277
16387
|
);
|
|
16278
16388
|
}
|
|
16279
16389
|
if (targetedLocalRootRules.length > 0) {
|
|
16280
|
-
logger.warn(
|
|
16390
|
+
this.logger.warn(
|
|
16281
16391
|
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
16282
16392
|
);
|
|
16283
16393
|
}
|
|
@@ -16301,7 +16411,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16301
16411
|
global: this.global
|
|
16302
16412
|
});
|
|
16303
16413
|
const resolveRelativeDirPath = (filePath) => {
|
|
16304
|
-
const dirName = (0,
|
|
16414
|
+
const dirName = (0, import_node_path119.dirname)((0, import_node_path119.relative)(this.baseDir, filePath));
|
|
16305
16415
|
return dirName === "" ? "." : dirName;
|
|
16306
16416
|
};
|
|
16307
16417
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
@@ -16319,13 +16429,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16319
16429
|
return [];
|
|
16320
16430
|
}
|
|
16321
16431
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
16322
|
-
(0,
|
|
16432
|
+
(0, import_node_path119.join)(
|
|
16323
16433
|
this.baseDir,
|
|
16324
16434
|
settablePaths.root.relativeDirPath ?? ".",
|
|
16325
16435
|
settablePaths.root.relativeFilePath
|
|
16326
16436
|
),
|
|
16327
16437
|
settablePaths.alternativeRoots,
|
|
16328
|
-
(alt) => (0,
|
|
16438
|
+
(alt) => (0, import_node_path119.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
16329
16439
|
);
|
|
16330
16440
|
if (forDeletion) {
|
|
16331
16441
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -16337,7 +16447,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16337
16447
|
return factory.class.forDeletion({
|
|
16338
16448
|
baseDir: this.baseDir,
|
|
16339
16449
|
relativeDirPath,
|
|
16340
|
-
relativeFilePath: (0,
|
|
16450
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16341
16451
|
global: this.global
|
|
16342
16452
|
});
|
|
16343
16453
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -16351,14 +16461,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16351
16461
|
});
|
|
16352
16462
|
return factory.class.fromFile({
|
|
16353
16463
|
baseDir: this.baseDir,
|
|
16354
|
-
relativeFilePath: (0,
|
|
16464
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16355
16465
|
relativeDirPath,
|
|
16356
16466
|
global: this.global
|
|
16357
16467
|
});
|
|
16358
16468
|
})
|
|
16359
16469
|
);
|
|
16360
16470
|
})();
|
|
16361
|
-
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16471
|
+
this.logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16362
16472
|
const localRootToolRules = await (async () => {
|
|
16363
16473
|
if (!forDeletion) {
|
|
16364
16474
|
return [];
|
|
@@ -16370,9 +16480,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16370
16480
|
return [];
|
|
16371
16481
|
}
|
|
16372
16482
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
16373
|
-
(0,
|
|
16483
|
+
(0, import_node_path119.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
16374
16484
|
settablePaths.alternativeRoots,
|
|
16375
|
-
(alt) => (0,
|
|
16485
|
+
(alt) => (0, import_node_path119.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
16376
16486
|
);
|
|
16377
16487
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
16378
16488
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -16383,23 +16493,25 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16383
16493
|
return factory.class.forDeletion({
|
|
16384
16494
|
baseDir: this.baseDir,
|
|
16385
16495
|
relativeDirPath,
|
|
16386
|
-
relativeFilePath: (0,
|
|
16496
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16387
16497
|
global: this.global
|
|
16388
16498
|
});
|
|
16389
16499
|
}).filter((rule) => rule.isDeletable());
|
|
16390
16500
|
})();
|
|
16391
|
-
logger.debug(
|
|
16501
|
+
this.logger.debug(
|
|
16502
|
+
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
16503
|
+
);
|
|
16392
16504
|
const nonRootToolRules = await (async () => {
|
|
16393
16505
|
if (!settablePaths.nonRoot) {
|
|
16394
16506
|
return [];
|
|
16395
16507
|
}
|
|
16396
|
-
const nonRootBaseDir = (0,
|
|
16508
|
+
const nonRootBaseDir = (0, import_node_path119.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
16397
16509
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
16398
|
-
(0,
|
|
16510
|
+
(0, import_node_path119.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
16399
16511
|
);
|
|
16400
16512
|
if (forDeletion) {
|
|
16401
16513
|
return nonRootFilePaths.map((filePath) => {
|
|
16402
|
-
const relativeFilePath = (0,
|
|
16514
|
+
const relativeFilePath = (0, import_node_path119.relative)(nonRootBaseDir, filePath);
|
|
16403
16515
|
checkPathTraversal({
|
|
16404
16516
|
relativePath: relativeFilePath,
|
|
16405
16517
|
intendedRootDir: nonRootBaseDir
|
|
@@ -16414,7 +16526,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16414
16526
|
}
|
|
16415
16527
|
return await Promise.all(
|
|
16416
16528
|
nonRootFilePaths.map((filePath) => {
|
|
16417
|
-
const relativeFilePath = (0,
|
|
16529
|
+
const relativeFilePath = (0, import_node_path119.relative)(nonRootBaseDir, filePath);
|
|
16418
16530
|
checkPathTraversal({
|
|
16419
16531
|
relativePath: relativeFilePath,
|
|
16420
16532
|
intendedRootDir: nonRootBaseDir
|
|
@@ -16427,10 +16539,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16427
16539
|
})
|
|
16428
16540
|
);
|
|
16429
16541
|
})();
|
|
16430
|
-
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16542
|
+
this.logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16431
16543
|
return [...rootToolRules, ...localRootToolRules, ...nonRootToolRules];
|
|
16432
16544
|
} catch (error) {
|
|
16433
|
-
logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16545
|
+
this.logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16434
16546
|
return [];
|
|
16435
16547
|
}
|
|
16436
16548
|
}
|
|
@@ -16527,14 +16639,14 @@ s/<command> [arguments]
|
|
|
16527
16639
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
16528
16640
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
16529
16641
|
|
|
16530
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
16642
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
16531
16643
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
16532
16644
|
|
|
16533
16645
|
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.
|
|
16534
16646
|
|
|
16535
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
16647
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path119.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
16536
16648
|
|
|
16537
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
16649
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path119.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
16538
16650
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
16539
16651
|
const result = [
|
|
16540
16652
|
overview,
|
|
@@ -16606,7 +16718,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16606
16718
|
return { count: totalCount, paths: [], hasDiff };
|
|
16607
16719
|
}
|
|
16608
16720
|
function warnUnsupportedTargets(params) {
|
|
16609
|
-
const { config, supportedTargets, featureName } = params;
|
|
16721
|
+
const { config, supportedTargets, featureName, logger } = params;
|
|
16610
16722
|
for (const target of config.getTargets()) {
|
|
16611
16723
|
if (!supportedTargets.includes(target) && config.getFeatures(target).includes(featureName)) {
|
|
16612
16724
|
logger.warn(`Target '${target}' does not support the feature '${featureName}'. Skipping.`);
|
|
@@ -16614,17 +16726,17 @@ function warnUnsupportedTargets(params) {
|
|
|
16614
16726
|
}
|
|
16615
16727
|
}
|
|
16616
16728
|
async function checkRulesyncDirExists(params) {
|
|
16617
|
-
return fileExists((0,
|
|
16729
|
+
return fileExists((0, import_node_path120.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16618
16730
|
}
|
|
16619
16731
|
async function generate(params) {
|
|
16620
|
-
const { config } = params;
|
|
16621
|
-
const ignoreResult = await generateIgnoreCore({ config });
|
|
16622
|
-
const mcpResult = await generateMcpCore({ config });
|
|
16623
|
-
const commandsResult = await generateCommandsCore({ config });
|
|
16624
|
-
const subagentsResult = await generateSubagentsCore({ config });
|
|
16625
|
-
const skillsResult = await generateSkillsCore({ config });
|
|
16626
|
-
const hooksResult = await generateHooksCore({ config });
|
|
16627
|
-
const rulesResult = await generateRulesCore({ config, skills: skillsResult.skills });
|
|
16732
|
+
const { config, logger } = params;
|
|
16733
|
+
const ignoreResult = await generateIgnoreCore({ config, logger });
|
|
16734
|
+
const mcpResult = await generateMcpCore({ config, logger });
|
|
16735
|
+
const commandsResult = await generateCommandsCore({ config, logger });
|
|
16736
|
+
const subagentsResult = await generateSubagentsCore({ config, logger });
|
|
16737
|
+
const skillsResult = await generateSkillsCore({ config, logger });
|
|
16738
|
+
const hooksResult = await generateHooksCore({ config, logger });
|
|
16739
|
+
const rulesResult = await generateRulesCore({ config, logger, skills: skillsResult.skills });
|
|
16628
16740
|
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
16629
16741
|
return {
|
|
16630
16742
|
rulesCount: rulesResult.count,
|
|
@@ -16646,13 +16758,13 @@ async function generate(params) {
|
|
|
16646
16758
|
};
|
|
16647
16759
|
}
|
|
16648
16760
|
async function generateRulesCore(params) {
|
|
16649
|
-
const { config, skills } = params;
|
|
16761
|
+
const { config, logger, skills } = params;
|
|
16650
16762
|
let totalCount = 0;
|
|
16651
16763
|
const allPaths = [];
|
|
16652
16764
|
let hasDiff = false;
|
|
16653
16765
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16654
16766
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedTargets);
|
|
16655
|
-
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules" });
|
|
16767
|
+
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger });
|
|
16656
16768
|
for (const baseDir of config.getBaseDirs()) {
|
|
16657
16769
|
for (const toolTarget of toolTargets) {
|
|
16658
16770
|
if (!config.getFeatures(toolTarget).includes("rules")) {
|
|
@@ -16666,7 +16778,8 @@ async function generateRulesCore(params) {
|
|
|
16666
16778
|
simulateSubagents: config.getSimulateSubagents(),
|
|
16667
16779
|
simulateSkills: config.getSimulateSkills(),
|
|
16668
16780
|
skills,
|
|
16669
|
-
dryRun: config.isPreviewMode()
|
|
16781
|
+
dryRun: config.isPreviewMode(),
|
|
16782
|
+
logger
|
|
16670
16783
|
});
|
|
16671
16784
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16672
16785
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16683,12 +16796,13 @@ async function generateRulesCore(params) {
|
|
|
16683
16796
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16684
16797
|
}
|
|
16685
16798
|
async function generateIgnoreCore(params) {
|
|
16686
|
-
const { config } = params;
|
|
16799
|
+
const { config, logger } = params;
|
|
16687
16800
|
const supportedIgnoreTargets = IgnoreProcessor.getToolTargets();
|
|
16688
16801
|
warnUnsupportedTargets({
|
|
16689
16802
|
config,
|
|
16690
16803
|
supportedTargets: supportedIgnoreTargets,
|
|
16691
|
-
featureName: "ignore"
|
|
16804
|
+
featureName: "ignore",
|
|
16805
|
+
logger
|
|
16692
16806
|
});
|
|
16693
16807
|
if (config.getGlobal()) {
|
|
16694
16808
|
return { count: 0, paths: [], hasDiff: false };
|
|
@@ -16705,7 +16819,8 @@ async function generateIgnoreCore(params) {
|
|
|
16705
16819
|
const processor = new IgnoreProcessor({
|
|
16706
16820
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
16707
16821
|
toolTarget,
|
|
16708
|
-
dryRun: config.isPreviewMode()
|
|
16822
|
+
dryRun: config.isPreviewMode(),
|
|
16823
|
+
logger
|
|
16709
16824
|
});
|
|
16710
16825
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16711
16826
|
let result;
|
|
@@ -16736,13 +16851,18 @@ async function generateIgnoreCore(params) {
|
|
|
16736
16851
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16737
16852
|
}
|
|
16738
16853
|
async function generateMcpCore(params) {
|
|
16739
|
-
const { config } = params;
|
|
16854
|
+
const { config, logger } = params;
|
|
16740
16855
|
let totalCount = 0;
|
|
16741
16856
|
const allPaths = [];
|
|
16742
16857
|
let hasDiff = false;
|
|
16743
16858
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16744
16859
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedMcpTargets);
|
|
16745
|
-
warnUnsupportedTargets({
|
|
16860
|
+
warnUnsupportedTargets({
|
|
16861
|
+
config,
|
|
16862
|
+
supportedTargets: supportedMcpTargets,
|
|
16863
|
+
featureName: "mcp",
|
|
16864
|
+
logger
|
|
16865
|
+
});
|
|
16746
16866
|
for (const baseDir of config.getBaseDirs()) {
|
|
16747
16867
|
for (const toolTarget of toolTargets) {
|
|
16748
16868
|
if (!config.getFeatures(toolTarget).includes("mcp")) {
|
|
@@ -16752,7 +16872,8 @@ async function generateMcpCore(params) {
|
|
|
16752
16872
|
baseDir,
|
|
16753
16873
|
toolTarget,
|
|
16754
16874
|
global: config.getGlobal(),
|
|
16755
|
-
dryRun: config.isPreviewMode()
|
|
16875
|
+
dryRun: config.isPreviewMode(),
|
|
16876
|
+
logger
|
|
16756
16877
|
});
|
|
16757
16878
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16758
16879
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16769,7 +16890,7 @@ async function generateMcpCore(params) {
|
|
|
16769
16890
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16770
16891
|
}
|
|
16771
16892
|
async function generateCommandsCore(params) {
|
|
16772
|
-
const { config } = params;
|
|
16893
|
+
const { config, logger } = params;
|
|
16773
16894
|
let totalCount = 0;
|
|
16774
16895
|
const allPaths = [];
|
|
16775
16896
|
let hasDiff = false;
|
|
@@ -16781,7 +16902,8 @@ async function generateCommandsCore(params) {
|
|
|
16781
16902
|
warnUnsupportedTargets({
|
|
16782
16903
|
config,
|
|
16783
16904
|
supportedTargets: supportedCommandsTargets,
|
|
16784
|
-
featureName: "commands"
|
|
16905
|
+
featureName: "commands",
|
|
16906
|
+
logger
|
|
16785
16907
|
});
|
|
16786
16908
|
for (const baseDir of config.getBaseDirs()) {
|
|
16787
16909
|
for (const toolTarget of toolTargets) {
|
|
@@ -16792,7 +16914,8 @@ async function generateCommandsCore(params) {
|
|
|
16792
16914
|
baseDir,
|
|
16793
16915
|
toolTarget,
|
|
16794
16916
|
global: config.getGlobal(),
|
|
16795
|
-
dryRun: config.isPreviewMode()
|
|
16917
|
+
dryRun: config.isPreviewMode(),
|
|
16918
|
+
logger
|
|
16796
16919
|
});
|
|
16797
16920
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16798
16921
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16809,7 +16932,7 @@ async function generateCommandsCore(params) {
|
|
|
16809
16932
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16810
16933
|
}
|
|
16811
16934
|
async function generateSubagentsCore(params) {
|
|
16812
|
-
const { config } = params;
|
|
16935
|
+
const { config, logger } = params;
|
|
16813
16936
|
let totalCount = 0;
|
|
16814
16937
|
const allPaths = [];
|
|
16815
16938
|
let hasDiff = false;
|
|
@@ -16821,7 +16944,8 @@ async function generateSubagentsCore(params) {
|
|
|
16821
16944
|
warnUnsupportedTargets({
|
|
16822
16945
|
config,
|
|
16823
16946
|
supportedTargets: supportedSubagentsTargets,
|
|
16824
|
-
featureName: "subagents"
|
|
16947
|
+
featureName: "subagents",
|
|
16948
|
+
logger
|
|
16825
16949
|
});
|
|
16826
16950
|
for (const baseDir of config.getBaseDirs()) {
|
|
16827
16951
|
for (const toolTarget of toolTargets) {
|
|
@@ -16832,7 +16956,8 @@ async function generateSubagentsCore(params) {
|
|
|
16832
16956
|
baseDir,
|
|
16833
16957
|
toolTarget,
|
|
16834
16958
|
global: config.getGlobal(),
|
|
16835
|
-
dryRun: config.isPreviewMode()
|
|
16959
|
+
dryRun: config.isPreviewMode(),
|
|
16960
|
+
logger
|
|
16836
16961
|
});
|
|
16837
16962
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16838
16963
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16849,7 +16974,7 @@ async function generateSubagentsCore(params) {
|
|
|
16849
16974
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16850
16975
|
}
|
|
16851
16976
|
async function generateSkillsCore(params) {
|
|
16852
|
-
const { config } = params;
|
|
16977
|
+
const { config, logger } = params;
|
|
16853
16978
|
let totalCount = 0;
|
|
16854
16979
|
const allPaths = [];
|
|
16855
16980
|
let hasDiff = false;
|
|
@@ -16862,7 +16987,8 @@ async function generateSkillsCore(params) {
|
|
|
16862
16987
|
warnUnsupportedTargets({
|
|
16863
16988
|
config,
|
|
16864
16989
|
supportedTargets: supportedSkillsTargets,
|
|
16865
|
-
featureName: "skills"
|
|
16990
|
+
featureName: "skills",
|
|
16991
|
+
logger
|
|
16866
16992
|
});
|
|
16867
16993
|
for (const baseDir of config.getBaseDirs()) {
|
|
16868
16994
|
for (const toolTarget of toolTargets) {
|
|
@@ -16873,7 +16999,8 @@ async function generateSkillsCore(params) {
|
|
|
16873
16999
|
baseDir,
|
|
16874
17000
|
toolTarget,
|
|
16875
17001
|
global: config.getGlobal(),
|
|
16876
|
-
dryRun: config.isPreviewMode()
|
|
17002
|
+
dryRun: config.isPreviewMode(),
|
|
17003
|
+
logger
|
|
16877
17004
|
});
|
|
16878
17005
|
const rulesyncDirs = await processor.loadRulesyncDirs();
|
|
16879
17006
|
for (const rulesyncDir of rulesyncDirs) {
|
|
@@ -16895,13 +17022,18 @@ async function generateSkillsCore(params) {
|
|
|
16895
17022
|
return { count: totalCount, paths: allPaths, skills: allSkills, hasDiff };
|
|
16896
17023
|
}
|
|
16897
17024
|
async function generateHooksCore(params) {
|
|
16898
|
-
const { config } = params;
|
|
17025
|
+
const { config, logger } = params;
|
|
16899
17026
|
let totalCount = 0;
|
|
16900
17027
|
const allPaths = [];
|
|
16901
17028
|
let hasDiff = false;
|
|
16902
17029
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16903
17030
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedHooksTargets);
|
|
16904
|
-
warnUnsupportedTargets({
|
|
17031
|
+
warnUnsupportedTargets({
|
|
17032
|
+
config,
|
|
17033
|
+
supportedTargets: supportedHooksTargets,
|
|
17034
|
+
featureName: "hooks",
|
|
17035
|
+
logger
|
|
17036
|
+
});
|
|
16905
17037
|
for (const baseDir of config.getBaseDirs()) {
|
|
16906
17038
|
for (const toolTarget of toolTargets) {
|
|
16907
17039
|
if (!config.getFeatures(toolTarget).includes("hooks")) {
|
|
@@ -16911,7 +17043,8 @@ async function generateHooksCore(params) {
|
|
|
16911
17043
|
baseDir,
|
|
16912
17044
|
toolTarget,
|
|
16913
17045
|
global: config.getGlobal(),
|
|
16914
|
-
dryRun: config.isPreviewMode()
|
|
17046
|
+
dryRun: config.isPreviewMode(),
|
|
17047
|
+
logger
|
|
16915
17048
|
});
|
|
16916
17049
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16917
17050
|
let result;
|
|
@@ -16938,14 +17071,14 @@ async function generateHooksCore(params) {
|
|
|
16938
17071
|
|
|
16939
17072
|
// src/lib/import.ts
|
|
16940
17073
|
async function importFromTool(params) {
|
|
16941
|
-
const { config, tool } = params;
|
|
16942
|
-
const rulesCount = await importRulesCore({ config, tool });
|
|
16943
|
-
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
16944
|
-
const mcpCount = await importMcpCore({ config, tool });
|
|
16945
|
-
const commandsCount = await importCommandsCore({ config, tool });
|
|
16946
|
-
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
16947
|
-
const skillsCount = await importSkillsCore({ config, tool });
|
|
16948
|
-
const hooksCount = await importHooksCore({ config, tool });
|
|
17074
|
+
const { config, tool, logger } = params;
|
|
17075
|
+
const rulesCount = await importRulesCore({ config, tool, logger });
|
|
17076
|
+
const ignoreCount = await importIgnoreCore({ config, tool, logger });
|
|
17077
|
+
const mcpCount = await importMcpCore({ config, tool, logger });
|
|
17078
|
+
const commandsCount = await importCommandsCore({ config, tool, logger });
|
|
17079
|
+
const subagentsCount = await importSubagentsCore({ config, tool, logger });
|
|
17080
|
+
const skillsCount = await importSkillsCore({ config, tool, logger });
|
|
17081
|
+
const hooksCount = await importHooksCore({ config, tool, logger });
|
|
16949
17082
|
return {
|
|
16950
17083
|
rulesCount,
|
|
16951
17084
|
ignoreCount,
|
|
@@ -16957,7 +17090,7 @@ async function importFromTool(params) {
|
|
|
16957
17090
|
};
|
|
16958
17091
|
}
|
|
16959
17092
|
async function importRulesCore(params) {
|
|
16960
|
-
const { config, tool } = params;
|
|
17093
|
+
const { config, tool, logger } = params;
|
|
16961
17094
|
if (!config.getFeatures(tool).includes("rules")) {
|
|
16962
17095
|
return 0;
|
|
16963
17096
|
}
|
|
@@ -16969,7 +17102,8 @@ async function importRulesCore(params) {
|
|
|
16969
17102
|
const rulesProcessor = new RulesProcessor({
|
|
16970
17103
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
16971
17104
|
toolTarget: tool,
|
|
16972
|
-
global
|
|
17105
|
+
global,
|
|
17106
|
+
logger
|
|
16973
17107
|
});
|
|
16974
17108
|
const toolFiles = await rulesProcessor.loadToolFiles();
|
|
16975
17109
|
if (toolFiles.length === 0) {
|
|
@@ -16984,7 +17118,7 @@ async function importRulesCore(params) {
|
|
|
16984
17118
|
return writtenCount;
|
|
16985
17119
|
}
|
|
16986
17120
|
async function importIgnoreCore(params) {
|
|
16987
|
-
const { config, tool } = params;
|
|
17121
|
+
const { config, tool, logger } = params;
|
|
16988
17122
|
if (!config.getFeatures(tool).includes("ignore")) {
|
|
16989
17123
|
return 0;
|
|
16990
17124
|
}
|
|
@@ -16997,7 +17131,8 @@ async function importIgnoreCore(params) {
|
|
|
16997
17131
|
}
|
|
16998
17132
|
const ignoreProcessor = new IgnoreProcessor({
|
|
16999
17133
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17000
|
-
toolTarget: tool
|
|
17134
|
+
toolTarget: tool,
|
|
17135
|
+
logger
|
|
17001
17136
|
});
|
|
17002
17137
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
17003
17138
|
if (toolFiles.length === 0) {
|
|
@@ -17015,7 +17150,7 @@ async function importIgnoreCore(params) {
|
|
|
17015
17150
|
return writtenCount;
|
|
17016
17151
|
}
|
|
17017
17152
|
async function importMcpCore(params) {
|
|
17018
|
-
const { config, tool } = params;
|
|
17153
|
+
const { config, tool, logger } = params;
|
|
17019
17154
|
if (!config.getFeatures(tool).includes("mcp")) {
|
|
17020
17155
|
return 0;
|
|
17021
17156
|
}
|
|
@@ -17027,7 +17162,8 @@ async function importMcpCore(params) {
|
|
|
17027
17162
|
const mcpProcessor = new McpProcessor({
|
|
17028
17163
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17029
17164
|
toolTarget: tool,
|
|
17030
|
-
global
|
|
17165
|
+
global,
|
|
17166
|
+
logger
|
|
17031
17167
|
});
|
|
17032
17168
|
const toolFiles = await mcpProcessor.loadToolFiles();
|
|
17033
17169
|
if (toolFiles.length === 0) {
|
|
@@ -17042,7 +17178,7 @@ async function importMcpCore(params) {
|
|
|
17042
17178
|
return writtenCount;
|
|
17043
17179
|
}
|
|
17044
17180
|
async function importCommandsCore(params) {
|
|
17045
|
-
const { config, tool } = params;
|
|
17181
|
+
const { config, tool, logger } = params;
|
|
17046
17182
|
if (!config.getFeatures(tool).includes("commands")) {
|
|
17047
17183
|
return 0;
|
|
17048
17184
|
}
|
|
@@ -17054,7 +17190,8 @@ async function importCommandsCore(params) {
|
|
|
17054
17190
|
const commandsProcessor = new CommandsProcessor({
|
|
17055
17191
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17056
17192
|
toolTarget: tool,
|
|
17057
|
-
global
|
|
17193
|
+
global,
|
|
17194
|
+
logger
|
|
17058
17195
|
});
|
|
17059
17196
|
const toolFiles = await commandsProcessor.loadToolFiles();
|
|
17060
17197
|
if (toolFiles.length === 0) {
|
|
@@ -17069,7 +17206,7 @@ async function importCommandsCore(params) {
|
|
|
17069
17206
|
return writtenCount;
|
|
17070
17207
|
}
|
|
17071
17208
|
async function importSubagentsCore(params) {
|
|
17072
|
-
const { config, tool } = params;
|
|
17209
|
+
const { config, tool, logger } = params;
|
|
17073
17210
|
if (!config.getFeatures(tool).includes("subagents")) {
|
|
17074
17211
|
return 0;
|
|
17075
17212
|
}
|
|
@@ -17081,7 +17218,8 @@ async function importSubagentsCore(params) {
|
|
|
17081
17218
|
const subagentsProcessor = new SubagentsProcessor({
|
|
17082
17219
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17083
17220
|
toolTarget: tool,
|
|
17084
|
-
global: config.getGlobal()
|
|
17221
|
+
global: config.getGlobal(),
|
|
17222
|
+
logger
|
|
17085
17223
|
});
|
|
17086
17224
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
17087
17225
|
if (toolFiles.length === 0) {
|
|
@@ -17096,7 +17234,7 @@ async function importSubagentsCore(params) {
|
|
|
17096
17234
|
return writtenCount;
|
|
17097
17235
|
}
|
|
17098
17236
|
async function importSkillsCore(params) {
|
|
17099
|
-
const { config, tool } = params;
|
|
17237
|
+
const { config, tool, logger } = params;
|
|
17100
17238
|
if (!config.getFeatures(tool).includes("skills")) {
|
|
17101
17239
|
return 0;
|
|
17102
17240
|
}
|
|
@@ -17108,7 +17246,8 @@ async function importSkillsCore(params) {
|
|
|
17108
17246
|
const skillsProcessor = new SkillsProcessor({
|
|
17109
17247
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17110
17248
|
toolTarget: tool,
|
|
17111
|
-
global
|
|
17249
|
+
global,
|
|
17250
|
+
logger
|
|
17112
17251
|
});
|
|
17113
17252
|
const toolDirs = await skillsProcessor.loadToolDirs();
|
|
17114
17253
|
if (toolDirs.length === 0) {
|
|
@@ -17123,7 +17262,7 @@ async function importSkillsCore(params) {
|
|
|
17123
17262
|
return writtenCount;
|
|
17124
17263
|
}
|
|
17125
17264
|
async function importHooksCore(params) {
|
|
17126
|
-
const { config, tool } = params;
|
|
17265
|
+
const { config, tool, logger } = params;
|
|
17127
17266
|
if (!config.getFeatures(tool).includes("hooks")) {
|
|
17128
17267
|
return 0;
|
|
17129
17268
|
}
|
|
@@ -17140,7 +17279,8 @@ async function importHooksCore(params) {
|
|
|
17140
17279
|
const hooksProcessor = new HooksProcessor({
|
|
17141
17280
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17142
17281
|
toolTarget: tool,
|
|
17143
|
-
global
|
|
17282
|
+
global,
|
|
17283
|
+
logger
|
|
17144
17284
|
});
|
|
17145
17285
|
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
17146
17286
|
if (toolFiles.length === 0) {
|
|
@@ -17155,10 +17295,76 @@ async function importHooksCore(params) {
|
|
|
17155
17295
|
return writtenCount;
|
|
17156
17296
|
}
|
|
17157
17297
|
|
|
17298
|
+
// src/utils/logger.ts
|
|
17299
|
+
var BaseLogger = class {
|
|
17300
|
+
_verbose = false;
|
|
17301
|
+
_silent = false;
|
|
17302
|
+
constructor({ verbose = false, silent = false } = {}) {
|
|
17303
|
+
this._silent = silent;
|
|
17304
|
+
this._verbose = verbose && !silent;
|
|
17305
|
+
}
|
|
17306
|
+
get verbose() {
|
|
17307
|
+
return this._verbose;
|
|
17308
|
+
}
|
|
17309
|
+
get silent() {
|
|
17310
|
+
return this._silent;
|
|
17311
|
+
}
|
|
17312
|
+
configure({ verbose, silent }) {
|
|
17313
|
+
if (verbose && silent) {
|
|
17314
|
+
this._silent = false;
|
|
17315
|
+
if (!isEnvTest()) {
|
|
17316
|
+
this.onConflictingFlags();
|
|
17317
|
+
}
|
|
17318
|
+
}
|
|
17319
|
+
this._silent = silent;
|
|
17320
|
+
this._verbose = verbose && !silent;
|
|
17321
|
+
}
|
|
17322
|
+
onConflictingFlags() {
|
|
17323
|
+
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
17324
|
+
}
|
|
17325
|
+
};
|
|
17326
|
+
var ConsoleLogger = class extends BaseLogger {
|
|
17327
|
+
isSuppressed() {
|
|
17328
|
+
return isEnvTest() || this._silent;
|
|
17329
|
+
}
|
|
17330
|
+
get jsonMode() {
|
|
17331
|
+
return false;
|
|
17332
|
+
}
|
|
17333
|
+
captureData(_key, _value) {
|
|
17334
|
+
}
|
|
17335
|
+
getJsonData() {
|
|
17336
|
+
return {};
|
|
17337
|
+
}
|
|
17338
|
+
outputJson(_success, _error) {
|
|
17339
|
+
}
|
|
17340
|
+
info(message, ...args) {
|
|
17341
|
+
if (this.isSuppressed()) return;
|
|
17342
|
+
console.log(message, ...args);
|
|
17343
|
+
}
|
|
17344
|
+
success(message, ...args) {
|
|
17345
|
+
if (this.isSuppressed()) return;
|
|
17346
|
+
console.log(message, ...args);
|
|
17347
|
+
}
|
|
17348
|
+
warn(message, ...args) {
|
|
17349
|
+
if (this.isSuppressed()) return;
|
|
17350
|
+
console.warn(message, ...args);
|
|
17351
|
+
}
|
|
17352
|
+
// Errors are always emitted, even in silent mode
|
|
17353
|
+
error(message, _code, ...args) {
|
|
17354
|
+
if (isEnvTest()) return;
|
|
17355
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
17356
|
+
console.error(errorMessage, ...args);
|
|
17357
|
+
}
|
|
17358
|
+
debug(message, ...args) {
|
|
17359
|
+
if (!this._verbose || this.isSuppressed()) return;
|
|
17360
|
+
console.log(message, ...args);
|
|
17361
|
+
}
|
|
17362
|
+
};
|
|
17363
|
+
|
|
17158
17364
|
// src/index.ts
|
|
17159
17365
|
async function generate2(options = {}) {
|
|
17160
17366
|
const { silent = true, verbose = false, ...rest } = options;
|
|
17161
|
-
logger
|
|
17367
|
+
const logger = new ConsoleLogger({ verbose, silent });
|
|
17162
17368
|
const config = await ConfigResolver.resolve({
|
|
17163
17369
|
...rest,
|
|
17164
17370
|
verbose,
|
|
@@ -17169,18 +17375,18 @@ async function generate2(options = {}) {
|
|
|
17169
17375
|
throw new Error(".rulesync directory not found. Run 'rulesync init' first.");
|
|
17170
17376
|
}
|
|
17171
17377
|
}
|
|
17172
|
-
return generate({ config });
|
|
17378
|
+
return generate({ config, logger });
|
|
17173
17379
|
}
|
|
17174
17380
|
async function importFromTool2(options) {
|
|
17175
17381
|
const { target, silent = true, verbose = false, ...rest } = options;
|
|
17176
|
-
logger
|
|
17382
|
+
const logger = new ConsoleLogger({ verbose, silent });
|
|
17177
17383
|
const config = await ConfigResolver.resolve({
|
|
17178
17384
|
...rest,
|
|
17179
17385
|
targets: [target],
|
|
17180
17386
|
verbose,
|
|
17181
17387
|
silent
|
|
17182
17388
|
});
|
|
17183
|
-
return importFromTool({ config, tool: target });
|
|
17389
|
+
return importFromTool({ config, tool: target, logger });
|
|
17184
17390
|
}
|
|
17185
17391
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17186
17392
|
0 && (module.exports = {
|