rulesync 5.1.1 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -95
- package/dist/index.cjs +454 -356
- package/dist/index.js +410 -312
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -82,15 +82,15 @@ var logger = new Logger();
|
|
|
82
82
|
import { intersection } from "es-toolkit";
|
|
83
83
|
|
|
84
84
|
// src/config/config-resolver.ts
|
|
85
|
-
import { resolve as resolve2 } from "path";
|
|
86
85
|
import { parse as parseJsonc } from "jsonc-parser";
|
|
86
|
+
import { resolve as resolve2 } from "path";
|
|
87
87
|
|
|
88
88
|
// src/utils/file.ts
|
|
89
|
+
import { kebabCase } from "es-toolkit";
|
|
89
90
|
import { globSync } from "fs";
|
|
90
91
|
import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
91
92
|
import os from "os";
|
|
92
93
|
import { dirname, join, relative, resolve } from "path";
|
|
93
|
-
import { kebabCase } from "es-toolkit";
|
|
94
94
|
async function ensureDir(dirPath) {
|
|
95
95
|
try {
|
|
96
96
|
await stat(dirPath);
|
|
@@ -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);
|
|
@@ -2589,8 +2590,8 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2589
2590
|
};
|
|
2590
2591
|
|
|
2591
2592
|
// src/features/ignore/claudecode-ignore.ts
|
|
2592
|
-
import { join as join19 } from "path";
|
|
2593
2593
|
import { uniq } from "es-toolkit";
|
|
2594
|
+
import { join as join19 } from "path";
|
|
2594
2595
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2595
2596
|
constructor(params) {
|
|
2596
2597
|
super(params);
|
|
@@ -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 { uniq as uniq2 } from "es-toolkit";
|
|
3242
|
+
import { join as join29 } from "path";
|
|
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,8 +3612,8 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3515
3612
|
};
|
|
3516
3613
|
|
|
3517
3614
|
// src/features/mcp/rulesync-mcp.ts
|
|
3518
|
-
import { join as join30 } from "path";
|
|
3519
3615
|
import { omit } from "es-toolkit/object";
|
|
3616
|
+
import { join as join31 } from "path";
|
|
3520
3617
|
import { z as z16 } from "zod/mini";
|
|
3521
3618
|
var RulesyncMcpServerSchema = z16.union([
|
|
3522
3619
|
z16.extend(McpServerSchema, {
|
|
@@ -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,25 +5006,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4909
5006
|
};
|
|
4910
5007
|
|
|
4911
5008
|
// src/features/rules/rules-processor.ts
|
|
4912
|
-
import { basename as basename23, join as join88 } from "path";
|
|
4913
5009
|
import { encode } from "@toon-format/toon";
|
|
5010
|
+
import { basename as basename23, join as join89 } from "path";
|
|
4914
5011
|
import { z as z41 } from "zod/mini";
|
|
4915
5012
|
|
|
4916
5013
|
// src/constants/general.ts
|
|
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,16 +8214,18 @@ 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
|
);
|
|
8129
|
-
logger.warn(
|
|
8226
|
+
logger.warn(
|
|
8227
|
+
`\u26A0\uFE0F Using deprecated path "${legacyPath}". Please migrate to "${recommendedPath}"`
|
|
8228
|
+
);
|
|
8130
8229
|
const fileContent = await readFileContent(legacyPath);
|
|
8131
8230
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8132
8231
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8155,7 +8254,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8155
8254
|
relativeFilePath,
|
|
8156
8255
|
validate = true
|
|
8157
8256
|
}) {
|
|
8158
|
-
const filePath =
|
|
8257
|
+
const filePath = join68(
|
|
8159
8258
|
process.cwd(),
|
|
8160
8259
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8161
8260
|
relativeFilePath
|
|
@@ -8257,7 +8356,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8257
8356
|
rulesyncRule,
|
|
8258
8357
|
validate = true,
|
|
8259
8358
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8260
|
-
nonRootPath = { relativeDirPath:
|
|
8359
|
+
nonRootPath = { relativeDirPath: join69(".agents", "memories") }
|
|
8261
8360
|
}) {
|
|
8262
8361
|
const params = this.buildToolRuleParamsDefault({
|
|
8263
8362
|
baseDir,
|
|
@@ -8268,7 +8367,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8268
8367
|
});
|
|
8269
8368
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8270
8369
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8271
|
-
params.relativeDirPath =
|
|
8370
|
+
params.relativeDirPath = join69(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8272
8371
|
params.relativeFilePath = "AGENTS.md";
|
|
8273
8372
|
}
|
|
8274
8373
|
return params;
|
|
@@ -8333,7 +8432,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8333
8432
|
relativeFilePath: "AGENTS.md"
|
|
8334
8433
|
},
|
|
8335
8434
|
nonRoot: {
|
|
8336
|
-
relativeDirPath:
|
|
8435
|
+
relativeDirPath: join70(".agents", "memories")
|
|
8337
8436
|
}
|
|
8338
8437
|
};
|
|
8339
8438
|
}
|
|
@@ -8343,8 +8442,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8343
8442
|
validate = true
|
|
8344
8443
|
}) {
|
|
8345
8444
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8346
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
8347
|
-
const fileContent = await readFileContent(
|
|
8445
|
+
const relativePath = isRoot ? "AGENTS.md" : join70(".agents", "memories", relativeFilePath);
|
|
8446
|
+
const fileContent = await readFileContent(join70(baseDir, relativePath));
|
|
8348
8447
|
return new _AgentsMdRule({
|
|
8349
8448
|
baseDir,
|
|
8350
8449
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8399,7 +8498,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8399
8498
|
};
|
|
8400
8499
|
|
|
8401
8500
|
// src/features/rules/antigravity-rule.ts
|
|
8402
|
-
import { join as
|
|
8501
|
+
import { join as join71 } from "path";
|
|
8403
8502
|
import { z as z36 } from "zod/mini";
|
|
8404
8503
|
var AntigravityRuleFrontmatterSchema = z36.looseObject({
|
|
8405
8504
|
trigger: z36.optional(
|
|
@@ -8558,7 +8657,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8558
8657
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8559
8658
|
if (!result.success) {
|
|
8560
8659
|
throw new Error(
|
|
8561
|
-
`Invalid frontmatter in ${
|
|
8660
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8562
8661
|
);
|
|
8563
8662
|
}
|
|
8564
8663
|
}
|
|
@@ -8573,7 +8672,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8573
8672
|
static getSettablePaths() {
|
|
8574
8673
|
return {
|
|
8575
8674
|
nonRoot: {
|
|
8576
|
-
relativeDirPath:
|
|
8675
|
+
relativeDirPath: join71(".agent", "rules")
|
|
8577
8676
|
}
|
|
8578
8677
|
};
|
|
8579
8678
|
}
|
|
@@ -8582,7 +8681,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8582
8681
|
relativeFilePath,
|
|
8583
8682
|
validate = true
|
|
8584
8683
|
}) {
|
|
8585
|
-
const filePath =
|
|
8684
|
+
const filePath = join71(
|
|
8586
8685
|
baseDir,
|
|
8587
8686
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8588
8687
|
relativeFilePath
|
|
@@ -8723,7 +8822,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8723
8822
|
};
|
|
8724
8823
|
|
|
8725
8824
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8726
|
-
import { join as
|
|
8825
|
+
import { join as join72 } from "path";
|
|
8727
8826
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8728
8827
|
toRulesyncRule() {
|
|
8729
8828
|
const rulesyncFrontmatter = {
|
|
@@ -8749,7 +8848,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8749
8848
|
relativeFilePath: ".augment-guidelines"
|
|
8750
8849
|
},
|
|
8751
8850
|
nonRoot: {
|
|
8752
|
-
relativeDirPath:
|
|
8851
|
+
relativeDirPath: join72(".augment", "rules")
|
|
8753
8852
|
}
|
|
8754
8853
|
};
|
|
8755
8854
|
}
|
|
@@ -8784,8 +8883,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8784
8883
|
}) {
|
|
8785
8884
|
const settablePaths = this.getSettablePaths();
|
|
8786
8885
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8787
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
8788
|
-
const fileContent = await readFileContent(
|
|
8886
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join72(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8887
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
8789
8888
|
return new _AugmentcodeLegacyRule({
|
|
8790
8889
|
baseDir,
|
|
8791
8890
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8814,7 +8913,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8814
8913
|
};
|
|
8815
8914
|
|
|
8816
8915
|
// src/features/rules/augmentcode-rule.ts
|
|
8817
|
-
import { join as
|
|
8916
|
+
import { join as join73 } from "path";
|
|
8818
8917
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8819
8918
|
toRulesyncRule() {
|
|
8820
8919
|
return this.toRulesyncRuleDefault();
|
|
@@ -8822,7 +8921,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8822
8921
|
static getSettablePaths() {
|
|
8823
8922
|
return {
|
|
8824
8923
|
nonRoot: {
|
|
8825
|
-
relativeDirPath:
|
|
8924
|
+
relativeDirPath: join73(".augment", "rules")
|
|
8826
8925
|
}
|
|
8827
8926
|
};
|
|
8828
8927
|
}
|
|
@@ -8846,7 +8945,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8846
8945
|
validate = true
|
|
8847
8946
|
}) {
|
|
8848
8947
|
const fileContent = await readFileContent(
|
|
8849
|
-
|
|
8948
|
+
join73(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8850
8949
|
);
|
|
8851
8950
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8852
8951
|
return new _AugmentcodeRule({
|
|
@@ -8882,7 +8981,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8882
8981
|
};
|
|
8883
8982
|
|
|
8884
8983
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8885
|
-
import { join as
|
|
8984
|
+
import { join as join74 } from "path";
|
|
8886
8985
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8887
8986
|
static getSettablePaths({
|
|
8888
8987
|
global
|
|
@@ -8901,7 +9000,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8901
9000
|
relativeFilePath: "CLAUDE.md"
|
|
8902
9001
|
},
|
|
8903
9002
|
nonRoot: {
|
|
8904
|
-
relativeDirPath:
|
|
9003
|
+
relativeDirPath: join74(".claude", "memories")
|
|
8905
9004
|
}
|
|
8906
9005
|
};
|
|
8907
9006
|
}
|
|
@@ -8916,7 +9015,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8916
9015
|
if (isRoot) {
|
|
8917
9016
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8918
9017
|
const fileContent2 = await readFileContent(
|
|
8919
|
-
|
|
9018
|
+
join74(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8920
9019
|
);
|
|
8921
9020
|
return new _ClaudecodeLegacyRule({
|
|
8922
9021
|
baseDir,
|
|
@@ -8930,8 +9029,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8930
9029
|
if (!paths.nonRoot) {
|
|
8931
9030
|
throw new Error("nonRoot path is not set");
|
|
8932
9031
|
}
|
|
8933
|
-
const relativePath =
|
|
8934
|
-
const fileContent = await readFileContent(
|
|
9032
|
+
const relativePath = join74(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9033
|
+
const fileContent = await readFileContent(join74(baseDir, relativePath));
|
|
8935
9034
|
return new _ClaudecodeLegacyRule({
|
|
8936
9035
|
baseDir,
|
|
8937
9036
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8990,7 +9089,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8990
9089
|
};
|
|
8991
9090
|
|
|
8992
9091
|
// src/features/rules/claudecode-rule.ts
|
|
8993
|
-
import { join as
|
|
9092
|
+
import { join as join75 } from "path";
|
|
8994
9093
|
import { z as z37 } from "zod/mini";
|
|
8995
9094
|
var ClaudecodeRuleFrontmatterSchema = z37.object({
|
|
8996
9095
|
paths: z37.optional(z37.string())
|
|
@@ -9015,7 +9114,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9015
9114
|
relativeFilePath: "CLAUDE.md"
|
|
9016
9115
|
},
|
|
9017
9116
|
nonRoot: {
|
|
9018
|
-
relativeDirPath:
|
|
9117
|
+
relativeDirPath: join75(".claude", "rules")
|
|
9019
9118
|
}
|
|
9020
9119
|
};
|
|
9021
9120
|
}
|
|
@@ -9024,7 +9123,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9024
9123
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9025
9124
|
if (!result.success) {
|
|
9026
9125
|
throw new Error(
|
|
9027
|
-
`Invalid frontmatter in ${
|
|
9126
|
+
`Invalid frontmatter in ${join75(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9028
9127
|
);
|
|
9029
9128
|
}
|
|
9030
9129
|
}
|
|
@@ -9052,7 +9151,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9052
9151
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9053
9152
|
if (isRoot) {
|
|
9054
9153
|
const fileContent2 = await readFileContent(
|
|
9055
|
-
|
|
9154
|
+
join75(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9056
9155
|
);
|
|
9057
9156
|
return new _ClaudecodeRule({
|
|
9058
9157
|
baseDir,
|
|
@@ -9067,13 +9166,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9067
9166
|
if (!paths.nonRoot) {
|
|
9068
9167
|
throw new Error("nonRoot path is not set");
|
|
9069
9168
|
}
|
|
9070
|
-
const relativePath =
|
|
9071
|
-
const fileContent = await readFileContent(
|
|
9169
|
+
const relativePath = join75(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9170
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
9072
9171
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9073
9172
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9074
9173
|
if (!result.success) {
|
|
9075
9174
|
throw new Error(
|
|
9076
|
-
`Invalid frontmatter in ${
|
|
9175
|
+
`Invalid frontmatter in ${join75(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9077
9176
|
);
|
|
9078
9177
|
}
|
|
9079
9178
|
return new _ClaudecodeRule({
|
|
@@ -9180,7 +9279,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9180
9279
|
return {
|
|
9181
9280
|
success: false,
|
|
9182
9281
|
error: new Error(
|
|
9183
|
-
`Invalid frontmatter in ${
|
|
9282
|
+
`Invalid frontmatter in ${join75(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9184
9283
|
)
|
|
9185
9284
|
};
|
|
9186
9285
|
}
|
|
@@ -9200,7 +9299,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9200
9299
|
};
|
|
9201
9300
|
|
|
9202
9301
|
// src/features/rules/cline-rule.ts
|
|
9203
|
-
import { join as
|
|
9302
|
+
import { join as join76 } from "path";
|
|
9204
9303
|
import { z as z38 } from "zod/mini";
|
|
9205
9304
|
var ClineRuleFrontmatterSchema = z38.object({
|
|
9206
9305
|
description: z38.string()
|
|
@@ -9245,7 +9344,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9245
9344
|
validate = true
|
|
9246
9345
|
}) {
|
|
9247
9346
|
const fileContent = await readFileContent(
|
|
9248
|
-
|
|
9347
|
+
join76(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9249
9348
|
);
|
|
9250
9349
|
return new _ClineRule({
|
|
9251
9350
|
baseDir,
|
|
@@ -9271,7 +9370,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9271
9370
|
};
|
|
9272
9371
|
|
|
9273
9372
|
// src/features/rules/codexcli-rule.ts
|
|
9274
|
-
import { join as
|
|
9373
|
+
import { join as join77 } from "path";
|
|
9275
9374
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9276
9375
|
static getSettablePaths({
|
|
9277
9376
|
global
|
|
@@ -9290,7 +9389,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9290
9389
|
relativeFilePath: "AGENTS.md"
|
|
9291
9390
|
},
|
|
9292
9391
|
nonRoot: {
|
|
9293
|
-
relativeDirPath:
|
|
9392
|
+
relativeDirPath: join77(".codex", "memories")
|
|
9294
9393
|
}
|
|
9295
9394
|
};
|
|
9296
9395
|
}
|
|
@@ -9305,7 +9404,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9305
9404
|
if (isRoot) {
|
|
9306
9405
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9307
9406
|
const fileContent2 = await readFileContent(
|
|
9308
|
-
|
|
9407
|
+
join77(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9309
9408
|
);
|
|
9310
9409
|
return new _CodexcliRule({
|
|
9311
9410
|
baseDir,
|
|
@@ -9319,8 +9418,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9319
9418
|
if (!paths.nonRoot) {
|
|
9320
9419
|
throw new Error("nonRoot path is not set");
|
|
9321
9420
|
}
|
|
9322
|
-
const relativePath =
|
|
9323
|
-
const fileContent = await readFileContent(
|
|
9421
|
+
const relativePath = join77(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9422
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9324
9423
|
return new _CodexcliRule({
|
|
9325
9424
|
baseDir,
|
|
9326
9425
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9379,7 +9478,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9379
9478
|
};
|
|
9380
9479
|
|
|
9381
9480
|
// src/features/rules/copilot-rule.ts
|
|
9382
|
-
import { join as
|
|
9481
|
+
import { join as join78 } from "path";
|
|
9383
9482
|
import { z as z39 } from "zod/mini";
|
|
9384
9483
|
var CopilotRuleFrontmatterSchema = z39.object({
|
|
9385
9484
|
description: z39.optional(z39.string()),
|
|
@@ -9396,7 +9495,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9396
9495
|
relativeFilePath: "copilot-instructions.md"
|
|
9397
9496
|
},
|
|
9398
9497
|
nonRoot: {
|
|
9399
|
-
relativeDirPath:
|
|
9498
|
+
relativeDirPath: join78(".github", "instructions")
|
|
9400
9499
|
}
|
|
9401
9500
|
};
|
|
9402
9501
|
}
|
|
@@ -9405,7 +9504,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9405
9504
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9406
9505
|
if (!result.success) {
|
|
9407
9506
|
throw new Error(
|
|
9408
|
-
`Invalid frontmatter in ${
|
|
9507
|
+
`Invalid frontmatter in ${join78(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9409
9508
|
);
|
|
9410
9509
|
}
|
|
9411
9510
|
}
|
|
@@ -9487,11 +9586,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9487
9586
|
validate = true
|
|
9488
9587
|
}) {
|
|
9489
9588
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9490
|
-
const relativePath = isRoot ?
|
|
9589
|
+
const relativePath = isRoot ? join78(
|
|
9491
9590
|
this.getSettablePaths().root.relativeDirPath,
|
|
9492
9591
|
this.getSettablePaths().root.relativeFilePath
|
|
9493
|
-
) :
|
|
9494
|
-
const fileContent = await readFileContent(
|
|
9592
|
+
) : join78(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9593
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9495
9594
|
if (isRoot) {
|
|
9496
9595
|
return new _CopilotRule({
|
|
9497
9596
|
baseDir,
|
|
@@ -9507,7 +9606,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9507
9606
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9508
9607
|
if (!result.success) {
|
|
9509
9608
|
throw new Error(
|
|
9510
|
-
`Invalid frontmatter in ${
|
|
9609
|
+
`Invalid frontmatter in ${join78(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9511
9610
|
);
|
|
9512
9611
|
}
|
|
9513
9612
|
return new _CopilotRule({
|
|
@@ -9547,7 +9646,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9547
9646
|
return {
|
|
9548
9647
|
success: false,
|
|
9549
9648
|
error: new Error(
|
|
9550
|
-
`Invalid frontmatter in ${
|
|
9649
|
+
`Invalid frontmatter in ${join78(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9551
9650
|
)
|
|
9552
9651
|
};
|
|
9553
9652
|
}
|
|
@@ -9567,7 +9666,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9567
9666
|
};
|
|
9568
9667
|
|
|
9569
9668
|
// src/features/rules/cursor-rule.ts
|
|
9570
|
-
import { basename as basename22, join as
|
|
9669
|
+
import { basename as basename22, join as join79 } from "path";
|
|
9571
9670
|
import { z as z40 } from "zod/mini";
|
|
9572
9671
|
var CursorRuleFrontmatterSchema = z40.object({
|
|
9573
9672
|
description: z40.optional(z40.string()),
|
|
@@ -9580,7 +9679,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9580
9679
|
static getSettablePaths() {
|
|
9581
9680
|
return {
|
|
9582
9681
|
nonRoot: {
|
|
9583
|
-
relativeDirPath:
|
|
9682
|
+
relativeDirPath: join79(".cursor", "rules")
|
|
9584
9683
|
}
|
|
9585
9684
|
};
|
|
9586
9685
|
}
|
|
@@ -9589,7 +9688,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9589
9688
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9590
9689
|
if (!result.success) {
|
|
9591
9690
|
throw new Error(
|
|
9592
|
-
`Invalid frontmatter in ${
|
|
9691
|
+
`Invalid frontmatter in ${join79(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9593
9692
|
);
|
|
9594
9693
|
}
|
|
9595
9694
|
}
|
|
@@ -9706,13 +9805,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9706
9805
|
validate = true
|
|
9707
9806
|
}) {
|
|
9708
9807
|
const fileContent = await readFileContent(
|
|
9709
|
-
|
|
9808
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9710
9809
|
);
|
|
9711
9810
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9712
9811
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9713
9812
|
if (!result.success) {
|
|
9714
9813
|
throw new Error(
|
|
9715
|
-
`Invalid frontmatter in ${
|
|
9814
|
+
`Invalid frontmatter in ${join79(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9716
9815
|
);
|
|
9717
9816
|
}
|
|
9718
9817
|
return new _CursorRule({
|
|
@@ -9749,7 +9848,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9749
9848
|
return {
|
|
9750
9849
|
success: false,
|
|
9751
9850
|
error: new Error(
|
|
9752
|
-
`Invalid frontmatter in ${
|
|
9851
|
+
`Invalid frontmatter in ${join79(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9753
9852
|
)
|
|
9754
9853
|
};
|
|
9755
9854
|
}
|
|
@@ -9769,7 +9868,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9769
9868
|
};
|
|
9770
9869
|
|
|
9771
9870
|
// src/features/rules/geminicli-rule.ts
|
|
9772
|
-
import { join as
|
|
9871
|
+
import { join as join80 } from "path";
|
|
9773
9872
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9774
9873
|
static getSettablePaths({
|
|
9775
9874
|
global
|
|
@@ -9788,7 +9887,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9788
9887
|
relativeFilePath: "GEMINI.md"
|
|
9789
9888
|
},
|
|
9790
9889
|
nonRoot: {
|
|
9791
|
-
relativeDirPath:
|
|
9890
|
+
relativeDirPath: join80(".gemini", "memories")
|
|
9792
9891
|
}
|
|
9793
9892
|
};
|
|
9794
9893
|
}
|
|
@@ -9803,7 +9902,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9803
9902
|
if (isRoot) {
|
|
9804
9903
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9805
9904
|
const fileContent2 = await readFileContent(
|
|
9806
|
-
|
|
9905
|
+
join80(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9807
9906
|
);
|
|
9808
9907
|
return new _GeminiCliRule({
|
|
9809
9908
|
baseDir,
|
|
@@ -9817,8 +9916,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9817
9916
|
if (!paths.nonRoot) {
|
|
9818
9917
|
throw new Error("nonRoot path is not set");
|
|
9819
9918
|
}
|
|
9820
|
-
const relativePath =
|
|
9821
|
-
const fileContent = await readFileContent(
|
|
9919
|
+
const relativePath = join80(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9920
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9822
9921
|
return new _GeminiCliRule({
|
|
9823
9922
|
baseDir,
|
|
9824
9923
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9877,7 +9976,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9877
9976
|
};
|
|
9878
9977
|
|
|
9879
9978
|
// src/features/rules/junie-rule.ts
|
|
9880
|
-
import { join as
|
|
9979
|
+
import { join as join81 } from "path";
|
|
9881
9980
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9882
9981
|
static getSettablePaths() {
|
|
9883
9982
|
return {
|
|
@@ -9886,7 +9985,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9886
9985
|
relativeFilePath: "guidelines.md"
|
|
9887
9986
|
},
|
|
9888
9987
|
nonRoot: {
|
|
9889
|
-
relativeDirPath:
|
|
9988
|
+
relativeDirPath: join81(".junie", "memories")
|
|
9890
9989
|
}
|
|
9891
9990
|
};
|
|
9892
9991
|
}
|
|
@@ -9896,8 +9995,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9896
9995
|
validate = true
|
|
9897
9996
|
}) {
|
|
9898
9997
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9899
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
9900
|
-
const fileContent = await readFileContent(
|
|
9998
|
+
const relativePath = isRoot ? "guidelines.md" : join81(".junie", "memories", relativeFilePath);
|
|
9999
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9901
10000
|
return new _JunieRule({
|
|
9902
10001
|
baseDir,
|
|
9903
10002
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9952,12 +10051,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9952
10051
|
};
|
|
9953
10052
|
|
|
9954
10053
|
// src/features/rules/kilo-rule.ts
|
|
9955
|
-
import { join as
|
|
10054
|
+
import { join as join82 } from "path";
|
|
9956
10055
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
9957
10056
|
static getSettablePaths(_options = {}) {
|
|
9958
10057
|
return {
|
|
9959
10058
|
nonRoot: {
|
|
9960
|
-
relativeDirPath:
|
|
10059
|
+
relativeDirPath: join82(".kilocode", "rules")
|
|
9961
10060
|
}
|
|
9962
10061
|
};
|
|
9963
10062
|
}
|
|
@@ -9967,7 +10066,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
9967
10066
|
validate = true
|
|
9968
10067
|
}) {
|
|
9969
10068
|
const fileContent = await readFileContent(
|
|
9970
|
-
|
|
10069
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9971
10070
|
);
|
|
9972
10071
|
return new _KiloRule({
|
|
9973
10072
|
baseDir,
|
|
@@ -10019,12 +10118,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10019
10118
|
};
|
|
10020
10119
|
|
|
10021
10120
|
// src/features/rules/kiro-rule.ts
|
|
10022
|
-
import { join as
|
|
10121
|
+
import { join as join83 } from "path";
|
|
10023
10122
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10024
10123
|
static getSettablePaths() {
|
|
10025
10124
|
return {
|
|
10026
10125
|
nonRoot: {
|
|
10027
|
-
relativeDirPath:
|
|
10126
|
+
relativeDirPath: join83(".kiro", "steering")
|
|
10028
10127
|
}
|
|
10029
10128
|
};
|
|
10030
10129
|
}
|
|
@@ -10034,7 +10133,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10034
10133
|
validate = true
|
|
10035
10134
|
}) {
|
|
10036
10135
|
const fileContent = await readFileContent(
|
|
10037
|
-
|
|
10136
|
+
join83(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10038
10137
|
);
|
|
10039
10138
|
return new _KiroRule({
|
|
10040
10139
|
baseDir,
|
|
@@ -10088,7 +10187,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10088
10187
|
};
|
|
10089
10188
|
|
|
10090
10189
|
// src/features/rules/opencode-rule.ts
|
|
10091
|
-
import { join as
|
|
10190
|
+
import { join as join84 } from "path";
|
|
10092
10191
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10093
10192
|
static getSettablePaths() {
|
|
10094
10193
|
return {
|
|
@@ -10097,7 +10196,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10097
10196
|
relativeFilePath: "AGENTS.md"
|
|
10098
10197
|
},
|
|
10099
10198
|
nonRoot: {
|
|
10100
|
-
relativeDirPath:
|
|
10199
|
+
relativeDirPath: join84(".opencode", "memories")
|
|
10101
10200
|
}
|
|
10102
10201
|
};
|
|
10103
10202
|
}
|
|
@@ -10107,8 +10206,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10107
10206
|
validate = true
|
|
10108
10207
|
}) {
|
|
10109
10208
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10110
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
10111
|
-
const fileContent = await readFileContent(
|
|
10209
|
+
const relativePath = isRoot ? "AGENTS.md" : join84(".opencode", "memories", relativeFilePath);
|
|
10210
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
10112
10211
|
return new _OpenCodeRule({
|
|
10113
10212
|
baseDir,
|
|
10114
10213
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10163,7 +10262,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10163
10262
|
};
|
|
10164
10263
|
|
|
10165
10264
|
// src/features/rules/qwencode-rule.ts
|
|
10166
|
-
import { join as
|
|
10265
|
+
import { join as join85 } from "path";
|
|
10167
10266
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10168
10267
|
static getSettablePaths() {
|
|
10169
10268
|
return {
|
|
@@ -10172,7 +10271,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10172
10271
|
relativeFilePath: "QWEN.md"
|
|
10173
10272
|
},
|
|
10174
10273
|
nonRoot: {
|
|
10175
|
-
relativeDirPath:
|
|
10274
|
+
relativeDirPath: join85(".qwen", "memories")
|
|
10176
10275
|
}
|
|
10177
10276
|
};
|
|
10178
10277
|
}
|
|
@@ -10182,8 +10281,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10182
10281
|
validate = true
|
|
10183
10282
|
}) {
|
|
10184
10283
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10185
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
10186
|
-
const fileContent = await readFileContent(
|
|
10284
|
+
const relativePath = isRoot ? "QWEN.md" : join85(".qwen", "memories", relativeFilePath);
|
|
10285
|
+
const fileContent = await readFileContent(join85(baseDir, relativePath));
|
|
10187
10286
|
return new _QwencodeRule({
|
|
10188
10287
|
baseDir,
|
|
10189
10288
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10235,12 +10334,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10235
10334
|
};
|
|
10236
10335
|
|
|
10237
10336
|
// src/features/rules/roo-rule.ts
|
|
10238
|
-
import { join as
|
|
10337
|
+
import { join as join86 } from "path";
|
|
10239
10338
|
var RooRule = class _RooRule extends ToolRule {
|
|
10240
10339
|
static getSettablePaths() {
|
|
10241
10340
|
return {
|
|
10242
10341
|
nonRoot: {
|
|
10243
|
-
relativeDirPath:
|
|
10342
|
+
relativeDirPath: join86(".roo", "rules")
|
|
10244
10343
|
}
|
|
10245
10344
|
};
|
|
10246
10345
|
}
|
|
@@ -10250,7 +10349,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10250
10349
|
validate = true
|
|
10251
10350
|
}) {
|
|
10252
10351
|
const fileContent = await readFileContent(
|
|
10253
|
-
|
|
10352
|
+
join86(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10254
10353
|
);
|
|
10255
10354
|
return new _RooRule({
|
|
10256
10355
|
baseDir,
|
|
@@ -10319,7 +10418,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10319
10418
|
};
|
|
10320
10419
|
|
|
10321
10420
|
// src/features/rules/warp-rule.ts
|
|
10322
|
-
import { join as
|
|
10421
|
+
import { join as join87 } from "path";
|
|
10323
10422
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10324
10423
|
constructor({ fileContent, root, ...rest }) {
|
|
10325
10424
|
super({
|
|
@@ -10335,7 +10434,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10335
10434
|
relativeFilePath: "WARP.md"
|
|
10336
10435
|
},
|
|
10337
10436
|
nonRoot: {
|
|
10338
|
-
relativeDirPath:
|
|
10437
|
+
relativeDirPath: join87(".warp", "memories")
|
|
10339
10438
|
}
|
|
10340
10439
|
};
|
|
10341
10440
|
}
|
|
@@ -10345,8 +10444,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10345
10444
|
validate = true
|
|
10346
10445
|
}) {
|
|
10347
10446
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10348
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
10349
|
-
const fileContent = await readFileContent(
|
|
10447
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join87(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10448
|
+
const fileContent = await readFileContent(join87(baseDir, relativePath));
|
|
10350
10449
|
return new _WarpRule({
|
|
10351
10450
|
baseDir,
|
|
10352
10451
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -10401,12 +10500,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10401
10500
|
};
|
|
10402
10501
|
|
|
10403
10502
|
// src/features/rules/windsurf-rule.ts
|
|
10404
|
-
import { join as
|
|
10503
|
+
import { join as join88 } from "path";
|
|
10405
10504
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
10406
10505
|
static getSettablePaths() {
|
|
10407
10506
|
return {
|
|
10408
10507
|
nonRoot: {
|
|
10409
|
-
relativeDirPath:
|
|
10508
|
+
relativeDirPath: join88(".windsurf", "rules")
|
|
10410
10509
|
}
|
|
10411
10510
|
};
|
|
10412
10511
|
}
|
|
@@ -10416,7 +10515,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
10416
10515
|
validate = true
|
|
10417
10516
|
}) {
|
|
10418
10517
|
const fileContent = await readFileContent(
|
|
10419
|
-
|
|
10518
|
+
join88(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10420
10519
|
);
|
|
10421
10520
|
return new _WindsurfRule({
|
|
10422
10521
|
baseDir,
|
|
@@ -10773,7 +10872,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10773
10872
|
}).relativeDirPath;
|
|
10774
10873
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10775
10874
|
const frontmatter = skill.getFrontmatter();
|
|
10776
|
-
const relativePath =
|
|
10875
|
+
const relativePath = join89(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10777
10876
|
return {
|
|
10778
10877
|
name: frontmatter.name,
|
|
10779
10878
|
description: frontmatter.description,
|
|
@@ -10840,7 +10939,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10840
10939
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10841
10940
|
*/
|
|
10842
10941
|
async loadRulesyncFiles() {
|
|
10843
|
-
const files = await findFilesByGlobs(
|
|
10942
|
+
const files = await findFilesByGlobs(join89(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10844
10943
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10845
10944
|
const rulesyncRules = await Promise.all(
|
|
10846
10945
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename23(file) }))
|
|
@@ -10861,7 +10960,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10861
10960
|
return rulesyncRules;
|
|
10862
10961
|
}
|
|
10863
10962
|
async loadRulesyncFilesLegacy() {
|
|
10864
|
-
const legacyFiles = await findFilesByGlobs(
|
|
10963
|
+
const legacyFiles = await findFilesByGlobs(join89(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10865
10964
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10866
10965
|
return Promise.all(
|
|
10867
10966
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename23(file) }))
|
|
@@ -10882,7 +10981,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10882
10981
|
return [];
|
|
10883
10982
|
}
|
|
10884
10983
|
const rootFilePaths = await findFilesByGlobs(
|
|
10885
|
-
|
|
10984
|
+
join89(
|
|
10886
10985
|
this.baseDir,
|
|
10887
10986
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10888
10987
|
settablePaths.root.relativeFilePath
|
|
@@ -10914,7 +11013,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10914
11013
|
return [];
|
|
10915
11014
|
}
|
|
10916
11015
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
10917
|
-
|
|
11016
|
+
join89(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
10918
11017
|
);
|
|
10919
11018
|
if (forDeletion) {
|
|
10920
11019
|
return nonRootFilePaths.map(
|
|
@@ -11023,14 +11122,14 @@ s/<command> [arguments]
|
|
|
11023
11122
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11024
11123
|
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
11124
|
|
|
11026
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
11125
|
+
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
11126
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11028
11127
|
|
|
11029
11128
|
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
11129
|
|
|
11031
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
11130
|
+
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
11131
|
|
|
11033
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
11132
|
+
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
11133
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11035
11134
|
const result = [
|
|
11036
11135
|
overview,
|
|
@@ -11312,7 +11411,7 @@ async function generateSkills(config) {
|
|
|
11312
11411
|
}
|
|
11313
11412
|
|
|
11314
11413
|
// src/cli/commands/gitignore.ts
|
|
11315
|
-
import { join as
|
|
11414
|
+
import { join as join90 } from "path";
|
|
11316
11415
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11317
11416
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11318
11417
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11376,7 +11475,6 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11376
11475
|
"**/.opencode/command/",
|
|
11377
11476
|
"**/.opencode/agent/",
|
|
11378
11477
|
"**/.opencode/skill/",
|
|
11379
|
-
"**/opencode.json",
|
|
11380
11478
|
// Qwen
|
|
11381
11479
|
"**/QWEN.md",
|
|
11382
11480
|
"**/.qwen/memories/",
|
|
@@ -11443,7 +11541,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
11443
11541
|
return result;
|
|
11444
11542
|
};
|
|
11445
11543
|
var gitignoreCommand = async () => {
|
|
11446
|
-
const gitignorePath =
|
|
11544
|
+
const gitignorePath = join90(process.cwd(), ".gitignore");
|
|
11447
11545
|
let gitignoreContent = "";
|
|
11448
11546
|
if (await fileExists(gitignorePath)) {
|
|
11449
11547
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11642,7 +11740,7 @@ async function importSkills(config, tool) {
|
|
|
11642
11740
|
}
|
|
11643
11741
|
|
|
11644
11742
|
// src/cli/commands/init.ts
|
|
11645
|
-
import { join as
|
|
11743
|
+
import { join as join91 } from "path";
|
|
11646
11744
|
async function initCommand() {
|
|
11647
11745
|
logger.info("Initializing rulesync...");
|
|
11648
11746
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11805,14 +11903,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11805
11903
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11806
11904
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
11807
11905
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11808
|
-
const ruleFilepath =
|
|
11906
|
+
const ruleFilepath = join91(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11809
11907
|
if (!await fileExists(ruleFilepath)) {
|
|
11810
11908
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11811
11909
|
logger.success(`Created ${ruleFilepath}`);
|
|
11812
11910
|
} else {
|
|
11813
11911
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11814
11912
|
}
|
|
11815
|
-
const mcpFilepath =
|
|
11913
|
+
const mcpFilepath = join91(
|
|
11816
11914
|
mcpPaths.recommended.relativeDirPath,
|
|
11817
11915
|
mcpPaths.recommended.relativeFilePath
|
|
11818
11916
|
);
|
|
@@ -11822,21 +11920,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11822
11920
|
} else {
|
|
11823
11921
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11824
11922
|
}
|
|
11825
|
-
const commandFilepath =
|
|
11923
|
+
const commandFilepath = join91(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11826
11924
|
if (!await fileExists(commandFilepath)) {
|
|
11827
11925
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11828
11926
|
logger.success(`Created ${commandFilepath}`);
|
|
11829
11927
|
} else {
|
|
11830
11928
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11831
11929
|
}
|
|
11832
|
-
const subagentFilepath =
|
|
11930
|
+
const subagentFilepath = join91(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11833
11931
|
if (!await fileExists(subagentFilepath)) {
|
|
11834
11932
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11835
11933
|
logger.success(`Created ${subagentFilepath}`);
|
|
11836
11934
|
} else {
|
|
11837
11935
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11838
11936
|
}
|
|
11839
|
-
const ignoreFilepath =
|
|
11937
|
+
const ignoreFilepath = join91(
|
|
11840
11938
|
ignorePaths.recommended.relativeDirPath,
|
|
11841
11939
|
ignorePaths.recommended.relativeFilePath
|
|
11842
11940
|
);
|
|
@@ -11855,12 +11953,12 @@ import { FastMCP } from "fastmcp";
|
|
|
11855
11953
|
import { z as z48 } from "zod/mini";
|
|
11856
11954
|
|
|
11857
11955
|
// src/mcp/commands.ts
|
|
11858
|
-
import { basename as basename24, join as
|
|
11956
|
+
import { basename as basename24, join as join92 } from "path";
|
|
11859
11957
|
import { z as z42 } from "zod/mini";
|
|
11860
11958
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11861
11959
|
var maxCommandsCount = 1e3;
|
|
11862
11960
|
async function listCommands() {
|
|
11863
|
-
const commandsDir =
|
|
11961
|
+
const commandsDir = join92(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11864
11962
|
try {
|
|
11865
11963
|
const files = await listDirectoryFiles(commandsDir);
|
|
11866
11964
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11872,7 +11970,7 @@ async function listCommands() {
|
|
|
11872
11970
|
});
|
|
11873
11971
|
const frontmatter = command.getFrontmatter();
|
|
11874
11972
|
return {
|
|
11875
|
-
relativePathFromCwd:
|
|
11973
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11876
11974
|
frontmatter
|
|
11877
11975
|
};
|
|
11878
11976
|
} catch (error) {
|
|
@@ -11898,7 +11996,7 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11898
11996
|
relativeFilePath: filename
|
|
11899
11997
|
});
|
|
11900
11998
|
return {
|
|
11901
|
-
relativePathFromCwd:
|
|
11999
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11902
12000
|
frontmatter: command.getFrontmatter(),
|
|
11903
12001
|
body: command.getBody()
|
|
11904
12002
|
};
|
|
@@ -11927,7 +12025,7 @@ async function putCommand({
|
|
|
11927
12025
|
try {
|
|
11928
12026
|
const existingCommands = await listCommands();
|
|
11929
12027
|
const isUpdate = existingCommands.some(
|
|
11930
|
-
(command2) => command2.relativePathFromCwd ===
|
|
12028
|
+
(command2) => command2.relativePathFromCwd === join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11931
12029
|
);
|
|
11932
12030
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
11933
12031
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -11942,11 +12040,11 @@ async function putCommand({
|
|
|
11942
12040
|
fileContent,
|
|
11943
12041
|
validate: true
|
|
11944
12042
|
});
|
|
11945
|
-
const commandsDir =
|
|
12043
|
+
const commandsDir = join92(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11946
12044
|
await ensureDir(commandsDir);
|
|
11947
12045
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
11948
12046
|
return {
|
|
11949
|
-
relativePathFromCwd:
|
|
12047
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11950
12048
|
frontmatter: command.getFrontmatter(),
|
|
11951
12049
|
body: command.getBody()
|
|
11952
12050
|
};
|
|
@@ -11962,11 +12060,11 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11962
12060
|
intendedRootDir: process.cwd()
|
|
11963
12061
|
});
|
|
11964
12062
|
const filename = basename24(relativePathFromCwd);
|
|
11965
|
-
const fullPath =
|
|
12063
|
+
const fullPath = join92(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
11966
12064
|
try {
|
|
11967
12065
|
await removeFile(fullPath);
|
|
11968
12066
|
return {
|
|
11969
|
-
relativePathFromCwd:
|
|
12067
|
+
relativePathFromCwd: join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11970
12068
|
};
|
|
11971
12069
|
} catch (error) {
|
|
11972
12070
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11991,7 +12089,7 @@ var commandToolSchemas = {
|
|
|
11991
12089
|
var commandTools = {
|
|
11992
12090
|
listCommands: {
|
|
11993
12091
|
name: "listCommands",
|
|
11994
|
-
description: `List all commands from ${
|
|
12092
|
+
description: `List all commands from ${join92(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11995
12093
|
parameters: commandToolSchemas.listCommands,
|
|
11996
12094
|
execute: async () => {
|
|
11997
12095
|
const commands = await listCommands();
|
|
@@ -12033,11 +12131,11 @@ var commandTools = {
|
|
|
12033
12131
|
};
|
|
12034
12132
|
|
|
12035
12133
|
// src/mcp/ignore.ts
|
|
12036
|
-
import { join as
|
|
12134
|
+
import { join as join93 } from "path";
|
|
12037
12135
|
import { z as z43 } from "zod/mini";
|
|
12038
12136
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12039
12137
|
async function getIgnoreFile() {
|
|
12040
|
-
const ignoreFilePath =
|
|
12138
|
+
const ignoreFilePath = join93(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12041
12139
|
try {
|
|
12042
12140
|
const content = await readFileContent(ignoreFilePath);
|
|
12043
12141
|
return {
|
|
@@ -12051,7 +12149,7 @@ async function getIgnoreFile() {
|
|
|
12051
12149
|
}
|
|
12052
12150
|
}
|
|
12053
12151
|
async function putIgnoreFile({ content }) {
|
|
12054
|
-
const ignoreFilePath =
|
|
12152
|
+
const ignoreFilePath = join93(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12055
12153
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12056
12154
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12057
12155
|
throw new Error(
|
|
@@ -12072,8 +12170,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12072
12170
|
}
|
|
12073
12171
|
}
|
|
12074
12172
|
async function deleteIgnoreFile() {
|
|
12075
|
-
const aiignorePath =
|
|
12076
|
-
const legacyIgnorePath =
|
|
12173
|
+
const aiignorePath = join93(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12174
|
+
const legacyIgnorePath = join93(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12077
12175
|
try {
|
|
12078
12176
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12079
12177
|
return {
|
|
@@ -12128,7 +12226,7 @@ var ignoreTools = {
|
|
|
12128
12226
|
};
|
|
12129
12227
|
|
|
12130
12228
|
// src/mcp/mcp.ts
|
|
12131
|
-
import { join as
|
|
12229
|
+
import { join as join94 } from "path";
|
|
12132
12230
|
import { z as z44 } from "zod/mini";
|
|
12133
12231
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12134
12232
|
async function getMcpFile() {
|
|
@@ -12138,7 +12236,7 @@ async function getMcpFile() {
|
|
|
12138
12236
|
validate: true,
|
|
12139
12237
|
modularMcp: config.getModularMcp()
|
|
12140
12238
|
});
|
|
12141
|
-
const relativePathFromCwd =
|
|
12239
|
+
const relativePathFromCwd = join94(
|
|
12142
12240
|
rulesyncMcp.getRelativeDirPath(),
|
|
12143
12241
|
rulesyncMcp.getRelativeFilePath()
|
|
12144
12242
|
);
|
|
@@ -12171,7 +12269,7 @@ async function putMcpFile({ content }) {
|
|
|
12171
12269
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12172
12270
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12173
12271
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12174
|
-
const fullPath =
|
|
12272
|
+
const fullPath = join94(baseDir, relativeDirPath, relativeFilePath);
|
|
12175
12273
|
const rulesyncMcp = new RulesyncMcp({
|
|
12176
12274
|
baseDir,
|
|
12177
12275
|
relativeDirPath,
|
|
@@ -12180,9 +12278,9 @@ async function putMcpFile({ content }) {
|
|
|
12180
12278
|
validate: true,
|
|
12181
12279
|
modularMcp: config.getModularMcp()
|
|
12182
12280
|
});
|
|
12183
|
-
await ensureDir(
|
|
12281
|
+
await ensureDir(join94(baseDir, relativeDirPath));
|
|
12184
12282
|
await writeFileContent(fullPath, content);
|
|
12185
|
-
const relativePathFromCwd =
|
|
12283
|
+
const relativePathFromCwd = join94(relativeDirPath, relativeFilePath);
|
|
12186
12284
|
return {
|
|
12187
12285
|
relativePathFromCwd,
|
|
12188
12286
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12197,15 +12295,15 @@ async function deleteMcpFile() {
|
|
|
12197
12295
|
try {
|
|
12198
12296
|
const baseDir = process.cwd();
|
|
12199
12297
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12200
|
-
const recommendedPath =
|
|
12298
|
+
const recommendedPath = join94(
|
|
12201
12299
|
baseDir,
|
|
12202
12300
|
paths.recommended.relativeDirPath,
|
|
12203
12301
|
paths.recommended.relativeFilePath
|
|
12204
12302
|
);
|
|
12205
|
-
const legacyPath =
|
|
12303
|
+
const legacyPath = join94(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12206
12304
|
await removeFile(recommendedPath);
|
|
12207
12305
|
await removeFile(legacyPath);
|
|
12208
|
-
const relativePathFromCwd =
|
|
12306
|
+
const relativePathFromCwd = join94(
|
|
12209
12307
|
paths.recommended.relativeDirPath,
|
|
12210
12308
|
paths.recommended.relativeFilePath
|
|
12211
12309
|
);
|
|
@@ -12256,12 +12354,12 @@ var mcpTools = {
|
|
|
12256
12354
|
};
|
|
12257
12355
|
|
|
12258
12356
|
// src/mcp/rules.ts
|
|
12259
|
-
import { basename as basename25, join as
|
|
12357
|
+
import { basename as basename25, join as join95 } from "path";
|
|
12260
12358
|
import { z as z45 } from "zod/mini";
|
|
12261
12359
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12262
12360
|
var maxRulesCount = 1e3;
|
|
12263
12361
|
async function listRules() {
|
|
12264
|
-
const rulesDir =
|
|
12362
|
+
const rulesDir = join95(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12265
12363
|
try {
|
|
12266
12364
|
const files = await listDirectoryFiles(rulesDir);
|
|
12267
12365
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12274,7 +12372,7 @@ async function listRules() {
|
|
|
12274
12372
|
});
|
|
12275
12373
|
const frontmatter = rule.getFrontmatter();
|
|
12276
12374
|
return {
|
|
12277
|
-
relativePathFromCwd:
|
|
12375
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12278
12376
|
frontmatter
|
|
12279
12377
|
};
|
|
12280
12378
|
} catch (error) {
|
|
@@ -12301,7 +12399,7 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12301
12399
|
validate: true
|
|
12302
12400
|
});
|
|
12303
12401
|
return {
|
|
12304
|
-
relativePathFromCwd:
|
|
12402
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12305
12403
|
frontmatter: rule.getFrontmatter(),
|
|
12306
12404
|
body: rule.getBody()
|
|
12307
12405
|
};
|
|
@@ -12330,7 +12428,7 @@ async function putRule({
|
|
|
12330
12428
|
try {
|
|
12331
12429
|
const existingRules = await listRules();
|
|
12332
12430
|
const isUpdate = existingRules.some(
|
|
12333
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
12431
|
+
(rule2) => rule2.relativePathFromCwd === join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12334
12432
|
);
|
|
12335
12433
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12336
12434
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12343,11 +12441,11 @@ async function putRule({
|
|
|
12343
12441
|
body,
|
|
12344
12442
|
validate: true
|
|
12345
12443
|
});
|
|
12346
|
-
const rulesDir =
|
|
12444
|
+
const rulesDir = join95(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12347
12445
|
await ensureDir(rulesDir);
|
|
12348
12446
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12349
12447
|
return {
|
|
12350
|
-
relativePathFromCwd:
|
|
12448
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12351
12449
|
frontmatter: rule.getFrontmatter(),
|
|
12352
12450
|
body: rule.getBody()
|
|
12353
12451
|
};
|
|
@@ -12363,11 +12461,11 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
12363
12461
|
intendedRootDir: process.cwd()
|
|
12364
12462
|
});
|
|
12365
12463
|
const filename = basename25(relativePathFromCwd);
|
|
12366
|
-
const fullPath =
|
|
12464
|
+
const fullPath = join95(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
12367
12465
|
try {
|
|
12368
12466
|
await removeFile(fullPath);
|
|
12369
12467
|
return {
|
|
12370
|
-
relativePathFromCwd:
|
|
12468
|
+
relativePathFromCwd: join95(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12371
12469
|
};
|
|
12372
12470
|
} catch (error) {
|
|
12373
12471
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12392,7 +12490,7 @@ var ruleToolSchemas = {
|
|
|
12392
12490
|
var ruleTools = {
|
|
12393
12491
|
listRules: {
|
|
12394
12492
|
name: "listRules",
|
|
12395
|
-
description: `List all rules from ${
|
|
12493
|
+
description: `List all rules from ${join95(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12396
12494
|
parameters: ruleToolSchemas.listRules,
|
|
12397
12495
|
execute: async () => {
|
|
12398
12496
|
const rules = await listRules();
|
|
@@ -12434,7 +12532,7 @@ var ruleTools = {
|
|
|
12434
12532
|
};
|
|
12435
12533
|
|
|
12436
12534
|
// src/mcp/skills.ts
|
|
12437
|
-
import { basename as basename26, dirname as dirname2, join as
|
|
12535
|
+
import { basename as basename26, dirname as dirname2, join as join96 } from "path";
|
|
12438
12536
|
import { z as z46 } from "zod/mini";
|
|
12439
12537
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
12440
12538
|
var maxSkillsCount = 1e3;
|
|
@@ -12458,9 +12556,9 @@ function extractDirName(relativeDirPathFromCwd) {
|
|
|
12458
12556
|
return dirName;
|
|
12459
12557
|
}
|
|
12460
12558
|
async function listSkills() {
|
|
12461
|
-
const skillsDir =
|
|
12559
|
+
const skillsDir = join96(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12462
12560
|
try {
|
|
12463
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
12561
|
+
const skillDirPaths = await findFilesByGlobs(join96(skillsDir, "*"), { type: "dir" });
|
|
12464
12562
|
const skills = await Promise.all(
|
|
12465
12563
|
skillDirPaths.map(async (dirPath) => {
|
|
12466
12564
|
const dirName = basename26(dirPath);
|
|
@@ -12471,7 +12569,7 @@ async function listSkills() {
|
|
|
12471
12569
|
});
|
|
12472
12570
|
const frontmatter = skill.getFrontmatter();
|
|
12473
12571
|
return {
|
|
12474
|
-
relativeDirPathFromCwd:
|
|
12572
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12475
12573
|
frontmatter
|
|
12476
12574
|
};
|
|
12477
12575
|
} catch (error) {
|
|
@@ -12497,7 +12595,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
12497
12595
|
dirName
|
|
12498
12596
|
});
|
|
12499
12597
|
return {
|
|
12500
|
-
relativeDirPathFromCwd:
|
|
12598
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12501
12599
|
frontmatter: skill.getFrontmatter(),
|
|
12502
12600
|
body: skill.getBody(),
|
|
12503
12601
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12531,7 +12629,7 @@ async function putSkill({
|
|
|
12531
12629
|
try {
|
|
12532
12630
|
const existingSkills = await listSkills();
|
|
12533
12631
|
const isUpdate = existingSkills.some(
|
|
12534
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
12632
|
+
(skill2) => skill2.relativeDirPathFromCwd === join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12535
12633
|
);
|
|
12536
12634
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12537
12635
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12546,9 +12644,9 @@ async function putSkill({
|
|
|
12546
12644
|
otherFiles: aiDirFiles,
|
|
12547
12645
|
validate: true
|
|
12548
12646
|
});
|
|
12549
|
-
const skillDirPath =
|
|
12647
|
+
const skillDirPath = join96(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12550
12648
|
await ensureDir(skillDirPath);
|
|
12551
|
-
const skillFilePath =
|
|
12649
|
+
const skillFilePath = join96(skillDirPath, SKILL_FILE_NAME);
|
|
12552
12650
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12553
12651
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12554
12652
|
for (const file of otherFiles) {
|
|
@@ -12556,15 +12654,15 @@ async function putSkill({
|
|
|
12556
12654
|
relativePath: file.name,
|
|
12557
12655
|
intendedRootDir: skillDirPath
|
|
12558
12656
|
});
|
|
12559
|
-
const filePath =
|
|
12560
|
-
const fileDir =
|
|
12657
|
+
const filePath = join96(skillDirPath, file.name);
|
|
12658
|
+
const fileDir = join96(skillDirPath, dirname2(file.name));
|
|
12561
12659
|
if (fileDir !== skillDirPath) {
|
|
12562
12660
|
await ensureDir(fileDir);
|
|
12563
12661
|
}
|
|
12564
12662
|
await writeFileContent(filePath, file.body);
|
|
12565
12663
|
}
|
|
12566
12664
|
return {
|
|
12567
|
-
relativeDirPathFromCwd:
|
|
12665
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12568
12666
|
frontmatter: skill.getFrontmatter(),
|
|
12569
12667
|
body: skill.getBody(),
|
|
12570
12668
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12586,13 +12684,13 @@ async function deleteSkill({
|
|
|
12586
12684
|
intendedRootDir: process.cwd()
|
|
12587
12685
|
});
|
|
12588
12686
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12589
|
-
const skillDirPath =
|
|
12687
|
+
const skillDirPath = join96(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12590
12688
|
try {
|
|
12591
12689
|
if (await directoryExists(skillDirPath)) {
|
|
12592
12690
|
await removeDirectory(skillDirPath);
|
|
12593
12691
|
}
|
|
12594
12692
|
return {
|
|
12595
|
-
relativeDirPathFromCwd:
|
|
12693
|
+
relativeDirPathFromCwd: join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12596
12694
|
};
|
|
12597
12695
|
} catch (error) {
|
|
12598
12696
|
throw new Error(
|
|
@@ -12625,7 +12723,7 @@ var skillToolSchemas = {
|
|
|
12625
12723
|
var skillTools = {
|
|
12626
12724
|
listSkills: {
|
|
12627
12725
|
name: "listSkills",
|
|
12628
|
-
description: `List all skills from ${
|
|
12726
|
+
description: `List all skills from ${join96(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12629
12727
|
parameters: skillToolSchemas.listSkills,
|
|
12630
12728
|
execute: async () => {
|
|
12631
12729
|
const skills = await listSkills();
|
|
@@ -12668,12 +12766,12 @@ var skillTools = {
|
|
|
12668
12766
|
};
|
|
12669
12767
|
|
|
12670
12768
|
// src/mcp/subagents.ts
|
|
12671
|
-
import { basename as basename27, join as
|
|
12769
|
+
import { basename as basename27, join as join97 } from "path";
|
|
12672
12770
|
import { z as z47 } from "zod/mini";
|
|
12673
12771
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12674
12772
|
var maxSubagentsCount = 1e3;
|
|
12675
12773
|
async function listSubagents() {
|
|
12676
|
-
const subagentsDir =
|
|
12774
|
+
const subagentsDir = join97(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12677
12775
|
try {
|
|
12678
12776
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12679
12777
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12686,7 +12784,7 @@ async function listSubagents() {
|
|
|
12686
12784
|
});
|
|
12687
12785
|
const frontmatter = subagent.getFrontmatter();
|
|
12688
12786
|
return {
|
|
12689
|
-
relativePathFromCwd:
|
|
12787
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12690
12788
|
frontmatter
|
|
12691
12789
|
};
|
|
12692
12790
|
} catch (error) {
|
|
@@ -12715,7 +12813,7 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12715
12813
|
validate: true
|
|
12716
12814
|
});
|
|
12717
12815
|
return {
|
|
12718
|
-
relativePathFromCwd:
|
|
12816
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12719
12817
|
frontmatter: subagent.getFrontmatter(),
|
|
12720
12818
|
body: subagent.getBody()
|
|
12721
12819
|
};
|
|
@@ -12744,7 +12842,7 @@ async function putSubagent({
|
|
|
12744
12842
|
try {
|
|
12745
12843
|
const existingSubagents = await listSubagents();
|
|
12746
12844
|
const isUpdate = existingSubagents.some(
|
|
12747
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
12845
|
+
(subagent2) => subagent2.relativePathFromCwd === join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12748
12846
|
);
|
|
12749
12847
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12750
12848
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12757,11 +12855,11 @@ async function putSubagent({
|
|
|
12757
12855
|
body,
|
|
12758
12856
|
validate: true
|
|
12759
12857
|
});
|
|
12760
|
-
const subagentsDir =
|
|
12858
|
+
const subagentsDir = join97(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12761
12859
|
await ensureDir(subagentsDir);
|
|
12762
12860
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12763
12861
|
return {
|
|
12764
|
-
relativePathFromCwd:
|
|
12862
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12765
12863
|
frontmatter: subagent.getFrontmatter(),
|
|
12766
12864
|
body: subagent.getBody()
|
|
12767
12865
|
};
|
|
@@ -12777,11 +12875,11 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12777
12875
|
intendedRootDir: process.cwd()
|
|
12778
12876
|
});
|
|
12779
12877
|
const filename = basename27(relativePathFromCwd);
|
|
12780
|
-
const fullPath =
|
|
12878
|
+
const fullPath = join97(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12781
12879
|
try {
|
|
12782
12880
|
await removeFile(fullPath);
|
|
12783
12881
|
return {
|
|
12784
|
-
relativePathFromCwd:
|
|
12882
|
+
relativePathFromCwd: join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12785
12883
|
};
|
|
12786
12884
|
} catch (error) {
|
|
12787
12885
|
throw new Error(
|
|
@@ -12809,7 +12907,7 @@ var subagentToolSchemas = {
|
|
|
12809
12907
|
var subagentTools = {
|
|
12810
12908
|
listSubagents: {
|
|
12811
12909
|
name: "listSubagents",
|
|
12812
|
-
description: `List all subagents from ${
|
|
12910
|
+
description: `List all subagents from ${join97(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12813
12911
|
parameters: subagentToolSchemas.listSubagents,
|
|
12814
12912
|
execute: async () => {
|
|
12815
12913
|
const subagents = await listSubagents();
|
|
@@ -13060,7 +13158,7 @@ async function mcpCommand({ version }) {
|
|
|
13060
13158
|
}
|
|
13061
13159
|
|
|
13062
13160
|
// src/cli/index.ts
|
|
13063
|
-
var getVersion = () => "5.
|
|
13161
|
+
var getVersion = () => "5.2.1";
|
|
13064
13162
|
var main = async () => {
|
|
13065
13163
|
const program = new Command();
|
|
13066
13164
|
const version = getVersion();
|