b1b95a4560
feat(M7): implement headless mode with JSON and stream-JSON output formats
...
Milestone M7 implementation adds programmatic output formats for automation
and machine consumption.
New features:
- --output-format flag with three modes:
* text (default): Human-readable streaming output
* json: Single JSON object with session_id, messages, and stats
* stream-json: NDJSON format with event stream (session_start, chunk, session_end)
- Session tracking:
* Unique session ID generation (timestamp-based)
* Duration tracking (ms)
* Token count estimation (chars / 4 approximation)
- Output structures:
* SessionOutput: Complete session with messages and stats
* StreamEvent: Individual events for NDJSON streaming
* Stats: Token counts (total, prompt, completion) and duration
- Tool result formatting:
* All tool commands (Read, Write, Edit, Glob, Grep, Bash, SlashCommand)
support all three output formats
* JSON mode wraps results with session metadata
* Stream-JSON mode emits event sequences
- Chat streaming:
* Text mode: Real-time character streaming (unchanged behavior)
* JSON mode: Collects full response, outputs once with stats
* Stream-JSON mode: Emits chunk events as they arrive
Tests added (5 new tests):
1. print_json_has_session_id_and_stats - Verifies JSON output structure
2. stream_json_sequence_is_well_formed - Verifies NDJSON event sequence
3. text_format_is_default - Verifies default behavior unchanged
4. json_format_with_tool_execution - Verifies tool result formatting
5. stream_json_includes_chunk_events - Verifies streaming chunks
All 68 tests passing (up from 63).
This enables programmatic usage for automation, CI/CD, and integration
with other tools.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 20:05:23 +01:00
a024a764d6
feat(M6): implement hooks system with PreToolUse, PostToolUse, and SessionStart events
...
Milestone M6 implementation adds a comprehensive hook system that allows
users to run custom scripts at various lifecycle events.
New crate: crates/platform/hooks
- HookEvent enum with multiple event types:
* PreToolUse: fires before tool execution, can deny operations (exit code 2)
* PostToolUse: fires after tool execution
* SessionStart: fires at session start, can persist env vars
* SessionEnd, UserPromptSubmit, PreCompact (defined for future use)
- HookManager for executing hooks with timeout support
- JSON I/O: hooks receive event data via stdin, can output to stdout
- Hooks located in .owlen/hooks/{EventName}
CLI integration:
- All tool commands (Read, Write, Edit, Glob, Grep, Bash, SlashCommand)
now fire PreToolUse hooks before execution
- Hooks can deny operations by exiting with code 2
- Hooks timeout after 5 seconds by default
Tests added:
- pretooluse_can_deny_call: verifies hooks can block tool execution
- posttooluse_runs_parallel: verifies PostToolUse hooks execute
- sessionstart_persists_env: verifies SessionStart can create env files
- hook_timeout_works: verifies timeout mechanism
- hook_not_found_is_ok: verifies missing hooks don't cause errors
All 63 tests passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 19:57:38 +01:00
686526bbd4
chore: change slash command directory from .claude to .owlen
...
Changes slash command directory from `.claude/commands/` to
`.owlen/commands/` to reflect that owlen is its own tool while
maintaining compatibility with claude-code slash command syntax.
Updated locations:
- CLI main: command file path lookup
- Tests: slash_command_works and slash_command_file_refs
All 56 tests passing.
2025-11-01 19:46:40 +01:00
5134462deb
feat(tools): implement Slash Commands with frontmatter and file refs (M5 complete)
...
This commit implements the complete M5 milestone (Slash Commands) including:
Slash Command Parser (tools-slash):
- YAML frontmatter parsing with serde_yaml
- Metadata extraction (description, author, tags, version)
- Arbitrary frontmatter fields via flattened HashMap
- Graceful fallback for commands without frontmatter
Argument Substitution:
- $ARGUMENTS - all arguments joined by space
- $1, $2, $3, etc. - positional arguments
- Unmatched placeholders remain unchanged
- Empty arguments result in empty string for $ARGUMENTS
File Reference Resolution:
- @path syntax to include file contents inline
- Regex-based matching for file references
- Multiple file references supported
- Clear error messages for missing files
CLI Integration:
- Added `slash` subcommand: `owlen slash <command> <args...>`
- Loads commands from `.claude/commands/<name>.md`
- Permission checks for SlashCommand tool
- Automatic file reference resolution before output
Command Structure:
---
description: "Command description"
author: "Author name"
tags:
- tag1
- tag2
---
Command body with $ARGUMENTS and @file.txt references
Permission Enforcement:
- Plan mode: SlashCommand allowed (utility tool)
- All modes: SlashCommand respects permissions
- File references respect filesystem permissions
Testing:
- 10 tests in tools-slash for parser functionality
- Frontmatter parsing with complex YAML
- Argument substitution (all variants)
- File reference resolution (single and multiple)
- Edge cases (no frontmatter, empty args, etc.)
- 3 new tests in CLI for integration
- slash_command_works (with args and frontmatter)
- slash_command_file_refs (file inclusion)
- slash_command_not_found (error handling)
- All 56 workspace tests passing ✅
Dependencies Added:
- serde_yaml 0.9 for YAML frontmatter parsing
- regex 1.12 for file reference pattern matching
M5 milestone complete! ✅
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 19:41:42 +01:00
d7ddc365ec
feat(tools): implement Bash tool with persistent sessions and timeouts (M4 complete)
...
This commit implements the complete M4 milestone (Bash tool) including:
Bash Session:
- Persistent bash session using tokio::process
- Environment variables persist between commands
- Current working directory persists between commands
- Session-based execution (not one-off commands)
- Automatic cleanup on session close
Key Features:
- Command timeout support (default: 2 minutes, configurable per-command)
- Output truncation (max 2000 lines for stdout/stderr)
- Exit code capture and propagation
- Stderr capture alongside stdout
- Command delimiter system to reliably detect command completion
- Automatic backup of exit codes to temp files
Implementation Details:
- Uses tokio::process for async command execution
- BashSession maintains single bash process across multiple commands
- stdio handles (stdin/stdout/stderr) are taken and restored for each command
- Non-blocking stderr reading with timeout to avoid deadlocks
- Mutex protection for concurrent access safety
CLI Integration:
- Added `bash` subcommand: `owlen bash <command> [--timeout <ms>]`
- Permission checks with command context for pattern matching
- Stdout/stderr properly routed to respective streams
- Exit code propagation (exits with same code as bash command)
Permission Enforcement:
- Plan mode (default): blocks Bash (asks for approval)
- Code mode: allows Bash
- Pattern matching support for command-specific rules (e.g., "npm test*")
Testing:
- 7 tests in tools-bash for session behavior
- bash_persists_env_between_calls ✅
- bash_persists_cwd_between_calls ✅
- bash_command_timeout ✅
- bash_output_truncation ✅
- bash_command_failure_returns_error_code ✅
- bash_stderr_captured ✅
- bash_multiple_commands_in_sequence ✅
- 3 new tests in CLI for permission enforcement
- plan_mode_blocks_bash_operations ✅
- code_mode_allows_bash ✅
- bash_command_timeout_works ✅
- All 43 workspace tests passing ✅
Dependencies Added:
- tokio with process, io-util, time, sync features
M4 milestone complete! ✅
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 19:31:36 +01:00
6108b9e3d1
feat(tools): implement Edit and Write tools with deterministic patches (M3 complete)
...
This commit implements the complete M3 milestone (Edit & Write tools) including:
Write tool:
- Creates new files with parent directory creation
- Overwrites existing files safely
- Simple and straightforward implementation
Edit tool:
- Exact string replacement with uniqueness enforcement
- Detects ambiguous matches (multiple occurrences) and fails safely
- Detects no-match scenarios and fails with clear error
- Automatic backup before modification
- Rollback on write failure (restores from backup)
- Supports multiline string replacements
CLI integration:
- Added `write` subcommand: `owlen write <path> <content>`
- Added `edit` subcommand: `owlen edit <path> <old_string> <new_string>`
- Permission checks for both Write and Edit tools
- Clear error messages for permission denials
Permission enforcement:
- Plan mode (default): blocks Write and Edit (asks for approval)
- AcceptEdits mode: allows Write and Edit
- Code mode: allows all operations
Testing:
- 6 new tests in tools-fs for Write/Edit functionality
- 5 new tests in CLI for permission enforcement with Edit/Write
- Tests verify plan mode blocks, acceptEdits allows, code mode allows all
- All 32 workspace tests passing
Dependencies:
- Added `similar` crate for future diff/patch enhancements
M3 milestone complete! ✅
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 19:19:49 +01:00
a6cf8585ef
feat(permissions): implement permission system with plan mode enforcement (M1 complete)
...
This commit implements the complete M1 milestone (Config & Permissions) including:
- New permissions crate with Tool, Action, Mode, and PermissionManager
- Three permission modes: Plan (read-only default), AcceptEdits, Code
- Pattern matching for permission rules (exact match and prefix with *)
- Integration with config-agent for mode-based permission management
- CLI integration with --mode flag to override configured mode
- Permission checks for Read, Glob, and Grep operations
- Comprehensive test suite (10 tests in permissions, 4 in config, 4 in CLI)
Also fixes:
- Fixed failing test in tools-fs (glob pattern issue)
- Improved glob_list() root extraction to handle patterns like "/*.txt"
All 21 workspace tests passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 19:14:54 +01:00
baf833427a
chore: update workspace paths after directory reorganization
...
Update workspace members and dependency paths to reflect new directory structure:
- crates/cli → crates/app/cli
- crates/config → crates/platform/config
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 18:50:05 +01:00
d21945dbc0
chore(git): ignore custom documentation files
...
Add AGENTS.md and CLAUDE.md to .gitignore to exclude project-specific documentation files.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com >
2025-11-01 18:49:44 +01:00