You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Claude Code stats not recording — stdout fallback + snake_case alias + doctor sandbox detection (#55)
<!-- AI-PR-DESCRIPTION-START -->
## PR Auto Describe
## Summary
>This PR improves omni's diagnostic tools, cross-tool hook
compatibility, and filesystem sandbox detection. It upgrades the
`doctor` command to catch Claude Code-style filesystem restrictions via
real write tests, adds support for Claude Code's tool response format,
and unifies hook field naming between camelCase and snake_case.
## Key Changes
- Enhanced `omni doctor` to validate actual filesystem/database write
access instead of static permission checks, with actionable Claude Code
sandbox warnings
- Added cross-tool hook compatibility by supporting both camelCase and
snake_case field names
- Added support for Claude Code's stdout/stderr tool response format
- Added a SQLite store writability test utility
## Detailed Breakdown
- **`src/cli/doctor.rs`**:
- Rewrote the ~/.omni config dir check: Replaced simplistic metadata
permission tests with a real write test (creates + cleans up a temporary
`.write_test` file)
- Added a new database writability scan using the new
`Store::test_write()` method, with tailored warnings for Claude Code
users
- Preserved existing fix-mode directory creation logic
- **`src/hooks/dispatcher.rs` + `src/hooks/session_start.rs`**: Added
serde deserialization aliases to support both camelCase (e.g.
`hookEventName`) and snake_case (e.g. `hook_event_name`) field names
- **`src/hooks/post_tool.rs`**:
- Extended `ToolResponse` struct to accept `stdout` and `stderr` fields
- Created `extract_tool_content()` that prioritizes structured `content`
fields (used by Cursor/Windsurf) then falls back to concatenated
stdout/stderr (Claude Code format)
- Replaced legacy content extraction logic with this new handler
- Added 4 new test cases covering Claude Code payloads, mixed
stdout/stderr, empty output, and structured content field precedence
- **`src/store/sqlite.rs`**: Added `test_write()` helper that validates
database writability by creating and dropping a temporary test table,
handling poisoned mutexes gracefully
## Notes
All `omni doctor` warnings now include specific instructions for Claude
Code users: add `~/.omni` to `sandbox.filesystem.allowWrite` in
`~/.claude/settings.json` to resolve sandboxed write blocks.
## Breaking Changes
None. All changes are backwards-compatible, with existing tooling and
workflows unaffected.
_Last updated: 2026-04-10 04:09:00_
<!-- AI-PR-DESCRIPTION-END -->
// DB write test (catches sandbox restrictions on the database itself)
164
+
if store.test_write(){
165
+
println!(
166
+
" {:<15} writable {}",
167
+
"DB Write:".bright_black(),
168
+
"[OK]".green().bold()
169
+
);
170
+
}else{
171
+
println!(
172
+
" {:<15} read-only {}",
173
+
"DB Write:".bright_black(),
174
+
"[ERROR]".red().bold()
175
+
);
176
+
warnings.push(
177
+
"Database is read-only. Claude Code sandbox may be blocking writes to ~/.omni/omni.db. Add ~/.omni to sandbox.filesystem.allowWrite in ~/.claude/settings.json",
0 commit comments