rulesync 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.cjs +448 -351
- package/dist/index.js +404 -307
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -102,7 +102,7 @@ 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
108
|
var import_node_path2 = require("path");
|
|
@@ -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);
|
|
@@ -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_node_path31 = require("path");
|
|
3265
|
+
var import_es_toolkit3 = require("es-toolkit");
|
|
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,7 +3635,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3538
3635
|
};
|
|
3539
3636
|
|
|
3540
3637
|
// src/features/mcp/rulesync-mcp.ts
|
|
3541
|
-
var
|
|
3638
|
+
var import_node_path33 = require("path");
|
|
3542
3639
|
var import_object = require("es-toolkit/object");
|
|
3543
3640
|
var import_mini16 = require("zod/mini");
|
|
3544
3641
|
var RulesyncMcpServerSchema = import_mini16.z.union([
|
|
@@ -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,7 +5029,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4932
5029
|
};
|
|
4933
5030
|
|
|
4934
5031
|
// src/features/rules/rules-processor.ts
|
|
4935
|
-
var
|
|
5032
|
+
var import_node_path91 = require("path");
|
|
4936
5033
|
var import_toon = require("@toon-format/toon");
|
|
4937
5034
|
var import_mini41 = require("zod/mini");
|
|
4938
5035
|
|
|
@@ -4940,17 +5037,17 @@ var import_mini41 = require("zod/mini");
|
|
|
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,12 +8237,12 @@ 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
|
);
|
|
@@ -8164,7 +8261,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8164
8261
|
agentsmd: result.data.agentsmd,
|
|
8165
8262
|
cursor: result.data.cursor
|
|
8166
8263
|
};
|
|
8167
|
-
const filename = (0,
|
|
8264
|
+
const filename = (0, import_node_path70.basename)(legacyPath);
|
|
8168
8265
|
return new _RulesyncRule({
|
|
8169
8266
|
baseDir: process.cwd(),
|
|
8170
8267
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8178,7 +8275,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8178
8275
|
relativeFilePath,
|
|
8179
8276
|
validate = true
|
|
8180
8277
|
}) {
|
|
8181
|
-
const filePath = (0,
|
|
8278
|
+
const filePath = (0, import_node_path70.join)(
|
|
8182
8279
|
process.cwd(),
|
|
8183
8280
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8184
8281
|
relativeFilePath
|
|
@@ -8197,7 +8294,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8197
8294
|
agentsmd: result.data.agentsmd,
|
|
8198
8295
|
cursor: result.data.cursor
|
|
8199
8296
|
};
|
|
8200
|
-
const filename = (0,
|
|
8297
|
+
const filename = (0, import_node_path70.basename)(filePath);
|
|
8201
8298
|
return new _RulesyncRule({
|
|
8202
8299
|
baseDir: process.cwd(),
|
|
8203
8300
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8280,7 +8377,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8280
8377
|
rulesyncRule,
|
|
8281
8378
|
validate = true,
|
|
8282
8379
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8283
|
-
nonRootPath = { relativeDirPath: (0,
|
|
8380
|
+
nonRootPath = { relativeDirPath: (0, import_node_path71.join)(".agents", "memories") }
|
|
8284
8381
|
}) {
|
|
8285
8382
|
const params = this.buildToolRuleParamsDefault({
|
|
8286
8383
|
baseDir,
|
|
@@ -8291,7 +8388,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8291
8388
|
});
|
|
8292
8389
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8293
8390
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8294
|
-
params.relativeDirPath = (0,
|
|
8391
|
+
params.relativeDirPath = (0, import_node_path71.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8295
8392
|
params.relativeFilePath = "AGENTS.md";
|
|
8296
8393
|
}
|
|
8297
8394
|
return params;
|
|
@@ -8356,7 +8453,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8356
8453
|
relativeFilePath: "AGENTS.md"
|
|
8357
8454
|
},
|
|
8358
8455
|
nonRoot: {
|
|
8359
|
-
relativeDirPath: (0,
|
|
8456
|
+
relativeDirPath: (0, import_node_path72.join)(".agents", "memories")
|
|
8360
8457
|
}
|
|
8361
8458
|
};
|
|
8362
8459
|
}
|
|
@@ -8366,8 +8463,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8366
8463
|
validate = true
|
|
8367
8464
|
}) {
|
|
8368
8465
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8369
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8370
|
-
const fileContent = await readFileContent((0,
|
|
8466
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path72.join)(".agents", "memories", relativeFilePath);
|
|
8467
|
+
const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
|
|
8371
8468
|
return new _AgentsMdRule({
|
|
8372
8469
|
baseDir,
|
|
8373
8470
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8422,7 +8519,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8422
8519
|
};
|
|
8423
8520
|
|
|
8424
8521
|
// src/features/rules/antigravity-rule.ts
|
|
8425
|
-
var
|
|
8522
|
+
var import_node_path73 = require("path");
|
|
8426
8523
|
var import_mini36 = require("zod/mini");
|
|
8427
8524
|
var AntigravityRuleFrontmatterSchema = import_mini36.z.looseObject({
|
|
8428
8525
|
trigger: import_mini36.z.optional(
|
|
@@ -8581,7 +8678,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8581
8678
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8582
8679
|
if (!result.success) {
|
|
8583
8680
|
throw new Error(
|
|
8584
|
-
`Invalid frontmatter in ${(0,
|
|
8681
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8585
8682
|
);
|
|
8586
8683
|
}
|
|
8587
8684
|
}
|
|
@@ -8596,7 +8693,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8596
8693
|
static getSettablePaths() {
|
|
8597
8694
|
return {
|
|
8598
8695
|
nonRoot: {
|
|
8599
|
-
relativeDirPath: (0,
|
|
8696
|
+
relativeDirPath: (0, import_node_path73.join)(".agent", "rules")
|
|
8600
8697
|
}
|
|
8601
8698
|
};
|
|
8602
8699
|
}
|
|
@@ -8605,7 +8702,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8605
8702
|
relativeFilePath,
|
|
8606
8703
|
validate = true
|
|
8607
8704
|
}) {
|
|
8608
|
-
const filePath = (0,
|
|
8705
|
+
const filePath = (0, import_node_path73.join)(
|
|
8609
8706
|
baseDir,
|
|
8610
8707
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8611
8708
|
relativeFilePath
|
|
@@ -8746,7 +8843,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8746
8843
|
};
|
|
8747
8844
|
|
|
8748
8845
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8749
|
-
var
|
|
8846
|
+
var import_node_path74 = require("path");
|
|
8750
8847
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8751
8848
|
toRulesyncRule() {
|
|
8752
8849
|
const rulesyncFrontmatter = {
|
|
@@ -8772,7 +8869,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8772
8869
|
relativeFilePath: ".augment-guidelines"
|
|
8773
8870
|
},
|
|
8774
8871
|
nonRoot: {
|
|
8775
|
-
relativeDirPath: (0,
|
|
8872
|
+
relativeDirPath: (0, import_node_path74.join)(".augment", "rules")
|
|
8776
8873
|
}
|
|
8777
8874
|
};
|
|
8778
8875
|
}
|
|
@@ -8807,8 +8904,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8807
8904
|
}) {
|
|
8808
8905
|
const settablePaths = this.getSettablePaths();
|
|
8809
8906
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8810
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
8811
|
-
const fileContent = await readFileContent((0,
|
|
8907
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path74.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8908
|
+
const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
|
|
8812
8909
|
return new _AugmentcodeLegacyRule({
|
|
8813
8910
|
baseDir,
|
|
8814
8911
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8837,7 +8934,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8837
8934
|
};
|
|
8838
8935
|
|
|
8839
8936
|
// src/features/rules/augmentcode-rule.ts
|
|
8840
|
-
var
|
|
8937
|
+
var import_node_path75 = require("path");
|
|
8841
8938
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8842
8939
|
toRulesyncRule() {
|
|
8843
8940
|
return this.toRulesyncRuleDefault();
|
|
@@ -8845,7 +8942,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8845
8942
|
static getSettablePaths() {
|
|
8846
8943
|
return {
|
|
8847
8944
|
nonRoot: {
|
|
8848
|
-
relativeDirPath: (0,
|
|
8945
|
+
relativeDirPath: (0, import_node_path75.join)(".augment", "rules")
|
|
8849
8946
|
}
|
|
8850
8947
|
};
|
|
8851
8948
|
}
|
|
@@ -8869,7 +8966,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8869
8966
|
validate = true
|
|
8870
8967
|
}) {
|
|
8871
8968
|
const fileContent = await readFileContent(
|
|
8872
|
-
(0,
|
|
8969
|
+
(0, import_node_path75.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8873
8970
|
);
|
|
8874
8971
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8875
8972
|
return new _AugmentcodeRule({
|
|
@@ -8905,7 +9002,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8905
9002
|
};
|
|
8906
9003
|
|
|
8907
9004
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8908
|
-
var
|
|
9005
|
+
var import_node_path76 = require("path");
|
|
8909
9006
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8910
9007
|
static getSettablePaths({
|
|
8911
9008
|
global
|
|
@@ -8924,7 +9021,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8924
9021
|
relativeFilePath: "CLAUDE.md"
|
|
8925
9022
|
},
|
|
8926
9023
|
nonRoot: {
|
|
8927
|
-
relativeDirPath: (0,
|
|
9024
|
+
relativeDirPath: (0, import_node_path76.join)(".claude", "memories")
|
|
8928
9025
|
}
|
|
8929
9026
|
};
|
|
8930
9027
|
}
|
|
@@ -8939,7 +9036,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8939
9036
|
if (isRoot) {
|
|
8940
9037
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8941
9038
|
const fileContent2 = await readFileContent(
|
|
8942
|
-
(0,
|
|
9039
|
+
(0, import_node_path76.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8943
9040
|
);
|
|
8944
9041
|
return new _ClaudecodeLegacyRule({
|
|
8945
9042
|
baseDir,
|
|
@@ -8953,8 +9050,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8953
9050
|
if (!paths.nonRoot) {
|
|
8954
9051
|
throw new Error("nonRoot path is not set");
|
|
8955
9052
|
}
|
|
8956
|
-
const relativePath = (0,
|
|
8957
|
-
const fileContent = await readFileContent((0,
|
|
9053
|
+
const relativePath = (0, import_node_path76.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9054
|
+
const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
|
|
8958
9055
|
return new _ClaudecodeLegacyRule({
|
|
8959
9056
|
baseDir,
|
|
8960
9057
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9013,7 +9110,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9013
9110
|
};
|
|
9014
9111
|
|
|
9015
9112
|
// src/features/rules/claudecode-rule.ts
|
|
9016
|
-
var
|
|
9113
|
+
var import_node_path77 = require("path");
|
|
9017
9114
|
var import_mini37 = require("zod/mini");
|
|
9018
9115
|
var ClaudecodeRuleFrontmatterSchema = import_mini37.z.object({
|
|
9019
9116
|
paths: import_mini37.z.optional(import_mini37.z.string())
|
|
@@ -9038,7 +9135,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9038
9135
|
relativeFilePath: "CLAUDE.md"
|
|
9039
9136
|
},
|
|
9040
9137
|
nonRoot: {
|
|
9041
|
-
relativeDirPath: (0,
|
|
9138
|
+
relativeDirPath: (0, import_node_path77.join)(".claude", "rules")
|
|
9042
9139
|
}
|
|
9043
9140
|
};
|
|
9044
9141
|
}
|
|
@@ -9047,7 +9144,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9047
9144
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9048
9145
|
if (!result.success) {
|
|
9049
9146
|
throw new Error(
|
|
9050
|
-
`Invalid frontmatter in ${(0,
|
|
9147
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9051
9148
|
);
|
|
9052
9149
|
}
|
|
9053
9150
|
}
|
|
@@ -9075,7 +9172,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9075
9172
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9076
9173
|
if (isRoot) {
|
|
9077
9174
|
const fileContent2 = await readFileContent(
|
|
9078
|
-
(0,
|
|
9175
|
+
(0, import_node_path77.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9079
9176
|
);
|
|
9080
9177
|
return new _ClaudecodeRule({
|
|
9081
9178
|
baseDir,
|
|
@@ -9090,13 +9187,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9090
9187
|
if (!paths.nonRoot) {
|
|
9091
9188
|
throw new Error("nonRoot path is not set");
|
|
9092
9189
|
}
|
|
9093
|
-
const relativePath = (0,
|
|
9094
|
-
const fileContent = await readFileContent((0,
|
|
9190
|
+
const relativePath = (0, import_node_path77.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9191
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
9095
9192
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9096
9193
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9097
9194
|
if (!result.success) {
|
|
9098
9195
|
throw new Error(
|
|
9099
|
-
`Invalid frontmatter in ${(0,
|
|
9196
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9100
9197
|
);
|
|
9101
9198
|
}
|
|
9102
9199
|
return new _ClaudecodeRule({
|
|
@@ -9203,7 +9300,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9203
9300
|
return {
|
|
9204
9301
|
success: false,
|
|
9205
9302
|
error: new Error(
|
|
9206
|
-
`Invalid frontmatter in ${(0,
|
|
9303
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9207
9304
|
)
|
|
9208
9305
|
};
|
|
9209
9306
|
}
|
|
@@ -9223,7 +9320,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9223
9320
|
};
|
|
9224
9321
|
|
|
9225
9322
|
// src/features/rules/cline-rule.ts
|
|
9226
|
-
var
|
|
9323
|
+
var import_node_path78 = require("path");
|
|
9227
9324
|
var import_mini38 = require("zod/mini");
|
|
9228
9325
|
var ClineRuleFrontmatterSchema = import_mini38.z.object({
|
|
9229
9326
|
description: import_mini38.z.string()
|
|
@@ -9268,7 +9365,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9268
9365
|
validate = true
|
|
9269
9366
|
}) {
|
|
9270
9367
|
const fileContent = await readFileContent(
|
|
9271
|
-
(0,
|
|
9368
|
+
(0, import_node_path78.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9272
9369
|
);
|
|
9273
9370
|
return new _ClineRule({
|
|
9274
9371
|
baseDir,
|
|
@@ -9294,7 +9391,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9294
9391
|
};
|
|
9295
9392
|
|
|
9296
9393
|
// src/features/rules/codexcli-rule.ts
|
|
9297
|
-
var
|
|
9394
|
+
var import_node_path79 = require("path");
|
|
9298
9395
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9299
9396
|
static getSettablePaths({
|
|
9300
9397
|
global
|
|
@@ -9313,7 +9410,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9313
9410
|
relativeFilePath: "AGENTS.md"
|
|
9314
9411
|
},
|
|
9315
9412
|
nonRoot: {
|
|
9316
|
-
relativeDirPath: (0,
|
|
9413
|
+
relativeDirPath: (0, import_node_path79.join)(".codex", "memories")
|
|
9317
9414
|
}
|
|
9318
9415
|
};
|
|
9319
9416
|
}
|
|
@@ -9328,7 +9425,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9328
9425
|
if (isRoot) {
|
|
9329
9426
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9330
9427
|
const fileContent2 = await readFileContent(
|
|
9331
|
-
(0,
|
|
9428
|
+
(0, import_node_path79.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9332
9429
|
);
|
|
9333
9430
|
return new _CodexcliRule({
|
|
9334
9431
|
baseDir,
|
|
@@ -9342,8 +9439,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9342
9439
|
if (!paths.nonRoot) {
|
|
9343
9440
|
throw new Error("nonRoot path is not set");
|
|
9344
9441
|
}
|
|
9345
|
-
const relativePath = (0,
|
|
9346
|
-
const fileContent = await readFileContent((0,
|
|
9442
|
+
const relativePath = (0, import_node_path79.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9443
|
+
const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
|
|
9347
9444
|
return new _CodexcliRule({
|
|
9348
9445
|
baseDir,
|
|
9349
9446
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9402,7 +9499,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9402
9499
|
};
|
|
9403
9500
|
|
|
9404
9501
|
// src/features/rules/copilot-rule.ts
|
|
9405
|
-
var
|
|
9502
|
+
var import_node_path80 = require("path");
|
|
9406
9503
|
var import_mini39 = require("zod/mini");
|
|
9407
9504
|
var CopilotRuleFrontmatterSchema = import_mini39.z.object({
|
|
9408
9505
|
description: import_mini39.z.optional(import_mini39.z.string()),
|
|
@@ -9419,7 +9516,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9419
9516
|
relativeFilePath: "copilot-instructions.md"
|
|
9420
9517
|
},
|
|
9421
9518
|
nonRoot: {
|
|
9422
|
-
relativeDirPath: (0,
|
|
9519
|
+
relativeDirPath: (0, import_node_path80.join)(".github", "instructions")
|
|
9423
9520
|
}
|
|
9424
9521
|
};
|
|
9425
9522
|
}
|
|
@@ -9428,7 +9525,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9428
9525
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9429
9526
|
if (!result.success) {
|
|
9430
9527
|
throw new Error(
|
|
9431
|
-
`Invalid frontmatter in ${(0,
|
|
9528
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9432
9529
|
);
|
|
9433
9530
|
}
|
|
9434
9531
|
}
|
|
@@ -9510,11 +9607,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9510
9607
|
validate = true
|
|
9511
9608
|
}) {
|
|
9512
9609
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9513
|
-
const relativePath = isRoot ? (0,
|
|
9610
|
+
const relativePath = isRoot ? (0, import_node_path80.join)(
|
|
9514
9611
|
this.getSettablePaths().root.relativeDirPath,
|
|
9515
9612
|
this.getSettablePaths().root.relativeFilePath
|
|
9516
|
-
) : (0,
|
|
9517
|
-
const fileContent = await readFileContent((0,
|
|
9613
|
+
) : (0, import_node_path80.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9614
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
9518
9615
|
if (isRoot) {
|
|
9519
9616
|
return new _CopilotRule({
|
|
9520
9617
|
baseDir,
|
|
@@ -9530,7 +9627,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9530
9627
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9531
9628
|
if (!result.success) {
|
|
9532
9629
|
throw new Error(
|
|
9533
|
-
`Invalid frontmatter in ${(0,
|
|
9630
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9534
9631
|
);
|
|
9535
9632
|
}
|
|
9536
9633
|
return new _CopilotRule({
|
|
@@ -9570,7 +9667,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9570
9667
|
return {
|
|
9571
9668
|
success: false,
|
|
9572
9669
|
error: new Error(
|
|
9573
|
-
`Invalid frontmatter in ${(0,
|
|
9670
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9574
9671
|
)
|
|
9575
9672
|
};
|
|
9576
9673
|
}
|
|
@@ -9590,7 +9687,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9590
9687
|
};
|
|
9591
9688
|
|
|
9592
9689
|
// src/features/rules/cursor-rule.ts
|
|
9593
|
-
var
|
|
9690
|
+
var import_node_path81 = require("path");
|
|
9594
9691
|
var import_mini40 = require("zod/mini");
|
|
9595
9692
|
var CursorRuleFrontmatterSchema = import_mini40.z.object({
|
|
9596
9693
|
description: import_mini40.z.optional(import_mini40.z.string()),
|
|
@@ -9603,7 +9700,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9603
9700
|
static getSettablePaths() {
|
|
9604
9701
|
return {
|
|
9605
9702
|
nonRoot: {
|
|
9606
|
-
relativeDirPath: (0,
|
|
9703
|
+
relativeDirPath: (0, import_node_path81.join)(".cursor", "rules")
|
|
9607
9704
|
}
|
|
9608
9705
|
};
|
|
9609
9706
|
}
|
|
@@ -9612,7 +9709,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9612
9709
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9613
9710
|
if (!result.success) {
|
|
9614
9711
|
throw new Error(
|
|
9615
|
-
`Invalid frontmatter in ${(0,
|
|
9712
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9616
9713
|
);
|
|
9617
9714
|
}
|
|
9618
9715
|
}
|
|
@@ -9729,19 +9826,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9729
9826
|
validate = true
|
|
9730
9827
|
}) {
|
|
9731
9828
|
const fileContent = await readFileContent(
|
|
9732
|
-
(0,
|
|
9829
|
+
(0, import_node_path81.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9733
9830
|
);
|
|
9734
9831
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9735
9832
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9736
9833
|
if (!result.success) {
|
|
9737
9834
|
throw new Error(
|
|
9738
|
-
`Invalid frontmatter in ${(0,
|
|
9835
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9739
9836
|
);
|
|
9740
9837
|
}
|
|
9741
9838
|
return new _CursorRule({
|
|
9742
9839
|
baseDir,
|
|
9743
9840
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9744
|
-
relativeFilePath: (0,
|
|
9841
|
+
relativeFilePath: (0, import_node_path81.basename)(relativeFilePath),
|
|
9745
9842
|
frontmatter: result.data,
|
|
9746
9843
|
body: content.trim(),
|
|
9747
9844
|
validate
|
|
@@ -9772,7 +9869,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9772
9869
|
return {
|
|
9773
9870
|
success: false,
|
|
9774
9871
|
error: new Error(
|
|
9775
|
-
`Invalid frontmatter in ${(0,
|
|
9872
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9776
9873
|
)
|
|
9777
9874
|
};
|
|
9778
9875
|
}
|
|
@@ -9792,7 +9889,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9792
9889
|
};
|
|
9793
9890
|
|
|
9794
9891
|
// src/features/rules/geminicli-rule.ts
|
|
9795
|
-
var
|
|
9892
|
+
var import_node_path82 = require("path");
|
|
9796
9893
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9797
9894
|
static getSettablePaths({
|
|
9798
9895
|
global
|
|
@@ -9811,7 +9908,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9811
9908
|
relativeFilePath: "GEMINI.md"
|
|
9812
9909
|
},
|
|
9813
9910
|
nonRoot: {
|
|
9814
|
-
relativeDirPath: (0,
|
|
9911
|
+
relativeDirPath: (0, import_node_path82.join)(".gemini", "memories")
|
|
9815
9912
|
}
|
|
9816
9913
|
};
|
|
9817
9914
|
}
|
|
@@ -9826,7 +9923,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9826
9923
|
if (isRoot) {
|
|
9827
9924
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9828
9925
|
const fileContent2 = await readFileContent(
|
|
9829
|
-
(0,
|
|
9926
|
+
(0, import_node_path82.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9830
9927
|
);
|
|
9831
9928
|
return new _GeminiCliRule({
|
|
9832
9929
|
baseDir,
|
|
@@ -9840,8 +9937,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9840
9937
|
if (!paths.nonRoot) {
|
|
9841
9938
|
throw new Error("nonRoot path is not set");
|
|
9842
9939
|
}
|
|
9843
|
-
const relativePath = (0,
|
|
9844
|
-
const fileContent = await readFileContent((0,
|
|
9940
|
+
const relativePath = (0, import_node_path82.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9941
|
+
const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
|
|
9845
9942
|
return new _GeminiCliRule({
|
|
9846
9943
|
baseDir,
|
|
9847
9944
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9900,7 +9997,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9900
9997
|
};
|
|
9901
9998
|
|
|
9902
9999
|
// src/features/rules/junie-rule.ts
|
|
9903
|
-
var
|
|
10000
|
+
var import_node_path83 = require("path");
|
|
9904
10001
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9905
10002
|
static getSettablePaths() {
|
|
9906
10003
|
return {
|
|
@@ -9909,7 +10006,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9909
10006
|
relativeFilePath: "guidelines.md"
|
|
9910
10007
|
},
|
|
9911
10008
|
nonRoot: {
|
|
9912
|
-
relativeDirPath: (0,
|
|
10009
|
+
relativeDirPath: (0, import_node_path83.join)(".junie", "memories")
|
|
9913
10010
|
}
|
|
9914
10011
|
};
|
|
9915
10012
|
}
|
|
@@ -9919,8 +10016,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9919
10016
|
validate = true
|
|
9920
10017
|
}) {
|
|
9921
10018
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9922
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
9923
|
-
const fileContent = await readFileContent((0,
|
|
10019
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path83.join)(".junie", "memories", relativeFilePath);
|
|
10020
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
9924
10021
|
return new _JunieRule({
|
|
9925
10022
|
baseDir,
|
|
9926
10023
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9975,12 +10072,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9975
10072
|
};
|
|
9976
10073
|
|
|
9977
10074
|
// src/features/rules/kilo-rule.ts
|
|
9978
|
-
var
|
|
10075
|
+
var import_node_path84 = require("path");
|
|
9979
10076
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
9980
10077
|
static getSettablePaths(_options = {}) {
|
|
9981
10078
|
return {
|
|
9982
10079
|
nonRoot: {
|
|
9983
|
-
relativeDirPath: (0,
|
|
10080
|
+
relativeDirPath: (0, import_node_path84.join)(".kilocode", "rules")
|
|
9984
10081
|
}
|
|
9985
10082
|
};
|
|
9986
10083
|
}
|
|
@@ -9990,7 +10087,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
9990
10087
|
validate = true
|
|
9991
10088
|
}) {
|
|
9992
10089
|
const fileContent = await readFileContent(
|
|
9993
|
-
(0,
|
|
10090
|
+
(0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9994
10091
|
);
|
|
9995
10092
|
return new _KiloRule({
|
|
9996
10093
|
baseDir,
|
|
@@ -10042,12 +10139,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10042
10139
|
};
|
|
10043
10140
|
|
|
10044
10141
|
// src/features/rules/kiro-rule.ts
|
|
10045
|
-
var
|
|
10142
|
+
var import_node_path85 = require("path");
|
|
10046
10143
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10047
10144
|
static getSettablePaths() {
|
|
10048
10145
|
return {
|
|
10049
10146
|
nonRoot: {
|
|
10050
|
-
relativeDirPath: (0,
|
|
10147
|
+
relativeDirPath: (0, import_node_path85.join)(".kiro", "steering")
|
|
10051
10148
|
}
|
|
10052
10149
|
};
|
|
10053
10150
|
}
|
|
@@ -10057,7 +10154,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10057
10154
|
validate = true
|
|
10058
10155
|
}) {
|
|
10059
10156
|
const fileContent = await readFileContent(
|
|
10060
|
-
(0,
|
|
10157
|
+
(0, import_node_path85.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10061
10158
|
);
|
|
10062
10159
|
return new _KiroRule({
|
|
10063
10160
|
baseDir,
|
|
@@ -10111,7 +10208,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10111
10208
|
};
|
|
10112
10209
|
|
|
10113
10210
|
// src/features/rules/opencode-rule.ts
|
|
10114
|
-
var
|
|
10211
|
+
var import_node_path86 = require("path");
|
|
10115
10212
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10116
10213
|
static getSettablePaths() {
|
|
10117
10214
|
return {
|
|
@@ -10120,7 +10217,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10120
10217
|
relativeFilePath: "AGENTS.md"
|
|
10121
10218
|
},
|
|
10122
10219
|
nonRoot: {
|
|
10123
|
-
relativeDirPath: (0,
|
|
10220
|
+
relativeDirPath: (0, import_node_path86.join)(".opencode", "memories")
|
|
10124
10221
|
}
|
|
10125
10222
|
};
|
|
10126
10223
|
}
|
|
@@ -10130,8 +10227,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10130
10227
|
validate = true
|
|
10131
10228
|
}) {
|
|
10132
10229
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10133
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10134
|
-
const fileContent = await readFileContent((0,
|
|
10230
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path86.join)(".opencode", "memories", relativeFilePath);
|
|
10231
|
+
const fileContent = await readFileContent((0, import_node_path86.join)(baseDir, relativePath));
|
|
10135
10232
|
return new _OpenCodeRule({
|
|
10136
10233
|
baseDir,
|
|
10137
10234
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10186,7 +10283,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10186
10283
|
};
|
|
10187
10284
|
|
|
10188
10285
|
// src/features/rules/qwencode-rule.ts
|
|
10189
|
-
var
|
|
10286
|
+
var import_node_path87 = require("path");
|
|
10190
10287
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10191
10288
|
static getSettablePaths() {
|
|
10192
10289
|
return {
|
|
@@ -10195,7 +10292,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10195
10292
|
relativeFilePath: "QWEN.md"
|
|
10196
10293
|
},
|
|
10197
10294
|
nonRoot: {
|
|
10198
|
-
relativeDirPath: (0,
|
|
10295
|
+
relativeDirPath: (0, import_node_path87.join)(".qwen", "memories")
|
|
10199
10296
|
}
|
|
10200
10297
|
};
|
|
10201
10298
|
}
|
|
@@ -10205,8 +10302,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10205
10302
|
validate = true
|
|
10206
10303
|
}) {
|
|
10207
10304
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10208
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10209
|
-
const fileContent = await readFileContent((0,
|
|
10305
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path87.join)(".qwen", "memories", relativeFilePath);
|
|
10306
|
+
const fileContent = await readFileContent((0, import_node_path87.join)(baseDir, relativePath));
|
|
10210
10307
|
return new _QwencodeRule({
|
|
10211
10308
|
baseDir,
|
|
10212
10309
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10258,12 +10355,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10258
10355
|
};
|
|
10259
10356
|
|
|
10260
10357
|
// src/features/rules/roo-rule.ts
|
|
10261
|
-
var
|
|
10358
|
+
var import_node_path88 = require("path");
|
|
10262
10359
|
var RooRule = class _RooRule extends ToolRule {
|
|
10263
10360
|
static getSettablePaths() {
|
|
10264
10361
|
return {
|
|
10265
10362
|
nonRoot: {
|
|
10266
|
-
relativeDirPath: (0,
|
|
10363
|
+
relativeDirPath: (0, import_node_path88.join)(".roo", "rules")
|
|
10267
10364
|
}
|
|
10268
10365
|
};
|
|
10269
10366
|
}
|
|
@@ -10273,7 +10370,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10273
10370
|
validate = true
|
|
10274
10371
|
}) {
|
|
10275
10372
|
const fileContent = await readFileContent(
|
|
10276
|
-
(0,
|
|
10373
|
+
(0, import_node_path88.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10277
10374
|
);
|
|
10278
10375
|
return new _RooRule({
|
|
10279
10376
|
baseDir,
|
|
@@ -10342,7 +10439,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10342
10439
|
};
|
|
10343
10440
|
|
|
10344
10441
|
// src/features/rules/warp-rule.ts
|
|
10345
|
-
var
|
|
10442
|
+
var import_node_path89 = require("path");
|
|
10346
10443
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10347
10444
|
constructor({ fileContent, root, ...rest }) {
|
|
10348
10445
|
super({
|
|
@@ -10358,7 +10455,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10358
10455
|
relativeFilePath: "WARP.md"
|
|
10359
10456
|
},
|
|
10360
10457
|
nonRoot: {
|
|
10361
|
-
relativeDirPath: (0,
|
|
10458
|
+
relativeDirPath: (0, import_node_path89.join)(".warp", "memories")
|
|
10362
10459
|
}
|
|
10363
10460
|
};
|
|
10364
10461
|
}
|
|
@@ -10368,8 +10465,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10368
10465
|
validate = true
|
|
10369
10466
|
}) {
|
|
10370
10467
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10371
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10372
|
-
const fileContent = await readFileContent((0,
|
|
10468
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path89.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10469
|
+
const fileContent = await readFileContent((0, import_node_path89.join)(baseDir, relativePath));
|
|
10373
10470
|
return new _WarpRule({
|
|
10374
10471
|
baseDir,
|
|
10375
10472
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10424,12 +10521,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10424
10521
|
};
|
|
10425
10522
|
|
|
10426
10523
|
// src/features/rules/windsurf-rule.ts
|
|
10427
|
-
var
|
|
10524
|
+
var import_node_path90 = require("path");
|
|
10428
10525
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10429
10526
|
static getSettablePaths() {
|
|
10430
10527
|
return {
|
|
10431
10528
|
nonRoot: {
|
|
10432
|
-
relativeDirPath: (0,
|
|
10529
|
+
relativeDirPath: (0, import_node_path90.join)(".windsurf", "rules")
|
|
10433
10530
|
}
|
|
10434
10531
|
};
|
|
10435
10532
|
}
|
|
@@ -10439,7 +10536,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10439
10536
|
validate = true
|
|
10440
10537
|
}) {
|
|
10441
10538
|
const fileContent = await readFileContent(
|
|
10442
|
-
(0,
|
|
10539
|
+
(0, import_node_path90.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10443
10540
|
);
|
|
10444
10541
|
return new _WindsurfRule({
|
|
10445
10542
|
baseDir,
|
|
@@ -10796,7 +10893,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10796
10893
|
}).relativeDirPath;
|
|
10797
10894
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10798
10895
|
const frontmatter = skill.getFrontmatter();
|
|
10799
|
-
const relativePath = (0,
|
|
10896
|
+
const relativePath = (0, import_node_path91.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10800
10897
|
return {
|
|
10801
10898
|
name: frontmatter.name,
|
|
10802
10899
|
description: frontmatter.description,
|
|
@@ -10863,10 +10960,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10863
10960
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10864
10961
|
*/
|
|
10865
10962
|
async loadRulesyncFiles() {
|
|
10866
|
-
const files = await findFilesByGlobs((0,
|
|
10963
|
+
const files = await findFilesByGlobs((0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10867
10964
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10868
10965
|
const rulesyncRules = await Promise.all(
|
|
10869
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
10966
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path91.basename)(file) }))
|
|
10870
10967
|
);
|
|
10871
10968
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10872
10969
|
if (rootRules.length > 1) {
|
|
@@ -10884,10 +10981,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10884
10981
|
return rulesyncRules;
|
|
10885
10982
|
}
|
|
10886
10983
|
async loadRulesyncFilesLegacy() {
|
|
10887
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
10984
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path91.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10888
10985
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10889
10986
|
return Promise.all(
|
|
10890
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
10987
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path91.basename)(file) }))
|
|
10891
10988
|
);
|
|
10892
10989
|
}
|
|
10893
10990
|
/**
|
|
@@ -10905,7 +11002,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10905
11002
|
return [];
|
|
10906
11003
|
}
|
|
10907
11004
|
const rootFilePaths = await findFilesByGlobs(
|
|
10908
|
-
(0,
|
|
11005
|
+
(0, import_node_path91.join)(
|
|
10909
11006
|
this.baseDir,
|
|
10910
11007
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10911
11008
|
settablePaths.root.relativeFilePath
|
|
@@ -10916,7 +11013,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10916
11013
|
(filePath) => factory.class.forDeletion({
|
|
10917
11014
|
baseDir: this.baseDir,
|
|
10918
11015
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
10919
|
-
relativeFilePath: (0,
|
|
11016
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10920
11017
|
global: this.global
|
|
10921
11018
|
})
|
|
10922
11019
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10925,7 +11022,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10925
11022
|
rootFilePaths.map(
|
|
10926
11023
|
(filePath) => factory.class.fromFile({
|
|
10927
11024
|
baseDir: this.baseDir,
|
|
10928
|
-
relativeFilePath: (0,
|
|
11025
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10929
11026
|
global: this.global
|
|
10930
11027
|
})
|
|
10931
11028
|
)
|
|
@@ -10937,14 +11034,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10937
11034
|
return [];
|
|
10938
11035
|
}
|
|
10939
11036
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
10940
|
-
(0,
|
|
11037
|
+
(0, import_node_path91.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
10941
11038
|
);
|
|
10942
11039
|
if (forDeletion) {
|
|
10943
11040
|
return nonRootFilePaths.map(
|
|
10944
11041
|
(filePath) => factory.class.forDeletion({
|
|
10945
11042
|
baseDir: this.baseDir,
|
|
10946
11043
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
10947
|
-
relativeFilePath: (0,
|
|
11044
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10948
11045
|
global: this.global
|
|
10949
11046
|
})
|
|
10950
11047
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10953,7 +11050,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10953
11050
|
nonRootFilePaths.map(
|
|
10954
11051
|
(filePath) => factory.class.fromFile({
|
|
10955
11052
|
baseDir: this.baseDir,
|
|
10956
|
-
relativeFilePath: (0,
|
|
11053
|
+
relativeFilePath: (0, import_node_path91.basename)(filePath),
|
|
10957
11054
|
global: this.global
|
|
10958
11055
|
})
|
|
10959
11056
|
)
|
|
@@ -11046,14 +11143,14 @@ s/<command> [arguments]
|
|
|
11046
11143
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11047
11144
|
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
11145
|
|
|
11049
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
11146
|
+
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
11147
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11051
11148
|
|
|
11052
11149
|
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
11150
|
|
|
11054
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
11151
|
+
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
11152
|
|
|
11056
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
11153
|
+
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
11154
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11058
11155
|
const result = [
|
|
11059
11156
|
overview,
|
|
@@ -11122,7 +11219,7 @@ async function generateRules(config, options) {
|
|
|
11122
11219
|
}
|
|
11123
11220
|
let totalRulesOutputs = 0;
|
|
11124
11221
|
logger.info("Generating rule files...");
|
|
11125
|
-
const toolTargets = (0,
|
|
11222
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11126
11223
|
config.getTargets(),
|
|
11127
11224
|
RulesProcessor.getToolTargets({ global: config.getGlobal() })
|
|
11128
11225
|
);
|
|
@@ -11161,7 +11258,7 @@ async function generateIgnore(config) {
|
|
|
11161
11258
|
}
|
|
11162
11259
|
let totalIgnoreOutputs = 0;
|
|
11163
11260
|
logger.info("Generating ignore files...");
|
|
11164
|
-
for (const toolTarget of (0,
|
|
11261
|
+
for (const toolTarget of (0, import_es_toolkit4.intersection)(config.getTargets(), IgnoreProcessor.getToolTargets())) {
|
|
11165
11262
|
for (const baseDir of config.getBaseDirs()) {
|
|
11166
11263
|
try {
|
|
11167
11264
|
const processor = new IgnoreProcessor({
|
|
@@ -11200,7 +11297,7 @@ async function generateMcp(config) {
|
|
|
11200
11297
|
if (config.getModularMcp()) {
|
|
11201
11298
|
logger.info("\u2139\uFE0F Modular MCP support is experimental.");
|
|
11202
11299
|
}
|
|
11203
|
-
const toolTargets = (0,
|
|
11300
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11204
11301
|
config.getTargets(),
|
|
11205
11302
|
McpProcessor.getToolTargets({ global: config.getGlobal() })
|
|
11206
11303
|
);
|
|
@@ -11232,7 +11329,7 @@ async function generateCommands(config) {
|
|
|
11232
11329
|
}
|
|
11233
11330
|
let totalCommandOutputs = 0;
|
|
11234
11331
|
logger.info("Generating command files...");
|
|
11235
|
-
const toolTargets = (0,
|
|
11332
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11236
11333
|
config.getTargets(),
|
|
11237
11334
|
CommandsProcessor.getToolTargets({
|
|
11238
11335
|
global: config.getGlobal(),
|
|
@@ -11266,7 +11363,7 @@ async function generateSubagents(config) {
|
|
|
11266
11363
|
}
|
|
11267
11364
|
let totalSubagentOutputs = 0;
|
|
11268
11365
|
logger.info("Generating subagent files...");
|
|
11269
|
-
const toolTargets = (0,
|
|
11366
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11270
11367
|
config.getTargets(),
|
|
11271
11368
|
SubagentsProcessor.getToolTargets({
|
|
11272
11369
|
global: config.getGlobal(),
|
|
@@ -11301,7 +11398,7 @@ async function generateSkills(config) {
|
|
|
11301
11398
|
let totalSkillOutputs = 0;
|
|
11302
11399
|
const allSkills = [];
|
|
11303
11400
|
logger.info("Generating skill files...");
|
|
11304
|
-
const toolTargets = (0,
|
|
11401
|
+
const toolTargets = (0, import_es_toolkit4.intersection)(
|
|
11305
11402
|
config.getTargets(),
|
|
11306
11403
|
SkillsProcessor.getToolTargets({
|
|
11307
11404
|
global: config.getGlobal(),
|
|
@@ -11335,7 +11432,7 @@ async function generateSkills(config) {
|
|
|
11335
11432
|
}
|
|
11336
11433
|
|
|
11337
11434
|
// src/cli/commands/gitignore.ts
|
|
11338
|
-
var
|
|
11435
|
+
var import_node_path92 = require("path");
|
|
11339
11436
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11340
11437
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11341
11438
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11466,7 +11563,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11466
11563
|
return result;
|
|
11467
11564
|
};
|
|
11468
11565
|
var gitignoreCommand = async () => {
|
|
11469
|
-
const gitignorePath = (0,
|
|
11566
|
+
const gitignorePath = (0, import_node_path92.join)(process.cwd(), ".gitignore");
|
|
11470
11567
|
let gitignoreContent = "";
|
|
11471
11568
|
if (await fileExists(gitignorePath)) {
|
|
11472
11569
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11665,7 +11762,7 @@ async function importSkills(config, tool) {
|
|
|
11665
11762
|
}
|
|
11666
11763
|
|
|
11667
11764
|
// src/cli/commands/init.ts
|
|
11668
|
-
var
|
|
11765
|
+
var import_node_path93 = require("path");
|
|
11669
11766
|
async function initCommand() {
|
|
11670
11767
|
logger.info("Initializing rulesync...");
|
|
11671
11768
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11828,14 +11925,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11828
11925
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11829
11926
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
11830
11927
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11831
|
-
const ruleFilepath = (0,
|
|
11928
|
+
const ruleFilepath = (0, import_node_path93.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11832
11929
|
if (!await fileExists(ruleFilepath)) {
|
|
11833
11930
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11834
11931
|
logger.success(`Created ${ruleFilepath}`);
|
|
11835
11932
|
} else {
|
|
11836
11933
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11837
11934
|
}
|
|
11838
|
-
const mcpFilepath = (0,
|
|
11935
|
+
const mcpFilepath = (0, import_node_path93.join)(
|
|
11839
11936
|
mcpPaths.recommended.relativeDirPath,
|
|
11840
11937
|
mcpPaths.recommended.relativeFilePath
|
|
11841
11938
|
);
|
|
@@ -11845,21 +11942,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11845
11942
|
} else {
|
|
11846
11943
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11847
11944
|
}
|
|
11848
|
-
const commandFilepath = (0,
|
|
11945
|
+
const commandFilepath = (0, import_node_path93.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11849
11946
|
if (!await fileExists(commandFilepath)) {
|
|
11850
11947
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11851
11948
|
logger.success(`Created ${commandFilepath}`);
|
|
11852
11949
|
} else {
|
|
11853
11950
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11854
11951
|
}
|
|
11855
|
-
const subagentFilepath = (0,
|
|
11952
|
+
const subagentFilepath = (0, import_node_path93.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11856
11953
|
if (!await fileExists(subagentFilepath)) {
|
|
11857
11954
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11858
11955
|
logger.success(`Created ${subagentFilepath}`);
|
|
11859
11956
|
} else {
|
|
11860
11957
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11861
11958
|
}
|
|
11862
|
-
const ignoreFilepath = (0,
|
|
11959
|
+
const ignoreFilepath = (0, import_node_path93.join)(
|
|
11863
11960
|
ignorePaths.recommended.relativeDirPath,
|
|
11864
11961
|
ignorePaths.recommended.relativeFilePath
|
|
11865
11962
|
);
|
|
@@ -11878,12 +11975,12 @@ var import_fastmcp = require("fastmcp");
|
|
|
11878
11975
|
var import_mini48 = require("zod/mini");
|
|
11879
11976
|
|
|
11880
11977
|
// src/mcp/commands.ts
|
|
11881
|
-
var
|
|
11978
|
+
var import_node_path94 = require("path");
|
|
11882
11979
|
var import_mini42 = require("zod/mini");
|
|
11883
11980
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11884
11981
|
var maxCommandsCount = 1e3;
|
|
11885
11982
|
async function listCommands() {
|
|
11886
|
-
const commandsDir = (0,
|
|
11983
|
+
const commandsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11887
11984
|
try {
|
|
11888
11985
|
const files = await listDirectoryFiles(commandsDir);
|
|
11889
11986
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11895,7 +11992,7 @@ async function listCommands() {
|
|
|
11895
11992
|
});
|
|
11896
11993
|
const frontmatter = command.getFrontmatter();
|
|
11897
11994
|
return {
|
|
11898
|
-
relativePathFromCwd: (0,
|
|
11995
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11899
11996
|
frontmatter
|
|
11900
11997
|
};
|
|
11901
11998
|
} catch (error) {
|
|
@@ -11915,13 +12012,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11915
12012
|
relativePath: relativePathFromCwd,
|
|
11916
12013
|
intendedRootDir: process.cwd()
|
|
11917
12014
|
});
|
|
11918
|
-
const filename = (0,
|
|
12015
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
11919
12016
|
try {
|
|
11920
12017
|
const command = await RulesyncCommand.fromFile({
|
|
11921
12018
|
relativeFilePath: filename
|
|
11922
12019
|
});
|
|
11923
12020
|
return {
|
|
11924
|
-
relativePathFromCwd: (0,
|
|
12021
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11925
12022
|
frontmatter: command.getFrontmatter(),
|
|
11926
12023
|
body: command.getBody()
|
|
11927
12024
|
};
|
|
@@ -11940,7 +12037,7 @@ async function putCommand({
|
|
|
11940
12037
|
relativePath: relativePathFromCwd,
|
|
11941
12038
|
intendedRootDir: process.cwd()
|
|
11942
12039
|
});
|
|
11943
|
-
const filename = (0,
|
|
12040
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
11944
12041
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11945
12042
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
11946
12043
|
throw new Error(
|
|
@@ -11950,7 +12047,7 @@ async function putCommand({
|
|
|
11950
12047
|
try {
|
|
11951
12048
|
const existingCommands = await listCommands();
|
|
11952
12049
|
const isUpdate = existingCommands.some(
|
|
11953
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12050
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11954
12051
|
);
|
|
11955
12052
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
11956
12053
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -11965,11 +12062,11 @@ async function putCommand({
|
|
|
11965
12062
|
fileContent,
|
|
11966
12063
|
validate: true
|
|
11967
12064
|
});
|
|
11968
|
-
const commandsDir = (0,
|
|
12065
|
+
const commandsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11969
12066
|
await ensureDir(commandsDir);
|
|
11970
12067
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
11971
12068
|
return {
|
|
11972
|
-
relativePathFromCwd: (0,
|
|
12069
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11973
12070
|
frontmatter: command.getFrontmatter(),
|
|
11974
12071
|
body: command.getBody()
|
|
11975
12072
|
};
|
|
@@ -11984,12 +12081,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11984
12081
|
relativePath: relativePathFromCwd,
|
|
11985
12082
|
intendedRootDir: process.cwd()
|
|
11986
12083
|
});
|
|
11987
|
-
const filename = (0,
|
|
11988
|
-
const fullPath = (0,
|
|
12084
|
+
const filename = (0, import_node_path94.basename)(relativePathFromCwd);
|
|
12085
|
+
const fullPath = (0, import_node_path94.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
11989
12086
|
try {
|
|
11990
12087
|
await removeFile(fullPath);
|
|
11991
12088
|
return {
|
|
11992
|
-
relativePathFromCwd: (0,
|
|
12089
|
+
relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11993
12090
|
};
|
|
11994
12091
|
} catch (error) {
|
|
11995
12092
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12014,7 +12111,7 @@ var commandToolSchemas = {
|
|
|
12014
12111
|
var commandTools = {
|
|
12015
12112
|
listCommands: {
|
|
12016
12113
|
name: "listCommands",
|
|
12017
|
-
description: `List all commands from ${(0,
|
|
12114
|
+
description: `List all commands from ${(0, import_node_path94.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12018
12115
|
parameters: commandToolSchemas.listCommands,
|
|
12019
12116
|
execute: async () => {
|
|
12020
12117
|
const commands = await listCommands();
|
|
@@ -12056,11 +12153,11 @@ var commandTools = {
|
|
|
12056
12153
|
};
|
|
12057
12154
|
|
|
12058
12155
|
// src/mcp/ignore.ts
|
|
12059
|
-
var
|
|
12156
|
+
var import_node_path95 = require("path");
|
|
12060
12157
|
var import_mini43 = require("zod/mini");
|
|
12061
12158
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12062
12159
|
async function getIgnoreFile() {
|
|
12063
|
-
const ignoreFilePath = (0,
|
|
12160
|
+
const ignoreFilePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12064
12161
|
try {
|
|
12065
12162
|
const content = await readFileContent(ignoreFilePath);
|
|
12066
12163
|
return {
|
|
@@ -12074,7 +12171,7 @@ async function getIgnoreFile() {
|
|
|
12074
12171
|
}
|
|
12075
12172
|
}
|
|
12076
12173
|
async function putIgnoreFile({ content }) {
|
|
12077
|
-
const ignoreFilePath = (0,
|
|
12174
|
+
const ignoreFilePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12078
12175
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12079
12176
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12080
12177
|
throw new Error(
|
|
@@ -12095,8 +12192,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12095
12192
|
}
|
|
12096
12193
|
}
|
|
12097
12194
|
async function deleteIgnoreFile() {
|
|
12098
|
-
const aiignorePath = (0,
|
|
12099
|
-
const legacyIgnorePath = (0,
|
|
12195
|
+
const aiignorePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12196
|
+
const legacyIgnorePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12100
12197
|
try {
|
|
12101
12198
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12102
12199
|
return {
|
|
@@ -12151,7 +12248,7 @@ var ignoreTools = {
|
|
|
12151
12248
|
};
|
|
12152
12249
|
|
|
12153
12250
|
// src/mcp/mcp.ts
|
|
12154
|
-
var
|
|
12251
|
+
var import_node_path96 = require("path");
|
|
12155
12252
|
var import_mini44 = require("zod/mini");
|
|
12156
12253
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12157
12254
|
async function getMcpFile() {
|
|
@@ -12161,7 +12258,7 @@ async function getMcpFile() {
|
|
|
12161
12258
|
validate: true,
|
|
12162
12259
|
modularMcp: config.getModularMcp()
|
|
12163
12260
|
});
|
|
12164
|
-
const relativePathFromCwd = (0,
|
|
12261
|
+
const relativePathFromCwd = (0, import_node_path96.join)(
|
|
12165
12262
|
rulesyncMcp.getRelativeDirPath(),
|
|
12166
12263
|
rulesyncMcp.getRelativeFilePath()
|
|
12167
12264
|
);
|
|
@@ -12194,7 +12291,7 @@ async function putMcpFile({ content }) {
|
|
|
12194
12291
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12195
12292
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12196
12293
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12197
|
-
const fullPath = (0,
|
|
12294
|
+
const fullPath = (0, import_node_path96.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12198
12295
|
const rulesyncMcp = new RulesyncMcp({
|
|
12199
12296
|
baseDir,
|
|
12200
12297
|
relativeDirPath,
|
|
@@ -12203,9 +12300,9 @@ async function putMcpFile({ content }) {
|
|
|
12203
12300
|
validate: true,
|
|
12204
12301
|
modularMcp: config.getModularMcp()
|
|
12205
12302
|
});
|
|
12206
|
-
await ensureDir((0,
|
|
12303
|
+
await ensureDir((0, import_node_path96.join)(baseDir, relativeDirPath));
|
|
12207
12304
|
await writeFileContent(fullPath, content);
|
|
12208
|
-
const relativePathFromCwd = (0,
|
|
12305
|
+
const relativePathFromCwd = (0, import_node_path96.join)(relativeDirPath, relativeFilePath);
|
|
12209
12306
|
return {
|
|
12210
12307
|
relativePathFromCwd,
|
|
12211
12308
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12220,15 +12317,15 @@ async function deleteMcpFile() {
|
|
|
12220
12317
|
try {
|
|
12221
12318
|
const baseDir = process.cwd();
|
|
12222
12319
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12223
|
-
const recommendedPath = (0,
|
|
12320
|
+
const recommendedPath = (0, import_node_path96.join)(
|
|
12224
12321
|
baseDir,
|
|
12225
12322
|
paths.recommended.relativeDirPath,
|
|
12226
12323
|
paths.recommended.relativeFilePath
|
|
12227
12324
|
);
|
|
12228
|
-
const legacyPath = (0,
|
|
12325
|
+
const legacyPath = (0, import_node_path96.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12229
12326
|
await removeFile(recommendedPath);
|
|
12230
12327
|
await removeFile(legacyPath);
|
|
12231
|
-
const relativePathFromCwd = (0,
|
|
12328
|
+
const relativePathFromCwd = (0, import_node_path96.join)(
|
|
12232
12329
|
paths.recommended.relativeDirPath,
|
|
12233
12330
|
paths.recommended.relativeFilePath
|
|
12234
12331
|
);
|
|
@@ -12279,12 +12376,12 @@ var mcpTools = {
|
|
|
12279
12376
|
};
|
|
12280
12377
|
|
|
12281
12378
|
// src/mcp/rules.ts
|
|
12282
|
-
var
|
|
12379
|
+
var import_node_path97 = require("path");
|
|
12283
12380
|
var import_mini45 = require("zod/mini");
|
|
12284
12381
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12285
12382
|
var maxRulesCount = 1e3;
|
|
12286
12383
|
async function listRules() {
|
|
12287
|
-
const rulesDir = (0,
|
|
12384
|
+
const rulesDir = (0, import_node_path97.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12288
12385
|
try {
|
|
12289
12386
|
const files = await listDirectoryFiles(rulesDir);
|
|
12290
12387
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12297,7 +12394,7 @@ async function listRules() {
|
|
|
12297
12394
|
});
|
|
12298
12395
|
const frontmatter = rule.getFrontmatter();
|
|
12299
12396
|
return {
|
|
12300
|
-
relativePathFromCwd: (0,
|
|
12397
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12301
12398
|
frontmatter
|
|
12302
12399
|
};
|
|
12303
12400
|
} catch (error) {
|
|
@@ -12317,14 +12414,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12317
12414
|
relativePath: relativePathFromCwd,
|
|
12318
12415
|
intendedRootDir: process.cwd()
|
|
12319
12416
|
});
|
|
12320
|
-
const filename = (0,
|
|
12417
|
+
const filename = (0, import_node_path97.basename)(relativePathFromCwd);
|
|
12321
12418
|
try {
|
|
12322
12419
|
const rule = await RulesyncRule.fromFile({
|
|
12323
12420
|
relativeFilePath: filename,
|
|
12324
12421
|
validate: true
|
|
12325
12422
|
});
|
|
12326
12423
|
return {
|
|
12327
|
-
relativePathFromCwd: (0,
|
|
12424
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12328
12425
|
frontmatter: rule.getFrontmatter(),
|
|
12329
12426
|
body: rule.getBody()
|
|
12330
12427
|
};
|
|
@@ -12343,7 +12440,7 @@ async function putRule({
|
|
|
12343
12440
|
relativePath: relativePathFromCwd,
|
|
12344
12441
|
intendedRootDir: process.cwd()
|
|
12345
12442
|
});
|
|
12346
|
-
const filename = (0,
|
|
12443
|
+
const filename = (0, import_node_path97.basename)(relativePathFromCwd);
|
|
12347
12444
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12348
12445
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12349
12446
|
throw new Error(
|
|
@@ -12353,7 +12450,7 @@ async function putRule({
|
|
|
12353
12450
|
try {
|
|
12354
12451
|
const existingRules = await listRules();
|
|
12355
12452
|
const isUpdate = existingRules.some(
|
|
12356
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
12453
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12357
12454
|
);
|
|
12358
12455
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12359
12456
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12366,11 +12463,11 @@ async function putRule({
|
|
|
12366
12463
|
body,
|
|
12367
12464
|
validate: true
|
|
12368
12465
|
});
|
|
12369
|
-
const rulesDir = (0,
|
|
12466
|
+
const rulesDir = (0, import_node_path97.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12370
12467
|
await ensureDir(rulesDir);
|
|
12371
12468
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12372
12469
|
return {
|
|
12373
|
-
relativePathFromCwd: (0,
|
|
12470
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12374
12471
|
frontmatter: rule.getFrontmatter(),
|
|
12375
12472
|
body: rule.getBody()
|
|
12376
12473
|
};
|
|
@@ -12385,12 +12482,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12385
12482
|
relativePath: relativePathFromCwd,
|
|
12386
12483
|
intendedRootDir: process.cwd()
|
|
12387
12484
|
});
|
|
12388
|
-
const filename = (0,
|
|
12389
|
-
const fullPath = (0,
|
|
12485
|
+
const filename = (0, import_node_path97.basename)(relativePathFromCwd);
|
|
12486
|
+
const fullPath = (0, import_node_path97.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12390
12487
|
try {
|
|
12391
12488
|
await removeFile(fullPath);
|
|
12392
12489
|
return {
|
|
12393
|
-
relativePathFromCwd: (0,
|
|
12490
|
+
relativePathFromCwd: (0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12394
12491
|
};
|
|
12395
12492
|
} catch (error) {
|
|
12396
12493
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12415,7 +12512,7 @@ var ruleToolSchemas = {
|
|
|
12415
12512
|
var ruleTools = {
|
|
12416
12513
|
listRules: {
|
|
12417
12514
|
name: "listRules",
|
|
12418
|
-
description: `List all rules from ${(0,
|
|
12515
|
+
description: `List all rules from ${(0, import_node_path97.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12419
12516
|
parameters: ruleToolSchemas.listRules,
|
|
12420
12517
|
execute: async () => {
|
|
12421
12518
|
const rules = await listRules();
|
|
@@ -12457,7 +12554,7 @@ var ruleTools = {
|
|
|
12457
12554
|
};
|
|
12458
12555
|
|
|
12459
12556
|
// src/mcp/skills.ts
|
|
12460
|
-
var
|
|
12557
|
+
var import_node_path98 = require("path");
|
|
12461
12558
|
var import_mini46 = require("zod/mini");
|
|
12462
12559
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12463
12560
|
var maxSkillsCount = 1e3;
|
|
@@ -12474,19 +12571,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
12474
12571
|
};
|
|
12475
12572
|
}
|
|
12476
12573
|
function extractDirName(relativeDirPathFromCwd) {
|
|
12477
|
-
const dirName = (0,
|
|
12574
|
+
const dirName = (0, import_node_path98.basename)(relativeDirPathFromCwd);
|
|
12478
12575
|
if (!dirName) {
|
|
12479
12576
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
12480
12577
|
}
|
|
12481
12578
|
return dirName;
|
|
12482
12579
|
}
|
|
12483
12580
|
async function listSkills() {
|
|
12484
|
-
const skillsDir = (0,
|
|
12581
|
+
const skillsDir = (0, import_node_path98.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12485
12582
|
try {
|
|
12486
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
12583
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path98.join)(skillsDir, "*"), { type: "dir" });
|
|
12487
12584
|
const skills = await Promise.all(
|
|
12488
12585
|
skillDirPaths.map(async (dirPath) => {
|
|
12489
|
-
const dirName = (0,
|
|
12586
|
+
const dirName = (0, import_node_path98.basename)(dirPath);
|
|
12490
12587
|
if (!dirName) return null;
|
|
12491
12588
|
try {
|
|
12492
12589
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -12494,7 +12591,7 @@ async function listSkills() {
|
|
|
12494
12591
|
});
|
|
12495
12592
|
const frontmatter = skill.getFrontmatter();
|
|
12496
12593
|
return {
|
|
12497
|
-
relativeDirPathFromCwd: (0,
|
|
12594
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12498
12595
|
frontmatter
|
|
12499
12596
|
};
|
|
12500
12597
|
} catch (error) {
|
|
@@ -12520,7 +12617,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12520
12617
|
dirName
|
|
12521
12618
|
});
|
|
12522
12619
|
return {
|
|
12523
|
-
relativeDirPathFromCwd: (0,
|
|
12620
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12524
12621
|
frontmatter: skill.getFrontmatter(),
|
|
12525
12622
|
body: skill.getBody(),
|
|
12526
12623
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12554,7 +12651,7 @@ async function putSkill({
|
|
|
12554
12651
|
try {
|
|
12555
12652
|
const existingSkills = await listSkills();
|
|
12556
12653
|
const isUpdate = existingSkills.some(
|
|
12557
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
12654
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12558
12655
|
);
|
|
12559
12656
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12560
12657
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12569,9 +12666,9 @@ async function putSkill({
|
|
|
12569
12666
|
otherFiles: aiDirFiles,
|
|
12570
12667
|
validate: true
|
|
12571
12668
|
});
|
|
12572
|
-
const skillDirPath = (0,
|
|
12669
|
+
const skillDirPath = (0, import_node_path98.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12573
12670
|
await ensureDir(skillDirPath);
|
|
12574
|
-
const skillFilePath = (0,
|
|
12671
|
+
const skillFilePath = (0, import_node_path98.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12575
12672
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12576
12673
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12577
12674
|
for (const file of otherFiles) {
|
|
@@ -12579,15 +12676,15 @@ async function putSkill({
|
|
|
12579
12676
|
relativePath: file.name,
|
|
12580
12677
|
intendedRootDir: skillDirPath
|
|
12581
12678
|
});
|
|
12582
|
-
const filePath = (0,
|
|
12583
|
-
const fileDir = (0,
|
|
12679
|
+
const filePath = (0, import_node_path98.join)(skillDirPath, file.name);
|
|
12680
|
+
const fileDir = (0, import_node_path98.join)(skillDirPath, (0, import_node_path98.dirname)(file.name));
|
|
12584
12681
|
if (fileDir !== skillDirPath) {
|
|
12585
12682
|
await ensureDir(fileDir);
|
|
12586
12683
|
}
|
|
12587
12684
|
await writeFileContent(filePath, file.body);
|
|
12588
12685
|
}
|
|
12589
12686
|
return {
|
|
12590
|
-
relativeDirPathFromCwd: (0,
|
|
12687
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12591
12688
|
frontmatter: skill.getFrontmatter(),
|
|
12592
12689
|
body: skill.getBody(),
|
|
12593
12690
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12609,13 +12706,13 @@ async function deleteSkill({
|
|
|
12609
12706
|
intendedRootDir: process.cwd()
|
|
12610
12707
|
});
|
|
12611
12708
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12612
|
-
const skillDirPath = (0,
|
|
12709
|
+
const skillDirPath = (0, import_node_path98.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12613
12710
|
try {
|
|
12614
12711
|
if (await directoryExists(skillDirPath)) {
|
|
12615
12712
|
await removeDirectory(skillDirPath);
|
|
12616
12713
|
}
|
|
12617
12714
|
return {
|
|
12618
|
-
relativeDirPathFromCwd: (0,
|
|
12715
|
+
relativeDirPathFromCwd: (0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12619
12716
|
};
|
|
12620
12717
|
} catch (error) {
|
|
12621
12718
|
throw new Error(
|
|
@@ -12648,7 +12745,7 @@ var skillToolSchemas = {
|
|
|
12648
12745
|
var skillTools = {
|
|
12649
12746
|
listSkills: {
|
|
12650
12747
|
name: "listSkills",
|
|
12651
|
-
description: `List all skills from ${(0,
|
|
12748
|
+
description: `List all skills from ${(0, import_node_path98.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12652
12749
|
parameters: skillToolSchemas.listSkills,
|
|
12653
12750
|
execute: async () => {
|
|
12654
12751
|
const skills = await listSkills();
|
|
@@ -12691,12 +12788,12 @@ var skillTools = {
|
|
|
12691
12788
|
};
|
|
12692
12789
|
|
|
12693
12790
|
// src/mcp/subagents.ts
|
|
12694
|
-
var
|
|
12791
|
+
var import_node_path99 = require("path");
|
|
12695
12792
|
var import_mini47 = require("zod/mini");
|
|
12696
12793
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12697
12794
|
var maxSubagentsCount = 1e3;
|
|
12698
12795
|
async function listSubagents() {
|
|
12699
|
-
const subagentsDir = (0,
|
|
12796
|
+
const subagentsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12700
12797
|
try {
|
|
12701
12798
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12702
12799
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12709,7 +12806,7 @@ async function listSubagents() {
|
|
|
12709
12806
|
});
|
|
12710
12807
|
const frontmatter = subagent.getFrontmatter();
|
|
12711
12808
|
return {
|
|
12712
|
-
relativePathFromCwd: (0,
|
|
12809
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12713
12810
|
frontmatter
|
|
12714
12811
|
};
|
|
12715
12812
|
} catch (error) {
|
|
@@ -12731,14 +12828,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12731
12828
|
relativePath: relativePathFromCwd,
|
|
12732
12829
|
intendedRootDir: process.cwd()
|
|
12733
12830
|
});
|
|
12734
|
-
const filename = (0,
|
|
12831
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12735
12832
|
try {
|
|
12736
12833
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12737
12834
|
relativeFilePath: filename,
|
|
12738
12835
|
validate: true
|
|
12739
12836
|
});
|
|
12740
12837
|
return {
|
|
12741
|
-
relativePathFromCwd: (0,
|
|
12838
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12742
12839
|
frontmatter: subagent.getFrontmatter(),
|
|
12743
12840
|
body: subagent.getBody()
|
|
12744
12841
|
};
|
|
@@ -12757,7 +12854,7 @@ async function putSubagent({
|
|
|
12757
12854
|
relativePath: relativePathFromCwd,
|
|
12758
12855
|
intendedRootDir: process.cwd()
|
|
12759
12856
|
});
|
|
12760
|
-
const filename = (0,
|
|
12857
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12761
12858
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12762
12859
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12763
12860
|
throw new Error(
|
|
@@ -12767,7 +12864,7 @@ async function putSubagent({
|
|
|
12767
12864
|
try {
|
|
12768
12865
|
const existingSubagents = await listSubagents();
|
|
12769
12866
|
const isUpdate = existingSubagents.some(
|
|
12770
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
12867
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12771
12868
|
);
|
|
12772
12869
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12773
12870
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12780,11 +12877,11 @@ async function putSubagent({
|
|
|
12780
12877
|
body,
|
|
12781
12878
|
validate: true
|
|
12782
12879
|
});
|
|
12783
|
-
const subagentsDir = (0,
|
|
12880
|
+
const subagentsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12784
12881
|
await ensureDir(subagentsDir);
|
|
12785
12882
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12786
12883
|
return {
|
|
12787
|
-
relativePathFromCwd: (0,
|
|
12884
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12788
12885
|
frontmatter: subagent.getFrontmatter(),
|
|
12789
12886
|
body: subagent.getBody()
|
|
12790
12887
|
};
|
|
@@ -12799,12 +12896,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12799
12896
|
relativePath: relativePathFromCwd,
|
|
12800
12897
|
intendedRootDir: process.cwd()
|
|
12801
12898
|
});
|
|
12802
|
-
const filename = (0,
|
|
12803
|
-
const fullPath = (0,
|
|
12899
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12900
|
+
const fullPath = (0, import_node_path99.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12804
12901
|
try {
|
|
12805
12902
|
await removeFile(fullPath);
|
|
12806
12903
|
return {
|
|
12807
|
-
relativePathFromCwd: (0,
|
|
12904
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12808
12905
|
};
|
|
12809
12906
|
} catch (error) {
|
|
12810
12907
|
throw new Error(
|
|
@@ -12832,7 +12929,7 @@ var subagentToolSchemas = {
|
|
|
12832
12929
|
var subagentTools = {
|
|
12833
12930
|
listSubagents: {
|
|
12834
12931
|
name: "listSubagents",
|
|
12835
|
-
description: `List all subagents from ${(0,
|
|
12932
|
+
description: `List all subagents from ${(0, import_node_path99.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12836
12933
|
parameters: subagentToolSchemas.listSubagents,
|
|
12837
12934
|
execute: async () => {
|
|
12838
12935
|
const subagents = await listSubagents();
|
|
@@ -13083,7 +13180,7 @@ async function mcpCommand({ version }) {
|
|
|
13083
13180
|
}
|
|
13084
13181
|
|
|
13085
13182
|
// src/cli/index.ts
|
|
13086
|
-
var getVersion = () => "5.
|
|
13183
|
+
var getVersion = () => "5.2.0";
|
|
13087
13184
|
var main = async () => {
|
|
13088
13185
|
const program = new import_commander.Command();
|
|
13089
13186
|
const version = getVersion();
|