feat(reasonix): add permissions, hooks, and commands adapters - #2101
Merged
dyoshikawa merged 2 commits intoJul 1, 2026
Merged
Conversation
Extends the reasonix target beyond MCP-only to three new native surfaces, per the maintainer's own triage priority order in #2035: - reasonix-permissions.ts: maps rulesync's canonical permission.<category> model onto Reasonix's Claude-Code-style Tool(specifier)/:* rule syntax in the [permissions] table of the same reasonix.toml / ~/.reasonix/config.toml the MCP adapter already reads/writes, preserving [[plugins]] and other sibling keys on round-trip (mode is left untouched, since it has no canonical equivalent). - reasonix-hooks.ts: maps preToolUse/postToolUse/beforeSubmitPrompt/stop to Reasonix's PreToolUse/PostToolUse/UserPromptSubmit/Stop events in the standalone .reasonix/settings.json (project) / ~/.reasonix/settings.json (global), using Reasonix's flat per-event hook-object array (no Claude-style matcher/hooks wrapper) and converting the canonical timeout (seconds) to Reasonix's documented milliseconds field. - reasonix-command.ts: Markdown slash commands under .reasonix/commands/ (project) / ~/.reasonix/commands/ (global), directly analogous to claudecode-command.ts (description/argument-hint frontmatter, $ARGUMENTS/$1..$N body placeholders). - reasonix-mcp.ts: round-trips the trusted_read_only_tools field on [[plugins]] entries, which was previously dropped on import/export. Both project and global scope are registered for all three features in their respective processors and tool-target tuples. rules/skills/.mcp.json parity remain explicitly out of scope, per the maintainer's own note that those need a separate design pass. Fixes #2035. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address PR review (high): reasonix.toml/~/.reasonix/config.toml became a 2-writer shared file (mcp + permissions) but neither generation step declared it in writesSharedFile, so assertSharedFilesOrdered() could not protect the invariant that mcp must run before permissions. Currently safe only because permissions already depends on mcp for unrelated reasons; a future refactor could silently drop this ordering. Add the 'reasonix-config' token to both steps, mirroring the existing vibe-config/devin-config pattern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dyoshikawa
deleted the
resolve-issue-2035-reasonix-permissions-hooks-commands
branch
July 1, 2026 03:49
This was referenced Jul 1, 2026
Merged
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.
Summary
Follow-up for Reasonix upstream updates (#2035). Implements the maintainer's own prioritized slice from the triage comment: permissions first (highest value/lowest effort — same TOML the MCP adapter writes), then hooks/commands modeled on claudecode-*. rules/skills/.mcp.json parity are explicitly NOT implemented, per the maintainer's own deferral.
1. reasonix-permissions.ts
[permissions]table in the sharedreasonix.toml(project) /~/.reasonix/config.toml(global) — the same filereasonix-mcp.tsalready writes. Maps canonicalpermission.<category>onto Reasonix'sTool(specifier)syntax (SPEC.md confirms this is explicitly "Claude Code-style"), mirroringclaudecode-permissions.ts.modeand[[plugins]]and other sibling TOML tables survive round-trip untouched. Registered both scopes.2. reasonix-hooks.ts
.reasonix/settings.json(project) /~/.reasonix/settings.json(global) — a separate file from the TOML. Fact-check correction: the actual schema (found indocs/DESKTOP_HOOKS.zh-CN.md, not linked by the issue) is FLAT per event ({ "PreToolUse": [{ match, command, description, timeout }] }, no Claude-style matcher/hooks wrapper), and the timeout field is literallytimeoutin milliseconds, nottimeoutMs. MapspreToolUse/postToolUse/beforeSubmitPrompt/stop→PreToolUse/PostToolUse/UserPromptSubmit/Stop, converting canonical seconds ↔ milliseconds. Registered both scopes.Note: the same doc shows Reasonix also has
SessionStart/SessionEnd/PostLLMCall/SubagentStop/Notification/PreCompactevents not mapped here (out of the scoped 4-event set) — a good fast-follow candidate.3. reasonix-command.ts
Markdown files under
.reasonix/commands/(project) /~/.reasonix/commands/(global), frontmatterdescription/argument-hint, confirmed identical toclaudecode-command.ts's model. Registered both scopes.4. Bonus fix: trusted_read_only_tools round-trip
Reasonix's
[[plugins]]schema has atrusted_read_only_toolsfield thatreasonix-mcp.tspreviously dropped on round-trip. Added to the passthrough field list.Deferred (per maintainer's own triage)
rules (
[agent] system_prompt_file), skills ([skills]discovery config), and.mcp.jsonparity — explicitly out of scope.Verification
pnpm cicheckfully green: 301 test files, 6705 tests. Full e2e suite 638/639 (the one failure is pre-existing on main, verified via git stash, unrelated).References
Closes #2035