rulesync 7.19.0 → 7.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{chunk-J2ZF4SHC.js → chunk-UYWCICY6.js} +893 -701
- package/dist/cli/index.cjs +1313 -1044
- package/dist/cli/index.js +332 -257
- package/dist/index.cjs +750 -651
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -7
- package/package.json +2 -3
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,186 +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
|
-
// src/utils/logger.ts
|
|
92
|
-
var import_consola = require("consola");
|
|
93
|
-
|
|
94
|
-
// src/types/json-output.ts
|
|
95
|
-
var ErrorCodes = {
|
|
96
|
-
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
97
|
-
RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
|
|
98
|
-
INVALID_TARGET: "INVALID_TARGET",
|
|
99
|
-
FETCH_FAILED: "FETCH_FAILED",
|
|
100
|
-
WRITE_FAILED: "WRITE_FAILED",
|
|
101
|
-
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
102
|
-
GENERATION_FAILED: "GENERATION_FAILED",
|
|
103
|
-
IMPORT_FAILED: "IMPORT_FAILED",
|
|
104
|
-
INSTALL_FAILED: "INSTALL_FAILED",
|
|
105
|
-
UPDATE_FAILED: "UPDATE_FAILED",
|
|
106
|
-
GITIGNORE_FAILED: "GITIGNORE_FAILED",
|
|
107
|
-
INIT_FAILED: "INIT_FAILED",
|
|
108
|
-
MCP_FAILED: "MCP_FAILED",
|
|
109
|
-
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
110
|
-
};
|
|
111
|
-
|
|
112
91
|
// src/utils/vitest.ts
|
|
113
92
|
function isEnvTest() {
|
|
114
93
|
return process.env.NODE_ENV === "test";
|
|
115
94
|
}
|
|
116
95
|
|
|
117
|
-
// src/utils/logger.ts
|
|
118
|
-
var Logger = class {
|
|
119
|
-
/**
|
|
120
|
-
* Create a new Logger instance
|
|
121
|
-
*/
|
|
122
|
-
constructor(_version = "0.0.0") {
|
|
123
|
-
this._version = _version;
|
|
124
|
-
}
|
|
125
|
-
_verbose = false;
|
|
126
|
-
_silent = false;
|
|
127
|
-
_jsonMode = false;
|
|
128
|
-
_jsonOutputDone = false;
|
|
129
|
-
_commandName = "";
|
|
130
|
-
_jsonData = {};
|
|
131
|
-
console = import_consola.consola.withDefaults({
|
|
132
|
-
tag: "rulesync"
|
|
133
|
-
});
|
|
134
|
-
/**
|
|
135
|
-
* Configure logger with verbose and silent mode settings.
|
|
136
|
-
* Handles conflicting flags where silent takes precedence.
|
|
137
|
-
*/
|
|
138
|
-
configure({ verbose, silent }) {
|
|
139
|
-
if (verbose && silent) {
|
|
140
|
-
this._silent = false;
|
|
141
|
-
this.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
142
|
-
}
|
|
143
|
-
this._silent = silent;
|
|
144
|
-
this._verbose = verbose && !silent;
|
|
145
|
-
}
|
|
146
|
-
get verbose() {
|
|
147
|
-
return this._verbose;
|
|
148
|
-
}
|
|
149
|
-
get silent() {
|
|
150
|
-
return this._silent;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Enable JSON output mode
|
|
154
|
-
*/
|
|
155
|
-
setJsonMode(enabled, command) {
|
|
156
|
-
this._jsonMode = enabled;
|
|
157
|
-
this._jsonOutputDone = false;
|
|
158
|
-
this._commandName = command;
|
|
159
|
-
if (enabled) {
|
|
160
|
-
this._jsonData = {};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Check if JSON mode is enabled
|
|
165
|
-
*/
|
|
166
|
-
get jsonMode() {
|
|
167
|
-
return this._jsonMode;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Capture data for JSON output
|
|
171
|
-
*/
|
|
172
|
-
captureData(key, value) {
|
|
173
|
-
if (this._jsonMode) {
|
|
174
|
-
this._jsonData[key] = value;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Get captured JSON data
|
|
179
|
-
*/
|
|
180
|
-
getJsonData() {
|
|
181
|
-
return { ...this._jsonData };
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Output final JSON result
|
|
185
|
-
*/
|
|
186
|
-
outputJson(success, error) {
|
|
187
|
-
if (!this._jsonMode || this._jsonOutputDone) return;
|
|
188
|
-
this._jsonOutputDone = true;
|
|
189
|
-
const output = {
|
|
190
|
-
success,
|
|
191
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
192
|
-
command: this._commandName,
|
|
193
|
-
version: this._version
|
|
194
|
-
};
|
|
195
|
-
if (success) {
|
|
196
|
-
output.data = this._jsonData;
|
|
197
|
-
} else if (error) {
|
|
198
|
-
output.error = {
|
|
199
|
-
code: error.code,
|
|
200
|
-
message: error.message
|
|
201
|
-
};
|
|
202
|
-
if (error.details) {
|
|
203
|
-
output.error.details = error.details;
|
|
204
|
-
}
|
|
205
|
-
if (error.stack) {
|
|
206
|
-
output.error.stack = error.stack;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
const jsonStr = JSON.stringify(output, null, 2);
|
|
210
|
-
if (success) {
|
|
211
|
-
console.log(jsonStr);
|
|
212
|
-
} else {
|
|
213
|
-
console.error(jsonStr);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
info(message, ...args) {
|
|
217
|
-
if (isEnvTest() || this._silent) return;
|
|
218
|
-
if (this._jsonMode) return;
|
|
219
|
-
this.console.info(message, ...args);
|
|
220
|
-
}
|
|
221
|
-
success(message, ...args) {
|
|
222
|
-
if (isEnvTest() || this._silent) return;
|
|
223
|
-
if (this._jsonMode) return;
|
|
224
|
-
this.console.success(message, ...args);
|
|
225
|
-
}
|
|
226
|
-
warn(message, ...args) {
|
|
227
|
-
if (isEnvTest() || this._silent) return;
|
|
228
|
-
if (this._jsonMode) return;
|
|
229
|
-
this.console.warn(message, ...args);
|
|
230
|
-
}
|
|
231
|
-
error(message, code, ...args) {
|
|
232
|
-
if (isEnvTest()) return;
|
|
233
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
234
|
-
if (this._jsonMode) {
|
|
235
|
-
const errorInfo = {
|
|
236
|
-
code: code || ErrorCodes.UNKNOWN_ERROR,
|
|
237
|
-
message: errorMessage
|
|
238
|
-
};
|
|
239
|
-
if (this._verbose && message instanceof Error && message.stack) {
|
|
240
|
-
errorInfo.stack = message.stack;
|
|
241
|
-
}
|
|
242
|
-
this.outputJson(false, errorInfo);
|
|
243
|
-
} else {
|
|
244
|
-
this.console.error(errorMessage, ...args);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
debug(message, ...args) {
|
|
248
|
-
if (isEnvTest() || this._silent) return;
|
|
249
|
-
if (this._jsonMode) return;
|
|
250
|
-
if (this._verbose) {
|
|
251
|
-
this.console.info(message, ...args);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Get the internal console instance (for testing only)
|
|
256
|
-
* @internal
|
|
257
|
-
*/
|
|
258
|
-
_getConsole() {
|
|
259
|
-
return this.console;
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
var logger = new Logger("0.0.0");
|
|
263
|
-
|
|
264
96
|
// src/utils/file.ts
|
|
265
97
|
async function ensureDir(dirPath) {
|
|
266
98
|
try {
|
|
@@ -306,7 +138,6 @@ async function directoryExists(dirPath) {
|
|
|
306
138
|
}
|
|
307
139
|
}
|
|
308
140
|
async function readFileContent(filepath) {
|
|
309
|
-
logger.debug(`Reading file: ${filepath}`);
|
|
310
141
|
return (0, import_promises.readFile)(filepath, "utf-8");
|
|
311
142
|
}
|
|
312
143
|
async function readFileContentOrNull(filepath) {
|
|
@@ -316,7 +147,6 @@ async function readFileContentOrNull(filepath) {
|
|
|
316
147
|
return null;
|
|
317
148
|
}
|
|
318
149
|
async function readFileBuffer(filepath) {
|
|
319
|
-
logger.debug(`Reading file buffer: ${filepath}`);
|
|
320
150
|
return (0, import_promises.readFile)(filepath);
|
|
321
151
|
}
|
|
322
152
|
function addTrailingNewline(content) {
|
|
@@ -326,7 +156,6 @@ function addTrailingNewline(content) {
|
|
|
326
156
|
return content.trimEnd() + "\n";
|
|
327
157
|
}
|
|
328
158
|
async function writeFileContent(filepath, content) {
|
|
329
|
-
logger.debug(`Writing file: ${filepath}`);
|
|
330
159
|
await ensureDir((0, import_node_path2.dirname)(filepath));
|
|
331
160
|
await (0, import_promises.writeFile)(filepath, content, "utf-8");
|
|
332
161
|
}
|
|
@@ -359,25 +188,21 @@ async function findFilesByGlobs(globs, options = {}) {
|
|
|
359
188
|
async function removeDirectory(dirPath) {
|
|
360
189
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
361
190
|
if (dangerousPaths.includes(dirPath) || dirPath === "") {
|
|
362
|
-
logger.warn(`Skipping deletion of dangerous path: ${dirPath}`);
|
|
363
191
|
return;
|
|
364
192
|
}
|
|
365
193
|
try {
|
|
366
194
|
if (await fileExists(dirPath)) {
|
|
367
195
|
await (0, import_promises.rm)(dirPath, { recursive: true, force: true });
|
|
368
196
|
}
|
|
369
|
-
} catch
|
|
370
|
-
logger.warn(`Failed to remove directory ${dirPath}:`, error);
|
|
197
|
+
} catch {
|
|
371
198
|
}
|
|
372
199
|
}
|
|
373
200
|
async function removeFile(filepath) {
|
|
374
|
-
logger.debug(`Removing file: ${filepath}`);
|
|
375
201
|
try {
|
|
376
202
|
if (await fileExists(filepath)) {
|
|
377
203
|
await (0, import_promises.rm)(filepath);
|
|
378
204
|
}
|
|
379
|
-
} catch
|
|
380
|
-
logger.warn(`Failed to remove file ${filepath}:`, error);
|
|
205
|
+
} catch {
|
|
381
206
|
}
|
|
382
207
|
}
|
|
383
208
|
function getHomeDirectory() {
|
|
@@ -442,6 +267,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
442
267
|
"cline",
|
|
443
268
|
"codexcli",
|
|
444
269
|
"copilot",
|
|
270
|
+
"copilotcli",
|
|
445
271
|
"cursor",
|
|
446
272
|
"factorydroid",
|
|
447
273
|
"geminicli",
|
|
@@ -692,16 +518,11 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
692
518
|
if (!await fileExists(filePath)) {
|
|
693
519
|
return {};
|
|
694
520
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
return configParams;
|
|
701
|
-
} catch (error) {
|
|
702
|
-
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
703
|
-
throw error;
|
|
704
|
-
}
|
|
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;
|
|
705
526
|
};
|
|
706
527
|
var mergeConfigs = (baseConfig, localConfig) => {
|
|
707
528
|
return {
|
|
@@ -782,7 +603,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
782
603
|
}
|
|
783
604
|
|
|
784
605
|
// src/lib/generate.ts
|
|
785
|
-
var
|
|
606
|
+
var import_node_path120 = require("path");
|
|
786
607
|
var import_es_toolkit4 = require("es-toolkit");
|
|
787
608
|
|
|
788
609
|
// src/features/commands/commands-processor.ts
|
|
@@ -793,9 +614,15 @@ var import_mini14 = require("zod/mini");
|
|
|
793
614
|
var FeatureProcessor = class {
|
|
794
615
|
baseDir;
|
|
795
616
|
dryRun;
|
|
796
|
-
|
|
617
|
+
logger;
|
|
618
|
+
constructor({
|
|
619
|
+
baseDir = process.cwd(),
|
|
620
|
+
dryRun = false,
|
|
621
|
+
logger
|
|
622
|
+
}) {
|
|
797
623
|
this.baseDir = baseDir;
|
|
798
624
|
this.dryRun = dryRun;
|
|
625
|
+
this.logger = logger;
|
|
799
626
|
}
|
|
800
627
|
/**
|
|
801
628
|
* Return tool targets that this feature supports.
|
|
@@ -818,7 +645,7 @@ var FeatureProcessor = class {
|
|
|
818
645
|
continue;
|
|
819
646
|
}
|
|
820
647
|
if (this.dryRun) {
|
|
821
|
-
logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
648
|
+
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
822
649
|
} else {
|
|
823
650
|
await writeFileContent(filePath, contentWithNewline);
|
|
824
651
|
}
|
|
@@ -842,7 +669,7 @@ var FeatureProcessor = class {
|
|
|
842
669
|
for (const aiFile of orphanFiles) {
|
|
843
670
|
const filePath = aiFile.getFilePath();
|
|
844
671
|
if (this.dryRun) {
|
|
845
|
-
logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
672
|
+
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
846
673
|
} else {
|
|
847
674
|
await removeFile(filePath);
|
|
848
675
|
}
|
|
@@ -3214,9 +3041,10 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3214
3041
|
toolTarget,
|
|
3215
3042
|
global = false,
|
|
3216
3043
|
getFactory = defaultGetFactory,
|
|
3217
|
-
dryRun = false
|
|
3044
|
+
dryRun = false,
|
|
3045
|
+
logger
|
|
3218
3046
|
}) {
|
|
3219
|
-
super({ baseDir, dryRun });
|
|
3047
|
+
super({ baseDir, dryRun, logger });
|
|
3220
3048
|
const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3221
3049
|
if (!result.success) {
|
|
3222
3050
|
throw new Error(
|
|
@@ -3243,7 +3071,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3243
3071
|
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
3244
3072
|
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
3245
3073
|
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
3246
|
-
logger.warn(
|
|
3074
|
+
this.logger.warn(
|
|
3247
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.`
|
|
3248
3076
|
);
|
|
3249
3077
|
} else if (!firstOrigin) {
|
|
@@ -3289,7 +3117,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3289
3117
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
3290
3118
|
)
|
|
3291
3119
|
);
|
|
3292
|
-
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3120
|
+
this.logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3293
3121
|
return rulesyncCommands;
|
|
3294
3122
|
}
|
|
3295
3123
|
/**
|
|
@@ -3313,7 +3141,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3313
3141
|
global: this.global
|
|
3314
3142
|
})
|
|
3315
3143
|
).filter((cmd) => cmd.isDeletable());
|
|
3316
|
-
logger.debug(
|
|
3144
|
+
this.logger.debug(
|
|
3145
|
+
`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`
|
|
3146
|
+
);
|
|
3317
3147
|
return toolCommands2;
|
|
3318
3148
|
}
|
|
3319
3149
|
const toolCommands = await Promise.all(
|
|
@@ -3325,7 +3155,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3325
3155
|
})
|
|
3326
3156
|
)
|
|
3327
3157
|
);
|
|
3328
|
-
logger.debug(
|
|
3158
|
+
this.logger.debug(
|
|
3159
|
+
`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`
|
|
3160
|
+
);
|
|
3329
3161
|
return toolCommands;
|
|
3330
3162
|
}
|
|
3331
3163
|
/**
|
|
@@ -3594,7 +3426,8 @@ function isToolMatcherEntry(x) {
|
|
|
3594
3426
|
function canonicalToToolHooks({
|
|
3595
3427
|
config,
|
|
3596
3428
|
toolOverrideHooks,
|
|
3597
|
-
converterConfig
|
|
3429
|
+
converterConfig,
|
|
3430
|
+
logger
|
|
3598
3431
|
}) {
|
|
3599
3432
|
const supported = new Set(converterConfig.supportedEvents);
|
|
3600
3433
|
const sharedHooks = {};
|
|
@@ -3621,7 +3454,7 @@ function canonicalToToolHooks({
|
|
|
3621
3454
|
const isNoMatcherEvent = converterConfig.noMatcherEvents?.has(eventName) ?? false;
|
|
3622
3455
|
for (const [matcherKey, defs] of byMatcher) {
|
|
3623
3456
|
if (isNoMatcherEvent && matcherKey) {
|
|
3624
|
-
logger
|
|
3457
|
+
logger?.warn(
|
|
3625
3458
|
`matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
|
|
3626
3459
|
);
|
|
3627
3460
|
}
|
|
@@ -3818,7 +3651,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3818
3651
|
baseDir = process.cwd(),
|
|
3819
3652
|
rulesyncHooks,
|
|
3820
3653
|
validate = true,
|
|
3821
|
-
global = false
|
|
3654
|
+
global = false,
|
|
3655
|
+
logger
|
|
3822
3656
|
}) {
|
|
3823
3657
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3824
3658
|
const filePath = (0, import_node_path24.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -3839,7 +3673,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3839
3673
|
const claudeHooks = canonicalToToolHooks({
|
|
3840
3674
|
config,
|
|
3841
3675
|
toolOverrideHooks: config.claudecode?.hooks,
|
|
3842
|
-
converterConfig: CLAUDE_CONVERTER_CONFIG
|
|
3676
|
+
converterConfig: CLAUDE_CONVERTER_CONFIG,
|
|
3677
|
+
logger
|
|
3843
3678
|
});
|
|
3844
3679
|
const merged = { ...settings, hooks: claudeHooks };
|
|
3845
3680
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -3939,14 +3774,14 @@ function canonicalToCopilotHooks(config) {
|
|
|
3939
3774
|
}
|
|
3940
3775
|
return copilot;
|
|
3941
3776
|
}
|
|
3942
|
-
function resolveImportCommand(entry) {
|
|
3777
|
+
function resolveImportCommand(entry, logger) {
|
|
3943
3778
|
const hasBash = typeof entry.bash === "string";
|
|
3944
3779
|
const hasPowershell = typeof entry.powershell === "string";
|
|
3945
3780
|
if (hasBash && hasPowershell) {
|
|
3946
3781
|
const isWindows = process.platform === "win32";
|
|
3947
3782
|
const chosen = isWindows ? "powershell" : "bash";
|
|
3948
3783
|
const ignored = isWindows ? "bash" : "powershell";
|
|
3949
|
-
logger
|
|
3784
|
+
logger?.warn(
|
|
3950
3785
|
`Copilot hook has both bash and powershell commands; using ${chosen} and ignoring ${ignored} on this platform.`
|
|
3951
3786
|
);
|
|
3952
3787
|
return isWindows ? entry.powershell : entry.bash;
|
|
@@ -3957,7 +3792,7 @@ function resolveImportCommand(entry) {
|
|
|
3957
3792
|
}
|
|
3958
3793
|
return void 0;
|
|
3959
3794
|
}
|
|
3960
|
-
function copilotHooksToCanonical(copilotHooks) {
|
|
3795
|
+
function copilotHooksToCanonical(copilotHooks, logger) {
|
|
3961
3796
|
if (copilotHooks === null || copilotHooks === void 0 || typeof copilotHooks !== "object") {
|
|
3962
3797
|
return {};
|
|
3963
3798
|
}
|
|
@@ -3970,7 +3805,7 @@ function copilotHooksToCanonical(copilotHooks) {
|
|
|
3970
3805
|
const parseResult = CopilotHookEntrySchema.safeParse(rawEntry);
|
|
3971
3806
|
if (!parseResult.success) continue;
|
|
3972
3807
|
const entry = parseResult.data;
|
|
3973
|
-
const command = resolveImportCommand(entry);
|
|
3808
|
+
const command = resolveImportCommand(entry, logger);
|
|
3974
3809
|
const timeout = entry.timeoutSec;
|
|
3975
3810
|
defs.push({
|
|
3976
3811
|
type: "command",
|
|
@@ -4030,7 +3865,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4030
3865
|
validate
|
|
4031
3866
|
});
|
|
4032
3867
|
}
|
|
4033
|
-
toRulesyncHooks() {
|
|
3868
|
+
toRulesyncHooks(options) {
|
|
4034
3869
|
let parsed;
|
|
4035
3870
|
try {
|
|
4036
3871
|
parsed = JSON.parse(this.getFileContent());
|
|
@@ -4042,7 +3877,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
4042
3877
|
}
|
|
4043
3878
|
);
|
|
4044
3879
|
}
|
|
4045
|
-
const hooks = copilotHooksToCanonical(parsed.hooks);
|
|
3880
|
+
const hooks = copilotHooksToCanonical(parsed.hooks, options?.logger);
|
|
4046
3881
|
return this.toRulesyncHooksDefault({
|
|
4047
3882
|
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
4048
3883
|
});
|
|
@@ -4214,7 +4049,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4214
4049
|
baseDir = process.cwd(),
|
|
4215
4050
|
rulesyncHooks,
|
|
4216
4051
|
validate = true,
|
|
4217
|
-
global = false
|
|
4052
|
+
global = false,
|
|
4053
|
+
logger
|
|
4218
4054
|
}) {
|
|
4219
4055
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
4220
4056
|
const filePath = (0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -4235,7 +4071,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4235
4071
|
const factorydroidHooks = canonicalToToolHooks({
|
|
4236
4072
|
config,
|
|
4237
4073
|
toolOverrideHooks: config.factorydroid?.hooks,
|
|
4238
|
-
converterConfig: FACTORYDROID_CONVERTER_CONFIG
|
|
4074
|
+
converterConfig: FACTORYDROID_CONVERTER_CONFIG,
|
|
4075
|
+
logger
|
|
4239
4076
|
});
|
|
4240
4077
|
const merged = { ...settings, hooks: factorydroidHooks };
|
|
4241
4078
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -4734,9 +4571,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4734
4571
|
baseDir = process.cwd(),
|
|
4735
4572
|
toolTarget,
|
|
4736
4573
|
global = false,
|
|
4737
|
-
dryRun = false
|
|
4574
|
+
dryRun = false,
|
|
4575
|
+
logger
|
|
4738
4576
|
}) {
|
|
4739
|
-
super({ baseDir, dryRun });
|
|
4577
|
+
super({ baseDir, dryRun, logger });
|
|
4740
4578
|
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
4741
4579
|
if (!result.success) {
|
|
4742
4580
|
throw new Error(
|
|
@@ -4755,7 +4593,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4755
4593
|
})
|
|
4756
4594
|
];
|
|
4757
4595
|
} catch (error) {
|
|
4758
|
-
logger.error(
|
|
4596
|
+
this.logger.error(
|
|
4759
4597
|
`Failed to load Rulesync hooks file (${RULESYNC_HOOKS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
4760
4598
|
);
|
|
4761
4599
|
return [];
|
|
@@ -4774,7 +4612,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4774
4612
|
global: this.global
|
|
4775
4613
|
});
|
|
4776
4614
|
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
4777
|
-
logger.debug(
|
|
4615
|
+
this.logger.debug(
|
|
4778
4616
|
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
4779
4617
|
);
|
|
4780
4618
|
return list;
|
|
@@ -4784,14 +4622,14 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4784
4622
|
validate: true,
|
|
4785
4623
|
global: this.global
|
|
4786
4624
|
});
|
|
4787
|
-
logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4625
|
+
this.logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4788
4626
|
return [toolHooks];
|
|
4789
4627
|
} catch (error) {
|
|
4790
4628
|
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
4791
4629
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
4792
|
-
logger.debug(msg);
|
|
4630
|
+
this.logger.debug(msg);
|
|
4793
4631
|
} else {
|
|
4794
|
-
logger.error(msg);
|
|
4632
|
+
this.logger.error(msg);
|
|
4795
4633
|
}
|
|
4796
4634
|
return [];
|
|
4797
4635
|
}
|
|
@@ -4812,7 +4650,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4812
4650
|
const configEventNames = new Set(Object.keys(effectiveHooks));
|
|
4813
4651
|
const skipped = [...configEventNames].filter((e) => !supportedEvents.has(e));
|
|
4814
4652
|
if (skipped.length > 0) {
|
|
4815
|
-
logger.warn(
|
|
4653
|
+
this.logger.warn(
|
|
4816
4654
|
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
4817
4655
|
);
|
|
4818
4656
|
}
|
|
@@ -4831,7 +4669,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4831
4669
|
}
|
|
4832
4670
|
}
|
|
4833
4671
|
for (const [hookType, events] of unsupportedTypeToEvents) {
|
|
4834
|
-
logger.warn(
|
|
4672
|
+
this.logger.warn(
|
|
4835
4673
|
`Skipped ${hookType}-type hook(s) for ${this.toolTarget} (not supported): ${Array.from(events).join(", ")}`
|
|
4836
4674
|
);
|
|
4837
4675
|
}
|
|
@@ -4846,7 +4684,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4846
4684
|
}
|
|
4847
4685
|
}
|
|
4848
4686
|
if (eventsWithMatcher.size > 0) {
|
|
4849
|
-
logger.warn(
|
|
4687
|
+
this.logger.warn(
|
|
4850
4688
|
`Skipped matcher hook(s) for ${this.toolTarget} (not supported): ${Array.from(eventsWithMatcher).join(", ")}`
|
|
4851
4689
|
);
|
|
4852
4690
|
}
|
|
@@ -5908,9 +5746,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5908
5746
|
baseDir = process.cwd(),
|
|
5909
5747
|
toolTarget,
|
|
5910
5748
|
getFactory = defaultGetFactory2,
|
|
5911
|
-
dryRun = false
|
|
5749
|
+
dryRun = false,
|
|
5750
|
+
logger
|
|
5912
5751
|
}) {
|
|
5913
|
-
super({ baseDir, dryRun });
|
|
5752
|
+
super({ baseDir, dryRun, logger });
|
|
5914
5753
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
5915
5754
|
if (!result.success) {
|
|
5916
5755
|
throw new Error(
|
|
@@ -5932,7 +5771,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5932
5771
|
try {
|
|
5933
5772
|
return [await RulesyncIgnore.fromFile()];
|
|
5934
5773
|
} catch (error) {
|
|
5935
|
-
logger.error(
|
|
5774
|
+
this.logger.error(
|
|
5936
5775
|
`Failed to load rulesync ignore file (${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
5937
5776
|
);
|
|
5938
5777
|
return [];
|
|
@@ -5962,9 +5801,9 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5962
5801
|
} catch (error) {
|
|
5963
5802
|
const errorMessage = `Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`;
|
|
5964
5803
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
5965
|
-
logger.debug(errorMessage);
|
|
5804
|
+
this.logger.debug(errorMessage);
|
|
5966
5805
|
} else {
|
|
5967
|
-
logger.error(errorMessage);
|
|
5806
|
+
this.logger.error(errorMessage);
|
|
5968
5807
|
}
|
|
5969
5808
|
return [];
|
|
5970
5809
|
}
|
|
@@ -6094,7 +5933,10 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6094
5933
|
}
|
|
6095
5934
|
return { success: true, error: null };
|
|
6096
5935
|
}
|
|
6097
|
-
static async fromFile({
|
|
5936
|
+
static async fromFile({
|
|
5937
|
+
validate = true,
|
|
5938
|
+
logger
|
|
5939
|
+
}) {
|
|
6098
5940
|
const baseDir = process.cwd();
|
|
6099
5941
|
const paths = this.getSettablePaths();
|
|
6100
5942
|
const recommendedPath = (0, import_node_path44.join)(
|
|
@@ -6114,7 +5956,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6114
5956
|
});
|
|
6115
5957
|
}
|
|
6116
5958
|
if (await fileExists(legacyPath)) {
|
|
6117
|
-
logger
|
|
5959
|
+
logger?.warn(
|
|
6118
5960
|
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
6119
5961
|
);
|
|
6120
5962
|
const fileContent2 = await readFileContent(legacyPath);
|
|
@@ -6616,8 +6458,145 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6616
6458
|
}
|
|
6617
6459
|
};
|
|
6618
6460
|
|
|
6619
|
-
// src/features/mcp/
|
|
6461
|
+
// src/features/mcp/copilotcli-mcp.ts
|
|
6620
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");
|
|
6621
6600
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6622
6601
|
function isMcpServers(value) {
|
|
6623
6602
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -6667,7 +6646,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6667
6646
|
this.json = JSON.parse(this.fileContent);
|
|
6668
6647
|
} catch (error) {
|
|
6669
6648
|
throw new Error(
|
|
6670
|
-
`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)}`,
|
|
6671
6650
|
{ cause: error }
|
|
6672
6651
|
);
|
|
6673
6652
|
}
|
|
@@ -6693,14 +6672,14 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6693
6672
|
global = false
|
|
6694
6673
|
}) {
|
|
6695
6674
|
const paths = this.getSettablePaths({ global });
|
|
6696
|
-
const filePath = (0,
|
|
6675
|
+
const filePath = (0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6697
6676
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"mcpServers":{}}';
|
|
6698
6677
|
let json;
|
|
6699
6678
|
try {
|
|
6700
6679
|
json = JSON.parse(fileContent);
|
|
6701
6680
|
} catch (error) {
|
|
6702
6681
|
throw new Error(
|
|
6703
|
-
`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)}`,
|
|
6704
6683
|
{ cause: error }
|
|
6705
6684
|
);
|
|
6706
6685
|
}
|
|
@@ -6722,7 +6701,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6722
6701
|
}) {
|
|
6723
6702
|
const paths = this.getSettablePaths({ global });
|
|
6724
6703
|
const fileContent = await readOrInitializeFileContent(
|
|
6725
|
-
(0,
|
|
6704
|
+
(0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6726
6705
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6727
6706
|
);
|
|
6728
6707
|
let json;
|
|
@@ -6730,7 +6709,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6730
6709
|
json = JSON.parse(fileContent);
|
|
6731
6710
|
} catch (error) {
|
|
6732
6711
|
throw new Error(
|
|
6733
|
-
`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)}`,
|
|
6734
6713
|
{ cause: error }
|
|
6735
6714
|
);
|
|
6736
6715
|
}
|
|
@@ -6779,7 +6758,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6779
6758
|
};
|
|
6780
6759
|
|
|
6781
6760
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6782
|
-
var
|
|
6761
|
+
var import_node_path51 = require("path");
|
|
6783
6762
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6784
6763
|
json;
|
|
6785
6764
|
constructor(params) {
|
|
@@ -6800,7 +6779,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6800
6779
|
validate = true
|
|
6801
6780
|
}) {
|
|
6802
6781
|
const fileContent = await readFileContent(
|
|
6803
|
-
(0,
|
|
6782
|
+
(0, import_node_path51.join)(
|
|
6804
6783
|
baseDir,
|
|
6805
6784
|
this.getSettablePaths().relativeDirPath,
|
|
6806
6785
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6854,7 +6833,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6854
6833
|
};
|
|
6855
6834
|
|
|
6856
6835
|
// src/features/mcp/geminicli-mcp.ts
|
|
6857
|
-
var
|
|
6836
|
+
var import_node_path52 = require("path");
|
|
6858
6837
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6859
6838
|
json;
|
|
6860
6839
|
constructor(params) {
|
|
@@ -6882,7 +6861,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6882
6861
|
global = false
|
|
6883
6862
|
}) {
|
|
6884
6863
|
const paths = this.getSettablePaths({ global });
|
|
6885
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6864
|
+
const fileContent = await readFileContentOrNull((0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6886
6865
|
const json = JSON.parse(fileContent);
|
|
6887
6866
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6888
6867
|
return new _GeminiCliMcp({
|
|
@@ -6901,7 +6880,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6901
6880
|
}) {
|
|
6902
6881
|
const paths = this.getSettablePaths({ global });
|
|
6903
6882
|
const fileContent = await readOrInitializeFileContent(
|
|
6904
|
-
(0,
|
|
6883
|
+
(0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6905
6884
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6906
6885
|
);
|
|
6907
6886
|
const json = JSON.parse(fileContent);
|
|
@@ -6946,7 +6925,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6946
6925
|
};
|
|
6947
6926
|
|
|
6948
6927
|
// src/features/mcp/junie-mcp.ts
|
|
6949
|
-
var
|
|
6928
|
+
var import_node_path53 = require("path");
|
|
6950
6929
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6951
6930
|
json;
|
|
6952
6931
|
constructor(params) {
|
|
@@ -6958,7 +6937,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6958
6937
|
}
|
|
6959
6938
|
static getSettablePaths() {
|
|
6960
6939
|
return {
|
|
6961
|
-
relativeDirPath: (0,
|
|
6940
|
+
relativeDirPath: (0, import_node_path53.join)(".junie", "mcp"),
|
|
6962
6941
|
relativeFilePath: "mcp.json"
|
|
6963
6942
|
};
|
|
6964
6943
|
}
|
|
@@ -6967,7 +6946,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6967
6946
|
validate = true
|
|
6968
6947
|
}) {
|
|
6969
6948
|
const fileContent = await readFileContent(
|
|
6970
|
-
(0,
|
|
6949
|
+
(0, import_node_path53.join)(
|
|
6971
6950
|
baseDir,
|
|
6972
6951
|
this.getSettablePaths().relativeDirPath,
|
|
6973
6952
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7016,7 +6995,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
7016
6995
|
};
|
|
7017
6996
|
|
|
7018
6997
|
// src/features/mcp/kilo-mcp.ts
|
|
7019
|
-
var
|
|
6998
|
+
var import_node_path54 = require("path");
|
|
7020
6999
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
7021
7000
|
json;
|
|
7022
7001
|
constructor(params) {
|
|
@@ -7037,7 +7016,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7037
7016
|
validate = true
|
|
7038
7017
|
}) {
|
|
7039
7018
|
const paths = this.getSettablePaths();
|
|
7040
|
-
const fileContent = await readFileContentOrNull((0,
|
|
7019
|
+
const fileContent = await readFileContentOrNull((0, import_node_path54.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7041
7020
|
return new _KiloMcp({
|
|
7042
7021
|
baseDir,
|
|
7043
7022
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7085,7 +7064,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
7085
7064
|
};
|
|
7086
7065
|
|
|
7087
7066
|
// src/features/mcp/kiro-mcp.ts
|
|
7088
|
-
var
|
|
7067
|
+
var import_node_path55 = require("path");
|
|
7089
7068
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
7090
7069
|
json;
|
|
7091
7070
|
constructor(params) {
|
|
@@ -7097,7 +7076,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7097
7076
|
}
|
|
7098
7077
|
static getSettablePaths() {
|
|
7099
7078
|
return {
|
|
7100
|
-
relativeDirPath: (0,
|
|
7079
|
+
relativeDirPath: (0, import_node_path55.join)(".kiro", "settings"),
|
|
7101
7080
|
relativeFilePath: "mcp.json"
|
|
7102
7081
|
};
|
|
7103
7082
|
}
|
|
@@ -7106,7 +7085,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7106
7085
|
validate = true
|
|
7107
7086
|
}) {
|
|
7108
7087
|
const paths = this.getSettablePaths();
|
|
7109
|
-
const fileContent = await readFileContentOrNull((0,
|
|
7088
|
+
const fileContent = await readFileContentOrNull((0, import_node_path55.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7110
7089
|
return new _KiroMcp({
|
|
7111
7090
|
baseDir,
|
|
7112
7091
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7154,7 +7133,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7154
7133
|
};
|
|
7155
7134
|
|
|
7156
7135
|
// src/features/mcp/opencode-mcp.ts
|
|
7157
|
-
var
|
|
7136
|
+
var import_node_path56 = require("path");
|
|
7158
7137
|
var import_jsonc_parser2 = require("jsonc-parser");
|
|
7159
7138
|
var import_mini22 = require("zod/mini");
|
|
7160
7139
|
var OpencodeMcpLocalServerSchema = import_mini22.z.object({
|
|
@@ -7295,7 +7274,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7295
7274
|
static getSettablePaths({ global } = {}) {
|
|
7296
7275
|
if (global) {
|
|
7297
7276
|
return {
|
|
7298
|
-
relativeDirPath: (0,
|
|
7277
|
+
relativeDirPath: (0, import_node_path56.join)(".config", "opencode"),
|
|
7299
7278
|
relativeFilePath: "opencode.json"
|
|
7300
7279
|
};
|
|
7301
7280
|
}
|
|
@@ -7310,11 +7289,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7310
7289
|
global = false
|
|
7311
7290
|
}) {
|
|
7312
7291
|
const basePaths = this.getSettablePaths({ global });
|
|
7313
|
-
const jsonDir = (0,
|
|
7292
|
+
const jsonDir = (0, import_node_path56.join)(baseDir, basePaths.relativeDirPath);
|
|
7314
7293
|
let fileContent = null;
|
|
7315
7294
|
let relativeFilePath = "opencode.jsonc";
|
|
7316
|
-
const jsoncPath = (0,
|
|
7317
|
-
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");
|
|
7318
7297
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7319
7298
|
if (!fileContent) {
|
|
7320
7299
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7340,11 +7319,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7340
7319
|
global = false
|
|
7341
7320
|
}) {
|
|
7342
7321
|
const basePaths = this.getSettablePaths({ global });
|
|
7343
|
-
const jsonDir = (0,
|
|
7322
|
+
const jsonDir = (0, import_node_path56.join)(baseDir, basePaths.relativeDirPath);
|
|
7344
7323
|
let fileContent = null;
|
|
7345
7324
|
let relativeFilePath = "opencode.jsonc";
|
|
7346
|
-
const jsoncPath = (0,
|
|
7347
|
-
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");
|
|
7348
7327
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7349
7328
|
if (!fileContent) {
|
|
7350
7329
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7405,7 +7384,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7405
7384
|
};
|
|
7406
7385
|
|
|
7407
7386
|
// src/features/mcp/roo-mcp.ts
|
|
7408
|
-
var
|
|
7387
|
+
var import_node_path57 = require("path");
|
|
7409
7388
|
function isRooMcpServers(value) {
|
|
7410
7389
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7411
7390
|
}
|
|
@@ -7457,7 +7436,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7457
7436
|
validate = true
|
|
7458
7437
|
}) {
|
|
7459
7438
|
const fileContent = await readFileContent(
|
|
7460
|
-
(0,
|
|
7439
|
+
(0, import_node_path57.join)(
|
|
7461
7440
|
baseDir,
|
|
7462
7441
|
this.getSettablePaths().relativeDirPath,
|
|
7463
7442
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7519,6 +7498,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
7519
7498
|
"cline",
|
|
7520
7499
|
"codexcli",
|
|
7521
7500
|
"copilot",
|
|
7501
|
+
"copilotcli",
|
|
7522
7502
|
"cursor",
|
|
7523
7503
|
"factorydroid",
|
|
7524
7504
|
"geminicli",
|
|
@@ -7590,6 +7570,18 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
7590
7570
|
}
|
|
7591
7571
|
}
|
|
7592
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
|
+
],
|
|
7593
7585
|
[
|
|
7594
7586
|
"cursor",
|
|
7595
7587
|
{
|
|
@@ -7712,9 +7704,10 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7712
7704
|
toolTarget,
|
|
7713
7705
|
global = false,
|
|
7714
7706
|
getFactory = defaultGetFactory3,
|
|
7715
|
-
dryRun = false
|
|
7707
|
+
dryRun = false,
|
|
7708
|
+
logger
|
|
7716
7709
|
}) {
|
|
7717
|
-
super({ baseDir, dryRun });
|
|
7710
|
+
super({ baseDir, dryRun, logger });
|
|
7718
7711
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
7719
7712
|
if (!result.success) {
|
|
7720
7713
|
throw new Error(
|
|
@@ -7733,7 +7726,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7733
7726
|
try {
|
|
7734
7727
|
return [await RulesyncMcp.fromFile({})];
|
|
7735
7728
|
} catch (error) {
|
|
7736
|
-
logger.error(
|
|
7729
|
+
this.logger.error(
|
|
7737
7730
|
`Failed to load a Rulesync MCP file (${RULESYNC_MCP_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
7738
7731
|
);
|
|
7739
7732
|
return [];
|
|
@@ -7757,7 +7750,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7757
7750
|
global: this.global
|
|
7758
7751
|
});
|
|
7759
7752
|
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
7760
|
-
logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7753
|
+
this.logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7761
7754
|
return toolMcps2;
|
|
7762
7755
|
}
|
|
7763
7756
|
const toolMcps = [
|
|
@@ -7767,14 +7760,14 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7767
7760
|
global: this.global
|
|
7768
7761
|
})
|
|
7769
7762
|
];
|
|
7770
|
-
logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7763
|
+
this.logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7771
7764
|
return toolMcps;
|
|
7772
7765
|
} catch (error) {
|
|
7773
7766
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
7774
7767
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
7775
|
-
logger.debug(errorMessage);
|
|
7768
|
+
this.logger.debug(errorMessage);
|
|
7776
7769
|
} else {
|
|
7777
|
-
logger.error(errorMessage);
|
|
7770
|
+
this.logger.error(errorMessage);
|
|
7778
7771
|
}
|
|
7779
7772
|
return [];
|
|
7780
7773
|
}
|
|
@@ -7830,7 +7823,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7830
7823
|
};
|
|
7831
7824
|
|
|
7832
7825
|
// src/features/rules/rules-processor.ts
|
|
7833
|
-
var
|
|
7826
|
+
var import_node_path119 = require("path");
|
|
7834
7827
|
var import_toon = require("@toon-format/toon");
|
|
7835
7828
|
var import_mini57 = require("zod/mini");
|
|
7836
7829
|
|
|
@@ -7838,17 +7831,17 @@ var import_mini57 = require("zod/mini");
|
|
|
7838
7831
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7839
7832
|
|
|
7840
7833
|
// src/features/skills/agentsmd-skill.ts
|
|
7841
|
-
var
|
|
7834
|
+
var import_node_path61 = require("path");
|
|
7842
7835
|
|
|
7843
7836
|
// src/features/skills/simulated-skill.ts
|
|
7844
|
-
var
|
|
7837
|
+
var import_node_path60 = require("path");
|
|
7845
7838
|
var import_mini24 = require("zod/mini");
|
|
7846
7839
|
|
|
7847
7840
|
// src/features/skills/tool-skill.ts
|
|
7848
|
-
var
|
|
7841
|
+
var import_node_path59 = require("path");
|
|
7849
7842
|
|
|
7850
7843
|
// src/types/ai-dir.ts
|
|
7851
|
-
var
|
|
7844
|
+
var import_node_path58 = __toESM(require("path"), 1);
|
|
7852
7845
|
var AiDir = class {
|
|
7853
7846
|
/**
|
|
7854
7847
|
* @example "."
|
|
@@ -7882,7 +7875,7 @@ var AiDir = class {
|
|
|
7882
7875
|
otherFiles = [],
|
|
7883
7876
|
global = false
|
|
7884
7877
|
}) {
|
|
7885
|
-
if (dirName.includes(
|
|
7878
|
+
if (dirName.includes(import_node_path58.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
7886
7879
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
7887
7880
|
}
|
|
7888
7881
|
this.baseDir = baseDir;
|
|
@@ -7905,11 +7898,11 @@ var AiDir = class {
|
|
|
7905
7898
|
return this.dirName;
|
|
7906
7899
|
}
|
|
7907
7900
|
getDirPath() {
|
|
7908
|
-
const fullPath =
|
|
7909
|
-
const resolvedFull = (0,
|
|
7910
|
-
const resolvedBase = (0,
|
|
7911
|
-
const rel = (0,
|
|
7912
|
-
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)) {
|
|
7913
7906
|
throw new Error(
|
|
7914
7907
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
7915
7908
|
);
|
|
@@ -7923,7 +7916,7 @@ var AiDir = class {
|
|
|
7923
7916
|
return this.otherFiles;
|
|
7924
7917
|
}
|
|
7925
7918
|
getRelativePathFromCwd() {
|
|
7926
|
-
return
|
|
7919
|
+
return import_node_path58.default.join(this.relativeDirPath, this.dirName);
|
|
7927
7920
|
}
|
|
7928
7921
|
getGlobal() {
|
|
7929
7922
|
return this.global;
|
|
@@ -7942,15 +7935,15 @@ var AiDir = class {
|
|
|
7942
7935
|
* @returns Array of files with their relative paths and buffers
|
|
7943
7936
|
*/
|
|
7944
7937
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7945
|
-
const dirPath = (0,
|
|
7946
|
-
const glob = (0,
|
|
7938
|
+
const dirPath = (0, import_node_path58.join)(baseDir, relativeDirPath, dirName);
|
|
7939
|
+
const glob = (0, import_node_path58.join)(dirPath, "**", "*");
|
|
7947
7940
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7948
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
7941
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path58.basename)(filePath) !== excludeFileName);
|
|
7949
7942
|
const files = await Promise.all(
|
|
7950
7943
|
filteredPaths.map(async (filePath) => {
|
|
7951
7944
|
const fileBuffer = await readFileBuffer(filePath);
|
|
7952
7945
|
return {
|
|
7953
|
-
relativeFilePathToDirPath: (0,
|
|
7946
|
+
relativeFilePathToDirPath: (0, import_node_path58.relative)(dirPath, filePath),
|
|
7954
7947
|
fileBuffer
|
|
7955
7948
|
};
|
|
7956
7949
|
})
|
|
@@ -8041,8 +8034,8 @@ var ToolSkill = class extends AiDir {
|
|
|
8041
8034
|
}) {
|
|
8042
8035
|
const settablePaths = getSettablePaths({ global });
|
|
8043
8036
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8044
|
-
const skillDirPath = (0,
|
|
8045
|
-
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);
|
|
8046
8039
|
if (!await fileExists(skillFilePath)) {
|
|
8047
8040
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8048
8041
|
}
|
|
@@ -8066,7 +8059,7 @@ var ToolSkill = class extends AiDir {
|
|
|
8066
8059
|
}
|
|
8067
8060
|
requireMainFileFrontmatter() {
|
|
8068
8061
|
if (!this.mainFile?.frontmatter) {
|
|
8069
|
-
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)}`);
|
|
8070
8063
|
}
|
|
8071
8064
|
return this.mainFile.frontmatter;
|
|
8072
8065
|
}
|
|
@@ -8106,7 +8099,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8106
8099
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8107
8100
|
if (!result.success) {
|
|
8108
8101
|
throw new Error(
|
|
8109
|
-
`Invalid frontmatter in ${(0,
|
|
8102
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
8110
8103
|
);
|
|
8111
8104
|
}
|
|
8112
8105
|
}
|
|
@@ -8165,8 +8158,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8165
8158
|
}) {
|
|
8166
8159
|
const settablePaths = this.getSettablePaths();
|
|
8167
8160
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8168
|
-
const skillDirPath = (0,
|
|
8169
|
-
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);
|
|
8170
8163
|
if (!await fileExists(skillFilePath)) {
|
|
8171
8164
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8172
8165
|
}
|
|
@@ -8243,7 +8236,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8243
8236
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
8244
8237
|
}
|
|
8245
8238
|
return {
|
|
8246
|
-
relativeDirPath: (0,
|
|
8239
|
+
relativeDirPath: (0, import_node_path61.join)(".agents", "skills")
|
|
8247
8240
|
};
|
|
8248
8241
|
}
|
|
8249
8242
|
static async fromDir(params) {
|
|
@@ -8270,11 +8263,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8270
8263
|
};
|
|
8271
8264
|
|
|
8272
8265
|
// src/features/skills/factorydroid-skill.ts
|
|
8273
|
-
var
|
|
8266
|
+
var import_node_path62 = require("path");
|
|
8274
8267
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
8275
8268
|
static getSettablePaths(_options) {
|
|
8276
8269
|
return {
|
|
8277
|
-
relativeDirPath: (0,
|
|
8270
|
+
relativeDirPath: (0, import_node_path62.join)(".factory", "skills")
|
|
8278
8271
|
};
|
|
8279
8272
|
}
|
|
8280
8273
|
static async fromDir(params) {
|
|
@@ -8301,23 +8294,26 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
8301
8294
|
};
|
|
8302
8295
|
|
|
8303
8296
|
// src/features/skills/skills-processor.ts
|
|
8304
|
-
var
|
|
8297
|
+
var import_node_path80 = require("path");
|
|
8305
8298
|
var import_mini40 = require("zod/mini");
|
|
8306
8299
|
|
|
8307
8300
|
// src/types/dir-feature-processor.ts
|
|
8308
|
-
var
|
|
8301
|
+
var import_node_path63 = require("path");
|
|
8309
8302
|
var DirFeatureProcessor = class {
|
|
8310
8303
|
baseDir;
|
|
8311
8304
|
dryRun;
|
|
8312
8305
|
avoidBlockScalars;
|
|
8306
|
+
logger;
|
|
8313
8307
|
constructor({
|
|
8314
8308
|
baseDir = process.cwd(),
|
|
8315
8309
|
dryRun = false,
|
|
8316
|
-
avoidBlockScalars = false
|
|
8310
|
+
avoidBlockScalars = false,
|
|
8311
|
+
logger
|
|
8317
8312
|
}) {
|
|
8318
8313
|
this.baseDir = baseDir;
|
|
8319
8314
|
this.dryRun = dryRun;
|
|
8320
8315
|
this.avoidBlockScalars = avoidBlockScalars;
|
|
8316
|
+
this.logger = logger;
|
|
8321
8317
|
}
|
|
8322
8318
|
/**
|
|
8323
8319
|
* Return tool targets that this feature supports.
|
|
@@ -8342,7 +8338,7 @@ var DirFeatureProcessor = class {
|
|
|
8342
8338
|
const mainFile = aiDir.getMainFile();
|
|
8343
8339
|
let mainFileContent;
|
|
8344
8340
|
if (mainFile) {
|
|
8345
|
-
const mainFilePath = (0,
|
|
8341
|
+
const mainFilePath = (0, import_node_path63.join)(dirPath, mainFile.name);
|
|
8346
8342
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
8347
8343
|
avoidBlockScalars: this.avoidBlockScalars
|
|
8348
8344
|
});
|
|
@@ -8358,7 +8354,7 @@ var DirFeatureProcessor = class {
|
|
|
8358
8354
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
8359
8355
|
otherFileContents.push(contentWithNewline);
|
|
8360
8356
|
if (!dirHasChanges) {
|
|
8361
|
-
const filePath = (0,
|
|
8357
|
+
const filePath = (0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath);
|
|
8362
8358
|
const existingContent = await readFileContentOrNull(filePath);
|
|
8363
8359
|
if (existingContent !== contentWithNewline) {
|
|
8364
8360
|
dirHasChanges = true;
|
|
@@ -8370,24 +8366,26 @@ var DirFeatureProcessor = class {
|
|
|
8370
8366
|
}
|
|
8371
8367
|
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
8372
8368
|
if (this.dryRun) {
|
|
8373
|
-
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8369
|
+
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8374
8370
|
if (mainFile) {
|
|
8375
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
8376
|
-
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));
|
|
8377
8373
|
}
|
|
8378
8374
|
for (const file of otherFiles) {
|
|
8379
|
-
logger.info(
|
|
8380
|
-
|
|
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));
|
|
8381
8379
|
}
|
|
8382
8380
|
} else {
|
|
8383
8381
|
await ensureDir(dirPath);
|
|
8384
8382
|
if (mainFile && mainFileContent) {
|
|
8385
|
-
const mainFilePath = (0,
|
|
8383
|
+
const mainFilePath = (0, import_node_path63.join)(dirPath, mainFile.name);
|
|
8386
8384
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
8387
|
-
changedPaths.push((0,
|
|
8385
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, mainFile.name));
|
|
8388
8386
|
}
|
|
8389
8387
|
for (const [i, file] of otherFiles.entries()) {
|
|
8390
|
-
const filePath = (0,
|
|
8388
|
+
const filePath = (0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath);
|
|
8391
8389
|
const content = otherFileContents[i];
|
|
8392
8390
|
if (content === void 0) {
|
|
8393
8391
|
throw new Error(
|
|
@@ -8395,7 +8393,7 @@ var DirFeatureProcessor = class {
|
|
|
8395
8393
|
);
|
|
8396
8394
|
}
|
|
8397
8395
|
await writeFileContent(filePath, content);
|
|
8398
|
-
changedPaths.push((0,
|
|
8396
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
8399
8397
|
}
|
|
8400
8398
|
}
|
|
8401
8399
|
changedCount++;
|
|
@@ -8417,7 +8415,7 @@ var DirFeatureProcessor = class {
|
|
|
8417
8415
|
for (const aiDir of orphanDirs) {
|
|
8418
8416
|
const dirPath = aiDir.getDirPath();
|
|
8419
8417
|
if (this.dryRun) {
|
|
8420
|
-
logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8418
|
+
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8421
8419
|
} else {
|
|
8422
8420
|
await removeDirectory(dirPath);
|
|
8423
8421
|
}
|
|
@@ -8427,11 +8425,11 @@ var DirFeatureProcessor = class {
|
|
|
8427
8425
|
};
|
|
8428
8426
|
|
|
8429
8427
|
// src/features/skills/agentsskills-skill.ts
|
|
8430
|
-
var
|
|
8428
|
+
var import_node_path65 = require("path");
|
|
8431
8429
|
var import_mini26 = require("zod/mini");
|
|
8432
8430
|
|
|
8433
8431
|
// src/features/skills/rulesync-skill.ts
|
|
8434
|
-
var
|
|
8432
|
+
var import_node_path64 = require("path");
|
|
8435
8433
|
var import_mini25 = require("zod/mini");
|
|
8436
8434
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini25.z.looseObject({
|
|
8437
8435
|
name: import_mini25.z.string(),
|
|
@@ -8500,7 +8498,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8500
8498
|
}
|
|
8501
8499
|
getFrontmatter() {
|
|
8502
8500
|
if (!this.mainFile?.frontmatter) {
|
|
8503
|
-
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)}`);
|
|
8504
8502
|
}
|
|
8505
8503
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8506
8504
|
return result;
|
|
@@ -8526,8 +8524,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8526
8524
|
dirName,
|
|
8527
8525
|
global = false
|
|
8528
8526
|
}) {
|
|
8529
|
-
const skillDirPath = (0,
|
|
8530
|
-
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);
|
|
8531
8529
|
if (!await fileExists(skillFilePath)) {
|
|
8532
8530
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8533
8531
|
}
|
|
@@ -8564,7 +8562,7 @@ var AgentsSkillsSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
|
8564
8562
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8565
8563
|
constructor({
|
|
8566
8564
|
baseDir = process.cwd(),
|
|
8567
|
-
relativeDirPath = (0,
|
|
8565
|
+
relativeDirPath = (0, import_node_path65.join)(".agents", "skills"),
|
|
8568
8566
|
dirName,
|
|
8569
8567
|
frontmatter,
|
|
8570
8568
|
body,
|
|
@@ -8596,7 +8594,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8596
8594
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8597
8595
|
}
|
|
8598
8596
|
return {
|
|
8599
|
-
relativeDirPath: (0,
|
|
8597
|
+
relativeDirPath: (0, import_node_path65.join)(".agents", "skills")
|
|
8600
8598
|
};
|
|
8601
8599
|
}
|
|
8602
8600
|
getFrontmatter() {
|
|
@@ -8676,9 +8674,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8676
8674
|
});
|
|
8677
8675
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8678
8676
|
if (!result.success) {
|
|
8679
|
-
const skillDirPath = (0,
|
|
8677
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8680
8678
|
throw new Error(
|
|
8681
|
-
`Invalid frontmatter in ${(0,
|
|
8679
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8682
8680
|
);
|
|
8683
8681
|
}
|
|
8684
8682
|
return new _AgentsSkillsSkill({
|
|
@@ -8713,7 +8711,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8713
8711
|
};
|
|
8714
8712
|
|
|
8715
8713
|
// src/features/skills/antigravity-skill.ts
|
|
8716
|
-
var
|
|
8714
|
+
var import_node_path66 = require("path");
|
|
8717
8715
|
var import_mini27 = require("zod/mini");
|
|
8718
8716
|
var AntigravitySkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8719
8717
|
name: import_mini27.z.string(),
|
|
@@ -8722,7 +8720,7 @@ var AntigravitySkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
|
8722
8720
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8723
8721
|
constructor({
|
|
8724
8722
|
baseDir = process.cwd(),
|
|
8725
|
-
relativeDirPath = (0,
|
|
8723
|
+
relativeDirPath = (0, import_node_path66.join)(".agent", "skills"),
|
|
8726
8724
|
dirName,
|
|
8727
8725
|
frontmatter,
|
|
8728
8726
|
body,
|
|
@@ -8754,11 +8752,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8754
8752
|
} = {}) {
|
|
8755
8753
|
if (global) {
|
|
8756
8754
|
return {
|
|
8757
|
-
relativeDirPath: (0,
|
|
8755
|
+
relativeDirPath: (0, import_node_path66.join)(".gemini", "antigravity", "skills")
|
|
8758
8756
|
};
|
|
8759
8757
|
}
|
|
8760
8758
|
return {
|
|
8761
|
-
relativeDirPath: (0,
|
|
8759
|
+
relativeDirPath: (0, import_node_path66.join)(".agent", "skills")
|
|
8762
8760
|
};
|
|
8763
8761
|
}
|
|
8764
8762
|
getFrontmatter() {
|
|
@@ -8838,9 +8836,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8838
8836
|
});
|
|
8839
8837
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8840
8838
|
if (!result.success) {
|
|
8841
|
-
const skillDirPath = (0,
|
|
8839
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8842
8840
|
throw new Error(
|
|
8843
|
-
`Invalid frontmatter in ${(0,
|
|
8841
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8844
8842
|
);
|
|
8845
8843
|
}
|
|
8846
8844
|
return new _AntigravitySkill({
|
|
@@ -8874,7 +8872,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8874
8872
|
};
|
|
8875
8873
|
|
|
8876
8874
|
// src/features/skills/claudecode-skill.ts
|
|
8877
|
-
var
|
|
8875
|
+
var import_node_path67 = require("path");
|
|
8878
8876
|
var import_mini28 = require("zod/mini");
|
|
8879
8877
|
var ClaudecodeSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8880
8878
|
name: import_mini28.z.string(),
|
|
@@ -8886,7 +8884,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
|
8886
8884
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8887
8885
|
constructor({
|
|
8888
8886
|
baseDir = process.cwd(),
|
|
8889
|
-
relativeDirPath = (0,
|
|
8887
|
+
relativeDirPath = (0, import_node_path67.join)(".claude", "skills"),
|
|
8890
8888
|
dirName,
|
|
8891
8889
|
frontmatter,
|
|
8892
8890
|
body,
|
|
@@ -8917,7 +8915,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8917
8915
|
global: _global = false
|
|
8918
8916
|
} = {}) {
|
|
8919
8917
|
return {
|
|
8920
|
-
relativeDirPath: (0,
|
|
8918
|
+
relativeDirPath: (0, import_node_path67.join)(".claude", "skills")
|
|
8921
8919
|
};
|
|
8922
8920
|
}
|
|
8923
8921
|
getFrontmatter() {
|
|
@@ -9014,9 +9012,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9014
9012
|
});
|
|
9015
9013
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9016
9014
|
if (!result.success) {
|
|
9017
|
-
const skillDirPath = (0,
|
|
9015
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9018
9016
|
throw new Error(
|
|
9019
|
-
`Invalid frontmatter in ${(0,
|
|
9017
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9020
9018
|
);
|
|
9021
9019
|
}
|
|
9022
9020
|
return new _ClaudecodeSkill({
|
|
@@ -9050,7 +9048,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
9050
9048
|
};
|
|
9051
9049
|
|
|
9052
9050
|
// src/features/skills/cline-skill.ts
|
|
9053
|
-
var
|
|
9051
|
+
var import_node_path68 = require("path");
|
|
9054
9052
|
var import_mini29 = require("zod/mini");
|
|
9055
9053
|
var ClineSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
9056
9054
|
name: import_mini29.z.string(),
|
|
@@ -9059,7 +9057,7 @@ var ClineSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
|
9059
9057
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
9060
9058
|
constructor({
|
|
9061
9059
|
baseDir = process.cwd(),
|
|
9062
|
-
relativeDirPath = (0,
|
|
9060
|
+
relativeDirPath = (0, import_node_path68.join)(".cline", "skills"),
|
|
9063
9061
|
dirName,
|
|
9064
9062
|
frontmatter,
|
|
9065
9063
|
body,
|
|
@@ -9088,7 +9086,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9088
9086
|
}
|
|
9089
9087
|
static getSettablePaths(_options = {}) {
|
|
9090
9088
|
return {
|
|
9091
|
-
relativeDirPath: (0,
|
|
9089
|
+
relativeDirPath: (0, import_node_path68.join)(".cline", "skills")
|
|
9092
9090
|
};
|
|
9093
9091
|
}
|
|
9094
9092
|
getFrontmatter() {
|
|
@@ -9176,13 +9174,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9176
9174
|
});
|
|
9177
9175
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9178
9176
|
if (!result.success) {
|
|
9179
|
-
const skillDirPath = (0,
|
|
9177
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9180
9178
|
throw new Error(
|
|
9181
|
-
`Invalid frontmatter in ${(0,
|
|
9179
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9182
9180
|
);
|
|
9183
9181
|
}
|
|
9184
9182
|
if (result.data.name !== loaded.dirName) {
|
|
9185
|
-
const skillFilePath = (0,
|
|
9183
|
+
const skillFilePath = (0, import_node_path68.join)(
|
|
9186
9184
|
loaded.baseDir,
|
|
9187
9185
|
loaded.relativeDirPath,
|
|
9188
9186
|
loaded.dirName,
|
|
@@ -9223,7 +9221,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9223
9221
|
};
|
|
9224
9222
|
|
|
9225
9223
|
// src/features/skills/codexcli-skill.ts
|
|
9226
|
-
var
|
|
9224
|
+
var import_node_path69 = require("path");
|
|
9227
9225
|
var import_mini30 = require("zod/mini");
|
|
9228
9226
|
var CodexCliSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
9229
9227
|
name: import_mini30.z.string(),
|
|
@@ -9237,7 +9235,7 @@ var CodexCliSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
|
9237
9235
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
9238
9236
|
constructor({
|
|
9239
9237
|
baseDir = process.cwd(),
|
|
9240
|
-
relativeDirPath = (0,
|
|
9238
|
+
relativeDirPath = (0, import_node_path69.join)(".codex", "skills"),
|
|
9241
9239
|
dirName,
|
|
9242
9240
|
frontmatter,
|
|
9243
9241
|
body,
|
|
@@ -9268,7 +9266,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9268
9266
|
global: _global = false
|
|
9269
9267
|
} = {}) {
|
|
9270
9268
|
return {
|
|
9271
|
-
relativeDirPath: (0,
|
|
9269
|
+
relativeDirPath: (0, import_node_path69.join)(".codex", "skills")
|
|
9272
9270
|
};
|
|
9273
9271
|
}
|
|
9274
9272
|
getFrontmatter() {
|
|
@@ -9358,9 +9356,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9358
9356
|
});
|
|
9359
9357
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9360
9358
|
if (!result.success) {
|
|
9361
|
-
const skillDirPath = (0,
|
|
9359
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9362
9360
|
throw new Error(
|
|
9363
|
-
`Invalid frontmatter in ${(0,
|
|
9361
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9364
9362
|
);
|
|
9365
9363
|
}
|
|
9366
9364
|
return new _CodexCliSkill({
|
|
@@ -9394,7 +9392,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9394
9392
|
};
|
|
9395
9393
|
|
|
9396
9394
|
// src/features/skills/copilot-skill.ts
|
|
9397
|
-
var
|
|
9395
|
+
var import_node_path70 = require("path");
|
|
9398
9396
|
var import_mini31 = require("zod/mini");
|
|
9399
9397
|
var CopilotSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9400
9398
|
name: import_mini31.z.string(),
|
|
@@ -9404,7 +9402,7 @@ var CopilotSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
|
9404
9402
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
9405
9403
|
constructor({
|
|
9406
9404
|
baseDir = process.cwd(),
|
|
9407
|
-
relativeDirPath = (0,
|
|
9405
|
+
relativeDirPath = (0, import_node_path70.join)(".github", "skills"),
|
|
9408
9406
|
dirName,
|
|
9409
9407
|
frontmatter,
|
|
9410
9408
|
body,
|
|
@@ -9436,7 +9434,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9436
9434
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9437
9435
|
}
|
|
9438
9436
|
return {
|
|
9439
|
-
relativeDirPath: (0,
|
|
9437
|
+
relativeDirPath: (0, import_node_path70.join)(".github", "skills")
|
|
9440
9438
|
};
|
|
9441
9439
|
}
|
|
9442
9440
|
getFrontmatter() {
|
|
@@ -9522,9 +9520,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9522
9520
|
});
|
|
9523
9521
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9524
9522
|
if (!result.success) {
|
|
9525
|
-
const skillDirPath = (0,
|
|
9523
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9526
9524
|
throw new Error(
|
|
9527
|
-
`Invalid frontmatter in ${(0,
|
|
9525
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9528
9526
|
);
|
|
9529
9527
|
}
|
|
9530
9528
|
return new _CopilotSkill({
|
|
@@ -9559,7 +9557,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9559
9557
|
};
|
|
9560
9558
|
|
|
9561
9559
|
// src/features/skills/cursor-skill.ts
|
|
9562
|
-
var
|
|
9560
|
+
var import_node_path71 = require("path");
|
|
9563
9561
|
var import_mini32 = require("zod/mini");
|
|
9564
9562
|
var CursorSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9565
9563
|
name: import_mini32.z.string(),
|
|
@@ -9568,7 +9566,7 @@ var CursorSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
|
9568
9566
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9569
9567
|
constructor({
|
|
9570
9568
|
baseDir = process.cwd(),
|
|
9571
|
-
relativeDirPath = (0,
|
|
9569
|
+
relativeDirPath = (0, import_node_path71.join)(".cursor", "skills"),
|
|
9572
9570
|
dirName,
|
|
9573
9571
|
frontmatter,
|
|
9574
9572
|
body,
|
|
@@ -9597,7 +9595,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9597
9595
|
}
|
|
9598
9596
|
static getSettablePaths(_options) {
|
|
9599
9597
|
return {
|
|
9600
|
-
relativeDirPath: (0,
|
|
9598
|
+
relativeDirPath: (0, import_node_path71.join)(".cursor", "skills")
|
|
9601
9599
|
};
|
|
9602
9600
|
}
|
|
9603
9601
|
getFrontmatter() {
|
|
@@ -9677,9 +9675,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9677
9675
|
});
|
|
9678
9676
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9679
9677
|
if (!result.success) {
|
|
9680
|
-
const skillDirPath = (0,
|
|
9678
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9681
9679
|
throw new Error(
|
|
9682
|
-
`Invalid frontmatter in ${(0,
|
|
9680
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9683
9681
|
);
|
|
9684
9682
|
}
|
|
9685
9683
|
return new _CursorSkill({
|
|
@@ -9714,7 +9712,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9714
9712
|
};
|
|
9715
9713
|
|
|
9716
9714
|
// src/features/skills/geminicli-skill.ts
|
|
9717
|
-
var
|
|
9715
|
+
var import_node_path72 = require("path");
|
|
9718
9716
|
var import_mini33 = require("zod/mini");
|
|
9719
9717
|
var GeminiCliSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9720
9718
|
name: import_mini33.z.string(),
|
|
@@ -9754,7 +9752,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9754
9752
|
global: _global = false
|
|
9755
9753
|
} = {}) {
|
|
9756
9754
|
return {
|
|
9757
|
-
relativeDirPath: (0,
|
|
9755
|
+
relativeDirPath: (0, import_node_path72.join)(".gemini", "skills")
|
|
9758
9756
|
};
|
|
9759
9757
|
}
|
|
9760
9758
|
getFrontmatter() {
|
|
@@ -9834,9 +9832,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9834
9832
|
});
|
|
9835
9833
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9836
9834
|
if (!result.success) {
|
|
9837
|
-
const skillDirPath = (0,
|
|
9835
|
+
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9838
9836
|
throw new Error(
|
|
9839
|
-
`Invalid frontmatter in ${(0,
|
|
9837
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9840
9838
|
);
|
|
9841
9839
|
}
|
|
9842
9840
|
return new _GeminiCliSkill({
|
|
@@ -9871,7 +9869,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9871
9869
|
};
|
|
9872
9870
|
|
|
9873
9871
|
// src/features/skills/junie-skill.ts
|
|
9874
|
-
var
|
|
9872
|
+
var import_node_path73 = require("path");
|
|
9875
9873
|
var import_mini34 = require("zod/mini");
|
|
9876
9874
|
var JunieSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9877
9875
|
name: import_mini34.z.string(),
|
|
@@ -9880,7 +9878,7 @@ var JunieSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
|
9880
9878
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9881
9879
|
constructor({
|
|
9882
9880
|
baseDir = process.cwd(),
|
|
9883
|
-
relativeDirPath = (0,
|
|
9881
|
+
relativeDirPath = (0, import_node_path73.join)(".junie", "skills"),
|
|
9884
9882
|
dirName,
|
|
9885
9883
|
frontmatter,
|
|
9886
9884
|
body,
|
|
@@ -9912,7 +9910,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9912
9910
|
throw new Error("JunieSkill does not support global mode.");
|
|
9913
9911
|
}
|
|
9914
9912
|
return {
|
|
9915
|
-
relativeDirPath: (0,
|
|
9913
|
+
relativeDirPath: (0, import_node_path73.join)(".junie", "skills")
|
|
9916
9914
|
};
|
|
9917
9915
|
}
|
|
9918
9916
|
getFrontmatter() {
|
|
@@ -9999,13 +9997,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9999
9997
|
});
|
|
10000
9998
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10001
9999
|
if (!result.success) {
|
|
10002
|
-
const skillDirPath = (0,
|
|
10000
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10003
10001
|
throw new Error(
|
|
10004
|
-
`Invalid frontmatter in ${(0,
|
|
10002
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10005
10003
|
);
|
|
10006
10004
|
}
|
|
10007
10005
|
if (result.data.name !== loaded.dirName) {
|
|
10008
|
-
const skillFilePath = (0,
|
|
10006
|
+
const skillFilePath = (0, import_node_path73.join)(
|
|
10009
10007
|
loaded.baseDir,
|
|
10010
10008
|
loaded.relativeDirPath,
|
|
10011
10009
|
loaded.dirName,
|
|
@@ -10047,7 +10045,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
10047
10045
|
};
|
|
10048
10046
|
|
|
10049
10047
|
// src/features/skills/kilo-skill.ts
|
|
10050
|
-
var
|
|
10048
|
+
var import_node_path74 = require("path");
|
|
10051
10049
|
var import_mini35 = require("zod/mini");
|
|
10052
10050
|
var KiloSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
10053
10051
|
name: import_mini35.z.string(),
|
|
@@ -10056,7 +10054,7 @@ var KiloSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
|
10056
10054
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
10057
10055
|
constructor({
|
|
10058
10056
|
baseDir = process.cwd(),
|
|
10059
|
-
relativeDirPath = (0,
|
|
10057
|
+
relativeDirPath = (0, import_node_path74.join)(".kilocode", "skills"),
|
|
10060
10058
|
dirName,
|
|
10061
10059
|
frontmatter,
|
|
10062
10060
|
body,
|
|
@@ -10087,7 +10085,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10087
10085
|
global: _global = false
|
|
10088
10086
|
} = {}) {
|
|
10089
10087
|
return {
|
|
10090
|
-
relativeDirPath: (0,
|
|
10088
|
+
relativeDirPath: (0, import_node_path74.join)(".kilocode", "skills")
|
|
10091
10089
|
};
|
|
10092
10090
|
}
|
|
10093
10091
|
getFrontmatter() {
|
|
@@ -10175,13 +10173,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10175
10173
|
});
|
|
10176
10174
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10177
10175
|
if (!result.success) {
|
|
10178
|
-
const skillDirPath = (0,
|
|
10176
|
+
const skillDirPath = (0, import_node_path74.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10179
10177
|
throw new Error(
|
|
10180
|
-
`Invalid frontmatter in ${(0,
|
|
10178
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10181
10179
|
);
|
|
10182
10180
|
}
|
|
10183
10181
|
if (result.data.name !== loaded.dirName) {
|
|
10184
|
-
const skillFilePath = (0,
|
|
10182
|
+
const skillFilePath = (0, import_node_path74.join)(
|
|
10185
10183
|
loaded.baseDir,
|
|
10186
10184
|
loaded.relativeDirPath,
|
|
10187
10185
|
loaded.dirName,
|
|
@@ -10222,7 +10220,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10222
10220
|
};
|
|
10223
10221
|
|
|
10224
10222
|
// src/features/skills/kiro-skill.ts
|
|
10225
|
-
var
|
|
10223
|
+
var import_node_path75 = require("path");
|
|
10226
10224
|
var import_mini36 = require("zod/mini");
|
|
10227
10225
|
var KiroSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
10228
10226
|
name: import_mini36.z.string(),
|
|
@@ -10231,7 +10229,7 @@ var KiroSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
|
10231
10229
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
10232
10230
|
constructor({
|
|
10233
10231
|
baseDir = process.cwd(),
|
|
10234
|
-
relativeDirPath = (0,
|
|
10232
|
+
relativeDirPath = (0, import_node_path75.join)(".kiro", "skills"),
|
|
10235
10233
|
dirName,
|
|
10236
10234
|
frontmatter,
|
|
10237
10235
|
body,
|
|
@@ -10263,7 +10261,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10263
10261
|
throw new Error("KiroSkill does not support global mode.");
|
|
10264
10262
|
}
|
|
10265
10263
|
return {
|
|
10266
|
-
relativeDirPath: (0,
|
|
10264
|
+
relativeDirPath: (0, import_node_path75.join)(".kiro", "skills")
|
|
10267
10265
|
};
|
|
10268
10266
|
}
|
|
10269
10267
|
getFrontmatter() {
|
|
@@ -10351,13 +10349,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10351
10349
|
});
|
|
10352
10350
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10353
10351
|
if (!result.success) {
|
|
10354
|
-
const skillDirPath = (0,
|
|
10352
|
+
const skillDirPath = (0, import_node_path75.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10355
10353
|
throw new Error(
|
|
10356
|
-
`Invalid frontmatter in ${(0,
|
|
10354
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10357
10355
|
);
|
|
10358
10356
|
}
|
|
10359
10357
|
if (result.data.name !== loaded.dirName) {
|
|
10360
|
-
const skillFilePath = (0,
|
|
10358
|
+
const skillFilePath = (0, import_node_path75.join)(
|
|
10361
10359
|
loaded.baseDir,
|
|
10362
10360
|
loaded.relativeDirPath,
|
|
10363
10361
|
loaded.dirName,
|
|
@@ -10399,7 +10397,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10399
10397
|
};
|
|
10400
10398
|
|
|
10401
10399
|
// src/features/skills/opencode-skill.ts
|
|
10402
|
-
var
|
|
10400
|
+
var import_node_path76 = require("path");
|
|
10403
10401
|
var import_mini37 = require("zod/mini");
|
|
10404
10402
|
var OpenCodeSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10405
10403
|
name: import_mini37.z.string(),
|
|
@@ -10409,7 +10407,7 @@ var OpenCodeSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
|
10409
10407
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
10410
10408
|
constructor({
|
|
10411
10409
|
baseDir = process.cwd(),
|
|
10412
|
-
relativeDirPath = (0,
|
|
10410
|
+
relativeDirPath = (0, import_node_path76.join)(".opencode", "skill"),
|
|
10413
10411
|
dirName,
|
|
10414
10412
|
frontmatter,
|
|
10415
10413
|
body,
|
|
@@ -10438,7 +10436,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10438
10436
|
}
|
|
10439
10437
|
static getSettablePaths({ global = false } = {}) {
|
|
10440
10438
|
return {
|
|
10441
|
-
relativeDirPath: global ? (0,
|
|
10439
|
+
relativeDirPath: global ? (0, import_node_path76.join)(".config", "opencode", "skill") : (0, import_node_path76.join)(".opencode", "skill")
|
|
10442
10440
|
};
|
|
10443
10441
|
}
|
|
10444
10442
|
getFrontmatter() {
|
|
@@ -10524,9 +10522,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10524
10522
|
});
|
|
10525
10523
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10526
10524
|
if (!result.success) {
|
|
10527
|
-
const skillDirPath = (0,
|
|
10525
|
+
const skillDirPath = (0, import_node_path76.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10528
10526
|
throw new Error(
|
|
10529
|
-
`Invalid frontmatter in ${(0,
|
|
10527
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10530
10528
|
);
|
|
10531
10529
|
}
|
|
10532
10530
|
return new _OpenCodeSkill({
|
|
@@ -10560,7 +10558,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10560
10558
|
};
|
|
10561
10559
|
|
|
10562
10560
|
// src/features/skills/replit-skill.ts
|
|
10563
|
-
var
|
|
10561
|
+
var import_node_path77 = require("path");
|
|
10564
10562
|
var import_mini38 = require("zod/mini");
|
|
10565
10563
|
var ReplitSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
10566
10564
|
name: import_mini38.z.string(),
|
|
@@ -10569,7 +10567,7 @@ var ReplitSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
|
10569
10567
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
10570
10568
|
constructor({
|
|
10571
10569
|
baseDir = process.cwd(),
|
|
10572
|
-
relativeDirPath = (0,
|
|
10570
|
+
relativeDirPath = (0, import_node_path77.join)(".agents", "skills"),
|
|
10573
10571
|
dirName,
|
|
10574
10572
|
frontmatter,
|
|
10575
10573
|
body,
|
|
@@ -10601,7 +10599,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10601
10599
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10602
10600
|
}
|
|
10603
10601
|
return {
|
|
10604
|
-
relativeDirPath: (0,
|
|
10602
|
+
relativeDirPath: (0, import_node_path77.join)(".agents", "skills")
|
|
10605
10603
|
};
|
|
10606
10604
|
}
|
|
10607
10605
|
getFrontmatter() {
|
|
@@ -10681,9 +10679,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10681
10679
|
});
|
|
10682
10680
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10683
10681
|
if (!result.success) {
|
|
10684
|
-
const skillDirPath = (0,
|
|
10682
|
+
const skillDirPath = (0, import_node_path77.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10685
10683
|
throw new Error(
|
|
10686
|
-
`Invalid frontmatter in ${(0,
|
|
10684
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10687
10685
|
);
|
|
10688
10686
|
}
|
|
10689
10687
|
return new _ReplitSkill({
|
|
@@ -10718,7 +10716,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10718
10716
|
};
|
|
10719
10717
|
|
|
10720
10718
|
// src/features/skills/roo-skill.ts
|
|
10721
|
-
var
|
|
10719
|
+
var import_node_path78 = require("path");
|
|
10722
10720
|
var import_mini39 = require("zod/mini");
|
|
10723
10721
|
var RooSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
10724
10722
|
name: import_mini39.z.string(),
|
|
@@ -10727,7 +10725,7 @@ var RooSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
|
10727
10725
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10728
10726
|
constructor({
|
|
10729
10727
|
baseDir = process.cwd(),
|
|
10730
|
-
relativeDirPath = (0,
|
|
10728
|
+
relativeDirPath = (0, import_node_path78.join)(".roo", "skills"),
|
|
10731
10729
|
dirName,
|
|
10732
10730
|
frontmatter,
|
|
10733
10731
|
body,
|
|
@@ -10758,7 +10756,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10758
10756
|
global: _global = false
|
|
10759
10757
|
} = {}) {
|
|
10760
10758
|
return {
|
|
10761
|
-
relativeDirPath: (0,
|
|
10759
|
+
relativeDirPath: (0, import_node_path78.join)(".roo", "skills")
|
|
10762
10760
|
};
|
|
10763
10761
|
}
|
|
10764
10762
|
getFrontmatter() {
|
|
@@ -10846,13 +10844,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10846
10844
|
});
|
|
10847
10845
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10848
10846
|
if (!result.success) {
|
|
10849
|
-
const skillDirPath = (0,
|
|
10847
|
+
const skillDirPath = (0, import_node_path78.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10850
10848
|
throw new Error(
|
|
10851
|
-
`Invalid frontmatter in ${(0,
|
|
10849
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10852
10850
|
);
|
|
10853
10851
|
}
|
|
10854
10852
|
if (result.data.name !== loaded.dirName) {
|
|
10855
|
-
const skillFilePath = (0,
|
|
10853
|
+
const skillFilePath = (0, import_node_path78.join)(
|
|
10856
10854
|
loaded.baseDir,
|
|
10857
10855
|
loaded.relativeDirPath,
|
|
10858
10856
|
loaded.dirName,
|
|
@@ -10893,17 +10891,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10893
10891
|
};
|
|
10894
10892
|
|
|
10895
10893
|
// src/features/skills/skills-utils.ts
|
|
10896
|
-
var
|
|
10894
|
+
var import_node_path79 = require("path");
|
|
10897
10895
|
async function getLocalSkillDirNames(baseDir) {
|
|
10898
|
-
const skillsDir = (0,
|
|
10896
|
+
const skillsDir = (0, import_node_path79.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10899
10897
|
const names = /* @__PURE__ */ new Set();
|
|
10900
10898
|
if (!await directoryExists(skillsDir)) {
|
|
10901
10899
|
return names;
|
|
10902
10900
|
}
|
|
10903
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10901
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path79.join)(skillsDir, "*"), { type: "dir" });
|
|
10904
10902
|
for (const dirPath of dirPaths) {
|
|
10905
|
-
const name = (0,
|
|
10906
|
-
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;
|
|
10907
10905
|
names.add(name);
|
|
10908
10906
|
}
|
|
10909
10907
|
return names;
|
|
@@ -11082,9 +11080,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11082
11080
|
toolTarget,
|
|
11083
11081
|
global = false,
|
|
11084
11082
|
getFactory = defaultGetFactory4,
|
|
11085
|
-
dryRun = false
|
|
11083
|
+
dryRun = false,
|
|
11084
|
+
logger
|
|
11086
11085
|
}) {
|
|
11087
|
-
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor" });
|
|
11086
|
+
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor", logger });
|
|
11088
11087
|
const result = SkillsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
11089
11088
|
if (!result.success) {
|
|
11090
11089
|
throw new Error(
|
|
@@ -11117,7 +11116,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11117
11116
|
const rulesyncSkills = [];
|
|
11118
11117
|
for (const toolSkill of toolSkills) {
|
|
11119
11118
|
if (toolSkill instanceof SimulatedSkill) {
|
|
11120
|
-
logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11119
|
+
this.logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11121
11120
|
continue;
|
|
11122
11121
|
}
|
|
11123
11122
|
rulesyncSkills.push(toolSkill.toRulesyncSkill());
|
|
@@ -11138,14 +11137,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11138
11137
|
)
|
|
11139
11138
|
);
|
|
11140
11139
|
const localSkillNames = new Set(localDirNames);
|
|
11141
|
-
const curatedDirPath = (0,
|
|
11140
|
+
const curatedDirPath = (0, import_node_path80.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
11142
11141
|
let curatedSkills = [];
|
|
11143
11142
|
if (await directoryExists(curatedDirPath)) {
|
|
11144
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
11145
|
-
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));
|
|
11146
11145
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
11147
11146
|
if (localSkillNames.has(name)) {
|
|
11148
|
-
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11147
|
+
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11149
11148
|
return false;
|
|
11150
11149
|
}
|
|
11151
11150
|
return true;
|
|
@@ -11163,7 +11162,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11163
11162
|
);
|
|
11164
11163
|
}
|
|
11165
11164
|
const allSkills = [...localSkills, ...curatedSkills];
|
|
11166
|
-
logger.debug(
|
|
11165
|
+
this.logger.debug(
|
|
11167
11166
|
`Successfully loaded ${allSkills.length} rulesync skills (${localSkills.length} local, ${curatedSkills.length} curated)`
|
|
11168
11167
|
);
|
|
11169
11168
|
return allSkills;
|
|
@@ -11175,9 +11174,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11175
11174
|
async loadToolDirs() {
|
|
11176
11175
|
const factory = this.getFactory(this.toolTarget);
|
|
11177
11176
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11178
|
-
const skillsDirPath = (0,
|
|
11179
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
11180
|
-
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));
|
|
11181
11180
|
const toolSkills = await Promise.all(
|
|
11182
11181
|
dirNames.map(
|
|
11183
11182
|
(dirName) => factory.class.fromDir({
|
|
@@ -11187,15 +11186,15 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11187
11186
|
})
|
|
11188
11187
|
)
|
|
11189
11188
|
);
|
|
11190
|
-
logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11189
|
+
this.logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11191
11190
|
return toolSkills;
|
|
11192
11191
|
}
|
|
11193
11192
|
async loadToolDirsToDelete() {
|
|
11194
11193
|
const factory = this.getFactory(this.toolTarget);
|
|
11195
11194
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11196
|
-
const skillsDirPath = (0,
|
|
11197
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
11198
|
-
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));
|
|
11199
11198
|
const toolSkills = dirNames.map(
|
|
11200
11199
|
(dirName) => factory.class.forDeletion({
|
|
11201
11200
|
baseDir: this.baseDir,
|
|
@@ -11204,7 +11203,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11204
11203
|
global: this.global
|
|
11205
11204
|
})
|
|
11206
11205
|
);
|
|
11207
|
-
logger.debug(
|
|
11206
|
+
this.logger.debug(
|
|
11208
11207
|
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
11209
11208
|
);
|
|
11210
11209
|
return toolSkills;
|
|
@@ -11256,10 +11255,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11256
11255
|
};
|
|
11257
11256
|
|
|
11258
11257
|
// src/features/subagents/agentsmd-subagent.ts
|
|
11259
|
-
var
|
|
11258
|
+
var import_node_path82 = require("path");
|
|
11260
11259
|
|
|
11261
11260
|
// src/features/subagents/simulated-subagent.ts
|
|
11262
|
-
var
|
|
11261
|
+
var import_node_path81 = require("path");
|
|
11263
11262
|
var import_mini41 = require("zod/mini");
|
|
11264
11263
|
|
|
11265
11264
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -11324,7 +11323,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11324
11323
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11325
11324
|
if (!result.success) {
|
|
11326
11325
|
throw new Error(
|
|
11327
|
-
`Invalid frontmatter in ${(0,
|
|
11326
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11328
11327
|
);
|
|
11329
11328
|
}
|
|
11330
11329
|
}
|
|
@@ -11375,7 +11374,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11375
11374
|
return {
|
|
11376
11375
|
success: false,
|
|
11377
11376
|
error: new Error(
|
|
11378
|
-
`Invalid frontmatter in ${(0,
|
|
11377
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11379
11378
|
)
|
|
11380
11379
|
};
|
|
11381
11380
|
}
|
|
@@ -11385,7 +11384,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11385
11384
|
relativeFilePath,
|
|
11386
11385
|
validate = true
|
|
11387
11386
|
}) {
|
|
11388
|
-
const filePath = (0,
|
|
11387
|
+
const filePath = (0, import_node_path81.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
11389
11388
|
const fileContent = await readFileContent(filePath);
|
|
11390
11389
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11391
11390
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11395,7 +11394,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11395
11394
|
return {
|
|
11396
11395
|
baseDir,
|
|
11397
11396
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
11398
|
-
relativeFilePath: (0,
|
|
11397
|
+
relativeFilePath: (0, import_node_path81.basename)(relativeFilePath),
|
|
11399
11398
|
frontmatter: result.data,
|
|
11400
11399
|
body: content.trim(),
|
|
11401
11400
|
validate
|
|
@@ -11421,7 +11420,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11421
11420
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
11422
11421
|
static getSettablePaths() {
|
|
11423
11422
|
return {
|
|
11424
|
-
relativeDirPath: (0,
|
|
11423
|
+
relativeDirPath: (0, import_node_path82.join)(".agents", "subagents")
|
|
11425
11424
|
};
|
|
11426
11425
|
}
|
|
11427
11426
|
static async fromFile(params) {
|
|
@@ -11444,11 +11443,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
11444
11443
|
};
|
|
11445
11444
|
|
|
11446
11445
|
// src/features/subagents/factorydroid-subagent.ts
|
|
11447
|
-
var
|
|
11446
|
+
var import_node_path83 = require("path");
|
|
11448
11447
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
11449
11448
|
static getSettablePaths(_options) {
|
|
11450
11449
|
return {
|
|
11451
|
-
relativeDirPath: (0,
|
|
11450
|
+
relativeDirPath: (0, import_node_path83.join)(".factory", "droids")
|
|
11452
11451
|
};
|
|
11453
11452
|
}
|
|
11454
11453
|
static async fromFile(params) {
|
|
@@ -11471,11 +11470,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
11471
11470
|
};
|
|
11472
11471
|
|
|
11473
11472
|
// src/features/subagents/geminicli-subagent.ts
|
|
11474
|
-
var
|
|
11473
|
+
var import_node_path84 = require("path");
|
|
11475
11474
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
11476
11475
|
static getSettablePaths() {
|
|
11477
11476
|
return {
|
|
11478
|
-
relativeDirPath: (0,
|
|
11477
|
+
relativeDirPath: (0, import_node_path84.join)(".gemini", "subagents")
|
|
11479
11478
|
};
|
|
11480
11479
|
}
|
|
11481
11480
|
static async fromFile(params) {
|
|
@@ -11498,11 +11497,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
11498
11497
|
};
|
|
11499
11498
|
|
|
11500
11499
|
// src/features/subagents/roo-subagent.ts
|
|
11501
|
-
var
|
|
11500
|
+
var import_node_path85 = require("path");
|
|
11502
11501
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
11503
11502
|
static getSettablePaths() {
|
|
11504
11503
|
return {
|
|
11505
|
-
relativeDirPath: (0,
|
|
11504
|
+
relativeDirPath: (0, import_node_path85.join)(".roo", "subagents")
|
|
11506
11505
|
};
|
|
11507
11506
|
}
|
|
11508
11507
|
static async fromFile(params) {
|
|
@@ -11525,15 +11524,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
11525
11524
|
};
|
|
11526
11525
|
|
|
11527
11526
|
// src/features/subagents/subagents-processor.ts
|
|
11528
|
-
var
|
|
11527
|
+
var import_node_path94 = require("path");
|
|
11529
11528
|
var import_mini50 = require("zod/mini");
|
|
11530
11529
|
|
|
11531
11530
|
// src/features/subagents/claudecode-subagent.ts
|
|
11532
|
-
var
|
|
11531
|
+
var import_node_path87 = require("path");
|
|
11533
11532
|
var import_mini43 = require("zod/mini");
|
|
11534
11533
|
|
|
11535
11534
|
// src/features/subagents/rulesync-subagent.ts
|
|
11536
|
-
var
|
|
11535
|
+
var import_node_path86 = require("path");
|
|
11537
11536
|
var import_mini42 = require("zod/mini");
|
|
11538
11537
|
var RulesyncSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
11539
11538
|
targets: import_mini42.z._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -11547,7 +11546,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11547
11546
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11548
11547
|
if (!parseResult.success && rest.validate !== false) {
|
|
11549
11548
|
throw new Error(
|
|
11550
|
-
`Invalid frontmatter in ${(0,
|
|
11549
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11551
11550
|
);
|
|
11552
11551
|
}
|
|
11553
11552
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -11580,7 +11579,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11580
11579
|
return {
|
|
11581
11580
|
success: false,
|
|
11582
11581
|
error: new Error(
|
|
11583
|
-
`Invalid frontmatter in ${(0,
|
|
11582
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11584
11583
|
)
|
|
11585
11584
|
};
|
|
11586
11585
|
}
|
|
@@ -11588,14 +11587,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11588
11587
|
static async fromFile({
|
|
11589
11588
|
relativeFilePath
|
|
11590
11589
|
}) {
|
|
11591
|
-
const filePath = (0,
|
|
11590
|
+
const filePath = (0, import_node_path86.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
11592
11591
|
const fileContent = await readFileContent(filePath);
|
|
11593
11592
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11594
11593
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11595
11594
|
if (!result.success) {
|
|
11596
11595
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
11597
11596
|
}
|
|
11598
|
-
const filename = (0,
|
|
11597
|
+
const filename = (0, import_node_path86.basename)(relativeFilePath);
|
|
11599
11598
|
return new _RulesyncSubagent({
|
|
11600
11599
|
baseDir: process.cwd(),
|
|
11601
11600
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -11623,7 +11622,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11623
11622
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11624
11623
|
if (!result.success) {
|
|
11625
11624
|
throw new Error(
|
|
11626
|
-
`Invalid frontmatter in ${(0,
|
|
11625
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11627
11626
|
);
|
|
11628
11627
|
}
|
|
11629
11628
|
}
|
|
@@ -11635,7 +11634,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11635
11634
|
}
|
|
11636
11635
|
static getSettablePaths(_options = {}) {
|
|
11637
11636
|
return {
|
|
11638
|
-
relativeDirPath: (0,
|
|
11637
|
+
relativeDirPath: (0, import_node_path87.join)(".claude", "agents")
|
|
11639
11638
|
};
|
|
11640
11639
|
}
|
|
11641
11640
|
getFrontmatter() {
|
|
@@ -11714,7 +11713,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11714
11713
|
return {
|
|
11715
11714
|
success: false,
|
|
11716
11715
|
error: new Error(
|
|
11717
|
-
`Invalid frontmatter in ${(0,
|
|
11716
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11718
11717
|
)
|
|
11719
11718
|
};
|
|
11720
11719
|
}
|
|
@@ -11732,7 +11731,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11732
11731
|
global = false
|
|
11733
11732
|
}) {
|
|
11734
11733
|
const paths = this.getSettablePaths({ global });
|
|
11735
|
-
const filePath = (0,
|
|
11734
|
+
const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11736
11735
|
const fileContent = await readFileContent(filePath);
|
|
11737
11736
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11738
11737
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11767,7 +11766,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11767
11766
|
};
|
|
11768
11767
|
|
|
11769
11768
|
// src/features/subagents/codexcli-subagent.ts
|
|
11770
|
-
var
|
|
11769
|
+
var import_node_path88 = require("path");
|
|
11771
11770
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
11772
11771
|
var import_mini44 = require("zod/mini");
|
|
11773
11772
|
var CodexCliSubagentTomlSchema = import_mini44.z.looseObject({
|
|
@@ -11787,7 +11786,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11787
11786
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11788
11787
|
} catch (error) {
|
|
11789
11788
|
throw new Error(
|
|
11790
|
-
`Invalid TOML in ${(0,
|
|
11789
|
+
`Invalid TOML in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11791
11790
|
{ cause: error }
|
|
11792
11791
|
);
|
|
11793
11792
|
}
|
|
@@ -11799,7 +11798,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11799
11798
|
}
|
|
11800
11799
|
static getSettablePaths(_options = {}) {
|
|
11801
11800
|
return {
|
|
11802
|
-
relativeDirPath: (0,
|
|
11801
|
+
relativeDirPath: (0, import_node_path88.join)(".codex", "agents")
|
|
11803
11802
|
};
|
|
11804
11803
|
}
|
|
11805
11804
|
getBody() {
|
|
@@ -11811,7 +11810,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11811
11810
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11812
11811
|
} catch (error) {
|
|
11813
11812
|
throw new Error(
|
|
11814
|
-
`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)}`,
|
|
11815
11814
|
{ cause: error }
|
|
11816
11815
|
);
|
|
11817
11816
|
}
|
|
@@ -11892,7 +11891,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11892
11891
|
global = false
|
|
11893
11892
|
}) {
|
|
11894
11893
|
const paths = this.getSettablePaths({ global });
|
|
11895
|
-
const filePath = (0,
|
|
11894
|
+
const filePath = (0, import_node_path88.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11896
11895
|
const fileContent = await readFileContent(filePath);
|
|
11897
11896
|
const subagent = new _CodexCliSubagent({
|
|
11898
11897
|
baseDir,
|
|
@@ -11930,7 +11929,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11930
11929
|
};
|
|
11931
11930
|
|
|
11932
11931
|
// src/features/subagents/copilot-subagent.ts
|
|
11933
|
-
var
|
|
11932
|
+
var import_node_path89 = require("path");
|
|
11934
11933
|
var import_mini45 = require("zod/mini");
|
|
11935
11934
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11936
11935
|
var CopilotSubagentFrontmatterSchema = import_mini45.z.looseObject({
|
|
@@ -11956,7 +11955,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11956
11955
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11957
11956
|
if (!result.success) {
|
|
11958
11957
|
throw new Error(
|
|
11959
|
-
`Invalid frontmatter in ${(0,
|
|
11958
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11960
11959
|
);
|
|
11961
11960
|
}
|
|
11962
11961
|
}
|
|
@@ -11968,7 +11967,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11968
11967
|
}
|
|
11969
11968
|
static getSettablePaths(_options = {}) {
|
|
11970
11969
|
return {
|
|
11971
|
-
relativeDirPath: (0,
|
|
11970
|
+
relativeDirPath: (0, import_node_path89.join)(".github", "agents")
|
|
11972
11971
|
};
|
|
11973
11972
|
}
|
|
11974
11973
|
getFrontmatter() {
|
|
@@ -12042,7 +12041,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12042
12041
|
return {
|
|
12043
12042
|
success: false,
|
|
12044
12043
|
error: new Error(
|
|
12045
|
-
`Invalid frontmatter in ${(0,
|
|
12044
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12046
12045
|
)
|
|
12047
12046
|
};
|
|
12048
12047
|
}
|
|
@@ -12060,7 +12059,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12060
12059
|
global = false
|
|
12061
12060
|
}) {
|
|
12062
12061
|
const paths = this.getSettablePaths({ global });
|
|
12063
|
-
const filePath = (0,
|
|
12062
|
+
const filePath = (0, import_node_path89.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12064
12063
|
const fileContent = await readFileContent(filePath);
|
|
12065
12064
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12066
12065
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12096,7 +12095,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
12096
12095
|
};
|
|
12097
12096
|
|
|
12098
12097
|
// src/features/subagents/cursor-subagent.ts
|
|
12099
|
-
var
|
|
12098
|
+
var import_node_path90 = require("path");
|
|
12100
12099
|
var import_mini46 = require("zod/mini");
|
|
12101
12100
|
var CursorSubagentFrontmatterSchema = import_mini46.z.looseObject({
|
|
12102
12101
|
name: import_mini46.z.string(),
|
|
@@ -12110,7 +12109,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12110
12109
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12111
12110
|
if (!result.success) {
|
|
12112
12111
|
throw new Error(
|
|
12113
|
-
`Invalid frontmatter in ${(0,
|
|
12112
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12114
12113
|
);
|
|
12115
12114
|
}
|
|
12116
12115
|
}
|
|
@@ -12122,7 +12121,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12122
12121
|
}
|
|
12123
12122
|
static getSettablePaths(_options = {}) {
|
|
12124
12123
|
return {
|
|
12125
|
-
relativeDirPath: (0,
|
|
12124
|
+
relativeDirPath: (0, import_node_path90.join)(".cursor", "agents")
|
|
12126
12125
|
};
|
|
12127
12126
|
}
|
|
12128
12127
|
getFrontmatter() {
|
|
@@ -12189,7 +12188,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12189
12188
|
return {
|
|
12190
12189
|
success: false,
|
|
12191
12190
|
error: new Error(
|
|
12192
|
-
`Invalid frontmatter in ${(0,
|
|
12191
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12193
12192
|
)
|
|
12194
12193
|
};
|
|
12195
12194
|
}
|
|
@@ -12207,7 +12206,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12207
12206
|
global = false
|
|
12208
12207
|
}) {
|
|
12209
12208
|
const paths = this.getSettablePaths({ global });
|
|
12210
|
-
const filePath = (0,
|
|
12209
|
+
const filePath = (0, import_node_path90.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12211
12210
|
const fileContent = await readFileContent(filePath);
|
|
12212
12211
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12213
12212
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12243,7 +12242,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12243
12242
|
};
|
|
12244
12243
|
|
|
12245
12244
|
// src/features/subagents/junie-subagent.ts
|
|
12246
|
-
var
|
|
12245
|
+
var import_node_path91 = require("path");
|
|
12247
12246
|
var import_mini47 = require("zod/mini");
|
|
12248
12247
|
var JunieSubagentFrontmatterSchema = import_mini47.z.looseObject({
|
|
12249
12248
|
name: import_mini47.z.optional(import_mini47.z.string()),
|
|
@@ -12257,7 +12256,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12257
12256
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12258
12257
|
if (!result.success) {
|
|
12259
12258
|
throw new Error(
|
|
12260
|
-
`Invalid frontmatter in ${(0,
|
|
12259
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12261
12260
|
);
|
|
12262
12261
|
}
|
|
12263
12262
|
}
|
|
@@ -12272,7 +12271,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12272
12271
|
throw new Error("JunieSubagent does not support global mode.");
|
|
12273
12272
|
}
|
|
12274
12273
|
return {
|
|
12275
|
-
relativeDirPath: (0,
|
|
12274
|
+
relativeDirPath: (0, import_node_path91.join)(".junie", "agents")
|
|
12276
12275
|
};
|
|
12277
12276
|
}
|
|
12278
12277
|
getFrontmatter() {
|
|
@@ -12348,7 +12347,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12348
12347
|
return {
|
|
12349
12348
|
success: false,
|
|
12350
12349
|
error: new Error(
|
|
12351
|
-
`Invalid frontmatter in ${(0,
|
|
12350
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12352
12351
|
)
|
|
12353
12352
|
};
|
|
12354
12353
|
}
|
|
@@ -12366,7 +12365,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12366
12365
|
global = false
|
|
12367
12366
|
}) {
|
|
12368
12367
|
const paths = this.getSettablePaths({ global });
|
|
12369
|
-
const filePath = (0,
|
|
12368
|
+
const filePath = (0, import_node_path91.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12370
12369
|
const fileContent = await readFileContent(filePath);
|
|
12371
12370
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12372
12371
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12401,7 +12400,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12401
12400
|
};
|
|
12402
12401
|
|
|
12403
12402
|
// src/features/subagents/kiro-subagent.ts
|
|
12404
|
-
var
|
|
12403
|
+
var import_node_path92 = require("path");
|
|
12405
12404
|
var import_mini48 = require("zod/mini");
|
|
12406
12405
|
var KiroCliSubagentJsonSchema = import_mini48.z.looseObject({
|
|
12407
12406
|
name: import_mini48.z.string(),
|
|
@@ -12428,7 +12427,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12428
12427
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
12429
12428
|
} catch (error) {
|
|
12430
12429
|
throw new Error(
|
|
12431
|
-
`Invalid JSON in ${(0,
|
|
12430
|
+
`Invalid JSON in ${(0, import_node_path92.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12432
12431
|
{ cause: error }
|
|
12433
12432
|
);
|
|
12434
12433
|
}
|
|
@@ -12440,7 +12439,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12440
12439
|
}
|
|
12441
12440
|
static getSettablePaths(_options = {}) {
|
|
12442
12441
|
return {
|
|
12443
|
-
relativeDirPath: (0,
|
|
12442
|
+
relativeDirPath: (0, import_node_path92.join)(".kiro", "agents")
|
|
12444
12443
|
};
|
|
12445
12444
|
}
|
|
12446
12445
|
getBody() {
|
|
@@ -12452,7 +12451,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12452
12451
|
parsed = JSON.parse(this.body);
|
|
12453
12452
|
} catch (error) {
|
|
12454
12453
|
throw new Error(
|
|
12455
|
-
`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)}`,
|
|
12456
12455
|
{ cause: error }
|
|
12457
12456
|
);
|
|
12458
12457
|
}
|
|
@@ -12533,7 +12532,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12533
12532
|
global = false
|
|
12534
12533
|
}) {
|
|
12535
12534
|
const paths = this.getSettablePaths({ global });
|
|
12536
|
-
const filePath = (0,
|
|
12535
|
+
const filePath = (0, import_node_path92.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12537
12536
|
const fileContent = await readFileContent(filePath);
|
|
12538
12537
|
const subagent = new _KiroSubagent({
|
|
12539
12538
|
baseDir,
|
|
@@ -12571,7 +12570,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12571
12570
|
};
|
|
12572
12571
|
|
|
12573
12572
|
// src/features/subagents/opencode-subagent.ts
|
|
12574
|
-
var
|
|
12573
|
+
var import_node_path93 = require("path");
|
|
12575
12574
|
var import_mini49 = require("zod/mini");
|
|
12576
12575
|
var OpenCodeSubagentFrontmatterSchema = import_mini49.z.looseObject({
|
|
12577
12576
|
description: import_mini49.z.optional(import_mini49.z.string()),
|
|
@@ -12586,7 +12585,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12586
12585
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12587
12586
|
if (!result.success) {
|
|
12588
12587
|
throw new Error(
|
|
12589
|
-
`Invalid frontmatter in ${(0,
|
|
12588
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12590
12589
|
);
|
|
12591
12590
|
}
|
|
12592
12591
|
}
|
|
@@ -12600,7 +12599,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12600
12599
|
global = false
|
|
12601
12600
|
} = {}) {
|
|
12602
12601
|
return {
|
|
12603
|
-
relativeDirPath: global ? (0,
|
|
12602
|
+
relativeDirPath: global ? (0, import_node_path93.join)(".config", "opencode", "agent") : (0, import_node_path93.join)(".opencode", "agent")
|
|
12604
12603
|
};
|
|
12605
12604
|
}
|
|
12606
12605
|
getFrontmatter() {
|
|
@@ -12613,7 +12612,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12613
12612
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
12614
12613
|
const rulesyncFrontmatter = {
|
|
12615
12614
|
targets: ["*"],
|
|
12616
|
-
name: name ?? (0,
|
|
12615
|
+
name: name ?? (0, import_node_path93.basename)(this.getRelativeFilePath(), ".md"),
|
|
12617
12616
|
description,
|
|
12618
12617
|
opencode: { mode, ...opencodeSection }
|
|
12619
12618
|
};
|
|
@@ -12666,7 +12665,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12666
12665
|
return {
|
|
12667
12666
|
success: false,
|
|
12668
12667
|
error: new Error(
|
|
12669
|
-
`Invalid frontmatter in ${(0,
|
|
12668
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12670
12669
|
)
|
|
12671
12670
|
};
|
|
12672
12671
|
}
|
|
@@ -12683,7 +12682,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12683
12682
|
global = false
|
|
12684
12683
|
}) {
|
|
12685
12684
|
const paths = this.getSettablePaths({ global });
|
|
12686
|
-
const filePath = (0,
|
|
12685
|
+
const filePath = (0, import_node_path93.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12687
12686
|
const fileContent = await readFileContent(filePath);
|
|
12688
12687
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12689
12688
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12850,9 +12849,10 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12850
12849
|
toolTarget,
|
|
12851
12850
|
global = false,
|
|
12852
12851
|
getFactory = defaultGetFactory5,
|
|
12853
|
-
dryRun = false
|
|
12852
|
+
dryRun = false,
|
|
12853
|
+
logger
|
|
12854
12854
|
}) {
|
|
12855
|
-
super({ baseDir, dryRun });
|
|
12855
|
+
super({ baseDir, dryRun, logger });
|
|
12856
12856
|
const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
12857
12857
|
if (!result.success) {
|
|
12858
12858
|
throw new Error(
|
|
@@ -12888,7 +12888,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12888
12888
|
const rulesyncSubagents = [];
|
|
12889
12889
|
for (const toolSubagent of toolSubagents) {
|
|
12890
12890
|
if (toolSubagent instanceof SimulatedSubagent) {
|
|
12891
|
-
logger.debug(
|
|
12891
|
+
this.logger.debug(
|
|
12892
12892
|
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
12893
12893
|
);
|
|
12894
12894
|
continue;
|
|
@@ -12902,39 +12902,39 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12902
12902
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12903
12903
|
*/
|
|
12904
12904
|
async loadRulesyncFiles() {
|
|
12905
|
-
const subagentsDir = (0,
|
|
12905
|
+
const subagentsDir = (0, import_node_path94.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12906
12906
|
const dirExists = await directoryExists(subagentsDir);
|
|
12907
12907
|
if (!dirExists) {
|
|
12908
|
-
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12908
|
+
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12909
12909
|
return [];
|
|
12910
12910
|
}
|
|
12911
12911
|
const entries = await listDirectoryFiles(subagentsDir);
|
|
12912
12912
|
const mdFiles = entries.filter((file) => file.endsWith(".md"));
|
|
12913
12913
|
if (mdFiles.length === 0) {
|
|
12914
|
-
logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12914
|
+
this.logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12915
12915
|
return [];
|
|
12916
12916
|
}
|
|
12917
|
-
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12917
|
+
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12918
12918
|
const rulesyncSubagents = [];
|
|
12919
12919
|
for (const mdFile of mdFiles) {
|
|
12920
|
-
const filepath = (0,
|
|
12920
|
+
const filepath = (0, import_node_path94.join)(subagentsDir, mdFile);
|
|
12921
12921
|
try {
|
|
12922
12922
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12923
12923
|
relativeFilePath: mdFile,
|
|
12924
12924
|
validate: true
|
|
12925
12925
|
});
|
|
12926
12926
|
rulesyncSubagents.push(rulesyncSubagent);
|
|
12927
|
-
logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12927
|
+
this.logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12928
12928
|
} catch (error) {
|
|
12929
|
-
logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12929
|
+
this.logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12930
12930
|
continue;
|
|
12931
12931
|
}
|
|
12932
12932
|
}
|
|
12933
12933
|
if (rulesyncSubagents.length === 0) {
|
|
12934
|
-
logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12934
|
+
this.logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12935
12935
|
return [];
|
|
12936
12936
|
}
|
|
12937
|
-
logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12937
|
+
this.logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12938
12938
|
return rulesyncSubagents;
|
|
12939
12939
|
}
|
|
12940
12940
|
/**
|
|
@@ -12947,18 +12947,18 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12947
12947
|
const factory = this.getFactory(this.toolTarget);
|
|
12948
12948
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12949
12949
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12950
|
-
(0,
|
|
12950
|
+
(0, import_node_path94.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12951
12951
|
);
|
|
12952
12952
|
if (forDeletion) {
|
|
12953
12953
|
const toolSubagents2 = subagentFilePaths.map(
|
|
12954
12954
|
(path3) => factory.class.forDeletion({
|
|
12955
12955
|
baseDir: this.baseDir,
|
|
12956
12956
|
relativeDirPath: paths.relativeDirPath,
|
|
12957
|
-
relativeFilePath: (0,
|
|
12957
|
+
relativeFilePath: (0, import_node_path94.basename)(path3),
|
|
12958
12958
|
global: this.global
|
|
12959
12959
|
})
|
|
12960
12960
|
).filter((subagent) => subagent.isDeletable());
|
|
12961
|
-
logger.debug(
|
|
12961
|
+
this.logger.debug(
|
|
12962
12962
|
`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`
|
|
12963
12963
|
);
|
|
12964
12964
|
return toolSubagents2;
|
|
@@ -12967,12 +12967,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12967
12967
|
subagentFilePaths.map(
|
|
12968
12968
|
(path3) => factory.class.fromFile({
|
|
12969
12969
|
baseDir: this.baseDir,
|
|
12970
|
-
relativeFilePath: (0,
|
|
12970
|
+
relativeFilePath: (0, import_node_path94.basename)(path3),
|
|
12971
12971
|
global: this.global
|
|
12972
12972
|
})
|
|
12973
12973
|
)
|
|
12974
12974
|
);
|
|
12975
|
-
logger.debug(
|
|
12975
|
+
this.logger.debug(
|
|
12976
|
+
`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`
|
|
12977
|
+
);
|
|
12976
12978
|
return toolSubagents;
|
|
12977
12979
|
}
|
|
12978
12980
|
/**
|
|
@@ -13012,13 +13014,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
13012
13014
|
};
|
|
13013
13015
|
|
|
13014
13016
|
// src/features/rules/agentsmd-rule.ts
|
|
13015
|
-
var
|
|
13017
|
+
var import_node_path97 = require("path");
|
|
13016
13018
|
|
|
13017
13019
|
// src/features/rules/tool-rule.ts
|
|
13018
|
-
var
|
|
13020
|
+
var import_node_path96 = require("path");
|
|
13019
13021
|
|
|
13020
13022
|
// src/features/rules/rulesync-rule.ts
|
|
13021
|
-
var
|
|
13023
|
+
var import_node_path95 = require("path");
|
|
13022
13024
|
var import_mini51 = require("zod/mini");
|
|
13023
13025
|
var RulesyncRuleFrontmatterSchema = import_mini51.z.object({
|
|
13024
13026
|
root: import_mini51.z.optional(import_mini51.z.boolean()),
|
|
@@ -13065,7 +13067,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13065
13067
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13066
13068
|
if (!parseResult.success && rest.validate !== false) {
|
|
13067
13069
|
throw new Error(
|
|
13068
|
-
`Invalid frontmatter in ${(0,
|
|
13070
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
13069
13071
|
);
|
|
13070
13072
|
}
|
|
13071
13073
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -13100,7 +13102,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13100
13102
|
return {
|
|
13101
13103
|
success: false,
|
|
13102
13104
|
error: new Error(
|
|
13103
|
-
`Invalid frontmatter in ${(0,
|
|
13105
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13104
13106
|
)
|
|
13105
13107
|
};
|
|
13106
13108
|
}
|
|
@@ -13109,7 +13111,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13109
13111
|
relativeFilePath,
|
|
13110
13112
|
validate = true
|
|
13111
13113
|
}) {
|
|
13112
|
-
const filePath = (0,
|
|
13114
|
+
const filePath = (0, import_node_path95.join)(
|
|
13113
13115
|
process.cwd(),
|
|
13114
13116
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
13115
13117
|
relativeFilePath
|
|
@@ -13211,7 +13213,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13211
13213
|
rulesyncRule,
|
|
13212
13214
|
validate = true,
|
|
13213
13215
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
13214
|
-
nonRootPath = { relativeDirPath: (0,
|
|
13216
|
+
nonRootPath = { relativeDirPath: (0, import_node_path96.join)(".agents", "memories") }
|
|
13215
13217
|
}) {
|
|
13216
13218
|
const params = this.buildToolRuleParamsDefault({
|
|
13217
13219
|
baseDir,
|
|
@@ -13222,7 +13224,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13222
13224
|
});
|
|
13223
13225
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
13224
13226
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
13225
|
-
params.relativeDirPath = (0,
|
|
13227
|
+
params.relativeDirPath = (0, import_node_path96.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
13226
13228
|
params.relativeFilePath = "AGENTS.md";
|
|
13227
13229
|
}
|
|
13228
13230
|
return params;
|
|
@@ -13271,7 +13273,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13271
13273
|
}
|
|
13272
13274
|
};
|
|
13273
13275
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
13274
|
-
return excludeToolDir ? subDir : (0,
|
|
13276
|
+
return excludeToolDir ? subDir : (0, import_node_path96.join)(toolDir, subDir);
|
|
13275
13277
|
}
|
|
13276
13278
|
|
|
13277
13279
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -13300,8 +13302,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13300
13302
|
validate = true
|
|
13301
13303
|
}) {
|
|
13302
13304
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
13303
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
13304
|
-
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));
|
|
13305
13307
|
return new _AgentsMdRule({
|
|
13306
13308
|
baseDir,
|
|
13307
13309
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13356,7 +13358,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13356
13358
|
};
|
|
13357
13359
|
|
|
13358
13360
|
// src/features/rules/antigravity-rule.ts
|
|
13359
|
-
var
|
|
13361
|
+
var import_node_path98 = require("path");
|
|
13360
13362
|
var import_mini52 = require("zod/mini");
|
|
13361
13363
|
var AntigravityRuleFrontmatterSchema = import_mini52.z.looseObject({
|
|
13362
13364
|
trigger: import_mini52.z.optional(
|
|
@@ -13515,7 +13517,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13515
13517
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13516
13518
|
if (!result.success) {
|
|
13517
13519
|
throw new Error(
|
|
13518
|
-
`Invalid frontmatter in ${(0,
|
|
13520
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13519
13521
|
);
|
|
13520
13522
|
}
|
|
13521
13523
|
}
|
|
@@ -13539,7 +13541,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13539
13541
|
relativeFilePath,
|
|
13540
13542
|
validate = true
|
|
13541
13543
|
}) {
|
|
13542
|
-
const filePath = (0,
|
|
13544
|
+
const filePath = (0, import_node_path98.join)(
|
|
13543
13545
|
baseDir,
|
|
13544
13546
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13545
13547
|
relativeFilePath
|
|
@@ -13679,7 +13681,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13679
13681
|
};
|
|
13680
13682
|
|
|
13681
13683
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
13682
|
-
var
|
|
13684
|
+
var import_node_path99 = require("path");
|
|
13683
13685
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
13684
13686
|
toRulesyncRule() {
|
|
13685
13687
|
const rulesyncFrontmatter = {
|
|
@@ -13739,8 +13741,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13739
13741
|
}) {
|
|
13740
13742
|
const settablePaths = this.getSettablePaths();
|
|
13741
13743
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
13742
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
13743
|
-
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));
|
|
13744
13746
|
return new _AugmentcodeLegacyRule({
|
|
13745
13747
|
baseDir,
|
|
13746
13748
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -13769,7 +13771,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13769
13771
|
};
|
|
13770
13772
|
|
|
13771
13773
|
// src/features/rules/augmentcode-rule.ts
|
|
13772
|
-
var
|
|
13774
|
+
var import_node_path100 = require("path");
|
|
13773
13775
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
13774
13776
|
toRulesyncRule() {
|
|
13775
13777
|
return this.toRulesyncRuleDefault();
|
|
@@ -13800,7 +13802,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13800
13802
|
relativeFilePath,
|
|
13801
13803
|
validate = true
|
|
13802
13804
|
}) {
|
|
13803
|
-
const filePath = (0,
|
|
13805
|
+
const filePath = (0, import_node_path100.join)(
|
|
13804
13806
|
baseDir,
|
|
13805
13807
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13806
13808
|
relativeFilePath
|
|
@@ -13840,7 +13842,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13840
13842
|
};
|
|
13841
13843
|
|
|
13842
13844
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13843
|
-
var
|
|
13845
|
+
var import_node_path101 = require("path");
|
|
13844
13846
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13845
13847
|
static getSettablePaths({
|
|
13846
13848
|
global,
|
|
@@ -13882,7 +13884,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13882
13884
|
if (isRoot) {
|
|
13883
13885
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13884
13886
|
const fileContent2 = await readFileContent(
|
|
13885
|
-
(0,
|
|
13887
|
+
(0, import_node_path101.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13886
13888
|
);
|
|
13887
13889
|
return new _ClaudecodeLegacyRule({
|
|
13888
13890
|
baseDir,
|
|
@@ -13896,8 +13898,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13896
13898
|
if (!paths.nonRoot) {
|
|
13897
13899
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13898
13900
|
}
|
|
13899
|
-
const relativePath = (0,
|
|
13900
|
-
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));
|
|
13901
13903
|
return new _ClaudecodeLegacyRule({
|
|
13902
13904
|
baseDir,
|
|
13903
13905
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13956,7 +13958,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13956
13958
|
};
|
|
13957
13959
|
|
|
13958
13960
|
// src/features/rules/claudecode-rule.ts
|
|
13959
|
-
var
|
|
13961
|
+
var import_node_path102 = require("path");
|
|
13960
13962
|
var import_mini53 = require("zod/mini");
|
|
13961
13963
|
var ClaudecodeRuleFrontmatterSchema = import_mini53.z.object({
|
|
13962
13964
|
paths: import_mini53.z.optional(import_mini53.z.array(import_mini53.z.string()))
|
|
@@ -13997,7 +13999,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13997
13999
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13998
14000
|
if (!result.success) {
|
|
13999
14001
|
throw new Error(
|
|
14000
|
-
`Invalid frontmatter in ${(0,
|
|
14002
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14001
14003
|
);
|
|
14002
14004
|
}
|
|
14003
14005
|
}
|
|
@@ -14027,7 +14029,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14027
14029
|
if (isRoot) {
|
|
14028
14030
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
14029
14031
|
const fileContent2 = await readFileContent(
|
|
14030
|
-
(0,
|
|
14032
|
+
(0, import_node_path102.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
14031
14033
|
);
|
|
14032
14034
|
return new _ClaudecodeRule({
|
|
14033
14035
|
baseDir,
|
|
@@ -14042,8 +14044,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14042
14044
|
if (!paths.nonRoot) {
|
|
14043
14045
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14044
14046
|
}
|
|
14045
|
-
const relativePath = (0,
|
|
14046
|
-
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);
|
|
14047
14049
|
const fileContent = await readFileContent(filePath);
|
|
14048
14050
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14049
14051
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14154,7 +14156,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14154
14156
|
return {
|
|
14155
14157
|
success: false,
|
|
14156
14158
|
error: new Error(
|
|
14157
|
-
`Invalid frontmatter in ${(0,
|
|
14159
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14158
14160
|
)
|
|
14159
14161
|
};
|
|
14160
14162
|
}
|
|
@@ -14174,7 +14176,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14174
14176
|
};
|
|
14175
14177
|
|
|
14176
14178
|
// src/features/rules/cline-rule.ts
|
|
14177
|
-
var
|
|
14179
|
+
var import_node_path103 = require("path");
|
|
14178
14180
|
var import_mini54 = require("zod/mini");
|
|
14179
14181
|
var ClineRuleFrontmatterSchema = import_mini54.z.object({
|
|
14180
14182
|
description: import_mini54.z.string()
|
|
@@ -14220,7 +14222,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14220
14222
|
validate = true
|
|
14221
14223
|
}) {
|
|
14222
14224
|
const fileContent = await readFileContent(
|
|
14223
|
-
(0,
|
|
14225
|
+
(0, import_node_path103.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14224
14226
|
);
|
|
14225
14227
|
return new _ClineRule({
|
|
14226
14228
|
baseDir,
|
|
@@ -14246,7 +14248,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14246
14248
|
};
|
|
14247
14249
|
|
|
14248
14250
|
// src/features/rules/codexcli-rule.ts
|
|
14249
|
-
var
|
|
14251
|
+
var import_node_path104 = require("path");
|
|
14250
14252
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
14251
14253
|
static getSettablePaths({
|
|
14252
14254
|
global,
|
|
@@ -14281,7 +14283,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14281
14283
|
if (isRoot) {
|
|
14282
14284
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14283
14285
|
const fileContent2 = await readFileContent(
|
|
14284
|
-
(0,
|
|
14286
|
+
(0, import_node_path104.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14285
14287
|
);
|
|
14286
14288
|
return new _CodexcliRule({
|
|
14287
14289
|
baseDir,
|
|
@@ -14295,8 +14297,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14295
14297
|
if (!paths.nonRoot) {
|
|
14296
14298
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14297
14299
|
}
|
|
14298
|
-
const relativePath = (0,
|
|
14299
|
-
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));
|
|
14300
14302
|
return new _CodexcliRule({
|
|
14301
14303
|
baseDir,
|
|
14302
14304
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14355,7 +14357,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14355
14357
|
};
|
|
14356
14358
|
|
|
14357
14359
|
// src/features/rules/copilot-rule.ts
|
|
14358
|
-
var
|
|
14360
|
+
var import_node_path105 = require("path");
|
|
14359
14361
|
var import_mini55 = require("zod/mini");
|
|
14360
14362
|
var CopilotRuleFrontmatterSchema = import_mini55.z.object({
|
|
14361
14363
|
description: import_mini55.z.optional(import_mini55.z.string()),
|
|
@@ -14392,7 +14394,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14392
14394
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14393
14395
|
if (!result.success) {
|
|
14394
14396
|
throw new Error(
|
|
14395
|
-
`Invalid frontmatter in ${(0,
|
|
14397
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14396
14398
|
);
|
|
14397
14399
|
}
|
|
14398
14400
|
}
|
|
@@ -14482,8 +14484,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14482
14484
|
const paths = this.getSettablePaths({ global });
|
|
14483
14485
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14484
14486
|
if (isRoot) {
|
|
14485
|
-
const relativePath2 = (0,
|
|
14486
|
-
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);
|
|
14487
14489
|
const fileContent2 = await readFileContent(filePath2);
|
|
14488
14490
|
return new _CopilotRule({
|
|
14489
14491
|
baseDir,
|
|
@@ -14498,8 +14500,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14498
14500
|
if (!paths.nonRoot) {
|
|
14499
14501
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14500
14502
|
}
|
|
14501
|
-
const relativePath = (0,
|
|
14502
|
-
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);
|
|
14503
14505
|
const fileContent = await readFileContent(filePath);
|
|
14504
14506
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14505
14507
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14545,7 +14547,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14545
14547
|
return {
|
|
14546
14548
|
success: false,
|
|
14547
14549
|
error: new Error(
|
|
14548
|
-
`Invalid frontmatter in ${(0,
|
|
14550
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14549
14551
|
)
|
|
14550
14552
|
};
|
|
14551
14553
|
}
|
|
@@ -14565,7 +14567,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14565
14567
|
};
|
|
14566
14568
|
|
|
14567
14569
|
// src/features/rules/cursor-rule.ts
|
|
14568
|
-
var
|
|
14570
|
+
var import_node_path106 = require("path");
|
|
14569
14571
|
var import_mini56 = require("zod/mini");
|
|
14570
14572
|
var CursorRuleFrontmatterSchema = import_mini56.z.object({
|
|
14571
14573
|
description: import_mini56.z.optional(import_mini56.z.string()),
|
|
@@ -14587,7 +14589,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14587
14589
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14588
14590
|
if (!result.success) {
|
|
14589
14591
|
throw new Error(
|
|
14590
|
-
`Invalid frontmatter in ${(0,
|
|
14592
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14591
14593
|
);
|
|
14592
14594
|
}
|
|
14593
14595
|
}
|
|
@@ -14703,7 +14705,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14703
14705
|
relativeFilePath,
|
|
14704
14706
|
validate = true
|
|
14705
14707
|
}) {
|
|
14706
|
-
const filePath = (0,
|
|
14708
|
+
const filePath = (0, import_node_path106.join)(
|
|
14707
14709
|
baseDir,
|
|
14708
14710
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14709
14711
|
relativeFilePath
|
|
@@ -14713,7 +14715,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14713
14715
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14714
14716
|
if (!result.success) {
|
|
14715
14717
|
throw new Error(
|
|
14716
|
-
`Invalid frontmatter in ${(0,
|
|
14718
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
14717
14719
|
);
|
|
14718
14720
|
}
|
|
14719
14721
|
return new _CursorRule({
|
|
@@ -14750,7 +14752,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14750
14752
|
return {
|
|
14751
14753
|
success: false,
|
|
14752
14754
|
error: new Error(
|
|
14753
|
-
`Invalid frontmatter in ${(0,
|
|
14755
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14754
14756
|
)
|
|
14755
14757
|
};
|
|
14756
14758
|
}
|
|
@@ -14770,7 +14772,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14770
14772
|
};
|
|
14771
14773
|
|
|
14772
14774
|
// src/features/rules/factorydroid-rule.ts
|
|
14773
|
-
var
|
|
14775
|
+
var import_node_path107 = require("path");
|
|
14774
14776
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
14775
14777
|
constructor({ fileContent, root, ...rest }) {
|
|
14776
14778
|
super({
|
|
@@ -14810,8 +14812,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14810
14812
|
const paths = this.getSettablePaths({ global });
|
|
14811
14813
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14812
14814
|
if (isRoot) {
|
|
14813
|
-
const relativePath2 = (0,
|
|
14814
|
-
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));
|
|
14815
14817
|
return new _FactorydroidRule({
|
|
14816
14818
|
baseDir,
|
|
14817
14819
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14824,8 +14826,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14824
14826
|
if (!paths.nonRoot) {
|
|
14825
14827
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14826
14828
|
}
|
|
14827
|
-
const relativePath = (0,
|
|
14828
|
-
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));
|
|
14829
14831
|
return new _FactorydroidRule({
|
|
14830
14832
|
baseDir,
|
|
14831
14833
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14884,7 +14886,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14884
14886
|
};
|
|
14885
14887
|
|
|
14886
14888
|
// src/features/rules/geminicli-rule.ts
|
|
14887
|
-
var
|
|
14889
|
+
var import_node_path108 = require("path");
|
|
14888
14890
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14889
14891
|
static getSettablePaths({
|
|
14890
14892
|
global,
|
|
@@ -14919,7 +14921,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14919
14921
|
if (isRoot) {
|
|
14920
14922
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14921
14923
|
const fileContent2 = await readFileContent(
|
|
14922
|
-
(0,
|
|
14924
|
+
(0, import_node_path108.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14923
14925
|
);
|
|
14924
14926
|
return new _GeminiCliRule({
|
|
14925
14927
|
baseDir,
|
|
@@ -14933,8 +14935,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14933
14935
|
if (!paths.nonRoot) {
|
|
14934
14936
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14935
14937
|
}
|
|
14936
|
-
const relativePath = (0,
|
|
14937
|
-
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));
|
|
14938
14940
|
return new _GeminiCliRule({
|
|
14939
14941
|
baseDir,
|
|
14940
14942
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14993,7 +14995,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14993
14995
|
};
|
|
14994
14996
|
|
|
14995
14997
|
// src/features/rules/goose-rule.ts
|
|
14996
|
-
var
|
|
14998
|
+
var import_node_path109 = require("path");
|
|
14997
14999
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14998
15000
|
static getSettablePaths({
|
|
14999
15001
|
global,
|
|
@@ -15028,7 +15030,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15028
15030
|
if (isRoot) {
|
|
15029
15031
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15030
15032
|
const fileContent2 = await readFileContent(
|
|
15031
|
-
(0,
|
|
15033
|
+
(0, import_node_path109.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15032
15034
|
);
|
|
15033
15035
|
return new _GooseRule({
|
|
15034
15036
|
baseDir,
|
|
@@ -15042,8 +15044,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15042
15044
|
if (!paths.nonRoot) {
|
|
15043
15045
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15044
15046
|
}
|
|
15045
|
-
const relativePath = (0,
|
|
15046
|
-
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));
|
|
15047
15049
|
return new _GooseRule({
|
|
15048
15050
|
baseDir,
|
|
15049
15051
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15102,7 +15104,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
15102
15104
|
};
|
|
15103
15105
|
|
|
15104
15106
|
// src/features/rules/junie-rule.ts
|
|
15105
|
-
var
|
|
15107
|
+
var import_node_path110 = require("path");
|
|
15106
15108
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
15107
15109
|
static getSettablePaths(_options = {}) {
|
|
15108
15110
|
return {
|
|
@@ -15121,8 +15123,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15121
15123
|
validate = true
|
|
15122
15124
|
}) {
|
|
15123
15125
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
15124
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
15125
|
-
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));
|
|
15126
15128
|
return new _JunieRule({
|
|
15127
15129
|
baseDir,
|
|
15128
15130
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15177,7 +15179,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15177
15179
|
};
|
|
15178
15180
|
|
|
15179
15181
|
// src/features/rules/kilo-rule.ts
|
|
15180
|
-
var
|
|
15182
|
+
var import_node_path111 = require("path");
|
|
15181
15183
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
15182
15184
|
static getSettablePaths(_options = {}) {
|
|
15183
15185
|
return {
|
|
@@ -15192,7 +15194,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15192
15194
|
validate = true
|
|
15193
15195
|
}) {
|
|
15194
15196
|
const fileContent = await readFileContent(
|
|
15195
|
-
(0,
|
|
15197
|
+
(0, import_node_path111.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15196
15198
|
);
|
|
15197
15199
|
return new _KiloRule({
|
|
15198
15200
|
baseDir,
|
|
@@ -15244,7 +15246,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15244
15246
|
};
|
|
15245
15247
|
|
|
15246
15248
|
// src/features/rules/kiro-rule.ts
|
|
15247
|
-
var
|
|
15249
|
+
var import_node_path112 = require("path");
|
|
15248
15250
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
15249
15251
|
static getSettablePaths(_options = {}) {
|
|
15250
15252
|
return {
|
|
@@ -15259,7 +15261,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15259
15261
|
validate = true
|
|
15260
15262
|
}) {
|
|
15261
15263
|
const fileContent = await readFileContent(
|
|
15262
|
-
(0,
|
|
15264
|
+
(0, import_node_path112.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15263
15265
|
);
|
|
15264
15266
|
return new _KiroRule({
|
|
15265
15267
|
baseDir,
|
|
@@ -15313,7 +15315,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15313
15315
|
};
|
|
15314
15316
|
|
|
15315
15317
|
// src/features/rules/opencode-rule.ts
|
|
15316
|
-
var
|
|
15318
|
+
var import_node_path113 = require("path");
|
|
15317
15319
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
15318
15320
|
static getSettablePaths({
|
|
15319
15321
|
global,
|
|
@@ -15348,7 +15350,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15348
15350
|
if (isRoot) {
|
|
15349
15351
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15350
15352
|
const fileContent2 = await readFileContent(
|
|
15351
|
-
(0,
|
|
15353
|
+
(0, import_node_path113.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15352
15354
|
);
|
|
15353
15355
|
return new _OpenCodeRule({
|
|
15354
15356
|
baseDir,
|
|
@@ -15362,8 +15364,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15362
15364
|
if (!paths.nonRoot) {
|
|
15363
15365
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15364
15366
|
}
|
|
15365
|
-
const relativePath = (0,
|
|
15366
|
-
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));
|
|
15367
15369
|
return new _OpenCodeRule({
|
|
15368
15370
|
baseDir,
|
|
15369
15371
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15422,7 +15424,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15422
15424
|
};
|
|
15423
15425
|
|
|
15424
15426
|
// src/features/rules/qwencode-rule.ts
|
|
15425
|
-
var
|
|
15427
|
+
var import_node_path114 = require("path");
|
|
15426
15428
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
15427
15429
|
static getSettablePaths(_options = {}) {
|
|
15428
15430
|
return {
|
|
@@ -15441,8 +15443,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15441
15443
|
validate = true
|
|
15442
15444
|
}) {
|
|
15443
15445
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
15444
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
15445
|
-
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));
|
|
15446
15448
|
return new _QwencodeRule({
|
|
15447
15449
|
baseDir,
|
|
15448
15450
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15494,7 +15496,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15494
15496
|
};
|
|
15495
15497
|
|
|
15496
15498
|
// src/features/rules/replit-rule.ts
|
|
15497
|
-
var
|
|
15499
|
+
var import_node_path115 = require("path");
|
|
15498
15500
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
15499
15501
|
static getSettablePaths(_options = {}) {
|
|
15500
15502
|
return {
|
|
@@ -15516,7 +15518,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15516
15518
|
}
|
|
15517
15519
|
const relativePath = paths.root.relativeFilePath;
|
|
15518
15520
|
const fileContent = await readFileContent(
|
|
15519
|
-
(0,
|
|
15521
|
+
(0, import_node_path115.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
15520
15522
|
);
|
|
15521
15523
|
return new _ReplitRule({
|
|
15522
15524
|
baseDir,
|
|
@@ -15582,7 +15584,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15582
15584
|
};
|
|
15583
15585
|
|
|
15584
15586
|
// src/features/rules/roo-rule.ts
|
|
15585
|
-
var
|
|
15587
|
+
var import_node_path116 = require("path");
|
|
15586
15588
|
var RooRule = class _RooRule extends ToolRule {
|
|
15587
15589
|
static getSettablePaths(_options = {}) {
|
|
15588
15590
|
return {
|
|
@@ -15597,7 +15599,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15597
15599
|
validate = true
|
|
15598
15600
|
}) {
|
|
15599
15601
|
const fileContent = await readFileContent(
|
|
15600
|
-
(0,
|
|
15602
|
+
(0, import_node_path116.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15601
15603
|
);
|
|
15602
15604
|
return new _RooRule({
|
|
15603
15605
|
baseDir,
|
|
@@ -15666,7 +15668,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15666
15668
|
};
|
|
15667
15669
|
|
|
15668
15670
|
// src/features/rules/warp-rule.ts
|
|
15669
|
-
var
|
|
15671
|
+
var import_node_path117 = require("path");
|
|
15670
15672
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
15671
15673
|
constructor({ fileContent, root, ...rest }) {
|
|
15672
15674
|
super({
|
|
@@ -15692,8 +15694,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15692
15694
|
validate = true
|
|
15693
15695
|
}) {
|
|
15694
15696
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
15695
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
15696
|
-
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));
|
|
15697
15699
|
return new _WarpRule({
|
|
15698
15700
|
baseDir,
|
|
15699
15701
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -15748,7 +15750,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15748
15750
|
};
|
|
15749
15751
|
|
|
15750
15752
|
// src/features/rules/windsurf-rule.ts
|
|
15751
|
-
var
|
|
15753
|
+
var import_node_path118 = require("path");
|
|
15752
15754
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
15753
15755
|
static getSettablePaths(_options = {}) {
|
|
15754
15756
|
return {
|
|
@@ -15763,7 +15765,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
15763
15765
|
validate = true
|
|
15764
15766
|
}) {
|
|
15765
15767
|
const fileContent = await readFileContent(
|
|
15766
|
-
(0,
|
|
15768
|
+
(0, import_node_path118.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15767
15769
|
);
|
|
15768
15770
|
return new _WindsurfRule({
|
|
15769
15771
|
baseDir,
|
|
@@ -15840,7 +15842,7 @@ var rulesProcessorToolTargets = [
|
|
|
15840
15842
|
"windsurf"
|
|
15841
15843
|
];
|
|
15842
15844
|
var RulesProcessorToolTargetSchema = import_mini57.z.enum(rulesProcessorToolTargets);
|
|
15843
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
15845
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path119.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15844
15846
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15845
15847
|
[
|
|
15846
15848
|
"agentsmd",
|
|
@@ -16127,9 +16129,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16127
16129
|
global = false,
|
|
16128
16130
|
getFactory = defaultGetFactory6,
|
|
16129
16131
|
skills,
|
|
16130
|
-
dryRun = false
|
|
16132
|
+
dryRun = false,
|
|
16133
|
+
logger
|
|
16131
16134
|
}) {
|
|
16132
|
-
super({ baseDir, dryRun });
|
|
16135
|
+
super({ baseDir, dryRun, logger });
|
|
16133
16136
|
const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
|
|
16134
16137
|
if (!result.success) {
|
|
16135
16138
|
throw new Error(
|
|
@@ -16215,7 +16218,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16215
16218
|
}).relativeDirPath;
|
|
16216
16219
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
16217
16220
|
const frontmatter = skill.getFrontmatter();
|
|
16218
|
-
const relativePath = (0,
|
|
16221
|
+
const relativePath = (0, import_node_path119.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
16219
16222
|
return {
|
|
16220
16223
|
name: frontmatter.name,
|
|
16221
16224
|
description: frontmatter.description,
|
|
@@ -16328,12 +16331,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16328
16331
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
16329
16332
|
*/
|
|
16330
16333
|
async loadRulesyncFiles() {
|
|
16331
|
-
const rulesyncBaseDir = (0,
|
|
16332
|
-
const files = await findFilesByGlobs((0,
|
|
16333
|
-
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`);
|
|
16334
16337
|
const rulesyncRules = await Promise.all(
|
|
16335
16338
|
files.map((file) => {
|
|
16336
|
-
const relativeFilePath = (0,
|
|
16339
|
+
const relativeFilePath = (0, import_node_path119.relative)(rulesyncBaseDir, file);
|
|
16337
16340
|
checkPathTraversal({
|
|
16338
16341
|
relativePath: relativeFilePath,
|
|
16339
16342
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -16354,7 +16357,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16354
16357
|
);
|
|
16355
16358
|
}
|
|
16356
16359
|
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
16357
|
-
logger.warn(
|
|
16360
|
+
this.logger.warn(
|
|
16358
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}.`
|
|
16359
16362
|
);
|
|
16360
16363
|
}
|
|
@@ -16379,12 +16382,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16379
16382
|
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
16380
16383
|
);
|
|
16381
16384
|
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
16382
|
-
logger.warn(
|
|
16385
|
+
this.logger.warn(
|
|
16383
16386
|
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
16384
16387
|
);
|
|
16385
16388
|
}
|
|
16386
16389
|
if (targetedLocalRootRules.length > 0) {
|
|
16387
|
-
logger.warn(
|
|
16390
|
+
this.logger.warn(
|
|
16388
16391
|
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
16389
16392
|
);
|
|
16390
16393
|
}
|
|
@@ -16408,7 +16411,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16408
16411
|
global: this.global
|
|
16409
16412
|
});
|
|
16410
16413
|
const resolveRelativeDirPath = (filePath) => {
|
|
16411
|
-
const dirName = (0,
|
|
16414
|
+
const dirName = (0, import_node_path119.dirname)((0, import_node_path119.relative)(this.baseDir, filePath));
|
|
16412
16415
|
return dirName === "" ? "." : dirName;
|
|
16413
16416
|
};
|
|
16414
16417
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
@@ -16426,13 +16429,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16426
16429
|
return [];
|
|
16427
16430
|
}
|
|
16428
16431
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
16429
|
-
(0,
|
|
16432
|
+
(0, import_node_path119.join)(
|
|
16430
16433
|
this.baseDir,
|
|
16431
16434
|
settablePaths.root.relativeDirPath ?? ".",
|
|
16432
16435
|
settablePaths.root.relativeFilePath
|
|
16433
16436
|
),
|
|
16434
16437
|
settablePaths.alternativeRoots,
|
|
16435
|
-
(alt) => (0,
|
|
16438
|
+
(alt) => (0, import_node_path119.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
16436
16439
|
);
|
|
16437
16440
|
if (forDeletion) {
|
|
16438
16441
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -16444,7 +16447,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16444
16447
|
return factory.class.forDeletion({
|
|
16445
16448
|
baseDir: this.baseDir,
|
|
16446
16449
|
relativeDirPath,
|
|
16447
|
-
relativeFilePath: (0,
|
|
16450
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16448
16451
|
global: this.global
|
|
16449
16452
|
});
|
|
16450
16453
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -16458,14 +16461,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16458
16461
|
});
|
|
16459
16462
|
return factory.class.fromFile({
|
|
16460
16463
|
baseDir: this.baseDir,
|
|
16461
|
-
relativeFilePath: (0,
|
|
16464
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16462
16465
|
relativeDirPath,
|
|
16463
16466
|
global: this.global
|
|
16464
16467
|
});
|
|
16465
16468
|
})
|
|
16466
16469
|
);
|
|
16467
16470
|
})();
|
|
16468
|
-
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16471
|
+
this.logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16469
16472
|
const localRootToolRules = await (async () => {
|
|
16470
16473
|
if (!forDeletion) {
|
|
16471
16474
|
return [];
|
|
@@ -16477,9 +16480,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16477
16480
|
return [];
|
|
16478
16481
|
}
|
|
16479
16482
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
16480
|
-
(0,
|
|
16483
|
+
(0, import_node_path119.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
16481
16484
|
settablePaths.alternativeRoots,
|
|
16482
|
-
(alt) => (0,
|
|
16485
|
+
(alt) => (0, import_node_path119.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
16483
16486
|
);
|
|
16484
16487
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
16485
16488
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -16490,23 +16493,25 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16490
16493
|
return factory.class.forDeletion({
|
|
16491
16494
|
baseDir: this.baseDir,
|
|
16492
16495
|
relativeDirPath,
|
|
16493
|
-
relativeFilePath: (0,
|
|
16496
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16494
16497
|
global: this.global
|
|
16495
16498
|
});
|
|
16496
16499
|
}).filter((rule) => rule.isDeletable());
|
|
16497
16500
|
})();
|
|
16498
|
-
logger.debug(
|
|
16501
|
+
this.logger.debug(
|
|
16502
|
+
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
16503
|
+
);
|
|
16499
16504
|
const nonRootToolRules = await (async () => {
|
|
16500
16505
|
if (!settablePaths.nonRoot) {
|
|
16501
16506
|
return [];
|
|
16502
16507
|
}
|
|
16503
|
-
const nonRootBaseDir = (0,
|
|
16508
|
+
const nonRootBaseDir = (0, import_node_path119.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
16504
16509
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
16505
|
-
(0,
|
|
16510
|
+
(0, import_node_path119.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
16506
16511
|
);
|
|
16507
16512
|
if (forDeletion) {
|
|
16508
16513
|
return nonRootFilePaths.map((filePath) => {
|
|
16509
|
-
const relativeFilePath = (0,
|
|
16514
|
+
const relativeFilePath = (0, import_node_path119.relative)(nonRootBaseDir, filePath);
|
|
16510
16515
|
checkPathTraversal({
|
|
16511
16516
|
relativePath: relativeFilePath,
|
|
16512
16517
|
intendedRootDir: nonRootBaseDir
|
|
@@ -16521,7 +16526,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16521
16526
|
}
|
|
16522
16527
|
return await Promise.all(
|
|
16523
16528
|
nonRootFilePaths.map((filePath) => {
|
|
16524
|
-
const relativeFilePath = (0,
|
|
16529
|
+
const relativeFilePath = (0, import_node_path119.relative)(nonRootBaseDir, filePath);
|
|
16525
16530
|
checkPathTraversal({
|
|
16526
16531
|
relativePath: relativeFilePath,
|
|
16527
16532
|
intendedRootDir: nonRootBaseDir
|
|
@@ -16534,10 +16539,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16534
16539
|
})
|
|
16535
16540
|
);
|
|
16536
16541
|
})();
|
|
16537
|
-
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16542
|
+
this.logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16538
16543
|
return [...rootToolRules, ...localRootToolRules, ...nonRootToolRules];
|
|
16539
16544
|
} catch (error) {
|
|
16540
|
-
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)}`);
|
|
16541
16546
|
return [];
|
|
16542
16547
|
}
|
|
16543
16548
|
}
|
|
@@ -16634,14 +16639,14 @@ s/<command> [arguments]
|
|
|
16634
16639
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
16635
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.
|
|
16636
16641
|
|
|
16637
|
-
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.` : "";
|
|
16638
16643
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
16639
16644
|
|
|
16640
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.
|
|
16641
16646
|
|
|
16642
|
-
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.
|
|
16643
16648
|
|
|
16644
|
-
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.` : "";
|
|
16645
16650
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
16646
16651
|
const result = [
|
|
16647
16652
|
overview,
|
|
@@ -16713,7 +16718,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16713
16718
|
return { count: totalCount, paths: [], hasDiff };
|
|
16714
16719
|
}
|
|
16715
16720
|
function warnUnsupportedTargets(params) {
|
|
16716
|
-
const { config, supportedTargets, featureName } = params;
|
|
16721
|
+
const { config, supportedTargets, featureName, logger } = params;
|
|
16717
16722
|
for (const target of config.getTargets()) {
|
|
16718
16723
|
if (!supportedTargets.includes(target) && config.getFeatures(target).includes(featureName)) {
|
|
16719
16724
|
logger.warn(`Target '${target}' does not support the feature '${featureName}'. Skipping.`);
|
|
@@ -16721,17 +16726,17 @@ function warnUnsupportedTargets(params) {
|
|
|
16721
16726
|
}
|
|
16722
16727
|
}
|
|
16723
16728
|
async function checkRulesyncDirExists(params) {
|
|
16724
|
-
return fileExists((0,
|
|
16729
|
+
return fileExists((0, import_node_path120.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16725
16730
|
}
|
|
16726
16731
|
async function generate(params) {
|
|
16727
|
-
const { config } = params;
|
|
16728
|
-
const ignoreResult = await generateIgnoreCore({ config });
|
|
16729
|
-
const mcpResult = await generateMcpCore({ config });
|
|
16730
|
-
const commandsResult = await generateCommandsCore({ config });
|
|
16731
|
-
const subagentsResult = await generateSubagentsCore({ config });
|
|
16732
|
-
const skillsResult = await generateSkillsCore({ config });
|
|
16733
|
-
const hooksResult = await generateHooksCore({ config });
|
|
16734
|
-
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 });
|
|
16735
16740
|
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
16736
16741
|
return {
|
|
16737
16742
|
rulesCount: rulesResult.count,
|
|
@@ -16753,13 +16758,13 @@ async function generate(params) {
|
|
|
16753
16758
|
};
|
|
16754
16759
|
}
|
|
16755
16760
|
async function generateRulesCore(params) {
|
|
16756
|
-
const { config, skills } = params;
|
|
16761
|
+
const { config, logger, skills } = params;
|
|
16757
16762
|
let totalCount = 0;
|
|
16758
16763
|
const allPaths = [];
|
|
16759
16764
|
let hasDiff = false;
|
|
16760
16765
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16761
16766
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedTargets);
|
|
16762
|
-
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules" });
|
|
16767
|
+
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger });
|
|
16763
16768
|
for (const baseDir of config.getBaseDirs()) {
|
|
16764
16769
|
for (const toolTarget of toolTargets) {
|
|
16765
16770
|
if (!config.getFeatures(toolTarget).includes("rules")) {
|
|
@@ -16773,7 +16778,8 @@ async function generateRulesCore(params) {
|
|
|
16773
16778
|
simulateSubagents: config.getSimulateSubagents(),
|
|
16774
16779
|
simulateSkills: config.getSimulateSkills(),
|
|
16775
16780
|
skills,
|
|
16776
|
-
dryRun: config.isPreviewMode()
|
|
16781
|
+
dryRun: config.isPreviewMode(),
|
|
16782
|
+
logger
|
|
16777
16783
|
});
|
|
16778
16784
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16779
16785
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16790,12 +16796,13 @@ async function generateRulesCore(params) {
|
|
|
16790
16796
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16791
16797
|
}
|
|
16792
16798
|
async function generateIgnoreCore(params) {
|
|
16793
|
-
const { config } = params;
|
|
16799
|
+
const { config, logger } = params;
|
|
16794
16800
|
const supportedIgnoreTargets = IgnoreProcessor.getToolTargets();
|
|
16795
16801
|
warnUnsupportedTargets({
|
|
16796
16802
|
config,
|
|
16797
16803
|
supportedTargets: supportedIgnoreTargets,
|
|
16798
|
-
featureName: "ignore"
|
|
16804
|
+
featureName: "ignore",
|
|
16805
|
+
logger
|
|
16799
16806
|
});
|
|
16800
16807
|
if (config.getGlobal()) {
|
|
16801
16808
|
return { count: 0, paths: [], hasDiff: false };
|
|
@@ -16812,7 +16819,8 @@ async function generateIgnoreCore(params) {
|
|
|
16812
16819
|
const processor = new IgnoreProcessor({
|
|
16813
16820
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
16814
16821
|
toolTarget,
|
|
16815
|
-
dryRun: config.isPreviewMode()
|
|
16822
|
+
dryRun: config.isPreviewMode(),
|
|
16823
|
+
logger
|
|
16816
16824
|
});
|
|
16817
16825
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16818
16826
|
let result;
|
|
@@ -16843,13 +16851,18 @@ async function generateIgnoreCore(params) {
|
|
|
16843
16851
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16844
16852
|
}
|
|
16845
16853
|
async function generateMcpCore(params) {
|
|
16846
|
-
const { config } = params;
|
|
16854
|
+
const { config, logger } = params;
|
|
16847
16855
|
let totalCount = 0;
|
|
16848
16856
|
const allPaths = [];
|
|
16849
16857
|
let hasDiff = false;
|
|
16850
16858
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16851
16859
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedMcpTargets);
|
|
16852
|
-
warnUnsupportedTargets({
|
|
16860
|
+
warnUnsupportedTargets({
|
|
16861
|
+
config,
|
|
16862
|
+
supportedTargets: supportedMcpTargets,
|
|
16863
|
+
featureName: "mcp",
|
|
16864
|
+
logger
|
|
16865
|
+
});
|
|
16853
16866
|
for (const baseDir of config.getBaseDirs()) {
|
|
16854
16867
|
for (const toolTarget of toolTargets) {
|
|
16855
16868
|
if (!config.getFeatures(toolTarget).includes("mcp")) {
|
|
@@ -16859,7 +16872,8 @@ async function generateMcpCore(params) {
|
|
|
16859
16872
|
baseDir,
|
|
16860
16873
|
toolTarget,
|
|
16861
16874
|
global: config.getGlobal(),
|
|
16862
|
-
dryRun: config.isPreviewMode()
|
|
16875
|
+
dryRun: config.isPreviewMode(),
|
|
16876
|
+
logger
|
|
16863
16877
|
});
|
|
16864
16878
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16865
16879
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16876,7 +16890,7 @@ async function generateMcpCore(params) {
|
|
|
16876
16890
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16877
16891
|
}
|
|
16878
16892
|
async function generateCommandsCore(params) {
|
|
16879
|
-
const { config } = params;
|
|
16893
|
+
const { config, logger } = params;
|
|
16880
16894
|
let totalCount = 0;
|
|
16881
16895
|
const allPaths = [];
|
|
16882
16896
|
let hasDiff = false;
|
|
@@ -16888,7 +16902,8 @@ async function generateCommandsCore(params) {
|
|
|
16888
16902
|
warnUnsupportedTargets({
|
|
16889
16903
|
config,
|
|
16890
16904
|
supportedTargets: supportedCommandsTargets,
|
|
16891
|
-
featureName: "commands"
|
|
16905
|
+
featureName: "commands",
|
|
16906
|
+
logger
|
|
16892
16907
|
});
|
|
16893
16908
|
for (const baseDir of config.getBaseDirs()) {
|
|
16894
16909
|
for (const toolTarget of toolTargets) {
|
|
@@ -16899,7 +16914,8 @@ async function generateCommandsCore(params) {
|
|
|
16899
16914
|
baseDir,
|
|
16900
16915
|
toolTarget,
|
|
16901
16916
|
global: config.getGlobal(),
|
|
16902
|
-
dryRun: config.isPreviewMode()
|
|
16917
|
+
dryRun: config.isPreviewMode(),
|
|
16918
|
+
logger
|
|
16903
16919
|
});
|
|
16904
16920
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16905
16921
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16916,7 +16932,7 @@ async function generateCommandsCore(params) {
|
|
|
16916
16932
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16917
16933
|
}
|
|
16918
16934
|
async function generateSubagentsCore(params) {
|
|
16919
|
-
const { config } = params;
|
|
16935
|
+
const { config, logger } = params;
|
|
16920
16936
|
let totalCount = 0;
|
|
16921
16937
|
const allPaths = [];
|
|
16922
16938
|
let hasDiff = false;
|
|
@@ -16928,7 +16944,8 @@ async function generateSubagentsCore(params) {
|
|
|
16928
16944
|
warnUnsupportedTargets({
|
|
16929
16945
|
config,
|
|
16930
16946
|
supportedTargets: supportedSubagentsTargets,
|
|
16931
|
-
featureName: "subagents"
|
|
16947
|
+
featureName: "subagents",
|
|
16948
|
+
logger
|
|
16932
16949
|
});
|
|
16933
16950
|
for (const baseDir of config.getBaseDirs()) {
|
|
16934
16951
|
for (const toolTarget of toolTargets) {
|
|
@@ -16939,7 +16956,8 @@ async function generateSubagentsCore(params) {
|
|
|
16939
16956
|
baseDir,
|
|
16940
16957
|
toolTarget,
|
|
16941
16958
|
global: config.getGlobal(),
|
|
16942
|
-
dryRun: config.isPreviewMode()
|
|
16959
|
+
dryRun: config.isPreviewMode(),
|
|
16960
|
+
logger
|
|
16943
16961
|
});
|
|
16944
16962
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16945
16963
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16956,7 +16974,7 @@ async function generateSubagentsCore(params) {
|
|
|
16956
16974
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16957
16975
|
}
|
|
16958
16976
|
async function generateSkillsCore(params) {
|
|
16959
|
-
const { config } = params;
|
|
16977
|
+
const { config, logger } = params;
|
|
16960
16978
|
let totalCount = 0;
|
|
16961
16979
|
const allPaths = [];
|
|
16962
16980
|
let hasDiff = false;
|
|
@@ -16969,7 +16987,8 @@ async function generateSkillsCore(params) {
|
|
|
16969
16987
|
warnUnsupportedTargets({
|
|
16970
16988
|
config,
|
|
16971
16989
|
supportedTargets: supportedSkillsTargets,
|
|
16972
|
-
featureName: "skills"
|
|
16990
|
+
featureName: "skills",
|
|
16991
|
+
logger
|
|
16973
16992
|
});
|
|
16974
16993
|
for (const baseDir of config.getBaseDirs()) {
|
|
16975
16994
|
for (const toolTarget of toolTargets) {
|
|
@@ -16980,7 +16999,8 @@ async function generateSkillsCore(params) {
|
|
|
16980
16999
|
baseDir,
|
|
16981
17000
|
toolTarget,
|
|
16982
17001
|
global: config.getGlobal(),
|
|
16983
|
-
dryRun: config.isPreviewMode()
|
|
17002
|
+
dryRun: config.isPreviewMode(),
|
|
17003
|
+
logger
|
|
16984
17004
|
});
|
|
16985
17005
|
const rulesyncDirs = await processor.loadRulesyncDirs();
|
|
16986
17006
|
for (const rulesyncDir of rulesyncDirs) {
|
|
@@ -17002,13 +17022,18 @@ async function generateSkillsCore(params) {
|
|
|
17002
17022
|
return { count: totalCount, paths: allPaths, skills: allSkills, hasDiff };
|
|
17003
17023
|
}
|
|
17004
17024
|
async function generateHooksCore(params) {
|
|
17005
|
-
const { config } = params;
|
|
17025
|
+
const { config, logger } = params;
|
|
17006
17026
|
let totalCount = 0;
|
|
17007
17027
|
const allPaths = [];
|
|
17008
17028
|
let hasDiff = false;
|
|
17009
17029
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
17010
17030
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedHooksTargets);
|
|
17011
|
-
warnUnsupportedTargets({
|
|
17031
|
+
warnUnsupportedTargets({
|
|
17032
|
+
config,
|
|
17033
|
+
supportedTargets: supportedHooksTargets,
|
|
17034
|
+
featureName: "hooks",
|
|
17035
|
+
logger
|
|
17036
|
+
});
|
|
17012
17037
|
for (const baseDir of config.getBaseDirs()) {
|
|
17013
17038
|
for (const toolTarget of toolTargets) {
|
|
17014
17039
|
if (!config.getFeatures(toolTarget).includes("hooks")) {
|
|
@@ -17018,7 +17043,8 @@ async function generateHooksCore(params) {
|
|
|
17018
17043
|
baseDir,
|
|
17019
17044
|
toolTarget,
|
|
17020
17045
|
global: config.getGlobal(),
|
|
17021
|
-
dryRun: config.isPreviewMode()
|
|
17046
|
+
dryRun: config.isPreviewMode(),
|
|
17047
|
+
logger
|
|
17022
17048
|
});
|
|
17023
17049
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
17024
17050
|
let result;
|
|
@@ -17045,14 +17071,14 @@ async function generateHooksCore(params) {
|
|
|
17045
17071
|
|
|
17046
17072
|
// src/lib/import.ts
|
|
17047
17073
|
async function importFromTool(params) {
|
|
17048
|
-
const { config, tool } = params;
|
|
17049
|
-
const rulesCount = await importRulesCore({ config, tool });
|
|
17050
|
-
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
17051
|
-
const mcpCount = await importMcpCore({ config, tool });
|
|
17052
|
-
const commandsCount = await importCommandsCore({ config, tool });
|
|
17053
|
-
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
17054
|
-
const skillsCount = await importSkillsCore({ config, tool });
|
|
17055
|
-
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 });
|
|
17056
17082
|
return {
|
|
17057
17083
|
rulesCount,
|
|
17058
17084
|
ignoreCount,
|
|
@@ -17064,7 +17090,7 @@ async function importFromTool(params) {
|
|
|
17064
17090
|
};
|
|
17065
17091
|
}
|
|
17066
17092
|
async function importRulesCore(params) {
|
|
17067
|
-
const { config, tool } = params;
|
|
17093
|
+
const { config, tool, logger } = params;
|
|
17068
17094
|
if (!config.getFeatures(tool).includes("rules")) {
|
|
17069
17095
|
return 0;
|
|
17070
17096
|
}
|
|
@@ -17076,7 +17102,8 @@ async function importRulesCore(params) {
|
|
|
17076
17102
|
const rulesProcessor = new RulesProcessor({
|
|
17077
17103
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17078
17104
|
toolTarget: tool,
|
|
17079
|
-
global
|
|
17105
|
+
global,
|
|
17106
|
+
logger
|
|
17080
17107
|
});
|
|
17081
17108
|
const toolFiles = await rulesProcessor.loadToolFiles();
|
|
17082
17109
|
if (toolFiles.length === 0) {
|
|
@@ -17091,7 +17118,7 @@ async function importRulesCore(params) {
|
|
|
17091
17118
|
return writtenCount;
|
|
17092
17119
|
}
|
|
17093
17120
|
async function importIgnoreCore(params) {
|
|
17094
|
-
const { config, tool } = params;
|
|
17121
|
+
const { config, tool, logger } = params;
|
|
17095
17122
|
if (!config.getFeatures(tool).includes("ignore")) {
|
|
17096
17123
|
return 0;
|
|
17097
17124
|
}
|
|
@@ -17104,7 +17131,8 @@ async function importIgnoreCore(params) {
|
|
|
17104
17131
|
}
|
|
17105
17132
|
const ignoreProcessor = new IgnoreProcessor({
|
|
17106
17133
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17107
|
-
toolTarget: tool
|
|
17134
|
+
toolTarget: tool,
|
|
17135
|
+
logger
|
|
17108
17136
|
});
|
|
17109
17137
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
17110
17138
|
if (toolFiles.length === 0) {
|
|
@@ -17122,7 +17150,7 @@ async function importIgnoreCore(params) {
|
|
|
17122
17150
|
return writtenCount;
|
|
17123
17151
|
}
|
|
17124
17152
|
async function importMcpCore(params) {
|
|
17125
|
-
const { config, tool } = params;
|
|
17153
|
+
const { config, tool, logger } = params;
|
|
17126
17154
|
if (!config.getFeatures(tool).includes("mcp")) {
|
|
17127
17155
|
return 0;
|
|
17128
17156
|
}
|
|
@@ -17134,7 +17162,8 @@ async function importMcpCore(params) {
|
|
|
17134
17162
|
const mcpProcessor = new McpProcessor({
|
|
17135
17163
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17136
17164
|
toolTarget: tool,
|
|
17137
|
-
global
|
|
17165
|
+
global,
|
|
17166
|
+
logger
|
|
17138
17167
|
});
|
|
17139
17168
|
const toolFiles = await mcpProcessor.loadToolFiles();
|
|
17140
17169
|
if (toolFiles.length === 0) {
|
|
@@ -17149,7 +17178,7 @@ async function importMcpCore(params) {
|
|
|
17149
17178
|
return writtenCount;
|
|
17150
17179
|
}
|
|
17151
17180
|
async function importCommandsCore(params) {
|
|
17152
|
-
const { config, tool } = params;
|
|
17181
|
+
const { config, tool, logger } = params;
|
|
17153
17182
|
if (!config.getFeatures(tool).includes("commands")) {
|
|
17154
17183
|
return 0;
|
|
17155
17184
|
}
|
|
@@ -17161,7 +17190,8 @@ async function importCommandsCore(params) {
|
|
|
17161
17190
|
const commandsProcessor = new CommandsProcessor({
|
|
17162
17191
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17163
17192
|
toolTarget: tool,
|
|
17164
|
-
global
|
|
17193
|
+
global,
|
|
17194
|
+
logger
|
|
17165
17195
|
});
|
|
17166
17196
|
const toolFiles = await commandsProcessor.loadToolFiles();
|
|
17167
17197
|
if (toolFiles.length === 0) {
|
|
@@ -17176,7 +17206,7 @@ async function importCommandsCore(params) {
|
|
|
17176
17206
|
return writtenCount;
|
|
17177
17207
|
}
|
|
17178
17208
|
async function importSubagentsCore(params) {
|
|
17179
|
-
const { config, tool } = params;
|
|
17209
|
+
const { config, tool, logger } = params;
|
|
17180
17210
|
if (!config.getFeatures(tool).includes("subagents")) {
|
|
17181
17211
|
return 0;
|
|
17182
17212
|
}
|
|
@@ -17188,7 +17218,8 @@ async function importSubagentsCore(params) {
|
|
|
17188
17218
|
const subagentsProcessor = new SubagentsProcessor({
|
|
17189
17219
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17190
17220
|
toolTarget: tool,
|
|
17191
|
-
global: config.getGlobal()
|
|
17221
|
+
global: config.getGlobal(),
|
|
17222
|
+
logger
|
|
17192
17223
|
});
|
|
17193
17224
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
17194
17225
|
if (toolFiles.length === 0) {
|
|
@@ -17203,7 +17234,7 @@ async function importSubagentsCore(params) {
|
|
|
17203
17234
|
return writtenCount;
|
|
17204
17235
|
}
|
|
17205
17236
|
async function importSkillsCore(params) {
|
|
17206
|
-
const { config, tool } = params;
|
|
17237
|
+
const { config, tool, logger } = params;
|
|
17207
17238
|
if (!config.getFeatures(tool).includes("skills")) {
|
|
17208
17239
|
return 0;
|
|
17209
17240
|
}
|
|
@@ -17215,7 +17246,8 @@ async function importSkillsCore(params) {
|
|
|
17215
17246
|
const skillsProcessor = new SkillsProcessor({
|
|
17216
17247
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17217
17248
|
toolTarget: tool,
|
|
17218
|
-
global
|
|
17249
|
+
global,
|
|
17250
|
+
logger
|
|
17219
17251
|
});
|
|
17220
17252
|
const toolDirs = await skillsProcessor.loadToolDirs();
|
|
17221
17253
|
if (toolDirs.length === 0) {
|
|
@@ -17230,7 +17262,7 @@ async function importSkillsCore(params) {
|
|
|
17230
17262
|
return writtenCount;
|
|
17231
17263
|
}
|
|
17232
17264
|
async function importHooksCore(params) {
|
|
17233
|
-
const { config, tool } = params;
|
|
17265
|
+
const { config, tool, logger } = params;
|
|
17234
17266
|
if (!config.getFeatures(tool).includes("hooks")) {
|
|
17235
17267
|
return 0;
|
|
17236
17268
|
}
|
|
@@ -17247,7 +17279,8 @@ async function importHooksCore(params) {
|
|
|
17247
17279
|
const hooksProcessor = new HooksProcessor({
|
|
17248
17280
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17249
17281
|
toolTarget: tool,
|
|
17250
|
-
global
|
|
17282
|
+
global,
|
|
17283
|
+
logger
|
|
17251
17284
|
});
|
|
17252
17285
|
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
17253
17286
|
if (toolFiles.length === 0) {
|
|
@@ -17262,10 +17295,76 @@ async function importHooksCore(params) {
|
|
|
17262
17295
|
return writtenCount;
|
|
17263
17296
|
}
|
|
17264
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
|
+
|
|
17265
17364
|
// src/index.ts
|
|
17266
17365
|
async function generate2(options = {}) {
|
|
17267
17366
|
const { silent = true, verbose = false, ...rest } = options;
|
|
17268
|
-
logger
|
|
17367
|
+
const logger = new ConsoleLogger({ verbose, silent });
|
|
17269
17368
|
const config = await ConfigResolver.resolve({
|
|
17270
17369
|
...rest,
|
|
17271
17370
|
verbose,
|
|
@@ -17276,18 +17375,18 @@ async function generate2(options = {}) {
|
|
|
17276
17375
|
throw new Error(".rulesync directory not found. Run 'rulesync init' first.");
|
|
17277
17376
|
}
|
|
17278
17377
|
}
|
|
17279
|
-
return generate({ config });
|
|
17378
|
+
return generate({ config, logger });
|
|
17280
17379
|
}
|
|
17281
17380
|
async function importFromTool2(options) {
|
|
17282
17381
|
const { target, silent = true, verbose = false, ...rest } = options;
|
|
17283
|
-
logger
|
|
17382
|
+
const logger = new ConsoleLogger({ verbose, silent });
|
|
17284
17383
|
const config = await ConfigResolver.resolve({
|
|
17285
17384
|
...rest,
|
|
17286
17385
|
targets: [target],
|
|
17287
17386
|
verbose,
|
|
17288
17387
|
silent
|
|
17289
17388
|
});
|
|
17290
|
-
return importFromTool({ config, tool: target });
|
|
17389
|
+
return importFromTool({ config, tool: target, logger });
|
|
17291
17390
|
}
|
|
17292
17391
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17293
17392
|
0 && (module.exports = {
|