Skip to content

feat(ignore): support Zed global private_files and retract removed patterns - #2482

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-2415-zed-ignore-global
Jul 29, 2026
Merged

feat(ignore): support Zed global private_files and retract removed patterns#2482
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-2415-zed-ignore-global

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Background

Part of #2415 (gap 2). Zed's private_files is a worktree setting, and Zed layers default → user → project, so the key is honored in the user settings file (~/.config/zed/settings.json, %APPDATA%\Zed\settings.json on Windows) — the very file rulesync already writes in --global mode for MCP and permissions. ZedIgnore was nonetheless project-only, so rulesync generate --targets zed --features ignore --global emitted nothing.

The same adapter also merged additively (uniq([...existingPrivateFiles, ...patterns])), so a pattern deleted from .rulesync/.aiignore was never retracted from settings.json (gap 2b in the issue).

Changes

  • ZedIgnore.getSettablePaths() now takes { global } and returns the platform-aware getZedGlobalDir() for global scope; global is threaded through fromRulesyncIgnore, fromFile, and forDeletion. getExtraSharedWritePaths() declares the other platform's global spelling, mirroring ZedPermissions, so the shared-write derivation knows both on every platform.
  • zed is registered in ignoreProcessorGlobalToolTargets.
  • The shared-config gateway declares ignore: { kind: "replace-owned-keys", ownedKeys: ["private_files"] } on both global Zed entries (.config/zed/settings.json and AppData/Roaming/Zed/settings.json); the project entry already had it.
  • The additive merge is dropped. private_files is owned wholesale by the ignore feature, so the generated list is authoritative and a removed pattern is retracted. Every other key in the file — the MCP context_servers block, the permissions agent block, unrelated editor settings — is still preserved by the gateway, and the file is never deleted.

This retraction behavior change applies to project scope too, which is what gap 2b asked for.

Tests / docs

  • New ZedIgnore unit coverage for global settable paths, getExtraSharedWritePaths, and a global-scope generate that preserves an unrelated theme key while replacing a stale pattern. The three tests that pinned the additive merge now pin retraction.
  • Zed × ignore global happy-path case added to src/e2e/e2e-ignore.spec.ts (the global matrix assertion requires it); npx vitest run --config vitest.e2e.config.ts src/e2e/e2e-ignore.spec.ts passes.
  • docs/reference/file-formats.md gains a Zed paragraph in the ignore section and the scope sentence now lists zed; supported-tools tables regenerated and skill docs synced. Full pnpm cicheck is green.

Deferred

Gaps 5 (agent.sandbox_permissions authoring) and 6 (commands-as-skills) are design decisions per the maintainer's comment on #2415 and are not touched here, so this PR does not close the issue.

🤖 Generated with Claude Code

cm-dyoshikawa and others added 2 commits July 29, 2026 08:20
…tterns

Zed's `private_files` is a worktree setting that Zed also honors in the user
settings file, but ZedIgnore was project-only and merged additively, so a
pattern deleted from .rulesync/.aiignore was never retracted.

- ZedIgnore.getSettablePaths takes { global } and resolves the platform-aware
  user config dir; global is threaded through fromRulesyncIgnore/fromFile/
  forDeletion, and getExtraSharedWritePaths declares the other platform's
  spelling like ZedPermissions does.
- Register zed in ignoreProcessorGlobalToolTargets and declare the ignore
  feature's ownership of private_files on both global Zed gateway entries.
- Drop the additive merge: private_files is a replace-owned-keys block, so the
  generated list is authoritative while every other key stays preserved.

Part of #2415 (gap 2).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…obal import root

Review follow-ups on the Zed global ignore scope:

- Writing `private_files: []` when no patterns remain would replace Zed's
  populated default (`**/.env*`, `**/*.pem`, ...) wholesale and switch its
  secret redaction off. Emit `undefined` so the gateway removes the key.
- ZedIgnore.toRulesyncIgnore built the rulesync source under the imported
  file's outputRoot, which put `.rulesync/.aiignore` in the user config dir
  on a global import. The rulesync source always belongs to the project.
- Extract getZedOtherPlatformGlobalDir() into zed-paths and use it from all
  three Zed adapters instead of repeating the platform conditional.
- Refresh the stale gateway comment claiming private_files appends.

Adds unit coverage for the empty-pattern retraction and the global import,
plus the Zed global import e2e case.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dyoshikawa
dyoshikawa merged commit 9d33c8f into main Jul 29, 2026
9 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-scrap-issue-2415-zed-ignore-global branch July 29, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants