rulesync 43.10.1 → 43.12.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.
@@ -2,7 +2,7 @@ import { ZodError } from "zod";
2
2
  import { cp, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, realpath, rm, stat, writeFile } from "node:fs/promises";
3
3
  import path, { basename, dirname, extname, isAbsolute, join, normalize, parse, posix, relative, resolve, sep, win32 } from "node:path";
4
4
  import { applyEdits, findNodeAtLocation, getNodeValue, modify, parse as parse$1, parseTree, printParseErrorCode } from "jsonc-parser";
5
- import { meta, minLength, nonnegative, optional, refine, z } from "zod/mini";
5
+ import { meta, minLength, nonnegative, optional, positive, refine, z } from "zod/mini";
6
6
  import { constants, readdirSync, realpathSync, statSync } from "node:fs";
7
7
  import os from "node:os";
8
8
  import { intersection, kebabCase, uniq } from "es-toolkit";
@@ -742,6 +742,7 @@ const subagentsProcessorToolTargetTuple = [
742
742
  "kiro-ide",
743
743
  "lettacode",
744
744
  "mimocode",
745
+ "musecode",
745
746
  "omp",
746
747
  "opencode",
747
748
  "opencodev1",
@@ -5172,6 +5173,8 @@ const HookDefinitionSchema = z.looseObject({
5172
5173
  tool: z.optional(safeString),
5173
5174
  input: z.optional(z.looseObject({})),
5174
5175
  model: z.optional(safeString),
5176
+ tools: z.optional(z.array(safeString)),
5177
+ maxTurns: z.optional(z.int().check(positive())),
5175
5178
  args: z.optional(z.array(safeString)),
5176
5179
  metadata: z.optional(z.looseObject({})),
5177
5180
  source: z.optional(z.looseObject({
@@ -5863,16 +5866,17 @@ const CONTINUE_TO_CANONICAL_EVENT_NAMES = invertRecord(CANONICAL_TO_CONTINUE_EVE
5863
5866
  * observers, `gateway_platform_event` and `transform_api_error_classification`.
5864
5867
  * Shell hooks are gated on the same set.
5865
5868
  *
5866
- * Verified against the tag `v0.22.3`: `VALID_HOOKS` holds 46 entries, grown
5869
+ * Verified against the tag `v0.23.2`: `VALID_HOOKS` holds 48 entries, grown
5867
5870
  * from 23 at `v2026.8.3` (v0.20.0) and 37 at `v2026.8.16` (v0.20.2) — v0.21
5868
5871
  * added `agent_loop_stopped` and `on_room_member_activity`, v0.21.5 added
5869
5872
  * `pre_auxiliary_call` and `post_auxiliary_call`, v0.21.6 added
5870
5873
  * `post_gateway_admission`, `on_human_input_request` and
5871
- * `on_human_input_resolved`, and v0.22.3 added `on_session_delete` and
5872
- * `post_compaction`. This list holds 45 of them — see
5874
+ * `on_human_input_resolved`, v0.22.3 added `on_session_delete` and
5875
+ * `post_compaction`, and v0.23.1 added `on_session_open` and
5876
+ * `post_curator_run`. This list holds 47 of them — see
5873
5877
  * {@link HERMESAGENT_SHELL_UNSUPPORTED_HOOK_EVENTS} for the exclusion.
5874
5878
  *
5875
- * @see https://github.com/NousResearch/hermes-agent/blob/v0.22.3/hermes_cli/plugins.py
5879
+ * @see https://github.com/NousResearch/hermes-agent/blob/v0.23.2/hermes_cli/plugins.py
5876
5880
  */
5877
5881
  const HERMESAGENT_NATIVE_HOOK_EVENTS = [
5878
5882
  "pre_tool_call",
@@ -5897,6 +5901,7 @@ const HERMESAGENT_NATIVE_HOOK_EVENTS = [
5897
5901
  "on_session_finalize",
5898
5902
  "on_session_reset",
5899
5903
  "on_session_delete",
5904
+ "on_session_open",
5900
5905
  "on_skill_lifecycle",
5901
5906
  "subagent_start",
5902
5907
  "subagent_stop",
@@ -5919,7 +5924,8 @@ const HERMESAGENT_NATIVE_HOOK_EVENTS = [
5919
5924
  "on_kanban_dispatch_tick",
5920
5925
  "gateway_platform_event",
5921
5926
  "pre_command",
5922
- "post_compaction"
5927
+ "post_compaction",
5928
+ "post_curator_run"
5923
5929
  ];
5924
5930
  /**
5925
5931
  * `VALID_HOOKS` entries a SHELL hook may not register for. `VALID_HOOKS` doubles
@@ -5931,8 +5937,8 @@ const HERMESAGENT_NATIVE_HOOK_EVENTS = [
5931
5937
  * rulesync only ever writes shell hooks, so these are excluded from
5932
5938
  * {@link HERMESAGENT_NATIVE_HOOK_EVENTS} and warned about with their own message.
5933
5939
  *
5934
- * @see https://github.com/NousResearch/hermes-agent/blob/v0.22.3/hermes_cli/plugins.py — `SHELL_UNSUPPORTED_HOOKS`
5935
- * @see https://github.com/NousResearch/hermes-agent/blob/v0.22.3/agent/shell_hooks.py — `_parse_hooks_block`
5940
+ * @see https://github.com/NousResearch/hermes-agent/blob/v0.23.2/hermes_cli/plugins.py — `SHELL_UNSUPPORTED_HOOKS`
5941
+ * @see https://github.com/NousResearch/hermes-agent/blob/v0.23.2/agent/shell_hooks.py — `_parse_hooks_block`
5936
5942
  */
5937
5943
  const HERMESAGENT_SHELL_UNSUPPORTED_HOOK_EVENTS = ["transform_api_error_classification"];
5938
5944
  /**
@@ -5952,8 +5958,8 @@ const CANONICAL_TO_HERMESAGENT_EVENT_NAMES = {
5952
5958
  /**
5953
5959
  * Hook events supported by Hermes Agent's native Shell Hooks system.
5954
5960
  *
5955
- * Hermes validates hook events against a fixed `VALID_HOOKS` set — 46 entries as
5956
- * of v0.22.3 (tag `v0.22.3`); see {@link HERMESAGENT_NATIVE_HOOK_EVENTS} for the
5961
+ * Hermes validates hook events against a fixed `VALID_HOOKS` set — 48 entries as
5962
+ * of v0.23.2 (tag `v0.23.2`); see {@link HERMESAGENT_NATIVE_HOOK_EVENTS} for the
5957
5963
  * full list. Only the events with a clean 1:1 canonical equivalent are mapped
5958
5964
  * here. All other native events round-trip through `hermesagent.hooks`.
5959
5965
  * @see https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/hooks.md
@@ -6746,6 +6752,7 @@ const CANONICAL_TO_KIRO_IDE_EVENT_NAMES = {
6746
6752
  beforeSubmitPrompt: "UserPromptSubmit",
6747
6753
  preToolUse: "PreToolUse",
6748
6754
  postToolUse: "PostToolUse",
6755
+ permissionRequest: "PermissionRequest",
6749
6756
  stop: "Stop"
6750
6757
  };
6751
6758
  /**
@@ -6754,7 +6761,9 @@ const CANONICAL_TO_KIRO_IDE_EVENT_NAMES = {
6754
6761
  *
6755
6762
  * Kiro exposes PascalCase triggers. rulesync maps the canonical lifecycle
6756
6763
  * events that have a clean 1:1 equivalent: `SessionStart`, `Stop`,
6757
- * `UserPromptSubmit`, `PreToolUse`, and `PostToolUse`. Kiro also documents
6764
+ * `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, and `PermissionRequest`
6765
+ * (Kiro IDE 1.4.236+ and CLI V3 3.4.0+; it takes a Pre Tool Use–style tool
6766
+ * matcher). Kiro also documents
6758
6767
  * file-event (`PostFileCreate`/`PostFileSave`/`PostFileDelete`) and spec-task
6759
6768
  * (`PreTaskExec`/`PostTaskExec`) triggers that have no canonical equivalent;
6760
6769
  * those can still be emitted verbatim via the shared `kiro` override block
@@ -8183,6 +8192,15 @@ const CopilotSandboxUserConfiguredPathsSchema = z.strictObject({
8183
8192
  deniedPaths: z.optional(z.array(z.string()))
8184
8193
  });
8185
8194
  /**
8195
+ * `chat.agent.sandbox.credentials.envVars` (VS Code 1.146+): environment
8196
+ * variable names (never their secret values) mapped to the HTTPS hosts the
8197
+ * Agent Host sandbox may inject each value into. Inside the sandbox the
8198
+ * variable is masked.
8199
+ *
8200
+ * @see https://code.visualstudio.com/docs/agents/run/agent-sandboxing
8201
+ */
8202
+ const CopilotSandboxCredentialEnvVarsSchema = z.record(z.string(), z.strictObject({ injectHosts: z.array(z.string()) }));
8203
+ /**
8186
8204
  * The Agent Host sandbox settings VS Code 1.141 settled on, as a nested object
8187
8205
  * whose path mirrors the dotted setting key under `chat.agent.sandbox.` — e.g.
8188
8206
  * `network.allowNetwork` writes `chat.agent.sandbox.network.allowNetwork`.
@@ -8204,7 +8222,8 @@ const CopilotSandboxSchema = z.strictObject({
8204
8222
  lspServers: z.optional(z.boolean()),
8205
8223
  credentials: z.optional(z.strictObject({
8206
8224
  authenticategit: z.optional(z.boolean()),
8207
- authenticategh: z.optional(z.boolean())
8225
+ authenticategh: z.optional(z.boolean()),
8226
+ envVars: z.optional(CopilotSandboxCredentialEnvVarsSchema)
8208
8227
  })),
8209
8228
  fileSystem: z.optional(z.strictObject({
8210
8229
  allowDevToolAccess: z.optional(z.boolean()),
@@ -8531,15 +8550,15 @@ const CursorPermissionsOverrideSchema = z.looseObject({
8531
8550
  * `tools` (`approvalMode` = plan/default/auto-edit/auto/yolo, `autoAccept`,
8532
8551
  * `sandbox`, `sandboxImage`, `disabled`, `visible`, `eager`, `listDirectory`,
8533
8552
  * `todoWrite`, `codeModeOnly`, `freeform`, `workflowsEnabled`, `workflowNameOnly`,
8534
- * `executionSandbox`) and
8553
+ * `executionSandbox`, `lspEnabled`) and
8535
8554
  * `security` (`folderTrust`, `allowedHttpHookUrls`, `allowPrivateNetworkHooks`,
8536
8555
  * `allowedInsecureVoiceBaseUrls`) and `skills` (the skill kill-switches
8537
8556
  * `disabled`, `defaultDisabled`, `enabled`, `disabledLevels`, each a list Qwen
8538
8557
  * Code unions across scopes) and `general` (`outputStyle`, the output style
8539
8558
  * that reshapes how responses are written). Qwen Code strips `tools.workflowsEnabled`,
8540
- * `tools.executionSandbox`, `security.allowPrivateNetworkHooks` and
8559
+ * `tools.executionSandbox`, `tools.lspEnabled`, `security.allowPrivateNetworkHooks` and
8541
8560
  * `security.allowedInsecureVoiceBaseUrls` out of workspace settings, so generate
8542
- * skips those four in project scope and announces a granting value in global
8561
+ * skips those five in project scope and announces a granting value in global
8543
8562
  * scope (any `executionSandbox` change counts). `tools.workflowNameOnly` is
8544
8563
  * written in both scopes, but a workspace may only turn it on, which the
8545
8564
  * project-scope note says. `security.allowedHttpHookUrls` (honored in a workspace only while no
@@ -8706,8 +8725,10 @@ const ReasonixPermissionsOverrideSchema = z.looseObject({
8706
8725
  * holds: `general.defaultPermissionMode`, `tools.core` / `tools.exclude`, the
8707
8726
  * MCP approval and loading keys under `mcp` (`allowed`, `excluded`,
8708
8727
  * `enableAllProjectMcpServers`, `enabledProjectMcpServers`, `lazyLoad`),
8709
- * `agents.overrides`, the top-level `agentsMdExcludes` and the top-level
8710
- * `autoMode` classifier guidance (`allow` / `soft_deny` / `environment`).
8728
+ * `agents.overrides`, `security.disableYoloMode` (turns off the
8729
+ * `bypass_permissions` / YOLO mode; it only hardens, so it is not announced),
8730
+ * the top-level `agentsMdExcludes` and the top-level `autoMode` classifier
8731
+ * guidance (`allow` / `soft_deny` / `environment`).
8711
8732
  * Qoder reads `autoMode` from the user settings only, so it is written by
8712
8733
  * `--global` generate alone. Only the keys listed here are written; any other
8713
8734
  * key of these groups or of `autoMode` (`tools.shell.pager`,
@@ -8741,6 +8762,7 @@ const QoderPermissionsOverrideSchema = z.looseObject({
8741
8762
  lazyLoad: z.optional(z.boolean())
8742
8763
  })),
8743
8764
  agents: z.optional(z.looseObject({ overrides: z.optional(z.record(z.string(), z.looseObject({}))) })),
8765
+ security: z.optional(z.looseObject({ disableYoloMode: z.optional(z.boolean()) })),
8744
8766
  autoMode: z.optional(z.looseObject({
8745
8767
  allow: z.optional(z.array(z.string())),
8746
8768
  soft_deny: z.optional(z.array(z.string())),
@@ -9217,7 +9239,9 @@ const ANTIGRAVITY_CLI_ARTIFACT_REVIEW_POLICIES = [
9217
9239
  * import filter for the same reason as {@link ANTIGRAVITY_CLI_TOOL_PERMISSIONS}.
9218
9240
  * `auto` (Preview) requires the terminal sandbox (`enableTerminalSandbox`), is
9219
9241
  * not offered to business or enterprise accounts, and falls back to `default`
9220
- * when unavailable.
9242
+ * when unavailable. Canonical `default` is stored by the CLI as `""` (the
9243
+ * translation lives in `antigravity-cli-permissions.ts`), and since CLI 1.5.7
9244
+ * an omitted `agentMode` starts in `auto` where available.
9221
9245
  * @see https://antigravity.google/docs/cli/modes
9222
9246
  */
9223
9247
  const ANTIGRAVITY_CLI_AGENT_MODES = [
@@ -9518,15 +9542,20 @@ const CodexcliPermissionsOverrideSchema = z.looseObject({
9518
9542
  /**
9519
9543
  * The `[auto_review]` table of `config.toml`, which configures the reviewer
9520
9544
  * that `approvals_reviewer = "auto_review"` (Rulesync's default) selects:
9521
- * `policy` / `extra_policy` (text inserted into the reviewer prompt),
9545
+ * `policy` / `extra_policy` (text inserted into the reviewer prompt;
9546
+ * `extra_policy` only up to Codex 0.168.0),
9522
9547
  * `timeout_ms` (the review budget, Codex 0.165.0+; `0` waits without a
9523
9548
  * deadline), `circuit_break_action` (`default` | `strict`) and
9524
9549
  * `conversation_history_max_output_tokens` (a positive token cap). Codex
9525
9550
  * rejects the whole config file when one of these has the wrong type or is
9526
9551
  * out of range (`timeout_ms` is a `u32`, the token cap a `NonZeroUsize`), so
9527
9552
  * they are checked here; every other key passes through verbatim.
9553
+ * `extra_policy` and `experimental_policy_template` were removed in Codex
9554
+ * 0.169.0 (openai/codex PR #60646): newer Codex ignores them and warns at
9555
+ * startup (only `--strict-config` rejects them), so they are still accepted
9556
+ * and written for older Codex, and generate warns when they are authored.
9528
9557
  *
9529
- * @see https://github.com/openai/codex/blob/rust-v0.166.0/codex-rs/config/src/config_toml.rs (`AutoReviewToml`)
9558
+ * @see https://github.com/openai/codex/blob/rust-v0.169.0/codex-rs/config/src/config_toml.rs (`AutoReviewToml`)
9530
9559
  */
9531
9560
  auto_review: z.optional(z.looseObject({
9532
9561
  policy: z.optional(z.string()),
@@ -13993,6 +14022,7 @@ const SHARED_CONFIG_OWNERSHIP = {
13993
14022
  "chat.agent.sandbox.lspServers",
13994
14023
  "chat.agent.sandbox.credentials.authenticategit",
13995
14024
  "chat.agent.sandbox.credentials.authenticategh",
14025
+ "chat.agent.sandbox.credentials.envVars",
13996
14026
  "chat.agent.sandbox.fileSystem.allowDevToolAccess",
13997
14027
  "chat.agent.sandbox.fileSystem.userConfiguredPaths",
13998
14028
  "zoo-code.allowedCommands",
@@ -14241,6 +14271,7 @@ const SHARED_CONFIG_OWNERSHIP = {
14241
14271
  "tools",
14242
14272
  "mcp",
14243
14273
  "agents",
14274
+ "security",
14244
14275
  "autoMode",
14245
14276
  "agentsMdExcludes"
14246
14277
  ]
@@ -27720,6 +27751,8 @@ const MUSECODE_RULE_FILE_NAME = "AGENTS.md";
27720
27751
  const MUSECODE_SKILLS_DIR_PATH = AGENTSMD_SKILLS_DIR_PATH;
27721
27752
  const MUSECODE_GLOBAL_CONFIG_DIR_PATH = join(".config", "muse");
27722
27753
  const MUSECODE_GLOBAL_SKILLS_DIR_PATH = join(MUSECODE_GLOBAL_CONFIG_DIR_PATH, "skills");
27754
+ const MUSECODE_SUBAGENTS_DIR_PATH = AGENTSMD_SUBAGENTS_DIR_PATH;
27755
+ const MUSECODE_GLOBAL_SUBAGENTS_DIR_PATH = join(MUSECODE_GLOBAL_CONFIG_DIR_PATH, "agents");
27723
27756
  const MUSECODE_SETTINGS_FILE_NAME = "settings.json";
27724
27757
  // src/features/skills/musecode-skill.ts
27725
27758
  const MusecodeSkillFrontmatterSchema = z.looseObject({
@@ -30711,6 +30744,17 @@ const AntigravitySubagentFrontmatterSchema = z.looseObject({
30711
30744
  */
30712
30745
  const ANTIGRAVITY_SHARED_SUBAGENT_SECTION_KEYS = ["antigravity-ide", "antigravity-cli"];
30713
30746
  /**
30747
+ * Tool-specific rulesync sections every writer of the project
30748
+ * `.agents/agents/<name>.md` file merges, in increasing precedence order.
30749
+ *
30750
+ * Muse Code loads its project agents from the same directory, so its section
30751
+ * is merged into the shared file too, below the Antigravity blocks: a key both
30752
+ * set keeps the Antigravity value the file carried before Muse Code joined.
30753
+ * Global agents live in per-tool directories, so this list applies to the
30754
+ * project file only.
30755
+ */
30756
+ const AGENTS_DIR_SHARED_SUBAGENT_SECTION_KEYS = ["musecode", ...ANTIGRAVITY_SHARED_SUBAGENT_SECTION_KEYS];
30757
+ /**
30714
30758
  * Build the frontmatter an `.agents/agents/<name>.md` file carries.
30715
30759
  *
30716
30760
  * That path is shared: every Antigravity target writes it, and so does the
@@ -30808,11 +30852,13 @@ var AntigravitySharedSubagent = class extends ToolSubagent {
30808
30852
  * therefore merges the shared `antigravity-ide` → `antigravity-cli` sections
30809
30853
  * (the CLI block wins, matching the fixed order the MCP feature already uses
30810
30854
  * for the same shared-output reason), and the plugin target layers its own
30811
- * section on top of that. Only `getToolTarget()` decides which section an
30812
- * import writes back into.
30855
+ * section on top of that. The project file is also read by Muse Code, so in
30856
+ * project scope the `musecode` section is merged underneath (see
30857
+ * {@link AGENTS_DIR_SHARED_SUBAGENT_SECTION_KEYS}). Only `getToolTarget()`
30858
+ * decides which section an import writes back into.
30813
30859
  */
30814
- static getReadSectionKeys() {
30815
- return [...ANTIGRAVITY_SHARED_SUBAGENT_SECTION_KEYS];
30860
+ static getReadSectionKeys({ global = false } = {}) {
30861
+ return global ? [...ANTIGRAVITY_SHARED_SUBAGENT_SECTION_KEYS] : [...AGENTS_DIR_SHARED_SUBAGENT_SECTION_KEYS];
30816
30862
  }
30817
30863
  static getSettablePaths({ global = false } = {}) {
30818
30864
  return { relativeDirPath: global ? ANTIGRAVITY_GLOBAL_AGENTS_DIR_PATH : ANTIGRAVITY_AGENTS_DIR_PATH };
@@ -30842,7 +30888,7 @@ var AntigravitySharedSubagent = class extends ToolSubagent {
30842
30888
  static fromRulesyncSubagent({ outputRoot = process.cwd(), rulesyncSubagent, validate = true, global = false }) {
30843
30889
  const frontmatter = toAntigravitySubagentFrontmatter({
30844
30890
  rulesyncSubagent,
30845
- sectionKeys: this.getReadSectionKeys(),
30891
+ sectionKeys: this.getReadSectionKeys({ global }),
30846
30892
  toolTarget: this.getToolTarget()
30847
30893
  });
30848
30894
  const body = rulesyncSubagent.getBody();
@@ -31032,7 +31078,7 @@ var AgentsmdSubagent = class AgentsmdSubagent extends SimulatedSubagent {
31032
31078
  const defaults = this.fromRulesyncSubagentDefault(params);
31033
31079
  const frontmatter = toAntigravitySubagentFrontmatter({
31034
31080
  rulesyncSubagent: params.rulesyncSubagent,
31035
- sectionKeys: ANTIGRAVITY_SHARED_SUBAGENT_SECTION_KEYS,
31081
+ sectionKeys: AGENTS_DIR_SHARED_SUBAGENT_SECTION_KEYS,
31036
31082
  toolTarget: "agentsmd"
31037
31083
  });
31038
31084
  return new AgentsmdSubagent({
@@ -31095,7 +31141,7 @@ var AntigravityPluginSubagent = class extends AntigravitySharedSubagent {
31095
31141
  return "antigravity-plugin";
31096
31142
  }
31097
31143
  static getReadSectionKeys() {
31098
- return [...super.getReadSectionKeys(), "antigravity-plugin"];
31144
+ return [...ANTIGRAVITY_SHARED_SUBAGENT_SECTION_KEYS, "antigravity-plugin"];
31099
31145
  }
31100
31146
  static getSettablePaths() {
31101
31147
  return { relativeDirPath: ANTIGRAVITY_PLUGIN_AGENTS_DIR };
@@ -31439,7 +31485,7 @@ var RooSubagent = class extends ToolSubagent {
31439
31485
  * Aggregate every targeted rulesync subagent into a single `.roomodes` file.
31440
31486
  * Modes are de-duplicated by `slug` (last one wins) to keep the array unique.
31441
31487
  */
31442
- static fromRulesyncSubagents({ outputRoot = process.cwd(), rulesyncSubagents, validate = true }) {
31488
+ static fromRulesyncSubagents({ outputRoot = process.cwd(), rulesyncSubagents, validate = true, global = false }) {
31443
31489
  const bySlug = /* @__PURE__ */ new Map();
31444
31490
  for (const rulesyncSubagent of rulesyncSubagents) {
31445
31491
  const mode = this.toRooMode(rulesyncSubagent);
@@ -31447,17 +31493,19 @@ var RooSubagent = class extends ToolSubagent {
31447
31493
  }
31448
31494
  return new this({
31449
31495
  outputRoot,
31450
- relativeDirPath: this.getSettablePaths().relativeDirPath,
31496
+ relativeDirPath: this.getSettablePaths({ global }).relativeDirPath,
31451
31497
  relativeFilePath: this.modesFileName,
31452
31498
  modes: [...bySlug.values()],
31453
- validate
31499
+ validate,
31500
+ global
31454
31501
  });
31455
31502
  }
31456
- static fromRulesyncSubagent({ outputRoot = process.cwd(), rulesyncSubagent, validate = true }) {
31503
+ static fromRulesyncSubagent({ outputRoot = process.cwd(), rulesyncSubagent, validate = true, global = false }) {
31457
31504
  return this.fromRulesyncSubagents({
31458
31505
  outputRoot,
31459
31506
  rulesyncSubagents: [rulesyncSubagent],
31460
- validate
31507
+ validate,
31508
+ global
31461
31509
  });
31462
31510
  }
31463
31511
  /**
@@ -31513,8 +31561,8 @@ var RooSubagent = class extends ToolSubagent {
31513
31561
  toolTarget: "roo"
31514
31562
  });
31515
31563
  }
31516
- static async fromFile({ outputRoot = process.cwd(), relativeFilePath, validate = true }) {
31517
- const paths = this.getSettablePaths();
31564
+ static async fromFile({ outputRoot = process.cwd(), relativeFilePath, validate = true, global = false }) {
31565
+ const paths = this.getSettablePaths({ global });
31518
31566
  const filePath = join(outputRoot, paths.relativeDirPath, relativeFilePath);
31519
31567
  const fileContent = await readFileContent(filePath);
31520
31568
  let parsed;
@@ -31530,16 +31578,18 @@ var RooSubagent = class extends ToolSubagent {
31530
31578
  relativeDirPath: paths.relativeDirPath,
31531
31579
  relativeFilePath: basename(relativeFilePath),
31532
31580
  modes: result.data.customModes,
31533
- validate
31581
+ validate,
31582
+ global
31534
31583
  });
31535
31584
  }
31536
- static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath }) {
31585
+ static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath, global = false }) {
31537
31586
  return new this({
31538
31587
  outputRoot,
31539
31588
  relativeDirPath,
31540
31589
  relativeFilePath,
31541
31590
  modes: [],
31542
- validate: false
31591
+ validate: false,
31592
+ global
31543
31593
  });
31544
31594
  }
31545
31595
  };
@@ -31551,8 +31601,13 @@ var RooSubagent = class extends ToolSubagent {
31551
31601
  * presets `explore` and `general` — but it reads custom modes from an
31552
31602
  * aggregated `customModes` YAML file in Roo's format, so every targeted rulesync
31553
31603
  * subagent becomes one mode in `.bob/custom_modes.yaml`, exactly as the `roo`
31554
- * target fills `.roomodes`. Only the project file is emitted: the Bob IDE and
31555
- * Bob Shell docs name different global files.
31604
+ * target fills `.roomodes`. In global mode the same array goes to
31605
+ * `~/.bob/settings/custom_modes.yaml`, the user file both the Bob IDE and Bob
31606
+ * Shell custom-modes pages name. That file is unversioned and Bob IDE's "Edit
31607
+ * Global Modes" setting writes it too, so rulesync does not own it: a global
31608
+ * generate merges the generated modes into it by `slug`, keeps every other
31609
+ * mode, and the file is never deleted. The project file stays wholly owned by
31610
+ * rulesync, like Roo's `.roomodes`.
31556
31611
  *
31557
31612
  * The mode fields ride a `bob:` frontmatter section rather than Roo's `roo:`
31558
31613
  * one, because Bob's tool groups are spelled differently (`execute` where Roo
@@ -31569,7 +31624,7 @@ var RooSubagent = class extends ToolSubagent {
31569
31624
  * @see https://bob.ibm.com/docs/shell/configuration/custom-modes-bobshell
31570
31625
  * @see https://bob.ibm.com/docs/ide/features/subagents
31571
31626
  */
31572
- var BobSubagent = class extends RooSubagent {
31627
+ var BobSubagent = class BobSubagent extends RooSubagent {
31573
31628
  static modesFileName = BOB_CUSTOM_MODES_FILE_NAME;
31574
31629
  static modeSectionKey = "bob";
31575
31630
  static defaultGroups = [
@@ -31579,12 +31634,74 @@ var BobSubagent = class extends RooSubagent {
31579
31634
  "mcp"
31580
31635
  ];
31581
31636
  static importTarget = "bob";
31582
- static getSettablePaths(_options = {}) {
31637
+ static getSettablePaths({ global = false } = {}) {
31583
31638
  return {
31584
- relativeDirPath: BOB_DIR,
31639
+ relativeDirPath: global ? BOB_GLOBAL_SETTINGS_DIR_PATH : BOB_DIR,
31585
31640
  relativeFilePath: BOB_CUSTOM_MODES_FILE_NAME
31586
31641
  };
31587
31642
  }
31643
+ /** Receives the merge warnings; set by {@link BobSubagent.fromRulesyncSubagents}. */
31644
+ bobLogger;
31645
+ static fromRulesyncSubagents(params) {
31646
+ const subagent = super.fromRulesyncSubagents(params);
31647
+ if (subagent instanceof BobSubagent) subagent.bobLogger = params.logger;
31648
+ return subagent;
31649
+ }
31650
+ isDeletable() {
31651
+ return !this.global;
31652
+ }
31653
+ shouldMergeExistingFileContent() {
31654
+ return this.global;
31655
+ }
31656
+ /**
31657
+ * Merge the generated modes into the existing global file: a mode whose
31658
+ * `slug` rulesync generates is replaced in place, every other entry is kept
31659
+ * as written, and new modes are appended. A file that cannot be read as a
31660
+ * `customModes` document is an error rather than something to overwrite.
31661
+ */
31662
+ setFileContent(existingContent) {
31663
+ if (!this.global) {
31664
+ super.setFileContent(existingContent);
31665
+ return;
31666
+ }
31667
+ const filePath = join(this.getOutputRoot(), this.getRelativeDirPath(), this.getRelativeFilePath());
31668
+ let parsed;
31669
+ try {
31670
+ parsed = loadYaml(existingContent);
31671
+ } catch (error) {
31672
+ throw new Error(`Failed to parse custom modes (${filePath}); not overwriting it: ${formatError(error)}`, { cause: error });
31673
+ }
31674
+ const existingModes = isRecord(parsed) ? parsed.customModes : void 0;
31675
+ if (!(parsed === null || parsed === void 0 || isRecord(parsed)) || !(existingModes === null || existingModes === void 0 || Array.isArray(existingModes))) throw new Error(`Invalid custom modes in ${filePath}; not overwriting it: expected a "customModes" list.`);
31676
+ const generatedModes = this.getModes();
31677
+ const generatedSlugs = new Set(generatedModes.map((mode) => mode.slug));
31678
+ const pending = new Map(generatedModes.map((mode) => [mode.slug, mode]));
31679
+ const duplicateSlugs = /* @__PURE__ */ new Set();
31680
+ const merged = [];
31681
+ for (const entry of Array.isArray(existingModes) ? existingModes : []) {
31682
+ const slug = isRecord(entry) ? entry.slug : void 0;
31683
+ if (typeof slug !== "string" || !generatedSlugs.has(slug)) {
31684
+ merged.push(entry);
31685
+ continue;
31686
+ }
31687
+ const mode = pending.get(slug);
31688
+ if (mode === void 0) {
31689
+ duplicateSlugs.add(slug);
31690
+ continue;
31691
+ }
31692
+ merged.push(mode);
31693
+ pending.delete(slug);
31694
+ }
31695
+ merged.push(...pending.values());
31696
+ if (duplicateSlugs.size > 0) this.bobLogger?.warn(`Removed duplicate Bob custom mode(s) ${[...duplicateSlugs].map(quoteValueForWarning).join(", ")} from ${filePath}: rulesync generates these slugs and keeps only one entry for each.`);
31697
+ super.setFileContent(dump({
31698
+ ...isRecord(parsed) ? parsed : {},
31699
+ customModes: merged
31700
+ }, {
31701
+ lineWidth: -1,
31702
+ noRefs: true
31703
+ }));
31704
+ }
31588
31705
  static isTargetedByRulesyncSubagent(rulesyncSubagent) {
31589
31706
  return this.isTargetedByRulesyncSubagentDefault({
31590
31707
  rulesyncSubagent,
@@ -35662,6 +35779,87 @@ var OpenCodeSubagent = class extends OpenCodeStyleSubagent {
35662
35779
  var MimocodeSubagent = class extends OpenCodeSubagent {
35663
35780
  static layout = MIMOCODE_LAYOUT;
35664
35781
  };
35782
+ // src/features/subagents/musecode-subagent.ts
35783
+ /**
35784
+ * Muse Code agent names are lowercase words joined by single hyphens
35785
+ * (`test-writer`).
35786
+ *
35787
+ * @see https://dev.meta.ai/docs/muse-code/agents
35788
+ */
35789
+ const MUSECODE_AGENT_NAME_PATTERN = /^[a-z]+(?:-[a-z]+)*$/;
35790
+ /**
35791
+ * The frontmatter keys the Muse Code agents page documents.
35792
+ *
35793
+ * @see https://dev.meta.ai/docs/muse-code/agents
35794
+ */
35795
+ const MUSECODE_DOCUMENTED_FRONTMATTER_KEYS = /* @__PURE__ */ new Set([
35796
+ "name",
35797
+ "description",
35798
+ "model",
35799
+ "effort",
35800
+ "tools",
35801
+ "disallowedTools"
35802
+ ]);
35803
+ /**
35804
+ * Meta Muse Code custom agent (subagent): a Markdown file with YAML
35805
+ * frontmatter (`name`, `description`, and optionally `model`, `effort`,
35806
+ * `tools`, `disallowedTools`) whose body is the agent's prompt.
35807
+ *
35808
+ * Project agents load from `.agents/agents/`, the directory the Antigravity
35809
+ * targets and the simulated `agentsmd` writer already generate into, so the
35810
+ * project file is rendered exactly like theirs (the `musecode` section is part
35811
+ * of the merge every writer of that file performs) and the file on disk does
35812
+ * not depend on which target ran last. User agents load from
35813
+ * `~/.config/muse/agents/`, which only this target writes, so only the
35814
+ * `musecode` section is merged there.
35815
+ *
35816
+ * @see https://dev.meta.ai/docs/muse-code/agents
35817
+ */
35818
+ var MusecodeSubagent = class extends AntigravitySharedSubagent {
35819
+ static getToolTarget() {
35820
+ return "musecode";
35821
+ }
35822
+ static getReadSectionKeys({ global = false } = {}) {
35823
+ return global ? ["musecode"] : super.getReadSectionKeys({ global });
35824
+ }
35825
+ static getSettablePaths({ global = false } = {}) {
35826
+ return { relativeDirPath: global ? MUSECODE_GLOBAL_SUBAGENTS_DIR_PATH : MUSECODE_SUBAGENTS_DIR_PATH };
35827
+ }
35828
+ static fromRulesyncSubagent(params) {
35829
+ const name = params.rulesyncSubagent.getFrontmatter().name;
35830
+ if (!MUSECODE_AGENT_NAME_PATTERN.test(name)) params.logger?.warn(`Muse Code subagent name '${name}' in ${params.rulesyncSubagent.getRelativeFilePath()} is not lowercase words joined by single hyphens (e.g. 'test-writer'); Muse Code may not load it.`);
35831
+ const subagent = super.fromRulesyncSubagent(params);
35832
+ if (!params.global && subagent instanceof AntigravitySharedSubagent) this.warnAboutSharedProjectFile({
35833
+ params,
35834
+ subagent
35835
+ });
35836
+ return subagent;
35837
+ }
35838
+ /**
35839
+ * The project file is shared with the Antigravity writers, so its content
35840
+ * cannot be narrowed to what Muse Code documents. Say so instead when the
35841
+ * merged file differs from what the `musecode` block alone would produce.
35842
+ */
35843
+ static warnAboutSharedProjectFile({ params, subagent }) {
35844
+ const { logger, rulesyncSubagent } = params;
35845
+ const relativeFilePath = rulesyncSubagent.getRelativeFilePath();
35846
+ const undocumentedKeys = Object.keys(subagent.getFrontmatter()).filter((key) => !MUSECODE_DOCUMENTED_FRONTMATTER_KEYS.has(key));
35847
+ if (undocumentedKeys.length > 0) logger?.warn(`Muse Code subagent ${relativeFilePath}: the shared .agents/agents/ file carries keys Muse Code does not document (${undocumentedKeys.join(", ")}), set in a musecode or antigravity-* block; Muse Code may refuse to load the agent.`);
35848
+ const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
35849
+ const musecodeSection = rulesyncFrontmatter.musecode;
35850
+ if (!isPlainObject(musecodeSection)) return;
35851
+ for (const key of Object.keys(musecodeSection)) {
35852
+ if (key === "name" || key === "description") continue;
35853
+ const overridingSection = ANTIGRAVITY_SHARED_SUBAGENT_SECTION_KEYS.toReversed().find((sectionKey) => {
35854
+ const section = rulesyncFrontmatter[sectionKey];
35855
+ return isPlainObject(section) && section[key] !== void 0;
35856
+ });
35857
+ if (overridingSection === void 0) continue;
35858
+ const overridingValue = rulesyncFrontmatter[overridingSection][key];
35859
+ if (!isDeepStrictEqual(overridingValue, musecodeSection[key])) logger?.warn(`Muse Code subagent ${relativeFilePath}: '${key}' from the musecode block is overridden by the ${overridingSection} block in the shared .agents/agents/ file.`);
35860
+ }
35861
+ }
35862
+ };
35665
35863
  // src/features/subagents/omp-subagent.ts
35666
35864
  /**
35667
35865
  * Frontmatter of an oh-my-pi agent definition (`parseAgentFields` in
@@ -37435,7 +37633,7 @@ const toolSubagentFactories = /* @__PURE__ */ new Map([
37435
37633
  meta: {
37436
37634
  supportsProject: true,
37437
37635
  supportsSimulated: false,
37438
- supportsGlobal: false,
37636
+ supportsGlobal: true,
37439
37637
  filePattern: "custom_modes.yaml"
37440
37638
  }
37441
37639
  }],
@@ -37713,6 +37911,15 @@ const toolSubagentFactories = /* @__PURE__ */ new Map([
37713
37911
  filePattern: "*.md"
37714
37912
  }
37715
37913
  }],
37914
+ ["musecode", {
37915
+ class: MusecodeSubagent,
37916
+ meta: {
37917
+ supportsProject: true,
37918
+ supportsSimulated: false,
37919
+ supportsGlobal: true,
37920
+ filePattern: "*.md"
37921
+ }
37922
+ }],
37716
37923
  ["omp", {
37717
37924
  class: OmpSubagent,
37718
37925
  meta: {
@@ -51734,9 +51941,14 @@ const GooseCheckFrontmatterSchema = z.extend(AmpCheckFrontmatterSchema, {
51734
51941
  "turn-limit": z.optional(z.int().check(z.nonnegative()))
51735
51942
  });
51736
51943
  /**
51737
- * Represents a Goose review check (`goose review`), written to the user-wide
51944
+ * Represents a Goose review check, written to the user-wide
51738
51945
  * `~/.config/goose/checks/` (global scope only).
51739
51946
  *
51947
+ * Goose v1.60.0 removed the `goose review` subcommand that ran these checks
51948
+ * (aaif-goose/goose#13469). Goose still discovers them, but only lists them as
51949
+ * agent sources (`properties.kind = "check"`), so `model` and `turn-limit`
51950
+ * have no runtime effect there.
51951
+ *
51740
51952
  * Goose discovers repository checks in `.agents/checks/*.md`, the same
51741
51953
  * cross-tool directory the `amp` checks target already writes (Goose's
51742
51954
  * `tools` and `severity-default` fields exist for parity with Amp's), so the
@@ -53899,13 +54111,29 @@ function isEventApplicable({ events, eventName }) {
53899
54111
  function describeEvents(names) {
53900
54112
  return [...names].map((name) => `"${name}"`).join(", ");
53901
54113
  }
54114
+ const COMMAND_HOOK_TYPES = /* @__PURE__ */ new Set(["command"]);
53902
54115
  /**
53903
- * Whether a field registered for `command` hooks only applies to this hook.
53904
- * Applied on both export and import: a value imported into a canonical field
53905
- * the exporter would then drop is silently deleted on the next generate.
54116
+ * The hook types a field is documented on, or `undefined` when unrestricted.
54117
+ * `commandOnly` is shorthand for `command` alone.
53906
54118
  */
53907
- function isFieldApplicable({ commandOnly, hookType }) {
53908
- return commandOnly !== true || hookType === "command";
54119
+ function documentedHookTypes({ commandOnly, hookTypes }) {
54120
+ return commandOnly === true ? COMMAND_HOOK_TYPES : hookTypes;
54121
+ }
54122
+ /** Quote the hook types a restricted field is documented on, for a warning. */
54123
+ function describeDocumentedHookTypes(spec) {
54124
+ return describeEvents(documentedHookTypes(spec) ?? COMMAND_HOOK_TYPES);
54125
+ }
54126
+ /**
54127
+ * Whether a field registered for some hook types only (`command` hooks, or
54128
+ * the listed `hookTypes`) applies to this hook. Applied on both export and
54129
+ * import: a value imported into a canonical field the exporter would then
54130
+ * drop is silently deleted on the next generate.
54131
+ */
54132
+ function isFieldApplicable({ commandOnly, hookTypes, hookType }) {
54133
+ return documentedHookTypes({
54134
+ commandOnly,
54135
+ hookTypes
54136
+ })?.has(hookType) ?? true;
53909
54137
  }
53910
54138
  /**
53911
54139
  * Emit the configured passthrough fields on the tool side, mapping each
@@ -53920,14 +54148,18 @@ function isFieldApplicable({ commandOnly, hookType }) {
53920
54148
  * silence — the mirror of the import side.
53921
54149
  */
53922
54150
  function emitPassthroughFields({ def, hookType, eventName, fields, isValid, warn }) {
53923
- for (const { canonical, tool, commandOnly, maxLength, collapseWhitespaceForLength, onlyWithFlag, events } of fields) {
54151
+ for (const { canonical, tool, commandOnly, hookTypes, maxLength, collapseWhitespaceForLength, onlyWithFlag, events } of fields) {
53924
54152
  const value = def[canonical];
53925
54153
  if (value === void 0) continue;
53926
54154
  if (!isFieldApplicable({
53927
54155
  commandOnly,
54156
+ hookTypes,
53928
54157
  hookType
53929
54158
  })) {
53930
- warn?.(`Dropping "${canonical}" from a "${hookType}" hook on "${eventName}": this tool documents "${tool}" on "command" hooks only, so it is not generated.`);
54159
+ warn?.(`Dropping "${canonical}" from a "${hookType}" hook on "${eventName}": this tool documents "${tool}" on ${describeDocumentedHookTypes({
54160
+ commandOnly,
54161
+ hookTypes
54162
+ })} hooks only, so it is not generated.`);
53931
54163
  continue;
53932
54164
  }
53933
54165
  if (events !== void 0 && !isEventApplicable({
@@ -53950,8 +54182,9 @@ function emitPassthroughFields({ def, hookType, eventName, fields, isValid, warn
53950
54182
  if (length > maxLength) warn?.(`"${canonical}" on a "${hookType}" hook on "${eventName}" is ${length} characters long${collapseWhitespaceForLength ? " after collapsing whitespace" : ""}; this tool caps "${tool}" at ${maxLength} characters and will shorten it.`);
53951
54183
  }
53952
54184
  }
53953
- return Object.fromEntries(fields.filter(({ canonical, commandOnly, events }) => isFieldApplicable({
54185
+ return Object.fromEntries(fields.filter(({ canonical, commandOnly, hookTypes, events }) => isFieldApplicable({
53954
54186
  commandOnly,
54187
+ hookTypes,
53955
54188
  hookType
53956
54189
  }) && isEventApplicable({
53957
54190
  events,
@@ -53969,19 +54202,24 @@ function emitPassthroughFields({ def, hookType, eventName, fields, isValid, warn
53969
54202
  * value into a warning instead of a silent drop.
53970
54203
  */
53971
54204
  function importPassthroughFields({ h, hookType, eventName, fields, isValid, describeInvalid, warn }) {
53972
- const typeApplicable = fields.filter(({ commandOnly }) => isFieldApplicable({
54205
+ const typeApplicable = fields.filter(({ commandOnly, hookTypes }) => isFieldApplicable({
53973
54206
  commandOnly,
54207
+ hookTypes,
53974
54208
  hookType
53975
54209
  }));
53976
54210
  const applicable = typeApplicable.filter(({ events }) => isEventApplicable({
53977
54211
  events,
53978
54212
  eventName
53979
54213
  }));
53980
- const skipped = fields.filter(({ commandOnly }) => !isFieldApplicable({
54214
+ const skipped = fields.filter(({ commandOnly, hookTypes }) => !isFieldApplicable({
53981
54215
  commandOnly,
54216
+ hookTypes,
53982
54217
  hookType
53983
54218
  }));
53984
- for (const { tool } of skipped) if (h[tool] !== void 0) warn?.(`Dropping "${tool}" from an imported "${hookType}" hook: this tool documents it on "command" hooks only, so it is not imported.`);
54219
+ for (const { tool, commandOnly, hookTypes } of skipped) if (h[tool] !== void 0) warn?.(`Dropping "${tool}" from an imported "${hookType}" hook: this tool documents it on ${describeDocumentedHookTypes({
54220
+ commandOnly,
54221
+ hookTypes
54222
+ })} hooks only, so it is not imported.`);
53985
54223
  for (const { tool, events } of typeApplicable) if (events !== void 0 && !isEventApplicable({
53986
54224
  events,
53987
54225
  eventName
@@ -54155,13 +54393,13 @@ function isKeywordFieldApplicable({ spec, hookType, eventName, flags, direction,
54155
54393
  const field = direction === "generated" ? canonical : tool;
54156
54394
  if (!isFieldApplicable({
54157
54395
  commandOnly,
54396
+ hookTypes,
54158
54397
  hookType
54159
54398
  })) {
54160
- warn?.(`Dropping "${field}" from a "${hookType}" hook on "${eventName}": this tool documents "${tool}" on "command" hooks only, so it is not ${direction}.`);
54161
- return false;
54162
- }
54163
- if (hookTypes !== void 0 && !hookTypes.has(hookType)) {
54164
- warn?.(`Dropping "${field}" from a "${hookType}" hook on "${eventName}": this tool documents "${tool}" on ${describeEvents(hookTypes)} hooks only, so it is not ${direction}.`);
54399
+ warn?.(`Dropping "${field}" from a "${hookType}" hook on "${eventName}": this tool documents "${tool}" on ${describeDocumentedHookTypes({
54400
+ commandOnly,
54401
+ hookTypes
54402
+ })} hooks only, so it is not ${direction}.`);
54165
54403
  return false;
54166
54404
  }
54167
54405
  if (events !== void 0 && !events.has(eventName)) {
@@ -56313,7 +56551,11 @@ const CLAUDE_SPEC = {
56313
56551
  tool: "onFailure",
56314
56552
  trueValue: "block",
56315
56553
  falseValue: "continue",
56316
- hookTypes: /* @__PURE__ */ new Set(["command", "http"]),
56554
+ hookTypes: /* @__PURE__ */ new Set([
56555
+ "command",
56556
+ "http",
56557
+ "mcp_tool"
56558
+ ]),
56317
56559
  ignoredEvents: /* @__PURE__ */ new Set([
56318
56560
  "stop",
56319
56561
  "subagentStop",
@@ -59108,6 +59350,18 @@ const FACTORYDROID_CONVERTER_CONFIG = {
59108
59350
  tool: "commandRegex",
59109
59351
  valueType: "string",
59110
59352
  subdividesGroup: true
59353
+ }],
59354
+ keywordPassthroughFields: [{
59355
+ canonical: "failClosed",
59356
+ tool: "onFailure",
59357
+ trueValue: "block",
59358
+ falseValue: "continue",
59359
+ events: /* @__PURE__ */ new Set([
59360
+ "preToolUse",
59361
+ "postToolUse",
59362
+ "beforeSubmitPrompt",
59363
+ "preCompact"
59364
+ ])
59111
59365
  }]
59112
59366
  };
59113
59367
  /** Droid's nine event names, the keys a standalone `hooks.json` is made of. */
@@ -59613,7 +59867,7 @@ function canonicalToHermesHooks({ config, toolOverrideHooks, logger }) {
59613
59867
  for (const [nativeEvent, definitions] of Object.entries(toolOverrideHooks ?? {})) {
59614
59868
  if (HERMESAGENT_CANONICAL_EVENTS.has(nativeEvent)) continue;
59615
59869
  if (HERMESAGENT_SHELL_UNSUPPORTED_EVENTS.has(nativeEvent)) logger?.warn(`Hermes hook event "${nativeEvent}" is Python-plugin-only; Hermes Agent refuses it for shell hooks, so the generated entry will never run.`);
59616
- else if (!HERMESAGENT_NATIVE_EVENTS.has(nativeEvent)) logger?.warn(`Hermes hook event "${nativeEvent}" is not documented by Hermes Agent v0.22.3; preserving it for forward compatibility.`);
59870
+ else if (!HERMESAGENT_NATIVE_EVENTS.has(nativeEvent)) logger?.warn(`Hermes hook event "${nativeEvent}" is not documented by Hermes Agent v0.23.2; preserving it for forward compatibility.`);
59617
59871
  setHermesHookEntries({
59618
59872
  result,
59619
59873
  event: nativeEvent,
@@ -60089,7 +60343,8 @@ const BLOCKING_HOOKS = new Set(Object.keys(NAMED_HOOK_MATCHER_SUBJECTS).filter((
60089
60343
  * 5 minutes). Ordinary commands write to the host's stdout and stderr, as Bun
60090
60344
  * Shell echoed them; a `preToolUse` command's are read, 1 MiB each kept (more
60091
60345
  * stdout denies; on the Bun Shell fallback the whole output is buffered before
60092
- * that check). Output
60346
+ * that check), and a `sessionStart` command's stdout is read the same way while
60347
+ * its stderr goes to the host's (after the command, on Bun Shell). Output
60093
60348
  * pipes a background process keeps open are read for 1 s after the command
60094
60349
  * exits; what arrived by then is kept, and the reads are then cancelled, as
60095
60350
  * they are at a timeout. The OpenCode 1.x-style `event` hooks (`inProcess`)
@@ -60237,15 +60492,18 @@ function buildRunHelperLinesFor(cwdExpression) {
60237
60492
  " const timeout = () => new Promise((resolve) => (timer = setTimeout(resolve, seconds * 1000, null)));",
60238
60493
  " if (inProcess || !(await __rulesyncCanExec)) {",
60239
60494
  ` const run = Bun.$\`echo \${input} | \${{ raw: command }}\`.cwd(${cwdExpression}).nothrow();`,
60240
- " const result = await Promise.race([echo ? run : run.quiet(), timeout()]).finally(() => clearTimeout(timer));",
60241
- " if (!result || echo) return result && { exitCode: result.exitCode };",
60495
+ " // A sessionStart command's stderr reaches the host when it ends, even after its timeout.",
60496
+ " const finished = echo === true ? run : run.quiet().then((done) => (echo && process.stderr.write(done.stderr), done));",
60497
+ " const result = await Promise.race([finished, timeout()]).finally(() => clearTimeout(timer));",
60498
+ " if (!result || echo === true) return result && { exitCode: result.exitCode };",
60242
60499
  " const { exitCode, stdout, stderr } = result;",
60243
60500
  " return { exitCode, stdout: stdout.toString(), stderr: stderr.toString(), overflow: stdout.length > 1048576 };",
60244
60501
  " }",
60245
- " // An ordinary command writes to the host's stdout and stderr; a preToolUse one is read.",
60246
- " const output = echo ? \"inherit\" : \"pipe\";",
60247
- ` const proc = ${spawn("\"export BUN_BE_BUN=\\n\" + command", "new TextEncoder().encode(input + \"\\n\")", "output")};`,
60248
- " const [stdout, stderr] = echo ? [] : [__rulesyncRead(proc.stdout), __rulesyncRead(proc.stderr)];",
60502
+ " // An ordinary command writes to the host's stdout and stderr; a preToolUse one is read, and",
60503
+ " // a sessionStart one (`echo: \"stderr\"`) has its stdout read.",
60504
+ ` const proc = ${spawn("\"export BUN_BE_BUN=\\n\" + command", "new TextEncoder().encode(input + \"\\n\")", "echo === true ? \"inherit\" : \"pipe\"", "echo ? \"inherit\" : \"pipe\"")};`,
60505
+ " const stdout = echo === true ? undefined : __rulesyncRead(proc.stdout);",
60506
+ " const stderr = echo ? undefined : __rulesyncRead(proc.stderr);",
60249
60507
  " const exitCode = await Promise.race([proc.exited, timeout()]).finally(() => clearTimeout(timer));",
60250
60508
  " if (exitCode === null) {",
60251
60509
  " stdout?.stop(), stderr?.stop();",
@@ -60253,15 +60511,15 @@ function buildRunHelperLinesFor(cwdExpression) {
60253
60511
  " else __rulesyncKillTree(proc);",
60254
60512
  " return null;",
60255
60513
  " }",
60256
- " if (echo) return { exitCode };",
60257
- " await Promise.race([Promise.all([stdout.done, stderr.done]), Bun.sleep(1000)]);",
60258
- " stdout.stop(), stderr.stop();",
60259
- " return { exitCode, stdout: stdout.text(), stderr: stderr.text(), overflow: stdout.overflow() };",
60514
+ " if (echo === true) return { exitCode };",
60515
+ " await Promise.race([Promise.all([stdout.done, stderr?.done]), Bun.sleep(1000)]);",
60516
+ " stdout.stop(), stderr?.stop();",
60517
+ " return { exitCode, stdout: stdout.text(), stderr: stderr?.text() ?? \"\", overflow: stdout.overflow() };",
60260
60518
  "};",
60261
- "const __rulesyncRunHook = async ({ label, command, input, blocking, seconds, inProcess = false }) => {",
60519
+ "const __rulesyncRunHook = async ({ label, command, input, blocking, seconds, inProcess = false, context = false }) => {",
60262
60520
  " let result;",
60263
60521
  " try {",
60264
- " result = await __rulesyncRunCommand({ command, input, seconds, inProcess, echo: true });",
60522
+ " result = await __rulesyncRunCommand({ command, input, seconds, inProcess, echo: context ? \"stderr\" : true });",
60265
60523
  " } catch (error) {",
60266
60524
  " if (blocking) throw error;",
60267
60525
  " console.error(\"[rulesync-hooks] \" + label + \" hook failed:\", error);",
@@ -60272,7 +60530,7 @@ function buildRunHelperLinesFor(cwdExpression) {
60272
60530
  " if (blocking) throw new Error(message);",
60273
60531
  " return console.error(message);",
60274
60532
  " }",
60275
- " if (result.exitCode === 0) return;",
60533
+ " if (result.exitCode === 0) return result;",
60276
60534
  " const message = \"[rulesync-hooks] \" + label + \" hook exited with code \" + result.exitCode;",
60277
60535
  " if (blocking) throw new Error(message);",
60278
60536
  " console.error(message);",
@@ -60340,6 +60598,85 @@ const PRE_TOOL_USE_RESULT_HELPER_LINES = [
60340
60598
  " );",
60341
60599
  "};"
60342
60600
  ];
60601
+ /**
60602
+ * Helpers the generated plugin defines when a `sessionStart` handler is
60603
+ * present, so the command's stdout reaches the model as Claude Code's
60604
+ * `SessionStart` stdout does:
60605
+ * - `__rulesyncSessionStart(sessionID, run)` runs a session's `sessionStart`
60606
+ * commands (`run` pushes each command's result) and keeps the pending context
60607
+ * for that session. It always settles, since every command is bounded by its
60608
+ * timeout.
60609
+ * - `__rulesyncSessionContext(sessionID)` waits for that context, which the
60610
+ * host's system-prompt hook then adds to each model request of the session.
60611
+ *
60612
+ * A command's context is its stdout on exit code 0, or the
60613
+ * `hookSpecificOutput.additionalContext` string of a JSON object it prints,
60614
+ * trimmed and capped at Claude Code's 10,000 characters; more than 1 MiB of
60615
+ * stdout is logged and ignored. Only sessions whose context is not empty are
60616
+ * kept, the 100 whose context was used or became ready most recently, and a
60617
+ * deleted session is dropped.
60618
+ */
60619
+ const SESSION_CONTEXT_HELPER_LINES = [
60620
+ "const __rulesyncSessionContexts = new Map();",
60621
+ "const __rulesyncKept = new WeakSet();",
60622
+ "const __rulesyncContextOf = (result) => {",
60623
+ " if (typeof result?.stdout !== \"string\") return \"\";",
60624
+ " if (result.overflow) {",
60625
+ " console.error(\"[rulesync-hooks] sessionStart hook wrote more than 1 MiB to stdout; it is ignored\");",
60626
+ " return \"\";",
60627
+ " }",
60628
+ " let text = result.stdout;",
60629
+ " try {",
60630
+ " const parsed = JSON.parse(text);",
60631
+ " // Like Claude Code, only a JSON object counts as JSON output; anything else is plain text.",
60632
+ " if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) text = parsed.hookSpecificOutput?.additionalContext;",
60633
+ " } catch {}",
60634
+ " return typeof text === \"string\" ? text.trim().slice(0, 10000) : \"\";",
60635
+ "};",
60636
+ "const __rulesyncSessionStart = (sessionID, run) => {",
60637
+ " const results = [];",
60638
+ " const pending = run(results)",
60639
+ " .catch(() => {})",
60640
+ " .then(() => results.map(__rulesyncContextOf).filter(Boolean).join(\"\\n\\n\"));",
60641
+ " if (typeof sessionID === \"string\") {",
60642
+ " __rulesyncSessionContexts.delete(sessionID);",
60643
+ " __rulesyncSessionContexts.set(sessionID, pending);",
60644
+ " // Only a non-empty context is kept, and only it counts towards the 100: a running",
60645
+ " // or empty one never evicts another session's context.",
60646
+ " pending.then((context) => {",
60647
+ " if (__rulesyncSessionContexts.get(sessionID) !== pending) return;",
60648
+ " if (!context) return void __rulesyncSessionContexts.delete(sessionID);",
60649
+ " __rulesyncKept.add(pending);",
60650
+ " // Evict in completion order: a context counts as used once it is ready.",
60651
+ " __rulesyncSessionContexts.delete(sessionID);",
60652
+ " __rulesyncSessionContexts.set(sessionID, pending);",
60653
+ " const kept = [...__rulesyncSessionContexts].filter(([, entry]) => __rulesyncKept.has(entry));",
60654
+ " if (kept.length > 100) __rulesyncSessionContexts.delete(kept[0][0]);",
60655
+ " });",
60656
+ " }",
60657
+ " return pending;",
60658
+ "};",
60659
+ "const __rulesyncSessionContext = async (sessionID) => {",
60660
+ " const pending = __rulesyncSessionContexts.get(sessionID);",
60661
+ " if (!pending) return \"\";",
60662
+ " __rulesyncSessionContexts.delete(sessionID);",
60663
+ " __rulesyncSessionContexts.set(sessionID, pending);",
60664
+ " return pending;",
60665
+ "};"
60666
+ ];
60667
+ /**
60668
+ * The statements of a `sessionStart` group, run through `__rulesyncSessionStart`.
60669
+ * `__rulesyncSessionStart` registers the session's pending context before its
60670
+ * first `await`, so `"void"` (used by the serial V2 event loop) registers it
60671
+ * as soon as the event is read without waiting for the commands.
60672
+ */
60673
+ function wrapSessionStartLines(sessionIdExpression, statements, operator = "await") {
60674
+ return [
60675
+ `${operator} __rulesyncSessionStart(${sessionIdExpression}, async (__rulesyncResults) => {`,
60676
+ ...statements.map((line) => ` ${line}`),
60677
+ "});"
60678
+ ];
60679
+ }
60343
60680
  function escapeForTemplateLiteral(command) {
60344
60681
  return command.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
60345
60682
  }
@@ -60400,6 +60737,14 @@ function warnIgnoredFailClosed({ config, supportedEvents, toolConfigKey, logger
60400
60737
  }
60401
60738
  }
60402
60739
  }
60740
+ /** Whether any handler is a `sessionStart` one, whose stdout becomes session context. */
60741
+ function usesSessionContext(handlers) {
60742
+ return handlers.some((handler) => handler.context);
60743
+ }
60744
+ /** The handler fields a canonical event's `sessionStart`-ness adds. */
60745
+ function sessionContextExtrasFor(canonicalEvent) {
60746
+ return canonicalEvent === "sessionStart" ? { context: true } : {};
60747
+ }
60403
60748
  /** The per-canonical-event gates and payload every handler of it carries. */
60404
60749
  function handlerExtrasFor(canonicalEvent) {
60405
60750
  const shellGate = SHELL_EVENT_TOOL_GATES[canonicalEvent];
@@ -60409,7 +60754,8 @@ function handlerExtrasFor(canonicalEvent) {
60409
60754
  event: canonicalEvent,
60410
60755
  ...shellGate ? { toolGate: shellGate.tool } : {},
60411
60756
  ...propertyGate ? { propertyGate } : {},
60412
- ...payload ? { payload } : {}
60757
+ ...payload ? { payload } : {},
60758
+ ...sessionContextExtrasFor(canonicalEvent)
60413
60759
  };
60414
60760
  }
60415
60761
  /**
@@ -60451,22 +60797,22 @@ function buildGenericEventBodyLines(genericEventHandlers) {
60451
60797
  const bodyLines = [];
60452
60798
  if (Object.keys(genericEventHandlers).length === 0) return bodyLines;
60453
60799
  bodyLines.push(" event: async ({ event }) => {");
60800
+ if (Object.values(genericEventHandlers).some(usesSessionContext)) bodyLines.push(` if (event.type === "session.deleted") __rulesyncSessionContexts.delete(${V1_SESSION_ID_EXPRESSION});`);
60454
60801
  let isFirst = true;
60455
60802
  for (const [eventName, handlers] of Object.entries(genericEventHandlers)) {
60456
60803
  bodyLines.push(` ${isFirst ? "if" : "else if"} (event.type === "${eventName}") {`);
60457
60804
  isFirst = false;
60458
- for (const line of buildPayloadClosureLines({
60805
+ const statements = buildPayloadClosureLines({
60459
60806
  handlers,
60460
60807
  cwdExpression: V1_CWD_EXPRESSION
60461
- })) bodyLines.push(` ${line}`);
60808
+ });
60462
60809
  for (const handler of handlers) {
60463
60810
  const runStatement = buildRunStatement(handler);
60464
- if (handler.propertyGate) {
60465
- bodyLines.push(` if (${handler.propertyGate}) {`);
60466
- bodyLines.push(` ${runStatement}`);
60467
- bodyLines.push(" }");
60468
- } else bodyLines.push(` ${runStatement}`);
60811
+ if (handler.propertyGate) statements.push(`if (${handler.propertyGate}) {`, ` ${runStatement}`, "}");
60812
+ else statements.push(runStatement);
60469
60813
  }
60814
+ const lines = usesSessionContext(handlers) ? wrapSessionStartLines(V1_SESSION_ID_EXPRESSION, statements) : statements;
60815
+ bodyLines.push(...lines.map((line) => ` ${line}`));
60470
60816
  bodyLines.push(" }");
60471
60817
  }
60472
60818
  bodyLines.push(" },");
@@ -60477,6 +60823,19 @@ function stdinPayloadVariable(stdinEvent) {
60477
60823
  }
60478
60824
  /** The `cwd` a V1 payload reports: the session directory, else the process's. */
60479
60825
  const V1_CWD_EXPRESSION = "directory ?? process.cwd()";
60826
+ /** The session a V1 `session.created` / `session.deleted` event is about. */
60827
+ const V1_SESSION_ID_EXPRESSION = "event.properties?.info?.id";
60828
+ /**
60829
+ * The V1 named hook that adds a session's `sessionStart` context to the system
60830
+ * prompt of each of its model requests. OpenCode 1.x, Kilo and MiMo Code all
60831
+ * call it with the request's `sessionID`.
60832
+ */
60833
+ const V1_SYSTEM_TRANSFORM_LINES = [
60834
+ " \"experimental.chat.system.transform\": async (input, output) => {",
60835
+ " const context = await __rulesyncSessionContext(input?.sessionID);",
60836
+ " if (context && Array.isArray(output?.system)) output.system.push(context);",
60837
+ " },"
60838
+ ];
60480
60839
  /** Lazily serialized closures for the payloads the handlers use (internal tables only). */
60481
60840
  function buildPayloadClosureLines({ handlers, cwdExpression }) {
60482
60841
  const payloads = /* @__PURE__ */ new Map();
@@ -60504,20 +60863,27 @@ function buildRunStatement(handler) {
60504
60863
  const failClosed = handler.failClosed === void 0 ? "" : `, ${handler.failClosed}`;
60505
60864
  return `${PRE_TOOL_USE_RESULT_HELPER}(await __rulesyncRunCommand({ command: ${command}, input: ${input}, seconds: ${handler.timeout} })${failClosed});`;
60506
60865
  }
60507
- return `await __rulesyncRunHook({ ${[
60866
+ const run = `await __rulesyncRunHook({ ${[
60508
60867
  `label: ${JSON.stringify(handler.event)}`,
60509
60868
  `command: ${command}`,
60510
60869
  `input: ${input}`,
60511
60870
  `blocking: ${handler.blocking}`,
60512
60871
  `seconds: ${handler.timeout}`,
60513
- ...handler.inProcess ? ["inProcess: true"] : []
60514
- ].join(", ")} });`;
60872
+ ...handler.inProcess ? ["inProcess: true"] : [],
60873
+ ...handler.context ? ["context: true"] : []
60874
+ ].join(", ")} })`;
60875
+ return handler.context ? `__rulesyncResults.push(${run});` : `${run};`;
60515
60876
  }
60516
60877
  /** The helpers a plugin body defines before its handlers, run in `cwdExpression`. */
60517
60878
  function buildRunHelperLines({ handlers, cwdExpression }) {
60518
60879
  if (handlers.length === 0) return [];
60519
60880
  const usesPreToolUse = handlers.some((handler) => handler.payload?.name === "PreToolUse");
60520
- return [...buildRunHelperLinesFor(cwdExpression), ...usesPreToolUse ? ["", ...PRE_TOOL_USE_RESULT_HELPER_LINES] : []];
60881
+ const usesContext = usesSessionContext(handlers);
60882
+ return [
60883
+ ...buildRunHelperLinesFor(cwdExpression),
60884
+ ...usesPreToolUse ? ["", ...PRE_TOOL_USE_RESULT_HELPER_LINES] : [],
60885
+ ...usesContext ? ["", ...SESSION_CONTEXT_HELPER_LINES] : []
60886
+ ];
60521
60887
  }
60522
60888
  /** Emit the named (`tool.execute.*`) handler blocks. */
60523
60889
  function buildNamedEventBodyLines(namedEventHandlers) {
@@ -60591,7 +60957,12 @@ function generateOpencodeStylePluginCode(config, supportedEvents, toolConfigKey,
60591
60957
  namedEventHandlers,
60592
60958
  genericEventHandlers
60593
60959
  });
60594
- const bodyLines = [...buildGenericEventBodyLines(genericEventHandlers), ...buildNamedEventBodyLines(namedEventHandlers)];
60960
+ const usesContext = Object.values(genericEventHandlers).some(usesSessionContext);
60961
+ const bodyLines = [
60962
+ ...buildGenericEventBodyLines(genericEventHandlers),
60963
+ ...buildNamedEventBodyLines(namedEventHandlers),
60964
+ ...usesContext ? V1_SYSTEM_TRANSFORM_LINES : []
60965
+ ];
60595
60966
  return wrapInExportShape({
60596
60967
  preambleLines: buildRunHelperLines({
60597
60968
  handlers: [...Object.values(namedEventHandlers), ...Object.values(genericEventHandlers)].flat(),
@@ -60904,6 +61275,37 @@ const KiroIdeHooksFileSchema = z.looseObject({
60904
61275
  hooks: z.optional(z.array(KiroIdeHookEntrySchema))
60905
61276
  });
60906
61277
  /**
61278
+ * Triggers on which Kiro runs only `command` actions.
61279
+ * @see https://kiro.dev/docs/hooks/types/#permission-request
61280
+ */
61281
+ const KIRO_COMMAND_ONLY_TRIGGERS = /* @__PURE__ */ new Set(["PermissionRequest"]);
61282
+ /**
61283
+ * Whether an imported entry is an `agent` action on a command-only trigger
61284
+ * (Kiro also accepts the camelCase `permissionRequest` spelling). Kiro never
61285
+ * runs such a hook, so importing it would hand other targets an LLM
61286
+ * permission hook the user never had in effect.
61287
+ */
61288
+ function isAgentActionOnCommandOnlyTrigger(entry) {
61289
+ if (entry.action?.type !== "agent" || entry.trigger === void 0) return false;
61290
+ const trigger = lookupOwn({
61291
+ record: CANONICAL_TO_KIRO_IDE_EVENT_NAMES,
61292
+ key: entry.trigger
61293
+ }) ?? entry.trigger;
61294
+ return KIRO_COMMAND_ONLY_TRIGGERS.has(trigger);
61295
+ }
61296
+ /**
61297
+ * Drop `prompt` definitions on a {@link KIRO_COMMAND_ONLY_TRIGGERS} trigger with
61298
+ * a warning, rather than writing an `agent` action Kiro never runs.
61299
+ */
61300
+ function dropPromptHooksOnCommandOnlyTrigger(trigger, definitions, logger) {
61301
+ if (!KIRO_COMMAND_ONLY_TRIGGERS.has(trigger)) return definitions;
61302
+ return definitions.filter((def) => {
61303
+ if (def.type !== "prompt") return true;
61304
+ logger?.warn(`Skipped a prompt hook on Kiro's "${trigger}" trigger: Kiro runs only command actions on it.`);
61305
+ return false;
61306
+ });
61307
+ }
61308
+ /**
60907
61309
  * Build the Kiro IDE hook entries for a single canonical event's definitions.
60908
61310
  *
60909
61311
  * `command`-type definitions become `{ type: "command", command }` actions and
@@ -60958,7 +61360,7 @@ const KIRO_HOOKS_OVERRIDE_KEY = "kiro";
60958
61360
  * that is actually read.
60959
61361
  */
60960
61362
  const KIRO_HOOKS_IGNORED_OVERRIDE_KEYS = ["kiro-ide", "kiro-cli"];
60961
- function canonicalToKiroIdeHooks(config) {
61363
+ function canonicalToKiroIdeHooks(config, logger) {
60962
61364
  const kiroIdeSupported = new Set(KIRO_IDE_HOOK_EVENTS);
60963
61365
  const sharedHooks = {};
60964
61366
  for (const [event, defs] of Object.entries(config.hooks)) if (kiroIdeSupported.has(event)) sharedHooks[event] = defs;
@@ -60975,7 +61377,7 @@ function canonicalToKiroIdeHooks(config) {
60975
61377
  record: KIRO_LEGACY_TO_KIRO_IDE_TRIGGER_NAMES,
60976
61378
  key: eventName
60977
61379
  }) ?? eventName;
60978
- entries.push(...buildKiroIdeEntriesForEvent(trigger, definitions));
61380
+ entries.push(...buildKiroIdeEntriesForEvent(trigger, dropPromptHooksOnCommandOnlyTrigger(trigger, definitions, logger)));
60979
61381
  }
60980
61382
  return entries;
60981
61383
  }
@@ -60987,25 +61389,35 @@ function copyOptionalHookFields({ entry, def }) {
60987
61389
  if (entry.enabled === false) def.enabled = false;
60988
61390
  if (entry.confirm !== void 0 && entry.confirm !== null) def.confirm = omitPrototypePollutionKeysDeep(entry.confirm);
60989
61391
  }
60990
- function kiroIdeHooksToCanonical(entries) {
61392
+ /**
61393
+ * The canonical `type` plus `command` / `prompt` of an imported Kiro action, or
61394
+ * `undefined` when the action carries nothing to run.
61395
+ */
61396
+ function toCanonicalAction(action) {
61397
+ if (action.type === "command") return action.command ? {
61398
+ type: "command",
61399
+ command: action.command
61400
+ } : void 0;
61401
+ return action.prompt ? {
61402
+ type: "prompt",
61403
+ prompt: action.prompt
61404
+ } : void 0;
61405
+ }
61406
+ function kiroIdeHooksToCanonical(entries, logger) {
60991
61407
  const canonical = {};
60992
61408
  for (const entry of entries) {
60993
61409
  if (entry.trigger === void 0 || entry.action === void 0) continue;
61410
+ if (isAgentActionOnCommandOnlyTrigger(entry)) {
61411
+ logger?.warn(`Skipped an agent hook on Kiro's "${entry.trigger}" trigger: Kiro runs only command actions on it.`);
61412
+ continue;
61413
+ }
60994
61414
  const eventName = lookupOwn({
60995
61415
  record: KIRO_IDE_TO_CANONICAL_EVENT_NAMES,
60996
61416
  key: entry.trigger
60997
61417
  }) ?? entry.trigger;
60998
61418
  if (isPrototypePollutionKey(eventName)) continue;
60999
- const def = {};
61000
- if (entry.action.type === "command") {
61001
- if (!entry.action.command) continue;
61002
- def.type = "command";
61003
- def.command = entry.action.command;
61004
- } else {
61005
- if (!entry.action.prompt) continue;
61006
- def.type = "prompt";
61007
- def.prompt = entry.action.prompt;
61008
- }
61419
+ const def = toCanonicalAction(entry.action);
61420
+ if (def === void 0) continue;
61009
61421
  if (entry.name !== void 0 && entry.name !== null) def.name = entry.name;
61010
61422
  if (entry.description !== void 0 && entry.description !== null) def.description = entry.description;
61011
61423
  if (entry.matcher !== void 0 && entry.matcher !== null && entry.matcher !== "") def.matcher = entry.matcher;
@@ -61071,7 +61483,7 @@ var KiroIdeHooks = class extends ToolHooks {
61071
61483
  if (config[ignoredKey]?.hooks === void 0) continue;
61072
61484
  logger?.warn(`The "${ignoredKey}.hooks" block in ${join(rulesyncHooks.getRelativeDirPath(), rulesyncHooks.getRelativeFilePath())} is ignored. Author it under the "${KIRO_HOOKS_OVERRIDE_KEY}.hooks" key instead: the Kiro IDE and Kiro CLI targets write the same hooks file, so they read one shared block.`);
61073
61485
  }
61074
- const hooks = canonicalToKiroIdeHooks(config);
61486
+ const hooks = canonicalToKiroIdeHooks(config, logger);
61075
61487
  const fileContent = JSON.stringify({
61076
61488
  version: "v1",
61077
61489
  hooks
@@ -61088,7 +61500,7 @@ var KiroIdeHooks = class extends ToolHooks {
61088
61500
  const hooks = kiroIdeHooksToCanonical(this.parseFileContentOrThrow({
61089
61501
  displayName: "Kiro IDE",
61090
61502
  parse: (fileContent) => KiroIdeHooksFileSchema.parse(JSON.parse(fileContent))
61091
- }).hooks ?? []);
61503
+ }).hooks ?? [], logger);
61092
61504
  return this.toRulesyncHooksDefault({ fileContent: JSON.stringify(buildImportedHooksConfig({
61093
61505
  logger,
61094
61506
  hooks,
@@ -61520,6 +61932,27 @@ const TOOL_MATCHER_HELPER_LINES = [
61520
61932
  ];
61521
61933
  /** Hook points whose `matcher` is tested against the tool name. */
61522
61934
  const OPENCODE_V2_MATCHABLE_HOOKS = /* @__PURE__ */ new Set(["tool:execute.before", "tool:execute.after"]);
61935
+ /** The session a V2 `session.created` / `session.deleted` event is about. */
61936
+ const V2_SESSION_ID_EXPRESSION = "event.data?.sessionID";
61937
+ /**
61938
+ * The `session:context` registration that adds a session's `sessionStart`
61939
+ * context to the system prompt of each of its agent-loop model requests. A
61940
+ * host that cannot register it (no `ctx.session.hook`, or no `context` hook
61941
+ * point) gets a logged error instead of a setup throw, so the plugin's other
61942
+ * hooks, `preToolUse` guards included, still load.
61943
+ */
61944
+ const SESSION_CONTEXT_HOOK_LINES = [
61945
+ "try {",
61946
+ " __rulesyncRegistrations.push(",
61947
+ " await ctx.session.hook(\"context\", async (event) => {",
61948
+ " const context = await __rulesyncSessionContext(event?.sessionID);",
61949
+ " if (context && Array.isArray(event?.system)) event.system.push({ type: \"text\", text: context });",
61950
+ " }),",
61951
+ " );",
61952
+ "} catch (error) {",
61953
+ " console.error(\"[rulesync-hooks] could not register the session context hook; sessionStart output does not reach the model:\", error);",
61954
+ "}"
61955
+ ];
61523
61956
  /** Wrap a statement in the handler's gate and matcher conditions. */
61524
61957
  function wrapInConditions(handler, statement, indent) {
61525
61958
  const conditions = [];
@@ -61556,32 +61989,52 @@ function buildHookRegistrationLines(hookPoint, handlers) {
61556
61989
  * in its own try/catch, so a throw while evaluating its gate or building its
61557
61990
  * payload, outside `__rulesyncRunHook`, is logged the same way. The
61558
61991
  * subscription passes `types` so the server delivers only the handled events.
61992
+ *
61993
+ * The loop itself never waits for a command, so a slow handler cannot hold back
61994
+ * the events after it: handlers run one after another on
61995
+ * `__rulesyncEventQueue`, in event order, while `sessionStart` starts right
61996
+ * away, outside the queue (so it can overlap other event commands), and its
61997
+ * session's pending context is registered before that session's first model
61998
+ * request asks for it. Handlers still queued at dispose are skipped.
61559
61999
  */
61560
- function buildEventLoopLines(eventHandlers) {
62000
+ function buildEventLoopLines(eventHandlers, usesContext) {
61561
62001
  const lines = [];
61562
- const types = [...eventHandlers.keys()].map((eventType) => JSON.stringify(eventType)).join(", ");
62002
+ const eventTypes = new Set(eventHandlers.keys());
62003
+ if (usesContext) eventTypes.add("session.deleted");
62004
+ const types = [...eventTypes].map((eventType) => JSON.stringify(eventType)).join(", ");
61563
62005
  lines.push("const __rulesyncEvents = new AbortController();");
62006
+ lines.push("let __rulesyncEventQueue = Promise.resolve();");
61564
62007
  lines.push("void (async () => {");
61565
62008
  lines.push(" for await (const event of ctx.event.subscribe({");
61566
62009
  lines.push(` types: [${types}],`);
61567
62010
  lines.push(" signal: __rulesyncEvents.signal,");
61568
62011
  lines.push(" })) {");
62012
+ if (usesContext) lines.push(` if (event.type === "session.deleted") __rulesyncSessionContexts.delete(${V2_SESSION_ID_EXPRESSION});`);
61569
62013
  let isFirst = true;
61570
62014
  for (const [eventType, handlers] of eventHandlers) {
61571
62015
  lines.push(` ${isFirst ? "if" : "} else if"} (event.type === "${eventType}") {`);
61572
62016
  isFirst = false;
61573
- lines.push(...buildPayloadClosureLines({
62017
+ const statements = buildPayloadClosureLines({
61574
62018
  handlers,
61575
62019
  cwdExpression: "directory"
61576
- }).map((line) => ` ${line}`));
62020
+ });
61577
62021
  for (const handler of handlers) {
61578
- lines.push(" try {");
61579
- lines.push(...wrapInConditions(handler, buildRunStatement(handler), " "));
61580
- lines.push(" } catch (error) {");
62022
+ statements.push("try {");
62023
+ statements.push(...wrapInConditions(handler, buildRunStatement(handler), " "));
62024
+ statements.push("} catch (error) {");
61581
62025
  const message = JSON.stringify(`[rulesync-hooks] ${handler.event} hook failed:`);
61582
- lines.push(` console.error(${message}, error);`);
61583
- lines.push(" }");
61584
- }
62026
+ statements.push(` console.error(${message}, error);`);
62027
+ statements.push("}");
62028
+ }
62029
+ const body = usesSessionContext(handlers) ? wrapSessionStartLines(V2_SESSION_ID_EXPRESSION, statements, "void") : [
62030
+ "__rulesyncEventQueue = __rulesyncEventQueue",
62031
+ " .then(async () => {",
62032
+ " if (__rulesyncEvents.signal.aborted) return;",
62033
+ ...statements.map((line) => ` ${line}`),
62034
+ " })",
62035
+ ` .catch((error) => console.error(${JSON.stringify(`[rulesync-hooks] ${eventType} event hook failed:`)}, error));`
62036
+ ];
62037
+ lines.push(...body.map((line) => ` ${line}`));
61585
62038
  }
61586
62039
  lines.push(" }");
61587
62040
  lines.push(" }");
@@ -61612,7 +62065,8 @@ function buildHandlersFor({ canonicalEvent, definitions, target }) {
61612
62065
  ...hookTimingOf(def),
61613
62066
  ...def.matcher ? { matcher: def.matcher } : {},
61614
62067
  ...gate ? { gate } : {},
61615
- ...payload ? { payload } : {}
62068
+ ...payload ? { payload } : {},
62069
+ ...sessionContextExtrasFor(canonicalEvent)
61616
62070
  });
61617
62071
  }
61618
62072
  return handlers;
@@ -61629,16 +62083,19 @@ function buildSetupBodyLines({ hookHandlers, eventHandlers }) {
61629
62083
  })
61630
62084
  ];
61631
62085
  if ([...hookHandlers.values()].some((handlers) => handlers.some((handler) => handler.matcher !== void 0))) body.push("", ...TOOL_MATCHER_HELPER_LINES);
62086
+ const usesContext = [...eventHandlers.values()].some(usesSessionContext);
62087
+ const registers = hookHandlers.size > 0 || usesContext;
61632
62088
  const cleanup = [];
61633
- if (hookHandlers.size > 0) {
62089
+ if (registers) {
61634
62090
  body.push("", "const __rulesyncRegistrations = [];");
61635
62091
  for (const [hookPoint, handlers] of hookHandlers) body.push(...buildHookRegistrationLines(hookPoint, handlers));
62092
+ if (usesContext) body.push(...SESSION_CONTEXT_HOOK_LINES);
61636
62093
  }
61637
62094
  if (eventHandlers.size > 0) {
61638
- body.push("", ...buildEventLoopLines(eventHandlers));
62095
+ body.push("", ...buildEventLoopLines(eventHandlers, usesContext));
61639
62096
  cleanup.push(" __rulesyncEvents.abort();");
61640
62097
  }
61641
- if (hookHandlers.size > 0) cleanup.push(" await Promise.all(__rulesyncRegistrations.map((registration) => registration.dispose()));");
62098
+ if (registers) cleanup.push(" await Promise.all(__rulesyncRegistrations.map((registration) => registration.dispose()));");
61642
62099
  body.push("", "return async () => {", ...cleanup, "};");
61643
62100
  return body;
61644
62101
  }
@@ -62480,6 +62937,17 @@ var PoolHooks = class PoolHooks extends ToolHooks {
62480
62937
  }
62481
62938
  };
62482
62939
  // src/features/hooks/qoder-hooks.ts
62940
+ const QODER_NO_MATCHER_EVENTS = /* @__PURE__ */ new Set([
62941
+ "beforeSubmitPrompt",
62942
+ "stop",
62943
+ "cwdChanged",
62944
+ "worktreeCreate",
62945
+ "worktreeRemove",
62946
+ "taskCreated",
62947
+ "taskCompleted",
62948
+ "teammateIdle"
62949
+ ]);
62950
+ const QODER_AGENT_HOOK_TYPES = /* @__PURE__ */ new Set(["agent"]);
62483
62951
  const QODER_SPEC = {
62484
62952
  displayName: "Qoder",
62485
62953
  overrideKey: "qoder",
@@ -62489,16 +62957,7 @@ const QODER_SPEC = {
62489
62957
  toolToCanonicalEventNames: QODER_TO_CANONICAL_EVENT_NAMES,
62490
62958
  projectDirVar: "$QODER_PROJECT_DIR",
62491
62959
  prefixDotRelativeCommandsOnly: true,
62492
- noMatcherEvents: /* @__PURE__ */ new Set([
62493
- "beforeSubmitPrompt",
62494
- "stop",
62495
- "cwdChanged",
62496
- "worktreeCreate",
62497
- "worktreeRemove",
62498
- "taskCreated",
62499
- "taskCompleted",
62500
- "teammateIdle"
62501
- ]),
62960
+ noMatcherEvents: QODER_NO_MATCHER_EVENTS,
62502
62961
  supportedHookTypes: /* @__PURE__ */ new Set([
62503
62962
  "command",
62504
62963
  "http",
@@ -62555,6 +63014,15 @@ const QODER_SPEC = {
62555
63014
  canonical: "args",
62556
63015
  tool: "args",
62557
63016
  commandOnly: true
63017
+ }, {
63018
+ canonical: "tools",
63019
+ tool: "tools",
63020
+ hookTypes: QODER_AGENT_HOOK_TYPES
63021
+ }],
63022
+ numberPassthroughFields: [{
63023
+ canonical: "maxTurns",
63024
+ tool: "maxTurns",
63025
+ hookTypes: QODER_AGENT_HOOK_TYPES
62558
63026
  }],
62559
63027
  recordPassthroughFields: [{
62560
63028
  canonical: "env",
@@ -72467,12 +72935,22 @@ const MAX_REMOVE_EMPTY_ENTRIES_DEPTH = 32;
72467
72935
  */
72468
72936
  const GROK_DISABLED_MCP_TOOLS_KEY = "disabled_mcp_tools";
72469
72937
  /**
72938
+ * Grok 1.0.88+ runs a command that prints JSON headers at every connect of an
72939
+ * HTTP/SSE server. In `config.toml` the key is `headers_helper`; the camelCase
72940
+ * `headersHelper` (rulesync's canonical spelling) is documented for
72941
+ * `.mcp.json` only, so it is renamed in both directions.
72942
+ * (Grok user guide `07-mcp-servers.md`, "Headers from a command".)
72943
+ */
72944
+ const CANONICAL_HEADERS_HELPER_KEY = "headersHelper";
72945
+ const GROK_HEADERS_HELPER_KEY = "headers_helper";
72946
+ /**
72470
72947
  * Grok Build stores MCP servers in `config.toml` under a `[mcp_servers.<name>]`
72471
72948
  * table. Verified against `grok mcp add` (grok 0.2.54): a stdio server emits
72472
72949
  * `command`, `args`, `enabled = true`, and an `[mcp_servers.<name>.env]` table;
72473
72950
  * a remote server emits `url` and `enabled`. Unlike Codex CLI, Grok uses a
72474
- * literal `env` table (not the `env_vars` passthrough list), so the only field
72475
- * rename is `disabled` (rulesync) ↔ `enabled = false` (grok). `disabledTools`
72951
+ * literal `env` table (not the `env_vars` passthrough list), so the field
72952
+ * renames are `disabled` (rulesync) ↔ `enabled = false` (grok) and
72953
+ * `headersHelper` ↔ `headers_helper`. `disabledTools`
72476
72954
  * never lands in the server table: it is lifted into the top-level
72477
72955
  * `[disabled_mcp_tools]` table by `buildDisabledMcpTools`.
72478
72956
  */
@@ -72486,6 +72964,8 @@ function convertToGrokFormat(mcpServers) {
72486
72964
  if (PROTOTYPE_POLLUTION_KEYS.has(key) || key === "disabledTools") continue;
72487
72965
  if (key === "disabled") {
72488
72966
  if (value === true) converted["enabled"] = false;
72967
+ } else if (key === CANONICAL_HEADERS_HELPER_KEY) {
72968
+ if (!Object.hasOwn(config, GROK_HEADERS_HELPER_KEY)) converted[GROK_HEADERS_HELPER_KEY] = value;
72489
72969
  } else converted[key] = value;
72490
72970
  }
72491
72971
  result[name] = converted;
@@ -72501,6 +72981,9 @@ function convertFromGrokFormat(grokMcp) {
72501
72981
  if (PROTOTYPE_POLLUTION_KEYS.has(key)) continue;
72502
72982
  if (key === "enabled") {
72503
72983
  if (value === false) converted["disabled"] = true;
72984
+ } else if (key === GROK_HEADERS_HELPER_KEY) converted[CANONICAL_HEADERS_HELPER_KEY] = value;
72985
+ else if (key === CANONICAL_HEADERS_HELPER_KEY) {
72986
+ if (!Object.hasOwn(config, GROK_HEADERS_HELPER_KEY)) converted[CANONICAL_HEADERS_HELPER_KEY] = value;
72504
72987
  } else converted[key] = value;
72505
72988
  }
72506
72989
  result[name] = converted;
@@ -73616,6 +74099,21 @@ function fromKiroMcpServers(servers) {
73616
74099
  }];
73617
74100
  }));
73618
74101
  }
74102
+ /**
74103
+ * Parse an existing user-level `~/.kiro/settings/mcp.json` so a global generate
74104
+ * can merge into it. An unparseable file is refused instead of overwritten:
74105
+ * it is unversioned, so replacing it would lose whatever the user had there.
74106
+ */
74107
+ function parseExistingKiroMcpConfig(fileContent, configPath) {
74108
+ let parsed;
74109
+ try {
74110
+ parsed = JSON.parse(fileContent);
74111
+ } catch (error) {
74112
+ throw new Error(`Failed to parse Kiro MCP config at ${configPath}: ${formatError(error)}`, { cause: error });
74113
+ }
74114
+ if (!isPlainObject(parsed)) throw new Error(`Failed to parse Kiro MCP config at ${configPath}: expected a JSON object`);
74115
+ return parsed;
74116
+ }
73619
74117
  var KiroMcp = class KiroMcp extends ToolMcp {
73620
74118
  json;
73621
74119
  constructor(params) {
@@ -73625,13 +74123,26 @@ var KiroMcp = class KiroMcp extends ToolMcp {
73625
74123
  getJson() {
73626
74124
  return this.json;
73627
74125
  }
74126
+ /**
74127
+ * The user-level `~/.kiro/settings/mcp.json` also holds settings rulesync
74128
+ * does not manage (such as the top-level `identityProvider` block for
74129
+ * organization sign-in, which Kiro reads only from this file), so it is never
74130
+ * deleted in global mode. The project file is rulesync-managed and may be.
74131
+ * The sweep has no in-place retraction, so a global `--delete` run without a
74132
+ * source leaves the generated `mcpServers` behind; an empty source
74133
+ * (`{ "mcpServers": {} }`) retracts them through the normal merge.
74134
+ * @see https://kiro.dev/docs/mcp/configuration/
74135
+ */
74136
+ isDeletable() {
74137
+ return !this.global;
74138
+ }
73628
74139
  static getSettablePaths() {
73629
74140
  return {
73630
74141
  relativeDirPath: KIRO_SETTINGS_DIR_PATH,
73631
74142
  relativeFilePath: KIRO_MCP_FILE_NAME
73632
74143
  };
73633
74144
  }
73634
- static async fromFile({ outputRoot = process.cwd(), validate = true }) {
74145
+ static async fromFile({ outputRoot = process.cwd(), validate = true, global = false }) {
73635
74146
  const paths = this.getSettablePaths();
73636
74147
  const fileContent = await readFileContentOrNull(join(outputRoot, paths.relativeDirPath, paths.relativeFilePath)) ?? "{\"mcpServers\":{}}";
73637
74148
  return new KiroMcp({
@@ -73639,18 +74150,34 @@ var KiroMcp = class KiroMcp extends ToolMcp {
73639
74150
  relativeDirPath: paths.relativeDirPath,
73640
74151
  relativeFilePath: paths.relativeFilePath,
73641
74152
  fileContent,
73642
- validate
74153
+ validate,
74154
+ global
73643
74155
  });
73644
74156
  }
73645
- static fromRulesyncMcp({ outputRoot = process.cwd(), rulesyncMcp, validate = true }) {
74157
+ /**
74158
+ * In global mode the generated `mcpServers` are merged into the existing
74159
+ * user-level file, keeping every other top-level key (for example
74160
+ * `identityProvider`). The project file is written from scratch.
74161
+ */
74162
+ static async fromRulesyncMcp({ outputRoot = process.cwd(), rulesyncMcp, validate = true, global = false }) {
73646
74163
  const paths = this.getSettablePaths();
73647
- const fileContent = JSON.stringify({ mcpServers: toKiroMcpServers(rulesyncMcp.getMcpServers()) }, null, 2);
74164
+ const mcpServers = toKiroMcpServers(rulesyncMcp.getMcpServers());
74165
+ let existing = {};
74166
+ if (global) {
74167
+ const configPath = join(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
74168
+ const existingContent = await readFileContentOrNull(configPath);
74169
+ if (existingContent !== null) existing = parseExistingKiroMcpConfig(existingContent, configPath);
74170
+ }
73648
74171
  return new KiroMcp({
73649
74172
  outputRoot,
73650
74173
  relativeDirPath: paths.relativeDirPath,
73651
74174
  relativeFilePath: paths.relativeFilePath,
73652
- fileContent,
73653
- validate
74175
+ fileContent: JSON.stringify({
74176
+ ...existing,
74177
+ mcpServers
74178
+ }, null, 2),
74179
+ validate,
74180
+ global
73654
74181
  });
73655
74182
  }
73656
74183
  toRulesyncMcp() {
@@ -73658,13 +74185,14 @@ var KiroMcp = class KiroMcp extends ToolMcp {
73658
74185
  const translated = isMcpServers(mcpServers) ? fromKiroMcpServers(mcpServers) : {};
73659
74186
  return this.toRulesyncMcpDefault({ fileContent: JSON.stringify({ mcpServers: translated }, null, 2) });
73660
74187
  }
73661
- static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath }) {
74188
+ static forDeletion({ outputRoot = process.cwd(), relativeDirPath, relativeFilePath, global = false }) {
73662
74189
  return new KiroMcp({
73663
74190
  outputRoot,
73664
74191
  relativeDirPath,
73665
74192
  relativeFilePath,
73666
74193
  fileContent: "{}",
73667
- validate: false
74194
+ validate: false,
74195
+ global
73668
74196
  });
73669
74197
  }
73670
74198
  };
@@ -82089,6 +82617,22 @@ const ANTIGRAVITY_CLI_OVERRIDE_KEYS = [
82089
82617
  ];
82090
82618
  const moduleLogger$4 = fallbackLogger;
82091
82619
  /**
82620
+ * The value the CLI stores in `agentMode` for its Default mode. Since CLI 1.5.7
82621
+ * an omitted `agentMode` starts the CLI in `auto` where available, and the
82622
+ * documented stored values are `""` (Default), `"accept-edits"`, `"auto"` and
82623
+ * `"plan"` — there is no `"default"` string.
82624
+ * @see https://antigravity.google/docs/cli/modes
82625
+ * @see https://github.com/google-antigravity/antigravity-cli/releases/tag/1.5.7
82626
+ */
82627
+ const ANTIGRAVITY_CLI_STORED_DEFAULT_AGENT_MODE = "";
82628
+ /**
82629
+ * Translate the canonical `agentMode` override value to the value the CLI
82630
+ * stores: canonical `default` becomes `""`, other modes pass through.
82631
+ */
82632
+ function toStoredAgentMode(value) {
82633
+ return value === "default" ? ANTIGRAVITY_CLI_STORED_DEFAULT_AGENT_MODE : value;
82634
+ }
82635
+ /**
82092
82636
  * Narrow an imported `settings.json` value to one of the documented values of
82093
82637
  * an enum-typed override key. The override schema declares `toolPermission`,
82094
82638
  * `artifactReviewPolicy` and `agentMode` as `z.enum`, so carrying an
@@ -82225,7 +82769,7 @@ var AntigravityCliPermissions = class AntigravityCliPermissions extends ToolPerm
82225
82769
  const override = config["antigravity-cli"];
82226
82770
  for (const key of ANTIGRAVITY_CLI_OVERRIDE_KEYS) {
82227
82771
  const value = override?.[key];
82228
- if (value !== void 0) merged[key] = value;
82772
+ if (value !== void 0) merged[key] = key === "agentMode" ? toStoredAgentMode(value) : value;
82229
82773
  }
82230
82774
  const fileContent = JSON.stringify(merged, null, 2);
82231
82775
  return new AntigravityCliPermissions({
@@ -82269,7 +82813,7 @@ var AntigravityCliPermissions = class AntigravityCliPermissions extends ToolPerm
82269
82813
  });
82270
82814
  if (artifactReviewPolicy !== void 0) override.artifactReviewPolicy = artifactReviewPolicy;
82271
82815
  if (typeof settings.allowNonWorkspaceAccess === "boolean") override.allowNonWorkspaceAccess = settings.allowNonWorkspaceAccess;
82272
- const agentMode = pickDocumentedValue({
82816
+ const agentMode = settings.agentMode === ANTIGRAVITY_CLI_STORED_DEFAULT_AGENT_MODE ? "default" : pickDocumentedValue({
82273
82817
  key: "agentMode",
82274
82818
  value: settings.agentMode,
82275
82819
  documented: ANTIGRAVITY_CLI_AGENT_MODES
@@ -84098,6 +84642,29 @@ const CLAUDECODE_WIDENING_DEFAULT_MODES = {
84098
84642
  */
84099
84643
  const CLAUDECODE_PROJECT_SCOPE_IGNORED_DEFAULT_MODES = /* @__PURE__ */ new Set(["auto", "bypassPermissions"]);
84100
84644
  /**
84645
+ * The `permissions` fields Claude Code reads only from user or managed settings
84646
+ * (and `--settings`), never from a repository's `.claude/settings.json`, so
84647
+ * they are dropped at project scope and written only under `--global`.
84648
+ * `denyInsteadOfPrompting` (v2.1.319+) only restricts, but committing it to a
84649
+ * project file would promise unattended denials that never happen.
84650
+ *
84651
+ * @see https://code.claude.com/docs/en/settings-reference#permissions-denyinsteadofprompting
84652
+ */
84653
+ const CLAUDECODE_USER_SCOPE_ONLY_PERMISSIONS_FIELDS = /* @__PURE__ */ new Set(["denyInsteadOfPrompting"]);
84654
+ /**
84655
+ * Drop the project-scope `permissions` fields in
84656
+ * {@link CLAUDECODE_USER_SCOPE_ONLY_PERMISSIONS_FIELDS}, warning once per field
84657
+ * in the same voice as the user-scope-only top-level keys.
84658
+ */
84659
+ function stripUserScopeOnlyPermissionsFields({ fields, global, relativeFilePath, logger }) {
84660
+ if (global) return;
84661
+ for (const key of CLAUDECODE_USER_SCOPE_ONLY_PERMISSIONS_FIELDS) {
84662
+ if (!Object.hasOwn(fields, key)) continue;
84663
+ logger?.warn(`Claude Code permissions: 'permissions.${key}' is not honored in the project-scoped ${relativeFilePath}, so it is not written there — Claude Code reads it from user or managed settings only. Author it in the global scope instead, and remove any value an earlier generate may have left in ${relativeFilePath}.`);
84664
+ delete fields[key];
84665
+ }
84666
+ }
84667
+ /**
84101
84668
  * Drop a project-scope `permissions.defaultMode` Claude Code ignores there (see
84102
84669
  * {@link CLAUDECODE_PROJECT_SCOPE_IGNORED_DEFAULT_MODES}), warning in the same
84103
84670
  * voice as the other values the project-scoped file cannot honor.
@@ -84191,7 +84758,7 @@ const CLAUDECODE_TRUST_AFFECTING_SANDBOX_PATHS = [
84191
84758
  },
84192
84759
  {
84193
84760
  path: ["enabled"],
84194
- reason: "turns the sandbox on, and sandboxed Bash commands then run without a permission prompt unless `autoAllowBashIfSandboxed` is false",
84761
+ reason: "turns the sandbox on, and sandboxed Bash commands then run without a permission prompt wherever `autoAllowBashIfSandboxed` is true (it defaults to false since Claude Code v2.1.324)",
84195
84762
  widens: isNotFalse
84196
84763
  },
84197
84764
  {
@@ -84494,6 +85061,7 @@ const CLAUDECODE_UNHONORED_KEY_SOURCES = {
84494
85061
  disableCommandPluginSources: "managed settings",
84495
85062
  disableDesktopLocalSessions: "managed settings",
84496
85063
  disableMobileSimulatorTools: "managed settings",
85064
+ disableRemotePreviewScripts: "managed settings",
84497
85065
  disableSideloadFlags: "managed settings",
84498
85066
  externalEditorContext: "~/.claude.json",
84499
85067
  forceRemoteSettingsRefresh: "managed settings",
@@ -84987,6 +85555,12 @@ var ClaudecodePermissions = class ClaudecodePermissions extends ToolPermissions
84987
85555
  relativeFilePath: paths.relativeFilePath,
84988
85556
  logger
84989
85557
  });
85558
+ stripUserScopeOnlyPermissionsFields({
85559
+ fields: nonListFields,
85560
+ global,
85561
+ relativeFilePath: paths.relativeFilePath,
85562
+ logger
85563
+ });
84990
85564
  trustAffecting.push(...collectWideningPermissionFields({ fields: nonListFields }));
84991
85565
  settings.permissions = {
84992
85566
  ...settings.permissions,
@@ -86964,6 +87538,7 @@ const CODEX_DEFAULT_APPROVAL_POLICY = "on-request";
86964
87538
  const CODEX_DEFAULT_APPROVALS_REVIEWER = "auto_review";
86965
87539
  const CODEX_RETIRED_APPROVAL_POLICY = "untrusted";
86966
87540
  const CODEX_DEPRECATED_APPROVAL_POLICY = "on-failure";
87541
+ const CODEX_REMOVED_AUTO_REVIEW_KEYS = ["extra_policy", "experimental_policy_template"];
86967
87542
  const CODEX_GLOB_SCAN_MAX_DEPTH = 8;
86968
87543
  const CODEX_MINIMAL_KEY = ":minimal";
86969
87544
  const CODEX_GIT_WRITE_RULES = { ".git/**": "write" };
@@ -87565,6 +88140,10 @@ function computeCodexcliOverridePatch({ existing, override, logger }) {
87565
88140
  value,
87566
88141
  logger
87567
88142
  })) continue;
88143
+ if (key === "auto_review" && isRecord(value)) warnAboutRemovedAutoReviewKeys({
88144
+ value,
88145
+ logger
88146
+ });
87568
88147
  if (key === "sandbox_mode" || key === "sandbox_workspace_write") logger?.warn(`Codex CLI permission override key "${key}" is deprecated. Codex prioritizes the legacy sandbox settings over permission profiles when both are present, so it disables the generated "${RULESYNC_PROFILE_NAME}" permissions profile. Use "base_permission_profile" and the shared "permission" block instead.`);
87569
88148
  const existingValue = existing[key];
87570
88149
  patch[key] = isRecord(existingValue) && isRecord(value) ? {
@@ -87604,6 +88183,12 @@ function isWritableApprovalPolicy({ value, logger }) {
87604
88183
  if (value === CODEX_DEPRECATED_APPROVAL_POLICY) logger?.warn(`Codex CLI permission override "approval_policy": "${CODEX_DEPRECATED_APPROVAL_POLICY}" is deprecated; Codex reads it as "${CODEX_DEFAULT_APPROVAL_POLICY}". Use "${CODEX_DEFAULT_APPROVAL_POLICY}" instead.`);
87605
88184
  return true;
87606
88185
  }
88186
+ function warnAboutRemovedAutoReviewKeys({ value, logger }) {
88187
+ for (const key of CODEX_REMOVED_AUTO_REVIEW_KEYS) {
88188
+ if (!Object.hasOwn(value, key)) continue;
88189
+ logger?.warn(`Codex CLI permission override "auto_review.${key}" was removed in Codex 0.169.0: newer Codex ignores it and warns at startup (it is rejected only under --strict-config). It is still written for older Codex. Move the text to "auto_review.policy", or to guardian_extra_policy in a managed requirements.toml.`);
88190
+ }
88191
+ }
87607
88192
  function extractCodexcliOverride(table) {
87608
88193
  const override = {};
87609
88194
  for (const key of CODEXCLI_OVERRIDE_KEYS) if (table[key] !== void 0) override[key] = table[key];
@@ -88978,6 +89563,17 @@ const AUTO_APPROVE_KEYS = {
88978
89563
  webfetch: "chat.tools.urls.autoApprove"
88979
89564
  };
88980
89565
  /**
89566
+ * VS Code registers `chat.tools.edits.autoApprove` with
89567
+ * `ConfigurationScope.APPLICATION` (user settings only) and ignores the value
89568
+ * in a workspace `.vscode/settings.json`, so canonical `edit` rules written
89569
+ * there have no effect. The terminal and URL maps are honored in the workspace
89570
+ * only by the Local harness, which VS Code removes in February 2027.
89571
+ *
89572
+ * @see https://github.com/microsoft/vscode/blob/1.147.0/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.ts
89573
+ * @see https://code.visualstudio.com/docs/agents/run/approvals
89574
+ */
89575
+ const EDITS_KEY_IGNORED_WARNING = "GitHub Copilot: canonical `edit` rules are written to `chat.tools.edits.autoApprove` in .vscode/settings.json, but VS Code reads that setting from user settings only and ignores it in the workspace. Set edit approvals in your VS Code user settings instead.";
89576
+ /**
88981
89577
  * The workspace setting holding the starting permission level of new Local
88982
89578
  * (`local` harness) chat sessions, authored through the
88983
89579
  * `copilot.defaultPermissionMode` override. VS Code 1.144 narrowed it to Local
@@ -89135,6 +89731,10 @@ const SANDBOX_LEAVES = [
89135
89731
  path: ["credentials", "authenticategh"],
89136
89732
  schema: z.boolean()
89137
89733
  },
89734
+ {
89735
+ path: ["credentials", "envVars"],
89736
+ schema: CopilotSandboxCredentialEnvVarsSchema
89737
+ },
89138
89738
  {
89139
89739
  path: ["fileSystem", "allowDevToolAccess"],
89140
89740
  schema: z.boolean()
@@ -89194,6 +89794,11 @@ const COPILOT_TRUST_AFFECTING_SANDBOX_PATHS = [
89194
89794
  reason: "hands your GitHub CLI authentication to sandboxed commands",
89195
89795
  widens: isNotFalse
89196
89796
  },
89797
+ {
89798
+ path: ["credentials", "envVars"],
89799
+ reason: "lets the sandbox send the named environment variables' values to the listed hosts",
89800
+ widens: isNonEmptyMap
89801
+ },
89197
89802
  {
89198
89803
  path: ["fileSystem", "allowDevToolAccess"],
89199
89804
  reason: "grants sandboxed commands developer-tool directories, which can hold credentials such as registry tokens",
@@ -89219,6 +89824,27 @@ const COPILOT_TRUST_AFFECTING_SANDBOX_PATHS = [
89219
89824
  }
89220
89825
  ];
89221
89826
  const COPILOT_TOOL_LABEL = "GitHub Copilot";
89827
+ /** The trust-warning label of the `credentials.envVars` leaf. */
89828
+ const ENV_VARS_LABEL = "sandbox.credentials.envVars";
89829
+ /**
89830
+ * Every `VAR -> host, host` pair of a `credentials.envVars` map, so a
89831
+ * developer generating from a cloned repository can spot an unexpected host
89832
+ * without opening the file. Names and hosts are JSON-quoted so control
89833
+ * characters in authored values cannot forge log lines.
89834
+ */
89835
+ function describeEnvVars(envVars) {
89836
+ return Object.entries(envVars).map(([name, { injectHosts }]) => `${JSON.stringify(name)} -> ${injectHosts.length > 0 ? injectHosts.map((host) => JSON.stringify(host)).join(", ") : "(no hosts)"}`).join("; ");
89837
+ }
89838
+ /**
89839
+ * A separate, stronger warning for `injectHosts` entries containing `*`: the
89840
+ * sandbox may then send the credential to any host the pattern matches.
89841
+ */
89842
+ function warnOnWildcardInjectHosts({ envVars, relativeFilePath, logger }) {
89843
+ if (envVars === void 0) return;
89844
+ const wildcards = Object.entries(envVars).flatMap(([name, { injectHosts }]) => injectHosts.filter((host) => host.includes("*")).map((host) => `${JSON.stringify(name)} -> ${JSON.stringify(host)}`));
89845
+ if (wildcards.length === 0) return;
89846
+ logger?.warn(`${COPILOT_TOOL_LABEL}: '${ENV_VARS_LABEL}' in ${relativeFilePath} lets the sandbox send credentials to any host matching a wildcard: ${wildcards.join("; ")}. Review these patterns, since the credential can reach every matching host.`);
89847
+ }
89222
89848
  function sandboxKey(path) {
89223
89849
  return `${SANDBOX_KEY_PREFIX}${path.join(".")}`;
89224
89850
  }
@@ -89411,14 +90037,16 @@ var CopilotPermissions = class CopilotPermissions extends ToolPermissions {
89411
90037
  const patch = {};
89412
90038
  for (const [category, settingKey] of Object.entries(AUTO_APPROVE_KEYS)) {
89413
90039
  if (!Object.hasOwn(config.permission, category)) continue;
90040
+ const rules = category === "bash" ? bashRulesHonoringAllTools(config.permission) : honorCopilotAllToolsRestrictions({
90041
+ permission: config.permission,
90042
+ category,
90043
+ logger
90044
+ });
89414
90045
  patch[settingKey] = buildAutoApproveValue({
89415
90046
  category,
89416
- rules: category === "bash" ? bashRulesHonoringAllTools(config.permission) : honorCopilotAllToolsRestrictions({
89417
- permission: config.permission,
89418
- category,
89419
- logger
89420
- })
90047
+ rules
89421
90048
  });
90049
+ if (category === "edit" && Object.keys(rules).length > 0) logger?.warn(EDITS_KEY_IGNORED_WARNING);
89422
90050
  }
89423
90051
  const existingSettings = () => parseSharedConfig({
89424
90052
  format: "jsonc",
@@ -89439,13 +90067,23 @@ var CopilotPermissions = class CopilotPermissions extends ToolPermissions {
89439
90067
  sandbox,
89440
90068
  existingSettings: existingSettings()
89441
90069
  }));
90070
+ const relativeFilePath = join(paths.relativeDirPath, paths.relativeFilePath);
90071
+ const envVars = sandbox.credentials?.envVars;
89442
90072
  warnOnTrustAffectingEntries({
89443
90073
  toolLabel: COPILOT_TOOL_LABEL,
89444
90074
  entries: collectTrustAffectingSandboxPaths({
89445
90075
  sandbox,
89446
90076
  paths: COPILOT_TRUST_AFFECTING_SANDBOX_PATHS
89447
- }),
89448
- relativeFilePath: join(paths.relativeDirPath, paths.relativeFilePath),
90077
+ }).map((entry) => entry.label === ENV_VARS_LABEL && envVars !== void 0 ? {
90078
+ ...entry,
90079
+ reason: `${entry.reason}: ${describeEnvVars(envVars)}`
90080
+ } : entry),
90081
+ relativeFilePath,
90082
+ logger
90083
+ });
90084
+ warnOnWildcardInjectHosts({
90085
+ envVars,
90086
+ relativeFilePath,
89449
90087
  logger
89450
90088
  });
89451
90089
  }
@@ -92333,7 +92971,7 @@ function convertGoosePermissionConfigToRulesync(userPermission) {
92333
92971
  const GROKCLI_UI_KEY = "ui";
92334
92972
  const GROKCLI_PERMISSION_MODE_KEY = "permission_mode";
92335
92973
  const GROKCLI_PERMISSION_KEY = "permission";
92336
- const GROKCLI_AUTO_PERMISSION_MODE = "auto";
92974
+ const GROKCLI_DERIVED_PERMISSION_MODES = /* @__PURE__ */ new Set(["ask", "always-approve"]);
92337
92975
  const CATEGORY_TO_GROK_TOOL = {
92338
92976
  bash: "Bash",
92339
92977
  read: "Read",
@@ -92560,12 +93198,15 @@ function parseGrokRule(rule) {
92560
93198
  * compact arrays, so a user-authored `rules` array is preserved verbatim
92561
93199
  * but not reconciled against them.
92562
93200
  *
92563
- * The coarse `[ui] permission_mode` toggle is still written for backward
92564
- * compatibility with older Grok versions: `always-approve` when the config is
92565
- * pure-`allow`, otherwise `ask` (conservative — it is never `always-approve`
93201
+ * The coarse `[ui] permission_mode` toggle is kept in sync for backward
93202
+ * compatibility with older Grok versions, but only when the config already
93203
+ * sets it to `ask` or `always-approve`: `always-approve` only when the config
93204
+ * has the all-tools catch-all allow (`"*": { "*": "allow" }`) and no
93205
+ * `deny`/`ask` rule, otherwise `ask` (conservative — it is never `always-approve`
92566
93206
  * while any `deny`/`ask` rule exists, so it never contradicts the fine-grained
92567
- * arrays). It is a user-level UI setting, so it is only written in global scope
92568
- * (see below).
93207
+ * arrays). A missing key is not added, so Grok's own default mode applies. It
93208
+ * is a user-level UI setting, so it is only touched in global scope (see
93209
+ * below).
92569
93210
  *
92570
93211
  * Both scopes are supported: the adapter syncs the project-level
92571
93212
  * `./.grok/config.toml` (default) and the user-level `~/.grok/config.toml`
@@ -92626,7 +93267,7 @@ var GrokcliPermissions = class GrokcliPermissions extends ToolPermissions {
92626
93267
  ask: buckets.ask
92627
93268
  };
92628
93269
  const existingUi = toRecord(parsed[GROKCLI_UI_KEY]);
92629
- const uiPatch = global && existingUi[GROKCLI_PERMISSION_MODE_KEY] !== GROKCLI_AUTO_PERMISSION_MODE ? { [GROKCLI_UI_KEY]: {
93270
+ const uiPatch = global && GROKCLI_DERIVED_PERMISSION_MODES.has(existingUi[GROKCLI_PERMISSION_MODE_KEY]) ? { [GROKCLI_UI_KEY]: {
92630
93271
  ...existingUi,
92631
93272
  [GROKCLI_PERMISSION_MODE_KEY]: deriveGrokPermissionMode(config)
92632
93273
  } } : {};
@@ -92807,22 +93448,30 @@ function parseGrokPermissionArrays(permission) {
92807
93448
  /**
92808
93449
  * Legacy coarse fallback: map `[ui] permission_mode` to a canonical action.
92809
93450
  * `always-approve` ⇒ `allow`; anything else (including a missing mode) ⇒ `ask`.
93451
+ * A missing mode now means Grok's own default (`auto` in the TUI since 1.0.80),
93452
+ * which has no canonical counterpart, so the narrower `ask` reading is kept.
92810
93453
  */
92811
93454
  function legacyModeAction(parsed) {
92812
93455
  return toRecord(parsed[GROKCLI_UI_KEY])[GROKCLI_PERMISSION_MODE_KEY] === "always-approve" ? "allow" : "ask";
92813
93456
  }
92814
93457
  /**
92815
93458
  * Collapse a rulesync permissions config into Grok's single coarse mode.
92816
- * Any `deny`/`ask` rule anywhere keeps prompting (`ask`); otherwise an existing
92817
- * `allow` rule opts into `always-approve`; an empty config defaults to `ask`.
93459
+ * `always-approve` lets every tool run without a prompt, so it is derived only
93460
+ * from a true catch-all allow — the all-tools rule `"*": { "*": "allow" }` —
93461
+ * with no `deny`/`ask` rule anywhere. Narrow allows (e.g. `bash: { "git *":
93462
+ * "allow" }`, or even `bash: { "*": "allow" }`) never widen into it; they and
93463
+ * an empty config map to `ask`.
92818
93464
  */
92819
93465
  function deriveGrokPermissionMode(config) {
92820
- let hasAllow = false;
92821
- for (const rules of Object.values(config.permission)) for (const action of Object.values(rules)) {
92822
- if (action === "deny" || action === "ask") return "ask";
92823
- if (action === "allow") hasAllow = true;
92824
- }
92825
- return hasAllow ? "always-approve" : "ask";
93466
+ for (const rules of Object.values(config.permission)) for (const action of Object.values(rules)) if (action === "deny" || action === "ask") return "ask";
93467
+ const allTools = lookupOwn({
93468
+ record: config.permission,
93469
+ key: "*"
93470
+ });
93471
+ return allTools !== void 0 && lookupOwn({
93472
+ record: allTools,
93473
+ key: "*"
93474
+ }) === "allow" ? "always-approve" : "ask";
92826
93475
  }
92827
93476
  // src/features/permissions/hermesagent-permissions.ts
92828
93477
  /** Collect the glob patterns in a canonical category that carry a given action. */
@@ -94125,13 +94774,71 @@ function canonicalToKimiCodeRules({ config, logger }) {
94125
94774
  });
94126
94775
  }
94127
94776
  }
94128
- return [...overrideRules, ...sortKimiCodeRulesFailClosed(canonicalRules)];
94777
+ const rules = [...overrideRules, ...sortKimiCodeRulesFailClosed(canonicalRules)];
94778
+ warnAboutIgnoredKimiCodeRuleScopes({
94779
+ rules: overrideRules,
94780
+ logger
94781
+ });
94782
+ warnAboutShadowedKimiCodeRules({
94783
+ rules,
94784
+ logger
94785
+ });
94786
+ return rules;
94129
94787
  }
94130
- function getKimiCodePatternSpecificity(pattern) {
94788
+ /**
94789
+ * Scopes Kimi silently ignores on a rule in the user `config.toml`.
94790
+ *
94791
+ * @see https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#permission
94792
+ */
94793
+ const KIMI_CODE_IGNORED_USER_RULE_SCOPES = /* @__PURE__ */ new Set(["turn-override", "session-runtime"]);
94794
+ function warnAboutIgnoredKimiCodeRuleScopes({ rules, logger }) {
94795
+ for (const rule of rules) if (rule.scope !== void 0 && KIMI_CODE_IGNORED_USER_RULE_SCOPES.has(rule.scope)) logger?.warn(`Kimi Code permissions: the ${rule.decision} rule for "${rule.pattern}" has scope "${rule.scope}", which Kimi ignores in ${KIMI_CODE_CONFIG_SHARED_FILE_KEY}. Use "user" or "project" for it to take effect.`);
94796
+ }
94797
+ /** Split a Kimi rule pattern (`Tool` or `Tool(arg)`) into its tool and argument. */
94798
+ function splitKimiCodePattern(pattern) {
94131
94799
  const opening = pattern.indexOf("(");
94132
94800
  const hasArguments = opening >= 0 && pattern.endsWith(")");
94133
- const tool = hasArguments ? pattern.slice(0, opening) : pattern;
94134
- const argument = hasArguments ? pattern.slice(opening + 1, -1) : "";
94801
+ return {
94802
+ tool: hasArguments ? pattern.slice(0, opening) : pattern,
94803
+ argument: hasArguments ? pattern.slice(opening + 1, -1) : "",
94804
+ hasArguments
94805
+ };
94806
+ }
94807
+ /**
94808
+ * Whether `stricter` certainly matches every call `rule` matches: the same
94809
+ * pattern, or the bare name of the same tool (which matches every call of
94810
+ * it). Wildcard overlaps are not detected, so this never reports a false
94811
+ * shadow but can miss one.
94812
+ */
94813
+ function kimiCodeRuleCovers({ stricter, rule }) {
94814
+ return stricter.pattern === rule.pattern || stricter.pattern === splitKimiCodePattern(rule.pattern).tool;
94815
+ }
94816
+ /**
94817
+ * Kimi does not let the first matching rule win: a matching `deny` beats a
94818
+ * matching `ask`, which beats a matching `allow` (Kimi Code 2.6.0 docs). An
94819
+ * `allow` or `ask` meant to carve an exception out of a broader, stricter
94820
+ * rule therefore never takes effect, whether it comes from `kimi-code.rules`
94821
+ * or from a canonical category, so say so instead of letting the authored
94822
+ * order suggest otherwise. A rule whose own scope Kimi ignores already got
94823
+ * its warning and is skipped here.
94824
+ *
94825
+ * @see https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#permission
94826
+ */
94827
+ function warnAboutShadowedKimiCodeRules({ rules, logger }) {
94828
+ for (const rule of rules) {
94829
+ if (rule.decision === "deny" || KIMI_CODE_IGNORED_USER_RULE_SCOPES.has(rule.scope ?? "")) continue;
94830
+ const shadowing = rules.find((other) => isStricterAction({
94831
+ action: other.decision,
94832
+ existing: rule.decision
94833
+ }) && !KIMI_CODE_IGNORED_USER_RULE_SCOPES.has(other.scope ?? "") && kimiCodeRuleCovers({
94834
+ stricter: other,
94835
+ rule
94836
+ }));
94837
+ if (shadowing) logger?.warn(`Kimi Code permissions: the ${rule.decision} rule for "${rule.pattern}" never takes effect: the matching ${shadowing.decision} rule "${shadowing.pattern}" outranks it, because Kimi ranks matching rules deny > ask > allow regardless of their order.`);
94838
+ }
94839
+ }
94840
+ function getKimiCodePatternSpecificity(pattern) {
94841
+ const { tool, argument, hasArguments } = splitKimiCodePattern(pattern);
94135
94842
  return {
94136
94843
  tool,
94137
94844
  toolLiteralLength: tool.replaceAll("*", "").replaceAll("?", "").length,
@@ -96871,7 +97578,8 @@ const QODER_OVERRIDE_GROUP_KEYS = {
96871
97578
  "enabledProjectMcpServers",
96872
97579
  "lazyLoad"
96873
97580
  ],
96874
- agents: ["overrides"]
97581
+ agents: ["overrides"],
97582
+ security: ["disableYoloMode"]
96875
97583
  };
96876
97584
  const QODER_OVERRIDE_GROUPS = Object.keys(QODER_OVERRIDE_GROUP_KEYS);
96877
97585
  /**
@@ -97134,7 +97842,8 @@ function isLiftableQoderValue(key, value) {
97134
97842
  switch (key) {
97135
97843
  case "defaultPermissionMode": return typeof value === "string" && value.trim() !== "";
97136
97844
  case "enableAllProjectMcpServers":
97137
- case "lazyLoad": return typeof value === "boolean";
97845
+ case "lazyLoad":
97846
+ case "disableYoloMode": return typeof value === "boolean";
97138
97847
  case "overrides": return isRecord(value) && Object.values(value).every(isRecord);
97139
97848
  default: return isStringArray(value);
97140
97849
  }
@@ -97395,7 +98104,8 @@ const QWEN_OVERRIDE_TOOLS_KEYS = [
97395
98104
  "freeform",
97396
98105
  "workflowsEnabled",
97397
98106
  "workflowNameOnly",
97398
- "executionSandbox"
98107
+ "executionSandbox",
98108
+ "lspEnabled"
97399
98109
  ];
97400
98110
  const QWEN_OVERRIDE_SECURITY_KEYS = [
97401
98111
  "folderTrust",
@@ -97473,6 +98183,11 @@ const QWEN_SCOPED_TOOLS_KEYS = {
97473
98183
  grants: () => true,
97474
98184
  globalNote: "Qwen Code ignores this key in workspace settings so a repository cannot choose its own sandbox; in the global scope it sets the filesystem and network policy every tool command runs under for every project on this machine (a System value still replaces it, and Qwen Code needs a restart to pick it up)."
97475
98185
  },
98186
+ lspEnabled: {
98187
+ rule: "workspace-stripped",
98188
+ grants: (value) => value === true,
98189
+ globalNote: "Qwen Code ignores this key in workspace settings so a repository cannot start language servers on its own behalf; in the global scope it turns on LSP code intelligence for every project on this machine, and the servers run with your permissions. A server declared in a workspace `.lsp.json` still needs an explicitly trusted folder, LSP is refused at startup when `tools.executionSandbox` is set, and the `QWEN_CODE_ENABLE_LSP` / `QWEN_CODE_DISABLE_LSP` environment variables override this setting (disable wins)."
98190
+ },
97476
98191
  workflowNameOnly: {
97477
98192
  rule: "global-machine-wide",
97478
98193
  projectNote: ({ qualifiedKey, quotedValue, filePath }) => `${qualifiedKey} = ${quotedValue} was written to the project-scoped ${filePath}. Qwen Code lets a workspace only turn this key on: \`true\` restricts the model to named workflows in this repository, while any other value cannot lift a restriction set in user or system settings.`,
@@ -100189,6 +100904,14 @@ const TAKT_SECURITY_POLICIES = {
100189
100904
  const TAKT_SECURITY_POLICY_KEYS = Object.keys(TAKT_SECURITY_POLICIES);
100190
100905
  const TAKT_DEFAULT_PROVIDER = "claude-sdk";
100191
100906
  const TAKT_LEGACY_DEFAULT_PROVIDER = "claude";
100907
+ const TAKT_CLAUDE_READ_DENY_PROVIDERS = [
100908
+ "claude-sdk",
100909
+ "claude",
100910
+ "claude-headless"
100911
+ ];
100912
+ const TAKT_CLAUDE_PROVIDER_OPTIONS_KEY = "claude";
100913
+ const TAKT_CLAUDE_PERMISSIONS_KEY = "permissions";
100914
+ const TAKT_CLAUDE_PERMISSIONS_DENY_KEY = "deny";
100192
100915
  /**
100193
100916
  * Permissions adapter for Takt (`.takt/config.yaml`).
100194
100917
  *
@@ -100227,6 +100950,12 @@ const TAKT_LEGACY_DEFAULT_PROVIDER = "claude";
100227
100950
  * (a top-level per-provider sandbox/network table). Both are authored on
100228
100951
  * generate and re-extracted on import.
100229
100952
  *
100953
+ * Canonical `read` deny rules are also kept per path where the active provider
100954
+ * is Claude-family (Takt 0.76.0+): they are written as `Read(<pattern>)`
100955
+ * entries into `provider_options.claude.permissions.deny`, in addition to the
100956
+ * `readonly` mode they already derive. The list is only ever added to, so a
100957
+ * deny never turns into a broader allow.
100958
+ *
100230
100959
  * Takt 0.56.0 moved provider configuration into a separate `runtime.yaml`
100231
100960
  * (`.takt/runtime.yaml`, `~/.takt/runtime.yaml`). Once its `provider:` section
100232
100961
  * carries an assignment ("runtime mode" — the state a freshly installed Takt is
@@ -100291,7 +101020,8 @@ var TaktPermissions = class TaktPermissions extends ToolPermissions {
100291
101020
  outputRoot,
100292
101021
  logger
100293
101022
  });
100294
- const inheritedProvider = global ? void 0 : await readGlobalTaktProvider({
101023
+ const globalLayer = await readGlobalTaktLayer({
101024
+ global,
100295
101025
  projectFilePath: filePath,
100296
101026
  logger
100297
101027
  });
@@ -100299,7 +101029,7 @@ var TaktPermissions = class TaktPermissions extends ToolPermissions {
100299
101029
  const provider = resolveActiveProvider({
100300
101030
  config,
100301
101031
  runtime: runtime.active ? runtime.config : void 0,
100302
- inheritedProvider
101032
+ inheritedProvider: globalLayer.provider
100303
101033
  });
100304
101034
  const mode = deriveTaktPermissionMode(rulesyncJson);
100305
101035
  const override = isPlainObject(rulesyncJson.takt) ? rulesyncJson.takt : void 0;
@@ -100307,9 +101037,20 @@ var TaktPermissions = class TaktPermissions extends ToolPermissions {
100307
101037
  const authoredProviderOptions = isPlainObject(override?.[TAKT_PROVIDER_OPTIONS_KEY]) ? override[TAKT_PROVIDER_OPTIONS_KEY] : void 0;
100308
101038
  const runtimeModeRefusesProviderOptions = authoredProviderOptions !== void 0 && runtime.active;
100309
101039
  if (runtimeModeRefusesProviderOptions) logger?.warn(`Takt permissions: not writing "${TAKT_PROVIDER_OPTIONS_KEY}" to ${filePath} because ${runtime.filePaths.join(" + ")} puts Takt in runtime provider mode (Takt 0.56.0+), where any legacy provider setting in config.yaml makes Takt fail with "Mixed provider configuration detected". Move those options to \`provider.profiles.<profile>.options\` in runtime.yaml, and remove them from the \`takt\` block of the rulesync source. A "${TAKT_PROVIDER_OPTIONS_KEY}" already in ${filePath} is left untouched — rulesync does not own that key.`);
100310
- const overrideProviderOptions = runtimeModeRefusesProviderOptions ? void 0 : dropUntrustedProviderOptions({
100311
- providerOptions: authoredProviderOptions,
100312
- global,
101040
+ const overrideProviderOptions = addClaudeReadDenyRules({
101041
+ providerOptions: runtimeModeRefusesProviderOptions ? void 0 : dropUntrustedProviderOptions({
101042
+ providerOptions: authoredProviderOptions,
101043
+ global,
101044
+ filePath,
101045
+ logger
101046
+ }),
101047
+ readDenyRules: collectReadDenyRules(rulesyncJson),
101048
+ existingProviderOptions: config[TAKT_PROVIDER_OPTIONS_KEY],
101049
+ globalProviderOptions: globalLayer.providerOptions,
101050
+ globalFilePath: globalLayer.filePath,
101051
+ provider,
101052
+ runtimeActive: runtime.active,
101053
+ runtimeFilePaths: runtime.filePaths,
100313
101054
  filePath,
100314
101055
  logger
100315
101056
  });
@@ -100422,11 +101163,34 @@ function readProviderName(config) {
100422
101163
  return typeof provider === "string" && provider.trim() !== "" ? provider : void 0;
100423
101164
  }
100424
101165
  /**
100425
- * The top-level `provider:` of the global `~/.takt/config.yaml`, read for a
100426
- * project-scope generate. An unresolvable home directory, a missing or
100427
- * unparsable file, or one that names no provider all mean "nothing inherited".
101166
+ * What a project-scope generate inherits from the global `~/.takt/config.yaml`:
101167
+ * its provider and its `provider_options`. Nothing at global scope, where that
101168
+ * file is the one being generated.
100428
101169
  */
100429
- async function readGlobalTaktProvider({ projectFilePath, logger }) {
101170
+ async function readGlobalTaktLayer({ global, projectFilePath, logger }) {
101171
+ const globalConfig = global ? void 0 : await readGlobalTaktConfig({
101172
+ projectFilePath,
101173
+ logger
101174
+ });
101175
+ if (globalConfig === void 0) return {
101176
+ provider: void 0,
101177
+ providerOptions: void 0,
101178
+ filePath: void 0
101179
+ };
101180
+ return {
101181
+ provider: readProviderName(globalConfig.config),
101182
+ providerOptions: globalConfig.config[TAKT_PROVIDER_OPTIONS_KEY],
101183
+ filePath: globalConfig.filePath
101184
+ };
101185
+ }
101186
+ /**
101187
+ * The global `~/.takt/config.yaml`, read for a project-scope generate: its
101188
+ * top-level `provider:` is inherited by a project config that names none, and
101189
+ * its `provider_options.claude.permissions.deny` is the list a project list
101190
+ * would replace. An unresolvable home directory or a missing or unparsable file
101191
+ * all mean "nothing inherited".
101192
+ */
101193
+ async function readGlobalTaktConfig({ projectFilePath, logger }) {
100430
101194
  let globalPath;
100431
101195
  try {
100432
101196
  globalPath = join(getHomeDirectory(), TAKT_DIR, TAKT_CONFIG_FILE_NAME);
@@ -100437,12 +101201,15 @@ async function readGlobalTaktProvider({ projectFilePath, logger }) {
100437
101201
  try {
100438
101202
  const content = await readFileContentOrNull(globalPath);
100439
101203
  if (content === null) return;
100440
- return readProviderName(parseSharedConfig({
100441
- format: "yaml",
100442
- fileContent: content,
101204
+ return {
100443
101205
  filePath: globalPath,
100444
- invalidRootPolicy: "error"
100445
- }));
101206
+ config: parseSharedConfig({
101207
+ format: "yaml",
101208
+ fileContent: content,
101209
+ filePath: globalPath,
101210
+ invalidRootPolicy: "error"
101211
+ })
101212
+ };
100446
101213
  } catch (error) {
100447
101214
  logger?.warn(`Takt permissions: could not read the provider from ${globalPath} (${formatError(error)}); falling back to the project config alone.`);
100448
101215
  return;
@@ -100805,6 +101572,70 @@ function taktModeToRulesyncConfig(mode) {
100805
101572
  default: return { permission: { bash: { ["*"]: "deny" } } };
100806
101573
  }
100807
101574
  }
101575
+ /**
101576
+ * The canonical `read` deny rules as Claude Code `Read(...)` entries, in the
101577
+ * form the Claude Code permissions and ignore adapters write them: the pattern
101578
+ * verbatim, and a bare `Read` for the catch-all.
101579
+ */
101580
+ function collectReadDenyRules(config) {
101581
+ const rules = config.permission.read ?? {};
101582
+ return Object.entries(rules).filter(([, action]) => action === "deny").map(([pattern]) => pattern === "*" ? "Read" : buildReadDenyEntry(pattern));
101583
+ }
101584
+ /**
101585
+ * Add the canonical `read` deny rules to `provider_options.claude.permissions.deny`
101586
+ * (Takt 0.76.0+), which Takt passes to `claude-sdk` / `claude-headless` as
101587
+ * Claude Code `permissions.deny` rules.
101588
+ *
101589
+ * Takt replaces a `deny` list wholesale rather than concatenating it, so the
101590
+ * rules are merged into the list that would otherwise be in force: the one the
101591
+ * `takt` block states (which replaces a hand-written config.yaml list, as any
101592
+ * authored `provider_options` leaf does), else the one already in config.yaml.
101593
+ * Without an authored list nothing is removed from config.yaml's — a rule
101594
+ * written by hand, or by an earlier generate, is kept.
101595
+ *
101596
+ * At project scope the written list also replaces a global `~/.takt/config.yaml`
101597
+ * deny list for this project. That list usually holds personal paths, so it is
101598
+ * not copied into the (committed) project file; a warning names it instead.
101599
+ *
101600
+ * Skipped when the active provider is not Claude-family (no other provider
101601
+ * reads the list) and, with a warning, in runtime mode, where `provider_options`
101602
+ * in config.yaml stops Takt with "Mixed provider configuration detected".
101603
+ * https://github.com/nrslib/takt/blob/main/docs/configuration.md#claude-read-deny-rules
101604
+ */
101605
+ function addClaudeReadDenyRules({ providerOptions, readDenyRules, existingProviderOptions, globalProviderOptions, globalFilePath, provider, runtimeActive, runtimeFilePaths, filePath, logger }) {
101606
+ if (readDenyRules.length === 0 || !TAKT_CLAUDE_READ_DENY_PROVIDERS.includes(provider)) return providerOptions;
101607
+ if (runtimeActive) {
101608
+ logger?.warn(`Takt permissions: not writing the read deny rules (${readDenyRules.join(", ")}) to "${TAKT_PROVIDER_OPTIONS_KEY}.${TAKT_CLAUDE_PROVIDER_OPTIONS_KEY}.${TAKT_CLAUDE_PERMISSIONS_KEY}.${TAKT_CLAUDE_PERMISSIONS_DENY_KEY}" in ${filePath} because ${runtimeFilePaths.join(" + ")} puts Takt in runtime provider mode. They still make the mode readonly; to have Claude enforce them per path, add them under \`${TAKT_CLAUDE_PERMISSIONS_KEY}.${TAKT_CLAUDE_PERMISSIONS_DENY_KEY}\` in the options of a Claude profile in runtime.yaml.`);
101609
+ return providerOptions;
101610
+ }
101611
+ const authoredClaude = providerOptions?.[TAKT_CLAUDE_PROVIDER_OPTIONS_KEY];
101612
+ const authoredDeny = readClaudeDenyList(authoredClaude);
101613
+ const existingDeny = isPlainObject(existingProviderOptions) ? readClaudeDenyList(existingProviderOptions[TAKT_CLAUDE_PROVIDER_OPTIONS_KEY]) : void 0;
101614
+ const deny = [.../* @__PURE__ */ new Set([...authoredDeny ?? existingDeny ?? [], ...readDenyRules])];
101615
+ const shadowedGlobalDeny = ((isPlainObject(globalProviderOptions) ? readClaudeDenyList(globalProviderOptions[TAKT_CLAUDE_PROVIDER_OPTIONS_KEY]) : void 0) ?? []).filter((rule) => !deny.includes(rule));
101616
+ if (shadowedGlobalDeny.length > 0) logger?.warn(`Takt permissions: the read deny rules written to "${TAKT_PROVIDER_OPTIONS_KEY}.${TAKT_CLAUDE_PROVIDER_OPTIONS_KEY}.${TAKT_CLAUDE_PERMISSIONS_KEY}.${TAKT_CLAUDE_PERMISSIONS_DENY_KEY}" in ${filePath} replace the list in ${globalFilePath ?? "the global config.yaml"} for this project, because Takt does not concatenate deny lists across layers. Claude will no longer apply ${shadowedGlobalDeny.join(", ")} here unless you add them to the project list (the \`takt.provider_options.claude.permissions.deny\` block of the rulesync source) or to the canonical \`read\` rules.`);
101617
+ const claude = isPlainObject(authoredClaude) ? authoredClaude : {};
101618
+ const permissions = isPlainObject(claude[TAKT_CLAUDE_PERMISSIONS_KEY]) ? claude[TAKT_CLAUDE_PERMISSIONS_KEY] : {};
101619
+ return {
101620
+ ...providerOptions,
101621
+ [TAKT_CLAUDE_PROVIDER_OPTIONS_KEY]: {
101622
+ ...claude,
101623
+ [TAKT_CLAUDE_PERMISSIONS_KEY]: {
101624
+ ...permissions,
101625
+ [TAKT_CLAUDE_PERMISSIONS_DENY_KEY]: deny
101626
+ }
101627
+ }
101628
+ };
101629
+ }
101630
+ /** The string entries of `<claude options>.permissions.deny`, when it is a list. */
101631
+ function readClaudeDenyList(claudeOptions) {
101632
+ if (!isPlainObject(claudeOptions)) return;
101633
+ const permissions = claudeOptions[TAKT_CLAUDE_PERMISSIONS_KEY];
101634
+ if (!isPlainObject(permissions)) return;
101635
+ const deny = permissions[TAKT_CLAUDE_PERMISSIONS_DENY_KEY];
101636
+ if (!Array.isArray(deny)) return;
101637
+ return deny.filter((entry) => typeof entry === "string" && entry !== "");
101638
+ }
100808
101639
  const TAKT_BASE_URL_PROVIDERS = [
100809
101640
  "codex",
100810
101641
  "claude",
@@ -103829,6 +104660,32 @@ function buildZedToolPermissions({ permission, logger }) {
103829
104660
  inertMcpCategories
103830
104661
  };
103831
104662
  }
104663
+ /**
104664
+ * Zed's file-edit tools whose `confirm` default does not prompt for files inside
104665
+ * the project.
104666
+ */
104667
+ const ZED_IN_PROJECT_EDIT_TOOLS = ["edit_file", "write_file"];
104668
+ /**
104669
+ * Zed's `edit_file` and `write_file` skip the permission prompt for files inside
104670
+ * the project when the settings decision is `confirm`: only Zed settings
104671
+ * folders, `.agents/skills/` and paths a symlink places outside the project
104672
+ * still prompt (`authorize_file_edit` in `crates/agent/src/tools/tool_permissions.rs`,
104673
+ * documented under "File Edits Inside the Project" since zed-industries/zed#67037).
104674
+ * A canonical catch-all `ask` on `edit`/`write` — or an all-tools `*` ask those
104675
+ * tools fall back to — therefore lets the agent edit in-project files without
104676
+ * asking, so say so at generate time rather than implying a prompt.
104677
+ *
104678
+ * The check runs on the merged `tools` result: a tool whose entry is a
104679
+ * preserved, hand-written one (not managed by rulesync) is skipped, since its
104680
+ * decision is the user's own. Only the literal `.*` ask pattern counts as
104681
+ * "prompt for every file" and silences the warning; any narrower pattern still
104682
+ * leaves other in-project files unprompted, so the warning stays.
104683
+ */
104684
+ function warnInProjectEditConfirm({ managedDefault, managedTools, preservedToolNames, logger }) {
104685
+ const confirmTools = ZED_IN_PROJECT_EDIT_TOOLS.filter((tool) => !preservedToolNames.has(tool) && (managedTools[tool]?.default ?? managedDefault) === "confirm" && !managedTools[tool]?.always_confirm?.some((entry) => entry.pattern === ".*"));
104686
+ if (confirmTools.length === 0) return;
104687
+ logger?.warn(`Zed permissions: the catch-all "ask" for ${confirmTools.map((tool) => `"${tool}"`).join(" and ")} becomes Zed's "confirm" default, which does not prompt for edits to files inside the project (only Zed settings folders, ".agents/skills/" and files outside the project still prompt). To be asked before in-project edits, add the "ask" pattern ".*" to the category (only that exact pattern silences this warning; an "always_confirm" match outranks "always_allow" patterns). Zed honors such patterns for in-project files from v1.30 on. Canonical patterns are shared by every target: in glob-matching targets (such as Claude Code's "Edit(.*)") ".*" matches dotfiles only, so there it adds an extra "ask" for those files and loosens nothing.`);
104688
+ }
103832
104689
  function asRecord(value) {
103833
104690
  if (value === null || typeof value !== "object" || Array.isArray(value)) return {};
103834
104691
  return Object.fromEntries(Object.entries(value));
@@ -103974,6 +104831,12 @@ var ZedPermissions = class ZedPermissions extends ToolPermissions {
103974
104831
  if ("*" in config.permission) managedToolNames.add("*");
103975
104832
  for (const toolName of Object.keys(existingTools)) if (toolName.startsWith("mcp__")) managedToolNames.add(toolName);
103976
104833
  const preservedTools = Object.fromEntries(Object.entries(existingTools).filter(([toolName]) => !managedToolNames.has(toolName)));
104834
+ warnInProjectEditConfirm({
104835
+ managedDefault,
104836
+ managedTools,
104837
+ preservedToolNames: new Set(Object.keys(preservedTools)),
104838
+ logger
104839
+ });
103977
104840
  return new ZedPermissions({
103978
104841
  outputRoot,
103979
104842
  relativeDirPath: paths.relativeDirPath,
@@ -107131,4 +107994,4 @@ const CHECKS_IMPORT_STRATEGY = {
107131
107994
  };
107132
107995
  export { RulesyncRule as $, RULESYNC_RULES_RELATIVE_DIR_PATH as $n, getFileSizeAndExecutableBit as $t, CODEBUDDY_LOCAL_RULE_FILE_NAME as A, ToolTargetSchema as An, fallbackLogger as At, CLAUDECODE_LOCAL_RULE_FILE_NAME as B, RULESYNC_CONFIG_RELATIVE_FILE_PATH as Bn, assertDirectoryIfExists as Bt, LETTACODE_DIR as C, toPosixPath as Cn, SourceEntrySchema as Ct, COMMANDCODE_DIR as D, ALL_TOOL_TARGETS as Dn, ConsoleLogger as Dt, FACTORYDROID_SETTINGS_LOCAL_FILE_NAME as E, mapWithConcurrency as En, findControlCharacter as Et, sweepRefusalReason as F, FEATURE_SOURCE_TREE_ENTRIES as Fn, CLIError as Ft, toInstructionBudgetFile as G, RULESYNC_IGNORE_RELATIVE_FILE_PATH as Gn, assertWritablePathInsideRoot as Gt, CLAUDECODE_SETTINGS_LOCAL_FILE_NAME as H, RULESYNC_CURATED_RULES_RELATIVE_DIR_PATH as Hn, assertNoSymlinkBelowRoot as Ht, CODEXCLI_BASH_RULES_FILE_NAME as I, MAX_FILE_SIZE as In, ErrorCodes as It, getLocalSkillDirNames as J, RULESYNC_MCP_SCHEMA_URL as Jn, directoryExists as Jt, classifyRemoteName as K, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH as Kn, checkPathTraversal as Kt, CODEXCLI_DIR as L, RULESYNC_AIIGNORE_RELATIVE_FILE_PATH as Ln, parseJsonc as Lt, AUGMENTCODE_SETTINGS_LOCAL_FILE_NAME as M, ALL_FEATURES_WITH_WILDCARD as Mn, withFallbackLoggerTarget as Mt, caseFoldIdentity as N, DEPRECATED_FEATURE_REPLACEMENTS as Nn, resetRunWarningState as Nt, COMMANDCODE_SETTINGS_LOCAL_FILE_NAME as O, ALL_TOOL_TARGETS_WITH_WILDCARD as On, JsonLogger as Ot, groupSpellingsByCaseFoldedIdentity as P, CURATED_RULES_FEATURE_SUBDIR as Pn, withWarnOnceScope as Pt, RulesyncSkillFrontmatterSchema as Q, RULESYNC_RELATIVE_DIR_PATH as Qn, findFilesByGlobs as Qt, CLAUDECODE_AGENT_MEMORY_LOCAL_DIR_NAME as R, RULESYNC_CHECKS_RELATIVE_DIR_PATH as Rn, PathOutsideRootError as Rt, QWENCODE_LOCAL_RULE_FILE_NAME as S, splitPathSegments as Sn, GITIGNORE_DESTINATION_KEY as St, FACTORYDROID_DIR as T, writeFileContent as Tn, getSourceTransport as Tt, CLAUDECODE_SKILLS_DIR_PATH as U, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH as Un, assertPathResolvesInsideRoot as Ut, CLAUDECODE_MEMORIES_DIR_NAME as V, RULESYNC_CONFIG_SCHEMA_URL as Vn, assertLandingOutsideVcsMetadata as Vt, findProjectInstructionBudgetFindings as W, RULESYNC_HOOKS_RELATIVE_FILE_PATH as Wn, assertTreeContainsNoSymlinks as Wt, RulesyncSubagentFrontmatterSchema as X, RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH as Xn, fileExists as Xt, RulesyncSubagent as Y, RULESYNC_NPM_SOURCES_LOCK_RELATIVE_FILE_PATH as Yn, ensureDir as Yt, RulesyncSkill as Z, RULESYNC_PERMISSIONS_SCHEMA_URL as Zn, fileExistsStrict as Zt, SkillsProcessor as _, removeFileWithoutFollowingSymlinks as _n, mergeInputRootConfigs as _t, convertFromTool as a, listDirectoryEntryNames as an, formatMegabytes as ar, getRulesyncSourceCandidates as at, REASONIX_LOCAL_RULE_FILE_NAME as b, resolvedRelativePath as bn, CONFLICTING_TARGET_PAIRS as bt, ELLIPSIS_WIDTH as c, normalizePosixDirPath as cn, hasEnclosingMarkOutsideKeycap as cr, RulesyncCommandFrontmatterSchema as ct, McpProcessor as d, readFileContent as dn, stripControlCharactersKeepingLineFeeds as dr, stringifyFrontmatter as dt, getHomeDirectory as en, RULESYNC_SKILLS_RELATIVE_DIR_PATH as er, RulesyncRuleFrontmatterSchema as et, IgnoreProcessor as f, readFileContentOrNull as fn, stripControlCharactersKeepingLineFeedsAndTabs as fr, loadYaml as ft, SubagentsProcessor as g, removeFileStrict as gn, ConfigResolver as gt, RulesProcessor as h, removeFile as hn, SKILL_FILE_NAME as ht, inspectInputRoots as i, isSymlink as in, RULESYNC_XDG_CONFIG_HOME_DEFAULT_DIR_NAME as ir, RulesyncHooks as it, AUGMENTCODE_DIR as j, ALL_FEATURES as jn, warnOnConflictingFlags as jt, CODEBUDDY_DIR as k, PACKAGING_TOOL_TARGETS as kn, WarningCollectingLogger as kt, displayWidthOf as l, pathEscapesRoot as ln, quoteForLog as lr, RulesyncCheck as lt, ChecksProcessor as m, removeDirectoryStrict as mn, SHARED_USER_MANAGED_CONFIG_PATHS as mt, formatSourceLoadFailure as n, isFileSystemError as nn, RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH as nr, RulesyncMcp as nt, getProcessorRegistryEntry as o, listFilePathsRecursively as on, formatError as or, resolveRulesyncSourceWritePath as ot, HooksProcessor as p, removeDirectory as pn, stripHiddenCharacters as pr, isRecord as pt, hasWindowsFoldableName as q, RULESYNC_MCP_RELATIVE_FILE_PATH as qn, createTempDirectory as qt, generate as r, isRootDirPath as rn, RULESYNC_USER_CONFIG_DIR_NAME as rr, RulesyncIgnore as rt, parseCommaSeparatedList as s, listSubdirectoryNames as sn, truncateText as sr, RulesyncCommand as st, importFromTool as t, isFileNotFoundError as tn, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH as tr, RulesyncPermissions as tt, shortenToWidth as u, posixRelativePathEscapesRoot as un, stripControlCharacters as ur, RulesyncCheckFrontmatterSchema as ut, CRUSH_LOCAL_RULE_FILE_NAME as v, removeTempDirectory as vn, parseConfigFileContent as vt, LETTACODE_SETTINGS_LOCAL_FILE_NAME as w, writeFileBuffer as wn, assertTargetsFeaturesExclusive as wt, QWENCODE_DIR as x, runWithDirectoryRollback as xn, ConfigFileSchema as xt, CommandsProcessor as y, resolvePath as yn, resolveEffectiveInputRoots as yt, CLAUDECODE_DIR as z, RULESYNC_COMMANDS_RELATIVE_DIR_PATH as zn, applyFileMode as zt };
107133
107996
 
107134
- //# sourceMappingURL=import-fiaj0fDK.js.map
107997
+ //# sourceMappingURL=import-Ctgal4jT.js.map