rulesync 7.6.2 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-MG4OE47A.js → chunk-KDYNNWMK.js} +987 -606
- package/dist/cli/index.cjs +1275 -890
- package/dist/cli/index.js +8 -4
- package/dist/index.cjs +1011 -630
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/package.json +13 -13
package/dist/cli/index.cjs
CHANGED
|
@@ -128,8 +128,8 @@ var Logger = class {
|
|
|
128
128
|
var logger = new Logger();
|
|
129
129
|
|
|
130
130
|
// src/lib/fetch.ts
|
|
131
|
+
var import_node_path112 = require("path");
|
|
131
132
|
var import_promise = require("es-toolkit/promise");
|
|
132
|
-
var import_node_path110 = require("path");
|
|
133
133
|
|
|
134
134
|
// src/constants/rulesync-paths.ts
|
|
135
135
|
var import_node_path = require("path");
|
|
@@ -158,14 +158,14 @@ var FETCH_CONCURRENCY_LIMIT = 10;
|
|
|
158
158
|
|
|
159
159
|
// src/features/commands/commands-processor.ts
|
|
160
160
|
var import_node_path19 = require("path");
|
|
161
|
-
var
|
|
161
|
+
var import_mini12 = require("zod/mini");
|
|
162
162
|
|
|
163
163
|
// src/utils/file.ts
|
|
164
|
-
var import_es_toolkit = require("es-toolkit");
|
|
165
|
-
var import_globby = require("globby");
|
|
166
164
|
var import_promises = require("fs/promises");
|
|
167
165
|
var import_node_os = __toESM(require("os"), 1);
|
|
168
166
|
var import_node_path2 = require("path");
|
|
167
|
+
var import_es_toolkit = require("es-toolkit");
|
|
168
|
+
var import_globby = require("globby");
|
|
169
169
|
async function ensureDir(dirPath) {
|
|
170
170
|
try {
|
|
171
171
|
await (0, import_promises.stat)(dirPath);
|
|
@@ -253,7 +253,11 @@ async function findFilesByGlobs(globs, options = {}) {
|
|
|
253
253
|
const { type = "all" } = options;
|
|
254
254
|
const globbyOptions = type === "file" ? { onlyFiles: true, onlyDirectories: false } : type === "dir" ? { onlyFiles: false, onlyDirectories: true } : { onlyFiles: false, onlyDirectories: false };
|
|
255
255
|
const normalizedGlobs = Array.isArray(globs) ? globs.map((g) => g.replaceAll("\\", "/")) : globs.replaceAll("\\", "/");
|
|
256
|
-
const results = (0, import_globby.globbySync)(normalizedGlobs, {
|
|
256
|
+
const results = (0, import_globby.globbySync)(normalizedGlobs, {
|
|
257
|
+
absolute: true,
|
|
258
|
+
followSymbolicLinks: false,
|
|
259
|
+
...globbyOptions
|
|
260
|
+
});
|
|
257
261
|
return results.toSorted();
|
|
258
262
|
}
|
|
259
263
|
async function removeDirectory(dirPath) {
|
|
@@ -1530,25 +1534,67 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1530
1534
|
|
|
1531
1535
|
// src/features/commands/cursor-command.ts
|
|
1532
1536
|
var import_node_path12 = require("path");
|
|
1537
|
+
var import_mini8 = require("zod/mini");
|
|
1538
|
+
var CursorCommandFrontmatterSchema = import_mini8.z.looseObject({
|
|
1539
|
+
description: import_mini8.z.optional(import_mini8.z.string()),
|
|
1540
|
+
handoffs: import_mini8.z.optional(
|
|
1541
|
+
import_mini8.z.array(
|
|
1542
|
+
import_mini8.z.looseObject({
|
|
1543
|
+
label: import_mini8.z.string(),
|
|
1544
|
+
agent: import_mini8.z.optional(import_mini8.z.string()),
|
|
1545
|
+
prompt: import_mini8.z.optional(import_mini8.z.string()),
|
|
1546
|
+
send: import_mini8.z.optional(import_mini8.z.boolean())
|
|
1547
|
+
})
|
|
1548
|
+
)
|
|
1549
|
+
)
|
|
1550
|
+
});
|
|
1533
1551
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1552
|
+
frontmatter;
|
|
1553
|
+
body;
|
|
1554
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
1555
|
+
if (rest.validate) {
|
|
1556
|
+
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1557
|
+
if (!result.success) {
|
|
1558
|
+
throw new Error(
|
|
1559
|
+
`Invalid frontmatter in ${(0, import_node_path12.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1560
|
+
);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
super({
|
|
1564
|
+
...rest,
|
|
1565
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
1566
|
+
});
|
|
1567
|
+
this.frontmatter = frontmatter;
|
|
1568
|
+
this.body = body;
|
|
1569
|
+
}
|
|
1534
1570
|
static getSettablePaths(_options = {}) {
|
|
1535
1571
|
return {
|
|
1536
1572
|
relativeDirPath: (0, import_node_path12.join)(".cursor", "commands")
|
|
1537
1573
|
};
|
|
1538
1574
|
}
|
|
1575
|
+
getBody() {
|
|
1576
|
+
return this.body;
|
|
1577
|
+
}
|
|
1578
|
+
getFrontmatter() {
|
|
1579
|
+
return this.frontmatter;
|
|
1580
|
+
}
|
|
1539
1581
|
toRulesyncCommand() {
|
|
1582
|
+
const { description = "", ...restFields } = this.frontmatter;
|
|
1540
1583
|
const rulesyncFrontmatter = {
|
|
1541
1584
|
targets: ["*"],
|
|
1542
|
-
description
|
|
1585
|
+
description,
|
|
1586
|
+
// Preserve extra fields in cursor section
|
|
1587
|
+
...Object.keys(restFields).length > 0 && { cursor: restFields }
|
|
1543
1588
|
};
|
|
1589
|
+
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1544
1590
|
return new RulesyncCommand({
|
|
1545
|
-
baseDir:
|
|
1591
|
+
baseDir: ".",
|
|
1546
1592
|
// RulesyncCommand baseDir is always the project root directory
|
|
1547
1593
|
frontmatter: rulesyncFrontmatter,
|
|
1548
|
-
body: this.
|
|
1594
|
+
body: this.body,
|
|
1549
1595
|
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1550
1596
|
relativeFilePath: this.relativeFilePath,
|
|
1551
|
-
fileContent
|
|
1597
|
+
fileContent,
|
|
1552
1598
|
validate: true
|
|
1553
1599
|
});
|
|
1554
1600
|
}
|
|
@@ -1558,20 +1604,38 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1558
1604
|
validate = true,
|
|
1559
1605
|
global = false
|
|
1560
1606
|
}) {
|
|
1607
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1608
|
+
const cursorFields = rulesyncFrontmatter.cursor ?? {};
|
|
1609
|
+
const cursorFrontmatter = {
|
|
1610
|
+
...rulesyncFrontmatter.description && { description: rulesyncFrontmatter.description },
|
|
1611
|
+
...cursorFields
|
|
1612
|
+
};
|
|
1613
|
+
const body = rulesyncCommand.getBody();
|
|
1561
1614
|
const paths = this.getSettablePaths({ global });
|
|
1562
1615
|
return new _CursorCommand({
|
|
1563
1616
|
baseDir,
|
|
1564
|
-
|
|
1617
|
+
frontmatter: cursorFrontmatter,
|
|
1618
|
+
body,
|
|
1565
1619
|
relativeDirPath: paths.relativeDirPath,
|
|
1566
1620
|
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1567
1621
|
validate
|
|
1568
1622
|
});
|
|
1569
1623
|
}
|
|
1570
1624
|
validate() {
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1625
|
+
if (!this.frontmatter) {
|
|
1626
|
+
return { success: true, error: null };
|
|
1627
|
+
}
|
|
1628
|
+
const result = CursorCommandFrontmatterSchema.safeParse(this.frontmatter);
|
|
1629
|
+
if (result.success) {
|
|
1630
|
+
return { success: true, error: null };
|
|
1631
|
+
} else {
|
|
1632
|
+
return {
|
|
1633
|
+
success: false,
|
|
1634
|
+
error: new Error(
|
|
1635
|
+
`Invalid frontmatter in ${(0, import_node_path12.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1636
|
+
)
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1575
1639
|
}
|
|
1576
1640
|
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1577
1641
|
return this.isTargetedByRulesyncCommandDefault({
|
|
@@ -1588,12 +1652,17 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1588
1652
|
const paths = this.getSettablePaths({ global });
|
|
1589
1653
|
const filePath = (0, import_node_path12.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1590
1654
|
const fileContent = await readFileContent(filePath);
|
|
1591
|
-
const { body: content } = parseFrontmatter(fileContent);
|
|
1655
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1656
|
+
const result = CursorCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1657
|
+
if (!result.success) {
|
|
1658
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
1659
|
+
}
|
|
1592
1660
|
return new _CursorCommand({
|
|
1593
1661
|
baseDir,
|
|
1594
1662
|
relativeDirPath: paths.relativeDirPath,
|
|
1595
1663
|
relativeFilePath,
|
|
1596
|
-
|
|
1664
|
+
frontmatter: result.data,
|
|
1665
|
+
body: content.trim(),
|
|
1597
1666
|
validate
|
|
1598
1667
|
});
|
|
1599
1668
|
}
|
|
@@ -1606,7 +1675,8 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1606
1675
|
baseDir,
|
|
1607
1676
|
relativeDirPath,
|
|
1608
1677
|
relativeFilePath,
|
|
1609
|
-
|
|
1678
|
+
frontmatter: {},
|
|
1679
|
+
body: "",
|
|
1610
1680
|
validate: false
|
|
1611
1681
|
});
|
|
1612
1682
|
}
|
|
@@ -1673,10 +1743,10 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
1673
1743
|
// src/features/commands/geminicli-command.ts
|
|
1674
1744
|
var import_node_path14 = require("path");
|
|
1675
1745
|
var import_smol_toml = require("smol-toml");
|
|
1676
|
-
var
|
|
1677
|
-
var GeminiCliCommandFrontmatterSchema =
|
|
1678
|
-
description:
|
|
1679
|
-
prompt:
|
|
1746
|
+
var import_mini9 = require("zod/mini");
|
|
1747
|
+
var GeminiCliCommandFrontmatterSchema = import_mini9.z.looseObject({
|
|
1748
|
+
description: import_mini9.z.optional(import_mini9.z.string()),
|
|
1749
|
+
prompt: import_mini9.z.string()
|
|
1680
1750
|
});
|
|
1681
1751
|
var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
1682
1752
|
frontmatter;
|
|
@@ -1979,12 +2049,12 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
1979
2049
|
|
|
1980
2050
|
// src/features/commands/opencode-command.ts
|
|
1981
2051
|
var import_node_path17 = require("path");
|
|
1982
|
-
var
|
|
1983
|
-
var OpenCodeCommandFrontmatterSchema =
|
|
1984
|
-
description:
|
|
1985
|
-
agent: (0,
|
|
1986
|
-
subtask: (0,
|
|
1987
|
-
model: (0,
|
|
2052
|
+
var import_mini10 = require("zod/mini");
|
|
2053
|
+
var OpenCodeCommandFrontmatterSchema = import_mini10.z.looseObject({
|
|
2054
|
+
description: import_mini10.z.string(),
|
|
2055
|
+
agent: (0, import_mini10.optional)(import_mini10.z.string()),
|
|
2056
|
+
subtask: (0, import_mini10.optional)(import_mini10.z.boolean()),
|
|
2057
|
+
model: (0, import_mini10.optional)(import_mini10.z.string())
|
|
1988
2058
|
});
|
|
1989
2059
|
var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
1990
2060
|
frontmatter;
|
|
@@ -2119,10 +2189,10 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2119
2189
|
|
|
2120
2190
|
// src/features/commands/roo-command.ts
|
|
2121
2191
|
var import_node_path18 = require("path");
|
|
2122
|
-
var
|
|
2123
|
-
var RooCommandFrontmatterSchema =
|
|
2124
|
-
description:
|
|
2125
|
-
"argument-hint": (0,
|
|
2192
|
+
var import_mini11 = require("zod/mini");
|
|
2193
|
+
var RooCommandFrontmatterSchema = import_mini11.z.looseObject({
|
|
2194
|
+
description: import_mini11.z.string(),
|
|
2195
|
+
"argument-hint": (0, import_mini11.optional)(import_mini11.z.string())
|
|
2126
2196
|
});
|
|
2127
2197
|
var RooCommand = class _RooCommand extends ToolCommand {
|
|
2128
2198
|
frontmatter;
|
|
@@ -2275,7 +2345,7 @@ var commandsProcessorToolTargetTuple = [
|
|
|
2275
2345
|
"opencode",
|
|
2276
2346
|
"roo"
|
|
2277
2347
|
];
|
|
2278
|
-
var CommandsProcessorToolTargetSchema =
|
|
2348
|
+
var CommandsProcessorToolTargetSchema = import_mini12.z.enum(commandsProcessorToolTargetTuple);
|
|
2279
2349
|
var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
2280
2350
|
[
|
|
2281
2351
|
"agentsmd",
|
|
@@ -2521,7 +2591,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2521
2591
|
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
2522
2592
|
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
2523
2593
|
logger.warn(
|
|
2524
|
-
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}".
|
|
2594
|
+
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}". Only the last processed command will be used.`
|
|
2525
2595
|
);
|
|
2526
2596
|
} else if (!firstOrigin) {
|
|
2527
2597
|
flattenedPathOrigins.set(flattenedPath, originalRelativePath);
|
|
@@ -2642,26 +2712,26 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2642
2712
|
};
|
|
2643
2713
|
|
|
2644
2714
|
// src/features/hooks/hooks-processor.ts
|
|
2645
|
-
var
|
|
2715
|
+
var import_mini14 = require("zod/mini");
|
|
2646
2716
|
|
|
2647
2717
|
// src/types/hooks.ts
|
|
2648
|
-
var
|
|
2718
|
+
var import_mini13 = require("zod/mini");
|
|
2649
2719
|
var CONTROL_CHARS = ["\n", "\r", "\0"];
|
|
2650
2720
|
var hasControlChars = (val) => CONTROL_CHARS.some((char) => val.includes(char));
|
|
2651
|
-
var safeString =
|
|
2652
|
-
|
|
2653
|
-
|
|
2721
|
+
var safeString = import_mini13.z.pipe(
|
|
2722
|
+
import_mini13.z.string(),
|
|
2723
|
+
import_mini13.z.custom(
|
|
2654
2724
|
(val) => typeof val === "string" && !hasControlChars(val),
|
|
2655
2725
|
"must not contain newline, carriage return, or NUL characters"
|
|
2656
2726
|
)
|
|
2657
2727
|
);
|
|
2658
|
-
var HookDefinitionSchema =
|
|
2659
|
-
command:
|
|
2660
|
-
type:
|
|
2661
|
-
timeout:
|
|
2662
|
-
matcher:
|
|
2663
|
-
prompt:
|
|
2664
|
-
loop_limit:
|
|
2728
|
+
var HookDefinitionSchema = import_mini13.z.looseObject({
|
|
2729
|
+
command: import_mini13.z.optional(safeString),
|
|
2730
|
+
type: import_mini13.z.optional(import_mini13.z.enum(["command", "prompt"])),
|
|
2731
|
+
timeout: import_mini13.z.optional(import_mini13.z.number()),
|
|
2732
|
+
matcher: import_mini13.z.optional(safeString),
|
|
2733
|
+
prompt: import_mini13.z.optional(import_mini13.z.string()),
|
|
2734
|
+
loop_limit: import_mini13.z.optional(import_mini13.z.nullable(import_mini13.z.number()))
|
|
2665
2735
|
});
|
|
2666
2736
|
var CURSOR_HOOK_EVENTS = [
|
|
2667
2737
|
"sessionStart",
|
|
@@ -2720,14 +2790,14 @@ var FACTORYDROID_HOOK_EVENTS = [
|
|
|
2720
2790
|
"notification",
|
|
2721
2791
|
"setup"
|
|
2722
2792
|
];
|
|
2723
|
-
var hooksRecordSchema =
|
|
2724
|
-
var HooksConfigSchema =
|
|
2725
|
-
version:
|
|
2793
|
+
var hooksRecordSchema = import_mini13.z.record(import_mini13.z.string(), import_mini13.z.array(HookDefinitionSchema));
|
|
2794
|
+
var HooksConfigSchema = import_mini13.z.looseObject({
|
|
2795
|
+
version: import_mini13.z.optional(import_mini13.z.number()),
|
|
2726
2796
|
hooks: hooksRecordSchema,
|
|
2727
|
-
cursor:
|
|
2728
|
-
claudecode:
|
|
2729
|
-
opencode:
|
|
2730
|
-
factorydroid:
|
|
2797
|
+
cursor: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2798
|
+
claudecode: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2799
|
+
opencode: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) })),
|
|
2800
|
+
factorydroid: import_mini13.z.optional(import_mini13.z.looseObject({ hooks: import_mini13.z.optional(hooksRecordSchema) }))
|
|
2731
2801
|
});
|
|
2732
2802
|
var CANONICAL_TO_CLAUDE_EVENT_NAMES = {
|
|
2733
2803
|
sessionStart: "SessionStart",
|
|
@@ -3516,7 +3586,7 @@ var OpencodeHooks = class _OpencodeHooks extends ToolHooks {
|
|
|
3516
3586
|
|
|
3517
3587
|
// src/features/hooks/hooks-processor.ts
|
|
3518
3588
|
var hooksProcessorToolTargetTuple = ["cursor", "claudecode", "opencode", "factorydroid"];
|
|
3519
|
-
var HooksProcessorToolTargetSchema =
|
|
3589
|
+
var HooksProcessorToolTargetSchema = import_mini14.z.enum(hooksProcessorToolTargetTuple);
|
|
3520
3590
|
var toolHooksFactories = /* @__PURE__ */ new Map([
|
|
3521
3591
|
[
|
|
3522
3592
|
"cursor",
|
|
@@ -3692,7 +3762,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
3692
3762
|
};
|
|
3693
3763
|
|
|
3694
3764
|
// src/features/ignore/ignore-processor.ts
|
|
3695
|
-
var
|
|
3765
|
+
var import_mini15 = require("zod/mini");
|
|
3696
3766
|
|
|
3697
3767
|
// src/features/ignore/augmentcode-ignore.ts
|
|
3698
3768
|
var import_node_path26 = require("path");
|
|
@@ -3869,8 +3939,8 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
3869
3939
|
};
|
|
3870
3940
|
|
|
3871
3941
|
// src/features/ignore/claudecode-ignore.ts
|
|
3872
|
-
var import_es_toolkit2 = require("es-toolkit");
|
|
3873
3942
|
var import_node_path27 = require("path");
|
|
3943
|
+
var import_es_toolkit2 = require("es-toolkit");
|
|
3874
3944
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
3875
3945
|
constructor(params) {
|
|
3876
3946
|
super(params);
|
|
@@ -3880,11 +3950,11 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
3880
3950
|
static getSettablePaths() {
|
|
3881
3951
|
return {
|
|
3882
3952
|
relativeDirPath: ".claude",
|
|
3883
|
-
relativeFilePath: "settings.
|
|
3953
|
+
relativeFilePath: "settings.json"
|
|
3884
3954
|
};
|
|
3885
3955
|
}
|
|
3886
3956
|
/**
|
|
3887
|
-
* ClaudecodeIgnore uses settings.
|
|
3957
|
+
* ClaudecodeIgnore uses settings.json, which can include non-ignore settings.
|
|
3888
3958
|
* It should not be deleted by rulesync.
|
|
3889
3959
|
*/
|
|
3890
3960
|
isDeletable() {
|
|
@@ -4164,8 +4234,75 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
4164
4234
|
}
|
|
4165
4235
|
};
|
|
4166
4236
|
|
|
4167
|
-
// src/features/ignore/
|
|
4237
|
+
// src/features/ignore/goose-ignore.ts
|
|
4168
4238
|
var import_node_path31 = require("path");
|
|
4239
|
+
var GooseIgnore = class _GooseIgnore extends ToolIgnore {
|
|
4240
|
+
static getSettablePaths() {
|
|
4241
|
+
return {
|
|
4242
|
+
relativeDirPath: ".",
|
|
4243
|
+
relativeFilePath: ".gooseignore"
|
|
4244
|
+
};
|
|
4245
|
+
}
|
|
4246
|
+
/**
|
|
4247
|
+
* Convert GooseIgnore to RulesyncIgnore format
|
|
4248
|
+
*/
|
|
4249
|
+
toRulesyncIgnore() {
|
|
4250
|
+
return this.toRulesyncIgnoreDefault();
|
|
4251
|
+
}
|
|
4252
|
+
/**
|
|
4253
|
+
* Create GooseIgnore from RulesyncIgnore
|
|
4254
|
+
*/
|
|
4255
|
+
static fromRulesyncIgnore({
|
|
4256
|
+
baseDir = process.cwd(),
|
|
4257
|
+
rulesyncIgnore
|
|
4258
|
+
}) {
|
|
4259
|
+
const body = rulesyncIgnore.getFileContent();
|
|
4260
|
+
return new _GooseIgnore({
|
|
4261
|
+
baseDir,
|
|
4262
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
4263
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
4264
|
+
fileContent: body
|
|
4265
|
+
});
|
|
4266
|
+
}
|
|
4267
|
+
/**
|
|
4268
|
+
* Load GooseIgnore from .gooseignore file
|
|
4269
|
+
*/
|
|
4270
|
+
static async fromFile({
|
|
4271
|
+
baseDir = process.cwd(),
|
|
4272
|
+
validate = true
|
|
4273
|
+
}) {
|
|
4274
|
+
const fileContent = await readFileContent(
|
|
4275
|
+
(0, import_node_path31.join)(
|
|
4276
|
+
baseDir,
|
|
4277
|
+
this.getSettablePaths().relativeDirPath,
|
|
4278
|
+
this.getSettablePaths().relativeFilePath
|
|
4279
|
+
)
|
|
4280
|
+
);
|
|
4281
|
+
return new _GooseIgnore({
|
|
4282
|
+
baseDir,
|
|
4283
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
4284
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
4285
|
+
fileContent,
|
|
4286
|
+
validate
|
|
4287
|
+
});
|
|
4288
|
+
}
|
|
4289
|
+
static forDeletion({
|
|
4290
|
+
baseDir = process.cwd(),
|
|
4291
|
+
relativeDirPath,
|
|
4292
|
+
relativeFilePath
|
|
4293
|
+
}) {
|
|
4294
|
+
return new _GooseIgnore({
|
|
4295
|
+
baseDir,
|
|
4296
|
+
relativeDirPath,
|
|
4297
|
+
relativeFilePath,
|
|
4298
|
+
fileContent: "",
|
|
4299
|
+
validate: false
|
|
4300
|
+
});
|
|
4301
|
+
}
|
|
4302
|
+
};
|
|
4303
|
+
|
|
4304
|
+
// src/features/ignore/junie-ignore.ts
|
|
4305
|
+
var import_node_path32 = require("path");
|
|
4169
4306
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
4170
4307
|
static getSettablePaths() {
|
|
4171
4308
|
return {
|
|
@@ -4192,7 +4329,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
4192
4329
|
validate = true
|
|
4193
4330
|
}) {
|
|
4194
4331
|
const fileContent = await readFileContent(
|
|
4195
|
-
(0,
|
|
4332
|
+
(0, import_node_path32.join)(
|
|
4196
4333
|
baseDir,
|
|
4197
4334
|
this.getSettablePaths().relativeDirPath,
|
|
4198
4335
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4222,7 +4359,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
4222
4359
|
};
|
|
4223
4360
|
|
|
4224
4361
|
// src/features/ignore/kilo-ignore.ts
|
|
4225
|
-
var
|
|
4362
|
+
var import_node_path33 = require("path");
|
|
4226
4363
|
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
4227
4364
|
static getSettablePaths() {
|
|
4228
4365
|
return {
|
|
@@ -4259,7 +4396,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
4259
4396
|
validate = true
|
|
4260
4397
|
}) {
|
|
4261
4398
|
const fileContent = await readFileContent(
|
|
4262
|
-
(0,
|
|
4399
|
+
(0, import_node_path33.join)(
|
|
4263
4400
|
baseDir,
|
|
4264
4401
|
this.getSettablePaths().relativeDirPath,
|
|
4265
4402
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4289,7 +4426,7 @@ var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
|
4289
4426
|
};
|
|
4290
4427
|
|
|
4291
4428
|
// src/features/ignore/kiro-ignore.ts
|
|
4292
|
-
var
|
|
4429
|
+
var import_node_path34 = require("path");
|
|
4293
4430
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
4294
4431
|
static getSettablePaths() {
|
|
4295
4432
|
return {
|
|
@@ -4316,7 +4453,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
4316
4453
|
validate = true
|
|
4317
4454
|
}) {
|
|
4318
4455
|
const fileContent = await readFileContent(
|
|
4319
|
-
(0,
|
|
4456
|
+
(0, import_node_path34.join)(
|
|
4320
4457
|
baseDir,
|
|
4321
4458
|
this.getSettablePaths().relativeDirPath,
|
|
4322
4459
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4346,7 +4483,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
4346
4483
|
};
|
|
4347
4484
|
|
|
4348
4485
|
// src/features/ignore/qwencode-ignore.ts
|
|
4349
|
-
var
|
|
4486
|
+
var import_node_path35 = require("path");
|
|
4350
4487
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
4351
4488
|
static getSettablePaths() {
|
|
4352
4489
|
return {
|
|
@@ -4373,7 +4510,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
4373
4510
|
validate = true
|
|
4374
4511
|
}) {
|
|
4375
4512
|
const fileContent = await readFileContent(
|
|
4376
|
-
(0,
|
|
4513
|
+
(0, import_node_path35.join)(
|
|
4377
4514
|
baseDir,
|
|
4378
4515
|
this.getSettablePaths().relativeDirPath,
|
|
4379
4516
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4403,7 +4540,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
4403
4540
|
};
|
|
4404
4541
|
|
|
4405
4542
|
// src/features/ignore/roo-ignore.ts
|
|
4406
|
-
var
|
|
4543
|
+
var import_node_path36 = require("path");
|
|
4407
4544
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
4408
4545
|
static getSettablePaths() {
|
|
4409
4546
|
return {
|
|
@@ -4430,7 +4567,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
4430
4567
|
validate = true
|
|
4431
4568
|
}) {
|
|
4432
4569
|
const fileContent = await readFileContent(
|
|
4433
|
-
(0,
|
|
4570
|
+
(0, import_node_path36.join)(
|
|
4434
4571
|
baseDir,
|
|
4435
4572
|
this.getSettablePaths().relativeDirPath,
|
|
4436
4573
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4460,7 +4597,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
4460
4597
|
};
|
|
4461
4598
|
|
|
4462
4599
|
// src/features/ignore/windsurf-ignore.ts
|
|
4463
|
-
var
|
|
4600
|
+
var import_node_path37 = require("path");
|
|
4464
4601
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
4465
4602
|
static getSettablePaths() {
|
|
4466
4603
|
return {
|
|
@@ -4487,7 +4624,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
4487
4624
|
validate = true
|
|
4488
4625
|
}) {
|
|
4489
4626
|
const fileContent = await readFileContent(
|
|
4490
|
-
(0,
|
|
4627
|
+
(0, import_node_path37.join)(
|
|
4491
4628
|
baseDir,
|
|
4492
4629
|
this.getSettablePaths().relativeDirPath,
|
|
4493
4630
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4517,8 +4654,8 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
4517
4654
|
};
|
|
4518
4655
|
|
|
4519
4656
|
// src/features/ignore/zed-ignore.ts
|
|
4657
|
+
var import_node_path38 = require("path");
|
|
4520
4658
|
var import_es_toolkit3 = require("es-toolkit");
|
|
4521
|
-
var import_node_path37 = require("path");
|
|
4522
4659
|
var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
4523
4660
|
constructor(params) {
|
|
4524
4661
|
super(params);
|
|
@@ -4554,7 +4691,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
4554
4691
|
}) {
|
|
4555
4692
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
4556
4693
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
4557
|
-
const filePath = (0,
|
|
4694
|
+
const filePath = (0, import_node_path38.join)(
|
|
4558
4695
|
baseDir,
|
|
4559
4696
|
this.getSettablePaths().relativeDirPath,
|
|
4560
4697
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4581,7 +4718,7 @@ var ZedIgnore = class _ZedIgnore extends ToolIgnore {
|
|
|
4581
4718
|
validate = true
|
|
4582
4719
|
}) {
|
|
4583
4720
|
const fileContent = await readFileContent(
|
|
4584
|
-
(0,
|
|
4721
|
+
(0, import_node_path38.join)(
|
|
4585
4722
|
baseDir,
|
|
4586
4723
|
this.getSettablePaths().relativeDirPath,
|
|
4587
4724
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4618,6 +4755,7 @@ var ignoreProcessorToolTargets = [
|
|
|
4618
4755
|
"cline",
|
|
4619
4756
|
"cursor",
|
|
4620
4757
|
"geminicli",
|
|
4758
|
+
"goose",
|
|
4621
4759
|
"junie",
|
|
4622
4760
|
"kilo",
|
|
4623
4761
|
"kiro",
|
|
@@ -4626,7 +4764,7 @@ var ignoreProcessorToolTargets = [
|
|
|
4626
4764
|
"windsurf",
|
|
4627
4765
|
"zed"
|
|
4628
4766
|
];
|
|
4629
|
-
var IgnoreProcessorToolTargetSchema =
|
|
4767
|
+
var IgnoreProcessorToolTargetSchema = import_mini15.z.enum(ignoreProcessorToolTargets);
|
|
4630
4768
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
4631
4769
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
4632
4770
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -4634,6 +4772,7 @@ var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
|
4634
4772
|
["cline", { class: ClineIgnore }],
|
|
4635
4773
|
["cursor", { class: CursorIgnore }],
|
|
4636
4774
|
["geminicli", { class: GeminiCliIgnore }],
|
|
4775
|
+
["goose", { class: GooseIgnore }],
|
|
4637
4776
|
["junie", { class: JunieIgnore }],
|
|
4638
4777
|
["kilo", { class: KiloIgnore }],
|
|
4639
4778
|
["kiro", { class: KiroIgnore }],
|
|
@@ -4763,49 +4902,49 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
4763
4902
|
};
|
|
4764
4903
|
|
|
4765
4904
|
// src/features/mcp/mcp-processor.ts
|
|
4766
|
-
var
|
|
4905
|
+
var import_mini19 = require("zod/mini");
|
|
4767
4906
|
|
|
4768
4907
|
// src/features/mcp/claudecode-mcp.ts
|
|
4769
|
-
var
|
|
4908
|
+
var import_node_path40 = require("path");
|
|
4770
4909
|
|
|
4771
4910
|
// src/features/mcp/rulesync-mcp.ts
|
|
4911
|
+
var import_node_path39 = require("path");
|
|
4772
4912
|
var import_object = require("es-toolkit/object");
|
|
4773
|
-
var
|
|
4774
|
-
var import_mini16 = require("zod/mini");
|
|
4913
|
+
var import_mini17 = require("zod/mini");
|
|
4775
4914
|
|
|
4776
4915
|
// src/types/mcp.ts
|
|
4777
|
-
var
|
|
4778
|
-
var McpServerSchema =
|
|
4779
|
-
type:
|
|
4780
|
-
command:
|
|
4781
|
-
args:
|
|
4782
|
-
url:
|
|
4783
|
-
httpUrl:
|
|
4784
|
-
env:
|
|
4785
|
-
disabled:
|
|
4786
|
-
networkTimeout:
|
|
4787
|
-
timeout:
|
|
4788
|
-
trust:
|
|
4789
|
-
cwd:
|
|
4790
|
-
transport:
|
|
4791
|
-
alwaysAllow:
|
|
4792
|
-
tools:
|
|
4793
|
-
kiroAutoApprove:
|
|
4794
|
-
kiroAutoBlock:
|
|
4795
|
-
headers:
|
|
4796
|
-
enabledTools:
|
|
4797
|
-
disabledTools:
|
|
4916
|
+
var import_mini16 = require("zod/mini");
|
|
4917
|
+
var McpServerSchema = import_mini16.z.object({
|
|
4918
|
+
type: import_mini16.z.optional(import_mini16.z.enum(["stdio", "sse", "http"])),
|
|
4919
|
+
command: import_mini16.z.optional(import_mini16.z.union([import_mini16.z.string(), import_mini16.z.array(import_mini16.z.string())])),
|
|
4920
|
+
args: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4921
|
+
url: import_mini16.z.optional(import_mini16.z.string()),
|
|
4922
|
+
httpUrl: import_mini16.z.optional(import_mini16.z.string()),
|
|
4923
|
+
env: import_mini16.z.optional(import_mini16.z.record(import_mini16.z.string(), import_mini16.z.string())),
|
|
4924
|
+
disabled: import_mini16.z.optional(import_mini16.z.boolean()),
|
|
4925
|
+
networkTimeout: import_mini16.z.optional(import_mini16.z.number()),
|
|
4926
|
+
timeout: import_mini16.z.optional(import_mini16.z.number()),
|
|
4927
|
+
trust: import_mini16.z.optional(import_mini16.z.boolean()),
|
|
4928
|
+
cwd: import_mini16.z.optional(import_mini16.z.string()),
|
|
4929
|
+
transport: import_mini16.z.optional(import_mini16.z.enum(["stdio", "sse", "http"])),
|
|
4930
|
+
alwaysAllow: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4931
|
+
tools: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4932
|
+
kiroAutoApprove: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4933
|
+
kiroAutoBlock: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4934
|
+
headers: import_mini16.z.optional(import_mini16.z.record(import_mini16.z.string(), import_mini16.z.string())),
|
|
4935
|
+
enabledTools: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string())),
|
|
4936
|
+
disabledTools: import_mini16.z.optional(import_mini16.z.array(import_mini16.z.string()))
|
|
4798
4937
|
});
|
|
4799
|
-
var McpServersSchema =
|
|
4938
|
+
var McpServersSchema = import_mini16.z.record(import_mini16.z.string(), McpServerSchema);
|
|
4800
4939
|
|
|
4801
4940
|
// src/features/mcp/rulesync-mcp.ts
|
|
4802
|
-
var RulesyncMcpServerSchema =
|
|
4803
|
-
targets:
|
|
4804
|
-
description:
|
|
4805
|
-
exposed:
|
|
4941
|
+
var RulesyncMcpServerSchema = import_mini17.z.extend(McpServerSchema, {
|
|
4942
|
+
targets: import_mini17.z.optional(RulesyncTargetsSchema),
|
|
4943
|
+
description: import_mini17.z.optional(import_mini17.z.string()),
|
|
4944
|
+
exposed: import_mini17.z.optional(import_mini17.z.boolean())
|
|
4806
4945
|
});
|
|
4807
|
-
var RulesyncMcpConfigSchema =
|
|
4808
|
-
mcpServers:
|
|
4946
|
+
var RulesyncMcpConfigSchema = import_mini17.z.object({
|
|
4947
|
+
mcpServers: import_mini17.z.record(import_mini17.z.string(), RulesyncMcpServerSchema)
|
|
4809
4948
|
});
|
|
4810
4949
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
4811
4950
|
json;
|
|
@@ -4841,12 +4980,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
4841
4980
|
static async fromFile({ validate = true }) {
|
|
4842
4981
|
const baseDir = process.cwd();
|
|
4843
4982
|
const paths = this.getSettablePaths();
|
|
4844
|
-
const recommendedPath = (0,
|
|
4983
|
+
const recommendedPath = (0, import_node_path39.join)(
|
|
4845
4984
|
baseDir,
|
|
4846
4985
|
paths.recommended.relativeDirPath,
|
|
4847
4986
|
paths.recommended.relativeFilePath
|
|
4848
4987
|
);
|
|
4849
|
-
const legacyPath = (0,
|
|
4988
|
+
const legacyPath = (0, import_node_path39.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
4850
4989
|
if (await fileExists(recommendedPath)) {
|
|
4851
4990
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
4852
4991
|
return new _RulesyncMcp({
|
|
@@ -4991,7 +5130,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
4991
5130
|
global = false
|
|
4992
5131
|
}) {
|
|
4993
5132
|
const paths = this.getSettablePaths({ global });
|
|
4994
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5133
|
+
const fileContent = await readFileContentOrNull((0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
4995
5134
|
const json = JSON.parse(fileContent);
|
|
4996
5135
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
4997
5136
|
return new _ClaudecodeMcp({
|
|
@@ -5010,7 +5149,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5010
5149
|
}) {
|
|
5011
5150
|
const paths = this.getSettablePaths({ global });
|
|
5012
5151
|
const fileContent = await readOrInitializeFileContent(
|
|
5013
|
-
(0,
|
|
5152
|
+
(0, import_node_path40.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
5014
5153
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
5015
5154
|
);
|
|
5016
5155
|
const json = JSON.parse(fileContent);
|
|
@@ -5049,7 +5188,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
5049
5188
|
};
|
|
5050
5189
|
|
|
5051
5190
|
// src/features/mcp/cline-mcp.ts
|
|
5052
|
-
var
|
|
5191
|
+
var import_node_path41 = require("path");
|
|
5053
5192
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
5054
5193
|
json;
|
|
5055
5194
|
constructor(params) {
|
|
@@ -5070,7 +5209,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5070
5209
|
validate = true
|
|
5071
5210
|
}) {
|
|
5072
5211
|
const fileContent = await readFileContent(
|
|
5073
|
-
(0,
|
|
5212
|
+
(0, import_node_path41.join)(
|
|
5074
5213
|
baseDir,
|
|
5075
5214
|
this.getSettablePaths().relativeDirPath,
|
|
5076
5215
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5119,7 +5258,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
5119
5258
|
};
|
|
5120
5259
|
|
|
5121
5260
|
// src/features/mcp/codexcli-mcp.ts
|
|
5122
|
-
var
|
|
5261
|
+
var import_node_path42 = require("path");
|
|
5123
5262
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
5124
5263
|
function convertFromCodexFormat(codexMcp) {
|
|
5125
5264
|
const result = {};
|
|
@@ -5202,7 +5341,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5202
5341
|
global = false
|
|
5203
5342
|
}) {
|
|
5204
5343
|
const paths = this.getSettablePaths({ global });
|
|
5205
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5344
|
+
const fileContent = await readFileContentOrNull((0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
|
|
5206
5345
|
return new _CodexcliMcp({
|
|
5207
5346
|
baseDir,
|
|
5208
5347
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -5218,7 +5357,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5218
5357
|
global = false
|
|
5219
5358
|
}) {
|
|
5220
5359
|
const paths = this.getSettablePaths({ global });
|
|
5221
|
-
const configTomlFilePath = (0,
|
|
5360
|
+
const configTomlFilePath = (0, import_node_path42.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
5222
5361
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
5223
5362
|
configTomlFilePath,
|
|
5224
5363
|
smolToml.stringify({})
|
|
@@ -5275,7 +5414,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5275
5414
|
};
|
|
5276
5415
|
|
|
5277
5416
|
// src/features/mcp/copilot-mcp.ts
|
|
5278
|
-
var
|
|
5417
|
+
var import_node_path43 = require("path");
|
|
5279
5418
|
function convertToCopilotFormat(mcpServers) {
|
|
5280
5419
|
return { servers: mcpServers };
|
|
5281
5420
|
}
|
|
@@ -5302,7 +5441,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
5302
5441
|
validate = true
|
|
5303
5442
|
}) {
|
|
5304
5443
|
const fileContent = await readFileContent(
|
|
5305
|
-
(0,
|
|
5444
|
+
(0, import_node_path43.join)(
|
|
5306
5445
|
baseDir,
|
|
5307
5446
|
this.getSettablePaths().relativeDirPath,
|
|
5308
5447
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5355,7 +5494,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
5355
5494
|
};
|
|
5356
5495
|
|
|
5357
5496
|
// src/features/mcp/cursor-mcp.ts
|
|
5358
|
-
var
|
|
5497
|
+
var import_node_path44 = require("path");
|
|
5359
5498
|
var CURSOR_ENV_VAR_PATTERN = /\$\{env:([^}]+)\}/g;
|
|
5360
5499
|
function isMcpServers(value) {
|
|
5361
5500
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
@@ -5416,7 +5555,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
5416
5555
|
validate = true
|
|
5417
5556
|
}) {
|
|
5418
5557
|
const fileContent = await readFileContent(
|
|
5419
|
-
(0,
|
|
5558
|
+
(0, import_node_path44.join)(
|
|
5420
5559
|
baseDir,
|
|
5421
5560
|
this.getSettablePaths().relativeDirPath,
|
|
5422
5561
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5484,7 +5623,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
5484
5623
|
};
|
|
5485
5624
|
|
|
5486
5625
|
// src/features/mcp/factorydroid-mcp.ts
|
|
5487
|
-
var
|
|
5626
|
+
var import_node_path45 = require("path");
|
|
5488
5627
|
var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
5489
5628
|
json;
|
|
5490
5629
|
constructor(params) {
|
|
@@ -5505,7 +5644,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
5505
5644
|
validate = true
|
|
5506
5645
|
}) {
|
|
5507
5646
|
const fileContent = await readFileContent(
|
|
5508
|
-
(0,
|
|
5647
|
+
(0, import_node_path45.join)(
|
|
5509
5648
|
baseDir,
|
|
5510
5649
|
this.getSettablePaths().relativeDirPath,
|
|
5511
5650
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5565,7 +5704,7 @@ var FactorydroidMcp = class _FactorydroidMcp extends ToolMcp {
|
|
|
5565
5704
|
};
|
|
5566
5705
|
|
|
5567
5706
|
// src/features/mcp/geminicli-mcp.ts
|
|
5568
|
-
var
|
|
5707
|
+
var import_node_path46 = require("path");
|
|
5569
5708
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
5570
5709
|
json;
|
|
5571
5710
|
constructor(params) {
|
|
@@ -5593,7 +5732,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
5593
5732
|
global = false
|
|
5594
5733
|
}) {
|
|
5595
5734
|
const paths = this.getSettablePaths({ global });
|
|
5596
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5735
|
+
const fileContent = await readFileContentOrNull((0, import_node_path46.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5597
5736
|
const json = JSON.parse(fileContent);
|
|
5598
5737
|
const newJson = { ...json, mcpServers: json.mcpServers ?? {} };
|
|
5599
5738
|
return new _GeminiCliMcp({
|
|
@@ -5612,7 +5751,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
5612
5751
|
}) {
|
|
5613
5752
|
const paths = this.getSettablePaths({ global });
|
|
5614
5753
|
const fileContent = await readOrInitializeFileContent(
|
|
5615
|
-
(0,
|
|
5754
|
+
(0, import_node_path46.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
5616
5755
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
5617
5756
|
);
|
|
5618
5757
|
const json = JSON.parse(fileContent);
|
|
@@ -5657,7 +5796,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
5657
5796
|
};
|
|
5658
5797
|
|
|
5659
5798
|
// src/features/mcp/junie-mcp.ts
|
|
5660
|
-
var
|
|
5799
|
+
var import_node_path47 = require("path");
|
|
5661
5800
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
5662
5801
|
json;
|
|
5663
5802
|
constructor(params) {
|
|
@@ -5669,7 +5808,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
5669
5808
|
}
|
|
5670
5809
|
static getSettablePaths() {
|
|
5671
5810
|
return {
|
|
5672
|
-
relativeDirPath: (0,
|
|
5811
|
+
relativeDirPath: (0, import_node_path47.join)(".junie", "mcp"),
|
|
5673
5812
|
relativeFilePath: "mcp.json"
|
|
5674
5813
|
};
|
|
5675
5814
|
}
|
|
@@ -5678,7 +5817,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
5678
5817
|
validate = true
|
|
5679
5818
|
}) {
|
|
5680
5819
|
const fileContent = await readFileContent(
|
|
5681
|
-
(0,
|
|
5820
|
+
(0, import_node_path47.join)(
|
|
5682
5821
|
baseDir,
|
|
5683
5822
|
this.getSettablePaths().relativeDirPath,
|
|
5684
5823
|
this.getSettablePaths().relativeFilePath
|
|
@@ -5727,7 +5866,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
5727
5866
|
};
|
|
5728
5867
|
|
|
5729
5868
|
// src/features/mcp/kilo-mcp.ts
|
|
5730
|
-
var
|
|
5869
|
+
var import_node_path48 = require("path");
|
|
5731
5870
|
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
5732
5871
|
json;
|
|
5733
5872
|
constructor(params) {
|
|
@@ -5748,7 +5887,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
5748
5887
|
validate = true
|
|
5749
5888
|
}) {
|
|
5750
5889
|
const paths = this.getSettablePaths();
|
|
5751
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5890
|
+
const fileContent = await readFileContentOrNull((0, import_node_path48.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5752
5891
|
return new _KiloMcp({
|
|
5753
5892
|
baseDir,
|
|
5754
5893
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -5796,7 +5935,7 @@ var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
|
5796
5935
|
};
|
|
5797
5936
|
|
|
5798
5937
|
// src/features/mcp/kiro-mcp.ts
|
|
5799
|
-
var
|
|
5938
|
+
var import_node_path49 = require("path");
|
|
5800
5939
|
var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
5801
5940
|
json;
|
|
5802
5941
|
constructor(params) {
|
|
@@ -5808,7 +5947,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
5808
5947
|
}
|
|
5809
5948
|
static getSettablePaths() {
|
|
5810
5949
|
return {
|
|
5811
|
-
relativeDirPath: (0,
|
|
5950
|
+
relativeDirPath: (0, import_node_path49.join)(".kiro", "settings"),
|
|
5812
5951
|
relativeFilePath: "mcp.json"
|
|
5813
5952
|
};
|
|
5814
5953
|
}
|
|
@@ -5817,7 +5956,7 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
5817
5956
|
validate = true
|
|
5818
5957
|
}) {
|
|
5819
5958
|
const paths = this.getSettablePaths();
|
|
5820
|
-
const fileContent = await readFileContentOrNull((0,
|
|
5959
|
+
const fileContent = await readFileContentOrNull((0, import_node_path49.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcpServers":{}}';
|
|
5821
5960
|
return new _KiroMcp({
|
|
5822
5961
|
baseDir,
|
|
5823
5962
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -5865,29 +6004,29 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
5865
6004
|
};
|
|
5866
6005
|
|
|
5867
6006
|
// src/features/mcp/opencode-mcp.ts
|
|
5868
|
-
var
|
|
5869
|
-
var
|
|
5870
|
-
var OpencodeMcpLocalServerSchema =
|
|
5871
|
-
type:
|
|
5872
|
-
command:
|
|
5873
|
-
environment:
|
|
5874
|
-
enabled:
|
|
5875
|
-
cwd:
|
|
6007
|
+
var import_node_path50 = require("path");
|
|
6008
|
+
var import_mini18 = require("zod/mini");
|
|
6009
|
+
var OpencodeMcpLocalServerSchema = import_mini18.z.object({
|
|
6010
|
+
type: import_mini18.z.literal("local"),
|
|
6011
|
+
command: import_mini18.z.array(import_mini18.z.string()),
|
|
6012
|
+
environment: import_mini18.z.optional(import_mini18.z.record(import_mini18.z.string(), import_mini18.z.string())),
|
|
6013
|
+
enabled: import_mini18.z._default(import_mini18.z.boolean(), true),
|
|
6014
|
+
cwd: import_mini18.z.optional(import_mini18.z.string())
|
|
5876
6015
|
});
|
|
5877
|
-
var OpencodeMcpRemoteServerSchema =
|
|
5878
|
-
type:
|
|
5879
|
-
url:
|
|
5880
|
-
headers:
|
|
5881
|
-
enabled:
|
|
6016
|
+
var OpencodeMcpRemoteServerSchema = import_mini18.z.object({
|
|
6017
|
+
type: import_mini18.z.literal("remote"),
|
|
6018
|
+
url: import_mini18.z.string(),
|
|
6019
|
+
headers: import_mini18.z.optional(import_mini18.z.record(import_mini18.z.string(), import_mini18.z.string())),
|
|
6020
|
+
enabled: import_mini18.z._default(import_mini18.z.boolean(), true)
|
|
5882
6021
|
});
|
|
5883
|
-
var OpencodeMcpServerSchema =
|
|
6022
|
+
var OpencodeMcpServerSchema = import_mini18.z.union([
|
|
5884
6023
|
OpencodeMcpLocalServerSchema,
|
|
5885
6024
|
OpencodeMcpRemoteServerSchema
|
|
5886
6025
|
]);
|
|
5887
|
-
var OpencodeConfigSchema =
|
|
5888
|
-
$schema:
|
|
5889
|
-
mcp:
|
|
5890
|
-
tools:
|
|
6026
|
+
var OpencodeConfigSchema = import_mini18.z.looseObject({
|
|
6027
|
+
$schema: import_mini18.z.optional(import_mini18.z.string()),
|
|
6028
|
+
mcp: import_mini18.z.optional(import_mini18.z.record(import_mini18.z.string(), OpencodeMcpServerSchema)),
|
|
6029
|
+
tools: import_mini18.z.optional(import_mini18.z.record(import_mini18.z.string(), import_mini18.z.boolean()))
|
|
5891
6030
|
});
|
|
5892
6031
|
function convertFromOpencodeFormat(opencodeMcp, tools) {
|
|
5893
6032
|
return Object.fromEntries(
|
|
@@ -6005,7 +6144,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6005
6144
|
static getSettablePaths({ global } = {}) {
|
|
6006
6145
|
if (global) {
|
|
6007
6146
|
return {
|
|
6008
|
-
relativeDirPath: (0,
|
|
6147
|
+
relativeDirPath: (0, import_node_path50.join)(".config", "opencode"),
|
|
6009
6148
|
relativeFilePath: "opencode.json"
|
|
6010
6149
|
};
|
|
6011
6150
|
}
|
|
@@ -6020,7 +6159,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6020
6159
|
global = false
|
|
6021
6160
|
}) {
|
|
6022
6161
|
const paths = this.getSettablePaths({ global });
|
|
6023
|
-
const fileContent = await readFileContentOrNull((0,
|
|
6162
|
+
const fileContent = await readFileContentOrNull((0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? '{"mcp":{}}';
|
|
6024
6163
|
const json = JSON.parse(fileContent);
|
|
6025
6164
|
const newJson = { ...json, mcp: json.mcp ?? {} };
|
|
6026
6165
|
return new _OpencodeMcp({
|
|
@@ -6039,7 +6178,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6039
6178
|
}) {
|
|
6040
6179
|
const paths = this.getSettablePaths({ global });
|
|
6041
6180
|
const fileContent = await readOrInitializeFileContent(
|
|
6042
|
-
(0,
|
|
6181
|
+
(0, import_node_path50.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
6043
6182
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
6044
6183
|
);
|
|
6045
6184
|
const json = JSON.parse(fileContent);
|
|
@@ -6092,7 +6231,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
6092
6231
|
};
|
|
6093
6232
|
|
|
6094
6233
|
// src/features/mcp/roo-mcp.ts
|
|
6095
|
-
var
|
|
6234
|
+
var import_node_path51 = require("path");
|
|
6096
6235
|
function isRooMcpServers(value) {
|
|
6097
6236
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
6098
6237
|
}
|
|
@@ -6144,7 +6283,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
6144
6283
|
validate = true
|
|
6145
6284
|
}) {
|
|
6146
6285
|
const fileContent = await readFileContent(
|
|
6147
|
-
(0,
|
|
6286
|
+
(0, import_node_path51.join)(
|
|
6148
6287
|
baseDir,
|
|
6149
6288
|
this.getSettablePaths().relativeDirPath,
|
|
6150
6289
|
this.getSettablePaths().relativeFilePath
|
|
@@ -6215,7 +6354,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
6215
6354
|
"opencode",
|
|
6216
6355
|
"roo"
|
|
6217
6356
|
];
|
|
6218
|
-
var McpProcessorToolTargetSchema =
|
|
6357
|
+
var McpProcessorToolTargetSchema = import_mini19.z.enum(mcpProcessorToolTargetTuple);
|
|
6219
6358
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
6220
6359
|
[
|
|
6221
6360
|
"claudecode",
|
|
@@ -6479,11 +6618,11 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
6479
6618
|
}
|
|
6480
6619
|
const factory = this.getFactory(this.toolTarget);
|
|
6481
6620
|
const toolMcps = await Promise.all(
|
|
6482
|
-
[rulesyncMcp].map(async (
|
|
6621
|
+
[rulesyncMcp].map(async (mcp) => {
|
|
6483
6622
|
const fieldsToStrip = [];
|
|
6484
6623
|
if (!factory.meta.supportsEnabledTools) fieldsToStrip.push("enabledTools");
|
|
6485
6624
|
if (!factory.meta.supportsDisabledTools) fieldsToStrip.push("disabledTools");
|
|
6486
|
-
const filteredRulesyncMcp =
|
|
6625
|
+
const filteredRulesyncMcp = mcp.stripMcpServerFields(fieldsToStrip);
|
|
6487
6626
|
return await factory.class.fromRulesyncMcp({
|
|
6488
6627
|
baseDir: this.baseDir,
|
|
6489
6628
|
rulesyncMcp: filteredRulesyncMcp,
|
|
@@ -6517,25 +6656,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
6517
6656
|
};
|
|
6518
6657
|
|
|
6519
6658
|
// src/features/rules/rules-processor.ts
|
|
6659
|
+
var import_node_path111 = require("path");
|
|
6520
6660
|
var import_toon = require("@toon-format/toon");
|
|
6521
|
-
var
|
|
6522
|
-
var import_mini49 = require("zod/mini");
|
|
6661
|
+
var import_mini51 = require("zod/mini");
|
|
6523
6662
|
|
|
6524
6663
|
// src/constants/general.ts
|
|
6525
6664
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
6526
6665
|
|
|
6527
6666
|
// src/features/skills/agentsmd-skill.ts
|
|
6528
|
-
var
|
|
6667
|
+
var import_node_path55 = require("path");
|
|
6529
6668
|
|
|
6530
6669
|
// src/features/skills/simulated-skill.ts
|
|
6531
|
-
var
|
|
6532
|
-
var
|
|
6670
|
+
var import_node_path54 = require("path");
|
|
6671
|
+
var import_mini20 = require("zod/mini");
|
|
6533
6672
|
|
|
6534
6673
|
// src/features/skills/tool-skill.ts
|
|
6535
|
-
var
|
|
6674
|
+
var import_node_path53 = require("path");
|
|
6536
6675
|
|
|
6537
6676
|
// src/types/ai-dir.ts
|
|
6538
|
-
var
|
|
6677
|
+
var import_node_path52 = __toESM(require("path"), 1);
|
|
6539
6678
|
var AiDir = class {
|
|
6540
6679
|
/**
|
|
6541
6680
|
* @example "."
|
|
@@ -6569,7 +6708,7 @@ var AiDir = class {
|
|
|
6569
6708
|
otherFiles = [],
|
|
6570
6709
|
global = false
|
|
6571
6710
|
}) {
|
|
6572
|
-
if (dirName.includes(
|
|
6711
|
+
if (dirName.includes(import_node_path52.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
6573
6712
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
6574
6713
|
}
|
|
6575
6714
|
this.baseDir = baseDir;
|
|
@@ -6592,11 +6731,11 @@ var AiDir = class {
|
|
|
6592
6731
|
return this.dirName;
|
|
6593
6732
|
}
|
|
6594
6733
|
getDirPath() {
|
|
6595
|
-
const fullPath =
|
|
6596
|
-
const resolvedFull = (0,
|
|
6597
|
-
const resolvedBase = (0,
|
|
6598
|
-
const rel = (0,
|
|
6599
|
-
if (rel.startsWith("..") ||
|
|
6734
|
+
const fullPath = import_node_path52.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
6735
|
+
const resolvedFull = (0, import_node_path52.resolve)(fullPath);
|
|
6736
|
+
const resolvedBase = (0, import_node_path52.resolve)(this.baseDir);
|
|
6737
|
+
const rel = (0, import_node_path52.relative)(resolvedBase, resolvedFull);
|
|
6738
|
+
if (rel.startsWith("..") || import_node_path52.default.isAbsolute(rel)) {
|
|
6600
6739
|
throw new Error(
|
|
6601
6740
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
6602
6741
|
);
|
|
@@ -6610,7 +6749,7 @@ var AiDir = class {
|
|
|
6610
6749
|
return this.otherFiles;
|
|
6611
6750
|
}
|
|
6612
6751
|
getRelativePathFromCwd() {
|
|
6613
|
-
return
|
|
6752
|
+
return import_node_path52.default.join(this.relativeDirPath, this.dirName);
|
|
6614
6753
|
}
|
|
6615
6754
|
getGlobal() {
|
|
6616
6755
|
return this.global;
|
|
@@ -6629,15 +6768,15 @@ var AiDir = class {
|
|
|
6629
6768
|
* @returns Array of files with their relative paths and buffers
|
|
6630
6769
|
*/
|
|
6631
6770
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
6632
|
-
const dirPath = (0,
|
|
6633
|
-
const glob = (0,
|
|
6771
|
+
const dirPath = (0, import_node_path52.join)(baseDir, relativeDirPath, dirName);
|
|
6772
|
+
const glob = (0, import_node_path52.join)(dirPath, "**", "*");
|
|
6634
6773
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
6635
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
6774
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path52.basename)(filePath) !== excludeFileName);
|
|
6636
6775
|
const files = await Promise.all(
|
|
6637
6776
|
filteredPaths.map(async (filePath) => {
|
|
6638
6777
|
const fileBuffer = await readFileBuffer(filePath);
|
|
6639
6778
|
return {
|
|
6640
|
-
relativeFilePathToDirPath: (0,
|
|
6779
|
+
relativeFilePathToDirPath: (0, import_node_path52.relative)(dirPath, filePath),
|
|
6641
6780
|
fileBuffer
|
|
6642
6781
|
};
|
|
6643
6782
|
})
|
|
@@ -6728,8 +6867,8 @@ var ToolSkill = class extends AiDir {
|
|
|
6728
6867
|
}) {
|
|
6729
6868
|
const settablePaths = getSettablePaths({ global });
|
|
6730
6869
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
6731
|
-
const skillDirPath = (0,
|
|
6732
|
-
const skillFilePath = (0,
|
|
6870
|
+
const skillDirPath = (0, import_node_path53.join)(baseDir, actualRelativeDirPath, dirName);
|
|
6871
|
+
const skillFilePath = (0, import_node_path53.join)(skillDirPath, SKILL_FILE_NAME);
|
|
6733
6872
|
if (!await fileExists(skillFilePath)) {
|
|
6734
6873
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
6735
6874
|
}
|
|
@@ -6753,16 +6892,16 @@ var ToolSkill = class extends AiDir {
|
|
|
6753
6892
|
}
|
|
6754
6893
|
requireMainFileFrontmatter() {
|
|
6755
6894
|
if (!this.mainFile?.frontmatter) {
|
|
6756
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
6895
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path53.join)(this.relativeDirPath, this.dirName)}`);
|
|
6757
6896
|
}
|
|
6758
6897
|
return this.mainFile.frontmatter;
|
|
6759
6898
|
}
|
|
6760
6899
|
};
|
|
6761
6900
|
|
|
6762
6901
|
// src/features/skills/simulated-skill.ts
|
|
6763
|
-
var SimulatedSkillFrontmatterSchema =
|
|
6764
|
-
name:
|
|
6765
|
-
description:
|
|
6902
|
+
var SimulatedSkillFrontmatterSchema = import_mini20.z.looseObject({
|
|
6903
|
+
name: import_mini20.z.string(),
|
|
6904
|
+
description: import_mini20.z.string()
|
|
6766
6905
|
});
|
|
6767
6906
|
var SimulatedSkill = class extends ToolSkill {
|
|
6768
6907
|
frontmatter;
|
|
@@ -6793,7 +6932,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
6793
6932
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
6794
6933
|
if (!result.success) {
|
|
6795
6934
|
throw new Error(
|
|
6796
|
-
`Invalid frontmatter in ${(0,
|
|
6935
|
+
`Invalid frontmatter in ${(0, import_node_path54.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
6797
6936
|
);
|
|
6798
6937
|
}
|
|
6799
6938
|
}
|
|
@@ -6851,8 +6990,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
6851
6990
|
}) {
|
|
6852
6991
|
const settablePaths = this.getSettablePaths();
|
|
6853
6992
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
6854
|
-
const skillDirPath = (0,
|
|
6855
|
-
const skillFilePath = (0,
|
|
6993
|
+
const skillDirPath = (0, import_node_path54.join)(baseDir, actualRelativeDirPath, dirName);
|
|
6994
|
+
const skillFilePath = (0, import_node_path54.join)(skillDirPath, SKILL_FILE_NAME);
|
|
6856
6995
|
if (!await fileExists(skillFilePath)) {
|
|
6857
6996
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
6858
6997
|
}
|
|
@@ -6929,7 +7068,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
6929
7068
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
6930
7069
|
}
|
|
6931
7070
|
return {
|
|
6932
|
-
relativeDirPath: (0,
|
|
7071
|
+
relativeDirPath: (0, import_node_path55.join)(".agents", "skills")
|
|
6933
7072
|
};
|
|
6934
7073
|
}
|
|
6935
7074
|
static async fromDir(params) {
|
|
@@ -6956,11 +7095,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
6956
7095
|
};
|
|
6957
7096
|
|
|
6958
7097
|
// src/features/skills/factorydroid-skill.ts
|
|
6959
|
-
var
|
|
7098
|
+
var import_node_path56 = require("path");
|
|
6960
7099
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
6961
7100
|
static getSettablePaths(_options) {
|
|
6962
7101
|
return {
|
|
6963
|
-
relativeDirPath: (0,
|
|
7102
|
+
relativeDirPath: (0, import_node_path56.join)(".factory", "skills")
|
|
6964
7103
|
};
|
|
6965
7104
|
}
|
|
6966
7105
|
static async fromDir(params) {
|
|
@@ -6987,11 +7126,11 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
6987
7126
|
};
|
|
6988
7127
|
|
|
6989
7128
|
// src/features/skills/skills-processor.ts
|
|
6990
|
-
var
|
|
6991
|
-
var
|
|
7129
|
+
var import_node_path73 = require("path");
|
|
7130
|
+
var import_mini35 = require("zod/mini");
|
|
6992
7131
|
|
|
6993
7132
|
// src/types/dir-feature-processor.ts
|
|
6994
|
-
var
|
|
7133
|
+
var import_node_path57 = require("path");
|
|
6995
7134
|
var DirFeatureProcessor = class {
|
|
6996
7135
|
baseDir;
|
|
6997
7136
|
dryRun;
|
|
@@ -7022,7 +7161,7 @@ var DirFeatureProcessor = class {
|
|
|
7022
7161
|
const mainFile = aiDir.getMainFile();
|
|
7023
7162
|
let mainFileContent;
|
|
7024
7163
|
if (mainFile) {
|
|
7025
|
-
const mainFilePath = (0,
|
|
7164
|
+
const mainFilePath = (0, import_node_path57.join)(dirPath, mainFile.name);
|
|
7026
7165
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
7027
7166
|
mainFileContent = addTrailingNewline(content);
|
|
7028
7167
|
const existingContent = await readFileContentOrNull(mainFilePath);
|
|
@@ -7036,7 +7175,7 @@ var DirFeatureProcessor = class {
|
|
|
7036
7175
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
7037
7176
|
otherFileContents.push(contentWithNewline);
|
|
7038
7177
|
if (!dirHasChanges) {
|
|
7039
|
-
const filePath = (0,
|
|
7178
|
+
const filePath = (0, import_node_path57.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7040
7179
|
const existingContent = await readFileContentOrNull(filePath);
|
|
7041
7180
|
if (existingContent !== contentWithNewline) {
|
|
7042
7181
|
dirHasChanges = true;
|
|
@@ -7050,22 +7189,22 @@ var DirFeatureProcessor = class {
|
|
|
7050
7189
|
if (this.dryRun) {
|
|
7051
7190
|
logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
7052
7191
|
if (mainFile) {
|
|
7053
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7054
|
-
changedPaths.push((0,
|
|
7192
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path57.join)(dirPath, mainFile.name)}`);
|
|
7193
|
+
changedPaths.push((0, import_node_path57.join)(relativeDir, mainFile.name));
|
|
7055
7194
|
}
|
|
7056
7195
|
for (const file of otherFiles) {
|
|
7057
|
-
logger.info(`[DRY RUN] Would write: ${(0,
|
|
7058
|
-
changedPaths.push((0,
|
|
7196
|
+
logger.info(`[DRY RUN] Would write: ${(0, import_node_path57.join)(dirPath, file.relativeFilePathToDirPath)}`);
|
|
7197
|
+
changedPaths.push((0, import_node_path57.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7059
7198
|
}
|
|
7060
7199
|
} else {
|
|
7061
7200
|
await ensureDir(dirPath);
|
|
7062
7201
|
if (mainFile && mainFileContent) {
|
|
7063
|
-
const mainFilePath = (0,
|
|
7202
|
+
const mainFilePath = (0, import_node_path57.join)(dirPath, mainFile.name);
|
|
7064
7203
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
7065
|
-
changedPaths.push((0,
|
|
7204
|
+
changedPaths.push((0, import_node_path57.join)(relativeDir, mainFile.name));
|
|
7066
7205
|
}
|
|
7067
7206
|
for (const [i, file] of otherFiles.entries()) {
|
|
7068
|
-
const filePath = (0,
|
|
7207
|
+
const filePath = (0, import_node_path57.join)(dirPath, file.relativeFilePathToDirPath);
|
|
7069
7208
|
const content = otherFileContents[i];
|
|
7070
7209
|
if (content === void 0) {
|
|
7071
7210
|
throw new Error(
|
|
@@ -7073,7 +7212,7 @@ var DirFeatureProcessor = class {
|
|
|
7073
7212
|
);
|
|
7074
7213
|
}
|
|
7075
7214
|
await writeFileContent(filePath, content);
|
|
7076
|
-
changedPaths.push((0,
|
|
7215
|
+
changedPaths.push((0, import_node_path57.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
7077
7216
|
}
|
|
7078
7217
|
}
|
|
7079
7218
|
changedCount++;
|
|
@@ -7105,37 +7244,38 @@ var DirFeatureProcessor = class {
|
|
|
7105
7244
|
};
|
|
7106
7245
|
|
|
7107
7246
|
// src/features/skills/agentsskills-skill.ts
|
|
7108
|
-
var
|
|
7109
|
-
var
|
|
7247
|
+
var import_node_path59 = require("path");
|
|
7248
|
+
var import_mini22 = require("zod/mini");
|
|
7110
7249
|
|
|
7111
7250
|
// src/features/skills/rulesync-skill.ts
|
|
7112
|
-
var
|
|
7113
|
-
var
|
|
7114
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
7115
|
-
name:
|
|
7116
|
-
description:
|
|
7117
|
-
targets:
|
|
7118
|
-
claudecode:
|
|
7119
|
-
|
|
7120
|
-
"allowed-tools":
|
|
7121
|
-
})
|
|
7122
|
-
),
|
|
7123
|
-
codexcli:
|
|
7124
|
-
|
|
7125
|
-
"short-description":
|
|
7251
|
+
var import_node_path58 = require("path");
|
|
7252
|
+
var import_mini21 = require("zod/mini");
|
|
7253
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini21.z.looseObject({
|
|
7254
|
+
name: import_mini21.z.string(),
|
|
7255
|
+
description: import_mini21.z.string(),
|
|
7256
|
+
targets: import_mini21.z._default(RulesyncTargetsSchema, ["*"]),
|
|
7257
|
+
claudecode: import_mini21.z.optional(
|
|
7258
|
+
import_mini21.z.looseObject({
|
|
7259
|
+
"allowed-tools": import_mini21.z.optional(import_mini21.z.array(import_mini21.z.string()))
|
|
7260
|
+
})
|
|
7261
|
+
),
|
|
7262
|
+
codexcli: import_mini21.z.optional(
|
|
7263
|
+
import_mini21.z.looseObject({
|
|
7264
|
+
"short-description": import_mini21.z.optional(import_mini21.z.string())
|
|
7126
7265
|
})
|
|
7127
7266
|
),
|
|
7128
|
-
opencode:
|
|
7129
|
-
|
|
7130
|
-
"allowed-tools":
|
|
7267
|
+
opencode: import_mini21.z.optional(
|
|
7268
|
+
import_mini21.z.looseObject({
|
|
7269
|
+
"allowed-tools": import_mini21.z.optional(import_mini21.z.array(import_mini21.z.string()))
|
|
7131
7270
|
})
|
|
7132
7271
|
),
|
|
7133
|
-
copilot:
|
|
7134
|
-
|
|
7135
|
-
license:
|
|
7272
|
+
copilot: import_mini21.z.optional(
|
|
7273
|
+
import_mini21.z.looseObject({
|
|
7274
|
+
license: import_mini21.z.optional(import_mini21.z.string())
|
|
7136
7275
|
})
|
|
7137
7276
|
),
|
|
7138
|
-
|
|
7277
|
+
cline: import_mini21.z.optional(import_mini21.z.looseObject({})),
|
|
7278
|
+
roo: import_mini21.z.optional(import_mini21.z.looseObject({}))
|
|
7139
7279
|
});
|
|
7140
7280
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
7141
7281
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -7175,7 +7315,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7175
7315
|
}
|
|
7176
7316
|
getFrontmatter() {
|
|
7177
7317
|
if (!this.mainFile?.frontmatter) {
|
|
7178
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
7318
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path58.join)(this.relativeDirPath, this.dirName)}`);
|
|
7179
7319
|
}
|
|
7180
7320
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
7181
7321
|
return result;
|
|
@@ -7201,8 +7341,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7201
7341
|
dirName,
|
|
7202
7342
|
global = false
|
|
7203
7343
|
}) {
|
|
7204
|
-
const skillDirPath = (0,
|
|
7205
|
-
const skillFilePath = (0,
|
|
7344
|
+
const skillDirPath = (0, import_node_path58.join)(baseDir, relativeDirPath, dirName);
|
|
7345
|
+
const skillFilePath = (0, import_node_path58.join)(skillDirPath, SKILL_FILE_NAME);
|
|
7206
7346
|
if (!await fileExists(skillFilePath)) {
|
|
7207
7347
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
7208
7348
|
}
|
|
@@ -7232,14 +7372,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
7232
7372
|
};
|
|
7233
7373
|
|
|
7234
7374
|
// src/features/skills/agentsskills-skill.ts
|
|
7235
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
7236
|
-
name:
|
|
7237
|
-
description:
|
|
7375
|
+
var AgentsSkillsSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
7376
|
+
name: import_mini22.z.string(),
|
|
7377
|
+
description: import_mini22.z.string()
|
|
7238
7378
|
});
|
|
7239
7379
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
7240
7380
|
constructor({
|
|
7241
7381
|
baseDir = process.cwd(),
|
|
7242
|
-
relativeDirPath = (0,
|
|
7382
|
+
relativeDirPath = (0, import_node_path59.join)(".agents", "skills"),
|
|
7243
7383
|
dirName,
|
|
7244
7384
|
frontmatter,
|
|
7245
7385
|
body,
|
|
@@ -7271,7 +7411,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7271
7411
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
7272
7412
|
}
|
|
7273
7413
|
return {
|
|
7274
|
-
relativeDirPath: (0,
|
|
7414
|
+
relativeDirPath: (0, import_node_path59.join)(".agents", "skills")
|
|
7275
7415
|
};
|
|
7276
7416
|
}
|
|
7277
7417
|
getFrontmatter() {
|
|
@@ -7350,9 +7490,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7350
7490
|
});
|
|
7351
7491
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7352
7492
|
if (!result.success) {
|
|
7353
|
-
const skillDirPath = (0,
|
|
7493
|
+
const skillDirPath = (0, import_node_path59.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7354
7494
|
throw new Error(
|
|
7355
|
-
`Invalid frontmatter in ${(0,
|
|
7495
|
+
`Invalid frontmatter in ${(0, import_node_path59.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7356
7496
|
);
|
|
7357
7497
|
}
|
|
7358
7498
|
return new _AgentsSkillsSkill({
|
|
@@ -7387,16 +7527,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
7387
7527
|
};
|
|
7388
7528
|
|
|
7389
7529
|
// src/features/skills/antigravity-skill.ts
|
|
7390
|
-
var
|
|
7391
|
-
var
|
|
7392
|
-
var AntigravitySkillFrontmatterSchema =
|
|
7393
|
-
name:
|
|
7394
|
-
description:
|
|
7530
|
+
var import_node_path60 = require("path");
|
|
7531
|
+
var import_mini23 = require("zod/mini");
|
|
7532
|
+
var AntigravitySkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
7533
|
+
name: import_mini23.z.string(),
|
|
7534
|
+
description: import_mini23.z.string()
|
|
7395
7535
|
});
|
|
7396
7536
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
7397
7537
|
constructor({
|
|
7398
7538
|
baseDir = process.cwd(),
|
|
7399
|
-
relativeDirPath = (0,
|
|
7539
|
+
relativeDirPath = (0, import_node_path60.join)(".agent", "skills"),
|
|
7400
7540
|
dirName,
|
|
7401
7541
|
frontmatter,
|
|
7402
7542
|
body,
|
|
@@ -7428,11 +7568,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7428
7568
|
} = {}) {
|
|
7429
7569
|
if (global) {
|
|
7430
7570
|
return {
|
|
7431
|
-
relativeDirPath: (0,
|
|
7571
|
+
relativeDirPath: (0, import_node_path60.join)(".gemini", "antigravity", "skills")
|
|
7432
7572
|
};
|
|
7433
7573
|
}
|
|
7434
7574
|
return {
|
|
7435
|
-
relativeDirPath: (0,
|
|
7575
|
+
relativeDirPath: (0, import_node_path60.join)(".agent", "skills")
|
|
7436
7576
|
};
|
|
7437
7577
|
}
|
|
7438
7578
|
getFrontmatter() {
|
|
@@ -7511,9 +7651,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7511
7651
|
});
|
|
7512
7652
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7513
7653
|
if (!result.success) {
|
|
7514
|
-
const skillDirPath = (0,
|
|
7654
|
+
const skillDirPath = (0, import_node_path60.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7515
7655
|
throw new Error(
|
|
7516
|
-
`Invalid frontmatter in ${(0,
|
|
7656
|
+
`Invalid frontmatter in ${(0, import_node_path60.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7517
7657
|
);
|
|
7518
7658
|
}
|
|
7519
7659
|
return new _AntigravitySkill({
|
|
@@ -7547,17 +7687,17 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
7547
7687
|
};
|
|
7548
7688
|
|
|
7549
7689
|
// src/features/skills/claudecode-skill.ts
|
|
7550
|
-
var
|
|
7551
|
-
var
|
|
7552
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
7553
|
-
name:
|
|
7554
|
-
description:
|
|
7555
|
-
"allowed-tools":
|
|
7690
|
+
var import_node_path61 = require("path");
|
|
7691
|
+
var import_mini24 = require("zod/mini");
|
|
7692
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
7693
|
+
name: import_mini24.z.string(),
|
|
7694
|
+
description: import_mini24.z.string(),
|
|
7695
|
+
"allowed-tools": import_mini24.z.optional(import_mini24.z.array(import_mini24.z.string()))
|
|
7556
7696
|
});
|
|
7557
7697
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
7558
7698
|
constructor({
|
|
7559
7699
|
baseDir = process.cwd(),
|
|
7560
|
-
relativeDirPath = (0,
|
|
7700
|
+
relativeDirPath = (0, import_node_path61.join)(".claude", "skills"),
|
|
7561
7701
|
dirName,
|
|
7562
7702
|
frontmatter,
|
|
7563
7703
|
body,
|
|
@@ -7588,7 +7728,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
7588
7728
|
global: _global = false
|
|
7589
7729
|
} = {}) {
|
|
7590
7730
|
return {
|
|
7591
|
-
relativeDirPath: (0,
|
|
7731
|
+
relativeDirPath: (0, import_node_path61.join)(".claude", "skills")
|
|
7592
7732
|
};
|
|
7593
7733
|
}
|
|
7594
7734
|
getFrontmatter() {
|
|
@@ -7673,9 +7813,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
7673
7813
|
});
|
|
7674
7814
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7675
7815
|
if (!result.success) {
|
|
7676
|
-
const skillDirPath = (0,
|
|
7816
|
+
const skillDirPath = (0, import_node_path61.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7677
7817
|
throw new Error(
|
|
7678
|
-
`Invalid frontmatter in ${(0,
|
|
7818
|
+
`Invalid frontmatter in ${(0, import_node_path61.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7679
7819
|
);
|
|
7680
7820
|
}
|
|
7681
7821
|
return new _ClaudecodeSkill({
|
|
@@ -7708,22 +7848,194 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
7708
7848
|
}
|
|
7709
7849
|
};
|
|
7710
7850
|
|
|
7851
|
+
// src/features/skills/cline-skill.ts
|
|
7852
|
+
var import_node_path62 = require("path");
|
|
7853
|
+
var import_mini25 = require("zod/mini");
|
|
7854
|
+
var ClineSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
7855
|
+
name: import_mini25.z.string(),
|
|
7856
|
+
description: import_mini25.z.string()
|
|
7857
|
+
});
|
|
7858
|
+
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
7859
|
+
constructor({
|
|
7860
|
+
baseDir = process.cwd(),
|
|
7861
|
+
relativeDirPath = (0, import_node_path62.join)(".cline", "skills"),
|
|
7862
|
+
dirName,
|
|
7863
|
+
frontmatter,
|
|
7864
|
+
body,
|
|
7865
|
+
otherFiles = [],
|
|
7866
|
+
validate = true,
|
|
7867
|
+
global = false
|
|
7868
|
+
}) {
|
|
7869
|
+
super({
|
|
7870
|
+
baseDir,
|
|
7871
|
+
relativeDirPath,
|
|
7872
|
+
dirName,
|
|
7873
|
+
mainFile: {
|
|
7874
|
+
name: SKILL_FILE_NAME,
|
|
7875
|
+
body,
|
|
7876
|
+
frontmatter: { ...frontmatter }
|
|
7877
|
+
},
|
|
7878
|
+
otherFiles,
|
|
7879
|
+
global
|
|
7880
|
+
});
|
|
7881
|
+
if (validate) {
|
|
7882
|
+
const result = this.validate();
|
|
7883
|
+
if (!result.success) {
|
|
7884
|
+
throw result.error;
|
|
7885
|
+
}
|
|
7886
|
+
}
|
|
7887
|
+
}
|
|
7888
|
+
static getSettablePaths(_options = {}) {
|
|
7889
|
+
return {
|
|
7890
|
+
relativeDirPath: (0, import_node_path62.join)(".cline", "skills")
|
|
7891
|
+
};
|
|
7892
|
+
}
|
|
7893
|
+
getFrontmatter() {
|
|
7894
|
+
const result = ClineSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
7895
|
+
return result;
|
|
7896
|
+
}
|
|
7897
|
+
getBody() {
|
|
7898
|
+
return this.mainFile?.body ?? "";
|
|
7899
|
+
}
|
|
7900
|
+
validate() {
|
|
7901
|
+
if (!this.mainFile) {
|
|
7902
|
+
return {
|
|
7903
|
+
success: false,
|
|
7904
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
7905
|
+
};
|
|
7906
|
+
}
|
|
7907
|
+
const result = ClineSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
7908
|
+
if (!result.success) {
|
|
7909
|
+
return {
|
|
7910
|
+
success: false,
|
|
7911
|
+
error: new Error(
|
|
7912
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
7913
|
+
)
|
|
7914
|
+
};
|
|
7915
|
+
}
|
|
7916
|
+
if (result.data.name !== this.getDirName()) {
|
|
7917
|
+
return {
|
|
7918
|
+
success: false,
|
|
7919
|
+
error: new Error(
|
|
7920
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
7921
|
+
)
|
|
7922
|
+
};
|
|
7923
|
+
}
|
|
7924
|
+
return { success: true, error: null };
|
|
7925
|
+
}
|
|
7926
|
+
toRulesyncSkill() {
|
|
7927
|
+
const frontmatter = this.getFrontmatter();
|
|
7928
|
+
const rulesyncFrontmatter = {
|
|
7929
|
+
name: frontmatter.name,
|
|
7930
|
+
description: frontmatter.description,
|
|
7931
|
+
targets: ["*"]
|
|
7932
|
+
};
|
|
7933
|
+
return new RulesyncSkill({
|
|
7934
|
+
baseDir: this.baseDir,
|
|
7935
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
7936
|
+
dirName: this.getDirName(),
|
|
7937
|
+
frontmatter: rulesyncFrontmatter,
|
|
7938
|
+
body: this.getBody(),
|
|
7939
|
+
otherFiles: this.getOtherFiles(),
|
|
7940
|
+
validate: true,
|
|
7941
|
+
global: this.global
|
|
7942
|
+
});
|
|
7943
|
+
}
|
|
7944
|
+
static fromRulesyncSkill({
|
|
7945
|
+
rulesyncSkill,
|
|
7946
|
+
validate = true,
|
|
7947
|
+
global = false
|
|
7948
|
+
}) {
|
|
7949
|
+
const settablePaths = _ClineSkill.getSettablePaths({ global });
|
|
7950
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
7951
|
+
const clineFrontmatter = {
|
|
7952
|
+
name: rulesyncFrontmatter.name,
|
|
7953
|
+
description: rulesyncFrontmatter.description
|
|
7954
|
+
};
|
|
7955
|
+
return new _ClineSkill({
|
|
7956
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
7957
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
7958
|
+
dirName: clineFrontmatter.name,
|
|
7959
|
+
frontmatter: clineFrontmatter,
|
|
7960
|
+
body: rulesyncSkill.getBody(),
|
|
7961
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
7962
|
+
validate,
|
|
7963
|
+
global
|
|
7964
|
+
});
|
|
7965
|
+
}
|
|
7966
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
7967
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
7968
|
+
return targets.includes("*") || targets.includes("cline");
|
|
7969
|
+
}
|
|
7970
|
+
static async fromDir(params) {
|
|
7971
|
+
const loaded = await this.loadSkillDirContent({
|
|
7972
|
+
...params,
|
|
7973
|
+
getSettablePaths: _ClineSkill.getSettablePaths
|
|
7974
|
+
});
|
|
7975
|
+
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7976
|
+
if (!result.success) {
|
|
7977
|
+
const skillDirPath = (0, import_node_path62.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7978
|
+
throw new Error(
|
|
7979
|
+
`Invalid frontmatter in ${(0, import_node_path62.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7980
|
+
);
|
|
7981
|
+
}
|
|
7982
|
+
if (result.data.name !== loaded.dirName) {
|
|
7983
|
+
const skillFilePath = (0, import_node_path62.join)(
|
|
7984
|
+
loaded.baseDir,
|
|
7985
|
+
loaded.relativeDirPath,
|
|
7986
|
+
loaded.dirName,
|
|
7987
|
+
SKILL_FILE_NAME
|
|
7988
|
+
);
|
|
7989
|
+
throw new Error(
|
|
7990
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
7991
|
+
);
|
|
7992
|
+
}
|
|
7993
|
+
return new _ClineSkill({
|
|
7994
|
+
baseDir: loaded.baseDir,
|
|
7995
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
7996
|
+
dirName: loaded.dirName,
|
|
7997
|
+
frontmatter: result.data,
|
|
7998
|
+
body: loaded.body,
|
|
7999
|
+
otherFiles: loaded.otherFiles,
|
|
8000
|
+
validate: true,
|
|
8001
|
+
global: loaded.global
|
|
8002
|
+
});
|
|
8003
|
+
}
|
|
8004
|
+
static forDeletion({
|
|
8005
|
+
baseDir = process.cwd(),
|
|
8006
|
+
relativeDirPath,
|
|
8007
|
+
dirName,
|
|
8008
|
+
global = false
|
|
8009
|
+
}) {
|
|
8010
|
+
return new _ClineSkill({
|
|
8011
|
+
baseDir,
|
|
8012
|
+
relativeDirPath,
|
|
8013
|
+
dirName,
|
|
8014
|
+
frontmatter: { name: "", description: "" },
|
|
8015
|
+
body: "",
|
|
8016
|
+
otherFiles: [],
|
|
8017
|
+
validate: false,
|
|
8018
|
+
global
|
|
8019
|
+
});
|
|
8020
|
+
}
|
|
8021
|
+
};
|
|
8022
|
+
|
|
7711
8023
|
// src/features/skills/codexcli-skill.ts
|
|
7712
|
-
var
|
|
7713
|
-
var
|
|
7714
|
-
var CodexCliSkillFrontmatterSchema =
|
|
7715
|
-
name:
|
|
7716
|
-
description:
|
|
7717
|
-
metadata:
|
|
7718
|
-
|
|
7719
|
-
"short-description":
|
|
8024
|
+
var import_node_path63 = require("path");
|
|
8025
|
+
var import_mini26 = require("zod/mini");
|
|
8026
|
+
var CodexCliSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
8027
|
+
name: import_mini26.z.string(),
|
|
8028
|
+
description: import_mini26.z.string(),
|
|
8029
|
+
metadata: import_mini26.z.optional(
|
|
8030
|
+
import_mini26.z.looseObject({
|
|
8031
|
+
"short-description": import_mini26.z.optional(import_mini26.z.string())
|
|
7720
8032
|
})
|
|
7721
8033
|
)
|
|
7722
8034
|
});
|
|
7723
8035
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
7724
8036
|
constructor({
|
|
7725
8037
|
baseDir = process.cwd(),
|
|
7726
|
-
relativeDirPath = (0,
|
|
8038
|
+
relativeDirPath = (0, import_node_path63.join)(".codex", "skills"),
|
|
7727
8039
|
dirName,
|
|
7728
8040
|
frontmatter,
|
|
7729
8041
|
body,
|
|
@@ -7754,7 +8066,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
7754
8066
|
global: _global = false
|
|
7755
8067
|
} = {}) {
|
|
7756
8068
|
return {
|
|
7757
|
-
relativeDirPath: (0,
|
|
8069
|
+
relativeDirPath: (0, import_node_path63.join)(".codex", "skills")
|
|
7758
8070
|
};
|
|
7759
8071
|
}
|
|
7760
8072
|
getFrontmatter() {
|
|
@@ -7843,9 +8155,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
7843
8155
|
});
|
|
7844
8156
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
7845
8157
|
if (!result.success) {
|
|
7846
|
-
const skillDirPath = (0,
|
|
8158
|
+
const skillDirPath = (0, import_node_path63.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
7847
8159
|
throw new Error(
|
|
7848
|
-
`Invalid frontmatter in ${(0,
|
|
8160
|
+
`Invalid frontmatter in ${(0, import_node_path63.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
7849
8161
|
);
|
|
7850
8162
|
}
|
|
7851
8163
|
return new _CodexCliSkill({
|
|
@@ -7879,17 +8191,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
7879
8191
|
};
|
|
7880
8192
|
|
|
7881
8193
|
// src/features/skills/copilot-skill.ts
|
|
7882
|
-
var
|
|
7883
|
-
var
|
|
7884
|
-
var CopilotSkillFrontmatterSchema =
|
|
7885
|
-
name:
|
|
7886
|
-
description:
|
|
7887
|
-
license:
|
|
8194
|
+
var import_node_path64 = require("path");
|
|
8195
|
+
var import_mini27 = require("zod/mini");
|
|
8196
|
+
var CopilotSkillFrontmatterSchema = import_mini27.z.looseObject({
|
|
8197
|
+
name: import_mini27.z.string(),
|
|
8198
|
+
description: import_mini27.z.string(),
|
|
8199
|
+
license: import_mini27.z.optional(import_mini27.z.string())
|
|
7888
8200
|
});
|
|
7889
8201
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
7890
8202
|
constructor({
|
|
7891
8203
|
baseDir = process.cwd(),
|
|
7892
|
-
relativeDirPath = (0,
|
|
8204
|
+
relativeDirPath = (0, import_node_path64.join)(".github", "skills"),
|
|
7893
8205
|
dirName,
|
|
7894
8206
|
frontmatter,
|
|
7895
8207
|
body,
|
|
@@ -7921,7 +8233,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
7921
8233
|
throw new Error("CopilotSkill does not support global mode.");
|
|
7922
8234
|
}
|
|
7923
8235
|
return {
|
|
7924
|
-
relativeDirPath: (0,
|
|
8236
|
+
relativeDirPath: (0, import_node_path64.join)(".github", "skills")
|
|
7925
8237
|
};
|
|
7926
8238
|
}
|
|
7927
8239
|
getFrontmatter() {
|
|
@@ -8006,9 +8318,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8006
8318
|
});
|
|
8007
8319
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8008
8320
|
if (!result.success) {
|
|
8009
|
-
const skillDirPath = (0,
|
|
8321
|
+
const skillDirPath = (0, import_node_path64.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8010
8322
|
throw new Error(
|
|
8011
|
-
`Invalid frontmatter in ${(0,
|
|
8323
|
+
`Invalid frontmatter in ${(0, import_node_path64.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8012
8324
|
);
|
|
8013
8325
|
}
|
|
8014
8326
|
return new _CopilotSkill({
|
|
@@ -8043,16 +8355,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
8043
8355
|
};
|
|
8044
8356
|
|
|
8045
8357
|
// src/features/skills/cursor-skill.ts
|
|
8046
|
-
var
|
|
8047
|
-
var
|
|
8048
|
-
var CursorSkillFrontmatterSchema =
|
|
8049
|
-
name:
|
|
8050
|
-
description:
|
|
8358
|
+
var import_node_path65 = require("path");
|
|
8359
|
+
var import_mini28 = require("zod/mini");
|
|
8360
|
+
var CursorSkillFrontmatterSchema = import_mini28.z.looseObject({
|
|
8361
|
+
name: import_mini28.z.string(),
|
|
8362
|
+
description: import_mini28.z.string()
|
|
8051
8363
|
});
|
|
8052
8364
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
8053
8365
|
constructor({
|
|
8054
8366
|
baseDir = process.cwd(),
|
|
8055
|
-
relativeDirPath = (0,
|
|
8367
|
+
relativeDirPath = (0, import_node_path65.join)(".cursor", "skills"),
|
|
8056
8368
|
dirName,
|
|
8057
8369
|
frontmatter,
|
|
8058
8370
|
body,
|
|
@@ -8081,7 +8393,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8081
8393
|
}
|
|
8082
8394
|
static getSettablePaths(_options) {
|
|
8083
8395
|
return {
|
|
8084
|
-
relativeDirPath: (0,
|
|
8396
|
+
relativeDirPath: (0, import_node_path65.join)(".cursor", "skills")
|
|
8085
8397
|
};
|
|
8086
8398
|
}
|
|
8087
8399
|
getFrontmatter() {
|
|
@@ -8160,9 +8472,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8160
8472
|
});
|
|
8161
8473
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8162
8474
|
if (!result.success) {
|
|
8163
|
-
const skillDirPath = (0,
|
|
8475
|
+
const skillDirPath = (0, import_node_path65.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8164
8476
|
throw new Error(
|
|
8165
|
-
`Invalid frontmatter in ${(0,
|
|
8477
|
+
`Invalid frontmatter in ${(0, import_node_path65.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8166
8478
|
);
|
|
8167
8479
|
}
|
|
8168
8480
|
return new _CursorSkill({
|
|
@@ -8197,11 +8509,11 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
8197
8509
|
};
|
|
8198
8510
|
|
|
8199
8511
|
// src/features/skills/geminicli-skill.ts
|
|
8200
|
-
var
|
|
8201
|
-
var
|
|
8202
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
8203
|
-
name:
|
|
8204
|
-
description:
|
|
8512
|
+
var import_node_path66 = require("path");
|
|
8513
|
+
var import_mini29 = require("zod/mini");
|
|
8514
|
+
var GeminiCliSkillFrontmatterSchema = import_mini29.z.looseObject({
|
|
8515
|
+
name: import_mini29.z.string(),
|
|
8516
|
+
description: import_mini29.z.string()
|
|
8205
8517
|
});
|
|
8206
8518
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
8207
8519
|
constructor({
|
|
@@ -8237,7 +8549,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8237
8549
|
global: _global = false
|
|
8238
8550
|
} = {}) {
|
|
8239
8551
|
return {
|
|
8240
|
-
relativeDirPath: (0,
|
|
8552
|
+
relativeDirPath: (0, import_node_path66.join)(".gemini", "skills")
|
|
8241
8553
|
};
|
|
8242
8554
|
}
|
|
8243
8555
|
getFrontmatter() {
|
|
@@ -8316,9 +8628,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8316
8628
|
});
|
|
8317
8629
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8318
8630
|
if (!result.success) {
|
|
8319
|
-
const skillDirPath = (0,
|
|
8631
|
+
const skillDirPath = (0, import_node_path66.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8320
8632
|
throw new Error(
|
|
8321
|
-
`Invalid frontmatter in ${(0,
|
|
8633
|
+
`Invalid frontmatter in ${(0, import_node_path66.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8322
8634
|
);
|
|
8323
8635
|
}
|
|
8324
8636
|
return new _GeminiCliSkill({
|
|
@@ -8353,16 +8665,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
8353
8665
|
};
|
|
8354
8666
|
|
|
8355
8667
|
// src/features/skills/kilo-skill.ts
|
|
8356
|
-
var
|
|
8357
|
-
var
|
|
8358
|
-
var KiloSkillFrontmatterSchema =
|
|
8359
|
-
name:
|
|
8360
|
-
description:
|
|
8668
|
+
var import_node_path67 = require("path");
|
|
8669
|
+
var import_mini30 = require("zod/mini");
|
|
8670
|
+
var KiloSkillFrontmatterSchema = import_mini30.z.looseObject({
|
|
8671
|
+
name: import_mini30.z.string(),
|
|
8672
|
+
description: import_mini30.z.string()
|
|
8361
8673
|
});
|
|
8362
8674
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
8363
8675
|
constructor({
|
|
8364
8676
|
baseDir = process.cwd(),
|
|
8365
|
-
relativeDirPath = (0,
|
|
8677
|
+
relativeDirPath = (0, import_node_path67.join)(".kilocode", "skills"),
|
|
8366
8678
|
dirName,
|
|
8367
8679
|
frontmatter,
|
|
8368
8680
|
body,
|
|
@@ -8393,7 +8705,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
8393
8705
|
global: _global = false
|
|
8394
8706
|
} = {}) {
|
|
8395
8707
|
return {
|
|
8396
|
-
relativeDirPath: (0,
|
|
8708
|
+
relativeDirPath: (0, import_node_path67.join)(".kilocode", "skills")
|
|
8397
8709
|
};
|
|
8398
8710
|
}
|
|
8399
8711
|
getFrontmatter() {
|
|
@@ -8480,13 +8792,13 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
8480
8792
|
});
|
|
8481
8793
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8482
8794
|
if (!result.success) {
|
|
8483
|
-
const skillDirPath = (0,
|
|
8795
|
+
const skillDirPath = (0, import_node_path67.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8484
8796
|
throw new Error(
|
|
8485
|
-
`Invalid frontmatter in ${(0,
|
|
8797
|
+
`Invalid frontmatter in ${(0, import_node_path67.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8486
8798
|
);
|
|
8487
8799
|
}
|
|
8488
8800
|
if (result.data.name !== loaded.dirName) {
|
|
8489
|
-
const skillFilePath = (0,
|
|
8801
|
+
const skillFilePath = (0, import_node_path67.join)(
|
|
8490
8802
|
loaded.baseDir,
|
|
8491
8803
|
loaded.relativeDirPath,
|
|
8492
8804
|
loaded.dirName,
|
|
@@ -8527,16 +8839,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
8527
8839
|
};
|
|
8528
8840
|
|
|
8529
8841
|
// src/features/skills/kiro-skill.ts
|
|
8530
|
-
var
|
|
8531
|
-
var
|
|
8532
|
-
var KiroSkillFrontmatterSchema =
|
|
8533
|
-
name:
|
|
8534
|
-
description:
|
|
8842
|
+
var import_node_path68 = require("path");
|
|
8843
|
+
var import_mini31 = require("zod/mini");
|
|
8844
|
+
var KiroSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
8845
|
+
name: import_mini31.z.string(),
|
|
8846
|
+
description: import_mini31.z.string()
|
|
8535
8847
|
});
|
|
8536
8848
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
8537
8849
|
constructor({
|
|
8538
8850
|
baseDir = process.cwd(),
|
|
8539
|
-
relativeDirPath = (0,
|
|
8851
|
+
relativeDirPath = (0, import_node_path68.join)(".kiro", "skills"),
|
|
8540
8852
|
dirName,
|
|
8541
8853
|
frontmatter,
|
|
8542
8854
|
body,
|
|
@@ -8568,7 +8880,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
8568
8880
|
throw new Error("KiroSkill does not support global mode.");
|
|
8569
8881
|
}
|
|
8570
8882
|
return {
|
|
8571
|
-
relativeDirPath: (0,
|
|
8883
|
+
relativeDirPath: (0, import_node_path68.join)(".kiro", "skills")
|
|
8572
8884
|
};
|
|
8573
8885
|
}
|
|
8574
8886
|
getFrontmatter() {
|
|
@@ -8655,13 +8967,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
8655
8967
|
});
|
|
8656
8968
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8657
8969
|
if (!result.success) {
|
|
8658
|
-
const skillDirPath = (0,
|
|
8970
|
+
const skillDirPath = (0, import_node_path68.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8659
8971
|
throw new Error(
|
|
8660
|
-
`Invalid frontmatter in ${(0,
|
|
8972
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8661
8973
|
);
|
|
8662
8974
|
}
|
|
8663
8975
|
if (result.data.name !== loaded.dirName) {
|
|
8664
|
-
const skillFilePath = (0,
|
|
8976
|
+
const skillFilePath = (0, import_node_path68.join)(
|
|
8665
8977
|
loaded.baseDir,
|
|
8666
8978
|
loaded.relativeDirPath,
|
|
8667
8979
|
loaded.dirName,
|
|
@@ -8703,17 +9015,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
8703
9015
|
};
|
|
8704
9016
|
|
|
8705
9017
|
// src/features/skills/opencode-skill.ts
|
|
8706
|
-
var
|
|
8707
|
-
var
|
|
8708
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
8709
|
-
name:
|
|
8710
|
-
description:
|
|
8711
|
-
"allowed-tools":
|
|
9018
|
+
var import_node_path69 = require("path");
|
|
9019
|
+
var import_mini32 = require("zod/mini");
|
|
9020
|
+
var OpenCodeSkillFrontmatterSchema = import_mini32.z.looseObject({
|
|
9021
|
+
name: import_mini32.z.string(),
|
|
9022
|
+
description: import_mini32.z.string(),
|
|
9023
|
+
"allowed-tools": import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
|
|
8712
9024
|
});
|
|
8713
9025
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
8714
9026
|
constructor({
|
|
8715
9027
|
baseDir = process.cwd(),
|
|
8716
|
-
relativeDirPath = (0,
|
|
9028
|
+
relativeDirPath = (0, import_node_path69.join)(".opencode", "skill"),
|
|
8717
9029
|
dirName,
|
|
8718
9030
|
frontmatter,
|
|
8719
9031
|
body,
|
|
@@ -8742,7 +9054,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
8742
9054
|
}
|
|
8743
9055
|
static getSettablePaths({ global = false } = {}) {
|
|
8744
9056
|
return {
|
|
8745
|
-
relativeDirPath: global ? (0,
|
|
9057
|
+
relativeDirPath: global ? (0, import_node_path69.join)(".config", "opencode", "skill") : (0, import_node_path69.join)(".opencode", "skill")
|
|
8746
9058
|
};
|
|
8747
9059
|
}
|
|
8748
9060
|
getFrontmatter() {
|
|
@@ -8827,9 +9139,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
8827
9139
|
});
|
|
8828
9140
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8829
9141
|
if (!result.success) {
|
|
8830
|
-
const skillDirPath = (0,
|
|
9142
|
+
const skillDirPath = (0, import_node_path69.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8831
9143
|
throw new Error(
|
|
8832
|
-
`Invalid frontmatter in ${(0,
|
|
9144
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8833
9145
|
);
|
|
8834
9146
|
}
|
|
8835
9147
|
return new _OpenCodeSkill({
|
|
@@ -8863,16 +9175,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
8863
9175
|
};
|
|
8864
9176
|
|
|
8865
9177
|
// src/features/skills/replit-skill.ts
|
|
8866
|
-
var
|
|
8867
|
-
var
|
|
8868
|
-
var ReplitSkillFrontmatterSchema =
|
|
8869
|
-
name:
|
|
8870
|
-
description:
|
|
9178
|
+
var import_node_path70 = require("path");
|
|
9179
|
+
var import_mini33 = require("zod/mini");
|
|
9180
|
+
var ReplitSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
9181
|
+
name: import_mini33.z.string(),
|
|
9182
|
+
description: import_mini33.z.string()
|
|
8871
9183
|
});
|
|
8872
9184
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
8873
9185
|
constructor({
|
|
8874
9186
|
baseDir = process.cwd(),
|
|
8875
|
-
relativeDirPath = (0,
|
|
9187
|
+
relativeDirPath = (0, import_node_path70.join)(".agents", "skills"),
|
|
8876
9188
|
dirName,
|
|
8877
9189
|
frontmatter,
|
|
8878
9190
|
body,
|
|
@@ -8904,7 +9216,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
8904
9216
|
throw new Error("ReplitSkill does not support global mode.");
|
|
8905
9217
|
}
|
|
8906
9218
|
return {
|
|
8907
|
-
relativeDirPath: (0,
|
|
9219
|
+
relativeDirPath: (0, import_node_path70.join)(".agents", "skills")
|
|
8908
9220
|
};
|
|
8909
9221
|
}
|
|
8910
9222
|
getFrontmatter() {
|
|
@@ -8983,9 +9295,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
8983
9295
|
});
|
|
8984
9296
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
8985
9297
|
if (!result.success) {
|
|
8986
|
-
const skillDirPath = (0,
|
|
9298
|
+
const skillDirPath = (0, import_node_path70.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
8987
9299
|
throw new Error(
|
|
8988
|
-
`Invalid frontmatter in ${(0,
|
|
9300
|
+
`Invalid frontmatter in ${(0, import_node_path70.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
8989
9301
|
);
|
|
8990
9302
|
}
|
|
8991
9303
|
return new _ReplitSkill({
|
|
@@ -9020,16 +9332,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
9020
9332
|
};
|
|
9021
9333
|
|
|
9022
9334
|
// src/features/skills/roo-skill.ts
|
|
9023
|
-
var
|
|
9024
|
-
var
|
|
9025
|
-
var RooSkillFrontmatterSchema =
|
|
9026
|
-
name:
|
|
9027
|
-
description:
|
|
9335
|
+
var import_node_path71 = require("path");
|
|
9336
|
+
var import_mini34 = require("zod/mini");
|
|
9337
|
+
var RooSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
9338
|
+
name: import_mini34.z.string(),
|
|
9339
|
+
description: import_mini34.z.string()
|
|
9028
9340
|
});
|
|
9029
9341
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
9030
9342
|
constructor({
|
|
9031
9343
|
baseDir = process.cwd(),
|
|
9032
|
-
relativeDirPath = (0,
|
|
9344
|
+
relativeDirPath = (0, import_node_path71.join)(".roo", "skills"),
|
|
9033
9345
|
dirName,
|
|
9034
9346
|
frontmatter,
|
|
9035
9347
|
body,
|
|
@@ -9060,7 +9372,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9060
9372
|
global: _global = false
|
|
9061
9373
|
} = {}) {
|
|
9062
9374
|
return {
|
|
9063
|
-
relativeDirPath: (0,
|
|
9375
|
+
relativeDirPath: (0, import_node_path71.join)(".roo", "skills")
|
|
9064
9376
|
};
|
|
9065
9377
|
}
|
|
9066
9378
|
getFrontmatter() {
|
|
@@ -9147,13 +9459,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9147
9459
|
});
|
|
9148
9460
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9149
9461
|
if (!result.success) {
|
|
9150
|
-
const skillDirPath = (0,
|
|
9462
|
+
const skillDirPath = (0, import_node_path71.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9151
9463
|
throw new Error(
|
|
9152
|
-
`Invalid frontmatter in ${(0,
|
|
9464
|
+
`Invalid frontmatter in ${(0, import_node_path71.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9153
9465
|
);
|
|
9154
9466
|
}
|
|
9155
9467
|
if (result.data.name !== loaded.dirName) {
|
|
9156
|
-
const skillFilePath = (0,
|
|
9468
|
+
const skillFilePath = (0, import_node_path71.join)(
|
|
9157
9469
|
loaded.baseDir,
|
|
9158
9470
|
loaded.relativeDirPath,
|
|
9159
9471
|
loaded.dirName,
|
|
@@ -9194,17 +9506,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
9194
9506
|
};
|
|
9195
9507
|
|
|
9196
9508
|
// src/features/skills/skills-utils.ts
|
|
9197
|
-
var
|
|
9509
|
+
var import_node_path72 = require("path");
|
|
9198
9510
|
async function getLocalSkillDirNames(baseDir) {
|
|
9199
|
-
const skillsDir = (0,
|
|
9511
|
+
const skillsDir = (0, import_node_path72.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
9200
9512
|
const names = /* @__PURE__ */ new Set();
|
|
9201
9513
|
if (!await directoryExists(skillsDir)) {
|
|
9202
9514
|
return names;
|
|
9203
9515
|
}
|
|
9204
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
9516
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path72.join)(skillsDir, "*"), { type: "dir" });
|
|
9205
9517
|
for (const dirPath of dirPaths) {
|
|
9206
|
-
const name = (0,
|
|
9207
|
-
if (name === (0,
|
|
9518
|
+
const name = (0, import_node_path72.basename)(dirPath);
|
|
9519
|
+
if (name === (0, import_node_path72.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
9208
9520
|
names.add(name);
|
|
9209
9521
|
}
|
|
9210
9522
|
return names;
|
|
@@ -9217,6 +9529,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
9217
9529
|
"antigravity",
|
|
9218
9530
|
"claudecode",
|
|
9219
9531
|
"claudecode-legacy",
|
|
9532
|
+
"cline",
|
|
9220
9533
|
"codexcli",
|
|
9221
9534
|
"copilot",
|
|
9222
9535
|
"cursor",
|
|
@@ -9228,7 +9541,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
9228
9541
|
"replit",
|
|
9229
9542
|
"roo"
|
|
9230
9543
|
];
|
|
9231
|
-
var SkillsProcessorToolTargetSchema =
|
|
9544
|
+
var SkillsProcessorToolTargetSchema = import_mini35.z.enum(skillsProcessorToolTargetTuple);
|
|
9232
9545
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
9233
9546
|
[
|
|
9234
9547
|
"agentsmd",
|
|
@@ -9265,6 +9578,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
9265
9578
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
9266
9579
|
}
|
|
9267
9580
|
],
|
|
9581
|
+
[
|
|
9582
|
+
"cline",
|
|
9583
|
+
{
|
|
9584
|
+
class: ClineSkill,
|
|
9585
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
9586
|
+
}
|
|
9587
|
+
],
|
|
9268
9588
|
[
|
|
9269
9589
|
"codexcli",
|
|
9270
9590
|
{
|
|
@@ -9422,11 +9742,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9422
9742
|
)
|
|
9423
9743
|
);
|
|
9424
9744
|
const localSkillNames = new Set(localDirNames);
|
|
9425
|
-
const curatedDirPath = (0,
|
|
9745
|
+
const curatedDirPath = (0, import_node_path73.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
9426
9746
|
let curatedSkills = [];
|
|
9427
9747
|
if (await directoryExists(curatedDirPath)) {
|
|
9428
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
9429
|
-
const curatedDirNames = curatedDirPaths.map((path4) => (0,
|
|
9748
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path73.join)(curatedDirPath, "*"), { type: "dir" });
|
|
9749
|
+
const curatedDirNames = curatedDirPaths.map((path4) => (0, import_node_path73.basename)(path4));
|
|
9430
9750
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
9431
9751
|
if (localSkillNames.has(name)) {
|
|
9432
9752
|
logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -9459,9 +9779,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9459
9779
|
async loadToolDirs() {
|
|
9460
9780
|
const factory = this.getFactory(this.toolTarget);
|
|
9461
9781
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
9462
|
-
const skillsDirPath = (0,
|
|
9463
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
9464
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
9782
|
+
const skillsDirPath = (0, import_node_path73.join)(this.baseDir, paths.relativeDirPath);
|
|
9783
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path73.join)(skillsDirPath, "*"), { type: "dir" });
|
|
9784
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path73.basename)(path4));
|
|
9465
9785
|
const toolSkills = await Promise.all(
|
|
9466
9786
|
dirNames.map(
|
|
9467
9787
|
(dirName) => factory.class.fromDir({
|
|
@@ -9477,9 +9797,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9477
9797
|
async loadToolDirsToDelete() {
|
|
9478
9798
|
const factory = this.getFactory(this.toolTarget);
|
|
9479
9799
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
9480
|
-
const skillsDirPath = (0,
|
|
9481
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
9482
|
-
const dirNames = dirPaths.map((path4) => (0,
|
|
9800
|
+
const skillsDirPath = (0, import_node_path73.join)(this.baseDir, paths.relativeDirPath);
|
|
9801
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path73.join)(skillsDirPath, "*"), { type: "dir" });
|
|
9802
|
+
const dirNames = dirPaths.map((path4) => (0, import_node_path73.basename)(path4));
|
|
9483
9803
|
const toolSkills = dirNames.map(
|
|
9484
9804
|
(dirName) => factory.class.forDeletion({
|
|
9485
9805
|
baseDir: this.baseDir,
|
|
@@ -9540,11 +9860,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
9540
9860
|
};
|
|
9541
9861
|
|
|
9542
9862
|
// src/features/subagents/agentsmd-subagent.ts
|
|
9543
|
-
var
|
|
9863
|
+
var import_node_path75 = require("path");
|
|
9544
9864
|
|
|
9545
9865
|
// src/features/subagents/simulated-subagent.ts
|
|
9546
|
-
var
|
|
9547
|
-
var
|
|
9866
|
+
var import_node_path74 = require("path");
|
|
9867
|
+
var import_mini36 = require("zod/mini");
|
|
9548
9868
|
|
|
9549
9869
|
// src/features/subagents/tool-subagent.ts
|
|
9550
9870
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -9584,12 +9904,21 @@ var ToolSubagent = class extends ToolFile {
|
|
|
9584
9904
|
}
|
|
9585
9905
|
return false;
|
|
9586
9906
|
}
|
|
9907
|
+
static filterToolSpecificSection(rawSection, excludeFields) {
|
|
9908
|
+
const filtered = {};
|
|
9909
|
+
for (const [key, value] of Object.entries(rawSection)) {
|
|
9910
|
+
if (!excludeFields.includes(key)) {
|
|
9911
|
+
filtered[key] = value;
|
|
9912
|
+
}
|
|
9913
|
+
}
|
|
9914
|
+
return filtered;
|
|
9915
|
+
}
|
|
9587
9916
|
};
|
|
9588
9917
|
|
|
9589
9918
|
// src/features/subagents/simulated-subagent.ts
|
|
9590
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
9591
|
-
name:
|
|
9592
|
-
description:
|
|
9919
|
+
var SimulatedSubagentFrontmatterSchema = import_mini36.z.object({
|
|
9920
|
+
name: import_mini36.z.string(),
|
|
9921
|
+
description: import_mini36.z.string()
|
|
9593
9922
|
});
|
|
9594
9923
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
9595
9924
|
frontmatter;
|
|
@@ -9599,7 +9928,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9599
9928
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9600
9929
|
if (!result.success) {
|
|
9601
9930
|
throw new Error(
|
|
9602
|
-
`Invalid frontmatter in ${(0,
|
|
9931
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9603
9932
|
);
|
|
9604
9933
|
}
|
|
9605
9934
|
}
|
|
@@ -9650,7 +9979,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9650
9979
|
return {
|
|
9651
9980
|
success: false,
|
|
9652
9981
|
error: new Error(
|
|
9653
|
-
`Invalid frontmatter in ${(0,
|
|
9982
|
+
`Invalid frontmatter in ${(0, import_node_path74.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9654
9983
|
)
|
|
9655
9984
|
};
|
|
9656
9985
|
}
|
|
@@ -9660,7 +9989,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9660
9989
|
relativeFilePath,
|
|
9661
9990
|
validate = true
|
|
9662
9991
|
}) {
|
|
9663
|
-
const filePath = (0,
|
|
9992
|
+
const filePath = (0, import_node_path74.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
9664
9993
|
const fileContent = await readFileContent(filePath);
|
|
9665
9994
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9666
9995
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -9670,7 +9999,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9670
9999
|
return {
|
|
9671
10000
|
baseDir,
|
|
9672
10001
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
9673
|
-
relativeFilePath: (0,
|
|
10002
|
+
relativeFilePath: (0, import_node_path74.basename)(relativeFilePath),
|
|
9674
10003
|
frontmatter: result.data,
|
|
9675
10004
|
body: content.trim(),
|
|
9676
10005
|
validate
|
|
@@ -9696,7 +10025,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
9696
10025
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
9697
10026
|
static getSettablePaths() {
|
|
9698
10027
|
return {
|
|
9699
|
-
relativeDirPath: (0,
|
|
10028
|
+
relativeDirPath: (0, import_node_path75.join)(".agents", "subagents")
|
|
9700
10029
|
};
|
|
9701
10030
|
}
|
|
9702
10031
|
static async fromFile(params) {
|
|
@@ -9719,11 +10048,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
9719
10048
|
};
|
|
9720
10049
|
|
|
9721
10050
|
// src/features/subagents/factorydroid-subagent.ts
|
|
9722
|
-
var
|
|
10051
|
+
var import_node_path76 = require("path");
|
|
9723
10052
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
9724
10053
|
static getSettablePaths(_options) {
|
|
9725
10054
|
return {
|
|
9726
|
-
relativeDirPath: (0,
|
|
10055
|
+
relativeDirPath: (0, import_node_path76.join)(".factory", "droids")
|
|
9727
10056
|
};
|
|
9728
10057
|
}
|
|
9729
10058
|
static async fromFile(params) {
|
|
@@ -9746,11 +10075,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
9746
10075
|
};
|
|
9747
10076
|
|
|
9748
10077
|
// src/features/subagents/geminicli-subagent.ts
|
|
9749
|
-
var
|
|
10078
|
+
var import_node_path77 = require("path");
|
|
9750
10079
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
9751
10080
|
static getSettablePaths() {
|
|
9752
10081
|
return {
|
|
9753
|
-
relativeDirPath: (0,
|
|
10082
|
+
relativeDirPath: (0, import_node_path77.join)(".gemini", "subagents")
|
|
9754
10083
|
};
|
|
9755
10084
|
}
|
|
9756
10085
|
static async fromFile(params) {
|
|
@@ -9773,11 +10102,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
9773
10102
|
};
|
|
9774
10103
|
|
|
9775
10104
|
// src/features/subagents/roo-subagent.ts
|
|
9776
|
-
var
|
|
10105
|
+
var import_node_path78 = require("path");
|
|
9777
10106
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
9778
10107
|
static getSettablePaths() {
|
|
9779
10108
|
return {
|
|
9780
|
-
relativeDirPath: (0,
|
|
10109
|
+
relativeDirPath: (0, import_node_path78.join)(".roo", "subagents")
|
|
9781
10110
|
};
|
|
9782
10111
|
}
|
|
9783
10112
|
static async fromFile(params) {
|
|
@@ -9800,20 +10129,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
9800
10129
|
};
|
|
9801
10130
|
|
|
9802
10131
|
// src/features/subagents/subagents-processor.ts
|
|
9803
|
-
var
|
|
9804
|
-
var
|
|
10132
|
+
var import_node_path86 = require("path");
|
|
10133
|
+
var import_mini44 = require("zod/mini");
|
|
9805
10134
|
|
|
9806
10135
|
// src/features/subagents/claudecode-subagent.ts
|
|
9807
|
-
var
|
|
9808
|
-
var
|
|
10136
|
+
var import_node_path80 = require("path");
|
|
10137
|
+
var import_mini38 = require("zod/mini");
|
|
9809
10138
|
|
|
9810
10139
|
// src/features/subagents/rulesync-subagent.ts
|
|
9811
|
-
var
|
|
9812
|
-
var
|
|
9813
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
9814
|
-
targets:
|
|
9815
|
-
name:
|
|
9816
|
-
description:
|
|
10140
|
+
var import_node_path79 = require("path");
|
|
10141
|
+
var import_mini37 = require("zod/mini");
|
|
10142
|
+
var RulesyncSubagentFrontmatterSchema = import_mini37.z.looseObject({
|
|
10143
|
+
targets: import_mini37.z._default(RulesyncTargetsSchema, ["*"]),
|
|
10144
|
+
name: import_mini37.z.string(),
|
|
10145
|
+
description: import_mini37.z.string()
|
|
9817
10146
|
});
|
|
9818
10147
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
9819
10148
|
frontmatter;
|
|
@@ -9822,7 +10151,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
9822
10151
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9823
10152
|
if (!parseResult.success && rest.validate !== false) {
|
|
9824
10153
|
throw new Error(
|
|
9825
|
-
`Invalid frontmatter in ${(0,
|
|
10154
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
9826
10155
|
);
|
|
9827
10156
|
}
|
|
9828
10157
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -9855,7 +10184,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
9855
10184
|
return {
|
|
9856
10185
|
success: false,
|
|
9857
10186
|
error: new Error(
|
|
9858
|
-
`Invalid frontmatter in ${(0,
|
|
10187
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9859
10188
|
)
|
|
9860
10189
|
};
|
|
9861
10190
|
}
|
|
@@ -9864,14 +10193,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
9864
10193
|
relativeFilePath
|
|
9865
10194
|
}) {
|
|
9866
10195
|
const fileContent = await readFileContent(
|
|
9867
|
-
(0,
|
|
10196
|
+
(0, import_node_path79.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
9868
10197
|
);
|
|
9869
10198
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9870
10199
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9871
10200
|
if (!result.success) {
|
|
9872
10201
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
9873
10202
|
}
|
|
9874
|
-
const filename = (0,
|
|
10203
|
+
const filename = (0, import_node_path79.basename)(relativeFilePath);
|
|
9875
10204
|
return new _RulesyncSubagent({
|
|
9876
10205
|
baseDir: process.cwd(),
|
|
9877
10206
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -9883,13 +10212,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
9883
10212
|
};
|
|
9884
10213
|
|
|
9885
10214
|
// src/features/subagents/claudecode-subagent.ts
|
|
9886
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
9887
|
-
name:
|
|
9888
|
-
description:
|
|
9889
|
-
model:
|
|
9890
|
-
tools:
|
|
9891
|
-
permissionMode:
|
|
9892
|
-
skills:
|
|
10215
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini38.z.looseObject({
|
|
10216
|
+
name: import_mini38.z.string(),
|
|
10217
|
+
description: import_mini38.z.string(),
|
|
10218
|
+
model: import_mini38.z.optional(import_mini38.z.string()),
|
|
10219
|
+
tools: import_mini38.z.optional(import_mini38.z.union([import_mini38.z.string(), import_mini38.z.array(import_mini38.z.string())])),
|
|
10220
|
+
permissionMode: import_mini38.z.optional(import_mini38.z.string()),
|
|
10221
|
+
skills: import_mini38.z.optional(import_mini38.z.union([import_mini38.z.string(), import_mini38.z.array(import_mini38.z.string())]))
|
|
9893
10222
|
});
|
|
9894
10223
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
9895
10224
|
frontmatter;
|
|
@@ -9899,7 +10228,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9899
10228
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9900
10229
|
if (!result.success) {
|
|
9901
10230
|
throw new Error(
|
|
9902
|
-
`Invalid frontmatter in ${(0,
|
|
10231
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9903
10232
|
);
|
|
9904
10233
|
}
|
|
9905
10234
|
}
|
|
@@ -9911,7 +10240,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9911
10240
|
}
|
|
9912
10241
|
static getSettablePaths(_options = {}) {
|
|
9913
10242
|
return {
|
|
9914
|
-
relativeDirPath: (0,
|
|
10243
|
+
relativeDirPath: (0, import_node_path80.join)(".claude", "agents")
|
|
9915
10244
|
};
|
|
9916
10245
|
}
|
|
9917
10246
|
getFrontmatter() {
|
|
@@ -9987,7 +10316,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9987
10316
|
return {
|
|
9988
10317
|
success: false,
|
|
9989
10318
|
error: new Error(
|
|
9990
|
-
`Invalid frontmatter in ${(0,
|
|
10319
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9991
10320
|
)
|
|
9992
10321
|
};
|
|
9993
10322
|
}
|
|
@@ -10005,7 +10334,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10005
10334
|
global = false
|
|
10006
10335
|
}) {
|
|
10007
10336
|
const paths = this.getSettablePaths({ global });
|
|
10008
|
-
const filePath = (0,
|
|
10337
|
+
const filePath = (0, import_node_path80.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10009
10338
|
const fileContent = await readFileContent(filePath);
|
|
10010
10339
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10011
10340
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10040,20 +10369,31 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
10040
10369
|
};
|
|
10041
10370
|
|
|
10042
10371
|
// src/features/subagents/codexcli-subagent.ts
|
|
10043
|
-
var
|
|
10372
|
+
var import_node_path81 = require("path");
|
|
10044
10373
|
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
10045
|
-
var
|
|
10046
|
-
var CodexCliSubagentTomlSchema =
|
|
10047
|
-
name:
|
|
10048
|
-
description:
|
|
10049
|
-
developer_instructions:
|
|
10050
|
-
model:
|
|
10051
|
-
model_reasoning_effort:
|
|
10052
|
-
sandbox_mode:
|
|
10374
|
+
var import_mini39 = require("zod/mini");
|
|
10375
|
+
var CodexCliSubagentTomlSchema = import_mini39.z.looseObject({
|
|
10376
|
+
name: import_mini39.z.string(),
|
|
10377
|
+
description: import_mini39.z.optional(import_mini39.z.string()),
|
|
10378
|
+
developer_instructions: import_mini39.z.optional(import_mini39.z.string()),
|
|
10379
|
+
model: import_mini39.z.optional(import_mini39.z.string()),
|
|
10380
|
+
model_reasoning_effort: import_mini39.z.optional(import_mini39.z.string()),
|
|
10381
|
+
sandbox_mode: import_mini39.z.optional(import_mini39.z.string())
|
|
10053
10382
|
});
|
|
10054
10383
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
10055
10384
|
body;
|
|
10056
10385
|
constructor({ body, ...rest }) {
|
|
10386
|
+
if (rest.validate !== false) {
|
|
10387
|
+
try {
|
|
10388
|
+
const parsed = smolToml2.parse(body);
|
|
10389
|
+
CodexCliSubagentTomlSchema.parse(parsed);
|
|
10390
|
+
} catch (error) {
|
|
10391
|
+
throw new Error(
|
|
10392
|
+
`Invalid TOML in ${(0, import_node_path81.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10393
|
+
{ cause: error }
|
|
10394
|
+
);
|
|
10395
|
+
}
|
|
10396
|
+
}
|
|
10057
10397
|
super({
|
|
10058
10398
|
...rest
|
|
10059
10399
|
});
|
|
@@ -10061,7 +10401,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10061
10401
|
}
|
|
10062
10402
|
static getSettablePaths(_options = {}) {
|
|
10063
10403
|
return {
|
|
10064
|
-
relativeDirPath: (0,
|
|
10404
|
+
relativeDirPath: (0, import_node_path81.join)(".codex", "agents")
|
|
10065
10405
|
};
|
|
10066
10406
|
}
|
|
10067
10407
|
getBody() {
|
|
@@ -10073,7 +10413,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10073
10413
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
10074
10414
|
} catch (error) {
|
|
10075
10415
|
throw new Error(
|
|
10076
|
-
`Failed to parse TOML in ${(0,
|
|
10416
|
+
`Failed to parse TOML in ${(0, import_node_path81.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10077
10417
|
{ cause: error }
|
|
10078
10418
|
);
|
|
10079
10419
|
}
|
|
@@ -10105,12 +10445,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10105
10445
|
}) {
|
|
10106
10446
|
const frontmatter = rulesyncSubagent.getFrontmatter();
|
|
10107
10447
|
const rawSection = frontmatter.codexcli ?? {};
|
|
10108
|
-
const
|
|
10109
|
-
name
|
|
10110
|
-
description
|
|
10111
|
-
developer_instructions
|
|
10112
|
-
|
|
10113
|
-
} = rawSection;
|
|
10448
|
+
const codexcliSection = this.filterToolSpecificSection(rawSection, [
|
|
10449
|
+
"name",
|
|
10450
|
+
"description",
|
|
10451
|
+
"developer_instructions"
|
|
10452
|
+
]);
|
|
10114
10453
|
const tomlObj = {
|
|
10115
10454
|
name: frontmatter.name,
|
|
10116
10455
|
...frontmatter.description ? { description: frontmatter.description } : {},
|
|
@@ -10155,9 +10494,9 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10155
10494
|
global = false
|
|
10156
10495
|
}) {
|
|
10157
10496
|
const paths = this.getSettablePaths({ global });
|
|
10158
|
-
const filePath = (0,
|
|
10497
|
+
const filePath = (0, import_node_path81.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10159
10498
|
const fileContent = await readFileContent(filePath);
|
|
10160
|
-
|
|
10499
|
+
const subagent = new _CodexCliSubagent({
|
|
10161
10500
|
baseDir,
|
|
10162
10501
|
relativeDirPath: paths.relativeDirPath,
|
|
10163
10502
|
relativeFilePath,
|
|
@@ -10166,6 +10505,15 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10166
10505
|
validate,
|
|
10167
10506
|
global
|
|
10168
10507
|
});
|
|
10508
|
+
if (validate) {
|
|
10509
|
+
const result = subagent.validate();
|
|
10510
|
+
if (!result.success) {
|
|
10511
|
+
throw new Error(
|
|
10512
|
+
`Invalid TOML in ${filePath}: ${result.error instanceof Error ? result.error.message : String(result.error)}`
|
|
10513
|
+
);
|
|
10514
|
+
}
|
|
10515
|
+
}
|
|
10516
|
+
return subagent;
|
|
10169
10517
|
}
|
|
10170
10518
|
static forDeletion({
|
|
10171
10519
|
baseDir = process.cwd(),
|
|
@@ -10184,13 +10532,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
10184
10532
|
};
|
|
10185
10533
|
|
|
10186
10534
|
// src/features/subagents/copilot-subagent.ts
|
|
10187
|
-
var
|
|
10188
|
-
var
|
|
10535
|
+
var import_node_path82 = require("path");
|
|
10536
|
+
var import_mini40 = require("zod/mini");
|
|
10189
10537
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
10190
|
-
var CopilotSubagentFrontmatterSchema =
|
|
10191
|
-
name:
|
|
10192
|
-
description:
|
|
10193
|
-
tools:
|
|
10538
|
+
var CopilotSubagentFrontmatterSchema = import_mini40.z.looseObject({
|
|
10539
|
+
name: import_mini40.z.string(),
|
|
10540
|
+
description: import_mini40.z.string(),
|
|
10541
|
+
tools: import_mini40.z.optional(import_mini40.z.union([import_mini40.z.string(), import_mini40.z.array(import_mini40.z.string())]))
|
|
10194
10542
|
});
|
|
10195
10543
|
var normalizeTools = (tools) => {
|
|
10196
10544
|
if (!tools) {
|
|
@@ -10210,7 +10558,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10210
10558
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10211
10559
|
if (!result.success) {
|
|
10212
10560
|
throw new Error(
|
|
10213
|
-
`Invalid frontmatter in ${(0,
|
|
10561
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10214
10562
|
);
|
|
10215
10563
|
}
|
|
10216
10564
|
}
|
|
@@ -10222,7 +10570,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10222
10570
|
}
|
|
10223
10571
|
static getSettablePaths(_options = {}) {
|
|
10224
10572
|
return {
|
|
10225
|
-
relativeDirPath: (0,
|
|
10573
|
+
relativeDirPath: (0, import_node_path82.join)(".github", "agents")
|
|
10226
10574
|
};
|
|
10227
10575
|
}
|
|
10228
10576
|
getFrontmatter() {
|
|
@@ -10296,7 +10644,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10296
10644
|
return {
|
|
10297
10645
|
success: false,
|
|
10298
10646
|
error: new Error(
|
|
10299
|
-
`Invalid frontmatter in ${(0,
|
|
10647
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10300
10648
|
)
|
|
10301
10649
|
};
|
|
10302
10650
|
}
|
|
@@ -10314,7 +10662,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10314
10662
|
global = false
|
|
10315
10663
|
}) {
|
|
10316
10664
|
const paths = this.getSettablePaths({ global });
|
|
10317
|
-
const filePath = (0,
|
|
10665
|
+
const filePath = (0, import_node_path82.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10318
10666
|
const fileContent = await readFileContent(filePath);
|
|
10319
10667
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10320
10668
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10350,11 +10698,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10350
10698
|
};
|
|
10351
10699
|
|
|
10352
10700
|
// src/features/subagents/cursor-subagent.ts
|
|
10353
|
-
var
|
|
10354
|
-
var
|
|
10355
|
-
var CursorSubagentFrontmatterSchema =
|
|
10356
|
-
name:
|
|
10357
|
-
description:
|
|
10701
|
+
var import_node_path83 = require("path");
|
|
10702
|
+
var import_mini41 = require("zod/mini");
|
|
10703
|
+
var CursorSubagentFrontmatterSchema = import_mini41.z.looseObject({
|
|
10704
|
+
name: import_mini41.z.string(),
|
|
10705
|
+
description: import_mini41.z.string()
|
|
10358
10706
|
});
|
|
10359
10707
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
10360
10708
|
frontmatter;
|
|
@@ -10364,7 +10712,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10364
10712
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10365
10713
|
if (!result.success) {
|
|
10366
10714
|
throw new Error(
|
|
10367
|
-
`Invalid frontmatter in ${(0,
|
|
10715
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10368
10716
|
);
|
|
10369
10717
|
}
|
|
10370
10718
|
}
|
|
@@ -10376,7 +10724,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10376
10724
|
}
|
|
10377
10725
|
static getSettablePaths(_options = {}) {
|
|
10378
10726
|
return {
|
|
10379
|
-
relativeDirPath: (0,
|
|
10727
|
+
relativeDirPath: (0, import_node_path83.join)(".cursor", "agents")
|
|
10380
10728
|
};
|
|
10381
10729
|
}
|
|
10382
10730
|
getFrontmatter() {
|
|
@@ -10443,7 +10791,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10443
10791
|
return {
|
|
10444
10792
|
success: false,
|
|
10445
10793
|
error: new Error(
|
|
10446
|
-
`Invalid frontmatter in ${(0,
|
|
10794
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10447
10795
|
)
|
|
10448
10796
|
};
|
|
10449
10797
|
}
|
|
@@ -10461,7 +10809,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10461
10809
|
global = false
|
|
10462
10810
|
}) {
|
|
10463
10811
|
const paths = this.getSettablePaths({ global });
|
|
10464
|
-
const filePath = (0,
|
|
10812
|
+
const filePath = (0, import_node_path83.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10465
10813
|
const fileContent = await readFileContent(filePath);
|
|
10466
10814
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10467
10815
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10497,27 +10845,38 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10497
10845
|
};
|
|
10498
10846
|
|
|
10499
10847
|
// src/features/subagents/kiro-subagent.ts
|
|
10500
|
-
var
|
|
10501
|
-
var
|
|
10502
|
-
var KiroCliSubagentJsonSchema =
|
|
10503
|
-
name:
|
|
10504
|
-
description:
|
|
10505
|
-
prompt:
|
|
10506
|
-
tools:
|
|
10507
|
-
toolAliases:
|
|
10508
|
-
toolSettings:
|
|
10509
|
-
toolSchema:
|
|
10510
|
-
hooks:
|
|
10511
|
-
model:
|
|
10512
|
-
mcpServers:
|
|
10513
|
-
useLegacyMcpJson:
|
|
10514
|
-
resources:
|
|
10515
|
-
allowedTools:
|
|
10516
|
-
includeMcpJson:
|
|
10848
|
+
var import_node_path84 = require("path");
|
|
10849
|
+
var import_mini42 = require("zod/mini");
|
|
10850
|
+
var KiroCliSubagentJsonSchema = import_mini42.z.looseObject({
|
|
10851
|
+
name: import_mini42.z.string(),
|
|
10852
|
+
description: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.string())),
|
|
10853
|
+
prompt: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.string())),
|
|
10854
|
+
tools: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.array(import_mini42.z.string()))),
|
|
10855
|
+
toolAliases: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.record(import_mini42.z.string(), import_mini42.z.string()))),
|
|
10856
|
+
toolSettings: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.unknown())),
|
|
10857
|
+
toolSchema: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.unknown())),
|
|
10858
|
+
hooks: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.record(import_mini42.z.string(), import_mini42.z.array(import_mini42.z.unknown())))),
|
|
10859
|
+
model: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.string())),
|
|
10860
|
+
mcpServers: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.record(import_mini42.z.string(), import_mini42.z.unknown()))),
|
|
10861
|
+
useLegacyMcpJson: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.boolean())),
|
|
10862
|
+
resources: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.array(import_mini42.z.string()))),
|
|
10863
|
+
allowedTools: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.array(import_mini42.z.string()))),
|
|
10864
|
+
includeMcpJson: import_mini42.z.optional(import_mini42.z.nullable(import_mini42.z.boolean()))
|
|
10517
10865
|
});
|
|
10518
10866
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
10519
10867
|
body;
|
|
10520
10868
|
constructor({ body, ...rest }) {
|
|
10869
|
+
if (rest.validate !== false) {
|
|
10870
|
+
try {
|
|
10871
|
+
const parsed = JSON.parse(body);
|
|
10872
|
+
KiroCliSubagentJsonSchema.parse(parsed);
|
|
10873
|
+
} catch (error) {
|
|
10874
|
+
throw new Error(
|
|
10875
|
+
`Invalid JSON in ${(0, import_node_path84.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10876
|
+
{ cause: error }
|
|
10877
|
+
);
|
|
10878
|
+
}
|
|
10879
|
+
}
|
|
10521
10880
|
super({
|
|
10522
10881
|
...rest
|
|
10523
10882
|
});
|
|
@@ -10525,14 +10884,22 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10525
10884
|
}
|
|
10526
10885
|
static getSettablePaths(_options = {}) {
|
|
10527
10886
|
return {
|
|
10528
|
-
relativeDirPath: (0,
|
|
10887
|
+
relativeDirPath: (0, import_node_path84.join)(".kiro", "agents")
|
|
10529
10888
|
};
|
|
10530
10889
|
}
|
|
10531
10890
|
getBody() {
|
|
10532
10891
|
return this.body;
|
|
10533
10892
|
}
|
|
10534
10893
|
toRulesyncSubagent() {
|
|
10535
|
-
|
|
10894
|
+
let parsed;
|
|
10895
|
+
try {
|
|
10896
|
+
parsed = JSON.parse(this.body);
|
|
10897
|
+
} catch (error) {
|
|
10898
|
+
throw new Error(
|
|
10899
|
+
`Failed to parse JSON in ${(0, import_node_path84.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10900
|
+
{ cause: error }
|
|
10901
|
+
);
|
|
10902
|
+
}
|
|
10536
10903
|
const { name, description, prompt, ...restFields } = parsed;
|
|
10537
10904
|
const kiroSection = {
|
|
10538
10905
|
...restFields
|
|
@@ -10560,7 +10927,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10560
10927
|
global = false
|
|
10561
10928
|
}) {
|
|
10562
10929
|
const frontmatter = rulesyncSubagent.getFrontmatter();
|
|
10563
|
-
const
|
|
10930
|
+
const rawSection = frontmatter.kiro ?? {};
|
|
10931
|
+
const kiroSection = this.filterToolSpecificSection(rawSection, [
|
|
10932
|
+
"name",
|
|
10933
|
+
"description",
|
|
10934
|
+
"prompt"
|
|
10935
|
+
]);
|
|
10564
10936
|
const json = {
|
|
10565
10937
|
name: frontmatter.name,
|
|
10566
10938
|
description: frontmatter.description || null,
|
|
@@ -10605,9 +10977,9 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10605
10977
|
global = false
|
|
10606
10978
|
}) {
|
|
10607
10979
|
const paths = this.getSettablePaths({ global });
|
|
10608
|
-
const filePath = (0,
|
|
10980
|
+
const filePath = (0, import_node_path84.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10609
10981
|
const fileContent = await readFileContent(filePath);
|
|
10610
|
-
|
|
10982
|
+
const subagent = new _KiroSubagent({
|
|
10611
10983
|
baseDir,
|
|
10612
10984
|
relativeDirPath: paths.relativeDirPath,
|
|
10613
10985
|
relativeFilePath,
|
|
@@ -10616,6 +10988,15 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10616
10988
|
validate,
|
|
10617
10989
|
global
|
|
10618
10990
|
});
|
|
10991
|
+
if (validate) {
|
|
10992
|
+
const result = subagent.validate();
|
|
10993
|
+
if (!result.success) {
|
|
10994
|
+
throw new Error(
|
|
10995
|
+
`Invalid JSON in ${filePath}: ${result.error instanceof Error ? result.error.message : String(result.error)}`
|
|
10996
|
+
);
|
|
10997
|
+
}
|
|
10998
|
+
}
|
|
10999
|
+
return subagent;
|
|
10619
11000
|
}
|
|
10620
11001
|
static forDeletion({
|
|
10621
11002
|
baseDir = process.cwd(),
|
|
@@ -10634,12 +11015,12 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10634
11015
|
};
|
|
10635
11016
|
|
|
10636
11017
|
// src/features/subagents/opencode-subagent.ts
|
|
10637
|
-
var
|
|
10638
|
-
var
|
|
10639
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
10640
|
-
description:
|
|
10641
|
-
mode:
|
|
10642
|
-
name:
|
|
11018
|
+
var import_node_path85 = require("path");
|
|
11019
|
+
var import_mini43 = require("zod/mini");
|
|
11020
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini43.z.looseObject({
|
|
11021
|
+
description: import_mini43.z.string(),
|
|
11022
|
+
mode: import_mini43.z._default(import_mini43.z.string(), "subagent"),
|
|
11023
|
+
name: import_mini43.z.optional(import_mini43.z.string())
|
|
10643
11024
|
});
|
|
10644
11025
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
10645
11026
|
frontmatter;
|
|
@@ -10649,7 +11030,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
10649
11030
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
10650
11031
|
if (!result.success) {
|
|
10651
11032
|
throw new Error(
|
|
10652
|
-
`Invalid frontmatter in ${(0,
|
|
11033
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
10653
11034
|
);
|
|
10654
11035
|
}
|
|
10655
11036
|
}
|
|
@@ -10663,7 +11044,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
10663
11044
|
global = false
|
|
10664
11045
|
} = {}) {
|
|
10665
11046
|
return {
|
|
10666
|
-
relativeDirPath: global ? (0,
|
|
11047
|
+
relativeDirPath: global ? (0, import_node_path85.join)(".config", "opencode", "agent") : (0, import_node_path85.join)(".opencode", "agent")
|
|
10667
11048
|
};
|
|
10668
11049
|
}
|
|
10669
11050
|
getFrontmatter() {
|
|
@@ -10676,7 +11057,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
10676
11057
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
10677
11058
|
const rulesyncFrontmatter = {
|
|
10678
11059
|
targets: ["*"],
|
|
10679
|
-
name: name ?? (0,
|
|
11060
|
+
name: name ?? (0, import_node_path85.basename)(this.getRelativeFilePath(), ".md"),
|
|
10680
11061
|
description,
|
|
10681
11062
|
opencode: { mode, ...opencodeSection }
|
|
10682
11063
|
};
|
|
@@ -10729,7 +11110,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
10729
11110
|
return {
|
|
10730
11111
|
success: false,
|
|
10731
11112
|
error: new Error(
|
|
10732
|
-
`Invalid frontmatter in ${(0,
|
|
11113
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
10733
11114
|
)
|
|
10734
11115
|
};
|
|
10735
11116
|
}
|
|
@@ -10746,7 +11127,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
10746
11127
|
global = false
|
|
10747
11128
|
}) {
|
|
10748
11129
|
const paths = this.getSettablePaths({ global });
|
|
10749
|
-
const filePath = (0,
|
|
11130
|
+
const filePath = (0, import_node_path85.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10750
11131
|
const fileContent = await readFileContent(filePath);
|
|
10751
11132
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
10752
11133
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -10795,7 +11176,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
10795
11176
|
"opencode",
|
|
10796
11177
|
"roo"
|
|
10797
11178
|
];
|
|
10798
|
-
var SubagentsProcessorToolTargetSchema =
|
|
11179
|
+
var SubagentsProcessorToolTargetSchema = import_mini44.z.enum(subagentsProcessorToolTargetTuple);
|
|
10799
11180
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
10800
11181
|
[
|
|
10801
11182
|
"agentsmd",
|
|
@@ -10957,7 +11338,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
10957
11338
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
10958
11339
|
*/
|
|
10959
11340
|
async loadRulesyncFiles() {
|
|
10960
|
-
const subagentsDir = (0,
|
|
11341
|
+
const subagentsDir = (0, import_node_path86.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
10961
11342
|
const dirExists = await directoryExists(subagentsDir);
|
|
10962
11343
|
if (!dirExists) {
|
|
10963
11344
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -10972,7 +11353,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
10972
11353
|
logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
10973
11354
|
const rulesyncSubagents = [];
|
|
10974
11355
|
for (const mdFile of mdFiles) {
|
|
10975
|
-
const filepath = (0,
|
|
11356
|
+
const filepath = (0, import_node_path86.join)(subagentsDir, mdFile);
|
|
10976
11357
|
try {
|
|
10977
11358
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
10978
11359
|
relativeFilePath: mdFile,
|
|
@@ -11002,14 +11383,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11002
11383
|
const factory = this.getFactory(this.toolTarget);
|
|
11003
11384
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
11004
11385
|
const subagentFilePaths = await findFilesByGlobs(
|
|
11005
|
-
(0,
|
|
11386
|
+
(0, import_node_path86.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
11006
11387
|
);
|
|
11007
11388
|
if (forDeletion) {
|
|
11008
11389
|
const toolSubagents2 = subagentFilePaths.map(
|
|
11009
11390
|
(path4) => factory.class.forDeletion({
|
|
11010
11391
|
baseDir: this.baseDir,
|
|
11011
11392
|
relativeDirPath: paths.relativeDirPath,
|
|
11012
|
-
relativeFilePath: (0,
|
|
11393
|
+
relativeFilePath: (0, import_node_path86.basename)(path4),
|
|
11013
11394
|
global: this.global
|
|
11014
11395
|
})
|
|
11015
11396
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -11022,7 +11403,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11022
11403
|
subagentFilePaths.map(
|
|
11023
11404
|
(path4) => factory.class.fromFile({
|
|
11024
11405
|
baseDir: this.baseDir,
|
|
11025
|
-
relativeFilePath: (0,
|
|
11406
|
+
relativeFilePath: (0, import_node_path86.basename)(path4),
|
|
11026
11407
|
global: this.global
|
|
11027
11408
|
})
|
|
11028
11409
|
)
|
|
@@ -11067,49 +11448,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
11067
11448
|
};
|
|
11068
11449
|
|
|
11069
11450
|
// src/features/rules/agentsmd-rule.ts
|
|
11070
|
-
var
|
|
11451
|
+
var import_node_path89 = require("path");
|
|
11071
11452
|
|
|
11072
11453
|
// src/features/rules/tool-rule.ts
|
|
11073
|
-
var
|
|
11454
|
+
var import_node_path88 = require("path");
|
|
11074
11455
|
|
|
11075
11456
|
// src/features/rules/rulesync-rule.ts
|
|
11076
|
-
var
|
|
11077
|
-
var
|
|
11078
|
-
var RulesyncRuleFrontmatterSchema =
|
|
11079
|
-
root:
|
|
11080
|
-
localRoot:
|
|
11081
|
-
targets:
|
|
11082
|
-
description:
|
|
11083
|
-
globs:
|
|
11084
|
-
agentsmd:
|
|
11085
|
-
|
|
11457
|
+
var import_node_path87 = require("path");
|
|
11458
|
+
var import_mini45 = require("zod/mini");
|
|
11459
|
+
var RulesyncRuleFrontmatterSchema = import_mini45.z.object({
|
|
11460
|
+
root: import_mini45.z.optional(import_mini45.z.boolean()),
|
|
11461
|
+
localRoot: import_mini45.z.optional(import_mini45.z.boolean()),
|
|
11462
|
+
targets: import_mini45.z._default(RulesyncTargetsSchema, ["*"]),
|
|
11463
|
+
description: import_mini45.z.optional(import_mini45.z.string()),
|
|
11464
|
+
globs: import_mini45.z.optional(import_mini45.z.array(import_mini45.z.string())),
|
|
11465
|
+
agentsmd: import_mini45.z.optional(
|
|
11466
|
+
import_mini45.z.object({
|
|
11086
11467
|
// @example "path/to/subproject"
|
|
11087
|
-
subprojectPath:
|
|
11468
|
+
subprojectPath: import_mini45.z.optional(import_mini45.z.string())
|
|
11088
11469
|
})
|
|
11089
11470
|
),
|
|
11090
|
-
claudecode:
|
|
11091
|
-
|
|
11471
|
+
claudecode: import_mini45.z.optional(
|
|
11472
|
+
import_mini45.z.object({
|
|
11092
11473
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
11093
11474
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
11094
|
-
paths:
|
|
11475
|
+
paths: import_mini45.z.optional(import_mini45.z.array(import_mini45.z.string()))
|
|
11095
11476
|
})
|
|
11096
11477
|
),
|
|
11097
|
-
cursor:
|
|
11098
|
-
|
|
11099
|
-
alwaysApply:
|
|
11100
|
-
description:
|
|
11101
|
-
globs:
|
|
11478
|
+
cursor: import_mini45.z.optional(
|
|
11479
|
+
import_mini45.z.object({
|
|
11480
|
+
alwaysApply: import_mini45.z.optional(import_mini45.z.boolean()),
|
|
11481
|
+
description: import_mini45.z.optional(import_mini45.z.string()),
|
|
11482
|
+
globs: import_mini45.z.optional(import_mini45.z.array(import_mini45.z.string()))
|
|
11102
11483
|
})
|
|
11103
11484
|
),
|
|
11104
|
-
copilot:
|
|
11105
|
-
|
|
11106
|
-
excludeAgent:
|
|
11485
|
+
copilot: import_mini45.z.optional(
|
|
11486
|
+
import_mini45.z.object({
|
|
11487
|
+
excludeAgent: import_mini45.z.optional(import_mini45.z.union([import_mini45.z.literal("code-review"), import_mini45.z.literal("coding-agent")]))
|
|
11107
11488
|
})
|
|
11108
11489
|
),
|
|
11109
|
-
antigravity:
|
|
11110
|
-
|
|
11111
|
-
trigger:
|
|
11112
|
-
globs:
|
|
11490
|
+
antigravity: import_mini45.z.optional(
|
|
11491
|
+
import_mini45.z.looseObject({
|
|
11492
|
+
trigger: import_mini45.z.optional(import_mini45.z.string()),
|
|
11493
|
+
globs: import_mini45.z.optional(import_mini45.z.array(import_mini45.z.string()))
|
|
11113
11494
|
})
|
|
11114
11495
|
)
|
|
11115
11496
|
});
|
|
@@ -11120,7 +11501,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11120
11501
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11121
11502
|
if (!parseResult.success && rest.validate !== false) {
|
|
11122
11503
|
throw new Error(
|
|
11123
|
-
`Invalid frontmatter in ${(0,
|
|
11504
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
11124
11505
|
);
|
|
11125
11506
|
}
|
|
11126
11507
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -11155,7 +11536,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11155
11536
|
return {
|
|
11156
11537
|
success: false,
|
|
11157
11538
|
error: new Error(
|
|
11158
|
-
`Invalid frontmatter in ${(0,
|
|
11539
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
11159
11540
|
)
|
|
11160
11541
|
};
|
|
11161
11542
|
}
|
|
@@ -11164,7 +11545,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
11164
11545
|
relativeFilePath,
|
|
11165
11546
|
validate = true
|
|
11166
11547
|
}) {
|
|
11167
|
-
const filePath = (0,
|
|
11548
|
+
const filePath = (0, import_node_path87.join)(
|
|
11168
11549
|
process.cwd(),
|
|
11169
11550
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
11170
11551
|
relativeFilePath
|
|
@@ -11266,7 +11647,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11266
11647
|
rulesyncRule,
|
|
11267
11648
|
validate = true,
|
|
11268
11649
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
11269
|
-
nonRootPath = { relativeDirPath: (0,
|
|
11650
|
+
nonRootPath = { relativeDirPath: (0, import_node_path88.join)(".agents", "memories") }
|
|
11270
11651
|
}) {
|
|
11271
11652
|
const params = this.buildToolRuleParamsDefault({
|
|
11272
11653
|
baseDir,
|
|
@@ -11277,7 +11658,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11277
11658
|
});
|
|
11278
11659
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
11279
11660
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
11280
|
-
params.relativeDirPath = (0,
|
|
11661
|
+
params.relativeDirPath = (0, import_node_path88.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
11281
11662
|
params.relativeFilePath = "AGENTS.md";
|
|
11282
11663
|
}
|
|
11283
11664
|
return params;
|
|
@@ -11326,7 +11707,7 @@ var ToolRule = class extends ToolFile {
|
|
|
11326
11707
|
}
|
|
11327
11708
|
};
|
|
11328
11709
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
11329
|
-
return excludeToolDir ? subDir : (0,
|
|
11710
|
+
return excludeToolDir ? subDir : (0, import_node_path88.join)(toolDir, subDir);
|
|
11330
11711
|
}
|
|
11331
11712
|
|
|
11332
11713
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -11355,8 +11736,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
11355
11736
|
validate = true
|
|
11356
11737
|
}) {
|
|
11357
11738
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
11358
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
11359
|
-
const fileContent = await readFileContent((0,
|
|
11739
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path89.join)(".agents", "memories", relativeFilePath);
|
|
11740
|
+
const fileContent = await readFileContent((0, import_node_path89.join)(baseDir, relativePath));
|
|
11360
11741
|
return new _AgentsMdRule({
|
|
11361
11742
|
baseDir,
|
|
11362
11743
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -11411,21 +11792,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
11411
11792
|
};
|
|
11412
11793
|
|
|
11413
11794
|
// src/features/rules/antigravity-rule.ts
|
|
11414
|
-
var
|
|
11415
|
-
var
|
|
11416
|
-
var AntigravityRuleFrontmatterSchema =
|
|
11417
|
-
trigger:
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11795
|
+
var import_node_path90 = require("path");
|
|
11796
|
+
var import_mini46 = require("zod/mini");
|
|
11797
|
+
var AntigravityRuleFrontmatterSchema = import_mini46.z.looseObject({
|
|
11798
|
+
trigger: import_mini46.z.optional(
|
|
11799
|
+
import_mini46.z.union([
|
|
11800
|
+
import_mini46.z.literal("always_on"),
|
|
11801
|
+
import_mini46.z.literal("glob"),
|
|
11802
|
+
import_mini46.z.literal("manual"),
|
|
11803
|
+
import_mini46.z.literal("model_decision"),
|
|
11804
|
+
import_mini46.z.string()
|
|
11424
11805
|
// accepts any string for forward compatibility
|
|
11425
11806
|
])
|
|
11426
11807
|
),
|
|
11427
|
-
globs:
|
|
11428
|
-
description:
|
|
11808
|
+
globs: import_mini46.z.optional(import_mini46.z.string()),
|
|
11809
|
+
description: import_mini46.z.optional(import_mini46.z.string())
|
|
11429
11810
|
});
|
|
11430
11811
|
function parseGlobsString(globs) {
|
|
11431
11812
|
if (!globs) {
|
|
@@ -11570,7 +11951,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
11570
11951
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
11571
11952
|
if (!result.success) {
|
|
11572
11953
|
throw new Error(
|
|
11573
|
-
`Invalid frontmatter in ${(0,
|
|
11954
|
+
`Invalid frontmatter in ${(0, import_node_path90.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
11574
11955
|
);
|
|
11575
11956
|
}
|
|
11576
11957
|
}
|
|
@@ -11594,7 +11975,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
11594
11975
|
relativeFilePath,
|
|
11595
11976
|
validate = true
|
|
11596
11977
|
}) {
|
|
11597
|
-
const filePath = (0,
|
|
11978
|
+
const filePath = (0, import_node_path90.join)(
|
|
11598
11979
|
baseDir,
|
|
11599
11980
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
11600
11981
|
relativeFilePath
|
|
@@ -11735,7 +12116,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
11735
12116
|
};
|
|
11736
12117
|
|
|
11737
12118
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
11738
|
-
var
|
|
12119
|
+
var import_node_path91 = require("path");
|
|
11739
12120
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
11740
12121
|
toRulesyncRule() {
|
|
11741
12122
|
const rulesyncFrontmatter = {
|
|
@@ -11796,8 +12177,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
11796
12177
|
}) {
|
|
11797
12178
|
const settablePaths = this.getSettablePaths();
|
|
11798
12179
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
11799
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
11800
|
-
const fileContent = await readFileContent((0,
|
|
12180
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path91.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12181
|
+
const fileContent = await readFileContent((0, import_node_path91.join)(baseDir, relativePath));
|
|
11801
12182
|
return new _AugmentcodeLegacyRule({
|
|
11802
12183
|
baseDir,
|
|
11803
12184
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -11826,7 +12207,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
11826
12207
|
};
|
|
11827
12208
|
|
|
11828
12209
|
// src/features/rules/augmentcode-rule.ts
|
|
11829
|
-
var
|
|
12210
|
+
var import_node_path92 = require("path");
|
|
11830
12211
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
11831
12212
|
toRulesyncRule() {
|
|
11832
12213
|
return this.toRulesyncRuleDefault();
|
|
@@ -11858,7 +12239,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
11858
12239
|
validate = true
|
|
11859
12240
|
}) {
|
|
11860
12241
|
const fileContent = await readFileContent(
|
|
11861
|
-
(0,
|
|
12242
|
+
(0, import_node_path92.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
11862
12243
|
);
|
|
11863
12244
|
const { body: content } = parseFrontmatter(fileContent);
|
|
11864
12245
|
return new _AugmentcodeRule({
|
|
@@ -11894,7 +12275,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
11894
12275
|
};
|
|
11895
12276
|
|
|
11896
12277
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
11897
|
-
var
|
|
12278
|
+
var import_node_path93 = require("path");
|
|
11898
12279
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
11899
12280
|
static getSettablePaths({
|
|
11900
12281
|
global,
|
|
@@ -11929,7 +12310,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
11929
12310
|
if (isRoot) {
|
|
11930
12311
|
const relativePath2 = paths.root.relativeFilePath;
|
|
11931
12312
|
const fileContent2 = await readFileContent(
|
|
11932
|
-
(0,
|
|
12313
|
+
(0, import_node_path93.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
11933
12314
|
);
|
|
11934
12315
|
return new _ClaudecodeLegacyRule({
|
|
11935
12316
|
baseDir,
|
|
@@ -11943,8 +12324,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
11943
12324
|
if (!paths.nonRoot) {
|
|
11944
12325
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
11945
12326
|
}
|
|
11946
|
-
const relativePath = (0,
|
|
11947
|
-
const fileContent = await readFileContent((0,
|
|
12327
|
+
const relativePath = (0, import_node_path93.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12328
|
+
const fileContent = await readFileContent((0, import_node_path93.join)(baseDir, relativePath));
|
|
11948
12329
|
return new _ClaudecodeLegacyRule({
|
|
11949
12330
|
baseDir,
|
|
11950
12331
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -12003,10 +12384,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
12003
12384
|
};
|
|
12004
12385
|
|
|
12005
12386
|
// src/features/rules/claudecode-rule.ts
|
|
12006
|
-
var
|
|
12007
|
-
var
|
|
12008
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
12009
|
-
paths:
|
|
12387
|
+
var import_node_path94 = require("path");
|
|
12388
|
+
var import_mini47 = require("zod/mini");
|
|
12389
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini47.z.object({
|
|
12390
|
+
paths: import_mini47.z.optional(import_mini47.z.array(import_mini47.z.string()))
|
|
12010
12391
|
});
|
|
12011
12392
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
12012
12393
|
frontmatter;
|
|
@@ -12038,7 +12419,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12038
12419
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12039
12420
|
if (!result.success) {
|
|
12040
12421
|
throw new Error(
|
|
12041
|
-
`Invalid frontmatter in ${(0,
|
|
12422
|
+
`Invalid frontmatter in ${(0, import_node_path94.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12042
12423
|
);
|
|
12043
12424
|
}
|
|
12044
12425
|
}
|
|
@@ -12066,7 +12447,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12066
12447
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
12067
12448
|
if (isRoot) {
|
|
12068
12449
|
const fileContent2 = await readFileContent(
|
|
12069
|
-
(0,
|
|
12450
|
+
(0, import_node_path94.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
12070
12451
|
);
|
|
12071
12452
|
return new _ClaudecodeRule({
|
|
12072
12453
|
baseDir,
|
|
@@ -12081,13 +12462,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12081
12462
|
if (!paths.nonRoot) {
|
|
12082
12463
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12083
12464
|
}
|
|
12084
|
-
const relativePath = (0,
|
|
12085
|
-
const fileContent = await readFileContent((0,
|
|
12465
|
+
const relativePath = (0, import_node_path94.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12466
|
+
const fileContent = await readFileContent((0, import_node_path94.join)(baseDir, relativePath));
|
|
12086
12467
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
12087
12468
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12088
12469
|
if (!result.success) {
|
|
12089
12470
|
throw new Error(
|
|
12090
|
-
`Invalid frontmatter in ${(0,
|
|
12471
|
+
`Invalid frontmatter in ${(0, import_node_path94.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
12091
12472
|
);
|
|
12092
12473
|
}
|
|
12093
12474
|
return new _ClaudecodeRule({
|
|
@@ -12194,7 +12575,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12194
12575
|
return {
|
|
12195
12576
|
success: false,
|
|
12196
12577
|
error: new Error(
|
|
12197
|
-
`Invalid frontmatter in ${(0,
|
|
12578
|
+
`Invalid frontmatter in ${(0, import_node_path94.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12198
12579
|
)
|
|
12199
12580
|
};
|
|
12200
12581
|
}
|
|
@@ -12214,10 +12595,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
12214
12595
|
};
|
|
12215
12596
|
|
|
12216
12597
|
// src/features/rules/cline-rule.ts
|
|
12217
|
-
var
|
|
12218
|
-
var
|
|
12219
|
-
var ClineRuleFrontmatterSchema =
|
|
12220
|
-
description:
|
|
12598
|
+
var import_node_path95 = require("path");
|
|
12599
|
+
var import_mini48 = require("zod/mini");
|
|
12600
|
+
var ClineRuleFrontmatterSchema = import_mini48.z.object({
|
|
12601
|
+
description: import_mini48.z.string()
|
|
12221
12602
|
});
|
|
12222
12603
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
12223
12604
|
static getSettablePaths(_options = {}) {
|
|
@@ -12260,7 +12641,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
12260
12641
|
validate = true
|
|
12261
12642
|
}) {
|
|
12262
12643
|
const fileContent = await readFileContent(
|
|
12263
|
-
(0,
|
|
12644
|
+
(0, import_node_path95.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
12264
12645
|
);
|
|
12265
12646
|
return new _ClineRule({
|
|
12266
12647
|
baseDir,
|
|
@@ -12286,7 +12667,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
12286
12667
|
};
|
|
12287
12668
|
|
|
12288
12669
|
// src/features/rules/codexcli-rule.ts
|
|
12289
|
-
var
|
|
12670
|
+
var import_node_path96 = require("path");
|
|
12290
12671
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
12291
12672
|
static getSettablePaths({
|
|
12292
12673
|
global,
|
|
@@ -12321,7 +12702,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12321
12702
|
if (isRoot) {
|
|
12322
12703
|
const relativePath2 = paths.root.relativeFilePath;
|
|
12323
12704
|
const fileContent2 = await readFileContent(
|
|
12324
|
-
(0,
|
|
12705
|
+
(0, import_node_path96.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
12325
12706
|
);
|
|
12326
12707
|
return new _CodexcliRule({
|
|
12327
12708
|
baseDir,
|
|
@@ -12335,8 +12716,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12335
12716
|
if (!paths.nonRoot) {
|
|
12336
12717
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12337
12718
|
}
|
|
12338
|
-
const relativePath = (0,
|
|
12339
|
-
const fileContent = await readFileContent((0,
|
|
12719
|
+
const relativePath = (0, import_node_path96.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12720
|
+
const fileContent = await readFileContent((0, import_node_path96.join)(baseDir, relativePath));
|
|
12340
12721
|
return new _CodexcliRule({
|
|
12341
12722
|
baseDir,
|
|
12342
12723
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -12395,12 +12776,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12395
12776
|
};
|
|
12396
12777
|
|
|
12397
12778
|
// src/features/rules/copilot-rule.ts
|
|
12398
|
-
var
|
|
12399
|
-
var
|
|
12400
|
-
var CopilotRuleFrontmatterSchema =
|
|
12401
|
-
description:
|
|
12402
|
-
applyTo:
|
|
12403
|
-
excludeAgent:
|
|
12779
|
+
var import_node_path97 = require("path");
|
|
12780
|
+
var import_mini49 = require("zod/mini");
|
|
12781
|
+
var CopilotRuleFrontmatterSchema = import_mini49.z.object({
|
|
12782
|
+
description: import_mini49.z.optional(import_mini49.z.string()),
|
|
12783
|
+
applyTo: import_mini49.z.optional(import_mini49.z.string()),
|
|
12784
|
+
excludeAgent: import_mini49.z.optional(import_mini49.z.union([import_mini49.z.literal("code-review"), import_mini49.z.literal("coding-agent")]))
|
|
12404
12785
|
});
|
|
12405
12786
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
12406
12787
|
frontmatter;
|
|
@@ -12429,7 +12810,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12429
12810
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12430
12811
|
if (!result.success) {
|
|
12431
12812
|
throw new Error(
|
|
12432
|
-
`Invalid frontmatter in ${(0,
|
|
12813
|
+
`Invalid frontmatter in ${(0, import_node_path97.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12433
12814
|
);
|
|
12434
12815
|
}
|
|
12435
12816
|
}
|
|
@@ -12519,8 +12900,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12519
12900
|
const paths = this.getSettablePaths({ global });
|
|
12520
12901
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
12521
12902
|
if (isRoot) {
|
|
12522
|
-
const relativePath2 = (0,
|
|
12523
|
-
const fileContent2 = await readFileContent((0,
|
|
12903
|
+
const relativePath2 = (0, import_node_path97.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
12904
|
+
const fileContent2 = await readFileContent((0, import_node_path97.join)(baseDir, relativePath2));
|
|
12524
12905
|
return new _CopilotRule({
|
|
12525
12906
|
baseDir,
|
|
12526
12907
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -12534,13 +12915,13 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12534
12915
|
if (!paths.nonRoot) {
|
|
12535
12916
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12536
12917
|
}
|
|
12537
|
-
const relativePath = (0,
|
|
12538
|
-
const fileContent = await readFileContent((0,
|
|
12918
|
+
const relativePath = (0, import_node_path97.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
12919
|
+
const fileContent = await readFileContent((0, import_node_path97.join)(baseDir, relativePath));
|
|
12539
12920
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
12540
12921
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12541
12922
|
if (!result.success) {
|
|
12542
12923
|
throw new Error(
|
|
12543
|
-
`Invalid frontmatter in ${(0,
|
|
12924
|
+
`Invalid frontmatter in ${(0, import_node_path97.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
12544
12925
|
);
|
|
12545
12926
|
}
|
|
12546
12927
|
return new _CopilotRule({
|
|
@@ -12582,7 +12963,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12582
12963
|
return {
|
|
12583
12964
|
success: false,
|
|
12584
12965
|
error: new Error(
|
|
12585
|
-
`Invalid frontmatter in ${(0,
|
|
12966
|
+
`Invalid frontmatter in ${(0, import_node_path97.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12586
12967
|
)
|
|
12587
12968
|
};
|
|
12588
12969
|
}
|
|
@@ -12602,12 +12983,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12602
12983
|
};
|
|
12603
12984
|
|
|
12604
12985
|
// src/features/rules/cursor-rule.ts
|
|
12605
|
-
var
|
|
12606
|
-
var
|
|
12607
|
-
var CursorRuleFrontmatterSchema =
|
|
12608
|
-
description:
|
|
12609
|
-
globs:
|
|
12610
|
-
alwaysApply:
|
|
12986
|
+
var import_node_path98 = require("path");
|
|
12987
|
+
var import_mini50 = require("zod/mini");
|
|
12988
|
+
var CursorRuleFrontmatterSchema = import_mini50.z.object({
|
|
12989
|
+
description: import_mini50.z.optional(import_mini50.z.string()),
|
|
12990
|
+
globs: import_mini50.z.optional(import_mini50.z.string()),
|
|
12991
|
+
alwaysApply: import_mini50.z.optional(import_mini50.z.boolean())
|
|
12611
12992
|
});
|
|
12612
12993
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
12613
12994
|
frontmatter;
|
|
@@ -12624,7 +13005,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
12624
13005
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12625
13006
|
if (!result.success) {
|
|
12626
13007
|
throw new Error(
|
|
12627
|
-
`Invalid frontmatter in ${(0,
|
|
13008
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12628
13009
|
);
|
|
12629
13010
|
}
|
|
12630
13011
|
}
|
|
@@ -12741,13 +13122,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
12741
13122
|
validate = true
|
|
12742
13123
|
}) {
|
|
12743
13124
|
const fileContent = await readFileContent(
|
|
12744
|
-
(0,
|
|
13125
|
+
(0, import_node_path98.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
12745
13126
|
);
|
|
12746
13127
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
12747
13128
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
12748
13129
|
if (!result.success) {
|
|
12749
13130
|
throw new Error(
|
|
12750
|
-
`Invalid frontmatter in ${(0,
|
|
13131
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
12751
13132
|
);
|
|
12752
13133
|
}
|
|
12753
13134
|
return new _CursorRule({
|
|
@@ -12784,7 +13165,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
12784
13165
|
return {
|
|
12785
13166
|
success: false,
|
|
12786
13167
|
error: new Error(
|
|
12787
|
-
`Invalid frontmatter in ${(0,
|
|
13168
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12788
13169
|
)
|
|
12789
13170
|
};
|
|
12790
13171
|
}
|
|
@@ -12804,7 +13185,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
12804
13185
|
};
|
|
12805
13186
|
|
|
12806
13187
|
// src/features/rules/factorydroid-rule.ts
|
|
12807
|
-
var
|
|
13188
|
+
var import_node_path99 = require("path");
|
|
12808
13189
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
12809
13190
|
constructor({ fileContent, root, ...rest }) {
|
|
12810
13191
|
super({
|
|
@@ -12844,8 +13225,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
12844
13225
|
const paths = this.getSettablePaths({ global });
|
|
12845
13226
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
12846
13227
|
if (isRoot) {
|
|
12847
|
-
const relativePath2 = (0,
|
|
12848
|
-
const fileContent2 = await readFileContent((0,
|
|
13228
|
+
const relativePath2 = (0, import_node_path99.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
13229
|
+
const fileContent2 = await readFileContent((0, import_node_path99.join)(baseDir, relativePath2));
|
|
12849
13230
|
return new _FactorydroidRule({
|
|
12850
13231
|
baseDir,
|
|
12851
13232
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -12858,8 +13239,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
12858
13239
|
if (!paths.nonRoot) {
|
|
12859
13240
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12860
13241
|
}
|
|
12861
|
-
const relativePath = (0,
|
|
12862
|
-
const fileContent = await readFileContent((0,
|
|
13242
|
+
const relativePath = (0, import_node_path99.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13243
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
12863
13244
|
return new _FactorydroidRule({
|
|
12864
13245
|
baseDir,
|
|
12865
13246
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -12918,7 +13299,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
12918
13299
|
};
|
|
12919
13300
|
|
|
12920
13301
|
// src/features/rules/geminicli-rule.ts
|
|
12921
|
-
var
|
|
13302
|
+
var import_node_path100 = require("path");
|
|
12922
13303
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
12923
13304
|
static getSettablePaths({
|
|
12924
13305
|
global,
|
|
@@ -12953,7 +13334,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
12953
13334
|
if (isRoot) {
|
|
12954
13335
|
const relativePath2 = paths.root.relativeFilePath;
|
|
12955
13336
|
const fileContent2 = await readFileContent(
|
|
12956
|
-
(0,
|
|
13337
|
+
(0, import_node_path100.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
12957
13338
|
);
|
|
12958
13339
|
return new _GeminiCliRule({
|
|
12959
13340
|
baseDir,
|
|
@@ -12967,8 +13348,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
12967
13348
|
if (!paths.nonRoot) {
|
|
12968
13349
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
12969
13350
|
}
|
|
12970
|
-
const relativePath = (0,
|
|
12971
|
-
const fileContent = await readFileContent((0,
|
|
13351
|
+
const relativePath = (0, import_node_path100.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13352
|
+
const fileContent = await readFileContent((0, import_node_path100.join)(baseDir, relativePath));
|
|
12972
13353
|
return new _GeminiCliRule({
|
|
12973
13354
|
baseDir,
|
|
12974
13355
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13027,7 +13408,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
13027
13408
|
};
|
|
13028
13409
|
|
|
13029
13410
|
// src/features/rules/goose-rule.ts
|
|
13030
|
-
var
|
|
13411
|
+
var import_node_path101 = require("path");
|
|
13031
13412
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
13032
13413
|
static getSettablePaths({
|
|
13033
13414
|
global,
|
|
@@ -13062,7 +13443,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13062
13443
|
if (isRoot) {
|
|
13063
13444
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13064
13445
|
const fileContent2 = await readFileContent(
|
|
13065
|
-
(0,
|
|
13446
|
+
(0, import_node_path101.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13066
13447
|
);
|
|
13067
13448
|
return new _GooseRule({
|
|
13068
13449
|
baseDir,
|
|
@@ -13076,8 +13457,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13076
13457
|
if (!paths.nonRoot) {
|
|
13077
13458
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13078
13459
|
}
|
|
13079
|
-
const relativePath = (0,
|
|
13080
|
-
const fileContent = await readFileContent((0,
|
|
13460
|
+
const relativePath = (0, import_node_path101.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13461
|
+
const fileContent = await readFileContent((0, import_node_path101.join)(baseDir, relativePath));
|
|
13081
13462
|
return new _GooseRule({
|
|
13082
13463
|
baseDir,
|
|
13083
13464
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13136,7 +13517,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
13136
13517
|
};
|
|
13137
13518
|
|
|
13138
13519
|
// src/features/rules/junie-rule.ts
|
|
13139
|
-
var
|
|
13520
|
+
var import_node_path102 = require("path");
|
|
13140
13521
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
13141
13522
|
static getSettablePaths(_options = {}) {
|
|
13142
13523
|
return {
|
|
@@ -13155,8 +13536,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13155
13536
|
validate = true
|
|
13156
13537
|
}) {
|
|
13157
13538
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
13158
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
13159
|
-
const fileContent = await readFileContent((0,
|
|
13539
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path102.join)(".junie", "memories", relativeFilePath);
|
|
13540
|
+
const fileContent = await readFileContent((0, import_node_path102.join)(baseDir, relativePath));
|
|
13160
13541
|
return new _JunieRule({
|
|
13161
13542
|
baseDir,
|
|
13162
13543
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13211,7 +13592,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
13211
13592
|
};
|
|
13212
13593
|
|
|
13213
13594
|
// src/features/rules/kilo-rule.ts
|
|
13214
|
-
var
|
|
13595
|
+
var import_node_path103 = require("path");
|
|
13215
13596
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
13216
13597
|
static getSettablePaths(_options = {}) {
|
|
13217
13598
|
return {
|
|
@@ -13226,7 +13607,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13226
13607
|
validate = true
|
|
13227
13608
|
}) {
|
|
13228
13609
|
const fileContent = await readFileContent(
|
|
13229
|
-
(0,
|
|
13610
|
+
(0, import_node_path103.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13230
13611
|
);
|
|
13231
13612
|
return new _KiloRule({
|
|
13232
13613
|
baseDir,
|
|
@@ -13278,7 +13659,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
13278
13659
|
};
|
|
13279
13660
|
|
|
13280
13661
|
// src/features/rules/kiro-rule.ts
|
|
13281
|
-
var
|
|
13662
|
+
var import_node_path104 = require("path");
|
|
13282
13663
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
13283
13664
|
static getSettablePaths(_options = {}) {
|
|
13284
13665
|
return {
|
|
@@ -13293,7 +13674,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13293
13674
|
validate = true
|
|
13294
13675
|
}) {
|
|
13295
13676
|
const fileContent = await readFileContent(
|
|
13296
|
-
(0,
|
|
13677
|
+
(0, import_node_path104.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13297
13678
|
);
|
|
13298
13679
|
return new _KiroRule({
|
|
13299
13680
|
baseDir,
|
|
@@ -13347,7 +13728,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13347
13728
|
};
|
|
13348
13729
|
|
|
13349
13730
|
// src/features/rules/opencode-rule.ts
|
|
13350
|
-
var
|
|
13731
|
+
var import_node_path105 = require("path");
|
|
13351
13732
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
13352
13733
|
static getSettablePaths({
|
|
13353
13734
|
global,
|
|
@@ -13382,7 +13763,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13382
13763
|
if (isRoot) {
|
|
13383
13764
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13384
13765
|
const fileContent2 = await readFileContent(
|
|
13385
|
-
(0,
|
|
13766
|
+
(0, import_node_path105.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13386
13767
|
);
|
|
13387
13768
|
return new _OpenCodeRule({
|
|
13388
13769
|
baseDir,
|
|
@@ -13396,8 +13777,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13396
13777
|
if (!paths.nonRoot) {
|
|
13397
13778
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13398
13779
|
}
|
|
13399
|
-
const relativePath = (0,
|
|
13400
|
-
const fileContent = await readFileContent((0,
|
|
13780
|
+
const relativePath = (0, import_node_path105.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13781
|
+
const fileContent = await readFileContent((0, import_node_path105.join)(baseDir, relativePath));
|
|
13401
13782
|
return new _OpenCodeRule({
|
|
13402
13783
|
baseDir,
|
|
13403
13784
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13456,7 +13837,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13456
13837
|
};
|
|
13457
13838
|
|
|
13458
13839
|
// src/features/rules/qwencode-rule.ts
|
|
13459
|
-
var
|
|
13840
|
+
var import_node_path106 = require("path");
|
|
13460
13841
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
13461
13842
|
static getSettablePaths(_options = {}) {
|
|
13462
13843
|
return {
|
|
@@ -13475,8 +13856,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13475
13856
|
validate = true
|
|
13476
13857
|
}) {
|
|
13477
13858
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
13478
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
13479
|
-
const fileContent = await readFileContent((0,
|
|
13859
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path106.join)(".qwen", "memories", relativeFilePath);
|
|
13860
|
+
const fileContent = await readFileContent((0, import_node_path106.join)(baseDir, relativePath));
|
|
13480
13861
|
return new _QwencodeRule({
|
|
13481
13862
|
baseDir,
|
|
13482
13863
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13528,7 +13909,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13528
13909
|
};
|
|
13529
13910
|
|
|
13530
13911
|
// src/features/rules/replit-rule.ts
|
|
13531
|
-
var
|
|
13912
|
+
var import_node_path107 = require("path");
|
|
13532
13913
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
13533
13914
|
static getSettablePaths(_options = {}) {
|
|
13534
13915
|
return {
|
|
@@ -13550,7 +13931,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
13550
13931
|
}
|
|
13551
13932
|
const relativePath = paths.root.relativeFilePath;
|
|
13552
13933
|
const fileContent = await readFileContent(
|
|
13553
|
-
(0,
|
|
13934
|
+
(0, import_node_path107.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
13554
13935
|
);
|
|
13555
13936
|
return new _ReplitRule({
|
|
13556
13937
|
baseDir,
|
|
@@ -13616,7 +13997,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
13616
13997
|
};
|
|
13617
13998
|
|
|
13618
13999
|
// src/features/rules/roo-rule.ts
|
|
13619
|
-
var
|
|
14000
|
+
var import_node_path108 = require("path");
|
|
13620
14001
|
var RooRule = class _RooRule extends ToolRule {
|
|
13621
14002
|
static getSettablePaths(_options = {}) {
|
|
13622
14003
|
return {
|
|
@@ -13631,7 +14012,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
13631
14012
|
validate = true
|
|
13632
14013
|
}) {
|
|
13633
14014
|
const fileContent = await readFileContent(
|
|
13634
|
-
(0,
|
|
14015
|
+
(0, import_node_path108.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13635
14016
|
);
|
|
13636
14017
|
return new _RooRule({
|
|
13637
14018
|
baseDir,
|
|
@@ -13700,7 +14081,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
13700
14081
|
};
|
|
13701
14082
|
|
|
13702
14083
|
// src/features/rules/warp-rule.ts
|
|
13703
|
-
var
|
|
14084
|
+
var import_node_path109 = require("path");
|
|
13704
14085
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
13705
14086
|
constructor({ fileContent, root, ...rest }) {
|
|
13706
14087
|
super({
|
|
@@ -13726,8 +14107,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
13726
14107
|
validate = true
|
|
13727
14108
|
}) {
|
|
13728
14109
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
13729
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
13730
|
-
const fileContent = await readFileContent((0,
|
|
14110
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path109.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
14111
|
+
const fileContent = await readFileContent((0, import_node_path109.join)(baseDir, relativePath));
|
|
13731
14112
|
return new _WarpRule({
|
|
13732
14113
|
baseDir,
|
|
13733
14114
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -13782,7 +14163,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
13782
14163
|
};
|
|
13783
14164
|
|
|
13784
14165
|
// src/features/rules/windsurf-rule.ts
|
|
13785
|
-
var
|
|
14166
|
+
var import_node_path110 = require("path");
|
|
13786
14167
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
13787
14168
|
static getSettablePaths(_options = {}) {
|
|
13788
14169
|
return {
|
|
@@ -13797,7 +14178,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
13797
14178
|
validate = true
|
|
13798
14179
|
}) {
|
|
13799
14180
|
const fileContent = await readFileContent(
|
|
13800
|
-
(0,
|
|
14181
|
+
(0, import_node_path110.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13801
14182
|
);
|
|
13802
14183
|
return new _WindsurfRule({
|
|
13803
14184
|
baseDir,
|
|
@@ -13873,8 +14254,8 @@ var rulesProcessorToolTargets = [
|
|
|
13873
14254
|
"warp",
|
|
13874
14255
|
"windsurf"
|
|
13875
14256
|
];
|
|
13876
|
-
var RulesProcessorToolTargetSchema =
|
|
13877
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
14257
|
+
var RulesProcessorToolTargetSchema = import_mini51.z.enum(rulesProcessorToolTargets);
|
|
14258
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path111.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
13878
14259
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
13879
14260
|
[
|
|
13880
14261
|
"agentsmd",
|
|
@@ -14249,7 +14630,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14249
14630
|
}).relativeDirPath;
|
|
14250
14631
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
14251
14632
|
const frontmatter = skill.getFrontmatter();
|
|
14252
|
-
const relativePath = (0,
|
|
14633
|
+
const relativePath = (0, import_node_path111.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
14253
14634
|
return {
|
|
14254
14635
|
name: frontmatter.name,
|
|
14255
14636
|
description: frontmatter.description,
|
|
@@ -14362,12 +14743,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14362
14743
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
14363
14744
|
*/
|
|
14364
14745
|
async loadRulesyncFiles() {
|
|
14365
|
-
const rulesyncBaseDir = (0,
|
|
14366
|
-
const files = await findFilesByGlobs((0,
|
|
14746
|
+
const rulesyncBaseDir = (0, import_node_path111.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
14747
|
+
const files = await findFilesByGlobs((0, import_node_path111.join)(rulesyncBaseDir, "**", "*.md"));
|
|
14367
14748
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
14368
14749
|
const rulesyncRules = await Promise.all(
|
|
14369
14750
|
files.map((file) => {
|
|
14370
|
-
const relativeFilePath = (0,
|
|
14751
|
+
const relativeFilePath = (0, import_node_path111.relative)(rulesyncBaseDir, file);
|
|
14371
14752
|
checkPathTraversal({
|
|
14372
14753
|
relativePath: relativeFilePath,
|
|
14373
14754
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -14430,7 +14811,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14430
14811
|
return [];
|
|
14431
14812
|
}
|
|
14432
14813
|
const rootFilePaths = await findFilesByGlobs(
|
|
14433
|
-
(0,
|
|
14814
|
+
(0, import_node_path111.join)(
|
|
14434
14815
|
this.baseDir,
|
|
14435
14816
|
settablePaths.root.relativeDirPath ?? ".",
|
|
14436
14817
|
settablePaths.root.relativeFilePath
|
|
@@ -14441,7 +14822,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14441
14822
|
(filePath) => factory.class.forDeletion({
|
|
14442
14823
|
baseDir: this.baseDir,
|
|
14443
14824
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14444
|
-
relativeFilePath: (0,
|
|
14825
|
+
relativeFilePath: (0, import_node_path111.basename)(filePath),
|
|
14445
14826
|
global: this.global
|
|
14446
14827
|
})
|
|
14447
14828
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14450,7 +14831,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14450
14831
|
rootFilePaths.map(
|
|
14451
14832
|
(filePath) => factory.class.fromFile({
|
|
14452
14833
|
baseDir: this.baseDir,
|
|
14453
|
-
relativeFilePath: (0,
|
|
14834
|
+
relativeFilePath: (0, import_node_path111.basename)(filePath),
|
|
14454
14835
|
global: this.global
|
|
14455
14836
|
})
|
|
14456
14837
|
)
|
|
@@ -14468,13 +14849,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14468
14849
|
return [];
|
|
14469
14850
|
}
|
|
14470
14851
|
const localRootFilePaths = await findFilesByGlobs(
|
|
14471
|
-
(0,
|
|
14852
|
+
(0, import_node_path111.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
14472
14853
|
);
|
|
14473
14854
|
return localRootFilePaths.map(
|
|
14474
14855
|
(filePath) => factory.class.forDeletion({
|
|
14475
14856
|
baseDir: this.baseDir,
|
|
14476
14857
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14477
|
-
relativeFilePath: (0,
|
|
14858
|
+
relativeFilePath: (0, import_node_path111.basename)(filePath),
|
|
14478
14859
|
global: this.global
|
|
14479
14860
|
})
|
|
14480
14861
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14484,13 +14865,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14484
14865
|
if (!settablePaths.nonRoot) {
|
|
14485
14866
|
return [];
|
|
14486
14867
|
}
|
|
14487
|
-
const nonRootBaseDir = (0,
|
|
14868
|
+
const nonRootBaseDir = (0, import_node_path111.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
14488
14869
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
14489
|
-
(0,
|
|
14870
|
+
(0, import_node_path111.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
14490
14871
|
);
|
|
14491
14872
|
if (forDeletion) {
|
|
14492
14873
|
return nonRootFilePaths.map((filePath) => {
|
|
14493
|
-
const relativeFilePath = (0,
|
|
14874
|
+
const relativeFilePath = (0, import_node_path111.relative)(nonRootBaseDir, filePath);
|
|
14494
14875
|
checkPathTraversal({
|
|
14495
14876
|
relativePath: relativeFilePath,
|
|
14496
14877
|
intendedRootDir: nonRootBaseDir
|
|
@@ -14505,7 +14886,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14505
14886
|
}
|
|
14506
14887
|
return await Promise.all(
|
|
14507
14888
|
nonRootFilePaths.map((filePath) => {
|
|
14508
|
-
const relativeFilePath = (0,
|
|
14889
|
+
const relativeFilePath = (0, import_node_path111.relative)(nonRootBaseDir, filePath);
|
|
14509
14890
|
checkPathTraversal({
|
|
14510
14891
|
relativePath: relativeFilePath,
|
|
14511
14892
|
intendedRootDir: nonRootBaseDir
|
|
@@ -14618,14 +14999,14 @@ s/<command> [arguments]
|
|
|
14618
14999
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
14619
15000
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
14620
15001
|
|
|
14621
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
15002
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path111.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
14622
15003
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
14623
15004
|
|
|
14624
15005
|
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.
|
|
14625
15006
|
|
|
14626
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
15007
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path111.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
14627
15008
|
|
|
14628
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
15009
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path111.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
14629
15010
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
14630
15011
|
const result = [
|
|
14631
15012
|
overview,
|
|
@@ -14657,51 +15038,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
14657
15038
|
var import_rest = require("@octokit/rest");
|
|
14658
15039
|
|
|
14659
15040
|
// src/types/fetch.ts
|
|
14660
|
-
var
|
|
15041
|
+
var import_mini53 = require("zod/mini");
|
|
14661
15042
|
|
|
14662
15043
|
// src/types/fetch-targets.ts
|
|
14663
|
-
var
|
|
15044
|
+
var import_mini52 = require("zod/mini");
|
|
14664
15045
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
14665
|
-
var FetchTargetSchema =
|
|
15046
|
+
var FetchTargetSchema = import_mini52.z.enum(ALL_FETCH_TARGETS);
|
|
14666
15047
|
|
|
14667
15048
|
// src/types/fetch.ts
|
|
14668
|
-
var ConflictStrategySchema =
|
|
14669
|
-
var GitHubFileTypeSchema =
|
|
14670
|
-
var GitHubFileEntrySchema =
|
|
14671
|
-
name:
|
|
14672
|
-
path:
|
|
14673
|
-
sha:
|
|
14674
|
-
size:
|
|
15049
|
+
var ConflictStrategySchema = import_mini53.z.enum(["skip", "overwrite"]);
|
|
15050
|
+
var GitHubFileTypeSchema = import_mini53.z.enum(["file", "dir", "symlink", "submodule"]);
|
|
15051
|
+
var GitHubFileEntrySchema = import_mini53.z.looseObject({
|
|
15052
|
+
name: import_mini53.z.string(),
|
|
15053
|
+
path: import_mini53.z.string(),
|
|
15054
|
+
sha: import_mini53.z.string(),
|
|
15055
|
+
size: import_mini53.z.number(),
|
|
14675
15056
|
type: GitHubFileTypeSchema,
|
|
14676
|
-
download_url:
|
|
15057
|
+
download_url: import_mini53.z.nullable(import_mini53.z.string())
|
|
14677
15058
|
});
|
|
14678
|
-
var FetchOptionsSchema =
|
|
14679
|
-
target:
|
|
14680
|
-
features:
|
|
14681
|
-
ref:
|
|
14682
|
-
path:
|
|
14683
|
-
output:
|
|
14684
|
-
conflict:
|
|
14685
|
-
token:
|
|
14686
|
-
verbose:
|
|
14687
|
-
silent:
|
|
15059
|
+
var FetchOptionsSchema = import_mini53.z.looseObject({
|
|
15060
|
+
target: import_mini53.z.optional(FetchTargetSchema),
|
|
15061
|
+
features: import_mini53.z.optional(import_mini53.z.array(import_mini53.z.enum(ALL_FEATURES_WITH_WILDCARD))),
|
|
15062
|
+
ref: import_mini53.z.optional(import_mini53.z.string()),
|
|
15063
|
+
path: import_mini53.z.optional(import_mini53.z.string()),
|
|
15064
|
+
output: import_mini53.z.optional(import_mini53.z.string()),
|
|
15065
|
+
conflict: import_mini53.z.optional(ConflictStrategySchema),
|
|
15066
|
+
token: import_mini53.z.optional(import_mini53.z.string()),
|
|
15067
|
+
verbose: import_mini53.z.optional(import_mini53.z.boolean()),
|
|
15068
|
+
silent: import_mini53.z.optional(import_mini53.z.boolean())
|
|
14688
15069
|
});
|
|
14689
|
-
var FetchFileStatusSchema =
|
|
14690
|
-
var GitHubRepoInfoSchema =
|
|
14691
|
-
default_branch:
|
|
14692
|
-
private:
|
|
15070
|
+
var FetchFileStatusSchema = import_mini53.z.enum(["created", "overwritten", "skipped"]);
|
|
15071
|
+
var GitHubRepoInfoSchema = import_mini53.z.looseObject({
|
|
15072
|
+
default_branch: import_mini53.z.string(),
|
|
15073
|
+
private: import_mini53.z.boolean()
|
|
14693
15074
|
});
|
|
14694
|
-
var GitHubReleaseAssetSchema =
|
|
14695
|
-
name:
|
|
14696
|
-
browser_download_url:
|
|
14697
|
-
size:
|
|
15075
|
+
var GitHubReleaseAssetSchema = import_mini53.z.looseObject({
|
|
15076
|
+
name: import_mini53.z.string(),
|
|
15077
|
+
browser_download_url: import_mini53.z.string(),
|
|
15078
|
+
size: import_mini53.z.number()
|
|
14698
15079
|
});
|
|
14699
|
-
var GitHubReleaseSchema =
|
|
14700
|
-
tag_name:
|
|
14701
|
-
name:
|
|
14702
|
-
prerelease:
|
|
14703
|
-
draft:
|
|
14704
|
-
assets:
|
|
15080
|
+
var GitHubReleaseSchema = import_mini53.z.looseObject({
|
|
15081
|
+
tag_name: import_mini53.z.string(),
|
|
15082
|
+
name: import_mini53.z.nullable(import_mini53.z.string()),
|
|
15083
|
+
prerelease: import_mini53.z.boolean(),
|
|
15084
|
+
draft: import_mini53.z.boolean(),
|
|
15085
|
+
assets: import_mini53.z.array(GitHubReleaseAssetSchema)
|
|
14705
15086
|
});
|
|
14706
15087
|
|
|
14707
15088
|
// src/lib/github-client.ts
|
|
@@ -15001,9 +15382,9 @@ async function listDirectoryRecursive(params) {
|
|
|
15001
15382
|
}
|
|
15002
15383
|
|
|
15003
15384
|
// src/types/git-provider.ts
|
|
15004
|
-
var
|
|
15385
|
+
var import_mini54 = require("zod/mini");
|
|
15005
15386
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
15006
|
-
var GitProviderSchema =
|
|
15387
|
+
var GitProviderSchema = import_mini54.z.enum(ALL_GIT_PROVIDERS);
|
|
15007
15388
|
|
|
15008
15389
|
// src/lib/source-parser.ts
|
|
15009
15390
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -15128,8 +15509,8 @@ async function processFeatureConversion(params) {
|
|
|
15128
15509
|
}
|
|
15129
15510
|
const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
15130
15511
|
for (const file of rulesyncFiles) {
|
|
15131
|
-
const relativePath = (0,
|
|
15132
|
-
const outputPath = (0,
|
|
15512
|
+
const relativePath = (0, import_node_path112.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
|
|
15513
|
+
const outputPath = (0, import_node_path112.join)(outputDir, relativePath);
|
|
15133
15514
|
await writeFileContent(outputPath, file.getFileContent());
|
|
15134
15515
|
paths.push(relativePath);
|
|
15135
15516
|
}
|
|
@@ -15275,7 +15656,7 @@ async function fetchFiles(params) {
|
|
|
15275
15656
|
skipped: 0
|
|
15276
15657
|
};
|
|
15277
15658
|
}
|
|
15278
|
-
const outputBasePath = (0,
|
|
15659
|
+
const outputBasePath = (0, import_node_path112.join)(baseDir, outputDir);
|
|
15279
15660
|
for (const { relativePath, size } of filesToFetch) {
|
|
15280
15661
|
checkPathTraversal({
|
|
15281
15662
|
relativePath,
|
|
@@ -15285,7 +15666,7 @@ async function fetchFiles(params) {
|
|
|
15285
15666
|
}
|
|
15286
15667
|
const results = await Promise.all(
|
|
15287
15668
|
filesToFetch.map(async ({ remotePath, relativePath }) => {
|
|
15288
|
-
const localPath = (0,
|
|
15669
|
+
const localPath = (0, import_node_path112.join)(outputBasePath, relativePath);
|
|
15289
15670
|
const exists = await fileExists(localPath);
|
|
15290
15671
|
if (exists && conflictStrategy === "skip") {
|
|
15291
15672
|
logger.debug(`Skipping existing file: ${relativePath}`);
|
|
@@ -15327,7 +15708,7 @@ async function collectFeatureFiles(params) {
|
|
|
15327
15708
|
);
|
|
15328
15709
|
const results = await Promise.all(
|
|
15329
15710
|
tasks.map(async ({ featurePath }) => {
|
|
15330
|
-
const fullPath = basePath === "." || basePath === "" ? featurePath : (0,
|
|
15711
|
+
const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path112.join)(basePath, featurePath);
|
|
15331
15712
|
const collected = [];
|
|
15332
15713
|
try {
|
|
15333
15714
|
if (featurePath.includes(".")) {
|
|
@@ -15427,7 +15808,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
15427
15808
|
relativePath: toolRelativePath,
|
|
15428
15809
|
intendedRootDir: tempDir
|
|
15429
15810
|
});
|
|
15430
|
-
const localPath = (0,
|
|
15811
|
+
const localPath = (0, import_node_path112.join)(tempDir, toolRelativePath);
|
|
15431
15812
|
const content = await withSemaphore(
|
|
15432
15813
|
semaphore,
|
|
15433
15814
|
() => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
|
|
@@ -15436,7 +15817,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
15436
15817
|
logger.debug(`Fetched to temp: ${toolRelativePath}`);
|
|
15437
15818
|
})
|
|
15438
15819
|
);
|
|
15439
|
-
const outputBasePath = (0,
|
|
15820
|
+
const outputBasePath = (0, import_node_path112.join)(baseDir, outputDir);
|
|
15440
15821
|
const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
|
|
15441
15822
|
tempDir,
|
|
15442
15823
|
outputDir: outputBasePath,
|
|
@@ -15509,7 +15890,7 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
15509
15890
|
if (relativePath.startsWith("rules/")) {
|
|
15510
15891
|
const restPath = relativePath.substring("rules/".length);
|
|
15511
15892
|
if (toolPaths.rules?.nonRoot) {
|
|
15512
|
-
return (0,
|
|
15893
|
+
return (0, import_node_path112.join)(toolPaths.rules.nonRoot, restPath);
|
|
15513
15894
|
}
|
|
15514
15895
|
}
|
|
15515
15896
|
if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
|
|
@@ -15518,19 +15899,19 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
15518
15899
|
if (relativePath.startsWith("commands/")) {
|
|
15519
15900
|
const restPath = relativePath.substring("commands/".length);
|
|
15520
15901
|
if (toolPaths.commands) {
|
|
15521
|
-
return (0,
|
|
15902
|
+
return (0, import_node_path112.join)(toolPaths.commands, restPath);
|
|
15522
15903
|
}
|
|
15523
15904
|
}
|
|
15524
15905
|
if (relativePath.startsWith("subagents/")) {
|
|
15525
15906
|
const restPath = relativePath.substring("subagents/".length);
|
|
15526
15907
|
if (toolPaths.subagents) {
|
|
15527
|
-
return (0,
|
|
15908
|
+
return (0, import_node_path112.join)(toolPaths.subagents, restPath);
|
|
15528
15909
|
}
|
|
15529
15910
|
}
|
|
15530
15911
|
if (relativePath.startsWith("skills/")) {
|
|
15531
15912
|
const restPath = relativePath.substring("skills/".length);
|
|
15532
15913
|
if (toolPaths.skills) {
|
|
15533
|
-
return (0,
|
|
15914
|
+
return (0, import_node_path112.join)(toolPaths.skills, restPath);
|
|
15534
15915
|
}
|
|
15535
15916
|
}
|
|
15536
15917
|
return relativePath;
|
|
@@ -15582,38 +15963,38 @@ async function fetchCommand(options) {
|
|
|
15582
15963
|
}
|
|
15583
15964
|
|
|
15584
15965
|
// src/config/config-resolver.ts
|
|
15966
|
+
var import_node_path113 = require("path");
|
|
15585
15967
|
var import_jsonc_parser = require("jsonc-parser");
|
|
15586
|
-
var import_node_path111 = require("path");
|
|
15587
15968
|
|
|
15588
15969
|
// src/config/config.ts
|
|
15589
|
-
var
|
|
15590
|
-
var SourceEntrySchema =
|
|
15591
|
-
source:
|
|
15592
|
-
skills: (0,
|
|
15970
|
+
var import_mini55 = require("zod/mini");
|
|
15971
|
+
var SourceEntrySchema = import_mini55.z.object({
|
|
15972
|
+
source: import_mini55.z.string().check((0, import_mini55.minLength)(1, "source must be a non-empty string")),
|
|
15973
|
+
skills: (0, import_mini55.optional)(import_mini55.z.array(import_mini55.z.string()))
|
|
15593
15974
|
});
|
|
15594
|
-
var ConfigParamsSchema =
|
|
15595
|
-
baseDirs:
|
|
15975
|
+
var ConfigParamsSchema = import_mini55.z.object({
|
|
15976
|
+
baseDirs: import_mini55.z.array(import_mini55.z.string()),
|
|
15596
15977
|
targets: RulesyncTargetsSchema,
|
|
15597
15978
|
features: RulesyncFeaturesSchema,
|
|
15598
|
-
verbose:
|
|
15599
|
-
delete:
|
|
15979
|
+
verbose: import_mini55.z.boolean(),
|
|
15980
|
+
delete: import_mini55.z.boolean(),
|
|
15600
15981
|
// New non-experimental options
|
|
15601
|
-
global: (0,
|
|
15602
|
-
silent: (0,
|
|
15603
|
-
simulateCommands: (0,
|
|
15604
|
-
simulateSubagents: (0,
|
|
15605
|
-
simulateSkills: (0,
|
|
15606
|
-
dryRun: (0,
|
|
15607
|
-
check: (0,
|
|
15982
|
+
global: (0, import_mini55.optional)(import_mini55.z.boolean()),
|
|
15983
|
+
silent: (0, import_mini55.optional)(import_mini55.z.boolean()),
|
|
15984
|
+
simulateCommands: (0, import_mini55.optional)(import_mini55.z.boolean()),
|
|
15985
|
+
simulateSubagents: (0, import_mini55.optional)(import_mini55.z.boolean()),
|
|
15986
|
+
simulateSkills: (0, import_mini55.optional)(import_mini55.z.boolean()),
|
|
15987
|
+
dryRun: (0, import_mini55.optional)(import_mini55.z.boolean()),
|
|
15988
|
+
check: (0, import_mini55.optional)(import_mini55.z.boolean()),
|
|
15608
15989
|
// Declarative skill sources
|
|
15609
|
-
sources: (0,
|
|
15990
|
+
sources: (0, import_mini55.optional)(import_mini55.z.array(SourceEntrySchema))
|
|
15610
15991
|
});
|
|
15611
|
-
var PartialConfigParamsSchema =
|
|
15612
|
-
var ConfigFileSchema =
|
|
15613
|
-
$schema: (0,
|
|
15614
|
-
...
|
|
15992
|
+
var PartialConfigParamsSchema = import_mini55.z.partial(ConfigParamsSchema);
|
|
15993
|
+
var ConfigFileSchema = import_mini55.z.object({
|
|
15994
|
+
$schema: (0, import_mini55.optional)(import_mini55.z.string()),
|
|
15995
|
+
...import_mini55.z.partial(ConfigParamsSchema).shape
|
|
15615
15996
|
});
|
|
15616
|
-
var RequiredConfigParamsSchema =
|
|
15997
|
+
var RequiredConfigParamsSchema = import_mini55.z.required(ConfigParamsSchema);
|
|
15617
15998
|
var CONFLICTING_TARGET_PAIRS = [
|
|
15618
15999
|
["augmentcode", "augmentcode-legacy"],
|
|
15619
16000
|
["claudecode", "claudecode-legacy"]
|
|
@@ -15834,8 +16215,8 @@ var ConfigResolver = class {
|
|
|
15834
16215
|
}) {
|
|
15835
16216
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
15836
16217
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
15837
|
-
const configDir = (0,
|
|
15838
|
-
const localConfigPath = (0,
|
|
16218
|
+
const configDir = (0, import_node_path113.dirname)(validatedConfigPath);
|
|
16219
|
+
const localConfigPath = (0, import_node_path113.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
15839
16220
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
15840
16221
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
15841
16222
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
@@ -15870,7 +16251,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
15870
16251
|
if (global) {
|
|
15871
16252
|
return [getHomeDirectory()];
|
|
15872
16253
|
}
|
|
15873
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
16254
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path113.resolve)(baseDir));
|
|
15874
16255
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
15875
16256
|
validateBaseDir(baseDir);
|
|
15876
16257
|
});
|
|
@@ -15878,8 +16259,8 @@ function getBaseDirsInLightOfGlobal({
|
|
|
15878
16259
|
}
|
|
15879
16260
|
|
|
15880
16261
|
// src/lib/generate.ts
|
|
16262
|
+
var import_node_path114 = require("path");
|
|
15881
16263
|
var import_es_toolkit4 = require("es-toolkit");
|
|
15882
|
-
var import_node_path112 = require("path");
|
|
15883
16264
|
async function processFeatureGeneration(params) {
|
|
15884
16265
|
const { config, processor, toolFiles } = params;
|
|
15885
16266
|
let totalCount = 0;
|
|
@@ -15924,7 +16305,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
15924
16305
|
return { count: totalCount, paths: [], hasDiff };
|
|
15925
16306
|
}
|
|
15926
16307
|
async function checkRulesyncDirExists(params) {
|
|
15927
|
-
return fileExists((0,
|
|
16308
|
+
return fileExists((0, import_node_path114.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
15928
16309
|
}
|
|
15929
16310
|
async function generate(params) {
|
|
15930
16311
|
const { config } = params;
|
|
@@ -16370,7 +16751,7 @@ async function generateCommand(options) {
|
|
|
16370
16751
|
}
|
|
16371
16752
|
|
|
16372
16753
|
// src/cli/commands/gitignore.ts
|
|
16373
|
-
var
|
|
16754
|
+
var import_node_path115 = require("path");
|
|
16374
16755
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
16375
16756
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
16376
16757
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -16525,7 +16906,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
16525
16906
|
return result;
|
|
16526
16907
|
};
|
|
16527
16908
|
var gitignoreCommand = async () => {
|
|
16528
|
-
const gitignorePath = (0,
|
|
16909
|
+
const gitignorePath = (0, import_node_path115.join)(process.cwd(), ".gitignore");
|
|
16529
16910
|
let gitignoreContent = "";
|
|
16530
16911
|
if (await fileExists(gitignorePath)) {
|
|
16531
16912
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -16805,7 +17186,7 @@ async function importCommand(options) {
|
|
|
16805
17186
|
}
|
|
16806
17187
|
|
|
16807
17188
|
// src/lib/init.ts
|
|
16808
|
-
var
|
|
17189
|
+
var import_node_path116 = require("path");
|
|
16809
17190
|
async function init() {
|
|
16810
17191
|
const sampleFiles = await createSampleFiles();
|
|
16811
17192
|
const configFile = await createConfigFile();
|
|
@@ -16995,27 +17376,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
16995
17376
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
16996
17377
|
await ensureDir(skillPaths.relativeDirPath);
|
|
16997
17378
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
16998
|
-
const ruleFilepath = (0,
|
|
17379
|
+
const ruleFilepath = (0, import_node_path116.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
16999
17380
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
17000
|
-
const mcpFilepath = (0,
|
|
17381
|
+
const mcpFilepath = (0, import_node_path116.join)(
|
|
17001
17382
|
mcpPaths.recommended.relativeDirPath,
|
|
17002
17383
|
mcpPaths.recommended.relativeFilePath
|
|
17003
17384
|
);
|
|
17004
17385
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
17005
|
-
const commandFilepath = (0,
|
|
17386
|
+
const commandFilepath = (0, import_node_path116.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
17006
17387
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
17007
|
-
const subagentFilepath = (0,
|
|
17388
|
+
const subagentFilepath = (0, import_node_path116.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
17008
17389
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
17009
|
-
const skillDirPath = (0,
|
|
17390
|
+
const skillDirPath = (0, import_node_path116.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
17010
17391
|
await ensureDir(skillDirPath);
|
|
17011
|
-
const skillFilepath = (0,
|
|
17392
|
+
const skillFilepath = (0, import_node_path116.join)(skillDirPath, SKILL_FILE_NAME);
|
|
17012
17393
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
17013
|
-
const ignoreFilepath = (0,
|
|
17394
|
+
const ignoreFilepath = (0, import_node_path116.join)(
|
|
17014
17395
|
ignorePaths.recommended.relativeDirPath,
|
|
17015
17396
|
ignorePaths.recommended.relativeFilePath
|
|
17016
17397
|
);
|
|
17017
17398
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
17018
|
-
const hooksFilepath = (0,
|
|
17399
|
+
const hooksFilepath = (0, import_node_path116.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
17019
17400
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
17020
17401
|
return results;
|
|
17021
17402
|
}
|
|
@@ -17053,33 +17434,33 @@ async function initCommand() {
|
|
|
17053
17434
|
}
|
|
17054
17435
|
|
|
17055
17436
|
// src/lib/sources.ts
|
|
17437
|
+
var import_node_path118 = require("path");
|
|
17056
17438
|
var import_promise2 = require("es-toolkit/promise");
|
|
17057
|
-
var import_node_path116 = require("path");
|
|
17058
17439
|
|
|
17059
17440
|
// src/lib/sources-lock.ts
|
|
17060
17441
|
var import_node_crypto = require("crypto");
|
|
17061
|
-
var
|
|
17062
|
-
var
|
|
17442
|
+
var import_node_path117 = require("path");
|
|
17443
|
+
var import_mini56 = require("zod/mini");
|
|
17063
17444
|
var LOCKFILE_VERSION = 1;
|
|
17064
|
-
var LockedSkillSchema =
|
|
17065
|
-
integrity:
|
|
17445
|
+
var LockedSkillSchema = import_mini56.z.object({
|
|
17446
|
+
integrity: import_mini56.z.string()
|
|
17066
17447
|
});
|
|
17067
|
-
var LockedSourceSchema =
|
|
17068
|
-
requestedRef: (0,
|
|
17069
|
-
resolvedRef:
|
|
17070
|
-
resolvedAt: (0,
|
|
17071
|
-
skills:
|
|
17448
|
+
var LockedSourceSchema = import_mini56.z.object({
|
|
17449
|
+
requestedRef: (0, import_mini56.optional)(import_mini56.z.string()),
|
|
17450
|
+
resolvedRef: import_mini56.z.string(),
|
|
17451
|
+
resolvedAt: (0, import_mini56.optional)(import_mini56.z.string()),
|
|
17452
|
+
skills: import_mini56.z.record(import_mini56.z.string(), LockedSkillSchema)
|
|
17072
17453
|
});
|
|
17073
|
-
var SourcesLockSchema =
|
|
17074
|
-
lockfileVersion:
|
|
17075
|
-
sources:
|
|
17454
|
+
var SourcesLockSchema = import_mini56.z.object({
|
|
17455
|
+
lockfileVersion: import_mini56.z.number(),
|
|
17456
|
+
sources: import_mini56.z.record(import_mini56.z.string(), LockedSourceSchema)
|
|
17076
17457
|
});
|
|
17077
|
-
var LegacyLockedSourceSchema =
|
|
17078
|
-
resolvedRef:
|
|
17079
|
-
skills:
|
|
17458
|
+
var LegacyLockedSourceSchema = import_mini56.z.object({
|
|
17459
|
+
resolvedRef: import_mini56.z.string(),
|
|
17460
|
+
skills: import_mini56.z.array(import_mini56.z.string())
|
|
17080
17461
|
});
|
|
17081
|
-
var LegacySourcesLockSchema =
|
|
17082
|
-
sources:
|
|
17462
|
+
var LegacySourcesLockSchema = import_mini56.z.object({
|
|
17463
|
+
sources: import_mini56.z.record(import_mini56.z.string(), LegacyLockedSourceSchema)
|
|
17083
17464
|
});
|
|
17084
17465
|
function migrateLegacyLock(legacy) {
|
|
17085
17466
|
const sources = {};
|
|
@@ -17102,7 +17483,7 @@ function createEmptyLock() {
|
|
|
17102
17483
|
return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
|
|
17103
17484
|
}
|
|
17104
17485
|
async function readLockFile(params) {
|
|
17105
|
-
const lockPath = (0,
|
|
17486
|
+
const lockPath = (0, import_node_path117.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
17106
17487
|
if (!await fileExists(lockPath)) {
|
|
17107
17488
|
logger.debug("No sources lockfile found, starting fresh.");
|
|
17108
17489
|
return createEmptyLock();
|
|
@@ -17130,7 +17511,7 @@ async function readLockFile(params) {
|
|
|
17130
17511
|
}
|
|
17131
17512
|
}
|
|
17132
17513
|
async function writeLockFile(params) {
|
|
17133
|
-
const lockPath = (0,
|
|
17514
|
+
const lockPath = (0, import_node_path117.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
17134
17515
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
17135
17516
|
await writeFileContent(lockPath, content);
|
|
17136
17517
|
logger.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -17271,7 +17652,7 @@ async function resolveAndFetchSources(params) {
|
|
|
17271
17652
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
17272
17653
|
if (skillNames.length === 0) return true;
|
|
17273
17654
|
for (const name of skillNames) {
|
|
17274
|
-
if (!await directoryExists((0,
|
|
17655
|
+
if (!await directoryExists((0, import_node_path118.join)(curatedDir, name))) {
|
|
17275
17656
|
return false;
|
|
17276
17657
|
}
|
|
17277
17658
|
}
|
|
@@ -17301,7 +17682,7 @@ async function fetchSource(params) {
|
|
|
17301
17682
|
ref = resolvedSha;
|
|
17302
17683
|
logger.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
17303
17684
|
}
|
|
17304
|
-
const curatedDir = (0,
|
|
17685
|
+
const curatedDir = (0, import_node_path118.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
17305
17686
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
17306
17687
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
17307
17688
|
if (allExist) {
|
|
@@ -17331,10 +17712,10 @@ async function fetchSource(params) {
|
|
|
17331
17712
|
const semaphore = new import_promise2.Semaphore(FETCH_CONCURRENCY_LIMIT);
|
|
17332
17713
|
const fetchedSkills = {};
|
|
17333
17714
|
if (locked) {
|
|
17334
|
-
const resolvedCuratedDir = (0,
|
|
17715
|
+
const resolvedCuratedDir = (0, import_node_path118.resolve)(curatedDir);
|
|
17335
17716
|
for (const prevSkill of lockedSkillNames) {
|
|
17336
|
-
const prevDir = (0,
|
|
17337
|
-
if (!(0,
|
|
17717
|
+
const prevDir = (0, import_node_path118.join)(curatedDir, prevSkill);
|
|
17718
|
+
if (!(0, import_node_path118.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path118.sep)) {
|
|
17338
17719
|
logger.warn(
|
|
17339
17720
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
17340
17721
|
);
|
|
@@ -17384,10 +17765,10 @@ async function fetchSource(params) {
|
|
|
17384
17765
|
const skillFiles = [];
|
|
17385
17766
|
for (const file of files) {
|
|
17386
17767
|
const relativeToSkill = file.path.substring(skillDir.path.length + 1);
|
|
17387
|
-
const localFilePath = (0,
|
|
17768
|
+
const localFilePath = (0, import_node_path118.join)(curatedDir, skillDir.name, relativeToSkill);
|
|
17388
17769
|
checkPathTraversal({
|
|
17389
17770
|
relativePath: relativeToSkill,
|
|
17390
|
-
intendedRootDir: (0,
|
|
17771
|
+
intendedRootDir: (0, import_node_path118.join)(curatedDir, skillDir.name)
|
|
17391
17772
|
});
|
|
17392
17773
|
const content = await withSemaphore(
|
|
17393
17774
|
semaphore,
|
|
@@ -17470,27 +17851,31 @@ async function installCommand(options) {
|
|
|
17470
17851
|
var import_fastmcp = require("fastmcp");
|
|
17471
17852
|
|
|
17472
17853
|
// src/mcp/tools.ts
|
|
17473
|
-
var
|
|
17854
|
+
var import_mini65 = require("zod/mini");
|
|
17474
17855
|
|
|
17475
17856
|
// src/mcp/commands.ts
|
|
17476
|
-
var
|
|
17477
|
-
var
|
|
17857
|
+
var import_node_path119 = require("path");
|
|
17858
|
+
var import_mini57 = require("zod/mini");
|
|
17478
17859
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
17479
17860
|
var maxCommandsCount = 1e3;
|
|
17480
17861
|
async function listCommands() {
|
|
17481
|
-
const commandsDir = (0,
|
|
17862
|
+
const commandsDir = (0, import_node_path119.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
17482
17863
|
try {
|
|
17483
17864
|
const files = await listDirectoryFiles(commandsDir);
|
|
17484
17865
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
17485
17866
|
const commands = await Promise.all(
|
|
17486
17867
|
mdFiles.map(async (file) => {
|
|
17487
17868
|
try {
|
|
17869
|
+
checkPathTraversal({
|
|
17870
|
+
relativePath: file,
|
|
17871
|
+
intendedRootDir: commandsDir
|
|
17872
|
+
});
|
|
17488
17873
|
const command = await RulesyncCommand.fromFile({
|
|
17489
17874
|
relativeFilePath: file
|
|
17490
17875
|
});
|
|
17491
17876
|
const frontmatter = command.getFrontmatter();
|
|
17492
17877
|
return {
|
|
17493
|
-
relativePathFromCwd: (0,
|
|
17878
|
+
relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
17494
17879
|
frontmatter
|
|
17495
17880
|
};
|
|
17496
17881
|
} catch (error) {
|
|
@@ -17512,13 +17897,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
17512
17897
|
relativePath: relativePathFromCwd,
|
|
17513
17898
|
intendedRootDir: process.cwd()
|
|
17514
17899
|
});
|
|
17515
|
-
const filename = (0,
|
|
17900
|
+
const filename = (0, import_node_path119.basename)(relativePathFromCwd);
|
|
17516
17901
|
try {
|
|
17517
17902
|
const command = await RulesyncCommand.fromFile({
|
|
17518
17903
|
relativeFilePath: filename
|
|
17519
17904
|
});
|
|
17520
17905
|
return {
|
|
17521
|
-
relativePathFromCwd: (0,
|
|
17906
|
+
relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
17522
17907
|
frontmatter: command.getFrontmatter(),
|
|
17523
17908
|
body: command.getBody()
|
|
17524
17909
|
};
|
|
@@ -17537,7 +17922,7 @@ async function putCommand({
|
|
|
17537
17922
|
relativePath: relativePathFromCwd,
|
|
17538
17923
|
intendedRootDir: process.cwd()
|
|
17539
17924
|
});
|
|
17540
|
-
const filename = (0,
|
|
17925
|
+
const filename = (0, import_node_path119.basename)(relativePathFromCwd);
|
|
17541
17926
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
17542
17927
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
17543
17928
|
throw new Error(
|
|
@@ -17547,7 +17932,7 @@ async function putCommand({
|
|
|
17547
17932
|
try {
|
|
17548
17933
|
const existingCommands = await listCommands();
|
|
17549
17934
|
const isUpdate = existingCommands.some(
|
|
17550
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
17935
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
17551
17936
|
);
|
|
17552
17937
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
17553
17938
|
throw new Error(
|
|
@@ -17564,11 +17949,11 @@ async function putCommand({
|
|
|
17564
17949
|
fileContent,
|
|
17565
17950
|
validate: true
|
|
17566
17951
|
});
|
|
17567
|
-
const commandsDir = (0,
|
|
17952
|
+
const commandsDir = (0, import_node_path119.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
17568
17953
|
await ensureDir(commandsDir);
|
|
17569
17954
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
17570
17955
|
return {
|
|
17571
|
-
relativePathFromCwd: (0,
|
|
17956
|
+
relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
17572
17957
|
frontmatter: command.getFrontmatter(),
|
|
17573
17958
|
body: command.getBody()
|
|
17574
17959
|
};
|
|
@@ -17583,12 +17968,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
17583
17968
|
relativePath: relativePathFromCwd,
|
|
17584
17969
|
intendedRootDir: process.cwd()
|
|
17585
17970
|
});
|
|
17586
|
-
const filename = (0,
|
|
17587
|
-
const fullPath = (0,
|
|
17971
|
+
const filename = (0, import_node_path119.basename)(relativePathFromCwd);
|
|
17972
|
+
const fullPath = (0, import_node_path119.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
17588
17973
|
try {
|
|
17589
17974
|
await removeFile(fullPath);
|
|
17590
17975
|
return {
|
|
17591
|
-
relativePathFromCwd: (0,
|
|
17976
|
+
relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
17592
17977
|
};
|
|
17593
17978
|
} catch (error) {
|
|
17594
17979
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -17597,23 +17982,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
17597
17982
|
}
|
|
17598
17983
|
}
|
|
17599
17984
|
var commandToolSchemas = {
|
|
17600
|
-
listCommands:
|
|
17601
|
-
getCommand:
|
|
17602
|
-
relativePathFromCwd:
|
|
17985
|
+
listCommands: import_mini57.z.object({}),
|
|
17986
|
+
getCommand: import_mini57.z.object({
|
|
17987
|
+
relativePathFromCwd: import_mini57.z.string()
|
|
17603
17988
|
}),
|
|
17604
|
-
putCommand:
|
|
17605
|
-
relativePathFromCwd:
|
|
17989
|
+
putCommand: import_mini57.z.object({
|
|
17990
|
+
relativePathFromCwd: import_mini57.z.string(),
|
|
17606
17991
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
17607
|
-
body:
|
|
17992
|
+
body: import_mini57.z.string()
|
|
17608
17993
|
}),
|
|
17609
|
-
deleteCommand:
|
|
17610
|
-
relativePathFromCwd:
|
|
17994
|
+
deleteCommand: import_mini57.z.object({
|
|
17995
|
+
relativePathFromCwd: import_mini57.z.string()
|
|
17611
17996
|
})
|
|
17612
17997
|
};
|
|
17613
17998
|
var commandTools = {
|
|
17614
17999
|
listCommands: {
|
|
17615
18000
|
name: "listCommands",
|
|
17616
|
-
description: `List all commands from ${(0,
|
|
18001
|
+
description: `List all commands from ${(0, import_node_path119.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
17617
18002
|
parameters: commandToolSchemas.listCommands,
|
|
17618
18003
|
execute: async () => {
|
|
17619
18004
|
const commands = await listCommands();
|
|
@@ -17655,15 +18040,15 @@ var commandTools = {
|
|
|
17655
18040
|
};
|
|
17656
18041
|
|
|
17657
18042
|
// src/mcp/generate.ts
|
|
17658
|
-
var
|
|
17659
|
-
var generateOptionsSchema =
|
|
17660
|
-
targets:
|
|
17661
|
-
features:
|
|
17662
|
-
delete:
|
|
17663
|
-
global:
|
|
17664
|
-
simulateCommands:
|
|
17665
|
-
simulateSubagents:
|
|
17666
|
-
simulateSkills:
|
|
18043
|
+
var import_mini58 = require("zod/mini");
|
|
18044
|
+
var generateOptionsSchema = import_mini58.z.object({
|
|
18045
|
+
targets: import_mini58.z.optional(import_mini58.z.array(import_mini58.z.string())),
|
|
18046
|
+
features: import_mini58.z.optional(import_mini58.z.array(import_mini58.z.string())),
|
|
18047
|
+
delete: import_mini58.z.optional(import_mini58.z.boolean()),
|
|
18048
|
+
global: import_mini58.z.optional(import_mini58.z.boolean()),
|
|
18049
|
+
simulateCommands: import_mini58.z.optional(import_mini58.z.boolean()),
|
|
18050
|
+
simulateSubagents: import_mini58.z.optional(import_mini58.z.boolean()),
|
|
18051
|
+
simulateSkills: import_mini58.z.optional(import_mini58.z.boolean())
|
|
17667
18052
|
});
|
|
17668
18053
|
async function executeGenerate(options = {}) {
|
|
17669
18054
|
try {
|
|
@@ -17740,11 +18125,11 @@ var generateTools = {
|
|
|
17740
18125
|
};
|
|
17741
18126
|
|
|
17742
18127
|
// src/mcp/ignore.ts
|
|
17743
|
-
var
|
|
17744
|
-
var
|
|
18128
|
+
var import_node_path120 = require("path");
|
|
18129
|
+
var import_mini59 = require("zod/mini");
|
|
17745
18130
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
17746
18131
|
async function getIgnoreFile() {
|
|
17747
|
-
const ignoreFilePath = (0,
|
|
18132
|
+
const ignoreFilePath = (0, import_node_path120.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
17748
18133
|
try {
|
|
17749
18134
|
const content = await readFileContent(ignoreFilePath);
|
|
17750
18135
|
return {
|
|
@@ -17761,7 +18146,7 @@ async function getIgnoreFile() {
|
|
|
17761
18146
|
}
|
|
17762
18147
|
}
|
|
17763
18148
|
async function putIgnoreFile({ content }) {
|
|
17764
|
-
const ignoreFilePath = (0,
|
|
18149
|
+
const ignoreFilePath = (0, import_node_path120.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
17765
18150
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
17766
18151
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
17767
18152
|
throw new Error(
|
|
@@ -17785,8 +18170,8 @@ async function putIgnoreFile({ content }) {
|
|
|
17785
18170
|
}
|
|
17786
18171
|
}
|
|
17787
18172
|
async function deleteIgnoreFile() {
|
|
17788
|
-
const aiignorePath = (0,
|
|
17789
|
-
const legacyIgnorePath = (0,
|
|
18173
|
+
const aiignorePath = (0, import_node_path120.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
18174
|
+
const legacyIgnorePath = (0, import_node_path120.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
17790
18175
|
try {
|
|
17791
18176
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
17792
18177
|
return {
|
|
@@ -17804,11 +18189,11 @@ async function deleteIgnoreFile() {
|
|
|
17804
18189
|
}
|
|
17805
18190
|
}
|
|
17806
18191
|
var ignoreToolSchemas = {
|
|
17807
|
-
getIgnoreFile:
|
|
17808
|
-
putIgnoreFile:
|
|
17809
|
-
content:
|
|
18192
|
+
getIgnoreFile: import_mini59.z.object({}),
|
|
18193
|
+
putIgnoreFile: import_mini59.z.object({
|
|
18194
|
+
content: import_mini59.z.string()
|
|
17810
18195
|
}),
|
|
17811
|
-
deleteIgnoreFile:
|
|
18196
|
+
deleteIgnoreFile: import_mini59.z.object({})
|
|
17812
18197
|
};
|
|
17813
18198
|
var ignoreTools = {
|
|
17814
18199
|
getIgnoreFile: {
|
|
@@ -17841,11 +18226,11 @@ var ignoreTools = {
|
|
|
17841
18226
|
};
|
|
17842
18227
|
|
|
17843
18228
|
// src/mcp/import.ts
|
|
17844
|
-
var
|
|
17845
|
-
var importOptionsSchema =
|
|
17846
|
-
target:
|
|
17847
|
-
features:
|
|
17848
|
-
global:
|
|
18229
|
+
var import_mini60 = require("zod/mini");
|
|
18230
|
+
var importOptionsSchema = import_mini60.z.object({
|
|
18231
|
+
target: import_mini60.z.string(),
|
|
18232
|
+
features: import_mini60.z.optional(import_mini60.z.array(import_mini60.z.string())),
|
|
18233
|
+
global: import_mini60.z.optional(import_mini60.z.boolean())
|
|
17849
18234
|
});
|
|
17850
18235
|
async function executeImport(options) {
|
|
17851
18236
|
try {
|
|
@@ -17914,15 +18299,15 @@ var importTools = {
|
|
|
17914
18299
|
};
|
|
17915
18300
|
|
|
17916
18301
|
// src/mcp/mcp.ts
|
|
17917
|
-
var
|
|
17918
|
-
var
|
|
18302
|
+
var import_node_path121 = require("path");
|
|
18303
|
+
var import_mini61 = require("zod/mini");
|
|
17919
18304
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
17920
18305
|
async function getMcpFile() {
|
|
17921
18306
|
try {
|
|
17922
18307
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
17923
18308
|
validate: true
|
|
17924
18309
|
});
|
|
17925
|
-
const relativePathFromCwd = (0,
|
|
18310
|
+
const relativePathFromCwd = (0, import_node_path121.join)(
|
|
17926
18311
|
rulesyncMcp.getRelativeDirPath(),
|
|
17927
18312
|
rulesyncMcp.getRelativeFilePath()
|
|
17928
18313
|
);
|
|
@@ -17960,7 +18345,7 @@ async function putMcpFile({ content }) {
|
|
|
17960
18345
|
const paths = RulesyncMcp.getSettablePaths();
|
|
17961
18346
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
17962
18347
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
17963
|
-
const fullPath = (0,
|
|
18348
|
+
const fullPath = (0, import_node_path121.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
17964
18349
|
const rulesyncMcp = new RulesyncMcp({
|
|
17965
18350
|
baseDir,
|
|
17966
18351
|
relativeDirPath,
|
|
@@ -17968,9 +18353,9 @@ async function putMcpFile({ content }) {
|
|
|
17968
18353
|
fileContent: content,
|
|
17969
18354
|
validate: true
|
|
17970
18355
|
});
|
|
17971
|
-
await ensureDir((0,
|
|
18356
|
+
await ensureDir((0, import_node_path121.join)(baseDir, relativeDirPath));
|
|
17972
18357
|
await writeFileContent(fullPath, content);
|
|
17973
|
-
const relativePathFromCwd = (0,
|
|
18358
|
+
const relativePathFromCwd = (0, import_node_path121.join)(relativeDirPath, relativeFilePath);
|
|
17974
18359
|
return {
|
|
17975
18360
|
relativePathFromCwd,
|
|
17976
18361
|
content: rulesyncMcp.getFileContent()
|
|
@@ -17988,15 +18373,15 @@ async function deleteMcpFile() {
|
|
|
17988
18373
|
try {
|
|
17989
18374
|
const baseDir = process.cwd();
|
|
17990
18375
|
const paths = RulesyncMcp.getSettablePaths();
|
|
17991
|
-
const recommendedPath = (0,
|
|
18376
|
+
const recommendedPath = (0, import_node_path121.join)(
|
|
17992
18377
|
baseDir,
|
|
17993
18378
|
paths.recommended.relativeDirPath,
|
|
17994
18379
|
paths.recommended.relativeFilePath
|
|
17995
18380
|
);
|
|
17996
|
-
const legacyPath = (0,
|
|
18381
|
+
const legacyPath = (0, import_node_path121.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
17997
18382
|
await removeFile(recommendedPath);
|
|
17998
18383
|
await removeFile(legacyPath);
|
|
17999
|
-
const relativePathFromCwd = (0,
|
|
18384
|
+
const relativePathFromCwd = (0, import_node_path121.join)(
|
|
18000
18385
|
paths.recommended.relativeDirPath,
|
|
18001
18386
|
paths.recommended.relativeFilePath
|
|
18002
18387
|
);
|
|
@@ -18013,11 +18398,11 @@ async function deleteMcpFile() {
|
|
|
18013
18398
|
}
|
|
18014
18399
|
}
|
|
18015
18400
|
var mcpToolSchemas = {
|
|
18016
|
-
getMcpFile:
|
|
18017
|
-
putMcpFile:
|
|
18018
|
-
content:
|
|
18401
|
+
getMcpFile: import_mini61.z.object({}),
|
|
18402
|
+
putMcpFile: import_mini61.z.object({
|
|
18403
|
+
content: import_mini61.z.string()
|
|
18019
18404
|
}),
|
|
18020
|
-
deleteMcpFile:
|
|
18405
|
+
deleteMcpFile: import_mini61.z.object({})
|
|
18021
18406
|
};
|
|
18022
18407
|
var mcpTools = {
|
|
18023
18408
|
getMcpFile: {
|
|
@@ -18050,12 +18435,12 @@ var mcpTools = {
|
|
|
18050
18435
|
};
|
|
18051
18436
|
|
|
18052
18437
|
// src/mcp/rules.ts
|
|
18053
|
-
var
|
|
18054
|
-
var
|
|
18438
|
+
var import_node_path122 = require("path");
|
|
18439
|
+
var import_mini62 = require("zod/mini");
|
|
18055
18440
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
18056
18441
|
var maxRulesCount = 1e3;
|
|
18057
18442
|
async function listRules() {
|
|
18058
|
-
const rulesDir = (0,
|
|
18443
|
+
const rulesDir = (0, import_node_path122.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
18059
18444
|
try {
|
|
18060
18445
|
const files = await listDirectoryFiles(rulesDir);
|
|
18061
18446
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18068,7 +18453,7 @@ async function listRules() {
|
|
|
18068
18453
|
});
|
|
18069
18454
|
const frontmatter = rule.getFrontmatter();
|
|
18070
18455
|
return {
|
|
18071
|
-
relativePathFromCwd: (0,
|
|
18456
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
18072
18457
|
frontmatter
|
|
18073
18458
|
};
|
|
18074
18459
|
} catch (error) {
|
|
@@ -18090,14 +18475,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
18090
18475
|
relativePath: relativePathFromCwd,
|
|
18091
18476
|
intendedRootDir: process.cwd()
|
|
18092
18477
|
});
|
|
18093
|
-
const filename = (0,
|
|
18478
|
+
const filename = (0, import_node_path122.basename)(relativePathFromCwd);
|
|
18094
18479
|
try {
|
|
18095
18480
|
const rule = await RulesyncRule.fromFile({
|
|
18096
18481
|
relativeFilePath: filename,
|
|
18097
18482
|
validate: true
|
|
18098
18483
|
});
|
|
18099
18484
|
return {
|
|
18100
|
-
relativePathFromCwd: (0,
|
|
18485
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
18101
18486
|
frontmatter: rule.getFrontmatter(),
|
|
18102
18487
|
body: rule.getBody()
|
|
18103
18488
|
};
|
|
@@ -18116,7 +18501,7 @@ async function putRule({
|
|
|
18116
18501
|
relativePath: relativePathFromCwd,
|
|
18117
18502
|
intendedRootDir: process.cwd()
|
|
18118
18503
|
});
|
|
18119
|
-
const filename = (0,
|
|
18504
|
+
const filename = (0, import_node_path122.basename)(relativePathFromCwd);
|
|
18120
18505
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18121
18506
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
18122
18507
|
throw new Error(
|
|
@@ -18126,7 +18511,7 @@ async function putRule({
|
|
|
18126
18511
|
try {
|
|
18127
18512
|
const existingRules = await listRules();
|
|
18128
18513
|
const isUpdate = existingRules.some(
|
|
18129
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
18514
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path122.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
18130
18515
|
);
|
|
18131
18516
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
18132
18517
|
throw new Error(
|
|
@@ -18141,11 +18526,11 @@ async function putRule({
|
|
|
18141
18526
|
body,
|
|
18142
18527
|
validate: true
|
|
18143
18528
|
});
|
|
18144
|
-
const rulesDir = (0,
|
|
18529
|
+
const rulesDir = (0, import_node_path122.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
18145
18530
|
await ensureDir(rulesDir);
|
|
18146
18531
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
18147
18532
|
return {
|
|
18148
|
-
relativePathFromCwd: (0,
|
|
18533
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
18149
18534
|
frontmatter: rule.getFrontmatter(),
|
|
18150
18535
|
body: rule.getBody()
|
|
18151
18536
|
};
|
|
@@ -18160,12 +18545,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
18160
18545
|
relativePath: relativePathFromCwd,
|
|
18161
18546
|
intendedRootDir: process.cwd()
|
|
18162
18547
|
});
|
|
18163
|
-
const filename = (0,
|
|
18164
|
-
const fullPath = (0,
|
|
18548
|
+
const filename = (0, import_node_path122.basename)(relativePathFromCwd);
|
|
18549
|
+
const fullPath = (0, import_node_path122.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
18165
18550
|
try {
|
|
18166
18551
|
await removeFile(fullPath);
|
|
18167
18552
|
return {
|
|
18168
|
-
relativePathFromCwd: (0,
|
|
18553
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
18169
18554
|
};
|
|
18170
18555
|
} catch (error) {
|
|
18171
18556
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -18174,23 +18559,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
18174
18559
|
}
|
|
18175
18560
|
}
|
|
18176
18561
|
var ruleToolSchemas = {
|
|
18177
|
-
listRules:
|
|
18178
|
-
getRule:
|
|
18179
|
-
relativePathFromCwd:
|
|
18562
|
+
listRules: import_mini62.z.object({}),
|
|
18563
|
+
getRule: import_mini62.z.object({
|
|
18564
|
+
relativePathFromCwd: import_mini62.z.string()
|
|
18180
18565
|
}),
|
|
18181
|
-
putRule:
|
|
18182
|
-
relativePathFromCwd:
|
|
18566
|
+
putRule: import_mini62.z.object({
|
|
18567
|
+
relativePathFromCwd: import_mini62.z.string(),
|
|
18183
18568
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
18184
|
-
body:
|
|
18569
|
+
body: import_mini62.z.string()
|
|
18185
18570
|
}),
|
|
18186
|
-
deleteRule:
|
|
18187
|
-
relativePathFromCwd:
|
|
18571
|
+
deleteRule: import_mini62.z.object({
|
|
18572
|
+
relativePathFromCwd: import_mini62.z.string()
|
|
18188
18573
|
})
|
|
18189
18574
|
};
|
|
18190
18575
|
var ruleTools = {
|
|
18191
18576
|
listRules: {
|
|
18192
18577
|
name: "listRules",
|
|
18193
|
-
description: `List all rules from ${(0,
|
|
18578
|
+
description: `List all rules from ${(0, import_node_path122.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18194
18579
|
parameters: ruleToolSchemas.listRules,
|
|
18195
18580
|
execute: async () => {
|
|
18196
18581
|
const rules = await listRules();
|
|
@@ -18232,8 +18617,8 @@ var ruleTools = {
|
|
|
18232
18617
|
};
|
|
18233
18618
|
|
|
18234
18619
|
// src/mcp/skills.ts
|
|
18235
|
-
var
|
|
18236
|
-
var
|
|
18620
|
+
var import_node_path123 = require("path");
|
|
18621
|
+
var import_mini63 = require("zod/mini");
|
|
18237
18622
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
18238
18623
|
var maxSkillsCount = 1e3;
|
|
18239
18624
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -18249,19 +18634,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
18249
18634
|
};
|
|
18250
18635
|
}
|
|
18251
18636
|
function extractDirName(relativeDirPathFromCwd) {
|
|
18252
|
-
const dirName = (0,
|
|
18637
|
+
const dirName = (0, import_node_path123.basename)(relativeDirPathFromCwd);
|
|
18253
18638
|
if (!dirName) {
|
|
18254
18639
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
18255
18640
|
}
|
|
18256
18641
|
return dirName;
|
|
18257
18642
|
}
|
|
18258
18643
|
async function listSkills() {
|
|
18259
|
-
const skillsDir = (0,
|
|
18644
|
+
const skillsDir = (0, import_node_path123.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
18260
18645
|
try {
|
|
18261
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
18646
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path123.join)(skillsDir, "*"), { type: "dir" });
|
|
18262
18647
|
const skills = await Promise.all(
|
|
18263
18648
|
skillDirPaths.map(async (dirPath) => {
|
|
18264
|
-
const dirName = (0,
|
|
18649
|
+
const dirName = (0, import_node_path123.basename)(dirPath);
|
|
18265
18650
|
if (!dirName) return null;
|
|
18266
18651
|
try {
|
|
18267
18652
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -18269,7 +18654,7 @@ async function listSkills() {
|
|
|
18269
18654
|
});
|
|
18270
18655
|
const frontmatter = skill.getFrontmatter();
|
|
18271
18656
|
return {
|
|
18272
|
-
relativeDirPathFromCwd: (0,
|
|
18657
|
+
relativeDirPathFromCwd: (0, import_node_path123.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18273
18658
|
frontmatter
|
|
18274
18659
|
};
|
|
18275
18660
|
} catch (error) {
|
|
@@ -18297,7 +18682,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
18297
18682
|
dirName
|
|
18298
18683
|
});
|
|
18299
18684
|
return {
|
|
18300
|
-
relativeDirPathFromCwd: (0,
|
|
18685
|
+
relativeDirPathFromCwd: (0, import_node_path123.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18301
18686
|
frontmatter: skill.getFrontmatter(),
|
|
18302
18687
|
body: skill.getBody(),
|
|
18303
18688
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -18331,7 +18716,7 @@ async function putSkill({
|
|
|
18331
18716
|
try {
|
|
18332
18717
|
const existingSkills = await listSkills();
|
|
18333
18718
|
const isUpdate = existingSkills.some(
|
|
18334
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
18719
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path123.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
18335
18720
|
);
|
|
18336
18721
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
18337
18722
|
throw new Error(
|
|
@@ -18348,9 +18733,9 @@ async function putSkill({
|
|
|
18348
18733
|
otherFiles: aiDirFiles,
|
|
18349
18734
|
validate: true
|
|
18350
18735
|
});
|
|
18351
|
-
const skillDirPath = (0,
|
|
18736
|
+
const skillDirPath = (0, import_node_path123.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
18352
18737
|
await ensureDir(skillDirPath);
|
|
18353
|
-
const skillFilePath = (0,
|
|
18738
|
+
const skillFilePath = (0, import_node_path123.join)(skillDirPath, SKILL_FILE_NAME);
|
|
18354
18739
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
18355
18740
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
18356
18741
|
for (const file of otherFiles) {
|
|
@@ -18358,15 +18743,15 @@ async function putSkill({
|
|
|
18358
18743
|
relativePath: file.name,
|
|
18359
18744
|
intendedRootDir: skillDirPath
|
|
18360
18745
|
});
|
|
18361
|
-
const filePath = (0,
|
|
18362
|
-
const fileDir = (0,
|
|
18746
|
+
const filePath = (0, import_node_path123.join)(skillDirPath, file.name);
|
|
18747
|
+
const fileDir = (0, import_node_path123.join)(skillDirPath, (0, import_node_path123.dirname)(file.name));
|
|
18363
18748
|
if (fileDir !== skillDirPath) {
|
|
18364
18749
|
await ensureDir(fileDir);
|
|
18365
18750
|
}
|
|
18366
18751
|
await writeFileContent(filePath, file.body);
|
|
18367
18752
|
}
|
|
18368
18753
|
return {
|
|
18369
|
-
relativeDirPathFromCwd: (0,
|
|
18754
|
+
relativeDirPathFromCwd: (0, import_node_path123.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18370
18755
|
frontmatter: skill.getFrontmatter(),
|
|
18371
18756
|
body: skill.getBody(),
|
|
18372
18757
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -18388,13 +18773,13 @@ async function deleteSkill({
|
|
|
18388
18773
|
intendedRootDir: process.cwd()
|
|
18389
18774
|
});
|
|
18390
18775
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
18391
|
-
const skillDirPath = (0,
|
|
18776
|
+
const skillDirPath = (0, import_node_path123.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
18392
18777
|
try {
|
|
18393
18778
|
if (await directoryExists(skillDirPath)) {
|
|
18394
18779
|
await removeDirectory(skillDirPath);
|
|
18395
18780
|
}
|
|
18396
18781
|
return {
|
|
18397
|
-
relativeDirPathFromCwd: (0,
|
|
18782
|
+
relativeDirPathFromCwd: (0, import_node_path123.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
18398
18783
|
};
|
|
18399
18784
|
} catch (error) {
|
|
18400
18785
|
throw new Error(
|
|
@@ -18405,29 +18790,29 @@ async function deleteSkill({
|
|
|
18405
18790
|
);
|
|
18406
18791
|
}
|
|
18407
18792
|
}
|
|
18408
|
-
var McpSkillFileSchema =
|
|
18409
|
-
name:
|
|
18410
|
-
body:
|
|
18793
|
+
var McpSkillFileSchema = import_mini63.z.object({
|
|
18794
|
+
name: import_mini63.z.string(),
|
|
18795
|
+
body: import_mini63.z.string()
|
|
18411
18796
|
});
|
|
18412
18797
|
var skillToolSchemas = {
|
|
18413
|
-
listSkills:
|
|
18414
|
-
getSkill:
|
|
18415
|
-
relativeDirPathFromCwd:
|
|
18798
|
+
listSkills: import_mini63.z.object({}),
|
|
18799
|
+
getSkill: import_mini63.z.object({
|
|
18800
|
+
relativeDirPathFromCwd: import_mini63.z.string()
|
|
18416
18801
|
}),
|
|
18417
|
-
putSkill:
|
|
18418
|
-
relativeDirPathFromCwd:
|
|
18802
|
+
putSkill: import_mini63.z.object({
|
|
18803
|
+
relativeDirPathFromCwd: import_mini63.z.string(),
|
|
18419
18804
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
18420
|
-
body:
|
|
18421
|
-
otherFiles:
|
|
18805
|
+
body: import_mini63.z.string(),
|
|
18806
|
+
otherFiles: import_mini63.z.optional(import_mini63.z.array(McpSkillFileSchema))
|
|
18422
18807
|
}),
|
|
18423
|
-
deleteSkill:
|
|
18424
|
-
relativeDirPathFromCwd:
|
|
18808
|
+
deleteSkill: import_mini63.z.object({
|
|
18809
|
+
relativeDirPathFromCwd: import_mini63.z.string()
|
|
18425
18810
|
})
|
|
18426
18811
|
};
|
|
18427
18812
|
var skillTools = {
|
|
18428
18813
|
listSkills: {
|
|
18429
18814
|
name: "listSkills",
|
|
18430
|
-
description: `List all skills from ${(0,
|
|
18815
|
+
description: `List all skills from ${(0, import_node_path123.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
18431
18816
|
parameters: skillToolSchemas.listSkills,
|
|
18432
18817
|
execute: async () => {
|
|
18433
18818
|
const skills = await listSkills();
|
|
@@ -18470,12 +18855,12 @@ var skillTools = {
|
|
|
18470
18855
|
};
|
|
18471
18856
|
|
|
18472
18857
|
// src/mcp/subagents.ts
|
|
18473
|
-
var
|
|
18474
|
-
var
|
|
18858
|
+
var import_node_path124 = require("path");
|
|
18859
|
+
var import_mini64 = require("zod/mini");
|
|
18475
18860
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
18476
18861
|
var maxSubagentsCount = 1e3;
|
|
18477
18862
|
async function listSubagents() {
|
|
18478
|
-
const subagentsDir = (0,
|
|
18863
|
+
const subagentsDir = (0, import_node_path124.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
18479
18864
|
try {
|
|
18480
18865
|
const files = await listDirectoryFiles(subagentsDir);
|
|
18481
18866
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18488,7 +18873,7 @@ async function listSubagents() {
|
|
|
18488
18873
|
});
|
|
18489
18874
|
const frontmatter = subagent.getFrontmatter();
|
|
18490
18875
|
return {
|
|
18491
|
-
relativePathFromCwd: (0,
|
|
18876
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
18492
18877
|
frontmatter
|
|
18493
18878
|
};
|
|
18494
18879
|
} catch (error) {
|
|
@@ -18512,14 +18897,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
18512
18897
|
relativePath: relativePathFromCwd,
|
|
18513
18898
|
intendedRootDir: process.cwd()
|
|
18514
18899
|
});
|
|
18515
|
-
const filename = (0,
|
|
18900
|
+
const filename = (0, import_node_path124.basename)(relativePathFromCwd);
|
|
18516
18901
|
try {
|
|
18517
18902
|
const subagent = await RulesyncSubagent.fromFile({
|
|
18518
18903
|
relativeFilePath: filename,
|
|
18519
18904
|
validate: true
|
|
18520
18905
|
});
|
|
18521
18906
|
return {
|
|
18522
|
-
relativePathFromCwd: (0,
|
|
18907
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
18523
18908
|
frontmatter: subagent.getFrontmatter(),
|
|
18524
18909
|
body: subagent.getBody()
|
|
18525
18910
|
};
|
|
@@ -18538,7 +18923,7 @@ async function putSubagent({
|
|
|
18538
18923
|
relativePath: relativePathFromCwd,
|
|
18539
18924
|
intendedRootDir: process.cwd()
|
|
18540
18925
|
});
|
|
18541
|
-
const filename = (0,
|
|
18926
|
+
const filename = (0, import_node_path124.basename)(relativePathFromCwd);
|
|
18542
18927
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18543
18928
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
18544
18929
|
throw new Error(
|
|
@@ -18548,7 +18933,7 @@ async function putSubagent({
|
|
|
18548
18933
|
try {
|
|
18549
18934
|
const existingSubagents = await listSubagents();
|
|
18550
18935
|
const isUpdate = existingSubagents.some(
|
|
18551
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
18936
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path124.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
18552
18937
|
);
|
|
18553
18938
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
18554
18939
|
throw new Error(
|
|
@@ -18563,11 +18948,11 @@ async function putSubagent({
|
|
|
18563
18948
|
body,
|
|
18564
18949
|
validate: true
|
|
18565
18950
|
});
|
|
18566
|
-
const subagentsDir = (0,
|
|
18951
|
+
const subagentsDir = (0, import_node_path124.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
18567
18952
|
await ensureDir(subagentsDir);
|
|
18568
18953
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
18569
18954
|
return {
|
|
18570
|
-
relativePathFromCwd: (0,
|
|
18955
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
18571
18956
|
frontmatter: subagent.getFrontmatter(),
|
|
18572
18957
|
body: subagent.getBody()
|
|
18573
18958
|
};
|
|
@@ -18582,12 +18967,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
18582
18967
|
relativePath: relativePathFromCwd,
|
|
18583
18968
|
intendedRootDir: process.cwd()
|
|
18584
18969
|
});
|
|
18585
|
-
const filename = (0,
|
|
18586
|
-
const fullPath = (0,
|
|
18970
|
+
const filename = (0, import_node_path124.basename)(relativePathFromCwd);
|
|
18971
|
+
const fullPath = (0, import_node_path124.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
18587
18972
|
try {
|
|
18588
18973
|
await removeFile(fullPath);
|
|
18589
18974
|
return {
|
|
18590
|
-
relativePathFromCwd: (0,
|
|
18975
|
+
relativePathFromCwd: (0, import_node_path124.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
18591
18976
|
};
|
|
18592
18977
|
} catch (error) {
|
|
18593
18978
|
throw new Error(
|
|
@@ -18599,23 +18984,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
18599
18984
|
}
|
|
18600
18985
|
}
|
|
18601
18986
|
var subagentToolSchemas = {
|
|
18602
|
-
listSubagents:
|
|
18603
|
-
getSubagent:
|
|
18604
|
-
relativePathFromCwd:
|
|
18987
|
+
listSubagents: import_mini64.z.object({}),
|
|
18988
|
+
getSubagent: import_mini64.z.object({
|
|
18989
|
+
relativePathFromCwd: import_mini64.z.string()
|
|
18605
18990
|
}),
|
|
18606
|
-
putSubagent:
|
|
18607
|
-
relativePathFromCwd:
|
|
18991
|
+
putSubagent: import_mini64.z.object({
|
|
18992
|
+
relativePathFromCwd: import_mini64.z.string(),
|
|
18608
18993
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
18609
|
-
body:
|
|
18994
|
+
body: import_mini64.z.string()
|
|
18610
18995
|
}),
|
|
18611
|
-
deleteSubagent:
|
|
18612
|
-
relativePathFromCwd:
|
|
18996
|
+
deleteSubagent: import_mini64.z.object({
|
|
18997
|
+
relativePathFromCwd: import_mini64.z.string()
|
|
18613
18998
|
})
|
|
18614
18999
|
};
|
|
18615
19000
|
var subagentTools = {
|
|
18616
19001
|
listSubagents: {
|
|
18617
19002
|
name: "listSubagents",
|
|
18618
|
-
description: `List all subagents from ${(0,
|
|
19003
|
+
description: `List all subagents from ${(0, import_node_path124.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18619
19004
|
parameters: subagentToolSchemas.listSubagents,
|
|
18620
19005
|
execute: async () => {
|
|
18621
19006
|
const subagents = await listSubagents();
|
|
@@ -18657,7 +19042,7 @@ var subagentTools = {
|
|
|
18657
19042
|
};
|
|
18658
19043
|
|
|
18659
19044
|
// src/mcp/tools.ts
|
|
18660
|
-
var rulesyncFeatureSchema =
|
|
19045
|
+
var rulesyncFeatureSchema = import_mini65.z.enum([
|
|
18661
19046
|
"rule",
|
|
18662
19047
|
"command",
|
|
18663
19048
|
"subagent",
|
|
@@ -18667,21 +19052,21 @@ var rulesyncFeatureSchema = import_mini63.z.enum([
|
|
|
18667
19052
|
"generate",
|
|
18668
19053
|
"import"
|
|
18669
19054
|
]);
|
|
18670
|
-
var rulesyncOperationSchema =
|
|
18671
|
-
var skillFileSchema =
|
|
18672
|
-
name:
|
|
18673
|
-
body:
|
|
19055
|
+
var rulesyncOperationSchema = import_mini65.z.enum(["list", "get", "put", "delete", "run"]);
|
|
19056
|
+
var skillFileSchema = import_mini65.z.object({
|
|
19057
|
+
name: import_mini65.z.string(),
|
|
19058
|
+
body: import_mini65.z.string()
|
|
18674
19059
|
});
|
|
18675
|
-
var rulesyncToolSchema =
|
|
19060
|
+
var rulesyncToolSchema = import_mini65.z.object({
|
|
18676
19061
|
feature: rulesyncFeatureSchema,
|
|
18677
19062
|
operation: rulesyncOperationSchema,
|
|
18678
|
-
targetPathFromCwd:
|
|
18679
|
-
frontmatter:
|
|
18680
|
-
body:
|
|
18681
|
-
otherFiles:
|
|
18682
|
-
content:
|
|
18683
|
-
generateOptions:
|
|
18684
|
-
importOptions:
|
|
19063
|
+
targetPathFromCwd: import_mini65.z.optional(import_mini65.z.string()),
|
|
19064
|
+
frontmatter: import_mini65.z.optional(import_mini65.z.unknown()),
|
|
19065
|
+
body: import_mini65.z.optional(import_mini65.z.string()),
|
|
19066
|
+
otherFiles: import_mini65.z.optional(import_mini65.z.array(skillFileSchema)),
|
|
19067
|
+
content: import_mini65.z.optional(import_mini65.z.string()),
|
|
19068
|
+
generateOptions: import_mini65.z.optional(generateOptionsSchema),
|
|
19069
|
+
importOptions: import_mini65.z.optional(importOptionsSchema)
|
|
18685
19070
|
});
|
|
18686
19071
|
var supportedOperationsByFeature = {
|
|
18687
19072
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -19240,7 +19625,7 @@ async function updateCommand(currentVersion, options) {
|
|
|
19240
19625
|
}
|
|
19241
19626
|
|
|
19242
19627
|
// src/cli/index.ts
|
|
19243
|
-
var getVersion = () => "7.
|
|
19628
|
+
var getVersion = () => "7.7.0";
|
|
19244
19629
|
var main = async () => {
|
|
19245
19630
|
const program = new import_commander.Command();
|
|
19246
19631
|
const version = getVersion();
|