rulesync 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs +511 -332
- package/dist/index.js +489 -310
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5240,8 +5240,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
5240
5240
|
|
|
5241
5241
|
// src/features/rules/rules-processor.ts
|
|
5242
5242
|
var import_toon = require("@toon-format/toon");
|
|
5243
|
-
var
|
|
5244
|
-
var
|
|
5243
|
+
var import_node_path96 = require("path");
|
|
5244
|
+
var import_mini43 = require("zod/mini");
|
|
5245
5245
|
|
|
5246
5246
|
// src/constants/general.ts
|
|
5247
5247
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -7767,8 +7767,8 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
7767
7767
|
};
|
|
7768
7768
|
|
|
7769
7769
|
// src/features/subagents/subagents-processor.ts
|
|
7770
|
-
var
|
|
7771
|
-
var
|
|
7770
|
+
var import_node_path73 = require("path");
|
|
7771
|
+
var import_mini36 = require("zod/mini");
|
|
7772
7772
|
|
|
7773
7773
|
// src/features/subagents/claudecode-subagent.ts
|
|
7774
7774
|
var import_node_path69 = require("path");
|
|
@@ -8171,13 +8171,150 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
8171
8171
|
}
|
|
8172
8172
|
};
|
|
8173
8173
|
|
|
8174
|
-
// src/features/subagents/
|
|
8174
|
+
// src/features/subagents/kiro-subagent.ts
|
|
8175
8175
|
var import_node_path71 = require("path");
|
|
8176
8176
|
var import_mini34 = require("zod/mini");
|
|
8177
|
-
var
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8177
|
+
var KiroCliSubagentJsonSchema = import_mini34.z.looseObject({
|
|
8178
|
+
name: import_mini34.z.string(),
|
|
8179
|
+
description: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.string())),
|
|
8180
|
+
prompt: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.string())),
|
|
8181
|
+
tools: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.array(import_mini34.z.string()))),
|
|
8182
|
+
toolAliases: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.record(import_mini34.z.string(), import_mini34.z.string()))),
|
|
8183
|
+
toolSettings: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.unknown())),
|
|
8184
|
+
toolSchema: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.unknown())),
|
|
8185
|
+
hooks: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.record(import_mini34.z.string(), import_mini34.z.array(import_mini34.z.unknown())))),
|
|
8186
|
+
model: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.string())),
|
|
8187
|
+
mcpServers: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.record(import_mini34.z.string(), import_mini34.z.unknown()))),
|
|
8188
|
+
useLegacyMcpJson: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.boolean())),
|
|
8189
|
+
resources: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.array(import_mini34.z.string()))),
|
|
8190
|
+
allowedTools: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.array(import_mini34.z.string()))),
|
|
8191
|
+
includeMcpJson: import_mini34.z.optional(import_mini34.z.nullable(import_mini34.z.boolean()))
|
|
8192
|
+
});
|
|
8193
|
+
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
8194
|
+
body;
|
|
8195
|
+
constructor({ body, ...rest }) {
|
|
8196
|
+
super({
|
|
8197
|
+
...rest
|
|
8198
|
+
});
|
|
8199
|
+
this.body = body;
|
|
8200
|
+
}
|
|
8201
|
+
static getSettablePaths(_options = {}) {
|
|
8202
|
+
return {
|
|
8203
|
+
relativeDirPath: (0, import_node_path71.join)(".kiro", "agents")
|
|
8204
|
+
};
|
|
8205
|
+
}
|
|
8206
|
+
getBody() {
|
|
8207
|
+
return this.body;
|
|
8208
|
+
}
|
|
8209
|
+
toRulesyncSubagent() {
|
|
8210
|
+
const parsed = JSON.parse(this.body);
|
|
8211
|
+
const { name, description, prompt, ...restFields } = parsed;
|
|
8212
|
+
const kiroSection = {
|
|
8213
|
+
...restFields
|
|
8214
|
+
};
|
|
8215
|
+
const rulesyncFrontmatter = {
|
|
8216
|
+
targets: ["kiro"],
|
|
8217
|
+
name,
|
|
8218
|
+
description: description ?? "",
|
|
8219
|
+
// Only include kiro section if there are fields
|
|
8220
|
+
...Object.keys(kiroSection).length > 0 && { kiro: kiroSection }
|
|
8221
|
+
};
|
|
8222
|
+
return new RulesyncSubagent({
|
|
8223
|
+
baseDir: ".",
|
|
8224
|
+
frontmatter: rulesyncFrontmatter,
|
|
8225
|
+
body: prompt ?? "",
|
|
8226
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
8227
|
+
relativeFilePath: this.getRelativeFilePath().replace(/\.json$/, ".md"),
|
|
8228
|
+
validate: true
|
|
8229
|
+
});
|
|
8230
|
+
}
|
|
8231
|
+
static fromRulesyncSubagent({
|
|
8232
|
+
baseDir = process.cwd(),
|
|
8233
|
+
rulesyncSubagent,
|
|
8234
|
+
validate = true,
|
|
8235
|
+
global = false
|
|
8236
|
+
}) {
|
|
8237
|
+
const frontmatter = rulesyncSubagent.getFrontmatter();
|
|
8238
|
+
const kiroSection = frontmatter.kiro ?? {};
|
|
8239
|
+
const json = {
|
|
8240
|
+
name: frontmatter.name,
|
|
8241
|
+
description: frontmatter.description || null,
|
|
8242
|
+
prompt: rulesyncSubagent.getBody() || null,
|
|
8243
|
+
...kiroSection
|
|
8244
|
+
};
|
|
8245
|
+
const body = JSON.stringify(json, null, 2);
|
|
8246
|
+
const paths = this.getSettablePaths({ global });
|
|
8247
|
+
const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".json");
|
|
8248
|
+
return new _KiroSubagent({
|
|
8249
|
+
baseDir,
|
|
8250
|
+
body,
|
|
8251
|
+
relativeDirPath: paths.relativeDirPath,
|
|
8252
|
+
relativeFilePath,
|
|
8253
|
+
fileContent: body,
|
|
8254
|
+
validate,
|
|
8255
|
+
global
|
|
8256
|
+
});
|
|
8257
|
+
}
|
|
8258
|
+
validate() {
|
|
8259
|
+
try {
|
|
8260
|
+
const parsed = JSON.parse(this.body);
|
|
8261
|
+
KiroCliSubagentJsonSchema.parse(parsed);
|
|
8262
|
+
return { success: true, error: null };
|
|
8263
|
+
} catch (error) {
|
|
8264
|
+
return {
|
|
8265
|
+
success: false,
|
|
8266
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
8267
|
+
};
|
|
8268
|
+
}
|
|
8269
|
+
}
|
|
8270
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
8271
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
8272
|
+
rulesyncSubagent,
|
|
8273
|
+
toolTarget: "kiro"
|
|
8274
|
+
});
|
|
8275
|
+
}
|
|
8276
|
+
static async fromFile({
|
|
8277
|
+
baseDir = process.cwd(),
|
|
8278
|
+
relativeFilePath,
|
|
8279
|
+
validate = true,
|
|
8280
|
+
global = false
|
|
8281
|
+
}) {
|
|
8282
|
+
const paths = this.getSettablePaths({ global });
|
|
8283
|
+
const filePath = (0, import_node_path71.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8284
|
+
const fileContent = await readFileContent(filePath);
|
|
8285
|
+
return new _KiroSubagent({
|
|
8286
|
+
baseDir,
|
|
8287
|
+
relativeDirPath: paths.relativeDirPath,
|
|
8288
|
+
relativeFilePath,
|
|
8289
|
+
body: fileContent.trim(),
|
|
8290
|
+
fileContent,
|
|
8291
|
+
validate,
|
|
8292
|
+
global
|
|
8293
|
+
});
|
|
8294
|
+
}
|
|
8295
|
+
static forDeletion({
|
|
8296
|
+
baseDir = process.cwd(),
|
|
8297
|
+
relativeDirPath,
|
|
8298
|
+
relativeFilePath
|
|
8299
|
+
}) {
|
|
8300
|
+
return new _KiroSubagent({
|
|
8301
|
+
baseDir,
|
|
8302
|
+
relativeDirPath,
|
|
8303
|
+
relativeFilePath,
|
|
8304
|
+
body: "",
|
|
8305
|
+
fileContent: "",
|
|
8306
|
+
validate: false
|
|
8307
|
+
});
|
|
8308
|
+
}
|
|
8309
|
+
};
|
|
8310
|
+
|
|
8311
|
+
// src/features/subagents/opencode-subagent.ts
|
|
8312
|
+
var import_node_path72 = require("path");
|
|
8313
|
+
var import_mini35 = require("zod/mini");
|
|
8314
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini35.z.looseObject({
|
|
8315
|
+
description: import_mini35.z.string(),
|
|
8316
|
+
mode: import_mini35.z.literal("subagent"),
|
|
8317
|
+
name: import_mini35.z.optional(import_mini35.z.string())
|
|
8181
8318
|
});
|
|
8182
8319
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
8183
8320
|
frontmatter;
|
|
@@ -8187,7 +8324,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8187
8324
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
8188
8325
|
if (!result.success) {
|
|
8189
8326
|
throw new Error(
|
|
8190
|
-
`Invalid frontmatter in ${(0,
|
|
8327
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8191
8328
|
);
|
|
8192
8329
|
}
|
|
8193
8330
|
}
|
|
@@ -8201,7 +8338,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8201
8338
|
global = false
|
|
8202
8339
|
} = {}) {
|
|
8203
8340
|
return {
|
|
8204
|
-
relativeDirPath: global ? (0,
|
|
8341
|
+
relativeDirPath: global ? (0, import_node_path72.join)(".config", "opencode", "agent") : (0, import_node_path72.join)(".opencode", "agent")
|
|
8205
8342
|
};
|
|
8206
8343
|
}
|
|
8207
8344
|
getFrontmatter() {
|
|
@@ -8214,7 +8351,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8214
8351
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
8215
8352
|
const rulesyncFrontmatter = {
|
|
8216
8353
|
targets: ["*"],
|
|
8217
|
-
name: name ?? (0,
|
|
8354
|
+
name: name ?? (0, import_node_path72.basename)(this.getRelativeFilePath(), ".md"),
|
|
8218
8355
|
description,
|
|
8219
8356
|
opencode: { mode, ...opencodeSection }
|
|
8220
8357
|
};
|
|
@@ -8267,7 +8404,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8267
8404
|
return {
|
|
8268
8405
|
success: false,
|
|
8269
8406
|
error: new Error(
|
|
8270
|
-
`Invalid frontmatter in ${(0,
|
|
8407
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8271
8408
|
)
|
|
8272
8409
|
};
|
|
8273
8410
|
}
|
|
@@ -8284,7 +8421,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
8284
8421
|
global = false
|
|
8285
8422
|
}) {
|
|
8286
8423
|
const paths = this.getSettablePaths({ global });
|
|
8287
|
-
const filePath = (0,
|
|
8424
|
+
const filePath = (0, import_node_path72.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
8288
8425
|
const fileContent = await readFileContent(filePath);
|
|
8289
8426
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8290
8427
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -8328,41 +8465,82 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
8328
8465
|
"copilot",
|
|
8329
8466
|
"cursor",
|
|
8330
8467
|
"geminicli",
|
|
8468
|
+
"kiro",
|
|
8331
8469
|
"opencode",
|
|
8332
8470
|
"roo"
|
|
8333
8471
|
];
|
|
8334
|
-
var SubagentsProcessorToolTargetSchema =
|
|
8472
|
+
var SubagentsProcessorToolTargetSchema = import_mini36.z.enum(subagentsProcessorToolTargetTuple);
|
|
8335
8473
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
8336
8474
|
[
|
|
8337
8475
|
"agentsmd",
|
|
8338
|
-
{
|
|
8476
|
+
{
|
|
8477
|
+
class: AgentsmdSubagent,
|
|
8478
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8479
|
+
}
|
|
8339
8480
|
],
|
|
8340
8481
|
[
|
|
8341
8482
|
"claudecode",
|
|
8342
|
-
{
|
|
8483
|
+
{
|
|
8484
|
+
class: ClaudecodeSubagent,
|
|
8485
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8486
|
+
}
|
|
8343
8487
|
],
|
|
8344
8488
|
[
|
|
8345
8489
|
"claudecode-legacy",
|
|
8346
|
-
{
|
|
8490
|
+
{
|
|
8491
|
+
class: ClaudecodeSubagent,
|
|
8492
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8493
|
+
}
|
|
8347
8494
|
],
|
|
8348
8495
|
[
|
|
8349
8496
|
"codexcli",
|
|
8350
|
-
{
|
|
8497
|
+
{
|
|
8498
|
+
class: CodexCliSubagent,
|
|
8499
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8500
|
+
}
|
|
8351
8501
|
],
|
|
8352
8502
|
[
|
|
8353
8503
|
"copilot",
|
|
8354
|
-
{
|
|
8504
|
+
{
|
|
8505
|
+
class: CopilotSubagent,
|
|
8506
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
|
|
8507
|
+
}
|
|
8508
|
+
],
|
|
8509
|
+
[
|
|
8510
|
+
"cursor",
|
|
8511
|
+
{
|
|
8512
|
+
class: CursorSubagent,
|
|
8513
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8514
|
+
}
|
|
8355
8515
|
],
|
|
8356
|
-
["cursor", { class: CursorSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
8357
8516
|
[
|
|
8358
8517
|
"geminicli",
|
|
8359
|
-
{
|
|
8518
|
+
{
|
|
8519
|
+
class: GeminiCliSubagent,
|
|
8520
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8521
|
+
}
|
|
8522
|
+
],
|
|
8523
|
+
[
|
|
8524
|
+
"kiro",
|
|
8525
|
+
{
|
|
8526
|
+
class: KiroSubagent,
|
|
8527
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.json" }
|
|
8528
|
+
}
|
|
8360
8529
|
],
|
|
8361
8530
|
[
|
|
8362
8531
|
"opencode",
|
|
8363
|
-
{
|
|
8532
|
+
{
|
|
8533
|
+
class: OpenCodeSubagent,
|
|
8534
|
+
meta: { supportsSimulated: false, supportsGlobal: true, filePattern: "*.md" }
|
|
8535
|
+
}
|
|
8364
8536
|
],
|
|
8365
|
-
[
|
|
8537
|
+
[
|
|
8538
|
+
"roo",
|
|
8539
|
+
{
|
|
8540
|
+
class: RooSubagent,
|
|
8541
|
+
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
8542
|
+
}
|
|
8543
|
+
]
|
|
8366
8544
|
]);
|
|
8367
8545
|
var defaultGetFactory5 = (target) => {
|
|
8368
8546
|
const factory = toolSubagentFactories.get(target);
|
|
@@ -8445,7 +8623,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8445
8623
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
8446
8624
|
*/
|
|
8447
8625
|
async loadRulesyncFiles() {
|
|
8448
|
-
const subagentsDir = (0,
|
|
8626
|
+
const subagentsDir = (0, import_node_path73.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
8449
8627
|
const dirExists = await directoryExists(subagentsDir);
|
|
8450
8628
|
if (!dirExists) {
|
|
8451
8629
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -8460,7 +8638,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8460
8638
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
8461
8639
|
const rulesyncSubagents = [];
|
|
8462
8640
|
for (const mdFile of mdFiles) {
|
|
8463
|
-
const filepath = (0,
|
|
8641
|
+
const filepath = (0, import_node_path73.join)(subagentsDir, mdFile);
|
|
8464
8642
|
try {
|
|
8465
8643
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
8466
8644
|
relativeFilePath: mdFile,
|
|
@@ -8490,14 +8668,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8490
8668
|
const factory = this.getFactory(this.toolTarget);
|
|
8491
8669
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
8492
8670
|
const subagentFilePaths = await findFilesByGlobs(
|
|
8493
|
-
(0,
|
|
8671
|
+
(0, import_node_path73.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
8494
8672
|
);
|
|
8495
8673
|
if (forDeletion) {
|
|
8496
8674
|
const toolSubagents2 = subagentFilePaths.map(
|
|
8497
8675
|
(path3) => factory.class.forDeletion({
|
|
8498
8676
|
baseDir: this.baseDir,
|
|
8499
8677
|
relativeDirPath: paths.relativeDirPath,
|
|
8500
|
-
relativeFilePath: (0,
|
|
8678
|
+
relativeFilePath: (0, import_node_path73.basename)(path3),
|
|
8501
8679
|
global: this.global
|
|
8502
8680
|
})
|
|
8503
8681
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -8508,7 +8686,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8508
8686
|
subagentFilePaths.map(
|
|
8509
8687
|
(path3) => factory.class.fromFile({
|
|
8510
8688
|
baseDir: this.baseDir,
|
|
8511
|
-
relativeFilePath: (0,
|
|
8689
|
+
relativeFilePath: (0, import_node_path73.basename)(path3),
|
|
8512
8690
|
global: this.global
|
|
8513
8691
|
})
|
|
8514
8692
|
)
|
|
@@ -8540,48 +8718,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
8540
8718
|
};
|
|
8541
8719
|
|
|
8542
8720
|
// src/features/rules/agentsmd-rule.ts
|
|
8543
|
-
var
|
|
8721
|
+
var import_node_path76 = require("path");
|
|
8544
8722
|
|
|
8545
8723
|
// src/features/rules/tool-rule.ts
|
|
8546
|
-
var
|
|
8724
|
+
var import_node_path75 = require("path");
|
|
8547
8725
|
|
|
8548
8726
|
// src/features/rules/rulesync-rule.ts
|
|
8549
|
-
var
|
|
8550
|
-
var
|
|
8551
|
-
var RulesyncRuleFrontmatterSchema =
|
|
8552
|
-
root:
|
|
8553
|
-
targets:
|
|
8554
|
-
description:
|
|
8555
|
-
globs:
|
|
8556
|
-
agentsmd:
|
|
8557
|
-
|
|
8727
|
+
var import_node_path74 = require("path");
|
|
8728
|
+
var import_mini37 = require("zod/mini");
|
|
8729
|
+
var RulesyncRuleFrontmatterSchema = import_mini37.z.object({
|
|
8730
|
+
root: import_mini37.z.optional(import_mini37.z.optional(import_mini37.z.boolean())),
|
|
8731
|
+
targets: import_mini37.z.optional(RulesyncTargetsSchema),
|
|
8732
|
+
description: import_mini37.z.optional(import_mini37.z.string()),
|
|
8733
|
+
globs: import_mini37.z.optional(import_mini37.z.array(import_mini37.z.string())),
|
|
8734
|
+
agentsmd: import_mini37.z.optional(
|
|
8735
|
+
import_mini37.z.object({
|
|
8558
8736
|
// @example "path/to/subproject"
|
|
8559
|
-
subprojectPath:
|
|
8737
|
+
subprojectPath: import_mini37.z.optional(import_mini37.z.string())
|
|
8560
8738
|
})
|
|
8561
8739
|
),
|
|
8562
|
-
claudecode:
|
|
8563
|
-
|
|
8740
|
+
claudecode: import_mini37.z.optional(
|
|
8741
|
+
import_mini37.z.object({
|
|
8564
8742
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
8565
8743
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
8566
|
-
paths:
|
|
8744
|
+
paths: import_mini37.z.optional(import_mini37.z.string())
|
|
8567
8745
|
})
|
|
8568
8746
|
),
|
|
8569
|
-
cursor:
|
|
8570
|
-
|
|
8571
|
-
alwaysApply:
|
|
8572
|
-
description:
|
|
8573
|
-
globs:
|
|
8747
|
+
cursor: import_mini37.z.optional(
|
|
8748
|
+
import_mini37.z.object({
|
|
8749
|
+
alwaysApply: import_mini37.z.optional(import_mini37.z.boolean()),
|
|
8750
|
+
description: import_mini37.z.optional(import_mini37.z.string()),
|
|
8751
|
+
globs: import_mini37.z.optional(import_mini37.z.array(import_mini37.z.string()))
|
|
8574
8752
|
})
|
|
8575
8753
|
),
|
|
8576
|
-
copilot:
|
|
8577
|
-
|
|
8578
|
-
excludeAgent:
|
|
8754
|
+
copilot: import_mini37.z.optional(
|
|
8755
|
+
import_mini37.z.object({
|
|
8756
|
+
excludeAgent: import_mini37.z.optional(import_mini37.z.union([import_mini37.z.literal("code-review"), import_mini37.z.literal("coding-agent")]))
|
|
8579
8757
|
})
|
|
8580
8758
|
),
|
|
8581
|
-
antigravity:
|
|
8582
|
-
|
|
8583
|
-
trigger:
|
|
8584
|
-
globs:
|
|
8759
|
+
antigravity: import_mini37.z.optional(
|
|
8760
|
+
import_mini37.z.looseObject({
|
|
8761
|
+
trigger: import_mini37.z.optional(import_mini37.z.string()),
|
|
8762
|
+
globs: import_mini37.z.optional(import_mini37.z.array(import_mini37.z.string()))
|
|
8585
8763
|
})
|
|
8586
8764
|
)
|
|
8587
8765
|
});
|
|
@@ -8593,7 +8771,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8593
8771
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8594
8772
|
if (!result.success) {
|
|
8595
8773
|
throw new Error(
|
|
8596
|
-
`Invalid frontmatter in ${(0,
|
|
8774
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8597
8775
|
);
|
|
8598
8776
|
}
|
|
8599
8777
|
}
|
|
@@ -8628,7 +8806,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8628
8806
|
return {
|
|
8629
8807
|
success: false,
|
|
8630
8808
|
error: new Error(
|
|
8631
|
-
`Invalid frontmatter in ${(0,
|
|
8809
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8632
8810
|
)
|
|
8633
8811
|
};
|
|
8634
8812
|
}
|
|
@@ -8637,12 +8815,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8637
8815
|
relativeFilePath,
|
|
8638
8816
|
validate = true
|
|
8639
8817
|
}) {
|
|
8640
|
-
const legacyPath = (0,
|
|
8818
|
+
const legacyPath = (0, import_node_path74.join)(
|
|
8641
8819
|
process.cwd(),
|
|
8642
8820
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
8643
8821
|
relativeFilePath
|
|
8644
8822
|
);
|
|
8645
|
-
const recommendedPath = (0,
|
|
8823
|
+
const recommendedPath = (0, import_node_path74.join)(
|
|
8646
8824
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8647
8825
|
relativeFilePath
|
|
8648
8826
|
);
|
|
@@ -8663,7 +8841,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8663
8841
|
agentsmd: result.data.agentsmd,
|
|
8664
8842
|
cursor: result.data.cursor
|
|
8665
8843
|
};
|
|
8666
|
-
const filename = (0,
|
|
8844
|
+
const filename = (0, import_node_path74.basename)(legacyPath);
|
|
8667
8845
|
return new _RulesyncRule({
|
|
8668
8846
|
baseDir: process.cwd(),
|
|
8669
8847
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8677,7 +8855,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8677
8855
|
relativeFilePath,
|
|
8678
8856
|
validate = true
|
|
8679
8857
|
}) {
|
|
8680
|
-
const filePath = (0,
|
|
8858
|
+
const filePath = (0, import_node_path74.join)(
|
|
8681
8859
|
process.cwd(),
|
|
8682
8860
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
8683
8861
|
relativeFilePath
|
|
@@ -8696,7 +8874,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
8696
8874
|
agentsmd: result.data.agentsmd,
|
|
8697
8875
|
cursor: result.data.cursor
|
|
8698
8876
|
};
|
|
8699
|
-
const filename = (0,
|
|
8877
|
+
const filename = (0, import_node_path74.basename)(filePath);
|
|
8700
8878
|
return new _RulesyncRule({
|
|
8701
8879
|
baseDir: process.cwd(),
|
|
8702
8880
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -8779,7 +8957,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8779
8957
|
rulesyncRule,
|
|
8780
8958
|
validate = true,
|
|
8781
8959
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
8782
|
-
nonRootPath = { relativeDirPath: (0,
|
|
8960
|
+
nonRootPath = { relativeDirPath: (0, import_node_path75.join)(".agents", "memories") }
|
|
8783
8961
|
}) {
|
|
8784
8962
|
const params = this.buildToolRuleParamsDefault({
|
|
8785
8963
|
baseDir,
|
|
@@ -8790,7 +8968,7 @@ var ToolRule = class extends ToolFile {
|
|
|
8790
8968
|
});
|
|
8791
8969
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
8792
8970
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
8793
|
-
params.relativeDirPath = (0,
|
|
8971
|
+
params.relativeDirPath = (0, import_node_path75.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
8794
8972
|
params.relativeFilePath = "AGENTS.md";
|
|
8795
8973
|
}
|
|
8796
8974
|
return params;
|
|
@@ -8855,7 +9033,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8855
9033
|
relativeFilePath: "AGENTS.md"
|
|
8856
9034
|
},
|
|
8857
9035
|
nonRoot: {
|
|
8858
|
-
relativeDirPath: (0,
|
|
9036
|
+
relativeDirPath: (0, import_node_path76.join)(".agents", "memories")
|
|
8859
9037
|
}
|
|
8860
9038
|
};
|
|
8861
9039
|
}
|
|
@@ -8865,8 +9043,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8865
9043
|
validate = true
|
|
8866
9044
|
}) {
|
|
8867
9045
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
8868
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
8869
|
-
const fileContent = await readFileContent((0,
|
|
9046
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path76.join)(".agents", "memories", relativeFilePath);
|
|
9047
|
+
const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
|
|
8870
9048
|
return new _AgentsMdRule({
|
|
8871
9049
|
baseDir,
|
|
8872
9050
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -8921,21 +9099,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
8921
9099
|
};
|
|
8922
9100
|
|
|
8923
9101
|
// src/features/rules/antigravity-rule.ts
|
|
8924
|
-
var
|
|
8925
|
-
var
|
|
8926
|
-
var AntigravityRuleFrontmatterSchema =
|
|
8927
|
-
trigger:
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
9102
|
+
var import_node_path77 = require("path");
|
|
9103
|
+
var import_mini38 = require("zod/mini");
|
|
9104
|
+
var AntigravityRuleFrontmatterSchema = import_mini38.z.looseObject({
|
|
9105
|
+
trigger: import_mini38.z.optional(
|
|
9106
|
+
import_mini38.z.union([
|
|
9107
|
+
import_mini38.z.literal("always_on"),
|
|
9108
|
+
import_mini38.z.literal("glob"),
|
|
9109
|
+
import_mini38.z.literal("manual"),
|
|
9110
|
+
import_mini38.z.literal("model_decision"),
|
|
9111
|
+
import_mini38.z.string()
|
|
8934
9112
|
// accepts any string for forward compatibility
|
|
8935
9113
|
])
|
|
8936
9114
|
),
|
|
8937
|
-
globs:
|
|
8938
|
-
description:
|
|
9115
|
+
globs: import_mini38.z.optional(import_mini38.z.string()),
|
|
9116
|
+
description: import_mini38.z.optional(import_mini38.z.string())
|
|
8939
9117
|
});
|
|
8940
9118
|
function parseGlobsString(globs) {
|
|
8941
9119
|
if (!globs) {
|
|
@@ -9080,7 +9258,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9080
9258
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9081
9259
|
if (!result.success) {
|
|
9082
9260
|
throw new Error(
|
|
9083
|
-
`Invalid frontmatter in ${(0,
|
|
9261
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9084
9262
|
);
|
|
9085
9263
|
}
|
|
9086
9264
|
}
|
|
@@ -9095,7 +9273,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9095
9273
|
static getSettablePaths() {
|
|
9096
9274
|
return {
|
|
9097
9275
|
nonRoot: {
|
|
9098
|
-
relativeDirPath: (0,
|
|
9276
|
+
relativeDirPath: (0, import_node_path77.join)(".agent", "rules")
|
|
9099
9277
|
}
|
|
9100
9278
|
};
|
|
9101
9279
|
}
|
|
@@ -9104,7 +9282,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9104
9282
|
relativeFilePath,
|
|
9105
9283
|
validate = true
|
|
9106
9284
|
}) {
|
|
9107
|
-
const filePath = (0,
|
|
9285
|
+
const filePath = (0, import_node_path77.join)(
|
|
9108
9286
|
baseDir,
|
|
9109
9287
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9110
9288
|
relativeFilePath
|
|
@@ -9245,7 +9423,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
9245
9423
|
};
|
|
9246
9424
|
|
|
9247
9425
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
9248
|
-
var
|
|
9426
|
+
var import_node_path78 = require("path");
|
|
9249
9427
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
9250
9428
|
toRulesyncRule() {
|
|
9251
9429
|
const rulesyncFrontmatter = {
|
|
@@ -9271,7 +9449,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9271
9449
|
relativeFilePath: ".augment-guidelines"
|
|
9272
9450
|
},
|
|
9273
9451
|
nonRoot: {
|
|
9274
|
-
relativeDirPath: (0,
|
|
9452
|
+
relativeDirPath: (0, import_node_path78.join)(".augment", "rules")
|
|
9275
9453
|
}
|
|
9276
9454
|
};
|
|
9277
9455
|
}
|
|
@@ -9306,8 +9484,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9306
9484
|
}) {
|
|
9307
9485
|
const settablePaths = this.getSettablePaths();
|
|
9308
9486
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
9309
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
9310
|
-
const fileContent = await readFileContent((0,
|
|
9487
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path78.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9488
|
+
const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
|
|
9311
9489
|
return new _AugmentcodeLegacyRule({
|
|
9312
9490
|
baseDir,
|
|
9313
9491
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -9336,7 +9514,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
9336
9514
|
};
|
|
9337
9515
|
|
|
9338
9516
|
// src/features/rules/augmentcode-rule.ts
|
|
9339
|
-
var
|
|
9517
|
+
var import_node_path79 = require("path");
|
|
9340
9518
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
9341
9519
|
toRulesyncRule() {
|
|
9342
9520
|
return this.toRulesyncRuleDefault();
|
|
@@ -9344,7 +9522,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9344
9522
|
static getSettablePaths() {
|
|
9345
9523
|
return {
|
|
9346
9524
|
nonRoot: {
|
|
9347
|
-
relativeDirPath: (0,
|
|
9525
|
+
relativeDirPath: (0, import_node_path79.join)(".augment", "rules")
|
|
9348
9526
|
}
|
|
9349
9527
|
};
|
|
9350
9528
|
}
|
|
@@ -9368,7 +9546,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9368
9546
|
validate = true
|
|
9369
9547
|
}) {
|
|
9370
9548
|
const fileContent = await readFileContent(
|
|
9371
|
-
(0,
|
|
9549
|
+
(0, import_node_path79.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9372
9550
|
);
|
|
9373
9551
|
const { body: content } = parseFrontmatter(fileContent);
|
|
9374
9552
|
return new _AugmentcodeRule({
|
|
@@ -9404,7 +9582,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
9404
9582
|
};
|
|
9405
9583
|
|
|
9406
9584
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
9407
|
-
var
|
|
9585
|
+
var import_node_path80 = require("path");
|
|
9408
9586
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
9409
9587
|
static getSettablePaths({
|
|
9410
9588
|
global
|
|
@@ -9423,7 +9601,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9423
9601
|
relativeFilePath: "CLAUDE.md"
|
|
9424
9602
|
},
|
|
9425
9603
|
nonRoot: {
|
|
9426
|
-
relativeDirPath: (0,
|
|
9604
|
+
relativeDirPath: (0, import_node_path80.join)(".claude", "memories")
|
|
9427
9605
|
}
|
|
9428
9606
|
};
|
|
9429
9607
|
}
|
|
@@ -9438,7 +9616,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9438
9616
|
if (isRoot) {
|
|
9439
9617
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9440
9618
|
const fileContent2 = await readFileContent(
|
|
9441
|
-
(0,
|
|
9619
|
+
(0, import_node_path80.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9442
9620
|
);
|
|
9443
9621
|
return new _ClaudecodeLegacyRule({
|
|
9444
9622
|
baseDir,
|
|
@@ -9452,8 +9630,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9452
9630
|
if (!paths.nonRoot) {
|
|
9453
9631
|
throw new Error("nonRoot path is not set");
|
|
9454
9632
|
}
|
|
9455
|
-
const relativePath = (0,
|
|
9456
|
-
const fileContent = await readFileContent((0,
|
|
9633
|
+
const relativePath = (0, import_node_path80.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9634
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
9457
9635
|
return new _ClaudecodeLegacyRule({
|
|
9458
9636
|
baseDir,
|
|
9459
9637
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9512,10 +9690,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
9512
9690
|
};
|
|
9513
9691
|
|
|
9514
9692
|
// src/features/rules/claudecode-rule.ts
|
|
9515
|
-
var
|
|
9516
|
-
var
|
|
9517
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
9518
|
-
paths:
|
|
9693
|
+
var import_node_path81 = require("path");
|
|
9694
|
+
var import_mini39 = require("zod/mini");
|
|
9695
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini39.z.object({
|
|
9696
|
+
paths: import_mini39.z.optional(import_mini39.z.string())
|
|
9519
9697
|
});
|
|
9520
9698
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
9521
9699
|
frontmatter;
|
|
@@ -9537,7 +9715,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9537
9715
|
relativeFilePath: "CLAUDE.md"
|
|
9538
9716
|
},
|
|
9539
9717
|
nonRoot: {
|
|
9540
|
-
relativeDirPath: (0,
|
|
9718
|
+
relativeDirPath: (0, import_node_path81.join)(".claude", "rules")
|
|
9541
9719
|
}
|
|
9542
9720
|
};
|
|
9543
9721
|
}
|
|
@@ -9546,7 +9724,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9546
9724
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9547
9725
|
if (!result.success) {
|
|
9548
9726
|
throw new Error(
|
|
9549
|
-
`Invalid frontmatter in ${(0,
|
|
9727
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9550
9728
|
);
|
|
9551
9729
|
}
|
|
9552
9730
|
}
|
|
@@ -9574,7 +9752,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9574
9752
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
9575
9753
|
if (isRoot) {
|
|
9576
9754
|
const fileContent2 = await readFileContent(
|
|
9577
|
-
(0,
|
|
9755
|
+
(0, import_node_path81.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
9578
9756
|
);
|
|
9579
9757
|
return new _ClaudecodeRule({
|
|
9580
9758
|
baseDir,
|
|
@@ -9589,13 +9767,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9589
9767
|
if (!paths.nonRoot) {
|
|
9590
9768
|
throw new Error("nonRoot path is not set");
|
|
9591
9769
|
}
|
|
9592
|
-
const relativePath = (0,
|
|
9593
|
-
const fileContent = await readFileContent((0,
|
|
9770
|
+
const relativePath = (0, import_node_path81.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9771
|
+
const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
|
|
9594
9772
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9595
9773
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9596
9774
|
if (!result.success) {
|
|
9597
9775
|
throw new Error(
|
|
9598
|
-
`Invalid frontmatter in ${(0,
|
|
9776
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
9599
9777
|
);
|
|
9600
9778
|
}
|
|
9601
9779
|
return new _ClaudecodeRule({
|
|
@@ -9702,7 +9880,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9702
9880
|
return {
|
|
9703
9881
|
success: false,
|
|
9704
9882
|
error: new Error(
|
|
9705
|
-
`Invalid frontmatter in ${(0,
|
|
9883
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9706
9884
|
)
|
|
9707
9885
|
};
|
|
9708
9886
|
}
|
|
@@ -9722,10 +9900,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
9722
9900
|
};
|
|
9723
9901
|
|
|
9724
9902
|
// src/features/rules/cline-rule.ts
|
|
9725
|
-
var
|
|
9726
|
-
var
|
|
9727
|
-
var ClineRuleFrontmatterSchema =
|
|
9728
|
-
description:
|
|
9903
|
+
var import_node_path82 = require("path");
|
|
9904
|
+
var import_mini40 = require("zod/mini");
|
|
9905
|
+
var ClineRuleFrontmatterSchema = import_mini40.z.object({
|
|
9906
|
+
description: import_mini40.z.string()
|
|
9729
9907
|
});
|
|
9730
9908
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
9731
9909
|
static getSettablePaths() {
|
|
@@ -9767,7 +9945,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9767
9945
|
validate = true
|
|
9768
9946
|
}) {
|
|
9769
9947
|
const fileContent = await readFileContent(
|
|
9770
|
-
(0,
|
|
9948
|
+
(0, import_node_path82.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9771
9949
|
);
|
|
9772
9950
|
return new _ClineRule({
|
|
9773
9951
|
baseDir,
|
|
@@ -9793,7 +9971,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
9793
9971
|
};
|
|
9794
9972
|
|
|
9795
9973
|
// src/features/rules/codexcli-rule.ts
|
|
9796
|
-
var
|
|
9974
|
+
var import_node_path83 = require("path");
|
|
9797
9975
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
9798
9976
|
static getSettablePaths({
|
|
9799
9977
|
global
|
|
@@ -9812,7 +9990,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9812
9990
|
relativeFilePath: "AGENTS.md"
|
|
9813
9991
|
},
|
|
9814
9992
|
nonRoot: {
|
|
9815
|
-
relativeDirPath: (0,
|
|
9993
|
+
relativeDirPath: (0, import_node_path83.join)(".codex", "memories")
|
|
9816
9994
|
}
|
|
9817
9995
|
};
|
|
9818
9996
|
}
|
|
@@ -9827,7 +10005,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9827
10005
|
if (isRoot) {
|
|
9828
10006
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9829
10007
|
const fileContent2 = await readFileContent(
|
|
9830
|
-
(0,
|
|
10008
|
+
(0, import_node_path83.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9831
10009
|
);
|
|
9832
10010
|
return new _CodexcliRule({
|
|
9833
10011
|
baseDir,
|
|
@@ -9841,8 +10019,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9841
10019
|
if (!paths.nonRoot) {
|
|
9842
10020
|
throw new Error("nonRoot path is not set");
|
|
9843
10021
|
}
|
|
9844
|
-
const relativePath = (0,
|
|
9845
|
-
const fileContent = await readFileContent((0,
|
|
10022
|
+
const relativePath = (0, import_node_path83.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10023
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
9846
10024
|
return new _CodexcliRule({
|
|
9847
10025
|
baseDir,
|
|
9848
10026
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9901,12 +10079,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
9901
10079
|
};
|
|
9902
10080
|
|
|
9903
10081
|
// src/features/rules/copilot-rule.ts
|
|
9904
|
-
var
|
|
9905
|
-
var
|
|
9906
|
-
var CopilotRuleFrontmatterSchema =
|
|
9907
|
-
description:
|
|
9908
|
-
applyTo:
|
|
9909
|
-
excludeAgent:
|
|
10082
|
+
var import_node_path84 = require("path");
|
|
10083
|
+
var import_mini41 = require("zod/mini");
|
|
10084
|
+
var CopilotRuleFrontmatterSchema = import_mini41.z.object({
|
|
10085
|
+
description: import_mini41.z.optional(import_mini41.z.string()),
|
|
10086
|
+
applyTo: import_mini41.z.optional(import_mini41.z.string()),
|
|
10087
|
+
excludeAgent: import_mini41.z.optional(import_mini41.z.union([import_mini41.z.literal("code-review"), import_mini41.z.literal("coding-agent")]))
|
|
9910
10088
|
});
|
|
9911
10089
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
9912
10090
|
frontmatter;
|
|
@@ -9918,7 +10096,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9918
10096
|
relativeFilePath: "copilot-instructions.md"
|
|
9919
10097
|
},
|
|
9920
10098
|
nonRoot: {
|
|
9921
|
-
relativeDirPath: (0,
|
|
10099
|
+
relativeDirPath: (0, import_node_path84.join)(".github", "instructions")
|
|
9922
10100
|
}
|
|
9923
10101
|
};
|
|
9924
10102
|
}
|
|
@@ -9927,7 +10105,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9927
10105
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9928
10106
|
if (!result.success) {
|
|
9929
10107
|
throw new Error(
|
|
9930
|
-
`Invalid frontmatter in ${(0,
|
|
10108
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9931
10109
|
);
|
|
9932
10110
|
}
|
|
9933
10111
|
}
|
|
@@ -10009,11 +10187,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10009
10187
|
validate = true
|
|
10010
10188
|
}) {
|
|
10011
10189
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
10012
|
-
const relativePath = isRoot ? (0,
|
|
10190
|
+
const relativePath = isRoot ? (0, import_node_path84.join)(
|
|
10013
10191
|
this.getSettablePaths().root.relativeDirPath,
|
|
10014
10192
|
this.getSettablePaths().root.relativeFilePath
|
|
10015
|
-
) : (0,
|
|
10016
|
-
const fileContent = await readFileContent((0,
|
|
10193
|
+
) : (0, import_node_path84.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10194
|
+
const fileContent = await readFileContent((0, import_node_path84.join)(baseDir, relativePath));
|
|
10017
10195
|
if (isRoot) {
|
|
10018
10196
|
return new _CopilotRule({
|
|
10019
10197
|
baseDir,
|
|
@@ -10029,7 +10207,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10029
10207
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10030
10208
|
if (!result.success) {
|
|
10031
10209
|
throw new Error(
|
|
10032
|
-
`Invalid frontmatter in ${(0,
|
|
10210
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10033
10211
|
);
|
|
10034
10212
|
}
|
|
10035
10213
|
return new _CopilotRule({
|
|
@@ -10069,7 +10247,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10069
10247
|
return {
|
|
10070
10248
|
success: false,
|
|
10071
10249
|
error: new Error(
|
|
10072
|
-
`Invalid frontmatter in ${(0,
|
|
10250
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10073
10251
|
)
|
|
10074
10252
|
};
|
|
10075
10253
|
}
|
|
@@ -10089,12 +10267,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
10089
10267
|
};
|
|
10090
10268
|
|
|
10091
10269
|
// src/features/rules/cursor-rule.ts
|
|
10092
|
-
var
|
|
10093
|
-
var
|
|
10094
|
-
var CursorRuleFrontmatterSchema =
|
|
10095
|
-
description:
|
|
10096
|
-
globs:
|
|
10097
|
-
alwaysApply:
|
|
10270
|
+
var import_node_path85 = require("path");
|
|
10271
|
+
var import_mini42 = require("zod/mini");
|
|
10272
|
+
var CursorRuleFrontmatterSchema = import_mini42.z.object({
|
|
10273
|
+
description: import_mini42.z.optional(import_mini42.z.string()),
|
|
10274
|
+
globs: import_mini42.z.optional(import_mini42.z.string()),
|
|
10275
|
+
alwaysApply: import_mini42.z.optional(import_mini42.z.boolean())
|
|
10098
10276
|
});
|
|
10099
10277
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
10100
10278
|
frontmatter;
|
|
@@ -10102,7 +10280,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10102
10280
|
static getSettablePaths() {
|
|
10103
10281
|
return {
|
|
10104
10282
|
nonRoot: {
|
|
10105
|
-
relativeDirPath: (0,
|
|
10283
|
+
relativeDirPath: (0, import_node_path85.join)(".cursor", "rules")
|
|
10106
10284
|
}
|
|
10107
10285
|
};
|
|
10108
10286
|
}
|
|
@@ -10111,7 +10289,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10111
10289
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10112
10290
|
if (!result.success) {
|
|
10113
10291
|
throw new Error(
|
|
10114
|
-
`Invalid frontmatter in ${(0,
|
|
10292
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10115
10293
|
);
|
|
10116
10294
|
}
|
|
10117
10295
|
}
|
|
@@ -10228,19 +10406,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10228
10406
|
validate = true
|
|
10229
10407
|
}) {
|
|
10230
10408
|
const fileContent = await readFileContent(
|
|
10231
|
-
(0,
|
|
10409
|
+
(0, import_node_path85.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10232
10410
|
);
|
|
10233
10411
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
10234
10412
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
10235
10413
|
if (!result.success) {
|
|
10236
10414
|
throw new Error(
|
|
10237
|
-
`Invalid frontmatter in ${(0,
|
|
10415
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
10238
10416
|
);
|
|
10239
10417
|
}
|
|
10240
10418
|
return new _CursorRule({
|
|
10241
10419
|
baseDir,
|
|
10242
10420
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
10243
|
-
relativeFilePath: (0,
|
|
10421
|
+
relativeFilePath: (0, import_node_path85.basename)(relativeFilePath),
|
|
10244
10422
|
frontmatter: result.data,
|
|
10245
10423
|
body: content.trim(),
|
|
10246
10424
|
validate
|
|
@@ -10271,7 +10449,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10271
10449
|
return {
|
|
10272
10450
|
success: false,
|
|
10273
10451
|
error: new Error(
|
|
10274
|
-
`Invalid frontmatter in ${(0,
|
|
10452
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10275
10453
|
)
|
|
10276
10454
|
};
|
|
10277
10455
|
}
|
|
@@ -10291,7 +10469,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
10291
10469
|
};
|
|
10292
10470
|
|
|
10293
10471
|
// src/features/rules/geminicli-rule.ts
|
|
10294
|
-
var
|
|
10472
|
+
var import_node_path86 = require("path");
|
|
10295
10473
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
10296
10474
|
static getSettablePaths({
|
|
10297
10475
|
global
|
|
@@ -10310,7 +10488,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10310
10488
|
relativeFilePath: "GEMINI.md"
|
|
10311
10489
|
},
|
|
10312
10490
|
nonRoot: {
|
|
10313
|
-
relativeDirPath: (0,
|
|
10491
|
+
relativeDirPath: (0, import_node_path86.join)(".gemini", "memories")
|
|
10314
10492
|
}
|
|
10315
10493
|
};
|
|
10316
10494
|
}
|
|
@@ -10325,7 +10503,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10325
10503
|
if (isRoot) {
|
|
10326
10504
|
const relativePath2 = paths.root.relativeFilePath;
|
|
10327
10505
|
const fileContent2 = await readFileContent(
|
|
10328
|
-
(0,
|
|
10506
|
+
(0, import_node_path86.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
10329
10507
|
);
|
|
10330
10508
|
return new _GeminiCliRule({
|
|
10331
10509
|
baseDir,
|
|
@@ -10339,8 +10517,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10339
10517
|
if (!paths.nonRoot) {
|
|
10340
10518
|
throw new Error("nonRoot path is not set");
|
|
10341
10519
|
}
|
|
10342
|
-
const relativePath = (0,
|
|
10343
|
-
const fileContent = await readFileContent((0,
|
|
10520
|
+
const relativePath = (0, import_node_path86.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
10521
|
+
const fileContent = await readFileContent((0, import_node_path86.join)(baseDir, relativePath));
|
|
10344
10522
|
return new _GeminiCliRule({
|
|
10345
10523
|
baseDir,
|
|
10346
10524
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -10399,7 +10577,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
10399
10577
|
};
|
|
10400
10578
|
|
|
10401
10579
|
// src/features/rules/junie-rule.ts
|
|
10402
|
-
var
|
|
10580
|
+
var import_node_path87 = require("path");
|
|
10403
10581
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
10404
10582
|
static getSettablePaths() {
|
|
10405
10583
|
return {
|
|
@@ -10408,7 +10586,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10408
10586
|
relativeFilePath: "guidelines.md"
|
|
10409
10587
|
},
|
|
10410
10588
|
nonRoot: {
|
|
10411
|
-
relativeDirPath: (0,
|
|
10589
|
+
relativeDirPath: (0, import_node_path87.join)(".junie", "memories")
|
|
10412
10590
|
}
|
|
10413
10591
|
};
|
|
10414
10592
|
}
|
|
@@ -10418,8 +10596,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10418
10596
|
validate = true
|
|
10419
10597
|
}) {
|
|
10420
10598
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
10421
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
10422
|
-
const fileContent = await readFileContent((0,
|
|
10599
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path87.join)(".junie", "memories", relativeFilePath);
|
|
10600
|
+
const fileContent = await readFileContent((0, import_node_path87.join)(baseDir, relativePath));
|
|
10423
10601
|
return new _JunieRule({
|
|
10424
10602
|
baseDir,
|
|
10425
10603
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10474,12 +10652,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
10474
10652
|
};
|
|
10475
10653
|
|
|
10476
10654
|
// src/features/rules/kilo-rule.ts
|
|
10477
|
-
var
|
|
10655
|
+
var import_node_path88 = require("path");
|
|
10478
10656
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
10479
10657
|
static getSettablePaths(_options = {}) {
|
|
10480
10658
|
return {
|
|
10481
10659
|
nonRoot: {
|
|
10482
|
-
relativeDirPath: (0,
|
|
10660
|
+
relativeDirPath: (0, import_node_path88.join)(".kilocode", "rules")
|
|
10483
10661
|
}
|
|
10484
10662
|
};
|
|
10485
10663
|
}
|
|
@@ -10489,7 +10667,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10489
10667
|
validate = true
|
|
10490
10668
|
}) {
|
|
10491
10669
|
const fileContent = await readFileContent(
|
|
10492
|
-
(0,
|
|
10670
|
+
(0, import_node_path88.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10493
10671
|
);
|
|
10494
10672
|
return new _KiloRule({
|
|
10495
10673
|
baseDir,
|
|
@@ -10541,12 +10719,12 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
10541
10719
|
};
|
|
10542
10720
|
|
|
10543
10721
|
// src/features/rules/kiro-rule.ts
|
|
10544
|
-
var
|
|
10722
|
+
var import_node_path89 = require("path");
|
|
10545
10723
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
10546
10724
|
static getSettablePaths() {
|
|
10547
10725
|
return {
|
|
10548
10726
|
nonRoot: {
|
|
10549
|
-
relativeDirPath: (0,
|
|
10727
|
+
relativeDirPath: (0, import_node_path89.join)(".kiro", "steering")
|
|
10550
10728
|
}
|
|
10551
10729
|
};
|
|
10552
10730
|
}
|
|
@@ -10556,7 +10734,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10556
10734
|
validate = true
|
|
10557
10735
|
}) {
|
|
10558
10736
|
const fileContent = await readFileContent(
|
|
10559
|
-
(0,
|
|
10737
|
+
(0, import_node_path89.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10560
10738
|
);
|
|
10561
10739
|
return new _KiroRule({
|
|
10562
10740
|
baseDir,
|
|
@@ -10610,7 +10788,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
10610
10788
|
};
|
|
10611
10789
|
|
|
10612
10790
|
// src/features/rules/opencode-rule.ts
|
|
10613
|
-
var
|
|
10791
|
+
var import_node_path90 = require("path");
|
|
10614
10792
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
10615
10793
|
static getSettablePaths() {
|
|
10616
10794
|
return {
|
|
@@ -10619,7 +10797,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10619
10797
|
relativeFilePath: "AGENTS.md"
|
|
10620
10798
|
},
|
|
10621
10799
|
nonRoot: {
|
|
10622
|
-
relativeDirPath: (0,
|
|
10800
|
+
relativeDirPath: (0, import_node_path90.join)(".opencode", "memories")
|
|
10623
10801
|
}
|
|
10624
10802
|
};
|
|
10625
10803
|
}
|
|
@@ -10629,8 +10807,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10629
10807
|
validate = true
|
|
10630
10808
|
}) {
|
|
10631
10809
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
10632
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
10633
|
-
const fileContent = await readFileContent((0,
|
|
10810
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path90.join)(".opencode", "memories", relativeFilePath);
|
|
10811
|
+
const fileContent = await readFileContent((0, import_node_path90.join)(baseDir, relativePath));
|
|
10634
10812
|
return new _OpenCodeRule({
|
|
10635
10813
|
baseDir,
|
|
10636
10814
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10685,7 +10863,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
10685
10863
|
};
|
|
10686
10864
|
|
|
10687
10865
|
// src/features/rules/qwencode-rule.ts
|
|
10688
|
-
var
|
|
10866
|
+
var import_node_path91 = require("path");
|
|
10689
10867
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
10690
10868
|
static getSettablePaths() {
|
|
10691
10869
|
return {
|
|
@@ -10694,7 +10872,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10694
10872
|
relativeFilePath: "QWEN.md"
|
|
10695
10873
|
},
|
|
10696
10874
|
nonRoot: {
|
|
10697
|
-
relativeDirPath: (0,
|
|
10875
|
+
relativeDirPath: (0, import_node_path91.join)(".qwen", "memories")
|
|
10698
10876
|
}
|
|
10699
10877
|
};
|
|
10700
10878
|
}
|
|
@@ -10704,8 +10882,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10704
10882
|
validate = true
|
|
10705
10883
|
}) {
|
|
10706
10884
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
10707
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
10708
|
-
const fileContent = await readFileContent((0,
|
|
10885
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path91.join)(".qwen", "memories", relativeFilePath);
|
|
10886
|
+
const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
|
|
10709
10887
|
return new _QwencodeRule({
|
|
10710
10888
|
baseDir,
|
|
10711
10889
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -10757,7 +10935,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
10757
10935
|
};
|
|
10758
10936
|
|
|
10759
10937
|
// src/features/rules/replit-rule.ts
|
|
10760
|
-
var
|
|
10938
|
+
var import_node_path92 = require("path");
|
|
10761
10939
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
10762
10940
|
static getSettablePaths() {
|
|
10763
10941
|
return {
|
|
@@ -10779,7 +10957,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10779
10957
|
}
|
|
10780
10958
|
const relativePath = paths.root.relativeFilePath;
|
|
10781
10959
|
const fileContent = await readFileContent(
|
|
10782
|
-
(0,
|
|
10960
|
+
(0, import_node_path92.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
10783
10961
|
);
|
|
10784
10962
|
return new _ReplitRule({
|
|
10785
10963
|
baseDir,
|
|
@@ -10845,12 +11023,12 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
10845
11023
|
};
|
|
10846
11024
|
|
|
10847
11025
|
// src/features/rules/roo-rule.ts
|
|
10848
|
-
var
|
|
11026
|
+
var import_node_path93 = require("path");
|
|
10849
11027
|
var RooRule = class _RooRule extends ToolRule {
|
|
10850
11028
|
static getSettablePaths() {
|
|
10851
11029
|
return {
|
|
10852
11030
|
nonRoot: {
|
|
10853
|
-
relativeDirPath: (0,
|
|
11031
|
+
relativeDirPath: (0, import_node_path93.join)(".roo", "rules")
|
|
10854
11032
|
}
|
|
10855
11033
|
};
|
|
10856
11034
|
}
|
|
@@ -10860,7 +11038,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10860
11038
|
validate = true
|
|
10861
11039
|
}) {
|
|
10862
11040
|
const fileContent = await readFileContent(
|
|
10863
|
-
(0,
|
|
11041
|
+
(0, import_node_path93.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
10864
11042
|
);
|
|
10865
11043
|
return new _RooRule({
|
|
10866
11044
|
baseDir,
|
|
@@ -10929,7 +11107,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
10929
11107
|
};
|
|
10930
11108
|
|
|
10931
11109
|
// src/features/rules/warp-rule.ts
|
|
10932
|
-
var
|
|
11110
|
+
var import_node_path94 = require("path");
|
|
10933
11111
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
10934
11112
|
constructor({ fileContent, root, ...rest }) {
|
|
10935
11113
|
super({
|
|
@@ -10945,7 +11123,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10945
11123
|
relativeFilePath: "WARP.md"
|
|
10946
11124
|
},
|
|
10947
11125
|
nonRoot: {
|
|
10948
|
-
relativeDirPath: (0,
|
|
11126
|
+
relativeDirPath: (0, import_node_path94.join)(".warp", "memories")
|
|
10949
11127
|
}
|
|
10950
11128
|
};
|
|
10951
11129
|
}
|
|
@@ -10955,8 +11133,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
10955
11133
|
validate = true
|
|
10956
11134
|
}) {
|
|
10957
11135
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
10958
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
10959
|
-
const fileContent = await readFileContent((0,
|
|
11136
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path94.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
11137
|
+
const fileContent = await readFileContent((0, import_node_path94.join)(baseDir, relativePath));
|
|
10960
11138
|
return new _WarpRule({
|
|
10961
11139
|
baseDir,
|
|
10962
11140
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -11011,12 +11189,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
11011
11189
|
};
|
|
11012
11190
|
|
|
11013
11191
|
// src/features/rules/windsurf-rule.ts
|
|
11014
|
-
var
|
|
11192
|
+
var import_node_path95 = require("path");
|
|
11015
11193
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
11016
11194
|
static getSettablePaths() {
|
|
11017
11195
|
return {
|
|
11018
11196
|
nonRoot: {
|
|
11019
|
-
relativeDirPath: (0,
|
|
11197
|
+
relativeDirPath: (0, import_node_path95.join)(".windsurf", "rules")
|
|
11020
11198
|
}
|
|
11021
11199
|
};
|
|
11022
11200
|
}
|
|
@@ -11026,7 +11204,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
11026
11204
|
validate = true
|
|
11027
11205
|
}) {
|
|
11028
11206
|
const fileContent = await readFileContent(
|
|
11029
|
-
(0,
|
|
11207
|
+
(0, import_node_path95.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11030
11208
|
);
|
|
11031
11209
|
return new _WindsurfRule({
|
|
11032
11210
|
baseDir,
|
|
@@ -11100,7 +11278,7 @@ var rulesProcessorToolTargets = [
|
|
|
11100
11278
|
"warp",
|
|
11101
11279
|
"windsurf"
|
|
11102
11280
|
];
|
|
11103
|
-
var RulesProcessorToolTargetSchema =
|
|
11281
|
+
var RulesProcessorToolTargetSchema = import_mini43.z.enum(rulesProcessorToolTargets);
|
|
11104
11282
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
11105
11283
|
[
|
|
11106
11284
|
"agentsmd",
|
|
@@ -11391,7 +11569,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11391
11569
|
}).relativeDirPath;
|
|
11392
11570
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
11393
11571
|
const frontmatter = skill.getFrontmatter();
|
|
11394
|
-
const relativePath = (0,
|
|
11572
|
+
const relativePath = (0, import_node_path96.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
11395
11573
|
return {
|
|
11396
11574
|
name: frontmatter.name,
|
|
11397
11575
|
description: frontmatter.description,
|
|
@@ -11458,10 +11636,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11458
11636
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
11459
11637
|
*/
|
|
11460
11638
|
async loadRulesyncFiles() {
|
|
11461
|
-
const files = await findFilesByGlobs((0,
|
|
11639
|
+
const files = await findFilesByGlobs((0, import_node_path96.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
11462
11640
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
11463
11641
|
const rulesyncRules = await Promise.all(
|
|
11464
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
11642
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path96.basename)(file) }))
|
|
11465
11643
|
);
|
|
11466
11644
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
11467
11645
|
if (rootRules.length > 1) {
|
|
@@ -11479,10 +11657,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11479
11657
|
return rulesyncRules;
|
|
11480
11658
|
}
|
|
11481
11659
|
async loadRulesyncFilesLegacy() {
|
|
11482
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
11660
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path96.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
11483
11661
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
11484
11662
|
return Promise.all(
|
|
11485
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
11663
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path96.basename)(file) }))
|
|
11486
11664
|
);
|
|
11487
11665
|
}
|
|
11488
11666
|
/**
|
|
@@ -11500,7 +11678,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11500
11678
|
return [];
|
|
11501
11679
|
}
|
|
11502
11680
|
const rootFilePaths = await findFilesByGlobs(
|
|
11503
|
-
(0,
|
|
11681
|
+
(0, import_node_path96.join)(
|
|
11504
11682
|
this.baseDir,
|
|
11505
11683
|
settablePaths.root.relativeDirPath ?? ".",
|
|
11506
11684
|
settablePaths.root.relativeFilePath
|
|
@@ -11511,7 +11689,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11511
11689
|
(filePath) => factory.class.forDeletion({
|
|
11512
11690
|
baseDir: this.baseDir,
|
|
11513
11691
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
11514
|
-
relativeFilePath: (0,
|
|
11692
|
+
relativeFilePath: (0, import_node_path96.basename)(filePath),
|
|
11515
11693
|
global: this.global
|
|
11516
11694
|
})
|
|
11517
11695
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11520,7 +11698,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11520
11698
|
rootFilePaths.map(
|
|
11521
11699
|
(filePath) => factory.class.fromFile({
|
|
11522
11700
|
baseDir: this.baseDir,
|
|
11523
|
-
relativeFilePath: (0,
|
|
11701
|
+
relativeFilePath: (0, import_node_path96.basename)(filePath),
|
|
11524
11702
|
global: this.global
|
|
11525
11703
|
})
|
|
11526
11704
|
)
|
|
@@ -11532,14 +11710,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11532
11710
|
return [];
|
|
11533
11711
|
}
|
|
11534
11712
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
11535
|
-
(0,
|
|
11713
|
+
(0, import_node_path96.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
11536
11714
|
);
|
|
11537
11715
|
if (forDeletion) {
|
|
11538
11716
|
return nonRootFilePaths.map(
|
|
11539
11717
|
(filePath) => factory.class.forDeletion({
|
|
11540
11718
|
baseDir: this.baseDir,
|
|
11541
11719
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
11542
|
-
relativeFilePath: (0,
|
|
11720
|
+
relativeFilePath: (0, import_node_path96.basename)(filePath),
|
|
11543
11721
|
global: this.global
|
|
11544
11722
|
})
|
|
11545
11723
|
).filter((rule) => rule.isDeletable());
|
|
@@ -11548,7 +11726,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
11548
11726
|
nonRootFilePaths.map(
|
|
11549
11727
|
(filePath) => factory.class.fromFile({
|
|
11550
11728
|
baseDir: this.baseDir,
|
|
11551
|
-
relativeFilePath: (0,
|
|
11729
|
+
relativeFilePath: (0, import_node_path96.basename)(filePath),
|
|
11552
11730
|
global: this.global
|
|
11553
11731
|
})
|
|
11554
11732
|
)
|
|
@@ -11641,14 +11819,14 @@ s/<command> [arguments]
|
|
|
11641
11819
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
11642
11820
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
11643
11821
|
|
|
11644
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
11822
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path96.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
11645
11823
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
11646
11824
|
|
|
11647
11825
|
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.
|
|
11648
11826
|
|
|
11649
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
11827
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path96.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
11650
11828
|
|
|
11651
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
11829
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path96.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
11652
11830
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
11653
11831
|
const result = [
|
|
11654
11832
|
overview,
|
|
@@ -11930,7 +12108,7 @@ async function generateSkills(config) {
|
|
|
11930
12108
|
}
|
|
11931
12109
|
|
|
11932
12110
|
// src/cli/commands/gitignore.ts
|
|
11933
|
-
var
|
|
12111
|
+
var import_node_path97 = require("path");
|
|
11934
12112
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
11935
12113
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
11936
12114
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -11994,6 +12172,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
11994
12172
|
// Kiro
|
|
11995
12173
|
"**/.kiro/steering/",
|
|
11996
12174
|
"**/.kiro/prompts/",
|
|
12175
|
+
"**/.kiro/agents/",
|
|
11997
12176
|
"**/.kiro/settings/mcp.json",
|
|
11998
12177
|
"**/.aiignore",
|
|
11999
12178
|
// OpenCode
|
|
@@ -12069,7 +12248,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
12069
12248
|
return result;
|
|
12070
12249
|
};
|
|
12071
12250
|
var gitignoreCommand = async () => {
|
|
12072
|
-
const gitignorePath = (0,
|
|
12251
|
+
const gitignorePath = (0, import_node_path97.join)(process.cwd(), ".gitignore");
|
|
12073
12252
|
let gitignoreContent = "";
|
|
12074
12253
|
if (await fileExists(gitignorePath)) {
|
|
12075
12254
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -12268,7 +12447,7 @@ async function importSkills(config, tool) {
|
|
|
12268
12447
|
}
|
|
12269
12448
|
|
|
12270
12449
|
// src/cli/commands/init.ts
|
|
12271
|
-
var
|
|
12450
|
+
var import_node_path98 = require("path");
|
|
12272
12451
|
async function initCommand() {
|
|
12273
12452
|
logger.info("Initializing rulesync...");
|
|
12274
12453
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -12446,14 +12625,14 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12446
12625
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
12447
12626
|
await ensureDir(skillPaths.relativeDirPath);
|
|
12448
12627
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
12449
|
-
const ruleFilepath = (0,
|
|
12628
|
+
const ruleFilepath = (0, import_node_path98.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
12450
12629
|
if (!await fileExists(ruleFilepath)) {
|
|
12451
12630
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
12452
12631
|
logger.success(`Created ${ruleFilepath}`);
|
|
12453
12632
|
} else {
|
|
12454
12633
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
12455
12634
|
}
|
|
12456
|
-
const mcpFilepath = (0,
|
|
12635
|
+
const mcpFilepath = (0, import_node_path98.join)(
|
|
12457
12636
|
mcpPaths.recommended.relativeDirPath,
|
|
12458
12637
|
mcpPaths.recommended.relativeFilePath
|
|
12459
12638
|
);
|
|
@@ -12463,30 +12642,30 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12463
12642
|
} else {
|
|
12464
12643
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
12465
12644
|
}
|
|
12466
|
-
const commandFilepath = (0,
|
|
12645
|
+
const commandFilepath = (0, import_node_path98.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
12467
12646
|
if (!await fileExists(commandFilepath)) {
|
|
12468
12647
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
12469
12648
|
logger.success(`Created ${commandFilepath}`);
|
|
12470
12649
|
} else {
|
|
12471
12650
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
12472
12651
|
}
|
|
12473
|
-
const subagentFilepath = (0,
|
|
12652
|
+
const subagentFilepath = (0, import_node_path98.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
12474
12653
|
if (!await fileExists(subagentFilepath)) {
|
|
12475
12654
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
12476
12655
|
logger.success(`Created ${subagentFilepath}`);
|
|
12477
12656
|
} else {
|
|
12478
12657
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
12479
12658
|
}
|
|
12480
|
-
const skillDirPath = (0,
|
|
12659
|
+
const skillDirPath = (0, import_node_path98.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
12481
12660
|
await ensureDir(skillDirPath);
|
|
12482
|
-
const skillFilepath = (0,
|
|
12661
|
+
const skillFilepath = (0, import_node_path98.join)(skillDirPath, SKILL_FILE_NAME);
|
|
12483
12662
|
if (!await fileExists(skillFilepath)) {
|
|
12484
12663
|
await writeFileContent(skillFilepath, sampleSkillFile.content);
|
|
12485
12664
|
logger.success(`Created ${skillFilepath}`);
|
|
12486
12665
|
} else {
|
|
12487
12666
|
logger.info(`Skipped ${skillFilepath} (already exists)`);
|
|
12488
12667
|
}
|
|
12489
|
-
const ignoreFilepath = (0,
|
|
12668
|
+
const ignoreFilepath = (0, import_node_path98.join)(
|
|
12490
12669
|
ignorePaths.recommended.relativeDirPath,
|
|
12491
12670
|
ignorePaths.recommended.relativeFilePath
|
|
12492
12671
|
);
|
|
@@ -12502,15 +12681,15 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
12502
12681
|
var import_fastmcp = require("fastmcp");
|
|
12503
12682
|
|
|
12504
12683
|
// src/mcp/tools.ts
|
|
12505
|
-
var
|
|
12684
|
+
var import_mini50 = require("zod/mini");
|
|
12506
12685
|
|
|
12507
12686
|
// src/mcp/commands.ts
|
|
12508
|
-
var
|
|
12509
|
-
var
|
|
12687
|
+
var import_node_path99 = require("path");
|
|
12688
|
+
var import_mini44 = require("zod/mini");
|
|
12510
12689
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
12511
12690
|
var maxCommandsCount = 1e3;
|
|
12512
12691
|
async function listCommands() {
|
|
12513
|
-
const commandsDir = (0,
|
|
12692
|
+
const commandsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12514
12693
|
try {
|
|
12515
12694
|
const files = await listDirectoryFiles(commandsDir);
|
|
12516
12695
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12522,7 +12701,7 @@ async function listCommands() {
|
|
|
12522
12701
|
});
|
|
12523
12702
|
const frontmatter = command.getFrontmatter();
|
|
12524
12703
|
return {
|
|
12525
|
-
relativePathFromCwd: (0,
|
|
12704
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
12526
12705
|
frontmatter
|
|
12527
12706
|
};
|
|
12528
12707
|
} catch (error) {
|
|
@@ -12542,13 +12721,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
12542
12721
|
relativePath: relativePathFromCwd,
|
|
12543
12722
|
intendedRootDir: process.cwd()
|
|
12544
12723
|
});
|
|
12545
|
-
const filename = (0,
|
|
12724
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12546
12725
|
try {
|
|
12547
12726
|
const command = await RulesyncCommand.fromFile({
|
|
12548
12727
|
relativeFilePath: filename
|
|
12549
12728
|
});
|
|
12550
12729
|
return {
|
|
12551
|
-
relativePathFromCwd: (0,
|
|
12730
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12552
12731
|
frontmatter: command.getFrontmatter(),
|
|
12553
12732
|
body: command.getBody()
|
|
12554
12733
|
};
|
|
@@ -12567,7 +12746,7 @@ async function putCommand({
|
|
|
12567
12746
|
relativePath: relativePathFromCwd,
|
|
12568
12747
|
intendedRootDir: process.cwd()
|
|
12569
12748
|
});
|
|
12570
|
-
const filename = (0,
|
|
12749
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12571
12750
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12572
12751
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
12573
12752
|
throw new Error(
|
|
@@ -12577,7 +12756,7 @@ async function putCommand({
|
|
|
12577
12756
|
try {
|
|
12578
12757
|
const existingCommands = await listCommands();
|
|
12579
12758
|
const isUpdate = existingCommands.some(
|
|
12580
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
12759
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12581
12760
|
);
|
|
12582
12761
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
12583
12762
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -12592,11 +12771,11 @@ async function putCommand({
|
|
|
12592
12771
|
fileContent,
|
|
12593
12772
|
validate: true
|
|
12594
12773
|
});
|
|
12595
|
-
const commandsDir = (0,
|
|
12774
|
+
const commandsDir = (0, import_node_path99.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
12596
12775
|
await ensureDir(commandsDir);
|
|
12597
12776
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
12598
12777
|
return {
|
|
12599
|
-
relativePathFromCwd: (0,
|
|
12778
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
12600
12779
|
frontmatter: command.getFrontmatter(),
|
|
12601
12780
|
body: command.getBody()
|
|
12602
12781
|
};
|
|
@@ -12611,12 +12790,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12611
12790
|
relativePath: relativePathFromCwd,
|
|
12612
12791
|
intendedRootDir: process.cwd()
|
|
12613
12792
|
});
|
|
12614
|
-
const filename = (0,
|
|
12615
|
-
const fullPath = (0,
|
|
12793
|
+
const filename = (0, import_node_path99.basename)(relativePathFromCwd);
|
|
12794
|
+
const fullPath = (0, import_node_path99.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
12616
12795
|
try {
|
|
12617
12796
|
await removeFile(fullPath);
|
|
12618
12797
|
return {
|
|
12619
|
-
relativePathFromCwd: (0,
|
|
12798
|
+
relativePathFromCwd: (0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
12620
12799
|
};
|
|
12621
12800
|
} catch (error) {
|
|
12622
12801
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -12625,23 +12804,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
12625
12804
|
}
|
|
12626
12805
|
}
|
|
12627
12806
|
var commandToolSchemas = {
|
|
12628
|
-
listCommands:
|
|
12629
|
-
getCommand:
|
|
12630
|
-
relativePathFromCwd:
|
|
12807
|
+
listCommands: import_mini44.z.object({}),
|
|
12808
|
+
getCommand: import_mini44.z.object({
|
|
12809
|
+
relativePathFromCwd: import_mini44.z.string()
|
|
12631
12810
|
}),
|
|
12632
|
-
putCommand:
|
|
12633
|
-
relativePathFromCwd:
|
|
12811
|
+
putCommand: import_mini44.z.object({
|
|
12812
|
+
relativePathFromCwd: import_mini44.z.string(),
|
|
12634
12813
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
12635
|
-
body:
|
|
12814
|
+
body: import_mini44.z.string()
|
|
12636
12815
|
}),
|
|
12637
|
-
deleteCommand:
|
|
12638
|
-
relativePathFromCwd:
|
|
12816
|
+
deleteCommand: import_mini44.z.object({
|
|
12817
|
+
relativePathFromCwd: import_mini44.z.string()
|
|
12639
12818
|
})
|
|
12640
12819
|
};
|
|
12641
12820
|
var commandTools = {
|
|
12642
12821
|
listCommands: {
|
|
12643
12822
|
name: "listCommands",
|
|
12644
|
-
description: `List all commands from ${(0,
|
|
12823
|
+
description: `List all commands from ${(0, import_node_path99.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12645
12824
|
parameters: commandToolSchemas.listCommands,
|
|
12646
12825
|
execute: async () => {
|
|
12647
12826
|
const commands = await listCommands();
|
|
@@ -12683,11 +12862,11 @@ var commandTools = {
|
|
|
12683
12862
|
};
|
|
12684
12863
|
|
|
12685
12864
|
// src/mcp/ignore.ts
|
|
12686
|
-
var
|
|
12687
|
-
var
|
|
12865
|
+
var import_node_path100 = require("path");
|
|
12866
|
+
var import_mini45 = require("zod/mini");
|
|
12688
12867
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
12689
12868
|
async function getIgnoreFile() {
|
|
12690
|
-
const ignoreFilePath = (0,
|
|
12869
|
+
const ignoreFilePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12691
12870
|
try {
|
|
12692
12871
|
const content = await readFileContent(ignoreFilePath);
|
|
12693
12872
|
return {
|
|
@@ -12701,7 +12880,7 @@ async function getIgnoreFile() {
|
|
|
12701
12880
|
}
|
|
12702
12881
|
}
|
|
12703
12882
|
async function putIgnoreFile({ content }) {
|
|
12704
|
-
const ignoreFilePath = (0,
|
|
12883
|
+
const ignoreFilePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12705
12884
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
12706
12885
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
12707
12886
|
throw new Error(
|
|
@@ -12722,8 +12901,8 @@ async function putIgnoreFile({ content }) {
|
|
|
12722
12901
|
}
|
|
12723
12902
|
}
|
|
12724
12903
|
async function deleteIgnoreFile() {
|
|
12725
|
-
const aiignorePath = (0,
|
|
12726
|
-
const legacyIgnorePath = (0,
|
|
12904
|
+
const aiignorePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12905
|
+
const legacyIgnorePath = (0, import_node_path100.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
12727
12906
|
try {
|
|
12728
12907
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
12729
12908
|
return {
|
|
@@ -12741,11 +12920,11 @@ async function deleteIgnoreFile() {
|
|
|
12741
12920
|
}
|
|
12742
12921
|
}
|
|
12743
12922
|
var ignoreToolSchemas = {
|
|
12744
|
-
getIgnoreFile:
|
|
12745
|
-
putIgnoreFile:
|
|
12746
|
-
content:
|
|
12923
|
+
getIgnoreFile: import_mini45.z.object({}),
|
|
12924
|
+
putIgnoreFile: import_mini45.z.object({
|
|
12925
|
+
content: import_mini45.z.string()
|
|
12747
12926
|
}),
|
|
12748
|
-
deleteIgnoreFile:
|
|
12927
|
+
deleteIgnoreFile: import_mini45.z.object({})
|
|
12749
12928
|
};
|
|
12750
12929
|
var ignoreTools = {
|
|
12751
12930
|
getIgnoreFile: {
|
|
@@ -12778,8 +12957,8 @@ var ignoreTools = {
|
|
|
12778
12957
|
};
|
|
12779
12958
|
|
|
12780
12959
|
// src/mcp/mcp.ts
|
|
12781
|
-
var
|
|
12782
|
-
var
|
|
12960
|
+
var import_node_path101 = require("path");
|
|
12961
|
+
var import_mini46 = require("zod/mini");
|
|
12783
12962
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
12784
12963
|
async function getMcpFile() {
|
|
12785
12964
|
const config = await ConfigResolver.resolve({});
|
|
@@ -12788,7 +12967,7 @@ async function getMcpFile() {
|
|
|
12788
12967
|
validate: true,
|
|
12789
12968
|
modularMcp: config.getModularMcp()
|
|
12790
12969
|
});
|
|
12791
|
-
const relativePathFromCwd = (0,
|
|
12970
|
+
const relativePathFromCwd = (0, import_node_path101.join)(
|
|
12792
12971
|
rulesyncMcp.getRelativeDirPath(),
|
|
12793
12972
|
rulesyncMcp.getRelativeFilePath()
|
|
12794
12973
|
);
|
|
@@ -12821,7 +13000,7 @@ async function putMcpFile({ content }) {
|
|
|
12821
13000
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12822
13001
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
12823
13002
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
12824
|
-
const fullPath = (0,
|
|
13003
|
+
const fullPath = (0, import_node_path101.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
12825
13004
|
const rulesyncMcp = new RulesyncMcp({
|
|
12826
13005
|
baseDir,
|
|
12827
13006
|
relativeDirPath,
|
|
@@ -12830,9 +13009,9 @@ async function putMcpFile({ content }) {
|
|
|
12830
13009
|
validate: true,
|
|
12831
13010
|
modularMcp: config.getModularMcp()
|
|
12832
13011
|
});
|
|
12833
|
-
await ensureDir((0,
|
|
13012
|
+
await ensureDir((0, import_node_path101.join)(baseDir, relativeDirPath));
|
|
12834
13013
|
await writeFileContent(fullPath, content);
|
|
12835
|
-
const relativePathFromCwd = (0,
|
|
13014
|
+
const relativePathFromCwd = (0, import_node_path101.join)(relativeDirPath, relativeFilePath);
|
|
12836
13015
|
return {
|
|
12837
13016
|
relativePathFromCwd,
|
|
12838
13017
|
content: rulesyncMcp.getFileContent()
|
|
@@ -12847,15 +13026,15 @@ async function deleteMcpFile() {
|
|
|
12847
13026
|
try {
|
|
12848
13027
|
const baseDir = process.cwd();
|
|
12849
13028
|
const paths = RulesyncMcp.getSettablePaths();
|
|
12850
|
-
const recommendedPath = (0,
|
|
13029
|
+
const recommendedPath = (0, import_node_path101.join)(
|
|
12851
13030
|
baseDir,
|
|
12852
13031
|
paths.recommended.relativeDirPath,
|
|
12853
13032
|
paths.recommended.relativeFilePath
|
|
12854
13033
|
);
|
|
12855
|
-
const legacyPath = (0,
|
|
13034
|
+
const legacyPath = (0, import_node_path101.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
12856
13035
|
await removeFile(recommendedPath);
|
|
12857
13036
|
await removeFile(legacyPath);
|
|
12858
|
-
const relativePathFromCwd = (0,
|
|
13037
|
+
const relativePathFromCwd = (0, import_node_path101.join)(
|
|
12859
13038
|
paths.recommended.relativeDirPath,
|
|
12860
13039
|
paths.recommended.relativeFilePath
|
|
12861
13040
|
);
|
|
@@ -12869,11 +13048,11 @@ async function deleteMcpFile() {
|
|
|
12869
13048
|
}
|
|
12870
13049
|
}
|
|
12871
13050
|
var mcpToolSchemas = {
|
|
12872
|
-
getMcpFile:
|
|
12873
|
-
putMcpFile:
|
|
12874
|
-
content:
|
|
13051
|
+
getMcpFile: import_mini46.z.object({}),
|
|
13052
|
+
putMcpFile: import_mini46.z.object({
|
|
13053
|
+
content: import_mini46.z.string()
|
|
12875
13054
|
}),
|
|
12876
|
-
deleteMcpFile:
|
|
13055
|
+
deleteMcpFile: import_mini46.z.object({})
|
|
12877
13056
|
};
|
|
12878
13057
|
var mcpTools = {
|
|
12879
13058
|
getMcpFile: {
|
|
@@ -12906,12 +13085,12 @@ var mcpTools = {
|
|
|
12906
13085
|
};
|
|
12907
13086
|
|
|
12908
13087
|
// src/mcp/rules.ts
|
|
12909
|
-
var
|
|
12910
|
-
var
|
|
13088
|
+
var import_node_path102 = require("path");
|
|
13089
|
+
var import_mini47 = require("zod/mini");
|
|
12911
13090
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
12912
13091
|
var maxRulesCount = 1e3;
|
|
12913
13092
|
async function listRules() {
|
|
12914
|
-
const rulesDir = (0,
|
|
13093
|
+
const rulesDir = (0, import_node_path102.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12915
13094
|
try {
|
|
12916
13095
|
const files = await listDirectoryFiles(rulesDir);
|
|
12917
13096
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12924,7 +13103,7 @@ async function listRules() {
|
|
|
12924
13103
|
});
|
|
12925
13104
|
const frontmatter = rule.getFrontmatter();
|
|
12926
13105
|
return {
|
|
12927
|
-
relativePathFromCwd: (0,
|
|
13106
|
+
relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
12928
13107
|
frontmatter
|
|
12929
13108
|
};
|
|
12930
13109
|
} catch (error) {
|
|
@@ -12944,14 +13123,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
12944
13123
|
relativePath: relativePathFromCwd,
|
|
12945
13124
|
intendedRootDir: process.cwd()
|
|
12946
13125
|
});
|
|
12947
|
-
const filename = (0,
|
|
13126
|
+
const filename = (0, import_node_path102.basename)(relativePathFromCwd);
|
|
12948
13127
|
try {
|
|
12949
13128
|
const rule = await RulesyncRule.fromFile({
|
|
12950
13129
|
relativeFilePath: filename,
|
|
12951
13130
|
validate: true
|
|
12952
13131
|
});
|
|
12953
13132
|
return {
|
|
12954
|
-
relativePathFromCwd: (0,
|
|
13133
|
+
relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
12955
13134
|
frontmatter: rule.getFrontmatter(),
|
|
12956
13135
|
body: rule.getBody()
|
|
12957
13136
|
};
|
|
@@ -12970,7 +13149,7 @@ async function putRule({
|
|
|
12970
13149
|
relativePath: relativePathFromCwd,
|
|
12971
13150
|
intendedRootDir: process.cwd()
|
|
12972
13151
|
});
|
|
12973
|
-
const filename = (0,
|
|
13152
|
+
const filename = (0, import_node_path102.basename)(relativePathFromCwd);
|
|
12974
13153
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12975
13154
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
12976
13155
|
throw new Error(
|
|
@@ -12980,7 +13159,7 @@ async function putRule({
|
|
|
12980
13159
|
try {
|
|
12981
13160
|
const existingRules = await listRules();
|
|
12982
13161
|
const isUpdate = existingRules.some(
|
|
12983
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
13162
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
12984
13163
|
);
|
|
12985
13164
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
12986
13165
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -12993,11 +13172,11 @@ async function putRule({
|
|
|
12993
13172
|
body,
|
|
12994
13173
|
validate: true
|
|
12995
13174
|
});
|
|
12996
|
-
const rulesDir = (0,
|
|
13175
|
+
const rulesDir = (0, import_node_path102.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
12997
13176
|
await ensureDir(rulesDir);
|
|
12998
13177
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
12999
13178
|
return {
|
|
13000
|
-
relativePathFromCwd: (0,
|
|
13179
|
+
relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
13001
13180
|
frontmatter: rule.getFrontmatter(),
|
|
13002
13181
|
body: rule.getBody()
|
|
13003
13182
|
};
|
|
@@ -13012,12 +13191,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13012
13191
|
relativePath: relativePathFromCwd,
|
|
13013
13192
|
intendedRootDir: process.cwd()
|
|
13014
13193
|
});
|
|
13015
|
-
const filename = (0,
|
|
13016
|
-
const fullPath = (0,
|
|
13194
|
+
const filename = (0, import_node_path102.basename)(relativePathFromCwd);
|
|
13195
|
+
const fullPath = (0, import_node_path102.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
13017
13196
|
try {
|
|
13018
13197
|
await removeFile(fullPath);
|
|
13019
13198
|
return {
|
|
13020
|
-
relativePathFromCwd: (0,
|
|
13199
|
+
relativePathFromCwd: (0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
13021
13200
|
};
|
|
13022
13201
|
} catch (error) {
|
|
13023
13202
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -13026,23 +13205,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
13026
13205
|
}
|
|
13027
13206
|
}
|
|
13028
13207
|
var ruleToolSchemas = {
|
|
13029
|
-
listRules:
|
|
13030
|
-
getRule:
|
|
13031
|
-
relativePathFromCwd:
|
|
13208
|
+
listRules: import_mini47.z.object({}),
|
|
13209
|
+
getRule: import_mini47.z.object({
|
|
13210
|
+
relativePathFromCwd: import_mini47.z.string()
|
|
13032
13211
|
}),
|
|
13033
|
-
putRule:
|
|
13034
|
-
relativePathFromCwd:
|
|
13212
|
+
putRule: import_mini47.z.object({
|
|
13213
|
+
relativePathFromCwd: import_mini47.z.string(),
|
|
13035
13214
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
13036
|
-
body:
|
|
13215
|
+
body: import_mini47.z.string()
|
|
13037
13216
|
}),
|
|
13038
|
-
deleteRule:
|
|
13039
|
-
relativePathFromCwd:
|
|
13217
|
+
deleteRule: import_mini47.z.object({
|
|
13218
|
+
relativePathFromCwd: import_mini47.z.string()
|
|
13040
13219
|
})
|
|
13041
13220
|
};
|
|
13042
13221
|
var ruleTools = {
|
|
13043
13222
|
listRules: {
|
|
13044
13223
|
name: "listRules",
|
|
13045
|
-
description: `List all rules from ${(0,
|
|
13224
|
+
description: `List all rules from ${(0, import_node_path102.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13046
13225
|
parameters: ruleToolSchemas.listRules,
|
|
13047
13226
|
execute: async () => {
|
|
13048
13227
|
const rules = await listRules();
|
|
@@ -13084,8 +13263,8 @@ var ruleTools = {
|
|
|
13084
13263
|
};
|
|
13085
13264
|
|
|
13086
13265
|
// src/mcp/skills.ts
|
|
13087
|
-
var
|
|
13088
|
-
var
|
|
13266
|
+
var import_node_path103 = require("path");
|
|
13267
|
+
var import_mini48 = require("zod/mini");
|
|
13089
13268
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
13090
13269
|
var maxSkillsCount = 1e3;
|
|
13091
13270
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -13101,19 +13280,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
13101
13280
|
};
|
|
13102
13281
|
}
|
|
13103
13282
|
function extractDirName(relativeDirPathFromCwd) {
|
|
13104
|
-
const dirName = (0,
|
|
13283
|
+
const dirName = (0, import_node_path103.basename)(relativeDirPathFromCwd);
|
|
13105
13284
|
if (!dirName) {
|
|
13106
13285
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
13107
13286
|
}
|
|
13108
13287
|
return dirName;
|
|
13109
13288
|
}
|
|
13110
13289
|
async function listSkills() {
|
|
13111
|
-
const skillsDir = (0,
|
|
13290
|
+
const skillsDir = (0, import_node_path103.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
13112
13291
|
try {
|
|
13113
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
13292
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path103.join)(skillsDir, "*"), { type: "dir" });
|
|
13114
13293
|
const skills = await Promise.all(
|
|
13115
13294
|
skillDirPaths.map(async (dirPath) => {
|
|
13116
|
-
const dirName = (0,
|
|
13295
|
+
const dirName = (0, import_node_path103.basename)(dirPath);
|
|
13117
13296
|
if (!dirName) return null;
|
|
13118
13297
|
try {
|
|
13119
13298
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -13121,7 +13300,7 @@ async function listSkills() {
|
|
|
13121
13300
|
});
|
|
13122
13301
|
const frontmatter = skill.getFrontmatter();
|
|
13123
13302
|
return {
|
|
13124
|
-
relativeDirPathFromCwd: (0,
|
|
13303
|
+
relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13125
13304
|
frontmatter
|
|
13126
13305
|
};
|
|
13127
13306
|
} catch (error) {
|
|
@@ -13147,7 +13326,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
13147
13326
|
dirName
|
|
13148
13327
|
});
|
|
13149
13328
|
return {
|
|
13150
|
-
relativeDirPathFromCwd: (0,
|
|
13329
|
+
relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13151
13330
|
frontmatter: skill.getFrontmatter(),
|
|
13152
13331
|
body: skill.getBody(),
|
|
13153
13332
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13181,7 +13360,7 @@ async function putSkill({
|
|
|
13181
13360
|
try {
|
|
13182
13361
|
const existingSkills = await listSkills();
|
|
13183
13362
|
const isUpdate = existingSkills.some(
|
|
13184
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
13363
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13185
13364
|
);
|
|
13186
13365
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
13187
13366
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -13196,9 +13375,9 @@ async function putSkill({
|
|
|
13196
13375
|
otherFiles: aiDirFiles,
|
|
13197
13376
|
validate: true
|
|
13198
13377
|
});
|
|
13199
|
-
const skillDirPath = (0,
|
|
13378
|
+
const skillDirPath = (0, import_node_path103.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13200
13379
|
await ensureDir(skillDirPath);
|
|
13201
|
-
const skillFilePath = (0,
|
|
13380
|
+
const skillFilePath = (0, import_node_path103.join)(skillDirPath, SKILL_FILE_NAME);
|
|
13202
13381
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
13203
13382
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
13204
13383
|
for (const file of otherFiles) {
|
|
@@ -13206,15 +13385,15 @@ async function putSkill({
|
|
|
13206
13385
|
relativePath: file.name,
|
|
13207
13386
|
intendedRootDir: skillDirPath
|
|
13208
13387
|
});
|
|
13209
|
-
const filePath = (0,
|
|
13210
|
-
const fileDir = (0,
|
|
13388
|
+
const filePath = (0, import_node_path103.join)(skillDirPath, file.name);
|
|
13389
|
+
const fileDir = (0, import_node_path103.join)(skillDirPath, (0, import_node_path103.dirname)(file.name));
|
|
13211
13390
|
if (fileDir !== skillDirPath) {
|
|
13212
13391
|
await ensureDir(fileDir);
|
|
13213
13392
|
}
|
|
13214
13393
|
await writeFileContent(filePath, file.body);
|
|
13215
13394
|
}
|
|
13216
13395
|
return {
|
|
13217
|
-
relativeDirPathFromCwd: (0,
|
|
13396
|
+
relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
13218
13397
|
frontmatter: skill.getFrontmatter(),
|
|
13219
13398
|
body: skill.getBody(),
|
|
13220
13399
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -13236,13 +13415,13 @@ async function deleteSkill({
|
|
|
13236
13415
|
intendedRootDir: process.cwd()
|
|
13237
13416
|
});
|
|
13238
13417
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
13239
|
-
const skillDirPath = (0,
|
|
13418
|
+
const skillDirPath = (0, import_node_path103.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
13240
13419
|
try {
|
|
13241
13420
|
if (await directoryExists(skillDirPath)) {
|
|
13242
13421
|
await removeDirectory(skillDirPath);
|
|
13243
13422
|
}
|
|
13244
13423
|
return {
|
|
13245
|
-
relativeDirPathFromCwd: (0,
|
|
13424
|
+
relativeDirPathFromCwd: (0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
13246
13425
|
};
|
|
13247
13426
|
} catch (error) {
|
|
13248
13427
|
throw new Error(
|
|
@@ -13253,29 +13432,29 @@ async function deleteSkill({
|
|
|
13253
13432
|
);
|
|
13254
13433
|
}
|
|
13255
13434
|
}
|
|
13256
|
-
var McpSkillFileSchema =
|
|
13257
|
-
name:
|
|
13258
|
-
body:
|
|
13435
|
+
var McpSkillFileSchema = import_mini48.z.object({
|
|
13436
|
+
name: import_mini48.z.string(),
|
|
13437
|
+
body: import_mini48.z.string()
|
|
13259
13438
|
});
|
|
13260
13439
|
var skillToolSchemas = {
|
|
13261
|
-
listSkills:
|
|
13262
|
-
getSkill:
|
|
13263
|
-
relativeDirPathFromCwd:
|
|
13440
|
+
listSkills: import_mini48.z.object({}),
|
|
13441
|
+
getSkill: import_mini48.z.object({
|
|
13442
|
+
relativeDirPathFromCwd: import_mini48.z.string()
|
|
13264
13443
|
}),
|
|
13265
|
-
putSkill:
|
|
13266
|
-
relativeDirPathFromCwd:
|
|
13444
|
+
putSkill: import_mini48.z.object({
|
|
13445
|
+
relativeDirPathFromCwd: import_mini48.z.string(),
|
|
13267
13446
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
13268
|
-
body:
|
|
13269
|
-
otherFiles:
|
|
13447
|
+
body: import_mini48.z.string(),
|
|
13448
|
+
otherFiles: import_mini48.z.optional(import_mini48.z.array(McpSkillFileSchema))
|
|
13270
13449
|
}),
|
|
13271
|
-
deleteSkill:
|
|
13272
|
-
relativeDirPathFromCwd:
|
|
13450
|
+
deleteSkill: import_mini48.z.object({
|
|
13451
|
+
relativeDirPathFromCwd: import_mini48.z.string()
|
|
13273
13452
|
})
|
|
13274
13453
|
};
|
|
13275
13454
|
var skillTools = {
|
|
13276
13455
|
listSkills: {
|
|
13277
13456
|
name: "listSkills",
|
|
13278
|
-
description: `List all skills from ${(0,
|
|
13457
|
+
description: `List all skills from ${(0, import_node_path103.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
13279
13458
|
parameters: skillToolSchemas.listSkills,
|
|
13280
13459
|
execute: async () => {
|
|
13281
13460
|
const skills = await listSkills();
|
|
@@ -13318,12 +13497,12 @@ var skillTools = {
|
|
|
13318
13497
|
};
|
|
13319
13498
|
|
|
13320
13499
|
// src/mcp/subagents.ts
|
|
13321
|
-
var
|
|
13322
|
-
var
|
|
13500
|
+
var import_node_path104 = require("path");
|
|
13501
|
+
var import_mini49 = require("zod/mini");
|
|
13323
13502
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
13324
13503
|
var maxSubagentsCount = 1e3;
|
|
13325
13504
|
async function listSubagents() {
|
|
13326
|
-
const subagentsDir = (0,
|
|
13505
|
+
const subagentsDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13327
13506
|
try {
|
|
13328
13507
|
const files = await listDirectoryFiles(subagentsDir);
|
|
13329
13508
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -13336,7 +13515,7 @@ async function listSubagents() {
|
|
|
13336
13515
|
});
|
|
13337
13516
|
const frontmatter = subagent.getFrontmatter();
|
|
13338
13517
|
return {
|
|
13339
|
-
relativePathFromCwd: (0,
|
|
13518
|
+
relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
13340
13519
|
frontmatter
|
|
13341
13520
|
};
|
|
13342
13521
|
} catch (error) {
|
|
@@ -13358,14 +13537,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
13358
13537
|
relativePath: relativePathFromCwd,
|
|
13359
13538
|
intendedRootDir: process.cwd()
|
|
13360
13539
|
});
|
|
13361
|
-
const filename = (0,
|
|
13540
|
+
const filename = (0, import_node_path104.basename)(relativePathFromCwd);
|
|
13362
13541
|
try {
|
|
13363
13542
|
const subagent = await RulesyncSubagent.fromFile({
|
|
13364
13543
|
relativeFilePath: filename,
|
|
13365
13544
|
validate: true
|
|
13366
13545
|
});
|
|
13367
13546
|
return {
|
|
13368
|
-
relativePathFromCwd: (0,
|
|
13547
|
+
relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13369
13548
|
frontmatter: subagent.getFrontmatter(),
|
|
13370
13549
|
body: subagent.getBody()
|
|
13371
13550
|
};
|
|
@@ -13384,7 +13563,7 @@ async function putSubagent({
|
|
|
13384
13563
|
relativePath: relativePathFromCwd,
|
|
13385
13564
|
intendedRootDir: process.cwd()
|
|
13386
13565
|
});
|
|
13387
|
-
const filename = (0,
|
|
13566
|
+
const filename = (0, import_node_path104.basename)(relativePathFromCwd);
|
|
13388
13567
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
13389
13568
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
13390
13569
|
throw new Error(
|
|
@@ -13394,7 +13573,7 @@ async function putSubagent({
|
|
|
13394
13573
|
try {
|
|
13395
13574
|
const existingSubagents = await listSubagents();
|
|
13396
13575
|
const isUpdate = existingSubagents.some(
|
|
13397
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
13576
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13398
13577
|
);
|
|
13399
13578
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
13400
13579
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -13407,11 +13586,11 @@ async function putSubagent({
|
|
|
13407
13586
|
body,
|
|
13408
13587
|
validate: true
|
|
13409
13588
|
});
|
|
13410
|
-
const subagentsDir = (0,
|
|
13589
|
+
const subagentsDir = (0, import_node_path104.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
13411
13590
|
await ensureDir(subagentsDir);
|
|
13412
13591
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
13413
13592
|
return {
|
|
13414
|
-
relativePathFromCwd: (0,
|
|
13593
|
+
relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
13415
13594
|
frontmatter: subagent.getFrontmatter(),
|
|
13416
13595
|
body: subagent.getBody()
|
|
13417
13596
|
};
|
|
@@ -13426,12 +13605,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13426
13605
|
relativePath: relativePathFromCwd,
|
|
13427
13606
|
intendedRootDir: process.cwd()
|
|
13428
13607
|
});
|
|
13429
|
-
const filename = (0,
|
|
13430
|
-
const fullPath = (0,
|
|
13608
|
+
const filename = (0, import_node_path104.basename)(relativePathFromCwd);
|
|
13609
|
+
const fullPath = (0, import_node_path104.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
13431
13610
|
try {
|
|
13432
13611
|
await removeFile(fullPath);
|
|
13433
13612
|
return {
|
|
13434
|
-
relativePathFromCwd: (0,
|
|
13613
|
+
relativePathFromCwd: (0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
13435
13614
|
};
|
|
13436
13615
|
} catch (error) {
|
|
13437
13616
|
throw new Error(
|
|
@@ -13443,23 +13622,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
13443
13622
|
}
|
|
13444
13623
|
}
|
|
13445
13624
|
var subagentToolSchemas = {
|
|
13446
|
-
listSubagents:
|
|
13447
|
-
getSubagent:
|
|
13448
|
-
relativePathFromCwd:
|
|
13625
|
+
listSubagents: import_mini49.z.object({}),
|
|
13626
|
+
getSubagent: import_mini49.z.object({
|
|
13627
|
+
relativePathFromCwd: import_mini49.z.string()
|
|
13449
13628
|
}),
|
|
13450
|
-
putSubagent:
|
|
13451
|
-
relativePathFromCwd:
|
|
13629
|
+
putSubagent: import_mini49.z.object({
|
|
13630
|
+
relativePathFromCwd: import_mini49.z.string(),
|
|
13452
13631
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
13453
|
-
body:
|
|
13632
|
+
body: import_mini49.z.string()
|
|
13454
13633
|
}),
|
|
13455
|
-
deleteSubagent:
|
|
13456
|
-
relativePathFromCwd:
|
|
13634
|
+
deleteSubagent: import_mini49.z.object({
|
|
13635
|
+
relativePathFromCwd: import_mini49.z.string()
|
|
13457
13636
|
})
|
|
13458
13637
|
};
|
|
13459
13638
|
var subagentTools = {
|
|
13460
13639
|
listSubagents: {
|
|
13461
13640
|
name: "listSubagents",
|
|
13462
|
-
description: `List all subagents from ${(0,
|
|
13641
|
+
description: `List all subagents from ${(0, import_node_path104.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
13463
13642
|
parameters: subagentToolSchemas.listSubagents,
|
|
13464
13643
|
execute: async () => {
|
|
13465
13644
|
const subagents = await listSubagents();
|
|
@@ -13501,20 +13680,20 @@ var subagentTools = {
|
|
|
13501
13680
|
};
|
|
13502
13681
|
|
|
13503
13682
|
// src/mcp/tools.ts
|
|
13504
|
-
var rulesyncFeatureSchema =
|
|
13505
|
-
var rulesyncOperationSchema =
|
|
13506
|
-
var skillFileSchema =
|
|
13507
|
-
name:
|
|
13508
|
-
body:
|
|
13683
|
+
var rulesyncFeatureSchema = import_mini50.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
13684
|
+
var rulesyncOperationSchema = import_mini50.z.enum(["list", "get", "put", "delete"]);
|
|
13685
|
+
var skillFileSchema = import_mini50.z.object({
|
|
13686
|
+
name: import_mini50.z.string(),
|
|
13687
|
+
body: import_mini50.z.string()
|
|
13509
13688
|
});
|
|
13510
|
-
var rulesyncToolSchema =
|
|
13689
|
+
var rulesyncToolSchema = import_mini50.z.object({
|
|
13511
13690
|
feature: rulesyncFeatureSchema,
|
|
13512
13691
|
operation: rulesyncOperationSchema,
|
|
13513
|
-
targetPathFromCwd:
|
|
13514
|
-
frontmatter:
|
|
13515
|
-
body:
|
|
13516
|
-
otherFiles:
|
|
13517
|
-
content:
|
|
13692
|
+
targetPathFromCwd: import_mini50.z.optional(import_mini50.z.string()),
|
|
13693
|
+
frontmatter: import_mini50.z.optional(import_mini50.z.unknown()),
|
|
13694
|
+
body: import_mini50.z.optional(import_mini50.z.string()),
|
|
13695
|
+
otherFiles: import_mini50.z.optional(import_mini50.z.array(skillFileSchema)),
|
|
13696
|
+
content: import_mini50.z.optional(import_mini50.z.string())
|
|
13518
13697
|
});
|
|
13519
13698
|
var supportedOperationsByFeature = {
|
|
13520
13699
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -13710,7 +13889,7 @@ async function mcpCommand({ version }) {
|
|
|
13710
13889
|
}
|
|
13711
13890
|
|
|
13712
13891
|
// src/cli/index.ts
|
|
13713
|
-
var getVersion = () => "5.
|
|
13892
|
+
var getVersion = () => "5.7.0";
|
|
13714
13893
|
var main = async () => {
|
|
13715
13894
|
const program = new import_commander.Command();
|
|
13716
13895
|
const version = getVersion();
|