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.js
CHANGED
|
@@ -250,7 +250,8 @@ var ALL_TOOL_TARGETS = [
|
|
|
250
250
|
"qwencode",
|
|
251
251
|
"roo",
|
|
252
252
|
"warp",
|
|
253
|
-
"windsurf"
|
|
253
|
+
"windsurf",
|
|
254
|
+
"zed"
|
|
254
255
|
];
|
|
255
256
|
var ALL_TOOL_TARGETS_WITH_WILDCARD = [...ALL_TOOL_TARGETS, "*"];
|
|
256
257
|
var ToolTargetSchema = z2.enum(ALL_TOOL_TARGETS);
|
|
@@ -3236,6 +3237,100 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3236
3237
|
}
|
|
3237
3238
|
};
|
|
3238
3239
|
|
|
3240
|
+
// src/features/ignore/zed-ignore.ts
|
|
3241
|
+
import { join as join29 } from "path";
|
|
3242
|
+
import { uniq as uniq2 } from "es-toolkit";
|
|
3243
|
+
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
3244
|
+
constructor(params) {
|
|
3245
|
+
super(params);
|
|
3246
|
+
const jsonValue = JSON.parse(this.fileContent);
|
|
3247
|
+
this.patterns = jsonValue.private_files ?? [];
|
|
3248
|
+
}
|
|
3249
|
+
static getSettablePaths() {
|
|
3250
|
+
return {
|
|
3251
|
+
relativeDirPath: ".zed",
|
|
3252
|
+
relativeFilePath: "settings.json"
|
|
3253
|
+
};
|
|
3254
|
+
}
|
|
3255
|
+
/**
|
|
3256
|
+
* ZedIgnore uses settings.json which is a user-managed config file.
|
|
3257
|
+
* It should not be deleted by rulesync.
|
|
3258
|
+
*/
|
|
3259
|
+
isDeletable() {
|
|
3260
|
+
return false;
|
|
3261
|
+
}
|
|
3262
|
+
toRulesyncIgnore() {
|
|
3263
|
+
const rulesyncPatterns = this.patterns.filter((pattern) => pattern.length > 0);
|
|
3264
|
+
const fileContent = rulesyncPatterns.join("\n");
|
|
3265
|
+
return new RulesyncIgnore({
|
|
3266
|
+
baseDir: this.baseDir,
|
|
3267
|
+
relativeDirPath: RulesyncIgnore.getSettablePaths().recommended.relativeDirPath,
|
|
3268
|
+
relativeFilePath: RulesyncIgnore.getSettablePaths().recommended.relativeFilePath,
|
|
3269
|
+
fileContent
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
static async fromRulesyncIgnore({
|
|
3273
|
+
baseDir = process.cwd(),
|
|
3274
|
+
rulesyncIgnore
|
|
3275
|
+
}) {
|
|
3276
|
+
const fileContent = rulesyncIgnore.getFileContent();
|
|
3277
|
+
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
3278
|
+
const filePath = join29(
|
|
3279
|
+
baseDir,
|
|
3280
|
+
this.getSettablePaths().relativeDirPath,
|
|
3281
|
+
this.getSettablePaths().relativeFilePath
|
|
3282
|
+
);
|
|
3283
|
+
const exists = await fileExists(filePath);
|
|
3284
|
+
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
3285
|
+
const existingJsonValue = JSON.parse(existingFileContent);
|
|
3286
|
+
const existingPrivateFiles = existingJsonValue.private_files ?? [];
|
|
3287
|
+
const mergedPatterns = uniq2([...existingPrivateFiles, ...patterns].toSorted());
|
|
3288
|
+
const jsonValue = {
|
|
3289
|
+
...existingJsonValue,
|
|
3290
|
+
private_files: mergedPatterns
|
|
3291
|
+
};
|
|
3292
|
+
return new _ZedIgnore({
|
|
3293
|
+
baseDir,
|
|
3294
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3295
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3296
|
+
fileContent: JSON.stringify(jsonValue, null, 2),
|
|
3297
|
+
validate: true
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3300
|
+
static async fromFile({
|
|
3301
|
+
baseDir = process.cwd(),
|
|
3302
|
+
validate = true
|
|
3303
|
+
}) {
|
|
3304
|
+
const fileContent = await readFileContent(
|
|
3305
|
+
join29(
|
|
3306
|
+
baseDir,
|
|
3307
|
+
this.getSettablePaths().relativeDirPath,
|
|
3308
|
+
this.getSettablePaths().relativeFilePath
|
|
3309
|
+
)
|
|
3310
|
+
);
|
|
3311
|
+
return new _ZedIgnore({
|
|
3312
|
+
baseDir,
|
|
3313
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3314
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3315
|
+
fileContent,
|
|
3316
|
+
validate
|
|
3317
|
+
});
|
|
3318
|
+
}
|
|
3319
|
+
static forDeletion({
|
|
3320
|
+
baseDir = process.cwd(),
|
|
3321
|
+
relativeDirPath,
|
|
3322
|
+
relativeFilePath
|
|
3323
|
+
}) {
|
|
3324
|
+
return new _ZedIgnore({
|
|
3325
|
+
baseDir,
|
|
3326
|
+
relativeDirPath,
|
|
3327
|
+
relativeFilePath,
|
|
3328
|
+
fileContent: "{}",
|
|
3329
|
+
validate: false
|
|
3330
|
+
});
|
|
3331
|
+
}
|
|
3332
|
+
};
|
|
3333
|
+
|
|
3239
3334
|
// src/features/ignore/ignore-processor.ts
|
|
3240
3335
|
var ignoreProcessorToolTargets = [
|
|
3241
3336
|
"augmentcode",
|
|
@@ -3249,7 +3344,8 @@ var ignoreProcessorToolTargets = [
|
|
|
3249
3344
|
"kiro",
|
|
3250
3345
|
"qwencode",
|
|
3251
3346
|
"roo",
|
|
3252
|
-
"windsurf"
|
|
3347
|
+
"windsurf",
|
|
3348
|
+
"zed"
|
|
3253
3349
|
];
|
|
3254
3350
|
var IgnoreProcessorToolTargetSchema = z13.enum(ignoreProcessorToolTargets);
|
|
3255
3351
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
@@ -3264,7 +3360,8 @@ var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
|
3264
3360
|
["kiro", { class: KiroIgnore }],
|
|
3265
3361
|
["qwencode", { class: QwencodeIgnore }],
|
|
3266
3362
|
["roo", { class: RooIgnore }],
|
|
3267
|
-
["windsurf", { class: WindsurfIgnore }]
|
|
3363
|
+
["windsurf", { class: WindsurfIgnore }],
|
|
3364
|
+
["zed", { class: ZedIgnore }]
|
|
3268
3365
|
]);
|
|
3269
3366
|
var defaultGetFactory2 = (target) => {
|
|
3270
3367
|
const factory = toolIgnoreFactories.get(target);
|
|
@@ -3387,10 +3484,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3387
3484
|
import { z as z18 } from "zod/mini";
|
|
3388
3485
|
|
|
3389
3486
|
// src/features/mcp/claudecode-mcp.ts
|
|
3390
|
-
import { join as
|
|
3487
|
+
import { join as join32 } from "path";
|
|
3391
3488
|
|
|
3392
3489
|
// src/features/mcp/modular-mcp.ts
|
|
3393
|
-
import { join as
|
|
3490
|
+
import { join as join30 } from "path";
|
|
3394
3491
|
import { z as z15 } from "zod/mini";
|
|
3395
3492
|
|
|
3396
3493
|
// src/types/mcp.ts
|
|
@@ -3478,7 +3575,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3478
3575
|
args: [
|
|
3479
3576
|
"-y",
|
|
3480
3577
|
"@kimuson/modular-mcp",
|
|
3481
|
-
|
|
3578
|
+
join30(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3482
3579
|
],
|
|
3483
3580
|
env: {}
|
|
3484
3581
|
}
|
|
@@ -3515,7 +3612,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3515
3612
|
};
|
|
3516
3613
|
|
|
3517
3614
|
// src/features/mcp/rulesync-mcp.ts
|
|
3518
|
-
import { join as
|
|
3615
|
+
import { join as join31 } from "path";
|
|
3519
3616
|
import { omit } from "es-toolkit/object";
|
|
3520
3617
|
import { z as z16 } from "zod/mini";
|
|
3521
3618
|
var RulesyncMcpServerSchema = z16.union([
|
|
@@ -3572,12 +3669,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3572
3669
|
}) {
|
|
3573
3670
|
const baseDir = process.cwd();
|
|
3574
3671
|
const paths = this.getSettablePaths();
|
|
3575
|
-
const recommendedPath =
|
|
3672
|
+
const recommendedPath = join31(
|
|
3576
3673
|
baseDir,
|
|
3577
3674
|
paths.recommended.relativeDirPath,
|
|
3578
3675
|
paths.recommended.relativeFilePath
|
|
3579
3676
|
);
|
|
3580
|
-
const legacyPath =
|
|
3677
|
+
const legacyPath = join31(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3581
3678
|
if (await fileExists(recommendedPath)) {
|
|
3582
3679
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3583
3680
|
return new _RulesyncMcp({
|
|
@@ -3721,7 +3818,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3721
3818
|
}) {
|
|
3722
3819
|
const paths = this.getSettablePaths({ global });
|
|
3723
3820
|
const fileContent = await readOrInitializeFileContent(
|
|
3724
|
-
|
|
3821
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3725
3822
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3726
3823
|
);
|
|
3727
3824
|
const json = JSON.parse(fileContent);
|
|
@@ -3743,7 +3840,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3743
3840
|
}) {
|
|
3744
3841
|
const paths = this.getSettablePaths({ global });
|
|
3745
3842
|
const fileContent = await readOrInitializeFileContent(
|
|
3746
|
-
|
|
3843
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3747
3844
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3748
3845
|
);
|
|
3749
3846
|
const json = JSON.parse(fileContent);
|
|
@@ -3791,7 +3888,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3791
3888
|
};
|
|
3792
3889
|
|
|
3793
3890
|
// src/features/mcp/cline-mcp.ts
|
|
3794
|
-
import { join as
|
|
3891
|
+
import { join as join33 } from "path";
|
|
3795
3892
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3796
3893
|
json;
|
|
3797
3894
|
constructor(params) {
|
|
@@ -3812,7 +3909,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3812
3909
|
validate = true
|
|
3813
3910
|
}) {
|
|
3814
3911
|
const fileContent = await readFileContent(
|
|
3815
|
-
|
|
3912
|
+
join33(
|
|
3816
3913
|
baseDir,
|
|
3817
3914
|
this.getSettablePaths().relativeDirPath,
|
|
3818
3915
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3861,7 +3958,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3861
3958
|
};
|
|
3862
3959
|
|
|
3863
3960
|
// src/features/mcp/codexcli-mcp.ts
|
|
3864
|
-
import { join as
|
|
3961
|
+
import { join as join34 } from "path";
|
|
3865
3962
|
import * as smolToml from "smol-toml";
|
|
3866
3963
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3867
3964
|
toml;
|
|
@@ -3897,7 +3994,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3897
3994
|
}) {
|
|
3898
3995
|
const paths = this.getSettablePaths({ global });
|
|
3899
3996
|
const fileContent = await readFileContent(
|
|
3900
|
-
|
|
3997
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3901
3998
|
);
|
|
3902
3999
|
return new _CodexcliMcp({
|
|
3903
4000
|
baseDir,
|
|
@@ -3914,7 +4011,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3914
4011
|
global = false
|
|
3915
4012
|
}) {
|
|
3916
4013
|
const paths = this.getSettablePaths({ global });
|
|
3917
|
-
const configTomlFilePath =
|
|
4014
|
+
const configTomlFilePath = join34(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3918
4015
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3919
4016
|
configTomlFilePath,
|
|
3920
4017
|
smolToml.stringify({})
|
|
@@ -3968,7 +4065,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3968
4065
|
};
|
|
3969
4066
|
|
|
3970
4067
|
// src/features/mcp/copilot-mcp.ts
|
|
3971
|
-
import { join as
|
|
4068
|
+
import { join as join35 } from "path";
|
|
3972
4069
|
function convertToCopilotFormat(mcpServers) {
|
|
3973
4070
|
return { servers: mcpServers };
|
|
3974
4071
|
}
|
|
@@ -3995,7 +4092,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3995
4092
|
validate = true
|
|
3996
4093
|
}) {
|
|
3997
4094
|
const fileContent = await readFileContent(
|
|
3998
|
-
|
|
4095
|
+
join35(
|
|
3999
4096
|
baseDir,
|
|
4000
4097
|
this.getSettablePaths().relativeDirPath,
|
|
4001
4098
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4048,7 +4145,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
4048
4145
|
};
|
|
4049
4146
|
|
|
4050
4147
|
// src/features/mcp/cursor-mcp.ts
|
|
4051
|
-
import { join as
|
|
4148
|
+
import { join as join36 } from "path";
|
|
4052
4149
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
4053
4150
|
json;
|
|
4054
4151
|
constructor(params) {
|
|
@@ -4069,7 +4166,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4069
4166
|
validate = true
|
|
4070
4167
|
}) {
|
|
4071
4168
|
const fileContent = await readFileContent(
|
|
4072
|
-
|
|
4169
|
+
join36(
|
|
4073
4170
|
baseDir,
|
|
4074
4171
|
this.getSettablePaths().relativeDirPath,
|
|
4075
4172
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4129,7 +4226,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4129
4226
|
};
|
|
4130
4227
|
|
|
4131
4228
|
// src/features/mcp/geminicli-mcp.ts
|
|
4132
|
-
import { join as
|
|
4229
|
+
import { join as join37 } from "path";
|
|
4133
4230
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4134
4231
|
json;
|
|
4135
4232
|
constructor(params) {
|
|
@@ -4158,7 +4255,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4158
4255
|
}) {
|
|
4159
4256
|
const paths = this.getSettablePaths({ global });
|
|
4160
4257
|
const fileContent = await readOrInitializeFileContent(
|
|
4161
|
-
|
|
4258
|
+
join37(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4162
4259
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4163
4260
|
);
|
|
4164
4261
|
const json = JSON.parse(fileContent);
|
|
@@ -4179,7 +4276,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4179
4276
|
}) {
|
|
4180
4277
|
const paths = this.getSettablePaths({ global });
|
|
4181
4278
|
const fileContent = await readOrInitializeFileContent(
|
|
4182
|
-
|
|
4279
|
+
join37(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4183
4280
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4184
4281
|
);
|
|
4185
4282
|
const json = JSON.parse(fileContent);
|
|
@@ -4216,7 +4313,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4216
4313
|
};
|
|
4217
4314
|
|
|
4218
4315
|
// src/features/mcp/junie-mcp.ts
|
|
4219
|
-
import { join as
|
|
4316
|
+
import { join as join38 } from "path";
|
|
4220
4317
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4221
4318
|
json;
|
|
4222
4319
|
constructor(params) {
|
|
@@ -4228,7 +4325,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4228
4325
|
}
|
|
4229
4326
|
static getSettablePaths() {
|
|
4230
4327
|
return {
|
|
4231
|
-
relativeDirPath:
|
|
4328
|
+
relativeDirPath: join38(".junie", "mcp"),
|
|
4232
4329
|
relativeFilePath: "mcp.json"
|
|
4233
4330
|
};
|
|
4234
4331
|
}
|
|
@@ -4237,7 +4334,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4237
4334
|
validate = true
|
|
4238
4335
|
}) {
|
|
4239
4336
|
const fileContent = await readFileContent(
|
|
4240
|
-
|
|
4337
|
+
join38(
|
|
4241
4338
|
baseDir,
|
|
4242
4339
|
this.getSettablePaths().relativeDirPath,
|
|
4243
4340
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4286,7 +4383,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4286
4383
|
};
|
|
4287
4384
|
|
|
4288
4385
|
// src/features/mcp/kilo-mcp.ts
|
|
4289
|
-
import { join as
|
|
4386
|
+
import { join as join39 } from "path";
|
|
4290
4387
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4291
4388
|
json;
|
|
4292
4389
|
constructor(params) {
|
|
@@ -4308,7 +4405,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4308
4405
|
}) {
|
|
4309
4406
|
const paths = this.getSettablePaths();
|
|
4310
4407
|
const fileContent = await readOrInitializeFileContent(
|
|
4311
|
-
|
|
4408
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4312
4409
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4313
4410
|
);
|
|
4314
4411
|
return new _KiloMcp({
|
|
@@ -4362,7 +4459,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
4362
4459
|
};
|
|
4363
4460
|
|
|
4364
4461
|
// src/features/mcp/opencode-mcp.ts
|
|
4365
|
-
import { join as
|
|
4462
|
+
import { join as join40 } from "path";
|
|
4366
4463
|
import { z as z17 } from "zod/mini";
|
|
4367
4464
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4368
4465
|
type: z17.literal("local"),
|
|
@@ -4486,7 +4583,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4486
4583
|
}) {
|
|
4487
4584
|
const paths = this.getSettablePaths({ global });
|
|
4488
4585
|
const fileContent = await readOrInitializeFileContent(
|
|
4489
|
-
|
|
4586
|
+
join40(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4490
4587
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4491
4588
|
);
|
|
4492
4589
|
const json = JSON.parse(fileContent);
|
|
@@ -4507,7 +4604,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4507
4604
|
}) {
|
|
4508
4605
|
const paths = this.getSettablePaths({ global });
|
|
4509
4606
|
const fileContent = await readOrInitializeFileContent(
|
|
4510
|
-
|
|
4607
|
+
join40(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4511
4608
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4512
4609
|
);
|
|
4513
4610
|
const json = JSON.parse(fileContent);
|
|
@@ -4551,7 +4648,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4551
4648
|
};
|
|
4552
4649
|
|
|
4553
4650
|
// src/features/mcp/roo-mcp.ts
|
|
4554
|
-
import { join as
|
|
4651
|
+
import { join as join41 } from "path";
|
|
4555
4652
|
function isRooMcpServers(value) {
|
|
4556
4653
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4557
4654
|
}
|
|
@@ -4603,7 +4700,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4603
4700
|
validate = true
|
|
4604
4701
|
}) {
|
|
4605
4702
|
const fileContent = await readFileContent(
|
|
4606
|
-
|
|
4703
|
+
join41(
|
|
4607
4704
|
baseDir,
|
|
4608
4705
|
this.getSettablePaths().relativeDirPath,
|
|
4609
4706
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4909,7 +5006,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4909
5006
|
};
|
|
4910
5007
|
|
|
4911
5008
|
// src/features/rules/rules-processor.ts
|
|
4912
|
-
import { basename as basename23, join as
|
|
5009
|
+
import { basename as basename23, join as join89 } from "path";
|
|
4913
5010
|
import { encode } from "@toon-format/toon";
|
|
4914
5011
|
import { z as z41 } from "zod/mini";
|
|
4915
5012
|
|
|
@@ -4917,17 +5014,17 @@ import { z as z41 } from "zod/mini";
|
|
|
4917
5014
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4918
5015
|
|
|
4919
5016
|
// src/features/skills/agentsmd-skill.ts
|
|
4920
|
-
import { join as
|
|
5017
|
+
import { join as join45 } from "path";
|
|
4921
5018
|
|
|
4922
5019
|
// src/features/skills/simulated-skill.ts
|
|
4923
|
-
import { join as
|
|
5020
|
+
import { join as join44 } from "path";
|
|
4924
5021
|
import { z as z19 } from "zod/mini";
|
|
4925
5022
|
|
|
4926
5023
|
// src/features/skills/tool-skill.ts
|
|
4927
|
-
import { join as
|
|
5024
|
+
import { join as join43 } from "path";
|
|
4928
5025
|
|
|
4929
5026
|
// src/types/ai-dir.ts
|
|
4930
|
-
import path2, { basename as basename15, join as
|
|
5027
|
+
import path2, { basename as basename15, join as join42, relative as relative3, resolve as resolve4 } from "path";
|
|
4931
5028
|
var AiDir = class {
|
|
4932
5029
|
/**
|
|
4933
5030
|
* @example "."
|
|
@@ -5021,8 +5118,8 @@ var AiDir = class {
|
|
|
5021
5118
|
* @returns Array of files with their relative paths and buffers
|
|
5022
5119
|
*/
|
|
5023
5120
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
5024
|
-
const dirPath =
|
|
5025
|
-
const glob =
|
|
5121
|
+
const dirPath = join42(baseDir, relativeDirPath, dirName);
|
|
5122
|
+
const glob = join42(dirPath, "**", "*");
|
|
5026
5123
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
5027
5124
|
const filteredPaths = filePaths.filter((filePath) => basename15(filePath) !== excludeFileName);
|
|
5028
5125
|
const files = await Promise.all(
|
|
@@ -5120,8 +5217,8 @@ var ToolSkill = class extends AiDir {
|
|
|
5120
5217
|
}) {
|
|
5121
5218
|
const settablePaths = getSettablePaths({ global });
|
|
5122
5219
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5123
|
-
const skillDirPath =
|
|
5124
|
-
const skillFilePath =
|
|
5220
|
+
const skillDirPath = join43(baseDir, actualRelativeDirPath, dirName);
|
|
5221
|
+
const skillFilePath = join43(skillDirPath, SKILL_FILE_NAME);
|
|
5125
5222
|
if (!await fileExists(skillFilePath)) {
|
|
5126
5223
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5127
5224
|
}
|
|
@@ -5179,7 +5276,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5179
5276
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
5180
5277
|
if (!result.success) {
|
|
5181
5278
|
throw new Error(
|
|
5182
|
-
`Invalid frontmatter in ${
|
|
5279
|
+
`Invalid frontmatter in ${join44(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5183
5280
|
);
|
|
5184
5281
|
}
|
|
5185
5282
|
}
|
|
@@ -5237,8 +5334,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5237
5334
|
}) {
|
|
5238
5335
|
const settablePaths = this.getSettablePaths();
|
|
5239
5336
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5240
|
-
const skillDirPath =
|
|
5241
|
-
const skillFilePath =
|
|
5337
|
+
const skillDirPath = join44(baseDir, actualRelativeDirPath, dirName);
|
|
5338
|
+
const skillFilePath = join44(skillDirPath, SKILL_FILE_NAME);
|
|
5242
5339
|
if (!await fileExists(skillFilePath)) {
|
|
5243
5340
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5244
5341
|
}
|
|
@@ -5315,7 +5412,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5315
5412
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5316
5413
|
}
|
|
5317
5414
|
return {
|
|
5318
|
-
relativeDirPath:
|
|
5415
|
+
relativeDirPath: join45(".agents", "skills")
|
|
5319
5416
|
};
|
|
5320
5417
|
}
|
|
5321
5418
|
static async fromDir(params) {
|
|
@@ -5342,14 +5439,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5342
5439
|
};
|
|
5343
5440
|
|
|
5344
5441
|
// src/features/skills/geminicli-skill.ts
|
|
5345
|
-
import { join as
|
|
5442
|
+
import { join as join46 } from "path";
|
|
5346
5443
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5347
5444
|
static getSettablePaths(options) {
|
|
5348
5445
|
if (options?.global) {
|
|
5349
5446
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5350
5447
|
}
|
|
5351
5448
|
return {
|
|
5352
|
-
relativeDirPath:
|
|
5449
|
+
relativeDirPath: join46(".gemini", "skills")
|
|
5353
5450
|
};
|
|
5354
5451
|
}
|
|
5355
5452
|
static async fromDir(params) {
|
|
@@ -5376,11 +5473,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5376
5473
|
};
|
|
5377
5474
|
|
|
5378
5475
|
// src/features/skills/skills-processor.ts
|
|
5379
|
-
import { basename as basename16, join as
|
|
5476
|
+
import { basename as basename16, join as join56 } from "path";
|
|
5380
5477
|
import { z as z28 } from "zod/mini";
|
|
5381
5478
|
|
|
5382
5479
|
// src/types/dir-feature-processor.ts
|
|
5383
|
-
import { join as
|
|
5480
|
+
import { join as join47 } from "path";
|
|
5384
5481
|
var DirFeatureProcessor = class {
|
|
5385
5482
|
baseDir;
|
|
5386
5483
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5402,14 +5499,14 @@ var DirFeatureProcessor = class {
|
|
|
5402
5499
|
await ensureDir(dirPath);
|
|
5403
5500
|
const mainFile = aiDir.getMainFile();
|
|
5404
5501
|
if (mainFile) {
|
|
5405
|
-
const mainFilePath =
|
|
5502
|
+
const mainFilePath = join47(dirPath, mainFile.name);
|
|
5406
5503
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5407
5504
|
const contentWithNewline = addTrailingNewline(content);
|
|
5408
5505
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5409
5506
|
}
|
|
5410
5507
|
const otherFiles = aiDir.getOtherFiles();
|
|
5411
5508
|
for (const file of otherFiles) {
|
|
5412
|
-
const filePath =
|
|
5509
|
+
const filePath = join47(dirPath, file.relativeFilePathToDirPath);
|
|
5413
5510
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5414
5511
|
await writeFileContent(filePath, contentWithNewline);
|
|
5415
5512
|
}
|
|
@@ -5424,11 +5521,11 @@ var DirFeatureProcessor = class {
|
|
|
5424
5521
|
};
|
|
5425
5522
|
|
|
5426
5523
|
// src/features/skills/claudecode-skill.ts
|
|
5427
|
-
import { join as
|
|
5524
|
+
import { join as join49 } from "path";
|
|
5428
5525
|
import { z as z21 } from "zod/mini";
|
|
5429
5526
|
|
|
5430
5527
|
// src/features/skills/rulesync-skill.ts
|
|
5431
|
-
import { join as
|
|
5528
|
+
import { join as join48 } from "path";
|
|
5432
5529
|
import { z as z20 } from "zod/mini";
|
|
5433
5530
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5434
5531
|
name: z20.string(),
|
|
@@ -5515,8 +5612,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5515
5612
|
dirName,
|
|
5516
5613
|
global = false
|
|
5517
5614
|
}) {
|
|
5518
|
-
const skillDirPath =
|
|
5519
|
-
const skillFilePath =
|
|
5615
|
+
const skillDirPath = join48(baseDir, relativeDirPath, dirName);
|
|
5616
|
+
const skillFilePath = join48(skillDirPath, SKILL_FILE_NAME);
|
|
5520
5617
|
if (!await fileExists(skillFilePath)) {
|
|
5521
5618
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5522
5619
|
}
|
|
@@ -5554,7 +5651,7 @@ var ClaudecodeSkillFrontmatterSchema = z21.looseObject({
|
|
|
5554
5651
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5555
5652
|
constructor({
|
|
5556
5653
|
baseDir = process.cwd(),
|
|
5557
|
-
relativeDirPath =
|
|
5654
|
+
relativeDirPath = join49(".claude", "skills"),
|
|
5558
5655
|
dirName,
|
|
5559
5656
|
frontmatter,
|
|
5560
5657
|
body,
|
|
@@ -5585,7 +5682,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5585
5682
|
global: _global = false
|
|
5586
5683
|
} = {}) {
|
|
5587
5684
|
return {
|
|
5588
|
-
relativeDirPath:
|
|
5685
|
+
relativeDirPath: join49(".claude", "skills")
|
|
5589
5686
|
};
|
|
5590
5687
|
}
|
|
5591
5688
|
getFrontmatter() {
|
|
@@ -5630,7 +5727,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5630
5727
|
};
|
|
5631
5728
|
return new RulesyncSkill({
|
|
5632
5729
|
baseDir: this.baseDir,
|
|
5633
|
-
relativeDirPath:
|
|
5730
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5634
5731
|
dirName: this.getDirName(),
|
|
5635
5732
|
frontmatter: rulesyncFrontmatter,
|
|
5636
5733
|
body: this.getBody(),
|
|
@@ -5673,9 +5770,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5673
5770
|
});
|
|
5674
5771
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5675
5772
|
if (!result.success) {
|
|
5676
|
-
const skillDirPath =
|
|
5773
|
+
const skillDirPath = join49(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5677
5774
|
throw new Error(
|
|
5678
|
-
`Invalid frontmatter in ${
|
|
5775
|
+
`Invalid frontmatter in ${join49(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5679
5776
|
);
|
|
5680
5777
|
}
|
|
5681
5778
|
return new _ClaudecodeSkill({
|
|
@@ -5709,7 +5806,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5709
5806
|
};
|
|
5710
5807
|
|
|
5711
5808
|
// src/features/skills/codexcli-skill.ts
|
|
5712
|
-
import { join as
|
|
5809
|
+
import { join as join50 } from "path";
|
|
5713
5810
|
import { z as z22 } from "zod/mini";
|
|
5714
5811
|
var CodexCliSkillFrontmatterSchema = z22.looseObject({
|
|
5715
5812
|
name: z22.string(),
|
|
@@ -5718,7 +5815,7 @@ var CodexCliSkillFrontmatterSchema = z22.looseObject({
|
|
|
5718
5815
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5719
5816
|
constructor({
|
|
5720
5817
|
baseDir = process.cwd(),
|
|
5721
|
-
relativeDirPath =
|
|
5818
|
+
relativeDirPath = join50(".codex", "skills"),
|
|
5722
5819
|
dirName,
|
|
5723
5820
|
frontmatter,
|
|
5724
5821
|
body,
|
|
@@ -5750,7 +5847,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5750
5847
|
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
5751
5848
|
}
|
|
5752
5849
|
return {
|
|
5753
|
-
relativeDirPath:
|
|
5850
|
+
relativeDirPath: join50(".codex", "skills")
|
|
5754
5851
|
};
|
|
5755
5852
|
}
|
|
5756
5853
|
getFrontmatter() {
|
|
@@ -5790,7 +5887,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5790
5887
|
};
|
|
5791
5888
|
return new RulesyncSkill({
|
|
5792
5889
|
baseDir: this.baseDir,
|
|
5793
|
-
relativeDirPath:
|
|
5890
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5794
5891
|
dirName: this.getDirName(),
|
|
5795
5892
|
frontmatter: rulesyncFrontmatter,
|
|
5796
5893
|
body: this.getBody(),
|
|
@@ -5832,9 +5929,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5832
5929
|
});
|
|
5833
5930
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5834
5931
|
if (!result.success) {
|
|
5835
|
-
const skillDirPath =
|
|
5932
|
+
const skillDirPath = join50(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5836
5933
|
throw new Error(
|
|
5837
|
-
`Invalid frontmatter in ${
|
|
5934
|
+
`Invalid frontmatter in ${join50(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5838
5935
|
);
|
|
5839
5936
|
}
|
|
5840
5937
|
return new _CodexCliSkill({
|
|
@@ -5868,7 +5965,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5868
5965
|
};
|
|
5869
5966
|
|
|
5870
5967
|
// src/features/skills/copilot-skill.ts
|
|
5871
|
-
import { join as
|
|
5968
|
+
import { join as join51 } from "path";
|
|
5872
5969
|
import { z as z23 } from "zod/mini";
|
|
5873
5970
|
var CopilotSkillFrontmatterSchema = z23.looseObject({
|
|
5874
5971
|
name: z23.string(),
|
|
@@ -5878,7 +5975,7 @@ var CopilotSkillFrontmatterSchema = z23.looseObject({
|
|
|
5878
5975
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5879
5976
|
constructor({
|
|
5880
5977
|
baseDir = process.cwd(),
|
|
5881
|
-
relativeDirPath =
|
|
5978
|
+
relativeDirPath = join51(".github", "skills"),
|
|
5882
5979
|
dirName,
|
|
5883
5980
|
frontmatter,
|
|
5884
5981
|
body,
|
|
@@ -5910,7 +6007,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5910
6007
|
throw new Error("CopilotSkill does not support global mode.");
|
|
5911
6008
|
}
|
|
5912
6009
|
return {
|
|
5913
|
-
relativeDirPath:
|
|
6010
|
+
relativeDirPath: join51(".github", "skills")
|
|
5914
6011
|
};
|
|
5915
6012
|
}
|
|
5916
6013
|
getFrontmatter() {
|
|
@@ -5955,7 +6052,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5955
6052
|
};
|
|
5956
6053
|
return new RulesyncSkill({
|
|
5957
6054
|
baseDir: this.baseDir,
|
|
5958
|
-
relativeDirPath:
|
|
6055
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
5959
6056
|
dirName: this.getDirName(),
|
|
5960
6057
|
frontmatter: rulesyncFrontmatter,
|
|
5961
6058
|
body: this.getBody(),
|
|
@@ -5998,9 +6095,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5998
6095
|
});
|
|
5999
6096
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6000
6097
|
if (!result.success) {
|
|
6001
|
-
const skillDirPath =
|
|
6098
|
+
const skillDirPath = join51(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6002
6099
|
throw new Error(
|
|
6003
|
-
`Invalid frontmatter in ${
|
|
6100
|
+
`Invalid frontmatter in ${join51(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6004
6101
|
);
|
|
6005
6102
|
}
|
|
6006
6103
|
return new _CopilotSkill({
|
|
@@ -6035,7 +6132,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
6035
6132
|
};
|
|
6036
6133
|
|
|
6037
6134
|
// src/features/skills/cursor-skill.ts
|
|
6038
|
-
import { join as
|
|
6135
|
+
import { join as join52 } from "path";
|
|
6039
6136
|
import { z as z24 } from "zod/mini";
|
|
6040
6137
|
var CursorSkillFrontmatterSchema = z24.looseObject({
|
|
6041
6138
|
name: z24.string(),
|
|
@@ -6044,7 +6141,7 @@ var CursorSkillFrontmatterSchema = z24.looseObject({
|
|
|
6044
6141
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6045
6142
|
constructor({
|
|
6046
6143
|
baseDir = process.cwd(),
|
|
6047
|
-
relativeDirPath =
|
|
6144
|
+
relativeDirPath = join52(".cursor", "skills"),
|
|
6048
6145
|
dirName,
|
|
6049
6146
|
frontmatter,
|
|
6050
6147
|
body,
|
|
@@ -6076,7 +6173,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6076
6173
|
throw new Error("CursorSkill does not support global mode.");
|
|
6077
6174
|
}
|
|
6078
6175
|
return {
|
|
6079
|
-
relativeDirPath:
|
|
6176
|
+
relativeDirPath: join52(".cursor", "skills")
|
|
6080
6177
|
};
|
|
6081
6178
|
}
|
|
6082
6179
|
getFrontmatter() {
|
|
@@ -6116,7 +6213,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6116
6213
|
};
|
|
6117
6214
|
return new RulesyncSkill({
|
|
6118
6215
|
baseDir: this.baseDir,
|
|
6119
|
-
relativeDirPath:
|
|
6216
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6120
6217
|
dirName: this.getDirName(),
|
|
6121
6218
|
frontmatter: rulesyncFrontmatter,
|
|
6122
6219
|
body: this.getBody(),
|
|
@@ -6158,9 +6255,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6158
6255
|
});
|
|
6159
6256
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6160
6257
|
if (!result.success) {
|
|
6161
|
-
const skillDirPath =
|
|
6258
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6162
6259
|
throw new Error(
|
|
6163
|
-
`Invalid frontmatter in ${
|
|
6260
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6164
6261
|
);
|
|
6165
6262
|
}
|
|
6166
6263
|
return new _CursorSkill({
|
|
@@ -6195,7 +6292,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6195
6292
|
};
|
|
6196
6293
|
|
|
6197
6294
|
// src/features/skills/kilo-skill.ts
|
|
6198
|
-
import { join as
|
|
6295
|
+
import { join as join53 } from "path";
|
|
6199
6296
|
import { z as z25 } from "zod/mini";
|
|
6200
6297
|
var KiloSkillFrontmatterSchema = z25.looseObject({
|
|
6201
6298
|
name: z25.string(),
|
|
@@ -6204,7 +6301,7 @@ var KiloSkillFrontmatterSchema = z25.looseObject({
|
|
|
6204
6301
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
6205
6302
|
constructor({
|
|
6206
6303
|
baseDir = process.cwd(),
|
|
6207
|
-
relativeDirPath =
|
|
6304
|
+
relativeDirPath = join53(".kilocode", "skills"),
|
|
6208
6305
|
dirName,
|
|
6209
6306
|
frontmatter,
|
|
6210
6307
|
body,
|
|
@@ -6235,7 +6332,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6235
6332
|
global: _global = false
|
|
6236
6333
|
} = {}) {
|
|
6237
6334
|
return {
|
|
6238
|
-
relativeDirPath:
|
|
6335
|
+
relativeDirPath: join53(".kilocode", "skills")
|
|
6239
6336
|
};
|
|
6240
6337
|
}
|
|
6241
6338
|
getFrontmatter() {
|
|
@@ -6283,7 +6380,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6283
6380
|
};
|
|
6284
6381
|
return new RulesyncSkill({
|
|
6285
6382
|
baseDir: this.baseDir,
|
|
6286
|
-
relativeDirPath:
|
|
6383
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6287
6384
|
dirName: this.getDirName(),
|
|
6288
6385
|
frontmatter: rulesyncFrontmatter,
|
|
6289
6386
|
body: this.getBody(),
|
|
@@ -6325,13 +6422,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6325
6422
|
});
|
|
6326
6423
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6327
6424
|
if (!result.success) {
|
|
6328
|
-
const skillDirPath =
|
|
6425
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6329
6426
|
throw new Error(
|
|
6330
|
-
`Invalid frontmatter in ${
|
|
6427
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6331
6428
|
);
|
|
6332
6429
|
}
|
|
6333
6430
|
if (result.data.name !== loaded.dirName) {
|
|
6334
|
-
const skillFilePath =
|
|
6431
|
+
const skillFilePath = join53(
|
|
6335
6432
|
loaded.baseDir,
|
|
6336
6433
|
loaded.relativeDirPath,
|
|
6337
6434
|
loaded.dirName,
|
|
@@ -6372,7 +6469,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
6372
6469
|
};
|
|
6373
6470
|
|
|
6374
6471
|
// src/features/skills/opencode-skill.ts
|
|
6375
|
-
import { join as
|
|
6472
|
+
import { join as join54 } from "path";
|
|
6376
6473
|
import { z as z26 } from "zod/mini";
|
|
6377
6474
|
var OpenCodeSkillFrontmatterSchema = z26.looseObject({
|
|
6378
6475
|
name: z26.string(),
|
|
@@ -6382,7 +6479,7 @@ var OpenCodeSkillFrontmatterSchema = z26.looseObject({
|
|
|
6382
6479
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
6383
6480
|
constructor({
|
|
6384
6481
|
baseDir = process.cwd(),
|
|
6385
|
-
relativeDirPath =
|
|
6482
|
+
relativeDirPath = join54(".opencode", "skill"),
|
|
6386
6483
|
dirName,
|
|
6387
6484
|
frontmatter,
|
|
6388
6485
|
body,
|
|
@@ -6411,7 +6508,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6411
6508
|
}
|
|
6412
6509
|
static getSettablePaths({ global = false } = {}) {
|
|
6413
6510
|
return {
|
|
6414
|
-
relativeDirPath: global ?
|
|
6511
|
+
relativeDirPath: global ? join54(".config", "opencode", "skill") : join54(".opencode", "skill")
|
|
6415
6512
|
};
|
|
6416
6513
|
}
|
|
6417
6514
|
getFrontmatter() {
|
|
@@ -6456,7 +6553,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6456
6553
|
};
|
|
6457
6554
|
return new RulesyncSkill({
|
|
6458
6555
|
baseDir: this.baseDir,
|
|
6459
|
-
relativeDirPath:
|
|
6556
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6460
6557
|
dirName: this.getDirName(),
|
|
6461
6558
|
frontmatter: rulesyncFrontmatter,
|
|
6462
6559
|
body: this.getBody(),
|
|
@@ -6499,9 +6596,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6499
6596
|
});
|
|
6500
6597
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6501
6598
|
if (!result.success) {
|
|
6502
|
-
const skillDirPath =
|
|
6599
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6503
6600
|
throw new Error(
|
|
6504
|
-
`Invalid frontmatter in ${
|
|
6601
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6505
6602
|
);
|
|
6506
6603
|
}
|
|
6507
6604
|
return new _OpenCodeSkill({
|
|
@@ -6535,7 +6632,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6535
6632
|
};
|
|
6536
6633
|
|
|
6537
6634
|
// src/features/skills/roo-skill.ts
|
|
6538
|
-
import { join as
|
|
6635
|
+
import { join as join55 } from "path";
|
|
6539
6636
|
import { z as z27 } from "zod/mini";
|
|
6540
6637
|
var RooSkillFrontmatterSchema = z27.looseObject({
|
|
6541
6638
|
name: z27.string(),
|
|
@@ -6544,7 +6641,7 @@ var RooSkillFrontmatterSchema = z27.looseObject({
|
|
|
6544
6641
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6545
6642
|
constructor({
|
|
6546
6643
|
baseDir = process.cwd(),
|
|
6547
|
-
relativeDirPath =
|
|
6644
|
+
relativeDirPath = join55(".roo", "skills"),
|
|
6548
6645
|
dirName,
|
|
6549
6646
|
frontmatter,
|
|
6550
6647
|
body,
|
|
@@ -6575,7 +6672,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6575
6672
|
global: _global = false
|
|
6576
6673
|
} = {}) {
|
|
6577
6674
|
return {
|
|
6578
|
-
relativeDirPath:
|
|
6675
|
+
relativeDirPath: join55(".roo", "skills")
|
|
6579
6676
|
};
|
|
6580
6677
|
}
|
|
6581
6678
|
getFrontmatter() {
|
|
@@ -6623,7 +6720,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6623
6720
|
};
|
|
6624
6721
|
return new RulesyncSkill({
|
|
6625
6722
|
baseDir: this.baseDir,
|
|
6626
|
-
relativeDirPath:
|
|
6723
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
6627
6724
|
dirName: this.getDirName(),
|
|
6628
6725
|
frontmatter: rulesyncFrontmatter,
|
|
6629
6726
|
body: this.getBody(),
|
|
@@ -6665,13 +6762,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6665
6762
|
});
|
|
6666
6763
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6667
6764
|
if (!result.success) {
|
|
6668
|
-
const skillDirPath =
|
|
6765
|
+
const skillDirPath = join55(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6669
6766
|
throw new Error(
|
|
6670
|
-
`Invalid frontmatter in ${
|
|
6767
|
+
`Invalid frontmatter in ${join55(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6671
6768
|
);
|
|
6672
6769
|
}
|
|
6673
6770
|
if (result.data.name !== loaded.dirName) {
|
|
6674
|
-
const skillFilePath =
|
|
6771
|
+
const skillFilePath = join55(
|
|
6675
6772
|
loaded.baseDir,
|
|
6676
6773
|
loaded.relativeDirPath,
|
|
6677
6774
|
loaded.dirName,
|
|
@@ -6874,8 +6971,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6874
6971
|
*/
|
|
6875
6972
|
async loadRulesyncDirs() {
|
|
6876
6973
|
const paths = RulesyncSkill.getSettablePaths();
|
|
6877
|
-
const rulesyncSkillsDirPath =
|
|
6878
|
-
const dirPaths = await findFilesByGlobs(
|
|
6974
|
+
const rulesyncSkillsDirPath = join56(this.baseDir, paths.relativeDirPath);
|
|
6975
|
+
const dirPaths = await findFilesByGlobs(join56(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
6879
6976
|
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6880
6977
|
const rulesyncSkills = await Promise.all(
|
|
6881
6978
|
dirNames.map(
|
|
@@ -6892,8 +6989,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6892
6989
|
async loadToolDirs() {
|
|
6893
6990
|
const factory = this.getFactory(this.toolTarget);
|
|
6894
6991
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6895
|
-
const skillsDirPath =
|
|
6896
|
-
const dirPaths = await findFilesByGlobs(
|
|
6992
|
+
const skillsDirPath = join56(this.baseDir, paths.relativeDirPath);
|
|
6993
|
+
const dirPaths = await findFilesByGlobs(join56(skillsDirPath, "*"), { type: "dir" });
|
|
6897
6994
|
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6898
6995
|
const toolSkills = await Promise.all(
|
|
6899
6996
|
dirNames.map(
|
|
@@ -6910,8 +7007,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6910
7007
|
async loadToolDirsToDelete() {
|
|
6911
7008
|
const factory = this.getFactory(this.toolTarget);
|
|
6912
7009
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6913
|
-
const skillsDirPath =
|
|
6914
|
-
const dirPaths = await findFilesByGlobs(
|
|
7010
|
+
const skillsDirPath = join56(this.baseDir, paths.relativeDirPath);
|
|
7011
|
+
const dirPaths = await findFilesByGlobs(join56(skillsDirPath, "*"), { type: "dir" });
|
|
6915
7012
|
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6916
7013
|
const toolSkills = dirNames.map(
|
|
6917
7014
|
(dirName) => factory.class.forDeletion({
|
|
@@ -6960,10 +7057,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6960
7057
|
};
|
|
6961
7058
|
|
|
6962
7059
|
// src/features/subagents/agentsmd-subagent.ts
|
|
6963
|
-
import { join as
|
|
7060
|
+
import { join as join58 } from "path";
|
|
6964
7061
|
|
|
6965
7062
|
// src/features/subagents/simulated-subagent.ts
|
|
6966
|
-
import { basename as basename17, join as
|
|
7063
|
+
import { basename as basename17, join as join57 } from "path";
|
|
6967
7064
|
import { z as z29 } from "zod/mini";
|
|
6968
7065
|
|
|
6969
7066
|
// src/features/subagents/tool-subagent.ts
|
|
@@ -7019,7 +7116,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7019
7116
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7020
7117
|
if (!result.success) {
|
|
7021
7118
|
throw new Error(
|
|
7022
|
-
`Invalid frontmatter in ${
|
|
7119
|
+
`Invalid frontmatter in ${join57(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7023
7120
|
);
|
|
7024
7121
|
}
|
|
7025
7122
|
}
|
|
@@ -7070,7 +7167,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7070
7167
|
return {
|
|
7071
7168
|
success: false,
|
|
7072
7169
|
error: new Error(
|
|
7073
|
-
`Invalid frontmatter in ${
|
|
7170
|
+
`Invalid frontmatter in ${join57(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7074
7171
|
)
|
|
7075
7172
|
};
|
|
7076
7173
|
}
|
|
@@ -7080,7 +7177,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7080
7177
|
relativeFilePath,
|
|
7081
7178
|
validate = true
|
|
7082
7179
|
}) {
|
|
7083
|
-
const filePath =
|
|
7180
|
+
const filePath = join57(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
7084
7181
|
const fileContent = await readFileContent(filePath);
|
|
7085
7182
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7086
7183
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7116,7 +7213,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
7116
7213
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
7117
7214
|
static getSettablePaths() {
|
|
7118
7215
|
return {
|
|
7119
|
-
relativeDirPath:
|
|
7216
|
+
relativeDirPath: join58(".agents", "subagents")
|
|
7120
7217
|
};
|
|
7121
7218
|
}
|
|
7122
7219
|
static async fromFile(params) {
|
|
@@ -7139,11 +7236,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
7139
7236
|
};
|
|
7140
7237
|
|
|
7141
7238
|
// src/features/subagents/codexcli-subagent.ts
|
|
7142
|
-
import { join as
|
|
7239
|
+
import { join as join59 } from "path";
|
|
7143
7240
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
7144
7241
|
static getSettablePaths() {
|
|
7145
7242
|
return {
|
|
7146
|
-
relativeDirPath:
|
|
7243
|
+
relativeDirPath: join59(".codex", "subagents")
|
|
7147
7244
|
};
|
|
7148
7245
|
}
|
|
7149
7246
|
static async fromFile(params) {
|
|
@@ -7166,11 +7263,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
7166
7263
|
};
|
|
7167
7264
|
|
|
7168
7265
|
// src/features/subagents/cursor-subagent.ts
|
|
7169
|
-
import { join as
|
|
7266
|
+
import { join as join60 } from "path";
|
|
7170
7267
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
7171
7268
|
static getSettablePaths() {
|
|
7172
7269
|
return {
|
|
7173
|
-
relativeDirPath:
|
|
7270
|
+
relativeDirPath: join60(".cursor", "subagents")
|
|
7174
7271
|
};
|
|
7175
7272
|
}
|
|
7176
7273
|
static async fromFile(params) {
|
|
@@ -7193,11 +7290,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
7193
7290
|
};
|
|
7194
7291
|
|
|
7195
7292
|
// src/features/subagents/geminicli-subagent.ts
|
|
7196
|
-
import { join as
|
|
7293
|
+
import { join as join61 } from "path";
|
|
7197
7294
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
7198
7295
|
static getSettablePaths() {
|
|
7199
7296
|
return {
|
|
7200
|
-
relativeDirPath:
|
|
7297
|
+
relativeDirPath: join61(".gemini", "subagents")
|
|
7201
7298
|
};
|
|
7202
7299
|
}
|
|
7203
7300
|
static async fromFile(params) {
|
|
@@ -7220,11 +7317,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
7220
7317
|
};
|
|
7221
7318
|
|
|
7222
7319
|
// src/features/subagents/roo-subagent.ts
|
|
7223
|
-
import { join as
|
|
7320
|
+
import { join as join62 } from "path";
|
|
7224
7321
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
7225
7322
|
static getSettablePaths() {
|
|
7226
7323
|
return {
|
|
7227
|
-
relativeDirPath:
|
|
7324
|
+
relativeDirPath: join62(".roo", "subagents")
|
|
7228
7325
|
};
|
|
7229
7326
|
}
|
|
7230
7327
|
static async fromFile(params) {
|
|
@@ -7247,15 +7344,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7247
7344
|
};
|
|
7248
7345
|
|
|
7249
7346
|
// src/features/subagents/subagents-processor.ts
|
|
7250
|
-
import { basename as basename20, join as
|
|
7347
|
+
import { basename as basename20, join as join67 } from "path";
|
|
7251
7348
|
import { z as z34 } from "zod/mini";
|
|
7252
7349
|
|
|
7253
7350
|
// src/features/subagents/claudecode-subagent.ts
|
|
7254
|
-
import { join as
|
|
7351
|
+
import { join as join64 } from "path";
|
|
7255
7352
|
import { z as z31 } from "zod/mini";
|
|
7256
7353
|
|
|
7257
7354
|
// src/features/subagents/rulesync-subagent.ts
|
|
7258
|
-
import { basename as basename18, join as
|
|
7355
|
+
import { basename as basename18, join as join63 } from "path";
|
|
7259
7356
|
import { z as z30 } from "zod/mini";
|
|
7260
7357
|
var RulesyncSubagentFrontmatterSchema = z30.looseObject({
|
|
7261
7358
|
targets: RulesyncTargetsSchema,
|
|
@@ -7270,7 +7367,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7270
7367
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7271
7368
|
if (!result.success) {
|
|
7272
7369
|
throw new Error(
|
|
7273
|
-
`Invalid frontmatter in ${
|
|
7370
|
+
`Invalid frontmatter in ${join63(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7274
7371
|
);
|
|
7275
7372
|
}
|
|
7276
7373
|
}
|
|
@@ -7303,7 +7400,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7303
7400
|
return {
|
|
7304
7401
|
success: false,
|
|
7305
7402
|
error: new Error(
|
|
7306
|
-
`Invalid frontmatter in ${
|
|
7403
|
+
`Invalid frontmatter in ${join63(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7307
7404
|
)
|
|
7308
7405
|
};
|
|
7309
7406
|
}
|
|
@@ -7312,7 +7409,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
7312
7409
|
relativeFilePath
|
|
7313
7410
|
}) {
|
|
7314
7411
|
const fileContent = await readFileContent(
|
|
7315
|
-
|
|
7412
|
+
join63(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
7316
7413
|
);
|
|
7317
7414
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7318
7415
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7347,7 +7444,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7347
7444
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7348
7445
|
if (!result.success) {
|
|
7349
7446
|
throw new Error(
|
|
7350
|
-
`Invalid frontmatter in ${
|
|
7447
|
+
`Invalid frontmatter in ${join64(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7351
7448
|
);
|
|
7352
7449
|
}
|
|
7353
7450
|
}
|
|
@@ -7359,7 +7456,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7359
7456
|
}
|
|
7360
7457
|
static getSettablePaths(_options = {}) {
|
|
7361
7458
|
return {
|
|
7362
|
-
relativeDirPath:
|
|
7459
|
+
relativeDirPath: join64(".claude", "agents")
|
|
7363
7460
|
};
|
|
7364
7461
|
}
|
|
7365
7462
|
getFrontmatter() {
|
|
@@ -7433,7 +7530,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7433
7530
|
return {
|
|
7434
7531
|
success: false,
|
|
7435
7532
|
error: new Error(
|
|
7436
|
-
`Invalid frontmatter in ${
|
|
7533
|
+
`Invalid frontmatter in ${join64(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7437
7534
|
)
|
|
7438
7535
|
};
|
|
7439
7536
|
}
|
|
@@ -7451,7 +7548,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7451
7548
|
global = false
|
|
7452
7549
|
}) {
|
|
7453
7550
|
const paths = this.getSettablePaths({ global });
|
|
7454
|
-
const filePath =
|
|
7551
|
+
const filePath = join64(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7455
7552
|
const fileContent = await readFileContent(filePath);
|
|
7456
7553
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7457
7554
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7486,7 +7583,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7486
7583
|
};
|
|
7487
7584
|
|
|
7488
7585
|
// src/features/subagents/copilot-subagent.ts
|
|
7489
|
-
import { join as
|
|
7586
|
+
import { join as join65 } from "path";
|
|
7490
7587
|
import { z as z32 } from "zod/mini";
|
|
7491
7588
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7492
7589
|
var CopilotSubagentFrontmatterSchema = z32.looseObject({
|
|
@@ -7512,7 +7609,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7512
7609
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7513
7610
|
if (!result.success) {
|
|
7514
7611
|
throw new Error(
|
|
7515
|
-
`Invalid frontmatter in ${
|
|
7612
|
+
`Invalid frontmatter in ${join65(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7516
7613
|
);
|
|
7517
7614
|
}
|
|
7518
7615
|
}
|
|
@@ -7524,7 +7621,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7524
7621
|
}
|
|
7525
7622
|
static getSettablePaths(_options = {}) {
|
|
7526
7623
|
return {
|
|
7527
|
-
relativeDirPath:
|
|
7624
|
+
relativeDirPath: join65(".github", "agents")
|
|
7528
7625
|
};
|
|
7529
7626
|
}
|
|
7530
7627
|
getFrontmatter() {
|
|
@@ -7598,7 +7695,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7598
7695
|
return {
|
|
7599
7696
|
success: false,
|
|
7600
7697
|
error: new Error(
|
|
7601
|
-
`Invalid frontmatter in ${
|
|
7698
|
+
`Invalid frontmatter in ${join65(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7602
7699
|
)
|
|
7603
7700
|
};
|
|
7604
7701
|
}
|
|
@@ -7616,7 +7713,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7616
7713
|
global = false
|
|
7617
7714
|
}) {
|
|
7618
7715
|
const paths = this.getSettablePaths({ global });
|
|
7619
|
-
const filePath =
|
|
7716
|
+
const filePath = join65(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7620
7717
|
const fileContent = await readFileContent(filePath);
|
|
7621
7718
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7622
7719
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7652,7 +7749,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7652
7749
|
};
|
|
7653
7750
|
|
|
7654
7751
|
// src/features/subagents/opencode-subagent.ts
|
|
7655
|
-
import { basename as basename19, join as
|
|
7752
|
+
import { basename as basename19, join as join66 } from "path";
|
|
7656
7753
|
import { z as z33 } from "zod/mini";
|
|
7657
7754
|
var OpenCodeSubagentFrontmatterSchema = z33.looseObject({
|
|
7658
7755
|
description: z33.string(),
|
|
@@ -7667,7 +7764,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7667
7764
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7668
7765
|
if (!result.success) {
|
|
7669
7766
|
throw new Error(
|
|
7670
|
-
`Invalid frontmatter in ${
|
|
7767
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7671
7768
|
);
|
|
7672
7769
|
}
|
|
7673
7770
|
}
|
|
@@ -7681,7 +7778,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7681
7778
|
global = false
|
|
7682
7779
|
} = {}) {
|
|
7683
7780
|
return {
|
|
7684
|
-
relativeDirPath: global ?
|
|
7781
|
+
relativeDirPath: global ? join66(".config", "opencode", "agent") : join66(".opencode", "agent")
|
|
7685
7782
|
};
|
|
7686
7783
|
}
|
|
7687
7784
|
getFrontmatter() {
|
|
@@ -7747,7 +7844,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7747
7844
|
return {
|
|
7748
7845
|
success: false,
|
|
7749
7846
|
error: new Error(
|
|
7750
|
-
`Invalid frontmatter in ${
|
|
7847
|
+
`Invalid frontmatter in ${join66(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7751
7848
|
)
|
|
7752
7849
|
};
|
|
7753
7850
|
}
|
|
@@ -7764,7 +7861,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7764
7861
|
global = false
|
|
7765
7862
|
}) {
|
|
7766
7863
|
const paths = this.getSettablePaths({ global });
|
|
7767
|
-
const filePath =
|
|
7864
|
+
const filePath = join66(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7768
7865
|
const fileContent = await readFileContent(filePath);
|
|
7769
7866
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7770
7867
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7925,7 +8022,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7925
8022
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
7926
8023
|
*/
|
|
7927
8024
|
async loadRulesyncFiles() {
|
|
7928
|
-
const subagentsDir =
|
|
8025
|
+
const subagentsDir = join67(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
7929
8026
|
const dirExists = await directoryExists(subagentsDir);
|
|
7930
8027
|
if (!dirExists) {
|
|
7931
8028
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -7940,7 +8037,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7940
8037
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
7941
8038
|
const rulesyncSubagents = [];
|
|
7942
8039
|
for (const mdFile of mdFiles) {
|
|
7943
|
-
const filepath =
|
|
8040
|
+
const filepath = join67(subagentsDir, mdFile);
|
|
7944
8041
|
try {
|
|
7945
8042
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
7946
8043
|
relativeFilePath: mdFile,
|
|
@@ -7970,7 +8067,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7970
8067
|
const factory = this.getFactory(this.toolTarget);
|
|
7971
8068
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7972
8069
|
const subagentFilePaths = await findFilesByGlobs(
|
|
7973
|
-
|
|
8070
|
+
join67(this.baseDir, paths.relativeDirPath, "*.md")
|
|
7974
8071
|
);
|
|
7975
8072
|
if (forDeletion) {
|
|
7976
8073
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -8020,13 +8117,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8020
8117
|
};
|
|
8021
8118
|
|
|
8022
8119
|
// src/features/rules/agentsmd-rule.ts
|
|
8023
|
-
import { join as
|
|
8120
|
+
import { join as join70 } from "path";
|
|
8024
8121
|
|
|
8025
8122
|
// src/features/rules/tool-rule.ts
|
|
8026
|
-
import { join as
|
|
8123
|
+
import { join as join69 } from "path";
|
|
8027
8124
|
|
|
8028
8125
|
// src/features/rules/rulesync-rule.ts
|
|
8029
|
-
import { basename as basename21, join as
|
|
8126
|
+
import { basename as basename21, join as join68 } from "path";
|
|
8030
8127
|
import { z as z35 } from "zod/mini";
|
|
8031
8128
|
var RulesyncRuleFrontmatterSchema = z35.object({
|
|
8032
8129
|
root: z35.optional(z35.optional(z35.boolean())),
|
|
@@ -8073,7 +8170,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8073
8170
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8074
8171
|
if (!result.success) {
|
|
8075
8172
|
throw new Error(
|
|
8076
|
-
`Invalid frontmatter in ${
|
|
8173
|
+
`Invalid frontmatter in ${join68(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8077
8174
|
);
|
|
8078
8175
|
}
|
|
8079
8176
|
}
|
|
@@ -8108,7 +8205,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8108
8205
|
return {
|
|
8109
8206
|
success: false,
|
|
8110
8207
|
error: new Error(
|
|
8111
|
-
`Invalid frontmatter in ${
|
|
8208
|
+
`Invalid frontmatter in ${join68(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8112
8209
|
)
|
|
8113
8210
|
};
|
|
8114
8211
|
}
|
|
@@ -8117,12 +8214,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8117
8214
|
relativeFilePath,
|
|
8118
8215
|
validate = true
|
|
8119
8216
|
}) {
|
|
8120
|
-
const legacyPath =
|
|
8217
|
+
const legacyPath = join68(
|
|
8121
8218
|
process.cwd(),
|
|
8122
8219
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8123
8220
|
relativeFilePath
|
|
8124
8221
|
);
|
|
8125
|
-
const recommendedPath =
|
|
8222
|
+
const recommendedPath = join68(
|
|
8126
8223
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8127
8224
|
relativeFilePath
|
|
8128
8225
|
);
|
|
@@ -8155,7 +8252,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8155
8252
|
relativeFilePath,
|
|
8156
8253
|
validate = true
|
|
8157
8254
|
}) {
|
|
8158
|
-
const filePath =
|
|
8255
|
+
const filePath = join68(
|
|
8159
8256
|
process.cwd(),
|
|
8160
8257
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8161
8258
|
relativeFilePath
|
|
@@ -8257,7 +8354,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8257
8354
|
rulesyncRule,
|
|
8258
8355
|
validate = true,
|
|
8259
8356
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8260
|
-
nonRootPath = { relativeDirPath:
|
|
8357
|
+
nonRootPath = { relativeDirPath: join69(".agents", "memories") }
|
|
8261
8358
|
}) {
|
|
8262
8359
|
const params = this.buildToolRuleParamsDefault({
|
|
8263
8360
|
baseDir,
|
|
@@ -8268,7 +8365,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8268
8365
|
});
|
|
8269
8366
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8270
8367
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8271
|
-
params.relativeDirPath =
|
|
8368
|
+
params.relativeDirPath = join69(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8272
8369
|
params.relativeFilePath = "AGENTS.md";
|
|
8273
8370
|
}
|
|
8274
8371
|
return params;
|
|
@@ -8333,7 +8430,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8333
8430
|
relativeFilePath: "AGENTS.md"
|
|
8334
8431
|
},
|
|
8335
8432
|
nonRoot: {
|
|
8336
|
-
relativeDirPath:
|
|
8433
|
+
relativeDirPath: join70(".agents", "memories")
|
|
8337
8434
|
}
|
|
8338
8435
|
};
|
|
8339
8436
|
}
|
|
@@ -8343,8 +8440,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8343
8440
|
validate = true
|
|
8344
8441
|
}) {
|
|
8345
8442
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8346
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
8347
|
-
const fileContent = await readFileContent(
|
|
8443
|
+
const relativePath = isRoot ? "AGENTS.md" : join70(".agents", "memories", relativeFilePath);
|
|
8444
|
+
const fileContent = await readFileContent(join70(baseDir, relativePath));
|
|
8348
8445
|
return new _AgentsMdRule({
|
|
8349
8446
|
baseDir,
|
|
8350
8447
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8399,7 +8496,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8399
8496
|
};
|
|
8400
8497
|
|
|
8401
8498
|
// src/features/rules/antigravity-rule.ts
|
|
8402
|
-
import { join as
|
|
8499
|
+
import { join as join71 } from "path";
|
|
8403
8500
|
import { z as z36 } from "zod/mini";
|
|
8404
8501
|
var AntigravityRuleFrontmatterSchema = z36.looseObject({
|
|
8405
8502
|
trigger: z36.optional(
|
|
@@ -8558,7 +8655,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8558
8655
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8559
8656
|
if (!result.success) {
|
|
8560
8657
|
throw new Error(
|
|
8561
|
-
`Invalid frontmatter in ${
|
|
8658
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8562
8659
|
);
|
|
8563
8660
|
}
|
|
8564
8661
|
}
|
|
@@ -8573,7 +8670,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8573
8670
|
static getSettablePaths() {
|
|
8574
8671
|
return {
|
|
8575
8672
|
nonRoot: {
|
|
8576
|
-
relativeDirPath:
|
|
8673
|
+
relativeDirPath: join71(".agent", "rules")
|
|
8577
8674
|
}
|
|
8578
8675
|
};
|
|
8579
8676
|
}
|
|
@@ -8582,7 +8679,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8582
8679
|
relativeFilePath,
|
|
8583
8680
|
validate = true
|
|
8584
8681
|
}) {
|
|
8585
|
-
const filePath =
|
|
8682
|
+
const filePath = join71(
|
|
8586
8683
|
baseDir,
|
|
8587
8684
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8588
8685
|
relativeFilePath
|
|
@@ -8723,7 +8820,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8723
8820
|
};
|
|
8724
8821
|
|
|
8725
8822
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8726
|
-
import { join as
|
|
8823
|
+
import { join as join72 } from "path";
|
|
8727
8824
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8728
8825
|
toRulesyncRule() {
|
|
8729
8826
|
const rulesyncFrontmatter = {
|
|
@@ -8749,7 +8846,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8749
8846
|
relativeFilePath: ".augment-guidelines"
|
|
8750
8847
|
},
|
|
8751
8848
|
nonRoot: {
|
|
8752
|
-
relativeDirPath:
|
|
8849
|
+
relativeDirPath: join72(".augment", "rules")
|
|
8753
8850
|
}
|
|
8754
8851
|
};
|
|
8755
8852
|
}
|
|
@@ -8784,8 +8881,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8784
8881
|
}) {
|
|
8785
8882
|
const settablePaths = this.getSettablePaths();
|
|
8786
8883
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8787
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
8788
|
-
const fileContent = await readFileContent(
|
|
8884
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join72(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8885
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
8789
8886
|
return new _AugmentcodeLegacyRule({
|
|
8790
8887
|
baseDir,
|
|
8791
8888
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8814,7 +8911,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8814
8911
|
};
|
|
8815
8912
|
|
|
8816
8913
|
// src/features/rules/augmentcode-rule.ts
|
|
8817
|
-
import { join as
|
|
8914
|
+
import { join as join73 } from "path";
|
|
8818
8915
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8819
8916
|
toRulesyncRule() {
|
|
8820
8917
|
return this.toRulesyncRuleDefault();
|
|
@@ -8822,7 +8919,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8822
8919
|
static getSettablePaths() {
|
|
8823
8920
|
return {
|
|
8824
8921
|
nonRoot: {
|
|
8825
|
-
relativeDirPath:
|
|
8922
|
+
relativeDirPath: join73(".augment", "rules")
|
|
8826
8923
|
}
|
|
8827
8924
|
};
|
|
8828
8925
|
}
|
|
@@ -8846,7 +8943,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8846
8943
|
validate = true
|
|
8847
8944
|
}) {
|
|
8848
8945
|
const fileContent = await readFileContent(
|
|
8849
|
-
|
|
8946
|
+
join73(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8850
8947
|
);
|
|
8851
8948
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8852
8949
|
return new _AugmentcodeRule({
|
|
@@ -8882,7 +8979,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8882
8979
|
};
|
|
8883
8980
|
|
|
8884
8981
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8885
|
-
import { join as
|
|
8982
|
+
import { join as join74 } from "path";
|
|
8886
8983
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8887
8984
|
static getSettablePaths({
|
|
8888
8985
|
global
|
|
@@ -8901,7 +8998,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8901
8998
|
relativeFilePath: "CLAUDE.md"
|
|
8902
8999
|
},
|
|
8903
9000
|
nonRoot: {
|
|
8904
|
-
relativeDirPath:
|
|
9001
|
+
relativeDirPath: join74(".claude", "memories")
|
|
8905
9002
|
}
|
|
8906
9003
|
};
|
|
8907
9004
|
}
|
|
@@ -8916,7 +9013,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8916
9013
|
if (isRoot) {
|
|
8917
9014
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8918
9015
|
const fileContent2 = await readFileContent(
|
|
8919
|
-
|
|
9016
|
+
join74(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8920
9017
|
);
|
|
8921
9018
|
return new _ClaudecodeLegacyRule({
|
|
8922
9019
|
baseDir,
|
|
@@ -8930,8 +9027,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8930
9027
|
if (!paths.nonRoot) {
|
|
8931
9028
|
throw new Error("nonRoot path is not set");
|
|
8932
9029
|
}
|
|
8933
|
-
const relativePath =
|
|
8934
|
-
const fileContent = await readFileContent(
|
|
9030
|
+
const relativePath = join74(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9031
|
+
const fileContent = await readFileContent(join74(baseDir, relativePath));
|
|
8935
9032
|
return new _ClaudecodeLegacyRule({
|
|
8936
9033
|
baseDir,
|
|
8937
9034
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8990,7 +9087,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8990
9087
|
};
|
|
8991
9088
|
|
|
8992
9089
|
// src/features/rules/claudecode-rule.ts
|
|
8993
|
-
import { join as
|
|
9090
|
+
import { join as join75 } from "path";
|
|
8994
9091
|
import { z as z37 } from "zod/mini";
|
|
8995
9092
|
var ClaudecodeRuleFrontmatterSchema = z37.object({
|
|
8996
9093
|
paths: z37.optional(z37.string())
|
|
@@ -9015,7 +9112,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9015
9112
|
relativeFilePath: "CLAUDE.md"
|
|
9016
9113
|
},
|
|
9017
9114
|
nonRoot: {
|
|
9018
|
-
relativeDirPath:
|
|
9115
|
+
relativeDirPath: join75(".claude", "rules")
|
|
9019
9116
|
}
|
|
9020
9117
|
};
|
|
9021
9118
|
}
|
|
@@ -9024,7 +9121,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9024
9121
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9025
9122
|
if (!result.success) {
|
|
9026
9123
|
throw new Error(
|
|
9027
|
-
`Invalid frontmatter in ${
|
|
9124
|
+
`Invalid frontmatter in ${join75(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9028
9125
|
);
|
|
9029
9126
|
}
|
|
9030
9127
|
}
|
|
@@ -9052,7 +9149,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9052
9149
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9053
9150
|
if (isRoot) {
|
|
9054
9151
|
const fileContent2 = await readFileContent(
|
|
9055
|
-
|
|
9152
|
+
join75(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9056
9153
|
);
|
|
9057
9154
|
return new _ClaudecodeRule({
|
|
9058
9155
|
baseDir,
|
|
@@ -9067,13 +9164,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9067
9164
|
if (!paths.nonRoot) {
|
|
9068
9165
|
throw new Error("nonRoot path is not set");
|
|
9069
9166
|
}
|
|
9070
|
-
const relativePath =
|
|
9071
|
-
const fileContent = await readFileContent(
|
|
9167
|
+
const relativePath = join75(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9168
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
9072
9169
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9073
9170
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9074
9171
|
if (!result.success) {
|
|
9075
9172
|
throw new Error(
|
|
9076
|
-
`Invalid frontmatter in ${
|
|
9173
|
+
`Invalid frontmatter in ${join75(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9077
9174
|
);
|
|
9078
9175
|
}
|
|
9079
9176
|
return new _ClaudecodeRule({
|
|
@@ -9180,7 +9277,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9180
9277
|
return {
|
|
9181
9278
|
success: false,
|
|
9182
9279
|
error: new Error(
|
|
9183
|
-
`Invalid frontmatter in ${
|
|
9280
|
+
`Invalid frontmatter in ${join75(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9184
9281
|
)
|
|
9185
9282
|
};
|
|
9186
9283
|
}
|
|
@@ -9200,7 +9297,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9200
9297
|
};
|
|
9201
9298
|
|
|
9202
9299
|
// src/features/rules/cline-rule.ts
|
|
9203
|
-
import { join as
|
|
9300
|
+
import { join as join76 } from "path";
|
|
9204
9301
|
import { z as z38 } from "zod/mini";
|
|
9205
9302
|
var ClineRuleFrontmatterSchema = z38.object({
|
|
9206
9303
|
description: z38.string()
|
|
@@ -9245,7 +9342,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9245
9342
|
validate = true
|
|
9246
9343
|
}) {
|
|
9247
9344
|
const fileContent = await readFileContent(
|
|
9248
|
-
|
|
9345
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9249
9346
|
);
|
|
9250
9347
|
return new _ClineRule({
|
|
9251
9348
|
baseDir,
|
|
@@ -9271,7 +9368,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9271
9368
|
};
|
|
9272
9369
|
|
|
9273
9370
|
// src/features/rules/codexcli-rule.ts
|
|
9274
|
-
import { join as
|
|
9371
|
+
import { join as join77 } from "path";
|
|
9275
9372
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9276
9373
|
static getSettablePaths({
|
|
9277
9374
|
global
|
|
@@ -9290,7 +9387,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9290
9387
|
relativeFilePath: "AGENTS.md"
|
|
9291
9388
|
},
|
|
9292
9389
|
nonRoot: {
|
|
9293
|
-
relativeDirPath:
|
|
9390
|
+
relativeDirPath: join77(".codex", "memories")
|
|
9294
9391
|
}
|
|
9295
9392
|
};
|
|
9296
9393
|
}
|
|
@@ -9305,7 +9402,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9305
9402
|
if (isRoot) {
|
|
9306
9403
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9307
9404
|
const fileContent2 = await readFileContent(
|
|
9308
|
-
|
|
9405
|
+
join77(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9309
9406
|
);
|
|
9310
9407
|
return new _CodexcliRule({
|
|
9311
9408
|
baseDir,
|
|
@@ -9319,8 +9416,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9319
9416
|
if (!paths.nonRoot) {
|
|
9320
9417
|
throw new Error("nonRoot path is not set");
|
|
9321
9418
|
}
|
|
9322
|
-
const relativePath =
|
|
9323
|
-
const fileContent = await readFileContent(
|
|
9419
|
+
const relativePath = join77(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9420
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9324
9421
|
return new _CodexcliRule({
|
|
9325
9422
|
baseDir,
|
|
9326
9423
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9379,7 +9476,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9379
9476
|
};
|
|
9380
9477
|
|
|
9381
9478
|
// src/features/rules/copilot-rule.ts
|
|
9382
|
-
import { join as
|
|
9479
|
+
import { join as join78 } from "path";
|
|
9383
9480
|
import { z as z39 } from "zod/mini";
|
|
9384
9481
|
var CopilotRuleFrontmatterSchema = z39.object({
|
|
9385
9482
|
description: z39.optional(z39.string()),
|
|
@@ -9396,7 +9493,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9396
9493
|
relativeFilePath: "copilot-instructions.md"
|
|
9397
9494
|
},
|
|
9398
9495
|
nonRoot: {
|
|
9399
|
-
relativeDirPath:
|
|
9496
|
+
relativeDirPath: join78(".github", "instructions")
|
|
9400
9497
|
}
|
|
9401
9498
|
};
|
|
9402
9499
|
}
|
|
@@ -9405,7 +9502,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9405
9502
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9406
9503
|
if (!result.success) {
|
|
9407
9504
|
throw new Error(
|
|
9408
|
-
`Invalid frontmatter in ${
|
|
9505
|
+
`Invalid frontmatter in ${join78(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9409
9506
|
);
|
|
9410
9507
|
}
|
|
9411
9508
|
}
|
|
@@ -9487,11 +9584,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9487
9584
|
validate = true
|
|
9488
9585
|
}) {
|
|
9489
9586
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9490
|
-
const relativePath = isRoot ?
|
|
9587
|
+
const relativePath = isRoot ? join78(
|
|
9491
9588
|
this.getSettablePaths().root.relativeDirPath,
|
|
9492
9589
|
this.getSettablePaths().root.relativeFilePath
|
|
9493
|
-
) :
|
|
9494
|
-
const fileContent = await readFileContent(
|
|
9590
|
+
) : join78(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9591
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9495
9592
|
if (isRoot) {
|
|
9496
9593
|
return new _CopilotRule({
|
|
9497
9594
|
baseDir,
|
|
@@ -9507,7 +9604,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9507
9604
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9508
9605
|
if (!result.success) {
|
|
9509
9606
|
throw new Error(
|
|
9510
|
-
`Invalid frontmatter in ${
|
|
9607
|
+
`Invalid frontmatter in ${join78(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9511
9608
|
);
|
|
9512
9609
|
}
|
|
9513
9610
|
return new _CopilotRule({
|
|
@@ -9547,7 +9644,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9547
9644
|
return {
|
|
9548
9645
|
success: false,
|
|
9549
9646
|
error: new Error(
|
|
9550
|
-
`Invalid frontmatter in ${
|
|
9647
|
+
`Invalid frontmatter in ${join78(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9551
9648
|
)
|
|
9552
9649
|
};
|
|
9553
9650
|
}
|
|
@@ -9567,7 +9664,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9567
9664
|
};
|
|
9568
9665
|
|
|
9569
9666
|
// src/features/rules/cursor-rule.ts
|
|
9570
|
-
import { basename as basename22, join as
|
|
9667
|
+
import { basename as basename22, join as join79 } from "path";
|
|
9571
9668
|
import { z as z40 } from "zod/mini";
|
|
9572
9669
|
var CursorRuleFrontmatterSchema = z40.object({
|
|
9573
9670
|
description: z40.optional(z40.string()),
|
|
@@ -9580,7 +9677,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9580
9677
|
static getSettablePaths() {
|
|
9581
9678
|
return {
|
|
9582
9679
|
nonRoot: {
|
|
9583
|
-
relativeDirPath:
|
|
9680
|
+
relativeDirPath: join79(".cursor", "rules")
|
|
9584
9681
|
}
|
|
9585
9682
|
};
|
|
9586
9683
|
}
|
|
@@ -9589,7 +9686,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9589
9686
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9590
9687
|
if (!result.success) {
|
|
9591
9688
|
throw new Error(
|
|
9592
|
-
`Invalid frontmatter in ${
|
|
9689
|
+
`Invalid frontmatter in ${join79(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9593
9690
|
);
|
|
9594
9691
|
}
|
|
9595
9692
|
}
|
|
@@ -9706,13 +9803,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9706
9803
|
validate = true
|
|
9707
9804
|
}) {
|
|
9708
9805
|
const fileContent = await readFileContent(
|
|
9709
|
-
|
|
9806
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9710
9807
|
);
|
|
9711
9808
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9712
9809
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9713
9810
|
if (!result.success) {
|
|
9714
9811
|
throw new Error(
|
|
9715
|
-
`Invalid frontmatter in ${
|
|
9812
|
+
`Invalid frontmatter in ${join79(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9716
9813
|
);
|
|
9717
9814
|
}
|
|
9718
9815
|
return new _CursorRule({
|
|
@@ -9749,7 +9846,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9749
9846
|
return {
|
|
9750
9847
|
success: false,
|
|
9751
9848
|
error: new Error(
|
|
9752
|
-
`Invalid frontmatter in ${
|
|
9849
|
+
`Invalid frontmatter in ${join79(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9753
9850
|
)
|
|
9754
9851
|
};
|
|
9755
9852
|
}
|
|
@@ -9769,7 +9866,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9769
9866
|
};
|
|
9770
9867
|
|
|
9771
9868
|
// src/features/rules/geminicli-rule.ts
|
|
9772
|
-
import { join as
|
|
9869
|
+
import { join as join80 } from "path";
|
|
9773
9870
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9774
9871
|
static getSettablePaths({
|
|
9775
9872
|
global
|
|
@@ -9788,7 +9885,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9788
9885
|
relativeFilePath: "GEMINI.md"
|
|
9789
9886
|
},
|
|
9790
9887
|
nonRoot: {
|
|
9791
|
-
relativeDirPath:
|
|
9888
|
+
relativeDirPath: join80(".gemini", "memories")
|
|
9792
9889
|
}
|
|
9793
9890
|
};
|
|
9794
9891
|
}
|
|
@@ -9803,7 +9900,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9803
9900
|
if (isRoot) {
|
|
9804
9901
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9805
9902
|
const fileContent2 = await readFileContent(
|
|
9806
|
-
|
|
9903
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9807
9904
|
);
|
|
9808
9905
|
return new _GeminiCliRule({
|
|
9809
9906
|
baseDir,
|
|
@@ -9817,8 +9914,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9817
9914
|
if (!paths.nonRoot) {
|
|
9818
9915
|
throw new Error("nonRoot path is not set");
|
|
9819
9916
|
}
|
|
9820
|
-
const relativePath =
|
|
9821
|
-
const fileContent = await readFileContent(
|
|
9917
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9918
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9822
9919
|
return new _GeminiCliRule({
|
|
9823
9920
|
baseDir,
|
|
9824
9921
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9877,7 +9974,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9877
9974
|
};
|
|
9878
9975
|
|
|
9879
9976
|
// src/features/rules/junie-rule.ts
|
|
9880
|
-
import { join as
|
|
9977
|
+
import { join as join81 } from "path";
|
|
9881
9978
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9882
9979
|
static getSettablePaths() {
|
|
9883
9980
|
return {
|
|
@@ -9886,7 +9983,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9886
9983
|
relativeFilePath: "guidelines.md"
|
|
9887
9984
|
},
|
|
9888
9985
|
nonRoot: {
|
|
9889
|
-
relativeDirPath:
|
|
9986
|
+
relativeDirPath: join81(".junie", "memories")
|
|
9890
9987
|
}
|
|
9891
9988
|
};
|
|
9892
9989
|
}
|
|
@@ -9896,8 +9993,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9896
9993
|
validate = true
|
|
9897
9994
|
}) {
|
|
9898
9995
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9899
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
9900
|
-
const fileContent = await readFileContent(
|
|
9996
|
+
const relativePath = isRoot ? "guidelines.md" : join81(".junie", "memories", relativeFilePath);
|
|
9997
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9901
9998
|
return new _JunieRule({
|
|
9902
9999
|
baseDir,
|
|
9903
10000
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9952,12 +10049,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9952
10049
|
};
|
|
9953
10050
|
|
|
9954
10051
|
// src/features/rules/kilo-rule.ts
|
|
9955
|
-
import { join as
|
|
10052
|
+
import { join as join82 } from "path";
|
|
9956
10053
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
9957
10054
|
static getSettablePaths(_options = {}) {
|
|
9958
10055
|
return {
|
|
9959
10056
|
nonRoot: {
|
|
9960
|
-
relativeDirPath:
|
|
10057
|
+
relativeDirPath: join82(".kilocode", "rules")
|
|
9961
10058
|
}
|
|
9962
10059
|
};
|
|
9963
10060
|
}
|
|
@@ -9967,7 +10064,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
9967
10064
|
validate = true
|
|
9968
10065
|
}) {
|
|
9969
10066
|
const fileContent = await readFileContent(
|
|
9970
|
-
|
|
10067
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9971
10068
|
);
|
|
9972
10069
|
return new _KiloRule({
|
|
9973
10070
|
baseDir,
|
|
@@ -10019,12 +10116,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10019
10116
|
};
|
|
10020
10117
|
|
|
10021
10118
|
// src/features/rules/kiro-rule.ts
|
|
10022
|
-
import { join as
|
|
10119
|
+
import { join as join83 } from "path";
|
|
10023
10120
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10024
10121
|
static getSettablePaths() {
|
|
10025
10122
|
return {
|
|
10026
10123
|
nonRoot: {
|
|
10027
|
-
relativeDirPath:
|
|
10124
|
+
relativeDirPath: join83(".kiro", "steering")
|
|
10028
10125
|
}
|
|
10029
10126
|
};
|
|
10030
10127
|
}
|
|
@@ -10034,7 +10131,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10034
10131
|
validate = true
|
|
10035
10132
|
}) {
|
|
10036
10133
|
const fileContent = await readFileContent(
|
|
10037
|
-
|
|
10134
|
+
join83(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10038
10135
|
);
|
|
10039
10136
|
return new _KiroRule({
|
|
10040
10137
|
baseDir,
|
|
@@ -10088,7 +10185,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10088
10185
|
};
|
|
10089
10186
|
|
|
10090
10187
|
// src/features/rules/opencode-rule.ts
|
|
10091
|
-
import { join as
|
|
10188
|
+
import { join as join84 } from "path";
|
|
10092
10189
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10093
10190
|
static getSettablePaths() {
|
|
10094
10191
|
return {
|
|
@@ -10097,7 +10194,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10097
10194
|
relativeFilePath: "AGENTS.md"
|
|
10098
10195
|
},
|
|
10099
10196
|
nonRoot: {
|
|
10100
|
-
relativeDirPath:
|
|
10197
|
+
relativeDirPath: join84(".opencode", "memories")
|
|
10101
10198
|
}
|
|
10102
10199
|
};
|
|
10103
10200
|
}
|
|
@@ -10107,8 +10204,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10107
10204
|
validate = true
|
|
10108
10205
|
}) {
|
|
10109
10206
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10110
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10111
|
-
const fileContent = await readFileContent(
|
|
10207
|
+
const relativePath = isRoot ? "AGENTS.md" : join84(".opencode", "memories", relativeFilePath);
|
|
10208
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10112
10209
|
return new _OpenCodeRule({
|
|
10113
10210
|
baseDir,
|
|
10114
10211
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10163,7 +10260,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10163
10260
|
};
|
|
10164
10261
|
|
|
10165
10262
|
// src/features/rules/qwencode-rule.ts
|
|
10166
|
-
import { join as
|
|
10263
|
+
import { join as join85 } from "path";
|
|
10167
10264
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10168
10265
|
static getSettablePaths() {
|
|
10169
10266
|
return {
|
|
@@ -10172,7 +10269,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10172
10269
|
relativeFilePath: "QWEN.md"
|
|
10173
10270
|
},
|
|
10174
10271
|
nonRoot: {
|
|
10175
|
-
relativeDirPath:
|
|
10272
|
+
relativeDirPath: join85(".qwen", "memories")
|
|
10176
10273
|
}
|
|
10177
10274
|
};
|
|
10178
10275
|
}
|
|
@@ -10182,8 +10279,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10182
10279
|
validate = true
|
|
10183
10280
|
}) {
|
|
10184
10281
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10185
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10186
|
-
const fileContent = await readFileContent(
|
|
10282
|
+
const relativePath = isRoot ? "QWEN.md" : join85(".qwen", "memories", relativeFilePath);
|
|
10283
|
+
const fileContent = await readFileContent(join85(baseDir, relativePath));
|
|
10187
10284
|
return new _QwencodeRule({
|
|
10188
10285
|
baseDir,
|
|
10189
10286
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10235,12 +10332,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10235
10332
|
};
|
|
10236
10333
|
|
|
10237
10334
|
// src/features/rules/roo-rule.ts
|
|
10238
|
-
import { join as
|
|
10335
|
+
import { join as join86 } from "path";
|
|
10239
10336
|
var RooRule = class _RooRule extends ToolRule {
|
|
10240
10337
|
static getSettablePaths() {
|
|
10241
10338
|
return {
|
|
10242
10339
|
nonRoot: {
|
|
10243
|
-
relativeDirPath:
|
|
10340
|
+
relativeDirPath: join86(".roo", "rules")
|
|
10244
10341
|
}
|
|
10245
10342
|
};
|
|
10246
10343
|
}
|
|
@@ -10250,7 +10347,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10250
10347
|
validate = true
|
|
10251
10348
|
}) {
|
|
10252
10349
|
const fileContent = await readFileContent(
|
|
10253
|
-
|
|
10350
|
+
join86(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10254
10351
|
);
|
|
10255
10352
|
return new _RooRule({
|
|
10256
10353
|
baseDir,
|
|
@@ -10319,7 +10416,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10319
10416
|
};
|
|
10320
10417
|
|
|
10321
10418
|
// src/features/rules/warp-rule.ts
|
|
10322
|
-
import { join as
|
|
10419
|
+
import { join as join87 } from "path";
|
|
10323
10420
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10324
10421
|
constructor({ fileContent, root, ...rest }) {
|
|
10325
10422
|
super({
|
|
@@ -10335,7 +10432,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10335
10432
|
relativeFilePath: "WARP.md"
|
|
10336
10433
|
},
|
|
10337
10434
|
nonRoot: {
|
|
10338
|
-
relativeDirPath:
|
|
10435
|
+
relativeDirPath: join87(".warp", "memories")
|
|
10339
10436
|
}
|
|
10340
10437
|
};
|
|
10341
10438
|
}
|
|
@@ -10345,8 +10442,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10345
10442
|
validate = true
|
|
10346
10443
|
}) {
|
|
10347
10444
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10348
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
10349
|
-
const fileContent = await readFileContent(
|
|
10445
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join87(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10446
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10350
10447
|
return new _WarpRule({
|
|
10351
10448
|
baseDir,
|
|
10352
10449
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10401,12 +10498,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10401
10498
|
};
|
|
10402
10499
|
|
|
10403
10500
|
// src/features/rules/windsurf-rule.ts
|
|
10404
|
-
import { join as
|
|
10501
|
+
import { join as join88 } from "path";
|
|
10405
10502
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10406
10503
|
static getSettablePaths() {
|
|
10407
10504
|
return {
|
|
10408
10505
|
nonRoot: {
|
|
10409
|
-
relativeDirPath:
|
|
10506
|
+
relativeDirPath: join88(".windsurf", "rules")
|
|
10410
10507
|
}
|
|
10411
10508
|
};
|
|
10412
10509
|
}
|
|
@@ -10416,7 +10513,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10416
10513
|
validate = true
|
|
10417
10514
|
}) {
|
|
10418
10515
|
const fileContent = await readFileContent(
|
|
10419
|
-
|
|
10516
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10420
10517
|
);
|
|
10421
10518
|
return new _WindsurfRule({
|
|
10422
10519
|
baseDir,
|
|
@@ -10773,7 +10870,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10773
10870
|
}).relativeDirPath;
|
|
10774
10871
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10775
10872
|
const frontmatter = skill.getFrontmatter();
|
|
10776
|
-
const relativePath =
|
|
10873
|
+
const relativePath = join89(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10777
10874
|
return {
|
|
10778
10875
|
name: frontmatter.name,
|
|
10779
10876
|
description: frontmatter.description,
|
|
@@ -10840,7 +10937,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10840
10937
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10841
10938
|
*/
|
|
10842
10939
|
async loadRulesyncFiles() {
|
|
10843
|
-
const files = await findFilesByGlobs(
|
|
10940
|
+
const files = await findFilesByGlobs(join89(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10844
10941
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10845
10942
|
const rulesyncRules = await Promise.all(
|
|
10846
10943
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename23(file) }))
|
|
@@ -10861,7 +10958,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10861
10958
|
return rulesyncRules;
|
|
10862
10959
|
}
|
|
10863
10960
|
async loadRulesyncFilesLegacy() {
|
|
10864
|
-
const legacyFiles = await findFilesByGlobs(
|
|
10961
|
+
const legacyFiles = await findFilesByGlobs(join89(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10865
10962
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10866
10963
|
return Promise.all(
|
|
10867
10964
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename23(file) }))
|
|
@@ -10882,7 +10979,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10882
10979
|
return [];
|
|
10883
10980
|
}
|
|
10884
10981
|
const rootFilePaths = await findFilesByGlobs(
|
|
10885
|
-
|
|
10982
|
+
join89(
|
|
10886
10983
|
this.baseDir,
|
|
10887
10984
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10888
10985
|
settablePaths.root.relativeFilePath
|
|
@@ -10914,7 +11011,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10914
11011
|
return [];
|
|
10915
11012
|
}
|
|
10916
11013
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
10917
|
-
|
|
11014
|
+
join89(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
10918
11015
|
);
|
|
10919
11016
|
if (forDeletion) {
|
|
10920
11017
|
return nonRootFilePaths.map(
|
|
@@ -11023,14 +11120,14 @@ s/<command> [arguments]
|
|
|
11023
11120
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11024
11121
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11025
11122
|
|
|
11026
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
11123
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join89(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11027
11124
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11028
11125
|
|
|
11029
11126
|
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.
|
|
11030
11127
|
|
|
11031
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
11128
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11032
11129
|
|
|
11033
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
11130
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join89(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11034
11131
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11035
11132
|
const result = [
|
|
11036
11133
|
overview,
|
|
@@ -11312,7 +11409,7 @@ async function generateSkills(config) {
|
|
|
11312
11409
|
}
|
|
11313
11410
|
|
|
11314
11411
|
// src/cli/commands/gitignore.ts
|
|
11315
|
-
import { join as
|
|
11412
|
+
import { join as join90 } from "path";
|
|
11316
11413
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11317
11414
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11318
11415
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11443,7 +11540,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11443
11540
|
return result;
|
|
11444
11541
|
};
|
|
11445
11542
|
var gitignoreCommand = async () => {
|
|
11446
|
-
const gitignorePath =
|
|
11543
|
+
const gitignorePath = join90(process.cwd(), ".gitignore");
|
|
11447
11544
|
let gitignoreContent = "";
|
|
11448
11545
|
if (await fileExists(gitignorePath)) {
|
|
11449
11546
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11642,7 +11739,7 @@ async function importSkills(config, tool) {
|
|
|
11642
11739
|
}
|
|
11643
11740
|
|
|
11644
11741
|
// src/cli/commands/init.ts
|
|
11645
|
-
import { join as
|
|
11742
|
+
import { join as join91 } from "path";
|
|
11646
11743
|
async function initCommand() {
|
|
11647
11744
|
logger.info("Initializing rulesync...");
|
|
11648
11745
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11805,14 +11902,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11805
11902
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11806
11903
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
11807
11904
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11808
|
-
const ruleFilepath =
|
|
11905
|
+
const ruleFilepath = join91(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11809
11906
|
if (!await fileExists(ruleFilepath)) {
|
|
11810
11907
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11811
11908
|
logger.success(`Created ${ruleFilepath}`);
|
|
11812
11909
|
} else {
|
|
11813
11910
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11814
11911
|
}
|
|
11815
|
-
const mcpFilepath =
|
|
11912
|
+
const mcpFilepath = join91(
|
|
11816
11913
|
mcpPaths.recommended.relativeDirPath,
|
|
11817
11914
|
mcpPaths.recommended.relativeFilePath
|
|
11818
11915
|
);
|
|
@@ -11822,21 +11919,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11822
11919
|
} else {
|
|
11823
11920
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11824
11921
|
}
|
|
11825
|
-
const commandFilepath =
|
|
11922
|
+
const commandFilepath = join91(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11826
11923
|
if (!await fileExists(commandFilepath)) {
|
|
11827
11924
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11828
11925
|
logger.success(`Created ${commandFilepath}`);
|
|
11829
11926
|
} else {
|
|
11830
11927
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11831
11928
|
}
|
|
11832
|
-
const subagentFilepath =
|
|
11929
|
+
const subagentFilepath = join91(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11833
11930
|
if (!await fileExists(subagentFilepath)) {
|
|
11834
11931
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11835
11932
|
logger.success(`Created ${subagentFilepath}`);
|
|
11836
11933
|
} else {
|
|
11837
11934
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11838
11935
|
}
|
|
11839
|
-
const ignoreFilepath =
|
|
11936
|
+
const ignoreFilepath = join91(
|
|
11840
11937
|
ignorePaths.recommended.relativeDirPath,
|
|
11841
11938
|
ignorePaths.recommended.relativeFilePath
|
|
11842
11939
|
);
|
|
@@ -11855,12 +11952,12 @@ import { FastMCP } from "fastmcp";
|
|
|
11855
11952
|
import { z as z48 } from "zod/mini";
|
|
11856
11953
|
|
|
11857
11954
|
// src/mcp/commands.ts
|
|
11858
|
-
import { basename as basename24, join as
|
|
11955
|
+
import { basename as basename24, join as join92 } from "path";
|
|
11859
11956
|
import { z as z42 } from "zod/mini";
|
|
11860
11957
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11861
11958
|
var maxCommandsCount = 1e3;
|
|
11862
11959
|
async function listCommands() {
|
|
11863
|
-
const commandsDir =
|
|
11960
|
+
const commandsDir = join92(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11864
11961
|
try {
|
|
11865
11962
|
const files = await listDirectoryFiles(commandsDir);
|
|
11866
11963
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11872,7 +11969,7 @@ async function listCommands() {
|
|
|
11872
11969
|
});
|
|
11873
11970
|
const frontmatter = command.getFrontmatter();
|
|
11874
11971
|
return {
|
|
11875
|
-
relativePathFromCwd:
|
|
11972
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11876
11973
|
frontmatter
|
|
11877
11974
|
};
|
|
11878
11975
|
} catch (error) {
|
|
@@ -11898,7 +11995,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11898
11995
|
relativeFilePath: filename
|
|
11899
11996
|
});
|
|
11900
11997
|
return {
|
|
11901
|
-
relativePathFromCwd:
|
|
11998
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11902
11999
|
frontmatter: command.getFrontmatter(),
|
|
11903
12000
|
body: command.getBody()
|
|
11904
12001
|
};
|
|
@@ -11927,7 +12024,7 @@ async function putCommand({
|
|
|
11927
12024
|
try {
|
|
11928
12025
|
const existingCommands = await listCommands();
|
|
11929
12026
|
const isUpdate = existingCommands.some(
|
|
11930
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12027
|
+
(command2) => command2.relativePathFromCwd === join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11931
12028
|
);
|
|
11932
12029
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
11933
12030
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -11942,11 +12039,11 @@ async function putCommand({
|
|
|
11942
12039
|
fileContent,
|
|
11943
12040
|
validate: true
|
|
11944
12041
|
});
|
|
11945
|
-
const commandsDir =
|
|
12042
|
+
const commandsDir = join92(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11946
12043
|
await ensureDir(commandsDir);
|
|
11947
12044
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
11948
12045
|
return {
|
|
11949
|
-
relativePathFromCwd:
|
|
12046
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11950
12047
|
frontmatter: command.getFrontmatter(),
|
|
11951
12048
|
body: command.getBody()
|
|
11952
12049
|
};
|
|
@@ -11962,11 +12059,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11962
12059
|
intendedRootDir: process.cwd()
|
|
11963
12060
|
});
|
|
11964
12061
|
const filename = basename24(relativePathFromCwd);
|
|
11965
|
-
const fullPath =
|
|
12062
|
+
const fullPath = join92(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
11966
12063
|
try {
|
|
11967
12064
|
await removeFile(fullPath);
|
|
11968
12065
|
return {
|
|
11969
|
-
relativePathFromCwd:
|
|
12066
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11970
12067
|
};
|
|
11971
12068
|
} catch (error) {
|
|
11972
12069
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11991,7 +12088,7 @@ var commandToolSchemas = {
|
|
|
11991
12088
|
var commandTools = {
|
|
11992
12089
|
listCommands: {
|
|
11993
12090
|
name: "listCommands",
|
|
11994
|
-
description: `List all commands from ${
|
|
12091
|
+
description: `List all commands from ${join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11995
12092
|
parameters: commandToolSchemas.listCommands,
|
|
11996
12093
|
execute: async () => {
|
|
11997
12094
|
const commands = await listCommands();
|
|
@@ -12033,11 +12130,11 @@ var commandTools = {
|
|
|
12033
12130
|
};
|
|
12034
12131
|
|
|
12035
12132
|
// src/mcp/ignore.ts
|
|
12036
|
-
import { join as
|
|
12133
|
+
import { join as join93 } from "path";
|
|
12037
12134
|
import { z as z43 } from "zod/mini";
|
|
12038
12135
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12039
12136
|
async function getIgnoreFile() {
|
|
12040
|
-
const ignoreFilePath =
|
|
12137
|
+
const ignoreFilePath = join93(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12041
12138
|
try {
|
|
12042
12139
|
const content = await readFileContent(ignoreFilePath);
|
|
12043
12140
|
return {
|
|
@@ -12051,7 +12148,7 @@ async function getIgnoreFile() {
|
|
|
12051
12148
|
}
|
|
12052
12149
|
}
|
|
12053
12150
|
async function putIgnoreFile({ content }) {
|
|
12054
|
-
const ignoreFilePath =
|
|
12151
|
+
const ignoreFilePath = join93(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12055
12152
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12056
12153
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12057
12154
|
throw new Error(
|
|
@@ -12072,8 +12169,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12072
12169
|
}
|
|
12073
12170
|
}
|
|
12074
12171
|
async function deleteIgnoreFile() {
|
|
12075
|
-
const aiignorePath =
|
|
12076
|
-
const legacyIgnorePath =
|
|
12172
|
+
const aiignorePath = join93(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12173
|
+
const legacyIgnorePath = join93(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12077
12174
|
try {
|
|
12078
12175
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12079
12176
|
return {
|
|
@@ -12128,7 +12225,7 @@ var ignoreTools = {
|
|
|
12128
12225
|
};
|
|
12129
12226
|
|
|
12130
12227
|
// src/mcp/mcp.ts
|
|
12131
|
-
import { join as
|
|
12228
|
+
import { join as join94 } from "path";
|
|
12132
12229
|
import { z as z44 } from "zod/mini";
|
|
12133
12230
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12134
12231
|
async function getMcpFile() {
|
|
@@ -12138,7 +12235,7 @@ async function getMcpFile() {
|
|
|
12138
12235
|
validate: true,
|
|
12139
12236
|
modularMcp: config.getModularMcp()
|
|
12140
12237
|
});
|
|
12141
|
-
const relativePathFromCwd =
|
|
12238
|
+
const relativePathFromCwd = join94(
|
|
12142
12239
|
rulesyncMcp.getRelativeDirPath(),
|
|
12143
12240
|
rulesyncMcp.getRelativeFilePath()
|
|
12144
12241
|
);
|
|
@@ -12171,7 +12268,7 @@ async function putMcpFile({ content }) {
|
|
|
12171
12268
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12172
12269
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12173
12270
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12174
|
-
const fullPath =
|
|
12271
|
+
const fullPath = join94(baseDir, relativeDirPath, relativeFilePath);
|
|
12175
12272
|
const rulesyncMcp = new RulesyncMcp({
|
|
12176
12273
|
baseDir,
|
|
12177
12274
|
relativeDirPath,
|
|
@@ -12180,9 +12277,9 @@ async function putMcpFile({ content }) {
|
|
|
12180
12277
|
validate: true,
|
|
12181
12278
|
modularMcp: config.getModularMcp()
|
|
12182
12279
|
});
|
|
12183
|
-
await ensureDir(
|
|
12280
|
+
await ensureDir(join94(baseDir, relativeDirPath));
|
|
12184
12281
|
await writeFileContent(fullPath, content);
|
|
12185
|
-
const relativePathFromCwd =
|
|
12282
|
+
const relativePathFromCwd = join94(relativeDirPath, relativeFilePath);
|
|
12186
12283
|
return {
|
|
12187
12284
|
relativePathFromCwd,
|
|
12188
12285
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12197,15 +12294,15 @@ async function deleteMcpFile() {
|
|
|
12197
12294
|
try {
|
|
12198
12295
|
const baseDir = process.cwd();
|
|
12199
12296
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12200
|
-
const recommendedPath =
|
|
12297
|
+
const recommendedPath = join94(
|
|
12201
12298
|
baseDir,
|
|
12202
12299
|
paths.recommended.relativeDirPath,
|
|
12203
12300
|
paths.recommended.relativeFilePath
|
|
12204
12301
|
);
|
|
12205
|
-
const legacyPath =
|
|
12302
|
+
const legacyPath = join94(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12206
12303
|
await removeFile(recommendedPath);
|
|
12207
12304
|
await removeFile(legacyPath);
|
|
12208
|
-
const relativePathFromCwd =
|
|
12305
|
+
const relativePathFromCwd = join94(
|
|
12209
12306
|
paths.recommended.relativeDirPath,
|
|
12210
12307
|
paths.recommended.relativeFilePath
|
|
12211
12308
|
);
|
|
@@ -12256,12 +12353,12 @@ var mcpTools = {
|
|
|
12256
12353
|
};
|
|
12257
12354
|
|
|
12258
12355
|
// src/mcp/rules.ts
|
|
12259
|
-
import { basename as basename25, join as
|
|
12356
|
+
import { basename as basename25, join as join95 } from "path";
|
|
12260
12357
|
import { z as z45 } from "zod/mini";
|
|
12261
12358
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12262
12359
|
var maxRulesCount = 1e3;
|
|
12263
12360
|
async function listRules() {
|
|
12264
|
-
const rulesDir =
|
|
12361
|
+
const rulesDir = join95(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12265
12362
|
try {
|
|
12266
12363
|
const files = await listDirectoryFiles(rulesDir);
|
|
12267
12364
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12274,7 +12371,7 @@ async function listRules() {
|
|
|
12274
12371
|
});
|
|
12275
12372
|
const frontmatter = rule.getFrontmatter();
|
|
12276
12373
|
return {
|
|
12277
|
-
relativePathFromCwd:
|
|
12374
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12278
12375
|
frontmatter
|
|
12279
12376
|
};
|
|
12280
12377
|
} catch (error) {
|
|
@@ -12301,7 +12398,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12301
12398
|
validate: true
|
|
12302
12399
|
});
|
|
12303
12400
|
return {
|
|
12304
|
-
relativePathFromCwd:
|
|
12401
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12305
12402
|
frontmatter: rule.getFrontmatter(),
|
|
12306
12403
|
body: rule.getBody()
|
|
12307
12404
|
};
|
|
@@ -12330,7 +12427,7 @@ async function putRule({
|
|
|
12330
12427
|
try {
|
|
12331
12428
|
const existingRules = await listRules();
|
|
12332
12429
|
const isUpdate = existingRules.some(
|
|
12333
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
12430
|
+
(rule2) => rule2.relativePathFromCwd === join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12334
12431
|
);
|
|
12335
12432
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12336
12433
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12343,11 +12440,11 @@ async function putRule({
|
|
|
12343
12440
|
body,
|
|
12344
12441
|
validate: true
|
|
12345
12442
|
});
|
|
12346
|
-
const rulesDir =
|
|
12443
|
+
const rulesDir = join95(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12347
12444
|
await ensureDir(rulesDir);
|
|
12348
12445
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12349
12446
|
return {
|
|
12350
|
-
relativePathFromCwd:
|
|
12447
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12351
12448
|
frontmatter: rule.getFrontmatter(),
|
|
12352
12449
|
body: rule.getBody()
|
|
12353
12450
|
};
|
|
@@ -12363,11 +12460,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12363
12460
|
intendedRootDir: process.cwd()
|
|
12364
12461
|
});
|
|
12365
12462
|
const filename = basename25(relativePathFromCwd);
|
|
12366
|
-
const fullPath =
|
|
12463
|
+
const fullPath = join95(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12367
12464
|
try {
|
|
12368
12465
|
await removeFile(fullPath);
|
|
12369
12466
|
return {
|
|
12370
|
-
relativePathFromCwd:
|
|
12467
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12371
12468
|
};
|
|
12372
12469
|
} catch (error) {
|
|
12373
12470
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12392,7 +12489,7 @@ var ruleToolSchemas = {
|
|
|
12392
12489
|
var ruleTools = {
|
|
12393
12490
|
listRules: {
|
|
12394
12491
|
name: "listRules",
|
|
12395
|
-
description: `List all rules from ${
|
|
12492
|
+
description: `List all rules from ${join95(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12396
12493
|
parameters: ruleToolSchemas.listRules,
|
|
12397
12494
|
execute: async () => {
|
|
12398
12495
|
const rules = await listRules();
|
|
@@ -12434,7 +12531,7 @@ var ruleTools = {
|
|
|
12434
12531
|
};
|
|
12435
12532
|
|
|
12436
12533
|
// src/mcp/skills.ts
|
|
12437
|
-
import { basename as basename26, dirname as dirname2, join as
|
|
12534
|
+
import { basename as basename26, dirname as dirname2, join as join96 } from "path";
|
|
12438
12535
|
import { z as z46 } from "zod/mini";
|
|
12439
12536
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12440
12537
|
var maxSkillsCount = 1e3;
|
|
@@ -12458,9 +12555,9 @@ function extractDirName(relativeDirPathFromCwd) {
|
|
|
12458
12555
|
return dirName;
|
|
12459
12556
|
}
|
|
12460
12557
|
async function listSkills() {
|
|
12461
|
-
const skillsDir =
|
|
12558
|
+
const skillsDir = join96(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12462
12559
|
try {
|
|
12463
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
12560
|
+
const skillDirPaths = await findFilesByGlobs(join96(skillsDir, "*"), { type: "dir" });
|
|
12464
12561
|
const skills = await Promise.all(
|
|
12465
12562
|
skillDirPaths.map(async (dirPath) => {
|
|
12466
12563
|
const dirName = basename26(dirPath);
|
|
@@ -12471,7 +12568,7 @@ async function listSkills() {
|
|
|
12471
12568
|
});
|
|
12472
12569
|
const frontmatter = skill.getFrontmatter();
|
|
12473
12570
|
return {
|
|
12474
|
-
relativeDirPathFromCwd:
|
|
12571
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12475
12572
|
frontmatter
|
|
12476
12573
|
};
|
|
12477
12574
|
} catch (error) {
|
|
@@ -12497,7 +12594,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12497
12594
|
dirName
|
|
12498
12595
|
});
|
|
12499
12596
|
return {
|
|
12500
|
-
relativeDirPathFromCwd:
|
|
12597
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12501
12598
|
frontmatter: skill.getFrontmatter(),
|
|
12502
12599
|
body: skill.getBody(),
|
|
12503
12600
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12531,7 +12628,7 @@ async function putSkill({
|
|
|
12531
12628
|
try {
|
|
12532
12629
|
const existingSkills = await listSkills();
|
|
12533
12630
|
const isUpdate = existingSkills.some(
|
|
12534
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
12631
|
+
(skill2) => skill2.relativeDirPathFromCwd === join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12535
12632
|
);
|
|
12536
12633
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12537
12634
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12546,9 +12643,9 @@ async function putSkill({
|
|
|
12546
12643
|
otherFiles: aiDirFiles,
|
|
12547
12644
|
validate: true
|
|
12548
12645
|
});
|
|
12549
|
-
const skillDirPath =
|
|
12646
|
+
const skillDirPath = join96(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12550
12647
|
await ensureDir(skillDirPath);
|
|
12551
|
-
const skillFilePath =
|
|
12648
|
+
const skillFilePath = join96(skillDirPath, SKILL_FILE_NAME);
|
|
12552
12649
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12553
12650
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12554
12651
|
for (const file of otherFiles) {
|
|
@@ -12556,15 +12653,15 @@ async function putSkill({
|
|
|
12556
12653
|
relativePath: file.name,
|
|
12557
12654
|
intendedRootDir: skillDirPath
|
|
12558
12655
|
});
|
|
12559
|
-
const filePath =
|
|
12560
|
-
const fileDir =
|
|
12656
|
+
const filePath = join96(skillDirPath, file.name);
|
|
12657
|
+
const fileDir = join96(skillDirPath, dirname2(file.name));
|
|
12561
12658
|
if (fileDir !== skillDirPath) {
|
|
12562
12659
|
await ensureDir(fileDir);
|
|
12563
12660
|
}
|
|
12564
12661
|
await writeFileContent(filePath, file.body);
|
|
12565
12662
|
}
|
|
12566
12663
|
return {
|
|
12567
|
-
relativeDirPathFromCwd:
|
|
12664
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12568
12665
|
frontmatter: skill.getFrontmatter(),
|
|
12569
12666
|
body: skill.getBody(),
|
|
12570
12667
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12586,13 +12683,13 @@ async function deleteSkill({
|
|
|
12586
12683
|
intendedRootDir: process.cwd()
|
|
12587
12684
|
});
|
|
12588
12685
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12589
|
-
const skillDirPath =
|
|
12686
|
+
const skillDirPath = join96(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12590
12687
|
try {
|
|
12591
12688
|
if (await directoryExists(skillDirPath)) {
|
|
12592
12689
|
await removeDirectory(skillDirPath);
|
|
12593
12690
|
}
|
|
12594
12691
|
return {
|
|
12595
|
-
relativeDirPathFromCwd:
|
|
12692
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12596
12693
|
};
|
|
12597
12694
|
} catch (error) {
|
|
12598
12695
|
throw new Error(
|
|
@@ -12625,7 +12722,7 @@ var skillToolSchemas = {
|
|
|
12625
12722
|
var skillTools = {
|
|
12626
12723
|
listSkills: {
|
|
12627
12724
|
name: "listSkills",
|
|
12628
|
-
description: `List all skills from ${
|
|
12725
|
+
description: `List all skills from ${join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12629
12726
|
parameters: skillToolSchemas.listSkills,
|
|
12630
12727
|
execute: async () => {
|
|
12631
12728
|
const skills = await listSkills();
|
|
@@ -12668,12 +12765,12 @@ var skillTools = {
|
|
|
12668
12765
|
};
|
|
12669
12766
|
|
|
12670
12767
|
// src/mcp/subagents.ts
|
|
12671
|
-
import { basename as basename27, join as
|
|
12768
|
+
import { basename as basename27, join as join97 } from "path";
|
|
12672
12769
|
import { z as z47 } from "zod/mini";
|
|
12673
12770
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12674
12771
|
var maxSubagentsCount = 1e3;
|
|
12675
12772
|
async function listSubagents() {
|
|
12676
|
-
const subagentsDir =
|
|
12773
|
+
const subagentsDir = join97(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12677
12774
|
try {
|
|
12678
12775
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12679
12776
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12686,7 +12783,7 @@ async function listSubagents() {
|
|
|
12686
12783
|
});
|
|
12687
12784
|
const frontmatter = subagent.getFrontmatter();
|
|
12688
12785
|
return {
|
|
12689
|
-
relativePathFromCwd:
|
|
12786
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12690
12787
|
frontmatter
|
|
12691
12788
|
};
|
|
12692
12789
|
} catch (error) {
|
|
@@ -12715,7 +12812,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12715
12812
|
validate: true
|
|
12716
12813
|
});
|
|
12717
12814
|
return {
|
|
12718
|
-
relativePathFromCwd:
|
|
12815
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12719
12816
|
frontmatter: subagent.getFrontmatter(),
|
|
12720
12817
|
body: subagent.getBody()
|
|
12721
12818
|
};
|
|
@@ -12744,7 +12841,7 @@ async function putSubagent({
|
|
|
12744
12841
|
try {
|
|
12745
12842
|
const existingSubagents = await listSubagents();
|
|
12746
12843
|
const isUpdate = existingSubagents.some(
|
|
12747
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
12844
|
+
(subagent2) => subagent2.relativePathFromCwd === join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12748
12845
|
);
|
|
12749
12846
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12750
12847
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12757,11 +12854,11 @@ async function putSubagent({
|
|
|
12757
12854
|
body,
|
|
12758
12855
|
validate: true
|
|
12759
12856
|
});
|
|
12760
|
-
const subagentsDir =
|
|
12857
|
+
const subagentsDir = join97(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12761
12858
|
await ensureDir(subagentsDir);
|
|
12762
12859
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12763
12860
|
return {
|
|
12764
|
-
relativePathFromCwd:
|
|
12861
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12765
12862
|
frontmatter: subagent.getFrontmatter(),
|
|
12766
12863
|
body: subagent.getBody()
|
|
12767
12864
|
};
|
|
@@ -12777,11 +12874,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12777
12874
|
intendedRootDir: process.cwd()
|
|
12778
12875
|
});
|
|
12779
12876
|
const filename = basename27(relativePathFromCwd);
|
|
12780
|
-
const fullPath =
|
|
12877
|
+
const fullPath = join97(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12781
12878
|
try {
|
|
12782
12879
|
await removeFile(fullPath);
|
|
12783
12880
|
return {
|
|
12784
|
-
relativePathFromCwd:
|
|
12881
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12785
12882
|
};
|
|
12786
12883
|
} catch (error) {
|
|
12787
12884
|
throw new Error(
|
|
@@ -12809,7 +12906,7 @@ var subagentToolSchemas = {
|
|
|
12809
12906
|
var subagentTools = {
|
|
12810
12907
|
listSubagents: {
|
|
12811
12908
|
name: "listSubagents",
|
|
12812
|
-
description: `List all subagents from ${
|
|
12909
|
+
description: `List all subagents from ${join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12813
12910
|
parameters: subagentToolSchemas.listSubagents,
|
|
12814
12911
|
execute: async () => {
|
|
12815
12912
|
const subagents = await listSubagents();
|
|
@@ -13060,7 +13157,7 @@ async function mcpCommand({ version }) {
|
|
|
13060
13157
|
}
|
|
13061
13158
|
|
|
13062
13159
|
// src/cli/index.ts
|
|
13063
|
-
var getVersion = () => "5.
|
|
13160
|
+
var getVersion = () => "5.2.0";
|
|
13064
13161
|
var main = async () => {
|
|
13065
13162
|
const program = new Command();
|
|
13066
13163
|
const version = getVersion();
|