The comment tests used hardcoded addresses (0x118910, 0x118920, etc.)
that assumed a specific binary layout. These addresses don't have code
units on CI-compiled binaries, causing "No code unit at address" errors.
Now uses get_function_address/get_function_addresses helpers to
dynamically resolve valid addresses.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Batch was broken because it sent a single "batch" command to the Java
bridge, which rejected it. Now the Rust CLI parses each line of the
batch file as a sub-command and dispatches them individually through
execute_via_bridge, collecting results into a JSON response.
Also updated CI to install Java 21 (required by Ghidra 12.0.1).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
BatchArgs was missing --project and --program fields, so batch commands
couldn't specify which project to use. Also fixed argument ordering in
all test files to place --project/--program after the subcommand name,
matching clap's per-subcommand argument parsing.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test harness used dirs::data_local_dir() (~/.local/share) to compute
the project path, but the CLI defaults to dirs::cache_dir() (~/.cache).
This caused different MD5 hashes for port file lookup, so the test harness
could never find the port file written by the bridge.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests that use DaemonTestHarness or ensure_test_project were missing the
require_ghidra!() macro, causing them to attempt bridge startup in CI
where Ghidra is not installed, resulting in 120s timeouts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace redundant closure with function reference (clippy::redundant_closure)
- Use is_some_and instead of map_or(false, ...) (clippy::unnecessary_map_or)
- Run cargo fmt across all files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Make --quiet flag functional by threading it through execute_via_bridge()
- Fix --sort hyphen ambiguity with allow_hyphen_values in clap
- Replace deprecated atty crate with std::io::IsTerminal
- Use config.default_limit as fallback when user doesn't specify --limit
- Respect per-command --json flag in QueryOptions format detection
- Remove dead src/daemon/ module and src/ipc/transport.rs
- Deduplicate headless_script lookup (GhidraClient delegates to bridge)
- Fix stop_bridge() SIGTERM race with graceful shutdown wait loop
- Extend config set to support all config keys
- Clean up dead code warnings and remove blanket #![allow(dead_code)]
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Refactor disassembly tests to dynamically resolve addresses and validate instruction schemas.
- Introduce error handling tests for invalid inputs in disassembly.
- Improve patching tests by validating output structure and ensuring graceful failure on invalid inputs.
- Add snapshot tests for output format regression detection in patching and querying commands.
- Update function list and memory map tests to validate JSON output against typed schemas.
- Ensure all tests utilize dynamic address resolution instead of hardcoded values for robustness.
- Implemented `install_pyghidra` function to set up PyGhidra in a Python virtual environment for Ghidra installations.
- Enhanced `install_ghidra` to call `install_pyghidra` after Ghidra installation.
- Updated daemon command handling to include program name in start, restart, and stop commands.
- Refactored project path resolution to streamline project management.
- Improved socket path handling to respect `GHIDRA_CLI_SOCKET` environment variable for testing.
- Modified tests to remove ignore flags, allowing for automated testing without Ghidra installation.
- Added analysis step in test project setup to ensure comments and other features work correctly.
HeadlessExecutor spawned a new Ghidra process per command, which was
slow. The daemon maintains a persistent connection and is now the only
way to execute queries.
Changes:
- Delete src/ghidra/headless.rs entirely
- Remove dead handler functions that used HeadlessExecutor:
- handle_query, handle_function_command, handle_decompile,
- handle_decompile_impl, handle_strings_command,
- handle_memory_command, handle_dump_command, handle_summary
- Update handle_quick to inform user about daemon requirement
- Query::execute replaced with Query::process_results for
post-processing of daemon results
All query commands (function list, decompile, strings, memory, etc.)
now require the daemon to be running. The CLI prints clear instructions
when daemon is not available.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add E2E test infrastructure:
- DaemonTestHarness for managing daemon lifecycle in tests
- Test fixtures and helpers in tests/common/
- Sample binary fixture for integration tests
Add test coverage:
- command_tests.rs: version, doctor, config commands
- project_tests.rs: project create/list/info/delete, import, analyze
- daemon_tests.rs: daemon start/status/ping/stop/clear-cache
- query_tests.rs: function list, strings, memory, decompile, xref
- unimplemented_tests.rs: 39 tests for graceful error messages
Fix CLI bugs:
- DisasmArgs: rename count to num_instructions (--instructions/-n)
to avoid conflict with QueryOptions.count
- GraphExportArgs: add unique arg id for format positional to avoid
conflict with QueryOptions.format
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit implements the daemon-only architecture where all query
operations (functions, strings, decompile, memory, summary, xrefs)
must go through the persistent daemon instead of spawning new Ghidra
processes per command.
Key changes:
- Wire IPC client in main.rs to route queries through daemon
- Add requires_daemon() to determine which commands need daemon
- Add execute_via_daemon() to translate CLI commands to IPC calls
- Deprecate HeadlessExecutor with migration notice
- Fix filter.pest hex number parsing order (hex before number)
- Add #[allow(dead_code)] to infrastructure modules for future use
- Mark E2E tests requiring daemon as #[ignore]
Architecture benefits:
- Faster queries: Ghidra stays loaded, no 5-30s startup per command
- Simpler code: One execution path instead of two
- Better UX: Clear daemon requirement with helpful error messages
When daemon is not running, users see:
Error: This command requires the daemon to be running.
Start the daemon with: ghidra daemon start --project <name>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Key changes:
- Remove HeadlessExecutor as execution path
- All query operations require daemon
- Wire IPC layer (already implemented) as primary client
- 9 milestones for complete implementation
Rationale: Binary analysis is slow enough that persistent
daemon is always preferable to per-command process spawning.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add docs/plan-prod.md with comprehensive release plan
- Include sample_binary test fixture
- Update e2e tests
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>