Skip to content

refactor(template): optimize Rust code quality and add prek init (#42)#43

Merged
crrow merged 10 commits intomainfrom
issue-42-template-rust-opt
Mar 27, 2026
Merged

refactor(template): optimize Rust code quality and add prek init (#42)#43
crrow merged 10 commits intomainfrom
issue-42-template-rust-opt

Conversation

@crrow
Copy link
Copy Markdown
Contributor

@crrow crrow commented Mar 27, 2026

Summary

  • paths.rs: Replace assert!/expect panics with Result-based init_data_dir() + snafu PathResolution variant
  • app_config.rs: Replace unwrap_or_default() with snafu error propagation; new init()/get() two-phase pattern with idempotency guard
  • backend.rs: Table-driven refactor replaces ~20 individual constructors with HEADLESS_PRESETS + INTERACTIVE_PRESETS static tables (745 → 521 lines)
  • executor.rs: Unify terminate_child signature to &mut across unix/non-unix
  • main.rs: Add init_data_dir() + app_config::init() startup sequence; load()get(); section markers for config field registry
  • justfile: Add prek-init, init recipes; setup-hooks now aliases prek-init
  • tests/: Integration test scaffolding — common::cmd() helper + 5 smoke tests (help, version, agent-describe, hello, unknown command)
  • agent-quickstart.md: Updated data flow diagram, module map, config access examples, new init/prek steps

Closes #42

Test plan

  • Generate a test project with rara-cli-template setup
  • cargo check compiles without errors
  • cargo test — smoke tests pass
  • just init — prek hooks install
  • just pre-commit — all checks pass
  • cargo run -- --agent-describe — valid JSON with protocol: "agent-cli/1"
  • cargo run -- hello world — returns AgentResponse JSON

🤖 Generated with Claude Code

@crrow crrow merged commit 165f87c into main Mar 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(template): optimize Rust code quality and add prek init

1 participant