Skip to content

Compat: honor permissions from .claude/settings.json #37

Description

@aakashrajput

Why

Teams switching from Claude Code have curated permissions.allow/deny/ask lists in .claude/settings.json. Honoring them makes switching frictionless and keeps their guardrails intact.

What

  • Read .claude/settings.json (and .claude/settings.local.json, local wins) from the project root
  • Map permissions.allow / deny / ask rules onto our permission layer. Rule shapes to support: Bash(git *), Edit(src/**), Read(...), WebFetch(domain:example.com), bare tool names. Map tool names to ours (Bashrun_command, Editedit_file/multi_edit/apply_patch, etc.); log unmappable rules and skip
  • Precedence: deny > ask > allow; our native config always outranks imported rules
  • Gate behind config flag (default on), log a summary line at startup

Where to start

  • src/permissions/index.ts — current 3-tier model; this adds a rule-matching layer in front
  • Keep the matcher a pure function with table-driven tests

Acceptance criteria

  • Fixture tests: allow/deny/ask each honored, glob patterns, precedence, unmappable-rule skip
  • No behavior change when no .claude/settings.json exists
  • typecheck + tests green

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions