summaryrefslogtreecommitdiff
path: root/CLAUDE.md
blob: 0dca1b73c09589907f76a31a9ddc56b5590e45d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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.