rulesync 16.13.0 → 16.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/index.cjs +4 -4
- package/dist/cli/index.js +4 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/{import-Dswkc7Ub.js → import-Ds0QeVp6.js} +300 -18
- package/dist/import-Ds0QeVp6.js.map +1 -0
- package/dist/{import-ChnrtxiJ.cjs → import-DsiSzsJH.cjs} +314 -32
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/import-Dswkc7Ub.js.map +0 -1
|
@@ -419,7 +419,8 @@ const permissionsProcessorToolTargetTuple = [
|
|
|
419
419
|
"takt",
|
|
420
420
|
"vibe",
|
|
421
421
|
"warp",
|
|
422
|
-
"zed"
|
|
422
|
+
"zed",
|
|
423
|
+
"zoocode"
|
|
423
424
|
];
|
|
424
425
|
const checksProcessorToolTargetTuple = [
|
|
425
426
|
"amp",
|
|
@@ -5345,6 +5346,7 @@ const RulesyncRuleFrontmatterSchema = z.object({
|
|
|
5345
5346
|
systemPrompt: z.optional(z.enum(["append"])),
|
|
5346
5347
|
contextFile: z.optional(z.enum(["override"]))
|
|
5347
5348
|
})),
|
|
5349
|
+
roo: z.optional(z.looseObject({ mode: z.optional(z.string()) })),
|
|
5348
5350
|
takt: z.optional(z.looseObject({
|
|
5349
5351
|
name: z.optional(z.string()),
|
|
5350
5352
|
extends: z.optional(z.string()),
|
|
@@ -7786,7 +7788,9 @@ const SHARED_CONFIG_OWNERSHIP = {
|
|
|
7786
7788
|
ownedKeys: [
|
|
7787
7789
|
"chat.tools.terminal.autoApprove",
|
|
7788
7790
|
"chat.tools.edits.autoApprove",
|
|
7789
|
-
"chat.tools.urls.autoApprove"
|
|
7791
|
+
"chat.tools.urls.autoApprove",
|
|
7792
|
+
"zoo-code.allowedCommands",
|
|
7793
|
+
"zoo-code.deniedCommands"
|
|
7790
7794
|
]
|
|
7791
7795
|
} }
|
|
7792
7796
|
},
|
|
@@ -12750,6 +12754,21 @@ const ROO_DIR = ".roo";
|
|
|
12750
12754
|
const ROO_COMMANDS_DIR_PATH = join(ROO_DIR, "commands");
|
|
12751
12755
|
const ROO_SKILLS_DIR_PATH = join(ROO_DIR, "skills");
|
|
12752
12756
|
const ROO_MCP_FILE_NAME = "mcp.json";
|
|
12757
|
+
/**
|
|
12758
|
+
* Mode slugs Roo/Zoo Code themselves accept for a `rules-{mode}` directory:
|
|
12759
|
+
* the loader builds the directory name by interpolating the active mode slug,
|
|
12760
|
+
* and custom-mode slugs are restricted to this alphabet. Validating against it
|
|
12761
|
+
* also keeps an authored value from escaping `.roo/` through path separators or
|
|
12762
|
+
* `..` segments.
|
|
12763
|
+
*/
|
|
12764
|
+
const ROO_MODE_SLUG_PATTERN = /^[a-zA-Z0-9-]+$/;
|
|
12765
|
+
/**
|
|
12766
|
+
* `.roo/rules-{mode}/` — the mode-specific rule directory Roo/Zoo Code load
|
|
12767
|
+
* INSTEAD of `.roo/rules/` while that mode is active. The relative path is the
|
|
12768
|
+
* same in global scope, where it resolves under `~/.roo/`.
|
|
12769
|
+
* @see https://github.com/Zoo-Code-Org/Zoo-Code/blob/main/src/core/prompts/sections/custom-instructions.ts
|
|
12770
|
+
*/
|
|
12771
|
+
const rooModeRulesDirName = (mode) => `rules-${mode}`;
|
|
12753
12772
|
const ROO_IGNORE_FILE_NAME = ".rooignore";
|
|
12754
12773
|
/**
|
|
12755
12774
|
* Roo Code reads project-level custom modes from a single aggregated
|
|
@@ -27775,6 +27794,27 @@ const defaultGetFactory$3 = (target) => {
|
|
|
27775
27794
|
if (!factory) throw new Error(`Unsupported tool target: ${target}`);
|
|
27776
27795
|
return factory;
|
|
27777
27796
|
};
|
|
27797
|
+
/**
|
|
27798
|
+
* Warn about per-server tool filters the target tool cannot express.
|
|
27799
|
+
*
|
|
27800
|
+
* `enabledTools`/`disabledTools` are canonical fields, so a single
|
|
27801
|
+
* `.rulesync/.mcp.json` can carry a filter that only some targets read. The
|
|
27802
|
+
* unsupported ones are stripped before generation (writing them would produce a
|
|
27803
|
+
* key the tool discards on load), which used to happen silently — the filter
|
|
27804
|
+
* simply did not apply and nothing said so. Warning names the servers whose
|
|
27805
|
+
* filter is being dropped for this target so the gap is visible at generate
|
|
27806
|
+
* time rather than in the tool's behavior.
|
|
27807
|
+
*
|
|
27808
|
+
* Only fields actually present are reported, so a config that never authored
|
|
27809
|
+
* the filter stays quiet.
|
|
27810
|
+
*/
|
|
27811
|
+
function warnStrippedMcpServerFields({ mcpServers, fields, toolTarget, logger }) {
|
|
27812
|
+
for (const field of fields) {
|
|
27813
|
+
const serverNames = Object.entries(mcpServers ?? {}).filter(([, serverConfig]) => serverConfig[field] !== void 0).map(([serverName]) => serverName);
|
|
27814
|
+
if (serverNames.length === 0) continue;
|
|
27815
|
+
logger.warn(`${toolTarget} does not read the per-server \`${field}\` MCP tool filter; dropping it from ${serverNames.join(", ")}.`);
|
|
27816
|
+
}
|
|
27817
|
+
}
|
|
27778
27818
|
var McpProcessor = class extends FeatureProcessor {
|
|
27779
27819
|
toolTarget;
|
|
27780
27820
|
global;
|
|
@@ -27854,6 +27894,12 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
27854
27894
|
const fieldsToStrip = [];
|
|
27855
27895
|
if (!factory.meta.supportsEnabledTools) fieldsToStrip.push("enabledTools");
|
|
27856
27896
|
if (!factory.meta.supportsDisabledTools) fieldsToStrip.push("disabledTools");
|
|
27897
|
+
warnStrippedMcpServerFields({
|
|
27898
|
+
mcpServers: targetedRulesyncMcp.getJson().mcpServers,
|
|
27899
|
+
fields: fieldsToStrip,
|
|
27900
|
+
toolTarget: this.toolTarget,
|
|
27901
|
+
logger: this.logger
|
|
27902
|
+
});
|
|
27857
27903
|
const filteredRulesyncMcp = targetedRulesyncMcp.stripMcpServerFields(fieldsToStrip);
|
|
27858
27904
|
return await factory.class.fromRulesyncMcp({
|
|
27859
27905
|
outputRoot: this.outputRoot,
|
|
@@ -33507,7 +33553,7 @@ function extractKiroOverride(toolsSettings) {
|
|
|
33507
33553
|
if (Object.keys(overrideToolsSettings).length === 0) return void 0;
|
|
33508
33554
|
return { toolsSettings: overrideToolsSettings };
|
|
33509
33555
|
}
|
|
33510
|
-
function asStringArray(value) {
|
|
33556
|
+
function asStringArray$1(value) {
|
|
33511
33557
|
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
33512
33558
|
}
|
|
33513
33559
|
/**
|
|
@@ -33517,8 +33563,8 @@ function asStringArray(value) {
|
|
|
33517
33563
|
*/
|
|
33518
33564
|
function rulesFromArrays(settings, allowKey, denyKey) {
|
|
33519
33565
|
const rules = {};
|
|
33520
|
-
for (const pattern of asStringArray(settings[allowKey])) rules[pattern] = "allow";
|
|
33521
|
-
for (const pattern of asStringArray(settings[denyKey])) rules[pattern] = "deny";
|
|
33566
|
+
for (const pattern of asStringArray$1(settings[allowKey])) rules[pattern] = "allow";
|
|
33567
|
+
for (const pattern of asStringArray$1(settings[denyKey])) rules[pattern] = "deny";
|
|
33522
33568
|
return rules;
|
|
33523
33569
|
}
|
|
33524
33570
|
//#endregion
|
|
@@ -36430,6 +36476,181 @@ var ZedPermissions = class ZedPermissions extends ToolPermissions {
|
|
|
36430
36476
|
}
|
|
36431
36477
|
};
|
|
36432
36478
|
//#endregion
|
|
36479
|
+
//#region src/constants/zoocode-paths.ts
|
|
36480
|
+
/**
|
|
36481
|
+
* Zoo Code is a VS Code extension, so its committable command allow/deny lists
|
|
36482
|
+
* are workspace settings rather than files in the `.roo/` agent-asset tree that
|
|
36483
|
+
* the other Zoo Code features write.
|
|
36484
|
+
*
|
|
36485
|
+
* `zoo-code.allowedCommands` / `zoo-code.deniedCommands` are contributed with no
|
|
36486
|
+
* `scope`, which in VS Code means `window` scope — settable in a workspace's
|
|
36487
|
+
* `.vscode/settings.json` — and `ClineProvider.mergeCommandLists()` unions the
|
|
36488
|
+
* workspace values into the effective auto-approval lists.
|
|
36489
|
+
*
|
|
36490
|
+
* The `zoo-code.*` namespace is Zoo-era (the v3.74.0 rebrand); the archived Roo
|
|
36491
|
+
* Code lineage spelled the same settings `roo-cline.*`, so this surface is
|
|
36492
|
+
* deliberately not shared with the `roo` target.
|
|
36493
|
+
*
|
|
36494
|
+
* @see https://github.com/Zoo-Code-Org/Zoo-Code/blob/main/src/package.json
|
|
36495
|
+
* @see https://github.com/Zoo-Code-Org/Zoo-Code/blob/main/src/core/webview/ClineProvider.ts
|
|
36496
|
+
*/
|
|
36497
|
+
const ZOOCODE_VSCODE_SETTINGS_DIR = ".vscode";
|
|
36498
|
+
const ZOOCODE_VSCODE_SETTINGS_FILE_NAME = "settings.json";
|
|
36499
|
+
const ZOOCODE_ALLOWED_COMMANDS_KEY = "zoo-code.allowedCommands";
|
|
36500
|
+
const ZOOCODE_DENIED_COMMANDS_KEY = "zoo-code.deniedCommands";
|
|
36501
|
+
//#endregion
|
|
36502
|
+
//#region src/features/permissions/zoocode-permissions.ts
|
|
36503
|
+
/**
|
|
36504
|
+
* The canonical category Zoo Code's command lists correspond to. Zoo Code gates
|
|
36505
|
+
* terminal command execution and nothing else through these settings, so only
|
|
36506
|
+
* `bash` maps; `read`/`write`/`edit`/`webfetch` have no workspace-settable
|
|
36507
|
+
* counterpart in the extension's contributions.
|
|
36508
|
+
*/
|
|
36509
|
+
const COMMAND_CATEGORY = "bash";
|
|
36510
|
+
function asStringArray(value) {
|
|
36511
|
+
if (!Array.isArray(value)) return [];
|
|
36512
|
+
return value.filter((entry) => typeof entry === "string");
|
|
36513
|
+
}
|
|
36514
|
+
/**
|
|
36515
|
+
* Split one canonical category's rules into Zoo Code's two command lists.
|
|
36516
|
+
*
|
|
36517
|
+
* Zoo Code matches these entries as command **prefixes**: a command runs
|
|
36518
|
+
* without a confirmation prompt when it starts with an `allowedCommands` entry,
|
|
36519
|
+
* and is refused outright when it starts with a `deniedCommands` entry (deny
|
|
36520
|
+
* wins). `ask` is represented by listing the pattern in neither list, which
|
|
36521
|
+
* leaves Zoo Code's default approval prompt in charge.
|
|
36522
|
+
*
|
|
36523
|
+
* Each list is `undefined` when it would be empty, so the key is retracted from
|
|
36524
|
+
* the settings file rather than written as an empty array — an empty
|
|
36525
|
+
* `allowedCommands` and an absent one mean the same thing to Zoo Code, and the
|
|
36526
|
+
* absent form leaves no rulesync residue behind.
|
|
36527
|
+
*/
|
|
36528
|
+
function buildCommandLists(rules) {
|
|
36529
|
+
const allowed = [];
|
|
36530
|
+
const denied = [];
|
|
36531
|
+
for (const [pattern, action] of Object.entries(rules)) if (action === "allow") allowed.push(pattern);
|
|
36532
|
+
else if (action === "deny") denied.push(pattern);
|
|
36533
|
+
return {
|
|
36534
|
+
allowed: allowed.length > 0 ? allowed : void 0,
|
|
36535
|
+
denied: denied.length > 0 ? denied : void 0
|
|
36536
|
+
};
|
|
36537
|
+
}
|
|
36538
|
+
/**
|
|
36539
|
+
* Permissions generator for Zoo Code.
|
|
36540
|
+
*
|
|
36541
|
+
* Zoo Code has no policy file in its `.roo/` tree: the committable command
|
|
36542
|
+
* allow/deny lists are VS Code workspace settings
|
|
36543
|
+
* (`zoo-code.allowedCommands` / `zoo-code.deniedCommands` in
|
|
36544
|
+
* `.vscode/settings.json`), which `ClineProvider.mergeCommandLists()` unions
|
|
36545
|
+
* into the lists the auto-approval decision reads. That file is a
|
|
36546
|
+
* general-purpose workspace settings file with many unrelated keys, so reads
|
|
36547
|
+
* and writes merge into the existing JSONC (touching only the two managed keys)
|
|
36548
|
+
* and the file is never deleted.
|
|
36549
|
+
*
|
|
36550
|
+
* Only project scope is modeled: VS Code's user-scope `settings.json` lives at
|
|
36551
|
+
* a platform-dependent path outside rulesync's home-relative global model.
|
|
36552
|
+
*
|
|
36553
|
+
* The `roo` target deliberately does not get this adapter. The settings
|
|
36554
|
+
* namespace is Zoo-era (`roo-cline.*` before the v3.74.0 rebrand), and Roo Code
|
|
36555
|
+
* is EOL with its repository archived, so emitting `zoo-code.*` keys for a
|
|
36556
|
+
* `--targets roo` generate would write settings that Roo itself never reads.
|
|
36557
|
+
*
|
|
36558
|
+
* @see https://github.com/Zoo-Code-Org/Zoo-Code/blob/main/src/package.json
|
|
36559
|
+
* @see https://github.com/Zoo-Code-Org/Zoo-Code/blob/main/src/core/auto-approval/commands.ts
|
|
36560
|
+
*/
|
|
36561
|
+
var ZoocodePermissions = class ZoocodePermissions extends ToolPermissions {
|
|
36562
|
+
constructor(params) {
|
|
36563
|
+
super({
|
|
36564
|
+
...params,
|
|
36565
|
+
fileContent: params.fileContent ?? "{}"
|
|
36566
|
+
});
|
|
36567
|
+
}
|
|
36568
|
+
/**
|
|
36569
|
+
* `.vscode/settings.json` is a user-managed workspace file with unrelated
|
|
36570
|
+
* settings, so it must not be deleted.
|
|
36571
|
+
*/
|
|
36572
|
+
isDeletable() {
|
|
36573
|
+
return false;
|
|
36574
|
+
}
|
|
36575
|
+
static getSettablePaths(_options = {}) {
|
|
36576
|
+
return {
|
|
36577
|
+
relativeDirPath: ZOOCODE_VSCODE_SETTINGS_DIR,
|
|
36578
|
+
relativeFilePath: ZOOCODE_VSCODE_SETTINGS_FILE_NAME
|
|
36579
|
+
};
|
|
36580
|
+
}
|
|
36581
|
+
static async fromFile({ outputRoot = process.cwd(), validate = true }) {
|
|
36582
|
+
const paths = ZoocodePermissions.getSettablePaths();
|
|
36583
|
+
const fileContent = await readFileContentOrNull(join(outputRoot, paths.relativeDirPath, paths.relativeFilePath)) ?? "{}";
|
|
36584
|
+
return new ZoocodePermissions({
|
|
36585
|
+
outputRoot,
|
|
36586
|
+
relativeDirPath: paths.relativeDirPath,
|
|
36587
|
+
relativeFilePath: paths.relativeFilePath,
|
|
36588
|
+
fileContent,
|
|
36589
|
+
validate
|
|
36590
|
+
});
|
|
36591
|
+
}
|
|
36592
|
+
static async fromRulesyncPermissions({ outputRoot = process.cwd(), rulesyncPermissions }) {
|
|
36593
|
+
const paths = ZoocodePermissions.getSettablePaths();
|
|
36594
|
+
const filePath = join(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
36595
|
+
const existingContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
36596
|
+
const rules = rulesyncPermissions.getJson().permission[COMMAND_CATEGORY];
|
|
36597
|
+
const patch = {};
|
|
36598
|
+
if (rules !== void 0) {
|
|
36599
|
+
const { allowed, denied } = buildCommandLists(rules);
|
|
36600
|
+
patch[ZOOCODE_ALLOWED_COMMANDS_KEY] = allowed;
|
|
36601
|
+
patch[ZOOCODE_DENIED_COMMANDS_KEY] = denied;
|
|
36602
|
+
}
|
|
36603
|
+
return new ZoocodePermissions({
|
|
36604
|
+
outputRoot,
|
|
36605
|
+
relativeDirPath: paths.relativeDirPath,
|
|
36606
|
+
relativeFilePath: paths.relativeFilePath,
|
|
36607
|
+
fileContent: applySharedConfigPatch({
|
|
36608
|
+
fileKey: sharedConfigFileKey(paths),
|
|
36609
|
+
feature: "permissions",
|
|
36610
|
+
existingContent,
|
|
36611
|
+
patch,
|
|
36612
|
+
filePath
|
|
36613
|
+
}),
|
|
36614
|
+
validate: true
|
|
36615
|
+
});
|
|
36616
|
+
}
|
|
36617
|
+
toRulesyncPermissions() {
|
|
36618
|
+
let settings;
|
|
36619
|
+
try {
|
|
36620
|
+
settings = parseSharedConfig({
|
|
36621
|
+
format: "jsonc",
|
|
36622
|
+
fileContent: this.getFileContent() || "{}",
|
|
36623
|
+
filePath: join(this.getRelativeDirPath(), this.getRelativeFilePath()),
|
|
36624
|
+
invalidRootPolicy: "error",
|
|
36625
|
+
jsoncParseErrors: "error"
|
|
36626
|
+
});
|
|
36627
|
+
} catch (error) {
|
|
36628
|
+
throw new Error(`Failed to parse Zoo Code VS Code settings in ${join(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`, { cause: error });
|
|
36629
|
+
}
|
|
36630
|
+
const rules = {};
|
|
36631
|
+
for (const pattern of asStringArray(settings[ZOOCODE_ALLOWED_COMMANDS_KEY])) rules[pattern] = "allow";
|
|
36632
|
+
for (const pattern of asStringArray(settings[ZOOCODE_DENIED_COMMANDS_KEY])) rules[pattern] = "deny";
|
|
36633
|
+
const permission = {};
|
|
36634
|
+
if (Object.keys(rules).length > 0) permission[COMMAND_CATEGORY] = rules;
|
|
36635
|
+
return this.toRulesyncPermissionsDefault({ fileContent: JSON.stringify({ permission }, null, 2) });
|
|
36636
|
+
}
|
|
36637
|
+
validate() {
|
|
36638
|
+
return {
|
|
36639
|
+
success: true,
|
|
36640
|
+
error: null
|
|
36641
|
+
};
|
|
36642
|
+
}
|
|
36643
|
+
static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath }) {
|
|
36644
|
+
return new ZoocodePermissions({
|
|
36645
|
+
outputRoot,
|
|
36646
|
+
relativeDirPath,
|
|
36647
|
+
relativeFilePath,
|
|
36648
|
+
fileContent: "{}",
|
|
36649
|
+
validate: false
|
|
36650
|
+
});
|
|
36651
|
+
}
|
|
36652
|
+
};
|
|
36653
|
+
//#endregion
|
|
36433
36654
|
//#region src/features/permissions/permissions-processor.ts
|
|
36434
36655
|
const PermissionsProcessorToolTargetSchema = z.enum(permissionsProcessorToolTargetTuple);
|
|
36435
36656
|
const toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
@@ -36672,6 +36893,14 @@ const toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
|
36672
36893
|
supportsGlobal: true,
|
|
36673
36894
|
supportsImport: true
|
|
36674
36895
|
}
|
|
36896
|
+
}],
|
|
36897
|
+
["zoocode", {
|
|
36898
|
+
class: ZoocodePermissions,
|
|
36899
|
+
meta: {
|
|
36900
|
+
supportsProject: true,
|
|
36901
|
+
supportsGlobal: false,
|
|
36902
|
+
supportsImport: true
|
|
36903
|
+
}
|
|
36675
36904
|
}]
|
|
36676
36905
|
]);
|
|
36677
36906
|
var PermissionsProcessor = class extends FeatureProcessor {
|
|
@@ -52051,11 +52280,12 @@ var RooRule = class RooRule extends ToolRule {
|
|
|
52051
52280
|
static getSettablePaths(_options = {}) {
|
|
52052
52281
|
return { nonRoot: { relativeDirPath: buildToolPath(ROO_DIR, "rules", _options.excludeToolDir) } };
|
|
52053
52282
|
}
|
|
52054
|
-
static async fromFile({ outputRoot = process.cwd(), relativeFilePath, validate = true }) {
|
|
52055
|
-
const
|
|
52283
|
+
static async fromFile({ outputRoot = process.cwd(), relativeFilePath, relativeDirPath: overrideDirPath, validate = true }) {
|
|
52284
|
+
const relativeDirPath = overrideDirPath !== void 0 && RooRule.extractModeFromDirPath(overrideDirPath) !== void 0 ? overrideDirPath : this.getSettablePaths().nonRoot.relativeDirPath;
|
|
52285
|
+
const fileContent = await readFileContent(join(outputRoot, relativeDirPath, relativeFilePath));
|
|
52056
52286
|
return new RooRule({
|
|
52057
52287
|
outputRoot,
|
|
52058
|
-
relativeDirPath
|
|
52288
|
+
relativeDirPath,
|
|
52059
52289
|
relativeFilePath,
|
|
52060
52290
|
fileContent,
|
|
52061
52291
|
validate,
|
|
@@ -52063,12 +52293,16 @@ var RooRule = class RooRule extends ToolRule {
|
|
|
52063
52293
|
});
|
|
52064
52294
|
}
|
|
52065
52295
|
static fromRulesyncRule({ outputRoot = process.cwd(), rulesyncRule, validate = true }) {
|
|
52066
|
-
|
|
52296
|
+
const params = this.buildToolRuleParamsDefault({
|
|
52067
52297
|
outputRoot,
|
|
52068
52298
|
rulesyncRule,
|
|
52069
52299
|
validate,
|
|
52070
52300
|
nonRootPath: this.getSettablePaths().nonRoot
|
|
52071
|
-
})
|
|
52301
|
+
});
|
|
52302
|
+
const mode = rulesyncRule.getFrontmatter().roo?.mode;
|
|
52303
|
+
if (!params.root && mode !== void 0 && mode !== "") if (!ROO_MODE_SLUG_PATTERN.test(mode)) warnWithFallback(void 0, `Ignoring roo.mode "${mode}" on ${rulesyncRule.getRelativeFilePath()}: a mode slug may contain only letters, digits and hyphens. Writing the rule to ${params.relativeDirPath} instead.`);
|
|
52304
|
+
else params.relativeDirPath = join(dirname(params.relativeDirPath), rooModeRulesDirName(mode));
|
|
52305
|
+
return new RooRule(params);
|
|
52072
52306
|
}
|
|
52073
52307
|
/**
|
|
52074
52308
|
* Extract mode slug from file path for mode-specific rules
|
|
@@ -52080,8 +52314,51 @@ var RooRule = class RooRule extends ToolRule {
|
|
|
52080
52314
|
const singleFileMatch = filePath.match(/\.(roo|cline)rules-([a-zA-Z0-9-]+)$/);
|
|
52081
52315
|
if (singleFileMatch) return singleFileMatch[2];
|
|
52082
52316
|
}
|
|
52317
|
+
/**
|
|
52318
|
+
* The mode slug of a `.roo/rules-{mode}/` directory, or `undefined` for the
|
|
52319
|
+
* generic `.roo/rules/` directory and anything else. Path-shaped input is
|
|
52320
|
+
* rejected by the slug pattern, so a crafted directory name cannot be lifted
|
|
52321
|
+
* back into frontmatter.
|
|
52322
|
+
*/
|
|
52323
|
+
static extractModeFromDirPath(relativeDirPath) {
|
|
52324
|
+
for (const segment of toPosixPath(relativeDirPath).split("/")) {
|
|
52325
|
+
if (!segment.startsWith("rules-")) continue;
|
|
52326
|
+
const mode = segment.slice(6);
|
|
52327
|
+
if (ROO_MODE_SLUG_PATTERN.test(mode)) return mode;
|
|
52328
|
+
}
|
|
52329
|
+
}
|
|
52083
52330
|
toRulesyncRule() {
|
|
52084
|
-
|
|
52331
|
+
const mode = RooRule.extractModeFromDirPath(this.getRelativeDirPath());
|
|
52332
|
+
if (mode === void 0) return this.toRulesyncRuleDefault();
|
|
52333
|
+
const baseName = this.getRelativeFilePath().replace(/\.md$/, "");
|
|
52334
|
+
const suffix = `-${mode}`;
|
|
52335
|
+
const importedName = baseName.endsWith(suffix) ? baseName : `${baseName}${suffix}`;
|
|
52336
|
+
return new RulesyncRule({
|
|
52337
|
+
outputRoot: this.getOutputRoot(),
|
|
52338
|
+
relativeDirPath: RulesyncRule.getSettablePaths().recommended.relativeDirPath,
|
|
52339
|
+
relativeFilePath: `${importedName}.md`,
|
|
52340
|
+
frontmatter: {
|
|
52341
|
+
root: false,
|
|
52342
|
+
targets: [this.constructor.getToolTargetName()],
|
|
52343
|
+
description: this.description,
|
|
52344
|
+
globs: this.globs ?? [],
|
|
52345
|
+
roo: { mode }
|
|
52346
|
+
},
|
|
52347
|
+
body: this.getFileContent(),
|
|
52348
|
+
validate: true
|
|
52349
|
+
});
|
|
52350
|
+
}
|
|
52351
|
+
/**
|
|
52352
|
+
* Mode-specific rule directories (`.roo/rules-{mode}/`), which Roo/Zoo Code
|
|
52353
|
+
* load instead of `.roo/rules/` while that mode is active. Import-only: the
|
|
52354
|
+
* generic directory is the only one the deletion sweep enumerates, because a
|
|
52355
|
+
* `rules-*` glob would also match mode rules a user wrote by hand.
|
|
52356
|
+
*/
|
|
52357
|
+
static getNestedFilePatterns({ outputRoot }) {
|
|
52358
|
+
return {
|
|
52359
|
+
include: [`${toPosixPath(outputRoot)}/${toPosixPath(ROO_DIR)}/rules-*/**/*.md`],
|
|
52360
|
+
ignore: []
|
|
52361
|
+
};
|
|
52085
52362
|
}
|
|
52086
52363
|
validate() {
|
|
52087
52364
|
return {
|
|
@@ -52102,10 +52379,18 @@ var RooRule = class RooRule extends ToolRule {
|
|
|
52102
52379
|
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
52103
52380
|
return this.isTargetedByRulesyncRuleDefault({
|
|
52104
52381
|
rulesyncRule,
|
|
52105
|
-
toolTarget:
|
|
52382
|
+
toolTarget: this.getToolTargetName()
|
|
52106
52383
|
});
|
|
52107
52384
|
}
|
|
52108
52385
|
/**
|
|
52386
|
+
* The tool target this class imports as. `ZoocodeRule` narrows the same
|
|
52387
|
+
* `.roo/` adapters to the `zoocode` target, so the name has to come from the
|
|
52388
|
+
* class rather than a literal.
|
|
52389
|
+
*/
|
|
52390
|
+
static getToolTargetName() {
|
|
52391
|
+
return "roo";
|
|
52392
|
+
}
|
|
52393
|
+
/**
|
|
52109
52394
|
* Glob for the `separate-local-file` deletion; Roo reads `AGENTS.local.md`
|
|
52110
52395
|
* at the project root, not under `.roo/` (mirrors rovodev).
|
|
52111
52396
|
*/
|
|
@@ -52638,11 +52923,8 @@ var ZedRule = class ZedRule extends ToolRule {
|
|
|
52638
52923
|
* @see https://docs.zoocode.dev
|
|
52639
52924
|
*/
|
|
52640
52925
|
var ZoocodeRule = class extends RooRule {
|
|
52641
|
-
static
|
|
52642
|
-
return
|
|
52643
|
-
rulesyncRule,
|
|
52644
|
-
toolTarget: "zoocode"
|
|
52645
|
-
});
|
|
52926
|
+
static getToolTargetName() {
|
|
52927
|
+
return "zoocode";
|
|
52646
52928
|
}
|
|
52647
52929
|
};
|
|
52648
52930
|
//#endregion
|
|
@@ -55611,4 +55893,4 @@ async function importChecksCore(params) {
|
|
|
55611
55893
|
//#endregion
|
|
55612
55894
|
export { JsonLogger as $, RULESYNC_PERMISSIONS_LEGACY_FILE_NAME as $t, RulesyncRuleFrontmatterSchema as A, ALL_TOOL_TARGETS_WITH_WILDCARD as At, RulesyncCheck as B, RULESYNC_CURATED_RULES_RELATIVE_DIR_PATH as Bt, CODEXCLI_DIR as C, removeTempDirectory as Ct, RulesyncSkill as D, writeFileBuffer as Dt, RulesyncSubagentFrontmatterSchema as E, toPosixPath as Et, getRulesyncSourceCandidates as F, RULESYNC_AIIGNORE_RELATIVE_FILE_PATH as Ft, SKILL_FILE_NAME as G, RULESYNC_IGNORE_RELATIVE_FILE_PATH as Gt, stringifyFrontmatter as H, RULESYNC_HOOKS_FILE_NAME as Ht, resolveRulesyncSourceWritePath as I, RULESYNC_CHECKS_RELATIVE_DIR_PATH as It, ConfigFileSchema as J, RULESYNC_MCP_LEGACY_FILE_NAME as Jt, ConfigResolver as K, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH as Kt, parseJsonc as L, RULESYNC_COMMANDS_RELATIVE_DIR_PATH as Lt, RulesyncMcp as M, ToolTargetSchema as Mt, RulesyncIgnore as N, MAX_FILE_SIZE as Nt, RulesyncSkillFrontmatterSchema as O, writeFileContent as Ot, RulesyncHooks as P, RULESYNC_AIIGNORE_FILE_NAME as Pt, ConsoleLogger as Q, RULESYNC_PERMISSIONS_FILE_NAME as Qt, RulesyncCommand as R, RULESYNC_CONFIG_RELATIVE_FILE_PATH as Rt, CODEXCLI_BASH_RULES_FILE_NAME as S, removeFileStrict as St, RulesyncSubagent as T, runWithDirectoryRollback as Tt, loadYaml as U, RULESYNC_HOOKS_LEGACY_FILE_NAME as Ut, RulesyncCheckFrontmatterSchema as V, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH as Vt, SHARED_USER_MANAGED_CONFIG_PATHS as W, RULESYNC_HOOKS_RELATIVE_FILE_PATH as Wt, SourceEntrySchema as X, RULESYNC_MCP_SCHEMA_URL as Xt, GITIGNORE_DESTINATION_KEY as Y, RULESYNC_MCP_RELATIVE_FILE_PATH as Yt, findControlCharacter as Z, RULESYNC_NPM_SOURCES_LOCK_RELATIVE_FILE_PATH as Zt, CLAUDECODE_LOCAL_RULE_FILE_NAME as _, readFileContent as _t, convertFromTool as a, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH as an, assertTreeContainsNoSymlinks as at, CLAUDECODE_SKILLS_DIR_PATH as b, removeDirectoryStrict as bt, SubagentsProcessor as c, ALL_FEATURES_WITH_WILDCARD as cn, createTempDirectory as ct, IgnoreProcessor as d, fileExists as dt, RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH as en, fallbackLogger as et, HooksProcessor as f, findFilesByGlobs as ft, CLAUDECODE_DIR as g, listDirectoryFiles as gt, QWENCODE_LOCAL_RULE_FILE_NAME as h, isSymlink as ht, getProcessorRegistryEntry as i, RULESYNC_SKILLS_RELATIVE_DIR_PATH as in, assertDirectoryIfExists as it, RulesyncPermissions as j, PACKAGING_TOOL_TARGETS as jt, RulesyncRule as k, ALL_TOOL_TARGETS as kt, SkillsProcessor as l, DEPRECATED_FEATURE_REPLACEMENTS as ln, directoryExists as lt, QWENCODE_DIR as m, getHomeDirectory as mt, checkRulesyncDirExists as n, RULESYNC_RELATIVE_DIR_PATH as nn, CLIError as nt, isPackagingToolTarget as o, RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH as on, assertWritablePathInsideRoot as ot, CommandsProcessor as p, getFileSize as pt, CONFLICTING_TARGET_PAIRS as q, RULESYNC_MCP_FILE_NAME as qt, generate as r, RULESYNC_RULES_RELATIVE_DIR_PATH as rn, ErrorCodes as rt, RulesProcessor as s, ALL_FEATURES as sn, checkPathTraversal as st, importFromTool as t, RULESYNC_PERMISSIONS_SCHEMA_URL as tn, warnOnConflictingFlags as tt, McpProcessor as u, formatError as un, ensureDir as ut, CLAUDECODE_MEMORIES_DIR_NAME as v, readFileContentOrNull as vt, getLocalSkillDirNames as w, resolvePath as wt, ChecksProcessor as x, removeFile as xt, CLAUDECODE_SETTINGS_LOCAL_FILE_NAME as y, removeDirectory as yt, RulesyncCommandFrontmatterSchema as z, RULESYNC_CONFIG_SCHEMA_URL as zt };
|
|
55613
55895
|
|
|
55614
|
-
//# sourceMappingURL=import-
|
|
55896
|
+
//# sourceMappingURL=import-Ds0QeVp6.js.map
|