fix(core): match file permission rules without case on macOS

Merged
KN
8d ago
+50-6

Issue for this PR

Closes #64624

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Wildcard.match ignores case only on Windows. macOS volumes ignore case by default, so .OPENCODE/plugins/x.ts is the same file as .opencode/plugins/x.ts, but it did not match a .opencode/* rule.

Permission.evaluate and the organization tool.use policy hook now match the resources of the file actions (read, edit, and external_directory) without case on macOS. The list of file actions lives in Permission.pathActions, which the agent config also uses. Windows is unchanged. On macOS, shell commands and other resources still match with case. On a case-sensitive APFS volume, file rules now also match other spellings; that makes ask and deny rules stricter, but allow rules broader too.

No feature flag: this is a bug fix.

How did you verify your code works?

  • New tests in packages/core/test/permission.test.ts and packages/core/test/config/policy.test.ts. They fail on macOS without the fix; the new Wildcard.match option is checked on every platform.
  • On macOS, in packages/core: bun run script/test.ts (7562 pass, 0 fail), bun typecheck, and bun run typecheck:tsc.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR