Skip to main content

Module access_compat

Module access_compat 

Source
Expand description

Permission compatibility — partial port of grok-build xai-grok-workspace/src/permission/ (Apache-2.0).

Two pieces are ported at MVP depth:

  1. Bash command splitter — a lightweight, regex-based variant of grok’s bash_command_splitting.rs (which uses tree-sitter-bash). Detects &&, ||, ;, | boundaries and splits into individual commands.

  2. .claude/settings.json importer — translates Claude’s permissions.allow/deny/ask arrays into oxicode AccessGate rule decisions via ClaudeRuleSet.

§Non-goals

  • grok’s auto_mode.rs (100 KB learning-based auto-approve) is intentionally NOT ported — it requires training data we don’t have.
  • grok’s manager.rs/resolution.rs (255 KB) are layered on workspace hooks that oxicode doesn’t share.

Structs§

ClaudeRuleSet
Adapter that wires an ImportResult into an AccessGate-like check.
ClaudeSettings
Subset of .claude/settings.json we read.
ImportResult
Outcome of importing .claude/settings.json.
ImportedRule
A rule extracted from a Claude permissions entry.
ParsedPermissions
permissions block from Claude settings.
SplitCommand
A single command extracted from a shell pipeline.

Enums§

CommandSeparator
Operators that can join commands in a shell pipeline.

Functions§

load_claude_settings
Read .claude/settings.json from dir/.claude/settings.json.
parse_claude_settings
Parse the raw text of a .claude/settings.json file.
parse_rule_entry
Parse a single Claude permissions entry string.
split_bash
Split a shell command line on &&, ||, ;, |. Quotes and backslash escapes are honored. Returns None on unbalanced quotes.