rulesync 8.4.0 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-MMBSR2RA.js → chunk-Q5FDY7NL.js} +548 -333
- package/dist/cli/index.cjs +1019 -704
- package/dist/cli/index.js +127 -25
- package/dist/index.cjs +561 -347
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -41,8 +41,13 @@ var ALL_FEATURES = [
|
|
|
41
41
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
42
42
|
var FeatureSchema = import_mini.z.enum(ALL_FEATURES);
|
|
43
43
|
var FeaturesSchema = import_mini.z.array(FeatureSchema);
|
|
44
|
+
var GitignoreDestinationSchema = import_mini.z.enum(["gitignore", "gitattributes"]);
|
|
44
45
|
var FeatureOptionsSchema = import_mini.z.record(import_mini.z.string(), import_mini.z.unknown());
|
|
45
|
-
var FeatureValueSchema = import_mini.z.union([
|
|
46
|
+
var FeatureValueSchema = import_mini.z.union([
|
|
47
|
+
import_mini.z.boolean(),
|
|
48
|
+
FeatureOptionsSchema,
|
|
49
|
+
GitignoreDestinationSchema
|
|
50
|
+
]);
|
|
46
51
|
var PerFeatureConfigSchema = import_mini.z.record(import_mini.z.string(), FeatureValueSchema);
|
|
47
52
|
var PerTargetFeaturesValueSchema = import_mini.z.union([
|
|
48
53
|
import_mini.z.array(import_mini.z.enum(ALL_FEATURES_WITH_WILDCARD)),
|
|
@@ -79,7 +84,7 @@ function formatError(error) {
|
|
|
79
84
|
var parseCommaSeparatedList = (value) => value.split(",").map((s) => s.trim()).filter(Boolean);
|
|
80
85
|
|
|
81
86
|
// src/lib/fetch.ts
|
|
82
|
-
var
|
|
87
|
+
var import_node_path133 = require("path");
|
|
83
88
|
var import_promise = require("es-toolkit/promise");
|
|
84
89
|
|
|
85
90
|
// src/constants/rulesync-paths.ts
|
|
@@ -8652,9 +8657,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
8652
8657
|
};
|
|
8653
8658
|
|
|
8654
8659
|
// src/features/rules/rules-processor.ts
|
|
8655
|
-
var
|
|
8660
|
+
var import_node_path132 = require("path");
|
|
8656
8661
|
var import_toon = require("@toon-format/toon");
|
|
8657
|
-
var
|
|
8662
|
+
var import_mini66 = require("zod/mini");
|
|
8658
8663
|
|
|
8659
8664
|
// src/constants/general.ts
|
|
8660
8665
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -9442,8 +9447,8 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
9442
9447
|
};
|
|
9443
9448
|
|
|
9444
9449
|
// src/features/skills/skills-processor.ts
|
|
9445
|
-
var
|
|
9446
|
-
var
|
|
9450
|
+
var import_node_path87 = require("path");
|
|
9451
|
+
var import_mini46 = require("zod/mini");
|
|
9447
9452
|
|
|
9448
9453
|
// src/types/dir-feature-processor.ts
|
|
9449
9454
|
var import_node_path69 = require("path");
|
|
@@ -12083,6 +12088,166 @@ async function getLocalSkillDirNames(baseDir) {
|
|
|
12083
12088
|
return names;
|
|
12084
12089
|
}
|
|
12085
12090
|
|
|
12091
|
+
// src/features/skills/windsurf-skill.ts
|
|
12092
|
+
var import_node_path86 = require("path");
|
|
12093
|
+
var import_mini45 = require("zod/mini");
|
|
12094
|
+
var WindsurfSkillFrontmatterSchema = import_mini45.z.looseObject({
|
|
12095
|
+
name: import_mini45.z.string(),
|
|
12096
|
+
description: import_mini45.z.string()
|
|
12097
|
+
});
|
|
12098
|
+
var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
12099
|
+
constructor({
|
|
12100
|
+
baseDir = process.cwd(),
|
|
12101
|
+
relativeDirPath = _WindsurfSkill.getSettablePaths().relativeDirPath,
|
|
12102
|
+
dirName,
|
|
12103
|
+
frontmatter,
|
|
12104
|
+
body,
|
|
12105
|
+
otherFiles = [],
|
|
12106
|
+
validate = true,
|
|
12107
|
+
global = false
|
|
12108
|
+
}) {
|
|
12109
|
+
super({
|
|
12110
|
+
baseDir,
|
|
12111
|
+
relativeDirPath,
|
|
12112
|
+
dirName,
|
|
12113
|
+
mainFile: {
|
|
12114
|
+
name: SKILL_FILE_NAME,
|
|
12115
|
+
body,
|
|
12116
|
+
frontmatter: { ...frontmatter }
|
|
12117
|
+
},
|
|
12118
|
+
otherFiles,
|
|
12119
|
+
global
|
|
12120
|
+
});
|
|
12121
|
+
if (validate) {
|
|
12122
|
+
const result = this.validate();
|
|
12123
|
+
if (!result.success) {
|
|
12124
|
+
throw result.error;
|
|
12125
|
+
}
|
|
12126
|
+
}
|
|
12127
|
+
}
|
|
12128
|
+
static getSettablePaths({ global = false } = {}) {
|
|
12129
|
+
if (global) {
|
|
12130
|
+
return {
|
|
12131
|
+
relativeDirPath: (0, import_node_path86.join)(".codeium", "windsurf", "skills")
|
|
12132
|
+
};
|
|
12133
|
+
}
|
|
12134
|
+
return {
|
|
12135
|
+
relativeDirPath: (0, import_node_path86.join)(".windsurf", "skills")
|
|
12136
|
+
};
|
|
12137
|
+
}
|
|
12138
|
+
getFrontmatter() {
|
|
12139
|
+
const result = WindsurfSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
12140
|
+
return result;
|
|
12141
|
+
}
|
|
12142
|
+
getBody() {
|
|
12143
|
+
return this.mainFile?.body ?? "";
|
|
12144
|
+
}
|
|
12145
|
+
validate() {
|
|
12146
|
+
if (!this.mainFile) {
|
|
12147
|
+
return {
|
|
12148
|
+
success: false,
|
|
12149
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
12150
|
+
};
|
|
12151
|
+
}
|
|
12152
|
+
const result = WindsurfSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
12153
|
+
if (!result.success) {
|
|
12154
|
+
return {
|
|
12155
|
+
success: false,
|
|
12156
|
+
error: new Error(
|
|
12157
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
12158
|
+
)
|
|
12159
|
+
};
|
|
12160
|
+
}
|
|
12161
|
+
return { success: true, error: null };
|
|
12162
|
+
}
|
|
12163
|
+
toRulesyncSkill() {
|
|
12164
|
+
const frontmatter = this.getFrontmatter();
|
|
12165
|
+
const rulesyncFrontmatter = {
|
|
12166
|
+
name: frontmatter.name,
|
|
12167
|
+
description: frontmatter.description,
|
|
12168
|
+
targets: ["*"]
|
|
12169
|
+
};
|
|
12170
|
+
return new RulesyncSkill({
|
|
12171
|
+
baseDir: this.baseDir,
|
|
12172
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
12173
|
+
dirName: this.getDirName(),
|
|
12174
|
+
frontmatter: rulesyncFrontmatter,
|
|
12175
|
+
body: this.getBody(),
|
|
12176
|
+
otherFiles: this.getOtherFiles(),
|
|
12177
|
+
validate: true,
|
|
12178
|
+
global: this.global
|
|
12179
|
+
});
|
|
12180
|
+
}
|
|
12181
|
+
static fromRulesyncSkill({
|
|
12182
|
+
baseDir = process.cwd(),
|
|
12183
|
+
rulesyncSkill,
|
|
12184
|
+
validate = true,
|
|
12185
|
+
global = false
|
|
12186
|
+
}) {
|
|
12187
|
+
const settablePaths = _WindsurfSkill.getSettablePaths({ global });
|
|
12188
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
12189
|
+
const windsurfFrontmatter = {
|
|
12190
|
+
name: rulesyncFrontmatter.name,
|
|
12191
|
+
description: rulesyncFrontmatter.description
|
|
12192
|
+
};
|
|
12193
|
+
return new _WindsurfSkill({
|
|
12194
|
+
baseDir,
|
|
12195
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
12196
|
+
dirName: rulesyncSkill.getDirName(),
|
|
12197
|
+
frontmatter: windsurfFrontmatter,
|
|
12198
|
+
body: rulesyncSkill.getBody(),
|
|
12199
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
12200
|
+
validate,
|
|
12201
|
+
global
|
|
12202
|
+
});
|
|
12203
|
+
}
|
|
12204
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
12205
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
12206
|
+
return targets.includes("*") || targets.includes("windsurf");
|
|
12207
|
+
}
|
|
12208
|
+
static async fromDir(params) {
|
|
12209
|
+
const loaded = await this.loadSkillDirContent({
|
|
12210
|
+
...params,
|
|
12211
|
+
getSettablePaths: _WindsurfSkill.getSettablePaths
|
|
12212
|
+
});
|
|
12213
|
+
const result = WindsurfSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12214
|
+
if (!result.success) {
|
|
12215
|
+
const skillDirPath = (0, import_node_path86.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
12216
|
+
throw new Error(
|
|
12217
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12218
|
+
);
|
|
12219
|
+
}
|
|
12220
|
+
return new _WindsurfSkill({
|
|
12221
|
+
baseDir: loaded.baseDir,
|
|
12222
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
12223
|
+
dirName: loaded.dirName,
|
|
12224
|
+
frontmatter: result.data,
|
|
12225
|
+
body: loaded.body,
|
|
12226
|
+
otherFiles: loaded.otherFiles,
|
|
12227
|
+
validate: true,
|
|
12228
|
+
global: loaded.global
|
|
12229
|
+
});
|
|
12230
|
+
}
|
|
12231
|
+
static forDeletion({
|
|
12232
|
+
baseDir = process.cwd(),
|
|
12233
|
+
relativeDirPath,
|
|
12234
|
+
dirName,
|
|
12235
|
+
global = false
|
|
12236
|
+
}) {
|
|
12237
|
+
const settablePaths = _WindsurfSkill.getSettablePaths({ global });
|
|
12238
|
+
return new _WindsurfSkill({
|
|
12239
|
+
baseDir,
|
|
12240
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
12241
|
+
dirName,
|
|
12242
|
+
frontmatter: { name: "", description: "" },
|
|
12243
|
+
body: "",
|
|
12244
|
+
otherFiles: [],
|
|
12245
|
+
validate: false,
|
|
12246
|
+
global
|
|
12247
|
+
});
|
|
12248
|
+
}
|
|
12249
|
+
};
|
|
12250
|
+
|
|
12086
12251
|
// src/features/skills/skills-processor.ts
|
|
12087
12252
|
var skillsProcessorToolTargetTuple = [
|
|
12088
12253
|
"agentsmd",
|
|
@@ -12103,9 +12268,10 @@ var skillsProcessorToolTargetTuple = [
|
|
|
12103
12268
|
"opencode",
|
|
12104
12269
|
"replit",
|
|
12105
12270
|
"roo",
|
|
12106
|
-
"rovodev"
|
|
12271
|
+
"rovodev",
|
|
12272
|
+
"windsurf"
|
|
12107
12273
|
];
|
|
12108
|
-
var SkillsProcessorToolTargetSchema =
|
|
12274
|
+
var SkillsProcessorToolTargetSchema = import_mini46.z.enum(skillsProcessorToolTargetTuple);
|
|
12109
12275
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
12110
12276
|
[
|
|
12111
12277
|
"agentsmd",
|
|
@@ -12239,6 +12405,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
12239
12405
|
class: RovodevSkill,
|
|
12240
12406
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
12241
12407
|
}
|
|
12408
|
+
],
|
|
12409
|
+
[
|
|
12410
|
+
"windsurf",
|
|
12411
|
+
{
|
|
12412
|
+
class: WindsurfSkill,
|
|
12413
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
12414
|
+
}
|
|
12242
12415
|
]
|
|
12243
12416
|
]);
|
|
12244
12417
|
var defaultGetFactory4 = (target) => {
|
|
@@ -12329,11 +12502,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12329
12502
|
)
|
|
12330
12503
|
);
|
|
12331
12504
|
const localSkillNames = new Set(localDirNames);
|
|
12332
|
-
const curatedDirPath = (0,
|
|
12505
|
+
const curatedDirPath = (0, import_node_path87.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
12333
12506
|
let curatedSkills = [];
|
|
12334
12507
|
if (await directoryExists(curatedDirPath)) {
|
|
12335
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
12336
|
-
const curatedDirNames = curatedDirPaths.map((path4) => (0,
|
|
12508
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path87.join)(curatedDirPath, "*"), { type: "dir" });
|
|
12509
|
+
const curatedDirNames = curatedDirPaths.map((path4) => (0, import_node_path87.basename)(path4));
|
|
12337
12510
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
12338
12511
|
if (localSkillNames.has(name)) {
|
|
12339
12512
|
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -12370,13 +12543,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12370
12543
|
const seenDirNames = /* @__PURE__ */ new Set();
|
|
12371
12544
|
const loadEntries = [];
|
|
12372
12545
|
for (const root of roots) {
|
|
12373
|
-
const skillsDirPath = (0,
|
|
12546
|
+
const skillsDirPath = (0, import_node_path87.join)(this.baseDir, root);
|
|
12374
12547
|
if (!await directoryExists(skillsDirPath)) {
|
|
12375
12548
|
continue;
|
|
12376
12549
|
}
|
|
12377
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
12550
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path87.join)(skillsDirPath, "*"), { type: "dir" });
|
|
12378
12551
|
for (const dirPath of dirPaths) {
|
|
12379
|
-
const dirName = (0,
|
|
12552
|
+
const dirName = (0, import_node_path87.basename)(dirPath);
|
|
12380
12553
|
if (seenDirNames.has(dirName)) {
|
|
12381
12554
|
continue;
|
|
12382
12555
|
}
|
|
@@ -12405,13 +12578,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12405
12578
|
const roots = toolSkillSearchRoots(paths);
|
|
12406
12579
|
const toolSkills = [];
|
|
12407
12580
|
for (const root of roots) {
|
|
12408
|
-
const skillsDirPath = (0,
|
|
12581
|
+
const skillsDirPath = (0, import_node_path87.join)(this.baseDir, root);
|
|
12409
12582
|
if (!await directoryExists(skillsDirPath)) {
|
|
12410
12583
|
continue;
|
|
12411
12584
|
}
|
|
12412
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
12585
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path87.join)(skillsDirPath, "*"), { type: "dir" });
|
|
12413
12586
|
for (const dirPath of dirPaths) {
|
|
12414
|
-
const dirName = (0,
|
|
12587
|
+
const dirName = (0, import_node_path87.basename)(dirPath);
|
|
12415
12588
|
const toolSkill = factory.class.forDeletion({
|
|
12416
12589
|
baseDir: this.baseDir,
|
|
12417
12590
|
relativeDirPath: root,
|
|
@@ -12473,11 +12646,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12473
12646
|
};
|
|
12474
12647
|
|
|
12475
12648
|
// src/features/subagents/agentsmd-subagent.ts
|
|
12476
|
-
var
|
|
12649
|
+
var import_node_path89 = require("path");
|
|
12477
12650
|
|
|
12478
12651
|
// src/features/subagents/simulated-subagent.ts
|
|
12479
|
-
var
|
|
12480
|
-
var
|
|
12652
|
+
var import_node_path88 = require("path");
|
|
12653
|
+
var import_mini47 = require("zod/mini");
|
|
12481
12654
|
|
|
12482
12655
|
// src/features/subagents/tool-subagent.ts
|
|
12483
12656
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -12529,9 +12702,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
12529
12702
|
};
|
|
12530
12703
|
|
|
12531
12704
|
// src/features/subagents/simulated-subagent.ts
|
|
12532
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
12533
|
-
name:
|
|
12534
|
-
description:
|
|
12705
|
+
var SimulatedSubagentFrontmatterSchema = import_mini47.z.object({
|
|
12706
|
+
name: import_mini47.z.string(),
|
|
12707
|
+
description: import_mini47.z.optional(import_mini47.z.string())
|
|
12535
12708
|
});
|
|
12536
12709
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
12537
12710
|
frontmatter;
|
|
@@ -12541,7 +12714,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12541
12714
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12542
12715
|
if (!result.success) {
|
|
12543
12716
|
throw new Error(
|
|
12544
|
-
`Invalid frontmatter in ${(0,
|
|
12717
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12545
12718
|
);
|
|
12546
12719
|
}
|
|
12547
12720
|
}
|
|
@@ -12592,7 +12765,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12592
12765
|
return {
|
|
12593
12766
|
success: false,
|
|
12594
12767
|
error: new Error(
|
|
12595
|
-
`Invalid frontmatter in ${(0,
|
|
12768
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12596
12769
|
)
|
|
12597
12770
|
};
|
|
12598
12771
|
}
|
|
@@ -12602,7 +12775,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12602
12775
|
relativeFilePath,
|
|
12603
12776
|
validate = true
|
|
12604
12777
|
}) {
|
|
12605
|
-
const filePath = (0,
|
|
12778
|
+
const filePath = (0, import_node_path88.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
12606
12779
|
const fileContent = await readFileContent(filePath);
|
|
12607
12780
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12608
12781
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12612,7 +12785,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12612
12785
|
return {
|
|
12613
12786
|
baseDir,
|
|
12614
12787
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
12615
|
-
relativeFilePath: (0,
|
|
12788
|
+
relativeFilePath: (0, import_node_path88.basename)(relativeFilePath),
|
|
12616
12789
|
frontmatter: result.data,
|
|
12617
12790
|
body: content.trim(),
|
|
12618
12791
|
validate
|
|
@@ -12638,7 +12811,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12638
12811
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
12639
12812
|
static getSettablePaths() {
|
|
12640
12813
|
return {
|
|
12641
|
-
relativeDirPath: (0,
|
|
12814
|
+
relativeDirPath: (0, import_node_path89.join)(".agents", "subagents")
|
|
12642
12815
|
};
|
|
12643
12816
|
}
|
|
12644
12817
|
static async fromFile(params) {
|
|
@@ -12661,11 +12834,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
12661
12834
|
};
|
|
12662
12835
|
|
|
12663
12836
|
// src/features/subagents/factorydroid-subagent.ts
|
|
12664
|
-
var
|
|
12837
|
+
var import_node_path90 = require("path");
|
|
12665
12838
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
12666
12839
|
static getSettablePaths(_options) {
|
|
12667
12840
|
return {
|
|
12668
|
-
relativeDirPath: (0,
|
|
12841
|
+
relativeDirPath: (0, import_node_path90.join)(".factory", "droids")
|
|
12669
12842
|
};
|
|
12670
12843
|
}
|
|
12671
12844
|
static async fromFile(params) {
|
|
@@ -12688,16 +12861,16 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
12688
12861
|
};
|
|
12689
12862
|
|
|
12690
12863
|
// src/features/subagents/geminicli-subagent.ts
|
|
12691
|
-
var
|
|
12692
|
-
var
|
|
12864
|
+
var import_node_path92 = require("path");
|
|
12865
|
+
var import_mini49 = require("zod/mini");
|
|
12693
12866
|
|
|
12694
12867
|
// src/features/subagents/rulesync-subagent.ts
|
|
12695
|
-
var
|
|
12696
|
-
var
|
|
12697
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
12698
|
-
targets:
|
|
12699
|
-
name:
|
|
12700
|
-
description:
|
|
12868
|
+
var import_node_path91 = require("path");
|
|
12869
|
+
var import_mini48 = require("zod/mini");
|
|
12870
|
+
var RulesyncSubagentFrontmatterSchema = import_mini48.z.looseObject({
|
|
12871
|
+
targets: import_mini48.z._default(RulesyncTargetsSchema, ["*"]),
|
|
12872
|
+
name: import_mini48.z.string(),
|
|
12873
|
+
description: import_mini48.z.optional(import_mini48.z.string())
|
|
12701
12874
|
});
|
|
12702
12875
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
12703
12876
|
frontmatter;
|
|
@@ -12706,7 +12879,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12706
12879
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12707
12880
|
if (!parseResult.success && rest.validate !== false) {
|
|
12708
12881
|
throw new Error(
|
|
12709
|
-
`Invalid frontmatter in ${(0,
|
|
12882
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12710
12883
|
);
|
|
12711
12884
|
}
|
|
12712
12885
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -12739,7 +12912,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12739
12912
|
return {
|
|
12740
12913
|
success: false,
|
|
12741
12914
|
error: new Error(
|
|
12742
|
-
`Invalid frontmatter in ${(0,
|
|
12915
|
+
`Invalid frontmatter in ${(0, import_node_path91.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12743
12916
|
)
|
|
12744
12917
|
};
|
|
12745
12918
|
}
|
|
@@ -12747,14 +12920,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12747
12920
|
static async fromFile({
|
|
12748
12921
|
relativeFilePath
|
|
12749
12922
|
}) {
|
|
12750
|
-
const filePath = (0,
|
|
12923
|
+
const filePath = (0, import_node_path91.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
12751
12924
|
const fileContent = await readFileContent(filePath);
|
|
12752
12925
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12753
12926
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12754
12927
|
if (!result.success) {
|
|
12755
12928
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
12756
12929
|
}
|
|
12757
|
-
const filename = (0,
|
|
12930
|
+
const filename = (0, import_node_path91.basename)(relativeFilePath);
|
|
12758
12931
|
return new _RulesyncSubagent({
|
|
12759
12932
|
baseDir: process.cwd(),
|
|
12760
12933
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -12766,9 +12939,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12766
12939
|
};
|
|
12767
12940
|
|
|
12768
12941
|
// src/features/subagents/geminicli-subagent.ts
|
|
12769
|
-
var GeminiCliSubagentFrontmatterSchema =
|
|
12770
|
-
name:
|
|
12771
|
-
description:
|
|
12942
|
+
var GeminiCliSubagentFrontmatterSchema = import_mini49.z.looseObject({
|
|
12943
|
+
name: import_mini49.z.string(),
|
|
12944
|
+
description: import_mini49.z.optional(import_mini49.z.string())
|
|
12772
12945
|
});
|
|
12773
12946
|
var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
12774
12947
|
frontmatter;
|
|
@@ -12778,7 +12951,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
12778
12951
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12779
12952
|
if (!result.success) {
|
|
12780
12953
|
throw new Error(
|
|
12781
|
-
`Invalid frontmatter in ${(0,
|
|
12954
|
+
`Invalid frontmatter in ${(0, import_node_path92.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12782
12955
|
);
|
|
12783
12956
|
}
|
|
12784
12957
|
}
|
|
@@ -12791,7 +12964,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
12791
12964
|
}
|
|
12792
12965
|
static getSettablePaths(_options = {}) {
|
|
12793
12966
|
return {
|
|
12794
|
-
relativeDirPath: (0,
|
|
12967
|
+
relativeDirPath: (0, import_node_path92.join)(".gemini", "agents")
|
|
12795
12968
|
};
|
|
12796
12969
|
}
|
|
12797
12970
|
getFrontmatter() {
|
|
@@ -12859,7 +13032,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
12859
13032
|
return {
|
|
12860
13033
|
success: false,
|
|
12861
13034
|
error: new Error(
|
|
12862
|
-
`Invalid frontmatter in ${(0,
|
|
13035
|
+
`Invalid frontmatter in ${(0, import_node_path92.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12863
13036
|
)
|
|
12864
13037
|
};
|
|
12865
13038
|
}
|
|
@@ -12877,7 +13050,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
12877
13050
|
global = false
|
|
12878
13051
|
}) {
|
|
12879
13052
|
const paths = this.getSettablePaths({ global });
|
|
12880
|
-
const filePath = (0,
|
|
13053
|
+
const filePath = (0, import_node_path92.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
12881
13054
|
const fileContent = await readFileContent(filePath);
|
|
12882
13055
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12883
13056
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12913,11 +13086,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
12913
13086
|
};
|
|
12914
13087
|
|
|
12915
13088
|
// src/features/subagents/roo-subagent.ts
|
|
12916
|
-
var
|
|
13089
|
+
var import_node_path93 = require("path");
|
|
12917
13090
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
12918
13091
|
static getSettablePaths() {
|
|
12919
13092
|
return {
|
|
12920
|
-
relativeDirPath: (0,
|
|
13093
|
+
relativeDirPath: (0, import_node_path93.join)(".roo", "subagents")
|
|
12921
13094
|
};
|
|
12922
13095
|
}
|
|
12923
13096
|
static async fromFile(params) {
|
|
@@ -12940,11 +13113,11 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
12940
13113
|
};
|
|
12941
13114
|
|
|
12942
13115
|
// src/features/subagents/rovodev-subagent.ts
|
|
12943
|
-
var
|
|
12944
|
-
var
|
|
12945
|
-
var RovodevSubagentFrontmatterSchema =
|
|
12946
|
-
name:
|
|
12947
|
-
description:
|
|
13116
|
+
var import_node_path94 = require("path");
|
|
13117
|
+
var import_mini50 = require("zod/mini");
|
|
13118
|
+
var RovodevSubagentFrontmatterSchema = import_mini50.z.looseObject({
|
|
13119
|
+
name: import_mini50.z.string(),
|
|
13120
|
+
description: import_mini50.z.optional(import_mini50.z.string())
|
|
12948
13121
|
});
|
|
12949
13122
|
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
12950
13123
|
frontmatter;
|
|
@@ -12954,7 +13127,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
12954
13127
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12955
13128
|
if (!result.success) {
|
|
12956
13129
|
throw new Error(
|
|
12957
|
-
`Invalid frontmatter in ${(0,
|
|
13130
|
+
`Invalid frontmatter in ${(0, import_node_path94.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12958
13131
|
);
|
|
12959
13132
|
}
|
|
12960
13133
|
}
|
|
@@ -12966,7 +13139,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
12966
13139
|
}
|
|
12967
13140
|
static getSettablePaths(_options = {}) {
|
|
12968
13141
|
return {
|
|
12969
|
-
relativeDirPath: (0,
|
|
13142
|
+
relativeDirPath: (0, import_node_path94.join)(".rovodev", "subagents")
|
|
12970
13143
|
};
|
|
12971
13144
|
}
|
|
12972
13145
|
getFrontmatter() {
|
|
@@ -13029,7 +13202,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13029
13202
|
return {
|
|
13030
13203
|
success: false,
|
|
13031
13204
|
error: new Error(
|
|
13032
|
-
`Invalid frontmatter in ${(0,
|
|
13205
|
+
`Invalid frontmatter in ${(0, import_node_path94.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13033
13206
|
)
|
|
13034
13207
|
};
|
|
13035
13208
|
}
|
|
@@ -13046,7 +13219,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13046
13219
|
global = false
|
|
13047
13220
|
}) {
|
|
13048
13221
|
const paths = this.getSettablePaths({ global });
|
|
13049
|
-
const filePath = (0,
|
|
13222
|
+
const filePath = (0, import_node_path94.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13050
13223
|
const fileContent = await readFileContent(filePath);
|
|
13051
13224
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13052
13225
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13085,19 +13258,19 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13085
13258
|
};
|
|
13086
13259
|
|
|
13087
13260
|
// src/features/subagents/subagents-processor.ts
|
|
13088
|
-
var
|
|
13089
|
-
var
|
|
13261
|
+
var import_node_path105 = require("path");
|
|
13262
|
+
var import_mini59 = require("zod/mini");
|
|
13090
13263
|
|
|
13091
13264
|
// src/features/subagents/claudecode-subagent.ts
|
|
13092
|
-
var
|
|
13093
|
-
var
|
|
13094
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
13095
|
-
name:
|
|
13096
|
-
description:
|
|
13097
|
-
model:
|
|
13098
|
-
tools:
|
|
13099
|
-
permissionMode:
|
|
13100
|
-
skills:
|
|
13265
|
+
var import_node_path95 = require("path");
|
|
13266
|
+
var import_mini51 = require("zod/mini");
|
|
13267
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini51.z.looseObject({
|
|
13268
|
+
name: import_mini51.z.string(),
|
|
13269
|
+
description: import_mini51.z.optional(import_mini51.z.string()),
|
|
13270
|
+
model: import_mini51.z.optional(import_mini51.z.string()),
|
|
13271
|
+
tools: import_mini51.z.optional(import_mini51.z.union([import_mini51.z.string(), import_mini51.z.array(import_mini51.z.string())])),
|
|
13272
|
+
permissionMode: import_mini51.z.optional(import_mini51.z.string()),
|
|
13273
|
+
skills: import_mini51.z.optional(import_mini51.z.union([import_mini51.z.string(), import_mini51.z.array(import_mini51.z.string())]))
|
|
13101
13274
|
});
|
|
13102
13275
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
13103
13276
|
frontmatter;
|
|
@@ -13107,7 +13280,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13107
13280
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13108
13281
|
if (!result.success) {
|
|
13109
13282
|
throw new Error(
|
|
13110
|
-
`Invalid frontmatter in ${(0,
|
|
13283
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13111
13284
|
);
|
|
13112
13285
|
}
|
|
13113
13286
|
}
|
|
@@ -13119,7 +13292,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13119
13292
|
}
|
|
13120
13293
|
static getSettablePaths(_options = {}) {
|
|
13121
13294
|
return {
|
|
13122
|
-
relativeDirPath: (0,
|
|
13295
|
+
relativeDirPath: (0, import_node_path95.join)(".claude", "agents")
|
|
13123
13296
|
};
|
|
13124
13297
|
}
|
|
13125
13298
|
getFrontmatter() {
|
|
@@ -13198,7 +13371,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13198
13371
|
return {
|
|
13199
13372
|
success: false,
|
|
13200
13373
|
error: new Error(
|
|
13201
|
-
`Invalid frontmatter in ${(0,
|
|
13374
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13202
13375
|
)
|
|
13203
13376
|
};
|
|
13204
13377
|
}
|
|
@@ -13216,7 +13389,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13216
13389
|
global = false
|
|
13217
13390
|
}) {
|
|
13218
13391
|
const paths = this.getSettablePaths({ global });
|
|
13219
|
-
const filePath = (0,
|
|
13392
|
+
const filePath = (0, import_node_path95.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13220
13393
|
const fileContent = await readFileContent(filePath);
|
|
13221
13394
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13222
13395
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13251,16 +13424,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13251
13424
|
};
|
|
13252
13425
|
|
|
13253
13426
|
// src/features/subagents/codexcli-subagent.ts
|
|
13254
|
-
var
|
|
13427
|
+
var import_node_path96 = require("path");
|
|
13255
13428
|
var smolToml4 = __toESM(require("smol-toml"), 1);
|
|
13256
|
-
var
|
|
13257
|
-
var CodexCliSubagentTomlSchema =
|
|
13258
|
-
name:
|
|
13259
|
-
description:
|
|
13260
|
-
developer_instructions:
|
|
13261
|
-
model:
|
|
13262
|
-
model_reasoning_effort:
|
|
13263
|
-
sandbox_mode:
|
|
13429
|
+
var import_mini52 = require("zod/mini");
|
|
13430
|
+
var CodexCliSubagentTomlSchema = import_mini52.z.looseObject({
|
|
13431
|
+
name: import_mini52.z.string(),
|
|
13432
|
+
description: import_mini52.z.optional(import_mini52.z.string()),
|
|
13433
|
+
developer_instructions: import_mini52.z.optional(import_mini52.z.string()),
|
|
13434
|
+
model: import_mini52.z.optional(import_mini52.z.string()),
|
|
13435
|
+
model_reasoning_effort: import_mini52.z.optional(import_mini52.z.string()),
|
|
13436
|
+
sandbox_mode: import_mini52.z.optional(import_mini52.z.string())
|
|
13264
13437
|
});
|
|
13265
13438
|
function stringifyCodexCliSubagentToml(tomlObj) {
|
|
13266
13439
|
const { developer_instructions, ...restFields } = tomlObj;
|
|
@@ -13282,7 +13455,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13282
13455
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
13283
13456
|
} catch (error) {
|
|
13284
13457
|
throw new Error(
|
|
13285
|
-
`Invalid TOML in ${(0,
|
|
13458
|
+
`Invalid TOML in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
13286
13459
|
{ cause: error }
|
|
13287
13460
|
);
|
|
13288
13461
|
}
|
|
@@ -13294,7 +13467,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13294
13467
|
}
|
|
13295
13468
|
static getSettablePaths(_options = {}) {
|
|
13296
13469
|
return {
|
|
13297
|
-
relativeDirPath: (0,
|
|
13470
|
+
relativeDirPath: (0, import_node_path96.join)(".codex", "agents")
|
|
13298
13471
|
};
|
|
13299
13472
|
}
|
|
13300
13473
|
getBody() {
|
|
@@ -13306,7 +13479,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13306
13479
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml4.parse(this.body));
|
|
13307
13480
|
} catch (error) {
|
|
13308
13481
|
throw new Error(
|
|
13309
|
-
`Failed to parse TOML in ${(0,
|
|
13482
|
+
`Failed to parse TOML in ${(0, import_node_path96.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
13310
13483
|
{ cause: error }
|
|
13311
13484
|
);
|
|
13312
13485
|
}
|
|
@@ -13387,7 +13560,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13387
13560
|
global = false
|
|
13388
13561
|
}) {
|
|
13389
13562
|
const paths = this.getSettablePaths({ global });
|
|
13390
|
-
const filePath = (0,
|
|
13563
|
+
const filePath = (0, import_node_path96.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13391
13564
|
const fileContent = await readFileContent(filePath);
|
|
13392
13565
|
const subagent = new _CodexCliSubagent({
|
|
13393
13566
|
baseDir,
|
|
@@ -13425,13 +13598,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13425
13598
|
};
|
|
13426
13599
|
|
|
13427
13600
|
// src/features/subagents/copilot-subagent.ts
|
|
13428
|
-
var
|
|
13429
|
-
var
|
|
13601
|
+
var import_node_path97 = require("path");
|
|
13602
|
+
var import_mini53 = require("zod/mini");
|
|
13430
13603
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
13431
|
-
var CopilotSubagentFrontmatterSchema =
|
|
13432
|
-
name:
|
|
13433
|
-
description:
|
|
13434
|
-
tools:
|
|
13604
|
+
var CopilotSubagentFrontmatterSchema = import_mini53.z.looseObject({
|
|
13605
|
+
name: import_mini53.z.string(),
|
|
13606
|
+
description: import_mini53.z.optional(import_mini53.z.string()),
|
|
13607
|
+
tools: import_mini53.z.optional(import_mini53.z.union([import_mini53.z.string(), import_mini53.z.array(import_mini53.z.string())]))
|
|
13435
13608
|
});
|
|
13436
13609
|
var normalizeTools = (tools) => {
|
|
13437
13610
|
if (!tools) {
|
|
@@ -13451,7 +13624,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13451
13624
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13452
13625
|
if (!result.success) {
|
|
13453
13626
|
throw new Error(
|
|
13454
|
-
`Invalid frontmatter in ${(0,
|
|
13627
|
+
`Invalid frontmatter in ${(0, import_node_path97.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13455
13628
|
);
|
|
13456
13629
|
}
|
|
13457
13630
|
}
|
|
@@ -13463,7 +13636,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13463
13636
|
}
|
|
13464
13637
|
static getSettablePaths(_options = {}) {
|
|
13465
13638
|
return {
|
|
13466
|
-
relativeDirPath: (0,
|
|
13639
|
+
relativeDirPath: (0, import_node_path97.join)(".github", "agents")
|
|
13467
13640
|
};
|
|
13468
13641
|
}
|
|
13469
13642
|
getFrontmatter() {
|
|
@@ -13541,7 +13714,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13541
13714
|
return {
|
|
13542
13715
|
success: false,
|
|
13543
13716
|
error: new Error(
|
|
13544
|
-
`Invalid frontmatter in ${(0,
|
|
13717
|
+
`Invalid frontmatter in ${(0, import_node_path97.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13545
13718
|
)
|
|
13546
13719
|
};
|
|
13547
13720
|
}
|
|
@@ -13559,7 +13732,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13559
13732
|
global = false
|
|
13560
13733
|
}) {
|
|
13561
13734
|
const paths = this.getSettablePaths({ global });
|
|
13562
|
-
const filePath = (0,
|
|
13735
|
+
const filePath = (0, import_node_path97.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13563
13736
|
const fileContent = await readFileContent(filePath);
|
|
13564
13737
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13565
13738
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13595,11 +13768,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13595
13768
|
};
|
|
13596
13769
|
|
|
13597
13770
|
// src/features/subagents/cursor-subagent.ts
|
|
13598
|
-
var
|
|
13599
|
-
var
|
|
13600
|
-
var CursorSubagentFrontmatterSchema =
|
|
13601
|
-
name:
|
|
13602
|
-
description:
|
|
13771
|
+
var import_node_path98 = require("path");
|
|
13772
|
+
var import_mini54 = require("zod/mini");
|
|
13773
|
+
var CursorSubagentFrontmatterSchema = import_mini54.z.looseObject({
|
|
13774
|
+
name: import_mini54.z.string(),
|
|
13775
|
+
description: import_mini54.z.optional(import_mini54.z.string())
|
|
13603
13776
|
});
|
|
13604
13777
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
13605
13778
|
frontmatter;
|
|
@@ -13609,7 +13782,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13609
13782
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13610
13783
|
if (!result.success) {
|
|
13611
13784
|
throw new Error(
|
|
13612
|
-
`Invalid frontmatter in ${(0,
|
|
13785
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13613
13786
|
);
|
|
13614
13787
|
}
|
|
13615
13788
|
}
|
|
@@ -13621,7 +13794,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13621
13794
|
}
|
|
13622
13795
|
static getSettablePaths(_options = {}) {
|
|
13623
13796
|
return {
|
|
13624
|
-
relativeDirPath: (0,
|
|
13797
|
+
relativeDirPath: (0, import_node_path98.join)(".cursor", "agents")
|
|
13625
13798
|
};
|
|
13626
13799
|
}
|
|
13627
13800
|
getFrontmatter() {
|
|
@@ -13688,7 +13861,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13688
13861
|
return {
|
|
13689
13862
|
success: false,
|
|
13690
13863
|
error: new Error(
|
|
13691
|
-
`Invalid frontmatter in ${(0,
|
|
13864
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13692
13865
|
)
|
|
13693
13866
|
};
|
|
13694
13867
|
}
|
|
@@ -13706,7 +13879,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13706
13879
|
global = false
|
|
13707
13880
|
}) {
|
|
13708
13881
|
const paths = this.getSettablePaths({ global });
|
|
13709
|
-
const filePath = (0,
|
|
13882
|
+
const filePath = (0, import_node_path98.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13710
13883
|
const fileContent = await readFileContent(filePath);
|
|
13711
13884
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13712
13885
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13742,12 +13915,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13742
13915
|
};
|
|
13743
13916
|
|
|
13744
13917
|
// src/features/subagents/deepagents-subagent.ts
|
|
13745
|
-
var
|
|
13746
|
-
var
|
|
13747
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
13748
|
-
name:
|
|
13749
|
-
description:
|
|
13750
|
-
model:
|
|
13918
|
+
var import_node_path99 = require("path");
|
|
13919
|
+
var import_mini55 = require("zod/mini");
|
|
13920
|
+
var DeepagentsSubagentFrontmatterSchema = import_mini55.z.looseObject({
|
|
13921
|
+
name: import_mini55.z.string(),
|
|
13922
|
+
description: import_mini55.z.optional(import_mini55.z.string()),
|
|
13923
|
+
model: import_mini55.z.optional(import_mini55.z.string())
|
|
13751
13924
|
});
|
|
13752
13925
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
13753
13926
|
frontmatter;
|
|
@@ -13757,7 +13930,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13757
13930
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13758
13931
|
if (!result.success) {
|
|
13759
13932
|
throw new Error(
|
|
13760
|
-
`Invalid frontmatter in ${(0,
|
|
13933
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13761
13934
|
);
|
|
13762
13935
|
}
|
|
13763
13936
|
}
|
|
@@ -13767,7 +13940,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13767
13940
|
}
|
|
13768
13941
|
static getSettablePaths(_options = {}) {
|
|
13769
13942
|
return {
|
|
13770
|
-
relativeDirPath: (0,
|
|
13943
|
+
relativeDirPath: (0, import_node_path99.join)(".deepagents", "agents")
|
|
13771
13944
|
};
|
|
13772
13945
|
}
|
|
13773
13946
|
getFrontmatter() {
|
|
@@ -13842,7 +14015,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13842
14015
|
return {
|
|
13843
14016
|
success: false,
|
|
13844
14017
|
error: new Error(
|
|
13845
|
-
`Invalid frontmatter in ${(0,
|
|
14018
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13846
14019
|
)
|
|
13847
14020
|
};
|
|
13848
14021
|
}
|
|
@@ -13860,7 +14033,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13860
14033
|
global = false
|
|
13861
14034
|
}) {
|
|
13862
14035
|
const paths = this.getSettablePaths({ global });
|
|
13863
|
-
const filePath = (0,
|
|
14036
|
+
const filePath = (0, import_node_path99.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13864
14037
|
const fileContent = await readFileContent(filePath);
|
|
13865
14038
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13866
14039
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13895,11 +14068,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13895
14068
|
};
|
|
13896
14069
|
|
|
13897
14070
|
// src/features/subagents/junie-subagent.ts
|
|
13898
|
-
var
|
|
13899
|
-
var
|
|
13900
|
-
var JunieSubagentFrontmatterSchema =
|
|
13901
|
-
name:
|
|
13902
|
-
description:
|
|
14071
|
+
var import_node_path100 = require("path");
|
|
14072
|
+
var import_mini56 = require("zod/mini");
|
|
14073
|
+
var JunieSubagentFrontmatterSchema = import_mini56.z.looseObject({
|
|
14074
|
+
name: import_mini56.z.optional(import_mini56.z.string()),
|
|
14075
|
+
description: import_mini56.z.string()
|
|
13903
14076
|
});
|
|
13904
14077
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
13905
14078
|
frontmatter;
|
|
@@ -13909,7 +14082,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
13909
14082
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13910
14083
|
if (!result.success) {
|
|
13911
14084
|
throw new Error(
|
|
13912
|
-
`Invalid frontmatter in ${(0,
|
|
14085
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13913
14086
|
);
|
|
13914
14087
|
}
|
|
13915
14088
|
}
|
|
@@ -13924,7 +14097,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
13924
14097
|
throw new Error("JunieSubagent does not support global mode.");
|
|
13925
14098
|
}
|
|
13926
14099
|
return {
|
|
13927
|
-
relativeDirPath: (0,
|
|
14100
|
+
relativeDirPath: (0, import_node_path100.join)(".junie", "agents")
|
|
13928
14101
|
};
|
|
13929
14102
|
}
|
|
13930
14103
|
getFrontmatter() {
|
|
@@ -14000,7 +14173,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14000
14173
|
return {
|
|
14001
14174
|
success: false,
|
|
14002
14175
|
error: new Error(
|
|
14003
|
-
`Invalid frontmatter in ${(0,
|
|
14176
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14004
14177
|
)
|
|
14005
14178
|
};
|
|
14006
14179
|
}
|
|
@@ -14018,7 +14191,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14018
14191
|
global = false
|
|
14019
14192
|
}) {
|
|
14020
14193
|
const paths = this.getSettablePaths({ global });
|
|
14021
|
-
const filePath = (0,
|
|
14194
|
+
const filePath = (0, import_node_path100.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14022
14195
|
const fileContent = await readFileContent(filePath);
|
|
14023
14196
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14024
14197
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14053,15 +14226,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14053
14226
|
};
|
|
14054
14227
|
|
|
14055
14228
|
// src/features/subagents/kilo-subagent.ts
|
|
14056
|
-
var
|
|
14229
|
+
var import_node_path102 = require("path");
|
|
14057
14230
|
|
|
14058
14231
|
// src/features/subagents/opencode-style-subagent.ts
|
|
14059
|
-
var
|
|
14060
|
-
var
|
|
14061
|
-
var OpenCodeStyleSubagentFrontmatterSchema =
|
|
14062
|
-
description:
|
|
14063
|
-
mode:
|
|
14064
|
-
name:
|
|
14232
|
+
var import_node_path101 = require("path");
|
|
14233
|
+
var import_mini57 = require("zod/mini");
|
|
14234
|
+
var OpenCodeStyleSubagentFrontmatterSchema = import_mini57.z.looseObject({
|
|
14235
|
+
description: import_mini57.z.optional(import_mini57.z.string()),
|
|
14236
|
+
mode: import_mini57.z._default(import_mini57.z.string(), "subagent"),
|
|
14237
|
+
name: import_mini57.z.optional(import_mini57.z.string())
|
|
14065
14238
|
});
|
|
14066
14239
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
14067
14240
|
frontmatter;
|
|
@@ -14071,7 +14244,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14071
14244
|
const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14072
14245
|
if (!result.success) {
|
|
14073
14246
|
throw new Error(
|
|
14074
|
-
`Invalid frontmatter in ${(0,
|
|
14247
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14075
14248
|
);
|
|
14076
14249
|
}
|
|
14077
14250
|
}
|
|
@@ -14091,7 +14264,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14091
14264
|
const { description, mode, name, ...toolSection } = this.frontmatter;
|
|
14092
14265
|
const rulesyncFrontmatter = {
|
|
14093
14266
|
targets: ["*"],
|
|
14094
|
-
name: name ?? (0,
|
|
14267
|
+
name: name ?? (0, import_node_path101.basename)(this.getRelativeFilePath(), ".md"),
|
|
14095
14268
|
description,
|
|
14096
14269
|
[this.getToolTarget()]: { mode, ...toolSection }
|
|
14097
14270
|
};
|
|
@@ -14113,7 +14286,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14113
14286
|
return {
|
|
14114
14287
|
success: false,
|
|
14115
14288
|
error: new Error(
|
|
14116
|
-
`Invalid frontmatter in ${(0,
|
|
14289
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14117
14290
|
)
|
|
14118
14291
|
};
|
|
14119
14292
|
}
|
|
@@ -14129,7 +14302,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14129
14302
|
global = false
|
|
14130
14303
|
} = {}) {
|
|
14131
14304
|
return {
|
|
14132
|
-
relativeDirPath: global ? (0,
|
|
14305
|
+
relativeDirPath: global ? (0, import_node_path102.join)(".config", "kilo", "agent") : (0, import_node_path102.join)(".kilo", "agent")
|
|
14133
14306
|
};
|
|
14134
14307
|
}
|
|
14135
14308
|
static fromRulesyncSubagent({
|
|
@@ -14173,7 +14346,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14173
14346
|
global = false
|
|
14174
14347
|
}) {
|
|
14175
14348
|
const paths = this.getSettablePaths({ global });
|
|
14176
|
-
const filePath = (0,
|
|
14349
|
+
const filePath = (0, import_node_path102.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14177
14350
|
const fileContent = await readFileContent(filePath);
|
|
14178
14351
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14179
14352
|
const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14209,23 +14382,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14209
14382
|
};
|
|
14210
14383
|
|
|
14211
14384
|
// src/features/subagents/kiro-subagent.ts
|
|
14212
|
-
var
|
|
14213
|
-
var
|
|
14214
|
-
var KiroCliSubagentJsonSchema =
|
|
14215
|
-
name:
|
|
14216
|
-
description:
|
|
14217
|
-
prompt:
|
|
14218
|
-
tools:
|
|
14219
|
-
toolAliases:
|
|
14220
|
-
toolSettings:
|
|
14221
|
-
toolSchema:
|
|
14222
|
-
hooks:
|
|
14223
|
-
model:
|
|
14224
|
-
mcpServers:
|
|
14225
|
-
useLegacyMcpJson:
|
|
14226
|
-
resources:
|
|
14227
|
-
allowedTools:
|
|
14228
|
-
includeMcpJson:
|
|
14385
|
+
var import_node_path103 = require("path");
|
|
14386
|
+
var import_mini58 = require("zod/mini");
|
|
14387
|
+
var KiroCliSubagentJsonSchema = import_mini58.z.looseObject({
|
|
14388
|
+
name: import_mini58.z.string(),
|
|
14389
|
+
description: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.string())),
|
|
14390
|
+
prompt: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.string())),
|
|
14391
|
+
tools: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.array(import_mini58.z.string()))),
|
|
14392
|
+
toolAliases: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.record(import_mini58.z.string(), import_mini58.z.string()))),
|
|
14393
|
+
toolSettings: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.unknown())),
|
|
14394
|
+
toolSchema: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.unknown())),
|
|
14395
|
+
hooks: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.record(import_mini58.z.string(), import_mini58.z.array(import_mini58.z.unknown())))),
|
|
14396
|
+
model: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.string())),
|
|
14397
|
+
mcpServers: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.record(import_mini58.z.string(), import_mini58.z.unknown()))),
|
|
14398
|
+
useLegacyMcpJson: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.boolean())),
|
|
14399
|
+
resources: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.array(import_mini58.z.string()))),
|
|
14400
|
+
allowedTools: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.array(import_mini58.z.string()))),
|
|
14401
|
+
includeMcpJson: import_mini58.z.optional(import_mini58.z.nullable(import_mini58.z.boolean()))
|
|
14229
14402
|
});
|
|
14230
14403
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
14231
14404
|
body;
|
|
@@ -14236,7 +14409,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14236
14409
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
14237
14410
|
} catch (error) {
|
|
14238
14411
|
throw new Error(
|
|
14239
|
-
`Invalid JSON in ${(0,
|
|
14412
|
+
`Invalid JSON in ${(0, import_node_path103.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
14240
14413
|
{ cause: error }
|
|
14241
14414
|
);
|
|
14242
14415
|
}
|
|
@@ -14248,7 +14421,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14248
14421
|
}
|
|
14249
14422
|
static getSettablePaths(_options = {}) {
|
|
14250
14423
|
return {
|
|
14251
|
-
relativeDirPath: (0,
|
|
14424
|
+
relativeDirPath: (0, import_node_path103.join)(".kiro", "agents")
|
|
14252
14425
|
};
|
|
14253
14426
|
}
|
|
14254
14427
|
getBody() {
|
|
@@ -14260,7 +14433,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14260
14433
|
parsed = JSON.parse(this.body);
|
|
14261
14434
|
} catch (error) {
|
|
14262
14435
|
throw new Error(
|
|
14263
|
-
`Failed to parse JSON in ${(0,
|
|
14436
|
+
`Failed to parse JSON in ${(0, import_node_path103.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
14264
14437
|
{ cause: error }
|
|
14265
14438
|
);
|
|
14266
14439
|
}
|
|
@@ -14341,7 +14514,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14341
14514
|
global = false
|
|
14342
14515
|
}) {
|
|
14343
14516
|
const paths = this.getSettablePaths({ global });
|
|
14344
|
-
const filePath = (0,
|
|
14517
|
+
const filePath = (0, import_node_path103.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14345
14518
|
const fileContent = await readFileContent(filePath);
|
|
14346
14519
|
const subagent = new _KiroSubagent({
|
|
14347
14520
|
baseDir,
|
|
@@ -14379,7 +14552,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14379
14552
|
};
|
|
14380
14553
|
|
|
14381
14554
|
// src/features/subagents/opencode-subagent.ts
|
|
14382
|
-
var
|
|
14555
|
+
var import_node_path104 = require("path");
|
|
14383
14556
|
var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
|
|
14384
14557
|
var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
14385
14558
|
getToolTarget() {
|
|
@@ -14389,7 +14562,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
14389
14562
|
global = false
|
|
14390
14563
|
} = {}) {
|
|
14391
14564
|
return {
|
|
14392
|
-
relativeDirPath: global ? (0,
|
|
14565
|
+
relativeDirPath: global ? (0, import_node_path104.join)(".config", "opencode", "agent") : (0, import_node_path104.join)(".opencode", "agent")
|
|
14393
14566
|
};
|
|
14394
14567
|
}
|
|
14395
14568
|
static fromRulesyncSubagent({
|
|
@@ -14433,7 +14606,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
14433
14606
|
global = false
|
|
14434
14607
|
}) {
|
|
14435
14608
|
const paths = this.getSettablePaths({ global });
|
|
14436
|
-
const filePath = (0,
|
|
14609
|
+
const filePath = (0, import_node_path104.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14437
14610
|
const fileContent = await readFileContent(filePath);
|
|
14438
14611
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14439
14612
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14486,7 +14659,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
14486
14659
|
"roo",
|
|
14487
14660
|
"rovodev"
|
|
14488
14661
|
];
|
|
14489
|
-
var SubagentsProcessorToolTargetSchema =
|
|
14662
|
+
var SubagentsProcessorToolTargetSchema = import_mini59.z.enum(subagentsProcessorToolTargetTuple);
|
|
14490
14663
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
14491
14664
|
[
|
|
14492
14665
|
"agentsmd",
|
|
@@ -14677,7 +14850,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14677
14850
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
14678
14851
|
*/
|
|
14679
14852
|
async loadRulesyncFiles() {
|
|
14680
|
-
const subagentsDir = (0,
|
|
14853
|
+
const subagentsDir = (0, import_node_path105.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
14681
14854
|
const dirExists = await directoryExists(subagentsDir);
|
|
14682
14855
|
if (!dirExists) {
|
|
14683
14856
|
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -14692,7 +14865,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14692
14865
|
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
14693
14866
|
const rulesyncSubagents = [];
|
|
14694
14867
|
for (const mdFile of mdFiles) {
|
|
14695
|
-
const filepath = (0,
|
|
14868
|
+
const filepath = (0, import_node_path105.join)(subagentsDir, mdFile);
|
|
14696
14869
|
try {
|
|
14697
14870
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
14698
14871
|
relativeFilePath: mdFile,
|
|
@@ -14722,14 +14895,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14722
14895
|
const factory = this.getFactory(this.toolTarget);
|
|
14723
14896
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
14724
14897
|
const subagentFilePaths = await findFilesByGlobs(
|
|
14725
|
-
(0,
|
|
14898
|
+
(0, import_node_path105.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
14726
14899
|
);
|
|
14727
14900
|
if (forDeletion) {
|
|
14728
14901
|
const toolSubagents2 = subagentFilePaths.map(
|
|
14729
14902
|
(path4) => factory.class.forDeletion({
|
|
14730
14903
|
baseDir: this.baseDir,
|
|
14731
14904
|
relativeDirPath: paths.relativeDirPath,
|
|
14732
|
-
relativeFilePath: (0,
|
|
14905
|
+
relativeFilePath: (0, import_node_path105.basename)(path4),
|
|
14733
14906
|
global: this.global
|
|
14734
14907
|
})
|
|
14735
14908
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -14742,7 +14915,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14742
14915
|
subagentFilePaths.map(
|
|
14743
14916
|
(path4) => factory.class.fromFile({
|
|
14744
14917
|
baseDir: this.baseDir,
|
|
14745
|
-
relativeFilePath: (0,
|
|
14918
|
+
relativeFilePath: (0, import_node_path105.basename)(path4),
|
|
14746
14919
|
global: this.global
|
|
14747
14920
|
})
|
|
14748
14921
|
)
|
|
@@ -14789,49 +14962,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14789
14962
|
};
|
|
14790
14963
|
|
|
14791
14964
|
// src/features/rules/agentsmd-rule.ts
|
|
14792
|
-
var
|
|
14965
|
+
var import_node_path108 = require("path");
|
|
14793
14966
|
|
|
14794
14967
|
// src/features/rules/tool-rule.ts
|
|
14795
|
-
var
|
|
14968
|
+
var import_node_path107 = require("path");
|
|
14796
14969
|
|
|
14797
14970
|
// src/features/rules/rulesync-rule.ts
|
|
14798
|
-
var
|
|
14799
|
-
var
|
|
14800
|
-
var RulesyncRuleFrontmatterSchema =
|
|
14801
|
-
root:
|
|
14802
|
-
localRoot:
|
|
14803
|
-
targets:
|
|
14804
|
-
description:
|
|
14805
|
-
globs:
|
|
14806
|
-
agentsmd:
|
|
14807
|
-
|
|
14971
|
+
var import_node_path106 = require("path");
|
|
14972
|
+
var import_mini60 = require("zod/mini");
|
|
14973
|
+
var RulesyncRuleFrontmatterSchema = import_mini60.z.object({
|
|
14974
|
+
root: import_mini60.z.optional(import_mini60.z.boolean()),
|
|
14975
|
+
localRoot: import_mini60.z.optional(import_mini60.z.boolean()),
|
|
14976
|
+
targets: import_mini60.z._default(RulesyncTargetsSchema, ["*"]),
|
|
14977
|
+
description: import_mini60.z.optional(import_mini60.z.string()),
|
|
14978
|
+
globs: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string())),
|
|
14979
|
+
agentsmd: import_mini60.z.optional(
|
|
14980
|
+
import_mini60.z.looseObject({
|
|
14808
14981
|
// @example "path/to/subproject"
|
|
14809
|
-
subprojectPath:
|
|
14982
|
+
subprojectPath: import_mini60.z.optional(import_mini60.z.string())
|
|
14810
14983
|
})
|
|
14811
14984
|
),
|
|
14812
|
-
claudecode:
|
|
14813
|
-
|
|
14985
|
+
claudecode: import_mini60.z.optional(
|
|
14986
|
+
import_mini60.z.looseObject({
|
|
14814
14987
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
14815
14988
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
14816
|
-
paths:
|
|
14989
|
+
paths: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string()))
|
|
14817
14990
|
})
|
|
14818
14991
|
),
|
|
14819
|
-
cursor:
|
|
14820
|
-
|
|
14821
|
-
alwaysApply:
|
|
14822
|
-
description:
|
|
14823
|
-
globs:
|
|
14992
|
+
cursor: import_mini60.z.optional(
|
|
14993
|
+
import_mini60.z.looseObject({
|
|
14994
|
+
alwaysApply: import_mini60.z.optional(import_mini60.z.boolean()),
|
|
14995
|
+
description: import_mini60.z.optional(import_mini60.z.string()),
|
|
14996
|
+
globs: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string()))
|
|
14824
14997
|
})
|
|
14825
14998
|
),
|
|
14826
|
-
copilot:
|
|
14827
|
-
|
|
14828
|
-
excludeAgent:
|
|
14999
|
+
copilot: import_mini60.z.optional(
|
|
15000
|
+
import_mini60.z.looseObject({
|
|
15001
|
+
excludeAgent: import_mini60.z.optional(import_mini60.z.union([import_mini60.z.literal("code-review"), import_mini60.z.literal("coding-agent")]))
|
|
14829
15002
|
})
|
|
14830
15003
|
),
|
|
14831
|
-
antigravity:
|
|
14832
|
-
|
|
14833
|
-
trigger:
|
|
14834
|
-
globs:
|
|
15004
|
+
antigravity: import_mini60.z.optional(
|
|
15005
|
+
import_mini60.z.looseObject({
|
|
15006
|
+
trigger: import_mini60.z.optional(import_mini60.z.string()),
|
|
15007
|
+
globs: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string()))
|
|
14835
15008
|
})
|
|
14836
15009
|
)
|
|
14837
15010
|
});
|
|
@@ -14842,7 +15015,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
14842
15015
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14843
15016
|
if (!parseResult.success && rest.validate !== false) {
|
|
14844
15017
|
throw new Error(
|
|
14845
|
-
`Invalid frontmatter in ${(0,
|
|
15018
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
14846
15019
|
);
|
|
14847
15020
|
}
|
|
14848
15021
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -14877,7 +15050,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
14877
15050
|
return {
|
|
14878
15051
|
success: false,
|
|
14879
15052
|
error: new Error(
|
|
14880
|
-
`Invalid frontmatter in ${(0,
|
|
15053
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14881
15054
|
)
|
|
14882
15055
|
};
|
|
14883
15056
|
}
|
|
@@ -14886,7 +15059,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
14886
15059
|
relativeFilePath,
|
|
14887
15060
|
validate = true
|
|
14888
15061
|
}) {
|
|
14889
|
-
const filePath = (0,
|
|
15062
|
+
const filePath = (0, import_node_path106.join)(
|
|
14890
15063
|
process.cwd(),
|
|
14891
15064
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
14892
15065
|
relativeFilePath
|
|
@@ -14985,7 +15158,7 @@ var ToolRule = class extends ToolFile {
|
|
|
14985
15158
|
rulesyncRule,
|
|
14986
15159
|
validate = true,
|
|
14987
15160
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
14988
|
-
nonRootPath = { relativeDirPath: (0,
|
|
15161
|
+
nonRootPath = { relativeDirPath: (0, import_node_path107.join)(".agents", "memories") }
|
|
14989
15162
|
}) {
|
|
14990
15163
|
const params = this.buildToolRuleParamsDefault({
|
|
14991
15164
|
baseDir,
|
|
@@ -14996,7 +15169,7 @@ var ToolRule = class extends ToolFile {
|
|
|
14996
15169
|
});
|
|
14997
15170
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
14998
15171
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
14999
|
-
params.relativeDirPath = (0,
|
|
15172
|
+
params.relativeDirPath = (0, import_node_path107.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
15000
15173
|
params.relativeFilePath = "AGENTS.md";
|
|
15001
15174
|
}
|
|
15002
15175
|
return params;
|
|
@@ -15045,7 +15218,7 @@ var ToolRule = class extends ToolFile {
|
|
|
15045
15218
|
}
|
|
15046
15219
|
};
|
|
15047
15220
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
15048
|
-
return excludeToolDir ? subDir : (0,
|
|
15221
|
+
return excludeToolDir ? subDir : (0, import_node_path107.join)(toolDir, subDir);
|
|
15049
15222
|
}
|
|
15050
15223
|
|
|
15051
15224
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -15074,8 +15247,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
15074
15247
|
validate = true
|
|
15075
15248
|
}) {
|
|
15076
15249
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
15077
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
15078
|
-
const fileContent = await readFileContent((0,
|
|
15250
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path108.join)(".agents", "memories", relativeFilePath);
|
|
15251
|
+
const fileContent = await readFileContent((0, import_node_path108.join)(baseDir, relativePath));
|
|
15079
15252
|
return new _AgentsMdRule({
|
|
15080
15253
|
baseDir,
|
|
15081
15254
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15130,21 +15303,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
15130
15303
|
};
|
|
15131
15304
|
|
|
15132
15305
|
// src/features/rules/antigravity-rule.ts
|
|
15133
|
-
var
|
|
15134
|
-
var
|
|
15135
|
-
var AntigravityRuleFrontmatterSchema =
|
|
15136
|
-
trigger:
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15306
|
+
var import_node_path109 = require("path");
|
|
15307
|
+
var import_mini61 = require("zod/mini");
|
|
15308
|
+
var AntigravityRuleFrontmatterSchema = import_mini61.z.looseObject({
|
|
15309
|
+
trigger: import_mini61.z.optional(
|
|
15310
|
+
import_mini61.z.union([
|
|
15311
|
+
import_mini61.z.literal("always_on"),
|
|
15312
|
+
import_mini61.z.literal("glob"),
|
|
15313
|
+
import_mini61.z.literal("manual"),
|
|
15314
|
+
import_mini61.z.literal("model_decision"),
|
|
15315
|
+
import_mini61.z.string()
|
|
15143
15316
|
// accepts any string for forward compatibility
|
|
15144
15317
|
])
|
|
15145
15318
|
),
|
|
15146
|
-
globs:
|
|
15147
|
-
description:
|
|
15319
|
+
globs: import_mini61.z.optional(import_mini61.z.string()),
|
|
15320
|
+
description: import_mini61.z.optional(import_mini61.z.string())
|
|
15148
15321
|
});
|
|
15149
15322
|
function parseGlobsString(globs) {
|
|
15150
15323
|
if (!globs) {
|
|
@@ -15289,7 +15462,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15289
15462
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15290
15463
|
if (!result.success) {
|
|
15291
15464
|
throw new Error(
|
|
15292
|
-
`Invalid frontmatter in ${(0,
|
|
15465
|
+
`Invalid frontmatter in ${(0, import_node_path109.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15293
15466
|
);
|
|
15294
15467
|
}
|
|
15295
15468
|
}
|
|
@@ -15313,7 +15486,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15313
15486
|
relativeFilePath,
|
|
15314
15487
|
validate = true
|
|
15315
15488
|
}) {
|
|
15316
|
-
const filePath = (0,
|
|
15489
|
+
const filePath = (0, import_node_path109.join)(
|
|
15317
15490
|
baseDir,
|
|
15318
15491
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
15319
15492
|
relativeFilePath
|
|
@@ -15453,7 +15626,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15453
15626
|
};
|
|
15454
15627
|
|
|
15455
15628
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
15456
|
-
var
|
|
15629
|
+
var import_node_path110 = require("path");
|
|
15457
15630
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
15458
15631
|
toRulesyncRule() {
|
|
15459
15632
|
const rulesyncFrontmatter = {
|
|
@@ -15513,8 +15686,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
15513
15686
|
}) {
|
|
15514
15687
|
const settablePaths = this.getSettablePaths();
|
|
15515
15688
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
15516
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
15517
|
-
const fileContent = await readFileContent((0,
|
|
15689
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path110.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15690
|
+
const fileContent = await readFileContent((0, import_node_path110.join)(baseDir, relativePath));
|
|
15518
15691
|
return new _AugmentcodeLegacyRule({
|
|
15519
15692
|
baseDir,
|
|
15520
15693
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -15543,7 +15716,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
15543
15716
|
};
|
|
15544
15717
|
|
|
15545
15718
|
// src/features/rules/augmentcode-rule.ts
|
|
15546
|
-
var
|
|
15719
|
+
var import_node_path111 = require("path");
|
|
15547
15720
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
15548
15721
|
toRulesyncRule() {
|
|
15549
15722
|
return this.toRulesyncRuleDefault();
|
|
@@ -15574,7 +15747,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
15574
15747
|
relativeFilePath,
|
|
15575
15748
|
validate = true
|
|
15576
15749
|
}) {
|
|
15577
|
-
const filePath = (0,
|
|
15750
|
+
const filePath = (0, import_node_path111.join)(
|
|
15578
15751
|
baseDir,
|
|
15579
15752
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
15580
15753
|
relativeFilePath
|
|
@@ -15614,7 +15787,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
15614
15787
|
};
|
|
15615
15788
|
|
|
15616
15789
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
15617
|
-
var
|
|
15790
|
+
var import_node_path112 = require("path");
|
|
15618
15791
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
15619
15792
|
static getSettablePaths({
|
|
15620
15793
|
global,
|
|
@@ -15656,7 +15829,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15656
15829
|
if (isRoot) {
|
|
15657
15830
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
15658
15831
|
const fileContent2 = await readFileContent(
|
|
15659
|
-
(0,
|
|
15832
|
+
(0, import_node_path112.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
15660
15833
|
);
|
|
15661
15834
|
return new _ClaudecodeLegacyRule({
|
|
15662
15835
|
baseDir,
|
|
@@ -15670,8 +15843,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15670
15843
|
if (!paths.nonRoot) {
|
|
15671
15844
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15672
15845
|
}
|
|
15673
|
-
const relativePath = (0,
|
|
15674
|
-
const fileContent = await readFileContent((0,
|
|
15846
|
+
const relativePath = (0, import_node_path112.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15847
|
+
const fileContent = await readFileContent((0, import_node_path112.join)(baseDir, relativePath));
|
|
15675
15848
|
return new _ClaudecodeLegacyRule({
|
|
15676
15849
|
baseDir,
|
|
15677
15850
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15730,10 +15903,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15730
15903
|
};
|
|
15731
15904
|
|
|
15732
15905
|
// src/features/rules/claudecode-rule.ts
|
|
15733
|
-
var
|
|
15734
|
-
var
|
|
15735
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
15736
|
-
paths:
|
|
15906
|
+
var import_node_path113 = require("path");
|
|
15907
|
+
var import_mini62 = require("zod/mini");
|
|
15908
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini62.z.object({
|
|
15909
|
+
paths: import_mini62.z.optional(import_mini62.z.array(import_mini62.z.string()))
|
|
15737
15910
|
});
|
|
15738
15911
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
15739
15912
|
frontmatter;
|
|
@@ -15771,7 +15944,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15771
15944
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15772
15945
|
if (!result.success) {
|
|
15773
15946
|
throw new Error(
|
|
15774
|
-
`Invalid frontmatter in ${(0,
|
|
15947
|
+
`Invalid frontmatter in ${(0, import_node_path113.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15775
15948
|
);
|
|
15776
15949
|
}
|
|
15777
15950
|
}
|
|
@@ -15801,7 +15974,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15801
15974
|
if (isRoot) {
|
|
15802
15975
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
15803
15976
|
const fileContent2 = await readFileContent(
|
|
15804
|
-
(0,
|
|
15977
|
+
(0, import_node_path113.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
15805
15978
|
);
|
|
15806
15979
|
return new _ClaudecodeRule({
|
|
15807
15980
|
baseDir,
|
|
@@ -15816,8 +15989,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15816
15989
|
if (!paths.nonRoot) {
|
|
15817
15990
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15818
15991
|
}
|
|
15819
|
-
const relativePath = (0,
|
|
15820
|
-
const filePath = (0,
|
|
15992
|
+
const relativePath = (0, import_node_path113.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
15993
|
+
const filePath = (0, import_node_path113.join)(baseDir, relativePath);
|
|
15821
15994
|
const fileContent = await readFileContent(filePath);
|
|
15822
15995
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15823
15996
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15928,7 +16101,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15928
16101
|
return {
|
|
15929
16102
|
success: false,
|
|
15930
16103
|
error: new Error(
|
|
15931
|
-
`Invalid frontmatter in ${(0,
|
|
16104
|
+
`Invalid frontmatter in ${(0, import_node_path113.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15932
16105
|
)
|
|
15933
16106
|
};
|
|
15934
16107
|
}
|
|
@@ -15948,10 +16121,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15948
16121
|
};
|
|
15949
16122
|
|
|
15950
16123
|
// src/features/rules/cline-rule.ts
|
|
15951
|
-
var
|
|
15952
|
-
var
|
|
15953
|
-
var ClineRuleFrontmatterSchema =
|
|
15954
|
-
description:
|
|
16124
|
+
var import_node_path114 = require("path");
|
|
16125
|
+
var import_mini63 = require("zod/mini");
|
|
16126
|
+
var ClineRuleFrontmatterSchema = import_mini63.z.object({
|
|
16127
|
+
description: import_mini63.z.string()
|
|
15955
16128
|
});
|
|
15956
16129
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
15957
16130
|
static getSettablePaths(_options = {}) {
|
|
@@ -15994,7 +16167,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
15994
16167
|
validate = true
|
|
15995
16168
|
}) {
|
|
15996
16169
|
const fileContent = await readFileContent(
|
|
15997
|
-
(0,
|
|
16170
|
+
(0, import_node_path114.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15998
16171
|
);
|
|
15999
16172
|
return new _ClineRule({
|
|
16000
16173
|
baseDir,
|
|
@@ -16020,7 +16193,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
16020
16193
|
};
|
|
16021
16194
|
|
|
16022
16195
|
// src/features/rules/codexcli-rule.ts
|
|
16023
|
-
var
|
|
16196
|
+
var import_node_path115 = require("path");
|
|
16024
16197
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
16025
16198
|
static getSettablePaths({
|
|
16026
16199
|
global,
|
|
@@ -16055,7 +16228,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16055
16228
|
if (isRoot) {
|
|
16056
16229
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16057
16230
|
const fileContent2 = await readFileContent(
|
|
16058
|
-
(0,
|
|
16231
|
+
(0, import_node_path115.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16059
16232
|
);
|
|
16060
16233
|
return new _CodexcliRule({
|
|
16061
16234
|
baseDir,
|
|
@@ -16069,8 +16242,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16069
16242
|
if (!paths.nonRoot) {
|
|
16070
16243
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16071
16244
|
}
|
|
16072
|
-
const relativePath = (0,
|
|
16073
|
-
const fileContent = await readFileContent((0,
|
|
16245
|
+
const relativePath = (0, import_node_path115.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16246
|
+
const fileContent = await readFileContent((0, import_node_path115.join)(baseDir, relativePath));
|
|
16074
16247
|
return new _CodexcliRule({
|
|
16075
16248
|
baseDir,
|
|
16076
16249
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16129,12 +16302,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16129
16302
|
};
|
|
16130
16303
|
|
|
16131
16304
|
// src/features/rules/copilot-rule.ts
|
|
16132
|
-
var
|
|
16133
|
-
var
|
|
16134
|
-
var CopilotRuleFrontmatterSchema =
|
|
16135
|
-
description:
|
|
16136
|
-
applyTo:
|
|
16137
|
-
excludeAgent:
|
|
16305
|
+
var import_node_path116 = require("path");
|
|
16306
|
+
var import_mini64 = require("zod/mini");
|
|
16307
|
+
var CopilotRuleFrontmatterSchema = import_mini64.z.object({
|
|
16308
|
+
description: import_mini64.z.optional(import_mini64.z.string()),
|
|
16309
|
+
applyTo: import_mini64.z.optional(import_mini64.z.string()),
|
|
16310
|
+
excludeAgent: import_mini64.z.optional(import_mini64.z.union([import_mini64.z.literal("code-review"), import_mini64.z.literal("coding-agent")]))
|
|
16138
16311
|
});
|
|
16139
16312
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
16140
16313
|
frontmatter;
|
|
@@ -16166,7 +16339,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16166
16339
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16167
16340
|
if (!result.success) {
|
|
16168
16341
|
throw new Error(
|
|
16169
|
-
`Invalid frontmatter in ${(0,
|
|
16342
|
+
`Invalid frontmatter in ${(0, import_node_path116.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16170
16343
|
);
|
|
16171
16344
|
}
|
|
16172
16345
|
}
|
|
@@ -16256,8 +16429,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16256
16429
|
const paths = this.getSettablePaths({ global });
|
|
16257
16430
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
16258
16431
|
if (isRoot) {
|
|
16259
|
-
const relativePath2 = (0,
|
|
16260
|
-
const filePath2 = (0,
|
|
16432
|
+
const relativePath2 = (0, import_node_path116.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
16433
|
+
const filePath2 = (0, import_node_path116.join)(baseDir, relativePath2);
|
|
16261
16434
|
const fileContent2 = await readFileContent(filePath2);
|
|
16262
16435
|
return new _CopilotRule({
|
|
16263
16436
|
baseDir,
|
|
@@ -16272,8 +16445,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16272
16445
|
if (!paths.nonRoot) {
|
|
16273
16446
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16274
16447
|
}
|
|
16275
|
-
const relativePath = (0,
|
|
16276
|
-
const filePath = (0,
|
|
16448
|
+
const relativePath = (0, import_node_path116.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16449
|
+
const filePath = (0, import_node_path116.join)(baseDir, relativePath);
|
|
16277
16450
|
const fileContent = await readFileContent(filePath);
|
|
16278
16451
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16279
16452
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16319,7 +16492,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16319
16492
|
return {
|
|
16320
16493
|
success: false,
|
|
16321
16494
|
error: new Error(
|
|
16322
|
-
`Invalid frontmatter in ${(0,
|
|
16495
|
+
`Invalid frontmatter in ${(0, import_node_path116.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16323
16496
|
)
|
|
16324
16497
|
};
|
|
16325
16498
|
}
|
|
@@ -16375,12 +16548,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
16375
16548
|
};
|
|
16376
16549
|
|
|
16377
16550
|
// src/features/rules/cursor-rule.ts
|
|
16378
|
-
var
|
|
16379
|
-
var
|
|
16380
|
-
var CursorRuleFrontmatterSchema =
|
|
16381
|
-
description:
|
|
16382
|
-
globs:
|
|
16383
|
-
alwaysApply:
|
|
16551
|
+
var import_node_path117 = require("path");
|
|
16552
|
+
var import_mini65 = require("zod/mini");
|
|
16553
|
+
var CursorRuleFrontmatterSchema = import_mini65.z.object({
|
|
16554
|
+
description: import_mini65.z.optional(import_mini65.z.string()),
|
|
16555
|
+
globs: import_mini65.z.optional(import_mini65.z.string()),
|
|
16556
|
+
alwaysApply: import_mini65.z.optional(import_mini65.z.boolean())
|
|
16384
16557
|
});
|
|
16385
16558
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
16386
16559
|
frontmatter;
|
|
@@ -16397,7 +16570,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16397
16570
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16398
16571
|
if (!result.success) {
|
|
16399
16572
|
throw new Error(
|
|
16400
|
-
`Invalid frontmatter in ${(0,
|
|
16573
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16401
16574
|
);
|
|
16402
16575
|
}
|
|
16403
16576
|
}
|
|
@@ -16513,7 +16686,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16513
16686
|
relativeFilePath,
|
|
16514
16687
|
validate = true
|
|
16515
16688
|
}) {
|
|
16516
|
-
const filePath = (0,
|
|
16689
|
+
const filePath = (0, import_node_path117.join)(
|
|
16517
16690
|
baseDir,
|
|
16518
16691
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
16519
16692
|
relativeFilePath
|
|
@@ -16523,7 +16696,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16523
16696
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16524
16697
|
if (!result.success) {
|
|
16525
16698
|
throw new Error(
|
|
16526
|
-
`Invalid frontmatter in ${(0,
|
|
16699
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
16527
16700
|
);
|
|
16528
16701
|
}
|
|
16529
16702
|
return new _CursorRule({
|
|
@@ -16560,7 +16733,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16560
16733
|
return {
|
|
16561
16734
|
success: false,
|
|
16562
16735
|
error: new Error(
|
|
16563
|
-
`Invalid frontmatter in ${(0,
|
|
16736
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16564
16737
|
)
|
|
16565
16738
|
};
|
|
16566
16739
|
}
|
|
@@ -16580,7 +16753,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16580
16753
|
};
|
|
16581
16754
|
|
|
16582
16755
|
// src/features/rules/deepagents-rule.ts
|
|
16583
|
-
var
|
|
16756
|
+
var import_node_path118 = require("path");
|
|
16584
16757
|
var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
16585
16758
|
constructor({ fileContent, root, ...rest }) {
|
|
16586
16759
|
super({
|
|
@@ -16607,8 +16780,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
16607
16780
|
}) {
|
|
16608
16781
|
const settablePaths = this.getSettablePaths();
|
|
16609
16782
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
16610
|
-
const relativePath = isRoot ? (0,
|
|
16611
|
-
const fileContent = await readFileContent((0,
|
|
16783
|
+
const relativePath = isRoot ? (0, import_node_path118.join)(".deepagents", "AGENTS.md") : (0, import_node_path118.join)(".deepagents", "memories", relativeFilePath);
|
|
16784
|
+
const fileContent = await readFileContent((0, import_node_path118.join)(baseDir, relativePath));
|
|
16612
16785
|
return new _DeepagentsRule({
|
|
16613
16786
|
baseDir,
|
|
16614
16787
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -16663,7 +16836,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
16663
16836
|
};
|
|
16664
16837
|
|
|
16665
16838
|
// src/features/rules/factorydroid-rule.ts
|
|
16666
|
-
var
|
|
16839
|
+
var import_node_path119 = require("path");
|
|
16667
16840
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
16668
16841
|
constructor({ fileContent, root, ...rest }) {
|
|
16669
16842
|
super({
|
|
@@ -16703,8 +16876,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16703
16876
|
const paths = this.getSettablePaths({ global });
|
|
16704
16877
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
16705
16878
|
if (isRoot) {
|
|
16706
|
-
const relativePath2 = (0,
|
|
16707
|
-
const fileContent2 = await readFileContent((0,
|
|
16879
|
+
const relativePath2 = (0, import_node_path119.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
16880
|
+
const fileContent2 = await readFileContent((0, import_node_path119.join)(baseDir, relativePath2));
|
|
16708
16881
|
return new _FactorydroidRule({
|
|
16709
16882
|
baseDir,
|
|
16710
16883
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -16717,8 +16890,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16717
16890
|
if (!paths.nonRoot) {
|
|
16718
16891
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16719
16892
|
}
|
|
16720
|
-
const relativePath = (0,
|
|
16721
|
-
const fileContent = await readFileContent((0,
|
|
16893
|
+
const relativePath = (0, import_node_path119.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16894
|
+
const fileContent = await readFileContent((0, import_node_path119.join)(baseDir, relativePath));
|
|
16722
16895
|
return new _FactorydroidRule({
|
|
16723
16896
|
baseDir,
|
|
16724
16897
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16777,7 +16950,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16777
16950
|
};
|
|
16778
16951
|
|
|
16779
16952
|
// src/features/rules/geminicli-rule.ts
|
|
16780
|
-
var
|
|
16953
|
+
var import_node_path120 = require("path");
|
|
16781
16954
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
16782
16955
|
static getSettablePaths({
|
|
16783
16956
|
global,
|
|
@@ -16812,7 +16985,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
16812
16985
|
if (isRoot) {
|
|
16813
16986
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16814
16987
|
const fileContent2 = await readFileContent(
|
|
16815
|
-
(0,
|
|
16988
|
+
(0, import_node_path120.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16816
16989
|
);
|
|
16817
16990
|
return new _GeminiCliRule({
|
|
16818
16991
|
baseDir,
|
|
@@ -16826,8 +16999,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
16826
16999
|
if (!paths.nonRoot) {
|
|
16827
17000
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16828
17001
|
}
|
|
16829
|
-
const relativePath = (0,
|
|
16830
|
-
const fileContent = await readFileContent((0,
|
|
17002
|
+
const relativePath = (0, import_node_path120.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17003
|
+
const fileContent = await readFileContent((0, import_node_path120.join)(baseDir, relativePath));
|
|
16831
17004
|
return new _GeminiCliRule({
|
|
16832
17005
|
baseDir,
|
|
16833
17006
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16886,7 +17059,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
16886
17059
|
};
|
|
16887
17060
|
|
|
16888
17061
|
// src/features/rules/goose-rule.ts
|
|
16889
|
-
var
|
|
17062
|
+
var import_node_path121 = require("path");
|
|
16890
17063
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
16891
17064
|
static getSettablePaths({
|
|
16892
17065
|
global,
|
|
@@ -16921,7 +17094,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
16921
17094
|
if (isRoot) {
|
|
16922
17095
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16923
17096
|
const fileContent2 = await readFileContent(
|
|
16924
|
-
(0,
|
|
17097
|
+
(0, import_node_path121.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16925
17098
|
);
|
|
16926
17099
|
return new _GooseRule({
|
|
16927
17100
|
baseDir,
|
|
@@ -16935,8 +17108,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
16935
17108
|
if (!paths.nonRoot) {
|
|
16936
17109
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16937
17110
|
}
|
|
16938
|
-
const relativePath = (0,
|
|
16939
|
-
const fileContent = await readFileContent((0,
|
|
17111
|
+
const relativePath = (0, import_node_path121.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17112
|
+
const fileContent = await readFileContent((0, import_node_path121.join)(baseDir, relativePath));
|
|
16940
17113
|
return new _GooseRule({
|
|
16941
17114
|
baseDir,
|
|
16942
17115
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16995,7 +17168,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
16995
17168
|
};
|
|
16996
17169
|
|
|
16997
17170
|
// src/features/rules/junie-rule.ts
|
|
16998
|
-
var
|
|
17171
|
+
var import_node_path122 = require("path");
|
|
16999
17172
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
17000
17173
|
static getSettablePaths(_options = {}) {
|
|
17001
17174
|
return {
|
|
@@ -17024,8 +17197,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
17024
17197
|
}) {
|
|
17025
17198
|
const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
|
|
17026
17199
|
const settablePaths = this.getSettablePaths();
|
|
17027
|
-
const relativePath = isRoot ? (0,
|
|
17028
|
-
const fileContent = await readFileContent((0,
|
|
17200
|
+
const relativePath = isRoot ? (0, import_node_path122.join)(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : (0, import_node_path122.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17201
|
+
const fileContent = await readFileContent((0, import_node_path122.join)(baseDir, relativePath));
|
|
17029
17202
|
return new _JunieRule({
|
|
17030
17203
|
baseDir,
|
|
17031
17204
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -17080,7 +17253,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
17080
17253
|
};
|
|
17081
17254
|
|
|
17082
17255
|
// src/features/rules/kilo-rule.ts
|
|
17083
|
-
var
|
|
17256
|
+
var import_node_path123 = require("path");
|
|
17084
17257
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
17085
17258
|
static getSettablePaths({
|
|
17086
17259
|
global,
|
|
@@ -17115,7 +17288,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17115
17288
|
if (isRoot) {
|
|
17116
17289
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17117
17290
|
const fileContent2 = await readFileContent(
|
|
17118
|
-
(0,
|
|
17291
|
+
(0, import_node_path123.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17119
17292
|
);
|
|
17120
17293
|
return new _KiloRule({
|
|
17121
17294
|
baseDir,
|
|
@@ -17129,8 +17302,8 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17129
17302
|
if (!paths.nonRoot) {
|
|
17130
17303
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17131
17304
|
}
|
|
17132
|
-
const relativePath = (0,
|
|
17133
|
-
const fileContent = await readFileContent((0,
|
|
17305
|
+
const relativePath = (0, import_node_path123.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17306
|
+
const fileContent = await readFileContent((0, import_node_path123.join)(baseDir, relativePath));
|
|
17134
17307
|
return new _KiloRule({
|
|
17135
17308
|
baseDir,
|
|
17136
17309
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17189,7 +17362,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17189
17362
|
};
|
|
17190
17363
|
|
|
17191
17364
|
// src/features/rules/kiro-rule.ts
|
|
17192
|
-
var
|
|
17365
|
+
var import_node_path124 = require("path");
|
|
17193
17366
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
17194
17367
|
static getSettablePaths(_options = {}) {
|
|
17195
17368
|
return {
|
|
@@ -17204,7 +17377,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
17204
17377
|
validate = true
|
|
17205
17378
|
}) {
|
|
17206
17379
|
const fileContent = await readFileContent(
|
|
17207
|
-
(0,
|
|
17380
|
+
(0, import_node_path124.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17208
17381
|
);
|
|
17209
17382
|
return new _KiroRule({
|
|
17210
17383
|
baseDir,
|
|
@@ -17258,7 +17431,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
17258
17431
|
};
|
|
17259
17432
|
|
|
17260
17433
|
// src/features/rules/opencode-rule.ts
|
|
17261
|
-
var
|
|
17434
|
+
var import_node_path125 = require("path");
|
|
17262
17435
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
17263
17436
|
static getSettablePaths({
|
|
17264
17437
|
global,
|
|
@@ -17293,7 +17466,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17293
17466
|
if (isRoot) {
|
|
17294
17467
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17295
17468
|
const fileContent2 = await readFileContent(
|
|
17296
|
-
(0,
|
|
17469
|
+
(0, import_node_path125.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17297
17470
|
);
|
|
17298
17471
|
return new _OpenCodeRule({
|
|
17299
17472
|
baseDir,
|
|
@@ -17307,8 +17480,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17307
17480
|
if (!paths.nonRoot) {
|
|
17308
17481
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17309
17482
|
}
|
|
17310
|
-
const relativePath = (0,
|
|
17311
|
-
const fileContent = await readFileContent((0,
|
|
17483
|
+
const relativePath = (0, import_node_path125.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17484
|
+
const fileContent = await readFileContent((0, import_node_path125.join)(baseDir, relativePath));
|
|
17312
17485
|
return new _OpenCodeRule({
|
|
17313
17486
|
baseDir,
|
|
17314
17487
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17367,7 +17540,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17367
17540
|
};
|
|
17368
17541
|
|
|
17369
17542
|
// src/features/rules/qwencode-rule.ts
|
|
17370
|
-
var
|
|
17543
|
+
var import_node_path126 = require("path");
|
|
17371
17544
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
17372
17545
|
static getSettablePaths(_options = {}) {
|
|
17373
17546
|
return {
|
|
@@ -17386,8 +17559,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
17386
17559
|
validate = true
|
|
17387
17560
|
}) {
|
|
17388
17561
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
17389
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
17390
|
-
const fileContent = await readFileContent((0,
|
|
17562
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path126.join)(".qwen", "memories", relativeFilePath);
|
|
17563
|
+
const fileContent = await readFileContent((0, import_node_path126.join)(baseDir, relativePath));
|
|
17391
17564
|
return new _QwencodeRule({
|
|
17392
17565
|
baseDir,
|
|
17393
17566
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -17439,7 +17612,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
17439
17612
|
};
|
|
17440
17613
|
|
|
17441
17614
|
// src/features/rules/replit-rule.ts
|
|
17442
|
-
var
|
|
17615
|
+
var import_node_path127 = require("path");
|
|
17443
17616
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
17444
17617
|
static getSettablePaths(_options = {}) {
|
|
17445
17618
|
return {
|
|
@@ -17461,7 +17634,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
17461
17634
|
}
|
|
17462
17635
|
const relativePath = paths.root.relativeFilePath;
|
|
17463
17636
|
const fileContent = await readFileContent(
|
|
17464
|
-
(0,
|
|
17637
|
+
(0, import_node_path127.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
17465
17638
|
);
|
|
17466
17639
|
return new _ReplitRule({
|
|
17467
17640
|
baseDir,
|
|
@@ -17527,7 +17700,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
17527
17700
|
};
|
|
17528
17701
|
|
|
17529
17702
|
// src/features/rules/roo-rule.ts
|
|
17530
|
-
var
|
|
17703
|
+
var import_node_path128 = require("path");
|
|
17531
17704
|
var RooRule = class _RooRule extends ToolRule {
|
|
17532
17705
|
static getSettablePaths(_options = {}) {
|
|
17533
17706
|
return {
|
|
@@ -17542,7 +17715,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
17542
17715
|
validate = true
|
|
17543
17716
|
}) {
|
|
17544
17717
|
const fileContent = await readFileContent(
|
|
17545
|
-
(0,
|
|
17718
|
+
(0, import_node_path128.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17546
17719
|
);
|
|
17547
17720
|
return new _RooRule({
|
|
17548
17721
|
baseDir,
|
|
@@ -17611,7 +17784,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
17611
17784
|
};
|
|
17612
17785
|
|
|
17613
17786
|
// src/features/rules/rovodev-rule.ts
|
|
17614
|
-
var
|
|
17787
|
+
var import_node_path129 = require("path");
|
|
17615
17788
|
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
17616
17789
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
17617
17790
|
/**
|
|
@@ -17655,7 +17828,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17655
17828
|
root: rovodevAgents,
|
|
17656
17829
|
alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
|
|
17657
17830
|
nonRoot: {
|
|
17658
|
-
relativeDirPath: (0,
|
|
17831
|
+
relativeDirPath: (0, import_node_path129.join)(".rovodev", ".rulesync", "modular-rules")
|
|
17659
17832
|
}
|
|
17660
17833
|
};
|
|
17661
17834
|
}
|
|
@@ -17694,10 +17867,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17694
17867
|
}) {
|
|
17695
17868
|
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
17696
17869
|
throw new Error(
|
|
17697
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0,
|
|
17870
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0, import_node_path129.join)(relativeDirPath, relativeFilePath)}`
|
|
17698
17871
|
);
|
|
17699
17872
|
}
|
|
17700
|
-
const fileContent = await readFileContent((0,
|
|
17873
|
+
const fileContent = await readFileContent((0, import_node_path129.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
17701
17874
|
return new _RovodevRule({
|
|
17702
17875
|
baseDir,
|
|
17703
17876
|
relativeDirPath,
|
|
@@ -17717,10 +17890,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17717
17890
|
paths
|
|
17718
17891
|
}) {
|
|
17719
17892
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17720
|
-
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0,
|
|
17893
|
+
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0, import_node_path129.join)(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : (0, import_node_path129.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
17721
17894
|
if (relativeFilePath !== "AGENTS.md") {
|
|
17722
17895
|
throw new Error(
|
|
17723
|
-
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${(0,
|
|
17896
|
+
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${(0, import_node_path129.join)(relativeDirPath, relativeFilePath)}`
|
|
17724
17897
|
);
|
|
17725
17898
|
}
|
|
17726
17899
|
const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
|
|
@@ -17728,10 +17901,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17728
17901
|
);
|
|
17729
17902
|
if (!allowed) {
|
|
17730
17903
|
throw new Error(
|
|
17731
|
-
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${(0,
|
|
17904
|
+
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${(0, import_node_path129.join)(relativeDirPath, relativeFilePath)}`
|
|
17732
17905
|
);
|
|
17733
17906
|
}
|
|
17734
|
-
const fileContent = await readFileContent((0,
|
|
17907
|
+
const fileContent = await readFileContent((0, import_node_path129.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
17735
17908
|
return new _RovodevRule({
|
|
17736
17909
|
baseDir,
|
|
17737
17910
|
relativeDirPath,
|
|
@@ -17845,7 +18018,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17845
18018
|
};
|
|
17846
18019
|
|
|
17847
18020
|
// src/features/rules/warp-rule.ts
|
|
17848
|
-
var
|
|
18021
|
+
var import_node_path130 = require("path");
|
|
17849
18022
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
17850
18023
|
constructor({ fileContent, root, ...rest }) {
|
|
17851
18024
|
super({
|
|
@@ -17871,8 +18044,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
17871
18044
|
validate = true
|
|
17872
18045
|
}) {
|
|
17873
18046
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
17874
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
17875
|
-
const fileContent = await readFileContent((0,
|
|
18047
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path130.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
18048
|
+
const fileContent = await readFileContent((0, import_node_path130.join)(baseDir, relativePath));
|
|
17876
18049
|
return new _WarpRule({
|
|
17877
18050
|
baseDir,
|
|
17878
18051
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -17927,7 +18100,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
17927
18100
|
};
|
|
17928
18101
|
|
|
17929
18102
|
// src/features/rules/windsurf-rule.ts
|
|
17930
|
-
var
|
|
18103
|
+
var import_node_path131 = require("path");
|
|
17931
18104
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
17932
18105
|
static getSettablePaths(_options = {}) {
|
|
17933
18106
|
return {
|
|
@@ -17942,7 +18115,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
17942
18115
|
validate = true
|
|
17943
18116
|
}) {
|
|
17944
18117
|
const fileContent = await readFileContent(
|
|
17945
|
-
(0,
|
|
18118
|
+
(0, import_node_path131.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17946
18119
|
);
|
|
17947
18120
|
return new _WindsurfRule({
|
|
17948
18121
|
baseDir,
|
|
@@ -18040,11 +18213,11 @@ var rulesProcessorToolTargets = [
|
|
|
18040
18213
|
"warp",
|
|
18041
18214
|
"windsurf"
|
|
18042
18215
|
];
|
|
18043
|
-
var RulesProcessorToolTargetSchema =
|
|
18044
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
18045
|
-
var RulesFeatureOptionsSchema =
|
|
18046
|
-
ruleDiscoveryMode:
|
|
18047
|
-
includeLocalRoot:
|
|
18216
|
+
var RulesProcessorToolTargetSchema = import_mini66.z.enum(rulesProcessorToolTargets);
|
|
18217
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path132.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
18218
|
+
var RulesFeatureOptionsSchema = import_mini66.z.looseObject({
|
|
18219
|
+
ruleDiscoveryMode: import_mini66.z.optional(import_mini66.z.enum(["none", "explicit"])),
|
|
18220
|
+
includeLocalRoot: import_mini66.z.optional(import_mini66.z.boolean())
|
|
18048
18221
|
});
|
|
18049
18222
|
var resolveRuleDiscoveryMode = ({
|
|
18050
18223
|
defaultMode,
|
|
@@ -18065,8 +18238,8 @@ var resolveRuleDiscoveryMode = ({
|
|
|
18065
18238
|
}
|
|
18066
18239
|
return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
|
|
18067
18240
|
};
|
|
18068
|
-
var IncludeLocalRootSchema =
|
|
18069
|
-
includeLocalRoot:
|
|
18241
|
+
var IncludeLocalRootSchema = import_mini66.z.looseObject({
|
|
18242
|
+
includeLocalRoot: import_mini66.z.optional(import_mini66.z.boolean())
|
|
18070
18243
|
});
|
|
18071
18244
|
var resolveIncludeLocalRoot = (options) => {
|
|
18072
18245
|
if (!options) return true;
|
|
@@ -18372,6 +18545,8 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
18372
18545
|
extension: "md",
|
|
18373
18546
|
supportsGlobal: false,
|
|
18374
18547
|
ruleDiscoveryMode: "auto"
|
|
18548
|
+
// No additionalConventions.skills needed: Windsurf Cascade auto-discovers
|
|
18549
|
+
// skills from .windsurf/skills/ and ~/.codeium/windsurf/skills/ directories.
|
|
18375
18550
|
}
|
|
18376
18551
|
}
|
|
18377
18552
|
]
|
|
@@ -18509,7 +18684,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18509
18684
|
}).relativeDirPath;
|
|
18510
18685
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
18511
18686
|
const frontmatter = skill.getFrontmatter();
|
|
18512
|
-
const relativePath = (0,
|
|
18687
|
+
const relativePath = (0, import_node_path132.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
18513
18688
|
return {
|
|
18514
18689
|
name: frontmatter.name,
|
|
18515
18690
|
description: frontmatter.description,
|
|
@@ -18638,12 +18813,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18638
18813
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
18639
18814
|
*/
|
|
18640
18815
|
async loadRulesyncFiles() {
|
|
18641
|
-
const rulesyncBaseDir = (0,
|
|
18642
|
-
const files = await findFilesByGlobs((0,
|
|
18816
|
+
const rulesyncBaseDir = (0, import_node_path132.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
18817
|
+
const files = await findFilesByGlobs((0, import_node_path132.join)(rulesyncBaseDir, "**", "*.md"));
|
|
18643
18818
|
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
18644
18819
|
const rulesyncRules = await Promise.all(
|
|
18645
18820
|
files.map((file) => {
|
|
18646
|
-
const relativeFilePath = (0,
|
|
18821
|
+
const relativeFilePath = (0, import_node_path132.relative)(rulesyncBaseDir, file);
|
|
18647
18822
|
checkPathTraversal({
|
|
18648
18823
|
relativePath: relativeFilePath,
|
|
18649
18824
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -18718,7 +18893,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18718
18893
|
global: this.global
|
|
18719
18894
|
});
|
|
18720
18895
|
const resolveRelativeDirPath = (filePath) => {
|
|
18721
|
-
const dirName = (0,
|
|
18896
|
+
const dirName = (0, import_node_path132.dirname)((0, import_node_path132.relative)(this.baseDir, filePath));
|
|
18722
18897
|
return dirName === "" ? "." : dirName;
|
|
18723
18898
|
};
|
|
18724
18899
|
const buildDeletionRulesFromPaths = (filePaths, opts) => {
|
|
@@ -18726,7 +18901,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18726
18901
|
const effectiveBaseDir = isNonRoot ? opts.baseDirOverride : this.baseDir;
|
|
18727
18902
|
return filePaths.map((filePath) => {
|
|
18728
18903
|
const relativeDirPath = isNonRoot ? opts.relativeDirPathOverride : resolveRelativeDirPath(filePath);
|
|
18729
|
-
const relativeFilePath = isNonRoot ? (0,
|
|
18904
|
+
const relativeFilePath = isNonRoot ? (0, import_node_path132.relative)(effectiveBaseDir, filePath) : (0, import_node_path132.basename)(filePath);
|
|
18730
18905
|
checkPathTraversal({
|
|
18731
18906
|
relativePath: isNonRoot ? relativeFilePath : relativeDirPath,
|
|
18732
18907
|
intendedRootDir: effectiveBaseDir
|
|
@@ -18754,13 +18929,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18754
18929
|
return [];
|
|
18755
18930
|
}
|
|
18756
18931
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
18757
|
-
(0,
|
|
18932
|
+
(0, import_node_path132.join)(
|
|
18758
18933
|
this.baseDir,
|
|
18759
18934
|
settablePaths.root.relativeDirPath ?? ".",
|
|
18760
18935
|
settablePaths.root.relativeFilePath
|
|
18761
18936
|
),
|
|
18762
18937
|
settablePaths.alternativeRoots,
|
|
18763
|
-
(alt) => (0,
|
|
18938
|
+
(alt) => (0, import_node_path132.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
18764
18939
|
);
|
|
18765
18940
|
if (forDeletion) {
|
|
18766
18941
|
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
@@ -18774,7 +18949,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18774
18949
|
});
|
|
18775
18950
|
return factory.class.fromFile({
|
|
18776
18951
|
baseDir: this.baseDir,
|
|
18777
|
-
relativeFilePath: (0,
|
|
18952
|
+
relativeFilePath: (0, import_node_path132.basename)(filePath),
|
|
18778
18953
|
relativeDirPath,
|
|
18779
18954
|
global: this.global
|
|
18780
18955
|
});
|
|
@@ -18791,7 +18966,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18791
18966
|
return [];
|
|
18792
18967
|
}
|
|
18793
18968
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
18794
|
-
(0,
|
|
18969
|
+
(0, import_node_path132.join)(this.baseDir, "AGENTS.local.md")
|
|
18795
18970
|
);
|
|
18796
18971
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
18797
18972
|
}
|
|
@@ -18802,9 +18977,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18802
18977
|
return [];
|
|
18803
18978
|
}
|
|
18804
18979
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
18805
|
-
(0,
|
|
18980
|
+
(0, import_node_path132.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
18806
18981
|
settablePaths.alternativeRoots,
|
|
18807
|
-
(alt) => (0,
|
|
18982
|
+
(alt) => (0, import_node_path132.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
18808
18983
|
);
|
|
18809
18984
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
18810
18985
|
})();
|
|
@@ -18815,20 +18990,20 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18815
18990
|
if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
|
|
18816
18991
|
return [];
|
|
18817
18992
|
}
|
|
18818
|
-
const primaryPaths = await findFilesByGlobs((0,
|
|
18993
|
+
const primaryPaths = await findFilesByGlobs((0, import_node_path132.join)(this.baseDir, ".rovodev", "AGENTS.md"));
|
|
18819
18994
|
if (primaryPaths.length === 0) {
|
|
18820
18995
|
return [];
|
|
18821
18996
|
}
|
|
18822
|
-
const mirrorPaths = await findFilesByGlobs((0,
|
|
18997
|
+
const mirrorPaths = await findFilesByGlobs((0, import_node_path132.join)(this.baseDir, "AGENTS.md"));
|
|
18823
18998
|
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
18824
18999
|
})();
|
|
18825
19000
|
const nonRootToolRules = await (async () => {
|
|
18826
19001
|
if (!settablePaths.nonRoot) {
|
|
18827
19002
|
return [];
|
|
18828
19003
|
}
|
|
18829
|
-
const nonRootBaseDir = (0,
|
|
19004
|
+
const nonRootBaseDir = (0, import_node_path132.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
18830
19005
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
18831
|
-
(0,
|
|
19006
|
+
(0, import_node_path132.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
18832
19007
|
);
|
|
18833
19008
|
if (forDeletion) {
|
|
18834
19009
|
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
@@ -18838,18 +19013,18 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18838
19013
|
}
|
|
18839
19014
|
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
18840
19015
|
const nonRootPathsForImport = this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
18841
|
-
const relativeFilePath = (0,
|
|
19016
|
+
const relativeFilePath = (0, import_node_path132.relative)(nonRootBaseDir, filePath);
|
|
18842
19017
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
18843
19018
|
if (!ok) {
|
|
18844
19019
|
this.logger.warn(
|
|
18845
|
-
`Skipping reserved Rovodev path under modular-rules (import): ${(0,
|
|
19020
|
+
`Skipping reserved Rovodev path under modular-rules (import): ${(0, import_node_path132.join)(modularRootRelative, relativeFilePath)}`
|
|
18846
19021
|
);
|
|
18847
19022
|
}
|
|
18848
19023
|
return ok;
|
|
18849
19024
|
}) : nonRootFilePaths;
|
|
18850
19025
|
return await Promise.all(
|
|
18851
19026
|
nonRootPathsForImport.map((filePath) => {
|
|
18852
|
-
const relativeFilePath = (0,
|
|
19027
|
+
const relativeFilePath = (0, import_node_path132.relative)(nonRootBaseDir, filePath);
|
|
18853
19028
|
checkPathTraversal({
|
|
18854
19029
|
relativePath: relativeFilePath,
|
|
18855
19030
|
intendedRootDir: nonRootBaseDir
|
|
@@ -18968,14 +19143,14 @@ s/<command> [arguments]
|
|
|
18968
19143
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
18969
19144
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
18970
19145
|
|
|
18971
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
19146
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path132.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
18972
19147
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
18973
19148
|
|
|
18974
19149
|
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.
|
|
18975
19150
|
|
|
18976
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
19151
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path132.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
18977
19152
|
|
|
18978
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
19153
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path132.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
18979
19154
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
18980
19155
|
const result = [
|
|
18981
19156
|
overview,
|
|
@@ -19007,51 +19182,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
19007
19182
|
var import_rest = require("@octokit/rest");
|
|
19008
19183
|
|
|
19009
19184
|
// src/types/fetch.ts
|
|
19010
|
-
var
|
|
19185
|
+
var import_mini68 = require("zod/mini");
|
|
19011
19186
|
|
|
19012
19187
|
// src/types/fetch-targets.ts
|
|
19013
|
-
var
|
|
19188
|
+
var import_mini67 = require("zod/mini");
|
|
19014
19189
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
19015
|
-
var FetchTargetSchema =
|
|
19190
|
+
var FetchTargetSchema = import_mini67.z.enum(ALL_FETCH_TARGETS);
|
|
19016
19191
|
|
|
19017
19192
|
// src/types/fetch.ts
|
|
19018
|
-
var ConflictStrategySchema =
|
|
19019
|
-
var GitHubFileTypeSchema =
|
|
19020
|
-
var GitHubFileEntrySchema =
|
|
19021
|
-
name:
|
|
19022
|
-
path:
|
|
19023
|
-
sha:
|
|
19024
|
-
size:
|
|
19193
|
+
var ConflictStrategySchema = import_mini68.z.enum(["skip", "overwrite"]);
|
|
19194
|
+
var GitHubFileTypeSchema = import_mini68.z.enum(["file", "dir", "symlink", "submodule"]);
|
|
19195
|
+
var GitHubFileEntrySchema = import_mini68.z.looseObject({
|
|
19196
|
+
name: import_mini68.z.string(),
|
|
19197
|
+
path: import_mini68.z.string(),
|
|
19198
|
+
sha: import_mini68.z.string(),
|
|
19199
|
+
size: import_mini68.z.number(),
|
|
19025
19200
|
type: GitHubFileTypeSchema,
|
|
19026
|
-
download_url:
|
|
19201
|
+
download_url: import_mini68.z.nullable(import_mini68.z.string())
|
|
19027
19202
|
});
|
|
19028
|
-
var FetchOptionsSchema =
|
|
19029
|
-
target:
|
|
19030
|
-
features:
|
|
19031
|
-
ref:
|
|
19032
|
-
path:
|
|
19033
|
-
output:
|
|
19034
|
-
conflict:
|
|
19035
|
-
token:
|
|
19036
|
-
verbose:
|
|
19037
|
-
silent:
|
|
19203
|
+
var FetchOptionsSchema = import_mini68.z.looseObject({
|
|
19204
|
+
target: import_mini68.z.optional(FetchTargetSchema),
|
|
19205
|
+
features: import_mini68.z.optional(import_mini68.z.array(import_mini68.z.enum(ALL_FEATURES_WITH_WILDCARD))),
|
|
19206
|
+
ref: import_mini68.z.optional(import_mini68.z.string()),
|
|
19207
|
+
path: import_mini68.z.optional(import_mini68.z.string()),
|
|
19208
|
+
output: import_mini68.z.optional(import_mini68.z.string()),
|
|
19209
|
+
conflict: import_mini68.z.optional(ConflictStrategySchema),
|
|
19210
|
+
token: import_mini68.z.optional(import_mini68.z.string()),
|
|
19211
|
+
verbose: import_mini68.z.optional(import_mini68.z.boolean()),
|
|
19212
|
+
silent: import_mini68.z.optional(import_mini68.z.boolean())
|
|
19038
19213
|
});
|
|
19039
|
-
var FetchFileStatusSchema =
|
|
19040
|
-
var GitHubRepoInfoSchema =
|
|
19041
|
-
default_branch:
|
|
19042
|
-
private:
|
|
19214
|
+
var FetchFileStatusSchema = import_mini68.z.enum(["created", "overwritten", "skipped"]);
|
|
19215
|
+
var GitHubRepoInfoSchema = import_mini68.z.looseObject({
|
|
19216
|
+
default_branch: import_mini68.z.string(),
|
|
19217
|
+
private: import_mini68.z.boolean()
|
|
19043
19218
|
});
|
|
19044
|
-
var GitHubReleaseAssetSchema =
|
|
19045
|
-
name:
|
|
19046
|
-
browser_download_url:
|
|
19047
|
-
size:
|
|
19219
|
+
var GitHubReleaseAssetSchema = import_mini68.z.looseObject({
|
|
19220
|
+
name: import_mini68.z.string(),
|
|
19221
|
+
browser_download_url: import_mini68.z.string(),
|
|
19222
|
+
size: import_mini68.z.number()
|
|
19048
19223
|
});
|
|
19049
|
-
var GitHubReleaseSchema =
|
|
19050
|
-
tag_name:
|
|
19051
|
-
name:
|
|
19052
|
-
prerelease:
|
|
19053
|
-
draft:
|
|
19054
|
-
assets:
|
|
19224
|
+
var GitHubReleaseSchema = import_mini68.z.looseObject({
|
|
19225
|
+
tag_name: import_mini68.z.string(),
|
|
19226
|
+
name: import_mini68.z.nullable(import_mini68.z.string()),
|
|
19227
|
+
prerelease: import_mini68.z.boolean(),
|
|
19228
|
+
draft: import_mini68.z.boolean(),
|
|
19229
|
+
assets: import_mini68.z.array(GitHubReleaseAssetSchema)
|
|
19055
19230
|
});
|
|
19056
19231
|
|
|
19057
19232
|
// src/lib/github-client.ts
|
|
@@ -19352,9 +19527,9 @@ async function listDirectoryRecursive(params) {
|
|
|
19352
19527
|
}
|
|
19353
19528
|
|
|
19354
19529
|
// src/types/git-provider.ts
|
|
19355
|
-
var
|
|
19530
|
+
var import_mini69 = require("zod/mini");
|
|
19356
19531
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
19357
|
-
var GitProviderSchema =
|
|
19532
|
+
var GitProviderSchema = import_mini69.z.enum(ALL_GIT_PROVIDERS);
|
|
19358
19533
|
|
|
19359
19534
|
// src/lib/source-parser.ts
|
|
19360
19535
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -19480,8 +19655,8 @@ async function processFeatureConversion(params) {
|
|
|
19480
19655
|
}
|
|
19481
19656
|
const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
19482
19657
|
for (const file of rulesyncFiles) {
|
|
19483
|
-
const relativePath = (0,
|
|
19484
|
-
const outputPath = (0,
|
|
19658
|
+
const relativePath = (0, import_node_path133.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
|
|
19659
|
+
const outputPath = (0, import_node_path133.join)(outputDir, relativePath);
|
|
19485
19660
|
await writeFileContent(outputPath, file.getFileContent());
|
|
19486
19661
|
paths.push(relativePath);
|
|
19487
19662
|
}
|
|
@@ -19629,7 +19804,7 @@ async function fetchFiles(params) {
|
|
|
19629
19804
|
skipped: 0
|
|
19630
19805
|
};
|
|
19631
19806
|
}
|
|
19632
|
-
const outputBasePath = (0,
|
|
19807
|
+
const outputBasePath = (0, import_node_path133.join)(baseDir, outputDir);
|
|
19633
19808
|
for (const { relativePath, size } of filesToFetch) {
|
|
19634
19809
|
checkPathTraversal({
|
|
19635
19810
|
relativePath,
|
|
@@ -19639,7 +19814,7 @@ async function fetchFiles(params) {
|
|
|
19639
19814
|
}
|
|
19640
19815
|
const results = await Promise.all(
|
|
19641
19816
|
filesToFetch.map(async ({ remotePath, relativePath }) => {
|
|
19642
|
-
const localPath = (0,
|
|
19817
|
+
const localPath = (0, import_node_path133.join)(outputBasePath, relativePath);
|
|
19643
19818
|
const exists = await fileExists(localPath);
|
|
19644
19819
|
if (exists && conflictStrategy === "skip") {
|
|
19645
19820
|
logger5.debug(`Skipping existing file: ${relativePath}`);
|
|
@@ -19681,7 +19856,7 @@ async function collectFeatureFiles(params) {
|
|
|
19681
19856
|
);
|
|
19682
19857
|
const results = await Promise.all(
|
|
19683
19858
|
tasks.map(async ({ featurePath }) => {
|
|
19684
|
-
const fullPath = basePath === "." || basePath === "" ? featurePath :
|
|
19859
|
+
const fullPath = basePath === "." || basePath === "" ? featurePath : import_node_path133.posix.join(basePath, featurePath);
|
|
19685
19860
|
const collected = [];
|
|
19686
19861
|
try {
|
|
19687
19862
|
if (featurePath.includes(".")) {
|
|
@@ -19783,7 +19958,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
19783
19958
|
relativePath: toolRelativePath,
|
|
19784
19959
|
intendedRootDir: tempDir
|
|
19785
19960
|
});
|
|
19786
|
-
const localPath = (0,
|
|
19961
|
+
const localPath = (0, import_node_path133.join)(tempDir, toolRelativePath);
|
|
19787
19962
|
const content = await withSemaphore(
|
|
19788
19963
|
semaphore,
|
|
19789
19964
|
() => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
|
|
@@ -19792,7 +19967,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
19792
19967
|
logger5.debug(`Fetched to temp: ${toolRelativePath}`);
|
|
19793
19968
|
})
|
|
19794
19969
|
);
|
|
19795
|
-
const outputBasePath = (0,
|
|
19970
|
+
const outputBasePath = (0, import_node_path133.join)(baseDir, outputDir);
|
|
19796
19971
|
const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
|
|
19797
19972
|
tempDir,
|
|
19798
19973
|
outputDir: outputBasePath,
|
|
@@ -19866,7 +20041,7 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
19866
20041
|
if (relativePath.startsWith("rules/")) {
|
|
19867
20042
|
const restPath = relativePath.substring("rules/".length);
|
|
19868
20043
|
if (toolPaths.rules?.nonRoot) {
|
|
19869
|
-
return (0,
|
|
20044
|
+
return (0, import_node_path133.join)(toolPaths.rules.nonRoot, restPath);
|
|
19870
20045
|
}
|
|
19871
20046
|
}
|
|
19872
20047
|
if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
|
|
@@ -19875,19 +20050,19 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
19875
20050
|
if (relativePath.startsWith("commands/")) {
|
|
19876
20051
|
const restPath = relativePath.substring("commands/".length);
|
|
19877
20052
|
if (toolPaths.commands) {
|
|
19878
|
-
return (0,
|
|
20053
|
+
return (0, import_node_path133.join)(toolPaths.commands, restPath);
|
|
19879
20054
|
}
|
|
19880
20055
|
}
|
|
19881
20056
|
if (relativePath.startsWith("subagents/")) {
|
|
19882
20057
|
const restPath = relativePath.substring("subagents/".length);
|
|
19883
20058
|
if (toolPaths.subagents) {
|
|
19884
|
-
return (0,
|
|
20059
|
+
return (0, import_node_path133.join)(toolPaths.subagents, restPath);
|
|
19885
20060
|
}
|
|
19886
20061
|
}
|
|
19887
20062
|
if (relativePath.startsWith("skills/")) {
|
|
19888
20063
|
const restPath = relativePath.substring("skills/".length);
|
|
19889
20064
|
if (toolPaths.skills) {
|
|
19890
|
-
return (0,
|
|
20065
|
+
return (0, import_node_path133.join)(toolPaths.skills, restPath);
|
|
19891
20066
|
}
|
|
19892
20067
|
}
|
|
19893
20068
|
return relativePath;
|
|
@@ -19972,12 +20147,12 @@ async function fetchCommand(logger5, options) {
|
|
|
19972
20147
|
}
|
|
19973
20148
|
|
|
19974
20149
|
// src/config/config-resolver.ts
|
|
19975
|
-
var
|
|
20150
|
+
var import_node_path135 = require("path");
|
|
19976
20151
|
var import_jsonc_parser4 = require("jsonc-parser");
|
|
19977
20152
|
|
|
19978
20153
|
// src/config/config.ts
|
|
19979
|
-
var
|
|
19980
|
-
var
|
|
20154
|
+
var import_node_path134 = require("path");
|
|
20155
|
+
var import_mini70 = require("zod/mini");
|
|
19981
20156
|
|
|
19982
20157
|
// src/utils/validation.ts
|
|
19983
20158
|
function findControlCharacter(value) {
|
|
@@ -19994,48 +20169,50 @@ function hasControlCharacters(value) {
|
|
|
19994
20169
|
}
|
|
19995
20170
|
|
|
19996
20171
|
// src/config/config.ts
|
|
19997
|
-
var
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
|
|
20004
|
-
(0,
|
|
20172
|
+
var GITIGNORE_DESTINATION_KEY = "gitignoreDestination";
|
|
20173
|
+
var SourceEntrySchema = import_mini70.z.object({
|
|
20174
|
+
source: import_mini70.z.string().check((0, import_mini70.minLength)(1, "source must be a non-empty string")),
|
|
20175
|
+
skills: (0, import_mini70.optional)(import_mini70.z.array(import_mini70.z.string())),
|
|
20176
|
+
transport: (0, import_mini70.optional)(import_mini70.z.enum(["github", "git"])),
|
|
20177
|
+
ref: (0, import_mini70.optional)(
|
|
20178
|
+
import_mini70.z.string().check(
|
|
20179
|
+
(0, import_mini70.refine)((v) => !v.startsWith("-"), 'ref must not start with "-"'),
|
|
20180
|
+
(0, import_mini70.refine)((v) => !hasControlCharacters(v), "ref must not contain control characters")
|
|
20005
20181
|
)
|
|
20006
20182
|
),
|
|
20007
|
-
path: (0,
|
|
20008
|
-
|
|
20009
|
-
(0,
|
|
20010
|
-
(0,
|
|
20011
|
-
(0,
|
|
20183
|
+
path: (0, import_mini70.optional)(
|
|
20184
|
+
import_mini70.z.string().check(
|
|
20185
|
+
(0, import_mini70.refine)((v) => !v.includes(".."), 'path must not contain ".."'),
|
|
20186
|
+
(0, import_mini70.refine)((v) => !(0, import_node_path134.isAbsolute)(v), "path must not be absolute"),
|
|
20187
|
+
(0, import_mini70.refine)((v) => !hasControlCharacters(v), "path must not contain control characters")
|
|
20012
20188
|
)
|
|
20013
20189
|
)
|
|
20014
20190
|
});
|
|
20015
|
-
var ConfigParamsSchema =
|
|
20016
|
-
baseDirs:
|
|
20191
|
+
var ConfigParamsSchema = import_mini70.z.object({
|
|
20192
|
+
baseDirs: import_mini70.z.array(import_mini70.z.string()),
|
|
20017
20193
|
targets: RulesyncConfigTargetsSchema,
|
|
20018
20194
|
features: RulesyncFeaturesSchema,
|
|
20019
|
-
verbose:
|
|
20020
|
-
delete:
|
|
20195
|
+
verbose: import_mini70.z.boolean(),
|
|
20196
|
+
delete: import_mini70.z.boolean(),
|
|
20021
20197
|
// New non-experimental options
|
|
20022
|
-
global: (0,
|
|
20023
|
-
silent: (0,
|
|
20024
|
-
simulateCommands: (0,
|
|
20025
|
-
simulateSubagents: (0,
|
|
20026
|
-
simulateSkills: (0,
|
|
20027
|
-
gitignoreTargetsOnly: (0,
|
|
20028
|
-
|
|
20029
|
-
|
|
20198
|
+
global: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20199
|
+
silent: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20200
|
+
simulateCommands: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20201
|
+
simulateSubagents: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20202
|
+
simulateSkills: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20203
|
+
gitignoreTargetsOnly: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20204
|
+
gitignoreDestination: (0, import_mini70.optional)(GitignoreDestinationSchema),
|
|
20205
|
+
dryRun: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20206
|
+
check: (0, import_mini70.optional)(import_mini70.z.boolean()),
|
|
20030
20207
|
// Declarative skill sources
|
|
20031
|
-
sources: (0,
|
|
20208
|
+
sources: (0, import_mini70.optional)(import_mini70.z.array(SourceEntrySchema))
|
|
20032
20209
|
});
|
|
20033
|
-
var PartialConfigParamsSchema =
|
|
20034
|
-
var ConfigFileSchema =
|
|
20035
|
-
$schema: (0,
|
|
20036
|
-
...
|
|
20210
|
+
var PartialConfigParamsSchema = import_mini70.z.partial(ConfigParamsSchema);
|
|
20211
|
+
var ConfigFileSchema = import_mini70.z.object({
|
|
20212
|
+
$schema: (0, import_mini70.optional)(import_mini70.z.string()),
|
|
20213
|
+
...import_mini70.z.partial(ConfigParamsSchema).shape
|
|
20037
20214
|
});
|
|
20038
|
-
var RequiredConfigParamsSchema =
|
|
20215
|
+
var RequiredConfigParamsSchema = import_mini70.z.required(ConfigParamsSchema);
|
|
20039
20216
|
var CONFLICTING_TARGET_PAIRS = [
|
|
20040
20217
|
["augmentcode", "augmentcode-legacy"],
|
|
20041
20218
|
["claudecode", "claudecode-legacy"]
|
|
@@ -20085,6 +20262,7 @@ var Config = class _Config {
|
|
|
20085
20262
|
simulateSubagents;
|
|
20086
20263
|
simulateSkills;
|
|
20087
20264
|
gitignoreTargetsOnly;
|
|
20265
|
+
gitignoreDestination;
|
|
20088
20266
|
dryRun;
|
|
20089
20267
|
check;
|
|
20090
20268
|
sources;
|
|
@@ -20100,6 +20278,7 @@ var Config = class _Config {
|
|
|
20100
20278
|
simulateSubagents,
|
|
20101
20279
|
simulateSkills,
|
|
20102
20280
|
gitignoreTargetsOnly,
|
|
20281
|
+
gitignoreDestination,
|
|
20103
20282
|
dryRun,
|
|
20104
20283
|
check,
|
|
20105
20284
|
sources
|
|
@@ -20125,6 +20304,7 @@ var Config = class _Config {
|
|
|
20125
20304
|
this.simulateSubagents = simulateSubagents ?? false;
|
|
20126
20305
|
this.simulateSkills = simulateSkills ?? false;
|
|
20127
20306
|
this.gitignoreTargetsOnly = gitignoreTargetsOnly ?? true;
|
|
20307
|
+
this.gitignoreDestination = gitignoreDestination ?? "gitignore";
|
|
20128
20308
|
this.dryRun = dryRun ?? false;
|
|
20129
20309
|
this.check = check ?? false;
|
|
20130
20310
|
this.sources = sources ?? [];
|
|
@@ -20282,6 +20462,36 @@ var Config = class _Config {
|
|
|
20282
20462
|
}
|
|
20283
20463
|
return void 0;
|
|
20284
20464
|
}
|
|
20465
|
+
getGitignoreDestination(target, feature) {
|
|
20466
|
+
const rootLevel = this.gitignoreDestination;
|
|
20467
|
+
if (!isRulesyncConfigTargetsObject(this.targets)) {
|
|
20468
|
+
return rootLevel;
|
|
20469
|
+
}
|
|
20470
|
+
const targetValue = this.targets[target];
|
|
20471
|
+
if (!targetValue || Array.isArray(targetValue)) {
|
|
20472
|
+
return rootLevel;
|
|
20473
|
+
}
|
|
20474
|
+
const perFeature = targetValue;
|
|
20475
|
+
const toolLevel = _Config.parseGitignoreDestination(perFeature[GITIGNORE_DESTINATION_KEY]);
|
|
20476
|
+
if (feature) {
|
|
20477
|
+
const featureValue = perFeature[feature];
|
|
20478
|
+
if (featureValue && typeof featureValue === "object" && !Array.isArray(featureValue)) {
|
|
20479
|
+
const featureLevel = _Config.parseGitignoreDestination(
|
|
20480
|
+
featureValue[GITIGNORE_DESTINATION_KEY]
|
|
20481
|
+
);
|
|
20482
|
+
if (featureLevel) {
|
|
20483
|
+
return featureLevel;
|
|
20484
|
+
}
|
|
20485
|
+
}
|
|
20486
|
+
}
|
|
20487
|
+
return toolLevel ?? rootLevel;
|
|
20488
|
+
}
|
|
20489
|
+
static parseGitignoreDestination(value) {
|
|
20490
|
+
if (value === "gitignore" || value === "gitattributes") {
|
|
20491
|
+
return value;
|
|
20492
|
+
}
|
|
20493
|
+
return void 0;
|
|
20494
|
+
}
|
|
20285
20495
|
/**
|
|
20286
20496
|
* Check if per-target features configuration is being used.
|
|
20287
20497
|
*/
|
|
@@ -20362,6 +20572,7 @@ var getDefaults = () => ({
|
|
|
20362
20572
|
simulateSubagents: false,
|
|
20363
20573
|
simulateSkills: false,
|
|
20364
20574
|
gitignoreTargetsOnly: true,
|
|
20575
|
+
gitignoreDestination: "gitignore",
|
|
20365
20576
|
dryRun: false,
|
|
20366
20577
|
check: false,
|
|
20367
20578
|
sources: []
|
|
@@ -20393,6 +20604,7 @@ var mergeConfigs = (baseConfig, localConfig) => {
|
|
|
20393
20604
|
simulateSubagents: localConfig.simulateSubagents ?? baseConfig.simulateSubagents,
|
|
20394
20605
|
simulateSkills: localConfig.simulateSkills ?? baseConfig.simulateSkills,
|
|
20395
20606
|
gitignoreTargetsOnly: localConfig.gitignoreTargetsOnly ?? baseConfig.gitignoreTargetsOnly,
|
|
20607
|
+
gitignoreDestination: localConfig.gitignoreDestination ?? baseConfig.gitignoreDestination,
|
|
20396
20608
|
dryRun: localConfig.dryRun ?? baseConfig.dryRun,
|
|
20397
20609
|
check: localConfig.check ?? baseConfig.check,
|
|
20398
20610
|
sources: localConfig.sources ?? baseConfig.sources
|
|
@@ -20413,12 +20625,13 @@ var ConfigResolver = class {
|
|
|
20413
20625
|
simulateSkills,
|
|
20414
20626
|
gitignoreTargetsOnly,
|
|
20415
20627
|
dryRun,
|
|
20416
|
-
check
|
|
20628
|
+
check,
|
|
20629
|
+
gitignoreDestination
|
|
20417
20630
|
}) {
|
|
20418
20631
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
20419
20632
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
20420
|
-
const configDir = (0,
|
|
20421
|
-
const localConfigPath = (0,
|
|
20633
|
+
const configDir = (0, import_node_path135.dirname)(validatedConfigPath);
|
|
20634
|
+
const localConfigPath = (0, import_node_path135.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
20422
20635
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
20423
20636
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
20424
20637
|
try {
|
|
@@ -20462,6 +20675,7 @@ var ConfigResolver = class {
|
|
|
20462
20675
|
simulateSubagents: resolvedSimulateSubagents,
|
|
20463
20676
|
simulateSkills: resolvedSimulateSkills,
|
|
20464
20677
|
gitignoreTargetsOnly: resolvedGitignoreTargetsOnly,
|
|
20678
|
+
gitignoreDestination: gitignoreDestination ?? configByFile.gitignoreDestination ?? getDefaults().gitignoreDestination,
|
|
20465
20679
|
dryRun: dryRun ?? configByFile.dryRun ?? getDefaults().dryRun,
|
|
20466
20680
|
check: check ?? configByFile.check ?? getDefaults().check,
|
|
20467
20681
|
sources: configByFile.sources ?? getDefaults().sources
|
|
@@ -20476,7 +20690,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
20476
20690
|
if (global) {
|
|
20477
20691
|
return [getHomeDirectory()];
|
|
20478
20692
|
}
|
|
20479
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
20693
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path135.resolve)(baseDir));
|
|
20480
20694
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
20481
20695
|
validateBaseDir(baseDir);
|
|
20482
20696
|
});
|
|
@@ -20484,28 +20698,28 @@ function getBaseDirsInLightOfGlobal({
|
|
|
20484
20698
|
}
|
|
20485
20699
|
|
|
20486
20700
|
// src/lib/generate.ts
|
|
20487
|
-
var
|
|
20701
|
+
var import_node_path142 = require("path");
|
|
20488
20702
|
var import_es_toolkit5 = require("es-toolkit");
|
|
20489
20703
|
|
|
20490
20704
|
// src/features/permissions/permissions-processor.ts
|
|
20491
|
-
var
|
|
20705
|
+
var import_mini75 = require("zod/mini");
|
|
20492
20706
|
|
|
20493
20707
|
// src/features/permissions/claudecode-permissions.ts
|
|
20494
|
-
var
|
|
20708
|
+
var import_node_path137 = require("path");
|
|
20495
20709
|
var import_es_toolkit4 = require("es-toolkit");
|
|
20496
20710
|
|
|
20497
20711
|
// src/features/permissions/rulesync-permissions.ts
|
|
20498
|
-
var
|
|
20712
|
+
var import_node_path136 = require("path");
|
|
20499
20713
|
|
|
20500
20714
|
// src/types/permissions.ts
|
|
20501
|
-
var
|
|
20502
|
-
var PermissionActionSchema =
|
|
20503
|
-
var PermissionRulesSchema =
|
|
20504
|
-
var PermissionsConfigSchema =
|
|
20505
|
-
permission:
|
|
20715
|
+
var import_mini71 = require("zod/mini");
|
|
20716
|
+
var PermissionActionSchema = import_mini71.z.enum(["allow", "ask", "deny"]);
|
|
20717
|
+
var PermissionRulesSchema = import_mini71.z.record(import_mini71.z.string(), PermissionActionSchema);
|
|
20718
|
+
var PermissionsConfigSchema = import_mini71.z.looseObject({
|
|
20719
|
+
permission: import_mini71.z.record(import_mini71.z.string(), PermissionRulesSchema)
|
|
20506
20720
|
});
|
|
20507
|
-
var RulesyncPermissionsFileSchema =
|
|
20508
|
-
$schema:
|
|
20721
|
+
var RulesyncPermissionsFileSchema = import_mini71.z.looseObject({
|
|
20722
|
+
$schema: import_mini71.z.optional(import_mini71.z.string()),
|
|
20509
20723
|
...PermissionsConfigSchema.shape
|
|
20510
20724
|
});
|
|
20511
20725
|
|
|
@@ -20540,7 +20754,7 @@ var RulesyncPermissions = class _RulesyncPermissions extends RulesyncFile {
|
|
|
20540
20754
|
validate = true
|
|
20541
20755
|
}) {
|
|
20542
20756
|
const paths = _RulesyncPermissions.getSettablePaths();
|
|
20543
|
-
const filePath = (0,
|
|
20757
|
+
const filePath = (0, import_node_path136.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20544
20758
|
if (!await fileExists(filePath)) {
|
|
20545
20759
|
throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
|
|
20546
20760
|
}
|
|
@@ -20648,7 +20862,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
20648
20862
|
validate = true
|
|
20649
20863
|
}) {
|
|
20650
20864
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
20651
|
-
const filePath = (0,
|
|
20865
|
+
const filePath = (0, import_node_path137.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20652
20866
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
20653
20867
|
return new _ClaudecodePermissions({
|
|
20654
20868
|
baseDir,
|
|
@@ -20664,7 +20878,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
20664
20878
|
logger: logger5
|
|
20665
20879
|
}) {
|
|
20666
20880
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
20667
|
-
const filePath = (0,
|
|
20881
|
+
const filePath = (0, import_node_path137.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20668
20882
|
const existingContent = await readOrInitializeFileContent(
|
|
20669
20883
|
filePath,
|
|
20670
20884
|
JSON.stringify({}, null, 2)
|
|
@@ -20741,7 +20955,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
20741
20955
|
settings = JSON.parse(this.getFileContent());
|
|
20742
20956
|
} catch (error) {
|
|
20743
20957
|
throw new Error(
|
|
20744
|
-
`Failed to parse Claude permissions content in ${(0,
|
|
20958
|
+
`Failed to parse Claude permissions content in ${(0, import_node_path137.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
20745
20959
|
{ cause: error }
|
|
20746
20960
|
);
|
|
20747
20961
|
}
|
|
@@ -20814,7 +21028,7 @@ function convertClaudeToRulesyncPermissions(params) {
|
|
|
20814
21028
|
}
|
|
20815
21029
|
|
|
20816
21030
|
// src/features/permissions/codexcli-permissions.ts
|
|
20817
|
-
var
|
|
21031
|
+
var import_node_path138 = require("path");
|
|
20818
21032
|
var smolToml5 = __toESM(require("smol-toml"), 1);
|
|
20819
21033
|
var RULESYNC_PROFILE_NAME = "rulesync";
|
|
20820
21034
|
var RULESYNC_BASH_RULES_FILE_NAME = "rulesync.rules";
|
|
@@ -20834,7 +21048,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
20834
21048
|
global = false
|
|
20835
21049
|
}) {
|
|
20836
21050
|
const paths = this.getSettablePaths({ global });
|
|
20837
|
-
const filePath = (0,
|
|
21051
|
+
const filePath = (0, import_node_path138.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20838
21052
|
const fileContent = await readFileContentOrNull(filePath) ?? smolToml5.stringify({});
|
|
20839
21053
|
return new _CodexcliPermissions({
|
|
20840
21054
|
baseDir,
|
|
@@ -20852,7 +21066,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
20852
21066
|
global = false
|
|
20853
21067
|
}) {
|
|
20854
21068
|
const paths = this.getSettablePaths({ global });
|
|
20855
|
-
const filePath = (0,
|
|
21069
|
+
const filePath = (0, import_node_path138.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20856
21070
|
const existingContent = await readFileContentOrNull(filePath) ?? smolToml5.stringify({});
|
|
20857
21071
|
const parsed = toMutableTable(smolToml5.parse(existingContent));
|
|
20858
21072
|
const profile = convertRulesyncToCodexProfile({
|
|
@@ -20877,7 +21091,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
20877
21091
|
parsed = smolToml5.parse(this.getFileContent());
|
|
20878
21092
|
} catch (error) {
|
|
20879
21093
|
throw new Error(
|
|
20880
|
-
`Failed to parse Codex CLI permissions content in ${(0,
|
|
21094
|
+
`Failed to parse Codex CLI permissions content in ${(0, import_node_path138.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
20881
21095
|
{ cause: error }
|
|
20882
21096
|
);
|
|
20883
21097
|
}
|
|
@@ -20918,7 +21132,7 @@ function createCodexcliBashRulesFile({
|
|
|
20918
21132
|
}) {
|
|
20919
21133
|
return new CodexcliRulesFile({
|
|
20920
21134
|
baseDir,
|
|
20921
|
-
relativeDirPath: (0,
|
|
21135
|
+
relativeDirPath: (0, import_node_path138.join)(".codex", "rules"),
|
|
20922
21136
|
relativeFilePath: RULESYNC_BASH_RULES_FILE_NAME,
|
|
20923
21137
|
fileContent: buildCodexBashRulesContent(config)
|
|
20924
21138
|
});
|
|
@@ -21073,13 +21287,13 @@ function mapBashActionToDecision(action) {
|
|
|
21073
21287
|
}
|
|
21074
21288
|
|
|
21075
21289
|
// src/features/permissions/geminicli-permissions.ts
|
|
21076
|
-
var
|
|
21077
|
-
var
|
|
21078
|
-
var GeminiCliSettingsSchema =
|
|
21079
|
-
tools:
|
|
21080
|
-
|
|
21081
|
-
allowed:
|
|
21082
|
-
exclude:
|
|
21290
|
+
var import_node_path139 = require("path");
|
|
21291
|
+
var import_mini72 = require("zod/mini");
|
|
21292
|
+
var GeminiCliSettingsSchema = import_mini72.z.looseObject({
|
|
21293
|
+
tools: import_mini72.z.optional(
|
|
21294
|
+
import_mini72.z.looseObject({
|
|
21295
|
+
allowed: import_mini72.z.optional(import_mini72.z.array(import_mini72.z.string())),
|
|
21296
|
+
exclude: import_mini72.z.optional(import_mini72.z.array(import_mini72.z.string()))
|
|
21083
21297
|
})
|
|
21084
21298
|
)
|
|
21085
21299
|
});
|
|
@@ -21106,7 +21320,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
21106
21320
|
global = false
|
|
21107
21321
|
}) {
|
|
21108
21322
|
const paths = this.getSettablePaths({ global });
|
|
21109
|
-
const filePath = (0,
|
|
21323
|
+
const filePath = (0, import_node_path139.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21110
21324
|
const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21111
21325
|
return new _GeminicliPermissions({
|
|
21112
21326
|
baseDir,
|
|
@@ -21124,7 +21338,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
21124
21338
|
global = false
|
|
21125
21339
|
}) {
|
|
21126
21340
|
const paths = this.getSettablePaths({ global });
|
|
21127
|
-
const filePath = (0,
|
|
21341
|
+
const filePath = (0, import_node_path139.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21128
21342
|
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21129
21343
|
const settingsResult = GeminiCliSettingsSchema.safeParse(JSON.parse(existingContent));
|
|
21130
21344
|
if (!settingsResult.success) {
|
|
@@ -21159,7 +21373,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
21159
21373
|
settings = GeminiCliSettingsSchema.parse(parsed);
|
|
21160
21374
|
} catch (error) {
|
|
21161
21375
|
throw new Error(
|
|
21162
|
-
`Failed to parse Gemini CLI permissions content in ${(0,
|
|
21376
|
+
`Failed to parse Gemini CLI permissions content in ${(0, import_node_path139.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
21163
21377
|
{ cause: error }
|
|
21164
21378
|
);
|
|
21165
21379
|
}
|
|
@@ -21237,17 +21451,17 @@ function parseGeminicliToolEntry({ entry }) {
|
|
|
21237
21451
|
}
|
|
21238
21452
|
|
|
21239
21453
|
// src/features/permissions/kiro-permissions.ts
|
|
21240
|
-
var
|
|
21241
|
-
var
|
|
21242
|
-
var KiroAgentSchema =
|
|
21243
|
-
allowedTools:
|
|
21244
|
-
toolsSettings:
|
|
21454
|
+
var import_node_path140 = require("path");
|
|
21455
|
+
var import_mini73 = require("zod/mini");
|
|
21456
|
+
var KiroAgentSchema = import_mini73.z.looseObject({
|
|
21457
|
+
allowedTools: import_mini73.z.optional(import_mini73.z.array(import_mini73.z.string())),
|
|
21458
|
+
toolsSettings: import_mini73.z.optional(import_mini73.z.record(import_mini73.z.string(), import_mini73.z.unknown()))
|
|
21245
21459
|
});
|
|
21246
|
-
var UnknownRecordSchema =
|
|
21460
|
+
var UnknownRecordSchema = import_mini73.z.record(import_mini73.z.string(), import_mini73.z.unknown());
|
|
21247
21461
|
var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
21248
21462
|
static getSettablePaths(_options = {}) {
|
|
21249
21463
|
return {
|
|
21250
|
-
relativeDirPath: (0,
|
|
21464
|
+
relativeDirPath: (0, import_node_path140.join)(".kiro", "agents"),
|
|
21251
21465
|
relativeFilePath: "default.json"
|
|
21252
21466
|
};
|
|
21253
21467
|
}
|
|
@@ -21259,7 +21473,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
21259
21473
|
validate = true
|
|
21260
21474
|
}) {
|
|
21261
21475
|
const paths = this.getSettablePaths();
|
|
21262
|
-
const filePath = (0,
|
|
21476
|
+
const filePath = (0, import_node_path140.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21263
21477
|
const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21264
21478
|
return new _KiroPermissions({
|
|
21265
21479
|
baseDir,
|
|
@@ -21276,7 +21490,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
21276
21490
|
logger: logger5
|
|
21277
21491
|
}) {
|
|
21278
21492
|
const paths = this.getSettablePaths();
|
|
21279
|
-
const filePath = (0,
|
|
21493
|
+
const filePath = (0, import_node_path140.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21280
21494
|
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21281
21495
|
const parsedResult = KiroAgentSchema.safeParse(JSON.parse(existingContent));
|
|
21282
21496
|
if (!parsedResult.success) {
|
|
@@ -21300,7 +21514,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
21300
21514
|
parsed = KiroAgentSchema.parse(JSON.parse(this.getFileContent()));
|
|
21301
21515
|
} catch (error) {
|
|
21302
21516
|
throw new Error(
|
|
21303
|
-
`Failed to parse Kiro permissions content in ${(0,
|
|
21517
|
+
`Failed to parse Kiro permissions content in ${(0, import_node_path140.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
21304
21518
|
{ cause: error }
|
|
21305
21519
|
);
|
|
21306
21520
|
}
|
|
@@ -21421,15 +21635,15 @@ function asStringArray(value) {
|
|
|
21421
21635
|
}
|
|
21422
21636
|
|
|
21423
21637
|
// src/features/permissions/opencode-permissions.ts
|
|
21424
|
-
var
|
|
21638
|
+
var import_node_path141 = require("path");
|
|
21425
21639
|
var import_jsonc_parser5 = require("jsonc-parser");
|
|
21426
|
-
var
|
|
21427
|
-
var OpencodePermissionSchema =
|
|
21428
|
-
|
|
21429
|
-
|
|
21640
|
+
var import_mini74 = require("zod/mini");
|
|
21641
|
+
var OpencodePermissionSchema = import_mini74.z.union([
|
|
21642
|
+
import_mini74.z.enum(["allow", "ask", "deny"]),
|
|
21643
|
+
import_mini74.z.record(import_mini74.z.string(), import_mini74.z.enum(["allow", "ask", "deny"]))
|
|
21430
21644
|
]);
|
|
21431
|
-
var OpencodePermissionsConfigSchema =
|
|
21432
|
-
permission:
|
|
21645
|
+
var OpencodePermissionsConfigSchema = import_mini74.z.looseObject({
|
|
21646
|
+
permission: import_mini74.z.optional(import_mini74.z.record(import_mini74.z.string(), OpencodePermissionSchema))
|
|
21433
21647
|
});
|
|
21434
21648
|
var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
21435
21649
|
json;
|
|
@@ -21446,7 +21660,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
21446
21660
|
static getSettablePaths({
|
|
21447
21661
|
global = false
|
|
21448
21662
|
} = {}) {
|
|
21449
|
-
return global ? { relativeDirPath: (0,
|
|
21663
|
+
return global ? { relativeDirPath: (0, import_node_path141.join)(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
|
|
21450
21664
|
}
|
|
21451
21665
|
static async fromFile({
|
|
21452
21666
|
baseDir = process.cwd(),
|
|
@@ -21454,9 +21668,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
21454
21668
|
global = false
|
|
21455
21669
|
}) {
|
|
21456
21670
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
21457
|
-
const jsonDir = (0,
|
|
21458
|
-
const jsoncPath = (0,
|
|
21459
|
-
const jsonPath = (0,
|
|
21671
|
+
const jsonDir = (0, import_node_path141.join)(baseDir, basePaths.relativeDirPath);
|
|
21672
|
+
const jsoncPath = (0, import_node_path141.join)(jsonDir, "opencode.jsonc");
|
|
21673
|
+
const jsonPath = (0, import_node_path141.join)(jsonDir, "opencode.json");
|
|
21460
21674
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
21461
21675
|
let relativeFilePath = "opencode.jsonc";
|
|
21462
21676
|
if (!fileContent) {
|
|
@@ -21481,9 +21695,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
21481
21695
|
global = false
|
|
21482
21696
|
}) {
|
|
21483
21697
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
21484
|
-
const jsonDir = (0,
|
|
21485
|
-
const jsoncPath = (0,
|
|
21486
|
-
const jsonPath = (0,
|
|
21698
|
+
const jsonDir = (0, import_node_path141.join)(baseDir, basePaths.relativeDirPath);
|
|
21699
|
+
const jsoncPath = (0, import_node_path141.join)(jsonDir, "opencode.jsonc");
|
|
21700
|
+
const jsonPath = (0, import_node_path141.join)(jsonDir, "opencode.json");
|
|
21487
21701
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
21488
21702
|
let relativeFilePath = "opencode.jsonc";
|
|
21489
21703
|
if (!fileContent) {
|
|
@@ -21560,7 +21774,7 @@ var permissionsProcessorToolTargetTuple = [
|
|
|
21560
21774
|
"kiro",
|
|
21561
21775
|
"opencode"
|
|
21562
21776
|
];
|
|
21563
|
-
var PermissionsProcessorToolTargetSchema =
|
|
21777
|
+
var PermissionsProcessorToolTargetSchema = import_mini75.z.enum(permissionsProcessorToolTargetTuple);
|
|
21564
21778
|
var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
21565
21779
|
[
|
|
21566
21780
|
"claudecode",
|
|
@@ -21795,7 +22009,7 @@ function warnUnsupportedTargets(params) {
|
|
|
21795
22009
|
}
|
|
21796
22010
|
}
|
|
21797
22011
|
async function checkRulesyncDirExists(params) {
|
|
21798
|
-
return fileExists((0,
|
|
22012
|
+
return fileExists((0, import_node_path142.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
21799
22013
|
}
|
|
21800
22014
|
async function generate(params) {
|
|
21801
22015
|
const { config, logger: logger5 } = params;
|
|
@@ -22265,7 +22479,7 @@ async function generateCommand(logger5, options) {
|
|
|
22265
22479
|
}
|
|
22266
22480
|
|
|
22267
22481
|
// src/cli/commands/gitignore.ts
|
|
22268
|
-
var
|
|
22482
|
+
var import_node_path143 = require("path");
|
|
22269
22483
|
|
|
22270
22484
|
// src/cli/commands/gitignore-entries.ts
|
|
22271
22485
|
var normalizeGitignoreEntryTargets = (target) => {
|
|
@@ -22450,6 +22664,9 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
22450
22664
|
entry: "**/.rovodev/.rulesync/"
|
|
22451
22665
|
},
|
|
22452
22666
|
{ target: "rovodev", feature: "skills", entry: "**/.agents/skills/" },
|
|
22667
|
+
// Windsurf
|
|
22668
|
+
{ target: "windsurf", feature: "skills", entry: "**/.windsurf/skills/" },
|
|
22669
|
+
{ target: "windsurf", feature: "skills", entry: "**/.codeium/windsurf/skills/" },
|
|
22453
22670
|
// Warp
|
|
22454
22671
|
{ target: "warp", feature: "rules", entry: "**/.warp/" },
|
|
22455
22672
|
{ target: "warp", feature: "rules", entry: "**/WARP.md" }
|
|
@@ -22529,13 +22746,14 @@ var warnInvalidFeatures = (features, logger5) => {
|
|
|
22529
22746
|
}
|
|
22530
22747
|
} else {
|
|
22531
22748
|
for (const feature of Object.keys(targetFeatures)) {
|
|
22749
|
+
if (feature === GITIGNORE_DESTINATION_KEY) continue;
|
|
22532
22750
|
warnOnce(feature);
|
|
22533
22751
|
}
|
|
22534
22752
|
}
|
|
22535
22753
|
}
|
|
22536
22754
|
}
|
|
22537
22755
|
};
|
|
22538
|
-
var
|
|
22756
|
+
var resolveGitignoreEntries = (params) => {
|
|
22539
22757
|
const { targets, features, logger: logger5 } = params ?? {};
|
|
22540
22758
|
if (targets && targets.length > 0) {
|
|
22541
22759
|
warnInvalidTargets(targets, logger5);
|
|
@@ -22551,7 +22769,11 @@ var filterGitignoreEntries = (params) => {
|
|
|
22551
22769
|
if (!isFeatureSelected(tag.feature, selectedTagTargets, features)) continue;
|
|
22552
22770
|
if (seen.has(tag.entry)) continue;
|
|
22553
22771
|
seen.add(tag.entry);
|
|
22554
|
-
result.push(
|
|
22772
|
+
result.push({
|
|
22773
|
+
entry: tag.entry,
|
|
22774
|
+
target: selectedTagTargets,
|
|
22775
|
+
feature: tag.feature
|
|
22776
|
+
});
|
|
22555
22777
|
}
|
|
22556
22778
|
return result;
|
|
22557
22779
|
};
|
|
@@ -22608,48 +22830,129 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
22608
22830
|
}
|
|
22609
22831
|
return result;
|
|
22610
22832
|
};
|
|
22611
|
-
var
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22833
|
+
var groupEntriesByDestination = ({
|
|
22834
|
+
entries,
|
|
22835
|
+
resolveDestination
|
|
22836
|
+
}) => {
|
|
22837
|
+
const gitignore = /* @__PURE__ */ new Set();
|
|
22838
|
+
const gitattributes = /* @__PURE__ */ new Set();
|
|
22839
|
+
for (const entry of entries) {
|
|
22840
|
+
const selectedToolTargets = entry.target.filter(
|
|
22841
|
+
(target) => target !== "common"
|
|
22842
|
+
);
|
|
22843
|
+
const destinations = /* @__PURE__ */ new Set();
|
|
22844
|
+
for (const target of selectedToolTargets) {
|
|
22845
|
+
if (entry.feature === "general") {
|
|
22846
|
+
destinations.add(resolveDestination(target));
|
|
22847
|
+
} else {
|
|
22848
|
+
destinations.add(resolveDestination(target, entry.feature));
|
|
22849
|
+
}
|
|
22850
|
+
}
|
|
22851
|
+
if (destinations.has("gitattributes")) {
|
|
22852
|
+
gitattributes.add(entry.entry);
|
|
22853
|
+
}
|
|
22854
|
+
if (destinations.size === 0 || destinations.has("gitignore")) {
|
|
22855
|
+
gitignore.add(entry.entry);
|
|
22856
|
+
}
|
|
22616
22857
|
}
|
|
22617
|
-
|
|
22618
|
-
|
|
22858
|
+
return {
|
|
22859
|
+
gitignore: [...gitignore],
|
|
22860
|
+
gitattributes: [...gitattributes]
|
|
22861
|
+
};
|
|
22862
|
+
};
|
|
22863
|
+
var gitignoreCommand = async (logger5, options) => {
|
|
22864
|
+
const gitignorePath = (0, import_node_path143.join)(process.cwd(), ".gitignore");
|
|
22865
|
+
const gitattributesPath = (0, import_node_path143.join)(process.cwd(), ".gitattributes");
|
|
22866
|
+
const config = await ConfigResolver.resolve({});
|
|
22867
|
+
const resolvedEntries = resolveGitignoreEntries({
|
|
22619
22868
|
targets: options?.targets,
|
|
22620
22869
|
features: options?.features,
|
|
22621
22870
|
logger: logger5
|
|
22622
22871
|
});
|
|
22623
|
-
const
|
|
22624
|
-
|
|
22625
|
-
|
|
22626
|
-
|
|
22627
|
-
|
|
22628
|
-
|
|
22629
|
-
|
|
22872
|
+
const { gitignore: gitignoreEntries, gitattributes: gitattributesEntries } = groupEntriesByDestination({
|
|
22873
|
+
entries: resolvedEntries,
|
|
22874
|
+
resolveDestination: (target, feature) => {
|
|
22875
|
+
if (feature === void 0 || feature === "general") {
|
|
22876
|
+
return config.getGitignoreDestination(target);
|
|
22877
|
+
}
|
|
22878
|
+
return config.getGitignoreDestination(target, feature);
|
|
22879
|
+
}
|
|
22880
|
+
});
|
|
22881
|
+
const updateRulesyncFile = async ({
|
|
22882
|
+
filePath,
|
|
22883
|
+
entries
|
|
22884
|
+
}) => {
|
|
22885
|
+
let content = "";
|
|
22886
|
+
if (await fileExists(filePath)) {
|
|
22887
|
+
content = await readFileContent(filePath);
|
|
22888
|
+
}
|
|
22889
|
+
const cleanedContent = removeExistingRulesyncEntries(content);
|
|
22890
|
+
const existingEntries = new Set(
|
|
22891
|
+
content.split("\n").map((line) => line.trim()).filter((line) => line !== "" && !isRulesyncHeader(line))
|
|
22892
|
+
);
|
|
22893
|
+
const alreadyExistedEntries = entries.filter((entry) => existingEntries.has(entry));
|
|
22894
|
+
const entriesToAdd = entries.filter((entry) => !existingEntries.has(entry));
|
|
22895
|
+
const rulesyncBlock = [RULESYNC_HEADER, ...entries].join("\n");
|
|
22896
|
+
const newContent = entries.length === 0 ? cleanedContent.trim() ? `${cleanedContent.trimEnd()}
|
|
22897
|
+
` : "" : cleanedContent.trim() ? `${cleanedContent.trimEnd()}
|
|
22630
22898
|
|
|
22631
22899
|
${rulesyncBlock}
|
|
22632
22900
|
` : `${rulesyncBlock}
|
|
22633
22901
|
`;
|
|
22634
|
-
|
|
22902
|
+
if (content === newContent) {
|
|
22903
|
+
return { updated: false, alreadyExistedEntries, entriesToAdd: [] };
|
|
22904
|
+
}
|
|
22905
|
+
await writeFileContent(filePath, newContent);
|
|
22906
|
+
return { updated: true, alreadyExistedEntries, entriesToAdd };
|
|
22907
|
+
};
|
|
22908
|
+
const gitignoreResult = await updateRulesyncFile({
|
|
22909
|
+
filePath: gitignorePath,
|
|
22910
|
+
entries: gitignoreEntries
|
|
22911
|
+
});
|
|
22912
|
+
const gitattributesResult = await updateRulesyncFile({
|
|
22913
|
+
filePath: gitattributesPath,
|
|
22914
|
+
entries: gitattributesEntries
|
|
22915
|
+
});
|
|
22916
|
+
if (!gitignoreResult.updated && !gitattributesResult.updated) {
|
|
22635
22917
|
if (logger5.jsonMode) {
|
|
22636
22918
|
logger5.captureData("entriesAdded", []);
|
|
22637
22919
|
logger5.captureData("gitignorePath", gitignorePath);
|
|
22638
|
-
logger5.captureData("
|
|
22920
|
+
logger5.captureData("gitattributesPath", gitattributesPath);
|
|
22921
|
+
logger5.captureData("alreadyExisted", [...gitignoreEntries, ...gitattributesEntries]);
|
|
22639
22922
|
}
|
|
22640
|
-
logger5.success(".gitignore
|
|
22923
|
+
logger5.success(".gitignore / .gitattributes are already up to date");
|
|
22641
22924
|
return;
|
|
22642
22925
|
}
|
|
22643
|
-
await writeFileContent(gitignorePath, newContent);
|
|
22644
22926
|
if (logger5.jsonMode) {
|
|
22645
|
-
logger5.captureData("entriesAdded",
|
|
22927
|
+
logger5.captureData("entriesAdded", [
|
|
22928
|
+
...gitignoreResult.entriesToAdd,
|
|
22929
|
+
...gitattributesResult.entriesToAdd
|
|
22930
|
+
]);
|
|
22646
22931
|
logger5.captureData("gitignorePath", gitignorePath);
|
|
22647
|
-
logger5.captureData("
|
|
22932
|
+
logger5.captureData("gitattributesPath", gitattributesPath);
|
|
22933
|
+
logger5.captureData("alreadyExisted", [
|
|
22934
|
+
...gitignoreResult.alreadyExistedEntries,
|
|
22935
|
+
...gitattributesResult.alreadyExistedEntries
|
|
22936
|
+
]);
|
|
22937
|
+
}
|
|
22938
|
+
if (gitignoreResult.updated) {
|
|
22939
|
+
logger5.success("Updated .gitignore with rulesync entries:");
|
|
22940
|
+
} else {
|
|
22941
|
+
logger5.success(".gitignore is already up to date");
|
|
22648
22942
|
}
|
|
22649
|
-
|
|
22650
|
-
for (const entry of filteredEntries) {
|
|
22943
|
+
for (const entry of gitignoreEntries) {
|
|
22651
22944
|
logger5.info(` ${entry}`);
|
|
22652
22945
|
}
|
|
22946
|
+
if (gitattributesEntries.length > 0) {
|
|
22947
|
+
if (gitattributesResult.updated) {
|
|
22948
|
+
logger5.success("Updated .gitattributes with rulesync entries:");
|
|
22949
|
+
} else {
|
|
22950
|
+
logger5.success(".gitattributes is already up to date");
|
|
22951
|
+
}
|
|
22952
|
+
for (const entry of gitattributesEntries) {
|
|
22953
|
+
logger5.info(` ${entry}`);
|
|
22954
|
+
}
|
|
22955
|
+
}
|
|
22653
22956
|
logger5.info("");
|
|
22654
22957
|
logger5.info(
|
|
22655
22958
|
"\u{1F4A1} If you're using Google Antigravity, note that rules, workflows, and skills won't load if they're gitignored."
|
|
@@ -22976,7 +23279,7 @@ async function importCommand(logger5, options) {
|
|
|
22976
23279
|
}
|
|
22977
23280
|
|
|
22978
23281
|
// src/lib/init.ts
|
|
22979
|
-
var
|
|
23282
|
+
var import_node_path144 = require("path");
|
|
22980
23283
|
async function init() {
|
|
22981
23284
|
const sampleFiles = await createSampleFiles();
|
|
22982
23285
|
const configFile = await createConfigFile();
|
|
@@ -23169,27 +23472,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
23169
23472
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
23170
23473
|
await ensureDir(skillPaths.relativeDirPath);
|
|
23171
23474
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
23172
|
-
const ruleFilepath = (0,
|
|
23475
|
+
const ruleFilepath = (0, import_node_path144.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
23173
23476
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
23174
|
-
const mcpFilepath = (0,
|
|
23477
|
+
const mcpFilepath = (0, import_node_path144.join)(
|
|
23175
23478
|
mcpPaths.recommended.relativeDirPath,
|
|
23176
23479
|
mcpPaths.recommended.relativeFilePath
|
|
23177
23480
|
);
|
|
23178
23481
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
23179
|
-
const commandFilepath = (0,
|
|
23482
|
+
const commandFilepath = (0, import_node_path144.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
23180
23483
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
23181
|
-
const subagentFilepath = (0,
|
|
23484
|
+
const subagentFilepath = (0, import_node_path144.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
23182
23485
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
23183
|
-
const skillDirPath = (0,
|
|
23486
|
+
const skillDirPath = (0, import_node_path144.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
23184
23487
|
await ensureDir(skillDirPath);
|
|
23185
|
-
const skillFilepath = (0,
|
|
23488
|
+
const skillFilepath = (0, import_node_path144.join)(skillDirPath, SKILL_FILE_NAME);
|
|
23186
23489
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
23187
|
-
const ignoreFilepath = (0,
|
|
23490
|
+
const ignoreFilepath = (0, import_node_path144.join)(
|
|
23188
23491
|
ignorePaths.recommended.relativeDirPath,
|
|
23189
23492
|
ignorePaths.recommended.relativeFilePath
|
|
23190
23493
|
);
|
|
23191
23494
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
23192
|
-
const hooksFilepath = (0,
|
|
23495
|
+
const hooksFilepath = (0, import_node_path144.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
23193
23496
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
23194
23497
|
return results;
|
|
23195
23498
|
}
|
|
@@ -23237,12 +23540,12 @@ async function initCommand(logger5) {
|
|
|
23237
23540
|
}
|
|
23238
23541
|
|
|
23239
23542
|
// src/lib/sources.ts
|
|
23240
|
-
var
|
|
23543
|
+
var import_node_path147 = require("path");
|
|
23241
23544
|
var import_promise2 = require("es-toolkit/promise");
|
|
23242
23545
|
|
|
23243
23546
|
// src/lib/git-client.ts
|
|
23244
23547
|
var import_node_child_process = require("child_process");
|
|
23245
|
-
var
|
|
23548
|
+
var import_node_path145 = require("path");
|
|
23246
23549
|
var import_node_util2 = require("util");
|
|
23247
23550
|
var execFileAsync = (0, import_node_util2.promisify)(import_node_child_process.execFile);
|
|
23248
23551
|
var GIT_TIMEOUT_MS = 6e4;
|
|
@@ -23330,7 +23633,7 @@ async function fetchSkillFiles(params) {
|
|
|
23330
23633
|
const { url, ref, skillsPath, logger: logger5 } = params;
|
|
23331
23634
|
validateGitUrl(url, { logger: logger5 });
|
|
23332
23635
|
validateRef(ref);
|
|
23333
|
-
if (skillsPath.split(/[/\\]/).includes("..") || (0,
|
|
23636
|
+
if (skillsPath.split(/[/\\]/).includes("..") || (0, import_node_path145.isAbsolute)(skillsPath)) {
|
|
23334
23637
|
throw new GitClientError(
|
|
23335
23638
|
`Invalid skillsPath "${skillsPath}": must be a relative path without ".."`
|
|
23336
23639
|
);
|
|
@@ -23364,7 +23667,7 @@ async function fetchSkillFiles(params) {
|
|
|
23364
23667
|
timeout: GIT_TIMEOUT_MS
|
|
23365
23668
|
});
|
|
23366
23669
|
await execFileAsync("git", ["-C", tmpDir, "checkout"], { timeout: GIT_TIMEOUT_MS });
|
|
23367
|
-
const skillsDir = (0,
|
|
23670
|
+
const skillsDir = (0, import_node_path145.join)(tmpDir, skillsPath);
|
|
23368
23671
|
if (!await directoryExists(skillsDir)) return [];
|
|
23369
23672
|
return await walkDirectory(skillsDir, skillsDir, 0, { totalFiles: 0, totalSize: 0 }, logger5);
|
|
23370
23673
|
} catch (error) {
|
|
@@ -23386,7 +23689,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
23386
23689
|
const results = [];
|
|
23387
23690
|
for (const name of await listDirectoryFiles(dir)) {
|
|
23388
23691
|
if (name === ".git") continue;
|
|
23389
|
-
const fullPath = (0,
|
|
23692
|
+
const fullPath = (0, import_node_path145.join)(dir, name);
|
|
23390
23693
|
if (await isSymlink(fullPath)) {
|
|
23391
23694
|
logger5?.warn(`Skipping symlink "${fullPath}".`);
|
|
23392
23695
|
continue;
|
|
@@ -23414,7 +23717,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
23414
23717
|
);
|
|
23415
23718
|
}
|
|
23416
23719
|
const content = await readFileContent(fullPath);
|
|
23417
|
-
results.push({ relativePath: (0,
|
|
23720
|
+
results.push({ relativePath: (0, import_node_path145.relative)(baseDir, fullPath), content, size });
|
|
23418
23721
|
}
|
|
23419
23722
|
}
|
|
23420
23723
|
return results;
|
|
@@ -23422,28 +23725,28 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
23422
23725
|
|
|
23423
23726
|
// src/lib/sources-lock.ts
|
|
23424
23727
|
var import_node_crypto = require("crypto");
|
|
23425
|
-
var
|
|
23426
|
-
var
|
|
23728
|
+
var import_node_path146 = require("path");
|
|
23729
|
+
var import_mini76 = require("zod/mini");
|
|
23427
23730
|
var LOCKFILE_VERSION = 1;
|
|
23428
|
-
var LockedSkillSchema =
|
|
23429
|
-
integrity:
|
|
23731
|
+
var LockedSkillSchema = import_mini76.z.object({
|
|
23732
|
+
integrity: import_mini76.z.string()
|
|
23430
23733
|
});
|
|
23431
|
-
var LockedSourceSchema =
|
|
23432
|
-
requestedRef: (0,
|
|
23433
|
-
resolvedRef:
|
|
23434
|
-
resolvedAt: (0,
|
|
23435
|
-
skills:
|
|
23734
|
+
var LockedSourceSchema = import_mini76.z.object({
|
|
23735
|
+
requestedRef: (0, import_mini76.optional)(import_mini76.z.string()),
|
|
23736
|
+
resolvedRef: import_mini76.z.string().check((0, import_mini76.refine)((v) => /^[0-9a-f]{40}$/.test(v), "resolvedRef must be a 40-character hex SHA")),
|
|
23737
|
+
resolvedAt: (0, import_mini76.optional)(import_mini76.z.string()),
|
|
23738
|
+
skills: import_mini76.z.record(import_mini76.z.string(), LockedSkillSchema)
|
|
23436
23739
|
});
|
|
23437
|
-
var SourcesLockSchema =
|
|
23438
|
-
lockfileVersion:
|
|
23439
|
-
sources:
|
|
23740
|
+
var SourcesLockSchema = import_mini76.z.object({
|
|
23741
|
+
lockfileVersion: import_mini76.z.number(),
|
|
23742
|
+
sources: import_mini76.z.record(import_mini76.z.string(), LockedSourceSchema)
|
|
23440
23743
|
});
|
|
23441
|
-
var LegacyLockedSourceSchema =
|
|
23442
|
-
resolvedRef:
|
|
23443
|
-
skills:
|
|
23744
|
+
var LegacyLockedSourceSchema = import_mini76.z.object({
|
|
23745
|
+
resolvedRef: import_mini76.z.string(),
|
|
23746
|
+
skills: import_mini76.z.array(import_mini76.z.string())
|
|
23444
23747
|
});
|
|
23445
|
-
var LegacySourcesLockSchema =
|
|
23446
|
-
sources:
|
|
23748
|
+
var LegacySourcesLockSchema = import_mini76.z.object({
|
|
23749
|
+
sources: import_mini76.z.record(import_mini76.z.string(), LegacyLockedSourceSchema)
|
|
23447
23750
|
});
|
|
23448
23751
|
function migrateLegacyLock(params) {
|
|
23449
23752
|
const { legacy, logger: logger5 } = params;
|
|
@@ -23468,7 +23771,7 @@ function createEmptyLock() {
|
|
|
23468
23771
|
}
|
|
23469
23772
|
async function readLockFile(params) {
|
|
23470
23773
|
const { logger: logger5 } = params;
|
|
23471
|
-
const lockPath = (0,
|
|
23774
|
+
const lockPath = (0, import_node_path146.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
23472
23775
|
if (!await fileExists(lockPath)) {
|
|
23473
23776
|
logger5.debug("No sources lockfile found, starting fresh.");
|
|
23474
23777
|
return createEmptyLock();
|
|
@@ -23497,7 +23800,7 @@ async function readLockFile(params) {
|
|
|
23497
23800
|
}
|
|
23498
23801
|
async function writeLockFile(params) {
|
|
23499
23802
|
const { logger: logger5 } = params;
|
|
23500
|
-
const lockPath = (0,
|
|
23803
|
+
const lockPath = (0, import_node_path146.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
23501
23804
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
23502
23805
|
await writeFileContent(lockPath, content);
|
|
23503
23806
|
logger5.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -23671,7 +23974,7 @@ function logGitClientHints(params) {
|
|
|
23671
23974
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
23672
23975
|
if (skillNames.length === 0) return true;
|
|
23673
23976
|
for (const name of skillNames) {
|
|
23674
|
-
if (!await directoryExists((0,
|
|
23977
|
+
if (!await directoryExists((0, import_node_path147.join)(curatedDir, name))) {
|
|
23675
23978
|
return false;
|
|
23676
23979
|
}
|
|
23677
23980
|
}
|
|
@@ -23679,10 +23982,10 @@ async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
|
23679
23982
|
}
|
|
23680
23983
|
async function cleanPreviousCuratedSkills(params) {
|
|
23681
23984
|
const { curatedDir, lockedSkillNames, logger: logger5 } = params;
|
|
23682
|
-
const resolvedCuratedDir = (0,
|
|
23985
|
+
const resolvedCuratedDir = (0, import_node_path147.resolve)(curatedDir);
|
|
23683
23986
|
for (const prevSkill of lockedSkillNames) {
|
|
23684
|
-
const prevDir = (0,
|
|
23685
|
-
if (!(0,
|
|
23987
|
+
const prevDir = (0, import_node_path147.join)(curatedDir, prevSkill);
|
|
23988
|
+
if (!(0, import_node_path147.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path147.sep)) {
|
|
23686
23989
|
logger5.warn(
|
|
23687
23990
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
23688
23991
|
);
|
|
@@ -23721,9 +24024,9 @@ async function writeSkillAndComputeIntegrity(params) {
|
|
|
23721
24024
|
for (const file of files) {
|
|
23722
24025
|
checkPathTraversal({
|
|
23723
24026
|
relativePath: file.relativePath,
|
|
23724
|
-
intendedRootDir: (0,
|
|
24027
|
+
intendedRootDir: (0, import_node_path147.join)(curatedDir, skillName)
|
|
23725
24028
|
});
|
|
23726
|
-
await writeFileContent((0,
|
|
24029
|
+
await writeFileContent((0, import_node_path147.join)(curatedDir, skillName, file.relativePath), file.content);
|
|
23727
24030
|
written.push({ path: file.relativePath, content: file.content });
|
|
23728
24031
|
}
|
|
23729
24032
|
const integrity = computeSkillIntegrity(written);
|
|
@@ -23800,7 +24103,7 @@ async function fetchSource(params) {
|
|
|
23800
24103
|
ref = resolvedSha;
|
|
23801
24104
|
logger5.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
23802
24105
|
}
|
|
23803
|
-
const curatedDir = (0,
|
|
24106
|
+
const curatedDir = (0, import_node_path147.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
23804
24107
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
23805
24108
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
23806
24109
|
if (allExist) {
|
|
@@ -23925,7 +24228,7 @@ async function fetchSourceViaGit(params) {
|
|
|
23925
24228
|
requestedRef = def.ref;
|
|
23926
24229
|
resolvedSha = def.sha;
|
|
23927
24230
|
}
|
|
23928
|
-
const curatedDir = (0,
|
|
24231
|
+
const curatedDir = (0, import_node_path147.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
23929
24232
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
23930
24233
|
if (await checkLockedSkillsExist(curatedDir, lockedSkillNames)) {
|
|
23931
24234
|
return { skillCount: 0, fetchedSkillNames: lockedSkillNames, updatedLock: lock };
|
|
@@ -23958,6 +24261,18 @@ async function fetchSourceViaGit(params) {
|
|
|
23958
24261
|
arr.push({ relativePath: inner, content: file.content });
|
|
23959
24262
|
skillFileMap.set(name, arr);
|
|
23960
24263
|
}
|
|
24264
|
+
if (skillFileMap.size === 0 && !isWildcard && skillFilter.length === 1) {
|
|
24265
|
+
const [singleSkillName] = skillFilter;
|
|
24266
|
+
if (singleSkillName !== void 0) {
|
|
24267
|
+
const rootFiles = remoteFiles.filter((f) => f.relativePath.indexOf("/") === -1);
|
|
24268
|
+
if (rootFiles.length > 0) {
|
|
24269
|
+
skillFileMap.set(
|
|
24270
|
+
singleSkillName,
|
|
24271
|
+
rootFiles.map((f) => ({ relativePath: f.relativePath, content: f.content }))
|
|
24272
|
+
);
|
|
24273
|
+
}
|
|
24274
|
+
}
|
|
24275
|
+
}
|
|
23961
24276
|
const allNames = [...skillFileMap.keys()];
|
|
23962
24277
|
const filteredNames = isWildcard ? allNames : allNames.filter((n) => skillFilter.includes(n));
|
|
23963
24278
|
if (locked) {
|
|
@@ -24041,11 +24356,11 @@ async function installCommand(logger5, options) {
|
|
|
24041
24356
|
var import_fastmcp = require("fastmcp");
|
|
24042
24357
|
|
|
24043
24358
|
// src/mcp/tools.ts
|
|
24044
|
-
var
|
|
24359
|
+
var import_mini85 = require("zod/mini");
|
|
24045
24360
|
|
|
24046
24361
|
// src/mcp/commands.ts
|
|
24047
|
-
var
|
|
24048
|
-
var
|
|
24362
|
+
var import_node_path148 = require("path");
|
|
24363
|
+
var import_mini77 = require("zod/mini");
|
|
24049
24364
|
|
|
24050
24365
|
// src/utils/logger.ts
|
|
24051
24366
|
var BaseLogger = class {
|
|
@@ -24196,7 +24511,7 @@ var logger = new ConsoleLogger({ verbose: false, silent: true });
|
|
|
24196
24511
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
24197
24512
|
var maxCommandsCount = 1e3;
|
|
24198
24513
|
async function listCommands() {
|
|
24199
|
-
const commandsDir = (0,
|
|
24514
|
+
const commandsDir = (0, import_node_path148.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
24200
24515
|
try {
|
|
24201
24516
|
const files = await listDirectoryFiles(commandsDir);
|
|
24202
24517
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -24212,7 +24527,7 @@ async function listCommands() {
|
|
|
24212
24527
|
});
|
|
24213
24528
|
const frontmatter = command.getFrontmatter();
|
|
24214
24529
|
return {
|
|
24215
|
-
relativePathFromCwd: (0,
|
|
24530
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
24216
24531
|
frontmatter
|
|
24217
24532
|
};
|
|
24218
24533
|
} catch (error) {
|
|
@@ -24234,13 +24549,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
24234
24549
|
relativePath: relativePathFromCwd,
|
|
24235
24550
|
intendedRootDir: process.cwd()
|
|
24236
24551
|
});
|
|
24237
|
-
const filename = (0,
|
|
24552
|
+
const filename = (0, import_node_path148.basename)(relativePathFromCwd);
|
|
24238
24553
|
try {
|
|
24239
24554
|
const command = await RulesyncCommand.fromFile({
|
|
24240
24555
|
relativeFilePath: filename
|
|
24241
24556
|
});
|
|
24242
24557
|
return {
|
|
24243
|
-
relativePathFromCwd: (0,
|
|
24558
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
24244
24559
|
frontmatter: command.getFrontmatter(),
|
|
24245
24560
|
body: command.getBody()
|
|
24246
24561
|
};
|
|
@@ -24259,7 +24574,7 @@ async function putCommand({
|
|
|
24259
24574
|
relativePath: relativePathFromCwd,
|
|
24260
24575
|
intendedRootDir: process.cwd()
|
|
24261
24576
|
});
|
|
24262
|
-
const filename = (0,
|
|
24577
|
+
const filename = (0, import_node_path148.basename)(relativePathFromCwd);
|
|
24263
24578
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
24264
24579
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
24265
24580
|
throw new Error(
|
|
@@ -24269,7 +24584,7 @@ async function putCommand({
|
|
|
24269
24584
|
try {
|
|
24270
24585
|
const existingCommands = await listCommands();
|
|
24271
24586
|
const isUpdate = existingCommands.some(
|
|
24272
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
24587
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
24273
24588
|
);
|
|
24274
24589
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
24275
24590
|
throw new Error(
|
|
@@ -24286,11 +24601,11 @@ async function putCommand({
|
|
|
24286
24601
|
fileContent,
|
|
24287
24602
|
validate: true
|
|
24288
24603
|
});
|
|
24289
|
-
const commandsDir = (0,
|
|
24604
|
+
const commandsDir = (0, import_node_path148.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
24290
24605
|
await ensureDir(commandsDir);
|
|
24291
24606
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
24292
24607
|
return {
|
|
24293
|
-
relativePathFromCwd: (0,
|
|
24608
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
24294
24609
|
frontmatter: command.getFrontmatter(),
|
|
24295
24610
|
body: command.getBody()
|
|
24296
24611
|
};
|
|
@@ -24305,12 +24620,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
24305
24620
|
relativePath: relativePathFromCwd,
|
|
24306
24621
|
intendedRootDir: process.cwd()
|
|
24307
24622
|
});
|
|
24308
|
-
const filename = (0,
|
|
24309
|
-
const fullPath = (0,
|
|
24623
|
+
const filename = (0, import_node_path148.basename)(relativePathFromCwd);
|
|
24624
|
+
const fullPath = (0, import_node_path148.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
24310
24625
|
try {
|
|
24311
24626
|
await removeFile(fullPath);
|
|
24312
24627
|
return {
|
|
24313
|
-
relativePathFromCwd: (0,
|
|
24628
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
24314
24629
|
};
|
|
24315
24630
|
} catch (error) {
|
|
24316
24631
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -24319,23 +24634,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
24319
24634
|
}
|
|
24320
24635
|
}
|
|
24321
24636
|
var commandToolSchemas = {
|
|
24322
|
-
listCommands:
|
|
24323
|
-
getCommand:
|
|
24324
|
-
relativePathFromCwd:
|
|
24637
|
+
listCommands: import_mini77.z.object({}),
|
|
24638
|
+
getCommand: import_mini77.z.object({
|
|
24639
|
+
relativePathFromCwd: import_mini77.z.string()
|
|
24325
24640
|
}),
|
|
24326
|
-
putCommand:
|
|
24327
|
-
relativePathFromCwd:
|
|
24641
|
+
putCommand: import_mini77.z.object({
|
|
24642
|
+
relativePathFromCwd: import_mini77.z.string(),
|
|
24328
24643
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
24329
|
-
body:
|
|
24644
|
+
body: import_mini77.z.string()
|
|
24330
24645
|
}),
|
|
24331
|
-
deleteCommand:
|
|
24332
|
-
relativePathFromCwd:
|
|
24646
|
+
deleteCommand: import_mini77.z.object({
|
|
24647
|
+
relativePathFromCwd: import_mini77.z.string()
|
|
24333
24648
|
})
|
|
24334
24649
|
};
|
|
24335
24650
|
var commandTools = {
|
|
24336
24651
|
listCommands: {
|
|
24337
24652
|
name: "listCommands",
|
|
24338
|
-
description: `List all commands from ${(0,
|
|
24653
|
+
description: `List all commands from ${(0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
24339
24654
|
parameters: commandToolSchemas.listCommands,
|
|
24340
24655
|
execute: async () => {
|
|
24341
24656
|
const commands = await listCommands();
|
|
@@ -24377,15 +24692,15 @@ var commandTools = {
|
|
|
24377
24692
|
};
|
|
24378
24693
|
|
|
24379
24694
|
// src/mcp/generate.ts
|
|
24380
|
-
var
|
|
24381
|
-
var generateOptionsSchema =
|
|
24382
|
-
targets:
|
|
24383
|
-
features:
|
|
24384
|
-
delete:
|
|
24385
|
-
global:
|
|
24386
|
-
simulateCommands:
|
|
24387
|
-
simulateSubagents:
|
|
24388
|
-
simulateSkills:
|
|
24695
|
+
var import_mini78 = require("zod/mini");
|
|
24696
|
+
var generateOptionsSchema = import_mini78.z.object({
|
|
24697
|
+
targets: import_mini78.z.optional(import_mini78.z.array(import_mini78.z.string())),
|
|
24698
|
+
features: import_mini78.z.optional(import_mini78.z.array(import_mini78.z.string())),
|
|
24699
|
+
delete: import_mini78.z.optional(import_mini78.z.boolean()),
|
|
24700
|
+
global: import_mini78.z.optional(import_mini78.z.boolean()),
|
|
24701
|
+
simulateCommands: import_mini78.z.optional(import_mini78.z.boolean()),
|
|
24702
|
+
simulateSubagents: import_mini78.z.optional(import_mini78.z.boolean()),
|
|
24703
|
+
simulateSkills: import_mini78.z.optional(import_mini78.z.boolean())
|
|
24389
24704
|
});
|
|
24390
24705
|
async function executeGenerate(options = {}) {
|
|
24391
24706
|
try {
|
|
@@ -24464,11 +24779,11 @@ var generateTools = {
|
|
|
24464
24779
|
};
|
|
24465
24780
|
|
|
24466
24781
|
// src/mcp/ignore.ts
|
|
24467
|
-
var
|
|
24468
|
-
var
|
|
24782
|
+
var import_node_path149 = require("path");
|
|
24783
|
+
var import_mini79 = require("zod/mini");
|
|
24469
24784
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
24470
24785
|
async function getIgnoreFile() {
|
|
24471
|
-
const ignoreFilePath = (0,
|
|
24786
|
+
const ignoreFilePath = (0, import_node_path149.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
24472
24787
|
try {
|
|
24473
24788
|
const content = await readFileContent(ignoreFilePath);
|
|
24474
24789
|
return {
|
|
@@ -24485,7 +24800,7 @@ async function getIgnoreFile() {
|
|
|
24485
24800
|
}
|
|
24486
24801
|
}
|
|
24487
24802
|
async function putIgnoreFile({ content }) {
|
|
24488
|
-
const ignoreFilePath = (0,
|
|
24803
|
+
const ignoreFilePath = (0, import_node_path149.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
24489
24804
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
24490
24805
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
24491
24806
|
throw new Error(
|
|
@@ -24509,8 +24824,8 @@ async function putIgnoreFile({ content }) {
|
|
|
24509
24824
|
}
|
|
24510
24825
|
}
|
|
24511
24826
|
async function deleteIgnoreFile() {
|
|
24512
|
-
const aiignorePath = (0,
|
|
24513
|
-
const legacyIgnorePath = (0,
|
|
24827
|
+
const aiignorePath = (0, import_node_path149.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
24828
|
+
const legacyIgnorePath = (0, import_node_path149.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
24514
24829
|
try {
|
|
24515
24830
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
24516
24831
|
return {
|
|
@@ -24528,11 +24843,11 @@ async function deleteIgnoreFile() {
|
|
|
24528
24843
|
}
|
|
24529
24844
|
}
|
|
24530
24845
|
var ignoreToolSchemas = {
|
|
24531
|
-
getIgnoreFile:
|
|
24532
|
-
putIgnoreFile:
|
|
24533
|
-
content:
|
|
24846
|
+
getIgnoreFile: import_mini79.z.object({}),
|
|
24847
|
+
putIgnoreFile: import_mini79.z.object({
|
|
24848
|
+
content: import_mini79.z.string()
|
|
24534
24849
|
}),
|
|
24535
|
-
deleteIgnoreFile:
|
|
24850
|
+
deleteIgnoreFile: import_mini79.z.object({})
|
|
24536
24851
|
};
|
|
24537
24852
|
var ignoreTools = {
|
|
24538
24853
|
getIgnoreFile: {
|
|
@@ -24565,11 +24880,11 @@ var ignoreTools = {
|
|
|
24565
24880
|
};
|
|
24566
24881
|
|
|
24567
24882
|
// src/mcp/import.ts
|
|
24568
|
-
var
|
|
24569
|
-
var importOptionsSchema =
|
|
24570
|
-
target:
|
|
24571
|
-
features:
|
|
24572
|
-
global:
|
|
24883
|
+
var import_mini80 = require("zod/mini");
|
|
24884
|
+
var importOptionsSchema = import_mini80.z.object({
|
|
24885
|
+
target: import_mini80.z.string(),
|
|
24886
|
+
features: import_mini80.z.optional(import_mini80.z.array(import_mini80.z.string())),
|
|
24887
|
+
global: import_mini80.z.optional(import_mini80.z.boolean())
|
|
24573
24888
|
});
|
|
24574
24889
|
async function executeImport(options) {
|
|
24575
24890
|
try {
|
|
@@ -24640,15 +24955,15 @@ var importTools = {
|
|
|
24640
24955
|
};
|
|
24641
24956
|
|
|
24642
24957
|
// src/mcp/mcp.ts
|
|
24643
|
-
var
|
|
24644
|
-
var
|
|
24958
|
+
var import_node_path150 = require("path");
|
|
24959
|
+
var import_mini81 = require("zod/mini");
|
|
24645
24960
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
24646
24961
|
async function getMcpFile() {
|
|
24647
24962
|
try {
|
|
24648
24963
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
24649
24964
|
validate: true
|
|
24650
24965
|
});
|
|
24651
|
-
const relativePathFromCwd = (0,
|
|
24966
|
+
const relativePathFromCwd = (0, import_node_path150.join)(
|
|
24652
24967
|
rulesyncMcp.getRelativeDirPath(),
|
|
24653
24968
|
rulesyncMcp.getRelativeFilePath()
|
|
24654
24969
|
);
|
|
@@ -24686,7 +25001,7 @@ async function putMcpFile({ content }) {
|
|
|
24686
25001
|
const paths = RulesyncMcp.getSettablePaths();
|
|
24687
25002
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
24688
25003
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
24689
|
-
const fullPath = (0,
|
|
25004
|
+
const fullPath = (0, import_node_path150.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
24690
25005
|
const rulesyncMcp = new RulesyncMcp({
|
|
24691
25006
|
baseDir,
|
|
24692
25007
|
relativeDirPath,
|
|
@@ -24694,9 +25009,9 @@ async function putMcpFile({ content }) {
|
|
|
24694
25009
|
fileContent: content,
|
|
24695
25010
|
validate: true
|
|
24696
25011
|
});
|
|
24697
|
-
await ensureDir((0,
|
|
25012
|
+
await ensureDir((0, import_node_path150.join)(baseDir, relativeDirPath));
|
|
24698
25013
|
await writeFileContent(fullPath, content);
|
|
24699
|
-
const relativePathFromCwd = (0,
|
|
25014
|
+
const relativePathFromCwd = (0, import_node_path150.join)(relativeDirPath, relativeFilePath);
|
|
24700
25015
|
return {
|
|
24701
25016
|
relativePathFromCwd,
|
|
24702
25017
|
content: rulesyncMcp.getFileContent()
|
|
@@ -24714,15 +25029,15 @@ async function deleteMcpFile() {
|
|
|
24714
25029
|
try {
|
|
24715
25030
|
const baseDir = process.cwd();
|
|
24716
25031
|
const paths = RulesyncMcp.getSettablePaths();
|
|
24717
|
-
const recommendedPath = (0,
|
|
25032
|
+
const recommendedPath = (0, import_node_path150.join)(
|
|
24718
25033
|
baseDir,
|
|
24719
25034
|
paths.recommended.relativeDirPath,
|
|
24720
25035
|
paths.recommended.relativeFilePath
|
|
24721
25036
|
);
|
|
24722
|
-
const legacyPath = (0,
|
|
25037
|
+
const legacyPath = (0, import_node_path150.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
24723
25038
|
await removeFile(recommendedPath);
|
|
24724
25039
|
await removeFile(legacyPath);
|
|
24725
|
-
const relativePathFromCwd = (0,
|
|
25040
|
+
const relativePathFromCwd = (0, import_node_path150.join)(
|
|
24726
25041
|
paths.recommended.relativeDirPath,
|
|
24727
25042
|
paths.recommended.relativeFilePath
|
|
24728
25043
|
);
|
|
@@ -24739,11 +25054,11 @@ async function deleteMcpFile() {
|
|
|
24739
25054
|
}
|
|
24740
25055
|
}
|
|
24741
25056
|
var mcpToolSchemas = {
|
|
24742
|
-
getMcpFile:
|
|
24743
|
-
putMcpFile:
|
|
24744
|
-
content:
|
|
25057
|
+
getMcpFile: import_mini81.z.object({}),
|
|
25058
|
+
putMcpFile: import_mini81.z.object({
|
|
25059
|
+
content: import_mini81.z.string()
|
|
24745
25060
|
}),
|
|
24746
|
-
deleteMcpFile:
|
|
25061
|
+
deleteMcpFile: import_mini81.z.object({})
|
|
24747
25062
|
};
|
|
24748
25063
|
var mcpTools = {
|
|
24749
25064
|
getMcpFile: {
|
|
@@ -24776,13 +25091,13 @@ var mcpTools = {
|
|
|
24776
25091
|
};
|
|
24777
25092
|
|
|
24778
25093
|
// src/mcp/rules.ts
|
|
24779
|
-
var
|
|
24780
|
-
var
|
|
25094
|
+
var import_node_path151 = require("path");
|
|
25095
|
+
var import_mini82 = require("zod/mini");
|
|
24781
25096
|
var logger2 = new ConsoleLogger({ verbose: false, silent: true });
|
|
24782
25097
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
24783
25098
|
var maxRulesCount = 1e3;
|
|
24784
25099
|
async function listRules() {
|
|
24785
|
-
const rulesDir = (0,
|
|
25100
|
+
const rulesDir = (0, import_node_path151.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
24786
25101
|
try {
|
|
24787
25102
|
const files = await listDirectoryFiles(rulesDir);
|
|
24788
25103
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -24795,7 +25110,7 @@ async function listRules() {
|
|
|
24795
25110
|
});
|
|
24796
25111
|
const frontmatter = rule.getFrontmatter();
|
|
24797
25112
|
return {
|
|
24798
|
-
relativePathFromCwd: (0,
|
|
25113
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
24799
25114
|
frontmatter
|
|
24800
25115
|
};
|
|
24801
25116
|
} catch (error) {
|
|
@@ -24817,14 +25132,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
24817
25132
|
relativePath: relativePathFromCwd,
|
|
24818
25133
|
intendedRootDir: process.cwd()
|
|
24819
25134
|
});
|
|
24820
|
-
const filename = (0,
|
|
25135
|
+
const filename = (0, import_node_path151.basename)(relativePathFromCwd);
|
|
24821
25136
|
try {
|
|
24822
25137
|
const rule = await RulesyncRule.fromFile({
|
|
24823
25138
|
relativeFilePath: filename,
|
|
24824
25139
|
validate: true
|
|
24825
25140
|
});
|
|
24826
25141
|
return {
|
|
24827
|
-
relativePathFromCwd: (0,
|
|
25142
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
24828
25143
|
frontmatter: rule.getFrontmatter(),
|
|
24829
25144
|
body: rule.getBody()
|
|
24830
25145
|
};
|
|
@@ -24843,7 +25158,7 @@ async function putRule({
|
|
|
24843
25158
|
relativePath: relativePathFromCwd,
|
|
24844
25159
|
intendedRootDir: process.cwd()
|
|
24845
25160
|
});
|
|
24846
|
-
const filename = (0,
|
|
25161
|
+
const filename = (0, import_node_path151.basename)(relativePathFromCwd);
|
|
24847
25162
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
24848
25163
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
24849
25164
|
throw new Error(
|
|
@@ -24853,7 +25168,7 @@ async function putRule({
|
|
|
24853
25168
|
try {
|
|
24854
25169
|
const existingRules = await listRules();
|
|
24855
25170
|
const isUpdate = existingRules.some(
|
|
24856
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
25171
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
24857
25172
|
);
|
|
24858
25173
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
24859
25174
|
throw new Error(
|
|
@@ -24868,11 +25183,11 @@ async function putRule({
|
|
|
24868
25183
|
body,
|
|
24869
25184
|
validate: true
|
|
24870
25185
|
});
|
|
24871
|
-
const rulesDir = (0,
|
|
25186
|
+
const rulesDir = (0, import_node_path151.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
24872
25187
|
await ensureDir(rulesDir);
|
|
24873
25188
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
24874
25189
|
return {
|
|
24875
|
-
relativePathFromCwd: (0,
|
|
25190
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
24876
25191
|
frontmatter: rule.getFrontmatter(),
|
|
24877
25192
|
body: rule.getBody()
|
|
24878
25193
|
};
|
|
@@ -24887,12 +25202,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
24887
25202
|
relativePath: relativePathFromCwd,
|
|
24888
25203
|
intendedRootDir: process.cwd()
|
|
24889
25204
|
});
|
|
24890
|
-
const filename = (0,
|
|
24891
|
-
const fullPath = (0,
|
|
25205
|
+
const filename = (0, import_node_path151.basename)(relativePathFromCwd);
|
|
25206
|
+
const fullPath = (0, import_node_path151.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
24892
25207
|
try {
|
|
24893
25208
|
await removeFile(fullPath);
|
|
24894
25209
|
return {
|
|
24895
|
-
relativePathFromCwd: (0,
|
|
25210
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
24896
25211
|
};
|
|
24897
25212
|
} catch (error) {
|
|
24898
25213
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -24901,23 +25216,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
24901
25216
|
}
|
|
24902
25217
|
}
|
|
24903
25218
|
var ruleToolSchemas = {
|
|
24904
|
-
listRules:
|
|
24905
|
-
getRule:
|
|
24906
|
-
relativePathFromCwd:
|
|
25219
|
+
listRules: import_mini82.z.object({}),
|
|
25220
|
+
getRule: import_mini82.z.object({
|
|
25221
|
+
relativePathFromCwd: import_mini82.z.string()
|
|
24907
25222
|
}),
|
|
24908
|
-
putRule:
|
|
24909
|
-
relativePathFromCwd:
|
|
25223
|
+
putRule: import_mini82.z.object({
|
|
25224
|
+
relativePathFromCwd: import_mini82.z.string(),
|
|
24910
25225
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
24911
|
-
body:
|
|
25226
|
+
body: import_mini82.z.string()
|
|
24912
25227
|
}),
|
|
24913
|
-
deleteRule:
|
|
24914
|
-
relativePathFromCwd:
|
|
25228
|
+
deleteRule: import_mini82.z.object({
|
|
25229
|
+
relativePathFromCwd: import_mini82.z.string()
|
|
24915
25230
|
})
|
|
24916
25231
|
};
|
|
24917
25232
|
var ruleTools = {
|
|
24918
25233
|
listRules: {
|
|
24919
25234
|
name: "listRules",
|
|
24920
|
-
description: `List all rules from ${(0,
|
|
25235
|
+
description: `List all rules from ${(0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
24921
25236
|
parameters: ruleToolSchemas.listRules,
|
|
24922
25237
|
execute: async () => {
|
|
24923
25238
|
const rules = await listRules();
|
|
@@ -24959,8 +25274,8 @@ var ruleTools = {
|
|
|
24959
25274
|
};
|
|
24960
25275
|
|
|
24961
25276
|
// src/mcp/skills.ts
|
|
24962
|
-
var
|
|
24963
|
-
var
|
|
25277
|
+
var import_node_path152 = require("path");
|
|
25278
|
+
var import_mini83 = require("zod/mini");
|
|
24964
25279
|
var logger3 = new ConsoleLogger({ verbose: false, silent: true });
|
|
24965
25280
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
24966
25281
|
var maxSkillsCount = 1e3;
|
|
@@ -24977,19 +25292,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
24977
25292
|
};
|
|
24978
25293
|
}
|
|
24979
25294
|
function extractDirName(relativeDirPathFromCwd) {
|
|
24980
|
-
const dirName = (0,
|
|
25295
|
+
const dirName = (0, import_node_path152.basename)(relativeDirPathFromCwd);
|
|
24981
25296
|
if (!dirName) {
|
|
24982
25297
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
24983
25298
|
}
|
|
24984
25299
|
return dirName;
|
|
24985
25300
|
}
|
|
24986
25301
|
async function listSkills() {
|
|
24987
|
-
const skillsDir = (0,
|
|
25302
|
+
const skillsDir = (0, import_node_path152.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
24988
25303
|
try {
|
|
24989
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
25304
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path152.join)(skillsDir, "*"), { type: "dir" });
|
|
24990
25305
|
const skills = await Promise.all(
|
|
24991
25306
|
skillDirPaths.map(async (dirPath) => {
|
|
24992
|
-
const dirName = (0,
|
|
25307
|
+
const dirName = (0, import_node_path152.basename)(dirPath);
|
|
24993
25308
|
if (!dirName) return null;
|
|
24994
25309
|
try {
|
|
24995
25310
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -24997,7 +25312,7 @@ async function listSkills() {
|
|
|
24997
25312
|
});
|
|
24998
25313
|
const frontmatter = skill.getFrontmatter();
|
|
24999
25314
|
return {
|
|
25000
|
-
relativeDirPathFromCwd: (0,
|
|
25315
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
25001
25316
|
frontmatter
|
|
25002
25317
|
};
|
|
25003
25318
|
} catch (error) {
|
|
@@ -25025,7 +25340,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
25025
25340
|
dirName
|
|
25026
25341
|
});
|
|
25027
25342
|
return {
|
|
25028
|
-
relativeDirPathFromCwd: (0,
|
|
25343
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
25029
25344
|
frontmatter: skill.getFrontmatter(),
|
|
25030
25345
|
body: skill.getBody(),
|
|
25031
25346
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -25059,7 +25374,7 @@ async function putSkill({
|
|
|
25059
25374
|
try {
|
|
25060
25375
|
const existingSkills = await listSkills();
|
|
25061
25376
|
const isUpdate = existingSkills.some(
|
|
25062
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
25377
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
25063
25378
|
);
|
|
25064
25379
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
25065
25380
|
throw new Error(
|
|
@@ -25076,9 +25391,9 @@ async function putSkill({
|
|
|
25076
25391
|
otherFiles: aiDirFiles,
|
|
25077
25392
|
validate: true
|
|
25078
25393
|
});
|
|
25079
|
-
const skillDirPath = (0,
|
|
25394
|
+
const skillDirPath = (0, import_node_path152.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
25080
25395
|
await ensureDir(skillDirPath);
|
|
25081
|
-
const skillFilePath = (0,
|
|
25396
|
+
const skillFilePath = (0, import_node_path152.join)(skillDirPath, SKILL_FILE_NAME);
|
|
25082
25397
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
25083
25398
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
25084
25399
|
for (const file of otherFiles) {
|
|
@@ -25086,15 +25401,15 @@ async function putSkill({
|
|
|
25086
25401
|
relativePath: file.name,
|
|
25087
25402
|
intendedRootDir: skillDirPath
|
|
25088
25403
|
});
|
|
25089
|
-
const filePath = (0,
|
|
25090
|
-
const fileDir = (0,
|
|
25404
|
+
const filePath = (0, import_node_path152.join)(skillDirPath, file.name);
|
|
25405
|
+
const fileDir = (0, import_node_path152.join)(skillDirPath, (0, import_node_path152.dirname)(file.name));
|
|
25091
25406
|
if (fileDir !== skillDirPath) {
|
|
25092
25407
|
await ensureDir(fileDir);
|
|
25093
25408
|
}
|
|
25094
25409
|
await writeFileContent(filePath, file.body);
|
|
25095
25410
|
}
|
|
25096
25411
|
return {
|
|
25097
|
-
relativeDirPathFromCwd: (0,
|
|
25412
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
25098
25413
|
frontmatter: skill.getFrontmatter(),
|
|
25099
25414
|
body: skill.getBody(),
|
|
25100
25415
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -25116,13 +25431,13 @@ async function deleteSkill({
|
|
|
25116
25431
|
intendedRootDir: process.cwd()
|
|
25117
25432
|
});
|
|
25118
25433
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
25119
|
-
const skillDirPath = (0,
|
|
25434
|
+
const skillDirPath = (0, import_node_path152.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
25120
25435
|
try {
|
|
25121
25436
|
if (await directoryExists(skillDirPath)) {
|
|
25122
25437
|
await removeDirectory(skillDirPath);
|
|
25123
25438
|
}
|
|
25124
25439
|
return {
|
|
25125
|
-
relativeDirPathFromCwd: (0,
|
|
25440
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
25126
25441
|
};
|
|
25127
25442
|
} catch (error) {
|
|
25128
25443
|
throw new Error(
|
|
@@ -25133,29 +25448,29 @@ async function deleteSkill({
|
|
|
25133
25448
|
);
|
|
25134
25449
|
}
|
|
25135
25450
|
}
|
|
25136
|
-
var McpSkillFileSchema =
|
|
25137
|
-
name:
|
|
25138
|
-
body:
|
|
25451
|
+
var McpSkillFileSchema = import_mini83.z.object({
|
|
25452
|
+
name: import_mini83.z.string(),
|
|
25453
|
+
body: import_mini83.z.string()
|
|
25139
25454
|
});
|
|
25140
25455
|
var skillToolSchemas = {
|
|
25141
|
-
listSkills:
|
|
25142
|
-
getSkill:
|
|
25143
|
-
relativeDirPathFromCwd:
|
|
25456
|
+
listSkills: import_mini83.z.object({}),
|
|
25457
|
+
getSkill: import_mini83.z.object({
|
|
25458
|
+
relativeDirPathFromCwd: import_mini83.z.string()
|
|
25144
25459
|
}),
|
|
25145
|
-
putSkill:
|
|
25146
|
-
relativeDirPathFromCwd:
|
|
25460
|
+
putSkill: import_mini83.z.object({
|
|
25461
|
+
relativeDirPathFromCwd: import_mini83.z.string(),
|
|
25147
25462
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
25148
|
-
body:
|
|
25149
|
-
otherFiles:
|
|
25463
|
+
body: import_mini83.z.string(),
|
|
25464
|
+
otherFiles: import_mini83.z.optional(import_mini83.z.array(McpSkillFileSchema))
|
|
25150
25465
|
}),
|
|
25151
|
-
deleteSkill:
|
|
25152
|
-
relativeDirPathFromCwd:
|
|
25466
|
+
deleteSkill: import_mini83.z.object({
|
|
25467
|
+
relativeDirPathFromCwd: import_mini83.z.string()
|
|
25153
25468
|
})
|
|
25154
25469
|
};
|
|
25155
25470
|
var skillTools = {
|
|
25156
25471
|
listSkills: {
|
|
25157
25472
|
name: "listSkills",
|
|
25158
|
-
description: `List all skills from ${(0,
|
|
25473
|
+
description: `List all skills from ${(0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
25159
25474
|
parameters: skillToolSchemas.listSkills,
|
|
25160
25475
|
execute: async () => {
|
|
25161
25476
|
const skills = await listSkills();
|
|
@@ -25198,13 +25513,13 @@ var skillTools = {
|
|
|
25198
25513
|
};
|
|
25199
25514
|
|
|
25200
25515
|
// src/mcp/subagents.ts
|
|
25201
|
-
var
|
|
25202
|
-
var
|
|
25516
|
+
var import_node_path153 = require("path");
|
|
25517
|
+
var import_mini84 = require("zod/mini");
|
|
25203
25518
|
var logger4 = new ConsoleLogger({ verbose: false, silent: true });
|
|
25204
25519
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
25205
25520
|
var maxSubagentsCount = 1e3;
|
|
25206
25521
|
async function listSubagents() {
|
|
25207
|
-
const subagentsDir = (0,
|
|
25522
|
+
const subagentsDir = (0, import_node_path153.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
25208
25523
|
try {
|
|
25209
25524
|
const files = await listDirectoryFiles(subagentsDir);
|
|
25210
25525
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -25217,7 +25532,7 @@ async function listSubagents() {
|
|
|
25217
25532
|
});
|
|
25218
25533
|
const frontmatter = subagent.getFrontmatter();
|
|
25219
25534
|
return {
|
|
25220
|
-
relativePathFromCwd: (0,
|
|
25535
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
25221
25536
|
frontmatter
|
|
25222
25537
|
};
|
|
25223
25538
|
} catch (error) {
|
|
@@ -25241,14 +25556,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
25241
25556
|
relativePath: relativePathFromCwd,
|
|
25242
25557
|
intendedRootDir: process.cwd()
|
|
25243
25558
|
});
|
|
25244
|
-
const filename = (0,
|
|
25559
|
+
const filename = (0, import_node_path153.basename)(relativePathFromCwd);
|
|
25245
25560
|
try {
|
|
25246
25561
|
const subagent = await RulesyncSubagent.fromFile({
|
|
25247
25562
|
relativeFilePath: filename,
|
|
25248
25563
|
validate: true
|
|
25249
25564
|
});
|
|
25250
25565
|
return {
|
|
25251
|
-
relativePathFromCwd: (0,
|
|
25566
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
25252
25567
|
frontmatter: subagent.getFrontmatter(),
|
|
25253
25568
|
body: subagent.getBody()
|
|
25254
25569
|
};
|
|
@@ -25267,7 +25582,7 @@ async function putSubagent({
|
|
|
25267
25582
|
relativePath: relativePathFromCwd,
|
|
25268
25583
|
intendedRootDir: process.cwd()
|
|
25269
25584
|
});
|
|
25270
|
-
const filename = (0,
|
|
25585
|
+
const filename = (0, import_node_path153.basename)(relativePathFromCwd);
|
|
25271
25586
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
25272
25587
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
25273
25588
|
throw new Error(
|
|
@@ -25277,7 +25592,7 @@ async function putSubagent({
|
|
|
25277
25592
|
try {
|
|
25278
25593
|
const existingSubagents = await listSubagents();
|
|
25279
25594
|
const isUpdate = existingSubagents.some(
|
|
25280
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
25595
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
25281
25596
|
);
|
|
25282
25597
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
25283
25598
|
throw new Error(
|
|
@@ -25292,11 +25607,11 @@ async function putSubagent({
|
|
|
25292
25607
|
body,
|
|
25293
25608
|
validate: true
|
|
25294
25609
|
});
|
|
25295
|
-
const subagentsDir = (0,
|
|
25610
|
+
const subagentsDir = (0, import_node_path153.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
25296
25611
|
await ensureDir(subagentsDir);
|
|
25297
25612
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
25298
25613
|
return {
|
|
25299
|
-
relativePathFromCwd: (0,
|
|
25614
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
25300
25615
|
frontmatter: subagent.getFrontmatter(),
|
|
25301
25616
|
body: subagent.getBody()
|
|
25302
25617
|
};
|
|
@@ -25311,12 +25626,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
25311
25626
|
relativePath: relativePathFromCwd,
|
|
25312
25627
|
intendedRootDir: process.cwd()
|
|
25313
25628
|
});
|
|
25314
|
-
const filename = (0,
|
|
25315
|
-
const fullPath = (0,
|
|
25629
|
+
const filename = (0, import_node_path153.basename)(relativePathFromCwd);
|
|
25630
|
+
const fullPath = (0, import_node_path153.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
25316
25631
|
try {
|
|
25317
25632
|
await removeFile(fullPath);
|
|
25318
25633
|
return {
|
|
25319
|
-
relativePathFromCwd: (0,
|
|
25634
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
25320
25635
|
};
|
|
25321
25636
|
} catch (error) {
|
|
25322
25637
|
throw new Error(
|
|
@@ -25328,23 +25643,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
25328
25643
|
}
|
|
25329
25644
|
}
|
|
25330
25645
|
var subagentToolSchemas = {
|
|
25331
|
-
listSubagents:
|
|
25332
|
-
getSubagent:
|
|
25333
|
-
relativePathFromCwd:
|
|
25646
|
+
listSubagents: import_mini84.z.object({}),
|
|
25647
|
+
getSubagent: import_mini84.z.object({
|
|
25648
|
+
relativePathFromCwd: import_mini84.z.string()
|
|
25334
25649
|
}),
|
|
25335
|
-
putSubagent:
|
|
25336
|
-
relativePathFromCwd:
|
|
25650
|
+
putSubagent: import_mini84.z.object({
|
|
25651
|
+
relativePathFromCwd: import_mini84.z.string(),
|
|
25337
25652
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
25338
|
-
body:
|
|
25653
|
+
body: import_mini84.z.string()
|
|
25339
25654
|
}),
|
|
25340
|
-
deleteSubagent:
|
|
25341
|
-
relativePathFromCwd:
|
|
25655
|
+
deleteSubagent: import_mini84.z.object({
|
|
25656
|
+
relativePathFromCwd: import_mini84.z.string()
|
|
25342
25657
|
})
|
|
25343
25658
|
};
|
|
25344
25659
|
var subagentTools = {
|
|
25345
25660
|
listSubagents: {
|
|
25346
25661
|
name: "listSubagents",
|
|
25347
|
-
description: `List all subagents from ${(0,
|
|
25662
|
+
description: `List all subagents from ${(0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
25348
25663
|
parameters: subagentToolSchemas.listSubagents,
|
|
25349
25664
|
execute: async () => {
|
|
25350
25665
|
const subagents = await listSubagents();
|
|
@@ -25386,7 +25701,7 @@ var subagentTools = {
|
|
|
25386
25701
|
};
|
|
25387
25702
|
|
|
25388
25703
|
// src/mcp/tools.ts
|
|
25389
|
-
var rulesyncFeatureSchema =
|
|
25704
|
+
var rulesyncFeatureSchema = import_mini85.z.enum([
|
|
25390
25705
|
"rule",
|
|
25391
25706
|
"command",
|
|
25392
25707
|
"subagent",
|
|
@@ -25396,21 +25711,21 @@ var rulesyncFeatureSchema = import_mini84.z.enum([
|
|
|
25396
25711
|
"generate",
|
|
25397
25712
|
"import"
|
|
25398
25713
|
]);
|
|
25399
|
-
var rulesyncOperationSchema =
|
|
25400
|
-
var skillFileSchema =
|
|
25401
|
-
name:
|
|
25402
|
-
body:
|
|
25714
|
+
var rulesyncOperationSchema = import_mini85.z.enum(["list", "get", "put", "delete", "run"]);
|
|
25715
|
+
var skillFileSchema = import_mini85.z.object({
|
|
25716
|
+
name: import_mini85.z.string(),
|
|
25717
|
+
body: import_mini85.z.string()
|
|
25403
25718
|
});
|
|
25404
|
-
var rulesyncToolSchema =
|
|
25719
|
+
var rulesyncToolSchema = import_mini85.z.object({
|
|
25405
25720
|
feature: rulesyncFeatureSchema,
|
|
25406
25721
|
operation: rulesyncOperationSchema,
|
|
25407
|
-
targetPathFromCwd:
|
|
25408
|
-
frontmatter:
|
|
25409
|
-
body:
|
|
25410
|
-
otherFiles:
|
|
25411
|
-
content:
|
|
25412
|
-
generateOptions:
|
|
25413
|
-
importOptions:
|
|
25722
|
+
targetPathFromCwd: import_mini85.z.optional(import_mini85.z.string()),
|
|
25723
|
+
frontmatter: import_mini85.z.optional(import_mini85.z.unknown()),
|
|
25724
|
+
body: import_mini85.z.optional(import_mini85.z.string()),
|
|
25725
|
+
otherFiles: import_mini85.z.optional(import_mini85.z.array(skillFileSchema)),
|
|
25726
|
+
content: import_mini85.z.optional(import_mini85.z.string()),
|
|
25727
|
+
generateOptions: import_mini85.z.optional(generateOptionsSchema),
|
|
25728
|
+
importOptions: import_mini85.z.optional(importOptionsSchema)
|
|
25414
25729
|
});
|
|
25415
25730
|
var supportedOperationsByFeature = {
|
|
25416
25731
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -25617,7 +25932,7 @@ async function mcpCommand(logger5, { version }) {
|
|
|
25617
25932
|
}
|
|
25618
25933
|
|
|
25619
25934
|
// src/cli/commands/resolve-gitignore-targets.ts
|
|
25620
|
-
var
|
|
25935
|
+
var import_node_path154 = require("path");
|
|
25621
25936
|
var resolveGitignoreTargets = async ({
|
|
25622
25937
|
cliTargets,
|
|
25623
25938
|
cwd = process.cwd()
|
|
@@ -25625,8 +25940,8 @@ var resolveGitignoreTargets = async ({
|
|
|
25625
25940
|
if (cliTargets !== void 0) {
|
|
25626
25941
|
return cliTargets;
|
|
25627
25942
|
}
|
|
25628
|
-
const baseConfigPath = (0,
|
|
25629
|
-
const localConfigPath = (0,
|
|
25943
|
+
const baseConfigPath = (0, import_node_path154.join)(cwd, RULESYNC_CONFIG_RELATIVE_FILE_PATH);
|
|
25944
|
+
const localConfigPath = (0, import_node_path154.join)(cwd, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
25630
25945
|
const [hasBase, hasLocal] = await Promise.all([
|
|
25631
25946
|
fileExists(baseConfigPath),
|
|
25632
25947
|
fileExists(localConfigPath)
|
|
@@ -26047,7 +26362,7 @@ function wrapCommand({
|
|
|
26047
26362
|
}
|
|
26048
26363
|
|
|
26049
26364
|
// src/cli/index.ts
|
|
26050
|
-
var getVersion = () => "8.
|
|
26365
|
+
var getVersion = () => "8.5.0";
|
|
26051
26366
|
function wrapCommand2(name, errorCode, handler) {
|
|
26052
26367
|
return wrapCommand({ name, errorCode, handler, getVersion });
|
|
26053
26368
|
}
|