rulesync 8.3.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-RVBJT5ST.js → chunk-Q5FDY7NL.js} +560 -334
- package/dist/cli/index.cjs +1031 -705
- package/dist/cli/index.js +127 -25
- package/dist/index.cjs +573 -348
- 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,17 +13424,28 @@ 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
|
});
|
|
13438
|
+
function stringifyCodexCliSubagentToml(tomlObj) {
|
|
13439
|
+
const { developer_instructions, ...restFields } = tomlObj;
|
|
13440
|
+
const restToml = smolToml4.stringify(restFields).trimEnd();
|
|
13441
|
+
if (developer_instructions === void 0) {
|
|
13442
|
+
return restToml;
|
|
13443
|
+
}
|
|
13444
|
+
const developerInstructionsToml = developer_instructions.includes("\n") ? developer_instructions.includes("'''") ? smolToml4.stringify({ developer_instructions }).trimEnd() : `developer_instructions = '''
|
|
13445
|
+
${developer_instructions}
|
|
13446
|
+
'''` : smolToml4.stringify({ developer_instructions }).trimEnd();
|
|
13447
|
+
return [restToml, developerInstructionsToml].filter((value) => value.length > 0).join("\n");
|
|
13448
|
+
}
|
|
13265
13449
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
13266
13450
|
body;
|
|
13267
13451
|
constructor({ body, ...rest }) {
|
|
@@ -13271,7 +13455,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13271
13455
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
13272
13456
|
} catch (error) {
|
|
13273
13457
|
throw new Error(
|
|
13274
|
-
`Invalid TOML in ${(0,
|
|
13458
|
+
`Invalid TOML in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
13275
13459
|
{ cause: error }
|
|
13276
13460
|
);
|
|
13277
13461
|
}
|
|
@@ -13283,7 +13467,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13283
13467
|
}
|
|
13284
13468
|
static getSettablePaths(_options = {}) {
|
|
13285
13469
|
return {
|
|
13286
|
-
relativeDirPath: (0,
|
|
13470
|
+
relativeDirPath: (0, import_node_path96.join)(".codex", "agents")
|
|
13287
13471
|
};
|
|
13288
13472
|
}
|
|
13289
13473
|
getBody() {
|
|
@@ -13295,7 +13479,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13295
13479
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml4.parse(this.body));
|
|
13296
13480
|
} catch (error) {
|
|
13297
13481
|
throw new Error(
|
|
13298
|
-
`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)}`,
|
|
13299
13483
|
{ cause: error }
|
|
13300
13484
|
);
|
|
13301
13485
|
}
|
|
@@ -13338,7 +13522,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13338
13522
|
...rulesyncSubagent.getBody() ? { developer_instructions: rulesyncSubagent.getBody() } : {},
|
|
13339
13523
|
...codexcliSection
|
|
13340
13524
|
};
|
|
13341
|
-
const body =
|
|
13525
|
+
const body = stringifyCodexCliSubagentToml(tomlObj);
|
|
13342
13526
|
const paths = this.getSettablePaths({ global });
|
|
13343
13527
|
const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".toml");
|
|
13344
13528
|
return new _CodexCliSubagent({
|
|
@@ -13376,7 +13560,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13376
13560
|
global = false
|
|
13377
13561
|
}) {
|
|
13378
13562
|
const paths = this.getSettablePaths({ global });
|
|
13379
|
-
const filePath = (0,
|
|
13563
|
+
const filePath = (0, import_node_path96.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13380
13564
|
const fileContent = await readFileContent(filePath);
|
|
13381
13565
|
const subagent = new _CodexCliSubagent({
|
|
13382
13566
|
baseDir,
|
|
@@ -13414,13 +13598,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13414
13598
|
};
|
|
13415
13599
|
|
|
13416
13600
|
// src/features/subagents/copilot-subagent.ts
|
|
13417
|
-
var
|
|
13418
|
-
var
|
|
13601
|
+
var import_node_path97 = require("path");
|
|
13602
|
+
var import_mini53 = require("zod/mini");
|
|
13419
13603
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
13420
|
-
var CopilotSubagentFrontmatterSchema =
|
|
13421
|
-
name:
|
|
13422
|
-
description:
|
|
13423
|
-
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())]))
|
|
13424
13608
|
});
|
|
13425
13609
|
var normalizeTools = (tools) => {
|
|
13426
13610
|
if (!tools) {
|
|
@@ -13440,7 +13624,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13440
13624
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13441
13625
|
if (!result.success) {
|
|
13442
13626
|
throw new Error(
|
|
13443
|
-
`Invalid frontmatter in ${(0,
|
|
13627
|
+
`Invalid frontmatter in ${(0, import_node_path97.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13444
13628
|
);
|
|
13445
13629
|
}
|
|
13446
13630
|
}
|
|
@@ -13452,7 +13636,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13452
13636
|
}
|
|
13453
13637
|
static getSettablePaths(_options = {}) {
|
|
13454
13638
|
return {
|
|
13455
|
-
relativeDirPath: (0,
|
|
13639
|
+
relativeDirPath: (0, import_node_path97.join)(".github", "agents")
|
|
13456
13640
|
};
|
|
13457
13641
|
}
|
|
13458
13642
|
getFrontmatter() {
|
|
@@ -13530,7 +13714,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13530
13714
|
return {
|
|
13531
13715
|
success: false,
|
|
13532
13716
|
error: new Error(
|
|
13533
|
-
`Invalid frontmatter in ${(0,
|
|
13717
|
+
`Invalid frontmatter in ${(0, import_node_path97.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13534
13718
|
)
|
|
13535
13719
|
};
|
|
13536
13720
|
}
|
|
@@ -13548,7 +13732,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13548
13732
|
global = false
|
|
13549
13733
|
}) {
|
|
13550
13734
|
const paths = this.getSettablePaths({ global });
|
|
13551
|
-
const filePath = (0,
|
|
13735
|
+
const filePath = (0, import_node_path97.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13552
13736
|
const fileContent = await readFileContent(filePath);
|
|
13553
13737
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13554
13738
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13584,11 +13768,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13584
13768
|
};
|
|
13585
13769
|
|
|
13586
13770
|
// src/features/subagents/cursor-subagent.ts
|
|
13587
|
-
var
|
|
13588
|
-
var
|
|
13589
|
-
var CursorSubagentFrontmatterSchema =
|
|
13590
|
-
name:
|
|
13591
|
-
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())
|
|
13592
13776
|
});
|
|
13593
13777
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
13594
13778
|
frontmatter;
|
|
@@ -13598,7 +13782,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13598
13782
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13599
13783
|
if (!result.success) {
|
|
13600
13784
|
throw new Error(
|
|
13601
|
-
`Invalid frontmatter in ${(0,
|
|
13785
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13602
13786
|
);
|
|
13603
13787
|
}
|
|
13604
13788
|
}
|
|
@@ -13610,7 +13794,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13610
13794
|
}
|
|
13611
13795
|
static getSettablePaths(_options = {}) {
|
|
13612
13796
|
return {
|
|
13613
|
-
relativeDirPath: (0,
|
|
13797
|
+
relativeDirPath: (0, import_node_path98.join)(".cursor", "agents")
|
|
13614
13798
|
};
|
|
13615
13799
|
}
|
|
13616
13800
|
getFrontmatter() {
|
|
@@ -13677,7 +13861,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13677
13861
|
return {
|
|
13678
13862
|
success: false,
|
|
13679
13863
|
error: new Error(
|
|
13680
|
-
`Invalid frontmatter in ${(0,
|
|
13864
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13681
13865
|
)
|
|
13682
13866
|
};
|
|
13683
13867
|
}
|
|
@@ -13695,7 +13879,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13695
13879
|
global = false
|
|
13696
13880
|
}) {
|
|
13697
13881
|
const paths = this.getSettablePaths({ global });
|
|
13698
|
-
const filePath = (0,
|
|
13882
|
+
const filePath = (0, import_node_path98.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13699
13883
|
const fileContent = await readFileContent(filePath);
|
|
13700
13884
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13701
13885
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13731,12 +13915,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13731
13915
|
};
|
|
13732
13916
|
|
|
13733
13917
|
// src/features/subagents/deepagents-subagent.ts
|
|
13734
|
-
var
|
|
13735
|
-
var
|
|
13736
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
13737
|
-
name:
|
|
13738
|
-
description:
|
|
13739
|
-
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())
|
|
13740
13924
|
});
|
|
13741
13925
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
13742
13926
|
frontmatter;
|
|
@@ -13746,7 +13930,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13746
13930
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13747
13931
|
if (!result.success) {
|
|
13748
13932
|
throw new Error(
|
|
13749
|
-
`Invalid frontmatter in ${(0,
|
|
13933
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13750
13934
|
);
|
|
13751
13935
|
}
|
|
13752
13936
|
}
|
|
@@ -13756,7 +13940,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13756
13940
|
}
|
|
13757
13941
|
static getSettablePaths(_options = {}) {
|
|
13758
13942
|
return {
|
|
13759
|
-
relativeDirPath: (0,
|
|
13943
|
+
relativeDirPath: (0, import_node_path99.join)(".deepagents", "agents")
|
|
13760
13944
|
};
|
|
13761
13945
|
}
|
|
13762
13946
|
getFrontmatter() {
|
|
@@ -13831,7 +14015,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13831
14015
|
return {
|
|
13832
14016
|
success: false,
|
|
13833
14017
|
error: new Error(
|
|
13834
|
-
`Invalid frontmatter in ${(0,
|
|
14018
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13835
14019
|
)
|
|
13836
14020
|
};
|
|
13837
14021
|
}
|
|
@@ -13849,7 +14033,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13849
14033
|
global = false
|
|
13850
14034
|
}) {
|
|
13851
14035
|
const paths = this.getSettablePaths({ global });
|
|
13852
|
-
const filePath = (0,
|
|
14036
|
+
const filePath = (0, import_node_path99.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13853
14037
|
const fileContent = await readFileContent(filePath);
|
|
13854
14038
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13855
14039
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13884,11 +14068,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13884
14068
|
};
|
|
13885
14069
|
|
|
13886
14070
|
// src/features/subagents/junie-subagent.ts
|
|
13887
|
-
var
|
|
13888
|
-
var
|
|
13889
|
-
var JunieSubagentFrontmatterSchema =
|
|
13890
|
-
name:
|
|
13891
|
-
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()
|
|
13892
14076
|
});
|
|
13893
14077
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
13894
14078
|
frontmatter;
|
|
@@ -13898,7 +14082,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
13898
14082
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13899
14083
|
if (!result.success) {
|
|
13900
14084
|
throw new Error(
|
|
13901
|
-
`Invalid frontmatter in ${(0,
|
|
14085
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13902
14086
|
);
|
|
13903
14087
|
}
|
|
13904
14088
|
}
|
|
@@ -13913,7 +14097,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
13913
14097
|
throw new Error("JunieSubagent does not support global mode.");
|
|
13914
14098
|
}
|
|
13915
14099
|
return {
|
|
13916
|
-
relativeDirPath: (0,
|
|
14100
|
+
relativeDirPath: (0, import_node_path100.join)(".junie", "agents")
|
|
13917
14101
|
};
|
|
13918
14102
|
}
|
|
13919
14103
|
getFrontmatter() {
|
|
@@ -13989,7 +14173,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
13989
14173
|
return {
|
|
13990
14174
|
success: false,
|
|
13991
14175
|
error: new Error(
|
|
13992
|
-
`Invalid frontmatter in ${(0,
|
|
14176
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13993
14177
|
)
|
|
13994
14178
|
};
|
|
13995
14179
|
}
|
|
@@ -14007,7 +14191,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14007
14191
|
global = false
|
|
14008
14192
|
}) {
|
|
14009
14193
|
const paths = this.getSettablePaths({ global });
|
|
14010
|
-
const filePath = (0,
|
|
14194
|
+
const filePath = (0, import_node_path100.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14011
14195
|
const fileContent = await readFileContent(filePath);
|
|
14012
14196
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14013
14197
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14042,15 +14226,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14042
14226
|
};
|
|
14043
14227
|
|
|
14044
14228
|
// src/features/subagents/kilo-subagent.ts
|
|
14045
|
-
var
|
|
14229
|
+
var import_node_path102 = require("path");
|
|
14046
14230
|
|
|
14047
14231
|
// src/features/subagents/opencode-style-subagent.ts
|
|
14048
|
-
var
|
|
14049
|
-
var
|
|
14050
|
-
var OpenCodeStyleSubagentFrontmatterSchema =
|
|
14051
|
-
description:
|
|
14052
|
-
mode:
|
|
14053
|
-
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())
|
|
14054
14238
|
});
|
|
14055
14239
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
14056
14240
|
frontmatter;
|
|
@@ -14060,7 +14244,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14060
14244
|
const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14061
14245
|
if (!result.success) {
|
|
14062
14246
|
throw new Error(
|
|
14063
|
-
`Invalid frontmatter in ${(0,
|
|
14247
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14064
14248
|
);
|
|
14065
14249
|
}
|
|
14066
14250
|
}
|
|
@@ -14080,7 +14264,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14080
14264
|
const { description, mode, name, ...toolSection } = this.frontmatter;
|
|
14081
14265
|
const rulesyncFrontmatter = {
|
|
14082
14266
|
targets: ["*"],
|
|
14083
|
-
name: name ?? (0,
|
|
14267
|
+
name: name ?? (0, import_node_path101.basename)(this.getRelativeFilePath(), ".md"),
|
|
14084
14268
|
description,
|
|
14085
14269
|
[this.getToolTarget()]: { mode, ...toolSection }
|
|
14086
14270
|
};
|
|
@@ -14102,7 +14286,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14102
14286
|
return {
|
|
14103
14287
|
success: false,
|
|
14104
14288
|
error: new Error(
|
|
14105
|
-
`Invalid frontmatter in ${(0,
|
|
14289
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14106
14290
|
)
|
|
14107
14291
|
};
|
|
14108
14292
|
}
|
|
@@ -14118,7 +14302,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14118
14302
|
global = false
|
|
14119
14303
|
} = {}) {
|
|
14120
14304
|
return {
|
|
14121
|
-
relativeDirPath: global ? (0,
|
|
14305
|
+
relativeDirPath: global ? (0, import_node_path102.join)(".config", "kilo", "agent") : (0, import_node_path102.join)(".kilo", "agent")
|
|
14122
14306
|
};
|
|
14123
14307
|
}
|
|
14124
14308
|
static fromRulesyncSubagent({
|
|
@@ -14162,7 +14346,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14162
14346
|
global = false
|
|
14163
14347
|
}) {
|
|
14164
14348
|
const paths = this.getSettablePaths({ global });
|
|
14165
|
-
const filePath = (0,
|
|
14349
|
+
const filePath = (0, import_node_path102.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14166
14350
|
const fileContent = await readFileContent(filePath);
|
|
14167
14351
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14168
14352
|
const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14198,23 +14382,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14198
14382
|
};
|
|
14199
14383
|
|
|
14200
14384
|
// src/features/subagents/kiro-subagent.ts
|
|
14201
|
-
var
|
|
14202
|
-
var
|
|
14203
|
-
var KiroCliSubagentJsonSchema =
|
|
14204
|
-
name:
|
|
14205
|
-
description:
|
|
14206
|
-
prompt:
|
|
14207
|
-
tools:
|
|
14208
|
-
toolAliases:
|
|
14209
|
-
toolSettings:
|
|
14210
|
-
toolSchema:
|
|
14211
|
-
hooks:
|
|
14212
|
-
model:
|
|
14213
|
-
mcpServers:
|
|
14214
|
-
useLegacyMcpJson:
|
|
14215
|
-
resources:
|
|
14216
|
-
allowedTools:
|
|
14217
|
-
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()))
|
|
14218
14402
|
});
|
|
14219
14403
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
14220
14404
|
body;
|
|
@@ -14225,7 +14409,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14225
14409
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
14226
14410
|
} catch (error) {
|
|
14227
14411
|
throw new Error(
|
|
14228
|
-
`Invalid JSON in ${(0,
|
|
14412
|
+
`Invalid JSON in ${(0, import_node_path103.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
14229
14413
|
{ cause: error }
|
|
14230
14414
|
);
|
|
14231
14415
|
}
|
|
@@ -14237,7 +14421,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14237
14421
|
}
|
|
14238
14422
|
static getSettablePaths(_options = {}) {
|
|
14239
14423
|
return {
|
|
14240
|
-
relativeDirPath: (0,
|
|
14424
|
+
relativeDirPath: (0, import_node_path103.join)(".kiro", "agents")
|
|
14241
14425
|
};
|
|
14242
14426
|
}
|
|
14243
14427
|
getBody() {
|
|
@@ -14249,7 +14433,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14249
14433
|
parsed = JSON.parse(this.body);
|
|
14250
14434
|
} catch (error) {
|
|
14251
14435
|
throw new Error(
|
|
14252
|
-
`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)}`,
|
|
14253
14437
|
{ cause: error }
|
|
14254
14438
|
);
|
|
14255
14439
|
}
|
|
@@ -14330,7 +14514,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14330
14514
|
global = false
|
|
14331
14515
|
}) {
|
|
14332
14516
|
const paths = this.getSettablePaths({ global });
|
|
14333
|
-
const filePath = (0,
|
|
14517
|
+
const filePath = (0, import_node_path103.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14334
14518
|
const fileContent = await readFileContent(filePath);
|
|
14335
14519
|
const subagent = new _KiroSubagent({
|
|
14336
14520
|
baseDir,
|
|
@@ -14368,7 +14552,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14368
14552
|
};
|
|
14369
14553
|
|
|
14370
14554
|
// src/features/subagents/opencode-subagent.ts
|
|
14371
|
-
var
|
|
14555
|
+
var import_node_path104 = require("path");
|
|
14372
14556
|
var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
|
|
14373
14557
|
var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
14374
14558
|
getToolTarget() {
|
|
@@ -14378,7 +14562,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
14378
14562
|
global = false
|
|
14379
14563
|
} = {}) {
|
|
14380
14564
|
return {
|
|
14381
|
-
relativeDirPath: global ? (0,
|
|
14565
|
+
relativeDirPath: global ? (0, import_node_path104.join)(".config", "opencode", "agent") : (0, import_node_path104.join)(".opencode", "agent")
|
|
14382
14566
|
};
|
|
14383
14567
|
}
|
|
14384
14568
|
static fromRulesyncSubagent({
|
|
@@ -14422,7 +14606,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
14422
14606
|
global = false
|
|
14423
14607
|
}) {
|
|
14424
14608
|
const paths = this.getSettablePaths({ global });
|
|
14425
|
-
const filePath = (0,
|
|
14609
|
+
const filePath = (0, import_node_path104.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14426
14610
|
const fileContent = await readFileContent(filePath);
|
|
14427
14611
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14428
14612
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14475,7 +14659,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
14475
14659
|
"roo",
|
|
14476
14660
|
"rovodev"
|
|
14477
14661
|
];
|
|
14478
|
-
var SubagentsProcessorToolTargetSchema =
|
|
14662
|
+
var SubagentsProcessorToolTargetSchema = import_mini59.z.enum(subagentsProcessorToolTargetTuple);
|
|
14479
14663
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
14480
14664
|
[
|
|
14481
14665
|
"agentsmd",
|
|
@@ -14666,7 +14850,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14666
14850
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
14667
14851
|
*/
|
|
14668
14852
|
async loadRulesyncFiles() {
|
|
14669
|
-
const subagentsDir = (0,
|
|
14853
|
+
const subagentsDir = (0, import_node_path105.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
14670
14854
|
const dirExists = await directoryExists(subagentsDir);
|
|
14671
14855
|
if (!dirExists) {
|
|
14672
14856
|
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -14681,7 +14865,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14681
14865
|
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
14682
14866
|
const rulesyncSubagents = [];
|
|
14683
14867
|
for (const mdFile of mdFiles) {
|
|
14684
|
-
const filepath = (0,
|
|
14868
|
+
const filepath = (0, import_node_path105.join)(subagentsDir, mdFile);
|
|
14685
14869
|
try {
|
|
14686
14870
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
14687
14871
|
relativeFilePath: mdFile,
|
|
@@ -14711,14 +14895,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14711
14895
|
const factory = this.getFactory(this.toolTarget);
|
|
14712
14896
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
14713
14897
|
const subagentFilePaths = await findFilesByGlobs(
|
|
14714
|
-
(0,
|
|
14898
|
+
(0, import_node_path105.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
14715
14899
|
);
|
|
14716
14900
|
if (forDeletion) {
|
|
14717
14901
|
const toolSubagents2 = subagentFilePaths.map(
|
|
14718
14902
|
(path4) => factory.class.forDeletion({
|
|
14719
14903
|
baseDir: this.baseDir,
|
|
14720
14904
|
relativeDirPath: paths.relativeDirPath,
|
|
14721
|
-
relativeFilePath: (0,
|
|
14905
|
+
relativeFilePath: (0, import_node_path105.basename)(path4),
|
|
14722
14906
|
global: this.global
|
|
14723
14907
|
})
|
|
14724
14908
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -14731,7 +14915,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14731
14915
|
subagentFilePaths.map(
|
|
14732
14916
|
(path4) => factory.class.fromFile({
|
|
14733
14917
|
baseDir: this.baseDir,
|
|
14734
|
-
relativeFilePath: (0,
|
|
14918
|
+
relativeFilePath: (0, import_node_path105.basename)(path4),
|
|
14735
14919
|
global: this.global
|
|
14736
14920
|
})
|
|
14737
14921
|
)
|
|
@@ -14778,49 +14962,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14778
14962
|
};
|
|
14779
14963
|
|
|
14780
14964
|
// src/features/rules/agentsmd-rule.ts
|
|
14781
|
-
var
|
|
14965
|
+
var import_node_path108 = require("path");
|
|
14782
14966
|
|
|
14783
14967
|
// src/features/rules/tool-rule.ts
|
|
14784
|
-
var
|
|
14968
|
+
var import_node_path107 = require("path");
|
|
14785
14969
|
|
|
14786
14970
|
// src/features/rules/rulesync-rule.ts
|
|
14787
|
-
var
|
|
14788
|
-
var
|
|
14789
|
-
var RulesyncRuleFrontmatterSchema =
|
|
14790
|
-
root:
|
|
14791
|
-
localRoot:
|
|
14792
|
-
targets:
|
|
14793
|
-
description:
|
|
14794
|
-
globs:
|
|
14795
|
-
agentsmd:
|
|
14796
|
-
|
|
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({
|
|
14797
14981
|
// @example "path/to/subproject"
|
|
14798
|
-
subprojectPath:
|
|
14982
|
+
subprojectPath: import_mini60.z.optional(import_mini60.z.string())
|
|
14799
14983
|
})
|
|
14800
14984
|
),
|
|
14801
|
-
claudecode:
|
|
14802
|
-
|
|
14985
|
+
claudecode: import_mini60.z.optional(
|
|
14986
|
+
import_mini60.z.looseObject({
|
|
14803
14987
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
14804
14988
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
14805
|
-
paths:
|
|
14989
|
+
paths: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string()))
|
|
14806
14990
|
})
|
|
14807
14991
|
),
|
|
14808
|
-
cursor:
|
|
14809
|
-
|
|
14810
|
-
alwaysApply:
|
|
14811
|
-
description:
|
|
14812
|
-
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()))
|
|
14813
14997
|
})
|
|
14814
14998
|
),
|
|
14815
|
-
copilot:
|
|
14816
|
-
|
|
14817
|
-
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")]))
|
|
14818
15002
|
})
|
|
14819
15003
|
),
|
|
14820
|
-
antigravity:
|
|
14821
|
-
|
|
14822
|
-
trigger:
|
|
14823
|
-
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()))
|
|
14824
15008
|
})
|
|
14825
15009
|
)
|
|
14826
15010
|
});
|
|
@@ -14831,7 +15015,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
14831
15015
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
14832
15016
|
if (!parseResult.success && rest.validate !== false) {
|
|
14833
15017
|
throw new Error(
|
|
14834
|
-
`Invalid frontmatter in ${(0,
|
|
15018
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
14835
15019
|
);
|
|
14836
15020
|
}
|
|
14837
15021
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -14866,7 +15050,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
14866
15050
|
return {
|
|
14867
15051
|
success: false,
|
|
14868
15052
|
error: new Error(
|
|
14869
|
-
`Invalid frontmatter in ${(0,
|
|
15053
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14870
15054
|
)
|
|
14871
15055
|
};
|
|
14872
15056
|
}
|
|
@@ -14875,7 +15059,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
14875
15059
|
relativeFilePath,
|
|
14876
15060
|
validate = true
|
|
14877
15061
|
}) {
|
|
14878
|
-
const filePath = (0,
|
|
15062
|
+
const filePath = (0, import_node_path106.join)(
|
|
14879
15063
|
process.cwd(),
|
|
14880
15064
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
14881
15065
|
relativeFilePath
|
|
@@ -14974,7 +15158,7 @@ var ToolRule = class extends ToolFile {
|
|
|
14974
15158
|
rulesyncRule,
|
|
14975
15159
|
validate = true,
|
|
14976
15160
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
14977
|
-
nonRootPath = { relativeDirPath: (0,
|
|
15161
|
+
nonRootPath = { relativeDirPath: (0, import_node_path107.join)(".agents", "memories") }
|
|
14978
15162
|
}) {
|
|
14979
15163
|
const params = this.buildToolRuleParamsDefault({
|
|
14980
15164
|
baseDir,
|
|
@@ -14985,7 +15169,7 @@ var ToolRule = class extends ToolFile {
|
|
|
14985
15169
|
});
|
|
14986
15170
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
14987
15171
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
14988
|
-
params.relativeDirPath = (0,
|
|
15172
|
+
params.relativeDirPath = (0, import_node_path107.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
14989
15173
|
params.relativeFilePath = "AGENTS.md";
|
|
14990
15174
|
}
|
|
14991
15175
|
return params;
|
|
@@ -15034,7 +15218,7 @@ var ToolRule = class extends ToolFile {
|
|
|
15034
15218
|
}
|
|
15035
15219
|
};
|
|
15036
15220
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
15037
|
-
return excludeToolDir ? subDir : (0,
|
|
15221
|
+
return excludeToolDir ? subDir : (0, import_node_path107.join)(toolDir, subDir);
|
|
15038
15222
|
}
|
|
15039
15223
|
|
|
15040
15224
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -15063,8 +15247,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
15063
15247
|
validate = true
|
|
15064
15248
|
}) {
|
|
15065
15249
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
15066
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
15067
|
-
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));
|
|
15068
15252
|
return new _AgentsMdRule({
|
|
15069
15253
|
baseDir,
|
|
15070
15254
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15119,21 +15303,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
15119
15303
|
};
|
|
15120
15304
|
|
|
15121
15305
|
// src/features/rules/antigravity-rule.ts
|
|
15122
|
-
var
|
|
15123
|
-
var
|
|
15124
|
-
var AntigravityRuleFrontmatterSchema =
|
|
15125
|
-
trigger:
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
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()
|
|
15132
15316
|
// accepts any string for forward compatibility
|
|
15133
15317
|
])
|
|
15134
15318
|
),
|
|
15135
|
-
globs:
|
|
15136
|
-
description:
|
|
15319
|
+
globs: import_mini61.z.optional(import_mini61.z.string()),
|
|
15320
|
+
description: import_mini61.z.optional(import_mini61.z.string())
|
|
15137
15321
|
});
|
|
15138
15322
|
function parseGlobsString(globs) {
|
|
15139
15323
|
if (!globs) {
|
|
@@ -15278,7 +15462,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15278
15462
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15279
15463
|
if (!result.success) {
|
|
15280
15464
|
throw new Error(
|
|
15281
|
-
`Invalid frontmatter in ${(0,
|
|
15465
|
+
`Invalid frontmatter in ${(0, import_node_path109.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15282
15466
|
);
|
|
15283
15467
|
}
|
|
15284
15468
|
}
|
|
@@ -15302,7 +15486,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15302
15486
|
relativeFilePath,
|
|
15303
15487
|
validate = true
|
|
15304
15488
|
}) {
|
|
15305
|
-
const filePath = (0,
|
|
15489
|
+
const filePath = (0, import_node_path109.join)(
|
|
15306
15490
|
baseDir,
|
|
15307
15491
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
15308
15492
|
relativeFilePath
|
|
@@ -15442,7 +15626,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15442
15626
|
};
|
|
15443
15627
|
|
|
15444
15628
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
15445
|
-
var
|
|
15629
|
+
var import_node_path110 = require("path");
|
|
15446
15630
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
15447
15631
|
toRulesyncRule() {
|
|
15448
15632
|
const rulesyncFrontmatter = {
|
|
@@ -15502,8 +15686,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
15502
15686
|
}) {
|
|
15503
15687
|
const settablePaths = this.getSettablePaths();
|
|
15504
15688
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
15505
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
15506
|
-
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));
|
|
15507
15691
|
return new _AugmentcodeLegacyRule({
|
|
15508
15692
|
baseDir,
|
|
15509
15693
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -15532,7 +15716,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
15532
15716
|
};
|
|
15533
15717
|
|
|
15534
15718
|
// src/features/rules/augmentcode-rule.ts
|
|
15535
|
-
var
|
|
15719
|
+
var import_node_path111 = require("path");
|
|
15536
15720
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
15537
15721
|
toRulesyncRule() {
|
|
15538
15722
|
return this.toRulesyncRuleDefault();
|
|
@@ -15563,7 +15747,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
15563
15747
|
relativeFilePath,
|
|
15564
15748
|
validate = true
|
|
15565
15749
|
}) {
|
|
15566
|
-
const filePath = (0,
|
|
15750
|
+
const filePath = (0, import_node_path111.join)(
|
|
15567
15751
|
baseDir,
|
|
15568
15752
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
15569
15753
|
relativeFilePath
|
|
@@ -15603,7 +15787,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
15603
15787
|
};
|
|
15604
15788
|
|
|
15605
15789
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
15606
|
-
var
|
|
15790
|
+
var import_node_path112 = require("path");
|
|
15607
15791
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
15608
15792
|
static getSettablePaths({
|
|
15609
15793
|
global,
|
|
@@ -15645,7 +15829,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15645
15829
|
if (isRoot) {
|
|
15646
15830
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
15647
15831
|
const fileContent2 = await readFileContent(
|
|
15648
|
-
(0,
|
|
15832
|
+
(0, import_node_path112.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
15649
15833
|
);
|
|
15650
15834
|
return new _ClaudecodeLegacyRule({
|
|
15651
15835
|
baseDir,
|
|
@@ -15659,8 +15843,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15659
15843
|
if (!paths.nonRoot) {
|
|
15660
15844
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15661
15845
|
}
|
|
15662
|
-
const relativePath = (0,
|
|
15663
|
-
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));
|
|
15664
15848
|
return new _ClaudecodeLegacyRule({
|
|
15665
15849
|
baseDir,
|
|
15666
15850
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15719,10 +15903,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15719
15903
|
};
|
|
15720
15904
|
|
|
15721
15905
|
// src/features/rules/claudecode-rule.ts
|
|
15722
|
-
var
|
|
15723
|
-
var
|
|
15724
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
15725
|
-
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()))
|
|
15726
15910
|
});
|
|
15727
15911
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
15728
15912
|
frontmatter;
|
|
@@ -15760,7 +15944,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15760
15944
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15761
15945
|
if (!result.success) {
|
|
15762
15946
|
throw new Error(
|
|
15763
|
-
`Invalid frontmatter in ${(0,
|
|
15947
|
+
`Invalid frontmatter in ${(0, import_node_path113.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15764
15948
|
);
|
|
15765
15949
|
}
|
|
15766
15950
|
}
|
|
@@ -15790,7 +15974,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15790
15974
|
if (isRoot) {
|
|
15791
15975
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
15792
15976
|
const fileContent2 = await readFileContent(
|
|
15793
|
-
(0,
|
|
15977
|
+
(0, import_node_path113.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
15794
15978
|
);
|
|
15795
15979
|
return new _ClaudecodeRule({
|
|
15796
15980
|
baseDir,
|
|
@@ -15805,8 +15989,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15805
15989
|
if (!paths.nonRoot) {
|
|
15806
15990
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15807
15991
|
}
|
|
15808
|
-
const relativePath = (0,
|
|
15809
|
-
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);
|
|
15810
15994
|
const fileContent = await readFileContent(filePath);
|
|
15811
15995
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15812
15996
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15917,7 +16101,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15917
16101
|
return {
|
|
15918
16102
|
success: false,
|
|
15919
16103
|
error: new Error(
|
|
15920
|
-
`Invalid frontmatter in ${(0,
|
|
16104
|
+
`Invalid frontmatter in ${(0, import_node_path113.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15921
16105
|
)
|
|
15922
16106
|
};
|
|
15923
16107
|
}
|
|
@@ -15937,10 +16121,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
15937
16121
|
};
|
|
15938
16122
|
|
|
15939
16123
|
// src/features/rules/cline-rule.ts
|
|
15940
|
-
var
|
|
15941
|
-
var
|
|
15942
|
-
var ClineRuleFrontmatterSchema =
|
|
15943
|
-
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()
|
|
15944
16128
|
});
|
|
15945
16129
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
15946
16130
|
static getSettablePaths(_options = {}) {
|
|
@@ -15983,7 +16167,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
15983
16167
|
validate = true
|
|
15984
16168
|
}) {
|
|
15985
16169
|
const fileContent = await readFileContent(
|
|
15986
|
-
(0,
|
|
16170
|
+
(0, import_node_path114.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
15987
16171
|
);
|
|
15988
16172
|
return new _ClineRule({
|
|
15989
16173
|
baseDir,
|
|
@@ -16009,7 +16193,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
16009
16193
|
};
|
|
16010
16194
|
|
|
16011
16195
|
// src/features/rules/codexcli-rule.ts
|
|
16012
|
-
var
|
|
16196
|
+
var import_node_path115 = require("path");
|
|
16013
16197
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
16014
16198
|
static getSettablePaths({
|
|
16015
16199
|
global,
|
|
@@ -16044,7 +16228,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16044
16228
|
if (isRoot) {
|
|
16045
16229
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16046
16230
|
const fileContent2 = await readFileContent(
|
|
16047
|
-
(0,
|
|
16231
|
+
(0, import_node_path115.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16048
16232
|
);
|
|
16049
16233
|
return new _CodexcliRule({
|
|
16050
16234
|
baseDir,
|
|
@@ -16058,8 +16242,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16058
16242
|
if (!paths.nonRoot) {
|
|
16059
16243
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16060
16244
|
}
|
|
16061
|
-
const relativePath = (0,
|
|
16062
|
-
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));
|
|
16063
16247
|
return new _CodexcliRule({
|
|
16064
16248
|
baseDir,
|
|
16065
16249
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16118,12 +16302,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16118
16302
|
};
|
|
16119
16303
|
|
|
16120
16304
|
// src/features/rules/copilot-rule.ts
|
|
16121
|
-
var
|
|
16122
|
-
var
|
|
16123
|
-
var CopilotRuleFrontmatterSchema =
|
|
16124
|
-
description:
|
|
16125
|
-
applyTo:
|
|
16126
|
-
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")]))
|
|
16127
16311
|
});
|
|
16128
16312
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
16129
16313
|
frontmatter;
|
|
@@ -16155,7 +16339,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16155
16339
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16156
16340
|
if (!result.success) {
|
|
16157
16341
|
throw new Error(
|
|
16158
|
-
`Invalid frontmatter in ${(0,
|
|
16342
|
+
`Invalid frontmatter in ${(0, import_node_path116.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16159
16343
|
);
|
|
16160
16344
|
}
|
|
16161
16345
|
}
|
|
@@ -16245,8 +16429,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16245
16429
|
const paths = this.getSettablePaths({ global });
|
|
16246
16430
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
16247
16431
|
if (isRoot) {
|
|
16248
|
-
const relativePath2 = (0,
|
|
16249
|
-
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);
|
|
16250
16434
|
const fileContent2 = await readFileContent(filePath2);
|
|
16251
16435
|
return new _CopilotRule({
|
|
16252
16436
|
baseDir,
|
|
@@ -16261,8 +16445,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16261
16445
|
if (!paths.nonRoot) {
|
|
16262
16446
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16263
16447
|
}
|
|
16264
|
-
const relativePath = (0,
|
|
16265
|
-
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);
|
|
16266
16450
|
const fileContent = await readFileContent(filePath);
|
|
16267
16451
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16268
16452
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16308,7 +16492,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16308
16492
|
return {
|
|
16309
16493
|
success: false,
|
|
16310
16494
|
error: new Error(
|
|
16311
|
-
`Invalid frontmatter in ${(0,
|
|
16495
|
+
`Invalid frontmatter in ${(0, import_node_path116.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16312
16496
|
)
|
|
16313
16497
|
};
|
|
16314
16498
|
}
|
|
@@ -16364,12 +16548,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
16364
16548
|
};
|
|
16365
16549
|
|
|
16366
16550
|
// src/features/rules/cursor-rule.ts
|
|
16367
|
-
var
|
|
16368
|
-
var
|
|
16369
|
-
var CursorRuleFrontmatterSchema =
|
|
16370
|
-
description:
|
|
16371
|
-
globs:
|
|
16372
|
-
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())
|
|
16373
16557
|
});
|
|
16374
16558
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
16375
16559
|
frontmatter;
|
|
@@ -16386,7 +16570,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16386
16570
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16387
16571
|
if (!result.success) {
|
|
16388
16572
|
throw new Error(
|
|
16389
|
-
`Invalid frontmatter in ${(0,
|
|
16573
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16390
16574
|
);
|
|
16391
16575
|
}
|
|
16392
16576
|
}
|
|
@@ -16502,7 +16686,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16502
16686
|
relativeFilePath,
|
|
16503
16687
|
validate = true
|
|
16504
16688
|
}) {
|
|
16505
|
-
const filePath = (0,
|
|
16689
|
+
const filePath = (0, import_node_path117.join)(
|
|
16506
16690
|
baseDir,
|
|
16507
16691
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
16508
16692
|
relativeFilePath
|
|
@@ -16512,7 +16696,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16512
16696
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16513
16697
|
if (!result.success) {
|
|
16514
16698
|
throw new Error(
|
|
16515
|
-
`Invalid frontmatter in ${(0,
|
|
16699
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
16516
16700
|
);
|
|
16517
16701
|
}
|
|
16518
16702
|
return new _CursorRule({
|
|
@@ -16549,7 +16733,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16549
16733
|
return {
|
|
16550
16734
|
success: false,
|
|
16551
16735
|
error: new Error(
|
|
16552
|
-
`Invalid frontmatter in ${(0,
|
|
16736
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16553
16737
|
)
|
|
16554
16738
|
};
|
|
16555
16739
|
}
|
|
@@ -16569,7 +16753,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16569
16753
|
};
|
|
16570
16754
|
|
|
16571
16755
|
// src/features/rules/deepagents-rule.ts
|
|
16572
|
-
var
|
|
16756
|
+
var import_node_path118 = require("path");
|
|
16573
16757
|
var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
16574
16758
|
constructor({ fileContent, root, ...rest }) {
|
|
16575
16759
|
super({
|
|
@@ -16596,8 +16780,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
16596
16780
|
}) {
|
|
16597
16781
|
const settablePaths = this.getSettablePaths();
|
|
16598
16782
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
16599
|
-
const relativePath = isRoot ? (0,
|
|
16600
|
-
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));
|
|
16601
16785
|
return new _DeepagentsRule({
|
|
16602
16786
|
baseDir,
|
|
16603
16787
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -16652,7 +16836,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
16652
16836
|
};
|
|
16653
16837
|
|
|
16654
16838
|
// src/features/rules/factorydroid-rule.ts
|
|
16655
|
-
var
|
|
16839
|
+
var import_node_path119 = require("path");
|
|
16656
16840
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
16657
16841
|
constructor({ fileContent, root, ...rest }) {
|
|
16658
16842
|
super({
|
|
@@ -16692,8 +16876,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16692
16876
|
const paths = this.getSettablePaths({ global });
|
|
16693
16877
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
16694
16878
|
if (isRoot) {
|
|
16695
|
-
const relativePath2 = (0,
|
|
16696
|
-
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));
|
|
16697
16881
|
return new _FactorydroidRule({
|
|
16698
16882
|
baseDir,
|
|
16699
16883
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -16706,8 +16890,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16706
16890
|
if (!paths.nonRoot) {
|
|
16707
16891
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16708
16892
|
}
|
|
16709
|
-
const relativePath = (0,
|
|
16710
|
-
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));
|
|
16711
16895
|
return new _FactorydroidRule({
|
|
16712
16896
|
baseDir,
|
|
16713
16897
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16766,7 +16950,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16766
16950
|
};
|
|
16767
16951
|
|
|
16768
16952
|
// src/features/rules/geminicli-rule.ts
|
|
16769
|
-
var
|
|
16953
|
+
var import_node_path120 = require("path");
|
|
16770
16954
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
16771
16955
|
static getSettablePaths({
|
|
16772
16956
|
global,
|
|
@@ -16801,7 +16985,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
16801
16985
|
if (isRoot) {
|
|
16802
16986
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16803
16987
|
const fileContent2 = await readFileContent(
|
|
16804
|
-
(0,
|
|
16988
|
+
(0, import_node_path120.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16805
16989
|
);
|
|
16806
16990
|
return new _GeminiCliRule({
|
|
16807
16991
|
baseDir,
|
|
@@ -16815,8 +16999,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
16815
16999
|
if (!paths.nonRoot) {
|
|
16816
17000
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16817
17001
|
}
|
|
16818
|
-
const relativePath = (0,
|
|
16819
|
-
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));
|
|
16820
17004
|
return new _GeminiCliRule({
|
|
16821
17005
|
baseDir,
|
|
16822
17006
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16875,7 +17059,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
16875
17059
|
};
|
|
16876
17060
|
|
|
16877
17061
|
// src/features/rules/goose-rule.ts
|
|
16878
|
-
var
|
|
17062
|
+
var import_node_path121 = require("path");
|
|
16879
17063
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
16880
17064
|
static getSettablePaths({
|
|
16881
17065
|
global,
|
|
@@ -16910,7 +17094,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
16910
17094
|
if (isRoot) {
|
|
16911
17095
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16912
17096
|
const fileContent2 = await readFileContent(
|
|
16913
|
-
(0,
|
|
17097
|
+
(0, import_node_path121.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16914
17098
|
);
|
|
16915
17099
|
return new _GooseRule({
|
|
16916
17100
|
baseDir,
|
|
@@ -16924,8 +17108,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
16924
17108
|
if (!paths.nonRoot) {
|
|
16925
17109
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16926
17110
|
}
|
|
16927
|
-
const relativePath = (0,
|
|
16928
|
-
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));
|
|
16929
17113
|
return new _GooseRule({
|
|
16930
17114
|
baseDir,
|
|
16931
17115
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16984,7 +17168,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
16984
17168
|
};
|
|
16985
17169
|
|
|
16986
17170
|
// src/features/rules/junie-rule.ts
|
|
16987
|
-
var
|
|
17171
|
+
var import_node_path122 = require("path");
|
|
16988
17172
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
16989
17173
|
static getSettablePaths(_options = {}) {
|
|
16990
17174
|
return {
|
|
@@ -17013,8 +17197,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
17013
17197
|
}) {
|
|
17014
17198
|
const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
|
|
17015
17199
|
const settablePaths = this.getSettablePaths();
|
|
17016
|
-
const relativePath = isRoot ? (0,
|
|
17017
|
-
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));
|
|
17018
17202
|
return new _JunieRule({
|
|
17019
17203
|
baseDir,
|
|
17020
17204
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -17069,7 +17253,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
17069
17253
|
};
|
|
17070
17254
|
|
|
17071
17255
|
// src/features/rules/kilo-rule.ts
|
|
17072
|
-
var
|
|
17256
|
+
var import_node_path123 = require("path");
|
|
17073
17257
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
17074
17258
|
static getSettablePaths({
|
|
17075
17259
|
global,
|
|
@@ -17104,7 +17288,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17104
17288
|
if (isRoot) {
|
|
17105
17289
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17106
17290
|
const fileContent2 = await readFileContent(
|
|
17107
|
-
(0,
|
|
17291
|
+
(0, import_node_path123.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17108
17292
|
);
|
|
17109
17293
|
return new _KiloRule({
|
|
17110
17294
|
baseDir,
|
|
@@ -17118,8 +17302,8 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17118
17302
|
if (!paths.nonRoot) {
|
|
17119
17303
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17120
17304
|
}
|
|
17121
|
-
const relativePath = (0,
|
|
17122
|
-
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));
|
|
17123
17307
|
return new _KiloRule({
|
|
17124
17308
|
baseDir,
|
|
17125
17309
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17178,7 +17362,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17178
17362
|
};
|
|
17179
17363
|
|
|
17180
17364
|
// src/features/rules/kiro-rule.ts
|
|
17181
|
-
var
|
|
17365
|
+
var import_node_path124 = require("path");
|
|
17182
17366
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
17183
17367
|
static getSettablePaths(_options = {}) {
|
|
17184
17368
|
return {
|
|
@@ -17193,7 +17377,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
17193
17377
|
validate = true
|
|
17194
17378
|
}) {
|
|
17195
17379
|
const fileContent = await readFileContent(
|
|
17196
|
-
(0,
|
|
17380
|
+
(0, import_node_path124.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17197
17381
|
);
|
|
17198
17382
|
return new _KiroRule({
|
|
17199
17383
|
baseDir,
|
|
@@ -17247,7 +17431,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
17247
17431
|
};
|
|
17248
17432
|
|
|
17249
17433
|
// src/features/rules/opencode-rule.ts
|
|
17250
|
-
var
|
|
17434
|
+
var import_node_path125 = require("path");
|
|
17251
17435
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
17252
17436
|
static getSettablePaths({
|
|
17253
17437
|
global,
|
|
@@ -17282,7 +17466,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17282
17466
|
if (isRoot) {
|
|
17283
17467
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17284
17468
|
const fileContent2 = await readFileContent(
|
|
17285
|
-
(0,
|
|
17469
|
+
(0, import_node_path125.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17286
17470
|
);
|
|
17287
17471
|
return new _OpenCodeRule({
|
|
17288
17472
|
baseDir,
|
|
@@ -17296,8 +17480,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17296
17480
|
if (!paths.nonRoot) {
|
|
17297
17481
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17298
17482
|
}
|
|
17299
|
-
const relativePath = (0,
|
|
17300
|
-
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));
|
|
17301
17485
|
return new _OpenCodeRule({
|
|
17302
17486
|
baseDir,
|
|
17303
17487
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17356,7 +17540,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17356
17540
|
};
|
|
17357
17541
|
|
|
17358
17542
|
// src/features/rules/qwencode-rule.ts
|
|
17359
|
-
var
|
|
17543
|
+
var import_node_path126 = require("path");
|
|
17360
17544
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
17361
17545
|
static getSettablePaths(_options = {}) {
|
|
17362
17546
|
return {
|
|
@@ -17375,8 +17559,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
17375
17559
|
validate = true
|
|
17376
17560
|
}) {
|
|
17377
17561
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
17378
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
17379
|
-
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));
|
|
17380
17564
|
return new _QwencodeRule({
|
|
17381
17565
|
baseDir,
|
|
17382
17566
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -17428,7 +17612,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
17428
17612
|
};
|
|
17429
17613
|
|
|
17430
17614
|
// src/features/rules/replit-rule.ts
|
|
17431
|
-
var
|
|
17615
|
+
var import_node_path127 = require("path");
|
|
17432
17616
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
17433
17617
|
static getSettablePaths(_options = {}) {
|
|
17434
17618
|
return {
|
|
@@ -17450,7 +17634,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
17450
17634
|
}
|
|
17451
17635
|
const relativePath = paths.root.relativeFilePath;
|
|
17452
17636
|
const fileContent = await readFileContent(
|
|
17453
|
-
(0,
|
|
17637
|
+
(0, import_node_path127.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
17454
17638
|
);
|
|
17455
17639
|
return new _ReplitRule({
|
|
17456
17640
|
baseDir,
|
|
@@ -17516,7 +17700,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
17516
17700
|
};
|
|
17517
17701
|
|
|
17518
17702
|
// src/features/rules/roo-rule.ts
|
|
17519
|
-
var
|
|
17703
|
+
var import_node_path128 = require("path");
|
|
17520
17704
|
var RooRule = class _RooRule extends ToolRule {
|
|
17521
17705
|
static getSettablePaths(_options = {}) {
|
|
17522
17706
|
return {
|
|
@@ -17531,7 +17715,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
17531
17715
|
validate = true
|
|
17532
17716
|
}) {
|
|
17533
17717
|
const fileContent = await readFileContent(
|
|
17534
|
-
(0,
|
|
17718
|
+
(0, import_node_path128.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17535
17719
|
);
|
|
17536
17720
|
return new _RooRule({
|
|
17537
17721
|
baseDir,
|
|
@@ -17600,7 +17784,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
17600
17784
|
};
|
|
17601
17785
|
|
|
17602
17786
|
// src/features/rules/rovodev-rule.ts
|
|
17603
|
-
var
|
|
17787
|
+
var import_node_path129 = require("path");
|
|
17604
17788
|
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
17605
17789
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
17606
17790
|
/**
|
|
@@ -17644,7 +17828,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17644
17828
|
root: rovodevAgents,
|
|
17645
17829
|
alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
|
|
17646
17830
|
nonRoot: {
|
|
17647
|
-
relativeDirPath: (0,
|
|
17831
|
+
relativeDirPath: (0, import_node_path129.join)(".rovodev", ".rulesync", "modular-rules")
|
|
17648
17832
|
}
|
|
17649
17833
|
};
|
|
17650
17834
|
}
|
|
@@ -17683,10 +17867,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17683
17867
|
}) {
|
|
17684
17868
|
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
17685
17869
|
throw new Error(
|
|
17686
|
-
`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)}`
|
|
17687
17871
|
);
|
|
17688
17872
|
}
|
|
17689
|
-
const fileContent = await readFileContent((0,
|
|
17873
|
+
const fileContent = await readFileContent((0, import_node_path129.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
17690
17874
|
return new _RovodevRule({
|
|
17691
17875
|
baseDir,
|
|
17692
17876
|
relativeDirPath,
|
|
@@ -17706,10 +17890,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17706
17890
|
paths
|
|
17707
17891
|
}) {
|
|
17708
17892
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17709
|
-
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);
|
|
17710
17894
|
if (relativeFilePath !== "AGENTS.md") {
|
|
17711
17895
|
throw new Error(
|
|
17712
|
-
`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)}`
|
|
17713
17897
|
);
|
|
17714
17898
|
}
|
|
17715
17899
|
const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
|
|
@@ -17717,10 +17901,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17717
17901
|
);
|
|
17718
17902
|
if (!allowed) {
|
|
17719
17903
|
throw new Error(
|
|
17720
|
-
`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)}`
|
|
17721
17905
|
);
|
|
17722
17906
|
}
|
|
17723
|
-
const fileContent = await readFileContent((0,
|
|
17907
|
+
const fileContent = await readFileContent((0, import_node_path129.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
17724
17908
|
return new _RovodevRule({
|
|
17725
17909
|
baseDir,
|
|
17726
17910
|
relativeDirPath,
|
|
@@ -17834,7 +18018,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17834
18018
|
};
|
|
17835
18019
|
|
|
17836
18020
|
// src/features/rules/warp-rule.ts
|
|
17837
|
-
var
|
|
18021
|
+
var import_node_path130 = require("path");
|
|
17838
18022
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
17839
18023
|
constructor({ fileContent, root, ...rest }) {
|
|
17840
18024
|
super({
|
|
@@ -17860,8 +18044,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
17860
18044
|
validate = true
|
|
17861
18045
|
}) {
|
|
17862
18046
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
17863
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
17864
|
-
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));
|
|
17865
18049
|
return new _WarpRule({
|
|
17866
18050
|
baseDir,
|
|
17867
18051
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -17916,7 +18100,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
17916
18100
|
};
|
|
17917
18101
|
|
|
17918
18102
|
// src/features/rules/windsurf-rule.ts
|
|
17919
|
-
var
|
|
18103
|
+
var import_node_path131 = require("path");
|
|
17920
18104
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
17921
18105
|
static getSettablePaths(_options = {}) {
|
|
17922
18106
|
return {
|
|
@@ -17931,7 +18115,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
17931
18115
|
validate = true
|
|
17932
18116
|
}) {
|
|
17933
18117
|
const fileContent = await readFileContent(
|
|
17934
|
-
(0,
|
|
18118
|
+
(0, import_node_path131.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17935
18119
|
);
|
|
17936
18120
|
return new _WindsurfRule({
|
|
17937
18121
|
baseDir,
|
|
@@ -18029,11 +18213,11 @@ var rulesProcessorToolTargets = [
|
|
|
18029
18213
|
"warp",
|
|
18030
18214
|
"windsurf"
|
|
18031
18215
|
];
|
|
18032
|
-
var RulesProcessorToolTargetSchema =
|
|
18033
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
18034
|
-
var RulesFeatureOptionsSchema =
|
|
18035
|
-
ruleDiscoveryMode:
|
|
18036
|
-
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())
|
|
18037
18221
|
});
|
|
18038
18222
|
var resolveRuleDiscoveryMode = ({
|
|
18039
18223
|
defaultMode,
|
|
@@ -18054,8 +18238,8 @@ var resolveRuleDiscoveryMode = ({
|
|
|
18054
18238
|
}
|
|
18055
18239
|
return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
|
|
18056
18240
|
};
|
|
18057
|
-
var IncludeLocalRootSchema =
|
|
18058
|
-
includeLocalRoot:
|
|
18241
|
+
var IncludeLocalRootSchema = import_mini66.z.looseObject({
|
|
18242
|
+
includeLocalRoot: import_mini66.z.optional(import_mini66.z.boolean())
|
|
18059
18243
|
});
|
|
18060
18244
|
var resolveIncludeLocalRoot = (options) => {
|
|
18061
18245
|
if (!options) return true;
|
|
@@ -18361,6 +18545,8 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
18361
18545
|
extension: "md",
|
|
18362
18546
|
supportsGlobal: false,
|
|
18363
18547
|
ruleDiscoveryMode: "auto"
|
|
18548
|
+
// No additionalConventions.skills needed: Windsurf Cascade auto-discovers
|
|
18549
|
+
// skills from .windsurf/skills/ and ~/.codeium/windsurf/skills/ directories.
|
|
18364
18550
|
}
|
|
18365
18551
|
}
|
|
18366
18552
|
]
|
|
@@ -18498,7 +18684,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18498
18684
|
}).relativeDirPath;
|
|
18499
18685
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
18500
18686
|
const frontmatter = skill.getFrontmatter();
|
|
18501
|
-
const relativePath = (0,
|
|
18687
|
+
const relativePath = (0, import_node_path132.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
18502
18688
|
return {
|
|
18503
18689
|
name: frontmatter.name,
|
|
18504
18690
|
description: frontmatter.description,
|
|
@@ -18627,12 +18813,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18627
18813
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
18628
18814
|
*/
|
|
18629
18815
|
async loadRulesyncFiles() {
|
|
18630
|
-
const rulesyncBaseDir = (0,
|
|
18631
|
-
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"));
|
|
18632
18818
|
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
18633
18819
|
const rulesyncRules = await Promise.all(
|
|
18634
18820
|
files.map((file) => {
|
|
18635
|
-
const relativeFilePath = (0,
|
|
18821
|
+
const relativeFilePath = (0, import_node_path132.relative)(rulesyncBaseDir, file);
|
|
18636
18822
|
checkPathTraversal({
|
|
18637
18823
|
relativePath: relativeFilePath,
|
|
18638
18824
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -18707,7 +18893,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18707
18893
|
global: this.global
|
|
18708
18894
|
});
|
|
18709
18895
|
const resolveRelativeDirPath = (filePath) => {
|
|
18710
|
-
const dirName = (0,
|
|
18896
|
+
const dirName = (0, import_node_path132.dirname)((0, import_node_path132.relative)(this.baseDir, filePath));
|
|
18711
18897
|
return dirName === "" ? "." : dirName;
|
|
18712
18898
|
};
|
|
18713
18899
|
const buildDeletionRulesFromPaths = (filePaths, opts) => {
|
|
@@ -18715,7 +18901,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18715
18901
|
const effectiveBaseDir = isNonRoot ? opts.baseDirOverride : this.baseDir;
|
|
18716
18902
|
return filePaths.map((filePath) => {
|
|
18717
18903
|
const relativeDirPath = isNonRoot ? opts.relativeDirPathOverride : resolveRelativeDirPath(filePath);
|
|
18718
|
-
const relativeFilePath = isNonRoot ? (0,
|
|
18904
|
+
const relativeFilePath = isNonRoot ? (0, import_node_path132.relative)(effectiveBaseDir, filePath) : (0, import_node_path132.basename)(filePath);
|
|
18719
18905
|
checkPathTraversal({
|
|
18720
18906
|
relativePath: isNonRoot ? relativeFilePath : relativeDirPath,
|
|
18721
18907
|
intendedRootDir: effectiveBaseDir
|
|
@@ -18743,13 +18929,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18743
18929
|
return [];
|
|
18744
18930
|
}
|
|
18745
18931
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
18746
|
-
(0,
|
|
18932
|
+
(0, import_node_path132.join)(
|
|
18747
18933
|
this.baseDir,
|
|
18748
18934
|
settablePaths.root.relativeDirPath ?? ".",
|
|
18749
18935
|
settablePaths.root.relativeFilePath
|
|
18750
18936
|
),
|
|
18751
18937
|
settablePaths.alternativeRoots,
|
|
18752
|
-
(alt) => (0,
|
|
18938
|
+
(alt) => (0, import_node_path132.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
18753
18939
|
);
|
|
18754
18940
|
if (forDeletion) {
|
|
18755
18941
|
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
@@ -18763,7 +18949,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18763
18949
|
});
|
|
18764
18950
|
return factory.class.fromFile({
|
|
18765
18951
|
baseDir: this.baseDir,
|
|
18766
|
-
relativeFilePath: (0,
|
|
18952
|
+
relativeFilePath: (0, import_node_path132.basename)(filePath),
|
|
18767
18953
|
relativeDirPath,
|
|
18768
18954
|
global: this.global
|
|
18769
18955
|
});
|
|
@@ -18780,7 +18966,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18780
18966
|
return [];
|
|
18781
18967
|
}
|
|
18782
18968
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
18783
|
-
(0,
|
|
18969
|
+
(0, import_node_path132.join)(this.baseDir, "AGENTS.local.md")
|
|
18784
18970
|
);
|
|
18785
18971
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
18786
18972
|
}
|
|
@@ -18791,9 +18977,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18791
18977
|
return [];
|
|
18792
18978
|
}
|
|
18793
18979
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
18794
|
-
(0,
|
|
18980
|
+
(0, import_node_path132.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
18795
18981
|
settablePaths.alternativeRoots,
|
|
18796
|
-
(alt) => (0,
|
|
18982
|
+
(alt) => (0, import_node_path132.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
18797
18983
|
);
|
|
18798
18984
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
18799
18985
|
})();
|
|
@@ -18804,20 +18990,20 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18804
18990
|
if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
|
|
18805
18991
|
return [];
|
|
18806
18992
|
}
|
|
18807
|
-
const primaryPaths = await findFilesByGlobs((0,
|
|
18993
|
+
const primaryPaths = await findFilesByGlobs((0, import_node_path132.join)(this.baseDir, ".rovodev", "AGENTS.md"));
|
|
18808
18994
|
if (primaryPaths.length === 0) {
|
|
18809
18995
|
return [];
|
|
18810
18996
|
}
|
|
18811
|
-
const mirrorPaths = await findFilesByGlobs((0,
|
|
18997
|
+
const mirrorPaths = await findFilesByGlobs((0, import_node_path132.join)(this.baseDir, "AGENTS.md"));
|
|
18812
18998
|
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
18813
18999
|
})();
|
|
18814
19000
|
const nonRootToolRules = await (async () => {
|
|
18815
19001
|
if (!settablePaths.nonRoot) {
|
|
18816
19002
|
return [];
|
|
18817
19003
|
}
|
|
18818
|
-
const nonRootBaseDir = (0,
|
|
19004
|
+
const nonRootBaseDir = (0, import_node_path132.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
18819
19005
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
18820
|
-
(0,
|
|
19006
|
+
(0, import_node_path132.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
18821
19007
|
);
|
|
18822
19008
|
if (forDeletion) {
|
|
18823
19009
|
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
@@ -18827,18 +19013,18 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18827
19013
|
}
|
|
18828
19014
|
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
18829
19015
|
const nonRootPathsForImport = this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
18830
|
-
const relativeFilePath = (0,
|
|
19016
|
+
const relativeFilePath = (0, import_node_path132.relative)(nonRootBaseDir, filePath);
|
|
18831
19017
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
18832
19018
|
if (!ok) {
|
|
18833
19019
|
this.logger.warn(
|
|
18834
|
-
`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)}`
|
|
18835
19021
|
);
|
|
18836
19022
|
}
|
|
18837
19023
|
return ok;
|
|
18838
19024
|
}) : nonRootFilePaths;
|
|
18839
19025
|
return await Promise.all(
|
|
18840
19026
|
nonRootPathsForImport.map((filePath) => {
|
|
18841
|
-
const relativeFilePath = (0,
|
|
19027
|
+
const relativeFilePath = (0, import_node_path132.relative)(nonRootBaseDir, filePath);
|
|
18842
19028
|
checkPathTraversal({
|
|
18843
19029
|
relativePath: relativeFilePath,
|
|
18844
19030
|
intendedRootDir: nonRootBaseDir
|
|
@@ -18957,14 +19143,14 @@ s/<command> [arguments]
|
|
|
18957
19143
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
18958
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.
|
|
18959
19145
|
|
|
18960
|
-
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.` : "";
|
|
18961
19147
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
18962
19148
|
|
|
18963
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.
|
|
18964
19150
|
|
|
18965
|
-
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.
|
|
18966
19152
|
|
|
18967
|
-
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.` : "";
|
|
18968
19154
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
18969
19155
|
const result = [
|
|
18970
19156
|
overview,
|
|
@@ -18996,51 +19182,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
18996
19182
|
var import_rest = require("@octokit/rest");
|
|
18997
19183
|
|
|
18998
19184
|
// src/types/fetch.ts
|
|
18999
|
-
var
|
|
19185
|
+
var import_mini68 = require("zod/mini");
|
|
19000
19186
|
|
|
19001
19187
|
// src/types/fetch-targets.ts
|
|
19002
|
-
var
|
|
19188
|
+
var import_mini67 = require("zod/mini");
|
|
19003
19189
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
19004
|
-
var FetchTargetSchema =
|
|
19190
|
+
var FetchTargetSchema = import_mini67.z.enum(ALL_FETCH_TARGETS);
|
|
19005
19191
|
|
|
19006
19192
|
// src/types/fetch.ts
|
|
19007
|
-
var ConflictStrategySchema =
|
|
19008
|
-
var GitHubFileTypeSchema =
|
|
19009
|
-
var GitHubFileEntrySchema =
|
|
19010
|
-
name:
|
|
19011
|
-
path:
|
|
19012
|
-
sha:
|
|
19013
|
-
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(),
|
|
19014
19200
|
type: GitHubFileTypeSchema,
|
|
19015
|
-
download_url:
|
|
19201
|
+
download_url: import_mini68.z.nullable(import_mini68.z.string())
|
|
19016
19202
|
});
|
|
19017
|
-
var FetchOptionsSchema =
|
|
19018
|
-
target:
|
|
19019
|
-
features:
|
|
19020
|
-
ref:
|
|
19021
|
-
path:
|
|
19022
|
-
output:
|
|
19023
|
-
conflict:
|
|
19024
|
-
token:
|
|
19025
|
-
verbose:
|
|
19026
|
-
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())
|
|
19027
19213
|
});
|
|
19028
|
-
var FetchFileStatusSchema =
|
|
19029
|
-
var GitHubRepoInfoSchema =
|
|
19030
|
-
default_branch:
|
|
19031
|
-
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()
|
|
19032
19218
|
});
|
|
19033
|
-
var GitHubReleaseAssetSchema =
|
|
19034
|
-
name:
|
|
19035
|
-
browser_download_url:
|
|
19036
|
-
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()
|
|
19037
19223
|
});
|
|
19038
|
-
var GitHubReleaseSchema =
|
|
19039
|
-
tag_name:
|
|
19040
|
-
name:
|
|
19041
|
-
prerelease:
|
|
19042
|
-
draft:
|
|
19043
|
-
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)
|
|
19044
19230
|
});
|
|
19045
19231
|
|
|
19046
19232
|
// src/lib/github-client.ts
|
|
@@ -19341,9 +19527,9 @@ async function listDirectoryRecursive(params) {
|
|
|
19341
19527
|
}
|
|
19342
19528
|
|
|
19343
19529
|
// src/types/git-provider.ts
|
|
19344
|
-
var
|
|
19530
|
+
var import_mini69 = require("zod/mini");
|
|
19345
19531
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
19346
|
-
var GitProviderSchema =
|
|
19532
|
+
var GitProviderSchema = import_mini69.z.enum(ALL_GIT_PROVIDERS);
|
|
19347
19533
|
|
|
19348
19534
|
// src/lib/source-parser.ts
|
|
19349
19535
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -19469,8 +19655,8 @@ async function processFeatureConversion(params) {
|
|
|
19469
19655
|
}
|
|
19470
19656
|
const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
19471
19657
|
for (const file of rulesyncFiles) {
|
|
19472
|
-
const relativePath = (0,
|
|
19473
|
-
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);
|
|
19474
19660
|
await writeFileContent(outputPath, file.getFileContent());
|
|
19475
19661
|
paths.push(relativePath);
|
|
19476
19662
|
}
|
|
@@ -19618,7 +19804,7 @@ async function fetchFiles(params) {
|
|
|
19618
19804
|
skipped: 0
|
|
19619
19805
|
};
|
|
19620
19806
|
}
|
|
19621
|
-
const outputBasePath = (0,
|
|
19807
|
+
const outputBasePath = (0, import_node_path133.join)(baseDir, outputDir);
|
|
19622
19808
|
for (const { relativePath, size } of filesToFetch) {
|
|
19623
19809
|
checkPathTraversal({
|
|
19624
19810
|
relativePath,
|
|
@@ -19628,7 +19814,7 @@ async function fetchFiles(params) {
|
|
|
19628
19814
|
}
|
|
19629
19815
|
const results = await Promise.all(
|
|
19630
19816
|
filesToFetch.map(async ({ remotePath, relativePath }) => {
|
|
19631
|
-
const localPath = (0,
|
|
19817
|
+
const localPath = (0, import_node_path133.join)(outputBasePath, relativePath);
|
|
19632
19818
|
const exists = await fileExists(localPath);
|
|
19633
19819
|
if (exists && conflictStrategy === "skip") {
|
|
19634
19820
|
logger5.debug(`Skipping existing file: ${relativePath}`);
|
|
@@ -19670,7 +19856,7 @@ async function collectFeatureFiles(params) {
|
|
|
19670
19856
|
);
|
|
19671
19857
|
const results = await Promise.all(
|
|
19672
19858
|
tasks.map(async ({ featurePath }) => {
|
|
19673
|
-
const fullPath = basePath === "." || basePath === "" ? featurePath :
|
|
19859
|
+
const fullPath = basePath === "." || basePath === "" ? featurePath : import_node_path133.posix.join(basePath, featurePath);
|
|
19674
19860
|
const collected = [];
|
|
19675
19861
|
try {
|
|
19676
19862
|
if (featurePath.includes(".")) {
|
|
@@ -19772,7 +19958,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
19772
19958
|
relativePath: toolRelativePath,
|
|
19773
19959
|
intendedRootDir: tempDir
|
|
19774
19960
|
});
|
|
19775
|
-
const localPath = (0,
|
|
19961
|
+
const localPath = (0, import_node_path133.join)(tempDir, toolRelativePath);
|
|
19776
19962
|
const content = await withSemaphore(
|
|
19777
19963
|
semaphore,
|
|
19778
19964
|
() => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
|
|
@@ -19781,7 +19967,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
19781
19967
|
logger5.debug(`Fetched to temp: ${toolRelativePath}`);
|
|
19782
19968
|
})
|
|
19783
19969
|
);
|
|
19784
|
-
const outputBasePath = (0,
|
|
19970
|
+
const outputBasePath = (0, import_node_path133.join)(baseDir, outputDir);
|
|
19785
19971
|
const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
|
|
19786
19972
|
tempDir,
|
|
19787
19973
|
outputDir: outputBasePath,
|
|
@@ -19855,7 +20041,7 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
19855
20041
|
if (relativePath.startsWith("rules/")) {
|
|
19856
20042
|
const restPath = relativePath.substring("rules/".length);
|
|
19857
20043
|
if (toolPaths.rules?.nonRoot) {
|
|
19858
|
-
return (0,
|
|
20044
|
+
return (0, import_node_path133.join)(toolPaths.rules.nonRoot, restPath);
|
|
19859
20045
|
}
|
|
19860
20046
|
}
|
|
19861
20047
|
if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
|
|
@@ -19864,19 +20050,19 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
19864
20050
|
if (relativePath.startsWith("commands/")) {
|
|
19865
20051
|
const restPath = relativePath.substring("commands/".length);
|
|
19866
20052
|
if (toolPaths.commands) {
|
|
19867
|
-
return (0,
|
|
20053
|
+
return (0, import_node_path133.join)(toolPaths.commands, restPath);
|
|
19868
20054
|
}
|
|
19869
20055
|
}
|
|
19870
20056
|
if (relativePath.startsWith("subagents/")) {
|
|
19871
20057
|
const restPath = relativePath.substring("subagents/".length);
|
|
19872
20058
|
if (toolPaths.subagents) {
|
|
19873
|
-
return (0,
|
|
20059
|
+
return (0, import_node_path133.join)(toolPaths.subagents, restPath);
|
|
19874
20060
|
}
|
|
19875
20061
|
}
|
|
19876
20062
|
if (relativePath.startsWith("skills/")) {
|
|
19877
20063
|
const restPath = relativePath.substring("skills/".length);
|
|
19878
20064
|
if (toolPaths.skills) {
|
|
19879
|
-
return (0,
|
|
20065
|
+
return (0, import_node_path133.join)(toolPaths.skills, restPath);
|
|
19880
20066
|
}
|
|
19881
20067
|
}
|
|
19882
20068
|
return relativePath;
|
|
@@ -19961,12 +20147,12 @@ async function fetchCommand(logger5, options) {
|
|
|
19961
20147
|
}
|
|
19962
20148
|
|
|
19963
20149
|
// src/config/config-resolver.ts
|
|
19964
|
-
var
|
|
20150
|
+
var import_node_path135 = require("path");
|
|
19965
20151
|
var import_jsonc_parser4 = require("jsonc-parser");
|
|
19966
20152
|
|
|
19967
20153
|
// src/config/config.ts
|
|
19968
|
-
var
|
|
19969
|
-
var
|
|
20154
|
+
var import_node_path134 = require("path");
|
|
20155
|
+
var import_mini70 = require("zod/mini");
|
|
19970
20156
|
|
|
19971
20157
|
// src/utils/validation.ts
|
|
19972
20158
|
function findControlCharacter(value) {
|
|
@@ -19983,48 +20169,50 @@ function hasControlCharacters(value) {
|
|
|
19983
20169
|
}
|
|
19984
20170
|
|
|
19985
20171
|
// src/config/config.ts
|
|
19986
|
-
var
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
(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")
|
|
19994
20181
|
)
|
|
19995
20182
|
),
|
|
19996
|
-
path: (0,
|
|
19997
|
-
|
|
19998
|
-
(0,
|
|
19999
|
-
(0,
|
|
20000
|
-
(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")
|
|
20001
20188
|
)
|
|
20002
20189
|
)
|
|
20003
20190
|
});
|
|
20004
|
-
var ConfigParamsSchema =
|
|
20005
|
-
baseDirs:
|
|
20191
|
+
var ConfigParamsSchema = import_mini70.z.object({
|
|
20192
|
+
baseDirs: import_mini70.z.array(import_mini70.z.string()),
|
|
20006
20193
|
targets: RulesyncConfigTargetsSchema,
|
|
20007
20194
|
features: RulesyncFeaturesSchema,
|
|
20008
|
-
verbose:
|
|
20009
|
-
delete:
|
|
20195
|
+
verbose: import_mini70.z.boolean(),
|
|
20196
|
+
delete: import_mini70.z.boolean(),
|
|
20010
20197
|
// New non-experimental options
|
|
20011
|
-
global: (0,
|
|
20012
|
-
silent: (0,
|
|
20013
|
-
simulateCommands: (0,
|
|
20014
|
-
simulateSubagents: (0,
|
|
20015
|
-
simulateSkills: (0,
|
|
20016
|
-
gitignoreTargetsOnly: (0,
|
|
20017
|
-
|
|
20018
|
-
|
|
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()),
|
|
20019
20207
|
// Declarative skill sources
|
|
20020
|
-
sources: (0,
|
|
20208
|
+
sources: (0, import_mini70.optional)(import_mini70.z.array(SourceEntrySchema))
|
|
20021
20209
|
});
|
|
20022
|
-
var PartialConfigParamsSchema =
|
|
20023
|
-
var ConfigFileSchema =
|
|
20024
|
-
$schema: (0,
|
|
20025
|
-
...
|
|
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
|
|
20026
20214
|
});
|
|
20027
|
-
var RequiredConfigParamsSchema =
|
|
20215
|
+
var RequiredConfigParamsSchema = import_mini70.z.required(ConfigParamsSchema);
|
|
20028
20216
|
var CONFLICTING_TARGET_PAIRS = [
|
|
20029
20217
|
["augmentcode", "augmentcode-legacy"],
|
|
20030
20218
|
["claudecode", "claudecode-legacy"]
|
|
@@ -20074,6 +20262,7 @@ var Config = class _Config {
|
|
|
20074
20262
|
simulateSubagents;
|
|
20075
20263
|
simulateSkills;
|
|
20076
20264
|
gitignoreTargetsOnly;
|
|
20265
|
+
gitignoreDestination;
|
|
20077
20266
|
dryRun;
|
|
20078
20267
|
check;
|
|
20079
20268
|
sources;
|
|
@@ -20089,6 +20278,7 @@ var Config = class _Config {
|
|
|
20089
20278
|
simulateSubagents,
|
|
20090
20279
|
simulateSkills,
|
|
20091
20280
|
gitignoreTargetsOnly,
|
|
20281
|
+
gitignoreDestination,
|
|
20092
20282
|
dryRun,
|
|
20093
20283
|
check,
|
|
20094
20284
|
sources
|
|
@@ -20114,6 +20304,7 @@ var Config = class _Config {
|
|
|
20114
20304
|
this.simulateSubagents = simulateSubagents ?? false;
|
|
20115
20305
|
this.simulateSkills = simulateSkills ?? false;
|
|
20116
20306
|
this.gitignoreTargetsOnly = gitignoreTargetsOnly ?? true;
|
|
20307
|
+
this.gitignoreDestination = gitignoreDestination ?? "gitignore";
|
|
20117
20308
|
this.dryRun = dryRun ?? false;
|
|
20118
20309
|
this.check = check ?? false;
|
|
20119
20310
|
this.sources = sources ?? [];
|
|
@@ -20271,6 +20462,36 @@ var Config = class _Config {
|
|
|
20271
20462
|
}
|
|
20272
20463
|
return void 0;
|
|
20273
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
|
+
}
|
|
20274
20495
|
/**
|
|
20275
20496
|
* Check if per-target features configuration is being used.
|
|
20276
20497
|
*/
|
|
@@ -20351,6 +20572,7 @@ var getDefaults = () => ({
|
|
|
20351
20572
|
simulateSubagents: false,
|
|
20352
20573
|
simulateSkills: false,
|
|
20353
20574
|
gitignoreTargetsOnly: true,
|
|
20575
|
+
gitignoreDestination: "gitignore",
|
|
20354
20576
|
dryRun: false,
|
|
20355
20577
|
check: false,
|
|
20356
20578
|
sources: []
|
|
@@ -20382,6 +20604,7 @@ var mergeConfigs = (baseConfig, localConfig) => {
|
|
|
20382
20604
|
simulateSubagents: localConfig.simulateSubagents ?? baseConfig.simulateSubagents,
|
|
20383
20605
|
simulateSkills: localConfig.simulateSkills ?? baseConfig.simulateSkills,
|
|
20384
20606
|
gitignoreTargetsOnly: localConfig.gitignoreTargetsOnly ?? baseConfig.gitignoreTargetsOnly,
|
|
20607
|
+
gitignoreDestination: localConfig.gitignoreDestination ?? baseConfig.gitignoreDestination,
|
|
20385
20608
|
dryRun: localConfig.dryRun ?? baseConfig.dryRun,
|
|
20386
20609
|
check: localConfig.check ?? baseConfig.check,
|
|
20387
20610
|
sources: localConfig.sources ?? baseConfig.sources
|
|
@@ -20402,12 +20625,13 @@ var ConfigResolver = class {
|
|
|
20402
20625
|
simulateSkills,
|
|
20403
20626
|
gitignoreTargetsOnly,
|
|
20404
20627
|
dryRun,
|
|
20405
|
-
check
|
|
20628
|
+
check,
|
|
20629
|
+
gitignoreDestination
|
|
20406
20630
|
}) {
|
|
20407
20631
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
20408
20632
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
20409
|
-
const configDir = (0,
|
|
20410
|
-
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);
|
|
20411
20635
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
20412
20636
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
20413
20637
|
try {
|
|
@@ -20451,6 +20675,7 @@ var ConfigResolver = class {
|
|
|
20451
20675
|
simulateSubagents: resolvedSimulateSubagents,
|
|
20452
20676
|
simulateSkills: resolvedSimulateSkills,
|
|
20453
20677
|
gitignoreTargetsOnly: resolvedGitignoreTargetsOnly,
|
|
20678
|
+
gitignoreDestination: gitignoreDestination ?? configByFile.gitignoreDestination ?? getDefaults().gitignoreDestination,
|
|
20454
20679
|
dryRun: dryRun ?? configByFile.dryRun ?? getDefaults().dryRun,
|
|
20455
20680
|
check: check ?? configByFile.check ?? getDefaults().check,
|
|
20456
20681
|
sources: configByFile.sources ?? getDefaults().sources
|
|
@@ -20465,7 +20690,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
20465
20690
|
if (global) {
|
|
20466
20691
|
return [getHomeDirectory()];
|
|
20467
20692
|
}
|
|
20468
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
20693
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path135.resolve)(baseDir));
|
|
20469
20694
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
20470
20695
|
validateBaseDir(baseDir);
|
|
20471
20696
|
});
|
|
@@ -20473,28 +20698,28 @@ function getBaseDirsInLightOfGlobal({
|
|
|
20473
20698
|
}
|
|
20474
20699
|
|
|
20475
20700
|
// src/lib/generate.ts
|
|
20476
|
-
var
|
|
20701
|
+
var import_node_path142 = require("path");
|
|
20477
20702
|
var import_es_toolkit5 = require("es-toolkit");
|
|
20478
20703
|
|
|
20479
20704
|
// src/features/permissions/permissions-processor.ts
|
|
20480
|
-
var
|
|
20705
|
+
var import_mini75 = require("zod/mini");
|
|
20481
20706
|
|
|
20482
20707
|
// src/features/permissions/claudecode-permissions.ts
|
|
20483
|
-
var
|
|
20708
|
+
var import_node_path137 = require("path");
|
|
20484
20709
|
var import_es_toolkit4 = require("es-toolkit");
|
|
20485
20710
|
|
|
20486
20711
|
// src/features/permissions/rulesync-permissions.ts
|
|
20487
|
-
var
|
|
20712
|
+
var import_node_path136 = require("path");
|
|
20488
20713
|
|
|
20489
20714
|
// src/types/permissions.ts
|
|
20490
|
-
var
|
|
20491
|
-
var PermissionActionSchema =
|
|
20492
|
-
var PermissionRulesSchema =
|
|
20493
|
-
var PermissionsConfigSchema =
|
|
20494
|
-
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)
|
|
20495
20720
|
});
|
|
20496
|
-
var RulesyncPermissionsFileSchema =
|
|
20497
|
-
$schema:
|
|
20721
|
+
var RulesyncPermissionsFileSchema = import_mini71.z.looseObject({
|
|
20722
|
+
$schema: import_mini71.z.optional(import_mini71.z.string()),
|
|
20498
20723
|
...PermissionsConfigSchema.shape
|
|
20499
20724
|
});
|
|
20500
20725
|
|
|
@@ -20529,7 +20754,7 @@ var RulesyncPermissions = class _RulesyncPermissions extends RulesyncFile {
|
|
|
20529
20754
|
validate = true
|
|
20530
20755
|
}) {
|
|
20531
20756
|
const paths = _RulesyncPermissions.getSettablePaths();
|
|
20532
|
-
const filePath = (0,
|
|
20757
|
+
const filePath = (0, import_node_path136.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20533
20758
|
if (!await fileExists(filePath)) {
|
|
20534
20759
|
throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
|
|
20535
20760
|
}
|
|
@@ -20637,7 +20862,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
20637
20862
|
validate = true
|
|
20638
20863
|
}) {
|
|
20639
20864
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
20640
|
-
const filePath = (0,
|
|
20865
|
+
const filePath = (0, import_node_path137.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20641
20866
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
20642
20867
|
return new _ClaudecodePermissions({
|
|
20643
20868
|
baseDir,
|
|
@@ -20653,7 +20878,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
20653
20878
|
logger: logger5
|
|
20654
20879
|
}) {
|
|
20655
20880
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
20656
|
-
const filePath = (0,
|
|
20881
|
+
const filePath = (0, import_node_path137.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20657
20882
|
const existingContent = await readOrInitializeFileContent(
|
|
20658
20883
|
filePath,
|
|
20659
20884
|
JSON.stringify({}, null, 2)
|
|
@@ -20730,7 +20955,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
20730
20955
|
settings = JSON.parse(this.getFileContent());
|
|
20731
20956
|
} catch (error) {
|
|
20732
20957
|
throw new Error(
|
|
20733
|
-
`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)}`,
|
|
20734
20959
|
{ cause: error }
|
|
20735
20960
|
);
|
|
20736
20961
|
}
|
|
@@ -20803,7 +21028,7 @@ function convertClaudeToRulesyncPermissions(params) {
|
|
|
20803
21028
|
}
|
|
20804
21029
|
|
|
20805
21030
|
// src/features/permissions/codexcli-permissions.ts
|
|
20806
|
-
var
|
|
21031
|
+
var import_node_path138 = require("path");
|
|
20807
21032
|
var smolToml5 = __toESM(require("smol-toml"), 1);
|
|
20808
21033
|
var RULESYNC_PROFILE_NAME = "rulesync";
|
|
20809
21034
|
var RULESYNC_BASH_RULES_FILE_NAME = "rulesync.rules";
|
|
@@ -20823,7 +21048,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
20823
21048
|
global = false
|
|
20824
21049
|
}) {
|
|
20825
21050
|
const paths = this.getSettablePaths({ global });
|
|
20826
|
-
const filePath = (0,
|
|
21051
|
+
const filePath = (0, import_node_path138.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20827
21052
|
const fileContent = await readFileContentOrNull(filePath) ?? smolToml5.stringify({});
|
|
20828
21053
|
return new _CodexcliPermissions({
|
|
20829
21054
|
baseDir,
|
|
@@ -20841,7 +21066,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
20841
21066
|
global = false
|
|
20842
21067
|
}) {
|
|
20843
21068
|
const paths = this.getSettablePaths({ global });
|
|
20844
|
-
const filePath = (0,
|
|
21069
|
+
const filePath = (0, import_node_path138.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
20845
21070
|
const existingContent = await readFileContentOrNull(filePath) ?? smolToml5.stringify({});
|
|
20846
21071
|
const parsed = toMutableTable(smolToml5.parse(existingContent));
|
|
20847
21072
|
const profile = convertRulesyncToCodexProfile({
|
|
@@ -20866,7 +21091,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
20866
21091
|
parsed = smolToml5.parse(this.getFileContent());
|
|
20867
21092
|
} catch (error) {
|
|
20868
21093
|
throw new Error(
|
|
20869
|
-
`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)}`,
|
|
20870
21095
|
{ cause: error }
|
|
20871
21096
|
);
|
|
20872
21097
|
}
|
|
@@ -20907,7 +21132,7 @@ function createCodexcliBashRulesFile({
|
|
|
20907
21132
|
}) {
|
|
20908
21133
|
return new CodexcliRulesFile({
|
|
20909
21134
|
baseDir,
|
|
20910
|
-
relativeDirPath: (0,
|
|
21135
|
+
relativeDirPath: (0, import_node_path138.join)(".codex", "rules"),
|
|
20911
21136
|
relativeFilePath: RULESYNC_BASH_RULES_FILE_NAME,
|
|
20912
21137
|
fileContent: buildCodexBashRulesContent(config)
|
|
20913
21138
|
});
|
|
@@ -21062,13 +21287,13 @@ function mapBashActionToDecision(action) {
|
|
|
21062
21287
|
}
|
|
21063
21288
|
|
|
21064
21289
|
// src/features/permissions/geminicli-permissions.ts
|
|
21065
|
-
var
|
|
21066
|
-
var
|
|
21067
|
-
var GeminiCliSettingsSchema =
|
|
21068
|
-
tools:
|
|
21069
|
-
|
|
21070
|
-
allowed:
|
|
21071
|
-
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()))
|
|
21072
21297
|
})
|
|
21073
21298
|
)
|
|
21074
21299
|
});
|
|
@@ -21095,7 +21320,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
21095
21320
|
global = false
|
|
21096
21321
|
}) {
|
|
21097
21322
|
const paths = this.getSettablePaths({ global });
|
|
21098
|
-
const filePath = (0,
|
|
21323
|
+
const filePath = (0, import_node_path139.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21099
21324
|
const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21100
21325
|
return new _GeminicliPermissions({
|
|
21101
21326
|
baseDir,
|
|
@@ -21113,7 +21338,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
21113
21338
|
global = false
|
|
21114
21339
|
}) {
|
|
21115
21340
|
const paths = this.getSettablePaths({ global });
|
|
21116
|
-
const filePath = (0,
|
|
21341
|
+
const filePath = (0, import_node_path139.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21117
21342
|
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21118
21343
|
const settingsResult = GeminiCliSettingsSchema.safeParse(JSON.parse(existingContent));
|
|
21119
21344
|
if (!settingsResult.success) {
|
|
@@ -21148,7 +21373,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
21148
21373
|
settings = GeminiCliSettingsSchema.parse(parsed);
|
|
21149
21374
|
} catch (error) {
|
|
21150
21375
|
throw new Error(
|
|
21151
|
-
`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)}`,
|
|
21152
21377
|
{ cause: error }
|
|
21153
21378
|
);
|
|
21154
21379
|
}
|
|
@@ -21226,17 +21451,17 @@ function parseGeminicliToolEntry({ entry }) {
|
|
|
21226
21451
|
}
|
|
21227
21452
|
|
|
21228
21453
|
// src/features/permissions/kiro-permissions.ts
|
|
21229
|
-
var
|
|
21230
|
-
var
|
|
21231
|
-
var KiroAgentSchema =
|
|
21232
|
-
allowedTools:
|
|
21233
|
-
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()))
|
|
21234
21459
|
});
|
|
21235
|
-
var UnknownRecordSchema =
|
|
21460
|
+
var UnknownRecordSchema = import_mini73.z.record(import_mini73.z.string(), import_mini73.z.unknown());
|
|
21236
21461
|
var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
21237
21462
|
static getSettablePaths(_options = {}) {
|
|
21238
21463
|
return {
|
|
21239
|
-
relativeDirPath: (0,
|
|
21464
|
+
relativeDirPath: (0, import_node_path140.join)(".kiro", "agents"),
|
|
21240
21465
|
relativeFilePath: "default.json"
|
|
21241
21466
|
};
|
|
21242
21467
|
}
|
|
@@ -21248,7 +21473,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
21248
21473
|
validate = true
|
|
21249
21474
|
}) {
|
|
21250
21475
|
const paths = this.getSettablePaths();
|
|
21251
|
-
const filePath = (0,
|
|
21476
|
+
const filePath = (0, import_node_path140.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21252
21477
|
const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21253
21478
|
return new _KiroPermissions({
|
|
21254
21479
|
baseDir,
|
|
@@ -21265,7 +21490,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
21265
21490
|
logger: logger5
|
|
21266
21491
|
}) {
|
|
21267
21492
|
const paths = this.getSettablePaths();
|
|
21268
|
-
const filePath = (0,
|
|
21493
|
+
const filePath = (0, import_node_path140.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
21269
21494
|
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
21270
21495
|
const parsedResult = KiroAgentSchema.safeParse(JSON.parse(existingContent));
|
|
21271
21496
|
if (!parsedResult.success) {
|
|
@@ -21289,7 +21514,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
21289
21514
|
parsed = KiroAgentSchema.parse(JSON.parse(this.getFileContent()));
|
|
21290
21515
|
} catch (error) {
|
|
21291
21516
|
throw new Error(
|
|
21292
|
-
`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)}`,
|
|
21293
21518
|
{ cause: error }
|
|
21294
21519
|
);
|
|
21295
21520
|
}
|
|
@@ -21410,15 +21635,15 @@ function asStringArray(value) {
|
|
|
21410
21635
|
}
|
|
21411
21636
|
|
|
21412
21637
|
// src/features/permissions/opencode-permissions.ts
|
|
21413
|
-
var
|
|
21638
|
+
var import_node_path141 = require("path");
|
|
21414
21639
|
var import_jsonc_parser5 = require("jsonc-parser");
|
|
21415
|
-
var
|
|
21416
|
-
var OpencodePermissionSchema =
|
|
21417
|
-
|
|
21418
|
-
|
|
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"]))
|
|
21419
21644
|
]);
|
|
21420
|
-
var OpencodePermissionsConfigSchema =
|
|
21421
|
-
permission:
|
|
21645
|
+
var OpencodePermissionsConfigSchema = import_mini74.z.looseObject({
|
|
21646
|
+
permission: import_mini74.z.optional(import_mini74.z.record(import_mini74.z.string(), OpencodePermissionSchema))
|
|
21422
21647
|
});
|
|
21423
21648
|
var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
21424
21649
|
json;
|
|
@@ -21435,7 +21660,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
21435
21660
|
static getSettablePaths({
|
|
21436
21661
|
global = false
|
|
21437
21662
|
} = {}) {
|
|
21438
|
-
return global ? { relativeDirPath: (0,
|
|
21663
|
+
return global ? { relativeDirPath: (0, import_node_path141.join)(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
|
|
21439
21664
|
}
|
|
21440
21665
|
static async fromFile({
|
|
21441
21666
|
baseDir = process.cwd(),
|
|
@@ -21443,9 +21668,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
21443
21668
|
global = false
|
|
21444
21669
|
}) {
|
|
21445
21670
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
21446
|
-
const jsonDir = (0,
|
|
21447
|
-
const jsoncPath = (0,
|
|
21448
|
-
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");
|
|
21449
21674
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
21450
21675
|
let relativeFilePath = "opencode.jsonc";
|
|
21451
21676
|
if (!fileContent) {
|
|
@@ -21470,9 +21695,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
21470
21695
|
global = false
|
|
21471
21696
|
}) {
|
|
21472
21697
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
21473
|
-
const jsonDir = (0,
|
|
21474
|
-
const jsoncPath = (0,
|
|
21475
|
-
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");
|
|
21476
21701
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
21477
21702
|
let relativeFilePath = "opencode.jsonc";
|
|
21478
21703
|
if (!fileContent) {
|
|
@@ -21549,7 +21774,7 @@ var permissionsProcessorToolTargetTuple = [
|
|
|
21549
21774
|
"kiro",
|
|
21550
21775
|
"opencode"
|
|
21551
21776
|
];
|
|
21552
|
-
var PermissionsProcessorToolTargetSchema =
|
|
21777
|
+
var PermissionsProcessorToolTargetSchema = import_mini75.z.enum(permissionsProcessorToolTargetTuple);
|
|
21553
21778
|
var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
21554
21779
|
[
|
|
21555
21780
|
"claudecode",
|
|
@@ -21784,7 +22009,7 @@ function warnUnsupportedTargets(params) {
|
|
|
21784
22009
|
}
|
|
21785
22010
|
}
|
|
21786
22011
|
async function checkRulesyncDirExists(params) {
|
|
21787
|
-
return fileExists((0,
|
|
22012
|
+
return fileExists((0, import_node_path142.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
21788
22013
|
}
|
|
21789
22014
|
async function generate(params) {
|
|
21790
22015
|
const { config, logger: logger5 } = params;
|
|
@@ -22254,7 +22479,7 @@ async function generateCommand(logger5, options) {
|
|
|
22254
22479
|
}
|
|
22255
22480
|
|
|
22256
22481
|
// src/cli/commands/gitignore.ts
|
|
22257
|
-
var
|
|
22482
|
+
var import_node_path143 = require("path");
|
|
22258
22483
|
|
|
22259
22484
|
// src/cli/commands/gitignore-entries.ts
|
|
22260
22485
|
var normalizeGitignoreEntryTargets = (target) => {
|
|
@@ -22439,6 +22664,9 @@ var GITIGNORE_ENTRY_REGISTRY = [
|
|
|
22439
22664
|
entry: "**/.rovodev/.rulesync/"
|
|
22440
22665
|
},
|
|
22441
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/" },
|
|
22442
22670
|
// Warp
|
|
22443
22671
|
{ target: "warp", feature: "rules", entry: "**/.warp/" },
|
|
22444
22672
|
{ target: "warp", feature: "rules", entry: "**/WARP.md" }
|
|
@@ -22518,13 +22746,14 @@ var warnInvalidFeatures = (features, logger5) => {
|
|
|
22518
22746
|
}
|
|
22519
22747
|
} else {
|
|
22520
22748
|
for (const feature of Object.keys(targetFeatures)) {
|
|
22749
|
+
if (feature === GITIGNORE_DESTINATION_KEY) continue;
|
|
22521
22750
|
warnOnce(feature);
|
|
22522
22751
|
}
|
|
22523
22752
|
}
|
|
22524
22753
|
}
|
|
22525
22754
|
}
|
|
22526
22755
|
};
|
|
22527
|
-
var
|
|
22756
|
+
var resolveGitignoreEntries = (params) => {
|
|
22528
22757
|
const { targets, features, logger: logger5 } = params ?? {};
|
|
22529
22758
|
if (targets && targets.length > 0) {
|
|
22530
22759
|
warnInvalidTargets(targets, logger5);
|
|
@@ -22540,7 +22769,11 @@ var filterGitignoreEntries = (params) => {
|
|
|
22540
22769
|
if (!isFeatureSelected(tag.feature, selectedTagTargets, features)) continue;
|
|
22541
22770
|
if (seen.has(tag.entry)) continue;
|
|
22542
22771
|
seen.add(tag.entry);
|
|
22543
|
-
result.push(
|
|
22772
|
+
result.push({
|
|
22773
|
+
entry: tag.entry,
|
|
22774
|
+
target: selectedTagTargets,
|
|
22775
|
+
feature: tag.feature
|
|
22776
|
+
});
|
|
22544
22777
|
}
|
|
22545
22778
|
return result;
|
|
22546
22779
|
};
|
|
@@ -22597,48 +22830,129 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
22597
22830
|
}
|
|
22598
22831
|
return result;
|
|
22599
22832
|
};
|
|
22600
|
-
var
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
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
|
+
}
|
|
22605
22857
|
}
|
|
22606
|
-
|
|
22607
|
-
|
|
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({
|
|
22608
22868
|
targets: options?.targets,
|
|
22609
22869
|
features: options?.features,
|
|
22610
22870
|
logger: logger5
|
|
22611
22871
|
});
|
|
22612
|
-
const
|
|
22613
|
-
|
|
22614
|
-
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
|
|
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()}
|
|
22619
22898
|
|
|
22620
22899
|
${rulesyncBlock}
|
|
22621
22900
|
` : `${rulesyncBlock}
|
|
22622
22901
|
`;
|
|
22623
|
-
|
|
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) {
|
|
22624
22917
|
if (logger5.jsonMode) {
|
|
22625
22918
|
logger5.captureData("entriesAdded", []);
|
|
22626
22919
|
logger5.captureData("gitignorePath", gitignorePath);
|
|
22627
|
-
logger5.captureData("
|
|
22920
|
+
logger5.captureData("gitattributesPath", gitattributesPath);
|
|
22921
|
+
logger5.captureData("alreadyExisted", [...gitignoreEntries, ...gitattributesEntries]);
|
|
22628
22922
|
}
|
|
22629
|
-
logger5.success(".gitignore
|
|
22923
|
+
logger5.success(".gitignore / .gitattributes are already up to date");
|
|
22630
22924
|
return;
|
|
22631
22925
|
}
|
|
22632
|
-
await writeFileContent(gitignorePath, newContent);
|
|
22633
22926
|
if (logger5.jsonMode) {
|
|
22634
|
-
logger5.captureData("entriesAdded",
|
|
22927
|
+
logger5.captureData("entriesAdded", [
|
|
22928
|
+
...gitignoreResult.entriesToAdd,
|
|
22929
|
+
...gitattributesResult.entriesToAdd
|
|
22930
|
+
]);
|
|
22635
22931
|
logger5.captureData("gitignorePath", gitignorePath);
|
|
22636
|
-
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");
|
|
22637
22942
|
}
|
|
22638
|
-
|
|
22639
|
-
for (const entry of filteredEntries) {
|
|
22943
|
+
for (const entry of gitignoreEntries) {
|
|
22640
22944
|
logger5.info(` ${entry}`);
|
|
22641
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
|
+
}
|
|
22642
22956
|
logger5.info("");
|
|
22643
22957
|
logger5.info(
|
|
22644
22958
|
"\u{1F4A1} If you're using Google Antigravity, note that rules, workflows, and skills won't load if they're gitignored."
|
|
@@ -22965,7 +23279,7 @@ async function importCommand(logger5, options) {
|
|
|
22965
23279
|
}
|
|
22966
23280
|
|
|
22967
23281
|
// src/lib/init.ts
|
|
22968
|
-
var
|
|
23282
|
+
var import_node_path144 = require("path");
|
|
22969
23283
|
async function init() {
|
|
22970
23284
|
const sampleFiles = await createSampleFiles();
|
|
22971
23285
|
const configFile = await createConfigFile();
|
|
@@ -23158,27 +23472,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
23158
23472
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
23159
23473
|
await ensureDir(skillPaths.relativeDirPath);
|
|
23160
23474
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
23161
|
-
const ruleFilepath = (0,
|
|
23475
|
+
const ruleFilepath = (0, import_node_path144.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
23162
23476
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
23163
|
-
const mcpFilepath = (0,
|
|
23477
|
+
const mcpFilepath = (0, import_node_path144.join)(
|
|
23164
23478
|
mcpPaths.recommended.relativeDirPath,
|
|
23165
23479
|
mcpPaths.recommended.relativeFilePath
|
|
23166
23480
|
);
|
|
23167
23481
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
23168
|
-
const commandFilepath = (0,
|
|
23482
|
+
const commandFilepath = (0, import_node_path144.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
23169
23483
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
23170
|
-
const subagentFilepath = (0,
|
|
23484
|
+
const subagentFilepath = (0, import_node_path144.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
23171
23485
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
23172
|
-
const skillDirPath = (0,
|
|
23486
|
+
const skillDirPath = (0, import_node_path144.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
23173
23487
|
await ensureDir(skillDirPath);
|
|
23174
|
-
const skillFilepath = (0,
|
|
23488
|
+
const skillFilepath = (0, import_node_path144.join)(skillDirPath, SKILL_FILE_NAME);
|
|
23175
23489
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
23176
|
-
const ignoreFilepath = (0,
|
|
23490
|
+
const ignoreFilepath = (0, import_node_path144.join)(
|
|
23177
23491
|
ignorePaths.recommended.relativeDirPath,
|
|
23178
23492
|
ignorePaths.recommended.relativeFilePath
|
|
23179
23493
|
);
|
|
23180
23494
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
23181
|
-
const hooksFilepath = (0,
|
|
23495
|
+
const hooksFilepath = (0, import_node_path144.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
23182
23496
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
23183
23497
|
return results;
|
|
23184
23498
|
}
|
|
@@ -23226,12 +23540,12 @@ async function initCommand(logger5) {
|
|
|
23226
23540
|
}
|
|
23227
23541
|
|
|
23228
23542
|
// src/lib/sources.ts
|
|
23229
|
-
var
|
|
23543
|
+
var import_node_path147 = require("path");
|
|
23230
23544
|
var import_promise2 = require("es-toolkit/promise");
|
|
23231
23545
|
|
|
23232
23546
|
// src/lib/git-client.ts
|
|
23233
23547
|
var import_node_child_process = require("child_process");
|
|
23234
|
-
var
|
|
23548
|
+
var import_node_path145 = require("path");
|
|
23235
23549
|
var import_node_util2 = require("util");
|
|
23236
23550
|
var execFileAsync = (0, import_node_util2.promisify)(import_node_child_process.execFile);
|
|
23237
23551
|
var GIT_TIMEOUT_MS = 6e4;
|
|
@@ -23319,7 +23633,7 @@ async function fetchSkillFiles(params) {
|
|
|
23319
23633
|
const { url, ref, skillsPath, logger: logger5 } = params;
|
|
23320
23634
|
validateGitUrl(url, { logger: logger5 });
|
|
23321
23635
|
validateRef(ref);
|
|
23322
|
-
if (skillsPath.split(/[/\\]/).includes("..") || (0,
|
|
23636
|
+
if (skillsPath.split(/[/\\]/).includes("..") || (0, import_node_path145.isAbsolute)(skillsPath)) {
|
|
23323
23637
|
throw new GitClientError(
|
|
23324
23638
|
`Invalid skillsPath "${skillsPath}": must be a relative path without ".."`
|
|
23325
23639
|
);
|
|
@@ -23353,7 +23667,7 @@ async function fetchSkillFiles(params) {
|
|
|
23353
23667
|
timeout: GIT_TIMEOUT_MS
|
|
23354
23668
|
});
|
|
23355
23669
|
await execFileAsync("git", ["-C", tmpDir, "checkout"], { timeout: GIT_TIMEOUT_MS });
|
|
23356
|
-
const skillsDir = (0,
|
|
23670
|
+
const skillsDir = (0, import_node_path145.join)(tmpDir, skillsPath);
|
|
23357
23671
|
if (!await directoryExists(skillsDir)) return [];
|
|
23358
23672
|
return await walkDirectory(skillsDir, skillsDir, 0, { totalFiles: 0, totalSize: 0 }, logger5);
|
|
23359
23673
|
} catch (error) {
|
|
@@ -23375,7 +23689,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
23375
23689
|
const results = [];
|
|
23376
23690
|
for (const name of await listDirectoryFiles(dir)) {
|
|
23377
23691
|
if (name === ".git") continue;
|
|
23378
|
-
const fullPath = (0,
|
|
23692
|
+
const fullPath = (0, import_node_path145.join)(dir, name);
|
|
23379
23693
|
if (await isSymlink(fullPath)) {
|
|
23380
23694
|
logger5?.warn(`Skipping symlink "${fullPath}".`);
|
|
23381
23695
|
continue;
|
|
@@ -23403,7 +23717,7 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
23403
23717
|
);
|
|
23404
23718
|
}
|
|
23405
23719
|
const content = await readFileContent(fullPath);
|
|
23406
|
-
results.push({ relativePath: (0,
|
|
23720
|
+
results.push({ relativePath: (0, import_node_path145.relative)(baseDir, fullPath), content, size });
|
|
23407
23721
|
}
|
|
23408
23722
|
}
|
|
23409
23723
|
return results;
|
|
@@ -23411,28 +23725,28 @@ async function walkDirectory(dir, baseDir, depth = 0, ctx = { totalFiles: 0, tot
|
|
|
23411
23725
|
|
|
23412
23726
|
// src/lib/sources-lock.ts
|
|
23413
23727
|
var import_node_crypto = require("crypto");
|
|
23414
|
-
var
|
|
23415
|
-
var
|
|
23728
|
+
var import_node_path146 = require("path");
|
|
23729
|
+
var import_mini76 = require("zod/mini");
|
|
23416
23730
|
var LOCKFILE_VERSION = 1;
|
|
23417
|
-
var LockedSkillSchema =
|
|
23418
|
-
integrity:
|
|
23731
|
+
var LockedSkillSchema = import_mini76.z.object({
|
|
23732
|
+
integrity: import_mini76.z.string()
|
|
23419
23733
|
});
|
|
23420
|
-
var LockedSourceSchema =
|
|
23421
|
-
requestedRef: (0,
|
|
23422
|
-
resolvedRef:
|
|
23423
|
-
resolvedAt: (0,
|
|
23424
|
-
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)
|
|
23425
23739
|
});
|
|
23426
|
-
var SourcesLockSchema =
|
|
23427
|
-
lockfileVersion:
|
|
23428
|
-
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)
|
|
23429
23743
|
});
|
|
23430
|
-
var LegacyLockedSourceSchema =
|
|
23431
|
-
resolvedRef:
|
|
23432
|
-
skills:
|
|
23744
|
+
var LegacyLockedSourceSchema = import_mini76.z.object({
|
|
23745
|
+
resolvedRef: import_mini76.z.string(),
|
|
23746
|
+
skills: import_mini76.z.array(import_mini76.z.string())
|
|
23433
23747
|
});
|
|
23434
|
-
var LegacySourcesLockSchema =
|
|
23435
|
-
sources:
|
|
23748
|
+
var LegacySourcesLockSchema = import_mini76.z.object({
|
|
23749
|
+
sources: import_mini76.z.record(import_mini76.z.string(), LegacyLockedSourceSchema)
|
|
23436
23750
|
});
|
|
23437
23751
|
function migrateLegacyLock(params) {
|
|
23438
23752
|
const { legacy, logger: logger5 } = params;
|
|
@@ -23457,7 +23771,7 @@ function createEmptyLock() {
|
|
|
23457
23771
|
}
|
|
23458
23772
|
async function readLockFile(params) {
|
|
23459
23773
|
const { logger: logger5 } = params;
|
|
23460
|
-
const lockPath = (0,
|
|
23774
|
+
const lockPath = (0, import_node_path146.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
23461
23775
|
if (!await fileExists(lockPath)) {
|
|
23462
23776
|
logger5.debug("No sources lockfile found, starting fresh.");
|
|
23463
23777
|
return createEmptyLock();
|
|
@@ -23486,7 +23800,7 @@ async function readLockFile(params) {
|
|
|
23486
23800
|
}
|
|
23487
23801
|
async function writeLockFile(params) {
|
|
23488
23802
|
const { logger: logger5 } = params;
|
|
23489
|
-
const lockPath = (0,
|
|
23803
|
+
const lockPath = (0, import_node_path146.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
23490
23804
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
23491
23805
|
await writeFileContent(lockPath, content);
|
|
23492
23806
|
logger5.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -23660,7 +23974,7 @@ function logGitClientHints(params) {
|
|
|
23660
23974
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
23661
23975
|
if (skillNames.length === 0) return true;
|
|
23662
23976
|
for (const name of skillNames) {
|
|
23663
|
-
if (!await directoryExists((0,
|
|
23977
|
+
if (!await directoryExists((0, import_node_path147.join)(curatedDir, name))) {
|
|
23664
23978
|
return false;
|
|
23665
23979
|
}
|
|
23666
23980
|
}
|
|
@@ -23668,10 +23982,10 @@ async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
|
23668
23982
|
}
|
|
23669
23983
|
async function cleanPreviousCuratedSkills(params) {
|
|
23670
23984
|
const { curatedDir, lockedSkillNames, logger: logger5 } = params;
|
|
23671
|
-
const resolvedCuratedDir = (0,
|
|
23985
|
+
const resolvedCuratedDir = (0, import_node_path147.resolve)(curatedDir);
|
|
23672
23986
|
for (const prevSkill of lockedSkillNames) {
|
|
23673
|
-
const prevDir = (0,
|
|
23674
|
-
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)) {
|
|
23675
23989
|
logger5.warn(
|
|
23676
23990
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
23677
23991
|
);
|
|
@@ -23710,9 +24024,9 @@ async function writeSkillAndComputeIntegrity(params) {
|
|
|
23710
24024
|
for (const file of files) {
|
|
23711
24025
|
checkPathTraversal({
|
|
23712
24026
|
relativePath: file.relativePath,
|
|
23713
|
-
intendedRootDir: (0,
|
|
24027
|
+
intendedRootDir: (0, import_node_path147.join)(curatedDir, skillName)
|
|
23714
24028
|
});
|
|
23715
|
-
await writeFileContent((0,
|
|
24029
|
+
await writeFileContent((0, import_node_path147.join)(curatedDir, skillName, file.relativePath), file.content);
|
|
23716
24030
|
written.push({ path: file.relativePath, content: file.content });
|
|
23717
24031
|
}
|
|
23718
24032
|
const integrity = computeSkillIntegrity(written);
|
|
@@ -23789,7 +24103,7 @@ async function fetchSource(params) {
|
|
|
23789
24103
|
ref = resolvedSha;
|
|
23790
24104
|
logger5.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
23791
24105
|
}
|
|
23792
|
-
const curatedDir = (0,
|
|
24106
|
+
const curatedDir = (0, import_node_path147.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
23793
24107
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
23794
24108
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
23795
24109
|
if (allExist) {
|
|
@@ -23914,7 +24228,7 @@ async function fetchSourceViaGit(params) {
|
|
|
23914
24228
|
requestedRef = def.ref;
|
|
23915
24229
|
resolvedSha = def.sha;
|
|
23916
24230
|
}
|
|
23917
|
-
const curatedDir = (0,
|
|
24231
|
+
const curatedDir = (0, import_node_path147.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
23918
24232
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
23919
24233
|
if (await checkLockedSkillsExist(curatedDir, lockedSkillNames)) {
|
|
23920
24234
|
return { skillCount: 0, fetchedSkillNames: lockedSkillNames, updatedLock: lock };
|
|
@@ -23947,6 +24261,18 @@ async function fetchSourceViaGit(params) {
|
|
|
23947
24261
|
arr.push({ relativePath: inner, content: file.content });
|
|
23948
24262
|
skillFileMap.set(name, arr);
|
|
23949
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
|
+
}
|
|
23950
24276
|
const allNames = [...skillFileMap.keys()];
|
|
23951
24277
|
const filteredNames = isWildcard ? allNames : allNames.filter((n) => skillFilter.includes(n));
|
|
23952
24278
|
if (locked) {
|
|
@@ -24030,11 +24356,11 @@ async function installCommand(logger5, options) {
|
|
|
24030
24356
|
var import_fastmcp = require("fastmcp");
|
|
24031
24357
|
|
|
24032
24358
|
// src/mcp/tools.ts
|
|
24033
|
-
var
|
|
24359
|
+
var import_mini85 = require("zod/mini");
|
|
24034
24360
|
|
|
24035
24361
|
// src/mcp/commands.ts
|
|
24036
|
-
var
|
|
24037
|
-
var
|
|
24362
|
+
var import_node_path148 = require("path");
|
|
24363
|
+
var import_mini77 = require("zod/mini");
|
|
24038
24364
|
|
|
24039
24365
|
// src/utils/logger.ts
|
|
24040
24366
|
var BaseLogger = class {
|
|
@@ -24185,7 +24511,7 @@ var logger = new ConsoleLogger({ verbose: false, silent: true });
|
|
|
24185
24511
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
24186
24512
|
var maxCommandsCount = 1e3;
|
|
24187
24513
|
async function listCommands() {
|
|
24188
|
-
const commandsDir = (0,
|
|
24514
|
+
const commandsDir = (0, import_node_path148.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
24189
24515
|
try {
|
|
24190
24516
|
const files = await listDirectoryFiles(commandsDir);
|
|
24191
24517
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -24201,7 +24527,7 @@ async function listCommands() {
|
|
|
24201
24527
|
});
|
|
24202
24528
|
const frontmatter = command.getFrontmatter();
|
|
24203
24529
|
return {
|
|
24204
|
-
relativePathFromCwd: (0,
|
|
24530
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
24205
24531
|
frontmatter
|
|
24206
24532
|
};
|
|
24207
24533
|
} catch (error) {
|
|
@@ -24223,13 +24549,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
24223
24549
|
relativePath: relativePathFromCwd,
|
|
24224
24550
|
intendedRootDir: process.cwd()
|
|
24225
24551
|
});
|
|
24226
|
-
const filename = (0,
|
|
24552
|
+
const filename = (0, import_node_path148.basename)(relativePathFromCwd);
|
|
24227
24553
|
try {
|
|
24228
24554
|
const command = await RulesyncCommand.fromFile({
|
|
24229
24555
|
relativeFilePath: filename
|
|
24230
24556
|
});
|
|
24231
24557
|
return {
|
|
24232
|
-
relativePathFromCwd: (0,
|
|
24558
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
24233
24559
|
frontmatter: command.getFrontmatter(),
|
|
24234
24560
|
body: command.getBody()
|
|
24235
24561
|
};
|
|
@@ -24248,7 +24574,7 @@ async function putCommand({
|
|
|
24248
24574
|
relativePath: relativePathFromCwd,
|
|
24249
24575
|
intendedRootDir: process.cwd()
|
|
24250
24576
|
});
|
|
24251
|
-
const filename = (0,
|
|
24577
|
+
const filename = (0, import_node_path148.basename)(relativePathFromCwd);
|
|
24252
24578
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
24253
24579
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
24254
24580
|
throw new Error(
|
|
@@ -24258,7 +24584,7 @@ async function putCommand({
|
|
|
24258
24584
|
try {
|
|
24259
24585
|
const existingCommands = await listCommands();
|
|
24260
24586
|
const isUpdate = existingCommands.some(
|
|
24261
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
24587
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
24262
24588
|
);
|
|
24263
24589
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
24264
24590
|
throw new Error(
|
|
@@ -24275,11 +24601,11 @@ async function putCommand({
|
|
|
24275
24601
|
fileContent,
|
|
24276
24602
|
validate: true
|
|
24277
24603
|
});
|
|
24278
|
-
const commandsDir = (0,
|
|
24604
|
+
const commandsDir = (0, import_node_path148.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
24279
24605
|
await ensureDir(commandsDir);
|
|
24280
24606
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
24281
24607
|
return {
|
|
24282
|
-
relativePathFromCwd: (0,
|
|
24608
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
24283
24609
|
frontmatter: command.getFrontmatter(),
|
|
24284
24610
|
body: command.getBody()
|
|
24285
24611
|
};
|
|
@@ -24294,12 +24620,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
24294
24620
|
relativePath: relativePathFromCwd,
|
|
24295
24621
|
intendedRootDir: process.cwd()
|
|
24296
24622
|
});
|
|
24297
|
-
const filename = (0,
|
|
24298
|
-
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);
|
|
24299
24625
|
try {
|
|
24300
24626
|
await removeFile(fullPath);
|
|
24301
24627
|
return {
|
|
24302
|
-
relativePathFromCwd: (0,
|
|
24628
|
+
relativePathFromCwd: (0, import_node_path148.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
24303
24629
|
};
|
|
24304
24630
|
} catch (error) {
|
|
24305
24631
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -24308,23 +24634,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
24308
24634
|
}
|
|
24309
24635
|
}
|
|
24310
24636
|
var commandToolSchemas = {
|
|
24311
|
-
listCommands:
|
|
24312
|
-
getCommand:
|
|
24313
|
-
relativePathFromCwd:
|
|
24637
|
+
listCommands: import_mini77.z.object({}),
|
|
24638
|
+
getCommand: import_mini77.z.object({
|
|
24639
|
+
relativePathFromCwd: import_mini77.z.string()
|
|
24314
24640
|
}),
|
|
24315
|
-
putCommand:
|
|
24316
|
-
relativePathFromCwd:
|
|
24641
|
+
putCommand: import_mini77.z.object({
|
|
24642
|
+
relativePathFromCwd: import_mini77.z.string(),
|
|
24317
24643
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
24318
|
-
body:
|
|
24644
|
+
body: import_mini77.z.string()
|
|
24319
24645
|
}),
|
|
24320
|
-
deleteCommand:
|
|
24321
|
-
relativePathFromCwd:
|
|
24646
|
+
deleteCommand: import_mini77.z.object({
|
|
24647
|
+
relativePathFromCwd: import_mini77.z.string()
|
|
24322
24648
|
})
|
|
24323
24649
|
};
|
|
24324
24650
|
var commandTools = {
|
|
24325
24651
|
listCommands: {
|
|
24326
24652
|
name: "listCommands",
|
|
24327
|
-
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.`,
|
|
24328
24654
|
parameters: commandToolSchemas.listCommands,
|
|
24329
24655
|
execute: async () => {
|
|
24330
24656
|
const commands = await listCommands();
|
|
@@ -24366,15 +24692,15 @@ var commandTools = {
|
|
|
24366
24692
|
};
|
|
24367
24693
|
|
|
24368
24694
|
// src/mcp/generate.ts
|
|
24369
|
-
var
|
|
24370
|
-
var generateOptionsSchema =
|
|
24371
|
-
targets:
|
|
24372
|
-
features:
|
|
24373
|
-
delete:
|
|
24374
|
-
global:
|
|
24375
|
-
simulateCommands:
|
|
24376
|
-
simulateSubagents:
|
|
24377
|
-
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())
|
|
24378
24704
|
});
|
|
24379
24705
|
async function executeGenerate(options = {}) {
|
|
24380
24706
|
try {
|
|
@@ -24453,11 +24779,11 @@ var generateTools = {
|
|
|
24453
24779
|
};
|
|
24454
24780
|
|
|
24455
24781
|
// src/mcp/ignore.ts
|
|
24456
|
-
var
|
|
24457
|
-
var
|
|
24782
|
+
var import_node_path149 = require("path");
|
|
24783
|
+
var import_mini79 = require("zod/mini");
|
|
24458
24784
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
24459
24785
|
async function getIgnoreFile() {
|
|
24460
|
-
const ignoreFilePath = (0,
|
|
24786
|
+
const ignoreFilePath = (0, import_node_path149.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
24461
24787
|
try {
|
|
24462
24788
|
const content = await readFileContent(ignoreFilePath);
|
|
24463
24789
|
return {
|
|
@@ -24474,7 +24800,7 @@ async function getIgnoreFile() {
|
|
|
24474
24800
|
}
|
|
24475
24801
|
}
|
|
24476
24802
|
async function putIgnoreFile({ content }) {
|
|
24477
|
-
const ignoreFilePath = (0,
|
|
24803
|
+
const ignoreFilePath = (0, import_node_path149.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
24478
24804
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
24479
24805
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
24480
24806
|
throw new Error(
|
|
@@ -24498,8 +24824,8 @@ async function putIgnoreFile({ content }) {
|
|
|
24498
24824
|
}
|
|
24499
24825
|
}
|
|
24500
24826
|
async function deleteIgnoreFile() {
|
|
24501
|
-
const aiignorePath = (0,
|
|
24502
|
-
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);
|
|
24503
24829
|
try {
|
|
24504
24830
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
24505
24831
|
return {
|
|
@@ -24517,11 +24843,11 @@ async function deleteIgnoreFile() {
|
|
|
24517
24843
|
}
|
|
24518
24844
|
}
|
|
24519
24845
|
var ignoreToolSchemas = {
|
|
24520
|
-
getIgnoreFile:
|
|
24521
|
-
putIgnoreFile:
|
|
24522
|
-
content:
|
|
24846
|
+
getIgnoreFile: import_mini79.z.object({}),
|
|
24847
|
+
putIgnoreFile: import_mini79.z.object({
|
|
24848
|
+
content: import_mini79.z.string()
|
|
24523
24849
|
}),
|
|
24524
|
-
deleteIgnoreFile:
|
|
24850
|
+
deleteIgnoreFile: import_mini79.z.object({})
|
|
24525
24851
|
};
|
|
24526
24852
|
var ignoreTools = {
|
|
24527
24853
|
getIgnoreFile: {
|
|
@@ -24554,11 +24880,11 @@ var ignoreTools = {
|
|
|
24554
24880
|
};
|
|
24555
24881
|
|
|
24556
24882
|
// src/mcp/import.ts
|
|
24557
|
-
var
|
|
24558
|
-
var importOptionsSchema =
|
|
24559
|
-
target:
|
|
24560
|
-
features:
|
|
24561
|
-
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())
|
|
24562
24888
|
});
|
|
24563
24889
|
async function executeImport(options) {
|
|
24564
24890
|
try {
|
|
@@ -24629,15 +24955,15 @@ var importTools = {
|
|
|
24629
24955
|
};
|
|
24630
24956
|
|
|
24631
24957
|
// src/mcp/mcp.ts
|
|
24632
|
-
var
|
|
24633
|
-
var
|
|
24958
|
+
var import_node_path150 = require("path");
|
|
24959
|
+
var import_mini81 = require("zod/mini");
|
|
24634
24960
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
24635
24961
|
async function getMcpFile() {
|
|
24636
24962
|
try {
|
|
24637
24963
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
24638
24964
|
validate: true
|
|
24639
24965
|
});
|
|
24640
|
-
const relativePathFromCwd = (0,
|
|
24966
|
+
const relativePathFromCwd = (0, import_node_path150.join)(
|
|
24641
24967
|
rulesyncMcp.getRelativeDirPath(),
|
|
24642
24968
|
rulesyncMcp.getRelativeFilePath()
|
|
24643
24969
|
);
|
|
@@ -24675,7 +25001,7 @@ async function putMcpFile({ content }) {
|
|
|
24675
25001
|
const paths = RulesyncMcp.getSettablePaths();
|
|
24676
25002
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
24677
25003
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
24678
|
-
const fullPath = (0,
|
|
25004
|
+
const fullPath = (0, import_node_path150.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
24679
25005
|
const rulesyncMcp = new RulesyncMcp({
|
|
24680
25006
|
baseDir,
|
|
24681
25007
|
relativeDirPath,
|
|
@@ -24683,9 +25009,9 @@ async function putMcpFile({ content }) {
|
|
|
24683
25009
|
fileContent: content,
|
|
24684
25010
|
validate: true
|
|
24685
25011
|
});
|
|
24686
|
-
await ensureDir((0,
|
|
25012
|
+
await ensureDir((0, import_node_path150.join)(baseDir, relativeDirPath));
|
|
24687
25013
|
await writeFileContent(fullPath, content);
|
|
24688
|
-
const relativePathFromCwd = (0,
|
|
25014
|
+
const relativePathFromCwd = (0, import_node_path150.join)(relativeDirPath, relativeFilePath);
|
|
24689
25015
|
return {
|
|
24690
25016
|
relativePathFromCwd,
|
|
24691
25017
|
content: rulesyncMcp.getFileContent()
|
|
@@ -24703,15 +25029,15 @@ async function deleteMcpFile() {
|
|
|
24703
25029
|
try {
|
|
24704
25030
|
const baseDir = process.cwd();
|
|
24705
25031
|
const paths = RulesyncMcp.getSettablePaths();
|
|
24706
|
-
const recommendedPath = (0,
|
|
25032
|
+
const recommendedPath = (0, import_node_path150.join)(
|
|
24707
25033
|
baseDir,
|
|
24708
25034
|
paths.recommended.relativeDirPath,
|
|
24709
25035
|
paths.recommended.relativeFilePath
|
|
24710
25036
|
);
|
|
24711
|
-
const legacyPath = (0,
|
|
25037
|
+
const legacyPath = (0, import_node_path150.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
24712
25038
|
await removeFile(recommendedPath);
|
|
24713
25039
|
await removeFile(legacyPath);
|
|
24714
|
-
const relativePathFromCwd = (0,
|
|
25040
|
+
const relativePathFromCwd = (0, import_node_path150.join)(
|
|
24715
25041
|
paths.recommended.relativeDirPath,
|
|
24716
25042
|
paths.recommended.relativeFilePath
|
|
24717
25043
|
);
|
|
@@ -24728,11 +25054,11 @@ async function deleteMcpFile() {
|
|
|
24728
25054
|
}
|
|
24729
25055
|
}
|
|
24730
25056
|
var mcpToolSchemas = {
|
|
24731
|
-
getMcpFile:
|
|
24732
|
-
putMcpFile:
|
|
24733
|
-
content:
|
|
25057
|
+
getMcpFile: import_mini81.z.object({}),
|
|
25058
|
+
putMcpFile: import_mini81.z.object({
|
|
25059
|
+
content: import_mini81.z.string()
|
|
24734
25060
|
}),
|
|
24735
|
-
deleteMcpFile:
|
|
25061
|
+
deleteMcpFile: import_mini81.z.object({})
|
|
24736
25062
|
};
|
|
24737
25063
|
var mcpTools = {
|
|
24738
25064
|
getMcpFile: {
|
|
@@ -24765,13 +25091,13 @@ var mcpTools = {
|
|
|
24765
25091
|
};
|
|
24766
25092
|
|
|
24767
25093
|
// src/mcp/rules.ts
|
|
24768
|
-
var
|
|
24769
|
-
var
|
|
25094
|
+
var import_node_path151 = require("path");
|
|
25095
|
+
var import_mini82 = require("zod/mini");
|
|
24770
25096
|
var logger2 = new ConsoleLogger({ verbose: false, silent: true });
|
|
24771
25097
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
24772
25098
|
var maxRulesCount = 1e3;
|
|
24773
25099
|
async function listRules() {
|
|
24774
|
-
const rulesDir = (0,
|
|
25100
|
+
const rulesDir = (0, import_node_path151.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
24775
25101
|
try {
|
|
24776
25102
|
const files = await listDirectoryFiles(rulesDir);
|
|
24777
25103
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -24784,7 +25110,7 @@ async function listRules() {
|
|
|
24784
25110
|
});
|
|
24785
25111
|
const frontmatter = rule.getFrontmatter();
|
|
24786
25112
|
return {
|
|
24787
|
-
relativePathFromCwd: (0,
|
|
25113
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
24788
25114
|
frontmatter
|
|
24789
25115
|
};
|
|
24790
25116
|
} catch (error) {
|
|
@@ -24806,14 +25132,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
24806
25132
|
relativePath: relativePathFromCwd,
|
|
24807
25133
|
intendedRootDir: process.cwd()
|
|
24808
25134
|
});
|
|
24809
|
-
const filename = (0,
|
|
25135
|
+
const filename = (0, import_node_path151.basename)(relativePathFromCwd);
|
|
24810
25136
|
try {
|
|
24811
25137
|
const rule = await RulesyncRule.fromFile({
|
|
24812
25138
|
relativeFilePath: filename,
|
|
24813
25139
|
validate: true
|
|
24814
25140
|
});
|
|
24815
25141
|
return {
|
|
24816
|
-
relativePathFromCwd: (0,
|
|
25142
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
24817
25143
|
frontmatter: rule.getFrontmatter(),
|
|
24818
25144
|
body: rule.getBody()
|
|
24819
25145
|
};
|
|
@@ -24832,7 +25158,7 @@ async function putRule({
|
|
|
24832
25158
|
relativePath: relativePathFromCwd,
|
|
24833
25159
|
intendedRootDir: process.cwd()
|
|
24834
25160
|
});
|
|
24835
|
-
const filename = (0,
|
|
25161
|
+
const filename = (0, import_node_path151.basename)(relativePathFromCwd);
|
|
24836
25162
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
24837
25163
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
24838
25164
|
throw new Error(
|
|
@@ -24842,7 +25168,7 @@ async function putRule({
|
|
|
24842
25168
|
try {
|
|
24843
25169
|
const existingRules = await listRules();
|
|
24844
25170
|
const isUpdate = existingRules.some(
|
|
24845
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
25171
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
24846
25172
|
);
|
|
24847
25173
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
24848
25174
|
throw new Error(
|
|
@@ -24857,11 +25183,11 @@ async function putRule({
|
|
|
24857
25183
|
body,
|
|
24858
25184
|
validate: true
|
|
24859
25185
|
});
|
|
24860
|
-
const rulesDir = (0,
|
|
25186
|
+
const rulesDir = (0, import_node_path151.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
24861
25187
|
await ensureDir(rulesDir);
|
|
24862
25188
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
24863
25189
|
return {
|
|
24864
|
-
relativePathFromCwd: (0,
|
|
25190
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
24865
25191
|
frontmatter: rule.getFrontmatter(),
|
|
24866
25192
|
body: rule.getBody()
|
|
24867
25193
|
};
|
|
@@ -24876,12 +25202,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
24876
25202
|
relativePath: relativePathFromCwd,
|
|
24877
25203
|
intendedRootDir: process.cwd()
|
|
24878
25204
|
});
|
|
24879
|
-
const filename = (0,
|
|
24880
|
-
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);
|
|
24881
25207
|
try {
|
|
24882
25208
|
await removeFile(fullPath);
|
|
24883
25209
|
return {
|
|
24884
|
-
relativePathFromCwd: (0,
|
|
25210
|
+
relativePathFromCwd: (0, import_node_path151.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
24885
25211
|
};
|
|
24886
25212
|
} catch (error) {
|
|
24887
25213
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -24890,23 +25216,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
24890
25216
|
}
|
|
24891
25217
|
}
|
|
24892
25218
|
var ruleToolSchemas = {
|
|
24893
|
-
listRules:
|
|
24894
|
-
getRule:
|
|
24895
|
-
relativePathFromCwd:
|
|
25219
|
+
listRules: import_mini82.z.object({}),
|
|
25220
|
+
getRule: import_mini82.z.object({
|
|
25221
|
+
relativePathFromCwd: import_mini82.z.string()
|
|
24896
25222
|
}),
|
|
24897
|
-
putRule:
|
|
24898
|
-
relativePathFromCwd:
|
|
25223
|
+
putRule: import_mini82.z.object({
|
|
25224
|
+
relativePathFromCwd: import_mini82.z.string(),
|
|
24899
25225
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
24900
|
-
body:
|
|
25226
|
+
body: import_mini82.z.string()
|
|
24901
25227
|
}),
|
|
24902
|
-
deleteRule:
|
|
24903
|
-
relativePathFromCwd:
|
|
25228
|
+
deleteRule: import_mini82.z.object({
|
|
25229
|
+
relativePathFromCwd: import_mini82.z.string()
|
|
24904
25230
|
})
|
|
24905
25231
|
};
|
|
24906
25232
|
var ruleTools = {
|
|
24907
25233
|
listRules: {
|
|
24908
25234
|
name: "listRules",
|
|
24909
|
-
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.`,
|
|
24910
25236
|
parameters: ruleToolSchemas.listRules,
|
|
24911
25237
|
execute: async () => {
|
|
24912
25238
|
const rules = await listRules();
|
|
@@ -24948,8 +25274,8 @@ var ruleTools = {
|
|
|
24948
25274
|
};
|
|
24949
25275
|
|
|
24950
25276
|
// src/mcp/skills.ts
|
|
24951
|
-
var
|
|
24952
|
-
var
|
|
25277
|
+
var import_node_path152 = require("path");
|
|
25278
|
+
var import_mini83 = require("zod/mini");
|
|
24953
25279
|
var logger3 = new ConsoleLogger({ verbose: false, silent: true });
|
|
24954
25280
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
24955
25281
|
var maxSkillsCount = 1e3;
|
|
@@ -24966,19 +25292,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
24966
25292
|
};
|
|
24967
25293
|
}
|
|
24968
25294
|
function extractDirName(relativeDirPathFromCwd) {
|
|
24969
|
-
const dirName = (0,
|
|
25295
|
+
const dirName = (0, import_node_path152.basename)(relativeDirPathFromCwd);
|
|
24970
25296
|
if (!dirName) {
|
|
24971
25297
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
24972
25298
|
}
|
|
24973
25299
|
return dirName;
|
|
24974
25300
|
}
|
|
24975
25301
|
async function listSkills() {
|
|
24976
|
-
const skillsDir = (0,
|
|
25302
|
+
const skillsDir = (0, import_node_path152.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
24977
25303
|
try {
|
|
24978
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
25304
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path152.join)(skillsDir, "*"), { type: "dir" });
|
|
24979
25305
|
const skills = await Promise.all(
|
|
24980
25306
|
skillDirPaths.map(async (dirPath) => {
|
|
24981
|
-
const dirName = (0,
|
|
25307
|
+
const dirName = (0, import_node_path152.basename)(dirPath);
|
|
24982
25308
|
if (!dirName) return null;
|
|
24983
25309
|
try {
|
|
24984
25310
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -24986,7 +25312,7 @@ async function listSkills() {
|
|
|
24986
25312
|
});
|
|
24987
25313
|
const frontmatter = skill.getFrontmatter();
|
|
24988
25314
|
return {
|
|
24989
|
-
relativeDirPathFromCwd: (0,
|
|
25315
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
24990
25316
|
frontmatter
|
|
24991
25317
|
};
|
|
24992
25318
|
} catch (error) {
|
|
@@ -25014,7 +25340,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
25014
25340
|
dirName
|
|
25015
25341
|
});
|
|
25016
25342
|
return {
|
|
25017
|
-
relativeDirPathFromCwd: (0,
|
|
25343
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
25018
25344
|
frontmatter: skill.getFrontmatter(),
|
|
25019
25345
|
body: skill.getBody(),
|
|
25020
25346
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -25048,7 +25374,7 @@ async function putSkill({
|
|
|
25048
25374
|
try {
|
|
25049
25375
|
const existingSkills = await listSkills();
|
|
25050
25376
|
const isUpdate = existingSkills.some(
|
|
25051
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
25377
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
25052
25378
|
);
|
|
25053
25379
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
25054
25380
|
throw new Error(
|
|
@@ -25065,9 +25391,9 @@ async function putSkill({
|
|
|
25065
25391
|
otherFiles: aiDirFiles,
|
|
25066
25392
|
validate: true
|
|
25067
25393
|
});
|
|
25068
|
-
const skillDirPath = (0,
|
|
25394
|
+
const skillDirPath = (0, import_node_path152.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
25069
25395
|
await ensureDir(skillDirPath);
|
|
25070
|
-
const skillFilePath = (0,
|
|
25396
|
+
const skillFilePath = (0, import_node_path152.join)(skillDirPath, SKILL_FILE_NAME);
|
|
25071
25397
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
25072
25398
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
25073
25399
|
for (const file of otherFiles) {
|
|
@@ -25075,15 +25401,15 @@ async function putSkill({
|
|
|
25075
25401
|
relativePath: file.name,
|
|
25076
25402
|
intendedRootDir: skillDirPath
|
|
25077
25403
|
});
|
|
25078
|
-
const filePath = (0,
|
|
25079
|
-
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));
|
|
25080
25406
|
if (fileDir !== skillDirPath) {
|
|
25081
25407
|
await ensureDir(fileDir);
|
|
25082
25408
|
}
|
|
25083
25409
|
await writeFileContent(filePath, file.body);
|
|
25084
25410
|
}
|
|
25085
25411
|
return {
|
|
25086
|
-
relativeDirPathFromCwd: (0,
|
|
25412
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
25087
25413
|
frontmatter: skill.getFrontmatter(),
|
|
25088
25414
|
body: skill.getBody(),
|
|
25089
25415
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -25105,13 +25431,13 @@ async function deleteSkill({
|
|
|
25105
25431
|
intendedRootDir: process.cwd()
|
|
25106
25432
|
});
|
|
25107
25433
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
25108
|
-
const skillDirPath = (0,
|
|
25434
|
+
const skillDirPath = (0, import_node_path152.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
25109
25435
|
try {
|
|
25110
25436
|
if (await directoryExists(skillDirPath)) {
|
|
25111
25437
|
await removeDirectory(skillDirPath);
|
|
25112
25438
|
}
|
|
25113
25439
|
return {
|
|
25114
|
-
relativeDirPathFromCwd: (0,
|
|
25440
|
+
relativeDirPathFromCwd: (0, import_node_path152.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
25115
25441
|
};
|
|
25116
25442
|
} catch (error) {
|
|
25117
25443
|
throw new Error(
|
|
@@ -25122,29 +25448,29 @@ async function deleteSkill({
|
|
|
25122
25448
|
);
|
|
25123
25449
|
}
|
|
25124
25450
|
}
|
|
25125
|
-
var McpSkillFileSchema =
|
|
25126
|
-
name:
|
|
25127
|
-
body:
|
|
25451
|
+
var McpSkillFileSchema = import_mini83.z.object({
|
|
25452
|
+
name: import_mini83.z.string(),
|
|
25453
|
+
body: import_mini83.z.string()
|
|
25128
25454
|
});
|
|
25129
25455
|
var skillToolSchemas = {
|
|
25130
|
-
listSkills:
|
|
25131
|
-
getSkill:
|
|
25132
|
-
relativeDirPathFromCwd:
|
|
25456
|
+
listSkills: import_mini83.z.object({}),
|
|
25457
|
+
getSkill: import_mini83.z.object({
|
|
25458
|
+
relativeDirPathFromCwd: import_mini83.z.string()
|
|
25133
25459
|
}),
|
|
25134
|
-
putSkill:
|
|
25135
|
-
relativeDirPathFromCwd:
|
|
25460
|
+
putSkill: import_mini83.z.object({
|
|
25461
|
+
relativeDirPathFromCwd: import_mini83.z.string(),
|
|
25136
25462
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
25137
|
-
body:
|
|
25138
|
-
otherFiles:
|
|
25463
|
+
body: import_mini83.z.string(),
|
|
25464
|
+
otherFiles: import_mini83.z.optional(import_mini83.z.array(McpSkillFileSchema))
|
|
25139
25465
|
}),
|
|
25140
|
-
deleteSkill:
|
|
25141
|
-
relativeDirPathFromCwd:
|
|
25466
|
+
deleteSkill: import_mini83.z.object({
|
|
25467
|
+
relativeDirPathFromCwd: import_mini83.z.string()
|
|
25142
25468
|
})
|
|
25143
25469
|
};
|
|
25144
25470
|
var skillTools = {
|
|
25145
25471
|
listSkills: {
|
|
25146
25472
|
name: "listSkills",
|
|
25147
|
-
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.`,
|
|
25148
25474
|
parameters: skillToolSchemas.listSkills,
|
|
25149
25475
|
execute: async () => {
|
|
25150
25476
|
const skills = await listSkills();
|
|
@@ -25187,13 +25513,13 @@ var skillTools = {
|
|
|
25187
25513
|
};
|
|
25188
25514
|
|
|
25189
25515
|
// src/mcp/subagents.ts
|
|
25190
|
-
var
|
|
25191
|
-
var
|
|
25516
|
+
var import_node_path153 = require("path");
|
|
25517
|
+
var import_mini84 = require("zod/mini");
|
|
25192
25518
|
var logger4 = new ConsoleLogger({ verbose: false, silent: true });
|
|
25193
25519
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
25194
25520
|
var maxSubagentsCount = 1e3;
|
|
25195
25521
|
async function listSubagents() {
|
|
25196
|
-
const subagentsDir = (0,
|
|
25522
|
+
const subagentsDir = (0, import_node_path153.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
25197
25523
|
try {
|
|
25198
25524
|
const files = await listDirectoryFiles(subagentsDir);
|
|
25199
25525
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -25206,7 +25532,7 @@ async function listSubagents() {
|
|
|
25206
25532
|
});
|
|
25207
25533
|
const frontmatter = subagent.getFrontmatter();
|
|
25208
25534
|
return {
|
|
25209
|
-
relativePathFromCwd: (0,
|
|
25535
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
25210
25536
|
frontmatter
|
|
25211
25537
|
};
|
|
25212
25538
|
} catch (error) {
|
|
@@ -25230,14 +25556,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
25230
25556
|
relativePath: relativePathFromCwd,
|
|
25231
25557
|
intendedRootDir: process.cwd()
|
|
25232
25558
|
});
|
|
25233
|
-
const filename = (0,
|
|
25559
|
+
const filename = (0, import_node_path153.basename)(relativePathFromCwd);
|
|
25234
25560
|
try {
|
|
25235
25561
|
const subagent = await RulesyncSubagent.fromFile({
|
|
25236
25562
|
relativeFilePath: filename,
|
|
25237
25563
|
validate: true
|
|
25238
25564
|
});
|
|
25239
25565
|
return {
|
|
25240
|
-
relativePathFromCwd: (0,
|
|
25566
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
25241
25567
|
frontmatter: subagent.getFrontmatter(),
|
|
25242
25568
|
body: subagent.getBody()
|
|
25243
25569
|
};
|
|
@@ -25256,7 +25582,7 @@ async function putSubagent({
|
|
|
25256
25582
|
relativePath: relativePathFromCwd,
|
|
25257
25583
|
intendedRootDir: process.cwd()
|
|
25258
25584
|
});
|
|
25259
|
-
const filename = (0,
|
|
25585
|
+
const filename = (0, import_node_path153.basename)(relativePathFromCwd);
|
|
25260
25586
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
25261
25587
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
25262
25588
|
throw new Error(
|
|
@@ -25266,7 +25592,7 @@ async function putSubagent({
|
|
|
25266
25592
|
try {
|
|
25267
25593
|
const existingSubagents = await listSubagents();
|
|
25268
25594
|
const isUpdate = existingSubagents.some(
|
|
25269
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
25595
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
25270
25596
|
);
|
|
25271
25597
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
25272
25598
|
throw new Error(
|
|
@@ -25281,11 +25607,11 @@ async function putSubagent({
|
|
|
25281
25607
|
body,
|
|
25282
25608
|
validate: true
|
|
25283
25609
|
});
|
|
25284
|
-
const subagentsDir = (0,
|
|
25610
|
+
const subagentsDir = (0, import_node_path153.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
25285
25611
|
await ensureDir(subagentsDir);
|
|
25286
25612
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
25287
25613
|
return {
|
|
25288
|
-
relativePathFromCwd: (0,
|
|
25614
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
25289
25615
|
frontmatter: subagent.getFrontmatter(),
|
|
25290
25616
|
body: subagent.getBody()
|
|
25291
25617
|
};
|
|
@@ -25300,12 +25626,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
25300
25626
|
relativePath: relativePathFromCwd,
|
|
25301
25627
|
intendedRootDir: process.cwd()
|
|
25302
25628
|
});
|
|
25303
|
-
const filename = (0,
|
|
25304
|
-
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);
|
|
25305
25631
|
try {
|
|
25306
25632
|
await removeFile(fullPath);
|
|
25307
25633
|
return {
|
|
25308
|
-
relativePathFromCwd: (0,
|
|
25634
|
+
relativePathFromCwd: (0, import_node_path153.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
25309
25635
|
};
|
|
25310
25636
|
} catch (error) {
|
|
25311
25637
|
throw new Error(
|
|
@@ -25317,23 +25643,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
25317
25643
|
}
|
|
25318
25644
|
}
|
|
25319
25645
|
var subagentToolSchemas = {
|
|
25320
|
-
listSubagents:
|
|
25321
|
-
getSubagent:
|
|
25322
|
-
relativePathFromCwd:
|
|
25646
|
+
listSubagents: import_mini84.z.object({}),
|
|
25647
|
+
getSubagent: import_mini84.z.object({
|
|
25648
|
+
relativePathFromCwd: import_mini84.z.string()
|
|
25323
25649
|
}),
|
|
25324
|
-
putSubagent:
|
|
25325
|
-
relativePathFromCwd:
|
|
25650
|
+
putSubagent: import_mini84.z.object({
|
|
25651
|
+
relativePathFromCwd: import_mini84.z.string(),
|
|
25326
25652
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
25327
|
-
body:
|
|
25653
|
+
body: import_mini84.z.string()
|
|
25328
25654
|
}),
|
|
25329
|
-
deleteSubagent:
|
|
25330
|
-
relativePathFromCwd:
|
|
25655
|
+
deleteSubagent: import_mini84.z.object({
|
|
25656
|
+
relativePathFromCwd: import_mini84.z.string()
|
|
25331
25657
|
})
|
|
25332
25658
|
};
|
|
25333
25659
|
var subagentTools = {
|
|
25334
25660
|
listSubagents: {
|
|
25335
25661
|
name: "listSubagents",
|
|
25336
|
-
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.`,
|
|
25337
25663
|
parameters: subagentToolSchemas.listSubagents,
|
|
25338
25664
|
execute: async () => {
|
|
25339
25665
|
const subagents = await listSubagents();
|
|
@@ -25375,7 +25701,7 @@ var subagentTools = {
|
|
|
25375
25701
|
};
|
|
25376
25702
|
|
|
25377
25703
|
// src/mcp/tools.ts
|
|
25378
|
-
var rulesyncFeatureSchema =
|
|
25704
|
+
var rulesyncFeatureSchema = import_mini85.z.enum([
|
|
25379
25705
|
"rule",
|
|
25380
25706
|
"command",
|
|
25381
25707
|
"subagent",
|
|
@@ -25385,21 +25711,21 @@ var rulesyncFeatureSchema = import_mini84.z.enum([
|
|
|
25385
25711
|
"generate",
|
|
25386
25712
|
"import"
|
|
25387
25713
|
]);
|
|
25388
|
-
var rulesyncOperationSchema =
|
|
25389
|
-
var skillFileSchema =
|
|
25390
|
-
name:
|
|
25391
|
-
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()
|
|
25392
25718
|
});
|
|
25393
|
-
var rulesyncToolSchema =
|
|
25719
|
+
var rulesyncToolSchema = import_mini85.z.object({
|
|
25394
25720
|
feature: rulesyncFeatureSchema,
|
|
25395
25721
|
operation: rulesyncOperationSchema,
|
|
25396
|
-
targetPathFromCwd:
|
|
25397
|
-
frontmatter:
|
|
25398
|
-
body:
|
|
25399
|
-
otherFiles:
|
|
25400
|
-
content:
|
|
25401
|
-
generateOptions:
|
|
25402
|
-
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)
|
|
25403
25729
|
});
|
|
25404
25730
|
var supportedOperationsByFeature = {
|
|
25405
25731
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -25606,7 +25932,7 @@ async function mcpCommand(logger5, { version }) {
|
|
|
25606
25932
|
}
|
|
25607
25933
|
|
|
25608
25934
|
// src/cli/commands/resolve-gitignore-targets.ts
|
|
25609
|
-
var
|
|
25935
|
+
var import_node_path154 = require("path");
|
|
25610
25936
|
var resolveGitignoreTargets = async ({
|
|
25611
25937
|
cliTargets,
|
|
25612
25938
|
cwd = process.cwd()
|
|
@@ -25614,8 +25940,8 @@ var resolveGitignoreTargets = async ({
|
|
|
25614
25940
|
if (cliTargets !== void 0) {
|
|
25615
25941
|
return cliTargets;
|
|
25616
25942
|
}
|
|
25617
|
-
const baseConfigPath = (0,
|
|
25618
|
-
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);
|
|
25619
25945
|
const [hasBase, hasLocal] = await Promise.all([
|
|
25620
25946
|
fileExists(baseConfigPath),
|
|
25621
25947
|
fileExists(localConfigPath)
|
|
@@ -26036,7 +26362,7 @@ function wrapCommand({
|
|
|
26036
26362
|
}
|
|
26037
26363
|
|
|
26038
26364
|
// src/cli/index.ts
|
|
26039
|
-
var getVersion = () => "8.
|
|
26365
|
+
var getVersion = () => "8.5.0";
|
|
26040
26366
|
function wrapCommand2(name, errorCode, handler) {
|
|
26041
26367
|
return wrapCommand({ name, errorCode, handler, getVersion });
|
|
26042
26368
|
}
|