rulesync 7.20.0 → 7.22.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 +3 -2
- package/dist/{chunk-5OPNV62F.js → chunk-4WYBBN4I.js} +901 -666
- package/dist/cli/index.cjs +1393 -1077
- package/dist/cli/index.js +333 -254
- package/dist/index.cjs +776 -550
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +7 -7
- package/package.json +21 -17
package/dist/index.cjs
CHANGED
|
@@ -51,6 +51,10 @@ var RULESYNC_COMMANDS_RELATIVE_DIR_PATH = (0, import_node_path.join)(RULESYNC_RE
|
|
|
51
51
|
var RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, "subagents");
|
|
52
52
|
var RULESYNC_MCP_RELATIVE_FILE_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, "mcp.json");
|
|
53
53
|
var RULESYNC_HOOKS_RELATIVE_FILE_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, "hooks.json");
|
|
54
|
+
var RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH = (0, import_node_path.join)(
|
|
55
|
+
RULESYNC_RELATIVE_DIR_PATH,
|
|
56
|
+
"permissions.json"
|
|
57
|
+
);
|
|
54
58
|
var RULESYNC_AIIGNORE_FILE_NAME = ".aiignore";
|
|
55
59
|
var RULESYNC_AIIGNORE_RELATIVE_FILE_PATH = (0, import_node_path.join)(RULESYNC_RELATIVE_DIR_PATH, ".aiignore");
|
|
56
60
|
var RULESYNC_IGNORE_RELATIVE_FILE_PATH = ".rulesyncignore";
|
|
@@ -64,6 +68,13 @@ var RULESYNC_MCP_FILE_NAME = "mcp.json";
|
|
|
64
68
|
var RULESYNC_MCP_SCHEMA_URL = "https://github.com/dyoshikawa/rulesync/releases/latest/download/mcp-schema.json";
|
|
65
69
|
var MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
66
70
|
|
|
71
|
+
// src/utils/file.ts
|
|
72
|
+
var import_promises = require("fs/promises");
|
|
73
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
74
|
+
var import_node_path2 = require("path");
|
|
75
|
+
var import_es_toolkit = require("es-toolkit");
|
|
76
|
+
var import_globby = require("globby");
|
|
77
|
+
|
|
67
78
|
// src/utils/error.ts
|
|
68
79
|
var import_zod = require("zod");
|
|
69
80
|
function isZodErrorLike(error) {
|
|
@@ -81,79 +92,11 @@ function formatError(error) {
|
|
|
81
92
|
return String(error);
|
|
82
93
|
}
|
|
83
94
|
|
|
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
95
|
// src/utils/vitest.ts
|
|
92
96
|
function isEnvTest() {
|
|
93
97
|
return process.env.NODE_ENV === "test";
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
// src/utils/logger.ts
|
|
97
|
-
var BaseLogger = class {
|
|
98
|
-
_verbose = false;
|
|
99
|
-
_silent = false;
|
|
100
|
-
get verbose() {
|
|
101
|
-
return this._verbose;
|
|
102
|
-
}
|
|
103
|
-
get silent() {
|
|
104
|
-
return this._silent;
|
|
105
|
-
}
|
|
106
|
-
configure({ verbose, silent }) {
|
|
107
|
-
if (verbose && silent) {
|
|
108
|
-
this._silent = false;
|
|
109
|
-
if (!isEnvTest()) {
|
|
110
|
-
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
this._silent = silent;
|
|
114
|
-
this._verbose = verbose && !silent;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
var ConsoleLogger = class extends BaseLogger {
|
|
118
|
-
isSuppressed() {
|
|
119
|
-
return isEnvTest() || this._silent;
|
|
120
|
-
}
|
|
121
|
-
get jsonMode() {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
captureData(_key, _value) {
|
|
125
|
-
}
|
|
126
|
-
getJsonData() {
|
|
127
|
-
return {};
|
|
128
|
-
}
|
|
129
|
-
outputJson(_success, _error) {
|
|
130
|
-
}
|
|
131
|
-
info(message, ...args) {
|
|
132
|
-
if (this.isSuppressed()) return;
|
|
133
|
-
console.log(message, ...args);
|
|
134
|
-
}
|
|
135
|
-
success(message, ...args) {
|
|
136
|
-
if (this.isSuppressed()) return;
|
|
137
|
-
console.log(message, ...args);
|
|
138
|
-
}
|
|
139
|
-
warn(message, ...args) {
|
|
140
|
-
if (this.isSuppressed()) return;
|
|
141
|
-
console.warn(message, ...args);
|
|
142
|
-
}
|
|
143
|
-
error(message, _code, ...args) {
|
|
144
|
-
if (isEnvTest()) return;
|
|
145
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
146
|
-
console.error(errorMessage, ...args);
|
|
147
|
-
}
|
|
148
|
-
debug(message, ...args) {
|
|
149
|
-
if (this.isSuppressed()) return;
|
|
150
|
-
if (this._verbose) {
|
|
151
|
-
console.log(message, ...args);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
var logger = new ConsoleLogger();
|
|
156
|
-
|
|
157
100
|
// src/utils/file.ts
|
|
158
101
|
async function ensureDir(dirPath) {
|
|
159
102
|
try {
|
|
@@ -199,7 +142,6 @@ async function directoryExists(dirPath) {
|
|
|
199
142
|
}
|
|
200
143
|
}
|
|
201
144
|
async function readFileContent(filepath) {
|
|
202
|
-
logger.debug(`Reading file: ${filepath}`);
|
|
203
145
|
return (0, import_promises.readFile)(filepath, "utf-8");
|
|
204
146
|
}
|
|
205
147
|
async function readFileContentOrNull(filepath) {
|
|
@@ -209,7 +151,6 @@ async function readFileContentOrNull(filepath) {
|
|
|
209
151
|
return null;
|
|
210
152
|
}
|
|
211
153
|
async function readFileBuffer(filepath) {
|
|
212
|
-
logger.debug(`Reading file buffer: ${filepath}`);
|
|
213
154
|
return (0, import_promises.readFile)(filepath);
|
|
214
155
|
}
|
|
215
156
|
function addTrailingNewline(content) {
|
|
@@ -219,7 +160,6 @@ function addTrailingNewline(content) {
|
|
|
219
160
|
return content.trimEnd() + "\n";
|
|
220
161
|
}
|
|
221
162
|
async function writeFileContent(filepath, content) {
|
|
222
|
-
logger.debug(`Writing file: ${filepath}`);
|
|
223
163
|
await ensureDir((0, import_node_path2.dirname)(filepath));
|
|
224
164
|
await (0, import_promises.writeFile)(filepath, content, "utf-8");
|
|
225
165
|
}
|
|
@@ -252,25 +192,21 @@ async function findFilesByGlobs(globs, options = {}) {
|
|
|
252
192
|
async function removeDirectory(dirPath) {
|
|
253
193
|
const dangerousPaths = [".", "/", "~", "src", "node_modules"];
|
|
254
194
|
if (dangerousPaths.includes(dirPath) || dirPath === "") {
|
|
255
|
-
logger.warn(`Skipping deletion of dangerous path: ${dirPath}`);
|
|
256
195
|
return;
|
|
257
196
|
}
|
|
258
197
|
try {
|
|
259
198
|
if (await fileExists(dirPath)) {
|
|
260
199
|
await (0, import_promises.rm)(dirPath, { recursive: true, force: true });
|
|
261
200
|
}
|
|
262
|
-
} catch
|
|
263
|
-
logger.warn(`Failed to remove directory ${dirPath}:`, error);
|
|
201
|
+
} catch {
|
|
264
202
|
}
|
|
265
203
|
}
|
|
266
204
|
async function removeFile(filepath) {
|
|
267
|
-
logger.debug(`Removing file: ${filepath}`);
|
|
268
205
|
try {
|
|
269
206
|
if (await fileExists(filepath)) {
|
|
270
207
|
await (0, import_promises.rm)(filepath);
|
|
271
208
|
}
|
|
272
|
-
} catch
|
|
273
|
-
logger.warn(`Failed to remove file ${filepath}:`, error);
|
|
209
|
+
} catch {
|
|
274
210
|
}
|
|
275
211
|
}
|
|
276
212
|
function getHomeDirectory() {
|
|
@@ -312,7 +248,8 @@ var ALL_FEATURES = [
|
|
|
312
248
|
"subagents",
|
|
313
249
|
"commands",
|
|
314
250
|
"skills",
|
|
315
|
-
"hooks"
|
|
251
|
+
"hooks",
|
|
252
|
+
"permissions"
|
|
316
253
|
];
|
|
317
254
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
318
255
|
var FeatureSchema = import_mini.z.enum(ALL_FEATURES);
|
|
@@ -335,6 +272,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
335
272
|
"cline",
|
|
336
273
|
"codexcli",
|
|
337
274
|
"copilot",
|
|
275
|
+
"copilotcli",
|
|
338
276
|
"cursor",
|
|
339
277
|
"factorydroid",
|
|
340
278
|
"geminicli",
|
|
@@ -585,16 +523,11 @@ var loadConfigFromFile = async (filePath) => {
|
|
|
585
523
|
if (!await fileExists(filePath)) {
|
|
586
524
|
return {};
|
|
587
525
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
return configParams;
|
|
594
|
-
} catch (error) {
|
|
595
|
-
logger.error(`Failed to load config file "${filePath}": ${formatError(error)}`);
|
|
596
|
-
throw error;
|
|
597
|
-
}
|
|
526
|
+
const fileContent = await readFileContent(filePath);
|
|
527
|
+
const jsonData = (0, import_jsonc_parser.parse)(fileContent);
|
|
528
|
+
const parsed = ConfigFileSchema.parse(jsonData);
|
|
529
|
+
const { $schema: _schema, ...configParams } = parsed;
|
|
530
|
+
return configParams;
|
|
598
531
|
};
|
|
599
532
|
var mergeConfigs = (baseConfig, localConfig) => {
|
|
600
533
|
return {
|
|
@@ -675,7 +608,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
675
608
|
}
|
|
676
609
|
|
|
677
610
|
// src/lib/generate.ts
|
|
678
|
-
var
|
|
611
|
+
var import_node_path120 = require("path");
|
|
679
612
|
var import_es_toolkit4 = require("es-toolkit");
|
|
680
613
|
|
|
681
614
|
// src/features/commands/commands-processor.ts
|
|
@@ -686,9 +619,15 @@ var import_mini14 = require("zod/mini");
|
|
|
686
619
|
var FeatureProcessor = class {
|
|
687
620
|
baseDir;
|
|
688
621
|
dryRun;
|
|
689
|
-
|
|
622
|
+
logger;
|
|
623
|
+
constructor({
|
|
624
|
+
baseDir = process.cwd(),
|
|
625
|
+
dryRun = false,
|
|
626
|
+
logger
|
|
627
|
+
}) {
|
|
690
628
|
this.baseDir = baseDir;
|
|
691
629
|
this.dryRun = dryRun;
|
|
630
|
+
this.logger = logger;
|
|
692
631
|
}
|
|
693
632
|
/**
|
|
694
633
|
* Return tool targets that this feature supports.
|
|
@@ -711,7 +650,7 @@ var FeatureProcessor = class {
|
|
|
711
650
|
continue;
|
|
712
651
|
}
|
|
713
652
|
if (this.dryRun) {
|
|
714
|
-
logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
653
|
+
this.logger.info(`[DRY RUN] Would write: ${filePath}`);
|
|
715
654
|
} else {
|
|
716
655
|
await writeFileContent(filePath, contentWithNewline);
|
|
717
656
|
}
|
|
@@ -735,7 +674,7 @@ var FeatureProcessor = class {
|
|
|
735
674
|
for (const aiFile of orphanFiles) {
|
|
736
675
|
const filePath = aiFile.getFilePath();
|
|
737
676
|
if (this.dryRun) {
|
|
738
|
-
logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
677
|
+
this.logger.info(`[DRY RUN] Would delete: ${filePath}`);
|
|
739
678
|
} else {
|
|
740
679
|
await removeFile(filePath);
|
|
741
680
|
}
|
|
@@ -2991,7 +2930,7 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2991
2930
|
meta: {
|
|
2992
2931
|
extension: "md",
|
|
2993
2932
|
supportsProject: true,
|
|
2994
|
-
supportsGlobal:
|
|
2933
|
+
supportsGlobal: false,
|
|
2995
2934
|
isSimulated: true,
|
|
2996
2935
|
supportsSubdirectory: false
|
|
2997
2936
|
}
|
|
@@ -3107,9 +3046,10 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3107
3046
|
toolTarget,
|
|
3108
3047
|
global = false,
|
|
3109
3048
|
getFactory = defaultGetFactory,
|
|
3110
|
-
dryRun = false
|
|
3049
|
+
dryRun = false,
|
|
3050
|
+
logger
|
|
3111
3051
|
}) {
|
|
3112
|
-
super({ baseDir, dryRun });
|
|
3052
|
+
super({ baseDir, dryRun, logger });
|
|
3113
3053
|
const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
3114
3054
|
if (!result.success) {
|
|
3115
3055
|
throw new Error(
|
|
@@ -3136,7 +3076,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3136
3076
|
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
3137
3077
|
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
3138
3078
|
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
3139
|
-
logger.warn(
|
|
3079
|
+
this.logger.warn(
|
|
3140
3080
|
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}". Only the last processed command will be used.`
|
|
3141
3081
|
);
|
|
3142
3082
|
} else if (!firstOrigin) {
|
|
@@ -3182,7 +3122,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3182
3122
|
(path3) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path3) })
|
|
3183
3123
|
)
|
|
3184
3124
|
);
|
|
3185
|
-
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3125
|
+
this.logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
3186
3126
|
return rulesyncCommands;
|
|
3187
3127
|
}
|
|
3188
3128
|
/**
|
|
@@ -3206,7 +3146,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3206
3146
|
global: this.global
|
|
3207
3147
|
})
|
|
3208
3148
|
).filter((cmd) => cmd.isDeletable());
|
|
3209
|
-
logger.debug(
|
|
3149
|
+
this.logger.debug(
|
|
3150
|
+
`Successfully loaded ${toolCommands2.length} ${paths.relativeDirPath} commands`
|
|
3151
|
+
);
|
|
3210
3152
|
return toolCommands2;
|
|
3211
3153
|
}
|
|
3212
3154
|
const toolCommands = await Promise.all(
|
|
@@ -3218,7 +3160,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
3218
3160
|
})
|
|
3219
3161
|
)
|
|
3220
3162
|
);
|
|
3221
|
-
logger.debug(
|
|
3163
|
+
this.logger.debug(
|
|
3164
|
+
`Successfully loaded ${toolCommands.length} ${paths.relativeDirPath} commands`
|
|
3165
|
+
);
|
|
3222
3166
|
return toolCommands;
|
|
3223
3167
|
}
|
|
3224
3168
|
/**
|
|
@@ -3487,7 +3431,8 @@ function isToolMatcherEntry(x) {
|
|
|
3487
3431
|
function canonicalToToolHooks({
|
|
3488
3432
|
config,
|
|
3489
3433
|
toolOverrideHooks,
|
|
3490
|
-
converterConfig
|
|
3434
|
+
converterConfig,
|
|
3435
|
+
logger
|
|
3491
3436
|
}) {
|
|
3492
3437
|
const supported = new Set(converterConfig.supportedEvents);
|
|
3493
3438
|
const sharedHooks = {};
|
|
@@ -3514,7 +3459,7 @@ function canonicalToToolHooks({
|
|
|
3514
3459
|
const isNoMatcherEvent = converterConfig.noMatcherEvents?.has(eventName) ?? false;
|
|
3515
3460
|
for (const [matcherKey, defs] of byMatcher) {
|
|
3516
3461
|
if (isNoMatcherEvent && matcherKey) {
|
|
3517
|
-
logger
|
|
3462
|
+
logger?.warn(
|
|
3518
3463
|
`matcher "${matcherKey}" on "${eventName}" hook will be ignored \u2014 this event does not support matchers`
|
|
3519
3464
|
);
|
|
3520
3465
|
}
|
|
@@ -3711,7 +3656,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3711
3656
|
baseDir = process.cwd(),
|
|
3712
3657
|
rulesyncHooks,
|
|
3713
3658
|
validate = true,
|
|
3714
|
-
global = false
|
|
3659
|
+
global = false,
|
|
3660
|
+
logger
|
|
3715
3661
|
}) {
|
|
3716
3662
|
const paths = _ClaudecodeHooks.getSettablePaths({ global });
|
|
3717
3663
|
const filePath = (0, import_node_path24.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -3732,7 +3678,8 @@ var ClaudecodeHooks = class _ClaudecodeHooks extends ToolHooks {
|
|
|
3732
3678
|
const claudeHooks = canonicalToToolHooks({
|
|
3733
3679
|
config,
|
|
3734
3680
|
toolOverrideHooks: config.claudecode?.hooks,
|
|
3735
|
-
converterConfig: CLAUDE_CONVERTER_CONFIG
|
|
3681
|
+
converterConfig: CLAUDE_CONVERTER_CONFIG,
|
|
3682
|
+
logger
|
|
3736
3683
|
});
|
|
3737
3684
|
const merged = { ...settings, hooks: claudeHooks };
|
|
3738
3685
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -3832,14 +3779,14 @@ function canonicalToCopilotHooks(config) {
|
|
|
3832
3779
|
}
|
|
3833
3780
|
return copilot;
|
|
3834
3781
|
}
|
|
3835
|
-
function resolveImportCommand(entry) {
|
|
3782
|
+
function resolveImportCommand(entry, logger) {
|
|
3836
3783
|
const hasBash = typeof entry.bash === "string";
|
|
3837
3784
|
const hasPowershell = typeof entry.powershell === "string";
|
|
3838
3785
|
if (hasBash && hasPowershell) {
|
|
3839
3786
|
const isWindows = process.platform === "win32";
|
|
3840
3787
|
const chosen = isWindows ? "powershell" : "bash";
|
|
3841
3788
|
const ignored = isWindows ? "bash" : "powershell";
|
|
3842
|
-
logger
|
|
3789
|
+
logger?.warn(
|
|
3843
3790
|
`Copilot hook has both bash and powershell commands; using ${chosen} and ignoring ${ignored} on this platform.`
|
|
3844
3791
|
);
|
|
3845
3792
|
return isWindows ? entry.powershell : entry.bash;
|
|
@@ -3850,7 +3797,7 @@ function resolveImportCommand(entry) {
|
|
|
3850
3797
|
}
|
|
3851
3798
|
return void 0;
|
|
3852
3799
|
}
|
|
3853
|
-
function copilotHooksToCanonical(copilotHooks) {
|
|
3800
|
+
function copilotHooksToCanonical(copilotHooks, logger) {
|
|
3854
3801
|
if (copilotHooks === null || copilotHooks === void 0 || typeof copilotHooks !== "object") {
|
|
3855
3802
|
return {};
|
|
3856
3803
|
}
|
|
@@ -3863,7 +3810,7 @@ function copilotHooksToCanonical(copilotHooks) {
|
|
|
3863
3810
|
const parseResult = CopilotHookEntrySchema.safeParse(rawEntry);
|
|
3864
3811
|
if (!parseResult.success) continue;
|
|
3865
3812
|
const entry = parseResult.data;
|
|
3866
|
-
const command = resolveImportCommand(entry);
|
|
3813
|
+
const command = resolveImportCommand(entry, logger);
|
|
3867
3814
|
const timeout = entry.timeoutSec;
|
|
3868
3815
|
defs.push({
|
|
3869
3816
|
type: "command",
|
|
@@ -3923,7 +3870,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3923
3870
|
validate
|
|
3924
3871
|
});
|
|
3925
3872
|
}
|
|
3926
|
-
toRulesyncHooks() {
|
|
3873
|
+
toRulesyncHooks(options) {
|
|
3927
3874
|
let parsed;
|
|
3928
3875
|
try {
|
|
3929
3876
|
parsed = JSON.parse(this.getFileContent());
|
|
@@ -3935,7 +3882,7 @@ var CopilotHooks = class _CopilotHooks extends ToolHooks {
|
|
|
3935
3882
|
}
|
|
3936
3883
|
);
|
|
3937
3884
|
}
|
|
3938
|
-
const hooks = copilotHooksToCanonical(parsed.hooks);
|
|
3885
|
+
const hooks = copilotHooksToCanonical(parsed.hooks, options?.logger);
|
|
3939
3886
|
return this.toRulesyncHooksDefault({
|
|
3940
3887
|
fileContent: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
3941
3888
|
});
|
|
@@ -4107,7 +4054,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4107
4054
|
baseDir = process.cwd(),
|
|
4108
4055
|
rulesyncHooks,
|
|
4109
4056
|
validate = true,
|
|
4110
|
-
global = false
|
|
4057
|
+
global = false,
|
|
4058
|
+
logger
|
|
4111
4059
|
}) {
|
|
4112
4060
|
const paths = _FactorydroidHooks.getSettablePaths({ global });
|
|
4113
4061
|
const filePath = (0, import_node_path27.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
@@ -4128,7 +4076,8 @@ var FactorydroidHooks = class _FactorydroidHooks extends ToolHooks {
|
|
|
4128
4076
|
const factorydroidHooks = canonicalToToolHooks({
|
|
4129
4077
|
config,
|
|
4130
4078
|
toolOverrideHooks: config.factorydroid?.hooks,
|
|
4131
|
-
converterConfig: FACTORYDROID_CONVERTER_CONFIG
|
|
4079
|
+
converterConfig: FACTORYDROID_CONVERTER_CONFIG,
|
|
4080
|
+
logger
|
|
4132
4081
|
});
|
|
4133
4082
|
const merged = { ...settings, hooks: factorydroidHooks };
|
|
4134
4083
|
const fileContent = JSON.stringify(merged, null, 2);
|
|
@@ -4627,9 +4576,10 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4627
4576
|
baseDir = process.cwd(),
|
|
4628
4577
|
toolTarget,
|
|
4629
4578
|
global = false,
|
|
4630
|
-
dryRun = false
|
|
4579
|
+
dryRun = false,
|
|
4580
|
+
logger
|
|
4631
4581
|
}) {
|
|
4632
|
-
super({ baseDir, dryRun });
|
|
4582
|
+
super({ baseDir, dryRun, logger });
|
|
4633
4583
|
const result = HooksProcessorToolTargetSchema.safeParse(toolTarget);
|
|
4634
4584
|
if (!result.success) {
|
|
4635
4585
|
throw new Error(
|
|
@@ -4648,7 +4598,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4648
4598
|
})
|
|
4649
4599
|
];
|
|
4650
4600
|
} catch (error) {
|
|
4651
|
-
logger.error(
|
|
4601
|
+
this.logger.error(
|
|
4652
4602
|
`Failed to load Rulesync hooks file (${RULESYNC_HOOKS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
4653
4603
|
);
|
|
4654
4604
|
return [];
|
|
@@ -4667,7 +4617,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4667
4617
|
global: this.global
|
|
4668
4618
|
});
|
|
4669
4619
|
const list = toolHooks2.isDeletable?.() !== false ? [toolHooks2] : [];
|
|
4670
|
-
logger.debug(
|
|
4620
|
+
this.logger.debug(
|
|
4671
4621
|
`Successfully loaded ${list.length} ${this.toolTarget} hooks files for deletion`
|
|
4672
4622
|
);
|
|
4673
4623
|
return list;
|
|
@@ -4677,14 +4627,14 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4677
4627
|
validate: true,
|
|
4678
4628
|
global: this.global
|
|
4679
4629
|
});
|
|
4680
|
-
logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4630
|
+
this.logger.debug(`Successfully loaded 1 ${this.toolTarget} hooks file`);
|
|
4681
4631
|
return [toolHooks];
|
|
4682
4632
|
} catch (error) {
|
|
4683
4633
|
const msg = `Failed to load hooks files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
4684
4634
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
4685
|
-
logger.debug(msg);
|
|
4635
|
+
this.logger.debug(msg);
|
|
4686
4636
|
} else {
|
|
4687
|
-
logger.error(msg);
|
|
4637
|
+
this.logger.error(msg);
|
|
4688
4638
|
}
|
|
4689
4639
|
return [];
|
|
4690
4640
|
}
|
|
@@ -4705,7 +4655,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4705
4655
|
const configEventNames = new Set(Object.keys(effectiveHooks));
|
|
4706
4656
|
const skipped = [...configEventNames].filter((e) => !supportedEvents.has(e));
|
|
4707
4657
|
if (skipped.length > 0) {
|
|
4708
|
-
logger.warn(
|
|
4658
|
+
this.logger.warn(
|
|
4709
4659
|
`Skipped hook event(s) for ${this.toolTarget} (not supported): ${skipped.join(", ")}`
|
|
4710
4660
|
);
|
|
4711
4661
|
}
|
|
@@ -4724,7 +4674,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4724
4674
|
}
|
|
4725
4675
|
}
|
|
4726
4676
|
for (const [hookType, events] of unsupportedTypeToEvents) {
|
|
4727
|
-
logger.warn(
|
|
4677
|
+
this.logger.warn(
|
|
4728
4678
|
`Skipped ${hookType}-type hook(s) for ${this.toolTarget} (not supported): ${Array.from(events).join(", ")}`
|
|
4729
4679
|
);
|
|
4730
4680
|
}
|
|
@@ -4739,7 +4689,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
4739
4689
|
}
|
|
4740
4690
|
}
|
|
4741
4691
|
if (eventsWithMatcher.size > 0) {
|
|
4742
|
-
logger.warn(
|
|
4692
|
+
this.logger.warn(
|
|
4743
4693
|
`Skipped matcher hook(s) for ${this.toolTarget} (not supported): ${Array.from(eventsWithMatcher).join(", ")}`
|
|
4744
4694
|
);
|
|
4745
4695
|
}
|
|
@@ -5801,9 +5751,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5801
5751
|
baseDir = process.cwd(),
|
|
5802
5752
|
toolTarget,
|
|
5803
5753
|
getFactory = defaultGetFactory2,
|
|
5804
|
-
dryRun = false
|
|
5754
|
+
dryRun = false,
|
|
5755
|
+
logger
|
|
5805
5756
|
}) {
|
|
5806
|
-
super({ baseDir, dryRun });
|
|
5757
|
+
super({ baseDir, dryRun, logger });
|
|
5807
5758
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
5808
5759
|
if (!result.success) {
|
|
5809
5760
|
throw new Error(
|
|
@@ -5825,7 +5776,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5825
5776
|
try {
|
|
5826
5777
|
return [await RulesyncIgnore.fromFile()];
|
|
5827
5778
|
} catch (error) {
|
|
5828
|
-
logger.error(
|
|
5779
|
+
this.logger.error(
|
|
5829
5780
|
`Failed to load rulesync ignore file (${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
5830
5781
|
);
|
|
5831
5782
|
return [];
|
|
@@ -5855,9 +5806,9 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
5855
5806
|
} catch (error) {
|
|
5856
5807
|
const errorMessage = `Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`;
|
|
5857
5808
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
5858
|
-
logger.debug(errorMessage);
|
|
5809
|
+
this.logger.debug(errorMessage);
|
|
5859
5810
|
} else {
|
|
5860
|
-
logger.error(errorMessage);
|
|
5811
|
+
this.logger.error(errorMessage);
|
|
5861
5812
|
}
|
|
5862
5813
|
return [];
|
|
5863
5814
|
}
|
|
@@ -5987,7 +5938,10 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
5987
5938
|
}
|
|
5988
5939
|
return { success: true, error: null };
|
|
5989
5940
|
}
|
|
5990
|
-
static async fromFile({
|
|
5941
|
+
static async fromFile({
|
|
5942
|
+
validate = true,
|
|
5943
|
+
logger
|
|
5944
|
+
}) {
|
|
5991
5945
|
const baseDir = process.cwd();
|
|
5992
5946
|
const paths = this.getSettablePaths();
|
|
5993
5947
|
const recommendedPath = (0, import_node_path44.join)(
|
|
@@ -6007,7 +5961,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
6007
5961
|
});
|
|
6008
5962
|
}
|
|
6009
5963
|
if (await fileExists(legacyPath)) {
|
|
6010
|
-
logger
|
|
5964
|
+
logger?.warn(
|
|
6011
5965
|
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
6012
5966
|
);
|
|
6013
5967
|
const fileContent2 = await readFileContent(legacyPath);
|
|
@@ -6509,8 +6463,145 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
6509
6463
|
}
|
|
6510
6464
|
};
|
|
6511
6465
|
|
|
6512
|
-
// src/features/mcp/
|
|
6466
|
+
// src/features/mcp/copilotcli-mcp.ts
|
|
6513
6467
|
var import_node_path49 = require("path");
|
|
6468
|
+
function addTypeField(mcpServers) {
|
|
6469
|
+
const result = {};
|
|
6470
|
+
for (const [name, server] of Object.entries(mcpServers)) {
|
|
6471
|
+
const parsed = McpServerSchema.parse(server);
|
|
6472
|
+
if (!parsed.command) {
|
|
6473
|
+
throw new Error(
|
|
6474
|
+
`MCP server "${name}" is missing a command. GitHub Copilot CLI stdio servers require a non-empty command.`
|
|
6475
|
+
);
|
|
6476
|
+
}
|
|
6477
|
+
let command;
|
|
6478
|
+
let args;
|
|
6479
|
+
if (typeof parsed.command === "string") {
|
|
6480
|
+
command = parsed.command;
|
|
6481
|
+
args = parsed.args;
|
|
6482
|
+
} else {
|
|
6483
|
+
const [cmd, ...cmdArgs] = parsed.command;
|
|
6484
|
+
if (!cmd) {
|
|
6485
|
+
throw new Error(`MCP server "${name}" has an empty command array.`);
|
|
6486
|
+
}
|
|
6487
|
+
command = cmd;
|
|
6488
|
+
args = cmdArgs.length > 0 ? [...cmdArgs, ...parsed.args ?? []] : parsed.args;
|
|
6489
|
+
}
|
|
6490
|
+
result[name] = {
|
|
6491
|
+
type: "stdio",
|
|
6492
|
+
command,
|
|
6493
|
+
...args && { args },
|
|
6494
|
+
...parsed.env && { env: parsed.env }
|
|
6495
|
+
};
|
|
6496
|
+
}
|
|
6497
|
+
return result;
|
|
6498
|
+
}
|
|
6499
|
+
function removeTypeField(config) {
|
|
6500
|
+
const result = {};
|
|
6501
|
+
for (const [name, server] of Object.entries(config.mcpServers ?? {})) {
|
|
6502
|
+
const { type: _, ...rest } = server;
|
|
6503
|
+
result[name] = rest;
|
|
6504
|
+
}
|
|
6505
|
+
return result;
|
|
6506
|
+
}
|
|
6507
|
+
var CopilotcliMcp = class _CopilotcliMcp extends ToolMcp {
|
|
6508
|
+
json;
|
|
6509
|
+
constructor(params) {
|
|
6510
|
+
super(params);
|
|
6511
|
+
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
6512
|
+
}
|
|
6513
|
+
getJson() {
|
|
6514
|
+
return this.json;
|
|
6515
|
+
}
|
|
6516
|
+
/**
|
|
6517
|
+
* In global mode, ~/.copilot/mcp-config.json should not be deleted
|
|
6518
|
+
* as it may contain other user settings.
|
|
6519
|
+
* In local mode, .copilot/mcp-config.json can be safely deleted.
|
|
6520
|
+
*/
|
|
6521
|
+
isDeletable() {
|
|
6522
|
+
return !this.global;
|
|
6523
|
+
}
|
|
6524
|
+
static getSettablePaths({ global } = {}) {
|
|
6525
|
+
if (global) {
|
|
6526
|
+
return {
|
|
6527
|
+
relativeDirPath: ".copilot",
|
|
6528
|
+
relativeFilePath: "mcp-config.json"
|
|
6529
|
+
};
|
|
6530
|
+
}
|
|
6531
|
+
return {
|
|
6532
|
+
relativeDirPath: ".copilot",
|
|
6533
|
+
relativeFilePath: "mcp-config.json"
|
|
6534
|
+
};
|
|
6535
|
+
}
|
|
6536
|
+
static async fromFile({
|
|
6537
|
+
baseDir = process.cwd(),
|
|
6538
|
+
validate = true,
|
|
6539
|
+
global = false
|
|
6540
|
+
}) {
|
|
6541
|
+
const paths = this.getSettablePaths({ global });
|
|
6542
|
+
const fileContent = await readFileContentOrNull((0, import_node_path49.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6543
|
+
const json = JSON.parse(fileContent);
|
|
6544
|
+
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6545
|
+
return new _CopilotcliMcp({
|
|
6546
|
+
baseDir,
|
|
6547
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6548
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6549
|
+
fileContent: JSON.stringify(newJson, null, 2),
|
|
6550
|
+
validate,
|
|
6551
|
+
global
|
|
6552
|
+
});
|
|
6553
|
+
}
|
|
6554
|
+
static async fromRulesyncMcp({
|
|
6555
|
+
baseDir = process.cwd(),
|
|
6556
|
+
rulesyncMcp,
|
|
6557
|
+
validate = true,
|
|
6558
|
+
global = false
|
|
6559
|
+
}) {
|
|
6560
|
+
const paths = this.getSettablePaths({ global });
|
|
6561
|
+
const fileContent = await readOrInitializeFileContent(
|
|
6562
|
+
(0, import_node_path49.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6563
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6564
|
+
);
|
|
6565
|
+
const json = JSON.parse(fileContent);
|
|
6566
|
+
const copilotCliMcpServers = addTypeField(rulesyncMcp.getMcpServers());
|
|
6567
|
+
const mcpJson = { ...json, mcpServers: copilotCliMcpServers };
|
|
6568
|
+
return new _CopilotcliMcp({
|
|
6569
|
+
baseDir,
|
|
6570
|
+
relativeDirPath: paths.relativeDirPath,
|
|
6571
|
+
relativeFilePath: paths.relativeFilePath,
|
|
6572
|
+
fileContent: JSON.stringify(mcpJson, null, 2),
|
|
6573
|
+
validate,
|
|
6574
|
+
global
|
|
6575
|
+
});
|
|
6576
|
+
}
|
|
6577
|
+
toRulesyncMcp() {
|
|
6578
|
+
const mcpServers = removeTypeField(this.json);
|
|
6579
|
+
return this.toRulesyncMcpDefault({
|
|
6580
|
+
fileContent: JSON.stringify({ mcpServers }, null, 2)
|
|
6581
|
+
});
|
|
6582
|
+
}
|
|
6583
|
+
validate() {
|
|
6584
|
+
return { success: true, error: null };
|
|
6585
|
+
}
|
|
6586
|
+
static forDeletion({
|
|
6587
|
+
baseDir = process.cwd(),
|
|
6588
|
+
relativeDirPath,
|
|
6589
|
+
relativeFilePath,
|
|
6590
|
+
global = false
|
|
6591
|
+
}) {
|
|
6592
|
+
return new _CopilotcliMcp({
|
|
6593
|
+
baseDir,
|
|
6594
|
+
relativeDirPath,
|
|
6595
|
+
relativeFilePath,
|
|
6596
|
+
fileContent: "{}",
|
|
6597
|
+
validate: false,
|
|
6598
|
+
global
|
|
6599
|
+
});
|
|
6600
|
+
}
|
|
6601
|
+
};
|
|
6602
|
+
|
|
6603
|
+
// src/features/mcp/cursor-mcp.ts
|
|
6604
|
+
var import_node_path50 = require("path");
|
|
6514
6605
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
6515
6606
|
function isMcpServers(value) {
|
|
6516
6607
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -6560,7 +6651,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6560
6651
|
this.json = JSON.parse(this.fileContent);
|
|
6561
6652
|
} catch (error) {
|
|
6562
6653
|
throw new Error(
|
|
6563
|
-
`Failed to parse Cursor MCP config at ${(0,
|
|
6654
|
+
`Failed to parse Cursor MCP config at ${(0, import_node_path50.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(error)}`,
|
|
6564
6655
|
{ cause: error }
|
|
6565
6656
|
);
|
|
6566
6657
|
}
|
|
@@ -6586,14 +6677,14 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6586
6677
|
global = false
|
|
6587
6678
|
}) {
|
|
6588
6679
|
const paths = this.getSettablePaths({ global });
|
|
6589
|
-
const filePath = (0,
|
|
6680
|
+
const filePath = (0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
6590
6681
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"mcpServers":{}}';
|
|
6591
6682
|
let json;
|
|
6592
6683
|
try {
|
|
6593
6684
|
json = JSON.parse(fileContent);
|
|
6594
6685
|
} catch (error) {
|
|
6595
6686
|
throw new Error(
|
|
6596
|
-
`Failed to parse Cursor MCP config at ${(0,
|
|
6687
|
+
`Failed to parse Cursor MCP config at ${(0, import_node_path50.join)(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6597
6688
|
{ cause: error }
|
|
6598
6689
|
);
|
|
6599
6690
|
}
|
|
@@ -6615,7 +6706,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6615
6706
|
}) {
|
|
6616
6707
|
const paths = this.getSettablePaths({ global });
|
|
6617
6708
|
const fileContent = await readOrInitializeFileContent(
|
|
6618
|
-
(0,
|
|
6709
|
+
(0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6619
6710
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6620
6711
|
);
|
|
6621
6712
|
let json;
|
|
@@ -6623,7 +6714,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6623
6714
|
json = JSON.parse(fileContent);
|
|
6624
6715
|
} catch (error) {
|
|
6625
6716
|
throw new Error(
|
|
6626
|
-
`Failed to parse Cursor MCP config at ${(0,
|
|
6717
|
+
`Failed to parse Cursor MCP config at ${(0, import_node_path50.join)(paths.relativeDirPath, paths.relativeFilePath)}: ${formatError(error)}`,
|
|
6627
6718
|
{ cause: error }
|
|
6628
6719
|
);
|
|
6629
6720
|
}
|
|
@@ -6672,7 +6763,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
6672
6763
|
};
|
|
6673
6764
|
|
|
6674
6765
|
// src/features/mcp/factorydroid-mcp.ts
|
|
6675
|
-
var
|
|
6766
|
+
var import_node_path51 = require("path");
|
|
6676
6767
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
6677
6768
|
json;
|
|
6678
6769
|
constructor(params) {
|
|
@@ -6693,7 +6784,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6693
6784
|
validate = true
|
|
6694
6785
|
}) {
|
|
6695
6786
|
const fileContent = await readFileContent(
|
|
6696
|
-
(0,
|
|
6787
|
+
(0, import_node_path51.join)(
|
|
6697
6788
|
baseDir,
|
|
6698
6789
|
this.getSettablePaths().relativeDirPath,
|
|
6699
6790
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6747,7 +6838,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
6747
6838
|
};
|
|
6748
6839
|
|
|
6749
6840
|
// src/features/mcp/geminicli-mcp.ts
|
|
6750
|
-
var
|
|
6841
|
+
var import_node_path52 = require("path");
|
|
6751
6842
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
6752
6843
|
json;
|
|
6753
6844
|
constructor(params) {
|
|
@@ -6775,7 +6866,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6775
6866
|
global = false
|
|
6776
6867
|
}) {
|
|
6777
6868
|
const paths = this.getSettablePaths({ global });
|
|
6778
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6869
|
+
const fileContent = await readFileContentOrNull((0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6779
6870
|
const json = JSON.parse(fileContent);
|
|
6780
6871
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
6781
6872
|
return new _GeminiCliMcp({
|
|
@@ -6794,7 +6885,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6794
6885
|
}) {
|
|
6795
6886
|
const paths = this.getSettablePaths({ global });
|
|
6796
6887
|
const fileContent = await readOrInitializeFileContent(
|
|
6797
|
-
(0,
|
|
6888
|
+
(0, import_node_path52.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6798
6889
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
6799
6890
|
);
|
|
6800
6891
|
const json = JSON.parse(fileContent);
|
|
@@ -6839,7 +6930,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
6839
6930
|
};
|
|
6840
6931
|
|
|
6841
6932
|
// src/features/mcp/junie-mcp.ts
|
|
6842
|
-
var
|
|
6933
|
+
var import_node_path53 = require("path");
|
|
6843
6934
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
6844
6935
|
json;
|
|
6845
6936
|
constructor(params) {
|
|
@@ -6851,7 +6942,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6851
6942
|
}
|
|
6852
6943
|
static getSettablePaths() {
|
|
6853
6944
|
return {
|
|
6854
|
-
relativeDirPath: (0,
|
|
6945
|
+
relativeDirPath: (0, import_node_path53.join)(".junie", "mcp"),
|
|
6855
6946
|
relativeFilePath: "mcp.json"
|
|
6856
6947
|
};
|
|
6857
6948
|
}
|
|
@@ -6860,7 +6951,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6860
6951
|
validate = true
|
|
6861
6952
|
}) {
|
|
6862
6953
|
const fileContent = await readFileContent(
|
|
6863
|
-
(0,
|
|
6954
|
+
(0, import_node_path53.join)(
|
|
6864
6955
|
baseDir,
|
|
6865
6956
|
this.getSettablePaths().relativeDirPath,
|
|
6866
6957
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6909,7 +7000,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
6909
7000
|
};
|
|
6910
7001
|
|
|
6911
7002
|
// src/features/mcp/kilo-mcp.ts
|
|
6912
|
-
var
|
|
7003
|
+
var import_node_path54 = require("path");
|
|
6913
7004
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
6914
7005
|
json;
|
|
6915
7006
|
constructor(params) {
|
|
@@ -6930,7 +7021,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6930
7021
|
validate = true
|
|
6931
7022
|
}) {
|
|
6932
7023
|
const paths = this.getSettablePaths();
|
|
6933
|
-
const fileContent = await readFileContentOrNull((0,
|
|
7024
|
+
const fileContent = await readFileContentOrNull((0, import_node_path54.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
6934
7025
|
return new _KiloMcp({
|
|
6935
7026
|
baseDir,
|
|
6936
7027
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6978,7 +7069,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
6978
7069
|
};
|
|
6979
7070
|
|
|
6980
7071
|
// src/features/mcp/kiro-mcp.ts
|
|
6981
|
-
var
|
|
7072
|
+
var import_node_path55 = require("path");
|
|
6982
7073
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
6983
7074
|
json;
|
|
6984
7075
|
constructor(params) {
|
|
@@ -6990,7 +7081,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6990
7081
|
}
|
|
6991
7082
|
static getSettablePaths() {
|
|
6992
7083
|
return {
|
|
6993
|
-
relativeDirPath: (0,
|
|
7084
|
+
relativeDirPath: (0, import_node_path55.join)(".kiro", "settings"),
|
|
6994
7085
|
relativeFilePath: "mcp.json"
|
|
6995
7086
|
};
|
|
6996
7087
|
}
|
|
@@ -6999,7 +7090,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
6999
7090
|
validate = true
|
|
7000
7091
|
}) {
|
|
7001
7092
|
const paths = this.getSettablePaths();
|
|
7002
|
-
const fileContent = await readFileContentOrNull((0,
|
|
7093
|
+
const fileContent = await readFileContentOrNull((0, import_node_path55.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
7003
7094
|
return new _KiroMcp({
|
|
7004
7095
|
baseDir,
|
|
7005
7096
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -7047,7 +7138,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
7047
7138
|
};
|
|
7048
7139
|
|
|
7049
7140
|
// src/features/mcp/opencode-mcp.ts
|
|
7050
|
-
var
|
|
7141
|
+
var import_node_path56 = require("path");
|
|
7051
7142
|
var import_jsonc_parser2 = require("jsonc-parser");
|
|
7052
7143
|
var import_mini22 = require("zod/mini");
|
|
7053
7144
|
var OpencodeMcpLocalServerSchema = import_mini22.z.object({
|
|
@@ -7188,7 +7279,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7188
7279
|
static getSettablePaths({ global } = {}) {
|
|
7189
7280
|
if (global) {
|
|
7190
7281
|
return {
|
|
7191
|
-
relativeDirPath: (0,
|
|
7282
|
+
relativeDirPath: (0, import_node_path56.join)(".config", "opencode"),
|
|
7192
7283
|
relativeFilePath: "opencode.json"
|
|
7193
7284
|
};
|
|
7194
7285
|
}
|
|
@@ -7203,11 +7294,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7203
7294
|
global = false
|
|
7204
7295
|
}) {
|
|
7205
7296
|
const basePaths = this.getSettablePaths({ global });
|
|
7206
|
-
const jsonDir = (0,
|
|
7297
|
+
const jsonDir = (0, import_node_path56.join)(baseDir, basePaths.relativeDirPath);
|
|
7207
7298
|
let fileContent = null;
|
|
7208
7299
|
let relativeFilePath = "opencode.jsonc";
|
|
7209
|
-
const jsoncPath = (0,
|
|
7210
|
-
const jsonPath = (0,
|
|
7300
|
+
const jsoncPath = (0, import_node_path56.join)(jsonDir, "opencode.jsonc");
|
|
7301
|
+
const jsonPath = (0, import_node_path56.join)(jsonDir, "opencode.json");
|
|
7211
7302
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7212
7303
|
if (!fileContent) {
|
|
7213
7304
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7233,11 +7324,11 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7233
7324
|
global = false
|
|
7234
7325
|
}) {
|
|
7235
7326
|
const basePaths = this.getSettablePaths({ global });
|
|
7236
|
-
const jsonDir = (0,
|
|
7327
|
+
const jsonDir = (0, import_node_path56.join)(baseDir, basePaths.relativeDirPath);
|
|
7237
7328
|
let fileContent = null;
|
|
7238
7329
|
let relativeFilePath = "opencode.jsonc";
|
|
7239
|
-
const jsoncPath = (0,
|
|
7240
|
-
const jsonPath = (0,
|
|
7330
|
+
const jsoncPath = (0, import_node_path56.join)(jsonDir, "opencode.jsonc");
|
|
7331
|
+
const jsonPath = (0, import_node_path56.join)(jsonDir, "opencode.json");
|
|
7241
7332
|
fileContent = await readFileContentOrNull(jsoncPath);
|
|
7242
7333
|
if (!fileContent) {
|
|
7243
7334
|
fileContent = await readFileContentOrNull(jsonPath);
|
|
@@ -7298,7 +7389,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
7298
7389
|
};
|
|
7299
7390
|
|
|
7300
7391
|
// src/features/mcp/roo-mcp.ts
|
|
7301
|
-
var
|
|
7392
|
+
var import_node_path57 = require("path");
|
|
7302
7393
|
function isRooMcpServers(value) {
|
|
7303
7394
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
7304
7395
|
}
|
|
@@ -7350,7 +7441,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
7350
7441
|
validate = true
|
|
7351
7442
|
}) {
|
|
7352
7443
|
const fileContent = await readFileContent(
|
|
7353
|
-
(0,
|
|
7444
|
+
(0, import_node_path57.join)(
|
|
7354
7445
|
baseDir,
|
|
7355
7446
|
this.getSettablePaths().relativeDirPath,
|
|
7356
7447
|
this.getSettablePaths().relativeFilePath
|
|
@@ -7412,6 +7503,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
7412
7503
|
"cline",
|
|
7413
7504
|
"codexcli",
|
|
7414
7505
|
"copilot",
|
|
7506
|
+
"copilotcli",
|
|
7415
7507
|
"cursor",
|
|
7416
7508
|
"factorydroid",
|
|
7417
7509
|
"geminicli",
|
|
@@ -7483,6 +7575,18 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
7483
7575
|
}
|
|
7484
7576
|
}
|
|
7485
7577
|
],
|
|
7578
|
+
[
|
|
7579
|
+
"copilotcli",
|
|
7580
|
+
{
|
|
7581
|
+
class: CopilotcliMcp,
|
|
7582
|
+
meta: {
|
|
7583
|
+
supportsProject: true,
|
|
7584
|
+
supportsGlobal: true,
|
|
7585
|
+
supportsEnabledTools: false,
|
|
7586
|
+
supportsDisabledTools: false
|
|
7587
|
+
}
|
|
7588
|
+
}
|
|
7589
|
+
],
|
|
7486
7590
|
[
|
|
7487
7591
|
"cursor",
|
|
7488
7592
|
{
|
|
@@ -7605,9 +7709,10 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7605
7709
|
toolTarget,
|
|
7606
7710
|
global = false,
|
|
7607
7711
|
getFactory = defaultGetFactory3,
|
|
7608
|
-
dryRun = false
|
|
7712
|
+
dryRun = false,
|
|
7713
|
+
logger
|
|
7609
7714
|
}) {
|
|
7610
|
-
super({ baseDir, dryRun });
|
|
7715
|
+
super({ baseDir, dryRun, logger });
|
|
7611
7716
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
7612
7717
|
if (!result.success) {
|
|
7613
7718
|
throw new Error(
|
|
@@ -7626,7 +7731,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7626
7731
|
try {
|
|
7627
7732
|
return [await RulesyncMcp.fromFile({})];
|
|
7628
7733
|
} catch (error) {
|
|
7629
|
-
logger.error(
|
|
7734
|
+
this.logger.error(
|
|
7630
7735
|
`Failed to load a Rulesync MCP file (${RULESYNC_MCP_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
7631
7736
|
);
|
|
7632
7737
|
return [];
|
|
@@ -7650,7 +7755,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7650
7755
|
global: this.global
|
|
7651
7756
|
});
|
|
7652
7757
|
const toolMcps2 = toolMcp.isDeletable() ? [toolMcp] : [];
|
|
7653
|
-
logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7758
|
+
this.logger.debug(`Successfully loaded ${toolMcps2.length} ${this.toolTarget} MCP files`);
|
|
7654
7759
|
return toolMcps2;
|
|
7655
7760
|
}
|
|
7656
7761
|
const toolMcps = [
|
|
@@ -7660,14 +7765,14 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7660
7765
|
global: this.global
|
|
7661
7766
|
})
|
|
7662
7767
|
];
|
|
7663
|
-
logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7768
|
+
this.logger.debug(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
7664
7769
|
return toolMcps;
|
|
7665
7770
|
} catch (error) {
|
|
7666
7771
|
const errorMessage = `Failed to load MCP files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
7667
7772
|
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
7668
|
-
logger.debug(errorMessage);
|
|
7773
|
+
this.logger.debug(errorMessage);
|
|
7669
7774
|
} else {
|
|
7670
|
-
logger.error(errorMessage);
|
|
7775
|
+
this.logger.error(errorMessage);
|
|
7671
7776
|
}
|
|
7672
7777
|
return [];
|
|
7673
7778
|
}
|
|
@@ -7723,7 +7828,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7723
7828
|
};
|
|
7724
7829
|
|
|
7725
7830
|
// src/features/rules/rules-processor.ts
|
|
7726
|
-
var
|
|
7831
|
+
var import_node_path119 = require("path");
|
|
7727
7832
|
var import_toon = require("@toon-format/toon");
|
|
7728
7833
|
var import_mini57 = require("zod/mini");
|
|
7729
7834
|
|
|
@@ -7731,17 +7836,17 @@ var import_mini57 = require("zod/mini");
|
|
|
7731
7836
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
7732
7837
|
|
|
7733
7838
|
// src/features/skills/agentsmd-skill.ts
|
|
7734
|
-
var
|
|
7839
|
+
var import_node_path61 = require("path");
|
|
7735
7840
|
|
|
7736
7841
|
// src/features/skills/simulated-skill.ts
|
|
7737
|
-
var
|
|
7842
|
+
var import_node_path60 = require("path");
|
|
7738
7843
|
var import_mini24 = require("zod/mini");
|
|
7739
7844
|
|
|
7740
7845
|
// src/features/skills/tool-skill.ts
|
|
7741
|
-
var
|
|
7846
|
+
var import_node_path59 = require("path");
|
|
7742
7847
|
|
|
7743
7848
|
// src/types/ai-dir.ts
|
|
7744
|
-
var
|
|
7849
|
+
var import_node_path58 = __toESM(require("path"), 1);
|
|
7745
7850
|
var AiDir = class {
|
|
7746
7851
|
/**
|
|
7747
7852
|
* @example "."
|
|
@@ -7775,7 +7880,7 @@ var AiDir = class {
|
|
|
7775
7880
|
otherFiles = [],
|
|
7776
7881
|
global = false
|
|
7777
7882
|
}) {
|
|
7778
|
-
if (dirName.includes(
|
|
7883
|
+
if (dirName.includes(import_node_path58.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
7779
7884
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
7780
7885
|
}
|
|
7781
7886
|
this.baseDir = baseDir;
|
|
@@ -7798,11 +7903,11 @@ var AiDir = class {
|
|
|
7798
7903
|
return this.dirName;
|
|
7799
7904
|
}
|
|
7800
7905
|
getDirPath() {
|
|
7801
|
-
const fullPath =
|
|
7802
|
-
const resolvedFull = (0,
|
|
7803
|
-
const resolvedBase = (0,
|
|
7804
|
-
const rel = (0,
|
|
7805
|
-
if (rel.startsWith("..") ||
|
|
7906
|
+
const fullPath = import_node_path58.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
7907
|
+
const resolvedFull = (0, import_node_path58.resolve)(fullPath);
|
|
7908
|
+
const resolvedBase = (0, import_node_path58.resolve)(this.baseDir);
|
|
7909
|
+
const rel = (0, import_node_path58.relative)(resolvedBase, resolvedFull);
|
|
7910
|
+
if (rel.startsWith("..") || import_node_path58.default.isAbsolute(rel)) {
|
|
7806
7911
|
throw new Error(
|
|
7807
7912
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
7808
7913
|
);
|
|
@@ -7816,7 +7921,7 @@ var AiDir = class {
|
|
|
7816
7921
|
return this.otherFiles;
|
|
7817
7922
|
}
|
|
7818
7923
|
getRelativePathFromCwd() {
|
|
7819
|
-
return
|
|
7924
|
+
return import_node_path58.default.join(this.relativeDirPath, this.dirName);
|
|
7820
7925
|
}
|
|
7821
7926
|
getGlobal() {
|
|
7822
7927
|
return this.global;
|
|
@@ -7835,15 +7940,15 @@ var AiDir = class {
|
|
|
7835
7940
|
* @returns Array of files with their relative paths and buffers
|
|
7836
7941
|
*/
|
|
7837
7942
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
7838
|
-
const dirPath = (0,
|
|
7839
|
-
const glob = (0,
|
|
7943
|
+
const dirPath = (0, import_node_path58.join)(baseDir, relativeDirPath, dirName);
|
|
7944
|
+
const glob = (0, import_node_path58.join)(dirPath, "**", "*");
|
|
7840
7945
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
7841
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
7946
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path58.basename)(filePath) !== excludeFileName);
|
|
7842
7947
|
const files = await Promise.all(
|
|
7843
7948
|
filteredPaths.map(async (filePath) => {
|
|
7844
7949
|
const fileBuffer = await readFileBuffer(filePath);
|
|
7845
7950
|
return {
|
|
7846
|
-
relativeFilePathToDirPath: (0,
|
|
7951
|
+
relativeFilePathToDirPath: (0, import_node_path58.relative)(dirPath, filePath),
|
|
7847
7952
|
fileBuffer
|
|
7848
7953
|
};
|
|
7849
7954
|
})
|
|
@@ -7934,8 +8039,8 @@ var ToolSkill = class extends AiDir {
|
|
|
7934
8039
|
}) {
|
|
7935
8040
|
const settablePaths = getSettablePaths({ global });
|
|
7936
8041
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
7937
|
-
const skillDirPath = (0,
|
|
7938
|
-
const skillFilePath = (0,
|
|
8042
|
+
const skillDirPath = (0, import_node_path59.join)(baseDir, actualRelativeDirPath, dirName);
|
|
8043
|
+
const skillFilePath = (0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7939
8044
|
if (!await fileExists(skillFilePath)) {
|
|
7940
8045
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7941
8046
|
}
|
|
@@ -7959,7 +8064,7 @@ var ToolSkill = class extends AiDir {
|
|
|
7959
8064
|
}
|
|
7960
8065
|
requireMainFileFrontmatter() {
|
|
7961
8066
|
if (!this.mainFile?.frontmatter) {
|
|
7962
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
8067
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path59.join)(this.relativeDirPath, this.dirName)}`);
|
|
7963
8068
|
}
|
|
7964
8069
|
return this.mainFile.frontmatter;
|
|
7965
8070
|
}
|
|
@@ -7999,7 +8104,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
7999
8104
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
8000
8105
|
if (!result.success) {
|
|
8001
8106
|
throw new Error(
|
|
8002
|
-
`Invalid frontmatter in ${(0,
|
|
8107
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
8003
8108
|
);
|
|
8004
8109
|
}
|
|
8005
8110
|
}
|
|
@@ -8058,8 +8163,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
8058
8163
|
}) {
|
|
8059
8164
|
const settablePaths = this.getSettablePaths();
|
|
8060
8165
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
8061
|
-
const skillDirPath = (0,
|
|
8062
|
-
const skillFilePath = (0,
|
|
8166
|
+
const skillDirPath = (0, import_node_path60.join)(baseDir, actualRelativeDirPath, dirName);
|
|
8167
|
+
const skillFilePath = (0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME);
|
|
8063
8168
|
if (!await fileExists(skillFilePath)) {
|
|
8064
8169
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8065
8170
|
}
|
|
@@ -8136,7 +8241,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8136
8241
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
8137
8242
|
}
|
|
8138
8243
|
return {
|
|
8139
|
-
relativeDirPath: (0,
|
|
8244
|
+
relativeDirPath: (0, import_node_path61.join)(".agents", "skills")
|
|
8140
8245
|
};
|
|
8141
8246
|
}
|
|
8142
8247
|
static async fromDir(params) {
|
|
@@ -8163,11 +8268,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
8163
8268
|
};
|
|
8164
8269
|
|
|
8165
8270
|
// src/features/skills/factorydroid-skill.ts
|
|
8166
|
-
var
|
|
8271
|
+
var import_node_path62 = require("path");
|
|
8167
8272
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
8168
8273
|
static getSettablePaths(_options) {
|
|
8169
8274
|
return {
|
|
8170
|
-
relativeDirPath: (0,
|
|
8275
|
+
relativeDirPath: (0, import_node_path62.join)(".factory", "skills")
|
|
8171
8276
|
};
|
|
8172
8277
|
}
|
|
8173
8278
|
static async fromDir(params) {
|
|
@@ -8194,23 +8299,26 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
8194
8299
|
};
|
|
8195
8300
|
|
|
8196
8301
|
// src/features/skills/skills-processor.ts
|
|
8197
|
-
var
|
|
8302
|
+
var import_node_path80 = require("path");
|
|
8198
8303
|
var import_mini40 = require("zod/mini");
|
|
8199
8304
|
|
|
8200
8305
|
// src/types/dir-feature-processor.ts
|
|
8201
|
-
var
|
|
8306
|
+
var import_node_path63 = require("path");
|
|
8202
8307
|
var DirFeatureProcessor = class {
|
|
8203
8308
|
baseDir;
|
|
8204
8309
|
dryRun;
|
|
8205
8310
|
avoidBlockScalars;
|
|
8311
|
+
logger;
|
|
8206
8312
|
constructor({
|
|
8207
8313
|
baseDir = process.cwd(),
|
|
8208
8314
|
dryRun = false,
|
|
8209
|
-
avoidBlockScalars = false
|
|
8315
|
+
avoidBlockScalars = false,
|
|
8316
|
+
logger
|
|
8210
8317
|
}) {
|
|
8211
8318
|
this.baseDir = baseDir;
|
|
8212
8319
|
this.dryRun = dryRun;
|
|
8213
8320
|
this.avoidBlockScalars = avoidBlockScalars;
|
|
8321
|
+
this.logger = logger;
|
|
8214
8322
|
}
|
|
8215
8323
|
/**
|
|
8216
8324
|
* Return tool targets that this feature supports.
|
|
@@ -8235,7 +8343,7 @@ var DirFeatureProcessor = class {
|
|
|
8235
8343
|
const mainFile = aiDir.getMainFile();
|
|
8236
8344
|
let mainFileContent;
|
|
8237
8345
|
if (mainFile) {
|
|
8238
|
-
const mainFilePath = (0,
|
|
8346
|
+
const mainFilePath = (0, import_node_path63.join)(dirPath, mainFile.name);
|
|
8239
8347
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
8240
8348
|
avoidBlockScalars: this.avoidBlockScalars
|
|
8241
8349
|
});
|
|
@@ -8251,7 +8359,7 @@ var DirFeatureProcessor = class {
|
|
|
8251
8359
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
8252
8360
|
otherFileContents.push(contentWithNewline);
|
|
8253
8361
|
if (!dirHasChanges) {
|
|
8254
|
-
const filePath = (0,
|
|
8362
|
+
const filePath = (0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath);
|
|
8255
8363
|
const existingContent = await readFileContentOrNull(filePath);
|
|
8256
8364
|
if (existingContent !== contentWithNewline) {
|
|
8257
8365
|
dirHasChanges = true;
|
|
@@ -8263,24 +8371,26 @@ var DirFeatureProcessor = class {
|
|
|
8263
8371
|
}
|
|
8264
8372
|
const relativeDir = aiDir.getRelativePathFromCwd();
|
|
8265
8373
|
if (this.dryRun) {
|
|
8266
|
-
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8374
|
+
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
8267
8375
|
if (mainFile) {
|
|
8268
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
8269
|
-
changedPaths.push((0,
|
|
8376
|
+
this.logger.info(`[DRY RUN] Would write: ${(0, import_node_path63.join)(dirPath, mainFile.name)}`);
|
|
8377
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, mainFile.name));
|
|
8270
8378
|
}
|
|
8271
8379
|
for (const file of otherFiles) {
|
|
8272
|
-
logger.info(
|
|
8273
|
-
|
|
8380
|
+
this.logger.info(
|
|
8381
|
+
`[DRY RUN] Would write: ${(0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath)}`
|
|
8382
|
+
);
|
|
8383
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
8274
8384
|
}
|
|
8275
8385
|
} else {
|
|
8276
8386
|
await ensureDir(dirPath);
|
|
8277
8387
|
if (mainFile && mainFileContent) {
|
|
8278
|
-
const mainFilePath = (0,
|
|
8388
|
+
const mainFilePath = (0, import_node_path63.join)(dirPath, mainFile.name);
|
|
8279
8389
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
8280
|
-
changedPaths.push((0,
|
|
8390
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, mainFile.name));
|
|
8281
8391
|
}
|
|
8282
8392
|
for (const [i, file] of otherFiles.entries()) {
|
|
8283
|
-
const filePath = (0,
|
|
8393
|
+
const filePath = (0, import_node_path63.join)(dirPath, file.relativeFilePathToDirPath);
|
|
8284
8394
|
const content = otherFileContents[i];
|
|
8285
8395
|
if (content === void 0) {
|
|
8286
8396
|
throw new Error(
|
|
@@ -8288,7 +8398,7 @@ var DirFeatureProcessor = class {
|
|
|
8288
8398
|
);
|
|
8289
8399
|
}
|
|
8290
8400
|
await writeFileContent(filePath, content);
|
|
8291
|
-
changedPaths.push((0,
|
|
8401
|
+
changedPaths.push((0, import_node_path63.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
8292
8402
|
}
|
|
8293
8403
|
}
|
|
8294
8404
|
changedCount++;
|
|
@@ -8310,7 +8420,7 @@ var DirFeatureProcessor = class {
|
|
|
8310
8420
|
for (const aiDir of orphanDirs) {
|
|
8311
8421
|
const dirPath = aiDir.getDirPath();
|
|
8312
8422
|
if (this.dryRun) {
|
|
8313
|
-
logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8423
|
+
this.logger.info(`[DRY RUN] Would delete directory: ${dirPath}`);
|
|
8314
8424
|
} else {
|
|
8315
8425
|
await removeDirectory(dirPath);
|
|
8316
8426
|
}
|
|
@@ -8320,11 +8430,11 @@ var DirFeatureProcessor = class {
|
|
|
8320
8430
|
};
|
|
8321
8431
|
|
|
8322
8432
|
// src/features/skills/agentsskills-skill.ts
|
|
8323
|
-
var
|
|
8433
|
+
var import_node_path65 = require("path");
|
|
8324
8434
|
var import_mini26 = require("zod/mini");
|
|
8325
8435
|
|
|
8326
8436
|
// src/features/skills/rulesync-skill.ts
|
|
8327
|
-
var
|
|
8437
|
+
var import_node_path64 = require("path");
|
|
8328
8438
|
var import_mini25 = require("zod/mini");
|
|
8329
8439
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini25.z.looseObject({
|
|
8330
8440
|
name: import_mini25.z.string(),
|
|
@@ -8393,7 +8503,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8393
8503
|
}
|
|
8394
8504
|
getFrontmatter() {
|
|
8395
8505
|
if (!this.mainFile?.frontmatter) {
|
|
8396
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
8506
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path64.join)(this.relativeDirPath, this.dirName)}`);
|
|
8397
8507
|
}
|
|
8398
8508
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
8399
8509
|
return result;
|
|
@@ -8419,8 +8529,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
8419
8529
|
dirName,
|
|
8420
8530
|
global = false
|
|
8421
8531
|
}) {
|
|
8422
|
-
const skillDirPath = (0,
|
|
8423
|
-
const skillFilePath = (0,
|
|
8532
|
+
const skillDirPath = (0, import_node_path64.join)(baseDir, relativeDirPath, dirName);
|
|
8533
|
+
const skillFilePath = (0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME);
|
|
8424
8534
|
if (!await fileExists(skillFilePath)) {
|
|
8425
8535
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
8426
8536
|
}
|
|
@@ -8457,7 +8567,7 @@ var AgentsSkillsSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
|
8457
8567
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
8458
8568
|
constructor({
|
|
8459
8569
|
baseDir = process.cwd(),
|
|
8460
|
-
relativeDirPath = (0,
|
|
8570
|
+
relativeDirPath = (0, import_node_path65.join)(".agents", "skills"),
|
|
8461
8571
|
dirName,
|
|
8462
8572
|
frontmatter,
|
|
8463
8573
|
body,
|
|
@@ -8489,7 +8599,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8489
8599
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
8490
8600
|
}
|
|
8491
8601
|
return {
|
|
8492
|
-
relativeDirPath: (0,
|
|
8602
|
+
relativeDirPath: (0, import_node_path65.join)(".agents", "skills")
|
|
8493
8603
|
};
|
|
8494
8604
|
}
|
|
8495
8605
|
getFrontmatter() {
|
|
@@ -8569,9 +8679,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8569
8679
|
});
|
|
8570
8680
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8571
8681
|
if (!result.success) {
|
|
8572
|
-
const skillDirPath = (0,
|
|
8682
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8573
8683
|
throw new Error(
|
|
8574
|
-
`Invalid frontmatter in ${(0,
|
|
8684
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8575
8685
|
);
|
|
8576
8686
|
}
|
|
8577
8687
|
return new _AgentsSkillsSkill({
|
|
@@ -8606,7 +8716,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
8606
8716
|
};
|
|
8607
8717
|
|
|
8608
8718
|
// src/features/skills/antigravity-skill.ts
|
|
8609
|
-
var
|
|
8719
|
+
var import_node_path66 = require("path");
|
|
8610
8720
|
var import_mini27 = require("zod/mini");
|
|
8611
8721
|
var AntigravitySkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8612
8722
|
name: import_mini27.z.string(),
|
|
@@ -8615,7 +8725,7 @@ var AntigravitySkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
|
8615
8725
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
8616
8726
|
constructor({
|
|
8617
8727
|
baseDir = process.cwd(),
|
|
8618
|
-
relativeDirPath = (0,
|
|
8728
|
+
relativeDirPath = (0, import_node_path66.join)(".agent", "skills"),
|
|
8619
8729
|
dirName,
|
|
8620
8730
|
frontmatter,
|
|
8621
8731
|
body,
|
|
@@ -8647,11 +8757,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8647
8757
|
} = {}) {
|
|
8648
8758
|
if (global) {
|
|
8649
8759
|
return {
|
|
8650
|
-
relativeDirPath: (0,
|
|
8760
|
+
relativeDirPath: (0, import_node_path66.join)(".gemini", "antigravity", "skills")
|
|
8651
8761
|
};
|
|
8652
8762
|
}
|
|
8653
8763
|
return {
|
|
8654
|
-
relativeDirPath: (0,
|
|
8764
|
+
relativeDirPath: (0, import_node_path66.join)(".agent", "skills")
|
|
8655
8765
|
};
|
|
8656
8766
|
}
|
|
8657
8767
|
getFrontmatter() {
|
|
@@ -8731,9 +8841,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8731
8841
|
});
|
|
8732
8842
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8733
8843
|
if (!result.success) {
|
|
8734
|
-
const skillDirPath = (0,
|
|
8844
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8735
8845
|
throw new Error(
|
|
8736
|
-
`Invalid frontmatter in ${(0,
|
|
8846
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8737
8847
|
);
|
|
8738
8848
|
}
|
|
8739
8849
|
return new _AntigravitySkill({
|
|
@@ -8767,7 +8877,7 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
8767
8877
|
};
|
|
8768
8878
|
|
|
8769
8879
|
// src/features/skills/claudecode-skill.ts
|
|
8770
|
-
var
|
|
8880
|
+
var import_node_path67 = require("path");
|
|
8771
8881
|
var import_mini28 = require("zod/mini");
|
|
8772
8882
|
var ClaudecodeSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8773
8883
|
name: import_mini28.z.string(),
|
|
@@ -8779,7 +8889,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
|
8779
8889
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
8780
8890
|
constructor({
|
|
8781
8891
|
baseDir = process.cwd(),
|
|
8782
|
-
relativeDirPath = (0,
|
|
8892
|
+
relativeDirPath = (0, import_node_path67.join)(".claude", "skills"),
|
|
8783
8893
|
dirName,
|
|
8784
8894
|
frontmatter,
|
|
8785
8895
|
body,
|
|
@@ -8810,7 +8920,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8810
8920
|
global: _global = false
|
|
8811
8921
|
} = {}) {
|
|
8812
8922
|
return {
|
|
8813
|
-
relativeDirPath: (0,
|
|
8923
|
+
relativeDirPath: (0, import_node_path67.join)(".claude", "skills")
|
|
8814
8924
|
};
|
|
8815
8925
|
}
|
|
8816
8926
|
getFrontmatter() {
|
|
@@ -8907,9 +9017,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8907
9017
|
});
|
|
8908
9018
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8909
9019
|
if (!result.success) {
|
|
8910
|
-
const skillDirPath = (0,
|
|
9020
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8911
9021
|
throw new Error(
|
|
8912
|
-
`Invalid frontmatter in ${(0,
|
|
9022
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8913
9023
|
);
|
|
8914
9024
|
}
|
|
8915
9025
|
return new _ClaudecodeSkill({
|
|
@@ -8943,7 +9053,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
8943
9053
|
};
|
|
8944
9054
|
|
|
8945
9055
|
// src/features/skills/cline-skill.ts
|
|
8946
|
-
var
|
|
9056
|
+
var import_node_path68 = require("path");
|
|
8947
9057
|
var import_mini29 = require("zod/mini");
|
|
8948
9058
|
var ClineSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
8949
9059
|
name: import_mini29.z.string(),
|
|
@@ -8952,7 +9062,7 @@ var ClineSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
|
8952
9062
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
8953
9063
|
constructor({
|
|
8954
9064
|
baseDir = process.cwd(),
|
|
8955
|
-
relativeDirPath = (0,
|
|
9065
|
+
relativeDirPath = (0, import_node_path68.join)(".cline", "skills"),
|
|
8956
9066
|
dirName,
|
|
8957
9067
|
frontmatter,
|
|
8958
9068
|
body,
|
|
@@ -8981,7 +9091,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
8981
9091
|
}
|
|
8982
9092
|
static getSettablePaths(_options = {}) {
|
|
8983
9093
|
return {
|
|
8984
|
-
relativeDirPath: (0,
|
|
9094
|
+
relativeDirPath: (0, import_node_path68.join)(".cline", "skills")
|
|
8985
9095
|
};
|
|
8986
9096
|
}
|
|
8987
9097
|
getFrontmatter() {
|
|
@@ -9069,13 +9179,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9069
9179
|
});
|
|
9070
9180
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9071
9181
|
if (!result.success) {
|
|
9072
|
-
const skillDirPath = (0,
|
|
9182
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9073
9183
|
throw new Error(
|
|
9074
|
-
`Invalid frontmatter in ${(0,
|
|
9184
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9075
9185
|
);
|
|
9076
9186
|
}
|
|
9077
9187
|
if (result.data.name !== loaded.dirName) {
|
|
9078
|
-
const skillFilePath = (0,
|
|
9188
|
+
const skillFilePath = (0, import_node_path68.join)(
|
|
9079
9189
|
loaded.baseDir,
|
|
9080
9190
|
loaded.relativeDirPath,
|
|
9081
9191
|
loaded.dirName,
|
|
@@ -9116,7 +9226,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
9116
9226
|
};
|
|
9117
9227
|
|
|
9118
9228
|
// src/features/skills/codexcli-skill.ts
|
|
9119
|
-
var
|
|
9229
|
+
var import_node_path69 = require("path");
|
|
9120
9230
|
var import_mini30 = require("zod/mini");
|
|
9121
9231
|
var CodexCliSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
9122
9232
|
name: import_mini30.z.string(),
|
|
@@ -9130,7 +9240,7 @@ var CodexCliSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
|
9130
9240
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
9131
9241
|
constructor({
|
|
9132
9242
|
baseDir = process.cwd(),
|
|
9133
|
-
relativeDirPath = (0,
|
|
9243
|
+
relativeDirPath = (0, import_node_path69.join)(".codex", "skills"),
|
|
9134
9244
|
dirName,
|
|
9135
9245
|
frontmatter,
|
|
9136
9246
|
body,
|
|
@@ -9161,7 +9271,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9161
9271
|
global: _global = false
|
|
9162
9272
|
} = {}) {
|
|
9163
9273
|
return {
|
|
9164
|
-
relativeDirPath: (0,
|
|
9274
|
+
relativeDirPath: (0, import_node_path69.join)(".codex", "skills")
|
|
9165
9275
|
};
|
|
9166
9276
|
}
|
|
9167
9277
|
getFrontmatter() {
|
|
@@ -9251,9 +9361,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9251
9361
|
});
|
|
9252
9362
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9253
9363
|
if (!result.success) {
|
|
9254
|
-
const skillDirPath = (0,
|
|
9364
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9255
9365
|
throw new Error(
|
|
9256
|
-
`Invalid frontmatter in ${(0,
|
|
9366
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9257
9367
|
);
|
|
9258
9368
|
}
|
|
9259
9369
|
return new _CodexCliSkill({
|
|
@@ -9287,7 +9397,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
9287
9397
|
};
|
|
9288
9398
|
|
|
9289
9399
|
// src/features/skills/copilot-skill.ts
|
|
9290
|
-
var
|
|
9400
|
+
var import_node_path70 = require("path");
|
|
9291
9401
|
var import_mini31 = require("zod/mini");
|
|
9292
9402
|
var CopilotSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9293
9403
|
name: import_mini31.z.string(),
|
|
@@ -9297,7 +9407,7 @@ var CopilotSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
|
9297
9407
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
9298
9408
|
constructor({
|
|
9299
9409
|
baseDir = process.cwd(),
|
|
9300
|
-
relativeDirPath = (0,
|
|
9410
|
+
relativeDirPath = (0, import_node_path70.join)(".github", "skills"),
|
|
9301
9411
|
dirName,
|
|
9302
9412
|
frontmatter,
|
|
9303
9413
|
body,
|
|
@@ -9329,7 +9439,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9329
9439
|
throw new Error("CopilotSkill does not support global mode.");
|
|
9330
9440
|
}
|
|
9331
9441
|
return {
|
|
9332
|
-
relativeDirPath: (0,
|
|
9442
|
+
relativeDirPath: (0, import_node_path70.join)(".github", "skills")
|
|
9333
9443
|
};
|
|
9334
9444
|
}
|
|
9335
9445
|
getFrontmatter() {
|
|
@@ -9415,9 +9525,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9415
9525
|
});
|
|
9416
9526
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9417
9527
|
if (!result.success) {
|
|
9418
|
-
const skillDirPath = (0,
|
|
9528
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9419
9529
|
throw new Error(
|
|
9420
|
-
`Invalid frontmatter in ${(0,
|
|
9530
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9421
9531
|
);
|
|
9422
9532
|
}
|
|
9423
9533
|
return new _CopilotSkill({
|
|
@@ -9452,7 +9562,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
9452
9562
|
};
|
|
9453
9563
|
|
|
9454
9564
|
// src/features/skills/cursor-skill.ts
|
|
9455
|
-
var
|
|
9565
|
+
var import_node_path71 = require("path");
|
|
9456
9566
|
var import_mini32 = require("zod/mini");
|
|
9457
9567
|
var CursorSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9458
9568
|
name: import_mini32.z.string(),
|
|
@@ -9461,7 +9571,7 @@ var CursorSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
|
9461
9571
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
9462
9572
|
constructor({
|
|
9463
9573
|
baseDir = process.cwd(),
|
|
9464
|
-
relativeDirPath = (0,
|
|
9574
|
+
relativeDirPath = (0, import_node_path71.join)(".cursor", "skills"),
|
|
9465
9575
|
dirName,
|
|
9466
9576
|
frontmatter,
|
|
9467
9577
|
body,
|
|
@@ -9490,7 +9600,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9490
9600
|
}
|
|
9491
9601
|
static getSettablePaths(_options) {
|
|
9492
9602
|
return {
|
|
9493
|
-
relativeDirPath: (0,
|
|
9603
|
+
relativeDirPath: (0, import_node_path71.join)(".cursor", "skills")
|
|
9494
9604
|
};
|
|
9495
9605
|
}
|
|
9496
9606
|
getFrontmatter() {
|
|
@@ -9570,9 +9680,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9570
9680
|
});
|
|
9571
9681
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9572
9682
|
if (!result.success) {
|
|
9573
|
-
const skillDirPath = (0,
|
|
9683
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9574
9684
|
throw new Error(
|
|
9575
|
-
`Invalid frontmatter in ${(0,
|
|
9685
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9576
9686
|
);
|
|
9577
9687
|
}
|
|
9578
9688
|
return new _CursorSkill({
|
|
@@ -9607,7 +9717,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
9607
9717
|
};
|
|
9608
9718
|
|
|
9609
9719
|
// src/features/skills/geminicli-skill.ts
|
|
9610
|
-
var
|
|
9720
|
+
var import_node_path72 = require("path");
|
|
9611
9721
|
var import_mini33 = require("zod/mini");
|
|
9612
9722
|
var GeminiCliSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9613
9723
|
name: import_mini33.z.string(),
|
|
@@ -9647,7 +9757,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9647
9757
|
global: _global = false
|
|
9648
9758
|
} = {}) {
|
|
9649
9759
|
return {
|
|
9650
|
-
relativeDirPath: (0,
|
|
9760
|
+
relativeDirPath: (0, import_node_path72.join)(".gemini", "skills")
|
|
9651
9761
|
};
|
|
9652
9762
|
}
|
|
9653
9763
|
getFrontmatter() {
|
|
@@ -9727,9 +9837,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9727
9837
|
});
|
|
9728
9838
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9729
9839
|
if (!result.success) {
|
|
9730
|
-
const skillDirPath = (0,
|
|
9840
|
+
const skillDirPath = (0, import_node_path72.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9731
9841
|
throw new Error(
|
|
9732
|
-
`Invalid frontmatter in ${(0,
|
|
9842
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9733
9843
|
);
|
|
9734
9844
|
}
|
|
9735
9845
|
return new _GeminiCliSkill({
|
|
@@ -9764,7 +9874,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9764
9874
|
};
|
|
9765
9875
|
|
|
9766
9876
|
// src/features/skills/junie-skill.ts
|
|
9767
|
-
var
|
|
9877
|
+
var import_node_path73 = require("path");
|
|
9768
9878
|
var import_mini34 = require("zod/mini");
|
|
9769
9879
|
var JunieSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9770
9880
|
name: import_mini34.z.string(),
|
|
@@ -9773,7 +9883,7 @@ var JunieSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
|
9773
9883
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9774
9884
|
constructor({
|
|
9775
9885
|
baseDir = process.cwd(),
|
|
9776
|
-
relativeDirPath = (0,
|
|
9886
|
+
relativeDirPath = (0, import_node_path73.join)(".junie", "skills"),
|
|
9777
9887
|
dirName,
|
|
9778
9888
|
frontmatter,
|
|
9779
9889
|
body,
|
|
@@ -9805,7 +9915,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9805
9915
|
throw new Error("JunieSkill does not support global mode.");
|
|
9806
9916
|
}
|
|
9807
9917
|
return {
|
|
9808
|
-
relativeDirPath: (0,
|
|
9918
|
+
relativeDirPath: (0, import_node_path73.join)(".junie", "skills")
|
|
9809
9919
|
};
|
|
9810
9920
|
}
|
|
9811
9921
|
getFrontmatter() {
|
|
@@ -9892,13 +10002,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9892
10002
|
});
|
|
9893
10003
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9894
10004
|
if (!result.success) {
|
|
9895
|
-
const skillDirPath = (0,
|
|
10005
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9896
10006
|
throw new Error(
|
|
9897
|
-
`Invalid frontmatter in ${(0,
|
|
10007
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9898
10008
|
);
|
|
9899
10009
|
}
|
|
9900
10010
|
if (result.data.name !== loaded.dirName) {
|
|
9901
|
-
const skillFilePath = (0,
|
|
10011
|
+
const skillFilePath = (0, import_node_path73.join)(
|
|
9902
10012
|
loaded.baseDir,
|
|
9903
10013
|
loaded.relativeDirPath,
|
|
9904
10014
|
loaded.dirName,
|
|
@@ -9940,7 +10050,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
9940
10050
|
};
|
|
9941
10051
|
|
|
9942
10052
|
// src/features/skills/kilo-skill.ts
|
|
9943
|
-
var
|
|
10053
|
+
var import_node_path74 = require("path");
|
|
9944
10054
|
var import_mini35 = require("zod/mini");
|
|
9945
10055
|
var KiloSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
9946
10056
|
name: import_mini35.z.string(),
|
|
@@ -9949,7 +10059,7 @@ var KiloSkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
|
9949
10059
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
9950
10060
|
constructor({
|
|
9951
10061
|
baseDir = process.cwd(),
|
|
9952
|
-
relativeDirPath = (0,
|
|
10062
|
+
relativeDirPath = (0, import_node_path74.join)(".kilocode", "skills"),
|
|
9953
10063
|
dirName,
|
|
9954
10064
|
frontmatter,
|
|
9955
10065
|
body,
|
|
@@ -9980,7 +10090,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9980
10090
|
global: _global = false
|
|
9981
10091
|
} = {}) {
|
|
9982
10092
|
return {
|
|
9983
|
-
relativeDirPath: (0,
|
|
10093
|
+
relativeDirPath: (0, import_node_path74.join)(".kilocode", "skills")
|
|
9984
10094
|
};
|
|
9985
10095
|
}
|
|
9986
10096
|
getFrontmatter() {
|
|
@@ -10068,13 +10178,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10068
10178
|
});
|
|
10069
10179
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10070
10180
|
if (!result.success) {
|
|
10071
|
-
const skillDirPath = (0,
|
|
10181
|
+
const skillDirPath = (0, import_node_path74.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10072
10182
|
throw new Error(
|
|
10073
|
-
`Invalid frontmatter in ${(0,
|
|
10183
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10074
10184
|
);
|
|
10075
10185
|
}
|
|
10076
10186
|
if (result.data.name !== loaded.dirName) {
|
|
10077
|
-
const skillFilePath = (0,
|
|
10187
|
+
const skillFilePath = (0, import_node_path74.join)(
|
|
10078
10188
|
loaded.baseDir,
|
|
10079
10189
|
loaded.relativeDirPath,
|
|
10080
10190
|
loaded.dirName,
|
|
@@ -10115,7 +10225,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
10115
10225
|
};
|
|
10116
10226
|
|
|
10117
10227
|
// src/features/skills/kiro-skill.ts
|
|
10118
|
-
var
|
|
10228
|
+
var import_node_path75 = require("path");
|
|
10119
10229
|
var import_mini36 = require("zod/mini");
|
|
10120
10230
|
var KiroSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
10121
10231
|
name: import_mini36.z.string(),
|
|
@@ -10124,7 +10234,7 @@ var KiroSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
|
10124
10234
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
10125
10235
|
constructor({
|
|
10126
10236
|
baseDir = process.cwd(),
|
|
10127
|
-
relativeDirPath = (0,
|
|
10237
|
+
relativeDirPath = (0, import_node_path75.join)(".kiro", "skills"),
|
|
10128
10238
|
dirName,
|
|
10129
10239
|
frontmatter,
|
|
10130
10240
|
body,
|
|
@@ -10156,7 +10266,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10156
10266
|
throw new Error("KiroSkill does not support global mode.");
|
|
10157
10267
|
}
|
|
10158
10268
|
return {
|
|
10159
|
-
relativeDirPath: (0,
|
|
10269
|
+
relativeDirPath: (0, import_node_path75.join)(".kiro", "skills")
|
|
10160
10270
|
};
|
|
10161
10271
|
}
|
|
10162
10272
|
getFrontmatter() {
|
|
@@ -10244,13 +10354,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10244
10354
|
});
|
|
10245
10355
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10246
10356
|
if (!result.success) {
|
|
10247
|
-
const skillDirPath = (0,
|
|
10357
|
+
const skillDirPath = (0, import_node_path75.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10248
10358
|
throw new Error(
|
|
10249
|
-
`Invalid frontmatter in ${(0,
|
|
10359
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10250
10360
|
);
|
|
10251
10361
|
}
|
|
10252
10362
|
if (result.data.name !== loaded.dirName) {
|
|
10253
|
-
const skillFilePath = (0,
|
|
10363
|
+
const skillFilePath = (0, import_node_path75.join)(
|
|
10254
10364
|
loaded.baseDir,
|
|
10255
10365
|
loaded.relativeDirPath,
|
|
10256
10366
|
loaded.dirName,
|
|
@@ -10292,7 +10402,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
10292
10402
|
};
|
|
10293
10403
|
|
|
10294
10404
|
// src/features/skills/opencode-skill.ts
|
|
10295
|
-
var
|
|
10405
|
+
var import_node_path76 = require("path");
|
|
10296
10406
|
var import_mini37 = require("zod/mini");
|
|
10297
10407
|
var OpenCodeSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10298
10408
|
name: import_mini37.z.string(),
|
|
@@ -10302,7 +10412,7 @@ var OpenCodeSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
|
10302
10412
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
10303
10413
|
constructor({
|
|
10304
10414
|
baseDir = process.cwd(),
|
|
10305
|
-
relativeDirPath = (0,
|
|
10415
|
+
relativeDirPath = (0, import_node_path76.join)(".opencode", "skill"),
|
|
10306
10416
|
dirName,
|
|
10307
10417
|
frontmatter,
|
|
10308
10418
|
body,
|
|
@@ -10331,7 +10441,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10331
10441
|
}
|
|
10332
10442
|
static getSettablePaths({ global = false } = {}) {
|
|
10333
10443
|
return {
|
|
10334
|
-
relativeDirPath: global ? (0,
|
|
10444
|
+
relativeDirPath: global ? (0, import_node_path76.join)(".config", "opencode", "skill") : (0, import_node_path76.join)(".opencode", "skill")
|
|
10335
10445
|
};
|
|
10336
10446
|
}
|
|
10337
10447
|
getFrontmatter() {
|
|
@@ -10417,9 +10527,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10417
10527
|
});
|
|
10418
10528
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10419
10529
|
if (!result.success) {
|
|
10420
|
-
const skillDirPath = (0,
|
|
10530
|
+
const skillDirPath = (0, import_node_path76.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10421
10531
|
throw new Error(
|
|
10422
|
-
`Invalid frontmatter in ${(0,
|
|
10532
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10423
10533
|
);
|
|
10424
10534
|
}
|
|
10425
10535
|
return new _OpenCodeSkill({
|
|
@@ -10453,7 +10563,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
10453
10563
|
};
|
|
10454
10564
|
|
|
10455
10565
|
// src/features/skills/replit-skill.ts
|
|
10456
|
-
var
|
|
10566
|
+
var import_node_path77 = require("path");
|
|
10457
10567
|
var import_mini38 = require("zod/mini");
|
|
10458
10568
|
var ReplitSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
10459
10569
|
name: import_mini38.z.string(),
|
|
@@ -10462,7 +10572,7 @@ var ReplitSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
|
10462
10572
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
10463
10573
|
constructor({
|
|
10464
10574
|
baseDir = process.cwd(),
|
|
10465
|
-
relativeDirPath = (0,
|
|
10575
|
+
relativeDirPath = (0, import_node_path77.join)(".agents", "skills"),
|
|
10466
10576
|
dirName,
|
|
10467
10577
|
frontmatter,
|
|
10468
10578
|
body,
|
|
@@ -10494,7 +10604,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10494
10604
|
throw new Error("ReplitSkill does not support global mode.");
|
|
10495
10605
|
}
|
|
10496
10606
|
return {
|
|
10497
|
-
relativeDirPath: (0,
|
|
10607
|
+
relativeDirPath: (0, import_node_path77.join)(".agents", "skills")
|
|
10498
10608
|
};
|
|
10499
10609
|
}
|
|
10500
10610
|
getFrontmatter() {
|
|
@@ -10574,9 +10684,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10574
10684
|
});
|
|
10575
10685
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10576
10686
|
if (!result.success) {
|
|
10577
|
-
const skillDirPath = (0,
|
|
10687
|
+
const skillDirPath = (0, import_node_path77.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10578
10688
|
throw new Error(
|
|
10579
|
-
`Invalid frontmatter in ${(0,
|
|
10689
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10580
10690
|
);
|
|
10581
10691
|
}
|
|
10582
10692
|
return new _ReplitSkill({
|
|
@@ -10611,7 +10721,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10611
10721
|
};
|
|
10612
10722
|
|
|
10613
10723
|
// src/features/skills/roo-skill.ts
|
|
10614
|
-
var
|
|
10724
|
+
var import_node_path78 = require("path");
|
|
10615
10725
|
var import_mini39 = require("zod/mini");
|
|
10616
10726
|
var RooSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
10617
10727
|
name: import_mini39.z.string(),
|
|
@@ -10620,7 +10730,7 @@ var RooSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
|
10620
10730
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10621
10731
|
constructor({
|
|
10622
10732
|
baseDir = process.cwd(),
|
|
10623
|
-
relativeDirPath = (0,
|
|
10733
|
+
relativeDirPath = (0, import_node_path78.join)(".roo", "skills"),
|
|
10624
10734
|
dirName,
|
|
10625
10735
|
frontmatter,
|
|
10626
10736
|
body,
|
|
@@ -10651,7 +10761,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10651
10761
|
global: _global = false
|
|
10652
10762
|
} = {}) {
|
|
10653
10763
|
return {
|
|
10654
|
-
relativeDirPath: (0,
|
|
10764
|
+
relativeDirPath: (0, import_node_path78.join)(".roo", "skills")
|
|
10655
10765
|
};
|
|
10656
10766
|
}
|
|
10657
10767
|
getFrontmatter() {
|
|
@@ -10739,13 +10849,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10739
10849
|
});
|
|
10740
10850
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10741
10851
|
if (!result.success) {
|
|
10742
|
-
const skillDirPath = (0,
|
|
10852
|
+
const skillDirPath = (0, import_node_path78.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10743
10853
|
throw new Error(
|
|
10744
|
-
`Invalid frontmatter in ${(0,
|
|
10854
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10745
10855
|
);
|
|
10746
10856
|
}
|
|
10747
10857
|
if (result.data.name !== loaded.dirName) {
|
|
10748
|
-
const skillFilePath = (0,
|
|
10858
|
+
const skillFilePath = (0, import_node_path78.join)(
|
|
10749
10859
|
loaded.baseDir,
|
|
10750
10860
|
loaded.relativeDirPath,
|
|
10751
10861
|
loaded.dirName,
|
|
@@ -10786,17 +10896,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10786
10896
|
};
|
|
10787
10897
|
|
|
10788
10898
|
// src/features/skills/skills-utils.ts
|
|
10789
|
-
var
|
|
10899
|
+
var import_node_path79 = require("path");
|
|
10790
10900
|
async function getLocalSkillDirNames(baseDir) {
|
|
10791
|
-
const skillsDir = (0,
|
|
10901
|
+
const skillsDir = (0, import_node_path79.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10792
10902
|
const names = /* @__PURE__ */ new Set();
|
|
10793
10903
|
if (!await directoryExists(skillsDir)) {
|
|
10794
10904
|
return names;
|
|
10795
10905
|
}
|
|
10796
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
10906
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path79.join)(skillsDir, "*"), { type: "dir" });
|
|
10797
10907
|
for (const dirPath of dirPaths) {
|
|
10798
|
-
const name = (0,
|
|
10799
|
-
if (name === (0,
|
|
10908
|
+
const name = (0, import_node_path79.basename)(dirPath);
|
|
10909
|
+
if (name === (0, import_node_path79.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
10800
10910
|
names.add(name);
|
|
10801
10911
|
}
|
|
10802
10912
|
return names;
|
|
@@ -10891,7 +11001,7 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
10891
11001
|
"factorydroid",
|
|
10892
11002
|
{
|
|
10893
11003
|
class: FactorydroidSkill,
|
|
10894
|
-
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal:
|
|
11004
|
+
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
10895
11005
|
}
|
|
10896
11006
|
],
|
|
10897
11007
|
[
|
|
@@ -10975,9 +11085,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10975
11085
|
toolTarget,
|
|
10976
11086
|
global = false,
|
|
10977
11087
|
getFactory = defaultGetFactory4,
|
|
10978
|
-
dryRun = false
|
|
11088
|
+
dryRun = false,
|
|
11089
|
+
logger
|
|
10979
11090
|
}) {
|
|
10980
|
-
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor" });
|
|
11091
|
+
super({ baseDir, dryRun, avoidBlockScalars: toolTarget === "cursor", logger });
|
|
10981
11092
|
const result = SkillsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
10982
11093
|
if (!result.success) {
|
|
10983
11094
|
throw new Error(
|
|
@@ -11010,7 +11121,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11010
11121
|
const rulesyncSkills = [];
|
|
11011
11122
|
for (const toolSkill of toolSkills) {
|
|
11012
11123
|
if (toolSkill instanceof SimulatedSkill) {
|
|
11013
|
-
logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11124
|
+
this.logger.debug(`Skipping simulated skill conversion: ${toolSkill.getDirPath()}`);
|
|
11014
11125
|
continue;
|
|
11015
11126
|
}
|
|
11016
11127
|
rulesyncSkills.push(toolSkill.toRulesyncSkill());
|
|
@@ -11031,14 +11142,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11031
11142
|
)
|
|
11032
11143
|
);
|
|
11033
11144
|
const localSkillNames = new Set(localDirNames);
|
|
11034
|
-
const curatedDirPath = (0,
|
|
11145
|
+
const curatedDirPath = (0, import_node_path80.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
11035
11146
|
let curatedSkills = [];
|
|
11036
11147
|
if (await directoryExists(curatedDirPath)) {
|
|
11037
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
11038
|
-
const curatedDirNames = curatedDirPaths.map((path3) => (0,
|
|
11148
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path80.join)(curatedDirPath, "*"), { type: "dir" });
|
|
11149
|
+
const curatedDirNames = curatedDirPaths.map((path3) => (0, import_node_path80.basename)(path3));
|
|
11039
11150
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
11040
11151
|
if (localSkillNames.has(name)) {
|
|
11041
|
-
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11152
|
+
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
11042
11153
|
return false;
|
|
11043
11154
|
}
|
|
11044
11155
|
return true;
|
|
@@ -11056,7 +11167,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11056
11167
|
);
|
|
11057
11168
|
}
|
|
11058
11169
|
const allSkills = [...localSkills, ...curatedSkills];
|
|
11059
|
-
logger.debug(
|
|
11170
|
+
this.logger.debug(
|
|
11060
11171
|
`Successfully loaded ${allSkills.length} rulesync skills (${localSkills.length} local, ${curatedSkills.length} curated)`
|
|
11061
11172
|
);
|
|
11062
11173
|
return allSkills;
|
|
@@ -11068,9 +11179,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11068
11179
|
async loadToolDirs() {
|
|
11069
11180
|
const factory = this.getFactory(this.toolTarget);
|
|
11070
11181
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11071
|
-
const skillsDirPath = (0,
|
|
11072
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
11073
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
11182
|
+
const skillsDirPath = (0, import_node_path80.join)(this.baseDir, paths.relativeDirPath);
|
|
11183
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path80.join)(skillsDirPath, "*"), { type: "dir" });
|
|
11184
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path80.basename)(path3));
|
|
11074
11185
|
const toolSkills = await Promise.all(
|
|
11075
11186
|
dirNames.map(
|
|
11076
11187
|
(dirName) => factory.class.fromDir({
|
|
@@ -11080,15 +11191,15 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11080
11191
|
})
|
|
11081
11192
|
)
|
|
11082
11193
|
);
|
|
11083
|
-
logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11194
|
+
this.logger.debug(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
11084
11195
|
return toolSkills;
|
|
11085
11196
|
}
|
|
11086
11197
|
async loadToolDirsToDelete() {
|
|
11087
11198
|
const factory = this.getFactory(this.toolTarget);
|
|
11088
11199
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11089
|
-
const skillsDirPath = (0,
|
|
11090
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
11091
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
11200
|
+
const skillsDirPath = (0, import_node_path80.join)(this.baseDir, paths.relativeDirPath);
|
|
11201
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path80.join)(skillsDirPath, "*"), { type: "dir" });
|
|
11202
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path80.basename)(path3));
|
|
11092
11203
|
const toolSkills = dirNames.map(
|
|
11093
11204
|
(dirName) => factory.class.forDeletion({
|
|
11094
11205
|
baseDir: this.baseDir,
|
|
@@ -11097,7 +11208,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11097
11208
|
global: this.global
|
|
11098
11209
|
})
|
|
11099
11210
|
);
|
|
11100
|
-
logger.debug(
|
|
11211
|
+
this.logger.debug(
|
|
11101
11212
|
`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills for deletion`
|
|
11102
11213
|
);
|
|
11103
11214
|
return toolSkills;
|
|
@@ -11149,10 +11260,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
11149
11260
|
};
|
|
11150
11261
|
|
|
11151
11262
|
// src/features/subagents/agentsmd-subagent.ts
|
|
11152
|
-
var
|
|
11263
|
+
var import_node_path82 = require("path");
|
|
11153
11264
|
|
|
11154
11265
|
// src/features/subagents/simulated-subagent.ts
|
|
11155
|
-
var
|
|
11266
|
+
var import_node_path81 = require("path");
|
|
11156
11267
|
var import_mini41 = require("zod/mini");
|
|
11157
11268
|
|
|
11158
11269
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -11217,7 +11328,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11217
11328
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11218
11329
|
if (!result.success) {
|
|
11219
11330
|
throw new Error(
|
|
11220
|
-
`Invalid frontmatter in ${(0,
|
|
11331
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11221
11332
|
);
|
|
11222
11333
|
}
|
|
11223
11334
|
}
|
|
@@ -11268,7 +11379,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11268
11379
|
return {
|
|
11269
11380
|
success: false,
|
|
11270
11381
|
error: new Error(
|
|
11271
|
-
`Invalid frontmatter in ${(0,
|
|
11382
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11272
11383
|
)
|
|
11273
11384
|
};
|
|
11274
11385
|
}
|
|
@@ -11278,7 +11389,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11278
11389
|
relativeFilePath,
|
|
11279
11390
|
validate = true
|
|
11280
11391
|
}) {
|
|
11281
|
-
const filePath = (0,
|
|
11392
|
+
const filePath = (0, import_node_path81.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
11282
11393
|
const fileContent = await readFileContent(filePath);
|
|
11283
11394
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11284
11395
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11288,7 +11399,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11288
11399
|
return {
|
|
11289
11400
|
baseDir,
|
|
11290
11401
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
11291
|
-
relativeFilePath: (0,
|
|
11402
|
+
relativeFilePath: (0, import_node_path81.basename)(relativeFilePath),
|
|
11292
11403
|
frontmatter: result.data,
|
|
11293
11404
|
body: content.trim(),
|
|
11294
11405
|
validate
|
|
@@ -11314,7 +11425,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
11314
11425
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
11315
11426
|
static getSettablePaths() {
|
|
11316
11427
|
return {
|
|
11317
|
-
relativeDirPath: (0,
|
|
11428
|
+
relativeDirPath: (0, import_node_path82.join)(".agents", "subagents")
|
|
11318
11429
|
};
|
|
11319
11430
|
}
|
|
11320
11431
|
static async fromFile(params) {
|
|
@@ -11337,11 +11448,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
11337
11448
|
};
|
|
11338
11449
|
|
|
11339
11450
|
// src/features/subagents/factorydroid-subagent.ts
|
|
11340
|
-
var
|
|
11451
|
+
var import_node_path83 = require("path");
|
|
11341
11452
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
11342
11453
|
static getSettablePaths(_options) {
|
|
11343
11454
|
return {
|
|
11344
|
-
relativeDirPath: (0,
|
|
11455
|
+
relativeDirPath: (0, import_node_path83.join)(".factory", "droids")
|
|
11345
11456
|
};
|
|
11346
11457
|
}
|
|
11347
11458
|
static async fromFile(params) {
|
|
@@ -11364,11 +11475,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
11364
11475
|
};
|
|
11365
11476
|
|
|
11366
11477
|
// src/features/subagents/geminicli-subagent.ts
|
|
11367
|
-
var
|
|
11478
|
+
var import_node_path84 = require("path");
|
|
11368
11479
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
11369
11480
|
static getSettablePaths() {
|
|
11370
11481
|
return {
|
|
11371
|
-
relativeDirPath: (0,
|
|
11482
|
+
relativeDirPath: (0, import_node_path84.join)(".gemini", "subagents")
|
|
11372
11483
|
};
|
|
11373
11484
|
}
|
|
11374
11485
|
static async fromFile(params) {
|
|
@@ -11391,11 +11502,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
11391
11502
|
};
|
|
11392
11503
|
|
|
11393
11504
|
// src/features/subagents/roo-subagent.ts
|
|
11394
|
-
var
|
|
11505
|
+
var import_node_path85 = require("path");
|
|
11395
11506
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
11396
11507
|
static getSettablePaths() {
|
|
11397
11508
|
return {
|
|
11398
|
-
relativeDirPath: (0,
|
|
11509
|
+
relativeDirPath: (0, import_node_path85.join)(".roo", "subagents")
|
|
11399
11510
|
};
|
|
11400
11511
|
}
|
|
11401
11512
|
static async fromFile(params) {
|
|
@@ -11418,15 +11529,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
11418
11529
|
};
|
|
11419
11530
|
|
|
11420
11531
|
// src/features/subagents/subagents-processor.ts
|
|
11421
|
-
var
|
|
11532
|
+
var import_node_path94 = require("path");
|
|
11422
11533
|
var import_mini50 = require("zod/mini");
|
|
11423
11534
|
|
|
11424
11535
|
// src/features/subagents/claudecode-subagent.ts
|
|
11425
|
-
var
|
|
11536
|
+
var import_node_path87 = require("path");
|
|
11426
11537
|
var import_mini43 = require("zod/mini");
|
|
11427
11538
|
|
|
11428
11539
|
// src/features/subagents/rulesync-subagent.ts
|
|
11429
|
-
var
|
|
11540
|
+
var import_node_path86 = require("path");
|
|
11430
11541
|
var import_mini42 = require("zod/mini");
|
|
11431
11542
|
var RulesyncSubagentFrontmatterSchema = import_mini42.z.looseObject({
|
|
11432
11543
|
targets: import_mini42.z._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -11440,7 +11551,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11440
11551
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11441
11552
|
if (!parseResult.success && rest.validate !== false) {
|
|
11442
11553
|
throw new Error(
|
|
11443
|
-
`Invalid frontmatter in ${(0,
|
|
11554
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11444
11555
|
);
|
|
11445
11556
|
}
|
|
11446
11557
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -11473,7 +11584,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11473
11584
|
return {
|
|
11474
11585
|
success: false,
|
|
11475
11586
|
error: new Error(
|
|
11476
|
-
`Invalid frontmatter in ${(0,
|
|
11587
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11477
11588
|
)
|
|
11478
11589
|
};
|
|
11479
11590
|
}
|
|
@@ -11481,14 +11592,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
11481
11592
|
static async fromFile({
|
|
11482
11593
|
relativeFilePath
|
|
11483
11594
|
}) {
|
|
11484
|
-
const filePath = (0,
|
|
11595
|
+
const filePath = (0, import_node_path86.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
11485
11596
|
const fileContent = await readFileContent(filePath);
|
|
11486
11597
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11487
11598
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11488
11599
|
if (!result.success) {
|
|
11489
11600
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
11490
11601
|
}
|
|
11491
|
-
const filename = (0,
|
|
11602
|
+
const filename = (0, import_node_path86.basename)(relativeFilePath);
|
|
11492
11603
|
return new _RulesyncSubagent({
|
|
11493
11604
|
baseDir: process.cwd(),
|
|
11494
11605
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -11516,7 +11627,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11516
11627
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11517
11628
|
if (!result.success) {
|
|
11518
11629
|
throw new Error(
|
|
11519
|
-
`Invalid frontmatter in ${(0,
|
|
11630
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11520
11631
|
);
|
|
11521
11632
|
}
|
|
11522
11633
|
}
|
|
@@ -11528,7 +11639,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11528
11639
|
}
|
|
11529
11640
|
static getSettablePaths(_options = {}) {
|
|
11530
11641
|
return {
|
|
11531
|
-
relativeDirPath: (0,
|
|
11642
|
+
relativeDirPath: (0, import_node_path87.join)(".claude", "agents")
|
|
11532
11643
|
};
|
|
11533
11644
|
}
|
|
11534
11645
|
getFrontmatter() {
|
|
@@ -11607,7 +11718,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11607
11718
|
return {
|
|
11608
11719
|
success: false,
|
|
11609
11720
|
error: new Error(
|
|
11610
|
-
`Invalid frontmatter in ${(0,
|
|
11721
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11611
11722
|
)
|
|
11612
11723
|
};
|
|
11613
11724
|
}
|
|
@@ -11625,7 +11736,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11625
11736
|
global = false
|
|
11626
11737
|
}) {
|
|
11627
11738
|
const paths = this.getSettablePaths({ global });
|
|
11628
|
-
const filePath = (0,
|
|
11739
|
+
const filePath = (0, import_node_path87.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11629
11740
|
const fileContent = await readFileContent(filePath);
|
|
11630
11741
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11631
11742
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11660,7 +11771,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11660
11771
|
};
|
|
11661
11772
|
|
|
11662
11773
|
// src/features/subagents/codexcli-subagent.ts
|
|
11663
|
-
var
|
|
11774
|
+
var import_node_path88 = require("path");
|
|
11664
11775
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
11665
11776
|
var import_mini44 = require("zod/mini");
|
|
11666
11777
|
var CodexCliSubagentTomlSchema = import_mini44.z.looseObject({
|
|
@@ -11680,7 +11791,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11680
11791
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11681
11792
|
} catch (error) {
|
|
11682
11793
|
throw new Error(
|
|
11683
|
-
`Invalid TOML in ${(0,
|
|
11794
|
+
`Invalid TOML in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11684
11795
|
{ cause: error }
|
|
11685
11796
|
);
|
|
11686
11797
|
}
|
|
@@ -11692,7 +11803,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11692
11803
|
}
|
|
11693
11804
|
static getSettablePaths(_options = {}) {
|
|
11694
11805
|
return {
|
|
11695
|
-
relativeDirPath: (0,
|
|
11806
|
+
relativeDirPath: (0, import_node_path88.join)(".codex", "agents")
|
|
11696
11807
|
};
|
|
11697
11808
|
}
|
|
11698
11809
|
getBody() {
|
|
@@ -11704,7 +11815,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11704
11815
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11705
11816
|
} catch (error) {
|
|
11706
11817
|
throw new Error(
|
|
11707
|
-
`Failed to parse TOML in ${(0,
|
|
11818
|
+
`Failed to parse TOML in ${(0, import_node_path88.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11708
11819
|
{ cause: error }
|
|
11709
11820
|
);
|
|
11710
11821
|
}
|
|
@@ -11785,7 +11896,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11785
11896
|
global = false
|
|
11786
11897
|
}) {
|
|
11787
11898
|
const paths = this.getSettablePaths({ global });
|
|
11788
|
-
const filePath = (0,
|
|
11899
|
+
const filePath = (0, import_node_path88.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11789
11900
|
const fileContent = await readFileContent(filePath);
|
|
11790
11901
|
const subagent = new _CodexCliSubagent({
|
|
11791
11902
|
baseDir,
|
|
@@ -11823,7 +11934,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11823
11934
|
};
|
|
11824
11935
|
|
|
11825
11936
|
// src/features/subagents/copilot-subagent.ts
|
|
11826
|
-
var
|
|
11937
|
+
var import_node_path89 = require("path");
|
|
11827
11938
|
var import_mini45 = require("zod/mini");
|
|
11828
11939
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11829
11940
|
var CopilotSubagentFrontmatterSchema = import_mini45.z.looseObject({
|
|
@@ -11849,7 +11960,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11849
11960
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11850
11961
|
if (!result.success) {
|
|
11851
11962
|
throw new Error(
|
|
11852
|
-
`Invalid frontmatter in ${(0,
|
|
11963
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11853
11964
|
);
|
|
11854
11965
|
}
|
|
11855
11966
|
}
|
|
@@ -11861,7 +11972,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11861
11972
|
}
|
|
11862
11973
|
static getSettablePaths(_options = {}) {
|
|
11863
11974
|
return {
|
|
11864
|
-
relativeDirPath: (0,
|
|
11975
|
+
relativeDirPath: (0, import_node_path89.join)(".github", "agents")
|
|
11865
11976
|
};
|
|
11866
11977
|
}
|
|
11867
11978
|
getFrontmatter() {
|
|
@@ -11935,7 +12046,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11935
12046
|
return {
|
|
11936
12047
|
success: false,
|
|
11937
12048
|
error: new Error(
|
|
11938
|
-
`Invalid frontmatter in ${(0,
|
|
12049
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11939
12050
|
)
|
|
11940
12051
|
};
|
|
11941
12052
|
}
|
|
@@ -11953,7 +12064,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11953
12064
|
global = false
|
|
11954
12065
|
}) {
|
|
11955
12066
|
const paths = this.getSettablePaths({ global });
|
|
11956
|
-
const filePath = (0,
|
|
12067
|
+
const filePath = (0, import_node_path89.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11957
12068
|
const fileContent = await readFileContent(filePath);
|
|
11958
12069
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11959
12070
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11989,7 +12100,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11989
12100
|
};
|
|
11990
12101
|
|
|
11991
12102
|
// src/features/subagents/cursor-subagent.ts
|
|
11992
|
-
var
|
|
12103
|
+
var import_node_path90 = require("path");
|
|
11993
12104
|
var import_mini46 = require("zod/mini");
|
|
11994
12105
|
var CursorSubagentFrontmatterSchema = import_mini46.z.looseObject({
|
|
11995
12106
|
name: import_mini46.z.string(),
|
|
@@ -12003,7 +12114,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12003
12114
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12004
12115
|
if (!result.success) {
|
|
12005
12116
|
throw new Error(
|
|
12006
|
-
`Invalid frontmatter in ${(0,
|
|
12117
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12007
12118
|
);
|
|
12008
12119
|
}
|
|
12009
12120
|
}
|
|
@@ -12015,7 +12126,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12015
12126
|
}
|
|
12016
12127
|
static getSettablePaths(_options = {}) {
|
|
12017
12128
|
return {
|
|
12018
|
-
relativeDirPath: (0,
|
|
12129
|
+
relativeDirPath: (0, import_node_path90.join)(".cursor", "agents")
|
|
12019
12130
|
};
|
|
12020
12131
|
}
|
|
12021
12132
|
getFrontmatter() {
|
|
@@ -12082,7 +12193,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12082
12193
|
return {
|
|
12083
12194
|
success: false,
|
|
12084
12195
|
error: new Error(
|
|
12085
|
-
`Invalid frontmatter in ${(0,
|
|
12196
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12086
12197
|
)
|
|
12087
12198
|
};
|
|
12088
12199
|
}
|
|
@@ -12100,7 +12211,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12100
12211
|
global = false
|
|
12101
12212
|
}) {
|
|
12102
12213
|
const paths = this.getSettablePaths({ global });
|
|
12103
|
-
const filePath = (0,
|
|
12214
|
+
const filePath = (0, import_node_path90.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12104
12215
|
const fileContent = await readFileContent(filePath);
|
|
12105
12216
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12106
12217
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12136,7 +12247,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
12136
12247
|
};
|
|
12137
12248
|
|
|
12138
12249
|
// src/features/subagents/junie-subagent.ts
|
|
12139
|
-
var
|
|
12250
|
+
var import_node_path91 = require("path");
|
|
12140
12251
|
var import_mini47 = require("zod/mini");
|
|
12141
12252
|
var JunieSubagentFrontmatterSchema = import_mini47.z.looseObject({
|
|
12142
12253
|
name: import_mini47.z.optional(import_mini47.z.string()),
|
|
@@ -12150,7 +12261,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12150
12261
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12151
12262
|
if (!result.success) {
|
|
12152
12263
|
throw new Error(
|
|
12153
|
-
`Invalid frontmatter in ${(0,
|
|
12264
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12154
12265
|
);
|
|
12155
12266
|
}
|
|
12156
12267
|
}
|
|
@@ -12165,7 +12276,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12165
12276
|
throw new Error("JunieSubagent does not support global mode.");
|
|
12166
12277
|
}
|
|
12167
12278
|
return {
|
|
12168
|
-
relativeDirPath: (0,
|
|
12279
|
+
relativeDirPath: (0, import_node_path91.join)(".junie", "agents")
|
|
12169
12280
|
};
|
|
12170
12281
|
}
|
|
12171
12282
|
getFrontmatter() {
|
|
@@ -12241,7 +12352,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12241
12352
|
return {
|
|
12242
12353
|
success: false,
|
|
12243
12354
|
error: new Error(
|
|
12244
|
-
`Invalid frontmatter in ${(0,
|
|
12355
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12245
12356
|
)
|
|
12246
12357
|
};
|
|
12247
12358
|
}
|
|
@@ -12259,7 +12370,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12259
12370
|
global = false
|
|
12260
12371
|
}) {
|
|
12261
12372
|
const paths = this.getSettablePaths({ global });
|
|
12262
|
-
const filePath = (0,
|
|
12373
|
+
const filePath = (0, import_node_path91.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12263
12374
|
const fileContent = await readFileContent(filePath);
|
|
12264
12375
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12265
12376
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12294,7 +12405,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
12294
12405
|
};
|
|
12295
12406
|
|
|
12296
12407
|
// src/features/subagents/kiro-subagent.ts
|
|
12297
|
-
var
|
|
12408
|
+
var import_node_path92 = require("path");
|
|
12298
12409
|
var import_mini48 = require("zod/mini");
|
|
12299
12410
|
var KiroCliSubagentJsonSchema = import_mini48.z.looseObject({
|
|
12300
12411
|
name: import_mini48.z.string(),
|
|
@@ -12321,7 +12432,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12321
12432
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
12322
12433
|
} catch (error) {
|
|
12323
12434
|
throw new Error(
|
|
12324
|
-
`Invalid JSON in ${(0,
|
|
12435
|
+
`Invalid JSON in ${(0, import_node_path92.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12325
12436
|
{ cause: error }
|
|
12326
12437
|
);
|
|
12327
12438
|
}
|
|
@@ -12333,7 +12444,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12333
12444
|
}
|
|
12334
12445
|
static getSettablePaths(_options = {}) {
|
|
12335
12446
|
return {
|
|
12336
|
-
relativeDirPath: (0,
|
|
12447
|
+
relativeDirPath: (0, import_node_path92.join)(".kiro", "agents")
|
|
12337
12448
|
};
|
|
12338
12449
|
}
|
|
12339
12450
|
getBody() {
|
|
@@ -12345,7 +12456,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12345
12456
|
parsed = JSON.parse(this.body);
|
|
12346
12457
|
} catch (error) {
|
|
12347
12458
|
throw new Error(
|
|
12348
|
-
`Failed to parse JSON in ${(0,
|
|
12459
|
+
`Failed to parse JSON in ${(0, import_node_path92.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
12349
12460
|
{ cause: error }
|
|
12350
12461
|
);
|
|
12351
12462
|
}
|
|
@@ -12426,7 +12537,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12426
12537
|
global = false
|
|
12427
12538
|
}) {
|
|
12428
12539
|
const paths = this.getSettablePaths({ global });
|
|
12429
|
-
const filePath = (0,
|
|
12540
|
+
const filePath = (0, import_node_path92.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12430
12541
|
const fileContent = await readFileContent(filePath);
|
|
12431
12542
|
const subagent = new _KiroSubagent({
|
|
12432
12543
|
baseDir,
|
|
@@ -12464,7 +12575,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
12464
12575
|
};
|
|
12465
12576
|
|
|
12466
12577
|
// src/features/subagents/opencode-subagent.ts
|
|
12467
|
-
var
|
|
12578
|
+
var import_node_path93 = require("path");
|
|
12468
12579
|
var import_mini49 = require("zod/mini");
|
|
12469
12580
|
var OpenCodeSubagentFrontmatterSchema = import_mini49.z.looseObject({
|
|
12470
12581
|
description: import_mini49.z.optional(import_mini49.z.string()),
|
|
@@ -12479,7 +12590,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12479
12590
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12480
12591
|
if (!result.success) {
|
|
12481
12592
|
throw new Error(
|
|
12482
|
-
`Invalid frontmatter in ${(0,
|
|
12593
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12483
12594
|
);
|
|
12484
12595
|
}
|
|
12485
12596
|
}
|
|
@@ -12493,7 +12604,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12493
12604
|
global = false
|
|
12494
12605
|
} = {}) {
|
|
12495
12606
|
return {
|
|
12496
|
-
relativeDirPath: global ? (0,
|
|
12607
|
+
relativeDirPath: global ? (0, import_node_path93.join)(".config", "opencode", "agent") : (0, import_node_path93.join)(".opencode", "agent")
|
|
12497
12608
|
};
|
|
12498
12609
|
}
|
|
12499
12610
|
getFrontmatter() {
|
|
@@ -12506,7 +12617,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12506
12617
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
12507
12618
|
const rulesyncFrontmatter = {
|
|
12508
12619
|
targets: ["*"],
|
|
12509
|
-
name: name ?? (0,
|
|
12620
|
+
name: name ?? (0, import_node_path93.basename)(this.getRelativeFilePath(), ".md"),
|
|
12510
12621
|
description,
|
|
12511
12622
|
opencode: { mode, ...opencodeSection }
|
|
12512
12623
|
};
|
|
@@ -12559,7 +12670,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12559
12670
|
return {
|
|
12560
12671
|
success: false,
|
|
12561
12672
|
error: new Error(
|
|
12562
|
-
`Invalid frontmatter in ${(0,
|
|
12673
|
+
`Invalid frontmatter in ${(0, import_node_path93.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12563
12674
|
)
|
|
12564
12675
|
};
|
|
12565
12676
|
}
|
|
@@ -12576,7 +12687,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
12576
12687
|
global = false
|
|
12577
12688
|
}) {
|
|
12578
12689
|
const paths = this.getSettablePaths({ global });
|
|
12579
|
-
const filePath = (0,
|
|
12690
|
+
const filePath = (0, import_node_path93.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12580
12691
|
const fileContent = await readFileContent(filePath);
|
|
12581
12692
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12582
12693
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12653,7 +12764,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
12653
12764
|
"codexcli",
|
|
12654
12765
|
{
|
|
12655
12766
|
class: CodexCliSubagent,
|
|
12656
|
-
meta: { supportsSimulated: false, supportsGlobal:
|
|
12767
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.toml" }
|
|
12657
12768
|
}
|
|
12658
12769
|
],
|
|
12659
12770
|
[
|
|
@@ -12674,7 +12785,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
12674
12785
|
"factorydroid",
|
|
12675
12786
|
{
|
|
12676
12787
|
class: FactorydroidSubagent,
|
|
12677
|
-
meta: { supportsSimulated: true, supportsGlobal:
|
|
12788
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
12678
12789
|
}
|
|
12679
12790
|
],
|
|
12680
12791
|
[
|
|
@@ -12743,9 +12854,10 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12743
12854
|
toolTarget,
|
|
12744
12855
|
global = false,
|
|
12745
12856
|
getFactory = defaultGetFactory5,
|
|
12746
|
-
dryRun = false
|
|
12857
|
+
dryRun = false,
|
|
12858
|
+
logger
|
|
12747
12859
|
}) {
|
|
12748
|
-
super({ baseDir, dryRun });
|
|
12860
|
+
super({ baseDir, dryRun, logger });
|
|
12749
12861
|
const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
12750
12862
|
if (!result.success) {
|
|
12751
12863
|
throw new Error(
|
|
@@ -12781,7 +12893,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12781
12893
|
const rulesyncSubagents = [];
|
|
12782
12894
|
for (const toolSubagent of toolSubagents) {
|
|
12783
12895
|
if (toolSubagent instanceof SimulatedSubagent) {
|
|
12784
|
-
logger.debug(
|
|
12896
|
+
this.logger.debug(
|
|
12785
12897
|
`Skipping simulated subagent conversion: ${toolSubagent.getRelativeFilePath()}`
|
|
12786
12898
|
);
|
|
12787
12899
|
continue;
|
|
@@ -12795,39 +12907,39 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12795
12907
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12796
12908
|
*/
|
|
12797
12909
|
async loadRulesyncFiles() {
|
|
12798
|
-
const subagentsDir = (0,
|
|
12910
|
+
const subagentsDir = (0, import_node_path94.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12799
12911
|
const dirExists = await directoryExists(subagentsDir);
|
|
12800
12912
|
if (!dirExists) {
|
|
12801
|
-
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12913
|
+
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
12802
12914
|
return [];
|
|
12803
12915
|
}
|
|
12804
12916
|
const entries = await listDirectoryFiles(subagentsDir);
|
|
12805
12917
|
const mdFiles = entries.filter((file) => file.endsWith(".md"));
|
|
12806
12918
|
if (mdFiles.length === 0) {
|
|
12807
|
-
logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12919
|
+
this.logger.debug(`No markdown files found in rulesync subagents directory: ${subagentsDir}`);
|
|
12808
12920
|
return [];
|
|
12809
12921
|
}
|
|
12810
|
-
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12922
|
+
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12811
12923
|
const rulesyncSubagents = [];
|
|
12812
12924
|
for (const mdFile of mdFiles) {
|
|
12813
|
-
const filepath = (0,
|
|
12925
|
+
const filepath = (0, import_node_path94.join)(subagentsDir, mdFile);
|
|
12814
12926
|
try {
|
|
12815
12927
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12816
12928
|
relativeFilePath: mdFile,
|
|
12817
12929
|
validate: true
|
|
12818
12930
|
});
|
|
12819
12931
|
rulesyncSubagents.push(rulesyncSubagent);
|
|
12820
|
-
logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12932
|
+
this.logger.debug(`Successfully loaded subagent: ${mdFile}`);
|
|
12821
12933
|
} catch (error) {
|
|
12822
|
-
logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12934
|
+
this.logger.warn(`Failed to load subagent file ${filepath}: ${formatError(error)}`);
|
|
12823
12935
|
continue;
|
|
12824
12936
|
}
|
|
12825
12937
|
}
|
|
12826
12938
|
if (rulesyncSubagents.length === 0) {
|
|
12827
|
-
logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12939
|
+
this.logger.debug(`No valid subagents found in ${subagentsDir}`);
|
|
12828
12940
|
return [];
|
|
12829
12941
|
}
|
|
12830
|
-
logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12942
|
+
this.logger.debug(`Successfully loaded ${rulesyncSubagents.length} rulesync subagents`);
|
|
12831
12943
|
return rulesyncSubagents;
|
|
12832
12944
|
}
|
|
12833
12945
|
/**
|
|
@@ -12840,18 +12952,18 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12840
12952
|
const factory = this.getFactory(this.toolTarget);
|
|
12841
12953
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12842
12954
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12843
|
-
(0,
|
|
12955
|
+
(0, import_node_path94.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12844
12956
|
);
|
|
12845
12957
|
if (forDeletion) {
|
|
12846
12958
|
const toolSubagents2 = subagentFilePaths.map(
|
|
12847
12959
|
(path3) => factory.class.forDeletion({
|
|
12848
12960
|
baseDir: this.baseDir,
|
|
12849
12961
|
relativeDirPath: paths.relativeDirPath,
|
|
12850
|
-
relativeFilePath: (0,
|
|
12962
|
+
relativeFilePath: (0, import_node_path94.basename)(path3),
|
|
12851
12963
|
global: this.global
|
|
12852
12964
|
})
|
|
12853
12965
|
).filter((subagent) => subagent.isDeletable());
|
|
12854
|
-
logger.debug(
|
|
12966
|
+
this.logger.debug(
|
|
12855
12967
|
`Successfully loaded ${toolSubagents2.length} ${paths.relativeDirPath} subagents`
|
|
12856
12968
|
);
|
|
12857
12969
|
return toolSubagents2;
|
|
@@ -12860,12 +12972,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12860
12972
|
subagentFilePaths.map(
|
|
12861
12973
|
(path3) => factory.class.fromFile({
|
|
12862
12974
|
baseDir: this.baseDir,
|
|
12863
|
-
relativeFilePath: (0,
|
|
12975
|
+
relativeFilePath: (0, import_node_path94.basename)(path3),
|
|
12864
12976
|
global: this.global
|
|
12865
12977
|
})
|
|
12866
12978
|
)
|
|
12867
12979
|
);
|
|
12868
|
-
logger.debug(
|
|
12980
|
+
this.logger.debug(
|
|
12981
|
+
`Successfully loaded ${toolSubagents.length} ${paths.relativeDirPath} subagents`
|
|
12982
|
+
);
|
|
12869
12983
|
return toolSubagents;
|
|
12870
12984
|
}
|
|
12871
12985
|
/**
|
|
@@ -12905,13 +13019,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12905
13019
|
};
|
|
12906
13020
|
|
|
12907
13021
|
// src/features/rules/agentsmd-rule.ts
|
|
12908
|
-
var
|
|
13022
|
+
var import_node_path97 = require("path");
|
|
12909
13023
|
|
|
12910
13024
|
// src/features/rules/tool-rule.ts
|
|
12911
|
-
var
|
|
13025
|
+
var import_node_path96 = require("path");
|
|
12912
13026
|
|
|
12913
13027
|
// src/features/rules/rulesync-rule.ts
|
|
12914
|
-
var
|
|
13028
|
+
var import_node_path95 = require("path");
|
|
12915
13029
|
var import_mini51 = require("zod/mini");
|
|
12916
13030
|
var RulesyncRuleFrontmatterSchema = import_mini51.z.object({
|
|
12917
13031
|
root: import_mini51.z.optional(import_mini51.z.boolean()),
|
|
@@ -12958,7 +13072,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12958
13072
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12959
13073
|
if (!parseResult.success && rest.validate !== false) {
|
|
12960
13074
|
throw new Error(
|
|
12961
|
-
`Invalid frontmatter in ${(0,
|
|
13075
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12962
13076
|
);
|
|
12963
13077
|
}
|
|
12964
13078
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -12993,7 +13107,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12993
13107
|
return {
|
|
12994
13108
|
success: false,
|
|
12995
13109
|
error: new Error(
|
|
12996
|
-
`Invalid frontmatter in ${(0,
|
|
13110
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12997
13111
|
)
|
|
12998
13112
|
};
|
|
12999
13113
|
}
|
|
@@ -13002,7 +13116,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
13002
13116
|
relativeFilePath,
|
|
13003
13117
|
validate = true
|
|
13004
13118
|
}) {
|
|
13005
|
-
const filePath = (0,
|
|
13119
|
+
const filePath = (0, import_node_path95.join)(
|
|
13006
13120
|
process.cwd(),
|
|
13007
13121
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
13008
13122
|
relativeFilePath
|
|
@@ -13104,7 +13218,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13104
13218
|
rulesyncRule,
|
|
13105
13219
|
validate = true,
|
|
13106
13220
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
13107
|
-
nonRootPath = { relativeDirPath: (0,
|
|
13221
|
+
nonRootPath = { relativeDirPath: (0, import_node_path96.join)(".agents", "memories") }
|
|
13108
13222
|
}) {
|
|
13109
13223
|
const params = this.buildToolRuleParamsDefault({
|
|
13110
13224
|
baseDir,
|
|
@@ -13115,7 +13229,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13115
13229
|
});
|
|
13116
13230
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
13117
13231
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
13118
|
-
params.relativeDirPath = (0,
|
|
13232
|
+
params.relativeDirPath = (0, import_node_path96.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
13119
13233
|
params.relativeFilePath = "AGENTS.md";
|
|
13120
13234
|
}
|
|
13121
13235
|
return params;
|
|
@@ -13164,7 +13278,7 @@ var ToolRule = class extends ToolFile {
|
|
|
13164
13278
|
}
|
|
13165
13279
|
};
|
|
13166
13280
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
13167
|
-
return excludeToolDir ? subDir : (0,
|
|
13281
|
+
return excludeToolDir ? subDir : (0, import_node_path96.join)(toolDir, subDir);
|
|
13168
13282
|
}
|
|
13169
13283
|
|
|
13170
13284
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -13193,8 +13307,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13193
13307
|
validate = true
|
|
13194
13308
|
}) {
|
|
13195
13309
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
13196
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
13197
|
-
const fileContent = await readFileContent((0,
|
|
13310
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path97.join)(".agents", "memories", relativeFilePath);
|
|
13311
|
+
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
13198
13312
|
return new _AgentsMdRule({
|
|
13199
13313
|
baseDir,
|
|
13200
13314
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13249,7 +13363,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
13249
13363
|
};
|
|
13250
13364
|
|
|
13251
13365
|
// src/features/rules/antigravity-rule.ts
|
|
13252
|
-
var
|
|
13366
|
+
var import_node_path98 = require("path");
|
|
13253
13367
|
var import_mini52 = require("zod/mini");
|
|
13254
13368
|
var AntigravityRuleFrontmatterSchema = import_mini52.z.looseObject({
|
|
13255
13369
|
trigger: import_mini52.z.optional(
|
|
@@ -13408,7 +13522,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13408
13522
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13409
13523
|
if (!result.success) {
|
|
13410
13524
|
throw new Error(
|
|
13411
|
-
`Invalid frontmatter in ${(0,
|
|
13525
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13412
13526
|
);
|
|
13413
13527
|
}
|
|
13414
13528
|
}
|
|
@@ -13432,7 +13546,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13432
13546
|
relativeFilePath,
|
|
13433
13547
|
validate = true
|
|
13434
13548
|
}) {
|
|
13435
|
-
const filePath = (0,
|
|
13549
|
+
const filePath = (0, import_node_path98.join)(
|
|
13436
13550
|
baseDir,
|
|
13437
13551
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13438
13552
|
relativeFilePath
|
|
@@ -13572,7 +13686,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
13572
13686
|
};
|
|
13573
13687
|
|
|
13574
13688
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
13575
|
-
var
|
|
13689
|
+
var import_node_path99 = require("path");
|
|
13576
13690
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
13577
13691
|
toRulesyncRule() {
|
|
13578
13692
|
const rulesyncFrontmatter = {
|
|
@@ -13632,8 +13746,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13632
13746
|
}) {
|
|
13633
13747
|
const settablePaths = this.getSettablePaths();
|
|
13634
13748
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
13635
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
13636
|
-
const fileContent = await readFileContent((0,
|
|
13749
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path99.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13750
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
13637
13751
|
return new _AugmentcodeLegacyRule({
|
|
13638
13752
|
baseDir,
|
|
13639
13753
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -13662,7 +13776,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
13662
13776
|
};
|
|
13663
13777
|
|
|
13664
13778
|
// src/features/rules/augmentcode-rule.ts
|
|
13665
|
-
var
|
|
13779
|
+
var import_node_path100 = require("path");
|
|
13666
13780
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
13667
13781
|
toRulesyncRule() {
|
|
13668
13782
|
return this.toRulesyncRuleDefault();
|
|
@@ -13693,7 +13807,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13693
13807
|
relativeFilePath,
|
|
13694
13808
|
validate = true
|
|
13695
13809
|
}) {
|
|
13696
|
-
const filePath = (0,
|
|
13810
|
+
const filePath = (0, import_node_path100.join)(
|
|
13697
13811
|
baseDir,
|
|
13698
13812
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13699
13813
|
relativeFilePath
|
|
@@ -13733,7 +13847,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13733
13847
|
};
|
|
13734
13848
|
|
|
13735
13849
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13736
|
-
var
|
|
13850
|
+
var import_node_path101 = require("path");
|
|
13737
13851
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13738
13852
|
static getSettablePaths({
|
|
13739
13853
|
global,
|
|
@@ -13775,7 +13889,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13775
13889
|
if (isRoot) {
|
|
13776
13890
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13777
13891
|
const fileContent2 = await readFileContent(
|
|
13778
|
-
(0,
|
|
13892
|
+
(0, import_node_path101.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13779
13893
|
);
|
|
13780
13894
|
return new _ClaudecodeLegacyRule({
|
|
13781
13895
|
baseDir,
|
|
@@ -13789,8 +13903,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13789
13903
|
if (!paths.nonRoot) {
|
|
13790
13904
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13791
13905
|
}
|
|
13792
|
-
const relativePath = (0,
|
|
13793
|
-
const fileContent = await readFileContent((0,
|
|
13906
|
+
const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13907
|
+
const fileContent = await readFileContent((0, import_node_path101.join)(baseDir, relativePath));
|
|
13794
13908
|
return new _ClaudecodeLegacyRule({
|
|
13795
13909
|
baseDir,
|
|
13796
13910
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13849,7 +13963,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13849
13963
|
};
|
|
13850
13964
|
|
|
13851
13965
|
// src/features/rules/claudecode-rule.ts
|
|
13852
|
-
var
|
|
13966
|
+
var import_node_path102 = require("path");
|
|
13853
13967
|
var import_mini53 = require("zod/mini");
|
|
13854
13968
|
var ClaudecodeRuleFrontmatterSchema = import_mini53.z.object({
|
|
13855
13969
|
paths: import_mini53.z.optional(import_mini53.z.array(import_mini53.z.string()))
|
|
@@ -13890,7 +14004,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13890
14004
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13891
14005
|
if (!result.success) {
|
|
13892
14006
|
throw new Error(
|
|
13893
|
-
`Invalid frontmatter in ${(0,
|
|
14007
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13894
14008
|
);
|
|
13895
14009
|
}
|
|
13896
14010
|
}
|
|
@@ -13920,7 +14034,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13920
14034
|
if (isRoot) {
|
|
13921
14035
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13922
14036
|
const fileContent2 = await readFileContent(
|
|
13923
|
-
(0,
|
|
14037
|
+
(0, import_node_path102.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13924
14038
|
);
|
|
13925
14039
|
return new _ClaudecodeRule({
|
|
13926
14040
|
baseDir,
|
|
@@ -13935,8 +14049,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13935
14049
|
if (!paths.nonRoot) {
|
|
13936
14050
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13937
14051
|
}
|
|
13938
|
-
const relativePath = (0,
|
|
13939
|
-
const filePath = (0,
|
|
14052
|
+
const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14053
|
+
const filePath = (0, import_node_path102.join)(baseDir, relativePath);
|
|
13940
14054
|
const fileContent = await readFileContent(filePath);
|
|
13941
14055
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13942
14056
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14047,7 +14161,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14047
14161
|
return {
|
|
14048
14162
|
success: false,
|
|
14049
14163
|
error: new Error(
|
|
14050
|
-
`Invalid frontmatter in ${(0,
|
|
14164
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14051
14165
|
)
|
|
14052
14166
|
};
|
|
14053
14167
|
}
|
|
@@ -14067,7 +14181,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
14067
14181
|
};
|
|
14068
14182
|
|
|
14069
14183
|
// src/features/rules/cline-rule.ts
|
|
14070
|
-
var
|
|
14184
|
+
var import_node_path103 = require("path");
|
|
14071
14185
|
var import_mini54 = require("zod/mini");
|
|
14072
14186
|
var ClineRuleFrontmatterSchema = import_mini54.z.object({
|
|
14073
14187
|
description: import_mini54.z.string()
|
|
@@ -14113,7 +14227,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14113
14227
|
validate = true
|
|
14114
14228
|
}) {
|
|
14115
14229
|
const fileContent = await readFileContent(
|
|
14116
|
-
(0,
|
|
14230
|
+
(0, import_node_path103.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14117
14231
|
);
|
|
14118
14232
|
return new _ClineRule({
|
|
14119
14233
|
baseDir,
|
|
@@ -14139,7 +14253,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
14139
14253
|
};
|
|
14140
14254
|
|
|
14141
14255
|
// src/features/rules/codexcli-rule.ts
|
|
14142
|
-
var
|
|
14256
|
+
var import_node_path104 = require("path");
|
|
14143
14257
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
14144
14258
|
static getSettablePaths({
|
|
14145
14259
|
global,
|
|
@@ -14174,7 +14288,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14174
14288
|
if (isRoot) {
|
|
14175
14289
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14176
14290
|
const fileContent2 = await readFileContent(
|
|
14177
|
-
(0,
|
|
14291
|
+
(0, import_node_path104.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14178
14292
|
);
|
|
14179
14293
|
return new _CodexcliRule({
|
|
14180
14294
|
baseDir,
|
|
@@ -14188,8 +14302,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14188
14302
|
if (!paths.nonRoot) {
|
|
14189
14303
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14190
14304
|
}
|
|
14191
|
-
const relativePath = (0,
|
|
14192
|
-
const fileContent = await readFileContent((0,
|
|
14305
|
+
const relativePath = (0, import_node_path104.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14306
|
+
const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
|
|
14193
14307
|
return new _CodexcliRule({
|
|
14194
14308
|
baseDir,
|
|
14195
14309
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14248,7 +14362,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
14248
14362
|
};
|
|
14249
14363
|
|
|
14250
14364
|
// src/features/rules/copilot-rule.ts
|
|
14251
|
-
var
|
|
14365
|
+
var import_node_path105 = require("path");
|
|
14252
14366
|
var import_mini55 = require("zod/mini");
|
|
14253
14367
|
var CopilotRuleFrontmatterSchema = import_mini55.z.object({
|
|
14254
14368
|
description: import_mini55.z.optional(import_mini55.z.string()),
|
|
@@ -14285,7 +14399,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14285
14399
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14286
14400
|
if (!result.success) {
|
|
14287
14401
|
throw new Error(
|
|
14288
|
-
`Invalid frontmatter in ${(0,
|
|
14402
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14289
14403
|
);
|
|
14290
14404
|
}
|
|
14291
14405
|
}
|
|
@@ -14375,8 +14489,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14375
14489
|
const paths = this.getSettablePaths({ global });
|
|
14376
14490
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14377
14491
|
if (isRoot) {
|
|
14378
|
-
const relativePath2 = (0,
|
|
14379
|
-
const filePath2 = (0,
|
|
14492
|
+
const relativePath2 = (0, import_node_path105.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14493
|
+
const filePath2 = (0, import_node_path105.join)(baseDir, relativePath2);
|
|
14380
14494
|
const fileContent2 = await readFileContent(filePath2);
|
|
14381
14495
|
return new _CopilotRule({
|
|
14382
14496
|
baseDir,
|
|
@@ -14391,8 +14505,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14391
14505
|
if (!paths.nonRoot) {
|
|
14392
14506
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14393
14507
|
}
|
|
14394
|
-
const relativePath = (0,
|
|
14395
|
-
const filePath = (0,
|
|
14508
|
+
const relativePath = (0, import_node_path105.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14509
|
+
const filePath = (0, import_node_path105.join)(baseDir, relativePath);
|
|
14396
14510
|
const fileContent = await readFileContent(filePath);
|
|
14397
14511
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14398
14512
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14438,7 +14552,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14438
14552
|
return {
|
|
14439
14553
|
success: false,
|
|
14440
14554
|
error: new Error(
|
|
14441
|
-
`Invalid frontmatter in ${(0,
|
|
14555
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14442
14556
|
)
|
|
14443
14557
|
};
|
|
14444
14558
|
}
|
|
@@ -14458,7 +14572,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
14458
14572
|
};
|
|
14459
14573
|
|
|
14460
14574
|
// src/features/rules/cursor-rule.ts
|
|
14461
|
-
var
|
|
14575
|
+
var import_node_path106 = require("path");
|
|
14462
14576
|
var import_mini56 = require("zod/mini");
|
|
14463
14577
|
var CursorRuleFrontmatterSchema = import_mini56.z.object({
|
|
14464
14578
|
description: import_mini56.z.optional(import_mini56.z.string()),
|
|
@@ -14480,7 +14594,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14480
14594
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14481
14595
|
if (!result.success) {
|
|
14482
14596
|
throw new Error(
|
|
14483
|
-
`Invalid frontmatter in ${(0,
|
|
14597
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14484
14598
|
);
|
|
14485
14599
|
}
|
|
14486
14600
|
}
|
|
@@ -14596,7 +14710,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14596
14710
|
relativeFilePath,
|
|
14597
14711
|
validate = true
|
|
14598
14712
|
}) {
|
|
14599
|
-
const filePath = (0,
|
|
14713
|
+
const filePath = (0, import_node_path106.join)(
|
|
14600
14714
|
baseDir,
|
|
14601
14715
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
14602
14716
|
relativeFilePath
|
|
@@ -14606,7 +14720,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14606
14720
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14607
14721
|
if (!result.success) {
|
|
14608
14722
|
throw new Error(
|
|
14609
|
-
`Invalid frontmatter in ${(0,
|
|
14723
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
14610
14724
|
);
|
|
14611
14725
|
}
|
|
14612
14726
|
return new _CursorRule({
|
|
@@ -14643,7 +14757,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14643
14757
|
return {
|
|
14644
14758
|
success: false,
|
|
14645
14759
|
error: new Error(
|
|
14646
|
-
`Invalid frontmatter in ${(0,
|
|
14760
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14647
14761
|
)
|
|
14648
14762
|
};
|
|
14649
14763
|
}
|
|
@@ -14663,7 +14777,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
14663
14777
|
};
|
|
14664
14778
|
|
|
14665
14779
|
// src/features/rules/factorydroid-rule.ts
|
|
14666
|
-
var
|
|
14780
|
+
var import_node_path107 = require("path");
|
|
14667
14781
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
14668
14782
|
constructor({ fileContent, root, ...rest }) {
|
|
14669
14783
|
super({
|
|
@@ -14703,8 +14817,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14703
14817
|
const paths = this.getSettablePaths({ global });
|
|
14704
14818
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14705
14819
|
if (isRoot) {
|
|
14706
|
-
const relativePath2 = (0,
|
|
14707
|
-
const fileContent2 = await readFileContent((0,
|
|
14820
|
+
const relativePath2 = (0, import_node_path107.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14821
|
+
const fileContent2 = await readFileContent((0, import_node_path107.join)(baseDir, relativePath2));
|
|
14708
14822
|
return new _FactorydroidRule({
|
|
14709
14823
|
baseDir,
|
|
14710
14824
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14717,8 +14831,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14717
14831
|
if (!paths.nonRoot) {
|
|
14718
14832
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14719
14833
|
}
|
|
14720
|
-
const relativePath = (0,
|
|
14721
|
-
const fileContent = await readFileContent((0,
|
|
14834
|
+
const relativePath = (0, import_node_path107.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14835
|
+
const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
|
|
14722
14836
|
return new _FactorydroidRule({
|
|
14723
14837
|
baseDir,
|
|
14724
14838
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14777,7 +14891,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14777
14891
|
};
|
|
14778
14892
|
|
|
14779
14893
|
// src/features/rules/geminicli-rule.ts
|
|
14780
|
-
var
|
|
14894
|
+
var import_node_path108 = require("path");
|
|
14781
14895
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14782
14896
|
static getSettablePaths({
|
|
14783
14897
|
global,
|
|
@@ -14812,7 +14926,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14812
14926
|
if (isRoot) {
|
|
14813
14927
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14814
14928
|
const fileContent2 = await readFileContent(
|
|
14815
|
-
(0,
|
|
14929
|
+
(0, import_node_path108.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14816
14930
|
);
|
|
14817
14931
|
return new _GeminiCliRule({
|
|
14818
14932
|
baseDir,
|
|
@@ -14826,8 +14940,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14826
14940
|
if (!paths.nonRoot) {
|
|
14827
14941
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14828
14942
|
}
|
|
14829
|
-
const relativePath = (0,
|
|
14830
|
-
const fileContent = await readFileContent((0,
|
|
14943
|
+
const relativePath = (0, import_node_path108.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14944
|
+
const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
|
|
14831
14945
|
return new _GeminiCliRule({
|
|
14832
14946
|
baseDir,
|
|
14833
14947
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14886,7 +15000,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14886
15000
|
};
|
|
14887
15001
|
|
|
14888
15002
|
// src/features/rules/goose-rule.ts
|
|
14889
|
-
var
|
|
15003
|
+
var import_node_path109 = require("path");
|
|
14890
15004
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14891
15005
|
static getSettablePaths({
|
|
14892
15006
|
global,
|
|
@@ -14921,7 +15035,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14921
15035
|
if (isRoot) {
|
|
14922
15036
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14923
15037
|
const fileContent2 = await readFileContent(
|
|
14924
|
-
(0,
|
|
15038
|
+
(0, import_node_path109.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14925
15039
|
);
|
|
14926
15040
|
return new _GooseRule({
|
|
14927
15041
|
baseDir,
|
|
@@ -14935,8 +15049,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14935
15049
|
if (!paths.nonRoot) {
|
|
14936
15050
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14937
15051
|
}
|
|
14938
|
-
const relativePath = (0,
|
|
14939
|
-
const fileContent = await readFileContent((0,
|
|
15052
|
+
const relativePath = (0, import_node_path109.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15053
|
+
const fileContent = await readFileContent((0, import_node_path109.join)(baseDir, relativePath));
|
|
14940
15054
|
return new _GooseRule({
|
|
14941
15055
|
baseDir,
|
|
14942
15056
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14995,7 +15109,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14995
15109
|
};
|
|
14996
15110
|
|
|
14997
15111
|
// src/features/rules/junie-rule.ts
|
|
14998
|
-
var
|
|
15112
|
+
var import_node_path110 = require("path");
|
|
14999
15113
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
15000
15114
|
static getSettablePaths(_options = {}) {
|
|
15001
15115
|
return {
|
|
@@ -15014,8 +15128,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15014
15128
|
validate = true
|
|
15015
15129
|
}) {
|
|
15016
15130
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
15017
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
15018
|
-
const fileContent = await readFileContent((0,
|
|
15131
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path110.join)(".junie", "memories", relativeFilePath);
|
|
15132
|
+
const fileContent = await readFileContent((0, import_node_path110.join)(baseDir, relativePath));
|
|
15019
15133
|
return new _JunieRule({
|
|
15020
15134
|
baseDir,
|
|
15021
15135
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15070,7 +15184,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
15070
15184
|
};
|
|
15071
15185
|
|
|
15072
15186
|
// src/features/rules/kilo-rule.ts
|
|
15073
|
-
var
|
|
15187
|
+
var import_node_path111 = require("path");
|
|
15074
15188
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
15075
15189
|
static getSettablePaths(_options = {}) {
|
|
15076
15190
|
return {
|
|
@@ -15085,7 +15199,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15085
15199
|
validate = true
|
|
15086
15200
|
}) {
|
|
15087
15201
|
const fileContent = await readFileContent(
|
|
15088
|
-
(0,
|
|
15202
|
+
(0, import_node_path111.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15089
15203
|
);
|
|
15090
15204
|
return new _KiloRule({
|
|
15091
15205
|
baseDir,
|
|
@@ -15137,7 +15251,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
15137
15251
|
};
|
|
15138
15252
|
|
|
15139
15253
|
// src/features/rules/kiro-rule.ts
|
|
15140
|
-
var
|
|
15254
|
+
var import_node_path112 = require("path");
|
|
15141
15255
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
15142
15256
|
static getSettablePaths(_options = {}) {
|
|
15143
15257
|
return {
|
|
@@ -15152,7 +15266,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15152
15266
|
validate = true
|
|
15153
15267
|
}) {
|
|
15154
15268
|
const fileContent = await readFileContent(
|
|
15155
|
-
(0,
|
|
15269
|
+
(0, import_node_path112.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15156
15270
|
);
|
|
15157
15271
|
return new _KiroRule({
|
|
15158
15272
|
baseDir,
|
|
@@ -15206,7 +15320,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
15206
15320
|
};
|
|
15207
15321
|
|
|
15208
15322
|
// src/features/rules/opencode-rule.ts
|
|
15209
|
-
var
|
|
15323
|
+
var import_node_path113 = require("path");
|
|
15210
15324
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
15211
15325
|
static getSettablePaths({
|
|
15212
15326
|
global,
|
|
@@ -15241,7 +15355,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15241
15355
|
if (isRoot) {
|
|
15242
15356
|
const relativePath2 = paths.root.relativeFilePath;
|
|
15243
15357
|
const fileContent2 = await readFileContent(
|
|
15244
|
-
(0,
|
|
15358
|
+
(0, import_node_path113.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
15245
15359
|
);
|
|
15246
15360
|
return new _OpenCodeRule({
|
|
15247
15361
|
baseDir,
|
|
@@ -15255,8 +15369,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15255
15369
|
if (!paths.nonRoot) {
|
|
15256
15370
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15257
15371
|
}
|
|
15258
|
-
const relativePath = (0,
|
|
15259
|
-
const fileContent = await readFileContent((0,
|
|
15372
|
+
const relativePath = (0, import_node_path113.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15373
|
+
const fileContent = await readFileContent((0, import_node_path113.join)(baseDir, relativePath));
|
|
15260
15374
|
return new _OpenCodeRule({
|
|
15261
15375
|
baseDir,
|
|
15262
15376
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15315,7 +15429,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
15315
15429
|
};
|
|
15316
15430
|
|
|
15317
15431
|
// src/features/rules/qwencode-rule.ts
|
|
15318
|
-
var
|
|
15432
|
+
var import_node_path114 = require("path");
|
|
15319
15433
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
15320
15434
|
static getSettablePaths(_options = {}) {
|
|
15321
15435
|
return {
|
|
@@ -15334,8 +15448,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15334
15448
|
validate = true
|
|
15335
15449
|
}) {
|
|
15336
15450
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
15337
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
15338
|
-
const fileContent = await readFileContent((0,
|
|
15451
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path114.join)(".qwen", "memories", relativeFilePath);
|
|
15452
|
+
const fileContent = await readFileContent((0, import_node_path114.join)(baseDir, relativePath));
|
|
15339
15453
|
return new _QwencodeRule({
|
|
15340
15454
|
baseDir,
|
|
15341
15455
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15387,7 +15501,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
15387
15501
|
};
|
|
15388
15502
|
|
|
15389
15503
|
// src/features/rules/replit-rule.ts
|
|
15390
|
-
var
|
|
15504
|
+
var import_node_path115 = require("path");
|
|
15391
15505
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
15392
15506
|
static getSettablePaths(_options = {}) {
|
|
15393
15507
|
return {
|
|
@@ -15409,7 +15523,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15409
15523
|
}
|
|
15410
15524
|
const relativePath = paths.root.relativeFilePath;
|
|
15411
15525
|
const fileContent = await readFileContent(
|
|
15412
|
-
(0,
|
|
15526
|
+
(0, import_node_path115.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
15413
15527
|
);
|
|
15414
15528
|
return new _ReplitRule({
|
|
15415
15529
|
baseDir,
|
|
@@ -15475,7 +15589,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
15475
15589
|
};
|
|
15476
15590
|
|
|
15477
15591
|
// src/features/rules/roo-rule.ts
|
|
15478
|
-
var
|
|
15592
|
+
var import_node_path116 = require("path");
|
|
15479
15593
|
var RooRule = class _RooRule extends ToolRule {
|
|
15480
15594
|
static getSettablePaths(_options = {}) {
|
|
15481
15595
|
return {
|
|
@@ -15490,7 +15604,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15490
15604
|
validate = true
|
|
15491
15605
|
}) {
|
|
15492
15606
|
const fileContent = await readFileContent(
|
|
15493
|
-
(0,
|
|
15607
|
+
(0, import_node_path116.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15494
15608
|
);
|
|
15495
15609
|
return new _RooRule({
|
|
15496
15610
|
baseDir,
|
|
@@ -15559,7 +15673,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
15559
15673
|
};
|
|
15560
15674
|
|
|
15561
15675
|
// src/features/rules/warp-rule.ts
|
|
15562
|
-
var
|
|
15676
|
+
var import_node_path117 = require("path");
|
|
15563
15677
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
15564
15678
|
constructor({ fileContent, root, ...rest }) {
|
|
15565
15679
|
super({
|
|
@@ -15585,8 +15699,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15585
15699
|
validate = true
|
|
15586
15700
|
}) {
|
|
15587
15701
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
15588
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
15589
|
-
const fileContent = await readFileContent((0,
|
|
15702
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path117.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15703
|
+
const fileContent = await readFileContent((0, import_node_path117.join)(baseDir, relativePath));
|
|
15590
15704
|
return new _WarpRule({
|
|
15591
15705
|
baseDir,
|
|
15592
15706
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -15641,7 +15755,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
15641
15755
|
};
|
|
15642
15756
|
|
|
15643
15757
|
// src/features/rules/windsurf-rule.ts
|
|
15644
|
-
var
|
|
15758
|
+
var import_node_path118 = require("path");
|
|
15645
15759
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
15646
15760
|
static getSettablePaths(_options = {}) {
|
|
15647
15761
|
return {
|
|
@@ -15656,7 +15770,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
15656
15770
|
validate = true
|
|
15657
15771
|
}) {
|
|
15658
15772
|
const fileContent = await readFileContent(
|
|
15659
|
-
(0,
|
|
15773
|
+
(0, import_node_path118.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15660
15774
|
);
|
|
15661
15775
|
return new _WindsurfRule({
|
|
15662
15776
|
baseDir,
|
|
@@ -15733,7 +15847,7 @@ var rulesProcessorToolTargets = [
|
|
|
15733
15847
|
"windsurf"
|
|
15734
15848
|
];
|
|
15735
15849
|
var RulesProcessorToolTargetSchema = import_mini57.z.enum(rulesProcessorToolTargets);
|
|
15736
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
15850
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path119.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15737
15851
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15738
15852
|
[
|
|
15739
15853
|
"agentsmd",
|
|
@@ -16020,9 +16134,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16020
16134
|
global = false,
|
|
16021
16135
|
getFactory = defaultGetFactory6,
|
|
16022
16136
|
skills,
|
|
16023
|
-
dryRun = false
|
|
16137
|
+
dryRun = false,
|
|
16138
|
+
logger
|
|
16024
16139
|
}) {
|
|
16025
|
-
super({ baseDir, dryRun });
|
|
16140
|
+
super({ baseDir, dryRun, logger });
|
|
16026
16141
|
const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
|
|
16027
16142
|
if (!result.success) {
|
|
16028
16143
|
throw new Error(
|
|
@@ -16108,7 +16223,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16108
16223
|
}).relativeDirPath;
|
|
16109
16224
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
16110
16225
|
const frontmatter = skill.getFrontmatter();
|
|
16111
|
-
const relativePath = (0,
|
|
16226
|
+
const relativePath = (0, import_node_path119.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
16112
16227
|
return {
|
|
16113
16228
|
name: frontmatter.name,
|
|
16114
16229
|
description: frontmatter.description,
|
|
@@ -16221,12 +16336,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16221
16336
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
16222
16337
|
*/
|
|
16223
16338
|
async loadRulesyncFiles() {
|
|
16224
|
-
const rulesyncBaseDir = (0,
|
|
16225
|
-
const files = await findFilesByGlobs((0,
|
|
16226
|
-
logger.debug(`Found ${files.length} rulesync files`);
|
|
16339
|
+
const rulesyncBaseDir = (0, import_node_path119.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
16340
|
+
const files = await findFilesByGlobs((0, import_node_path119.join)(rulesyncBaseDir, "**", "*.md"));
|
|
16341
|
+
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
16227
16342
|
const rulesyncRules = await Promise.all(
|
|
16228
16343
|
files.map((file) => {
|
|
16229
|
-
const relativeFilePath = (0,
|
|
16344
|
+
const relativeFilePath = (0, import_node_path119.relative)(rulesyncBaseDir, file);
|
|
16230
16345
|
checkPathTraversal({
|
|
16231
16346
|
relativePath: relativeFilePath,
|
|
16232
16347
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -16247,7 +16362,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16247
16362
|
);
|
|
16248
16363
|
}
|
|
16249
16364
|
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
16250
|
-
logger.warn(
|
|
16365
|
+
this.logger.warn(
|
|
16251
16366
|
`No root rulesync rule file found for target '${this.toolTarget}'. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
16252
16367
|
);
|
|
16253
16368
|
}
|
|
@@ -16272,12 +16387,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16272
16387
|
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
16273
16388
|
);
|
|
16274
16389
|
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
16275
|
-
logger.warn(
|
|
16390
|
+
this.logger.warn(
|
|
16276
16391
|
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
16277
16392
|
);
|
|
16278
16393
|
}
|
|
16279
16394
|
if (targetedLocalRootRules.length > 0) {
|
|
16280
|
-
logger.warn(
|
|
16395
|
+
this.logger.warn(
|
|
16281
16396
|
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
16282
16397
|
);
|
|
16283
16398
|
}
|
|
@@ -16301,7 +16416,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16301
16416
|
global: this.global
|
|
16302
16417
|
});
|
|
16303
16418
|
const resolveRelativeDirPath = (filePath) => {
|
|
16304
|
-
const dirName = (0,
|
|
16419
|
+
const dirName = (0, import_node_path119.dirname)((0, import_node_path119.relative)(this.baseDir, filePath));
|
|
16305
16420
|
return dirName === "" ? "." : dirName;
|
|
16306
16421
|
};
|
|
16307
16422
|
const findFilesWithFallback = async (primaryGlob, alternativeRoots, buildAltGlob) => {
|
|
@@ -16319,13 +16434,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16319
16434
|
return [];
|
|
16320
16435
|
}
|
|
16321
16436
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
16322
|
-
(0,
|
|
16437
|
+
(0, import_node_path119.join)(
|
|
16323
16438
|
this.baseDir,
|
|
16324
16439
|
settablePaths.root.relativeDirPath ?? ".",
|
|
16325
16440
|
settablePaths.root.relativeFilePath
|
|
16326
16441
|
),
|
|
16327
16442
|
settablePaths.alternativeRoots,
|
|
16328
|
-
(alt) => (0,
|
|
16443
|
+
(alt) => (0, import_node_path119.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
16329
16444
|
);
|
|
16330
16445
|
if (forDeletion) {
|
|
16331
16446
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -16337,7 +16452,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16337
16452
|
return factory.class.forDeletion({
|
|
16338
16453
|
baseDir: this.baseDir,
|
|
16339
16454
|
relativeDirPath,
|
|
16340
|
-
relativeFilePath: (0,
|
|
16455
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16341
16456
|
global: this.global
|
|
16342
16457
|
});
|
|
16343
16458
|
}).filter((rule) => rule.isDeletable());
|
|
@@ -16351,14 +16466,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16351
16466
|
});
|
|
16352
16467
|
return factory.class.fromFile({
|
|
16353
16468
|
baseDir: this.baseDir,
|
|
16354
|
-
relativeFilePath: (0,
|
|
16469
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16355
16470
|
relativeDirPath,
|
|
16356
16471
|
global: this.global
|
|
16357
16472
|
});
|
|
16358
16473
|
})
|
|
16359
16474
|
);
|
|
16360
16475
|
})();
|
|
16361
|
-
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16476
|
+
this.logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
16362
16477
|
const localRootToolRules = await (async () => {
|
|
16363
16478
|
if (!forDeletion) {
|
|
16364
16479
|
return [];
|
|
@@ -16370,9 +16485,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16370
16485
|
return [];
|
|
16371
16486
|
}
|
|
16372
16487
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
16373
|
-
(0,
|
|
16488
|
+
(0, import_node_path119.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
16374
16489
|
settablePaths.alternativeRoots,
|
|
16375
|
-
(alt) => (0,
|
|
16490
|
+
(alt) => (0, import_node_path119.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
16376
16491
|
);
|
|
16377
16492
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
16378
16493
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -16383,23 +16498,25 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16383
16498
|
return factory.class.forDeletion({
|
|
16384
16499
|
baseDir: this.baseDir,
|
|
16385
16500
|
relativeDirPath,
|
|
16386
|
-
relativeFilePath: (0,
|
|
16501
|
+
relativeFilePath: (0, import_node_path119.basename)(filePath),
|
|
16387
16502
|
global: this.global
|
|
16388
16503
|
});
|
|
16389
16504
|
}).filter((rule) => rule.isDeletable());
|
|
16390
16505
|
})();
|
|
16391
|
-
logger.debug(
|
|
16506
|
+
this.logger.debug(
|
|
16507
|
+
`Found ${localRootToolRules.length} local root tool rule files for deletion`
|
|
16508
|
+
);
|
|
16392
16509
|
const nonRootToolRules = await (async () => {
|
|
16393
16510
|
if (!settablePaths.nonRoot) {
|
|
16394
16511
|
return [];
|
|
16395
16512
|
}
|
|
16396
|
-
const nonRootBaseDir = (0,
|
|
16513
|
+
const nonRootBaseDir = (0, import_node_path119.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
16397
16514
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
16398
|
-
(0,
|
|
16515
|
+
(0, import_node_path119.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
16399
16516
|
);
|
|
16400
16517
|
if (forDeletion) {
|
|
16401
16518
|
return nonRootFilePaths.map((filePath) => {
|
|
16402
|
-
const relativeFilePath = (0,
|
|
16519
|
+
const relativeFilePath = (0, import_node_path119.relative)(nonRootBaseDir, filePath);
|
|
16403
16520
|
checkPathTraversal({
|
|
16404
16521
|
relativePath: relativeFilePath,
|
|
16405
16522
|
intendedRootDir: nonRootBaseDir
|
|
@@ -16414,7 +16531,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16414
16531
|
}
|
|
16415
16532
|
return await Promise.all(
|
|
16416
16533
|
nonRootFilePaths.map((filePath) => {
|
|
16417
|
-
const relativeFilePath = (0,
|
|
16534
|
+
const relativeFilePath = (0, import_node_path119.relative)(nonRootBaseDir, filePath);
|
|
16418
16535
|
checkPathTraversal({
|
|
16419
16536
|
relativePath: relativeFilePath,
|
|
16420
16537
|
intendedRootDir: nonRootBaseDir
|
|
@@ -16427,10 +16544,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
16427
16544
|
})
|
|
16428
16545
|
);
|
|
16429
16546
|
})();
|
|
16430
|
-
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16547
|
+
this.logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
16431
16548
|
return [...rootToolRules, ...localRootToolRules, ...nonRootToolRules];
|
|
16432
16549
|
} catch (error) {
|
|
16433
|
-
logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16550
|
+
this.logger.error(`Failed to load tool files for ${this.toolTarget}: ${formatError(error)}`);
|
|
16434
16551
|
return [];
|
|
16435
16552
|
}
|
|
16436
16553
|
}
|
|
@@ -16527,14 +16644,14 @@ s/<command> [arguments]
|
|
|
16527
16644
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
16528
16645
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
16529
16646
|
|
|
16530
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
16647
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
16531
16648
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
16532
16649
|
|
|
16533
16650
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
16534
16651
|
|
|
16535
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
16652
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path119.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
16536
16653
|
|
|
16537
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
16654
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path119.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
16538
16655
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
16539
16656
|
const result = [
|
|
16540
16657
|
overview,
|
|
@@ -16605,26 +16722,38 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
16605
16722
|
}
|
|
16606
16723
|
return { count: totalCount, paths: [], hasDiff };
|
|
16607
16724
|
}
|
|
16725
|
+
var SIMULATE_OPTION_MAP = {
|
|
16726
|
+
commands: "--simulate-commands",
|
|
16727
|
+
subagents: "--simulate-subagents",
|
|
16728
|
+
skills: "--simulate-skills"
|
|
16729
|
+
};
|
|
16608
16730
|
function warnUnsupportedTargets(params) {
|
|
16609
|
-
const { config, supportedTargets, featureName } = params;
|
|
16731
|
+
const { config, supportedTargets, simulatedTargets = [], featureName, logger } = params;
|
|
16610
16732
|
for (const target of config.getTargets()) {
|
|
16611
16733
|
if (!supportedTargets.includes(target) && config.getFeatures(target).includes(featureName)) {
|
|
16612
|
-
|
|
16734
|
+
const simulateOption = SIMULATE_OPTION_MAP[featureName];
|
|
16735
|
+
if (simulateOption && simulatedTargets.includes(target)) {
|
|
16736
|
+
logger.warn(
|
|
16737
|
+
`Target '${target}' only supports simulated '${featureName}'. Use '${simulateOption}' to enable it. Skipping.`
|
|
16738
|
+
);
|
|
16739
|
+
} else {
|
|
16740
|
+
logger.warn(`Target '${target}' does not support the feature '${featureName}'. Skipping.`);
|
|
16741
|
+
}
|
|
16613
16742
|
}
|
|
16614
16743
|
}
|
|
16615
16744
|
}
|
|
16616
16745
|
async function checkRulesyncDirExists(params) {
|
|
16617
|
-
return fileExists((0,
|
|
16746
|
+
return fileExists((0, import_node_path120.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
16618
16747
|
}
|
|
16619
16748
|
async function generate(params) {
|
|
16620
|
-
const { config } = params;
|
|
16621
|
-
const ignoreResult = await generateIgnoreCore({ config });
|
|
16622
|
-
const mcpResult = await generateMcpCore({ config });
|
|
16623
|
-
const commandsResult = await generateCommandsCore({ config });
|
|
16624
|
-
const subagentsResult = await generateSubagentsCore({ config });
|
|
16625
|
-
const skillsResult = await generateSkillsCore({ config });
|
|
16626
|
-
const hooksResult = await generateHooksCore({ config });
|
|
16627
|
-
const rulesResult = await generateRulesCore({ config, skills: skillsResult.skills });
|
|
16749
|
+
const { config, logger } = params;
|
|
16750
|
+
const ignoreResult = await generateIgnoreCore({ config, logger });
|
|
16751
|
+
const mcpResult = await generateMcpCore({ config, logger });
|
|
16752
|
+
const commandsResult = await generateCommandsCore({ config, logger });
|
|
16753
|
+
const subagentsResult = await generateSubagentsCore({ config, logger });
|
|
16754
|
+
const skillsResult = await generateSkillsCore({ config, logger });
|
|
16755
|
+
const hooksResult = await generateHooksCore({ config, logger });
|
|
16756
|
+
const rulesResult = await generateRulesCore({ config, logger, skills: skillsResult.skills });
|
|
16628
16757
|
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
16629
16758
|
return {
|
|
16630
16759
|
rulesCount: rulesResult.count,
|
|
@@ -16646,13 +16775,13 @@ async function generate(params) {
|
|
|
16646
16775
|
};
|
|
16647
16776
|
}
|
|
16648
16777
|
async function generateRulesCore(params) {
|
|
16649
|
-
const { config, skills } = params;
|
|
16778
|
+
const { config, logger, skills } = params;
|
|
16650
16779
|
let totalCount = 0;
|
|
16651
16780
|
const allPaths = [];
|
|
16652
16781
|
let hasDiff = false;
|
|
16653
16782
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16654
16783
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedTargets);
|
|
16655
|
-
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules" });
|
|
16784
|
+
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger });
|
|
16656
16785
|
for (const baseDir of config.getBaseDirs()) {
|
|
16657
16786
|
for (const toolTarget of toolTargets) {
|
|
16658
16787
|
if (!config.getFeatures(toolTarget).includes("rules")) {
|
|
@@ -16666,7 +16795,8 @@ async function generateRulesCore(params) {
|
|
|
16666
16795
|
simulateSubagents: config.getSimulateSubagents(),
|
|
16667
16796
|
simulateSkills: config.getSimulateSkills(),
|
|
16668
16797
|
skills,
|
|
16669
|
-
dryRun: config.isPreviewMode()
|
|
16798
|
+
dryRun: config.isPreviewMode(),
|
|
16799
|
+
logger
|
|
16670
16800
|
});
|
|
16671
16801
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16672
16802
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16683,12 +16813,13 @@ async function generateRulesCore(params) {
|
|
|
16683
16813
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16684
16814
|
}
|
|
16685
16815
|
async function generateIgnoreCore(params) {
|
|
16686
|
-
const { config } = params;
|
|
16816
|
+
const { config, logger } = params;
|
|
16687
16817
|
const supportedIgnoreTargets = IgnoreProcessor.getToolTargets();
|
|
16688
16818
|
warnUnsupportedTargets({
|
|
16689
16819
|
config,
|
|
16690
16820
|
supportedTargets: supportedIgnoreTargets,
|
|
16691
|
-
featureName: "ignore"
|
|
16821
|
+
featureName: "ignore",
|
|
16822
|
+
logger
|
|
16692
16823
|
});
|
|
16693
16824
|
if (config.getGlobal()) {
|
|
16694
16825
|
return { count: 0, paths: [], hasDiff: false };
|
|
@@ -16705,7 +16836,8 @@ async function generateIgnoreCore(params) {
|
|
|
16705
16836
|
const processor = new IgnoreProcessor({
|
|
16706
16837
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
16707
16838
|
toolTarget,
|
|
16708
|
-
dryRun: config.isPreviewMode()
|
|
16839
|
+
dryRun: config.isPreviewMode(),
|
|
16840
|
+
logger
|
|
16709
16841
|
});
|
|
16710
16842
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16711
16843
|
let result;
|
|
@@ -16736,13 +16868,18 @@ async function generateIgnoreCore(params) {
|
|
|
16736
16868
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16737
16869
|
}
|
|
16738
16870
|
async function generateMcpCore(params) {
|
|
16739
|
-
const { config } = params;
|
|
16871
|
+
const { config, logger } = params;
|
|
16740
16872
|
let totalCount = 0;
|
|
16741
16873
|
const allPaths = [];
|
|
16742
16874
|
let hasDiff = false;
|
|
16743
16875
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16744
16876
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedMcpTargets);
|
|
16745
|
-
warnUnsupportedTargets({
|
|
16877
|
+
warnUnsupportedTargets({
|
|
16878
|
+
config,
|
|
16879
|
+
supportedTargets: supportedMcpTargets,
|
|
16880
|
+
featureName: "mcp",
|
|
16881
|
+
logger
|
|
16882
|
+
});
|
|
16746
16883
|
for (const baseDir of config.getBaseDirs()) {
|
|
16747
16884
|
for (const toolTarget of toolTargets) {
|
|
16748
16885
|
if (!config.getFeatures(toolTarget).includes("mcp")) {
|
|
@@ -16752,7 +16889,8 @@ async function generateMcpCore(params) {
|
|
|
16752
16889
|
baseDir,
|
|
16753
16890
|
toolTarget,
|
|
16754
16891
|
global: config.getGlobal(),
|
|
16755
|
-
dryRun: config.isPreviewMode()
|
|
16892
|
+
dryRun: config.isPreviewMode(),
|
|
16893
|
+
logger
|
|
16756
16894
|
});
|
|
16757
16895
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16758
16896
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16769,7 +16907,7 @@ async function generateMcpCore(params) {
|
|
|
16769
16907
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16770
16908
|
}
|
|
16771
16909
|
async function generateCommandsCore(params) {
|
|
16772
|
-
const { config } = params;
|
|
16910
|
+
const { config, logger } = params;
|
|
16773
16911
|
let totalCount = 0;
|
|
16774
16912
|
const allPaths = [];
|
|
16775
16913
|
let hasDiff = false;
|
|
@@ -16781,7 +16919,9 @@ async function generateCommandsCore(params) {
|
|
|
16781
16919
|
warnUnsupportedTargets({
|
|
16782
16920
|
config,
|
|
16783
16921
|
supportedTargets: supportedCommandsTargets,
|
|
16784
|
-
|
|
16922
|
+
simulatedTargets: CommandsProcessor.getToolTargetsSimulated(),
|
|
16923
|
+
featureName: "commands",
|
|
16924
|
+
logger
|
|
16785
16925
|
});
|
|
16786
16926
|
for (const baseDir of config.getBaseDirs()) {
|
|
16787
16927
|
for (const toolTarget of toolTargets) {
|
|
@@ -16792,7 +16932,8 @@ async function generateCommandsCore(params) {
|
|
|
16792
16932
|
baseDir,
|
|
16793
16933
|
toolTarget,
|
|
16794
16934
|
global: config.getGlobal(),
|
|
16795
|
-
dryRun: config.isPreviewMode()
|
|
16935
|
+
dryRun: config.isPreviewMode(),
|
|
16936
|
+
logger
|
|
16796
16937
|
});
|
|
16797
16938
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16798
16939
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16809,7 +16950,7 @@ async function generateCommandsCore(params) {
|
|
|
16809
16950
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16810
16951
|
}
|
|
16811
16952
|
async function generateSubagentsCore(params) {
|
|
16812
|
-
const { config } = params;
|
|
16953
|
+
const { config, logger } = params;
|
|
16813
16954
|
let totalCount = 0;
|
|
16814
16955
|
const allPaths = [];
|
|
16815
16956
|
let hasDiff = false;
|
|
@@ -16821,7 +16962,9 @@ async function generateSubagentsCore(params) {
|
|
|
16821
16962
|
warnUnsupportedTargets({
|
|
16822
16963
|
config,
|
|
16823
16964
|
supportedTargets: supportedSubagentsTargets,
|
|
16824
|
-
|
|
16965
|
+
simulatedTargets: SubagentsProcessor.getToolTargetsSimulated(),
|
|
16966
|
+
featureName: "subagents",
|
|
16967
|
+
logger
|
|
16825
16968
|
});
|
|
16826
16969
|
for (const baseDir of config.getBaseDirs()) {
|
|
16827
16970
|
for (const toolTarget of toolTargets) {
|
|
@@ -16832,7 +16975,8 @@ async function generateSubagentsCore(params) {
|
|
|
16832
16975
|
baseDir,
|
|
16833
16976
|
toolTarget,
|
|
16834
16977
|
global: config.getGlobal(),
|
|
16835
|
-
dryRun: config.isPreviewMode()
|
|
16978
|
+
dryRun: config.isPreviewMode(),
|
|
16979
|
+
logger
|
|
16836
16980
|
});
|
|
16837
16981
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16838
16982
|
const toolFiles = await processor.convertRulesyncFilesToToolFiles(rulesyncFiles);
|
|
@@ -16849,7 +16993,7 @@ async function generateSubagentsCore(params) {
|
|
|
16849
16993
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
16850
16994
|
}
|
|
16851
16995
|
async function generateSkillsCore(params) {
|
|
16852
|
-
const { config } = params;
|
|
16996
|
+
const { config, logger } = params;
|
|
16853
16997
|
let totalCount = 0;
|
|
16854
16998
|
const allPaths = [];
|
|
16855
16999
|
let hasDiff = false;
|
|
@@ -16862,7 +17006,9 @@ async function generateSkillsCore(params) {
|
|
|
16862
17006
|
warnUnsupportedTargets({
|
|
16863
17007
|
config,
|
|
16864
17008
|
supportedTargets: supportedSkillsTargets,
|
|
16865
|
-
|
|
17009
|
+
simulatedTargets: SkillsProcessor.getToolTargetsSimulated(),
|
|
17010
|
+
featureName: "skills",
|
|
17011
|
+
logger
|
|
16866
17012
|
});
|
|
16867
17013
|
for (const baseDir of config.getBaseDirs()) {
|
|
16868
17014
|
for (const toolTarget of toolTargets) {
|
|
@@ -16873,7 +17019,8 @@ async function generateSkillsCore(params) {
|
|
|
16873
17019
|
baseDir,
|
|
16874
17020
|
toolTarget,
|
|
16875
17021
|
global: config.getGlobal(),
|
|
16876
|
-
dryRun: config.isPreviewMode()
|
|
17022
|
+
dryRun: config.isPreviewMode(),
|
|
17023
|
+
logger
|
|
16877
17024
|
});
|
|
16878
17025
|
const rulesyncDirs = await processor.loadRulesyncDirs();
|
|
16879
17026
|
for (const rulesyncDir of rulesyncDirs) {
|
|
@@ -16895,13 +17042,18 @@ async function generateSkillsCore(params) {
|
|
|
16895
17042
|
return { count: totalCount, paths: allPaths, skills: allSkills, hasDiff };
|
|
16896
17043
|
}
|
|
16897
17044
|
async function generateHooksCore(params) {
|
|
16898
|
-
const { config } = params;
|
|
17045
|
+
const { config, logger } = params;
|
|
16899
17046
|
let totalCount = 0;
|
|
16900
17047
|
const allPaths = [];
|
|
16901
17048
|
let hasDiff = false;
|
|
16902
17049
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
16903
17050
|
const toolTargets = (0, import_es_toolkit4.intersection)(config.getTargets(), supportedHooksTargets);
|
|
16904
|
-
warnUnsupportedTargets({
|
|
17051
|
+
warnUnsupportedTargets({
|
|
17052
|
+
config,
|
|
17053
|
+
supportedTargets: supportedHooksTargets,
|
|
17054
|
+
featureName: "hooks",
|
|
17055
|
+
logger
|
|
17056
|
+
});
|
|
16905
17057
|
for (const baseDir of config.getBaseDirs()) {
|
|
16906
17058
|
for (const toolTarget of toolTargets) {
|
|
16907
17059
|
if (!config.getFeatures(toolTarget).includes("hooks")) {
|
|
@@ -16911,7 +17063,8 @@ async function generateHooksCore(params) {
|
|
|
16911
17063
|
baseDir,
|
|
16912
17064
|
toolTarget,
|
|
16913
17065
|
global: config.getGlobal(),
|
|
16914
|
-
dryRun: config.isPreviewMode()
|
|
17066
|
+
dryRun: config.isPreviewMode(),
|
|
17067
|
+
logger
|
|
16915
17068
|
});
|
|
16916
17069
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
16917
17070
|
let result;
|
|
@@ -16938,14 +17091,14 @@ async function generateHooksCore(params) {
|
|
|
16938
17091
|
|
|
16939
17092
|
// src/lib/import.ts
|
|
16940
17093
|
async function importFromTool(params) {
|
|
16941
|
-
const { config, tool } = params;
|
|
16942
|
-
const rulesCount = await importRulesCore({ config, tool });
|
|
16943
|
-
const ignoreCount = await importIgnoreCore({ config, tool });
|
|
16944
|
-
const mcpCount = await importMcpCore({ config, tool });
|
|
16945
|
-
const commandsCount = await importCommandsCore({ config, tool });
|
|
16946
|
-
const subagentsCount = await importSubagentsCore({ config, tool });
|
|
16947
|
-
const skillsCount = await importSkillsCore({ config, tool });
|
|
16948
|
-
const hooksCount = await importHooksCore({ config, tool });
|
|
17094
|
+
const { config, tool, logger } = params;
|
|
17095
|
+
const rulesCount = await importRulesCore({ config, tool, logger });
|
|
17096
|
+
const ignoreCount = await importIgnoreCore({ config, tool, logger });
|
|
17097
|
+
const mcpCount = await importMcpCore({ config, tool, logger });
|
|
17098
|
+
const commandsCount = await importCommandsCore({ config, tool, logger });
|
|
17099
|
+
const subagentsCount = await importSubagentsCore({ config, tool, logger });
|
|
17100
|
+
const skillsCount = await importSkillsCore({ config, tool, logger });
|
|
17101
|
+
const hooksCount = await importHooksCore({ config, tool, logger });
|
|
16949
17102
|
return {
|
|
16950
17103
|
rulesCount,
|
|
16951
17104
|
ignoreCount,
|
|
@@ -16957,7 +17110,7 @@ async function importFromTool(params) {
|
|
|
16957
17110
|
};
|
|
16958
17111
|
}
|
|
16959
17112
|
async function importRulesCore(params) {
|
|
16960
|
-
const { config, tool } = params;
|
|
17113
|
+
const { config, tool, logger } = params;
|
|
16961
17114
|
if (!config.getFeatures(tool).includes("rules")) {
|
|
16962
17115
|
return 0;
|
|
16963
17116
|
}
|
|
@@ -16969,7 +17122,8 @@ async function importRulesCore(params) {
|
|
|
16969
17122
|
const rulesProcessor = new RulesProcessor({
|
|
16970
17123
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
16971
17124
|
toolTarget: tool,
|
|
16972
|
-
global
|
|
17125
|
+
global,
|
|
17126
|
+
logger
|
|
16973
17127
|
});
|
|
16974
17128
|
const toolFiles = await rulesProcessor.loadToolFiles();
|
|
16975
17129
|
if (toolFiles.length === 0) {
|
|
@@ -16984,7 +17138,7 @@ async function importRulesCore(params) {
|
|
|
16984
17138
|
return writtenCount;
|
|
16985
17139
|
}
|
|
16986
17140
|
async function importIgnoreCore(params) {
|
|
16987
|
-
const { config, tool } = params;
|
|
17141
|
+
const { config, tool, logger } = params;
|
|
16988
17142
|
if (!config.getFeatures(tool).includes("ignore")) {
|
|
16989
17143
|
return 0;
|
|
16990
17144
|
}
|
|
@@ -16997,7 +17151,8 @@ async function importIgnoreCore(params) {
|
|
|
16997
17151
|
}
|
|
16998
17152
|
const ignoreProcessor = new IgnoreProcessor({
|
|
16999
17153
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17000
|
-
toolTarget: tool
|
|
17154
|
+
toolTarget: tool,
|
|
17155
|
+
logger
|
|
17001
17156
|
});
|
|
17002
17157
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
17003
17158
|
if (toolFiles.length === 0) {
|
|
@@ -17015,7 +17170,7 @@ async function importIgnoreCore(params) {
|
|
|
17015
17170
|
return writtenCount;
|
|
17016
17171
|
}
|
|
17017
17172
|
async function importMcpCore(params) {
|
|
17018
|
-
const { config, tool } = params;
|
|
17173
|
+
const { config, tool, logger } = params;
|
|
17019
17174
|
if (!config.getFeatures(tool).includes("mcp")) {
|
|
17020
17175
|
return 0;
|
|
17021
17176
|
}
|
|
@@ -17027,7 +17182,8 @@ async function importMcpCore(params) {
|
|
|
17027
17182
|
const mcpProcessor = new McpProcessor({
|
|
17028
17183
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17029
17184
|
toolTarget: tool,
|
|
17030
|
-
global
|
|
17185
|
+
global,
|
|
17186
|
+
logger
|
|
17031
17187
|
});
|
|
17032
17188
|
const toolFiles = await mcpProcessor.loadToolFiles();
|
|
17033
17189
|
if (toolFiles.length === 0) {
|
|
@@ -17042,7 +17198,7 @@ async function importMcpCore(params) {
|
|
|
17042
17198
|
return writtenCount;
|
|
17043
17199
|
}
|
|
17044
17200
|
async function importCommandsCore(params) {
|
|
17045
|
-
const { config, tool } = params;
|
|
17201
|
+
const { config, tool, logger } = params;
|
|
17046
17202
|
if (!config.getFeatures(tool).includes("commands")) {
|
|
17047
17203
|
return 0;
|
|
17048
17204
|
}
|
|
@@ -17054,7 +17210,8 @@ async function importCommandsCore(params) {
|
|
|
17054
17210
|
const commandsProcessor = new CommandsProcessor({
|
|
17055
17211
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17056
17212
|
toolTarget: tool,
|
|
17057
|
-
global
|
|
17213
|
+
global,
|
|
17214
|
+
logger
|
|
17058
17215
|
});
|
|
17059
17216
|
const toolFiles = await commandsProcessor.loadToolFiles();
|
|
17060
17217
|
if (toolFiles.length === 0) {
|
|
@@ -17069,7 +17226,7 @@ async function importCommandsCore(params) {
|
|
|
17069
17226
|
return writtenCount;
|
|
17070
17227
|
}
|
|
17071
17228
|
async function importSubagentsCore(params) {
|
|
17072
|
-
const { config, tool } = params;
|
|
17229
|
+
const { config, tool, logger } = params;
|
|
17073
17230
|
if (!config.getFeatures(tool).includes("subagents")) {
|
|
17074
17231
|
return 0;
|
|
17075
17232
|
}
|
|
@@ -17081,7 +17238,8 @@ async function importSubagentsCore(params) {
|
|
|
17081
17238
|
const subagentsProcessor = new SubagentsProcessor({
|
|
17082
17239
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17083
17240
|
toolTarget: tool,
|
|
17084
|
-
global: config.getGlobal()
|
|
17241
|
+
global: config.getGlobal(),
|
|
17242
|
+
logger
|
|
17085
17243
|
});
|
|
17086
17244
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
17087
17245
|
if (toolFiles.length === 0) {
|
|
@@ -17096,7 +17254,7 @@ async function importSubagentsCore(params) {
|
|
|
17096
17254
|
return writtenCount;
|
|
17097
17255
|
}
|
|
17098
17256
|
async function importSkillsCore(params) {
|
|
17099
|
-
const { config, tool } = params;
|
|
17257
|
+
const { config, tool, logger } = params;
|
|
17100
17258
|
if (!config.getFeatures(tool).includes("skills")) {
|
|
17101
17259
|
return 0;
|
|
17102
17260
|
}
|
|
@@ -17108,7 +17266,8 @@ async function importSkillsCore(params) {
|
|
|
17108
17266
|
const skillsProcessor = new SkillsProcessor({
|
|
17109
17267
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17110
17268
|
toolTarget: tool,
|
|
17111
|
-
global
|
|
17269
|
+
global,
|
|
17270
|
+
logger
|
|
17112
17271
|
});
|
|
17113
17272
|
const toolDirs = await skillsProcessor.loadToolDirs();
|
|
17114
17273
|
if (toolDirs.length === 0) {
|
|
@@ -17123,7 +17282,7 @@ async function importSkillsCore(params) {
|
|
|
17123
17282
|
return writtenCount;
|
|
17124
17283
|
}
|
|
17125
17284
|
async function importHooksCore(params) {
|
|
17126
|
-
const { config, tool } = params;
|
|
17285
|
+
const { config, tool, logger } = params;
|
|
17127
17286
|
if (!config.getFeatures(tool).includes("hooks")) {
|
|
17128
17287
|
return 0;
|
|
17129
17288
|
}
|
|
@@ -17140,7 +17299,8 @@ async function importHooksCore(params) {
|
|
|
17140
17299
|
const hooksProcessor = new HooksProcessor({
|
|
17141
17300
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
17142
17301
|
toolTarget: tool,
|
|
17143
|
-
global
|
|
17302
|
+
global,
|
|
17303
|
+
logger
|
|
17144
17304
|
});
|
|
17145
17305
|
const toolFiles = await hooksProcessor.loadToolFiles();
|
|
17146
17306
|
if (toolFiles.length === 0) {
|
|
@@ -17155,10 +17315,76 @@ async function importHooksCore(params) {
|
|
|
17155
17315
|
return writtenCount;
|
|
17156
17316
|
}
|
|
17157
17317
|
|
|
17318
|
+
// src/utils/logger.ts
|
|
17319
|
+
var BaseLogger = class {
|
|
17320
|
+
_verbose = false;
|
|
17321
|
+
_silent = false;
|
|
17322
|
+
constructor({ verbose = false, silent = false } = {}) {
|
|
17323
|
+
this._silent = silent;
|
|
17324
|
+
this._verbose = verbose && !silent;
|
|
17325
|
+
}
|
|
17326
|
+
get verbose() {
|
|
17327
|
+
return this._verbose;
|
|
17328
|
+
}
|
|
17329
|
+
get silent() {
|
|
17330
|
+
return this._silent;
|
|
17331
|
+
}
|
|
17332
|
+
configure({ verbose, silent }) {
|
|
17333
|
+
if (verbose && silent) {
|
|
17334
|
+
this._silent = false;
|
|
17335
|
+
if (!isEnvTest()) {
|
|
17336
|
+
this.onConflictingFlags();
|
|
17337
|
+
}
|
|
17338
|
+
}
|
|
17339
|
+
this._silent = silent;
|
|
17340
|
+
this._verbose = verbose && !silent;
|
|
17341
|
+
}
|
|
17342
|
+
onConflictingFlags() {
|
|
17343
|
+
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
17344
|
+
}
|
|
17345
|
+
};
|
|
17346
|
+
var ConsoleLogger = class extends BaseLogger {
|
|
17347
|
+
isSuppressed() {
|
|
17348
|
+
return isEnvTest() || this._silent;
|
|
17349
|
+
}
|
|
17350
|
+
get jsonMode() {
|
|
17351
|
+
return false;
|
|
17352
|
+
}
|
|
17353
|
+
captureData(_key, _value) {
|
|
17354
|
+
}
|
|
17355
|
+
getJsonData() {
|
|
17356
|
+
return {};
|
|
17357
|
+
}
|
|
17358
|
+
outputJson(_success, _error) {
|
|
17359
|
+
}
|
|
17360
|
+
info(message, ...args) {
|
|
17361
|
+
if (this.isSuppressed()) return;
|
|
17362
|
+
console.log(message, ...args);
|
|
17363
|
+
}
|
|
17364
|
+
success(message, ...args) {
|
|
17365
|
+
if (this.isSuppressed()) return;
|
|
17366
|
+
console.log(message, ...args);
|
|
17367
|
+
}
|
|
17368
|
+
warn(message, ...args) {
|
|
17369
|
+
if (this.isSuppressed()) return;
|
|
17370
|
+
console.warn(message, ...args);
|
|
17371
|
+
}
|
|
17372
|
+
// Errors are always emitted, even in silent mode
|
|
17373
|
+
error(message, _code, ...args) {
|
|
17374
|
+
if (isEnvTest()) return;
|
|
17375
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
17376
|
+
console.error(errorMessage, ...args);
|
|
17377
|
+
}
|
|
17378
|
+
debug(message, ...args) {
|
|
17379
|
+
if (!this._verbose || this.isSuppressed()) return;
|
|
17380
|
+
console.log(message, ...args);
|
|
17381
|
+
}
|
|
17382
|
+
};
|
|
17383
|
+
|
|
17158
17384
|
// src/index.ts
|
|
17159
17385
|
async function generate2(options = {}) {
|
|
17160
17386
|
const { silent = true, verbose = false, ...rest } = options;
|
|
17161
|
-
logger
|
|
17387
|
+
const logger = new ConsoleLogger({ verbose, silent });
|
|
17162
17388
|
const config = await ConfigResolver.resolve({
|
|
17163
17389
|
...rest,
|
|
17164
17390
|
verbose,
|
|
@@ -17169,18 +17395,18 @@ async function generate2(options = {}) {
|
|
|
17169
17395
|
throw new Error(".rulesync directory not found. Run 'rulesync init' first.");
|
|
17170
17396
|
}
|
|
17171
17397
|
}
|
|
17172
|
-
return generate({ config });
|
|
17398
|
+
return generate({ config, logger });
|
|
17173
17399
|
}
|
|
17174
17400
|
async function importFromTool2(options) {
|
|
17175
17401
|
const { target, silent = true, verbose = false, ...rest } = options;
|
|
17176
|
-
logger
|
|
17402
|
+
const logger = new ConsoleLogger({ verbose, silent });
|
|
17177
17403
|
const config = await ConfigResolver.resolve({
|
|
17178
17404
|
...rest,
|
|
17179
17405
|
targets: [target],
|
|
17180
17406
|
verbose,
|
|
17181
17407
|
silent
|
|
17182
17408
|
});
|
|
17183
|
-
return importFromTool({ config, tool: target });
|
|
17409
|
+
return importFromTool({ config, tool: target, logger });
|
|
17184
17410
|
}
|
|
17185
17411
|
// Annotate the CommonJS export names for ESM import in node:
|
|
17186
17412
|
0 && (module.exports = {
|