rulesync 43.6.2 → 43.6.3
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/dist/cli/index.cjs +3 -3
- package/dist/cli/index.js +3 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/{import-8kSEsosv.cjs → import-DCvPujUW.cjs} +95 -33
- package/dist/{import-iLVVcze8.js → import-w0JlEoNl.js} +96 -34
- package/dist/{import-iLVVcze8.js.map → import-w0JlEoNl.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +8 -8
|
@@ -9745,11 +9745,9 @@ var RulesyncPermissions = class RulesyncPermissions extends RulesyncFile {
|
|
|
9745
9745
|
* `PERMISSION_OVERRIDE_KEY_ALIASES`) is replaced wholesale, and removed when
|
|
9746
9746
|
* the import does not produce one: only that tool's import ever writes it, so
|
|
9747
9747
|
* a setting removed from the tool's own config has to disappear here too.
|
|
9748
|
-
*
|
|
9749
|
-
*
|
|
9750
|
-
*
|
|
9751
|
-
* `permission` record inside the block merges per category. Every other
|
|
9752
|
-
* top-level key — `$schema` included — is kept unless the import names it.
|
|
9748
|
+
* Every other top-level key — `$schema` included — is kept unless the import
|
|
9749
|
+
* names it, in which case the imported value replaces it. No importer emits
|
|
9750
|
+
* another tool's override block, so those blocks are never touched here.
|
|
9753
9751
|
*/
|
|
9754
9752
|
static mergeImportedJson({ existing, imported, toolTarget }) {
|
|
9755
9753
|
const ownOverrideKey = PERMISSION_OVERRIDE_KEY_ALIASES[toolTarget] ?? toolTarget;
|
|
@@ -9761,14 +9759,7 @@ var RulesyncPermissions = class RulesyncPermissions extends RulesyncFile {
|
|
|
9761
9759
|
existing: current,
|
|
9762
9760
|
imported: value
|
|
9763
9761
|
});
|
|
9764
|
-
else
|
|
9765
|
-
const block = { ...current };
|
|
9766
|
-
for (const [field, fieldValue] of Object.entries(value)) block[field] = field === "permission" ? mergePermissionCategories({
|
|
9767
|
-
existing: block[field],
|
|
9768
|
-
imported: fieldValue
|
|
9769
|
-
}) : fieldValue;
|
|
9770
|
-
merged[key] = block;
|
|
9771
|
-
} else merged[key] = value;
|
|
9762
|
+
else merged[key] = value;
|
|
9772
9763
|
}
|
|
9773
9764
|
return merged;
|
|
9774
9765
|
}
|
|
@@ -52429,6 +52420,29 @@ var AmpHooks = class AmpHooks extends ToolHooks {
|
|
|
52429
52420
|
});
|
|
52430
52421
|
}
|
|
52431
52422
|
};
|
|
52423
|
+
// src/features/hooks/hook-matcher-tool-names.ts
|
|
52424
|
+
const MATCHER_TOKEN_PATTERN = /\\.|\[(?:\\.|[^\]\\])*\]|(?<=^|[^\w\\]|\\\w)[A-Za-z_]\w*(?!\w)/gs;
|
|
52425
|
+
function isMatcherName(token) {
|
|
52426
|
+
return !token.startsWith("\\") && !token.startsWith("[");
|
|
52427
|
+
}
|
|
52428
|
+
/**
|
|
52429
|
+
* The distinct whole names in a matcher that start with a capital letter, for
|
|
52430
|
+
* adapters whose runtime tool names are all lowercase: after translation, such
|
|
52431
|
+
* a name has no runtime equivalent and can never match.
|
|
52432
|
+
*/
|
|
52433
|
+
function capitalizedMatcherNames(matcher) {
|
|
52434
|
+
const names = [...matcher.matchAll(MATCHER_TOKEN_PATTERN)].map(([token]) => token).filter((token) => isMatcherName(token) && /^[A-Z]/.test(token));
|
|
52435
|
+
return [...new Set(names)];
|
|
52436
|
+
}
|
|
52437
|
+
/**
|
|
52438
|
+
* Rewrites the whole tool names inside a hook `matcher` regex through `names`,
|
|
52439
|
+
* leaving escapes, character classes and unknown names as written. Used by
|
|
52440
|
+
* adapters whose runtime tool names differ from the canonical (Claude Code)
|
|
52441
|
+
* spelling.
|
|
52442
|
+
*/
|
|
52443
|
+
function replaceMatcherNames(matcher, names) {
|
|
52444
|
+
return matcher.replace(MATCHER_TOKEN_PATTERN, (token) => isMatcherName(token) && Object.hasOwn(names, token) ? names[token] ?? token : token);
|
|
52445
|
+
}
|
|
52432
52446
|
// src/utils/object.ts
|
|
52433
52447
|
/**
|
|
52434
52448
|
* Return a shallow copy of `obj` keeping only the entries whose value is
|
|
@@ -54349,6 +54363,48 @@ const ANTIGRAVITY_FLAT_HANDLER_EVENTS = new Set([...ANTIGRAVITY_NO_MATCHER_EVENT
|
|
|
54349
54363
|
record: CANONICAL_TO_ANTIGRAVITY_EVENT_NAMES,
|
|
54350
54364
|
key: event
|
|
54351
54365
|
}) ?? event));
|
|
54366
|
+
const CANONICAL_TO_ANTIGRAVITY_TOOL_NAMES = {
|
|
54367
|
+
Bash: "run_command",
|
|
54368
|
+
Read: "(?:read_file|view_file)",
|
|
54369
|
+
Write: "(?:write_file|write_to_file)",
|
|
54370
|
+
Edit: "(?:edit_file|replace_file_content)",
|
|
54371
|
+
WebSearch: "search_web"
|
|
54372
|
+
};
|
|
54373
|
+
const ANTIGRAVITY_TO_CANONICAL_TOOL_NAMES = {
|
|
54374
|
+
run_command: "Bash",
|
|
54375
|
+
read_file: "Read",
|
|
54376
|
+
view_file: "Read",
|
|
54377
|
+
write_file: "Write",
|
|
54378
|
+
write_to_file: "Write",
|
|
54379
|
+
edit_file: "Edit",
|
|
54380
|
+
replace_file_content: "Edit",
|
|
54381
|
+
search_web: "WebSearch"
|
|
54382
|
+
};
|
|
54383
|
+
const ANTIGRAVITY_GROUP_TO_CANONICAL_TOOL_NAMES = Object.entries(CANONICAL_TO_ANTIGRAVITY_TOOL_NAMES).filter(([, name]) => name.startsWith("(?:")).map(([canonical, group]) => [group, canonical]);
|
|
54384
|
+
const ANTIGRAVITY_DOCUMENTED_TOOL_CANDIDATES = {
|
|
54385
|
+
Grep: "grep_search",
|
|
54386
|
+
Glob: "find_by_name",
|
|
54387
|
+
WebFetch: "read_url_content",
|
|
54388
|
+
MultiEdit: "multi_replace_file_content"
|
|
54389
|
+
};
|
|
54390
|
+
function canonicalToAntigravityMatcher({ matcher, eventName, warn }) {
|
|
54391
|
+
const translated = replaceMatcherNames(matcher, CANONICAL_TO_ANTIGRAVITY_TOOL_NAMES);
|
|
54392
|
+
const unmatched = capitalizedMatcherNames(translated);
|
|
54393
|
+
if (unmatched.length > 0) {
|
|
54394
|
+
const candidates = unmatched.flatMap((name) => {
|
|
54395
|
+
const candidate = lookupOwn({
|
|
54396
|
+
record: ANTIGRAVITY_DOCUMENTED_TOOL_CANDIDATES,
|
|
54397
|
+
key: name
|
|
54398
|
+
});
|
|
54399
|
+
return candidate ? [`\`${candidate}\` for ${quoteValueForWarning(name)}`] : [];
|
|
54400
|
+
});
|
|
54401
|
+
warn(`Antigravity reports lowercase tool names in the hook payload (\`toolCall.name\`), and ${unmatched.map((name) => quoteValueForWarning(name)).join(", ")} in the "${eventName}" matcher ${quoteValueForWarning(matcher)} has no verified Antigravity equivalent, so it is written as-is and will likely never match. Use the tool name Antigravity reports instead` + (candidates.length > 0 ? ` (the Antigravity hooks docs list ${candidates.join(", ")}, unverified).` : "."));
|
|
54402
|
+
}
|
|
54403
|
+
return translated;
|
|
54404
|
+
}
|
|
54405
|
+
function antigravityToCanonicalMatcher(matcher) {
|
|
54406
|
+
return replaceMatcherNames(ANTIGRAVITY_GROUP_TO_CANONICAL_TOOL_NAMES.reduce((current, [group, canonical]) => current.split(group).join(canonical), matcher), ANTIGRAVITY_TO_CANONICAL_TOOL_NAMES);
|
|
54407
|
+
}
|
|
54352
54408
|
/**
|
|
54353
54409
|
* Antigravity uses a Claude-Code-like `hooks.json`. The `PreToolUse` /
|
|
54354
54410
|
* `PostToolUse` events use the matcher-based group shape, while `SessionStart`,
|
|
@@ -54362,7 +54418,11 @@ const ANTIGRAVITY_CONVERTER_CONFIG = {
|
|
|
54362
54418
|
toolToCanonicalEventNames: ANTIGRAVITY_TO_CANONICAL_EVENT_NAMES,
|
|
54363
54419
|
projectDirVar: "",
|
|
54364
54420
|
noMatcherEvents: ANTIGRAVITY_NO_MATCHER_EVENTS,
|
|
54365
|
-
supportedHookTypes: /* @__PURE__ */ new Set(["command"])
|
|
54421
|
+
supportedHookTypes: /* @__PURE__ */ new Set(["command"]),
|
|
54422
|
+
matcherTranslation: {
|
|
54423
|
+
toTool: canonicalToAntigravityMatcher,
|
|
54424
|
+
toCanonical: antigravityToCanonicalMatcher
|
|
54425
|
+
}
|
|
54366
54426
|
};
|
|
54367
54427
|
/**
|
|
54368
54428
|
* Turn the shared converter's matcher-group output into Antigravity's shape:
|
|
@@ -57395,20 +57455,6 @@ var CopilotcliHooks = class CopilotcliHooks extends ToolHooks {
|
|
|
57395
57455
|
}), null, 2) });
|
|
57396
57456
|
}
|
|
57397
57457
|
};
|
|
57398
|
-
// src/features/hooks/hook-matcher-tool-names.ts
|
|
57399
|
-
const MATCHER_TOKEN_PATTERN = /\\.|\[(?:\\.|[^\]\\])*\]|(?<=^|[^\w\\]|\\\w)[A-Za-z_]\w*(?!\w)/gs;
|
|
57400
|
-
function isMatcherName(token) {
|
|
57401
|
-
return !token.startsWith("\\") && !token.startsWith("[");
|
|
57402
|
-
}
|
|
57403
|
-
/**
|
|
57404
|
-
* Rewrites the whole tool names inside a hook `matcher` regex through `names`,
|
|
57405
|
-
* leaving escapes, character classes and unknown names as written. Used by
|
|
57406
|
-
* adapters whose runtime tool names differ from the canonical (Claude Code)
|
|
57407
|
-
* spelling.
|
|
57408
|
-
*/
|
|
57409
|
-
function replaceMatcherNames(matcher, names) {
|
|
57410
|
-
return matcher.replace(MATCHER_TOKEN_PATTERN, (token) => isMatcherName(token) && Object.hasOwn(names, token) ? names[token] ?? token : token);
|
|
57411
|
-
}
|
|
57412
57458
|
// src/features/hooks/cortexcode-hooks.ts
|
|
57413
57459
|
const CORTEXCODE_NO_MATCHER_EVENTS = /* @__PURE__ */ new Set(["beforeSubmitPrompt", "stop"]);
|
|
57414
57460
|
const CANONICAL_TO_CORTEXCODE_TOOL_NAMES = {
|
|
@@ -57422,8 +57468,8 @@ const CANONICAL_TO_CORTEXCODE_TOOL_NAMES = {
|
|
|
57422
57468
|
const CORTEXCODE_TO_CANONICAL_TOOL_NAMES = invertRecord(CANONICAL_TO_CORTEXCODE_TOOL_NAMES);
|
|
57423
57469
|
function canonicalToCortexcodeMatcher({ matcher, eventName, warn }) {
|
|
57424
57470
|
const translated = replaceMatcherNames(matcher, CANONICAL_TO_CORTEXCODE_TOOL_NAMES);
|
|
57425
|
-
const unmatched =
|
|
57426
|
-
if (unmatched.length > 0) warn(`Cortex Code matches hook matchers case-sensitively against lowercase runtime tool names, and ${
|
|
57471
|
+
const unmatched = capitalizedMatcherNames(translated);
|
|
57472
|
+
if (unmatched.length > 0) warn(`Cortex Code matches hook matchers case-sensitively against lowercase runtime tool names, and ${unmatched.map((name) => quoteValueForWarning(name)).join(", ")} in the "${eventName}" matcher ${quoteValueForWarning(matcher)} is not a tool Cortex Code documents a runtime ID for, so it is written as-is and will likely never match. Replace it with the lowercase name Cortex Code uses for that tool, if it has one.`);
|
|
57427
57473
|
return translated;
|
|
57428
57474
|
}
|
|
57429
57475
|
function cortexcodeToCanonicalMatcher(matcher) {
|
|
@@ -90261,6 +90307,22 @@ function unmanagedMcpAllowlistEntries({ existing, previousPermission, nextPermis
|
|
|
90261
90307
|
return category === null || !Object.hasOwn(previousPermission, category) && !Object.hasOwn(nextPermission, category);
|
|
90262
90308
|
});
|
|
90263
90309
|
}
|
|
90310
|
+
/** Hermes's override key in the canonical document (`hermes`). */
|
|
90311
|
+
const HERMES_OVERRIDE_KEY = PERMISSION_OVERRIDE_KEY_ALIASES.hermesagent ?? "hermesagent";
|
|
90312
|
+
/**
|
|
90313
|
+
* The part of a canonical permissions document Hermes keeps as provenance: the
|
|
90314
|
+
* `$schema`, the canonical `permission` block, and Hermes's own override.
|
|
90315
|
+
*/
|
|
90316
|
+
function hermesProvenanceOf(permissions) {
|
|
90317
|
+
const source = permissions;
|
|
90318
|
+
const provenance = {};
|
|
90319
|
+
for (const key of [
|
|
90320
|
+
"$schema",
|
|
90321
|
+
"permission",
|
|
90322
|
+
HERMES_OVERRIDE_KEY
|
|
90323
|
+
]) if (source[key] !== void 0) provenance[key] = source[key];
|
|
90324
|
+
return provenance;
|
|
90325
|
+
}
|
|
90264
90326
|
/** The validated canonical `permission` block of a config's `permissions.rulesync` blob. */
|
|
90265
90327
|
function canonicalPermissionOf(config) {
|
|
90266
90328
|
const parsed = RulesyncPermissionsFileSchema.safeParse({ permission: provenancePermissionOf(config) });
|
|
@@ -90428,10 +90490,10 @@ var HermesagentPermissions = class HermesagentPermissions extends ToolPermission
|
|
|
90428
90490
|
patterns: websiteBlocklist.enabled === true && isStringArray(websiteBlocklist.domains) ? websiteBlocklist.domains : []
|
|
90429
90491
|
});
|
|
90430
90492
|
removeEmptyCategories(permission);
|
|
90431
|
-
const { permission: _permission, hermes: _hermes, ...otherProvenance } = provenance;
|
|
90432
90493
|
const hermes = buildHermesOverride(config, provenance);
|
|
90494
|
+
const { $schema } = provenance;
|
|
90433
90495
|
const imported = {
|
|
90434
|
-
|
|
90496
|
+
...$schema !== void 0 && { $schema },
|
|
90435
90497
|
permission,
|
|
90436
90498
|
...Object.keys(hermes).length > 0 && { hermes }
|
|
90437
90499
|
};
|
|
@@ -90489,7 +90551,7 @@ var HermesagentPermissions = class HermesagentPermissions extends ToolPermission
|
|
|
90489
90551
|
base: config,
|
|
90490
90552
|
patch: permissions.hermes
|
|
90491
90553
|
});
|
|
90492
|
-
config.permissions = { rulesync: permissions };
|
|
90554
|
+
config.permissions = { rulesync: hermesProvenanceOf(permissions) };
|
|
90493
90555
|
return new HermesagentPermissions({
|
|
90494
90556
|
outputRoot,
|
|
90495
90557
|
fileContent: stringifySharedConfig({
|
|
@@ -9723,11 +9723,9 @@ var RulesyncPermissions = class RulesyncPermissions extends RulesyncFile {
|
|
|
9723
9723
|
* `PERMISSION_OVERRIDE_KEY_ALIASES`) is replaced wholesale, and removed when
|
|
9724
9724
|
* the import does not produce one: only that tool's import ever writes it, so
|
|
9725
9725
|
* a setting removed from the tool's own config has to disappear here too.
|
|
9726
|
-
*
|
|
9727
|
-
*
|
|
9728
|
-
*
|
|
9729
|
-
* `permission` record inside the block merges per category. Every other
|
|
9730
|
-
* top-level key — `$schema` included — is kept unless the import names it.
|
|
9726
|
+
* Every other top-level key — `$schema` included — is kept unless the import
|
|
9727
|
+
* names it, in which case the imported value replaces it. No importer emits
|
|
9728
|
+
* another tool's override block, so those blocks are never touched here.
|
|
9731
9729
|
*/
|
|
9732
9730
|
static mergeImportedJson({ existing, imported, toolTarget }) {
|
|
9733
9731
|
const ownOverrideKey = PERMISSION_OVERRIDE_KEY_ALIASES[toolTarget] ?? toolTarget;
|
|
@@ -9739,14 +9737,7 @@ var RulesyncPermissions = class RulesyncPermissions extends RulesyncFile {
|
|
|
9739
9737
|
existing: current,
|
|
9740
9738
|
imported: value
|
|
9741
9739
|
});
|
|
9742
|
-
else
|
|
9743
|
-
const block = { ...current };
|
|
9744
|
-
for (const [field, fieldValue] of Object.entries(value)) block[field] = field === "permission" ? mergePermissionCategories({
|
|
9745
|
-
existing: block[field],
|
|
9746
|
-
imported: fieldValue
|
|
9747
|
-
}) : fieldValue;
|
|
9748
|
-
merged[key] = block;
|
|
9749
|
-
} else merged[key] = value;
|
|
9740
|
+
else merged[key] = value;
|
|
9750
9741
|
}
|
|
9751
9742
|
return merged;
|
|
9752
9743
|
}
|
|
@@ -52407,6 +52398,29 @@ var AmpHooks = class AmpHooks extends ToolHooks {
|
|
|
52407
52398
|
});
|
|
52408
52399
|
}
|
|
52409
52400
|
};
|
|
52401
|
+
// src/features/hooks/hook-matcher-tool-names.ts
|
|
52402
|
+
const MATCHER_TOKEN_PATTERN = /\\.|\[(?:\\.|[^\]\\])*\]|(?<=^|[^\w\\]|\\\w)[A-Za-z_]\w*(?!\w)/gs;
|
|
52403
|
+
function isMatcherName(token) {
|
|
52404
|
+
return !token.startsWith("\\") && !token.startsWith("[");
|
|
52405
|
+
}
|
|
52406
|
+
/**
|
|
52407
|
+
* The distinct whole names in a matcher that start with a capital letter, for
|
|
52408
|
+
* adapters whose runtime tool names are all lowercase: after translation, such
|
|
52409
|
+
* a name has no runtime equivalent and can never match.
|
|
52410
|
+
*/
|
|
52411
|
+
function capitalizedMatcherNames(matcher) {
|
|
52412
|
+
const names = [...matcher.matchAll(MATCHER_TOKEN_PATTERN)].map(([token]) => token).filter((token) => isMatcherName(token) && /^[A-Z]/.test(token));
|
|
52413
|
+
return [...new Set(names)];
|
|
52414
|
+
}
|
|
52415
|
+
/**
|
|
52416
|
+
* Rewrites the whole tool names inside a hook `matcher` regex through `names`,
|
|
52417
|
+
* leaving escapes, character classes and unknown names as written. Used by
|
|
52418
|
+
* adapters whose runtime tool names differ from the canonical (Claude Code)
|
|
52419
|
+
* spelling.
|
|
52420
|
+
*/
|
|
52421
|
+
function replaceMatcherNames(matcher, names) {
|
|
52422
|
+
return matcher.replace(MATCHER_TOKEN_PATTERN, (token) => isMatcherName(token) && Object.hasOwn(names, token) ? names[token] ?? token : token);
|
|
52423
|
+
}
|
|
52410
52424
|
// src/utils/object.ts
|
|
52411
52425
|
/**
|
|
52412
52426
|
* Return a shallow copy of `obj` keeping only the entries whose value is
|
|
@@ -54327,6 +54341,48 @@ const ANTIGRAVITY_FLAT_HANDLER_EVENTS = new Set([...ANTIGRAVITY_NO_MATCHER_EVENT
|
|
|
54327
54341
|
record: CANONICAL_TO_ANTIGRAVITY_EVENT_NAMES,
|
|
54328
54342
|
key: event
|
|
54329
54343
|
}) ?? event));
|
|
54344
|
+
const CANONICAL_TO_ANTIGRAVITY_TOOL_NAMES = {
|
|
54345
|
+
Bash: "run_command",
|
|
54346
|
+
Read: "(?:read_file|view_file)",
|
|
54347
|
+
Write: "(?:write_file|write_to_file)",
|
|
54348
|
+
Edit: "(?:edit_file|replace_file_content)",
|
|
54349
|
+
WebSearch: "search_web"
|
|
54350
|
+
};
|
|
54351
|
+
const ANTIGRAVITY_TO_CANONICAL_TOOL_NAMES = {
|
|
54352
|
+
run_command: "Bash",
|
|
54353
|
+
read_file: "Read",
|
|
54354
|
+
view_file: "Read",
|
|
54355
|
+
write_file: "Write",
|
|
54356
|
+
write_to_file: "Write",
|
|
54357
|
+
edit_file: "Edit",
|
|
54358
|
+
replace_file_content: "Edit",
|
|
54359
|
+
search_web: "WebSearch"
|
|
54360
|
+
};
|
|
54361
|
+
const ANTIGRAVITY_GROUP_TO_CANONICAL_TOOL_NAMES = Object.entries(CANONICAL_TO_ANTIGRAVITY_TOOL_NAMES).filter(([, name]) => name.startsWith("(?:")).map(([canonical, group]) => [group, canonical]);
|
|
54362
|
+
const ANTIGRAVITY_DOCUMENTED_TOOL_CANDIDATES = {
|
|
54363
|
+
Grep: "grep_search",
|
|
54364
|
+
Glob: "find_by_name",
|
|
54365
|
+
WebFetch: "read_url_content",
|
|
54366
|
+
MultiEdit: "multi_replace_file_content"
|
|
54367
|
+
};
|
|
54368
|
+
function canonicalToAntigravityMatcher({ matcher, eventName, warn }) {
|
|
54369
|
+
const translated = replaceMatcherNames(matcher, CANONICAL_TO_ANTIGRAVITY_TOOL_NAMES);
|
|
54370
|
+
const unmatched = capitalizedMatcherNames(translated);
|
|
54371
|
+
if (unmatched.length > 0) {
|
|
54372
|
+
const candidates = unmatched.flatMap((name) => {
|
|
54373
|
+
const candidate = lookupOwn({
|
|
54374
|
+
record: ANTIGRAVITY_DOCUMENTED_TOOL_CANDIDATES,
|
|
54375
|
+
key: name
|
|
54376
|
+
});
|
|
54377
|
+
return candidate ? [`\`${candidate}\` for ${quoteValueForWarning(name)}`] : [];
|
|
54378
|
+
});
|
|
54379
|
+
warn(`Antigravity reports lowercase tool names in the hook payload (\`toolCall.name\`), and ${unmatched.map((name) => quoteValueForWarning(name)).join(", ")} in the "${eventName}" matcher ${quoteValueForWarning(matcher)} has no verified Antigravity equivalent, so it is written as-is and will likely never match. Use the tool name Antigravity reports instead` + (candidates.length > 0 ? ` (the Antigravity hooks docs list ${candidates.join(", ")}, unverified).` : "."));
|
|
54380
|
+
}
|
|
54381
|
+
return translated;
|
|
54382
|
+
}
|
|
54383
|
+
function antigravityToCanonicalMatcher(matcher) {
|
|
54384
|
+
return replaceMatcherNames(ANTIGRAVITY_GROUP_TO_CANONICAL_TOOL_NAMES.reduce((current, [group, canonical]) => current.split(group).join(canonical), matcher), ANTIGRAVITY_TO_CANONICAL_TOOL_NAMES);
|
|
54385
|
+
}
|
|
54330
54386
|
/**
|
|
54331
54387
|
* Antigravity uses a Claude-Code-like `hooks.json`. The `PreToolUse` /
|
|
54332
54388
|
* `PostToolUse` events use the matcher-based group shape, while `SessionStart`,
|
|
@@ -54340,7 +54396,11 @@ const ANTIGRAVITY_CONVERTER_CONFIG = {
|
|
|
54340
54396
|
toolToCanonicalEventNames: ANTIGRAVITY_TO_CANONICAL_EVENT_NAMES,
|
|
54341
54397
|
projectDirVar: "",
|
|
54342
54398
|
noMatcherEvents: ANTIGRAVITY_NO_MATCHER_EVENTS,
|
|
54343
|
-
supportedHookTypes: /* @__PURE__ */ new Set(["command"])
|
|
54399
|
+
supportedHookTypes: /* @__PURE__ */ new Set(["command"]),
|
|
54400
|
+
matcherTranslation: {
|
|
54401
|
+
toTool: canonicalToAntigravityMatcher,
|
|
54402
|
+
toCanonical: antigravityToCanonicalMatcher
|
|
54403
|
+
}
|
|
54344
54404
|
};
|
|
54345
54405
|
/**
|
|
54346
54406
|
* Turn the shared converter's matcher-group output into Antigravity's shape:
|
|
@@ -57373,20 +57433,6 @@ var CopilotcliHooks = class CopilotcliHooks extends ToolHooks {
|
|
|
57373
57433
|
}), null, 2) });
|
|
57374
57434
|
}
|
|
57375
57435
|
};
|
|
57376
|
-
// src/features/hooks/hook-matcher-tool-names.ts
|
|
57377
|
-
const MATCHER_TOKEN_PATTERN = /\\.|\[(?:\\.|[^\]\\])*\]|(?<=^|[^\w\\]|\\\w)[A-Za-z_]\w*(?!\w)/gs;
|
|
57378
|
-
function isMatcherName(token) {
|
|
57379
|
-
return !token.startsWith("\\") && !token.startsWith("[");
|
|
57380
|
-
}
|
|
57381
|
-
/**
|
|
57382
|
-
* Rewrites the whole tool names inside a hook `matcher` regex through `names`,
|
|
57383
|
-
* leaving escapes, character classes and unknown names as written. Used by
|
|
57384
|
-
* adapters whose runtime tool names differ from the canonical (Claude Code)
|
|
57385
|
-
* spelling.
|
|
57386
|
-
*/
|
|
57387
|
-
function replaceMatcherNames(matcher, names) {
|
|
57388
|
-
return matcher.replace(MATCHER_TOKEN_PATTERN, (token) => isMatcherName(token) && Object.hasOwn(names, token) ? names[token] ?? token : token);
|
|
57389
|
-
}
|
|
57390
57436
|
// src/features/hooks/cortexcode-hooks.ts
|
|
57391
57437
|
const CORTEXCODE_NO_MATCHER_EVENTS = /* @__PURE__ */ new Set(["beforeSubmitPrompt", "stop"]);
|
|
57392
57438
|
const CANONICAL_TO_CORTEXCODE_TOOL_NAMES = {
|
|
@@ -57400,8 +57446,8 @@ const CANONICAL_TO_CORTEXCODE_TOOL_NAMES = {
|
|
|
57400
57446
|
const CORTEXCODE_TO_CANONICAL_TOOL_NAMES = invertRecord(CANONICAL_TO_CORTEXCODE_TOOL_NAMES);
|
|
57401
57447
|
function canonicalToCortexcodeMatcher({ matcher, eventName, warn }) {
|
|
57402
57448
|
const translated = replaceMatcherNames(matcher, CANONICAL_TO_CORTEXCODE_TOOL_NAMES);
|
|
57403
|
-
const unmatched =
|
|
57404
|
-
if (unmatched.length > 0) warn(`Cortex Code matches hook matchers case-sensitively against lowercase runtime tool names, and ${
|
|
57449
|
+
const unmatched = capitalizedMatcherNames(translated);
|
|
57450
|
+
if (unmatched.length > 0) warn(`Cortex Code matches hook matchers case-sensitively against lowercase runtime tool names, and ${unmatched.map((name) => quoteValueForWarning(name)).join(", ")} in the "${eventName}" matcher ${quoteValueForWarning(matcher)} is not a tool Cortex Code documents a runtime ID for, so it is written as-is and will likely never match. Replace it with the lowercase name Cortex Code uses for that tool, if it has one.`);
|
|
57405
57451
|
return translated;
|
|
57406
57452
|
}
|
|
57407
57453
|
function cortexcodeToCanonicalMatcher(matcher) {
|
|
@@ -90239,6 +90285,22 @@ function unmanagedMcpAllowlistEntries({ existing, previousPermission, nextPermis
|
|
|
90239
90285
|
return category === null || !Object.hasOwn(previousPermission, category) && !Object.hasOwn(nextPermission, category);
|
|
90240
90286
|
});
|
|
90241
90287
|
}
|
|
90288
|
+
/** Hermes's override key in the canonical document (`hermes`). */
|
|
90289
|
+
const HERMES_OVERRIDE_KEY = PERMISSION_OVERRIDE_KEY_ALIASES.hermesagent ?? "hermesagent";
|
|
90290
|
+
/**
|
|
90291
|
+
* The part of a canonical permissions document Hermes keeps as provenance: the
|
|
90292
|
+
* `$schema`, the canonical `permission` block, and Hermes's own override.
|
|
90293
|
+
*/
|
|
90294
|
+
function hermesProvenanceOf(permissions) {
|
|
90295
|
+
const source = permissions;
|
|
90296
|
+
const provenance = {};
|
|
90297
|
+
for (const key of [
|
|
90298
|
+
"$schema",
|
|
90299
|
+
"permission",
|
|
90300
|
+
HERMES_OVERRIDE_KEY
|
|
90301
|
+
]) if (source[key] !== void 0) provenance[key] = source[key];
|
|
90302
|
+
return provenance;
|
|
90303
|
+
}
|
|
90242
90304
|
/** The validated canonical `permission` block of a config's `permissions.rulesync` blob. */
|
|
90243
90305
|
function canonicalPermissionOf(config) {
|
|
90244
90306
|
const parsed = RulesyncPermissionsFileSchema.safeParse({ permission: provenancePermissionOf(config) });
|
|
@@ -90406,10 +90468,10 @@ var HermesagentPermissions = class HermesagentPermissions extends ToolPermission
|
|
|
90406
90468
|
patterns: websiteBlocklist.enabled === true && isStringArray(websiteBlocklist.domains) ? websiteBlocklist.domains : []
|
|
90407
90469
|
});
|
|
90408
90470
|
removeEmptyCategories(permission);
|
|
90409
|
-
const { permission: _permission, hermes: _hermes, ...otherProvenance } = provenance;
|
|
90410
90471
|
const hermes = buildHermesOverride(config, provenance);
|
|
90472
|
+
const { $schema } = provenance;
|
|
90411
90473
|
const imported = {
|
|
90412
|
-
|
|
90474
|
+
...$schema !== void 0 && { $schema },
|
|
90413
90475
|
permission,
|
|
90414
90476
|
...Object.keys(hermes).length > 0 && { hermes }
|
|
90415
90477
|
};
|
|
@@ -90467,7 +90529,7 @@ var HermesagentPermissions = class HermesagentPermissions extends ToolPermission
|
|
|
90467
90529
|
base: config,
|
|
90468
90530
|
patch: permissions.hermes
|
|
90469
90531
|
});
|
|
90470
|
-
config.permissions = { rulesync: permissions };
|
|
90532
|
+
config.permissions = { rulesync: hermesProvenanceOf(permissions) };
|
|
90471
90533
|
return new HermesagentPermissions({
|
|
90472
90534
|
outputRoot,
|
|
90473
90535
|
fileContent: stringifySharedConfig({
|
|
@@ -103997,4 +104059,4 @@ const CHECKS_IMPORT_STRATEGY = {
|
|
|
103997
104059
|
};
|
|
103998
104060
|
export { RulesyncMcp as $, RULESYNC_USER_CONFIG_DIR_NAME as $n, isRootDirPath as $t, CODEBUDDY_LOCAL_RULE_FILE_NAME as A, CURATED_RULES_FEATURE_SUBDIR as An, resetRunWarningState as At, CLAUDECODE_MEMORIES_DIR_NAME as B, RULESYNC_HOOKS_RELATIVE_FILE_PATH as Bn, assertTreeContainsNoSymlinks as Bt, LETTACODE_DIR as C, ALL_TOOL_TARGETS as Cn, findControlCharacter as Ct, COMMANDCODE_DIR as D, ALL_FEATURES as Dn, fallbackLogger as Dt, FACTORYDROID_SETTINGS_LOCAL_FILE_NAME as E, ToolTargetSchema as En, WarningCollectingLogger as Et, CODEXCLI_BASH_RULES_FILE_NAME as F, RULESYNC_COMMANDS_RELATIVE_DIR_PATH as Fn, PathOutsideRootError as Ft, getLocalSkillDirNames as G, RULESYNC_NPM_SOURCES_LOCK_RELATIVE_FILE_PATH as Gn, ensureDir as Gt, CLAUDECODE_SKILLS_DIR_PATH as H, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH as Hn, checkPathTraversal as Ht, CODEXCLI_DIR as I, RULESYNC_CONFIG_RELATIVE_FILE_PATH as In, applyFileMode as It, RulesyncSkill as J, RULESYNC_RELATIVE_DIR_PATH as Jn, findFilesByGlobs as Jt, RulesyncSubagent as K, RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH as Kn, fileExists as Kt, CLAUDECODE_AGENT_MEMORY_LOCAL_DIR_NAME as L, RULESYNC_CONFIG_SCHEMA_URL as Ln, assertDirectoryIfExists as Lt, AUGMENTCODE_SETTINGS_LOCAL_FILE_NAME as M, MAX_FILE_SIZE as Mn, CLIError as Mt, caseFoldIdentity as N, RULESYNC_AIIGNORE_RELATIVE_FILE_PATH as Nn, ErrorCodes as Nt, COMMANDCODE_SETTINGS_LOCAL_FILE_NAME as O, ALL_FEATURES_WITH_WILDCARD as On, warnOnConflictingFlags as Ot, groupSpellingsByCaseFoldedIdentity as P, RULESYNC_CHECKS_RELATIVE_DIR_PATH as Pn, parseJsonc as Pt, RulesyncPermissions as Q, RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH as Qn, isFileSystemError as Qt, CLAUDECODE_DIR as R, RULESYNC_CURATED_RULES_RELATIVE_DIR_PATH as Rn, assertNoSymlinkBelowRoot as Rt, QWENCODE_LOCAL_RULE_FILE_NAME as S, mapWithConcurrency as Sn, getSourceTransport as St, FACTORYDROID_DIR as T, PACKAGING_TOOL_TARGETS as Tn, JsonLogger as Tt, findProjectInstructionBudgetFindings as U, RULESYNC_MCP_RELATIVE_FILE_PATH as Un, createTempDirectory as Ut, CLAUDECODE_SETTINGS_LOCAL_FILE_NAME as V, RULESYNC_IGNORE_RELATIVE_FILE_PATH as Vn, assertWritablePathInsideRoot as Vt, toInstructionBudgetFile as W, RULESYNC_MCP_SCHEMA_URL as Wn, directoryExists as Wt, RulesyncRule as X, RULESYNC_SKILLS_RELATIVE_DIR_PATH as Xn, getHomeDirectory as Xt, RulesyncSkillFrontmatterSchema as Y, RULESYNC_RULES_RELATIVE_DIR_PATH as Yn, getFileSizeAndExecutableBit as Yt, RulesyncRuleFrontmatterSchema as Z, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH as Zn, isFileNotFoundError as Zt, SkillsProcessor as _, runWithDirectoryRollback as _n, CONFLICTING_TARGET_PAIRS as _t, convertFromTool as a, pathEscapesRoot as an, hasEnclosingMarkOutsideKeycap as ar, RulesyncCommandFrontmatterSchema as at, REASONIX_LOCAL_RULE_FILE_NAME as b, writeFileBuffer as bn, SourceEntrySchema as bt, ELLIPSIS_WIDTH as c, readFileContentOrNull as cn, stripControlCharactersKeepingLineFeeds as cr, stringifyFrontmatter as ct, McpProcessor as d, removeFile as dn, SHARED_USER_MANAGED_CONFIG_PATHS as dt, isSymlink as en, RULESYNC_XDG_CONFIG_HOME_DEFAULT_DIR_NAME as er, RulesyncIgnore as et, IgnoreProcessor as f, removeFileStrict as fn, SKILL_FILE_NAME as ft, SubagentsProcessor as g, resolvedRelativePath as gn, resolveEffectiveInputRoots as gt, RulesProcessor as h, resolvePath as hn, parseConfigFileContent as ht, inspectInputRoots as i, normalizePosixDirPath as in, hasDeceptiveHiddenCharacters as ir, RulesyncCommand as it, AUGMENTCODE_DIR as j, FEATURE_SOURCE_TREE_ENTRIES as jn, withWarnOnceScope as jt, CODEBUDDY_DIR as k, DEPRECATED_FEATURE_REPLACEMENTS as kn, withFallbackLoggerTarget as kt, displayWidthOf as l, removeDirectory as ln, stripControlCharactersKeepingLineFeedsAndTabs as lr, loadYaml as lt, ChecksProcessor as m, removeTempDirectory as mn, mergeInputRootConfigs as mt, formatSourceLoadFailure as n, listFilePathsRecursively as nn, formatError as nr, getRulesyncSourceCandidates as nt, getProcessorRegistryEntry as o, posixRelativePathEscapesRoot as on, quoteForLog as or, RulesyncCheck as ot, HooksProcessor as p, removeFileWithoutFollowingSymlinks as pn, ConfigResolver as pt, RulesyncSubagentFrontmatterSchema as q, RULESYNC_PERMISSIONS_SCHEMA_URL as qn, fileExistsStrict as qt, generate as r, listSubdirectoryNames as rn, truncateText as rr, resolveRulesyncSourceWritePath as rt, parseCommaSeparatedList as s, readFileContent as sn, stripControlCharacters as sr, RulesyncCheckFrontmatterSchema as st, importFromTool as t, listDirectoryEntryNames as tn, formatMegabytes as tr, RulesyncHooks as tt, shortenToWidth as u, removeDirectoryStrict as un, stripHiddenCharacters as ur, isRecord as ut, CRUSH_LOCAL_RULE_FILE_NAME as v, splitPathSegments as vn, ConfigFileSchema as vt, LETTACODE_SETTINGS_LOCAL_FILE_NAME as w, ALL_TOOL_TARGETS_WITH_WILDCARD as wn, ConsoleLogger as wt, QWENCODE_DIR as x, writeFileContent as xn, assertTargetsFeaturesExclusive as xt, CommandsProcessor as y, toPosixPath as yn, GITIGNORE_DESTINATION_KEY as yt, CLAUDECODE_LOCAL_RULE_FILE_NAME as z, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH as zn, assertPathResolvesInsideRoot as zt };
|
|
103999
104061
|
|
|
104000
|
-
//# sourceMappingURL=import-
|
|
104062
|
+
//# sourceMappingURL=import-w0JlEoNl.js.map
|