rulesync 7.13.0 → 7.14.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 +5 -5
- package/dist/{chunk-JGRHJWG5.js → chunk-UWNVSK5V.js} +751 -337
- package/dist/cli/index.cjs +1332 -619
- package/dist/cli/index.js +380 -77
- package/dist/index.cjs +1002 -608
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -159,7 +159,7 @@ var MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
|
159
159
|
var FETCH_CONCURRENCY_LIMIT = 10;
|
|
160
160
|
|
|
161
161
|
// src/utils/file.ts
|
|
162
|
-
import { mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
162
|
+
import { lstat, mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "fs/promises";
|
|
163
163
|
import os from "os";
|
|
164
164
|
import { dirname, join as join2, relative, resolve } from "path";
|
|
165
165
|
import { kebabCase } from "es-toolkit";
|
|
@@ -240,6 +240,24 @@ async function fileExists(filepath) {
|
|
|
240
240
|
return false;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
+
async function getFileSize(filepath) {
|
|
244
|
+
try {
|
|
245
|
+
const stats = await stat(filepath);
|
|
246
|
+
return stats.size;
|
|
247
|
+
} catch (error) {
|
|
248
|
+
throw new Error(`Failed to get file size for "${filepath}": ${formatError(error)}`, {
|
|
249
|
+
cause: error
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async function isSymlink(filepath) {
|
|
254
|
+
try {
|
|
255
|
+
const stats = await lstat(filepath);
|
|
256
|
+
return stats.isSymbolicLink();
|
|
257
|
+
} catch {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
243
261
|
async function listDirectoryFiles(dir) {
|
|
244
262
|
try {
|
|
245
263
|
return await readdir(dir);
|
|
@@ -314,10 +332,32 @@ async function removeTempDirectory(tempDir) {
|
|
|
314
332
|
}
|
|
315
333
|
|
|
316
334
|
// src/config/config.ts
|
|
317
|
-
import {
|
|
335
|
+
import { isAbsolute } from "path";
|
|
336
|
+
import { minLength, optional, refine, z as z3 } from "zod/mini";
|
|
337
|
+
function hasControlCharacters(value) {
|
|
338
|
+
for (let i = 0; i < value.length; i++) {
|
|
339
|
+
const code = value.charCodeAt(i);
|
|
340
|
+
if (code >= 0 && code <= 31 || code === 127) return true;
|
|
341
|
+
}
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
318
344
|
var SourceEntrySchema = z3.object({
|
|
319
345
|
source: z3.string().check(minLength(1, "source must be a non-empty string")),
|
|
320
|
-
skills: optional(z3.array(z3.string()))
|
|
346
|
+
skills: optional(z3.array(z3.string())),
|
|
347
|
+
transport: optional(z3.enum(["github", "git"])),
|
|
348
|
+
ref: optional(
|
|
349
|
+
z3.string().check(
|
|
350
|
+
refine((v) => !v.startsWith("-"), 'ref must not start with "-"'),
|
|
351
|
+
refine((v) => !hasControlCharacters(v), "ref must not contain control characters")
|
|
352
|
+
)
|
|
353
|
+
),
|
|
354
|
+
path: optional(
|
|
355
|
+
z3.string().check(
|
|
356
|
+
refine((v) => !v.includes(".."), 'path must not contain ".."'),
|
|
357
|
+
refine((v) => !isAbsolute(v), "path must not be absolute"),
|
|
358
|
+
refine((v) => !hasControlCharacters(v), "path must not contain control characters")
|
|
359
|
+
)
|
|
360
|
+
)
|
|
321
361
|
});
|
|
322
362
|
var ConfigParamsSchema = z3.object({
|
|
323
363
|
baseDirs: z3.array(z3.string()),
|
|
@@ -606,7 +646,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
606
646
|
}
|
|
607
647
|
|
|
608
648
|
// src/lib/generate.ts
|
|
609
|
-
import { join as
|
|
649
|
+
import { join as join116 } from "path";
|
|
610
650
|
import { intersection } from "es-toolkit";
|
|
611
651
|
|
|
612
652
|
// src/features/commands/commands-processor.ts
|
|
@@ -7402,9 +7442,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
7402
7442
|
};
|
|
7403
7443
|
|
|
7404
7444
|
// src/features/rules/rules-processor.ts
|
|
7405
|
-
import { basename as basename10, dirname as dirname3, join as
|
|
7445
|
+
import { basename as basename10, dirname as dirname3, join as join115, relative as relative5 } from "path";
|
|
7406
7446
|
import { encode } from "@toon-format/toon";
|
|
7407
|
-
import { z as
|
|
7447
|
+
import { z as z56 } from "zod/mini";
|
|
7408
7448
|
|
|
7409
7449
|
// src/constants/general.ts
|
|
7410
7450
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -7872,8 +7912,8 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
7872
7912
|
};
|
|
7873
7913
|
|
|
7874
7914
|
// src/features/skills/skills-processor.ts
|
|
7875
|
-
import { basename as basename5, join as
|
|
7876
|
-
import { z as
|
|
7915
|
+
import { basename as basename5, join as join76 } from "path";
|
|
7916
|
+
import { z as z39 } from "zod/mini";
|
|
7877
7917
|
|
|
7878
7918
|
// src/types/dir-feature-processor.ts
|
|
7879
7919
|
import { join as join59 } from "path";
|
|
@@ -9425,17 +9465,193 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
9425
9465
|
}
|
|
9426
9466
|
};
|
|
9427
9467
|
|
|
9428
|
-
// src/features/skills/
|
|
9468
|
+
// src/features/skills/junie-skill.ts
|
|
9429
9469
|
import { join as join69 } from "path";
|
|
9430
9470
|
import { z as z33 } from "zod/mini";
|
|
9431
|
-
var
|
|
9471
|
+
var JunieSkillFrontmatterSchema = z33.looseObject({
|
|
9432
9472
|
name: z33.string(),
|
|
9433
9473
|
description: z33.string()
|
|
9434
9474
|
});
|
|
9475
|
+
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
9476
|
+
constructor({
|
|
9477
|
+
baseDir = process.cwd(),
|
|
9478
|
+
relativeDirPath = join69(".junie", "skills"),
|
|
9479
|
+
dirName,
|
|
9480
|
+
frontmatter,
|
|
9481
|
+
body,
|
|
9482
|
+
otherFiles = [],
|
|
9483
|
+
validate = true,
|
|
9484
|
+
global = false
|
|
9485
|
+
}) {
|
|
9486
|
+
super({
|
|
9487
|
+
baseDir,
|
|
9488
|
+
relativeDirPath,
|
|
9489
|
+
dirName,
|
|
9490
|
+
mainFile: {
|
|
9491
|
+
name: SKILL_FILE_NAME,
|
|
9492
|
+
body,
|
|
9493
|
+
frontmatter: { ...frontmatter }
|
|
9494
|
+
},
|
|
9495
|
+
otherFiles,
|
|
9496
|
+
global
|
|
9497
|
+
});
|
|
9498
|
+
if (validate) {
|
|
9499
|
+
const result = this.validate();
|
|
9500
|
+
if (!result.success) {
|
|
9501
|
+
throw result.error;
|
|
9502
|
+
}
|
|
9503
|
+
}
|
|
9504
|
+
}
|
|
9505
|
+
static getSettablePaths(options) {
|
|
9506
|
+
if (options?.global) {
|
|
9507
|
+
throw new Error("JunieSkill does not support global mode.");
|
|
9508
|
+
}
|
|
9509
|
+
return {
|
|
9510
|
+
relativeDirPath: join69(".junie", "skills")
|
|
9511
|
+
};
|
|
9512
|
+
}
|
|
9513
|
+
getFrontmatter() {
|
|
9514
|
+
const result = JunieSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
9515
|
+
return result;
|
|
9516
|
+
}
|
|
9517
|
+
getBody() {
|
|
9518
|
+
return this.mainFile?.body ?? "";
|
|
9519
|
+
}
|
|
9520
|
+
validate() {
|
|
9521
|
+
if (!this.mainFile) {
|
|
9522
|
+
return {
|
|
9523
|
+
success: false,
|
|
9524
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
9525
|
+
};
|
|
9526
|
+
}
|
|
9527
|
+
const result = JunieSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
9528
|
+
if (!result.success) {
|
|
9529
|
+
return {
|
|
9530
|
+
success: false,
|
|
9531
|
+
error: new Error(
|
|
9532
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
9533
|
+
)
|
|
9534
|
+
};
|
|
9535
|
+
}
|
|
9536
|
+
if (result.data.name !== this.getDirName()) {
|
|
9537
|
+
return {
|
|
9538
|
+
success: false,
|
|
9539
|
+
error: new Error(
|
|
9540
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
9541
|
+
)
|
|
9542
|
+
};
|
|
9543
|
+
}
|
|
9544
|
+
return { success: true, error: null };
|
|
9545
|
+
}
|
|
9546
|
+
toRulesyncSkill() {
|
|
9547
|
+
const frontmatter = this.getFrontmatter();
|
|
9548
|
+
const rulesyncFrontmatter = {
|
|
9549
|
+
name: frontmatter.name,
|
|
9550
|
+
description: frontmatter.description,
|
|
9551
|
+
targets: ["*"]
|
|
9552
|
+
};
|
|
9553
|
+
return new RulesyncSkill({
|
|
9554
|
+
baseDir: this.baseDir,
|
|
9555
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
9556
|
+
dirName: this.getDirName(),
|
|
9557
|
+
frontmatter: rulesyncFrontmatter,
|
|
9558
|
+
body: this.getBody(),
|
|
9559
|
+
otherFiles: this.getOtherFiles(),
|
|
9560
|
+
validate: true,
|
|
9561
|
+
global: this.global
|
|
9562
|
+
});
|
|
9563
|
+
}
|
|
9564
|
+
static fromRulesyncSkill({
|
|
9565
|
+
rulesyncSkill,
|
|
9566
|
+
validate = true,
|
|
9567
|
+
global = false
|
|
9568
|
+
}) {
|
|
9569
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9570
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
9571
|
+
const junieFrontmatter = {
|
|
9572
|
+
name: rulesyncFrontmatter.name,
|
|
9573
|
+
description: rulesyncFrontmatter.description
|
|
9574
|
+
};
|
|
9575
|
+
return new _JunieSkill({
|
|
9576
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
9577
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
9578
|
+
dirName: junieFrontmatter.name,
|
|
9579
|
+
frontmatter: junieFrontmatter,
|
|
9580
|
+
body: rulesyncSkill.getBody(),
|
|
9581
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
9582
|
+
validate,
|
|
9583
|
+
global
|
|
9584
|
+
});
|
|
9585
|
+
}
|
|
9586
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
9587
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
9588
|
+
return targets.includes("*") || targets.includes("junie");
|
|
9589
|
+
}
|
|
9590
|
+
static async fromDir(params) {
|
|
9591
|
+
const loaded = await this.loadSkillDirContent({
|
|
9592
|
+
...params,
|
|
9593
|
+
getSettablePaths: _JunieSkill.getSettablePaths
|
|
9594
|
+
});
|
|
9595
|
+
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9596
|
+
if (!result.success) {
|
|
9597
|
+
const skillDirPath = join69(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9598
|
+
throw new Error(
|
|
9599
|
+
`Invalid frontmatter in ${join69(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9600
|
+
);
|
|
9601
|
+
}
|
|
9602
|
+
if (result.data.name !== loaded.dirName) {
|
|
9603
|
+
const skillFilePath = join69(
|
|
9604
|
+
loaded.baseDir,
|
|
9605
|
+
loaded.relativeDirPath,
|
|
9606
|
+
loaded.dirName,
|
|
9607
|
+
SKILL_FILE_NAME
|
|
9608
|
+
);
|
|
9609
|
+
throw new Error(
|
|
9610
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
9611
|
+
);
|
|
9612
|
+
}
|
|
9613
|
+
return new _JunieSkill({
|
|
9614
|
+
baseDir: loaded.baseDir,
|
|
9615
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
9616
|
+
dirName: loaded.dirName,
|
|
9617
|
+
frontmatter: result.data,
|
|
9618
|
+
body: loaded.body,
|
|
9619
|
+
otherFiles: loaded.otherFiles,
|
|
9620
|
+
validate: true,
|
|
9621
|
+
global: loaded.global
|
|
9622
|
+
});
|
|
9623
|
+
}
|
|
9624
|
+
static forDeletion({
|
|
9625
|
+
baseDir = process.cwd(),
|
|
9626
|
+
relativeDirPath,
|
|
9627
|
+
dirName,
|
|
9628
|
+
global = false
|
|
9629
|
+
}) {
|
|
9630
|
+
const settablePaths = _JunieSkill.getSettablePaths({ global });
|
|
9631
|
+
return new _JunieSkill({
|
|
9632
|
+
baseDir,
|
|
9633
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
9634
|
+
dirName,
|
|
9635
|
+
frontmatter: { name: "", description: "" },
|
|
9636
|
+
body: "",
|
|
9637
|
+
otherFiles: [],
|
|
9638
|
+
validate: false,
|
|
9639
|
+
global
|
|
9640
|
+
});
|
|
9641
|
+
}
|
|
9642
|
+
};
|
|
9643
|
+
|
|
9644
|
+
// src/features/skills/kilo-skill.ts
|
|
9645
|
+
import { join as join70 } from "path";
|
|
9646
|
+
import { z as z34 } from "zod/mini";
|
|
9647
|
+
var KiloSkillFrontmatterSchema = z34.looseObject({
|
|
9648
|
+
name: z34.string(),
|
|
9649
|
+
description: z34.string()
|
|
9650
|
+
});
|
|
9435
9651
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
9436
9652
|
constructor({
|
|
9437
9653
|
baseDir = process.cwd(),
|
|
9438
|
-
relativeDirPath =
|
|
9654
|
+
relativeDirPath = join70(".kilocode", "skills"),
|
|
9439
9655
|
dirName,
|
|
9440
9656
|
frontmatter,
|
|
9441
9657
|
body,
|
|
@@ -9466,7 +9682,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9466
9682
|
global: _global = false
|
|
9467
9683
|
} = {}) {
|
|
9468
9684
|
return {
|
|
9469
|
-
relativeDirPath:
|
|
9685
|
+
relativeDirPath: join70(".kilocode", "skills")
|
|
9470
9686
|
};
|
|
9471
9687
|
}
|
|
9472
9688
|
getFrontmatter() {
|
|
@@ -9553,13 +9769,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9553
9769
|
});
|
|
9554
9770
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9555
9771
|
if (!result.success) {
|
|
9556
|
-
const skillDirPath =
|
|
9772
|
+
const skillDirPath = join70(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9557
9773
|
throw new Error(
|
|
9558
|
-
`Invalid frontmatter in ${
|
|
9774
|
+
`Invalid frontmatter in ${join70(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9559
9775
|
);
|
|
9560
9776
|
}
|
|
9561
9777
|
if (result.data.name !== loaded.dirName) {
|
|
9562
|
-
const skillFilePath =
|
|
9778
|
+
const skillFilePath = join70(
|
|
9563
9779
|
loaded.baseDir,
|
|
9564
9780
|
loaded.relativeDirPath,
|
|
9565
9781
|
loaded.dirName,
|
|
@@ -9600,16 +9816,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
9600
9816
|
};
|
|
9601
9817
|
|
|
9602
9818
|
// src/features/skills/kiro-skill.ts
|
|
9603
|
-
import { join as
|
|
9604
|
-
import { z as
|
|
9605
|
-
var KiroSkillFrontmatterSchema =
|
|
9606
|
-
name:
|
|
9607
|
-
description:
|
|
9819
|
+
import { join as join71 } from "path";
|
|
9820
|
+
import { z as z35 } from "zod/mini";
|
|
9821
|
+
var KiroSkillFrontmatterSchema = z35.looseObject({
|
|
9822
|
+
name: z35.string(),
|
|
9823
|
+
description: z35.string()
|
|
9608
9824
|
});
|
|
9609
9825
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
9610
9826
|
constructor({
|
|
9611
9827
|
baseDir = process.cwd(),
|
|
9612
|
-
relativeDirPath =
|
|
9828
|
+
relativeDirPath = join71(".kiro", "skills"),
|
|
9613
9829
|
dirName,
|
|
9614
9830
|
frontmatter,
|
|
9615
9831
|
body,
|
|
@@ -9641,7 +9857,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9641
9857
|
throw new Error("KiroSkill does not support global mode.");
|
|
9642
9858
|
}
|
|
9643
9859
|
return {
|
|
9644
|
-
relativeDirPath:
|
|
9860
|
+
relativeDirPath: join71(".kiro", "skills")
|
|
9645
9861
|
};
|
|
9646
9862
|
}
|
|
9647
9863
|
getFrontmatter() {
|
|
@@ -9728,13 +9944,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9728
9944
|
});
|
|
9729
9945
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9730
9946
|
if (!result.success) {
|
|
9731
|
-
const skillDirPath =
|
|
9947
|
+
const skillDirPath = join71(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9732
9948
|
throw new Error(
|
|
9733
|
-
`Invalid frontmatter in ${
|
|
9949
|
+
`Invalid frontmatter in ${join71(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9734
9950
|
);
|
|
9735
9951
|
}
|
|
9736
9952
|
if (result.data.name !== loaded.dirName) {
|
|
9737
|
-
const skillFilePath =
|
|
9953
|
+
const skillFilePath = join71(
|
|
9738
9954
|
loaded.baseDir,
|
|
9739
9955
|
loaded.relativeDirPath,
|
|
9740
9956
|
loaded.dirName,
|
|
@@ -9776,17 +9992,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
9776
9992
|
};
|
|
9777
9993
|
|
|
9778
9994
|
// src/features/skills/opencode-skill.ts
|
|
9779
|
-
import { join as
|
|
9780
|
-
import { z as
|
|
9781
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
9782
|
-
name:
|
|
9783
|
-
description:
|
|
9784
|
-
"allowed-tools":
|
|
9995
|
+
import { join as join72 } from "path";
|
|
9996
|
+
import { z as z36 } from "zod/mini";
|
|
9997
|
+
var OpenCodeSkillFrontmatterSchema = z36.looseObject({
|
|
9998
|
+
name: z36.string(),
|
|
9999
|
+
description: z36.string(),
|
|
10000
|
+
"allowed-tools": z36.optional(z36.array(z36.string()))
|
|
9785
10001
|
});
|
|
9786
10002
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
9787
10003
|
constructor({
|
|
9788
10004
|
baseDir = process.cwd(),
|
|
9789
|
-
relativeDirPath =
|
|
10005
|
+
relativeDirPath = join72(".opencode", "skill"),
|
|
9790
10006
|
dirName,
|
|
9791
10007
|
frontmatter,
|
|
9792
10008
|
body,
|
|
@@ -9815,7 +10031,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9815
10031
|
}
|
|
9816
10032
|
static getSettablePaths({ global = false } = {}) {
|
|
9817
10033
|
return {
|
|
9818
|
-
relativeDirPath: global ?
|
|
10034
|
+
relativeDirPath: global ? join72(".config", "opencode", "skill") : join72(".opencode", "skill")
|
|
9819
10035
|
};
|
|
9820
10036
|
}
|
|
9821
10037
|
getFrontmatter() {
|
|
@@ -9900,9 +10116,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9900
10116
|
});
|
|
9901
10117
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9902
10118
|
if (!result.success) {
|
|
9903
|
-
const skillDirPath =
|
|
10119
|
+
const skillDirPath = join72(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9904
10120
|
throw new Error(
|
|
9905
|
-
`Invalid frontmatter in ${
|
|
10121
|
+
`Invalid frontmatter in ${join72(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9906
10122
|
);
|
|
9907
10123
|
}
|
|
9908
10124
|
return new _OpenCodeSkill({
|
|
@@ -9936,16 +10152,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
9936
10152
|
};
|
|
9937
10153
|
|
|
9938
10154
|
// src/features/skills/replit-skill.ts
|
|
9939
|
-
import { join as
|
|
9940
|
-
import { z as
|
|
9941
|
-
var ReplitSkillFrontmatterSchema =
|
|
9942
|
-
name:
|
|
9943
|
-
description:
|
|
10155
|
+
import { join as join73 } from "path";
|
|
10156
|
+
import { z as z37 } from "zod/mini";
|
|
10157
|
+
var ReplitSkillFrontmatterSchema = z37.looseObject({
|
|
10158
|
+
name: z37.string(),
|
|
10159
|
+
description: z37.string()
|
|
9944
10160
|
});
|
|
9945
10161
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
9946
10162
|
constructor({
|
|
9947
10163
|
baseDir = process.cwd(),
|
|
9948
|
-
relativeDirPath =
|
|
10164
|
+
relativeDirPath = join73(".agents", "skills"),
|
|
9949
10165
|
dirName,
|
|
9950
10166
|
frontmatter,
|
|
9951
10167
|
body,
|
|
@@ -9977,7 +10193,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9977
10193
|
throw new Error("ReplitSkill does not support global mode.");
|
|
9978
10194
|
}
|
|
9979
10195
|
return {
|
|
9980
|
-
relativeDirPath:
|
|
10196
|
+
relativeDirPath: join73(".agents", "skills")
|
|
9981
10197
|
};
|
|
9982
10198
|
}
|
|
9983
10199
|
getFrontmatter() {
|
|
@@ -10056,9 +10272,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10056
10272
|
});
|
|
10057
10273
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10058
10274
|
if (!result.success) {
|
|
10059
|
-
const skillDirPath =
|
|
10275
|
+
const skillDirPath = join73(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10060
10276
|
throw new Error(
|
|
10061
|
-
`Invalid frontmatter in ${
|
|
10277
|
+
`Invalid frontmatter in ${join73(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10062
10278
|
);
|
|
10063
10279
|
}
|
|
10064
10280
|
return new _ReplitSkill({
|
|
@@ -10093,16 +10309,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
10093
10309
|
};
|
|
10094
10310
|
|
|
10095
10311
|
// src/features/skills/roo-skill.ts
|
|
10096
|
-
import { join as
|
|
10097
|
-
import { z as
|
|
10098
|
-
var RooSkillFrontmatterSchema =
|
|
10099
|
-
name:
|
|
10100
|
-
description:
|
|
10312
|
+
import { join as join74 } from "path";
|
|
10313
|
+
import { z as z38 } from "zod/mini";
|
|
10314
|
+
var RooSkillFrontmatterSchema = z38.looseObject({
|
|
10315
|
+
name: z38.string(),
|
|
10316
|
+
description: z38.string()
|
|
10101
10317
|
});
|
|
10102
10318
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
10103
10319
|
constructor({
|
|
10104
10320
|
baseDir = process.cwd(),
|
|
10105
|
-
relativeDirPath =
|
|
10321
|
+
relativeDirPath = join74(".roo", "skills"),
|
|
10106
10322
|
dirName,
|
|
10107
10323
|
frontmatter,
|
|
10108
10324
|
body,
|
|
@@ -10133,7 +10349,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10133
10349
|
global: _global = false
|
|
10134
10350
|
} = {}) {
|
|
10135
10351
|
return {
|
|
10136
|
-
relativeDirPath:
|
|
10352
|
+
relativeDirPath: join74(".roo", "skills")
|
|
10137
10353
|
};
|
|
10138
10354
|
}
|
|
10139
10355
|
getFrontmatter() {
|
|
@@ -10220,13 +10436,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10220
10436
|
});
|
|
10221
10437
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10222
10438
|
if (!result.success) {
|
|
10223
|
-
const skillDirPath =
|
|
10439
|
+
const skillDirPath = join74(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10224
10440
|
throw new Error(
|
|
10225
|
-
`Invalid frontmatter in ${
|
|
10441
|
+
`Invalid frontmatter in ${join74(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10226
10442
|
);
|
|
10227
10443
|
}
|
|
10228
10444
|
if (result.data.name !== loaded.dirName) {
|
|
10229
|
-
const skillFilePath =
|
|
10445
|
+
const skillFilePath = join74(
|
|
10230
10446
|
loaded.baseDir,
|
|
10231
10447
|
loaded.relativeDirPath,
|
|
10232
10448
|
loaded.dirName,
|
|
@@ -10267,14 +10483,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
10267
10483
|
};
|
|
10268
10484
|
|
|
10269
10485
|
// src/features/skills/skills-utils.ts
|
|
10270
|
-
import { basename as basename4, join as
|
|
10486
|
+
import { basename as basename4, join as join75 } from "path";
|
|
10271
10487
|
async function getLocalSkillDirNames(baseDir) {
|
|
10272
|
-
const skillsDir =
|
|
10488
|
+
const skillsDir = join75(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10273
10489
|
const names = /* @__PURE__ */ new Set();
|
|
10274
10490
|
if (!await directoryExists(skillsDir)) {
|
|
10275
10491
|
return names;
|
|
10276
10492
|
}
|
|
10277
|
-
const dirPaths = await findFilesByGlobs(
|
|
10493
|
+
const dirPaths = await findFilesByGlobs(join75(skillsDir, "*"), { type: "dir" });
|
|
10278
10494
|
for (const dirPath of dirPaths) {
|
|
10279
10495
|
const name = basename4(dirPath);
|
|
10280
10496
|
if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
@@ -10296,13 +10512,14 @@ var skillsProcessorToolTargetTuple = [
|
|
|
10296
10512
|
"cursor",
|
|
10297
10513
|
"factorydroid",
|
|
10298
10514
|
"geminicli",
|
|
10515
|
+
"junie",
|
|
10299
10516
|
"kilo",
|
|
10300
10517
|
"kiro",
|
|
10301
10518
|
"opencode",
|
|
10302
10519
|
"replit",
|
|
10303
10520
|
"roo"
|
|
10304
10521
|
];
|
|
10305
|
-
var SkillsProcessorToolTargetSchema =
|
|
10522
|
+
var SkillsProcessorToolTargetSchema = z39.enum(skillsProcessorToolTargetTuple);
|
|
10306
10523
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
10307
10524
|
[
|
|
10308
10525
|
"agentsmd",
|
|
@@ -10381,6 +10598,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
10381
10598
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
10382
10599
|
}
|
|
10383
10600
|
],
|
|
10601
|
+
[
|
|
10602
|
+
"junie",
|
|
10603
|
+
{
|
|
10604
|
+
class: JunieSkill,
|
|
10605
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
10606
|
+
}
|
|
10607
|
+
],
|
|
10384
10608
|
[
|
|
10385
10609
|
"kilo",
|
|
10386
10610
|
{
|
|
@@ -10503,10 +10727,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10503
10727
|
)
|
|
10504
10728
|
);
|
|
10505
10729
|
const localSkillNames = new Set(localDirNames);
|
|
10506
|
-
const curatedDirPath =
|
|
10730
|
+
const curatedDirPath = join76(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
10507
10731
|
let curatedSkills = [];
|
|
10508
10732
|
if (await directoryExists(curatedDirPath)) {
|
|
10509
|
-
const curatedDirPaths = await findFilesByGlobs(
|
|
10733
|
+
const curatedDirPaths = await findFilesByGlobs(join76(curatedDirPath, "*"), { type: "dir" });
|
|
10510
10734
|
const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
|
|
10511
10735
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
10512
10736
|
if (localSkillNames.has(name)) {
|
|
@@ -10540,8 +10764,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10540
10764
|
async loadToolDirs() {
|
|
10541
10765
|
const factory = this.getFactory(this.toolTarget);
|
|
10542
10766
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10543
|
-
const skillsDirPath =
|
|
10544
|
-
const dirPaths = await findFilesByGlobs(
|
|
10767
|
+
const skillsDirPath = join76(this.baseDir, paths.relativeDirPath);
|
|
10768
|
+
const dirPaths = await findFilesByGlobs(join76(skillsDirPath, "*"), { type: "dir" });
|
|
10545
10769
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
10546
10770
|
const toolSkills = await Promise.all(
|
|
10547
10771
|
dirNames.map(
|
|
@@ -10558,8 +10782,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10558
10782
|
async loadToolDirsToDelete() {
|
|
10559
10783
|
const factory = this.getFactory(this.toolTarget);
|
|
10560
10784
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
10561
|
-
const skillsDirPath =
|
|
10562
|
-
const dirPaths = await findFilesByGlobs(
|
|
10785
|
+
const skillsDirPath = join76(this.baseDir, paths.relativeDirPath);
|
|
10786
|
+
const dirPaths = await findFilesByGlobs(join76(skillsDirPath, "*"), { type: "dir" });
|
|
10563
10787
|
const dirNames = dirPaths.map((path3) => basename5(path3));
|
|
10564
10788
|
const toolSkills = dirNames.map(
|
|
10565
10789
|
(dirName) => factory.class.forDeletion({
|
|
@@ -10621,11 +10845,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
10621
10845
|
};
|
|
10622
10846
|
|
|
10623
10847
|
// src/features/subagents/agentsmd-subagent.ts
|
|
10624
|
-
import { join as
|
|
10848
|
+
import { join as join78 } from "path";
|
|
10625
10849
|
|
|
10626
10850
|
// src/features/subagents/simulated-subagent.ts
|
|
10627
|
-
import { basename as basename6, join as
|
|
10628
|
-
import { z as
|
|
10851
|
+
import { basename as basename6, join as join77 } from "path";
|
|
10852
|
+
import { z as z40 } from "zod/mini";
|
|
10629
10853
|
|
|
10630
10854
|
// src/features/subagents/tool-subagent.ts
|
|
10631
10855
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -10677,9 +10901,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
10677
10901
|
};
|
|
10678
10902
|
|
|
10679
10903
|
// src/features/subagents/simulated-subagent.ts
|
|
10680
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
10681
|
-
name:
|
|
10682
|
-
description:
|
|
10904
|
+
var SimulatedSubagentFrontmatterSchema = z40.object({
|
|
10905
|
+
name: z40.string(),
|
|
10906
|
+
description: z40.optional(z40.string())
|
|
10683
10907
|
});
|
|
10684
10908
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
10685
10909
|
frontmatter;
|
|
@@ -10689,7 +10913,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10689
10913
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10690
10914
|
if (!result.success) {
|
|
10691
10915
|
throw new Error(
|
|
10692
|
-
`Invalid frontmatter in ${
|
|
10916
|
+
`Invalid frontmatter in ${join77(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10693
10917
|
);
|
|
10694
10918
|
}
|
|
10695
10919
|
}
|
|
@@ -10740,7 +10964,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10740
10964
|
return {
|
|
10741
10965
|
success: false,
|
|
10742
10966
|
error: new Error(
|
|
10743
|
-
`Invalid frontmatter in ${
|
|
10967
|
+
`Invalid frontmatter in ${join77(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10744
10968
|
)
|
|
10745
10969
|
};
|
|
10746
10970
|
}
|
|
@@ -10750,7 +10974,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10750
10974
|
relativeFilePath,
|
|
10751
10975
|
validate = true
|
|
10752
10976
|
}) {
|
|
10753
|
-
const filePath =
|
|
10977
|
+
const filePath = join77(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
10754
10978
|
const fileContent = await readFileContent(filePath);
|
|
10755
10979
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10756
10980
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10786,7 +11010,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
10786
11010
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
10787
11011
|
static getSettablePaths() {
|
|
10788
11012
|
return {
|
|
10789
|
-
relativeDirPath:
|
|
11013
|
+
relativeDirPath: join78(".agents", "subagents")
|
|
10790
11014
|
};
|
|
10791
11015
|
}
|
|
10792
11016
|
static async fromFile(params) {
|
|
@@ -10809,11 +11033,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
10809
11033
|
};
|
|
10810
11034
|
|
|
10811
11035
|
// src/features/subagents/factorydroid-subagent.ts
|
|
10812
|
-
import { join as
|
|
11036
|
+
import { join as join79 } from "path";
|
|
10813
11037
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
10814
11038
|
static getSettablePaths(_options) {
|
|
10815
11039
|
return {
|
|
10816
|
-
relativeDirPath:
|
|
11040
|
+
relativeDirPath: join79(".factory", "droids")
|
|
10817
11041
|
};
|
|
10818
11042
|
}
|
|
10819
11043
|
static async fromFile(params) {
|
|
@@ -10836,11 +11060,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
10836
11060
|
};
|
|
10837
11061
|
|
|
10838
11062
|
// src/features/subagents/geminicli-subagent.ts
|
|
10839
|
-
import { join as
|
|
11063
|
+
import { join as join80 } from "path";
|
|
10840
11064
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
10841
11065
|
static getSettablePaths() {
|
|
10842
11066
|
return {
|
|
10843
|
-
relativeDirPath:
|
|
11067
|
+
relativeDirPath: join80(".gemini", "subagents")
|
|
10844
11068
|
};
|
|
10845
11069
|
}
|
|
10846
11070
|
static async fromFile(params) {
|
|
@@ -10863,11 +11087,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
10863
11087
|
};
|
|
10864
11088
|
|
|
10865
11089
|
// src/features/subagents/roo-subagent.ts
|
|
10866
|
-
import { join as
|
|
11090
|
+
import { join as join81 } from "path";
|
|
10867
11091
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
10868
11092
|
static getSettablePaths() {
|
|
10869
11093
|
return {
|
|
10870
|
-
relativeDirPath:
|
|
11094
|
+
relativeDirPath: join81(".roo", "subagents")
|
|
10871
11095
|
};
|
|
10872
11096
|
}
|
|
10873
11097
|
static async fromFile(params) {
|
|
@@ -10890,20 +11114,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
10890
11114
|
};
|
|
10891
11115
|
|
|
10892
11116
|
// src/features/subagents/subagents-processor.ts
|
|
10893
|
-
import { basename as basename9, join as
|
|
10894
|
-
import { z as
|
|
11117
|
+
import { basename as basename9, join as join90 } from "path";
|
|
11118
|
+
import { z as z49 } from "zod/mini";
|
|
10895
11119
|
|
|
10896
11120
|
// src/features/subagents/claudecode-subagent.ts
|
|
10897
|
-
import { join as
|
|
10898
|
-
import { z as
|
|
11121
|
+
import { join as join83 } from "path";
|
|
11122
|
+
import { z as z42 } from "zod/mini";
|
|
10899
11123
|
|
|
10900
11124
|
// src/features/subagents/rulesync-subagent.ts
|
|
10901
|
-
import { basename as basename7, join as
|
|
10902
|
-
import { z as
|
|
10903
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
10904
|
-
targets:
|
|
10905
|
-
name:
|
|
10906
|
-
description:
|
|
11125
|
+
import { basename as basename7, join as join82 } from "path";
|
|
11126
|
+
import { z as z41 } from "zod/mini";
|
|
11127
|
+
var RulesyncSubagentFrontmatterSchema = z41.looseObject({
|
|
11128
|
+
targets: z41._default(RulesyncTargetsSchema, ["*"]),
|
|
11129
|
+
name: z41.string(),
|
|
11130
|
+
description: z41.optional(z41.string())
|
|
10907
11131
|
});
|
|
10908
11132
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
10909
11133
|
frontmatter;
|
|
@@ -10912,7 +11136,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10912
11136
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10913
11137
|
if (!parseResult.success && rest.validate !== false) {
|
|
10914
11138
|
throw new Error(
|
|
10915
|
-
`Invalid frontmatter in ${
|
|
11139
|
+
`Invalid frontmatter in ${join82(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
10916
11140
|
);
|
|
10917
11141
|
}
|
|
10918
11142
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -10945,7 +11169,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10945
11169
|
return {
|
|
10946
11170
|
success: false,
|
|
10947
11171
|
error: new Error(
|
|
10948
|
-
`Invalid frontmatter in ${
|
|
11172
|
+
`Invalid frontmatter in ${join82(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10949
11173
|
)
|
|
10950
11174
|
};
|
|
10951
11175
|
}
|
|
@@ -10953,7 +11177,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10953
11177
|
static async fromFile({
|
|
10954
11178
|
relativeFilePath
|
|
10955
11179
|
}) {
|
|
10956
|
-
const filePath =
|
|
11180
|
+
const filePath = join82(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
10957
11181
|
const fileContent = await readFileContent(filePath);
|
|
10958
11182
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
10959
11183
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10972,13 +11196,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
10972
11196
|
};
|
|
10973
11197
|
|
|
10974
11198
|
// src/features/subagents/claudecode-subagent.ts
|
|
10975
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
10976
|
-
name:
|
|
10977
|
-
description:
|
|
10978
|
-
model:
|
|
10979
|
-
tools:
|
|
10980
|
-
permissionMode:
|
|
10981
|
-
skills:
|
|
11199
|
+
var ClaudecodeSubagentFrontmatterSchema = z42.looseObject({
|
|
11200
|
+
name: z42.string(),
|
|
11201
|
+
description: z42.optional(z42.string()),
|
|
11202
|
+
model: z42.optional(z42.string()),
|
|
11203
|
+
tools: z42.optional(z42.union([z42.string(), z42.array(z42.string())])),
|
|
11204
|
+
permissionMode: z42.optional(z42.string()),
|
|
11205
|
+
skills: z42.optional(z42.union([z42.string(), z42.array(z42.string())]))
|
|
10982
11206
|
});
|
|
10983
11207
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
10984
11208
|
frontmatter;
|
|
@@ -10988,7 +11212,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10988
11212
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10989
11213
|
if (!result.success) {
|
|
10990
11214
|
throw new Error(
|
|
10991
|
-
`Invalid frontmatter in ${
|
|
11215
|
+
`Invalid frontmatter in ${join83(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10992
11216
|
);
|
|
10993
11217
|
}
|
|
10994
11218
|
}
|
|
@@ -11000,7 +11224,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11000
11224
|
}
|
|
11001
11225
|
static getSettablePaths(_options = {}) {
|
|
11002
11226
|
return {
|
|
11003
|
-
relativeDirPath:
|
|
11227
|
+
relativeDirPath: join83(".claude", "agents")
|
|
11004
11228
|
};
|
|
11005
11229
|
}
|
|
11006
11230
|
getFrontmatter() {
|
|
@@ -11039,7 +11263,10 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11039
11263
|
global = false
|
|
11040
11264
|
}) {
|
|
11041
11265
|
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
11042
|
-
const claudecodeSection = rulesyncFrontmatter.claudecode ?? {}
|
|
11266
|
+
const claudecodeSection = this.filterToolSpecificSection(rulesyncFrontmatter.claudecode ?? {}, [
|
|
11267
|
+
"name",
|
|
11268
|
+
"description"
|
|
11269
|
+
]);
|
|
11043
11270
|
const rawClaudecodeFrontmatter = {
|
|
11044
11271
|
name: rulesyncFrontmatter.name,
|
|
11045
11272
|
description: rulesyncFrontmatter.description,
|
|
@@ -11076,7 +11303,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11076
11303
|
return {
|
|
11077
11304
|
success: false,
|
|
11078
11305
|
error: new Error(
|
|
11079
|
-
`Invalid frontmatter in ${
|
|
11306
|
+
`Invalid frontmatter in ${join83(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11080
11307
|
)
|
|
11081
11308
|
};
|
|
11082
11309
|
}
|
|
@@ -11094,7 +11321,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11094
11321
|
global = false
|
|
11095
11322
|
}) {
|
|
11096
11323
|
const paths = this.getSettablePaths({ global });
|
|
11097
|
-
const filePath =
|
|
11324
|
+
const filePath = join83(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11098
11325
|
const fileContent = await readFileContent(filePath);
|
|
11099
11326
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11100
11327
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11129,16 +11356,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
11129
11356
|
};
|
|
11130
11357
|
|
|
11131
11358
|
// src/features/subagents/codexcli-subagent.ts
|
|
11132
|
-
import { join as
|
|
11359
|
+
import { join as join84 } from "path";
|
|
11133
11360
|
import * as smolToml2 from "smol-toml";
|
|
11134
|
-
import { z as
|
|
11135
|
-
var CodexCliSubagentTomlSchema =
|
|
11136
|
-
name:
|
|
11137
|
-
description:
|
|
11138
|
-
developer_instructions:
|
|
11139
|
-
model:
|
|
11140
|
-
model_reasoning_effort:
|
|
11141
|
-
sandbox_mode:
|
|
11361
|
+
import { z as z43 } from "zod/mini";
|
|
11362
|
+
var CodexCliSubagentTomlSchema = z43.looseObject({
|
|
11363
|
+
name: z43.string(),
|
|
11364
|
+
description: z43.optional(z43.string()),
|
|
11365
|
+
developer_instructions: z43.optional(z43.string()),
|
|
11366
|
+
model: z43.optional(z43.string()),
|
|
11367
|
+
model_reasoning_effort: z43.optional(z43.string()),
|
|
11368
|
+
sandbox_mode: z43.optional(z43.string())
|
|
11142
11369
|
});
|
|
11143
11370
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
11144
11371
|
body;
|
|
@@ -11149,7 +11376,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11149
11376
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
11150
11377
|
} catch (error) {
|
|
11151
11378
|
throw new Error(
|
|
11152
|
-
`Invalid TOML in ${
|
|
11379
|
+
`Invalid TOML in ${join84(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11153
11380
|
{ cause: error }
|
|
11154
11381
|
);
|
|
11155
11382
|
}
|
|
@@ -11161,7 +11388,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11161
11388
|
}
|
|
11162
11389
|
static getSettablePaths(_options = {}) {
|
|
11163
11390
|
return {
|
|
11164
|
-
relativeDirPath:
|
|
11391
|
+
relativeDirPath: join84(".codex", "agents")
|
|
11165
11392
|
};
|
|
11166
11393
|
}
|
|
11167
11394
|
getBody() {
|
|
@@ -11173,7 +11400,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11173
11400
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
11174
11401
|
} catch (error) {
|
|
11175
11402
|
throw new Error(
|
|
11176
|
-
`Failed to parse TOML in ${
|
|
11403
|
+
`Failed to parse TOML in ${join84(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11177
11404
|
{ cause: error }
|
|
11178
11405
|
);
|
|
11179
11406
|
}
|
|
@@ -11254,7 +11481,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11254
11481
|
global = false
|
|
11255
11482
|
}) {
|
|
11256
11483
|
const paths = this.getSettablePaths({ global });
|
|
11257
|
-
const filePath =
|
|
11484
|
+
const filePath = join84(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11258
11485
|
const fileContent = await readFileContent(filePath);
|
|
11259
11486
|
const subagent = new _CodexCliSubagent({
|
|
11260
11487
|
baseDir,
|
|
@@ -11292,13 +11519,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
11292
11519
|
};
|
|
11293
11520
|
|
|
11294
11521
|
// src/features/subagents/copilot-subagent.ts
|
|
11295
|
-
import { join as
|
|
11296
|
-
import { z as
|
|
11522
|
+
import { join as join85 } from "path";
|
|
11523
|
+
import { z as z44 } from "zod/mini";
|
|
11297
11524
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
11298
|
-
var CopilotSubagentFrontmatterSchema =
|
|
11299
|
-
name:
|
|
11300
|
-
description:
|
|
11301
|
-
tools:
|
|
11525
|
+
var CopilotSubagentFrontmatterSchema = z44.looseObject({
|
|
11526
|
+
name: z44.string(),
|
|
11527
|
+
description: z44.optional(z44.string()),
|
|
11528
|
+
tools: z44.optional(z44.union([z44.string(), z44.array(z44.string())]))
|
|
11302
11529
|
});
|
|
11303
11530
|
var normalizeTools = (tools) => {
|
|
11304
11531
|
if (!tools) {
|
|
@@ -11318,7 +11545,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11318
11545
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11319
11546
|
if (!result.success) {
|
|
11320
11547
|
throw new Error(
|
|
11321
|
-
`Invalid frontmatter in ${
|
|
11548
|
+
`Invalid frontmatter in ${join85(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11322
11549
|
);
|
|
11323
11550
|
}
|
|
11324
11551
|
}
|
|
@@ -11330,7 +11557,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11330
11557
|
}
|
|
11331
11558
|
static getSettablePaths(_options = {}) {
|
|
11332
11559
|
return {
|
|
11333
|
-
relativeDirPath:
|
|
11560
|
+
relativeDirPath: join85(".github", "agents")
|
|
11334
11561
|
};
|
|
11335
11562
|
}
|
|
11336
11563
|
getFrontmatter() {
|
|
@@ -11404,7 +11631,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11404
11631
|
return {
|
|
11405
11632
|
success: false,
|
|
11406
11633
|
error: new Error(
|
|
11407
|
-
`Invalid frontmatter in ${
|
|
11634
|
+
`Invalid frontmatter in ${join85(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11408
11635
|
)
|
|
11409
11636
|
};
|
|
11410
11637
|
}
|
|
@@ -11422,7 +11649,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11422
11649
|
global = false
|
|
11423
11650
|
}) {
|
|
11424
11651
|
const paths = this.getSettablePaths({ global });
|
|
11425
|
-
const filePath =
|
|
11652
|
+
const filePath = join85(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11426
11653
|
const fileContent = await readFileContent(filePath);
|
|
11427
11654
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11428
11655
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11458,11 +11685,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
11458
11685
|
};
|
|
11459
11686
|
|
|
11460
11687
|
// src/features/subagents/cursor-subagent.ts
|
|
11461
|
-
import { join as
|
|
11462
|
-
import { z as
|
|
11463
|
-
var CursorSubagentFrontmatterSchema =
|
|
11464
|
-
name:
|
|
11465
|
-
description:
|
|
11688
|
+
import { join as join86 } from "path";
|
|
11689
|
+
import { z as z45 } from "zod/mini";
|
|
11690
|
+
var CursorSubagentFrontmatterSchema = z45.looseObject({
|
|
11691
|
+
name: z45.string(),
|
|
11692
|
+
description: z45.optional(z45.string())
|
|
11466
11693
|
});
|
|
11467
11694
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
11468
11695
|
frontmatter;
|
|
@@ -11472,7 +11699,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11472
11699
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11473
11700
|
if (!result.success) {
|
|
11474
11701
|
throw new Error(
|
|
11475
|
-
`Invalid frontmatter in ${
|
|
11702
|
+
`Invalid frontmatter in ${join86(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11476
11703
|
);
|
|
11477
11704
|
}
|
|
11478
11705
|
}
|
|
@@ -11484,7 +11711,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11484
11711
|
}
|
|
11485
11712
|
static getSettablePaths(_options = {}) {
|
|
11486
11713
|
return {
|
|
11487
|
-
relativeDirPath:
|
|
11714
|
+
relativeDirPath: join86(".cursor", "agents")
|
|
11488
11715
|
};
|
|
11489
11716
|
}
|
|
11490
11717
|
getFrontmatter() {
|
|
@@ -11551,7 +11778,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11551
11778
|
return {
|
|
11552
11779
|
success: false,
|
|
11553
11780
|
error: new Error(
|
|
11554
|
-
`Invalid frontmatter in ${
|
|
11781
|
+
`Invalid frontmatter in ${join86(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11555
11782
|
)
|
|
11556
11783
|
};
|
|
11557
11784
|
}
|
|
@@ -11569,7 +11796,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11569
11796
|
global = false
|
|
11570
11797
|
}) {
|
|
11571
11798
|
const paths = this.getSettablePaths({ global });
|
|
11572
|
-
const filePath =
|
|
11799
|
+
const filePath = join86(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11573
11800
|
const fileContent = await readFileContent(filePath);
|
|
11574
11801
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11575
11802
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11604,24 +11831,182 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
11604
11831
|
}
|
|
11605
11832
|
};
|
|
11606
11833
|
|
|
11834
|
+
// src/features/subagents/junie-subagent.ts
|
|
11835
|
+
import { join as join87 } from "path";
|
|
11836
|
+
import { z as z46 } from "zod/mini";
|
|
11837
|
+
var JunieSubagentFrontmatterSchema = z46.looseObject({
|
|
11838
|
+
name: z46.optional(z46.string()),
|
|
11839
|
+
description: z46.string()
|
|
11840
|
+
});
|
|
11841
|
+
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
11842
|
+
frontmatter;
|
|
11843
|
+
body;
|
|
11844
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
11845
|
+
if (rest.validate !== false) {
|
|
11846
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11847
|
+
if (!result.success) {
|
|
11848
|
+
throw new Error(
|
|
11849
|
+
`Invalid frontmatter in ${join87(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11850
|
+
);
|
|
11851
|
+
}
|
|
11852
|
+
}
|
|
11853
|
+
super({
|
|
11854
|
+
...rest
|
|
11855
|
+
});
|
|
11856
|
+
this.frontmatter = frontmatter;
|
|
11857
|
+
this.body = body;
|
|
11858
|
+
}
|
|
11859
|
+
static getSettablePaths(options = {}) {
|
|
11860
|
+
if (options?.global) {
|
|
11861
|
+
throw new Error("JunieSubagent does not support global mode.");
|
|
11862
|
+
}
|
|
11863
|
+
return {
|
|
11864
|
+
relativeDirPath: join87(".junie", "agents")
|
|
11865
|
+
};
|
|
11866
|
+
}
|
|
11867
|
+
getFrontmatter() {
|
|
11868
|
+
return this.frontmatter;
|
|
11869
|
+
}
|
|
11870
|
+
getBody() {
|
|
11871
|
+
return this.body;
|
|
11872
|
+
}
|
|
11873
|
+
toRulesyncSubagent() {
|
|
11874
|
+
const { name, description, ...restFields } = this.frontmatter;
|
|
11875
|
+
const junieSection = {
|
|
11876
|
+
...restFields
|
|
11877
|
+
};
|
|
11878
|
+
const rulesyncFrontmatter = {
|
|
11879
|
+
targets: ["*"],
|
|
11880
|
+
name: name ?? this.getRelativeFilePath().replace(/\.md$/, ""),
|
|
11881
|
+
description,
|
|
11882
|
+
...Object.keys(junieSection).length > 0 && { junie: junieSection }
|
|
11883
|
+
};
|
|
11884
|
+
return new RulesyncSubagent({
|
|
11885
|
+
baseDir: ".",
|
|
11886
|
+
frontmatter: rulesyncFrontmatter,
|
|
11887
|
+
body: this.body,
|
|
11888
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
11889
|
+
relativeFilePath: this.getRelativeFilePath(),
|
|
11890
|
+
validate: true
|
|
11891
|
+
});
|
|
11892
|
+
}
|
|
11893
|
+
static fromRulesyncSubagent({
|
|
11894
|
+
baseDir = process.cwd(),
|
|
11895
|
+
rulesyncSubagent,
|
|
11896
|
+
validate = true,
|
|
11897
|
+
global = false
|
|
11898
|
+
}) {
|
|
11899
|
+
const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
|
|
11900
|
+
const junieSection = this.filterToolSpecificSection(rulesyncFrontmatter.junie ?? {}, [
|
|
11901
|
+
"name",
|
|
11902
|
+
"description"
|
|
11903
|
+
]);
|
|
11904
|
+
const rawJunieFrontmatter = {
|
|
11905
|
+
name: rulesyncFrontmatter.name,
|
|
11906
|
+
description: rulesyncFrontmatter.description,
|
|
11907
|
+
...junieSection
|
|
11908
|
+
};
|
|
11909
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(rawJunieFrontmatter);
|
|
11910
|
+
if (!result.success) {
|
|
11911
|
+
throw new Error(
|
|
11912
|
+
`Invalid junie subagent frontmatter in ${rulesyncSubagent.getRelativeFilePath()}: ${formatError(result.error)}`
|
|
11913
|
+
);
|
|
11914
|
+
}
|
|
11915
|
+
const junieFrontmatter = result.data;
|
|
11916
|
+
const body = rulesyncSubagent.getBody();
|
|
11917
|
+
const fileContent = stringifyFrontmatter(body, junieFrontmatter);
|
|
11918
|
+
const paths = this.getSettablePaths({ global });
|
|
11919
|
+
return new _JunieSubagent({
|
|
11920
|
+
baseDir,
|
|
11921
|
+
frontmatter: junieFrontmatter,
|
|
11922
|
+
body,
|
|
11923
|
+
relativeDirPath: paths.relativeDirPath,
|
|
11924
|
+
relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
|
|
11925
|
+
fileContent,
|
|
11926
|
+
validate
|
|
11927
|
+
});
|
|
11928
|
+
}
|
|
11929
|
+
validate() {
|
|
11930
|
+
if (!this.frontmatter) {
|
|
11931
|
+
return { success: true, error: null };
|
|
11932
|
+
}
|
|
11933
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(this.frontmatter);
|
|
11934
|
+
if (result.success) {
|
|
11935
|
+
return { success: true, error: null };
|
|
11936
|
+
} else {
|
|
11937
|
+
return {
|
|
11938
|
+
success: false,
|
|
11939
|
+
error: new Error(
|
|
11940
|
+
`Invalid frontmatter in ${join87(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11941
|
+
)
|
|
11942
|
+
};
|
|
11943
|
+
}
|
|
11944
|
+
}
|
|
11945
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
11946
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
11947
|
+
rulesyncSubagent,
|
|
11948
|
+
toolTarget: "junie"
|
|
11949
|
+
});
|
|
11950
|
+
}
|
|
11951
|
+
static async fromFile({
|
|
11952
|
+
baseDir = process.cwd(),
|
|
11953
|
+
relativeFilePath,
|
|
11954
|
+
validate = true,
|
|
11955
|
+
global = false
|
|
11956
|
+
}) {
|
|
11957
|
+
const paths = this.getSettablePaths({ global });
|
|
11958
|
+
const filePath = join87(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11959
|
+
const fileContent = await readFileContent(filePath);
|
|
11960
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11961
|
+
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11962
|
+
if (!result.success) {
|
|
11963
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
11964
|
+
}
|
|
11965
|
+
return new _JunieSubagent({
|
|
11966
|
+
baseDir,
|
|
11967
|
+
relativeDirPath: paths.relativeDirPath,
|
|
11968
|
+
relativeFilePath,
|
|
11969
|
+
frontmatter: result.data,
|
|
11970
|
+
body: content.trim(),
|
|
11971
|
+
fileContent,
|
|
11972
|
+
validate
|
|
11973
|
+
});
|
|
11974
|
+
}
|
|
11975
|
+
static forDeletion({
|
|
11976
|
+
baseDir = process.cwd(),
|
|
11977
|
+
relativeDirPath,
|
|
11978
|
+
relativeFilePath
|
|
11979
|
+
}) {
|
|
11980
|
+
return new _JunieSubagent({
|
|
11981
|
+
baseDir,
|
|
11982
|
+
relativeDirPath,
|
|
11983
|
+
relativeFilePath,
|
|
11984
|
+
frontmatter: { name: "", description: "" },
|
|
11985
|
+
body: "",
|
|
11986
|
+
fileContent: "",
|
|
11987
|
+
validate: false
|
|
11988
|
+
});
|
|
11989
|
+
}
|
|
11990
|
+
};
|
|
11991
|
+
|
|
11607
11992
|
// src/features/subagents/kiro-subagent.ts
|
|
11608
|
-
import { join as
|
|
11609
|
-
import { z as
|
|
11610
|
-
var KiroCliSubagentJsonSchema =
|
|
11611
|
-
name:
|
|
11612
|
-
description:
|
|
11613
|
-
prompt:
|
|
11614
|
-
tools:
|
|
11615
|
-
toolAliases:
|
|
11616
|
-
toolSettings:
|
|
11617
|
-
toolSchema:
|
|
11618
|
-
hooks:
|
|
11619
|
-
model:
|
|
11620
|
-
mcpServers:
|
|
11621
|
-
useLegacyMcpJson:
|
|
11622
|
-
resources:
|
|
11623
|
-
allowedTools:
|
|
11624
|
-
includeMcpJson:
|
|
11993
|
+
import { join as join88 } from "path";
|
|
11994
|
+
import { z as z47 } from "zod/mini";
|
|
11995
|
+
var KiroCliSubagentJsonSchema = z47.looseObject({
|
|
11996
|
+
name: z47.string(),
|
|
11997
|
+
description: z47.optional(z47.nullable(z47.string())),
|
|
11998
|
+
prompt: z47.optional(z47.nullable(z47.string())),
|
|
11999
|
+
tools: z47.optional(z47.nullable(z47.array(z47.string()))),
|
|
12000
|
+
toolAliases: z47.optional(z47.nullable(z47.record(z47.string(), z47.string()))),
|
|
12001
|
+
toolSettings: z47.optional(z47.nullable(z47.unknown())),
|
|
12002
|
+
toolSchema: z47.optional(z47.nullable(z47.unknown())),
|
|
12003
|
+
hooks: z47.optional(z47.nullable(z47.record(z47.string(), z47.array(z47.unknown())))),
|
|
12004
|
+
model: z47.optional(z47.nullable(z47.string())),
|
|
12005
|
+
mcpServers: z47.optional(z47.nullable(z47.record(z47.string(), z47.unknown()))),
|
|
12006
|
+
useLegacyMcpJson: z47.optional(z47.nullable(z47.boolean())),
|
|
12007
|
+
resources: z47.optional(z47.nullable(z47.array(z47.string()))),
|
|
12008
|
+
allowedTools: z47.optional(z47.nullable(z47.array(z47.string()))),
|
|
12009
|
+
includeMcpJson: z47.optional(z47.nullable(z47.boolean()))
|
|
11625
12010
|
});
|
|
11626
12011
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
11627
12012
|
body;
|
|
@@ -11632,7 +12017,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11632
12017
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
11633
12018
|
} catch (error) {
|
|
11634
12019
|
throw new Error(
|
|
11635
|
-
`Invalid JSON in ${
|
|
12020
|
+
`Invalid JSON in ${join88(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11636
12021
|
{ cause: error }
|
|
11637
12022
|
);
|
|
11638
12023
|
}
|
|
@@ -11644,7 +12029,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11644
12029
|
}
|
|
11645
12030
|
static getSettablePaths(_options = {}) {
|
|
11646
12031
|
return {
|
|
11647
|
-
relativeDirPath:
|
|
12032
|
+
relativeDirPath: join88(".kiro", "agents")
|
|
11648
12033
|
};
|
|
11649
12034
|
}
|
|
11650
12035
|
getBody() {
|
|
@@ -11656,7 +12041,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11656
12041
|
parsed = JSON.parse(this.body);
|
|
11657
12042
|
} catch (error) {
|
|
11658
12043
|
throw new Error(
|
|
11659
|
-
`Failed to parse JSON in ${
|
|
12044
|
+
`Failed to parse JSON in ${join88(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
11660
12045
|
{ cause: error }
|
|
11661
12046
|
);
|
|
11662
12047
|
}
|
|
@@ -11737,7 +12122,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11737
12122
|
global = false
|
|
11738
12123
|
}) {
|
|
11739
12124
|
const paths = this.getSettablePaths({ global });
|
|
11740
|
-
const filePath =
|
|
12125
|
+
const filePath = join88(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11741
12126
|
const fileContent = await readFileContent(filePath);
|
|
11742
12127
|
const subagent = new _KiroSubagent({
|
|
11743
12128
|
baseDir,
|
|
@@ -11775,12 +12160,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
11775
12160
|
};
|
|
11776
12161
|
|
|
11777
12162
|
// src/features/subagents/opencode-subagent.ts
|
|
11778
|
-
import { basename as basename8, join as
|
|
11779
|
-
import { z as
|
|
11780
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
11781
|
-
description:
|
|
11782
|
-
mode:
|
|
11783
|
-
name:
|
|
12163
|
+
import { basename as basename8, join as join89 } from "path";
|
|
12164
|
+
import { z as z48 } from "zod/mini";
|
|
12165
|
+
var OpenCodeSubagentFrontmatterSchema = z48.looseObject({
|
|
12166
|
+
description: z48.optional(z48.string()),
|
|
12167
|
+
mode: z48._default(z48.string(), "subagent"),
|
|
12168
|
+
name: z48.optional(z48.string())
|
|
11784
12169
|
});
|
|
11785
12170
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
11786
12171
|
frontmatter;
|
|
@@ -11790,7 +12175,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11790
12175
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
11791
12176
|
if (!result.success) {
|
|
11792
12177
|
throw new Error(
|
|
11793
|
-
`Invalid frontmatter in ${
|
|
12178
|
+
`Invalid frontmatter in ${join89(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11794
12179
|
);
|
|
11795
12180
|
}
|
|
11796
12181
|
}
|
|
@@ -11804,7 +12189,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11804
12189
|
global = false
|
|
11805
12190
|
} = {}) {
|
|
11806
12191
|
return {
|
|
11807
|
-
relativeDirPath: global ?
|
|
12192
|
+
relativeDirPath: global ? join89(".config", "opencode", "agent") : join89(".opencode", "agent")
|
|
11808
12193
|
};
|
|
11809
12194
|
}
|
|
11810
12195
|
getFrontmatter() {
|
|
@@ -11870,7 +12255,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11870
12255
|
return {
|
|
11871
12256
|
success: false,
|
|
11872
12257
|
error: new Error(
|
|
11873
|
-
`Invalid frontmatter in ${
|
|
12258
|
+
`Invalid frontmatter in ${join89(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11874
12259
|
)
|
|
11875
12260
|
};
|
|
11876
12261
|
}
|
|
@@ -11887,7 +12272,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
11887
12272
|
global = false
|
|
11888
12273
|
}) {
|
|
11889
12274
|
const paths = this.getSettablePaths({ global });
|
|
11890
|
-
const filePath =
|
|
12275
|
+
const filePath = join89(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
11891
12276
|
const fileContent = await readFileContent(filePath);
|
|
11892
12277
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
11893
12278
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -11932,11 +12317,12 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
11932
12317
|
"cursor",
|
|
11933
12318
|
"factorydroid",
|
|
11934
12319
|
"geminicli",
|
|
12320
|
+
"junie",
|
|
11935
12321
|
"kiro",
|
|
11936
12322
|
"opencode",
|
|
11937
12323
|
"roo"
|
|
11938
12324
|
];
|
|
11939
|
-
var SubagentsProcessorToolTargetSchema =
|
|
12325
|
+
var SubagentsProcessorToolTargetSchema = z49.enum(subagentsProcessorToolTargetTuple);
|
|
11940
12326
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
11941
12327
|
[
|
|
11942
12328
|
"agentsmd",
|
|
@@ -11994,6 +12380,13 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
11994
12380
|
meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
|
|
11995
12381
|
}
|
|
11996
12382
|
],
|
|
12383
|
+
[
|
|
12384
|
+
"junie",
|
|
12385
|
+
{
|
|
12386
|
+
class: JunieSubagent,
|
|
12387
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.md" }
|
|
12388
|
+
}
|
|
12389
|
+
],
|
|
11997
12390
|
[
|
|
11998
12391
|
"kiro",
|
|
11999
12392
|
{
|
|
@@ -12098,7 +12491,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12098
12491
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
12099
12492
|
*/
|
|
12100
12493
|
async loadRulesyncFiles() {
|
|
12101
|
-
const subagentsDir =
|
|
12494
|
+
const subagentsDir = join90(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
12102
12495
|
const dirExists = await directoryExists(subagentsDir);
|
|
12103
12496
|
if (!dirExists) {
|
|
12104
12497
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -12113,7 +12506,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12113
12506
|
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
12114
12507
|
const rulesyncSubagents = [];
|
|
12115
12508
|
for (const mdFile of mdFiles) {
|
|
12116
|
-
const filepath =
|
|
12509
|
+
const filepath = join90(subagentsDir, mdFile);
|
|
12117
12510
|
try {
|
|
12118
12511
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
12119
12512
|
relativeFilePath: mdFile,
|
|
@@ -12143,7 +12536,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12143
12536
|
const factory = this.getFactory(this.toolTarget);
|
|
12144
12537
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
12145
12538
|
const subagentFilePaths = await findFilesByGlobs(
|
|
12146
|
-
|
|
12539
|
+
join90(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
12147
12540
|
);
|
|
12148
12541
|
if (forDeletion) {
|
|
12149
12542
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -12208,49 +12601,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
12208
12601
|
};
|
|
12209
12602
|
|
|
12210
12603
|
// src/features/rules/agentsmd-rule.ts
|
|
12211
|
-
import { join as
|
|
12604
|
+
import { join as join93 } from "path";
|
|
12212
12605
|
|
|
12213
12606
|
// src/features/rules/tool-rule.ts
|
|
12214
|
-
import { join as
|
|
12607
|
+
import { join as join92 } from "path";
|
|
12215
12608
|
|
|
12216
12609
|
// src/features/rules/rulesync-rule.ts
|
|
12217
|
-
import { join as
|
|
12218
|
-
import { z as
|
|
12219
|
-
var RulesyncRuleFrontmatterSchema =
|
|
12220
|
-
root:
|
|
12221
|
-
localRoot:
|
|
12222
|
-
targets:
|
|
12223
|
-
description:
|
|
12224
|
-
globs:
|
|
12225
|
-
agentsmd:
|
|
12226
|
-
|
|
12610
|
+
import { join as join91 } from "path";
|
|
12611
|
+
import { z as z50 } from "zod/mini";
|
|
12612
|
+
var RulesyncRuleFrontmatterSchema = z50.object({
|
|
12613
|
+
root: z50.optional(z50.boolean()),
|
|
12614
|
+
localRoot: z50.optional(z50.boolean()),
|
|
12615
|
+
targets: z50._default(RulesyncTargetsSchema, ["*"]),
|
|
12616
|
+
description: z50.optional(z50.string()),
|
|
12617
|
+
globs: z50.optional(z50.array(z50.string())),
|
|
12618
|
+
agentsmd: z50.optional(
|
|
12619
|
+
z50.object({
|
|
12227
12620
|
// @example "path/to/subproject"
|
|
12228
|
-
subprojectPath:
|
|
12621
|
+
subprojectPath: z50.optional(z50.string())
|
|
12229
12622
|
})
|
|
12230
12623
|
),
|
|
12231
|
-
claudecode:
|
|
12232
|
-
|
|
12624
|
+
claudecode: z50.optional(
|
|
12625
|
+
z50.object({
|
|
12233
12626
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
12234
12627
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
12235
|
-
paths:
|
|
12628
|
+
paths: z50.optional(z50.array(z50.string()))
|
|
12236
12629
|
})
|
|
12237
12630
|
),
|
|
12238
|
-
cursor:
|
|
12239
|
-
|
|
12240
|
-
alwaysApply:
|
|
12241
|
-
description:
|
|
12242
|
-
globs:
|
|
12631
|
+
cursor: z50.optional(
|
|
12632
|
+
z50.object({
|
|
12633
|
+
alwaysApply: z50.optional(z50.boolean()),
|
|
12634
|
+
description: z50.optional(z50.string()),
|
|
12635
|
+
globs: z50.optional(z50.array(z50.string()))
|
|
12243
12636
|
})
|
|
12244
12637
|
),
|
|
12245
|
-
copilot:
|
|
12246
|
-
|
|
12247
|
-
excludeAgent:
|
|
12638
|
+
copilot: z50.optional(
|
|
12639
|
+
z50.object({
|
|
12640
|
+
excludeAgent: z50.optional(z50.union([z50.literal("code-review"), z50.literal("coding-agent")]))
|
|
12248
12641
|
})
|
|
12249
12642
|
),
|
|
12250
|
-
antigravity:
|
|
12251
|
-
|
|
12252
|
-
trigger:
|
|
12253
|
-
globs:
|
|
12643
|
+
antigravity: z50.optional(
|
|
12644
|
+
z50.looseObject({
|
|
12645
|
+
trigger: z50.optional(z50.string()),
|
|
12646
|
+
globs: z50.optional(z50.array(z50.string()))
|
|
12254
12647
|
})
|
|
12255
12648
|
)
|
|
12256
12649
|
});
|
|
@@ -12261,7 +12654,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12261
12654
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12262
12655
|
if (!parseResult.success && rest.validate !== false) {
|
|
12263
12656
|
throw new Error(
|
|
12264
|
-
`Invalid frontmatter in ${
|
|
12657
|
+
`Invalid frontmatter in ${join91(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12265
12658
|
);
|
|
12266
12659
|
}
|
|
12267
12660
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -12296,7 +12689,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12296
12689
|
return {
|
|
12297
12690
|
success: false,
|
|
12298
12691
|
error: new Error(
|
|
12299
|
-
`Invalid frontmatter in ${
|
|
12692
|
+
`Invalid frontmatter in ${join91(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12300
12693
|
)
|
|
12301
12694
|
};
|
|
12302
12695
|
}
|
|
@@ -12305,7 +12698,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
12305
12698
|
relativeFilePath,
|
|
12306
12699
|
validate = true
|
|
12307
12700
|
}) {
|
|
12308
|
-
const filePath =
|
|
12701
|
+
const filePath = join91(
|
|
12309
12702
|
process.cwd(),
|
|
12310
12703
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
12311
12704
|
relativeFilePath
|
|
@@ -12407,7 +12800,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12407
12800
|
rulesyncRule,
|
|
12408
12801
|
validate = true,
|
|
12409
12802
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
12410
|
-
nonRootPath = { relativeDirPath:
|
|
12803
|
+
nonRootPath = { relativeDirPath: join92(".agents", "memories") }
|
|
12411
12804
|
}) {
|
|
12412
12805
|
const params = this.buildToolRuleParamsDefault({
|
|
12413
12806
|
baseDir,
|
|
@@ -12418,7 +12811,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12418
12811
|
});
|
|
12419
12812
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
12420
12813
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
12421
|
-
params.relativeDirPath =
|
|
12814
|
+
params.relativeDirPath = join92(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
12422
12815
|
params.relativeFilePath = "AGENTS.md";
|
|
12423
12816
|
}
|
|
12424
12817
|
return params;
|
|
@@ -12467,7 +12860,7 @@ var ToolRule = class extends ToolFile {
|
|
|
12467
12860
|
}
|
|
12468
12861
|
};
|
|
12469
12862
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
12470
|
-
return excludeToolDir ? subDir :
|
|
12863
|
+
return excludeToolDir ? subDir : join92(toolDir, subDir);
|
|
12471
12864
|
}
|
|
12472
12865
|
|
|
12473
12866
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -12496,8 +12889,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12496
12889
|
validate = true
|
|
12497
12890
|
}) {
|
|
12498
12891
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
12499
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
12500
|
-
const fileContent = await readFileContent(
|
|
12892
|
+
const relativePath = isRoot ? "AGENTS.md" : join93(".agents", "memories", relativeFilePath);
|
|
12893
|
+
const fileContent = await readFileContent(join93(baseDir, relativePath));
|
|
12501
12894
|
return new _AgentsMdRule({
|
|
12502
12895
|
baseDir,
|
|
12503
12896
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12552,21 +12945,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
12552
12945
|
};
|
|
12553
12946
|
|
|
12554
12947
|
// src/features/rules/antigravity-rule.ts
|
|
12555
|
-
import { join as
|
|
12556
|
-
import { z as
|
|
12557
|
-
var AntigravityRuleFrontmatterSchema =
|
|
12558
|
-
trigger:
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12948
|
+
import { join as join94 } from "path";
|
|
12949
|
+
import { z as z51 } from "zod/mini";
|
|
12950
|
+
var AntigravityRuleFrontmatterSchema = z51.looseObject({
|
|
12951
|
+
trigger: z51.optional(
|
|
12952
|
+
z51.union([
|
|
12953
|
+
z51.literal("always_on"),
|
|
12954
|
+
z51.literal("glob"),
|
|
12955
|
+
z51.literal("manual"),
|
|
12956
|
+
z51.literal("model_decision"),
|
|
12957
|
+
z51.string()
|
|
12565
12958
|
// accepts any string for forward compatibility
|
|
12566
12959
|
])
|
|
12567
12960
|
),
|
|
12568
|
-
globs:
|
|
12569
|
-
description:
|
|
12961
|
+
globs: z51.optional(z51.string()),
|
|
12962
|
+
description: z51.optional(z51.string())
|
|
12570
12963
|
});
|
|
12571
12964
|
function parseGlobsString(globs) {
|
|
12572
12965
|
if (!globs) {
|
|
@@ -12711,7 +13104,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12711
13104
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12712
13105
|
if (!result.success) {
|
|
12713
13106
|
throw new Error(
|
|
12714
|
-
`Invalid frontmatter in ${
|
|
13107
|
+
`Invalid frontmatter in ${join94(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12715
13108
|
);
|
|
12716
13109
|
}
|
|
12717
13110
|
}
|
|
@@ -12735,7 +13128,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12735
13128
|
relativeFilePath,
|
|
12736
13129
|
validate = true
|
|
12737
13130
|
}) {
|
|
12738
|
-
const filePath =
|
|
13131
|
+
const filePath = join94(
|
|
12739
13132
|
baseDir,
|
|
12740
13133
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
12741
13134
|
relativeFilePath
|
|
@@ -12875,7 +13268,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
12875
13268
|
};
|
|
12876
13269
|
|
|
12877
13270
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
12878
|
-
import { join as
|
|
13271
|
+
import { join as join95 } from "path";
|
|
12879
13272
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
12880
13273
|
toRulesyncRule() {
|
|
12881
13274
|
const rulesyncFrontmatter = {
|
|
@@ -12935,8 +13328,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12935
13328
|
}) {
|
|
12936
13329
|
const settablePaths = this.getSettablePaths();
|
|
12937
13330
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
12938
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
12939
|
-
const fileContent = await readFileContent(
|
|
13331
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join95(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13332
|
+
const fileContent = await readFileContent(join95(baseDir, relativePath));
|
|
12940
13333
|
return new _AugmentcodeLegacyRule({
|
|
12941
13334
|
baseDir,
|
|
12942
13335
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -12965,7 +13358,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
12965
13358
|
};
|
|
12966
13359
|
|
|
12967
13360
|
// src/features/rules/augmentcode-rule.ts
|
|
12968
|
-
import { join as
|
|
13361
|
+
import { join as join96 } from "path";
|
|
12969
13362
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
12970
13363
|
toRulesyncRule() {
|
|
12971
13364
|
return this.toRulesyncRuleDefault();
|
|
@@ -12996,7 +13389,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
12996
13389
|
relativeFilePath,
|
|
12997
13390
|
validate = true
|
|
12998
13391
|
}) {
|
|
12999
|
-
const filePath =
|
|
13392
|
+
const filePath = join96(
|
|
13000
13393
|
baseDir,
|
|
13001
13394
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13002
13395
|
relativeFilePath
|
|
@@ -13036,7 +13429,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
13036
13429
|
};
|
|
13037
13430
|
|
|
13038
13431
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
13039
|
-
import { join as
|
|
13432
|
+
import { join as join97 } from "path";
|
|
13040
13433
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
13041
13434
|
static getSettablePaths({
|
|
13042
13435
|
global,
|
|
@@ -13078,7 +13471,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13078
13471
|
if (isRoot) {
|
|
13079
13472
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13080
13473
|
const fileContent2 = await readFileContent(
|
|
13081
|
-
|
|
13474
|
+
join97(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13082
13475
|
);
|
|
13083
13476
|
return new _ClaudecodeLegacyRule({
|
|
13084
13477
|
baseDir,
|
|
@@ -13092,8 +13485,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13092
13485
|
if (!paths.nonRoot) {
|
|
13093
13486
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13094
13487
|
}
|
|
13095
|
-
const relativePath =
|
|
13096
|
-
const fileContent = await readFileContent(
|
|
13488
|
+
const relativePath = join97(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13489
|
+
const fileContent = await readFileContent(join97(baseDir, relativePath));
|
|
13097
13490
|
return new _ClaudecodeLegacyRule({
|
|
13098
13491
|
baseDir,
|
|
13099
13492
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13152,10 +13545,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
13152
13545
|
};
|
|
13153
13546
|
|
|
13154
13547
|
// src/features/rules/claudecode-rule.ts
|
|
13155
|
-
import { join as
|
|
13156
|
-
import { z as
|
|
13157
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
13158
|
-
paths:
|
|
13548
|
+
import { join as join98 } from "path";
|
|
13549
|
+
import { z as z52 } from "zod/mini";
|
|
13550
|
+
var ClaudecodeRuleFrontmatterSchema = z52.object({
|
|
13551
|
+
paths: z52.optional(z52.array(z52.string()))
|
|
13159
13552
|
});
|
|
13160
13553
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
13161
13554
|
frontmatter;
|
|
@@ -13193,7 +13586,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13193
13586
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13194
13587
|
if (!result.success) {
|
|
13195
13588
|
throw new Error(
|
|
13196
|
-
`Invalid frontmatter in ${
|
|
13589
|
+
`Invalid frontmatter in ${join98(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13197
13590
|
);
|
|
13198
13591
|
}
|
|
13199
13592
|
}
|
|
@@ -13223,7 +13616,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13223
13616
|
if (isRoot) {
|
|
13224
13617
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
13225
13618
|
const fileContent2 = await readFileContent(
|
|
13226
|
-
|
|
13619
|
+
join98(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
13227
13620
|
);
|
|
13228
13621
|
return new _ClaudecodeRule({
|
|
13229
13622
|
baseDir,
|
|
@@ -13238,8 +13631,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13238
13631
|
if (!paths.nonRoot) {
|
|
13239
13632
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13240
13633
|
}
|
|
13241
|
-
const relativePath =
|
|
13242
|
-
const filePath =
|
|
13634
|
+
const relativePath = join98(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13635
|
+
const filePath = join98(baseDir, relativePath);
|
|
13243
13636
|
const fileContent = await readFileContent(filePath);
|
|
13244
13637
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13245
13638
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13350,7 +13743,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13350
13743
|
return {
|
|
13351
13744
|
success: false,
|
|
13352
13745
|
error: new Error(
|
|
13353
|
-
`Invalid frontmatter in ${
|
|
13746
|
+
`Invalid frontmatter in ${join98(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13354
13747
|
)
|
|
13355
13748
|
};
|
|
13356
13749
|
}
|
|
@@ -13370,10 +13763,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
13370
13763
|
};
|
|
13371
13764
|
|
|
13372
13765
|
// src/features/rules/cline-rule.ts
|
|
13373
|
-
import { join as
|
|
13374
|
-
import { z as
|
|
13375
|
-
var ClineRuleFrontmatterSchema =
|
|
13376
|
-
description:
|
|
13766
|
+
import { join as join99 } from "path";
|
|
13767
|
+
import { z as z53 } from "zod/mini";
|
|
13768
|
+
var ClineRuleFrontmatterSchema = z53.object({
|
|
13769
|
+
description: z53.string()
|
|
13377
13770
|
});
|
|
13378
13771
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
13379
13772
|
static getSettablePaths(_options = {}) {
|
|
@@ -13416,7 +13809,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13416
13809
|
validate = true
|
|
13417
13810
|
}) {
|
|
13418
13811
|
const fileContent = await readFileContent(
|
|
13419
|
-
|
|
13812
|
+
join99(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13420
13813
|
);
|
|
13421
13814
|
return new _ClineRule({
|
|
13422
13815
|
baseDir,
|
|
@@ -13442,7 +13835,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
13442
13835
|
};
|
|
13443
13836
|
|
|
13444
13837
|
// src/features/rules/codexcli-rule.ts
|
|
13445
|
-
import { join as
|
|
13838
|
+
import { join as join100 } from "path";
|
|
13446
13839
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
13447
13840
|
static getSettablePaths({
|
|
13448
13841
|
global,
|
|
@@ -13477,7 +13870,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13477
13870
|
if (isRoot) {
|
|
13478
13871
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13479
13872
|
const fileContent2 = await readFileContent(
|
|
13480
|
-
|
|
13873
|
+
join100(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13481
13874
|
);
|
|
13482
13875
|
return new _CodexcliRule({
|
|
13483
13876
|
baseDir,
|
|
@@ -13491,8 +13884,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13491
13884
|
if (!paths.nonRoot) {
|
|
13492
13885
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13493
13886
|
}
|
|
13494
|
-
const relativePath =
|
|
13495
|
-
const fileContent = await readFileContent(
|
|
13887
|
+
const relativePath = join100(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13888
|
+
const fileContent = await readFileContent(join100(baseDir, relativePath));
|
|
13496
13889
|
return new _CodexcliRule({
|
|
13497
13890
|
baseDir,
|
|
13498
13891
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13551,12 +13944,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
13551
13944
|
};
|
|
13552
13945
|
|
|
13553
13946
|
// src/features/rules/copilot-rule.ts
|
|
13554
|
-
import { join as
|
|
13555
|
-
import { z as
|
|
13556
|
-
var CopilotRuleFrontmatterSchema =
|
|
13557
|
-
description:
|
|
13558
|
-
applyTo:
|
|
13559
|
-
excludeAgent:
|
|
13947
|
+
import { join as join101 } from "path";
|
|
13948
|
+
import { z as z54 } from "zod/mini";
|
|
13949
|
+
var CopilotRuleFrontmatterSchema = z54.object({
|
|
13950
|
+
description: z54.optional(z54.string()),
|
|
13951
|
+
applyTo: z54.optional(z54.string()),
|
|
13952
|
+
excludeAgent: z54.optional(z54.union([z54.literal("code-review"), z54.literal("coding-agent")]))
|
|
13560
13953
|
});
|
|
13561
13954
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
13562
13955
|
frontmatter;
|
|
@@ -13567,6 +13960,9 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13567
13960
|
root: {
|
|
13568
13961
|
relativeDirPath: buildToolPath(".copilot", ".", options.excludeToolDir),
|
|
13569
13962
|
relativeFilePath: "copilot-instructions.md"
|
|
13963
|
+
},
|
|
13964
|
+
nonRoot: {
|
|
13965
|
+
relativeDirPath: buildToolPath(".copilot", "instructions", options.excludeToolDir)
|
|
13570
13966
|
}
|
|
13571
13967
|
};
|
|
13572
13968
|
}
|
|
@@ -13585,7 +13981,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13585
13981
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13586
13982
|
if (!result.success) {
|
|
13587
13983
|
throw new Error(
|
|
13588
|
-
`Invalid frontmatter in ${
|
|
13984
|
+
`Invalid frontmatter in ${join101(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13589
13985
|
);
|
|
13590
13986
|
}
|
|
13591
13987
|
}
|
|
@@ -13675,8 +14071,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13675
14071
|
const paths = this.getSettablePaths({ global });
|
|
13676
14072
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13677
14073
|
if (isRoot) {
|
|
13678
|
-
const relativePath2 =
|
|
13679
|
-
const filePath2 =
|
|
14074
|
+
const relativePath2 = join101(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14075
|
+
const filePath2 = join101(baseDir, relativePath2);
|
|
13680
14076
|
const fileContent2 = await readFileContent(filePath2);
|
|
13681
14077
|
return new _CopilotRule({
|
|
13682
14078
|
baseDir,
|
|
@@ -13691,8 +14087,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13691
14087
|
if (!paths.nonRoot) {
|
|
13692
14088
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13693
14089
|
}
|
|
13694
|
-
const relativePath =
|
|
13695
|
-
const filePath =
|
|
14090
|
+
const relativePath = join101(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14091
|
+
const filePath = join101(baseDir, relativePath);
|
|
13696
14092
|
const fileContent = await readFileContent(filePath);
|
|
13697
14093
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13698
14094
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13738,7 +14134,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13738
14134
|
return {
|
|
13739
14135
|
success: false,
|
|
13740
14136
|
error: new Error(
|
|
13741
|
-
`Invalid frontmatter in ${
|
|
14137
|
+
`Invalid frontmatter in ${join101(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13742
14138
|
)
|
|
13743
14139
|
};
|
|
13744
14140
|
}
|
|
@@ -13758,12 +14154,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
13758
14154
|
};
|
|
13759
14155
|
|
|
13760
14156
|
// src/features/rules/cursor-rule.ts
|
|
13761
|
-
import { join as
|
|
13762
|
-
import { z as
|
|
13763
|
-
var CursorRuleFrontmatterSchema =
|
|
13764
|
-
description:
|
|
13765
|
-
globs:
|
|
13766
|
-
alwaysApply:
|
|
14157
|
+
import { join as join102 } from "path";
|
|
14158
|
+
import { z as z55 } from "zod/mini";
|
|
14159
|
+
var CursorRuleFrontmatterSchema = z55.object({
|
|
14160
|
+
description: z55.optional(z55.string()),
|
|
14161
|
+
globs: z55.optional(z55.string()),
|
|
14162
|
+
alwaysApply: z55.optional(z55.boolean())
|
|
13767
14163
|
});
|
|
13768
14164
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
13769
14165
|
frontmatter;
|
|
@@ -13780,7 +14176,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13780
14176
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13781
14177
|
if (!result.success) {
|
|
13782
14178
|
throw new Error(
|
|
13783
|
-
`Invalid frontmatter in ${
|
|
14179
|
+
`Invalid frontmatter in ${join102(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13784
14180
|
);
|
|
13785
14181
|
}
|
|
13786
14182
|
}
|
|
@@ -13896,7 +14292,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13896
14292
|
relativeFilePath,
|
|
13897
14293
|
validate = true
|
|
13898
14294
|
}) {
|
|
13899
|
-
const filePath =
|
|
14295
|
+
const filePath = join102(
|
|
13900
14296
|
baseDir,
|
|
13901
14297
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
13902
14298
|
relativeFilePath
|
|
@@ -13906,7 +14302,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13906
14302
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
13907
14303
|
if (!result.success) {
|
|
13908
14304
|
throw new Error(
|
|
13909
|
-
`Invalid frontmatter in ${
|
|
14305
|
+
`Invalid frontmatter in ${join102(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
13910
14306
|
);
|
|
13911
14307
|
}
|
|
13912
14308
|
return new _CursorRule({
|
|
@@ -13943,7 +14339,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13943
14339
|
return {
|
|
13944
14340
|
success: false,
|
|
13945
14341
|
error: new Error(
|
|
13946
|
-
`Invalid frontmatter in ${
|
|
14342
|
+
`Invalid frontmatter in ${join102(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13947
14343
|
)
|
|
13948
14344
|
};
|
|
13949
14345
|
}
|
|
@@ -13963,7 +14359,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
13963
14359
|
};
|
|
13964
14360
|
|
|
13965
14361
|
// src/features/rules/factorydroid-rule.ts
|
|
13966
|
-
import { join as
|
|
14362
|
+
import { join as join103 } from "path";
|
|
13967
14363
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
13968
14364
|
constructor({ fileContent, root, ...rest }) {
|
|
13969
14365
|
super({
|
|
@@ -14003,8 +14399,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14003
14399
|
const paths = this.getSettablePaths({ global });
|
|
14004
14400
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
14005
14401
|
if (isRoot) {
|
|
14006
|
-
const relativePath2 =
|
|
14007
|
-
const fileContent2 = await readFileContent(
|
|
14402
|
+
const relativePath2 = join103(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
14403
|
+
const fileContent2 = await readFileContent(join103(baseDir, relativePath2));
|
|
14008
14404
|
return new _FactorydroidRule({
|
|
14009
14405
|
baseDir,
|
|
14010
14406
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -14017,8 +14413,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14017
14413
|
if (!paths.nonRoot) {
|
|
14018
14414
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14019
14415
|
}
|
|
14020
|
-
const relativePath =
|
|
14021
|
-
const fileContent = await readFileContent(
|
|
14416
|
+
const relativePath = join103(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14417
|
+
const fileContent = await readFileContent(join103(baseDir, relativePath));
|
|
14022
14418
|
return new _FactorydroidRule({
|
|
14023
14419
|
baseDir,
|
|
14024
14420
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14077,7 +14473,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
14077
14473
|
};
|
|
14078
14474
|
|
|
14079
14475
|
// src/features/rules/geminicli-rule.ts
|
|
14080
|
-
import { join as
|
|
14476
|
+
import { join as join104 } from "path";
|
|
14081
14477
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
14082
14478
|
static getSettablePaths({
|
|
14083
14479
|
global,
|
|
@@ -14112,7 +14508,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14112
14508
|
if (isRoot) {
|
|
14113
14509
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14114
14510
|
const fileContent2 = await readFileContent(
|
|
14115
|
-
|
|
14511
|
+
join104(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14116
14512
|
);
|
|
14117
14513
|
return new _GeminiCliRule({
|
|
14118
14514
|
baseDir,
|
|
@@ -14126,8 +14522,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14126
14522
|
if (!paths.nonRoot) {
|
|
14127
14523
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14128
14524
|
}
|
|
14129
|
-
const relativePath =
|
|
14130
|
-
const fileContent = await readFileContent(
|
|
14525
|
+
const relativePath = join104(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14526
|
+
const fileContent = await readFileContent(join104(baseDir, relativePath));
|
|
14131
14527
|
return new _GeminiCliRule({
|
|
14132
14528
|
baseDir,
|
|
14133
14529
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14186,7 +14582,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
14186
14582
|
};
|
|
14187
14583
|
|
|
14188
14584
|
// src/features/rules/goose-rule.ts
|
|
14189
|
-
import { join as
|
|
14585
|
+
import { join as join105 } from "path";
|
|
14190
14586
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
14191
14587
|
static getSettablePaths({
|
|
14192
14588
|
global,
|
|
@@ -14221,7 +14617,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14221
14617
|
if (isRoot) {
|
|
14222
14618
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14223
14619
|
const fileContent2 = await readFileContent(
|
|
14224
|
-
|
|
14620
|
+
join105(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14225
14621
|
);
|
|
14226
14622
|
return new _GooseRule({
|
|
14227
14623
|
baseDir,
|
|
@@ -14235,8 +14631,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14235
14631
|
if (!paths.nonRoot) {
|
|
14236
14632
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14237
14633
|
}
|
|
14238
|
-
const relativePath =
|
|
14239
|
-
const fileContent = await readFileContent(
|
|
14634
|
+
const relativePath = join105(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14635
|
+
const fileContent = await readFileContent(join105(baseDir, relativePath));
|
|
14240
14636
|
return new _GooseRule({
|
|
14241
14637
|
baseDir,
|
|
14242
14638
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14295,7 +14691,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
14295
14691
|
};
|
|
14296
14692
|
|
|
14297
14693
|
// src/features/rules/junie-rule.ts
|
|
14298
|
-
import { join as
|
|
14694
|
+
import { join as join106 } from "path";
|
|
14299
14695
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
14300
14696
|
static getSettablePaths(_options = {}) {
|
|
14301
14697
|
return {
|
|
@@ -14314,8 +14710,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14314
14710
|
validate = true
|
|
14315
14711
|
}) {
|
|
14316
14712
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
14317
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
14318
|
-
const fileContent = await readFileContent(
|
|
14713
|
+
const relativePath = isRoot ? "guidelines.md" : join106(".junie", "memories", relativeFilePath);
|
|
14714
|
+
const fileContent = await readFileContent(join106(baseDir, relativePath));
|
|
14319
14715
|
return new _JunieRule({
|
|
14320
14716
|
baseDir,
|
|
14321
14717
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14370,7 +14766,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
14370
14766
|
};
|
|
14371
14767
|
|
|
14372
14768
|
// src/features/rules/kilo-rule.ts
|
|
14373
|
-
import { join as
|
|
14769
|
+
import { join as join107 } from "path";
|
|
14374
14770
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
14375
14771
|
static getSettablePaths(_options = {}) {
|
|
14376
14772
|
return {
|
|
@@ -14385,7 +14781,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14385
14781
|
validate = true
|
|
14386
14782
|
}) {
|
|
14387
14783
|
const fileContent = await readFileContent(
|
|
14388
|
-
|
|
14784
|
+
join107(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14389
14785
|
);
|
|
14390
14786
|
return new _KiloRule({
|
|
14391
14787
|
baseDir,
|
|
@@ -14437,7 +14833,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
14437
14833
|
};
|
|
14438
14834
|
|
|
14439
14835
|
// src/features/rules/kiro-rule.ts
|
|
14440
|
-
import { join as
|
|
14836
|
+
import { join as join108 } from "path";
|
|
14441
14837
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
14442
14838
|
static getSettablePaths(_options = {}) {
|
|
14443
14839
|
return {
|
|
@@ -14452,7 +14848,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14452
14848
|
validate = true
|
|
14453
14849
|
}) {
|
|
14454
14850
|
const fileContent = await readFileContent(
|
|
14455
|
-
|
|
14851
|
+
join108(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14456
14852
|
);
|
|
14457
14853
|
return new _KiroRule({
|
|
14458
14854
|
baseDir,
|
|
@@ -14506,7 +14902,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
14506
14902
|
};
|
|
14507
14903
|
|
|
14508
14904
|
// src/features/rules/opencode-rule.ts
|
|
14509
|
-
import { join as
|
|
14905
|
+
import { join as join109 } from "path";
|
|
14510
14906
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
14511
14907
|
static getSettablePaths({
|
|
14512
14908
|
global,
|
|
@@ -14541,7 +14937,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14541
14937
|
if (isRoot) {
|
|
14542
14938
|
const relativePath2 = paths.root.relativeFilePath;
|
|
14543
14939
|
const fileContent2 = await readFileContent(
|
|
14544
|
-
|
|
14940
|
+
join109(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
14545
14941
|
);
|
|
14546
14942
|
return new _OpenCodeRule({
|
|
14547
14943
|
baseDir,
|
|
@@ -14555,8 +14951,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14555
14951
|
if (!paths.nonRoot) {
|
|
14556
14952
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
14557
14953
|
}
|
|
14558
|
-
const relativePath =
|
|
14559
|
-
const fileContent = await readFileContent(
|
|
14954
|
+
const relativePath = join109(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
14955
|
+
const fileContent = await readFileContent(join109(baseDir, relativePath));
|
|
14560
14956
|
return new _OpenCodeRule({
|
|
14561
14957
|
baseDir,
|
|
14562
14958
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -14615,7 +15011,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
14615
15011
|
};
|
|
14616
15012
|
|
|
14617
15013
|
// src/features/rules/qwencode-rule.ts
|
|
14618
|
-
import { join as
|
|
15014
|
+
import { join as join110 } from "path";
|
|
14619
15015
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
14620
15016
|
static getSettablePaths(_options = {}) {
|
|
14621
15017
|
return {
|
|
@@ -14634,8 +15030,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14634
15030
|
validate = true
|
|
14635
15031
|
}) {
|
|
14636
15032
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
14637
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
14638
|
-
const fileContent = await readFileContent(
|
|
15033
|
+
const relativePath = isRoot ? "QWEN.md" : join110(".qwen", "memories", relativeFilePath);
|
|
15034
|
+
const fileContent = await readFileContent(join110(baseDir, relativePath));
|
|
14639
15035
|
return new _QwencodeRule({
|
|
14640
15036
|
baseDir,
|
|
14641
15037
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -14687,7 +15083,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
14687
15083
|
};
|
|
14688
15084
|
|
|
14689
15085
|
// src/features/rules/replit-rule.ts
|
|
14690
|
-
import { join as
|
|
15086
|
+
import { join as join111 } from "path";
|
|
14691
15087
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
14692
15088
|
static getSettablePaths(_options = {}) {
|
|
14693
15089
|
return {
|
|
@@ -14709,7 +15105,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14709
15105
|
}
|
|
14710
15106
|
const relativePath = paths.root.relativeFilePath;
|
|
14711
15107
|
const fileContent = await readFileContent(
|
|
14712
|
-
|
|
15108
|
+
join111(baseDir, paths.root.relativeDirPath, relativePath)
|
|
14713
15109
|
);
|
|
14714
15110
|
return new _ReplitRule({
|
|
14715
15111
|
baseDir,
|
|
@@ -14775,7 +15171,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
14775
15171
|
};
|
|
14776
15172
|
|
|
14777
15173
|
// src/features/rules/roo-rule.ts
|
|
14778
|
-
import { join as
|
|
15174
|
+
import { join as join112 } from "path";
|
|
14779
15175
|
var RooRule = class _RooRule extends ToolRule {
|
|
14780
15176
|
static getSettablePaths(_options = {}) {
|
|
14781
15177
|
return {
|
|
@@ -14790,7 +15186,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14790
15186
|
validate = true
|
|
14791
15187
|
}) {
|
|
14792
15188
|
const fileContent = await readFileContent(
|
|
14793
|
-
|
|
15189
|
+
join112(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14794
15190
|
);
|
|
14795
15191
|
return new _RooRule({
|
|
14796
15192
|
baseDir,
|
|
@@ -14859,7 +15255,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
14859
15255
|
};
|
|
14860
15256
|
|
|
14861
15257
|
// src/features/rules/warp-rule.ts
|
|
14862
|
-
import { join as
|
|
15258
|
+
import { join as join113 } from "path";
|
|
14863
15259
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
14864
15260
|
constructor({ fileContent, root, ...rest }) {
|
|
14865
15261
|
super({
|
|
@@ -14885,8 +15281,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14885
15281
|
validate = true
|
|
14886
15282
|
}) {
|
|
14887
15283
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
14888
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
14889
|
-
const fileContent = await readFileContent(
|
|
15284
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join113(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
15285
|
+
const fileContent = await readFileContent(join113(baseDir, relativePath));
|
|
14890
15286
|
return new _WarpRule({
|
|
14891
15287
|
baseDir,
|
|
14892
15288
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -14941,7 +15337,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
14941
15337
|
};
|
|
14942
15338
|
|
|
14943
15339
|
// src/features/rules/windsurf-rule.ts
|
|
14944
|
-
import { join as
|
|
15340
|
+
import { join as join114 } from "path";
|
|
14945
15341
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
14946
15342
|
static getSettablePaths(_options = {}) {
|
|
14947
15343
|
return {
|
|
@@ -14956,7 +15352,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
14956
15352
|
validate = true
|
|
14957
15353
|
}) {
|
|
14958
15354
|
const fileContent = await readFileContent(
|
|
14959
|
-
|
|
15355
|
+
join114(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
14960
15356
|
);
|
|
14961
15357
|
return new _WindsurfRule({
|
|
14962
15358
|
baseDir,
|
|
@@ -15032,8 +15428,8 @@ var rulesProcessorToolTargets = [
|
|
|
15032
15428
|
"warp",
|
|
15033
15429
|
"windsurf"
|
|
15034
15430
|
];
|
|
15035
|
-
var RulesProcessorToolTargetSchema =
|
|
15036
|
-
var formatRulePaths = (rules) => rules.map((r) =>
|
|
15431
|
+
var RulesProcessorToolTargetSchema = z56.enum(rulesProcessorToolTargets);
|
|
15432
|
+
var formatRulePaths = (rules) => rules.map((r) => join115(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
15037
15433
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
15038
15434
|
[
|
|
15039
15435
|
"agentsmd",
|
|
@@ -15408,7 +15804,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15408
15804
|
}).relativeDirPath;
|
|
15409
15805
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
15410
15806
|
const frontmatter = skill.getFrontmatter();
|
|
15411
|
-
const relativePath =
|
|
15807
|
+
const relativePath = join115(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
15412
15808
|
return {
|
|
15413
15809
|
name: frontmatter.name,
|
|
15414
15810
|
description: frontmatter.description,
|
|
@@ -15521,8 +15917,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15521
15917
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
15522
15918
|
*/
|
|
15523
15919
|
async loadRulesyncFiles() {
|
|
15524
|
-
const rulesyncBaseDir =
|
|
15525
|
-
const files = await findFilesByGlobs(
|
|
15920
|
+
const rulesyncBaseDir = join115(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
15921
|
+
const files = await findFilesByGlobs(join115(rulesyncBaseDir, "**", "*.md"));
|
|
15526
15922
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
15527
15923
|
const rulesyncRules = await Promise.all(
|
|
15528
15924
|
files.map((file) => {
|
|
@@ -15536,41 +15932,57 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15536
15932
|
});
|
|
15537
15933
|
})
|
|
15538
15934
|
);
|
|
15935
|
+
const factory = this.getFactory(this.toolTarget);
|
|
15539
15936
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
15540
|
-
|
|
15541
|
-
|
|
15937
|
+
const targetedRootRules = rootRules.filter(
|
|
15938
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15939
|
+
);
|
|
15940
|
+
if (targetedRootRules.length > 1) {
|
|
15941
|
+
throw new Error(
|
|
15942
|
+
`Multiple root rulesync rules found for target '${this.toolTarget}': ${formatRulePaths(targetedRootRules)}`
|
|
15943
|
+
);
|
|
15542
15944
|
}
|
|
15543
|
-
if (
|
|
15945
|
+
if (targetedRootRules.length === 0 && rulesyncRules.length > 0) {
|
|
15544
15946
|
logger.warn(
|
|
15545
|
-
`No root rulesync rule file found. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15947
|
+
`No root rulesync rule file found for target '${this.toolTarget}'. Consider adding 'root: true' to one of your rule files in ${RULESYNC_RULES_RELATIVE_DIR_PATH}.`
|
|
15546
15948
|
);
|
|
15547
15949
|
}
|
|
15548
15950
|
const localRootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().localRoot);
|
|
15549
|
-
|
|
15951
|
+
const targetedLocalRootRules = localRootRules.filter(
|
|
15952
|
+
(rule) => factory.class.isTargetedByRulesyncRule(rule)
|
|
15953
|
+
);
|
|
15954
|
+
if (targetedLocalRootRules.length > 1) {
|
|
15550
15955
|
throw new Error(
|
|
15551
|
-
`Multiple localRoot rules found: ${formatRulePaths(
|
|
15956
|
+
`Multiple localRoot rules found for target '${this.toolTarget}': ${formatRulePaths(targetedLocalRootRules)}. Only one rule can have localRoot: true`
|
|
15552
15957
|
);
|
|
15553
15958
|
}
|
|
15554
|
-
if (
|
|
15959
|
+
if (targetedLocalRootRules.length > 0 && targetedRootRules.length === 0) {
|
|
15555
15960
|
throw new Error(
|
|
15556
|
-
`localRoot: true requires a root: true rule to exist (found in ${formatRulePaths(
|
|
15961
|
+
`localRoot: true requires a root: true rule to exist for target '${this.toolTarget}' (found in ${formatRulePaths(targetedLocalRootRules)})`
|
|
15557
15962
|
);
|
|
15558
15963
|
}
|
|
15559
15964
|
if (this.global) {
|
|
15560
|
-
const
|
|
15561
|
-
|
|
15965
|
+
const globalPaths = factory.class.getSettablePaths({ global: true });
|
|
15966
|
+
const supportsGlobalNonRoot = "nonRoot" in globalPaths && globalPaths.nonRoot !== null;
|
|
15967
|
+
const nonRootRules2 = rulesyncRules.filter(
|
|
15968
|
+
(rule) => !rule.getFrontmatter().root && !rule.getFrontmatter().localRoot && factory.class.isTargetedByRulesyncRule(rule)
|
|
15969
|
+
);
|
|
15970
|
+
if (nonRootRules2.length > 0 && !supportsGlobalNonRoot) {
|
|
15562
15971
|
logger.warn(
|
|
15563
|
-
`${
|
|
15972
|
+
`${nonRootRules2.length} non-root rulesync rules found, but it's in global mode, so ignoring them: ${formatRulePaths(nonRootRules2)}`
|
|
15564
15973
|
);
|
|
15565
15974
|
}
|
|
15566
|
-
if (
|
|
15975
|
+
if (targetedLocalRootRules.length > 0) {
|
|
15567
15976
|
logger.warn(
|
|
15568
|
-
`${
|
|
15977
|
+
`${targetedLocalRootRules.length} localRoot rules found, but localRoot is not supported in global mode, ignoring them: ${formatRulePaths(targetedLocalRootRules)}`
|
|
15569
15978
|
);
|
|
15570
15979
|
}
|
|
15571
|
-
return
|
|
15980
|
+
return supportsGlobalNonRoot ? [...targetedRootRules, ...nonRootRules2] : targetedRootRules;
|
|
15572
15981
|
}
|
|
15573
|
-
|
|
15982
|
+
const nonRootRules = rulesyncRules.filter(
|
|
15983
|
+
(rule) => !rule.getFrontmatter().root && factory.class.isTargetedByRulesyncRule(rule)
|
|
15984
|
+
);
|
|
15985
|
+
return [...targetedRootRules, ...nonRootRules];
|
|
15574
15986
|
}
|
|
15575
15987
|
/**
|
|
15576
15988
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -15603,13 +16015,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15603
16015
|
return [];
|
|
15604
16016
|
}
|
|
15605
16017
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
15606
|
-
|
|
16018
|
+
join115(
|
|
15607
16019
|
this.baseDir,
|
|
15608
16020
|
settablePaths.root.relativeDirPath ?? ".",
|
|
15609
16021
|
settablePaths.root.relativeFilePath
|
|
15610
16022
|
),
|
|
15611
16023
|
settablePaths.alternativeRoots,
|
|
15612
|
-
(alt) =>
|
|
16024
|
+
(alt) => join115(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
15613
16025
|
);
|
|
15614
16026
|
if (forDeletion) {
|
|
15615
16027
|
return uniqueRootFilePaths.map((filePath) => {
|
|
@@ -15654,9 +16066,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15654
16066
|
return [];
|
|
15655
16067
|
}
|
|
15656
16068
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
15657
|
-
|
|
16069
|
+
join115(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
15658
16070
|
settablePaths.alternativeRoots,
|
|
15659
|
-
(alt) =>
|
|
16071
|
+
(alt) => join115(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
15660
16072
|
);
|
|
15661
16073
|
return uniqueLocalRootFilePaths.map((filePath) => {
|
|
15662
16074
|
const relativeDirPath = resolveRelativeDirPath(filePath);
|
|
@@ -15677,9 +16089,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
15677
16089
|
if (!settablePaths.nonRoot) {
|
|
15678
16090
|
return [];
|
|
15679
16091
|
}
|
|
15680
|
-
const nonRootBaseDir =
|
|
16092
|
+
const nonRootBaseDir = join115(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
15681
16093
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
15682
|
-
|
|
16094
|
+
join115(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
15683
16095
|
);
|
|
15684
16096
|
if (forDeletion) {
|
|
15685
16097
|
return nonRootFilePaths.map((filePath) => {
|
|
@@ -15811,14 +16223,14 @@ s/<command> [arguments]
|
|
|
15811
16223
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
15812
16224
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
15813
16225
|
|
|
15814
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
16226
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join115(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
15815
16227
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
15816
16228
|
|
|
15817
16229
|
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.
|
|
15818
16230
|
|
|
15819
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
16231
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join115(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
15820
16232
|
|
|
15821
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
16233
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join115(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
15822
16234
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
15823
16235
|
const result = [
|
|
15824
16236
|
overview,
|
|
@@ -15898,7 +16310,7 @@ function warnUnsupportedTargets(params) {
|
|
|
15898
16310
|
}
|
|
15899
16311
|
}
|
|
15900
16312
|
async function checkRulesyncDirExists(params) {
|
|
15901
|
-
return fileExists(
|
|
16313
|
+
return fileExists(join116(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
15902
16314
|
}
|
|
15903
16315
|
async function generate(params) {
|
|
15904
16316
|
const { config } = params;
|
|
@@ -16466,6 +16878,8 @@ export {
|
|
|
16466
16878
|
readFileContent,
|
|
16467
16879
|
writeFileContent,
|
|
16468
16880
|
fileExists,
|
|
16881
|
+
getFileSize,
|
|
16882
|
+
isSymlink,
|
|
16469
16883
|
listDirectoryFiles,
|
|
16470
16884
|
findFilesByGlobs,
|
|
16471
16885
|
removeDirectory,
|