rulesync 5.0.0 → 5.1.1
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 -0
- package/dist/index.cjs +1035 -526
- package/dist/index.js +1044 -535
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -244,6 +244,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
244
244
|
"cursor",
|
|
245
245
|
"geminicli",
|
|
246
246
|
"junie",
|
|
247
|
+
"kilo",
|
|
247
248
|
"kiro",
|
|
248
249
|
"opencode",
|
|
249
250
|
"qwencode",
|
|
@@ -461,7 +462,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
461
462
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
462
463
|
|
|
463
464
|
// src/features/commands/commands-processor.ts
|
|
464
|
-
import { basename as
|
|
465
|
+
import { basename as basename14, join as join16 } from "path";
|
|
465
466
|
import { z as z12 } from "zod/mini";
|
|
466
467
|
|
|
467
468
|
// src/types/feature-processor.ts
|
|
@@ -1793,8 +1794,89 @@ prompt = ""`;
|
|
|
1793
1794
|
}
|
|
1794
1795
|
};
|
|
1795
1796
|
|
|
1796
|
-
// src/features/commands/
|
|
1797
|
+
// src/features/commands/kilo-command.ts
|
|
1797
1798
|
import { basename as basename11, join as join13 } from "path";
|
|
1799
|
+
var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
1800
|
+
static getSettablePaths(_options = {}) {
|
|
1801
|
+
return {
|
|
1802
|
+
relativeDirPath: join13(".kilocode", "workflows")
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
toRulesyncCommand() {
|
|
1806
|
+
const rulesyncFrontmatter = {
|
|
1807
|
+
targets: ["*"],
|
|
1808
|
+
description: ""
|
|
1809
|
+
};
|
|
1810
|
+
return new RulesyncCommand({
|
|
1811
|
+
baseDir: process.cwd(),
|
|
1812
|
+
frontmatter: rulesyncFrontmatter,
|
|
1813
|
+
body: this.getFileContent(),
|
|
1814
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1815
|
+
relativeFilePath: this.relativeFilePath,
|
|
1816
|
+
fileContent: this.getFileContent(),
|
|
1817
|
+
validate: true
|
|
1818
|
+
});
|
|
1819
|
+
}
|
|
1820
|
+
static fromRulesyncCommand({
|
|
1821
|
+
baseDir = process.cwd(),
|
|
1822
|
+
rulesyncCommand,
|
|
1823
|
+
validate = true
|
|
1824
|
+
}) {
|
|
1825
|
+
const paths = this.getSettablePaths();
|
|
1826
|
+
return new _KiloCommand({
|
|
1827
|
+
baseDir,
|
|
1828
|
+
fileContent: rulesyncCommand.getBody(),
|
|
1829
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1830
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1831
|
+
validate
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
validate() {
|
|
1835
|
+
return { success: true, error: null };
|
|
1836
|
+
}
|
|
1837
|
+
getBody() {
|
|
1838
|
+
return this.getFileContent();
|
|
1839
|
+
}
|
|
1840
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1841
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1842
|
+
rulesyncCommand,
|
|
1843
|
+
toolTarget: "kilo"
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
static async fromFile({
|
|
1847
|
+
baseDir = process.cwd(),
|
|
1848
|
+
relativeFilePath,
|
|
1849
|
+
validate = true
|
|
1850
|
+
}) {
|
|
1851
|
+
const paths = this.getSettablePaths();
|
|
1852
|
+
const filePath = join13(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1853
|
+
const fileContent = await readFileContent(filePath);
|
|
1854
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
1855
|
+
return new _KiloCommand({
|
|
1856
|
+
baseDir,
|
|
1857
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1858
|
+
relativeFilePath: basename11(relativeFilePath),
|
|
1859
|
+
fileContent: content.trim(),
|
|
1860
|
+
validate
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
static forDeletion({
|
|
1864
|
+
baseDir = process.cwd(),
|
|
1865
|
+
relativeDirPath,
|
|
1866
|
+
relativeFilePath
|
|
1867
|
+
}) {
|
|
1868
|
+
return new _KiloCommand({
|
|
1869
|
+
baseDir,
|
|
1870
|
+
relativeDirPath,
|
|
1871
|
+
relativeFilePath,
|
|
1872
|
+
fileContent: "",
|
|
1873
|
+
validate: false
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1878
|
+
// src/features/commands/opencode-command.ts
|
|
1879
|
+
import { basename as basename12, join as join14 } from "path";
|
|
1798
1880
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
1799
1881
|
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
1800
1882
|
description: z10.string(),
|
|
@@ -1810,7 +1892,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1810
1892
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1811
1893
|
if (!result.success) {
|
|
1812
1894
|
throw new Error(
|
|
1813
|
-
`Invalid frontmatter in ${
|
|
1895
|
+
`Invalid frontmatter in ${join14(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1814
1896
|
);
|
|
1815
1897
|
}
|
|
1816
1898
|
}
|
|
@@ -1823,7 +1905,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1823
1905
|
}
|
|
1824
1906
|
static getSettablePaths({ global } = {}) {
|
|
1825
1907
|
return {
|
|
1826
|
-
relativeDirPath: global ?
|
|
1908
|
+
relativeDirPath: global ? join14(".config", "opencode", "command") : join14(".opencode", "command")
|
|
1827
1909
|
};
|
|
1828
1910
|
}
|
|
1829
1911
|
getBody() {
|
|
@@ -1884,7 +1966,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1884
1966
|
return {
|
|
1885
1967
|
success: false,
|
|
1886
1968
|
error: new Error(
|
|
1887
|
-
`Invalid frontmatter in ${
|
|
1969
|
+
`Invalid frontmatter in ${join14(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1888
1970
|
)
|
|
1889
1971
|
};
|
|
1890
1972
|
}
|
|
@@ -1895,7 +1977,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1895
1977
|
global = false
|
|
1896
1978
|
}) {
|
|
1897
1979
|
const paths = this.getSettablePaths({ global });
|
|
1898
|
-
const filePath =
|
|
1980
|
+
const filePath = join14(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1899
1981
|
const fileContent = await readFileContent(filePath);
|
|
1900
1982
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1901
1983
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1905,7 +1987,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1905
1987
|
return new _OpenCodeCommand({
|
|
1906
1988
|
baseDir,
|
|
1907
1989
|
relativeDirPath: paths.relativeDirPath,
|
|
1908
|
-
relativeFilePath:
|
|
1990
|
+
relativeFilePath: basename12(relativeFilePath),
|
|
1909
1991
|
frontmatter: result.data,
|
|
1910
1992
|
body: content.trim(),
|
|
1911
1993
|
validate
|
|
@@ -1934,7 +2016,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1934
2016
|
};
|
|
1935
2017
|
|
|
1936
2018
|
// src/features/commands/roo-command.ts
|
|
1937
|
-
import { basename as
|
|
2019
|
+
import { basename as basename13, join as join15 } from "path";
|
|
1938
2020
|
import { optional as optional3, z as z11 } from "zod/mini";
|
|
1939
2021
|
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
1940
2022
|
description: z11.string(),
|
|
@@ -1945,7 +2027,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1945
2027
|
body;
|
|
1946
2028
|
static getSettablePaths() {
|
|
1947
2029
|
return {
|
|
1948
|
-
relativeDirPath:
|
|
2030
|
+
relativeDirPath: join15(".roo", "commands")
|
|
1949
2031
|
};
|
|
1950
2032
|
}
|
|
1951
2033
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1953,7 +2035,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1953
2035
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1954
2036
|
if (!result.success) {
|
|
1955
2037
|
throw new Error(
|
|
1956
|
-
`Invalid frontmatter in ${
|
|
2038
|
+
`Invalid frontmatter in ${join15(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1957
2039
|
);
|
|
1958
2040
|
}
|
|
1959
2041
|
}
|
|
@@ -2024,7 +2106,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2024
2106
|
return {
|
|
2025
2107
|
success: false,
|
|
2026
2108
|
error: new Error(
|
|
2027
|
-
`Invalid frontmatter in ${
|
|
2109
|
+
`Invalid frontmatter in ${join15(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
2028
2110
|
)
|
|
2029
2111
|
};
|
|
2030
2112
|
}
|
|
@@ -2040,7 +2122,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2040
2122
|
relativeFilePath,
|
|
2041
2123
|
validate = true
|
|
2042
2124
|
}) {
|
|
2043
|
-
const filePath =
|
|
2125
|
+
const filePath = join15(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2044
2126
|
const fileContent = await readFileContent(filePath);
|
|
2045
2127
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2046
2128
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -2050,7 +2132,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2050
2132
|
return new _RooCommand({
|
|
2051
2133
|
baseDir,
|
|
2052
2134
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
2053
|
-
relativeFilePath:
|
|
2135
|
+
relativeFilePath: basename13(relativeFilePath),
|
|
2054
2136
|
frontmatter: result.data,
|
|
2055
2137
|
body: content.trim(),
|
|
2056
2138
|
fileContent,
|
|
@@ -2085,6 +2167,7 @@ var commandsProcessorToolTargetTuple = [
|
|
|
2085
2167
|
"copilot",
|
|
2086
2168
|
"cursor",
|
|
2087
2169
|
"geminicli",
|
|
2170
|
+
"kilo",
|
|
2088
2171
|
"opencode",
|
|
2089
2172
|
"roo"
|
|
2090
2173
|
];
|
|
@@ -2158,6 +2241,13 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2158
2241
|
meta: { extension: "toml", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2159
2242
|
}
|
|
2160
2243
|
],
|
|
2244
|
+
[
|
|
2245
|
+
"kilo",
|
|
2246
|
+
{
|
|
2247
|
+
class: KiloCommand,
|
|
2248
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2249
|
+
}
|
|
2250
|
+
],
|
|
2161
2251
|
[
|
|
2162
2252
|
"opencode",
|
|
2163
2253
|
{
|
|
@@ -2248,11 +2338,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2248
2338
|
*/
|
|
2249
2339
|
async loadRulesyncFiles() {
|
|
2250
2340
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2251
|
-
|
|
2341
|
+
join16(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2252
2342
|
);
|
|
2253
2343
|
const rulesyncCommands = await Promise.all(
|
|
2254
2344
|
rulesyncCommandPaths.map(
|
|
2255
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
2345
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: basename14(path3) })
|
|
2256
2346
|
)
|
|
2257
2347
|
);
|
|
2258
2348
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2268,14 +2358,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2268
2358
|
const factory = this.getFactory(this.toolTarget);
|
|
2269
2359
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2270
2360
|
const commandFilePaths = await findFilesByGlobs(
|
|
2271
|
-
|
|
2361
|
+
join16(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2272
2362
|
);
|
|
2273
2363
|
if (forDeletion) {
|
|
2274
2364
|
const toolCommands2 = commandFilePaths.map(
|
|
2275
2365
|
(path3) => factory.class.forDeletion({
|
|
2276
2366
|
baseDir: this.baseDir,
|
|
2277
2367
|
relativeDirPath: paths.relativeDirPath,
|
|
2278
|
-
relativeFilePath:
|
|
2368
|
+
relativeFilePath: basename14(path3),
|
|
2279
2369
|
global: this.global
|
|
2280
2370
|
})
|
|
2281
2371
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2286,7 +2376,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2286
2376
|
commandFilePaths.map(
|
|
2287
2377
|
(path3) => factory.class.fromFile({
|
|
2288
2378
|
baseDir: this.baseDir,
|
|
2289
|
-
relativeFilePath:
|
|
2379
|
+
relativeFilePath: basename14(path3),
|
|
2290
2380
|
global: this.global
|
|
2291
2381
|
})
|
|
2292
2382
|
)
|
|
@@ -2321,14 +2411,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2321
2411
|
import { z as z13 } from "zod/mini";
|
|
2322
2412
|
|
|
2323
2413
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2324
|
-
import { join as
|
|
2414
|
+
import { join as join18 } from "path";
|
|
2325
2415
|
|
|
2326
2416
|
// src/types/tool-file.ts
|
|
2327
2417
|
var ToolFile = class extends AiFile {
|
|
2328
2418
|
};
|
|
2329
2419
|
|
|
2330
2420
|
// src/features/ignore/rulesync-ignore.ts
|
|
2331
|
-
import { join as
|
|
2421
|
+
import { join as join17 } from "path";
|
|
2332
2422
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2333
2423
|
validate() {
|
|
2334
2424
|
return { success: true, error: null };
|
|
@@ -2348,12 +2438,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2348
2438
|
static async fromFile() {
|
|
2349
2439
|
const baseDir = process.cwd();
|
|
2350
2440
|
const paths = this.getSettablePaths();
|
|
2351
|
-
const recommendedPath =
|
|
2441
|
+
const recommendedPath = join17(
|
|
2352
2442
|
baseDir,
|
|
2353
2443
|
paths.recommended.relativeDirPath,
|
|
2354
2444
|
paths.recommended.relativeFilePath
|
|
2355
2445
|
);
|
|
2356
|
-
const legacyPath =
|
|
2446
|
+
const legacyPath = join17(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2357
2447
|
if (await fileExists(recommendedPath)) {
|
|
2358
2448
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2359
2449
|
return new _RulesyncIgnore({
|
|
@@ -2469,7 +2559,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2469
2559
|
validate = true
|
|
2470
2560
|
}) {
|
|
2471
2561
|
const fileContent = await readFileContent(
|
|
2472
|
-
|
|
2562
|
+
join18(
|
|
2473
2563
|
baseDir,
|
|
2474
2564
|
this.getSettablePaths().relativeDirPath,
|
|
2475
2565
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2499,7 +2589,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2499
2589
|
};
|
|
2500
2590
|
|
|
2501
2591
|
// src/features/ignore/claudecode-ignore.ts
|
|
2502
|
-
import { join as
|
|
2592
|
+
import { join as join19 } from "path";
|
|
2503
2593
|
import { uniq } from "es-toolkit";
|
|
2504
2594
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2505
2595
|
constructor(params) {
|
|
@@ -2542,7 +2632,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2542
2632
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2543
2633
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2544
2634
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2545
|
-
const filePath =
|
|
2635
|
+
const filePath = join19(
|
|
2546
2636
|
baseDir,
|
|
2547
2637
|
this.getSettablePaths().relativeDirPath,
|
|
2548
2638
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2578,7 +2668,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2578
2668
|
validate = true
|
|
2579
2669
|
}) {
|
|
2580
2670
|
const fileContent = await readFileContent(
|
|
2581
|
-
|
|
2671
|
+
join19(
|
|
2582
2672
|
baseDir,
|
|
2583
2673
|
this.getSettablePaths().relativeDirPath,
|
|
2584
2674
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2608,7 +2698,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2608
2698
|
};
|
|
2609
2699
|
|
|
2610
2700
|
// src/features/ignore/cline-ignore.ts
|
|
2611
|
-
import { join as
|
|
2701
|
+
import { join as join20 } from "path";
|
|
2612
2702
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2613
2703
|
static getSettablePaths() {
|
|
2614
2704
|
return {
|
|
@@ -2645,7 +2735,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2645
2735
|
validate = true
|
|
2646
2736
|
}) {
|
|
2647
2737
|
const fileContent = await readFileContent(
|
|
2648
|
-
|
|
2738
|
+
join20(
|
|
2649
2739
|
baseDir,
|
|
2650
2740
|
this.getSettablePaths().relativeDirPath,
|
|
2651
2741
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2675,7 +2765,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2675
2765
|
};
|
|
2676
2766
|
|
|
2677
2767
|
// src/features/ignore/cursor-ignore.ts
|
|
2678
|
-
import { join as
|
|
2768
|
+
import { join as join21 } from "path";
|
|
2679
2769
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2680
2770
|
static getSettablePaths() {
|
|
2681
2771
|
return {
|
|
@@ -2708,7 +2798,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2708
2798
|
validate = true
|
|
2709
2799
|
}) {
|
|
2710
2800
|
const fileContent = await readFileContent(
|
|
2711
|
-
|
|
2801
|
+
join21(
|
|
2712
2802
|
baseDir,
|
|
2713
2803
|
this.getSettablePaths().relativeDirPath,
|
|
2714
2804
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2738,7 +2828,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2738
2828
|
};
|
|
2739
2829
|
|
|
2740
2830
|
// src/features/ignore/geminicli-ignore.ts
|
|
2741
|
-
import { join as
|
|
2831
|
+
import { join as join22 } from "path";
|
|
2742
2832
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2743
2833
|
static getSettablePaths() {
|
|
2744
2834
|
return {
|
|
@@ -2765,7 +2855,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2765
2855
|
validate = true
|
|
2766
2856
|
}) {
|
|
2767
2857
|
const fileContent = await readFileContent(
|
|
2768
|
-
|
|
2858
|
+
join22(
|
|
2769
2859
|
baseDir,
|
|
2770
2860
|
this.getSettablePaths().relativeDirPath,
|
|
2771
2861
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2795,7 +2885,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2795
2885
|
};
|
|
2796
2886
|
|
|
2797
2887
|
// src/features/ignore/junie-ignore.ts
|
|
2798
|
-
import { join as
|
|
2888
|
+
import { join as join23 } from "path";
|
|
2799
2889
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2800
2890
|
static getSettablePaths() {
|
|
2801
2891
|
return {
|
|
@@ -2822,7 +2912,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2822
2912
|
validate = true
|
|
2823
2913
|
}) {
|
|
2824
2914
|
const fileContent = await readFileContent(
|
|
2825
|
-
|
|
2915
|
+
join23(
|
|
2826
2916
|
baseDir,
|
|
2827
2917
|
this.getSettablePaths().relativeDirPath,
|
|
2828
2918
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2851,8 +2941,75 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2851
2941
|
}
|
|
2852
2942
|
};
|
|
2853
2943
|
|
|
2944
|
+
// src/features/ignore/kilo-ignore.ts
|
|
2945
|
+
import { join as join24 } from "path";
|
|
2946
|
+
var KiloIgnore = class _KiloIgnore extends ToolIgnore {
|
|
2947
|
+
static getSettablePaths() {
|
|
2948
|
+
return {
|
|
2949
|
+
relativeDirPath: ".",
|
|
2950
|
+
relativeFilePath: ".kilocodeignore"
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
/**
|
|
2954
|
+
* Convert KiloIgnore to RulesyncIgnore format
|
|
2955
|
+
*/
|
|
2956
|
+
toRulesyncIgnore() {
|
|
2957
|
+
return this.toRulesyncIgnoreDefault();
|
|
2958
|
+
}
|
|
2959
|
+
/**
|
|
2960
|
+
* Create KiloIgnore from RulesyncIgnore
|
|
2961
|
+
*/
|
|
2962
|
+
static fromRulesyncIgnore({
|
|
2963
|
+
baseDir = process.cwd(),
|
|
2964
|
+
rulesyncIgnore
|
|
2965
|
+
}) {
|
|
2966
|
+
const body = rulesyncIgnore.getFileContent();
|
|
2967
|
+
return new _KiloIgnore({
|
|
2968
|
+
baseDir,
|
|
2969
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2970
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
2971
|
+
fileContent: body
|
|
2972
|
+
});
|
|
2973
|
+
}
|
|
2974
|
+
/**
|
|
2975
|
+
* Load KiloIgnore from .kilocodeignore file
|
|
2976
|
+
*/
|
|
2977
|
+
static async fromFile({
|
|
2978
|
+
baseDir = process.cwd(),
|
|
2979
|
+
validate = true
|
|
2980
|
+
}) {
|
|
2981
|
+
const fileContent = await readFileContent(
|
|
2982
|
+
join24(
|
|
2983
|
+
baseDir,
|
|
2984
|
+
this.getSettablePaths().relativeDirPath,
|
|
2985
|
+
this.getSettablePaths().relativeFilePath
|
|
2986
|
+
)
|
|
2987
|
+
);
|
|
2988
|
+
return new _KiloIgnore({
|
|
2989
|
+
baseDir,
|
|
2990
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2991
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
2992
|
+
fileContent,
|
|
2993
|
+
validate
|
|
2994
|
+
});
|
|
2995
|
+
}
|
|
2996
|
+
static forDeletion({
|
|
2997
|
+
baseDir = process.cwd(),
|
|
2998
|
+
relativeDirPath,
|
|
2999
|
+
relativeFilePath
|
|
3000
|
+
}) {
|
|
3001
|
+
return new _KiloIgnore({
|
|
3002
|
+
baseDir,
|
|
3003
|
+
relativeDirPath,
|
|
3004
|
+
relativeFilePath,
|
|
3005
|
+
fileContent: "",
|
|
3006
|
+
validate: false
|
|
3007
|
+
});
|
|
3008
|
+
}
|
|
3009
|
+
};
|
|
3010
|
+
|
|
2854
3011
|
// src/features/ignore/kiro-ignore.ts
|
|
2855
|
-
import { join as
|
|
3012
|
+
import { join as join25 } from "path";
|
|
2856
3013
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2857
3014
|
static getSettablePaths() {
|
|
2858
3015
|
return {
|
|
@@ -2879,7 +3036,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2879
3036
|
validate = true
|
|
2880
3037
|
}) {
|
|
2881
3038
|
const fileContent = await readFileContent(
|
|
2882
|
-
|
|
3039
|
+
join25(
|
|
2883
3040
|
baseDir,
|
|
2884
3041
|
this.getSettablePaths().relativeDirPath,
|
|
2885
3042
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2909,7 +3066,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2909
3066
|
};
|
|
2910
3067
|
|
|
2911
3068
|
// src/features/ignore/qwencode-ignore.ts
|
|
2912
|
-
import { join as
|
|
3069
|
+
import { join as join26 } from "path";
|
|
2913
3070
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2914
3071
|
static getSettablePaths() {
|
|
2915
3072
|
return {
|
|
@@ -2936,7 +3093,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2936
3093
|
validate = true
|
|
2937
3094
|
}) {
|
|
2938
3095
|
const fileContent = await readFileContent(
|
|
2939
|
-
|
|
3096
|
+
join26(
|
|
2940
3097
|
baseDir,
|
|
2941
3098
|
this.getSettablePaths().relativeDirPath,
|
|
2942
3099
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2966,7 +3123,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2966
3123
|
};
|
|
2967
3124
|
|
|
2968
3125
|
// src/features/ignore/roo-ignore.ts
|
|
2969
|
-
import { join as
|
|
3126
|
+
import { join as join27 } from "path";
|
|
2970
3127
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2971
3128
|
static getSettablePaths() {
|
|
2972
3129
|
return {
|
|
@@ -2993,7 +3150,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2993
3150
|
validate = true
|
|
2994
3151
|
}) {
|
|
2995
3152
|
const fileContent = await readFileContent(
|
|
2996
|
-
|
|
3153
|
+
join27(
|
|
2997
3154
|
baseDir,
|
|
2998
3155
|
this.getSettablePaths().relativeDirPath,
|
|
2999
3156
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3023,7 +3180,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
3023
3180
|
};
|
|
3024
3181
|
|
|
3025
3182
|
// src/features/ignore/windsurf-ignore.ts
|
|
3026
|
-
import { join as
|
|
3183
|
+
import { join as join28 } from "path";
|
|
3027
3184
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
3028
3185
|
static getSettablePaths() {
|
|
3029
3186
|
return {
|
|
@@ -3050,7 +3207,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3050
3207
|
validate = true
|
|
3051
3208
|
}) {
|
|
3052
3209
|
const fileContent = await readFileContent(
|
|
3053
|
-
|
|
3210
|
+
join28(
|
|
3054
3211
|
baseDir,
|
|
3055
3212
|
this.getSettablePaths().relativeDirPath,
|
|
3056
3213
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3088,6 +3245,7 @@ var ignoreProcessorToolTargets = [
|
|
|
3088
3245
|
"cursor",
|
|
3089
3246
|
"geminicli",
|
|
3090
3247
|
"junie",
|
|
3248
|
+
"kilo",
|
|
3091
3249
|
"kiro",
|
|
3092
3250
|
"qwencode",
|
|
3093
3251
|
"roo",
|
|
@@ -3102,6 +3260,7 @@ var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
|
3102
3260
|
["cursor", { class: CursorIgnore }],
|
|
3103
3261
|
["geminicli", { class: GeminiCliIgnore }],
|
|
3104
3262
|
["junie", { class: JunieIgnore }],
|
|
3263
|
+
["kilo", { class: KiloIgnore }],
|
|
3105
3264
|
["kiro", { class: KiroIgnore }],
|
|
3106
3265
|
["qwencode", { class: QwencodeIgnore }],
|
|
3107
3266
|
["roo", { class: RooIgnore }],
|
|
@@ -3228,10 +3387,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3228
3387
|
import { z as z18 } from "zod/mini";
|
|
3229
3388
|
|
|
3230
3389
|
// src/features/mcp/claudecode-mcp.ts
|
|
3231
|
-
import { join as
|
|
3390
|
+
import { join as join31 } from "path";
|
|
3232
3391
|
|
|
3233
3392
|
// src/features/mcp/modular-mcp.ts
|
|
3234
|
-
import { join as
|
|
3393
|
+
import { join as join29 } from "path";
|
|
3235
3394
|
import { z as z15 } from "zod/mini";
|
|
3236
3395
|
|
|
3237
3396
|
// src/types/mcp.ts
|
|
@@ -3319,7 +3478,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3319
3478
|
args: [
|
|
3320
3479
|
"-y",
|
|
3321
3480
|
"@kimuson/modular-mcp",
|
|
3322
|
-
|
|
3481
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3323
3482
|
],
|
|
3324
3483
|
env: {}
|
|
3325
3484
|
}
|
|
@@ -3356,7 +3515,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3356
3515
|
};
|
|
3357
3516
|
|
|
3358
3517
|
// src/features/mcp/rulesync-mcp.ts
|
|
3359
|
-
import { join as
|
|
3518
|
+
import { join as join30 } from "path";
|
|
3360
3519
|
import { omit } from "es-toolkit/object";
|
|
3361
3520
|
import { z as z16 } from "zod/mini";
|
|
3362
3521
|
var RulesyncMcpServerSchema = z16.union([
|
|
@@ -3413,12 +3572,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3413
3572
|
}) {
|
|
3414
3573
|
const baseDir = process.cwd();
|
|
3415
3574
|
const paths = this.getSettablePaths();
|
|
3416
|
-
const recommendedPath =
|
|
3575
|
+
const recommendedPath = join30(
|
|
3417
3576
|
baseDir,
|
|
3418
3577
|
paths.recommended.relativeDirPath,
|
|
3419
3578
|
paths.recommended.relativeFilePath
|
|
3420
3579
|
);
|
|
3421
|
-
const legacyPath =
|
|
3580
|
+
const legacyPath = join30(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3422
3581
|
if (await fileExists(recommendedPath)) {
|
|
3423
3582
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3424
3583
|
return new _RulesyncMcp({
|
|
@@ -3562,7 +3721,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3562
3721
|
}) {
|
|
3563
3722
|
const paths = this.getSettablePaths({ global });
|
|
3564
3723
|
const fileContent = await readOrInitializeFileContent(
|
|
3565
|
-
|
|
3724
|
+
join31(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3566
3725
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3567
3726
|
);
|
|
3568
3727
|
const json = JSON.parse(fileContent);
|
|
@@ -3584,7 +3743,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3584
3743
|
}) {
|
|
3585
3744
|
const paths = this.getSettablePaths({ global });
|
|
3586
3745
|
const fileContent = await readOrInitializeFileContent(
|
|
3587
|
-
|
|
3746
|
+
join31(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3588
3747
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3589
3748
|
);
|
|
3590
3749
|
const json = JSON.parse(fileContent);
|
|
@@ -3632,7 +3791,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3632
3791
|
};
|
|
3633
3792
|
|
|
3634
3793
|
// src/features/mcp/cline-mcp.ts
|
|
3635
|
-
import { join as
|
|
3794
|
+
import { join as join32 } from "path";
|
|
3636
3795
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3637
3796
|
json;
|
|
3638
3797
|
constructor(params) {
|
|
@@ -3653,7 +3812,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3653
3812
|
validate = true
|
|
3654
3813
|
}) {
|
|
3655
3814
|
const fileContent = await readFileContent(
|
|
3656
|
-
|
|
3815
|
+
join32(
|
|
3657
3816
|
baseDir,
|
|
3658
3817
|
this.getSettablePaths().relativeDirPath,
|
|
3659
3818
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3702,7 +3861,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3702
3861
|
};
|
|
3703
3862
|
|
|
3704
3863
|
// src/features/mcp/codexcli-mcp.ts
|
|
3705
|
-
import { join as
|
|
3864
|
+
import { join as join33 } from "path";
|
|
3706
3865
|
import * as smolToml from "smol-toml";
|
|
3707
3866
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3708
3867
|
toml;
|
|
@@ -3738,7 +3897,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3738
3897
|
}) {
|
|
3739
3898
|
const paths = this.getSettablePaths({ global });
|
|
3740
3899
|
const fileContent = await readFileContent(
|
|
3741
|
-
|
|
3900
|
+
join33(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3742
3901
|
);
|
|
3743
3902
|
return new _CodexcliMcp({
|
|
3744
3903
|
baseDir,
|
|
@@ -3755,7 +3914,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3755
3914
|
global = false
|
|
3756
3915
|
}) {
|
|
3757
3916
|
const paths = this.getSettablePaths({ global });
|
|
3758
|
-
const configTomlFilePath =
|
|
3917
|
+
const configTomlFilePath = join33(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3759
3918
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3760
3919
|
configTomlFilePath,
|
|
3761
3920
|
smolToml.stringify({})
|
|
@@ -3809,7 +3968,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3809
3968
|
};
|
|
3810
3969
|
|
|
3811
3970
|
// src/features/mcp/copilot-mcp.ts
|
|
3812
|
-
import { join as
|
|
3971
|
+
import { join as join34 } from "path";
|
|
3813
3972
|
function convertToCopilotFormat(mcpServers) {
|
|
3814
3973
|
return { servers: mcpServers };
|
|
3815
3974
|
}
|
|
@@ -3836,7 +3995,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3836
3995
|
validate = true
|
|
3837
3996
|
}) {
|
|
3838
3997
|
const fileContent = await readFileContent(
|
|
3839
|
-
|
|
3998
|
+
join34(
|
|
3840
3999
|
baseDir,
|
|
3841
4000
|
this.getSettablePaths().relativeDirPath,
|
|
3842
4001
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3889,7 +4048,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3889
4048
|
};
|
|
3890
4049
|
|
|
3891
4050
|
// src/features/mcp/cursor-mcp.ts
|
|
3892
|
-
import { join as
|
|
4051
|
+
import { join as join35 } from "path";
|
|
3893
4052
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3894
4053
|
json;
|
|
3895
4054
|
constructor(params) {
|
|
@@ -3910,7 +4069,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3910
4069
|
validate = true
|
|
3911
4070
|
}) {
|
|
3912
4071
|
const fileContent = await readFileContent(
|
|
3913
|
-
|
|
4072
|
+
join35(
|
|
3914
4073
|
baseDir,
|
|
3915
4074
|
this.getSettablePaths().relativeDirPath,
|
|
3916
4075
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3970,7 +4129,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3970
4129
|
};
|
|
3971
4130
|
|
|
3972
4131
|
// src/features/mcp/geminicli-mcp.ts
|
|
3973
|
-
import { join as
|
|
4132
|
+
import { join as join36 } from "path";
|
|
3974
4133
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
3975
4134
|
json;
|
|
3976
4135
|
constructor(params) {
|
|
@@ -3999,7 +4158,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3999
4158
|
}) {
|
|
4000
4159
|
const paths = this.getSettablePaths({ global });
|
|
4001
4160
|
const fileContent = await readOrInitializeFileContent(
|
|
4002
|
-
|
|
4161
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4003
4162
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4004
4163
|
);
|
|
4005
4164
|
const json = JSON.parse(fileContent);
|
|
@@ -4020,7 +4179,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4020
4179
|
}) {
|
|
4021
4180
|
const paths = this.getSettablePaths({ global });
|
|
4022
4181
|
const fileContent = await readOrInitializeFileContent(
|
|
4023
|
-
|
|
4182
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4024
4183
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4025
4184
|
);
|
|
4026
4185
|
const json = JSON.parse(fileContent);
|
|
@@ -4057,7 +4216,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4057
4216
|
};
|
|
4058
4217
|
|
|
4059
4218
|
// src/features/mcp/junie-mcp.ts
|
|
4060
|
-
import { join as
|
|
4219
|
+
import { join as join37 } from "path";
|
|
4061
4220
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4062
4221
|
json;
|
|
4063
4222
|
constructor(params) {
|
|
@@ -4069,7 +4228,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4069
4228
|
}
|
|
4070
4229
|
static getSettablePaths() {
|
|
4071
4230
|
return {
|
|
4072
|
-
relativeDirPath:
|
|
4231
|
+
relativeDirPath: join37(".junie", "mcp"),
|
|
4073
4232
|
relativeFilePath: "mcp.json"
|
|
4074
4233
|
};
|
|
4075
4234
|
}
|
|
@@ -4078,7 +4237,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4078
4237
|
validate = true
|
|
4079
4238
|
}) {
|
|
4080
4239
|
const fileContent = await readFileContent(
|
|
4081
|
-
|
|
4240
|
+
join37(
|
|
4082
4241
|
baseDir,
|
|
4083
4242
|
this.getSettablePaths().relativeDirPath,
|
|
4084
4243
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4126,8 +4285,84 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4126
4285
|
}
|
|
4127
4286
|
};
|
|
4128
4287
|
|
|
4288
|
+
// src/features/mcp/kilo-mcp.ts
|
|
4289
|
+
import { join as join38 } from "path";
|
|
4290
|
+
var KiloMcp = class _KiloMcp extends ToolMcp {
|
|
4291
|
+
json;
|
|
4292
|
+
constructor(params) {
|
|
4293
|
+
super(params);
|
|
4294
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
4295
|
+
}
|
|
4296
|
+
getJson() {
|
|
4297
|
+
return this.json;
|
|
4298
|
+
}
|
|
4299
|
+
static getSettablePaths() {
|
|
4300
|
+
return {
|
|
4301
|
+
relativeDirPath: ".kilocode",
|
|
4302
|
+
relativeFilePath: "mcp.json"
|
|
4303
|
+
};
|
|
4304
|
+
}
|
|
4305
|
+
static async fromFile({
|
|
4306
|
+
baseDir = process.cwd(),
|
|
4307
|
+
validate = true
|
|
4308
|
+
}) {
|
|
4309
|
+
const paths = this.getSettablePaths();
|
|
4310
|
+
const fileContent = await readOrInitializeFileContent(
|
|
4311
|
+
join38(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4312
|
+
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4313
|
+
);
|
|
4314
|
+
return new _KiloMcp({
|
|
4315
|
+
baseDir,
|
|
4316
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4317
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4318
|
+
fileContent,
|
|
4319
|
+
validate
|
|
4320
|
+
});
|
|
4321
|
+
}
|
|
4322
|
+
static fromRulesyncMcp({
|
|
4323
|
+
baseDir = process.cwd(),
|
|
4324
|
+
rulesyncMcp,
|
|
4325
|
+
validate = true
|
|
4326
|
+
}) {
|
|
4327
|
+
const paths = this.getSettablePaths();
|
|
4328
|
+
const fileContent = JSON.stringify(
|
|
4329
|
+
{ mcpServers: rulesyncMcp.getMcpServers({ type: "exposed" }) },
|
|
4330
|
+
null,
|
|
4331
|
+
2
|
|
4332
|
+
);
|
|
4333
|
+
return new _KiloMcp({
|
|
4334
|
+
baseDir,
|
|
4335
|
+
relativeDirPath: paths.relativeDirPath,
|
|
4336
|
+
relativeFilePath: paths.relativeFilePath,
|
|
4337
|
+
fileContent,
|
|
4338
|
+
validate
|
|
4339
|
+
});
|
|
4340
|
+
}
|
|
4341
|
+
toRulesyncMcp() {
|
|
4342
|
+
return this.toRulesyncMcpDefault({
|
|
4343
|
+
fileContent: JSON.stringify({ mcpServers: this.json.mcpServers ?? {} }, null, 2)
|
|
4344
|
+
});
|
|
4345
|
+
}
|
|
4346
|
+
validate() {
|
|
4347
|
+
return { success: true, error: null };
|
|
4348
|
+
}
|
|
4349
|
+
static forDeletion({
|
|
4350
|
+
baseDir = process.cwd(),
|
|
4351
|
+
relativeDirPath,
|
|
4352
|
+
relativeFilePath
|
|
4353
|
+
}) {
|
|
4354
|
+
return new _KiloMcp({
|
|
4355
|
+
baseDir,
|
|
4356
|
+
relativeDirPath,
|
|
4357
|
+
relativeFilePath,
|
|
4358
|
+
fileContent: "{}",
|
|
4359
|
+
validate: false
|
|
4360
|
+
});
|
|
4361
|
+
}
|
|
4362
|
+
};
|
|
4363
|
+
|
|
4129
4364
|
// src/features/mcp/opencode-mcp.ts
|
|
4130
|
-
import { join as
|
|
4365
|
+
import { join as join39 } from "path";
|
|
4131
4366
|
import { z as z17 } from "zod/mini";
|
|
4132
4367
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4133
4368
|
type: z17.literal("local"),
|
|
@@ -4251,7 +4486,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4251
4486
|
}) {
|
|
4252
4487
|
const paths = this.getSettablePaths({ global });
|
|
4253
4488
|
const fileContent = await readOrInitializeFileContent(
|
|
4254
|
-
|
|
4489
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4255
4490
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4256
4491
|
);
|
|
4257
4492
|
const json = JSON.parse(fileContent);
|
|
@@ -4272,7 +4507,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4272
4507
|
}) {
|
|
4273
4508
|
const paths = this.getSettablePaths({ global });
|
|
4274
4509
|
const fileContent = await readOrInitializeFileContent(
|
|
4275
|
-
|
|
4510
|
+
join39(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4276
4511
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4277
4512
|
);
|
|
4278
4513
|
const json = JSON.parse(fileContent);
|
|
@@ -4316,7 +4551,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4316
4551
|
};
|
|
4317
4552
|
|
|
4318
4553
|
// src/features/mcp/roo-mcp.ts
|
|
4319
|
-
import { join as
|
|
4554
|
+
import { join as join40 } from "path";
|
|
4320
4555
|
function isRooMcpServers(value) {
|
|
4321
4556
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4322
4557
|
}
|
|
@@ -4368,7 +4603,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4368
4603
|
validate = true
|
|
4369
4604
|
}) {
|
|
4370
4605
|
const fileContent = await readFileContent(
|
|
4371
|
-
|
|
4606
|
+
join40(
|
|
4372
4607
|
baseDir,
|
|
4373
4608
|
this.getSettablePaths().relativeDirPath,
|
|
4374
4609
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4432,6 +4667,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
4432
4667
|
"copilot",
|
|
4433
4668
|
"cursor",
|
|
4434
4669
|
"geminicli",
|
|
4670
|
+
"kilo",
|
|
4435
4671
|
"junie",
|
|
4436
4672
|
"opencode",
|
|
4437
4673
|
"roo"
|
|
@@ -4487,6 +4723,13 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
4487
4723
|
meta: { supportsProject: true, supportsGlobal: true, supportsModular: false }
|
|
4488
4724
|
}
|
|
4489
4725
|
],
|
|
4726
|
+
[
|
|
4727
|
+
"kilo",
|
|
4728
|
+
{
|
|
4729
|
+
class: KiloMcp,
|
|
4730
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4731
|
+
}
|
|
4732
|
+
],
|
|
4490
4733
|
[
|
|
4491
4734
|
"junie",
|
|
4492
4735
|
{
|
|
@@ -4666,25 +4909,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4666
4909
|
};
|
|
4667
4910
|
|
|
4668
4911
|
// src/features/rules/rules-processor.ts
|
|
4669
|
-
import { basename as
|
|
4912
|
+
import { basename as basename23, join as join88 } from "path";
|
|
4670
4913
|
import { encode } from "@toon-format/toon";
|
|
4671
|
-
import { z as
|
|
4914
|
+
import { z as z41 } from "zod/mini";
|
|
4672
4915
|
|
|
4673
4916
|
// src/constants/general.ts
|
|
4674
4917
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4675
4918
|
|
|
4676
4919
|
// src/features/skills/agentsmd-skill.ts
|
|
4677
|
-
import { join as
|
|
4920
|
+
import { join as join44 } from "path";
|
|
4678
4921
|
|
|
4679
4922
|
// src/features/skills/simulated-skill.ts
|
|
4680
|
-
import { join as
|
|
4923
|
+
import { join as join43 } from "path";
|
|
4681
4924
|
import { z as z19 } from "zod/mini";
|
|
4682
4925
|
|
|
4683
4926
|
// src/features/skills/tool-skill.ts
|
|
4684
|
-
import { join as
|
|
4927
|
+
import { join as join42 } from "path";
|
|
4685
4928
|
|
|
4686
4929
|
// src/types/ai-dir.ts
|
|
4687
|
-
import path2, { basename as
|
|
4930
|
+
import path2, { basename as basename15, join as join41, relative as relative3, resolve as resolve4 } from "path";
|
|
4688
4931
|
var AiDir = class {
|
|
4689
4932
|
/**
|
|
4690
4933
|
* @example "."
|
|
@@ -4778,10 +5021,10 @@ var AiDir = class {
|
|
|
4778
5021
|
* @returns Array of files with their relative paths and buffers
|
|
4779
5022
|
*/
|
|
4780
5023
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
4781
|
-
const dirPath =
|
|
4782
|
-
const glob =
|
|
5024
|
+
const dirPath = join41(baseDir, relativeDirPath, dirName);
|
|
5025
|
+
const glob = join41(dirPath, "**", "*");
|
|
4783
5026
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
4784
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
5027
|
+
const filteredPaths = filePaths.filter((filePath) => basename15(filePath) !== excludeFileName);
|
|
4785
5028
|
const files = await Promise.all(
|
|
4786
5029
|
filteredPaths.map(async (filePath) => {
|
|
4787
5030
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -4877,8 +5120,8 @@ var ToolSkill = class extends AiDir {
|
|
|
4877
5120
|
}) {
|
|
4878
5121
|
const settablePaths = getSettablePaths({ global });
|
|
4879
5122
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4880
|
-
const skillDirPath =
|
|
4881
|
-
const skillFilePath =
|
|
5123
|
+
const skillDirPath = join42(baseDir, actualRelativeDirPath, dirName);
|
|
5124
|
+
const skillFilePath = join42(skillDirPath, SKILL_FILE_NAME);
|
|
4882
5125
|
if (!await fileExists(skillFilePath)) {
|
|
4883
5126
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4884
5127
|
}
|
|
@@ -4936,7 +5179,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4936
5179
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4937
5180
|
if (!result.success) {
|
|
4938
5181
|
throw new Error(
|
|
4939
|
-
`Invalid frontmatter in ${
|
|
5182
|
+
`Invalid frontmatter in ${join43(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
4940
5183
|
);
|
|
4941
5184
|
}
|
|
4942
5185
|
}
|
|
@@ -4994,8 +5237,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4994
5237
|
}) {
|
|
4995
5238
|
const settablePaths = this.getSettablePaths();
|
|
4996
5239
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4997
|
-
const skillDirPath =
|
|
4998
|
-
const skillFilePath =
|
|
5240
|
+
const skillDirPath = join43(baseDir, actualRelativeDirPath, dirName);
|
|
5241
|
+
const skillFilePath = join43(skillDirPath, SKILL_FILE_NAME);
|
|
4999
5242
|
if (!await fileExists(skillFilePath)) {
|
|
5000
5243
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5001
5244
|
}
|
|
@@ -5072,7 +5315,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5072
5315
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5073
5316
|
}
|
|
5074
5317
|
return {
|
|
5075
|
-
relativeDirPath:
|
|
5318
|
+
relativeDirPath: join44(".agents", "skills")
|
|
5076
5319
|
};
|
|
5077
5320
|
}
|
|
5078
5321
|
static async fromDir(params) {
|
|
@@ -5099,14 +5342,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5099
5342
|
};
|
|
5100
5343
|
|
|
5101
5344
|
// src/features/skills/geminicli-skill.ts
|
|
5102
|
-
import { join as
|
|
5345
|
+
import { join as join45 } from "path";
|
|
5103
5346
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5104
5347
|
static getSettablePaths(options) {
|
|
5105
5348
|
if (options?.global) {
|
|
5106
5349
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5107
5350
|
}
|
|
5108
5351
|
return {
|
|
5109
|
-
relativeDirPath:
|
|
5352
|
+
relativeDirPath: join45(".gemini", "skills")
|
|
5110
5353
|
};
|
|
5111
5354
|
}
|
|
5112
5355
|
static async fromDir(params) {
|
|
@@ -5133,11 +5376,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5133
5376
|
};
|
|
5134
5377
|
|
|
5135
5378
|
// src/features/skills/skills-processor.ts
|
|
5136
|
-
import { basename as
|
|
5137
|
-
import { z as
|
|
5379
|
+
import { basename as basename16, join as join55 } from "path";
|
|
5380
|
+
import { z as z28 } from "zod/mini";
|
|
5138
5381
|
|
|
5139
5382
|
// src/types/dir-feature-processor.ts
|
|
5140
|
-
import { join as
|
|
5383
|
+
import { join as join46 } from "path";
|
|
5141
5384
|
var DirFeatureProcessor = class {
|
|
5142
5385
|
baseDir;
|
|
5143
5386
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5159,14 +5402,14 @@ var DirFeatureProcessor = class {
|
|
|
5159
5402
|
await ensureDir(dirPath);
|
|
5160
5403
|
const mainFile = aiDir.getMainFile();
|
|
5161
5404
|
if (mainFile) {
|
|
5162
|
-
const mainFilePath =
|
|
5405
|
+
const mainFilePath = join46(dirPath, mainFile.name);
|
|
5163
5406
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5164
5407
|
const contentWithNewline = addTrailingNewline(content);
|
|
5165
5408
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5166
5409
|
}
|
|
5167
5410
|
const otherFiles = aiDir.getOtherFiles();
|
|
5168
5411
|
for (const file of otherFiles) {
|
|
5169
|
-
const filePath =
|
|
5412
|
+
const filePath = join46(dirPath, file.relativeFilePathToDirPath);
|
|
5170
5413
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5171
5414
|
await writeFileContent(filePath, contentWithNewline);
|
|
5172
5415
|
}
|
|
@@ -5181,11 +5424,11 @@ var DirFeatureProcessor = class {
|
|
|
5181
5424
|
};
|
|
5182
5425
|
|
|
5183
5426
|
// src/features/skills/claudecode-skill.ts
|
|
5184
|
-
import { join as
|
|
5427
|
+
import { join as join48 } from "path";
|
|
5185
5428
|
import { z as z21 } from "zod/mini";
|
|
5186
5429
|
|
|
5187
5430
|
// src/features/skills/rulesync-skill.ts
|
|
5188
|
-
import { join as
|
|
5431
|
+
import { join as join47 } from "path";
|
|
5189
5432
|
import { z as z20 } from "zod/mini";
|
|
5190
5433
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5191
5434
|
name: z20.string(),
|
|
@@ -5272,8 +5515,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5272
5515
|
dirName,
|
|
5273
5516
|
global = false
|
|
5274
5517
|
}) {
|
|
5275
|
-
const skillDirPath =
|
|
5276
|
-
const skillFilePath =
|
|
5518
|
+
const skillDirPath = join47(baseDir, relativeDirPath, dirName);
|
|
5519
|
+
const skillFilePath = join47(skillDirPath, SKILL_FILE_NAME);
|
|
5277
5520
|
if (!await fileExists(skillFilePath)) {
|
|
5278
5521
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5279
5522
|
}
|
|
@@ -5311,7 +5554,7 @@ var ClaudecodeSkillFrontmatterSchema = z21.looseObject({
|
|
|
5311
5554
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5312
5555
|
constructor({
|
|
5313
5556
|
baseDir = process.cwd(),
|
|
5314
|
-
relativeDirPath =
|
|
5557
|
+
relativeDirPath = join48(".claude", "skills"),
|
|
5315
5558
|
dirName,
|
|
5316
5559
|
frontmatter,
|
|
5317
5560
|
body,
|
|
@@ -5342,7 +5585,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5342
5585
|
global: _global = false
|
|
5343
5586
|
} = {}) {
|
|
5344
5587
|
return {
|
|
5345
|
-
relativeDirPath:
|
|
5588
|
+
relativeDirPath: join48(".claude", "skills")
|
|
5346
5589
|
};
|
|
5347
5590
|
}
|
|
5348
5591
|
getFrontmatter() {
|
|
@@ -5430,9 +5673,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5430
5673
|
});
|
|
5431
5674
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5432
5675
|
if (!result.success) {
|
|
5433
|
-
const skillDirPath =
|
|
5676
|
+
const skillDirPath = join48(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5434
5677
|
throw new Error(
|
|
5435
|
-
`Invalid frontmatter in ${
|
|
5678
|
+
`Invalid frontmatter in ${join48(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5436
5679
|
);
|
|
5437
5680
|
}
|
|
5438
5681
|
return new _ClaudecodeSkill({
|
|
@@ -5466,7 +5709,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5466
5709
|
};
|
|
5467
5710
|
|
|
5468
5711
|
// src/features/skills/codexcli-skill.ts
|
|
5469
|
-
import { join as
|
|
5712
|
+
import { join as join49 } from "path";
|
|
5470
5713
|
import { z as z22 } from "zod/mini";
|
|
5471
5714
|
var CodexCliSkillFrontmatterSchema = z22.looseObject({
|
|
5472
5715
|
name: z22.string(),
|
|
@@ -5475,7 +5718,7 @@ var CodexCliSkillFrontmatterSchema = z22.looseObject({
|
|
|
5475
5718
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5476
5719
|
constructor({
|
|
5477
5720
|
baseDir = process.cwd(),
|
|
5478
|
-
relativeDirPath =
|
|
5721
|
+
relativeDirPath = join49(".codex", "skills"),
|
|
5479
5722
|
dirName,
|
|
5480
5723
|
frontmatter,
|
|
5481
5724
|
body,
|
|
@@ -5507,7 +5750,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5507
5750
|
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
5508
5751
|
}
|
|
5509
5752
|
return {
|
|
5510
|
-
relativeDirPath:
|
|
5753
|
+
relativeDirPath: join49(".codex", "skills")
|
|
5511
5754
|
};
|
|
5512
5755
|
}
|
|
5513
5756
|
getFrontmatter() {
|
|
@@ -5589,9 +5832,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5589
5832
|
});
|
|
5590
5833
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5591
5834
|
if (!result.success) {
|
|
5592
|
-
const skillDirPath =
|
|
5835
|
+
const skillDirPath = join49(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5593
5836
|
throw new Error(
|
|
5594
|
-
`Invalid frontmatter in ${
|
|
5837
|
+
`Invalid frontmatter in ${join49(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5595
5838
|
);
|
|
5596
5839
|
}
|
|
5597
5840
|
return new _CodexCliSkill({
|
|
@@ -5625,7 +5868,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5625
5868
|
};
|
|
5626
5869
|
|
|
5627
5870
|
// src/features/skills/copilot-skill.ts
|
|
5628
|
-
import { join as
|
|
5871
|
+
import { join as join50 } from "path";
|
|
5629
5872
|
import { z as z23 } from "zod/mini";
|
|
5630
5873
|
var CopilotSkillFrontmatterSchema = z23.looseObject({
|
|
5631
5874
|
name: z23.string(),
|
|
@@ -5635,7 +5878,7 @@ var CopilotSkillFrontmatterSchema = z23.looseObject({
|
|
|
5635
5878
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5636
5879
|
constructor({
|
|
5637
5880
|
baseDir = process.cwd(),
|
|
5638
|
-
relativeDirPath =
|
|
5881
|
+
relativeDirPath = join50(".github", "skills"),
|
|
5639
5882
|
dirName,
|
|
5640
5883
|
frontmatter,
|
|
5641
5884
|
body,
|
|
@@ -5667,7 +5910,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5667
5910
|
throw new Error("CopilotSkill does not support global mode.");
|
|
5668
5911
|
}
|
|
5669
5912
|
return {
|
|
5670
|
-
relativeDirPath:
|
|
5913
|
+
relativeDirPath: join50(".github", "skills")
|
|
5671
5914
|
};
|
|
5672
5915
|
}
|
|
5673
5916
|
getFrontmatter() {
|
|
@@ -5755,9 +5998,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5755
5998
|
});
|
|
5756
5999
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5757
6000
|
if (!result.success) {
|
|
5758
|
-
const skillDirPath =
|
|
6001
|
+
const skillDirPath = join50(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5759
6002
|
throw new Error(
|
|
5760
|
-
`Invalid frontmatter in ${
|
|
6003
|
+
`Invalid frontmatter in ${join50(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5761
6004
|
);
|
|
5762
6005
|
}
|
|
5763
6006
|
return new _CopilotSkill({
|
|
@@ -5791,17 +6034,177 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5791
6034
|
}
|
|
5792
6035
|
};
|
|
5793
6036
|
|
|
5794
|
-
// src/features/skills/cursor-skill.ts
|
|
5795
|
-
import { join as
|
|
5796
|
-
import { z as z24 } from "zod/mini";
|
|
5797
|
-
var CursorSkillFrontmatterSchema = z24.looseObject({
|
|
5798
|
-
name: z24.string(),
|
|
5799
|
-
description: z24.string()
|
|
6037
|
+
// src/features/skills/cursor-skill.ts
|
|
6038
|
+
import { join as join51 } from "path";
|
|
6039
|
+
import { z as z24 } from "zod/mini";
|
|
6040
|
+
var CursorSkillFrontmatterSchema = z24.looseObject({
|
|
6041
|
+
name: z24.string(),
|
|
6042
|
+
description: z24.string()
|
|
6043
|
+
});
|
|
6044
|
+
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
6045
|
+
constructor({
|
|
6046
|
+
baseDir = process.cwd(),
|
|
6047
|
+
relativeDirPath = join51(".cursor", "skills"),
|
|
6048
|
+
dirName,
|
|
6049
|
+
frontmatter,
|
|
6050
|
+
body,
|
|
6051
|
+
otherFiles = [],
|
|
6052
|
+
validate = true,
|
|
6053
|
+
global = false
|
|
6054
|
+
}) {
|
|
6055
|
+
super({
|
|
6056
|
+
baseDir,
|
|
6057
|
+
relativeDirPath,
|
|
6058
|
+
dirName,
|
|
6059
|
+
mainFile: {
|
|
6060
|
+
name: SKILL_FILE_NAME,
|
|
6061
|
+
body,
|
|
6062
|
+
frontmatter: { ...frontmatter }
|
|
6063
|
+
},
|
|
6064
|
+
otherFiles,
|
|
6065
|
+
global
|
|
6066
|
+
});
|
|
6067
|
+
if (validate) {
|
|
6068
|
+
const result = this.validate();
|
|
6069
|
+
if (!result.success) {
|
|
6070
|
+
throw result.error;
|
|
6071
|
+
}
|
|
6072
|
+
}
|
|
6073
|
+
}
|
|
6074
|
+
static getSettablePaths(options) {
|
|
6075
|
+
if (options?.global) {
|
|
6076
|
+
throw new Error("CursorSkill does not support global mode.");
|
|
6077
|
+
}
|
|
6078
|
+
return {
|
|
6079
|
+
relativeDirPath: join51(".cursor", "skills")
|
|
6080
|
+
};
|
|
6081
|
+
}
|
|
6082
|
+
getFrontmatter() {
|
|
6083
|
+
if (!this.mainFile?.frontmatter) {
|
|
6084
|
+
throw new Error("Frontmatter is not defined");
|
|
6085
|
+
}
|
|
6086
|
+
const result = CursorSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
6087
|
+
return result;
|
|
6088
|
+
}
|
|
6089
|
+
getBody() {
|
|
6090
|
+
return this.mainFile?.body ?? "";
|
|
6091
|
+
}
|
|
6092
|
+
validate() {
|
|
6093
|
+
if (!this.mainFile) {
|
|
6094
|
+
return {
|
|
6095
|
+
success: false,
|
|
6096
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
6097
|
+
};
|
|
6098
|
+
}
|
|
6099
|
+
const result = CursorSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
6100
|
+
if (!result.success) {
|
|
6101
|
+
return {
|
|
6102
|
+
success: false,
|
|
6103
|
+
error: new Error(
|
|
6104
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
6105
|
+
)
|
|
6106
|
+
};
|
|
6107
|
+
}
|
|
6108
|
+
return { success: true, error: null };
|
|
6109
|
+
}
|
|
6110
|
+
toRulesyncSkill() {
|
|
6111
|
+
const frontmatter = this.getFrontmatter();
|
|
6112
|
+
const rulesyncFrontmatter = {
|
|
6113
|
+
name: frontmatter.name,
|
|
6114
|
+
description: frontmatter.description,
|
|
6115
|
+
targets: ["*"]
|
|
6116
|
+
};
|
|
6117
|
+
return new RulesyncSkill({
|
|
6118
|
+
baseDir: this.baseDir,
|
|
6119
|
+
relativeDirPath: this.relativeDirPath,
|
|
6120
|
+
dirName: this.getDirName(),
|
|
6121
|
+
frontmatter: rulesyncFrontmatter,
|
|
6122
|
+
body: this.getBody(),
|
|
6123
|
+
otherFiles: this.getOtherFiles(),
|
|
6124
|
+
validate: true,
|
|
6125
|
+
global: this.global
|
|
6126
|
+
});
|
|
6127
|
+
}
|
|
6128
|
+
static fromRulesyncSkill({
|
|
6129
|
+
rulesyncSkill,
|
|
6130
|
+
validate = true,
|
|
6131
|
+
global = false
|
|
6132
|
+
}) {
|
|
6133
|
+
const settablePaths = _CursorSkill.getSettablePaths({ global });
|
|
6134
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
6135
|
+
const cursorFrontmatter = {
|
|
6136
|
+
name: rulesyncFrontmatter.name,
|
|
6137
|
+
description: rulesyncFrontmatter.description
|
|
6138
|
+
};
|
|
6139
|
+
return new _CursorSkill({
|
|
6140
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
6141
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
6142
|
+
dirName: rulesyncSkill.getDirName(),
|
|
6143
|
+
frontmatter: cursorFrontmatter,
|
|
6144
|
+
body: rulesyncSkill.getBody(),
|
|
6145
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
6146
|
+
validate,
|
|
6147
|
+
global
|
|
6148
|
+
});
|
|
6149
|
+
}
|
|
6150
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
6151
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
6152
|
+
return targets.includes("*") || targets.includes("cursor");
|
|
6153
|
+
}
|
|
6154
|
+
static async fromDir(params) {
|
|
6155
|
+
const loaded = await this.loadSkillDirContent({
|
|
6156
|
+
...params,
|
|
6157
|
+
getSettablePaths: _CursorSkill.getSettablePaths
|
|
6158
|
+
});
|
|
6159
|
+
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6160
|
+
if (!result.success) {
|
|
6161
|
+
const skillDirPath = join51(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6162
|
+
throw new Error(
|
|
6163
|
+
`Invalid frontmatter in ${join51(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6164
|
+
);
|
|
6165
|
+
}
|
|
6166
|
+
return new _CursorSkill({
|
|
6167
|
+
baseDir: loaded.baseDir,
|
|
6168
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
6169
|
+
dirName: loaded.dirName,
|
|
6170
|
+
frontmatter: result.data,
|
|
6171
|
+
body: loaded.body,
|
|
6172
|
+
otherFiles: loaded.otherFiles,
|
|
6173
|
+
validate: true,
|
|
6174
|
+
global: loaded.global
|
|
6175
|
+
});
|
|
6176
|
+
}
|
|
6177
|
+
static forDeletion({
|
|
6178
|
+
baseDir = process.cwd(),
|
|
6179
|
+
relativeDirPath,
|
|
6180
|
+
dirName,
|
|
6181
|
+
global = false
|
|
6182
|
+
}) {
|
|
6183
|
+
const settablePaths = _CursorSkill.getSettablePaths({ global });
|
|
6184
|
+
return new _CursorSkill({
|
|
6185
|
+
baseDir,
|
|
6186
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
6187
|
+
dirName,
|
|
6188
|
+
frontmatter: { name: "", description: "" },
|
|
6189
|
+
body: "",
|
|
6190
|
+
otherFiles: [],
|
|
6191
|
+
validate: false,
|
|
6192
|
+
global
|
|
6193
|
+
});
|
|
6194
|
+
}
|
|
6195
|
+
};
|
|
6196
|
+
|
|
6197
|
+
// src/features/skills/kilo-skill.ts
|
|
6198
|
+
import { join as join52 } from "path";
|
|
6199
|
+
import { z as z25 } from "zod/mini";
|
|
6200
|
+
var KiloSkillFrontmatterSchema = z25.looseObject({
|
|
6201
|
+
name: z25.string(),
|
|
6202
|
+
description: z25.string()
|
|
5800
6203
|
});
|
|
5801
|
-
var
|
|
6204
|
+
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
5802
6205
|
constructor({
|
|
5803
6206
|
baseDir = process.cwd(),
|
|
5804
|
-
relativeDirPath =
|
|
6207
|
+
relativeDirPath = join52(".kilocode", "skills"),
|
|
5805
6208
|
dirName,
|
|
5806
6209
|
frontmatter,
|
|
5807
6210
|
body,
|
|
@@ -5828,19 +6231,18 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5828
6231
|
}
|
|
5829
6232
|
}
|
|
5830
6233
|
}
|
|
5831
|
-
static getSettablePaths(
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
}
|
|
6234
|
+
static getSettablePaths({
|
|
6235
|
+
global: _global = false
|
|
6236
|
+
} = {}) {
|
|
5835
6237
|
return {
|
|
5836
|
-
relativeDirPath:
|
|
6238
|
+
relativeDirPath: join52(".kilocode", "skills")
|
|
5837
6239
|
};
|
|
5838
6240
|
}
|
|
5839
6241
|
getFrontmatter() {
|
|
5840
6242
|
if (!this.mainFile?.frontmatter) {
|
|
5841
6243
|
throw new Error("Frontmatter is not defined");
|
|
5842
6244
|
}
|
|
5843
|
-
const result =
|
|
6245
|
+
const result = KiloSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
5844
6246
|
return result;
|
|
5845
6247
|
}
|
|
5846
6248
|
getBody() {
|
|
@@ -5853,7 +6255,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5853
6255
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
5854
6256
|
};
|
|
5855
6257
|
}
|
|
5856
|
-
const result =
|
|
6258
|
+
const result = KiloSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
5857
6259
|
if (!result.success) {
|
|
5858
6260
|
return {
|
|
5859
6261
|
success: false,
|
|
@@ -5862,6 +6264,14 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5862
6264
|
)
|
|
5863
6265
|
};
|
|
5864
6266
|
}
|
|
6267
|
+
if (result.data.name !== this.getDirName()) {
|
|
6268
|
+
return {
|
|
6269
|
+
success: false,
|
|
6270
|
+
error: new Error(
|
|
6271
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
6272
|
+
)
|
|
6273
|
+
};
|
|
6274
|
+
}
|
|
5865
6275
|
return { success: true, error: null };
|
|
5866
6276
|
}
|
|
5867
6277
|
toRulesyncSkill() {
|
|
@@ -5887,17 +6297,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5887
6297
|
validate = true,
|
|
5888
6298
|
global = false
|
|
5889
6299
|
}) {
|
|
5890
|
-
const settablePaths =
|
|
6300
|
+
const settablePaths = _KiloSkill.getSettablePaths({ global });
|
|
5891
6301
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
5892
|
-
const
|
|
6302
|
+
const kiloFrontmatter = {
|
|
5893
6303
|
name: rulesyncFrontmatter.name,
|
|
5894
6304
|
description: rulesyncFrontmatter.description
|
|
5895
6305
|
};
|
|
5896
|
-
return new
|
|
6306
|
+
return new _KiloSkill({
|
|
5897
6307
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
5898
6308
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
5899
|
-
dirName:
|
|
5900
|
-
frontmatter:
|
|
6309
|
+
dirName: kiloFrontmatter.name,
|
|
6310
|
+
frontmatter: kiloFrontmatter,
|
|
5901
6311
|
body: rulesyncSkill.getBody(),
|
|
5902
6312
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
5903
6313
|
validate,
|
|
@@ -5906,21 +6316,32 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5906
6316
|
}
|
|
5907
6317
|
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
5908
6318
|
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
5909
|
-
return targets.includes("*") || targets.includes("
|
|
6319
|
+
return targets.includes("*") || targets.includes("kilo");
|
|
5910
6320
|
}
|
|
5911
6321
|
static async fromDir(params) {
|
|
5912
6322
|
const loaded = await this.loadSkillDirContent({
|
|
5913
6323
|
...params,
|
|
5914
|
-
getSettablePaths:
|
|
6324
|
+
getSettablePaths: _KiloSkill.getSettablePaths
|
|
5915
6325
|
});
|
|
5916
|
-
const result =
|
|
6326
|
+
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5917
6327
|
if (!result.success) {
|
|
5918
|
-
const skillDirPath =
|
|
6328
|
+
const skillDirPath = join52(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5919
6329
|
throw new Error(
|
|
5920
|
-
`Invalid frontmatter in ${
|
|
6330
|
+
`Invalid frontmatter in ${join52(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5921
6331
|
);
|
|
5922
6332
|
}
|
|
5923
|
-
|
|
6333
|
+
if (result.data.name !== loaded.dirName) {
|
|
6334
|
+
const skillFilePath = join52(
|
|
6335
|
+
loaded.baseDir,
|
|
6336
|
+
loaded.relativeDirPath,
|
|
6337
|
+
loaded.dirName,
|
|
6338
|
+
SKILL_FILE_NAME
|
|
6339
|
+
);
|
|
6340
|
+
throw new Error(
|
|
6341
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
6342
|
+
);
|
|
6343
|
+
}
|
|
6344
|
+
return new _KiloSkill({
|
|
5924
6345
|
baseDir: loaded.baseDir,
|
|
5925
6346
|
relativeDirPath: loaded.relativeDirPath,
|
|
5926
6347
|
dirName: loaded.dirName,
|
|
@@ -5937,10 +6358,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5937
6358
|
dirName,
|
|
5938
6359
|
global = false
|
|
5939
6360
|
}) {
|
|
5940
|
-
|
|
5941
|
-
return new _CursorSkill({
|
|
6361
|
+
return new _KiloSkill({
|
|
5942
6362
|
baseDir,
|
|
5943
|
-
relativeDirPath
|
|
6363
|
+
relativeDirPath,
|
|
5944
6364
|
dirName,
|
|
5945
6365
|
frontmatter: { name: "", description: "" },
|
|
5946
6366
|
body: "",
|
|
@@ -5952,17 +6372,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5952
6372
|
};
|
|
5953
6373
|
|
|
5954
6374
|
// src/features/skills/opencode-skill.ts
|
|
5955
|
-
import { join as
|
|
5956
|
-
import { z as
|
|
5957
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
5958
|
-
name:
|
|
5959
|
-
description:
|
|
5960
|
-
"allowed-tools":
|
|
6375
|
+
import { join as join53 } from "path";
|
|
6376
|
+
import { z as z26 } from "zod/mini";
|
|
6377
|
+
var OpenCodeSkillFrontmatterSchema = z26.looseObject({
|
|
6378
|
+
name: z26.string(),
|
|
6379
|
+
description: z26.string(),
|
|
6380
|
+
"allowed-tools": z26.optional(z26.array(z26.string()))
|
|
5961
6381
|
});
|
|
5962
6382
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
5963
6383
|
constructor({
|
|
5964
6384
|
baseDir = process.cwd(),
|
|
5965
|
-
relativeDirPath =
|
|
6385
|
+
relativeDirPath = join53(".opencode", "skill"),
|
|
5966
6386
|
dirName,
|
|
5967
6387
|
frontmatter,
|
|
5968
6388
|
body,
|
|
@@ -5991,7 +6411,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
5991
6411
|
}
|
|
5992
6412
|
static getSettablePaths({ global = false } = {}) {
|
|
5993
6413
|
return {
|
|
5994
|
-
relativeDirPath: global ?
|
|
6414
|
+
relativeDirPath: global ? join53(".config", "opencode", "skill") : join53(".opencode", "skill")
|
|
5995
6415
|
};
|
|
5996
6416
|
}
|
|
5997
6417
|
getFrontmatter() {
|
|
@@ -6079,9 +6499,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6079
6499
|
});
|
|
6080
6500
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6081
6501
|
if (!result.success) {
|
|
6082
|
-
const skillDirPath =
|
|
6502
|
+
const skillDirPath = join53(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6083
6503
|
throw new Error(
|
|
6084
|
-
`Invalid frontmatter in ${
|
|
6504
|
+
`Invalid frontmatter in ${join53(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6085
6505
|
);
|
|
6086
6506
|
}
|
|
6087
6507
|
return new _OpenCodeSkill({
|
|
@@ -6115,16 +6535,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6115
6535
|
};
|
|
6116
6536
|
|
|
6117
6537
|
// src/features/skills/roo-skill.ts
|
|
6118
|
-
import { join as
|
|
6119
|
-
import { z as
|
|
6120
|
-
var RooSkillFrontmatterSchema =
|
|
6121
|
-
name:
|
|
6122
|
-
description:
|
|
6538
|
+
import { join as join54 } from "path";
|
|
6539
|
+
import { z as z27 } from "zod/mini";
|
|
6540
|
+
var RooSkillFrontmatterSchema = z27.looseObject({
|
|
6541
|
+
name: z27.string(),
|
|
6542
|
+
description: z27.string()
|
|
6123
6543
|
});
|
|
6124
6544
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6125
6545
|
constructor({
|
|
6126
6546
|
baseDir = process.cwd(),
|
|
6127
|
-
relativeDirPath =
|
|
6547
|
+
relativeDirPath = join54(".roo", "skills"),
|
|
6128
6548
|
dirName,
|
|
6129
6549
|
frontmatter,
|
|
6130
6550
|
body,
|
|
@@ -6155,7 +6575,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6155
6575
|
global: _global = false
|
|
6156
6576
|
} = {}) {
|
|
6157
6577
|
return {
|
|
6158
|
-
relativeDirPath:
|
|
6578
|
+
relativeDirPath: join54(".roo", "skills")
|
|
6159
6579
|
};
|
|
6160
6580
|
}
|
|
6161
6581
|
getFrontmatter() {
|
|
@@ -6245,13 +6665,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
6245
6665
|
});
|
|
6246
6666
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6247
6667
|
if (!result.success) {
|
|
6248
|
-
const skillDirPath =
|
|
6668
|
+
const skillDirPath = join54(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6249
6669
|
throw new Error(
|
|
6250
|
-
`Invalid frontmatter in ${
|
|
6670
|
+
`Invalid frontmatter in ${join54(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6251
6671
|
);
|
|
6252
6672
|
}
|
|
6253
6673
|
if (result.data.name !== loaded.dirName) {
|
|
6254
|
-
const skillFilePath =
|
|
6674
|
+
const skillFilePath = join54(
|
|
6255
6675
|
loaded.baseDir,
|
|
6256
6676
|
loaded.relativeDirPath,
|
|
6257
6677
|
loaded.dirName,
|
|
@@ -6300,10 +6720,11 @@ var skillsProcessorToolTargetTuple = [
|
|
|
6300
6720
|
"copilot",
|
|
6301
6721
|
"cursor",
|
|
6302
6722
|
"geminicli",
|
|
6723
|
+
"kilo",
|
|
6303
6724
|
"opencode",
|
|
6304
6725
|
"roo"
|
|
6305
6726
|
];
|
|
6306
|
-
var SkillsProcessorToolTargetSchema =
|
|
6727
|
+
var SkillsProcessorToolTargetSchema = z28.enum(skillsProcessorToolTargetTuple);
|
|
6307
6728
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6308
6729
|
[
|
|
6309
6730
|
"agentsmd",
|
|
@@ -6354,6 +6775,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6354
6775
|
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
6355
6776
|
}
|
|
6356
6777
|
],
|
|
6778
|
+
[
|
|
6779
|
+
"kilo",
|
|
6780
|
+
{
|
|
6781
|
+
class: KiloSkill,
|
|
6782
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6783
|
+
}
|
|
6784
|
+
],
|
|
6357
6785
|
[
|
|
6358
6786
|
"opencode",
|
|
6359
6787
|
{
|
|
@@ -6446,9 +6874,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6446
6874
|
*/
|
|
6447
6875
|
async loadRulesyncDirs() {
|
|
6448
6876
|
const paths = RulesyncSkill.getSettablePaths();
|
|
6449
|
-
const rulesyncSkillsDirPath =
|
|
6450
|
-
const dirPaths = await findFilesByGlobs(
|
|
6451
|
-
const dirNames = dirPaths.map((path3) =>
|
|
6877
|
+
const rulesyncSkillsDirPath = join55(this.baseDir, paths.relativeDirPath);
|
|
6878
|
+
const dirPaths = await findFilesByGlobs(join55(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
6879
|
+
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6452
6880
|
const rulesyncSkills = await Promise.all(
|
|
6453
6881
|
dirNames.map(
|
|
6454
6882
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -6464,9 +6892,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6464
6892
|
async loadToolDirs() {
|
|
6465
6893
|
const factory = this.getFactory(this.toolTarget);
|
|
6466
6894
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6467
|
-
const skillsDirPath =
|
|
6468
|
-
const dirPaths = await findFilesByGlobs(
|
|
6469
|
-
const dirNames = dirPaths.map((path3) =>
|
|
6895
|
+
const skillsDirPath = join55(this.baseDir, paths.relativeDirPath);
|
|
6896
|
+
const dirPaths = await findFilesByGlobs(join55(skillsDirPath, "*"), { type: "dir" });
|
|
6897
|
+
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6470
6898
|
const toolSkills = await Promise.all(
|
|
6471
6899
|
dirNames.map(
|
|
6472
6900
|
(dirName) => factory.class.fromDir({
|
|
@@ -6482,9 +6910,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6482
6910
|
async loadToolDirsToDelete() {
|
|
6483
6911
|
const factory = this.getFactory(this.toolTarget);
|
|
6484
6912
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6485
|
-
const skillsDirPath =
|
|
6486
|
-
const dirPaths = await findFilesByGlobs(
|
|
6487
|
-
const dirNames = dirPaths.map((path3) =>
|
|
6913
|
+
const skillsDirPath = join55(this.baseDir, paths.relativeDirPath);
|
|
6914
|
+
const dirPaths = await findFilesByGlobs(join55(skillsDirPath, "*"), { type: "dir" });
|
|
6915
|
+
const dirNames = dirPaths.map((path3) => basename16(path3));
|
|
6488
6916
|
const toolSkills = dirNames.map(
|
|
6489
6917
|
(dirName) => factory.class.forDeletion({
|
|
6490
6918
|
baseDir: this.baseDir,
|
|
@@ -6532,11 +6960,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6532
6960
|
};
|
|
6533
6961
|
|
|
6534
6962
|
// src/features/subagents/agentsmd-subagent.ts
|
|
6535
|
-
import { join as
|
|
6963
|
+
import { join as join57 } from "path";
|
|
6536
6964
|
|
|
6537
6965
|
// src/features/subagents/simulated-subagent.ts
|
|
6538
|
-
import { basename as
|
|
6539
|
-
import { z as
|
|
6966
|
+
import { basename as basename17, join as join56 } from "path";
|
|
6967
|
+
import { z as z29 } from "zod/mini";
|
|
6540
6968
|
|
|
6541
6969
|
// src/features/subagents/tool-subagent.ts
|
|
6542
6970
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -6579,9 +7007,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
6579
7007
|
};
|
|
6580
7008
|
|
|
6581
7009
|
// src/features/subagents/simulated-subagent.ts
|
|
6582
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
6583
|
-
name:
|
|
6584
|
-
description:
|
|
7010
|
+
var SimulatedSubagentFrontmatterSchema = z29.object({
|
|
7011
|
+
name: z29.string(),
|
|
7012
|
+
description: z29.string()
|
|
6585
7013
|
});
|
|
6586
7014
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
6587
7015
|
frontmatter;
|
|
@@ -6591,7 +7019,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
6591
7019
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6592
7020
|
if (!result.success) {
|
|
6593
7021
|
throw new Error(
|
|
6594
|
-
`Invalid frontmatter in ${
|
|
7022
|
+
`Invalid frontmatter in ${join56(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6595
7023
|
);
|
|
6596
7024
|
}
|
|
6597
7025
|
}
|
|
@@ -6642,7 +7070,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
6642
7070
|
return {
|
|
6643
7071
|
success: false,
|
|
6644
7072
|
error: new Error(
|
|
6645
|
-
`Invalid frontmatter in ${
|
|
7073
|
+
`Invalid frontmatter in ${join56(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6646
7074
|
)
|
|
6647
7075
|
};
|
|
6648
7076
|
}
|
|
@@ -6652,7 +7080,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
6652
7080
|
relativeFilePath,
|
|
6653
7081
|
validate = true
|
|
6654
7082
|
}) {
|
|
6655
|
-
const filePath =
|
|
7083
|
+
const filePath = join56(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
6656
7084
|
const fileContent = await readFileContent(filePath);
|
|
6657
7085
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
6658
7086
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -6662,7 +7090,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
6662
7090
|
return {
|
|
6663
7091
|
baseDir,
|
|
6664
7092
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
6665
|
-
relativeFilePath:
|
|
7093
|
+
relativeFilePath: basename17(relativeFilePath),
|
|
6666
7094
|
frontmatter: result.data,
|
|
6667
7095
|
body: content.trim(),
|
|
6668
7096
|
validate
|
|
@@ -6688,7 +7116,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
6688
7116
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
6689
7117
|
static getSettablePaths() {
|
|
6690
7118
|
return {
|
|
6691
|
-
relativeDirPath:
|
|
7119
|
+
relativeDirPath: join57(".agents", "subagents")
|
|
6692
7120
|
};
|
|
6693
7121
|
}
|
|
6694
7122
|
static async fromFile(params) {
|
|
@@ -6711,11 +7139,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
6711
7139
|
};
|
|
6712
7140
|
|
|
6713
7141
|
// src/features/subagents/codexcli-subagent.ts
|
|
6714
|
-
import { join as
|
|
7142
|
+
import { join as join58 } from "path";
|
|
6715
7143
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
6716
7144
|
static getSettablePaths() {
|
|
6717
7145
|
return {
|
|
6718
|
-
relativeDirPath:
|
|
7146
|
+
relativeDirPath: join58(".codex", "subagents")
|
|
6719
7147
|
};
|
|
6720
7148
|
}
|
|
6721
7149
|
static async fromFile(params) {
|
|
@@ -6738,11 +7166,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
6738
7166
|
};
|
|
6739
7167
|
|
|
6740
7168
|
// src/features/subagents/cursor-subagent.ts
|
|
6741
|
-
import { join as
|
|
7169
|
+
import { join as join59 } from "path";
|
|
6742
7170
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
6743
7171
|
static getSettablePaths() {
|
|
6744
7172
|
return {
|
|
6745
|
-
relativeDirPath:
|
|
7173
|
+
relativeDirPath: join59(".cursor", "subagents")
|
|
6746
7174
|
};
|
|
6747
7175
|
}
|
|
6748
7176
|
static async fromFile(params) {
|
|
@@ -6765,11 +7193,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
6765
7193
|
};
|
|
6766
7194
|
|
|
6767
7195
|
// src/features/subagents/geminicli-subagent.ts
|
|
6768
|
-
import { join as
|
|
7196
|
+
import { join as join60 } from "path";
|
|
6769
7197
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
6770
7198
|
static getSettablePaths() {
|
|
6771
7199
|
return {
|
|
6772
|
-
relativeDirPath:
|
|
7200
|
+
relativeDirPath: join60(".gemini", "subagents")
|
|
6773
7201
|
};
|
|
6774
7202
|
}
|
|
6775
7203
|
static async fromFile(params) {
|
|
@@ -6792,11 +7220,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
6792
7220
|
};
|
|
6793
7221
|
|
|
6794
7222
|
// src/features/subagents/roo-subagent.ts
|
|
6795
|
-
import { join as
|
|
7223
|
+
import { join as join61 } from "path";
|
|
6796
7224
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
6797
7225
|
static getSettablePaths() {
|
|
6798
7226
|
return {
|
|
6799
|
-
relativeDirPath:
|
|
7227
|
+
relativeDirPath: join61(".roo", "subagents")
|
|
6800
7228
|
};
|
|
6801
7229
|
}
|
|
6802
7230
|
static async fromFile(params) {
|
|
@@ -6819,20 +7247,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
6819
7247
|
};
|
|
6820
7248
|
|
|
6821
7249
|
// src/features/subagents/subagents-processor.ts
|
|
6822
|
-
import { basename as
|
|
6823
|
-
import { z as
|
|
7250
|
+
import { basename as basename20, join as join66 } from "path";
|
|
7251
|
+
import { z as z34 } from "zod/mini";
|
|
6824
7252
|
|
|
6825
7253
|
// src/features/subagents/claudecode-subagent.ts
|
|
6826
|
-
import { join as
|
|
6827
|
-
import { z as
|
|
7254
|
+
import { join as join63 } from "path";
|
|
7255
|
+
import { z as z31 } from "zod/mini";
|
|
6828
7256
|
|
|
6829
7257
|
// src/features/subagents/rulesync-subagent.ts
|
|
6830
|
-
import { basename as
|
|
6831
|
-
import { z as
|
|
6832
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
7258
|
+
import { basename as basename18, join as join62 } from "path";
|
|
7259
|
+
import { z as z30 } from "zod/mini";
|
|
7260
|
+
var RulesyncSubagentFrontmatterSchema = z30.looseObject({
|
|
6833
7261
|
targets: RulesyncTargetsSchema,
|
|
6834
|
-
name:
|
|
6835
|
-
description:
|
|
7262
|
+
name: z30.string(),
|
|
7263
|
+
description: z30.string()
|
|
6836
7264
|
});
|
|
6837
7265
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
6838
7266
|
frontmatter;
|
|
@@ -6842,7 +7270,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6842
7270
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6843
7271
|
if (!result.success) {
|
|
6844
7272
|
throw new Error(
|
|
6845
|
-
`Invalid frontmatter in ${
|
|
7273
|
+
`Invalid frontmatter in ${join62(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6846
7274
|
);
|
|
6847
7275
|
}
|
|
6848
7276
|
}
|
|
@@ -6875,7 +7303,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6875
7303
|
return {
|
|
6876
7304
|
success: false,
|
|
6877
7305
|
error: new Error(
|
|
6878
|
-
`Invalid frontmatter in ${
|
|
7306
|
+
`Invalid frontmatter in ${join62(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6879
7307
|
)
|
|
6880
7308
|
};
|
|
6881
7309
|
}
|
|
@@ -6884,14 +7312,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6884
7312
|
relativeFilePath
|
|
6885
7313
|
}) {
|
|
6886
7314
|
const fileContent = await readFileContent(
|
|
6887
|
-
|
|
7315
|
+
join62(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
6888
7316
|
);
|
|
6889
7317
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
6890
7318
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6891
7319
|
if (!result.success) {
|
|
6892
7320
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
6893
7321
|
}
|
|
6894
|
-
const filename =
|
|
7322
|
+
const filename = basename18(relativeFilePath);
|
|
6895
7323
|
return new _RulesyncSubagent({
|
|
6896
7324
|
baseDir: process.cwd(),
|
|
6897
7325
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -6903,13 +7331,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6903
7331
|
};
|
|
6904
7332
|
|
|
6905
7333
|
// src/features/subagents/claudecode-subagent.ts
|
|
6906
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
6907
|
-
name:
|
|
6908
|
-
description:
|
|
6909
|
-
model:
|
|
6910
|
-
tools:
|
|
6911
|
-
permissionMode:
|
|
6912
|
-
skills:
|
|
7334
|
+
var ClaudecodeSubagentFrontmatterSchema = z31.looseObject({
|
|
7335
|
+
name: z31.string(),
|
|
7336
|
+
description: z31.string(),
|
|
7337
|
+
model: z31.optional(z31.string()),
|
|
7338
|
+
tools: z31.optional(z31.union([z31.string(), z31.array(z31.string())])),
|
|
7339
|
+
permissionMode: z31.optional(z31.string()),
|
|
7340
|
+
skills: z31.optional(z31.union([z31.string(), z31.array(z31.string())]))
|
|
6913
7341
|
});
|
|
6914
7342
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
6915
7343
|
frontmatter;
|
|
@@ -6919,7 +7347,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6919
7347
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
6920
7348
|
if (!result.success) {
|
|
6921
7349
|
throw new Error(
|
|
6922
|
-
`Invalid frontmatter in ${
|
|
7350
|
+
`Invalid frontmatter in ${join63(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6923
7351
|
);
|
|
6924
7352
|
}
|
|
6925
7353
|
}
|
|
@@ -6931,7 +7359,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6931
7359
|
}
|
|
6932
7360
|
static getSettablePaths(_options = {}) {
|
|
6933
7361
|
return {
|
|
6934
|
-
relativeDirPath:
|
|
7362
|
+
relativeDirPath: join63(".claude", "agents")
|
|
6935
7363
|
};
|
|
6936
7364
|
}
|
|
6937
7365
|
getFrontmatter() {
|
|
@@ -7005,7 +7433,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7005
7433
|
return {
|
|
7006
7434
|
success: false,
|
|
7007
7435
|
error: new Error(
|
|
7008
|
-
`Invalid frontmatter in ${
|
|
7436
|
+
`Invalid frontmatter in ${join63(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7009
7437
|
)
|
|
7010
7438
|
};
|
|
7011
7439
|
}
|
|
@@ -7023,7 +7451,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7023
7451
|
global = false
|
|
7024
7452
|
}) {
|
|
7025
7453
|
const paths = this.getSettablePaths({ global });
|
|
7026
|
-
const filePath =
|
|
7454
|
+
const filePath = join63(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7027
7455
|
const fileContent = await readFileContent(filePath);
|
|
7028
7456
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7029
7457
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7058,13 +7486,13 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
7058
7486
|
};
|
|
7059
7487
|
|
|
7060
7488
|
// src/features/subagents/copilot-subagent.ts
|
|
7061
|
-
import { join as
|
|
7062
|
-
import { z as
|
|
7489
|
+
import { join as join64 } from "path";
|
|
7490
|
+
import { z as z32 } from "zod/mini";
|
|
7063
7491
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
7064
|
-
var CopilotSubagentFrontmatterSchema =
|
|
7065
|
-
name:
|
|
7066
|
-
description:
|
|
7067
|
-
tools:
|
|
7492
|
+
var CopilotSubagentFrontmatterSchema = z32.looseObject({
|
|
7493
|
+
name: z32.string(),
|
|
7494
|
+
description: z32.string(),
|
|
7495
|
+
tools: z32.optional(z32.union([z32.string(), z32.array(z32.string())]))
|
|
7068
7496
|
});
|
|
7069
7497
|
var normalizeTools = (tools) => {
|
|
7070
7498
|
if (!tools) {
|
|
@@ -7084,7 +7512,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7084
7512
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7085
7513
|
if (!result.success) {
|
|
7086
7514
|
throw new Error(
|
|
7087
|
-
`Invalid frontmatter in ${
|
|
7515
|
+
`Invalid frontmatter in ${join64(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7088
7516
|
);
|
|
7089
7517
|
}
|
|
7090
7518
|
}
|
|
@@ -7096,7 +7524,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7096
7524
|
}
|
|
7097
7525
|
static getSettablePaths(_options = {}) {
|
|
7098
7526
|
return {
|
|
7099
|
-
relativeDirPath:
|
|
7527
|
+
relativeDirPath: join64(".github", "agents")
|
|
7100
7528
|
};
|
|
7101
7529
|
}
|
|
7102
7530
|
getFrontmatter() {
|
|
@@ -7170,7 +7598,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7170
7598
|
return {
|
|
7171
7599
|
success: false,
|
|
7172
7600
|
error: new Error(
|
|
7173
|
-
`Invalid frontmatter in ${
|
|
7601
|
+
`Invalid frontmatter in ${join64(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7174
7602
|
)
|
|
7175
7603
|
};
|
|
7176
7604
|
}
|
|
@@ -7188,7 +7616,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7188
7616
|
global = false
|
|
7189
7617
|
}) {
|
|
7190
7618
|
const paths = this.getSettablePaths({ global });
|
|
7191
|
-
const filePath =
|
|
7619
|
+
const filePath = join64(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7192
7620
|
const fileContent = await readFileContent(filePath);
|
|
7193
7621
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7194
7622
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7224,12 +7652,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7224
7652
|
};
|
|
7225
7653
|
|
|
7226
7654
|
// src/features/subagents/opencode-subagent.ts
|
|
7227
|
-
import { basename as
|
|
7228
|
-
import { z as
|
|
7229
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7230
|
-
description:
|
|
7231
|
-
mode:
|
|
7232
|
-
name:
|
|
7655
|
+
import { basename as basename19, join as join65 } from "path";
|
|
7656
|
+
import { z as z33 } from "zod/mini";
|
|
7657
|
+
var OpenCodeSubagentFrontmatterSchema = z33.looseObject({
|
|
7658
|
+
description: z33.string(),
|
|
7659
|
+
mode: z33.literal("subagent"),
|
|
7660
|
+
name: z33.optional(z33.string())
|
|
7233
7661
|
});
|
|
7234
7662
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7235
7663
|
frontmatter;
|
|
@@ -7239,7 +7667,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7239
7667
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
7240
7668
|
if (!result.success) {
|
|
7241
7669
|
throw new Error(
|
|
7242
|
-
`Invalid frontmatter in ${
|
|
7670
|
+
`Invalid frontmatter in ${join65(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7243
7671
|
);
|
|
7244
7672
|
}
|
|
7245
7673
|
}
|
|
@@ -7253,7 +7681,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7253
7681
|
global = false
|
|
7254
7682
|
} = {}) {
|
|
7255
7683
|
return {
|
|
7256
|
-
relativeDirPath: global ?
|
|
7684
|
+
relativeDirPath: global ? join65(".config", "opencode", "agent") : join65(".opencode", "agent")
|
|
7257
7685
|
};
|
|
7258
7686
|
}
|
|
7259
7687
|
getFrontmatter() {
|
|
@@ -7266,7 +7694,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7266
7694
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7267
7695
|
const rulesyncFrontmatter = {
|
|
7268
7696
|
targets: ["opencode"],
|
|
7269
|
-
name: name ??
|
|
7697
|
+
name: name ?? basename19(this.getRelativeFilePath(), ".md"),
|
|
7270
7698
|
description,
|
|
7271
7699
|
opencode: { mode, ...opencodeSection }
|
|
7272
7700
|
};
|
|
@@ -7319,7 +7747,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7319
7747
|
return {
|
|
7320
7748
|
success: false,
|
|
7321
7749
|
error: new Error(
|
|
7322
|
-
`Invalid frontmatter in ${
|
|
7750
|
+
`Invalid frontmatter in ${join65(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7323
7751
|
)
|
|
7324
7752
|
};
|
|
7325
7753
|
}
|
|
@@ -7336,7 +7764,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7336
7764
|
global = false
|
|
7337
7765
|
}) {
|
|
7338
7766
|
const paths = this.getSettablePaths({ global });
|
|
7339
|
-
const filePath =
|
|
7767
|
+
const filePath = join65(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
7340
7768
|
const fileContent = await readFileContent(filePath);
|
|
7341
7769
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
7342
7770
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -7383,7 +7811,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7383
7811
|
"opencode",
|
|
7384
7812
|
"roo"
|
|
7385
7813
|
];
|
|
7386
|
-
var SubagentsProcessorToolTargetSchema =
|
|
7814
|
+
var SubagentsProcessorToolTargetSchema = z34.enum(subagentsProcessorToolTargetTuple);
|
|
7387
7815
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7388
7816
|
[
|
|
7389
7817
|
"agentsmd",
|
|
@@ -7497,7 +7925,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7497
7925
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
7498
7926
|
*/
|
|
7499
7927
|
async loadRulesyncFiles() {
|
|
7500
|
-
const subagentsDir =
|
|
7928
|
+
const subagentsDir = join66(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
7501
7929
|
const dirExists = await directoryExists(subagentsDir);
|
|
7502
7930
|
if (!dirExists) {
|
|
7503
7931
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -7512,7 +7940,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7512
7940
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
7513
7941
|
const rulesyncSubagents = [];
|
|
7514
7942
|
for (const mdFile of mdFiles) {
|
|
7515
|
-
const filepath =
|
|
7943
|
+
const filepath = join66(subagentsDir, mdFile);
|
|
7516
7944
|
try {
|
|
7517
7945
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
7518
7946
|
relativeFilePath: mdFile,
|
|
@@ -7542,14 +7970,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7542
7970
|
const factory = this.getFactory(this.toolTarget);
|
|
7543
7971
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
7544
7972
|
const subagentFilePaths = await findFilesByGlobs(
|
|
7545
|
-
|
|
7973
|
+
join66(this.baseDir, paths.relativeDirPath, "*.md")
|
|
7546
7974
|
);
|
|
7547
7975
|
if (forDeletion) {
|
|
7548
7976
|
const toolSubagents2 = subagentFilePaths.map(
|
|
7549
7977
|
(path3) => factory.class.forDeletion({
|
|
7550
7978
|
baseDir: this.baseDir,
|
|
7551
7979
|
relativeDirPath: paths.relativeDirPath,
|
|
7552
|
-
relativeFilePath:
|
|
7980
|
+
relativeFilePath: basename20(path3),
|
|
7553
7981
|
global: this.global
|
|
7554
7982
|
})
|
|
7555
7983
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -7560,7 +7988,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7560
7988
|
subagentFilePaths.map(
|
|
7561
7989
|
(path3) => factory.class.fromFile({
|
|
7562
7990
|
baseDir: this.baseDir,
|
|
7563
|
-
relativeFilePath:
|
|
7991
|
+
relativeFilePath: basename20(path3),
|
|
7564
7992
|
global: this.global
|
|
7565
7993
|
})
|
|
7566
7994
|
)
|
|
@@ -7592,48 +8020,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7592
8020
|
};
|
|
7593
8021
|
|
|
7594
8022
|
// src/features/rules/agentsmd-rule.ts
|
|
7595
|
-
import { join as
|
|
8023
|
+
import { join as join69 } from "path";
|
|
7596
8024
|
|
|
7597
8025
|
// src/features/rules/tool-rule.ts
|
|
7598
|
-
import { join as
|
|
8026
|
+
import { join as join68 } from "path";
|
|
7599
8027
|
|
|
7600
8028
|
// src/features/rules/rulesync-rule.ts
|
|
7601
|
-
import { basename as
|
|
7602
|
-
import { z as
|
|
7603
|
-
var RulesyncRuleFrontmatterSchema =
|
|
7604
|
-
root:
|
|
7605
|
-
targets:
|
|
7606
|
-
description:
|
|
7607
|
-
globs:
|
|
7608
|
-
agentsmd:
|
|
7609
|
-
|
|
8029
|
+
import { basename as basename21, join as join67 } from "path";
|
|
8030
|
+
import { z as z35 } from "zod/mini";
|
|
8031
|
+
var RulesyncRuleFrontmatterSchema = z35.object({
|
|
8032
|
+
root: z35.optional(z35.optional(z35.boolean())),
|
|
8033
|
+
targets: z35.optional(RulesyncTargetsSchema),
|
|
8034
|
+
description: z35.optional(z35.string()),
|
|
8035
|
+
globs: z35.optional(z35.array(z35.string())),
|
|
8036
|
+
agentsmd: z35.optional(
|
|
8037
|
+
z35.object({
|
|
7610
8038
|
// @example "path/to/subproject"
|
|
7611
|
-
subprojectPath:
|
|
8039
|
+
subprojectPath: z35.optional(z35.string())
|
|
7612
8040
|
})
|
|
7613
8041
|
),
|
|
7614
|
-
claudecode:
|
|
7615
|
-
|
|
8042
|
+
claudecode: z35.optional(
|
|
8043
|
+
z35.object({
|
|
7616
8044
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
7617
8045
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
7618
|
-
paths:
|
|
8046
|
+
paths: z35.optional(z35.string())
|
|
7619
8047
|
})
|
|
7620
8048
|
),
|
|
7621
|
-
cursor:
|
|
7622
|
-
|
|
7623
|
-
alwaysApply:
|
|
7624
|
-
description:
|
|
7625
|
-
globs:
|
|
8049
|
+
cursor: z35.optional(
|
|
8050
|
+
z35.object({
|
|
8051
|
+
alwaysApply: z35.optional(z35.boolean()),
|
|
8052
|
+
description: z35.optional(z35.string()),
|
|
8053
|
+
globs: z35.optional(z35.array(z35.string()))
|
|
7626
8054
|
})
|
|
7627
8055
|
),
|
|
7628
|
-
copilot:
|
|
7629
|
-
|
|
7630
|
-
excludeAgent:
|
|
8056
|
+
copilot: z35.optional(
|
|
8057
|
+
z35.object({
|
|
8058
|
+
excludeAgent: z35.optional(z35.union([z35.literal("code-review"), z35.literal("coding-agent")]))
|
|
7631
8059
|
})
|
|
7632
8060
|
),
|
|
7633
|
-
antigravity:
|
|
7634
|
-
|
|
7635
|
-
trigger:
|
|
7636
|
-
globs:
|
|
8061
|
+
antigravity: z35.optional(
|
|
8062
|
+
z35.looseObject({
|
|
8063
|
+
trigger: z35.optional(z35.string()),
|
|
8064
|
+
globs: z35.optional(z35.array(z35.string()))
|
|
7637
8065
|
})
|
|
7638
8066
|
)
|
|
7639
8067
|
});
|
|
@@ -7645,7 +8073,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7645
8073
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7646
8074
|
if (!result.success) {
|
|
7647
8075
|
throw new Error(
|
|
7648
|
-
`Invalid frontmatter in ${
|
|
8076
|
+
`Invalid frontmatter in ${join67(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7649
8077
|
);
|
|
7650
8078
|
}
|
|
7651
8079
|
}
|
|
@@ -7680,7 +8108,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7680
8108
|
return {
|
|
7681
8109
|
success: false,
|
|
7682
8110
|
error: new Error(
|
|
7683
|
-
`Invalid frontmatter in ${
|
|
8111
|
+
`Invalid frontmatter in ${join67(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7684
8112
|
)
|
|
7685
8113
|
};
|
|
7686
8114
|
}
|
|
@@ -7689,12 +8117,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7689
8117
|
relativeFilePath,
|
|
7690
8118
|
validate = true
|
|
7691
8119
|
}) {
|
|
7692
|
-
const legacyPath =
|
|
8120
|
+
const legacyPath = join67(
|
|
7693
8121
|
process.cwd(),
|
|
7694
8122
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
7695
8123
|
relativeFilePath
|
|
7696
8124
|
);
|
|
7697
|
-
const recommendedPath =
|
|
8125
|
+
const recommendedPath = join67(
|
|
7698
8126
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
7699
8127
|
relativeFilePath
|
|
7700
8128
|
);
|
|
@@ -7713,7 +8141,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7713
8141
|
agentsmd: result.data.agentsmd,
|
|
7714
8142
|
cursor: result.data.cursor
|
|
7715
8143
|
};
|
|
7716
|
-
const filename =
|
|
8144
|
+
const filename = basename21(legacyPath);
|
|
7717
8145
|
return new _RulesyncRule({
|
|
7718
8146
|
baseDir: process.cwd(),
|
|
7719
8147
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -7727,7 +8155,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7727
8155
|
relativeFilePath,
|
|
7728
8156
|
validate = true
|
|
7729
8157
|
}) {
|
|
7730
|
-
const filePath =
|
|
8158
|
+
const filePath = join67(
|
|
7731
8159
|
process.cwd(),
|
|
7732
8160
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
7733
8161
|
relativeFilePath
|
|
@@ -7746,7 +8174,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7746
8174
|
agentsmd: result.data.agentsmd,
|
|
7747
8175
|
cursor: result.data.cursor
|
|
7748
8176
|
};
|
|
7749
|
-
const filename =
|
|
8177
|
+
const filename = basename21(filePath);
|
|
7750
8178
|
return new _RulesyncRule({
|
|
7751
8179
|
baseDir: process.cwd(),
|
|
7752
8180
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -7829,7 +8257,7 @@ var ToolRule = class extends ToolFile {
|
|
|
7829
8257
|
rulesyncRule,
|
|
7830
8258
|
validate = true,
|
|
7831
8259
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
7832
|
-
nonRootPath = { relativeDirPath:
|
|
8260
|
+
nonRootPath = { relativeDirPath: join68(".agents", "memories") }
|
|
7833
8261
|
}) {
|
|
7834
8262
|
const params = this.buildToolRuleParamsDefault({
|
|
7835
8263
|
baseDir,
|
|
@@ -7840,7 +8268,7 @@ var ToolRule = class extends ToolFile {
|
|
|
7840
8268
|
});
|
|
7841
8269
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
7842
8270
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
7843
|
-
params.relativeDirPath =
|
|
8271
|
+
params.relativeDirPath = join68(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
7844
8272
|
params.relativeFilePath = "AGENTS.md";
|
|
7845
8273
|
}
|
|
7846
8274
|
return params;
|
|
@@ -7905,7 +8333,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7905
8333
|
relativeFilePath: "AGENTS.md"
|
|
7906
8334
|
},
|
|
7907
8335
|
nonRoot: {
|
|
7908
|
-
relativeDirPath:
|
|
8336
|
+
relativeDirPath: join69(".agents", "memories")
|
|
7909
8337
|
}
|
|
7910
8338
|
};
|
|
7911
8339
|
}
|
|
@@ -7915,8 +8343,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7915
8343
|
validate = true
|
|
7916
8344
|
}) {
|
|
7917
8345
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7918
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
7919
|
-
const fileContent = await readFileContent(
|
|
8346
|
+
const relativePath = isRoot ? "AGENTS.md" : join69(".agents", "memories", relativeFilePath);
|
|
8347
|
+
const fileContent = await readFileContent(join69(baseDir, relativePath));
|
|
7920
8348
|
return new _AgentsMdRule({
|
|
7921
8349
|
baseDir,
|
|
7922
8350
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7971,21 +8399,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7971
8399
|
};
|
|
7972
8400
|
|
|
7973
8401
|
// src/features/rules/antigravity-rule.ts
|
|
7974
|
-
import { join as
|
|
7975
|
-
import { z as
|
|
7976
|
-
var AntigravityRuleFrontmatterSchema =
|
|
7977
|
-
trigger:
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
8402
|
+
import { join as join70 } from "path";
|
|
8403
|
+
import { z as z36 } from "zod/mini";
|
|
8404
|
+
var AntigravityRuleFrontmatterSchema = z36.looseObject({
|
|
8405
|
+
trigger: z36.optional(
|
|
8406
|
+
z36.union([
|
|
8407
|
+
z36.literal("always_on"),
|
|
8408
|
+
z36.literal("glob"),
|
|
8409
|
+
z36.literal("manual"),
|
|
8410
|
+
z36.literal("model_decision"),
|
|
8411
|
+
z36.string()
|
|
7984
8412
|
// accepts any string for forward compatibility
|
|
7985
8413
|
])
|
|
7986
8414
|
),
|
|
7987
|
-
globs:
|
|
7988
|
-
description:
|
|
8415
|
+
globs: z36.optional(z36.string()),
|
|
8416
|
+
description: z36.optional(z36.string())
|
|
7989
8417
|
});
|
|
7990
8418
|
function parseGlobsString(globs) {
|
|
7991
8419
|
if (!globs) {
|
|
@@ -8130,7 +8558,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8130
8558
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8131
8559
|
if (!result.success) {
|
|
8132
8560
|
throw new Error(
|
|
8133
|
-
`Invalid frontmatter in ${
|
|
8561
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8134
8562
|
);
|
|
8135
8563
|
}
|
|
8136
8564
|
}
|
|
@@ -8145,7 +8573,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8145
8573
|
static getSettablePaths() {
|
|
8146
8574
|
return {
|
|
8147
8575
|
nonRoot: {
|
|
8148
|
-
relativeDirPath:
|
|
8576
|
+
relativeDirPath: join70(".agent", "rules")
|
|
8149
8577
|
}
|
|
8150
8578
|
};
|
|
8151
8579
|
}
|
|
@@ -8154,7 +8582,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8154
8582
|
relativeFilePath,
|
|
8155
8583
|
validate = true
|
|
8156
8584
|
}) {
|
|
8157
|
-
const filePath =
|
|
8585
|
+
const filePath = join70(
|
|
8158
8586
|
baseDir,
|
|
8159
8587
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8160
8588
|
relativeFilePath
|
|
@@ -8295,7 +8723,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8295
8723
|
};
|
|
8296
8724
|
|
|
8297
8725
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8298
|
-
import { join as
|
|
8726
|
+
import { join as join71 } from "path";
|
|
8299
8727
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8300
8728
|
toRulesyncRule() {
|
|
8301
8729
|
const rulesyncFrontmatter = {
|
|
@@ -8321,7 +8749,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8321
8749
|
relativeFilePath: ".augment-guidelines"
|
|
8322
8750
|
},
|
|
8323
8751
|
nonRoot: {
|
|
8324
|
-
relativeDirPath:
|
|
8752
|
+
relativeDirPath: join71(".augment", "rules")
|
|
8325
8753
|
}
|
|
8326
8754
|
};
|
|
8327
8755
|
}
|
|
@@ -8356,8 +8784,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8356
8784
|
}) {
|
|
8357
8785
|
const settablePaths = this.getSettablePaths();
|
|
8358
8786
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8359
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
8360
|
-
const fileContent = await readFileContent(
|
|
8787
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join71(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8788
|
+
const fileContent = await readFileContent(join71(baseDir, relativePath));
|
|
8361
8789
|
return new _AugmentcodeLegacyRule({
|
|
8362
8790
|
baseDir,
|
|
8363
8791
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8386,7 +8814,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8386
8814
|
};
|
|
8387
8815
|
|
|
8388
8816
|
// src/features/rules/augmentcode-rule.ts
|
|
8389
|
-
import { join as
|
|
8817
|
+
import { join as join72 } from "path";
|
|
8390
8818
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8391
8819
|
toRulesyncRule() {
|
|
8392
8820
|
return this.toRulesyncRuleDefault();
|
|
@@ -8394,7 +8822,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8394
8822
|
static getSettablePaths() {
|
|
8395
8823
|
return {
|
|
8396
8824
|
nonRoot: {
|
|
8397
|
-
relativeDirPath:
|
|
8825
|
+
relativeDirPath: join72(".augment", "rules")
|
|
8398
8826
|
}
|
|
8399
8827
|
};
|
|
8400
8828
|
}
|
|
@@ -8418,7 +8846,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8418
8846
|
validate = true
|
|
8419
8847
|
}) {
|
|
8420
8848
|
const fileContent = await readFileContent(
|
|
8421
|
-
|
|
8849
|
+
join72(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8422
8850
|
);
|
|
8423
8851
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8424
8852
|
return new _AugmentcodeRule({
|
|
@@ -8454,7 +8882,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8454
8882
|
};
|
|
8455
8883
|
|
|
8456
8884
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8457
|
-
import { join as
|
|
8885
|
+
import { join as join73 } from "path";
|
|
8458
8886
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8459
8887
|
static getSettablePaths({
|
|
8460
8888
|
global
|
|
@@ -8473,7 +8901,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8473
8901
|
relativeFilePath: "CLAUDE.md"
|
|
8474
8902
|
},
|
|
8475
8903
|
nonRoot: {
|
|
8476
|
-
relativeDirPath:
|
|
8904
|
+
relativeDirPath: join73(".claude", "memories")
|
|
8477
8905
|
}
|
|
8478
8906
|
};
|
|
8479
8907
|
}
|
|
@@ -8488,7 +8916,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8488
8916
|
if (isRoot) {
|
|
8489
8917
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8490
8918
|
const fileContent2 = await readFileContent(
|
|
8491
|
-
|
|
8919
|
+
join73(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8492
8920
|
);
|
|
8493
8921
|
return new _ClaudecodeLegacyRule({
|
|
8494
8922
|
baseDir,
|
|
@@ -8502,8 +8930,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8502
8930
|
if (!paths.nonRoot) {
|
|
8503
8931
|
throw new Error("nonRoot path is not set");
|
|
8504
8932
|
}
|
|
8505
|
-
const relativePath =
|
|
8506
|
-
const fileContent = await readFileContent(
|
|
8933
|
+
const relativePath = join73(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8934
|
+
const fileContent = await readFileContent(join73(baseDir, relativePath));
|
|
8507
8935
|
return new _ClaudecodeLegacyRule({
|
|
8508
8936
|
baseDir,
|
|
8509
8937
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8562,10 +8990,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8562
8990
|
};
|
|
8563
8991
|
|
|
8564
8992
|
// src/features/rules/claudecode-rule.ts
|
|
8565
|
-
import { join as
|
|
8566
|
-
import { z as
|
|
8567
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
8568
|
-
paths:
|
|
8993
|
+
import { join as join74 } from "path";
|
|
8994
|
+
import { z as z37 } from "zod/mini";
|
|
8995
|
+
var ClaudecodeRuleFrontmatterSchema = z37.object({
|
|
8996
|
+
paths: z37.optional(z37.string())
|
|
8569
8997
|
});
|
|
8570
8998
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
8571
8999
|
frontmatter;
|
|
@@ -8587,7 +9015,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8587
9015
|
relativeFilePath: "CLAUDE.md"
|
|
8588
9016
|
},
|
|
8589
9017
|
nonRoot: {
|
|
8590
|
-
relativeDirPath:
|
|
9018
|
+
relativeDirPath: join74(".claude", "rules")
|
|
8591
9019
|
}
|
|
8592
9020
|
};
|
|
8593
9021
|
}
|
|
@@ -8596,7 +9024,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8596
9024
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8597
9025
|
if (!result.success) {
|
|
8598
9026
|
throw new Error(
|
|
8599
|
-
`Invalid frontmatter in ${
|
|
9027
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8600
9028
|
);
|
|
8601
9029
|
}
|
|
8602
9030
|
}
|
|
@@ -8624,7 +9052,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8624
9052
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8625
9053
|
if (isRoot) {
|
|
8626
9054
|
const fileContent2 = await readFileContent(
|
|
8627
|
-
|
|
9055
|
+
join74(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
8628
9056
|
);
|
|
8629
9057
|
return new _ClaudecodeRule({
|
|
8630
9058
|
baseDir,
|
|
@@ -8639,13 +9067,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8639
9067
|
if (!paths.nonRoot) {
|
|
8640
9068
|
throw new Error("nonRoot path is not set");
|
|
8641
9069
|
}
|
|
8642
|
-
const relativePath =
|
|
8643
|
-
const fileContent = await readFileContent(
|
|
9070
|
+
const relativePath = join74(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9071
|
+
const fileContent = await readFileContent(join74(baseDir, relativePath));
|
|
8644
9072
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8645
9073
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8646
9074
|
if (!result.success) {
|
|
8647
9075
|
throw new Error(
|
|
8648
|
-
`Invalid frontmatter in ${
|
|
9076
|
+
`Invalid frontmatter in ${join74(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
8649
9077
|
);
|
|
8650
9078
|
}
|
|
8651
9079
|
return new _ClaudecodeRule({
|
|
@@ -8752,7 +9180,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8752
9180
|
return {
|
|
8753
9181
|
success: false,
|
|
8754
9182
|
error: new Error(
|
|
8755
|
-
`Invalid frontmatter in ${
|
|
9183
|
+
`Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8756
9184
|
)
|
|
8757
9185
|
};
|
|
8758
9186
|
}
|
|
@@ -8772,10 +9200,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8772
9200
|
};
|
|
8773
9201
|
|
|
8774
9202
|
// src/features/rules/cline-rule.ts
|
|
8775
|
-
import { join as
|
|
8776
|
-
import { z as
|
|
8777
|
-
var ClineRuleFrontmatterSchema =
|
|
8778
|
-
description:
|
|
9203
|
+
import { join as join75 } from "path";
|
|
9204
|
+
import { z as z38 } from "zod/mini";
|
|
9205
|
+
var ClineRuleFrontmatterSchema = z38.object({
|
|
9206
|
+
description: z38.string()
|
|
8779
9207
|
});
|
|
8780
9208
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
8781
9209
|
static getSettablePaths() {
|
|
@@ -8817,7 +9245,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8817
9245
|
validate = true
|
|
8818
9246
|
}) {
|
|
8819
9247
|
const fileContent = await readFileContent(
|
|
8820
|
-
|
|
9248
|
+
join75(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8821
9249
|
);
|
|
8822
9250
|
return new _ClineRule({
|
|
8823
9251
|
baseDir,
|
|
@@ -8843,7 +9271,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8843
9271
|
};
|
|
8844
9272
|
|
|
8845
9273
|
// src/features/rules/codexcli-rule.ts
|
|
8846
|
-
import { join as
|
|
9274
|
+
import { join as join76 } from "path";
|
|
8847
9275
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
8848
9276
|
static getSettablePaths({
|
|
8849
9277
|
global
|
|
@@ -8862,7 +9290,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8862
9290
|
relativeFilePath: "AGENTS.md"
|
|
8863
9291
|
},
|
|
8864
9292
|
nonRoot: {
|
|
8865
|
-
relativeDirPath:
|
|
9293
|
+
relativeDirPath: join76(".codex", "memories")
|
|
8866
9294
|
}
|
|
8867
9295
|
};
|
|
8868
9296
|
}
|
|
@@ -8877,7 +9305,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8877
9305
|
if (isRoot) {
|
|
8878
9306
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8879
9307
|
const fileContent2 = await readFileContent(
|
|
8880
|
-
|
|
9308
|
+
join76(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8881
9309
|
);
|
|
8882
9310
|
return new _CodexcliRule({
|
|
8883
9311
|
baseDir,
|
|
@@ -8891,8 +9319,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8891
9319
|
if (!paths.nonRoot) {
|
|
8892
9320
|
throw new Error("nonRoot path is not set");
|
|
8893
9321
|
}
|
|
8894
|
-
const relativePath =
|
|
8895
|
-
const fileContent = await readFileContent(
|
|
9322
|
+
const relativePath = join76(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9323
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
8896
9324
|
return new _CodexcliRule({
|
|
8897
9325
|
baseDir,
|
|
8898
9326
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8951,12 +9379,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8951
9379
|
};
|
|
8952
9380
|
|
|
8953
9381
|
// src/features/rules/copilot-rule.ts
|
|
8954
|
-
import { join as
|
|
8955
|
-
import { z as
|
|
8956
|
-
var CopilotRuleFrontmatterSchema =
|
|
8957
|
-
description:
|
|
8958
|
-
applyTo:
|
|
8959
|
-
excludeAgent:
|
|
9382
|
+
import { join as join77 } from "path";
|
|
9383
|
+
import { z as z39 } from "zod/mini";
|
|
9384
|
+
var CopilotRuleFrontmatterSchema = z39.object({
|
|
9385
|
+
description: z39.optional(z39.string()),
|
|
9386
|
+
applyTo: z39.optional(z39.string()),
|
|
9387
|
+
excludeAgent: z39.optional(z39.union([z39.literal("code-review"), z39.literal("coding-agent")]))
|
|
8960
9388
|
});
|
|
8961
9389
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
8962
9390
|
frontmatter;
|
|
@@ -8968,7 +9396,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8968
9396
|
relativeFilePath: "copilot-instructions.md"
|
|
8969
9397
|
},
|
|
8970
9398
|
nonRoot: {
|
|
8971
|
-
relativeDirPath:
|
|
9399
|
+
relativeDirPath: join77(".github", "instructions")
|
|
8972
9400
|
}
|
|
8973
9401
|
};
|
|
8974
9402
|
}
|
|
@@ -8977,7 +9405,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8977
9405
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8978
9406
|
if (!result.success) {
|
|
8979
9407
|
throw new Error(
|
|
8980
|
-
`Invalid frontmatter in ${
|
|
9408
|
+
`Invalid frontmatter in ${join77(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8981
9409
|
);
|
|
8982
9410
|
}
|
|
8983
9411
|
}
|
|
@@ -9059,11 +9487,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9059
9487
|
validate = true
|
|
9060
9488
|
}) {
|
|
9061
9489
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
9062
|
-
const relativePath = isRoot ?
|
|
9490
|
+
const relativePath = isRoot ? join77(
|
|
9063
9491
|
this.getSettablePaths().root.relativeDirPath,
|
|
9064
9492
|
this.getSettablePaths().root.relativeFilePath
|
|
9065
|
-
) :
|
|
9066
|
-
const fileContent = await readFileContent(
|
|
9493
|
+
) : join77(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9494
|
+
const fileContent = await readFileContent(join77(baseDir, relativePath));
|
|
9067
9495
|
if (isRoot) {
|
|
9068
9496
|
return new _CopilotRule({
|
|
9069
9497
|
baseDir,
|
|
@@ -9079,7 +9507,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9079
9507
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9080
9508
|
if (!result.success) {
|
|
9081
9509
|
throw new Error(
|
|
9082
|
-
`Invalid frontmatter in ${
|
|
9510
|
+
`Invalid frontmatter in ${join77(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9083
9511
|
);
|
|
9084
9512
|
}
|
|
9085
9513
|
return new _CopilotRule({
|
|
@@ -9119,7 +9547,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9119
9547
|
return {
|
|
9120
9548
|
success: false,
|
|
9121
9549
|
error: new Error(
|
|
9122
|
-
`Invalid frontmatter in ${
|
|
9550
|
+
`Invalid frontmatter in ${join77(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9123
9551
|
)
|
|
9124
9552
|
};
|
|
9125
9553
|
}
|
|
@@ -9139,12 +9567,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9139
9567
|
};
|
|
9140
9568
|
|
|
9141
9569
|
// src/features/rules/cursor-rule.ts
|
|
9142
|
-
import { basename as
|
|
9143
|
-
import { z as
|
|
9144
|
-
var CursorRuleFrontmatterSchema =
|
|
9145
|
-
description:
|
|
9146
|
-
globs:
|
|
9147
|
-
alwaysApply:
|
|
9570
|
+
import { basename as basename22, join as join78 } from "path";
|
|
9571
|
+
import { z as z40 } from "zod/mini";
|
|
9572
|
+
var CursorRuleFrontmatterSchema = z40.object({
|
|
9573
|
+
description: z40.optional(z40.string()),
|
|
9574
|
+
globs: z40.optional(z40.string()),
|
|
9575
|
+
alwaysApply: z40.optional(z40.boolean())
|
|
9148
9576
|
});
|
|
9149
9577
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9150
9578
|
frontmatter;
|
|
@@ -9152,7 +9580,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9152
9580
|
static getSettablePaths() {
|
|
9153
9581
|
return {
|
|
9154
9582
|
nonRoot: {
|
|
9155
|
-
relativeDirPath:
|
|
9583
|
+
relativeDirPath: join78(".cursor", "rules")
|
|
9156
9584
|
}
|
|
9157
9585
|
};
|
|
9158
9586
|
}
|
|
@@ -9161,7 +9589,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9161
9589
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9162
9590
|
if (!result.success) {
|
|
9163
9591
|
throw new Error(
|
|
9164
|
-
`Invalid frontmatter in ${
|
|
9592
|
+
`Invalid frontmatter in ${join78(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9165
9593
|
);
|
|
9166
9594
|
}
|
|
9167
9595
|
}
|
|
@@ -9278,19 +9706,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9278
9706
|
validate = true
|
|
9279
9707
|
}) {
|
|
9280
9708
|
const fileContent = await readFileContent(
|
|
9281
|
-
|
|
9709
|
+
join78(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9282
9710
|
);
|
|
9283
9711
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9284
9712
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9285
9713
|
if (!result.success) {
|
|
9286
9714
|
throw new Error(
|
|
9287
|
-
`Invalid frontmatter in ${
|
|
9715
|
+
`Invalid frontmatter in ${join78(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9288
9716
|
);
|
|
9289
9717
|
}
|
|
9290
9718
|
return new _CursorRule({
|
|
9291
9719
|
baseDir,
|
|
9292
9720
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9293
|
-
relativeFilePath:
|
|
9721
|
+
relativeFilePath: basename22(relativeFilePath),
|
|
9294
9722
|
frontmatter: result.data,
|
|
9295
9723
|
body: content.trim(),
|
|
9296
9724
|
validate
|
|
@@ -9321,7 +9749,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9321
9749
|
return {
|
|
9322
9750
|
success: false,
|
|
9323
9751
|
error: new Error(
|
|
9324
|
-
`Invalid frontmatter in ${
|
|
9752
|
+
`Invalid frontmatter in ${join78(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9325
9753
|
)
|
|
9326
9754
|
};
|
|
9327
9755
|
}
|
|
@@ -9341,7 +9769,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9341
9769
|
};
|
|
9342
9770
|
|
|
9343
9771
|
// src/features/rules/geminicli-rule.ts
|
|
9344
|
-
import { join as
|
|
9772
|
+
import { join as join79 } from "path";
|
|
9345
9773
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9346
9774
|
static getSettablePaths({
|
|
9347
9775
|
global
|
|
@@ -9360,7 +9788,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9360
9788
|
relativeFilePath: "GEMINI.md"
|
|
9361
9789
|
},
|
|
9362
9790
|
nonRoot: {
|
|
9363
|
-
relativeDirPath:
|
|
9791
|
+
relativeDirPath: join79(".gemini", "memories")
|
|
9364
9792
|
}
|
|
9365
9793
|
};
|
|
9366
9794
|
}
|
|
@@ -9375,7 +9803,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9375
9803
|
if (isRoot) {
|
|
9376
9804
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9377
9805
|
const fileContent2 = await readFileContent(
|
|
9378
|
-
|
|
9806
|
+
join79(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9379
9807
|
);
|
|
9380
9808
|
return new _GeminiCliRule({
|
|
9381
9809
|
baseDir,
|
|
@@ -9389,8 +9817,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9389
9817
|
if (!paths.nonRoot) {
|
|
9390
9818
|
throw new Error("nonRoot path is not set");
|
|
9391
9819
|
}
|
|
9392
|
-
const relativePath =
|
|
9393
|
-
const fileContent = await readFileContent(
|
|
9820
|
+
const relativePath = join79(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9821
|
+
const fileContent = await readFileContent(join79(baseDir, relativePath));
|
|
9394
9822
|
return new _GeminiCliRule({
|
|
9395
9823
|
baseDir,
|
|
9396
9824
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9449,7 +9877,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9449
9877
|
};
|
|
9450
9878
|
|
|
9451
9879
|
// src/features/rules/junie-rule.ts
|
|
9452
|
-
import { join as
|
|
9880
|
+
import { join as join80 } from "path";
|
|
9453
9881
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9454
9882
|
static getSettablePaths() {
|
|
9455
9883
|
return {
|
|
@@ -9458,7 +9886,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9458
9886
|
relativeFilePath: "guidelines.md"
|
|
9459
9887
|
},
|
|
9460
9888
|
nonRoot: {
|
|
9461
|
-
relativeDirPath:
|
|
9889
|
+
relativeDirPath: join80(".junie", "memories")
|
|
9462
9890
|
}
|
|
9463
9891
|
};
|
|
9464
9892
|
}
|
|
@@ -9468,8 +9896,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9468
9896
|
validate = true
|
|
9469
9897
|
}) {
|
|
9470
9898
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9471
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
9472
|
-
const fileContent = await readFileContent(
|
|
9899
|
+
const relativePath = isRoot ? "guidelines.md" : join80(".junie", "memories", relativeFilePath);
|
|
9900
|
+
const fileContent = await readFileContent(join80(baseDir, relativePath));
|
|
9473
9901
|
return new _JunieRule({
|
|
9474
9902
|
baseDir,
|
|
9475
9903
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9523,13 +9951,80 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9523
9951
|
}
|
|
9524
9952
|
};
|
|
9525
9953
|
|
|
9954
|
+
// src/features/rules/kilo-rule.ts
|
|
9955
|
+
import { join as join81 } from "path";
|
|
9956
|
+
var KiloRule = class _KiloRule extends ToolRule {
|
|
9957
|
+
static getSettablePaths(_options = {}) {
|
|
9958
|
+
return {
|
|
9959
|
+
nonRoot: {
|
|
9960
|
+
relativeDirPath: join81(".kilocode", "rules")
|
|
9961
|
+
}
|
|
9962
|
+
};
|
|
9963
|
+
}
|
|
9964
|
+
static async fromFile({
|
|
9965
|
+
baseDir = process.cwd(),
|
|
9966
|
+
relativeFilePath,
|
|
9967
|
+
validate = true
|
|
9968
|
+
}) {
|
|
9969
|
+
const fileContent = await readFileContent(
|
|
9970
|
+
join81(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9971
|
+
);
|
|
9972
|
+
return new _KiloRule({
|
|
9973
|
+
baseDir,
|
|
9974
|
+
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9975
|
+
relativeFilePath,
|
|
9976
|
+
fileContent,
|
|
9977
|
+
validate
|
|
9978
|
+
});
|
|
9979
|
+
}
|
|
9980
|
+
static fromRulesyncRule({
|
|
9981
|
+
baseDir = process.cwd(),
|
|
9982
|
+
rulesyncRule,
|
|
9983
|
+
validate = true
|
|
9984
|
+
}) {
|
|
9985
|
+
return new _KiloRule(
|
|
9986
|
+
this.buildToolRuleParamsDefault({
|
|
9987
|
+
baseDir,
|
|
9988
|
+
rulesyncRule,
|
|
9989
|
+
validate,
|
|
9990
|
+
nonRootPath: this.getSettablePaths().nonRoot
|
|
9991
|
+
})
|
|
9992
|
+
);
|
|
9993
|
+
}
|
|
9994
|
+
toRulesyncRule() {
|
|
9995
|
+
return this.toRulesyncRuleDefault();
|
|
9996
|
+
}
|
|
9997
|
+
validate() {
|
|
9998
|
+
return { success: true, error: null };
|
|
9999
|
+
}
|
|
10000
|
+
static forDeletion({
|
|
10001
|
+
baseDir = process.cwd(),
|
|
10002
|
+
relativeDirPath,
|
|
10003
|
+
relativeFilePath
|
|
10004
|
+
}) {
|
|
10005
|
+
return new _KiloRule({
|
|
10006
|
+
baseDir,
|
|
10007
|
+
relativeDirPath,
|
|
10008
|
+
relativeFilePath,
|
|
10009
|
+
fileContent: "",
|
|
10010
|
+
validate: false
|
|
10011
|
+
});
|
|
10012
|
+
}
|
|
10013
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
10014
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
10015
|
+
rulesyncRule,
|
|
10016
|
+
toolTarget: "kilo"
|
|
10017
|
+
});
|
|
10018
|
+
}
|
|
10019
|
+
};
|
|
10020
|
+
|
|
9526
10021
|
// src/features/rules/kiro-rule.ts
|
|
9527
|
-
import { join as
|
|
10022
|
+
import { join as join82 } from "path";
|
|
9528
10023
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
9529
10024
|
static getSettablePaths() {
|
|
9530
10025
|
return {
|
|
9531
10026
|
nonRoot: {
|
|
9532
|
-
relativeDirPath:
|
|
10027
|
+
relativeDirPath: join82(".kiro", "steering")
|
|
9533
10028
|
}
|
|
9534
10029
|
};
|
|
9535
10030
|
}
|
|
@@ -9539,7 +10034,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9539
10034
|
validate = true
|
|
9540
10035
|
}) {
|
|
9541
10036
|
const fileContent = await readFileContent(
|
|
9542
|
-
|
|
10037
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9543
10038
|
);
|
|
9544
10039
|
return new _KiroRule({
|
|
9545
10040
|
baseDir,
|
|
@@ -9593,7 +10088,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9593
10088
|
};
|
|
9594
10089
|
|
|
9595
10090
|
// src/features/rules/opencode-rule.ts
|
|
9596
|
-
import { join as
|
|
10091
|
+
import { join as join83 } from "path";
|
|
9597
10092
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
9598
10093
|
static getSettablePaths() {
|
|
9599
10094
|
return {
|
|
@@ -9602,7 +10097,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9602
10097
|
relativeFilePath: "AGENTS.md"
|
|
9603
10098
|
},
|
|
9604
10099
|
nonRoot: {
|
|
9605
|
-
relativeDirPath:
|
|
10100
|
+
relativeDirPath: join83(".opencode", "memories")
|
|
9606
10101
|
}
|
|
9607
10102
|
};
|
|
9608
10103
|
}
|
|
@@ -9612,8 +10107,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9612
10107
|
validate = true
|
|
9613
10108
|
}) {
|
|
9614
10109
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9615
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
9616
|
-
const fileContent = await readFileContent(
|
|
10110
|
+
const relativePath = isRoot ? "AGENTS.md" : join83(".opencode", "memories", relativeFilePath);
|
|
10111
|
+
const fileContent = await readFileContent(join83(baseDir, relativePath));
|
|
9617
10112
|
return new _OpenCodeRule({
|
|
9618
10113
|
baseDir,
|
|
9619
10114
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9668,7 +10163,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9668
10163
|
};
|
|
9669
10164
|
|
|
9670
10165
|
// src/features/rules/qwencode-rule.ts
|
|
9671
|
-
import { join as
|
|
10166
|
+
import { join as join84 } from "path";
|
|
9672
10167
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
9673
10168
|
static getSettablePaths() {
|
|
9674
10169
|
return {
|
|
@@ -9677,7 +10172,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9677
10172
|
relativeFilePath: "QWEN.md"
|
|
9678
10173
|
},
|
|
9679
10174
|
nonRoot: {
|
|
9680
|
-
relativeDirPath:
|
|
10175
|
+
relativeDirPath: join84(".qwen", "memories")
|
|
9681
10176
|
}
|
|
9682
10177
|
};
|
|
9683
10178
|
}
|
|
@@ -9687,8 +10182,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9687
10182
|
validate = true
|
|
9688
10183
|
}) {
|
|
9689
10184
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
9690
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
9691
|
-
const fileContent = await readFileContent(
|
|
10185
|
+
const relativePath = isRoot ? "QWEN.md" : join84(".qwen", "memories", relativeFilePath);
|
|
10186
|
+
const fileContent = await readFileContent(join84(baseDir, relativePath));
|
|
9692
10187
|
return new _QwencodeRule({
|
|
9693
10188
|
baseDir,
|
|
9694
10189
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9740,12 +10235,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9740
10235
|
};
|
|
9741
10236
|
|
|
9742
10237
|
// src/features/rules/roo-rule.ts
|
|
9743
|
-
import { join as
|
|
10238
|
+
import { join as join85 } from "path";
|
|
9744
10239
|
var RooRule = class _RooRule extends ToolRule {
|
|
9745
10240
|
static getSettablePaths() {
|
|
9746
10241
|
return {
|
|
9747
10242
|
nonRoot: {
|
|
9748
|
-
relativeDirPath:
|
|
10243
|
+
relativeDirPath: join85(".roo", "rules")
|
|
9749
10244
|
}
|
|
9750
10245
|
};
|
|
9751
10246
|
}
|
|
@@ -9755,7 +10250,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9755
10250
|
validate = true
|
|
9756
10251
|
}) {
|
|
9757
10252
|
const fileContent = await readFileContent(
|
|
9758
|
-
|
|
10253
|
+
join85(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9759
10254
|
);
|
|
9760
10255
|
return new _RooRule({
|
|
9761
10256
|
baseDir,
|
|
@@ -9824,7 +10319,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9824
10319
|
};
|
|
9825
10320
|
|
|
9826
10321
|
// src/features/rules/warp-rule.ts
|
|
9827
|
-
import { join as
|
|
10322
|
+
import { join as join86 } from "path";
|
|
9828
10323
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
9829
10324
|
constructor({ fileContent, root, ...rest }) {
|
|
9830
10325
|
super({
|
|
@@ -9840,7 +10335,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9840
10335
|
relativeFilePath: "WARP.md"
|
|
9841
10336
|
},
|
|
9842
10337
|
nonRoot: {
|
|
9843
|
-
relativeDirPath:
|
|
10338
|
+
relativeDirPath: join86(".warp", "memories")
|
|
9844
10339
|
}
|
|
9845
10340
|
};
|
|
9846
10341
|
}
|
|
@@ -9850,8 +10345,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9850
10345
|
validate = true
|
|
9851
10346
|
}) {
|
|
9852
10347
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
9853
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
9854
|
-
const fileContent = await readFileContent(
|
|
10348
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join86(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
10349
|
+
const fileContent = await readFileContent(join86(baseDir, relativePath));
|
|
9855
10350
|
return new _WarpRule({
|
|
9856
10351
|
baseDir,
|
|
9857
10352
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -9906,12 +10401,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9906
10401
|
};
|
|
9907
10402
|
|
|
9908
10403
|
// src/features/rules/windsurf-rule.ts
|
|
9909
|
-
import { join as
|
|
10404
|
+
import { join as join87 } from "path";
|
|
9910
10405
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
9911
10406
|
static getSettablePaths() {
|
|
9912
10407
|
return {
|
|
9913
10408
|
nonRoot: {
|
|
9914
|
-
relativeDirPath:
|
|
10409
|
+
relativeDirPath: join87(".windsurf", "rules")
|
|
9915
10410
|
}
|
|
9916
10411
|
};
|
|
9917
10412
|
}
|
|
@@ -9921,7 +10416,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
9921
10416
|
validate = true
|
|
9922
10417
|
}) {
|
|
9923
10418
|
const fileContent = await readFileContent(
|
|
9924
|
-
|
|
10419
|
+
join87(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9925
10420
|
);
|
|
9926
10421
|
return new _WindsurfRule({
|
|
9927
10422
|
baseDir,
|
|
@@ -9986,6 +10481,7 @@ var rulesProcessorToolTargets = [
|
|
|
9986
10481
|
"cursor",
|
|
9987
10482
|
"geminicli",
|
|
9988
10483
|
"junie",
|
|
10484
|
+
"kilo",
|
|
9989
10485
|
"kiro",
|
|
9990
10486
|
"opencode",
|
|
9991
10487
|
"qwencode",
|
|
@@ -9993,7 +10489,7 @@ var rulesProcessorToolTargets = [
|
|
|
9993
10489
|
"warp",
|
|
9994
10490
|
"windsurf"
|
|
9995
10491
|
];
|
|
9996
|
-
var RulesProcessorToolTargetSchema =
|
|
10492
|
+
var RulesProcessorToolTargetSchema = z41.enum(rulesProcessorToolTargets);
|
|
9997
10493
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
9998
10494
|
[
|
|
9999
10495
|
"agentsmd",
|
|
@@ -10115,6 +10611,13 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
10115
10611
|
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "toon" }
|
|
10116
10612
|
}
|
|
10117
10613
|
],
|
|
10614
|
+
[
|
|
10615
|
+
"kilo",
|
|
10616
|
+
{
|
|
10617
|
+
class: KiloRule,
|
|
10618
|
+
meta: { extension: "md", supportsGlobal: true, ruleDiscoveryMode: "auto" }
|
|
10619
|
+
}
|
|
10620
|
+
],
|
|
10118
10621
|
[
|
|
10119
10622
|
"kiro",
|
|
10120
10623
|
{
|
|
@@ -10270,7 +10773,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10270
10773
|
}).relativeDirPath;
|
|
10271
10774
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10272
10775
|
const frontmatter = skill.getFrontmatter();
|
|
10273
|
-
const relativePath =
|
|
10776
|
+
const relativePath = join88(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10274
10777
|
return {
|
|
10275
10778
|
name: frontmatter.name,
|
|
10276
10779
|
description: frontmatter.description,
|
|
@@ -10337,10 +10840,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10337
10840
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10338
10841
|
*/
|
|
10339
10842
|
async loadRulesyncFiles() {
|
|
10340
|
-
const files = await findFilesByGlobs(
|
|
10843
|
+
const files = await findFilesByGlobs(join88(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10341
10844
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10342
10845
|
const rulesyncRules = await Promise.all(
|
|
10343
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
10846
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename23(file) }))
|
|
10344
10847
|
);
|
|
10345
10848
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10346
10849
|
if (rootRules.length > 1) {
|
|
@@ -10358,10 +10861,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10358
10861
|
return rulesyncRules;
|
|
10359
10862
|
}
|
|
10360
10863
|
async loadRulesyncFilesLegacy() {
|
|
10361
|
-
const legacyFiles = await findFilesByGlobs(
|
|
10864
|
+
const legacyFiles = await findFilesByGlobs(join88(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10362
10865
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10363
10866
|
return Promise.all(
|
|
10364
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
10867
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename23(file) }))
|
|
10365
10868
|
);
|
|
10366
10869
|
}
|
|
10367
10870
|
/**
|
|
@@ -10379,7 +10882,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10379
10882
|
return [];
|
|
10380
10883
|
}
|
|
10381
10884
|
const rootFilePaths = await findFilesByGlobs(
|
|
10382
|
-
|
|
10885
|
+
join88(
|
|
10383
10886
|
this.baseDir,
|
|
10384
10887
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10385
10888
|
settablePaths.root.relativeFilePath
|
|
@@ -10390,7 +10893,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10390
10893
|
(filePath) => factory.class.forDeletion({
|
|
10391
10894
|
baseDir: this.baseDir,
|
|
10392
10895
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
10393
|
-
relativeFilePath:
|
|
10896
|
+
relativeFilePath: basename23(filePath),
|
|
10394
10897
|
global: this.global
|
|
10395
10898
|
})
|
|
10396
10899
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10399,7 +10902,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10399
10902
|
rootFilePaths.map(
|
|
10400
10903
|
(filePath) => factory.class.fromFile({
|
|
10401
10904
|
baseDir: this.baseDir,
|
|
10402
|
-
relativeFilePath:
|
|
10905
|
+
relativeFilePath: basename23(filePath),
|
|
10403
10906
|
global: this.global
|
|
10404
10907
|
})
|
|
10405
10908
|
)
|
|
@@ -10411,14 +10914,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10411
10914
|
return [];
|
|
10412
10915
|
}
|
|
10413
10916
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
10414
|
-
|
|
10917
|
+
join88(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
10415
10918
|
);
|
|
10416
10919
|
if (forDeletion) {
|
|
10417
10920
|
return nonRootFilePaths.map(
|
|
10418
10921
|
(filePath) => factory.class.forDeletion({
|
|
10419
10922
|
baseDir: this.baseDir,
|
|
10420
10923
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
10421
|
-
relativeFilePath:
|
|
10924
|
+
relativeFilePath: basename23(filePath),
|
|
10422
10925
|
global: this.global
|
|
10423
10926
|
})
|
|
10424
10927
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10427,7 +10930,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10427
10930
|
nonRootFilePaths.map(
|
|
10428
10931
|
(filePath) => factory.class.fromFile({
|
|
10429
10932
|
baseDir: this.baseDir,
|
|
10430
|
-
relativeFilePath:
|
|
10933
|
+
relativeFilePath: basename23(filePath),
|
|
10431
10934
|
global: this.global
|
|
10432
10935
|
})
|
|
10433
10936
|
)
|
|
@@ -10520,14 +11023,14 @@ s/<command> [arguments]
|
|
|
10520
11023
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
10521
11024
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
10522
11025
|
|
|
10523
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
11026
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join88(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
10524
11027
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
10525
11028
|
|
|
10526
11029
|
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.
|
|
10527
11030
|
|
|
10528
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
11031
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
10529
11032
|
|
|
10530
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
11033
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
10531
11034
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
10532
11035
|
const result = [
|
|
10533
11036
|
overview,
|
|
@@ -10809,7 +11312,7 @@ async function generateSkills(config) {
|
|
|
10809
11312
|
}
|
|
10810
11313
|
|
|
10811
11314
|
// src/cli/commands/gitignore.ts
|
|
10812
|
-
import { join as
|
|
11315
|
+
import { join as join89 } from "path";
|
|
10813
11316
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
10814
11317
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
10815
11318
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -10859,6 +11362,12 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
10859
11362
|
// Junie
|
|
10860
11363
|
"**/.junie/guidelines.md",
|
|
10861
11364
|
"**/.junie/mcp.json",
|
|
11365
|
+
// Kilo Code
|
|
11366
|
+
"**/.kilocode/rules/",
|
|
11367
|
+
"**/.kilocode/skills/",
|
|
11368
|
+
"**/.kilocode/workflows/",
|
|
11369
|
+
"**/.kilocode/mcp.json",
|
|
11370
|
+
"**/.kilocodeignore",
|
|
10862
11371
|
// Kiro
|
|
10863
11372
|
"**/.kiro/steering/",
|
|
10864
11373
|
"**/.aiignore",
|
|
@@ -10934,7 +11443,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
10934
11443
|
return result;
|
|
10935
11444
|
};
|
|
10936
11445
|
var gitignoreCommand = async () => {
|
|
10937
|
-
const gitignorePath =
|
|
11446
|
+
const gitignorePath = join89(process.cwd(), ".gitignore");
|
|
10938
11447
|
let gitignoreContent = "";
|
|
10939
11448
|
if (await fileExists(gitignorePath)) {
|
|
10940
11449
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11133,7 +11642,7 @@ async function importSkills(config, tool) {
|
|
|
11133
11642
|
}
|
|
11134
11643
|
|
|
11135
11644
|
// src/cli/commands/init.ts
|
|
11136
|
-
import { join as
|
|
11645
|
+
import { join as join90 } from "path";
|
|
11137
11646
|
async function initCommand() {
|
|
11138
11647
|
logger.info("Initializing rulesync...");
|
|
11139
11648
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11296,14 +11805,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11296
11805
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11297
11806
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
11298
11807
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11299
|
-
const ruleFilepath =
|
|
11808
|
+
const ruleFilepath = join90(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11300
11809
|
if (!await fileExists(ruleFilepath)) {
|
|
11301
11810
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11302
11811
|
logger.success(`Created ${ruleFilepath}`);
|
|
11303
11812
|
} else {
|
|
11304
11813
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11305
11814
|
}
|
|
11306
|
-
const mcpFilepath =
|
|
11815
|
+
const mcpFilepath = join90(
|
|
11307
11816
|
mcpPaths.recommended.relativeDirPath,
|
|
11308
11817
|
mcpPaths.recommended.relativeFilePath
|
|
11309
11818
|
);
|
|
@@ -11313,21 +11822,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11313
11822
|
} else {
|
|
11314
11823
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11315
11824
|
}
|
|
11316
|
-
const commandFilepath =
|
|
11825
|
+
const commandFilepath = join90(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11317
11826
|
if (!await fileExists(commandFilepath)) {
|
|
11318
11827
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11319
11828
|
logger.success(`Created ${commandFilepath}`);
|
|
11320
11829
|
} else {
|
|
11321
11830
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11322
11831
|
}
|
|
11323
|
-
const subagentFilepath =
|
|
11832
|
+
const subagentFilepath = join90(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11324
11833
|
if (!await fileExists(subagentFilepath)) {
|
|
11325
11834
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11326
11835
|
logger.success(`Created ${subagentFilepath}`);
|
|
11327
11836
|
} else {
|
|
11328
11837
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11329
11838
|
}
|
|
11330
|
-
const ignoreFilepath =
|
|
11839
|
+
const ignoreFilepath = join90(
|
|
11331
11840
|
ignorePaths.recommended.relativeDirPath,
|
|
11332
11841
|
ignorePaths.recommended.relativeFilePath
|
|
11333
11842
|
);
|
|
@@ -11343,15 +11852,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11343
11852
|
import { FastMCP } from "fastmcp";
|
|
11344
11853
|
|
|
11345
11854
|
// src/mcp/tools.ts
|
|
11346
|
-
import { z as
|
|
11855
|
+
import { z as z48 } from "zod/mini";
|
|
11347
11856
|
|
|
11348
11857
|
// src/mcp/commands.ts
|
|
11349
|
-
import { basename as
|
|
11350
|
-
import { z as
|
|
11858
|
+
import { basename as basename24, join as join91 } from "path";
|
|
11859
|
+
import { z as z42 } from "zod/mini";
|
|
11351
11860
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11352
11861
|
var maxCommandsCount = 1e3;
|
|
11353
11862
|
async function listCommands() {
|
|
11354
|
-
const commandsDir =
|
|
11863
|
+
const commandsDir = join91(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11355
11864
|
try {
|
|
11356
11865
|
const files = await listDirectoryFiles(commandsDir);
|
|
11357
11866
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11363,7 +11872,7 @@ async function listCommands() {
|
|
|
11363
11872
|
});
|
|
11364
11873
|
const frontmatter = command.getFrontmatter();
|
|
11365
11874
|
return {
|
|
11366
|
-
relativePathFromCwd:
|
|
11875
|
+
relativePathFromCwd: join91(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11367
11876
|
frontmatter
|
|
11368
11877
|
};
|
|
11369
11878
|
} catch (error) {
|
|
@@ -11383,13 +11892,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11383
11892
|
relativePath: relativePathFromCwd,
|
|
11384
11893
|
intendedRootDir: process.cwd()
|
|
11385
11894
|
});
|
|
11386
|
-
const filename =
|
|
11895
|
+
const filename = basename24(relativePathFromCwd);
|
|
11387
11896
|
try {
|
|
11388
11897
|
const command = await RulesyncCommand.fromFile({
|
|
11389
11898
|
relativeFilePath: filename
|
|
11390
11899
|
});
|
|
11391
11900
|
return {
|
|
11392
|
-
relativePathFromCwd:
|
|
11901
|
+
relativePathFromCwd: join91(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11393
11902
|
frontmatter: command.getFrontmatter(),
|
|
11394
11903
|
body: command.getBody()
|
|
11395
11904
|
};
|
|
@@ -11408,7 +11917,7 @@ async function putCommand({
|
|
|
11408
11917
|
relativePath: relativePathFromCwd,
|
|
11409
11918
|
intendedRootDir: process.cwd()
|
|
11410
11919
|
});
|
|
11411
|
-
const filename =
|
|
11920
|
+
const filename = basename24(relativePathFromCwd);
|
|
11412
11921
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11413
11922
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
11414
11923
|
throw new Error(
|
|
@@ -11418,7 +11927,7 @@ async function putCommand({
|
|
|
11418
11927
|
try {
|
|
11419
11928
|
const existingCommands = await listCommands();
|
|
11420
11929
|
const isUpdate = existingCommands.some(
|
|
11421
|
-
(command2) => command2.relativePathFromCwd ===
|
|
11930
|
+
(command2) => command2.relativePathFromCwd === join91(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11422
11931
|
);
|
|
11423
11932
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
11424
11933
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -11433,11 +11942,11 @@ async function putCommand({
|
|
|
11433
11942
|
fileContent,
|
|
11434
11943
|
validate: true
|
|
11435
11944
|
});
|
|
11436
|
-
const commandsDir =
|
|
11945
|
+
const commandsDir = join91(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11437
11946
|
await ensureDir(commandsDir);
|
|
11438
11947
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
11439
11948
|
return {
|
|
11440
|
-
relativePathFromCwd:
|
|
11949
|
+
relativePathFromCwd: join91(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11441
11950
|
frontmatter: command.getFrontmatter(),
|
|
11442
11951
|
body: command.getBody()
|
|
11443
11952
|
};
|
|
@@ -11452,12 +11961,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11452
11961
|
relativePath: relativePathFromCwd,
|
|
11453
11962
|
intendedRootDir: process.cwd()
|
|
11454
11963
|
});
|
|
11455
|
-
const filename =
|
|
11456
|
-
const fullPath =
|
|
11964
|
+
const filename = basename24(relativePathFromCwd);
|
|
11965
|
+
const fullPath = join91(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
11457
11966
|
try {
|
|
11458
11967
|
await removeFile(fullPath);
|
|
11459
11968
|
return {
|
|
11460
|
-
relativePathFromCwd:
|
|
11969
|
+
relativePathFromCwd: join91(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11461
11970
|
};
|
|
11462
11971
|
} catch (error) {
|
|
11463
11972
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11466,23 +11975,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11466
11975
|
}
|
|
11467
11976
|
}
|
|
11468
11977
|
var commandToolSchemas = {
|
|
11469
|
-
listCommands:
|
|
11470
|
-
getCommand:
|
|
11471
|
-
relativePathFromCwd:
|
|
11978
|
+
listCommands: z42.object({}),
|
|
11979
|
+
getCommand: z42.object({
|
|
11980
|
+
relativePathFromCwd: z42.string()
|
|
11472
11981
|
}),
|
|
11473
|
-
putCommand:
|
|
11474
|
-
relativePathFromCwd:
|
|
11982
|
+
putCommand: z42.object({
|
|
11983
|
+
relativePathFromCwd: z42.string(),
|
|
11475
11984
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
11476
|
-
body:
|
|
11985
|
+
body: z42.string()
|
|
11477
11986
|
}),
|
|
11478
|
-
deleteCommand:
|
|
11479
|
-
relativePathFromCwd:
|
|
11987
|
+
deleteCommand: z42.object({
|
|
11988
|
+
relativePathFromCwd: z42.string()
|
|
11480
11989
|
})
|
|
11481
11990
|
};
|
|
11482
11991
|
var commandTools = {
|
|
11483
11992
|
listCommands: {
|
|
11484
11993
|
name: "listCommands",
|
|
11485
|
-
description: `List all commands from ${
|
|
11994
|
+
description: `List all commands from ${join91(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11486
11995
|
parameters: commandToolSchemas.listCommands,
|
|
11487
11996
|
execute: async () => {
|
|
11488
11997
|
const commands = await listCommands();
|
|
@@ -11524,11 +12033,11 @@ var commandTools = {
|
|
|
11524
12033
|
};
|
|
11525
12034
|
|
|
11526
12035
|
// src/mcp/ignore.ts
|
|
11527
|
-
import { join as
|
|
11528
|
-
import { z as
|
|
12036
|
+
import { join as join92 } from "path";
|
|
12037
|
+
import { z as z43 } from "zod/mini";
|
|
11529
12038
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
11530
12039
|
async function getIgnoreFile() {
|
|
11531
|
-
const ignoreFilePath =
|
|
12040
|
+
const ignoreFilePath = join92(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11532
12041
|
try {
|
|
11533
12042
|
const content = await readFileContent(ignoreFilePath);
|
|
11534
12043
|
return {
|
|
@@ -11542,7 +12051,7 @@ async function getIgnoreFile() {
|
|
|
11542
12051
|
}
|
|
11543
12052
|
}
|
|
11544
12053
|
async function putIgnoreFile({ content }) {
|
|
11545
|
-
const ignoreFilePath =
|
|
12054
|
+
const ignoreFilePath = join92(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11546
12055
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
11547
12056
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
11548
12057
|
throw new Error(
|
|
@@ -11563,8 +12072,8 @@ async function putIgnoreFile({ content }) {
|
|
|
11563
12072
|
}
|
|
11564
12073
|
}
|
|
11565
12074
|
async function deleteIgnoreFile() {
|
|
11566
|
-
const aiignorePath =
|
|
11567
|
-
const legacyIgnorePath =
|
|
12075
|
+
const aiignorePath = join92(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
12076
|
+
const legacyIgnorePath = join92(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
11568
12077
|
try {
|
|
11569
12078
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
11570
12079
|
return {
|
|
@@ -11582,11 +12091,11 @@ async function deleteIgnoreFile() {
|
|
|
11582
12091
|
}
|
|
11583
12092
|
}
|
|
11584
12093
|
var ignoreToolSchemas = {
|
|
11585
|
-
getIgnoreFile:
|
|
11586
|
-
putIgnoreFile:
|
|
11587
|
-
content:
|
|
12094
|
+
getIgnoreFile: z43.object({}),
|
|
12095
|
+
putIgnoreFile: z43.object({
|
|
12096
|
+
content: z43.string()
|
|
11588
12097
|
}),
|
|
11589
|
-
deleteIgnoreFile:
|
|
12098
|
+
deleteIgnoreFile: z43.object({})
|
|
11590
12099
|
};
|
|
11591
12100
|
var ignoreTools = {
|
|
11592
12101
|
getIgnoreFile: {
|
|
@@ -11619,8 +12128,8 @@ var ignoreTools = {
|
|
|
11619
12128
|
};
|
|
11620
12129
|
|
|
11621
12130
|
// src/mcp/mcp.ts
|
|
11622
|
-
import { join as
|
|
11623
|
-
import { z as
|
|
12131
|
+
import { join as join93 } from "path";
|
|
12132
|
+
import { z as z44 } from "zod/mini";
|
|
11624
12133
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
11625
12134
|
async function getMcpFile() {
|
|
11626
12135
|
const config = await ConfigResolver.resolve({});
|
|
@@ -11629,7 +12138,7 @@ async function getMcpFile() {
|
|
|
11629
12138
|
validate: true,
|
|
11630
12139
|
modularMcp: config.getModularMcp()
|
|
11631
12140
|
});
|
|
11632
|
-
const relativePathFromCwd =
|
|
12141
|
+
const relativePathFromCwd = join93(
|
|
11633
12142
|
rulesyncMcp.getRelativeDirPath(),
|
|
11634
12143
|
rulesyncMcp.getRelativeFilePath()
|
|
11635
12144
|
);
|
|
@@ -11662,7 +12171,7 @@ async function putMcpFile({ content }) {
|
|
|
11662
12171
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11663
12172
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
11664
12173
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
11665
|
-
const fullPath =
|
|
12174
|
+
const fullPath = join93(baseDir, relativeDirPath, relativeFilePath);
|
|
11666
12175
|
const rulesyncMcp = new RulesyncMcp({
|
|
11667
12176
|
baseDir,
|
|
11668
12177
|
relativeDirPath,
|
|
@@ -11671,9 +12180,9 @@ async function putMcpFile({ content }) {
|
|
|
11671
12180
|
validate: true,
|
|
11672
12181
|
modularMcp: config.getModularMcp()
|
|
11673
12182
|
});
|
|
11674
|
-
await ensureDir(
|
|
12183
|
+
await ensureDir(join93(baseDir, relativeDirPath));
|
|
11675
12184
|
await writeFileContent(fullPath, content);
|
|
11676
|
-
const relativePathFromCwd =
|
|
12185
|
+
const relativePathFromCwd = join93(relativeDirPath, relativeFilePath);
|
|
11677
12186
|
return {
|
|
11678
12187
|
relativePathFromCwd,
|
|
11679
12188
|
content: rulesyncMcp.getFileContent()
|
|
@@ -11688,15 +12197,15 @@ async function deleteMcpFile() {
|
|
|
11688
12197
|
try {
|
|
11689
12198
|
const baseDir = process.cwd();
|
|
11690
12199
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11691
|
-
const recommendedPath =
|
|
12200
|
+
const recommendedPath = join93(
|
|
11692
12201
|
baseDir,
|
|
11693
12202
|
paths.recommended.relativeDirPath,
|
|
11694
12203
|
paths.recommended.relativeFilePath
|
|
11695
12204
|
);
|
|
11696
|
-
const legacyPath =
|
|
12205
|
+
const legacyPath = join93(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
11697
12206
|
await removeFile(recommendedPath);
|
|
11698
12207
|
await removeFile(legacyPath);
|
|
11699
|
-
const relativePathFromCwd =
|
|
12208
|
+
const relativePathFromCwd = join93(
|
|
11700
12209
|
paths.recommended.relativeDirPath,
|
|
11701
12210
|
paths.recommended.relativeFilePath
|
|
11702
12211
|
);
|
|
@@ -11710,11 +12219,11 @@ async function deleteMcpFile() {
|
|
|
11710
12219
|
}
|
|
11711
12220
|
}
|
|
11712
12221
|
var mcpToolSchemas = {
|
|
11713
|
-
getMcpFile:
|
|
11714
|
-
putMcpFile:
|
|
11715
|
-
content:
|
|
12222
|
+
getMcpFile: z44.object({}),
|
|
12223
|
+
putMcpFile: z44.object({
|
|
12224
|
+
content: z44.string()
|
|
11716
12225
|
}),
|
|
11717
|
-
deleteMcpFile:
|
|
12226
|
+
deleteMcpFile: z44.object({})
|
|
11718
12227
|
};
|
|
11719
12228
|
var mcpTools = {
|
|
11720
12229
|
getMcpFile: {
|
|
@@ -11747,12 +12256,12 @@ var mcpTools = {
|
|
|
11747
12256
|
};
|
|
11748
12257
|
|
|
11749
12258
|
// src/mcp/rules.ts
|
|
11750
|
-
import { basename as
|
|
11751
|
-
import { z as
|
|
12259
|
+
import { basename as basename25, join as join94 } from "path";
|
|
12260
|
+
import { z as z45 } from "zod/mini";
|
|
11752
12261
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
11753
12262
|
var maxRulesCount = 1e3;
|
|
11754
12263
|
async function listRules() {
|
|
11755
|
-
const rulesDir =
|
|
12264
|
+
const rulesDir = join94(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11756
12265
|
try {
|
|
11757
12266
|
const files = await listDirectoryFiles(rulesDir);
|
|
11758
12267
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11765,7 +12274,7 @@ async function listRules() {
|
|
|
11765
12274
|
});
|
|
11766
12275
|
const frontmatter = rule.getFrontmatter();
|
|
11767
12276
|
return {
|
|
11768
|
-
relativePathFromCwd:
|
|
12277
|
+
relativePathFromCwd: join94(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
11769
12278
|
frontmatter
|
|
11770
12279
|
};
|
|
11771
12280
|
} catch (error) {
|
|
@@ -11785,14 +12294,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
11785
12294
|
relativePath: relativePathFromCwd,
|
|
11786
12295
|
intendedRootDir: process.cwd()
|
|
11787
12296
|
});
|
|
11788
|
-
const filename =
|
|
12297
|
+
const filename = basename25(relativePathFromCwd);
|
|
11789
12298
|
try {
|
|
11790
12299
|
const rule = await RulesyncRule.fromFile({
|
|
11791
12300
|
relativeFilePath: filename,
|
|
11792
12301
|
validate: true
|
|
11793
12302
|
});
|
|
11794
12303
|
return {
|
|
11795
|
-
relativePathFromCwd:
|
|
12304
|
+
relativePathFromCwd: join94(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11796
12305
|
frontmatter: rule.getFrontmatter(),
|
|
11797
12306
|
body: rule.getBody()
|
|
11798
12307
|
};
|
|
@@ -11811,7 +12320,7 @@ async function putRule({
|
|
|
11811
12320
|
relativePath: relativePathFromCwd,
|
|
11812
12321
|
intendedRootDir: process.cwd()
|
|
11813
12322
|
});
|
|
11814
|
-
const filename =
|
|
12323
|
+
const filename = basename25(relativePathFromCwd);
|
|
11815
12324
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11816
12325
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
11817
12326
|
throw new Error(
|
|
@@ -11821,7 +12330,7 @@ async function putRule({
|
|
|
11821
12330
|
try {
|
|
11822
12331
|
const existingRules = await listRules();
|
|
11823
12332
|
const isUpdate = existingRules.some(
|
|
11824
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
12333
|
+
(rule2) => rule2.relativePathFromCwd === join94(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11825
12334
|
);
|
|
11826
12335
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
11827
12336
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -11834,11 +12343,11 @@ async function putRule({
|
|
|
11834
12343
|
body,
|
|
11835
12344
|
validate: true
|
|
11836
12345
|
});
|
|
11837
|
-
const rulesDir =
|
|
12346
|
+
const rulesDir = join94(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11838
12347
|
await ensureDir(rulesDir);
|
|
11839
12348
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
11840
12349
|
return {
|
|
11841
|
-
relativePathFromCwd:
|
|
12350
|
+
relativePathFromCwd: join94(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11842
12351
|
frontmatter: rule.getFrontmatter(),
|
|
11843
12352
|
body: rule.getBody()
|
|
11844
12353
|
};
|
|
@@ -11853,12 +12362,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11853
12362
|
relativePath: relativePathFromCwd,
|
|
11854
12363
|
intendedRootDir: process.cwd()
|
|
11855
12364
|
});
|
|
11856
|
-
const filename =
|
|
11857
|
-
const fullPath =
|
|
12365
|
+
const filename = basename25(relativePathFromCwd);
|
|
12366
|
+
const fullPath = join94(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
11858
12367
|
try {
|
|
11859
12368
|
await removeFile(fullPath);
|
|
11860
12369
|
return {
|
|
11861
|
-
relativePathFromCwd:
|
|
12370
|
+
relativePathFromCwd: join94(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11862
12371
|
};
|
|
11863
12372
|
} catch (error) {
|
|
11864
12373
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11867,23 +12376,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11867
12376
|
}
|
|
11868
12377
|
}
|
|
11869
12378
|
var ruleToolSchemas = {
|
|
11870
|
-
listRules:
|
|
11871
|
-
getRule:
|
|
11872
|
-
relativePathFromCwd:
|
|
12379
|
+
listRules: z45.object({}),
|
|
12380
|
+
getRule: z45.object({
|
|
12381
|
+
relativePathFromCwd: z45.string()
|
|
11873
12382
|
}),
|
|
11874
|
-
putRule:
|
|
11875
|
-
relativePathFromCwd:
|
|
12383
|
+
putRule: z45.object({
|
|
12384
|
+
relativePathFromCwd: z45.string(),
|
|
11876
12385
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
11877
|
-
body:
|
|
12386
|
+
body: z45.string()
|
|
11878
12387
|
}),
|
|
11879
|
-
deleteRule:
|
|
11880
|
-
relativePathFromCwd:
|
|
12388
|
+
deleteRule: z45.object({
|
|
12389
|
+
relativePathFromCwd: z45.string()
|
|
11881
12390
|
})
|
|
11882
12391
|
};
|
|
11883
12392
|
var ruleTools = {
|
|
11884
12393
|
listRules: {
|
|
11885
12394
|
name: "listRules",
|
|
11886
|
-
description: `List all rules from ${
|
|
12395
|
+
description: `List all rules from ${join94(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11887
12396
|
parameters: ruleToolSchemas.listRules,
|
|
11888
12397
|
execute: async () => {
|
|
11889
12398
|
const rules = await listRules();
|
|
@@ -11925,8 +12434,8 @@ var ruleTools = {
|
|
|
11925
12434
|
};
|
|
11926
12435
|
|
|
11927
12436
|
// src/mcp/skills.ts
|
|
11928
|
-
import { basename as
|
|
11929
|
-
import { z as
|
|
12437
|
+
import { basename as basename26, dirname as dirname2, join as join95 } from "path";
|
|
12438
|
+
import { z as z46 } from "zod/mini";
|
|
11930
12439
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
11931
12440
|
var maxSkillsCount = 1e3;
|
|
11932
12441
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -11942,19 +12451,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
11942
12451
|
};
|
|
11943
12452
|
}
|
|
11944
12453
|
function extractDirName(relativeDirPathFromCwd) {
|
|
11945
|
-
const dirName =
|
|
12454
|
+
const dirName = basename26(relativeDirPathFromCwd);
|
|
11946
12455
|
if (!dirName) {
|
|
11947
12456
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
11948
12457
|
}
|
|
11949
12458
|
return dirName;
|
|
11950
12459
|
}
|
|
11951
12460
|
async function listSkills() {
|
|
11952
|
-
const skillsDir =
|
|
12461
|
+
const skillsDir = join95(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
11953
12462
|
try {
|
|
11954
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
12463
|
+
const skillDirPaths = await findFilesByGlobs(join95(skillsDir, "*"), { type: "dir" });
|
|
11955
12464
|
const skills = await Promise.all(
|
|
11956
12465
|
skillDirPaths.map(async (dirPath) => {
|
|
11957
|
-
const dirName =
|
|
12466
|
+
const dirName = basename26(dirPath);
|
|
11958
12467
|
if (!dirName) return null;
|
|
11959
12468
|
try {
|
|
11960
12469
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -11962,7 +12471,7 @@ async function listSkills() {
|
|
|
11962
12471
|
});
|
|
11963
12472
|
const frontmatter = skill.getFrontmatter();
|
|
11964
12473
|
return {
|
|
11965
|
-
relativeDirPathFromCwd:
|
|
12474
|
+
relativeDirPathFromCwd: join95(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11966
12475
|
frontmatter
|
|
11967
12476
|
};
|
|
11968
12477
|
} catch (error) {
|
|
@@ -11988,7 +12497,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
11988
12497
|
dirName
|
|
11989
12498
|
});
|
|
11990
12499
|
return {
|
|
11991
|
-
relativeDirPathFromCwd:
|
|
12500
|
+
relativeDirPathFromCwd: join95(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11992
12501
|
frontmatter: skill.getFrontmatter(),
|
|
11993
12502
|
body: skill.getBody(),
|
|
11994
12503
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12022,7 +12531,7 @@ async function putSkill({
|
|
|
12022
12531
|
try {
|
|
12023
12532
|
const existingSkills = await listSkills();
|
|
12024
12533
|
const isUpdate = existingSkills.some(
|
|
12025
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
12534
|
+
(skill2) => skill2.relativeDirPathFromCwd === join95(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12026
12535
|
);
|
|
12027
12536
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
12028
12537
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -12037,9 +12546,9 @@ async function putSkill({
|
|
|
12037
12546
|
otherFiles: aiDirFiles,
|
|
12038
12547
|
validate: true
|
|
12039
12548
|
});
|
|
12040
|
-
const skillDirPath =
|
|
12549
|
+
const skillDirPath = join95(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12041
12550
|
await ensureDir(skillDirPath);
|
|
12042
|
-
const skillFilePath =
|
|
12551
|
+
const skillFilePath = join95(skillDirPath, SKILL_FILE_NAME);
|
|
12043
12552
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
12044
12553
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
12045
12554
|
for (const file of otherFiles) {
|
|
@@ -12047,15 +12556,15 @@ async function putSkill({
|
|
|
12047
12556
|
relativePath: file.name,
|
|
12048
12557
|
intendedRootDir: skillDirPath
|
|
12049
12558
|
});
|
|
12050
|
-
const filePath =
|
|
12051
|
-
const fileDir =
|
|
12559
|
+
const filePath = join95(skillDirPath, file.name);
|
|
12560
|
+
const fileDir = join95(skillDirPath, dirname2(file.name));
|
|
12052
12561
|
if (fileDir !== skillDirPath) {
|
|
12053
12562
|
await ensureDir(fileDir);
|
|
12054
12563
|
}
|
|
12055
12564
|
await writeFileContent(filePath, file.body);
|
|
12056
12565
|
}
|
|
12057
12566
|
return {
|
|
12058
|
-
relativeDirPathFromCwd:
|
|
12567
|
+
relativeDirPathFromCwd: join95(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
12059
12568
|
frontmatter: skill.getFrontmatter(),
|
|
12060
12569
|
body: skill.getBody(),
|
|
12061
12570
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12077,13 +12586,13 @@ async function deleteSkill({
|
|
|
12077
12586
|
intendedRootDir: process.cwd()
|
|
12078
12587
|
});
|
|
12079
12588
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12080
|
-
const skillDirPath =
|
|
12589
|
+
const skillDirPath = join95(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12081
12590
|
try {
|
|
12082
12591
|
if (await directoryExists(skillDirPath)) {
|
|
12083
12592
|
await removeDirectory(skillDirPath);
|
|
12084
12593
|
}
|
|
12085
12594
|
return {
|
|
12086
|
-
relativeDirPathFromCwd:
|
|
12595
|
+
relativeDirPathFromCwd: join95(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12087
12596
|
};
|
|
12088
12597
|
} catch (error) {
|
|
12089
12598
|
throw new Error(
|
|
@@ -12094,29 +12603,29 @@ async function deleteSkill({
|
|
|
12094
12603
|
);
|
|
12095
12604
|
}
|
|
12096
12605
|
}
|
|
12097
|
-
var McpSkillFileSchema =
|
|
12098
|
-
name:
|
|
12099
|
-
body:
|
|
12606
|
+
var McpSkillFileSchema = z46.object({
|
|
12607
|
+
name: z46.string(),
|
|
12608
|
+
body: z46.string()
|
|
12100
12609
|
});
|
|
12101
12610
|
var skillToolSchemas = {
|
|
12102
|
-
listSkills:
|
|
12103
|
-
getSkill:
|
|
12104
|
-
relativeDirPathFromCwd:
|
|
12611
|
+
listSkills: z46.object({}),
|
|
12612
|
+
getSkill: z46.object({
|
|
12613
|
+
relativeDirPathFromCwd: z46.string()
|
|
12105
12614
|
}),
|
|
12106
|
-
putSkill:
|
|
12107
|
-
relativeDirPathFromCwd:
|
|
12615
|
+
putSkill: z46.object({
|
|
12616
|
+
relativeDirPathFromCwd: z46.string(),
|
|
12108
12617
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12109
|
-
body:
|
|
12110
|
-
otherFiles:
|
|
12618
|
+
body: z46.string(),
|
|
12619
|
+
otherFiles: z46.optional(z46.array(McpSkillFileSchema))
|
|
12111
12620
|
}),
|
|
12112
|
-
deleteSkill:
|
|
12113
|
-
relativeDirPathFromCwd:
|
|
12621
|
+
deleteSkill: z46.object({
|
|
12622
|
+
relativeDirPathFromCwd: z46.string()
|
|
12114
12623
|
})
|
|
12115
12624
|
};
|
|
12116
12625
|
var skillTools = {
|
|
12117
12626
|
listSkills: {
|
|
12118
12627
|
name: "listSkills",
|
|
12119
|
-
description: `List all skills from ${
|
|
12628
|
+
description: `List all skills from ${join95(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12120
12629
|
parameters: skillToolSchemas.listSkills,
|
|
12121
12630
|
execute: async () => {
|
|
12122
12631
|
const skills = await listSkills();
|
|
@@ -12159,12 +12668,12 @@ var skillTools = {
|
|
|
12159
12668
|
};
|
|
12160
12669
|
|
|
12161
12670
|
// src/mcp/subagents.ts
|
|
12162
|
-
import { basename as
|
|
12163
|
-
import { z as
|
|
12671
|
+
import { basename as basename27, join as join96 } from "path";
|
|
12672
|
+
import { z as z47 } from "zod/mini";
|
|
12164
12673
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12165
12674
|
var maxSubagentsCount = 1e3;
|
|
12166
12675
|
async function listSubagents() {
|
|
12167
|
-
const subagentsDir =
|
|
12676
|
+
const subagentsDir = join96(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12168
12677
|
try {
|
|
12169
12678
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12170
12679
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12177,7 +12686,7 @@ async function listSubagents() {
|
|
|
12177
12686
|
});
|
|
12178
12687
|
const frontmatter = subagent.getFrontmatter();
|
|
12179
12688
|
return {
|
|
12180
|
-
relativePathFromCwd:
|
|
12689
|
+
relativePathFromCwd: join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12181
12690
|
frontmatter
|
|
12182
12691
|
};
|
|
12183
12692
|
} catch (error) {
|
|
@@ -12199,14 +12708,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12199
12708
|
relativePath: relativePathFromCwd,
|
|
12200
12709
|
intendedRootDir: process.cwd()
|
|
12201
12710
|
});
|
|
12202
|
-
const filename =
|
|
12711
|
+
const filename = basename27(relativePathFromCwd);
|
|
12203
12712
|
try {
|
|
12204
12713
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12205
12714
|
relativeFilePath: filename,
|
|
12206
12715
|
validate: true
|
|
12207
12716
|
});
|
|
12208
12717
|
return {
|
|
12209
|
-
relativePathFromCwd:
|
|
12718
|
+
relativePathFromCwd: join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12210
12719
|
frontmatter: subagent.getFrontmatter(),
|
|
12211
12720
|
body: subagent.getBody()
|
|
12212
12721
|
};
|
|
@@ -12225,7 +12734,7 @@ async function putSubagent({
|
|
|
12225
12734
|
relativePath: relativePathFromCwd,
|
|
12226
12735
|
intendedRootDir: process.cwd()
|
|
12227
12736
|
});
|
|
12228
|
-
const filename =
|
|
12737
|
+
const filename = basename27(relativePathFromCwd);
|
|
12229
12738
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12230
12739
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12231
12740
|
throw new Error(
|
|
@@ -12235,7 +12744,7 @@ async function putSubagent({
|
|
|
12235
12744
|
try {
|
|
12236
12745
|
const existingSubagents = await listSubagents();
|
|
12237
12746
|
const isUpdate = existingSubagents.some(
|
|
12238
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
12747
|
+
(subagent2) => subagent2.relativePathFromCwd === join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12239
12748
|
);
|
|
12240
12749
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12241
12750
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12248,11 +12757,11 @@ async function putSubagent({
|
|
|
12248
12757
|
body,
|
|
12249
12758
|
validate: true
|
|
12250
12759
|
});
|
|
12251
|
-
const subagentsDir =
|
|
12760
|
+
const subagentsDir = join96(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12252
12761
|
await ensureDir(subagentsDir);
|
|
12253
12762
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12254
12763
|
return {
|
|
12255
|
-
relativePathFromCwd:
|
|
12764
|
+
relativePathFromCwd: join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12256
12765
|
frontmatter: subagent.getFrontmatter(),
|
|
12257
12766
|
body: subagent.getBody()
|
|
12258
12767
|
};
|
|
@@ -12267,12 +12776,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12267
12776
|
relativePath: relativePathFromCwd,
|
|
12268
12777
|
intendedRootDir: process.cwd()
|
|
12269
12778
|
});
|
|
12270
|
-
const filename =
|
|
12271
|
-
const fullPath =
|
|
12779
|
+
const filename = basename27(relativePathFromCwd);
|
|
12780
|
+
const fullPath = join96(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12272
12781
|
try {
|
|
12273
12782
|
await removeFile(fullPath);
|
|
12274
12783
|
return {
|
|
12275
|
-
relativePathFromCwd:
|
|
12784
|
+
relativePathFromCwd: join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12276
12785
|
};
|
|
12277
12786
|
} catch (error) {
|
|
12278
12787
|
throw new Error(
|
|
@@ -12284,23 +12793,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12284
12793
|
}
|
|
12285
12794
|
}
|
|
12286
12795
|
var subagentToolSchemas = {
|
|
12287
|
-
listSubagents:
|
|
12288
|
-
getSubagent:
|
|
12289
|
-
relativePathFromCwd:
|
|
12796
|
+
listSubagents: z47.object({}),
|
|
12797
|
+
getSubagent: z47.object({
|
|
12798
|
+
relativePathFromCwd: z47.string()
|
|
12290
12799
|
}),
|
|
12291
|
-
putSubagent:
|
|
12292
|
-
relativePathFromCwd:
|
|
12800
|
+
putSubagent: z47.object({
|
|
12801
|
+
relativePathFromCwd: z47.string(),
|
|
12293
12802
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12294
|
-
body:
|
|
12803
|
+
body: z47.string()
|
|
12295
12804
|
}),
|
|
12296
|
-
deleteSubagent:
|
|
12297
|
-
relativePathFromCwd:
|
|
12805
|
+
deleteSubagent: z47.object({
|
|
12806
|
+
relativePathFromCwd: z47.string()
|
|
12298
12807
|
})
|
|
12299
12808
|
};
|
|
12300
12809
|
var subagentTools = {
|
|
12301
12810
|
listSubagents: {
|
|
12302
12811
|
name: "listSubagents",
|
|
12303
|
-
description: `List all subagents from ${
|
|
12812
|
+
description: `List all subagents from ${join96(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12304
12813
|
parameters: subagentToolSchemas.listSubagents,
|
|
12305
12814
|
execute: async () => {
|
|
12306
12815
|
const subagents = await listSubagents();
|
|
@@ -12342,20 +12851,20 @@ var subagentTools = {
|
|
|
12342
12851
|
};
|
|
12343
12852
|
|
|
12344
12853
|
// src/mcp/tools.ts
|
|
12345
|
-
var rulesyncFeatureSchema =
|
|
12346
|
-
var rulesyncOperationSchema =
|
|
12347
|
-
var skillFileSchema =
|
|
12348
|
-
name:
|
|
12349
|
-
body:
|
|
12854
|
+
var rulesyncFeatureSchema = z48.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
12855
|
+
var rulesyncOperationSchema = z48.enum(["list", "get", "put", "delete"]);
|
|
12856
|
+
var skillFileSchema = z48.object({
|
|
12857
|
+
name: z48.string(),
|
|
12858
|
+
body: z48.string()
|
|
12350
12859
|
});
|
|
12351
|
-
var rulesyncToolSchema =
|
|
12860
|
+
var rulesyncToolSchema = z48.object({
|
|
12352
12861
|
feature: rulesyncFeatureSchema,
|
|
12353
12862
|
operation: rulesyncOperationSchema,
|
|
12354
|
-
targetPathFromCwd:
|
|
12355
|
-
frontmatter:
|
|
12356
|
-
body:
|
|
12357
|
-
otherFiles:
|
|
12358
|
-
content:
|
|
12863
|
+
targetPathFromCwd: z48.optional(z48.string()),
|
|
12864
|
+
frontmatter: z48.optional(z48.unknown()),
|
|
12865
|
+
body: z48.optional(z48.string()),
|
|
12866
|
+
otherFiles: z48.optional(z48.array(skillFileSchema)),
|
|
12867
|
+
content: z48.optional(z48.string())
|
|
12359
12868
|
});
|
|
12360
12869
|
var supportedOperationsByFeature = {
|
|
12361
12870
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -12551,7 +13060,7 @@ async function mcpCommand({ version }) {
|
|
|
12551
13060
|
}
|
|
12552
13061
|
|
|
12553
13062
|
// src/cli/index.ts
|
|
12554
|
-
var getVersion = () => "5.
|
|
13063
|
+
var getVersion = () => "5.1.1";
|
|
12555
13064
|
var main = async () => {
|
|
12556
13065
|
const program = new Command();
|
|
12557
13066
|
const version = getVersion();
|