From 39eabc3cbc1930c0b7b7afa6d21482d663f6c0a9 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 27 Jul 2025 22:33:23 +0200 Subject: Add CLAUDE.md. --- CLAUDE.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 CLAUDE.md (limited to 'CLAUDE.md') diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..0dca1b7 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,51 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +**dosage** is a DOS-style command shell implementation written in Rust. The project aims to recreate classic DOS commands and shell functionality in a modern Rust environment, providing a nostalgic DOS computing experience. + +## Development Commands + +```bash +# Development +cargo run # Run in debug mode with REPL shell +cargo build # Build debug version +cargo check # Fast syntax/type checking +cargo clean # Clean build artifacts + +# Release builds (heavily optimized for size) +cargo build --release # Optimized build with LTO and size optimization +cargo run --release # Run optimized version +``` + +## Architecture + +### Command System Design +The application uses a type-safe command architecture with Rust enums: + +- **`Command`**: Top-level enum supporting pipes, redirections, external programs, and builtins +- **`BuiltinCommand`**: Comprehensive DOS command set covering file operations, shell control, scripting, and utilities +- **`FileSpec`**: Handles console (`Con`) vs file path targets for I/O redirection + +### Current Implementation Status +- **Implemented**: Basic REPL shell with `rustyline` for interactive input +- **Stubbed**: Command parsing (`parse` method returns "Not implemented") +- **Planned**: Full DOS command execution based on the `BuiltinCommand` enum + +### Key DOS Commands Planned +File operations (`type`, `copy`, `xcopy`, `dir`, `tree`), shell control (`prompt`, `echo`, `set`, `chdir`), and classic utilities (`date`, `time`, `cls`, `mem`). + +### Error Handling +Uses modern Rust error handling with `eyre::Result` and `color-eyre` for enhanced error reporting with colored output. + +### Dependencies +- **`rustyline`**: Interactive command-line editing and history +- **`crossterm`**: Cross-platform terminal manipulation +- **`prettytable-rs`**: Table formatting for command output +- **`eyre`/`color-eyre`**: Enhanced error handling and reporting +- **`thiserror`**: Error type derivation macros + +## Release Optimization +The release profile is configured for maximum size optimization with LTO, `opt-level = "z"`, symbol stripping, and single codegen unit compilation. \ No newline at end of file -- cgit v1.2.1