feat(repl): Phase 288 P1 - Add CLI entry point

Added --repl / -i flag:
- src/cli/args.rs: clap flag definition (+5 lines)
- src/cli/mod.rs: CliConfig.repl field (+3 lines)
- src/runner/mod.rs: run_repl() loop + stub eval (+71 lines)

Minimal REPL: .help / .exit work, eval stub for P2.

Test results:
   hakorune --repl starts REPL
   .help / .exit / .reset commands work
   File mode regression: 154/154 tests pass

File mode unchanged (0 regressions).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-25 13:28:41 +09:00
parent 796089688a
commit 8941e3bb03
3 changed files with 80 additions and 0 deletions

View File

@ -105,6 +105,12 @@ pub fn build_command() -> Command {
.arg(Arg::new("build-aot").long("build-aot").value_name("{cranelift|llvm}").help("AOT backend for --build"))
.arg(Arg::new("build-profile").long("profile").value_name("{release|debug}").help("Cargo profile for --build"))
.arg(Arg::new("build-target").long("target").value_name("TRIPLE").help("Target triple for --build"))
// Phase 288 P1: REPL mode
.arg(Arg::new("repl")
.long("repl")
.short('i')
.help("Start interactive REPL (Read-Eval-Print Loop)")
.action(clap::ArgAction::SetTrue))
}
fn hex_encode_utf8(s: &str) -> String {
@ -206,6 +212,8 @@ pub fn from_matches(matches: &ArgMatches) -> CliConfig {
macro_expand_child: matches.get_one::<String>("macro-expand-child").cloned(),
dump_expanded_ast_json: matches.get_flag("dump-expanded-ast-json"),
macro_ctx_json: matches.get_one::<String>("macro-ctx-json").cloned(),
// Phase 288 P1: REPL mode
repl: matches.get_flag("repl"),
};
if cfg.cli_verbose {

View File

@ -70,6 +70,8 @@ pub struct CliConfig {
pub macro_expand_child: Option<String>,
pub dump_expanded_ast_json: bool,
pub macro_ctx_json: Option<String>,
// Phase 288 P1: REPL mode
pub repl: bool,
}
pub use groups::{
@ -221,6 +223,8 @@ impl Default for CliConfig {
macro_expand_child: None,
dump_expanded_ast_json: false,
macro_ctx_json: None,
// Phase 288 P1: REPL mode
repl: false,
}
}
}