rulesync 5.1.1 → 5.2.1
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 +106 -95
- package/dist/index.cjs +454 -356
- package/dist/index.js +410 -312
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -102,18 +102,18 @@ var Logger = class {
|
|
|
102
102
|
var logger = new Logger();
|
|
103
103
|
|
|
104
104
|
// src/cli/commands/generate.ts
|
|
105
|
-
var
|
|
105
|
+
var import_es_toolkit4 = require("es-toolkit");
|
|
106
106
|
|
|
107
107
|
// src/config/config-resolver.ts
|
|
108
|
-
var import_node_path2 = require("path");
|
|
109
108
|
var import_jsonc_parser = require("jsonc-parser");
|
|
109
|
+
var import_node_path2 = require("path");
|
|
110
110
|
|
|
111
111
|
// src/utils/file.ts
|
|
112
|
+
var import_es_toolkit = require("es-toolkit");
|
|
112
113
|
var import_node_fs = require("fs");
|
|
113
114
|
var import_promises = require("fs/promises");
|
|
114
115
|
var import_node_os = __toESM(require("os"), 1);
|
|
115
116
|
var import_node_path = require("path");
|
|
116
|
-
var import_es_toolkit = require("es-toolkit");
|
|
117
117
|
async function ensureDir(dirPath) {
|
|
118
118
|
try {
|
|
119
119
|
await (0, import_promises.stat)(dirPath);
|
|
@@ -273,7 +273,8 @@ var ALL_TOOL_TARGETS = [
|
|
|
273
273
|
"qwencode",
|
|
274
274
|
"roo",
|
|
275
275
|
"warp",
|
|
276
|
-
"windsurf"
|
|
276
|
+
"windsurf",
|
|
277
|
+
"zed"
|
|
277
278
|
];
|
|
278
279
|
var ALL_TOOL_TARGETS_WITH_WILDCARD = [...ALL_TOOL_TARGETS, "*"];
|
|
279
280
|
var ToolTargetSchema = import_mini2.z.enum(ALL_TOOL_TARGETS);
|
|
@@ -2612,8 +2613,8 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2612
2613
|
};
|
|
2613
2614
|
|
|
2614
2615
|
// src/features/ignore/claudecode-ignore.ts
|
|
2615
|
-
var import_node_path21 = require("path");
|
|
2616
2616
|
var import_es_toolkit2 = require("es-toolkit");
|
|
2617
|
+
var import_node_path21 = require("path");
|
|
2617
2618
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2618
2619
|
constructor(params) {
|
|
2619
2620
|
super(params);
|
|
@@ -3259,6 +3260,100 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3259
3260
|
}
|
|
3260
3261
|
};
|
|
3261
3262
|
|
|
3263
|
+
// src/features/ignore/zed-ignore.ts
|
|
3264
|
+
var import_es_toolkit3 = require("es-toolkit");
|
|
3265
|
+
var import_node_path31 = require("path");
|
|
3266
|
+
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3267
|
+
constructor(params) {
|
|
3268
|
+
super(params);
|
|
3269
|
+
const jsonValue = JSON.parse(this.fileContent);
|
|
3270
|
+
this.patterns = jsonValue.private_files ?? [];
|
|
3271
|
+
}
|
|
3272
|
+
static getSettablePaths() {
|
|
3273
|
+
return {
|
|
3274
|
+
relativeDirPath: ".zed",
|
|
3275
|
+
relativeFilePath: "settings.json"
|
|
3276
|
+
};
|
|
3277
|
+
}
|
|
3278
|
+
/**
|
|
3279
|
+
* ZedIgnore uses settings.json which is a user-managed config file.
|
|
3280
|
+
* It should not be deleted by rulesync.
|
|
3281
|
+
*/
|
|
3282
|
+
isDeletable() {
|
|
3283
|
+
return false;
|
|
3284
|
+
}
|
|
3285
|
+
toRulesyncIgnore() {
|
|
3286
|
+
const rulesyncPatterns = this.patterns.filter((pattern) => pattern.length > 0);
|
|
3287
|
+
const fileContent = rulesyncPatterns.join("\n");
|
|
3288
|
+
return new RulesyncIgnore({
|
|
3289
|
+
baseDir: this.baseDir,
|
|
3290
|
+
relativeDirPath: RulesyncIgnore.getSettablePaths().recommended.relativeDirPath,
|
|
3291
|
+
relativeFilePath: RulesyncIgnore.getSettablePaths().recommended.relativeFilePath,
|
|
3292
|
+
fileContent
|
|
3293
|
+
});
|
|
3294
|
+
}
|
|
3295
|
+
static async fromRulesyncIgnore({
|
|
3296
|
+
baseDir = process.cwd(),
|
|
3297
|
+
rulesyncIgnore
|
|
3298
|
+
}) {
|
|
3299
|
+
const fileContent = rulesyncIgnore.getFileContent();
|
|
3300
|
+
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3301
|
+
const filePath = (0, import_node_path31.join)(
|
|
3302
|
+
baseDir,
|
|
3303
|
+
this.getSettablePaths().relativeDirPath,
|
|
3304
|
+
this.getSettablePaths().relativeFilePath
|
|
3305
|
+
);
|
|
3306
|
+
const exists = await fileExists(filePath);
|
|
3307
|
+
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
3308
|
+
const existingJsonValue = JSON.parse(existingFileContent);
|
|
3309
|
+
const existingPrivateFiles = existingJsonValue.private_files ?? [];
|
|
3310
|
+
const mergedPatterns = (0, import_es_toolkit3.uniq)([...existingPrivateFiles, ...patterns].toSorted());
|
|
3311
|
+
const jsonValue = {
|
|
3312
|
+
...existingJsonValue,
|
|
3313
|
+
private_files: mergedPatterns
|
|
3314
|
+
};
|
|
3315
|
+
return new _ZedIgnore({
|
|
3316
|
+
baseDir,
|
|
3317
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3318
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3319
|
+
fileContent: JSON.stringify(jsonValue, null, 2),
|
|
3320
|
+
validate: true
|
|
3321
|
+
});
|
|
3322
|
+
}
|
|
3323
|
+
static async fromFile({
|
|
3324
|
+
baseDir = process.cwd(),
|
|
3325
|
+
validate = true
|
|
3326
|
+
}) {
|
|
3327
|
+
const fileContent = await readFileContent(
|
|
3328
|
+
(0, import_node_path31.join)(
|
|
3329
|
+
baseDir,
|
|
3330
|
+
this.getSettablePaths().relativeDirPath,
|
|
3331
|
+
this.getSettablePaths().relativeFilePath
|
|
3332
|
+
)
|
|
3333
|
+
);
|
|
3334
|
+
return new _ZedIgnore({
|
|
3335
|
+
baseDir,
|
|
3336
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3337
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3338
|
+
fileContent,
|
|
3339
|
+
validate
|
|
3340
|
+
});
|
|
3341
|
+
}
|
|
3342
|
+
static forDeletion({
|
|
3343
|
+
baseDir = process.cwd(),
|
|
3344
|
+
relativeDirPath,
|
|
3345
|
+
relativeFilePath
|
|
3346
|
+
}) {
|
|
3347
|
+
return new _ZedIgnore({
|
|
3348
|
+
baseDir,
|
|
3349
|
+
relativeDirPath,
|
|
3350
|
+
relativeFilePath,
|
|
3351
|
+
fileContent: "{}",
|
|
3352
|
+
validate: false
|
|
3353
|
+
});
|
|
3354
|
+
}
|
|
3355
|
+
};
|
|
3356
|
+
|
|
3262
3357
|
// src/features/ignore/ignore-processor.ts
|
|
3263
3358
|
var ignoreProcessorToolTargets = [
|
|
3264
3359
|
"augmentcode",
|
|
@@ -3272,7 +3367,8 @@ var ignoreProcessorToolTargets = [
|
|
|
3272
3367
|
"kiro",
|
|
3273
3368
|
"qwencode",
|
|
3274
3369
|
"roo",
|
|
3275
|
-
"windsurf"
|
|
3370
|
+
"windsurf",
|
|
3371
|
+
"zed"
|
|
3276
3372
|
];
|
|
3277
3373
|
var IgnoreProcessorToolTargetSchema = import_mini13.z.enum(ignoreProcessorToolTargets);
|
|
3278
3374
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
@@ -3287,7 +3383,8 @@ var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
|
3287
3383
|
["kiro", { class: KiroIgnore }],
|
|
3288
3384
|
["qwencode", { class: QwencodeIgnore }],
|
|
3289
3385
|
["roo", { class: RooIgnore }],
|
|
3290
|
-
["windsurf", { class: WindsurfIgnore }]
|
|
3386
|
+
["windsurf", { class: WindsurfIgnore }],
|
|
3387
|
+
["zed", { class: ZedIgnore }]
|
|
3291
3388
|
]);
|
|
3292
3389
|
var defaultGetFactory2 = (target) => {
|
|
3293
3390
|
const factory = toolIgnoreFactories.get(target);
|
|
@@ -3410,10 +3507,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3410
3507
|
var import_mini18 = require("zod/mini");
|
|
3411
3508
|
|
|
3412
3509
|
// src/features/mcp/claudecode-mcp.ts
|
|
3413
|
-
var
|
|
3510
|
+
var import_node_path34 = require("path");
|
|
3414
3511
|
|
|
3415
3512
|
// src/features/mcp/modular-mcp.ts
|
|
3416
|
-
var
|
|
3513
|
+
var import_node_path32 = require("path");
|
|
3417
3514
|
var import_mini15 = require("zod/mini");
|
|
3418
3515
|
|
|
3419
3516
|
// src/types/mcp.ts
|
|
@@ -3501,7 +3598,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3501
3598
|
args: [
|
|
3502
3599
|
"-y",
|
|
3503
3600
|
"@kimuson/modular-mcp",
|
|
3504
|
-
(0,
|
|
3601
|
+
(0, import_node_path32.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3505
3602
|
],
|
|
3506
3603
|
env: {}
|
|
3507
3604
|
}
|
|
@@ -3538,8 +3635,8 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3538
3635
|
};
|
|
3539
3636
|
|
|
3540
3637
|
// src/features/mcp/rulesync-mcp.ts
|
|
3541
|
-
var import_node_path32 = require("path");
|
|
3542
3638
|
var import_object = require("es-toolkit/object");
|
|
3639
|
+
var import_node_path33 = require("path");
|
|
3543
3640
|
var import_mini16 = require("zod/mini");
|
|
3544
3641
|
var RulesyncMcpServerSchema = import_mini16.z.union([
|
|
3545
3642
|
import_mini16.z.extend(McpServerSchema, {
|
|
@@ -3595,12 +3692,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3595
3692
|
}) {
|
|
3596
3693
|
const baseDir = process.cwd();
|
|
3597
3694
|
const paths = this.getSettablePaths();
|
|
3598
|
-
const recommendedPath = (0,
|
|
3695
|
+
const recommendedPath = (0, import_node_path33.join)(
|
|
3599
3696
|
baseDir,
|
|
3600
3697
|
paths.recommended.relativeDirPath,
|
|
3601
3698
|
paths.recommended.relativeFilePath
|
|
3602
3699
|
);
|
|
3603
|
-
const legacyPath = (0,
|
|
3700
|
+
const legacyPath = (0, import_node_path33.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3604
3701
|
if (await fileExists(recommendedPath)) {
|
|
3605
3702
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3606
3703
|
return new _RulesyncMcp({
|
|
@@ -3744,7 +3841,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3744
3841
|
}) {
|
|
3745
3842
|
const paths = this.getSettablePaths({ global });
|
|
3746
3843
|
const fileContent = await readOrInitializeFileContent(
|
|
3747
|
-
(0,
|
|
3844
|
+
(0, import_node_path34.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3748
3845
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3749
3846
|
);
|
|
3750
3847
|
const json = JSON.parse(fileContent);
|
|
@@ -3766,7 +3863,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3766
3863
|
}) {
|
|
3767
3864
|
const paths = this.getSettablePaths({ global });
|
|
3768
3865
|
const fileContent = await readOrInitializeFileContent(
|
|
3769
|
-
(0,
|
|
3866
|
+
(0, import_node_path34.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3770
3867
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3771
3868
|
);
|
|
3772
3869
|
const json = JSON.parse(fileContent);
|
|
@@ -3814,7 +3911,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3814
3911
|
};
|
|
3815
3912
|
|
|
3816
3913
|
// src/features/mcp/cline-mcp.ts
|
|
3817
|
-
var
|
|
3914
|
+
var import_node_path35 = require("path");
|
|
3818
3915
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3819
3916
|
json;
|
|
3820
3917
|
constructor(params) {
|
|
@@ -3835,7 +3932,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3835
3932
|
validate = true
|
|
3836
3933
|
}) {
|
|
3837
3934
|
const fileContent = await readFileContent(
|
|
3838
|
-
(0,
|
|
3935
|
+
(0, import_node_path35.join)(
|
|
3839
3936
|
baseDir,
|
|
3840
3937
|
this.getSettablePaths().relativeDirPath,
|
|
3841
3938
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3884,7 +3981,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3884
3981
|
};
|
|
3885
3982
|
|
|
3886
3983
|
// src/features/mcp/codexcli-mcp.ts
|
|
3887
|
-
var
|
|
3984
|
+
var import_node_path36 = require("path");
|
|
3888
3985
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
3889
3986
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3890
3987
|
toml;
|
|
@@ -3920,7 +4017,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3920
4017
|
}) {
|
|
3921
4018
|
const paths = this.getSettablePaths({ global });
|
|
3922
4019
|
const fileContent = await readFileContent(
|
|
3923
|
-
(0,
|
|
4020
|
+
(0, import_node_path36.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3924
4021
|
);
|
|
3925
4022
|
return new _CodexcliMcp({
|
|
3926
4023
|
baseDir,
|
|
@@ -3937,7 +4034,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3937
4034
|
global = false
|
|
3938
4035
|
}) {
|
|
3939
4036
|
const paths = this.getSettablePaths({ global });
|
|
3940
|
-
const configTomlFilePath = (0,
|
|
4037
|
+
const configTomlFilePath = (0, import_node_path36.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3941
4038
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3942
4039
|
configTomlFilePath,
|
|
3943
4040
|
smolToml.stringify({})
|
|
@@ -3991,7 +4088,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3991
4088
|
};
|
|
3992
4089
|
|
|
3993
4090
|
// src/features/mcp/copilot-mcp.ts
|
|
3994
|
-
var
|
|
4091
|
+
var import_node_path37 = require("path");
|
|
3995
4092
|
function convertToCopilotFormat(mcpServers) {
|
|
3996
4093
|
return { servers: mcpServers };
|
|
3997
4094
|
}
|
|
@@ -4018,7 +4115,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4018
4115
|
validate = true
|
|
4019
4116
|
}) {
|
|
4020
4117
|
const fileContent = await readFileContent(
|
|
4021
|
-
(0,
|
|
4118
|
+
(0, import_node_path37.join)(
|
|
4022
4119
|
baseDir,
|
|
4023
4120
|
this.getSettablePaths().relativeDirPath,
|
|
4024
4121
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4071,7 +4168,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4071
4168
|
};
|
|
4072
4169
|
|
|
4073
4170
|
// src/features/mcp/cursor-mcp.ts
|
|
4074
|
-
var
|
|
4171
|
+
var import_node_path38 = require("path");
|
|
4075
4172
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4076
4173
|
json;
|
|
4077
4174
|
constructor(params) {
|
|
@@ -4092,7 +4189,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4092
4189
|
validate = true
|
|
4093
4190
|
}) {
|
|
4094
4191
|
const fileContent = await readFileContent(
|
|
4095
|
-
(0,
|
|
4192
|
+
(0, import_node_path38.join)(
|
|
4096
4193
|
baseDir,
|
|
4097
4194
|
this.getSettablePaths().relativeDirPath,
|
|
4098
4195
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4152,7 +4249,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4152
4249
|
};
|
|
4153
4250
|
|
|
4154
4251
|
// src/features/mcp/geminicli-mcp.ts
|
|
4155
|
-
var
|
|
4252
|
+
var import_node_path39 = require("path");
|
|
4156
4253
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4157
4254
|
json;
|
|
4158
4255
|
constructor(params) {
|
|
@@ -4181,7 +4278,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4181
4278
|
}) {
|
|
4182
4279
|
const paths = this.getSettablePaths({ global });
|
|
4183
4280
|
const fileContent = await readOrInitializeFileContent(
|
|
4184
|
-
(0,
|
|
4281
|
+
(0, import_node_path39.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4185
4282
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4186
4283
|
);
|
|
4187
4284
|
const json = JSON.parse(fileContent);
|
|
@@ -4202,7 +4299,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4202
4299
|
}) {
|
|
4203
4300
|
const paths = this.getSettablePaths({ global });
|
|
4204
4301
|
const fileContent = await readOrInitializeFileContent(
|
|
4205
|
-
(0,
|
|
4302
|
+
(0, import_node_path39.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4206
4303
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4207
4304
|
);
|
|
4208
4305
|
const json = JSON.parse(fileContent);
|
|
@@ -4239,7 +4336,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4239
4336
|
};
|
|
4240
4337
|
|
|
4241
4338
|
// src/features/mcp/junie-mcp.ts
|
|
4242
|
-
var
|
|
4339
|
+
var import_node_path40 = require("path");
|
|
4243
4340
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4244
4341
|
json;
|
|
4245
4342
|
constructor(params) {
|
|
@@ -4251,7 +4348,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4251
4348
|
}
|
|
4252
4349
|
static getSettablePaths() {
|
|
4253
4350
|
return {
|
|
4254
|
-
relativeDirPath: (0,
|
|
4351
|
+
relativeDirPath: (0, import_node_path40.join)(".junie", "mcp"),
|
|
4255
4352
|
relativeFilePath: "mcp.json"
|
|
4256
4353
|
};
|
|
4257
4354
|
}
|
|
@@ -4260,7 +4357,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4260
4357
|
validate = true
|
|
4261
4358
|
}) {
|
|
4262
4359
|
const fileContent = await readFileContent(
|
|
4263
|
-
(0,
|
|
4360
|
+
(0, import_node_path40.join)(
|
|
4264
4361
|
baseDir,
|
|
4265
4362
|
this.getSettablePaths().relativeDirPath,
|
|
4266
4363
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4309,7 +4406,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4309
4406
|
};
|
|
4310
4407
|
|
|
4311
4408
|
// src/features/mcp/kilo-mcp.ts
|
|
4312
|
-
var
|
|
4409
|
+
var import_node_path41 = require("path");
|
|
4313
4410
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4314
4411
|
json;
|
|
4315
4412
|
constructor(params) {
|
|
@@ -4331,7 +4428,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4331
4428
|
}) {
|
|
4332
4429
|
const paths = this.getSettablePaths();
|
|
4333
4430
|
const fileContent = await readOrInitializeFileContent(
|
|
4334
|
-
(0,
|
|
4431
|
+
(0, import_node_path41.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4335
4432
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4336
4433
|
);
|
|
4337
4434
|
return new _KiloMcp({
|
|
@@ -4385,7 +4482,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4385
4482
|
};
|
|
4386
4483
|
|
|
4387
4484
|
// src/features/mcp/opencode-mcp.ts
|
|
4388
|
-
var
|
|
4485
|
+
var import_node_path42 = require("path");
|
|
4389
4486
|
var import_mini17 = require("zod/mini");
|
|
4390
4487
|
var OpencodeMcpLocalServerSchema = import_mini17.z.object({
|
|
4391
4488
|
type: import_mini17.z.literal("local"),
|
|
@@ -4509,7 +4606,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4509
4606
|
}) {
|
|
4510
4607
|
const paths = this.getSettablePaths({ global });
|
|
4511
4608
|
const fileContent = await readOrInitializeFileContent(
|
|
4512
|
-
(0,
|
|
4609
|
+
(0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4513
4610
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4514
4611
|
);
|
|
4515
4612
|
const json = JSON.parse(fileContent);
|
|
@@ -4530,7 +4627,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4530
4627
|
}) {
|
|
4531
4628
|
const paths = this.getSettablePaths({ global });
|
|
4532
4629
|
const fileContent = await readOrInitializeFileContent(
|
|
4533
|
-
(0,
|
|
4630
|
+
(0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4534
4631
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4535
4632
|
);
|
|
4536
4633
|
const json = JSON.parse(fileContent);
|
|
@@ -4574,7 +4671,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4574
4671
|
};
|
|
4575
4672
|
|
|
4576
4673
|
// src/features/mcp/roo-mcp.ts
|
|
4577
|
-
var
|
|
4674
|
+
var import_node_path43 = require("path");
|
|
4578
4675
|
function isRooMcpServers(value) {
|
|
4579
4676
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4580
4677
|
}
|
|
@@ -4626,7 +4723,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4626
4723
|
validate = true
|
|
4627
4724
|
}) {
|
|
4628
4725
|
const fileContent = await readFileContent(
|
|
4629
|
-
(0,
|
|
4726
|
+
(0, import_node_path43.join)(
|
|
4630
4727
|
baseDir,
|
|
4631
4728
|
this.getSettablePaths().relativeDirPath,
|
|
4632
4729
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4932,25 +5029,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4932
5029
|
};
|
|
4933
5030
|
|
|
4934
5031
|
// src/features/rules/rules-processor.ts
|
|
4935
|
-
var import_node_path90 = require("path");
|
|
4936
5032
|
var import_toon = require("@toon-format/toon");
|
|
5033
|
+
var import_node_path91 = require("path");
|
|
4937
5034
|
var import_mini41 = require("zod/mini");
|
|
4938
5035
|
|
|
4939
5036
|
// src/constants/general.ts
|
|
4940
5037
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4941
5038
|
|
|
4942
5039
|
// src/features/skills/agentsmd-skill.ts
|
|
4943
|
-
var
|
|
5040
|
+
var import_node_path47 = require("path");
|
|
4944
5041
|
|
|
4945
5042
|
// src/features/skills/simulated-skill.ts
|
|
4946
|
-
var
|
|
5043
|
+
var import_node_path46 = require("path");
|
|
4947
5044
|
var import_mini19 = require("zod/mini");
|
|
4948
5045
|
|
|
4949
5046
|
// src/features/skills/tool-skill.ts
|
|
4950
|
-
var
|
|
5047
|
+
var import_node_path45 = require("path");
|
|
4951
5048
|
|
|
4952
5049
|
// src/types/ai-dir.ts
|
|
4953
|
-
var
|
|
5050
|
+
var import_node_path44 = __toESM(require("path"), 1);
|
|
4954
5051
|
var AiDir = class {
|
|
4955
5052
|
/**
|
|
4956
5053
|
* @example "."
|
|
@@ -4984,7 +5081,7 @@ var AiDir = class {
|
|
|
4984
5081
|
otherFiles = [],
|
|
4985
5082
|
global = false
|
|
4986
5083
|
}) {
|
|
4987
|
-
if (dirName.includes(
|
|
5084
|
+
if (dirName.includes(import_node_path44.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
4988
5085
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
4989
5086
|
}
|
|
4990
5087
|
this.baseDir = baseDir;
|
|
@@ -5007,11 +5104,11 @@ var AiDir = class {
|
|
|
5007
5104
|
return this.dirName;
|
|
5008
5105
|
}
|
|
5009
5106
|
getDirPath() {
|
|
5010
|
-
const fullPath =
|
|
5011
|
-
const resolvedFull = (0,
|
|
5012
|
-
const resolvedBase = (0,
|
|
5013
|
-
const rel = (0,
|
|
5014
|
-
if (rel.startsWith("..") ||
|
|
5107
|
+
const fullPath = import_node_path44.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
5108
|
+
const resolvedFull = (0, import_node_path44.resolve)(fullPath);
|
|
5109
|
+
const resolvedBase = (0, import_node_path44.resolve)(this.baseDir);
|
|
5110
|
+
const rel = (0, import_node_path44.relative)(resolvedBase, resolvedFull);
|
|
5111
|
+
if (rel.startsWith("..") || import_node_path44.default.isAbsolute(rel)) {
|
|
5015
5112
|
throw new Error(
|
|
5016
5113
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
5017
5114
|
);
|
|
@@ -5025,7 +5122,7 @@ var AiDir = class {
|
|
|
5025
5122
|
return this.otherFiles;
|
|
5026
5123
|
}
|
|
5027
5124
|
getRelativePathFromCwd() {
|
|
5028
|
-
return
|
|
5125
|
+
return import_node_path44.default.join(this.relativeDirPath, this.dirName);
|
|
5029
5126
|
}
|
|
5030
5127
|
getGlobal() {
|
|
5031
5128
|
return this.global;
|
|
@@ -5044,15 +5141,15 @@ var AiDir = class {
|
|
|
5044
5141
|
* @returns Array of files with their relative paths and buffers
|
|
5045
5142
|
*/
|
|
5046
5143
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5047
|
-
const dirPath = (0,
|
|
5048
|
-
const glob = (0,
|
|
5144
|
+
const dirPath = (0, import_node_path44.join)(baseDir, relativeDirPath, dirName);
|
|
5145
|
+
const glob = (0, import_node_path44.join)(dirPath, "**", "*");
|
|
5049
5146
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5050
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
5147
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path44.basename)(filePath) !== excludeFileName);
|
|
5051
5148
|
const files = await Promise.all(
|
|
5052
5149
|
filteredPaths.map(async (filePath) => {
|
|
5053
5150
|
const fileBuffer = await readFileBuffer(filePath);
|
|
5054
5151
|
return {
|
|
5055
|
-
relativeFilePathToDirPath: (0,
|
|
5152
|
+
relativeFilePathToDirPath: (0, import_node_path44.relative)(dirPath, filePath),
|
|
5056
5153
|
fileBuffer
|
|
5057
5154
|
};
|
|
5058
5155
|
})
|
|
@@ -5143,8 +5240,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5143
5240
|
}) {
|
|
5144
5241
|
const settablePaths = getSettablePaths({ global });
|
|
5145
5242
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5146
|
-
const skillDirPath = (0,
|
|
5147
|
-
const skillFilePath = (0,
|
|
5243
|
+
const skillDirPath = (0, import_node_path45.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5244
|
+
const skillFilePath = (0, import_node_path45.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5148
5245
|
if (!await fileExists(skillFilePath)) {
|
|
5149
5246
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5150
5247
|
}
|
|
@@ -5202,7 +5299,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5202
5299
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5203
5300
|
if (!result.success) {
|
|
5204
5301
|
throw new Error(
|
|
5205
|
-
`Invalid frontmatter in ${(0,
|
|
5302
|
+
`Invalid frontmatter in ${(0, import_node_path46.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5206
5303
|
);
|
|
5207
5304
|
}
|
|
5208
5305
|
}
|
|
@@ -5260,8 +5357,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5260
5357
|
}) {
|
|
5261
5358
|
const settablePaths = this.getSettablePaths();
|
|
5262
5359
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5263
|
-
const skillDirPath = (0,
|
|
5264
|
-
const skillFilePath = (0,
|
|
5360
|
+
const skillDirPath = (0, import_node_path46.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5361
|
+
const skillFilePath = (0, import_node_path46.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5265
5362
|
if (!await fileExists(skillFilePath)) {
|
|
5266
5363
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5267
5364
|
}
|
|
@@ -5338,7 +5435,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5338
5435
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5339
5436
|
}
|
|
5340
5437
|
return {
|
|
5341
|
-
relativeDirPath: (0,
|
|
5438
|
+
relativeDirPath: (0, import_node_path47.join)(".agents", "skills")
|
|
5342
5439
|
};
|
|
5343
5440
|
}
|
|
5344
5441
|
static async fromDir(params) {
|
|
@@ -5365,14 +5462,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5365
5462
|
};
|
|
5366
5463
|
|
|
5367
5464
|
// src/features/skills/geminicli-skill.ts
|
|
5368
|
-
var
|
|
5465
|
+
var import_node_path48 = require("path");
|
|
5369
5466
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5370
5467
|
static getSettablePaths(options) {
|
|
5371
5468
|
if (options?.global) {
|
|
5372
5469
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5373
5470
|
}
|
|
5374
5471
|
return {
|
|
5375
|
-
relativeDirPath: (0,
|
|
5472
|
+
relativeDirPath: (0, import_node_path48.join)(".gemini", "skills")
|
|
5376
5473
|
};
|
|
5377
5474
|
}
|
|
5378
5475
|
static async fromDir(params) {
|
|
@@ -5399,11 +5496,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5399
5496
|
};
|
|
5400
5497
|
|
|
5401
5498
|
// src/features/skills/skills-processor.ts
|
|
5402
|
-
var
|
|
5499
|
+
var import_node_path58 = require("path");
|
|
5403
5500
|
var import_mini28 = require("zod/mini");
|
|
5404
5501
|
|
|
5405
5502
|
// src/types/dir-feature-processor.ts
|
|
5406
|
-
var
|
|
5503
|
+
var import_node_path49 = require("path");
|
|
5407
5504
|
var DirFeatureProcessor = class {
|
|
5408
5505
|
baseDir;
|
|
5409
5506
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5425,14 +5522,14 @@ var DirFeatureProcessor = class {
|
|
|
5425
5522
|
await ensureDir(dirPath);
|
|
5426
5523
|
const mainFile = aiDir.getMainFile();
|
|
5427
5524
|
if (mainFile) {
|
|
5428
|
-
const mainFilePath = (0,
|
|
5525
|
+
const mainFilePath = (0, import_node_path49.join)(dirPath, mainFile.name);
|
|
5429
5526
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5430
5527
|
const contentWithNewline = addTrailingNewline(content);
|
|
5431
5528
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5432
5529
|
}
|
|
5433
5530
|
const otherFiles = aiDir.getOtherFiles();
|
|
5434
5531
|
for (const file of otherFiles) {
|
|
5435
|
-
const filePath = (0,
|
|
5532
|
+
const filePath = (0, import_node_path49.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5436
5533
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5437
5534
|
await writeFileContent(filePath, contentWithNewline);
|
|
5438
5535
|
}
|
|
@@ -5447,11 +5544,11 @@ var DirFeatureProcessor = class {
|
|
|
5447
5544
|
};
|
|
5448
5545
|
|
|
5449
5546
|
// src/features/skills/claudecode-skill.ts
|
|
5450
|
-
var
|
|
5547
|
+
var import_node_path51 = require("path");
|
|
5451
5548
|
var import_mini21 = require("zod/mini");
|
|
5452
5549
|
|
|
5453
5550
|
// src/features/skills/rulesync-skill.ts
|
|
5454
|
-
var
|
|
5551
|
+
var import_node_path50 = require("path");
|
|
5455
5552
|
var import_mini20 = require("zod/mini");
|
|
5456
5553
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
5457
5554
|
name: import_mini20.z.string(),
|
|
@@ -5538,8 +5635,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5538
5635
|
dirName,
|
|
5539
5636
|
global = false
|
|
5540
5637
|
}) {
|
|
5541
|
-
const skillDirPath = (0,
|
|
5542
|
-
const skillFilePath = (0,
|
|
5638
|
+
const skillDirPath = (0, import_node_path50.join)(baseDir, relativeDirPath, dirName);
|
|
5639
|
+
const skillFilePath = (0, import_node_path50.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5543
5640
|
if (!await fileExists(skillFilePath)) {
|
|
5544
5641
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5545
5642
|
}
|
|
@@ -5577,7 +5674,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
|
5577
5674
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5578
5675
|
constructor({
|
|
5579
5676
|
baseDir = process.cwd(),
|
|
5580
|
-
relativeDirPath = (0,
|
|
5677
|
+
relativeDirPath = (0, import_node_path51.join)(".claude", "skills"),
|
|
5581
5678
|
dirName,
|
|
5582
5679
|
frontmatter,
|
|
5583
5680
|
body,
|
|
@@ -5608,7 +5705,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5608
5705
|
global: _global = false
|
|
5609
5706
|
} = {}) {
|
|
5610
5707
|
return {
|
|
5611
|
-
relativeDirPath: (0,
|
|
5708
|
+
relativeDirPath: (0, import_node_path51.join)(".claude", "skills")
|
|
5612
5709
|
};
|
|
5613
5710
|
}
|
|
5614
5711
|
getFrontmatter() {
|
|
@@ -5653,7 +5750,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5653
5750
|
};
|
|
5654
5751
|
return new RulesyncSkill({
|
|
5655
5752
|
baseDir: this.baseDir,
|
|
5656
|
-
relativeDirPath:
|
|
5753
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5657
5754
|
dirName: this.getDirName(),
|
|
5658
5755
|
frontmatter: rulesyncFrontmatter,
|
|
5659
5756
|
body: this.getBody(),
|
|
@@ -5696,9 +5793,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5696
5793
|
});
|
|
5697
5794
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5698
5795
|
if (!result.success) {
|
|
5699
|
-
const skillDirPath = (0,
|
|
5796
|
+
const skillDirPath = (0, import_node_path51.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5700
5797
|
throw new Error(
|
|
5701
|
-
`Invalid frontmatter in ${(0,
|
|
5798
|
+
`Invalid frontmatter in ${(0, import_node_path51.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5702
5799
|
);
|
|
5703
5800
|
}
|
|
5704
5801
|
return new _ClaudecodeSkill({
|
|
@@ -5732,7 +5829,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5732
5829
|
};
|
|
5733
5830
|
|
|
5734
5831
|
// src/features/skills/codexcli-skill.ts
|
|
5735
|
-
var
|
|
5832
|
+
var import_node_path52 = require("path");
|
|
5736
5833
|
var import_mini22 = require("zod/mini");
|
|
5737
5834
|
var CodexCliSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
5738
5835
|
name: import_mini22.z.string(),
|
|
@@ -5741,7 +5838,7 @@ var CodexCliSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
|
5741
5838
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5742
5839
|
constructor({
|
|
5743
5840
|
baseDir = process.cwd(),
|
|
5744
|
-
relativeDirPath = (0,
|
|
5841
|
+
relativeDirPath = (0, import_node_path52.join)(".codex", "skills"),
|
|
5745
5842
|
dirName,
|
|
5746
5843
|
frontmatter,
|
|
5747
5844
|
body,
|
|
@@ -5773,7 +5870,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5773
5870
|
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
5774
5871
|
}
|
|
5775
5872
|
return {
|
|
5776
|
-
relativeDirPath: (0,
|
|
5873
|
+
relativeDirPath: (0, import_node_path52.join)(".codex", "skills")
|
|
5777
5874
|
};
|
|
5778
5875
|
}
|
|
5779
5876
|
getFrontmatter() {
|
|
@@ -5813,7 +5910,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5813
5910
|
};
|
|
5814
5911
|
return new RulesyncSkill({
|
|
5815
5912
|
baseDir: this.baseDir,
|
|
5816
|
-
relativeDirPath:
|
|
5913
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5817
5914
|
dirName: this.getDirName(),
|
|
5818
5915
|
frontmatter: rulesyncFrontmatter,
|
|
5819
5916
|
body: this.getBody(),
|
|
@@ -5855,9 +5952,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5855
5952
|
});
|
|
5856
5953
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5857
5954
|
if (!result.success) {
|
|
5858
|
-
const skillDirPath = (0,
|
|
5955
|
+
const skillDirPath = (0, import_node_path52.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5859
5956
|
throw new Error(
|
|
5860
|
-
`Invalid frontmatter in ${(0,
|
|
5957
|
+
`Invalid frontmatter in ${(0, import_node_path52.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5861
5958
|
);
|
|
5862
5959
|
}
|
|
5863
5960
|
return new _CodexCliSkill({
|
|
@@ -5891,7 +5988,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5891
5988
|
};
|
|
5892
5989
|
|
|
5893
5990
|
// src/features/skills/copilot-skill.ts
|
|
5894
|
-
var
|
|
5991
|
+
var import_node_path53 = require("path");
|
|
5895
5992
|
var import_mini23 = require("zod/mini");
|
|
5896
5993
|
var CopilotSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
5897
5994
|
name: import_mini23.z.string(),
|
|
@@ -5901,7 +5998,7 @@ var CopilotSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
|
5901
5998
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5902
5999
|
constructor({
|
|
5903
6000
|
baseDir = process.cwd(),
|
|
5904
|
-
relativeDirPath = (0,
|
|
6001
|
+
relativeDirPath = (0, import_node_path53.join)(".github", "skills"),
|
|
5905
6002
|
dirName,
|
|
5906
6003
|
frontmatter,
|
|
5907
6004
|
body,
|
|
@@ -5933,7 +6030,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5933
6030
|
throw new Error("CopilotSkill does not support global mode.");
|
|
5934
6031
|
}
|
|
5935
6032
|
return {
|
|
5936
|
-
relativeDirPath: (0,
|
|
6033
|
+
relativeDirPath: (0, import_node_path53.join)(".github", "skills")
|
|
5937
6034
|
};
|
|
5938
6035
|
}
|
|
5939
6036
|
getFrontmatter() {
|
|
@@ -5978,7 +6075,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5978
6075
|
};
|
|
5979
6076
|
return new RulesyncSkill({
|
|
5980
6077
|
baseDir: this.baseDir,
|
|
5981
|
-
relativeDirPath:
|
|
6078
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5982
6079
|
dirName: this.getDirName(),
|
|
5983
6080
|
frontmatter: rulesyncFrontmatter,
|
|
5984
6081
|
body: this.getBody(),
|
|
@@ -6021,9 +6118,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6021
6118
|
});
|
|
6022
6119
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6023
6120
|
if (!result.success) {
|
|
6024
|
-
const skillDirPath = (0,
|
|
6121
|
+
const skillDirPath = (0, import_node_path53.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6025
6122
|
throw new Error(
|
|
6026
|
-
`Invalid frontmatter in ${(0,
|
|
6123
|
+
`Invalid frontmatter in ${(0, import_node_path53.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6027
6124
|
);
|
|
6028
6125
|
}
|
|
6029
6126
|
return new _CopilotSkill({
|
|
@@ -6058,7 +6155,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6058
6155
|
};
|
|
6059
6156
|
|
|
6060
6157
|
// src/features/skills/cursor-skill.ts
|
|
6061
|
-
var
|
|
6158
|
+
var import_node_path54 = require("path");
|
|
6062
6159
|
var import_mini24 = require("zod/mini");
|
|
6063
6160
|
var CursorSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
6064
6161
|
name: import_mini24.z.string(),
|
|
@@ -6067,7 +6164,7 @@ var CursorSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
|
6067
6164
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6068
6165
|
constructor({
|
|
6069
6166
|
baseDir = process.cwd(),
|
|
6070
|
-
relativeDirPath = (0,
|
|
6167
|
+
relativeDirPath = (0, import_node_path54.join)(".cursor", "skills"),
|
|
6071
6168
|
dirName,
|
|
6072
6169
|
frontmatter,
|
|
6073
6170
|
body,
|
|
@@ -6099,7 +6196,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6099
6196
|
throw new Error("CursorSkill does not support global mode.");
|
|
6100
6197
|
}
|
|
6101
6198
|
return {
|
|
6102
|
-
relativeDirPath: (0,
|
|
6199
|
+
relativeDirPath: (0, import_node_path54.join)(".cursor", "skills")
|
|
6103
6200
|
};
|
|
6104
6201
|
}
|
|
6105
6202
|
getFrontmatter() {
|
|
@@ -6139,7 +6236,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6139
6236
|
};
|
|
6140
6237
|
return new RulesyncSkill({
|
|
6141
6238
|
baseDir: this.baseDir,
|
|
6142
|
-
relativeDirPath:
|
|
6239
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6143
6240
|
dirName: this.getDirName(),
|
|
6144
6241
|
frontmatter: rulesyncFrontmatter,
|
|
6145
6242
|
body: this.getBody(),
|
|
@@ -6181,9 +6278,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6181
6278
|
});
|
|
6182
6279
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6183
6280
|
if (!result.success) {
|
|
6184
|
-
const skillDirPath = (0,
|
|
6281
|
+
const skillDirPath = (0, import_node_path54.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6185
6282
|
throw new Error(
|
|
6186
|
-
`Invalid frontmatter in ${(0,
|
|
6283
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6187
6284
|
);
|
|
6188
6285
|
}
|
|
6189
6286
|
return new _CursorSkill({
|
|
@@ -6218,7 +6315,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6218
6315
|
};
|
|
6219
6316
|
|
|
6220
6317
|
// src/features/skills/kilo-skill.ts
|
|
6221
|
-
var
|
|
6318
|
+
var import_node_path55 = require("path");
|
|
6222
6319
|
var import_mini25 = require("zod/mini");
|
|
6223
6320
|
var KiloSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
6224
6321
|
name: import_mini25.z.string(),
|
|
@@ -6227,7 +6324,7 @@ var KiloSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
|
6227
6324
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6228
6325
|
constructor({
|
|
6229
6326
|
baseDir = process.cwd(),
|
|
6230
|
-
relativeDirPath = (0,
|
|
6327
|
+
relativeDirPath = (0, import_node_path55.join)(".kilocode", "skills"),
|
|
6231
6328
|
dirName,
|
|
6232
6329
|
frontmatter,
|
|
6233
6330
|
body,
|
|
@@ -6258,7 +6355,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6258
6355
|
global: _global = false
|
|
6259
6356
|
} = {}) {
|
|
6260
6357
|
return {
|
|
6261
|
-
relativeDirPath: (0,
|
|
6358
|
+
relativeDirPath: (0, import_node_path55.join)(".kilocode", "skills")
|
|
6262
6359
|
};
|
|
6263
6360
|
}
|
|
6264
6361
|
getFrontmatter() {
|
|
@@ -6306,7 +6403,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6306
6403
|
};
|
|
6307
6404
|
return new RulesyncSkill({
|
|
6308
6405
|
baseDir: this.baseDir,
|
|
6309
|
-
relativeDirPath:
|
|
6406
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6310
6407
|
dirName: this.getDirName(),
|
|
6311
6408
|
frontmatter: rulesyncFrontmatter,
|
|
6312
6409
|
body: this.getBody(),
|
|
@@ -6348,13 +6445,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6348
6445
|
});
|
|
6349
6446
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6350
6447
|
if (!result.success) {
|
|
6351
|
-
const skillDirPath = (0,
|
|
6448
|
+
const skillDirPath = (0, import_node_path55.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6352
6449
|
throw new Error(
|
|
6353
|
-
`Invalid frontmatter in ${(0,
|
|
6450
|
+
`Invalid frontmatter in ${(0, import_node_path55.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6354
6451
|
);
|
|
6355
6452
|
}
|
|
6356
6453
|
if (result.data.name !== loaded.dirName) {
|
|
6357
|
-
const skillFilePath = (0,
|
|
6454
|
+
const skillFilePath = (0, import_node_path55.join)(
|
|
6358
6455
|
loaded.baseDir,
|
|
6359
6456
|
loaded.relativeDirPath,
|
|
6360
6457
|
loaded.dirName,
|
|
@@ -6395,7 +6492,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6395
6492
|
};
|
|
6396
6493
|
|
|
6397
6494
|
// src/features/skills/opencode-skill.ts
|
|
6398
|
-
var
|
|
6495
|
+
var import_node_path56 = require("path");
|
|
6399
6496
|
var import_mini26 = require("zod/mini");
|
|
6400
6497
|
var OpenCodeSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
6401
6498
|
name: import_mini26.z.string(),
|
|
@@ -6405,7 +6502,7 @@ var OpenCodeSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
|
6405
6502
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6406
6503
|
constructor({
|
|
6407
6504
|
baseDir = process.cwd(),
|
|
6408
|
-
relativeDirPath = (0,
|
|
6505
|
+
relativeDirPath = (0, import_node_path56.join)(".opencode", "skill"),
|
|
6409
6506
|
dirName,
|
|
6410
6507
|
frontmatter,
|
|
6411
6508
|
body,
|
|
@@ -6434,7 +6531,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6434
6531
|
}
|
|
6435
6532
|
static getSettablePaths({ global = false } = {}) {
|
|
6436
6533
|
return {
|
|
6437
|
-
relativeDirPath: global ? (0,
|
|
6534
|
+
relativeDirPath: global ? (0, import_node_path56.join)(".config", "opencode", "skill") : (0, import_node_path56.join)(".opencode", "skill")
|
|
6438
6535
|
};
|
|
6439
6536
|
}
|
|
6440
6537
|
getFrontmatter() {
|
|
@@ -6479,7 +6576,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6479
6576
|
};
|
|
6480
6577
|
return new RulesyncSkill({
|
|
6481
6578
|
baseDir: this.baseDir,
|
|
6482
|
-
relativeDirPath:
|
|
6579
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6483
6580
|
dirName: this.getDirName(),
|
|
6484
6581
|
frontmatter: rulesyncFrontmatter,
|
|
6485
6582
|
body: this.getBody(),
|
|
@@ -6522,9 +6619,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6522
6619
|
});
|
|
6523
6620
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6524
6621
|
if (!result.success) {
|
|
6525
|
-
const skillDirPath = (0,
|
|
6622
|
+
const skillDirPath = (0, import_node_path56.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6526
6623
|
throw new Error(
|
|
6527
|
-
`Invalid frontmatter in ${(0,
|
|
6624
|
+
`Invalid frontmatter in ${(0, import_node_path56.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6528
6625
|
);
|
|
6529
6626
|
}
|
|
6530
6627
|
return new _OpenCodeSkill({
|
|
@@ -6558,7 +6655,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6558
6655
|
};
|
|
6559
6656
|
|
|
6560
6657
|
// src/features/skills/roo-skill.ts
|
|
6561
|
-
var
|
|
6658
|
+
var import_node_path57 = require("path");
|
|
6562
6659
|
var import_mini27 = require("zod/mini");
|
|
6563
6660
|
var RooSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
6564
6661
|
name: import_mini27.z.string(),
|
|
@@ -6567,7 +6664,7 @@ var RooSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
|
6567
6664
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6568
6665
|
constructor({
|
|
6569
6666
|
baseDir = process.cwd(),
|
|
6570
|
-
relativeDirPath = (0,
|
|
6667
|
+
relativeDirPath = (0, import_node_path57.join)(".roo", "skills"),
|
|
6571
6668
|
dirName,
|
|
6572
6669
|
frontmatter,
|
|
6573
6670
|
body,
|
|
@@ -6598,7 +6695,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6598
6695
|
global: _global = false
|
|
6599
6696
|
} = {}) {
|
|
6600
6697
|
return {
|
|
6601
|
-
relativeDirPath: (0,
|
|
6698
|
+
relativeDirPath: (0, import_node_path57.join)(".roo", "skills")
|
|
6602
6699
|
};
|
|
6603
6700
|
}
|
|
6604
6701
|
getFrontmatter() {
|
|
@@ -6646,7 +6743,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6646
6743
|
};
|
|
6647
6744
|
return new RulesyncSkill({
|
|
6648
6745
|
baseDir: this.baseDir,
|
|
6649
|
-
relativeDirPath:
|
|
6746
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6650
6747
|
dirName: this.getDirName(),
|
|
6651
6748
|
frontmatter: rulesyncFrontmatter,
|
|
6652
6749
|
body: this.getBody(),
|
|
@@ -6688,13 +6785,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6688
6785
|
});
|
|
6689
6786
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6690
6787
|
if (!result.success) {
|
|
6691
|
-
const skillDirPath = (0,
|
|
6788
|
+
const skillDirPath = (0, import_node_path57.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6692
6789
|
throw new Error(
|
|
6693
|
-
`Invalid frontmatter in ${(0,
|
|
6790
|
+
`Invalid frontmatter in ${(0, import_node_path57.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6694
6791
|
);
|
|
6695
6792
|
}
|
|
6696
6793
|
if (result.data.name !== loaded.dirName) {
|
|
6697
|
-
const skillFilePath = (0,
|
|
6794
|
+
const skillFilePath = (0, import_node_path57.join)(
|
|
6698
6795
|
loaded.baseDir,
|
|
6699
6796
|
loaded.relativeDirPath,
|
|
6700
6797
|
loaded.dirName,
|
|
@@ -6897,9 +6994,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6897
6994
|
*/
|
|
6898
6995
|
async loadRulesyncDirs() {
|
|
6899
6996
|
const paths = RulesyncSkill.getSettablePaths();
|
|
6900
|
-
const rulesyncSkillsDirPath = (0,
|
|
6901
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
6902
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
6997
|
+
const rulesyncSkillsDirPath = (0, import_node_path58.join)(this.baseDir, paths.relativeDirPath);
|
|
6998
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path58.join)(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
6999
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path58.basename)(path3));
|
|
6903
7000
|
const rulesyncSkills = await Promise.all(
|
|
6904
7001
|
dirNames.map(
|
|
6905
7002
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -6915,9 +7012,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6915
7012
|
async loadToolDirs() {
|
|
6916
7013
|
const factory = this.getFactory(this.toolTarget);
|
|
6917
7014
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6918
|
-
const skillsDirPath = (0,
|
|
6919
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
6920
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7015
|
+
const skillsDirPath = (0, import_node_path58.join)(this.baseDir, paths.relativeDirPath);
|
|
7016
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path58.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7017
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path58.basename)(path3));
|
|
6921
7018
|
const toolSkills = await Promise.all(
|
|
6922
7019
|
dirNames.map(
|
|
6923
7020
|
(dirName) => factory.class.fromDir({
|
|
@@ -6933,9 +7030,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6933
7030
|
async loadToolDirsToDelete() {
|
|
6934
7031
|
const factory = this.getFactory(this.toolTarget);
|
|
6935
7032
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6936
|
-
const skillsDirPath = (0,
|
|
6937
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
6938
|
-
const dirNames = dirPaths.map((path3) => (0,
|
|
7033
|
+
const skillsDirPath = (0, import_node_path58.join)(this.baseDir, paths.relativeDirPath);
|
|
7034
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path58.join)(skillsDirPath, "*"), { type: "dir" });
|
|
7035
|
+
const dirNames = dirPaths.map((path3) => (0, import_node_path58.basename)(path3));
|
|
6939
7036
|
const toolSkills = dirNames.map(
|
|
6940
7037
|
(dirName) => factory.class.forDeletion({
|
|
6941
7038
|
baseDir: this.baseDir,
|
|
@@ -6983,10 +7080,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6983
7080
|
};
|
|
6984
7081
|
|
|
6985
7082
|
// src/features/subagents/agentsmd-subagent.ts
|
|
6986
|
-
var
|
|
7083
|
+
var import_node_path60 = require("path");
|
|
6987
7084
|
|
|
6988
7085
|
// src/features/subagents/simulated-subagent.ts
|
|
6989
|
-
var
|
|
7086
|
+
var import_node_path59 = require("path");
|
|
6990
7087
|
var import_mini29 = require("zod/mini");
|
|
6991
7088
|
|
|
6992
7089
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7042,7 +7139,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7042
7139
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7043
7140
|
if (!result.success) {
|
|
7044
7141
|
throw new Error(
|
|
7045
|
-
`Invalid frontmatter in ${(0,
|
|
7142
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7046
7143
|
);
|
|
7047
7144
|
}
|
|
7048
7145
|
}
|
|
@@ -7093,7 +7190,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7093
7190
|
return {
|
|
7094
7191
|
success: false,
|
|
7095
7192
|
error: new Error(
|
|
7096
|
-
`Invalid frontmatter in ${(0,
|
|
7193
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7097
7194
|
)
|
|
7098
7195
|
};
|
|
7099
7196
|
}
|
|
@@ -7103,7 +7200,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7103
7200
|
relativeFilePath,
|
|
7104
7201
|
validate = true
|
|
7105
7202
|
}) {
|
|
7106
|
-
const filePath = (0,
|
|
7203
|
+
const filePath = (0, import_node_path59.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7107
7204
|
const fileContent = await readFileContent(filePath);
|
|
7108
7205
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7109
7206
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7113,7 +7210,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7113
7210
|
return {
|
|
7114
7211
|
baseDir,
|
|
7115
7212
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
7116
|
-
relativeFilePath: (0,
|
|
7213
|
+
relativeFilePath: (0, import_node_path59.basename)(relativeFilePath),
|
|
7117
7214
|
frontmatter: result.data,
|
|
7118
7215
|
body: content.trim(),
|
|
7119
7216
|
validate
|
|
@@ -7139,7 +7236,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7139
7236
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7140
7237
|
static getSettablePaths() {
|
|
7141
7238
|
return {
|
|
7142
|
-
relativeDirPath: (0,
|
|
7239
|
+
relativeDirPath: (0, import_node_path60.join)(".agents", "subagents")
|
|
7143
7240
|
};
|
|
7144
7241
|
}
|
|
7145
7242
|
static async fromFile(params) {
|
|
@@ -7162,11 +7259,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7162
7259
|
};
|
|
7163
7260
|
|
|
7164
7261
|
// src/features/subagents/codexcli-subagent.ts
|
|
7165
|
-
var
|
|
7262
|
+
var import_node_path61 = require("path");
|
|
7166
7263
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7167
7264
|
static getSettablePaths() {
|
|
7168
7265
|
return {
|
|
7169
|
-
relativeDirPath: (0,
|
|
7266
|
+
relativeDirPath: (0, import_node_path61.join)(".codex", "subagents")
|
|
7170
7267
|
};
|
|
7171
7268
|
}
|
|
7172
7269
|
static async fromFile(params) {
|
|
@@ -7189,11 +7286,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7189
7286
|
};
|
|
7190
7287
|
|
|
7191
7288
|
// src/features/subagents/cursor-subagent.ts
|
|
7192
|
-
var
|
|
7289
|
+
var import_node_path62 = require("path");
|
|
7193
7290
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7194
7291
|
static getSettablePaths() {
|
|
7195
7292
|
return {
|
|
7196
|
-
relativeDirPath: (0,
|
|
7293
|
+
relativeDirPath: (0, import_node_path62.join)(".cursor", "subagents")
|
|
7197
7294
|
};
|
|
7198
7295
|
}
|
|
7199
7296
|
static async fromFile(params) {
|
|
@@ -7216,11 +7313,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7216
7313
|
};
|
|
7217
7314
|
|
|
7218
7315
|
// src/features/subagents/geminicli-subagent.ts
|
|
7219
|
-
var
|
|
7316
|
+
var import_node_path63 = require("path");
|
|
7220
7317
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7221
7318
|
static getSettablePaths() {
|
|
7222
7319
|
return {
|
|
7223
|
-
relativeDirPath: (0,
|
|
7320
|
+
relativeDirPath: (0, import_node_path63.join)(".gemini", "subagents")
|
|
7224
7321
|
};
|
|
7225
7322
|
}
|
|
7226
7323
|
static async fromFile(params) {
|
|
@@ -7243,11 +7340,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7243
7340
|
};
|
|
7244
7341
|
|
|
7245
7342
|
// src/features/subagents/roo-subagent.ts
|
|
7246
|
-
var
|
|
7343
|
+
var import_node_path64 = require("path");
|
|
7247
7344
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7248
7345
|
static getSettablePaths() {
|
|
7249
7346
|
return {
|
|
7250
|
-
relativeDirPath: (0,
|
|
7347
|
+
relativeDirPath: (0, import_node_path64.join)(".roo", "subagents")
|
|
7251
7348
|
};
|
|
7252
7349
|
}
|
|
7253
7350
|
static async fromFile(params) {
|
|
@@ -7270,15 +7367,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7270
7367
|
};
|
|
7271
7368
|
|
|
7272
7369
|
// src/features/subagents/subagents-processor.ts
|
|
7273
|
-
var
|
|
7370
|
+
var import_node_path69 = require("path");
|
|
7274
7371
|
var import_mini34 = require("zod/mini");
|
|
7275
7372
|
|
|
7276
7373
|
// src/features/subagents/claudecode-subagent.ts
|
|
7277
|
-
var
|
|
7374
|
+
var import_node_path66 = require("path");
|
|
7278
7375
|
var import_mini31 = require("zod/mini");
|
|
7279
7376
|
|
|
7280
7377
|
// src/features/subagents/rulesync-subagent.ts
|
|
7281
|
-
var
|
|
7378
|
+
var import_node_path65 = require("path");
|
|
7282
7379
|
var import_mini30 = require("zod/mini");
|
|
7283
7380
|
var RulesyncSubagentFrontmatterSchema = import_mini30.z.looseObject({
|
|
7284
7381
|
targets: RulesyncTargetsSchema,
|
|
@@ -7293,7 +7390,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7293
7390
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7294
7391
|
if (!result.success) {
|
|
7295
7392
|
throw new Error(
|
|
7296
|
-
`Invalid frontmatter in ${(0,
|
|
7393
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7297
7394
|
);
|
|
7298
7395
|
}
|
|
7299
7396
|
}
|
|
@@ -7326,7 +7423,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7326
7423
|
return {
|
|
7327
7424
|
success: false,
|
|
7328
7425
|
error: new Error(
|
|
7329
|
-
`Invalid frontmatter in ${(0,
|
|
7426
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7330
7427
|
)
|
|
7331
7428
|
};
|
|
7332
7429
|
}
|
|
@@ -7335,14 +7432,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7335
7432
|
relativeFilePath
|
|
7336
7433
|
}) {
|
|
7337
7434
|
const fileContent = await readFileContent(
|
|
7338
|
-
(0,
|
|
7435
|
+
(0, import_node_path65.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7339
7436
|
);
|
|
7340
7437
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7341
7438
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7342
7439
|
if (!result.success) {
|
|
7343
7440
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
7344
7441
|
}
|
|
7345
|
-
const filename = (0,
|
|
7442
|
+
const filename = (0, import_node_path65.basename)(relativeFilePath);
|
|
7346
7443
|
return new _RulesyncSubagent({
|
|
7347
7444
|
baseDir: process.cwd(),
|
|
7348
7445
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -7370,7 +7467,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7370
7467
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7371
7468
|
if (!result.success) {
|
|
7372
7469
|
throw new Error(
|
|
7373
|
-
`Invalid frontmatter in ${(0,
|
|
7470
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7374
7471
|
);
|
|
7375
7472
|
}
|
|
7376
7473
|
}
|
|
@@ -7382,7 +7479,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7382
7479
|
}
|
|
7383
7480
|
static getSettablePaths(_options = {}) {
|
|
7384
7481
|
return {
|
|
7385
|
-
relativeDirPath: (0,
|
|
7482
|
+
relativeDirPath: (0, import_node_path66.join)(".claude", "agents")
|
|
7386
7483
|
};
|
|
7387
7484
|
}
|
|
7388
7485
|
getFrontmatter() {
|
|
@@ -7456,7 +7553,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7456
7553
|
return {
|
|
7457
7554
|
success: false,
|
|
7458
7555
|
error: new Error(
|
|
7459
|
-
`Invalid frontmatter in ${(0,
|
|
7556
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7460
7557
|
)
|
|
7461
7558
|
};
|
|
7462
7559
|
}
|
|
@@ -7474,7 +7571,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7474
7571
|
global = false
|
|
7475
7572
|
}) {
|
|
7476
7573
|
const paths = this.getSettablePaths({ global });
|
|
7477
|
-
const filePath = (0,
|
|
7574
|
+
const filePath = (0, import_node_path66.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7478
7575
|
const fileContent = await readFileContent(filePath);
|
|
7479
7576
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7480
7577
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7509,7 +7606,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7509
7606
|
};
|
|
7510
7607
|
|
|
7511
7608
|
// src/features/subagents/copilot-subagent.ts
|
|
7512
|
-
var
|
|
7609
|
+
var import_node_path67 = require("path");
|
|
7513
7610
|
var import_mini32 = require("zod/mini");
|
|
7514
7611
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7515
7612
|
var CopilotSubagentFrontmatterSchema = import_mini32.z.looseObject({
|
|
@@ -7535,7 +7632,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7535
7632
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7536
7633
|
if (!result.success) {
|
|
7537
7634
|
throw new Error(
|
|
7538
|
-
`Invalid frontmatter in ${(0,
|
|
7635
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7539
7636
|
);
|
|
7540
7637
|
}
|
|
7541
7638
|
}
|
|
@@ -7547,7 +7644,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7547
7644
|
}
|
|
7548
7645
|
static getSettablePaths(_options = {}) {
|
|
7549
7646
|
return {
|
|
7550
|
-
relativeDirPath: (0,
|
|
7647
|
+
relativeDirPath: (0, import_node_path67.join)(".github", "agents")
|
|
7551
7648
|
};
|
|
7552
7649
|
}
|
|
7553
7650
|
getFrontmatter() {
|
|
@@ -7621,7 +7718,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7621
7718
|
return {
|
|
7622
7719
|
success: false,
|
|
7623
7720
|
error: new Error(
|
|
7624
|
-
`Invalid frontmatter in ${(0,
|
|
7721
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7625
7722
|
)
|
|
7626
7723
|
};
|
|
7627
7724
|
}
|
|
@@ -7639,7 +7736,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7639
7736
|
global = false
|
|
7640
7737
|
}) {
|
|
7641
7738
|
const paths = this.getSettablePaths({ global });
|
|
7642
|
-
const filePath = (0,
|
|
7739
|
+
const filePath = (0, import_node_path67.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7643
7740
|
const fileContent = await readFileContent(filePath);
|
|
7644
7741
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7645
7742
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7675,7 +7772,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7675
7772
|
};
|
|
7676
7773
|
|
|
7677
7774
|
// src/features/subagents/opencode-subagent.ts
|
|
7678
|
-
var
|
|
7775
|
+
var import_node_path68 = require("path");
|
|
7679
7776
|
var import_mini33 = require("zod/mini");
|
|
7680
7777
|
var OpenCodeSubagentFrontmatterSchema = import_mini33.z.looseObject({
|
|
7681
7778
|
description: import_mini33.z.string(),
|
|
@@ -7690,7 +7787,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7690
7787
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7691
7788
|
if (!result.success) {
|
|
7692
7789
|
throw new Error(
|
|
7693
|
-
`Invalid frontmatter in ${(0,
|
|
7790
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7694
7791
|
);
|
|
7695
7792
|
}
|
|
7696
7793
|
}
|
|
@@ -7704,7 +7801,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7704
7801
|
global = false
|
|
7705
7802
|
} = {}) {
|
|
7706
7803
|
return {
|
|
7707
|
-
relativeDirPath: global ? (0,
|
|
7804
|
+
relativeDirPath: global ? (0, import_node_path68.join)(".config", "opencode", "agent") : (0, import_node_path68.join)(".opencode", "agent")
|
|
7708
7805
|
};
|
|
7709
7806
|
}
|
|
7710
7807
|
getFrontmatter() {
|
|
@@ -7717,7 +7814,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7717
7814
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7718
7815
|
const rulesyncFrontmatter = {
|
|
7719
7816
|
targets: ["opencode"],
|
|
7720
|
-
name: name ?? (0,
|
|
7817
|
+
name: name ?? (0, import_node_path68.basename)(this.getRelativeFilePath(), ".md"),
|
|
7721
7818
|
description,
|
|
7722
7819
|
opencode: { mode, ...opencodeSection }
|
|
7723
7820
|
};
|
|
@@ -7770,7 +7867,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7770
7867
|
return {
|
|
7771
7868
|
success: false,
|
|
7772
7869
|
error: new Error(
|
|
7773
|
-
`Invalid frontmatter in ${(0,
|
|
7870
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7774
7871
|
)
|
|
7775
7872
|
};
|
|
7776
7873
|
}
|
|
@@ -7787,7 +7884,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7787
7884
|
global = false
|
|
7788
7885
|
}) {
|
|
7789
7886
|
const paths = this.getSettablePaths({ global });
|
|
7790
|
-
const filePath = (0,
|
|
7887
|
+
const filePath = (0, import_node_path68.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7791
7888
|
const fileContent = await readFileContent(filePath);
|
|
7792
7889
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7793
7890
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7948,7 +8045,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7948
8045
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
7949
8046
|
*/
|
|
7950
8047
|
async loadRulesyncFiles() {
|
|
7951
|
-
const subagentsDir = (0,
|
|
8048
|
+
const subagentsDir = (0, import_node_path69.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
7952
8049
|
const dirExists = await directoryExists(subagentsDir);
|
|
7953
8050
|
if (!dirExists) {
|
|
7954
8051
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -7963,7 +8060,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7963
8060
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
7964
8061
|
const rulesyncSubagents = [];
|
|
7965
8062
|
for (const mdFile of mdFiles) {
|
|
7966
|
-
const filepath = (0,
|
|
8063
|
+
const filepath = (0, import_node_path69.join)(subagentsDir, mdFile);
|
|
7967
8064
|
try {
|
|
7968
8065
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
7969
8066
|
relativeFilePath: mdFile,
|
|
@@ -7993,14 +8090,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7993
8090
|
const factory = this.getFactory(this.toolTarget);
|
|
7994
8091
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7995
8092
|
const subagentFilePaths = await findFilesByGlobs(
|
|
7996
|
-
(0,
|
|
8093
|
+
(0, import_node_path69.join)(this.baseDir, paths.relativeDirPath, "*.md")
|
|
7997
8094
|
);
|
|
7998
8095
|
if (forDeletion) {
|
|
7999
8096
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8000
8097
|
(path3) => factory.class.forDeletion({
|
|
8001
8098
|
baseDir: this.baseDir,
|
|
8002
8099
|
relativeDirPath: paths.relativeDirPath,
|
|
8003
|
-
relativeFilePath: (0,
|
|
8100
|
+
relativeFilePath: (0, import_node_path69.basename)(path3),
|
|
8004
8101
|
global: this.global
|
|
8005
8102
|
})
|
|
8006
8103
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8011,7 +8108,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8011
8108
|
subagentFilePaths.map(
|
|
8012
8109
|
(path3) => factory.class.fromFile({
|
|
8013
8110
|
baseDir: this.baseDir,
|
|
8014
|
-
relativeFilePath: (0,
|
|
8111
|
+
relativeFilePath: (0, import_node_path69.basename)(path3),
|
|
8015
8112
|
global: this.global
|
|
8016
8113
|
})
|
|
8017
8114
|
)
|
|
@@ -8043,13 +8140,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8043
8140
|
};
|
|
8044
8141
|
|
|
8045
8142
|
// src/features/rules/agentsmd-rule.ts
|
|
8046
|
-
var
|
|
8143
|
+
var import_node_path72 = require("path");
|
|
8047
8144
|
|
|
8048
8145
|
// src/features/rules/tool-rule.ts
|
|
8049
|
-
var
|
|
8146
|
+
var import_node_path71 = require("path");
|
|
8050
8147
|
|
|
8051
8148
|
// src/features/rules/rulesync-rule.ts
|
|
8052
|
-
var
|
|
8149
|
+
var import_node_path70 = require("path");
|
|
8053
8150
|
var import_mini35 = require("zod/mini");
|
|
8054
8151
|
var RulesyncRuleFrontmatterSchema = import_mini35.z.object({
|
|
8055
8152
|
root: import_mini35.z.optional(import_mini35.z.optional(import_mini35.z.boolean())),
|
|
@@ -8096,7 +8193,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8096
8193
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8097
8194
|
if (!result.success) {
|
|
8098
8195
|
throw new Error(
|
|
8099
|
-
`Invalid frontmatter in ${(0,
|
|
8196
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8100
8197
|
);
|
|
8101
8198
|
}
|
|
8102
8199
|
}
|
|
@@ -8131,7 +8228,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8131
8228
|
return {
|
|
8132
8229
|
success: false,
|
|
8133
8230
|
error: new Error(
|
|
8134
|
-
`Invalid frontmatter in ${(0,
|
|
8231
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8135
8232
|
)
|
|
8136
8233
|
};
|
|
8137
8234
|
}
|
|
@@ -8140,16 +8237,18 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8140
8237
|
relativeFilePath,
|
|
8141
8238
|
validate = true
|
|
8142
8239
|
}) {
|
|
8143
|
-
const legacyPath = (0,
|
|
8240
|
+
const legacyPath = (0, import_node_path70.join)(
|
|
8144
8241
|
process.cwd(),
|
|
8145
8242
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8146
8243
|
relativeFilePath
|
|
8147
8244
|
);
|
|
8148
|
-
const recommendedPath = (0,
|
|
8245
|
+
const recommendedPath = (0, import_node_path70.join)(
|
|
8149
8246
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8150
8247
|
relativeFilePath
|
|
8151
8248
|
);
|
|
8152
|
-
logger.warn(
|
|
8249
|
+
logger.warn(
|
|
8250
|
+
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
8251
|
+
);
|
|
8153
8252
|
const fileContent = await readFileContent(legacyPath);
|
|
8154
8253
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8155
8254
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8164,7 +8263,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8164
8263
|
agentsmd: result.data.agentsmd,
|
|
8165
8264
|
cursor: result.data.cursor
|
|
8166
8265
|
};
|
|
8167
|
-
const filename = (0,
|
|
8266
|
+
const filename = (0, import_node_path70.basename)(legacyPath);
|
|
8168
8267
|
return new _RulesyncRule({
|
|
8169
8268
|
baseDir: process.cwd(),
|
|
8170
8269
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8178,7 +8277,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8178
8277
|
relativeFilePath,
|
|
8179
8278
|
validate = true
|
|
8180
8279
|
}) {
|
|
8181
|
-
const filePath = (0,
|
|
8280
|
+
const filePath = (0, import_node_path70.join)(
|
|
8182
8281
|
process.cwd(),
|
|
8183
8282
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8184
8283
|
relativeFilePath
|
|
@@ -8197,7 +8296,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8197
8296
|
agentsmd: result.data.agentsmd,
|
|
8198
8297
|
cursor: result.data.cursor
|
|
8199
8298
|
};
|
|
8200
|
-
const filename = (0,
|
|
8299
|
+
const filename = (0, import_node_path70.basename)(filePath);
|
|
8201
8300
|
return new _RulesyncRule({
|
|
8202
8301
|
baseDir: process.cwd(),
|
|
8203
8302
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8280,7 +8379,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8280
8379
|
rulesyncRule,
|
|
8281
8380
|
validate = true,
|
|
8282
8381
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8283
|
-
nonRootPath = { relativeDirPath: (0,
|
|
8382
|
+
nonRootPath = { relativeDirPath: (0, import_node_path71.join)(".agents", "memories") }
|
|
8284
8383
|
}) {
|
|
8285
8384
|
const params = this.buildToolRuleParamsDefault({
|
|
8286
8385
|
baseDir,
|
|
@@ -8291,7 +8390,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8291
8390
|
});
|
|
8292
8391
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8293
8392
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8294
|
-
params.relativeDirPath = (0,
|
|
8393
|
+
params.relativeDirPath = (0, import_node_path71.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8295
8394
|
params.relativeFilePath = "AGENTS.md";
|
|
8296
8395
|
}
|
|
8297
8396
|
return params;
|
|
@@ -8356,7 +8455,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8356
8455
|
relativeFilePath: "AGENTS.md"
|
|
8357
8456
|
},
|
|
8358
8457
|
nonRoot: {
|
|
8359
|
-
relativeDirPath: (0,
|
|
8458
|
+
relativeDirPath: (0, import_node_path72.join)(".agents", "memories")
|
|
8360
8459
|
}
|
|
8361
8460
|
};
|
|
8362
8461
|
}
|
|
@@ -8366,8 +8465,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8366
8465
|
validate = true
|
|
8367
8466
|
}) {
|
|
8368
8467
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8369
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8370
|
-
const fileContent = await readFileContent((0,
|
|
8468
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path72.join)(".agents", "memories", relativeFilePath);
|
|
8469
|
+
const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
|
|
8371
8470
|
return new _AgentsMdRule({
|
|
8372
8471
|
baseDir,
|
|
8373
8472
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8422,7 +8521,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8422
8521
|
};
|
|
8423
8522
|
|
|
8424
8523
|
// src/features/rules/antigravity-rule.ts
|
|
8425
|
-
var
|
|
8524
|
+
var import_node_path73 = require("path");
|
|
8426
8525
|
var import_mini36 = require("zod/mini");
|
|
8427
8526
|
var AntigravityRuleFrontmatterSchema = import_mini36.z.looseObject({
|
|
8428
8527
|
trigger: import_mini36.z.optional(
|
|
@@ -8581,7 +8680,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8581
8680
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8582
8681
|
if (!result.success) {
|
|
8583
8682
|
throw new Error(
|
|
8584
|
-
`Invalid frontmatter in ${(0,
|
|
8683
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8585
8684
|
);
|
|
8586
8685
|
}
|
|
8587
8686
|
}
|
|
@@ -8596,7 +8695,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8596
8695
|
static getSettablePaths() {
|
|
8597
8696
|
return {
|
|
8598
8697
|
nonRoot: {
|
|
8599
|
-
relativeDirPath: (0,
|
|
8698
|
+
relativeDirPath: (0, import_node_path73.join)(".agent", "rules")
|
|
8600
8699
|
}
|
|
8601
8700
|
};
|
|
8602
8701
|
}
|
|
@@ -8605,7 +8704,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8605
8704
|
relativeFilePath,
|
|
8606
8705
|
validate = true
|
|
8607
8706
|
}) {
|
|
8608
|
-
const filePath = (0,
|
|
8707
|
+
const filePath = (0, import_node_path73.join)(
|
|
8609
8708
|
baseDir,
|
|
8610
8709
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8611
8710
|
relativeFilePath
|
|
@@ -8746,7 +8845,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8746
8845
|
};
|
|
8747
8846
|
|
|
8748
8847
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8749
|
-
var
|
|
8848
|
+
var import_node_path74 = require("path");
|
|
8750
8849
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8751
8850
|
toRulesyncRule() {
|
|
8752
8851
|
const rulesyncFrontmatter = {
|
|
@@ -8772,7 +8871,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8772
8871
|
relativeFilePath: ".augment-guidelines"
|
|
8773
8872
|
},
|
|
8774
8873
|
nonRoot: {
|
|
8775
|
-
relativeDirPath: (0,
|
|
8874
|
+
relativeDirPath: (0, import_node_path74.join)(".augment", "rules")
|
|
8776
8875
|
}
|
|
8777
8876
|
};
|
|
8778
8877
|
}
|
|
@@ -8807,8 +8906,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8807
8906
|
}) {
|
|
8808
8907
|
const settablePaths = this.getSettablePaths();
|
|
8809
8908
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8810
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
8811
|
-
const fileContent = await readFileContent((0,
|
|
8909
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path74.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8910
|
+
const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
|
|
8812
8911
|
return new _AugmentcodeLegacyRule({
|
|
8813
8912
|
baseDir,
|
|
8814
8913
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8837,7 +8936,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8837
8936
|
};
|
|
8838
8937
|
|
|
8839
8938
|
// src/features/rules/augmentcode-rule.ts
|
|
8840
|
-
var
|
|
8939
|
+
var import_node_path75 = require("path");
|
|
8841
8940
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8842
8941
|
toRulesyncRule() {
|
|
8843
8942
|
return this.toRulesyncRuleDefault();
|
|
@@ -8845,7 +8944,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8845
8944
|
static getSettablePaths() {
|
|
8846
8945
|
return {
|
|
8847
8946
|
nonRoot: {
|
|
8848
|
-
relativeDirPath: (0,
|
|
8947
|
+
relativeDirPath: (0, import_node_path75.join)(".augment", "rules")
|
|
8849
8948
|
}
|
|
8850
8949
|
};
|
|
8851
8950
|
}
|
|
@@ -8869,7 +8968,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8869
8968
|
validate = true
|
|
8870
8969
|
}) {
|
|
8871
8970
|
const fileContent = await readFileContent(
|
|
8872
|
-
(0,
|
|
8971
|
+
(0, import_node_path75.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8873
8972
|
);
|
|
8874
8973
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8875
8974
|
return new _AugmentcodeRule({
|
|
@@ -8905,7 +9004,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8905
9004
|
};
|
|
8906
9005
|
|
|
8907
9006
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8908
|
-
var
|
|
9007
|
+
var import_node_path76 = require("path");
|
|
8909
9008
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8910
9009
|
static getSettablePaths({
|
|
8911
9010
|
global
|
|
@@ -8924,7 +9023,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8924
9023
|
relativeFilePath: "CLAUDE.md"
|
|
8925
9024
|
},
|
|
8926
9025
|
nonRoot: {
|
|
8927
|
-
relativeDirPath: (0,
|
|
9026
|
+
relativeDirPath: (0, import_node_path76.join)(".claude", "memories")
|
|
8928
9027
|
}
|
|
8929
9028
|
};
|
|
8930
9029
|
}
|
|
@@ -8939,7 +9038,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8939
9038
|
if (isRoot) {
|
|
8940
9039
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8941
9040
|
const fileContent2 = await readFileContent(
|
|
8942
|
-
(0,
|
|
9041
|
+
(0, import_node_path76.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8943
9042
|
);
|
|
8944
9043
|
return new _ClaudecodeLegacyRule({
|
|
8945
9044
|
baseDir,
|
|
@@ -8953,8 +9052,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8953
9052
|
if (!paths.nonRoot) {
|
|
8954
9053
|
throw new Error("nonRoot path is not set");
|
|
8955
9054
|
}
|
|
8956
|
-
const relativePath = (0,
|
|
8957
|
-
const fileContent = await readFileContent((0,
|
|
9055
|
+
const relativePath = (0, import_node_path76.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9056
|
+
const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
|
|
8958
9057
|
return new _ClaudecodeLegacyRule({
|
|
8959
9058
|
baseDir,
|
|
8960
9059
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9013,7 +9112,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9013
9112
|
};
|
|
9014
9113
|
|
|
9015
9114
|
// src/features/rules/claudecode-rule.ts
|
|
9016
|
-
var
|
|
9115
|
+
var import_node_path77 = require("path");
|
|
9017
9116
|
var import_mini37 = require("zod/mini");
|
|
9018
9117
|
var ClaudecodeRuleFrontmatterSchema = import_mini37.z.object({
|
|
9019
9118
|
paths: import_mini37.z.optional(import_mini37.z.string())
|
|
@@ -9038,7 +9137,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9038
9137
|
relativeFilePath: "CLAUDE.md"
|
|
9039
9138
|
},
|
|
9040
9139
|
nonRoot: {
|
|
9041
|
-
relativeDirPath: (0,
|
|
9140
|
+
relativeDirPath: (0, import_node_path77.join)(".claude", "rules")
|
|
9042
9141
|
}
|
|
9043
9142
|
};
|
|
9044
9143
|
}
|
|
@@ -9047,7 +9146,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9047
9146
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9048
9147
|
if (!result.success) {
|
|
9049
9148
|
throw new Error(
|
|
9050
|
-
`Invalid frontmatter in ${(0,
|
|
9149
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9051
9150
|
);
|
|
9052
9151
|
}
|
|
9053
9152
|
}
|
|
@@ -9075,7 +9174,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9075
9174
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9076
9175
|
if (isRoot) {
|
|
9077
9176
|
const fileContent2 = await readFileContent(
|
|
9078
|
-
(0,
|
|
9177
|
+
(0, import_node_path77.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9079
9178
|
);
|
|
9080
9179
|
return new _ClaudecodeRule({
|
|
9081
9180
|
baseDir,
|
|
@@ -9090,13 +9189,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9090
9189
|
if (!paths.nonRoot) {
|
|
9091
9190
|
throw new Error("nonRoot path is not set");
|
|
9092
9191
|
}
|
|
9093
|
-
const relativePath = (0,
|
|
9094
|
-
const fileContent = await readFileContent((0,
|
|
9192
|
+
const relativePath = (0, import_node_path77.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9193
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
9095
9194
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9096
9195
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9097
9196
|
if (!result.success) {
|
|
9098
9197
|
throw new Error(
|
|
9099
|
-
`Invalid frontmatter in ${(0,
|
|
9198
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9100
9199
|
);
|
|
9101
9200
|
}
|
|
9102
9201
|
return new _ClaudecodeRule({
|
|
@@ -9203,7 +9302,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9203
9302
|
return {
|
|
9204
9303
|
success: false,
|
|
9205
9304
|
error: new Error(
|
|
9206
|
-
`Invalid frontmatter in ${(0,
|
|
9305
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9207
9306
|
)
|
|
9208
9307
|
};
|
|
9209
9308
|
}
|
|
@@ -9223,7 +9322,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9223
9322
|
};
|
|
9224
9323
|
|
|
9225
9324
|
// src/features/rules/cline-rule.ts
|
|
9226
|
-
var
|
|
9325
|
+
var import_node_path78 = require("path");
|
|
9227
9326
|
var import_mini38 = require("zod/mini");
|
|
9228
9327
|
var ClineRuleFrontmatterSchema = import_mini38.z.object({
|
|
9229
9328
|
description: import_mini38.z.string()
|
|
@@ -9268,7 +9367,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9268
9367
|
validate = true
|
|
9269
9368
|
}) {
|
|
9270
9369
|
const fileContent = await readFileContent(
|
|
9271
|
-
(0,
|
|
9370
|
+
(0, import_node_path78.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9272
9371
|
);
|
|
9273
9372
|
return new _ClineRule({
|
|
9274
9373
|
baseDir,
|
|
@@ -9294,7 +9393,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9294
9393
|
};
|
|
9295
9394
|
|
|
9296
9395
|
// src/features/rules/codexcli-rule.ts
|
|
9297
|
-
var
|
|
9396
|
+
var import_node_path79 = require("path");
|
|
9298
9397
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9299
9398
|
static getSettablePaths({
|
|
9300
9399
|
global
|
|
@@ -9313,7 +9412,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9313
9412
|
relativeFilePath: "AGENTS.md"
|
|
9314
9413
|
},
|
|
9315
9414
|
nonRoot: {
|
|
9316
|
-
relativeDirPath: (0,
|
|
9415
|
+
relativeDirPath: (0, import_node_path79.join)(".codex", "memories")
|
|
9317
9416
|
}
|
|
9318
9417
|
};
|
|
9319
9418
|
}
|
|
@@ -9328,7 +9427,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9328
9427
|
if (isRoot) {
|
|
9329
9428
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9330
9429
|
const fileContent2 = await readFileContent(
|
|
9331
|
-
(0,
|
|
9430
|
+
(0, import_node_path79.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9332
9431
|
);
|
|
9333
9432
|
return new _CodexcliRule({
|
|
9334
9433
|
baseDir,
|
|
@@ -9342,8 +9441,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9342
9441
|
if (!paths.nonRoot) {
|
|
9343
9442
|
throw new Error("nonRoot path is not set");
|
|
9344
9443
|
}
|
|
9345
|
-
const relativePath = (0,
|
|
9346
|
-
const fileContent = await readFileContent((0,
|
|
9444
|
+
const relativePath = (0, import_node_path79.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9445
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
9347
9446
|
return new _CodexcliRule({
|
|
9348
9447
|
baseDir,
|
|
9349
9448
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9402,7 +9501,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9402
9501
|
};
|
|
9403
9502
|
|
|
9404
9503
|
// src/features/rules/copilot-rule.ts
|
|
9405
|
-
var
|
|
9504
|
+
var import_node_path80 = require("path");
|
|
9406
9505
|
var import_mini39 = require("zod/mini");
|
|
9407
9506
|
var CopilotRuleFrontmatterSchema = import_mini39.z.object({
|
|
9408
9507
|
description: import_mini39.z.optional(import_mini39.z.string()),
|
|
@@ -9419,7 +9518,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9419
9518
|
relativeFilePath: "copilot-instructions.md"
|
|
9420
9519
|
},
|
|
9421
9520
|
nonRoot: {
|
|
9422
|
-
relativeDirPath: (0,
|
|
9521
|
+
relativeDirPath: (0, import_node_path80.join)(".github", "instructions")
|
|
9423
9522
|
}
|
|
9424
9523
|
};
|
|
9425
9524
|
}
|
|
@@ -9428,7 +9527,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9428
9527
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9429
9528
|
if (!result.success) {
|
|
9430
9529
|
throw new Error(
|
|
9431
|
-
`Invalid frontmatter in ${(0,
|
|
9530
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9432
9531
|
);
|
|
9433
9532
|
}
|
|
9434
9533
|
}
|
|
@@ -9510,11 +9609,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9510
9609
|
validate = true
|
|
9511
9610
|
}) {
|
|
9512
9611
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9513
|
-
const relativePath = isRoot ? (0,
|
|
9612
|
+
const relativePath = isRoot ? (0, import_node_path80.join)(
|
|
9514
9613
|
this.getSettablePaths().root.relativeDirPath,
|
|
9515
9614
|
this.getSettablePaths().root.relativeFilePath
|
|
9516
|
-
) : (0,
|
|
9517
|
-
const fileContent = await readFileContent((0,
|
|
9615
|
+
) : (0, import_node_path80.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9616
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
9518
9617
|
if (isRoot) {
|
|
9519
9618
|
return new _CopilotRule({
|
|
9520
9619
|
baseDir,
|
|
@@ -9530,7 +9629,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9530
9629
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9531
9630
|
if (!result.success) {
|
|
9532
9631
|
throw new Error(
|
|
9533
|
-
`Invalid frontmatter in ${(0,
|
|
9632
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9534
9633
|
);
|
|
9535
9634
|
}
|
|
9536
9635
|
return new _CopilotRule({
|
|
@@ -9570,7 +9669,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9570
9669
|
return {
|
|
9571
9670
|
success: false,
|
|
9572
9671
|
error: new Error(
|
|
9573
|
-
`Invalid frontmatter in ${(0,
|
|
9672
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9574
9673
|
)
|
|
9575
9674
|
};
|
|
9576
9675
|
}
|
|
@@ -9590,7 +9689,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9590
9689
|
};
|
|
9591
9690
|
|
|
9592
9691
|
// src/features/rules/cursor-rule.ts
|
|
9593
|
-
var
|
|
9692
|
+
var import_node_path81 = require("path");
|
|
9594
9693
|
var import_mini40 = require("zod/mini");
|
|
9595
9694
|
var CursorRuleFrontmatterSchema = import_mini40.z.object({
|
|
9596
9695
|
description: import_mini40.z.optional(import_mini40.z.string()),
|
|
@@ -9603,7 +9702,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9603
9702
|
static getSettablePaths() {
|
|
9604
9703
|
return {
|
|
9605
9704
|
nonRoot: {
|
|
9606
|
-
relativeDirPath: (0,
|
|
9705
|
+
relativeDirPath: (0, import_node_path81.join)(".cursor", "rules")
|
|
9607
9706
|
}
|
|
9608
9707
|
};
|
|
9609
9708
|
}
|
|
@@ -9612,7 +9711,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9612
9711
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9613
9712
|
if (!result.success) {
|
|
9614
9713
|
throw new Error(
|
|
9615
|
-
`Invalid frontmatter in ${(0,
|
|
9714
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9616
9715
|
);
|
|
9617
9716
|
}
|
|
9618
9717
|
}
|
|
@@ -9729,19 +9828,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9729
9828
|
validate = true
|
|
9730
9829
|
}) {
|
|
9731
9830
|
const fileContent = await readFileContent(
|
|
9732
|
-
(0,
|
|
9831
|
+
(0, import_node_path81.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9733
9832
|
);
|
|
9734
9833
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9735
9834
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9736
9835
|
if (!result.success) {
|
|
9737
9836
|
throw new Error(
|
|
9738
|
-
`Invalid frontmatter in ${(0,
|
|
9837
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9739
9838
|
);
|
|
9740
9839
|
}
|
|
9741
9840
|
return new _CursorRule({
|
|
9742
9841
|
baseDir,
|
|
9743
9842
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9744
|
-
relativeFilePath: (0,
|
|
9843
|
+
relativeFilePath: (0, import_node_path81.basename)(relativeFilePath),
|
|
9745
9844
|
frontmatter: result.data,
|
|
9746
9845
|
body: content.trim(),
|
|
9747
9846
|
validate
|
|
@@ -9772,7 +9871,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9772
9871
|
return {
|
|
9773
9872
|
success: false,
|
|
9774
9873
|
error: new Error(
|
|
9775
|
-
`Invalid frontmatter in ${(0,
|
|
9874
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9776
9875
|
)
|
|
9777
9876
|
};
|
|
9778
9877
|
}
|
|
@@ -9792,7 +9891,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9792
9891
|
};
|
|
9793
9892
|
|
|
9794
9893
|
// src/features/rules/geminicli-rule.ts
|
|
9795
|
-
var
|
|
9894
|
+
var import_node_path82 = require("path");
|
|
9796
9895
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9797
9896
|
static getSettablePaths({
|
|
9798
9897
|
global
|
|
@@ -9811,7 +9910,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9811
9910
|
relativeFilePath: "GEMINI.md"
|
|
9812
9911
|
},
|
|
9813
9912
|
nonRoot: {
|
|
9814
|
-
relativeDirPath: (0,
|
|
9913
|
+
relativeDirPath: (0, import_node_path82.join)(".gemini", "memories")
|
|
9815
9914
|
}
|
|
9816
9915
|
};
|
|
9817
9916
|
}
|
|
@@ -9826,7 +9925,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9826
9925
|
if (isRoot) {
|
|
9827
9926
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9828
9927
|
const fileContent2 = await readFileContent(
|
|
9829
|
-
(0,
|
|
9928
|
+
(0, import_node_path82.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9830
9929
|
);
|
|
9831
9930
|
return new _GeminiCliRule({
|
|
9832
9931
|
baseDir,
|
|
@@ -9840,8 +9939,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9840
9939
|
if (!paths.nonRoot) {
|
|
9841
9940
|
throw new Error("nonRoot path is not set");
|
|
9842
9941
|
}
|
|
9843
|
-
const relativePath = (0,
|
|
9844
|
-
const fileContent = await readFileContent((0,
|
|
9942
|
+
const relativePath = (0, import_node_path82.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9943
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
9845
9944
|
return new _GeminiCliRule({
|
|
9846
9945
|
baseDir,
|
|
9847
9946
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9900,7 +9999,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9900
9999
|
};
|
|
9901
10000
|
|
|
9902
10001
|
// src/features/rules/junie-rule.ts
|
|
9903
|
-
var
|
|
10002
|
+
var import_node_path83 = require("path");
|
|
9904
10003
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9905
10004
|
static getSettablePaths() {
|
|
9906
10005
|
return {
|
|
@@ -9909,7 +10008,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9909
10008
|
relativeFilePath: "guidelines.md"
|
|
9910
10009
|
},
|
|
9911
10010
|
nonRoot: {
|
|
9912
|
-
relativeDirPath: (0,
|
|
10011
|
+
relativeDirPath: (0, import_node_path83.join)(".junie", "memories")
|
|
9913
10012
|
}
|
|
9914
10013
|
};
|
|
9915
10014
|
}
|
|
@@ -9919,8 +10018,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9919
10018
|
validate = true
|
|
9920
10019
|
}) {
|
|
9921
10020
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9922
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
9923
|
-
const fileContent = await readFileContent((0,
|
|
10021
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path83.join)(".junie", "memories", relativeFilePath);
|
|
10022
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
9924
10023
|
return new _JunieRule({
|
|
9925
10024
|
baseDir,
|
|
9926
10025
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9975,12 +10074,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9975
10074
|
};
|
|
9976
10075
|
|
|
9977
10076
|
// src/features/rules/kilo-rule.ts
|
|
9978
|
-
var
|
|
10077
|
+
var import_node_path84 = require("path");
|
|
9979
10078
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
9980
10079
|
static getSettablePaths(_options = {}) {
|
|
9981
10080
|
return {
|
|
9982
10081
|
nonRoot: {
|
|
9983
|
-
relativeDirPath: (0,
|
|
10082
|
+
relativeDirPath: (0, import_node_path84.join)(".kilocode", "rules")
|
|
9984
10083
|
}
|
|
9985
10084
|
};
|
|
9986
10085
|
}
|
|
@@ -9990,7 +10089,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
9990
10089
|
validate = true
|
|
9991
10090
|
}) {
|
|
9992
10091
|
const fileContent = await readFileContent(
|
|
9993
|
-
(0,
|
|
10092
|
+
(0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9994
10093
|
);
|
|
9995
10094
|
return new _KiloRule({
|
|
9996
10095
|
baseDir,
|
|
@@ -10042,12 +10141,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10042
10141
|
};
|
|
10043
10142
|
|
|
10044
10143
|
// src/features/rules/kiro-rule.ts
|
|
10045
|
-
var
|
|
10144
|
+
var import_node_path85 = require("path");
|
|
10046
10145
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10047
10146
|
static getSettablePaths() {
|
|
10048
10147
|
return {
|
|
10049
10148
|
nonRoot: {
|
|
10050
|
-
relativeDirPath: (0,
|
|
10149
|
+
relativeDirPath: (0, import_node_path85.join)(".kiro", "steering")
|
|
10051
10150
|
}
|
|
10052
10151
|
};
|
|
10053
10152
|
}
|
|
@@ -10057,7 +10156,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10057
10156
|
validate = true
|
|
10058
10157
|
}) {
|
|
10059
10158
|
const fileContent = await readFileContent(
|
|
10060
|
-
(0,
|
|
10159
|
+
(0, import_node_path85.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10061
10160
|
);
|
|
10062
10161
|
return new _KiroRule({
|
|
10063
10162
|
baseDir,
|
|
@@ -10111,7 +10210,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10111
10210
|
};
|
|
10112
10211
|
|
|
10113
10212
|
// src/features/rules/opencode-rule.ts
|
|
10114
|
-
var
|
|
10213
|
+
var import_node_path86 = require("path");
|
|
10115
10214
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10116
10215
|
static getSettablePaths() {
|
|
10117
10216
|
return {
|
|
@@ -10120,7 +10219,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10120
10219
|
relativeFilePath: "AGENTS.md"
|
|
10121
10220
|
},
|
|
10122
10221
|
nonRoot: {
|
|
10123
|
-
relativeDirPath: (0,
|
|
10222
|
+
relativeDirPath: (0, import_node_path86.join)(".opencode", "memories")
|
|
10124
10223
|
}
|
|
10125
10224
|
};
|
|
10126
10225
|
}
|
|
@@ -10130,8 +10229,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10130
10229
|
validate = true
|
|
10131
10230
|
}) {
|
|
10132
10231
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10133
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10134
|
-
const fileContent = await readFileContent((0,
|
|
10232
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path86.join)(".opencode", "memories", relativeFilePath);
|
|
10233
|
+
const fileContent = await readFileContent((0, import_node_path86.join)(baseDir, relativePath));
|
|
10135
10234
|
return new _OpenCodeRule({
|
|
10136
10235
|
baseDir,
|
|
10137
10236
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10186,7 +10285,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10186
10285
|
};
|
|
10187
10286
|
|
|
10188
10287
|
// src/features/rules/qwencode-rule.ts
|
|
10189
|
-
var
|
|
10288
|
+
var import_node_path87 = require("path");
|
|
10190
10289
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10191
10290
|
static getSettablePaths() {
|
|
10192
10291
|
return {
|
|
@@ -10195,7 +10294,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10195
10294
|
relativeFilePath: "QWEN.md"
|
|
10196
10295
|
},
|
|
10197
10296
|
nonRoot: {
|
|
10198
|
-
relativeDirPath: (0,
|
|
10297
|
+
relativeDirPath: (0, import_node_path87.join)(".qwen", "memories")
|
|
10199
10298
|
}
|
|
10200
10299
|
};
|
|
10201
10300
|
}
|
|
@@ -10205,8 +10304,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10205
10304
|
validate = true
|
|
10206
10305
|
}) {
|
|
10207
10306
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10208
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10209
|
-
const fileContent = await readFileContent((0,
|
|
10307
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path87.join)(".qwen", "memories", relativeFilePath);
|
|
10308
|
+
const fileContent = await readFileContent((0, import_node_path87.join)(baseDir, relativePath));
|
|
10210
10309
|
return new _QwencodeRule({
|
|
10211
10310
|
baseDir,
|
|
10212
10311
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10258,12 +10357,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10258
10357
|
};
|
|
10259
10358
|
|
|
10260
10359
|
// src/features/rules/roo-rule.ts
|
|
10261
|
-
var
|
|
10360
|
+
var import_node_path88 = require("path");
|
|
10262
10361
|
var RooRule = class _RooRule extends ToolRule {
|
|
10263
10362
|
static getSettablePaths() {
|
|
10264
10363
|
return {
|
|
10265
10364
|
nonRoot: {
|
|
10266
|
-
relativeDirPath: (0,
|
|
10365
|
+
relativeDirPath: (0, import_node_path88.join)(".roo", "rules")
|
|
10267
10366
|
}
|
|
10268
10367
|
};
|
|
10269
10368
|
}
|
|
@@ -10273,7 +10372,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10273
10372
|
validate = true
|
|
10274
10373
|
}) {
|
|
10275
10374
|
const fileContent = await readFileContent(
|
|
10276
|
-
(0,
|
|
10375
|
+
(0, import_node_path88.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10277
10376
|
);
|
|
10278
10377
|
return new _RooRule({
|
|
10279
10378
|
baseDir,
|
|
@@ -10342,7 +10441,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10342
10441
|
};
|
|
10343
10442
|
|
|
10344
10443
|
// src/features/rules/warp-rule.ts
|
|
10345
|
-
var
|
|
10444
|
+
var import_node_path89 = require("path");
|
|
10346
10445
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10347
10446
|
constructor({ fileContent, root, ...rest }) {
|
|
10348
10447
|
super({
|
|
@@ -10358,7 +10457,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10358
10457
|
relativeFilePath: "WARP.md"
|
|
10359
10458
|
},
|
|
10360
10459
|
nonRoot: {
|
|
10361
|
-
relativeDirPath: (0,
|
|
10460
|
+
relativeDirPath: (0, import_node_path89.join)(".warp", "memories")
|
|
10362
10461
|
}
|
|
10363
10462
|
};
|
|
10364
10463
|
}
|
|
@@ -10368,8 +10467,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10368
10467
|
validate = true
|
|
10369
10468
|
}) {
|
|
10370
10469
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10371
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10372
|
-
const fileContent = await readFileContent((0,
|
|
10470
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path89.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10471
|
+
const fileContent = await readFileContent((0, import_node_path89.join)(baseDir, relativePath));
|
|
10373
10472
|
return new _WarpRule({
|
|
10374
10473
|
baseDir,
|
|
10375
10474
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10424,12 +10523,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10424
10523
|
};
|
|
10425
10524
|
|
|
10426
10525
|
// src/features/rules/windsurf-rule.ts
|
|
10427
|
-
var
|
|
10526
|
+
var import_node_path90 = require("path");
|
|
10428
10527
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10429
10528
|
static getSettablePaths() {
|
|
10430
10529
|
return {
|
|
10431
10530
|
nonRoot: {
|
|
10432
|
-
relativeDirPath: (0,
|
|
10531
|
+
relativeDirPath: (0, import_node_path90.join)(".windsurf", "rules")
|
|
10433
10532
|
}
|
|
10434
10533
|
};
|
|
10435
10534
|
}
|
|
@@ -10439,7 +10538,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10439
10538
|
validate = true
|
|
10440
10539
|
}) {
|
|
10441
10540
|
const fileContent = await readFileContent(
|
|
10442
|
-
(0,
|
|
10541
|
+
(0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10443
10542
|
);
|
|
10444
10543
|
return new _WindsurfRule({
|
|
10445
10544
|
baseDir,
|
|
@@ -10796,7 +10895,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10796
10895
|
}).relativeDirPath;
|
|
10797
10896
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10798
10897
|
const frontmatter = skill.getFrontmatter();
|
|
10799
|
-
const relativePath = (0,
|
|
10898
|
+
const relativePath = (0, import_node_path91.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10800
10899
|
return {
|
|
10801
10900
|
name: frontmatter.name,
|
|
10802
10901
|
description: frontmatter.description,
|
|
@@ -10863,10 +10962,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10863
10962
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10864
10963
|
*/
|
|
10865
10964
|
async loadRulesyncFiles() {
|
|
10866
|
-
const files = await findFilesByGlobs((0,
|
|
10965
|
+
const files = await findFilesByGlobs((0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10867
10966
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10868
10967
|
const rulesyncRules = await Promise.all(
|
|
10869
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
10968
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path91.basename)(file) }))
|
|
10870
10969
|
);
|
|
10871
10970
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10872
10971
|
if (rootRules.length > 1) {
|
|
@@ -10884,10 +10983,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10884
10983
|
return rulesyncRules;
|
|
10885
10984
|
}
|
|
10886
10985
|
async loadRulesyncFilesLegacy() {
|
|
10887
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
10986
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path91.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10888
10987
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10889
10988
|
return Promise.all(
|
|
10890
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
10989
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path91.basename)(file) }))
|
|
10891
10990
|
);
|
|
10892
10991
|
}
|
|
10893
10992
|
/**
|
|
@@ -10905,7 +11004,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10905
11004
|
return [];
|
|
10906
11005
|
}
|
|
10907
11006
|
const rootFilePaths = await findFilesByGlobs(
|
|
10908
|
-
(0,
|
|
11007
|
+
(0, import_node_path91.join)(
|
|
10909
11008
|
this.baseDir,
|
|
10910
11009
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10911
11010
|
settablePaths.root.relativeFilePath
|
|
@@ -10916,7 +11015,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10916
11015
|
(filePath) => factory.class.forDeletion({
|
|
10917
11016
|
baseDir: this.baseDir,
|
|
10918
11017
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
10919
|
-
relativeFilePath: (0,
|
|
11018
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10920
11019
|
global: this.global
|
|
10921
11020
|
})
|
|
10922
11021
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10925,7 +11024,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10925
11024
|
rootFilePaths.map(
|
|
10926
11025
|
(filePath) => factory.class.fromFile({
|
|
10927
11026
|
baseDir: this.baseDir,
|
|
10928
|
-
relativeFilePath: (0,
|
|
11027
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10929
11028
|
global: this.global
|
|
10930
11029
|
})
|
|
10931
11030
|
)
|
|
@@ -10937,14 +11036,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10937
11036
|
return [];
|
|
10938
11037
|
}
|
|
10939
11038
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
10940
|
-
(0,
|
|
11039
|
+
(0, import_node_path91.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
10941
11040
|
);
|
|
10942
11041
|
if (forDeletion) {
|
|
10943
11042
|
return nonRootFilePaths.map(
|
|
10944
11043
|
(filePath) => factory.class.forDeletion({
|
|
10945
11044
|
baseDir: this.baseDir,
|
|
10946
11045
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
10947
|
-
relativeFilePath: (0,
|
|
11046
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10948
11047
|
global: this.global
|
|
10949
11048
|
})
|
|
10950
11049
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10953,7 +11052,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10953
11052
|
nonRootFilePaths.map(
|
|
10954
11053
|
(filePath) => factory.class.fromFile({
|
|
10955
11054
|
baseDir: this.baseDir,
|
|
10956
|
-
relativeFilePath: (0,
|
|
11055
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10957
11056
|
global: this.global
|
|
10958
11057
|
})
|
|
10959
11058
|
)
|
|
@@ -11046,14 +11145,14 @@ s/<command> [arguments]
|
|
|
11046
11145
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11047
11146
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11048
11147
|
|
|
11049
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
11148
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path91.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11050
11149
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11051
11150
|
|
|
11052
11151
|
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.
|
|
11053
11152
|
|
|
11054
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
11153
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11055
11154
|
|
|
11056
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
11155
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path91.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11057
11156
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11058
11157
|
const result = [
|
|
11059
11158
|
overview,
|
|
@@ -11122,7 +11221,7 @@ async function generateRules(config, options) {
|
|
|
11122
11221
|
}
|
|
11123
11222
|
let totalRulesOutputs = 0;
|
|
11124
11223
|
logger.info("Generating rule files...");
|
|
11125
|
-
const toolTargets = (0,
|
|
11224
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11126
11225
|
config.getTargets(),
|
|
11127
11226
|
RulesProcessor.getToolTargets({ global: config.getGlobal() })
|
|
11128
11227
|
);
|
|
@@ -11161,7 +11260,7 @@ async function generateIgnore(config) {
|
|
|
11161
11260
|
}
|
|
11162
11261
|
let totalIgnoreOutputs = 0;
|
|
11163
11262
|
logger.info("Generating ignore files...");
|
|
11164
|
-
for (const toolTarget of (0,
|
|
11263
|
+
for (const toolTarget of (0, import_es_toolkit4.intersection)(config.getTargets(), IgnoreProcessor.getToolTargets())) {
|
|
11165
11264
|
for (const baseDir of config.getBaseDirs()) {
|
|
11166
11265
|
try {
|
|
11167
11266
|
const processor = new IgnoreProcessor({
|
|
@@ -11200,7 +11299,7 @@ async function generateMcp(config) {
|
|
|
11200
11299
|
if (config.getModularMcp()) {
|
|
11201
11300
|
logger.info("\u2139\uFE0F Modular MCP support is experimental.");
|
|
11202
11301
|
}
|
|
11203
|
-
const toolTargets = (0,
|
|
11302
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11204
11303
|
config.getTargets(),
|
|
11205
11304
|
McpProcessor.getToolTargets({ global: config.getGlobal() })
|
|
11206
11305
|
);
|
|
@@ -11232,7 +11331,7 @@ async function generateCommands(config) {
|
|
|
11232
11331
|
}
|
|
11233
11332
|
let totalCommandOutputs = 0;
|
|
11234
11333
|
logger.info("Generating command files...");
|
|
11235
|
-
const toolTargets = (0,
|
|
11334
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11236
11335
|
config.getTargets(),
|
|
11237
11336
|
CommandsProcessor.getToolTargets({
|
|
11238
11337
|
global: config.getGlobal(),
|
|
@@ -11266,7 +11365,7 @@ async function generateSubagents(config) {
|
|
|
11266
11365
|
}
|
|
11267
11366
|
let totalSubagentOutputs = 0;
|
|
11268
11367
|
logger.info("Generating subagent files...");
|
|
11269
|
-
const toolTargets = (0,
|
|
11368
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11270
11369
|
config.getTargets(),
|
|
11271
11370
|
SubagentsProcessor.getToolTargets({
|
|
11272
11371
|
global: config.getGlobal(),
|
|
@@ -11301,7 +11400,7 @@ async function generateSkills(config) {
|
|
|
11301
11400
|
let totalSkillOutputs = 0;
|
|
11302
11401
|
const allSkills = [];
|
|
11303
11402
|
logger.info("Generating skill files...");
|
|
11304
|
-
const toolTargets = (0,
|
|
11403
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11305
11404
|
config.getTargets(),
|
|
11306
11405
|
SkillsProcessor.getToolTargets({
|
|
11307
11406
|
global: config.getGlobal(),
|
|
@@ -11335,7 +11434,7 @@ async function generateSkills(config) {
|
|
|
11335
11434
|
}
|
|
11336
11435
|
|
|
11337
11436
|
// src/cli/commands/gitignore.ts
|
|
11338
|
-
var
|
|
11437
|
+
var import_node_path92 = require("path");
|
|
11339
11438
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11340
11439
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11341
11440
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11399,7 +11498,6 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11399
11498
|
"**/.opencode/command/",
|
|
11400
11499
|
"**/.opencode/agent/",
|
|
11401
11500
|
"**/.opencode/skill/",
|
|
11402
|
-
"**/opencode.json",
|
|
11403
11501
|
// Qwen
|
|
11404
11502
|
"**/QWEN.md",
|
|
11405
11503
|
"**/.qwen/memories/",
|
|
@@ -11466,7 +11564,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11466
11564
|
return result;
|
|
11467
11565
|
};
|
|
11468
11566
|
var gitignoreCommand = async () => {
|
|
11469
|
-
const gitignorePath = (0,
|
|
11567
|
+
const gitignorePath = (0, import_node_path92.join)(process.cwd(), ".gitignore");
|
|
11470
11568
|
let gitignoreContent = "";
|
|
11471
11569
|
if (await fileExists(gitignorePath)) {
|
|
11472
11570
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11665,7 +11763,7 @@ async function importSkills(config, tool) {
|
|
|
11665
11763
|
}
|
|
11666
11764
|
|
|
11667
11765
|
// src/cli/commands/init.ts
|
|
11668
|
-
var
|
|
11766
|
+
var import_node_path93 = require("path");
|
|
11669
11767
|
async function initCommand() {
|
|
11670
11768
|
logger.info("Initializing rulesync...");
|
|
11671
11769
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11828,14 +11926,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11828
11926
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11829
11927
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
11830
11928
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11831
|
-
const ruleFilepath = (0,
|
|
11929
|
+
const ruleFilepath = (0, import_node_path93.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11832
11930
|
if (!await fileExists(ruleFilepath)) {
|
|
11833
11931
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11834
11932
|
logger.success(`Created ${ruleFilepath}`);
|
|
11835
11933
|
} else {
|
|
11836
11934
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11837
11935
|
}
|
|
11838
|
-
const mcpFilepath = (0,
|
|
11936
|
+
const mcpFilepath = (0, import_node_path93.join)(
|
|
11839
11937
|
mcpPaths.recommended.relativeDirPath,
|
|
11840
11938
|
mcpPaths.recommended.relativeFilePath
|
|
11841
11939
|
);
|
|
@@ -11845,21 +11943,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11845
11943
|
} else {
|
|
11846
11944
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11847
11945
|
}
|
|
11848
|
-
const commandFilepath = (0,
|
|
11946
|
+
const commandFilepath = (0, import_node_path93.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11849
11947
|
if (!await fileExists(commandFilepath)) {
|
|
11850
11948
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11851
11949
|
logger.success(`Created ${commandFilepath}`);
|
|
11852
11950
|
} else {
|
|
11853
11951
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11854
11952
|
}
|
|
11855
|
-
const subagentFilepath = (0,
|
|
11953
|
+
const subagentFilepath = (0, import_node_path93.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11856
11954
|
if (!await fileExists(subagentFilepath)) {
|
|
11857
11955
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11858
11956
|
logger.success(`Created ${subagentFilepath}`);
|
|
11859
11957
|
} else {
|
|
11860
11958
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11861
11959
|
}
|
|
11862
|
-
const ignoreFilepath = (0,
|
|
11960
|
+
const ignoreFilepath = (0, import_node_path93.join)(
|
|
11863
11961
|
ignorePaths.recommended.relativeDirPath,
|
|
11864
11962
|
ignorePaths.recommended.relativeFilePath
|
|
11865
11963
|
);
|
|
@@ -11878,12 +11976,12 @@ var import_fastmcp = require("fastmcp");
|
|
|
11878
11976
|
var import_mini48 = require("zod/mini");
|
|
11879
11977
|
|
|
11880
11978
|
// src/mcp/commands.ts
|
|
11881
|
-
var
|
|
11979
|
+
var import_node_path94 = require("path");
|
|
11882
11980
|
var import_mini42 = require("zod/mini");
|
|
11883
11981
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11884
11982
|
var maxCommandsCount = 1e3;
|
|
11885
11983
|
async function listCommands() {
|
|
11886
|
-
const commandsDir = (0,
|
|
11984
|
+
const commandsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11887
11985
|
try {
|
|
11888
11986
|
const files = await listDirectoryFiles(commandsDir);
|
|
11889
11987
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11895,7 +11993,7 @@ async function listCommands() {
|
|
|
11895
11993
|
});
|
|
11896
11994
|
const frontmatter = command.getFrontmatter();
|
|
11897
11995
|
return {
|
|
11898
|
-
relativePathFromCwd: (0,
|
|
11996
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11899
11997
|
frontmatter
|
|
11900
11998
|
};
|
|
11901
11999
|
} catch (error) {
|
|
@@ -11915,13 +12013,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11915
12013
|
relativePath: relativePathFromCwd,
|
|
11916
12014
|
intendedRootDir: process.cwd()
|
|
11917
12015
|
});
|
|
11918
|
-
const filename = (0,
|
|
12016
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
11919
12017
|
try {
|
|
11920
12018
|
const command = await RulesyncCommand.fromFile({
|
|
11921
12019
|
relativeFilePath: filename
|
|
11922
12020
|
});
|
|
11923
12021
|
return {
|
|
11924
|
-
relativePathFromCwd: (0,
|
|
12022
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11925
12023
|
frontmatter: command.getFrontmatter(),
|
|
11926
12024
|
body: command.getBody()
|
|
11927
12025
|
};
|
|
@@ -11940,7 +12038,7 @@ async function putCommand({
|
|
|
11940
12038
|
relativePath: relativePathFromCwd,
|
|
11941
12039
|
intendedRootDir: process.cwd()
|
|
11942
12040
|
});
|
|
11943
|
-
const filename = (0,
|
|
12041
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
11944
12042
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11945
12043
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
11946
12044
|
throw new Error(
|
|
@@ -11950,7 +12048,7 @@ async function putCommand({
|
|
|
11950
12048
|
try {
|
|
11951
12049
|
const existingCommands = await listCommands();
|
|
11952
12050
|
const isUpdate = existingCommands.some(
|
|
11953
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12051
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11954
12052
|
);
|
|
11955
12053
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
11956
12054
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -11965,11 +12063,11 @@ async function putCommand({
|
|
|
11965
12063
|
fileContent,
|
|
11966
12064
|
validate: true
|
|
11967
12065
|
});
|
|
11968
|
-
const commandsDir = (0,
|
|
12066
|
+
const commandsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11969
12067
|
await ensureDir(commandsDir);
|
|
11970
12068
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
11971
12069
|
return {
|
|
11972
|
-
relativePathFromCwd: (0,
|
|
12070
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11973
12071
|
frontmatter: command.getFrontmatter(),
|
|
11974
12072
|
body: command.getBody()
|
|
11975
12073
|
};
|
|
@@ -11984,12 +12082,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11984
12082
|
relativePath: relativePathFromCwd,
|
|
11985
12083
|
intendedRootDir: process.cwd()
|
|
11986
12084
|
});
|
|
11987
|
-
const filename = (0,
|
|
11988
|
-
const fullPath = (0,
|
|
12085
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
12086
|
+
const fullPath = (0, import_node_path94.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
11989
12087
|
try {
|
|
11990
12088
|
await removeFile(fullPath);
|
|
11991
12089
|
return {
|
|
11992
|
-
relativePathFromCwd: (0,
|
|
12090
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11993
12091
|
};
|
|
11994
12092
|
} catch (error) {
|
|
11995
12093
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12014,7 +12112,7 @@ var commandToolSchemas = {
|
|
|
12014
12112
|
var commandTools = {
|
|
12015
12113
|
listCommands: {
|
|
12016
12114
|
name: "listCommands",
|
|
12017
|
-
description: `List all commands from ${(0,
|
|
12115
|
+
description: `List all commands from ${(0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12018
12116
|
parameters: commandToolSchemas.listCommands,
|
|
12019
12117
|
execute: async () => {
|
|
12020
12118
|
const commands = await listCommands();
|
|
@@ -12056,11 +12154,11 @@ var commandTools = {
|
|
|
12056
12154
|
};
|
|
12057
12155
|
|
|
12058
12156
|
// src/mcp/ignore.ts
|
|
12059
|
-
var
|
|
12157
|
+
var import_node_path95 = require("path");
|
|
12060
12158
|
var import_mini43 = require("zod/mini");
|
|
12061
12159
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12062
12160
|
async function getIgnoreFile() {
|
|
12063
|
-
const ignoreFilePath = (0,
|
|
12161
|
+
const ignoreFilePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12064
12162
|
try {
|
|
12065
12163
|
const content = await readFileContent(ignoreFilePath);
|
|
12066
12164
|
return {
|
|
@@ -12074,7 +12172,7 @@ async function getIgnoreFile() {
|
|
|
12074
12172
|
}
|
|
12075
12173
|
}
|
|
12076
12174
|
async function putIgnoreFile({ content }) {
|
|
12077
|
-
const ignoreFilePath = (0,
|
|
12175
|
+
const ignoreFilePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12078
12176
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12079
12177
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12080
12178
|
throw new Error(
|
|
@@ -12095,8 +12193,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12095
12193
|
}
|
|
12096
12194
|
}
|
|
12097
12195
|
async function deleteIgnoreFile() {
|
|
12098
|
-
const aiignorePath = (0,
|
|
12099
|
-
const legacyIgnorePath = (0,
|
|
12196
|
+
const aiignorePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12197
|
+
const legacyIgnorePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12100
12198
|
try {
|
|
12101
12199
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12102
12200
|
return {
|
|
@@ -12151,7 +12249,7 @@ var ignoreTools = {
|
|
|
12151
12249
|
};
|
|
12152
12250
|
|
|
12153
12251
|
// src/mcp/mcp.ts
|
|
12154
|
-
var
|
|
12252
|
+
var import_node_path96 = require("path");
|
|
12155
12253
|
var import_mini44 = require("zod/mini");
|
|
12156
12254
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12157
12255
|
async function getMcpFile() {
|
|
@@ -12161,7 +12259,7 @@ async function getMcpFile() {
|
|
|
12161
12259
|
validate: true,
|
|
12162
12260
|
modularMcp: config.getModularMcp()
|
|
12163
12261
|
});
|
|
12164
|
-
const relativePathFromCwd = (0,
|
|
12262
|
+
const relativePathFromCwd = (0, import_node_path96.join)(
|
|
12165
12263
|
rulesyncMcp.getRelativeDirPath(),
|
|
12166
12264
|
rulesyncMcp.getRelativeFilePath()
|
|
12167
12265
|
);
|
|
@@ -12194,7 +12292,7 @@ async function putMcpFile({ content }) {
|
|
|
12194
12292
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12195
12293
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12196
12294
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12197
|
-
const fullPath = (0,
|
|
12295
|
+
const fullPath = (0, import_node_path96.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12198
12296
|
const rulesyncMcp = new RulesyncMcp({
|
|
12199
12297
|
baseDir,
|
|
12200
12298
|
relativeDirPath,
|
|
@@ -12203,9 +12301,9 @@ async function putMcpFile({ content }) {
|
|
|
12203
12301
|
validate: true,
|
|
12204
12302
|
modularMcp: config.getModularMcp()
|
|
12205
12303
|
});
|
|
12206
|
-
await ensureDir((0,
|
|
12304
|
+
await ensureDir((0, import_node_path96.join)(baseDir, relativeDirPath));
|
|
12207
12305
|
await writeFileContent(fullPath, content);
|
|
12208
|
-
const relativePathFromCwd = (0,
|
|
12306
|
+
const relativePathFromCwd = (0, import_node_path96.join)(relativeDirPath, relativeFilePath);
|
|
12209
12307
|
return {
|
|
12210
12308
|
relativePathFromCwd,
|
|
12211
12309
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12220,15 +12318,15 @@ async function deleteMcpFile() {
|
|
|
12220
12318
|
try {
|
|
12221
12319
|
const baseDir = process.cwd();
|
|
12222
12320
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12223
|
-
const recommendedPath = (0,
|
|
12321
|
+
const recommendedPath = (0, import_node_path96.join)(
|
|
12224
12322
|
baseDir,
|
|
12225
12323
|
paths.recommended.relativeDirPath,
|
|
12226
12324
|
paths.recommended.relativeFilePath
|
|
12227
12325
|
);
|
|
12228
|
-
const legacyPath = (0,
|
|
12326
|
+
const legacyPath = (0, import_node_path96.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12229
12327
|
await removeFile(recommendedPath);
|
|
12230
12328
|
await removeFile(legacyPath);
|
|
12231
|
-
const relativePathFromCwd = (0,
|
|
12329
|
+
const relativePathFromCwd = (0, import_node_path96.join)(
|
|
12232
12330
|
paths.recommended.relativeDirPath,
|
|
12233
12331
|
paths.recommended.relativeFilePath
|
|
12234
12332
|
);
|
|
@@ -12279,12 +12377,12 @@ var mcpTools = {
|
|
|
12279
12377
|
};
|
|
12280
12378
|
|
|
12281
12379
|
// src/mcp/rules.ts
|
|
12282
|
-
var
|
|
12380
|
+
var import_node_path97 = require("path");
|
|
12283
12381
|
var import_mini45 = require("zod/mini");
|
|
12284
12382
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12285
12383
|
var maxRulesCount = 1e3;
|
|
12286
12384
|
async function listRules() {
|
|
12287
|
-
const rulesDir = (0,
|
|
12385
|
+
const rulesDir = (0, import_node_path97.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12288
12386
|
try {
|
|
12289
12387
|
const files = await listDirectoryFiles(rulesDir);
|
|
12290
12388
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12297,7 +12395,7 @@ async function listRules() {
|
|
|
12297
12395
|
});
|
|
12298
12396
|
const frontmatter = rule.getFrontmatter();
|
|
12299
12397
|
return {
|
|
12300
|
-
relativePathFromCwd: (0,
|
|
12398
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12301
12399
|
frontmatter
|
|
12302
12400
|
};
|
|
12303
12401
|
} catch (error) {
|
|
@@ -12317,14 +12415,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12317
12415
|
relativePath: relativePathFromCwd,
|
|
12318
12416
|
intendedRootDir: process.cwd()
|
|
12319
12417
|
});
|
|
12320
|
-
const filename = (0,
|
|
12418
|
+
const filename = (0, import_node_path97.basename)(relativePathFromCwd);
|
|
12321
12419
|
try {
|
|
12322
12420
|
const rule = await RulesyncRule.fromFile({
|
|
12323
12421
|
relativeFilePath: filename,
|
|
12324
12422
|
validate: true
|
|
12325
12423
|
});
|
|
12326
12424
|
return {
|
|
12327
|
-
relativePathFromCwd: (0,
|
|
12425
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12328
12426
|
frontmatter: rule.getFrontmatter(),
|
|
12329
12427
|
body: rule.getBody()
|
|
12330
12428
|
};
|
|
@@ -12343,7 +12441,7 @@ async function putRule({
|
|
|
12343
12441
|
relativePath: relativePathFromCwd,
|
|
12344
12442
|
intendedRootDir: process.cwd()
|
|
12345
12443
|
});
|
|
12346
|
-
const filename = (0,
|
|
12444
|
+
const filename = (0, import_node_path97.basename)(relativePathFromCwd);
|
|
12347
12445
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12348
12446
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12349
12447
|
throw new Error(
|
|
@@ -12353,7 +12451,7 @@ async function putRule({
|
|
|
12353
12451
|
try {
|
|
12354
12452
|
const existingRules = await listRules();
|
|
12355
12453
|
const isUpdate = existingRules.some(
|
|
12356
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
12454
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12357
12455
|
);
|
|
12358
12456
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12359
12457
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12366,11 +12464,11 @@ async function putRule({
|
|
|
12366
12464
|
body,
|
|
12367
12465
|
validate: true
|
|
12368
12466
|
});
|
|
12369
|
-
const rulesDir = (0,
|
|
12467
|
+
const rulesDir = (0, import_node_path97.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12370
12468
|
await ensureDir(rulesDir);
|
|
12371
12469
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12372
12470
|
return {
|
|
12373
|
-
relativePathFromCwd: (0,
|
|
12471
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12374
12472
|
frontmatter: rule.getFrontmatter(),
|
|
12375
12473
|
body: rule.getBody()
|
|
12376
12474
|
};
|
|
@@ -12385,12 +12483,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12385
12483
|
relativePath: relativePathFromCwd,
|
|
12386
12484
|
intendedRootDir: process.cwd()
|
|
12387
12485
|
});
|
|
12388
|
-
const filename = (0,
|
|
12389
|
-
const fullPath = (0,
|
|
12486
|
+
const filename = (0, import_node_path97.basename)(relativePathFromCwd);
|
|
12487
|
+
const fullPath = (0, import_node_path97.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12390
12488
|
try {
|
|
12391
12489
|
await removeFile(fullPath);
|
|
12392
12490
|
return {
|
|
12393
|
-
relativePathFromCwd: (0,
|
|
12491
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12394
12492
|
};
|
|
12395
12493
|
} catch (error) {
|
|
12396
12494
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12415,7 +12513,7 @@ var ruleToolSchemas = {
|
|
|
12415
12513
|
var ruleTools = {
|
|
12416
12514
|
listRules: {
|
|
12417
12515
|
name: "listRules",
|
|
12418
|
-
description: `List all rules from ${(0,
|
|
12516
|
+
description: `List all rules from ${(0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12419
12517
|
parameters: ruleToolSchemas.listRules,
|
|
12420
12518
|
execute: async () => {
|
|
12421
12519
|
const rules = await listRules();
|
|
@@ -12457,7 +12555,7 @@ var ruleTools = {
|
|
|
12457
12555
|
};
|
|
12458
12556
|
|
|
12459
12557
|
// src/mcp/skills.ts
|
|
12460
|
-
var
|
|
12558
|
+
var import_node_path98 = require("path");
|
|
12461
12559
|
var import_mini46 = require("zod/mini");
|
|
12462
12560
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12463
12561
|
var maxSkillsCount = 1e3;
|
|
@@ -12474,19 +12572,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12474
12572
|
};
|
|
12475
12573
|
}
|
|
12476
12574
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12477
|
-
const dirName = (0,
|
|
12575
|
+
const dirName = (0, import_node_path98.basename)(relativeDirPathFromCwd);
|
|
12478
12576
|
if (!dirName) {
|
|
12479
12577
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12480
12578
|
}
|
|
12481
12579
|
return dirName;
|
|
12482
12580
|
}
|
|
12483
12581
|
async function listSkills() {
|
|
12484
|
-
const skillsDir = (0,
|
|
12582
|
+
const skillsDir = (0, import_node_path98.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12485
12583
|
try {
|
|
12486
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
12584
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path98.join)(skillsDir, "*"), { type: "dir" });
|
|
12487
12585
|
const skills = await Promise.all(
|
|
12488
12586
|
skillDirPaths.map(async (dirPath) => {
|
|
12489
|
-
const dirName = (0,
|
|
12587
|
+
const dirName = (0, import_node_path98.basename)(dirPath);
|
|
12490
12588
|
if (!dirName) return null;
|
|
12491
12589
|
try {
|
|
12492
12590
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12494,7 +12592,7 @@ async function listSkills() {
|
|
|
12494
12592
|
});
|
|
12495
12593
|
const frontmatter = skill.getFrontmatter();
|
|
12496
12594
|
return {
|
|
12497
|
-
relativeDirPathFromCwd: (0,
|
|
12595
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12498
12596
|
frontmatter
|
|
12499
12597
|
};
|
|
12500
12598
|
} catch (error) {
|
|
@@ -12520,7 +12618,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12520
12618
|
dirName
|
|
12521
12619
|
});
|
|
12522
12620
|
return {
|
|
12523
|
-
relativeDirPathFromCwd: (0,
|
|
12621
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12524
12622
|
frontmatter: skill.getFrontmatter(),
|
|
12525
12623
|
body: skill.getBody(),
|
|
12526
12624
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12554,7 +12652,7 @@ async function putSkill({
|
|
|
12554
12652
|
try {
|
|
12555
12653
|
const existingSkills = await listSkills();
|
|
12556
12654
|
const isUpdate = existingSkills.some(
|
|
12557
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
12655
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12558
12656
|
);
|
|
12559
12657
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12560
12658
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12569,9 +12667,9 @@ async function putSkill({
|
|
|
12569
12667
|
otherFiles: aiDirFiles,
|
|
12570
12668
|
validate: true
|
|
12571
12669
|
});
|
|
12572
|
-
const skillDirPath = (0,
|
|
12670
|
+
const skillDirPath = (0, import_node_path98.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12573
12671
|
await ensureDir(skillDirPath);
|
|
12574
|
-
const skillFilePath = (0,
|
|
12672
|
+
const skillFilePath = (0, import_node_path98.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12575
12673
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12576
12674
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12577
12675
|
for (const file of otherFiles) {
|
|
@@ -12579,15 +12677,15 @@ async function putSkill({
|
|
|
12579
12677
|
relativePath: file.name,
|
|
12580
12678
|
intendedRootDir: skillDirPath
|
|
12581
12679
|
});
|
|
12582
|
-
const filePath = (0,
|
|
12583
|
-
const fileDir = (0,
|
|
12680
|
+
const filePath = (0, import_node_path98.join)(skillDirPath, file.name);
|
|
12681
|
+
const fileDir = (0, import_node_path98.join)(skillDirPath, (0, import_node_path98.dirname)(file.name));
|
|
12584
12682
|
if (fileDir !== skillDirPath) {
|
|
12585
12683
|
await ensureDir(fileDir);
|
|
12586
12684
|
}
|
|
12587
12685
|
await writeFileContent(filePath, file.body);
|
|
12588
12686
|
}
|
|
12589
12687
|
return {
|
|
12590
|
-
relativeDirPathFromCwd: (0,
|
|
12688
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12591
12689
|
frontmatter: skill.getFrontmatter(),
|
|
12592
12690
|
body: skill.getBody(),
|
|
12593
12691
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12609,13 +12707,13 @@ async function deleteSkill({
|
|
|
12609
12707
|
intendedRootDir: process.cwd()
|
|
12610
12708
|
});
|
|
12611
12709
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12612
|
-
const skillDirPath = (0,
|
|
12710
|
+
const skillDirPath = (0, import_node_path98.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12613
12711
|
try {
|
|
12614
12712
|
if (await directoryExists(skillDirPath)) {
|
|
12615
12713
|
await removeDirectory(skillDirPath);
|
|
12616
12714
|
}
|
|
12617
12715
|
return {
|
|
12618
|
-
relativeDirPathFromCwd: (0,
|
|
12716
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12619
12717
|
};
|
|
12620
12718
|
} catch (error) {
|
|
12621
12719
|
throw new Error(
|
|
@@ -12648,7 +12746,7 @@ var skillToolSchemas = {
|
|
|
12648
12746
|
var skillTools = {
|
|
12649
12747
|
listSkills: {
|
|
12650
12748
|
name: "listSkills",
|
|
12651
|
-
description: `List all skills from ${(0,
|
|
12749
|
+
description: `List all skills from ${(0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12652
12750
|
parameters: skillToolSchemas.listSkills,
|
|
12653
12751
|
execute: async () => {
|
|
12654
12752
|
const skills = await listSkills();
|
|
@@ -12691,12 +12789,12 @@ var skillTools = {
|
|
|
12691
12789
|
};
|
|
12692
12790
|
|
|
12693
12791
|
// src/mcp/subagents.ts
|
|
12694
|
-
var
|
|
12792
|
+
var import_node_path99 = require("path");
|
|
12695
12793
|
var import_mini47 = require("zod/mini");
|
|
12696
12794
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12697
12795
|
var maxSubagentsCount = 1e3;
|
|
12698
12796
|
async function listSubagents() {
|
|
12699
|
-
const subagentsDir = (0,
|
|
12797
|
+
const subagentsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12700
12798
|
try {
|
|
12701
12799
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12702
12800
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12709,7 +12807,7 @@ async function listSubagents() {
|
|
|
12709
12807
|
});
|
|
12710
12808
|
const frontmatter = subagent.getFrontmatter();
|
|
12711
12809
|
return {
|
|
12712
|
-
relativePathFromCwd: (0,
|
|
12810
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12713
12811
|
frontmatter
|
|
12714
12812
|
};
|
|
12715
12813
|
} catch (error) {
|
|
@@ -12731,14 +12829,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12731
12829
|
relativePath: relativePathFromCwd,
|
|
12732
12830
|
intendedRootDir: process.cwd()
|
|
12733
12831
|
});
|
|
12734
|
-
const filename = (0,
|
|
12832
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12735
12833
|
try {
|
|
12736
12834
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12737
12835
|
relativeFilePath: filename,
|
|
12738
12836
|
validate: true
|
|
12739
12837
|
});
|
|
12740
12838
|
return {
|
|
12741
|
-
relativePathFromCwd: (0,
|
|
12839
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12742
12840
|
frontmatter: subagent.getFrontmatter(),
|
|
12743
12841
|
body: subagent.getBody()
|
|
12744
12842
|
};
|
|
@@ -12757,7 +12855,7 @@ async function putSubagent({
|
|
|
12757
12855
|
relativePath: relativePathFromCwd,
|
|
12758
12856
|
intendedRootDir: process.cwd()
|
|
12759
12857
|
});
|
|
12760
|
-
const filename = (0,
|
|
12858
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12761
12859
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12762
12860
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12763
12861
|
throw new Error(
|
|
@@ -12767,7 +12865,7 @@ async function putSubagent({
|
|
|
12767
12865
|
try {
|
|
12768
12866
|
const existingSubagents = await listSubagents();
|
|
12769
12867
|
const isUpdate = existingSubagents.some(
|
|
12770
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
12868
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12771
12869
|
);
|
|
12772
12870
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12773
12871
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12780,11 +12878,11 @@ async function putSubagent({
|
|
|
12780
12878
|
body,
|
|
12781
12879
|
validate: true
|
|
12782
12880
|
});
|
|
12783
|
-
const subagentsDir = (0,
|
|
12881
|
+
const subagentsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12784
12882
|
await ensureDir(subagentsDir);
|
|
12785
12883
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12786
12884
|
return {
|
|
12787
|
-
relativePathFromCwd: (0,
|
|
12885
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12788
12886
|
frontmatter: subagent.getFrontmatter(),
|
|
12789
12887
|
body: subagent.getBody()
|
|
12790
12888
|
};
|
|
@@ -12799,12 +12897,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12799
12897
|
relativePath: relativePathFromCwd,
|
|
12800
12898
|
intendedRootDir: process.cwd()
|
|
12801
12899
|
});
|
|
12802
|
-
const filename = (0,
|
|
12803
|
-
const fullPath = (0,
|
|
12900
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12901
|
+
const fullPath = (0, import_node_path99.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12804
12902
|
try {
|
|
12805
12903
|
await removeFile(fullPath);
|
|
12806
12904
|
return {
|
|
12807
|
-
relativePathFromCwd: (0,
|
|
12905
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12808
12906
|
};
|
|
12809
12907
|
} catch (error) {
|
|
12810
12908
|
throw new Error(
|
|
@@ -12832,7 +12930,7 @@ var subagentToolSchemas = {
|
|
|
12832
12930
|
var subagentTools = {
|
|
12833
12931
|
listSubagents: {
|
|
12834
12932
|
name: "listSubagents",
|
|
12835
|
-
description: `List all subagents from ${(0,
|
|
12933
|
+
description: `List all subagents from ${(0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12836
12934
|
parameters: subagentToolSchemas.listSubagents,
|
|
12837
12935
|
execute: async () => {
|
|
12838
12936
|
const subagents = await listSubagents();
|
|
@@ -13083,7 +13181,7 @@ async function mcpCommand({ version }) {
|
|
|
13083
13181
|
}
|
|
13084
13182
|
|
|
13085
13183
|
// src/cli/index.ts
|
|
13086
|
-
var getVersion = () => "5.
|
|
13184
|
+
var getVersion = () => "5.2.1";
|
|
13087
13185
|
var main = async () => {
|
|
13088
13186
|
const program = new import_commander.Command();
|
|
13089
13187
|
const version = getVersion();
|