feat(ignore): support Zed global private_files and retract removed patterns - #2482
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Part of #2415 (gap 2). Zed's
private_filesis 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.jsonon Windows) — the very file rulesync already writes in--globalmode for MCP and permissions.ZedIgnorewas nonetheless project-only, sorulesync generate --targets zed --features ignore --globalemitted nothing.The same adapter also merged additively (
uniq([...existingPrivateFiles, ...patterns])), so a pattern deleted from.rulesync/.aiignorewas never retracted fromsettings.json(gap 2b in the issue).Changes
ZedIgnore.getSettablePaths()now takes{ global }and returns the platform-awaregetZedGlobalDir()for global scope;globalis threaded throughfromRulesyncIgnore,fromFile, andforDeletion.getExtraSharedWritePaths()declares the other platform's global spelling, mirroringZedPermissions, so the shared-write derivation knows both on every platform.zedis registered inignoreProcessorGlobalToolTargets.ignore: { kind: "replace-owned-keys", ownedKeys: ["private_files"] }on both global Zed entries (.config/zed/settings.jsonandAppData/Roaming/Zed/settings.json); the project entry already had it.private_filesis 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 MCPcontext_serversblock, the permissionsagentblock, 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
ZedIgnoreunit coverage for global settable paths,getExtraSharedWritePaths, and a global-scope generate that preserves an unrelatedthemekey while replacing a stale pattern. The three tests that pinned the additive merge now pin retraction.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.tspasses.docs/reference/file-formats.mdgains a Zed paragraph in the ignore section and the scope sentence now listszed; supported-tools tables regenerated and skill docs synced. Fullpnpm cicheckis green.Deferred
Gaps 5 (
agent.sandbox_permissionsauthoring) 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