From faa4a4ce9e3a7bf9cc4ec36d952a0092736e5d2d Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 2 Apr 2026 16:47:23 -0700 Subject: [PATCH] Migrate from Bun/TypeScript to Rust --- CLAUDE.md | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 731916a..58303ef 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,12 +1,12 @@ # shout -Transcript-based shell integration test runner. Bun + TypeScript. +Transcript-based shell integration test runner. Rust. ## Commands -- `bun test` — run unit tests -- `bunx tsc --noEmit` — type check -- `bun run src/cli/index.ts test [files...]` — run shout CLI +- `cargo test` — run tests (integration tests in `tests/shout.rs`) +- `cargo build` — build the binary +- `cargo run -- test [files...]` — run shout CLI - `-u, --update` — rewrite `.shout` files with actual output - `-k, --keep` — keep temp directories after run - `--clean-env` — start with empty environment @@ -19,15 +19,13 @@ Transcript-based shell integration test runner. Bun + TypeScript. ## Architecture -- `src/parse.ts` — parses `.shout` files into `ShoutFile` (list of `Command`) -- `src/run.ts` — executes commands via `Bun.spawn(["/bin/sh"], { detached: true })`, captures output with sentinels -- `src/match.ts` — wildcard-aware output matching and diff generation -- `src/format.ts` — evaluates pass/fail, formats failures and summary -- `src/update.ts` — rewrites `.shout` files with actual output (`--update` mode) -- `src/utils.ts` — shared utilities (`trimTrailingEmpty`, `escapeRegex`) -- `src/duration.ts` — parses duration strings (`10s`, `500ms`, `1m`) -- `src/cli/index.ts` — CLI entry point via `commander` -- `src/index.ts` — barrel exports +- `src/main.rs` — CLI entry point, arg parsing, file discovery, `run_one` orchestration +- `src/parse.rs` — parses `.shout` files into `ShoutFile` (list of `Command`), also `parse_setup` +- `src/run.rs` — executes commands via `/bin/sh`, captures output with sentinels +- `src/matching.rs` — wildcard-aware output matching and diff generation +- `src/format.rs` — evaluates pass/fail, formats failures and summary +- `src/update.rs` — rewrites `.shout` files with actual output (`--update` mode) +- `src/duration.rs` — parses duration strings (`10s`, `500ms`, `1m`) - `web/index.html` — web documentation page ## .shout file format @@ -63,17 +61,16 @@ Transcript-based shell integration test runner. Bun + TypeScript. ## New feature checklist -1. `src/parse.ts` — update types (`Directive`, `ShoutFile`, `Command`) and both parsers (`parse` + `parseSetup`) -2. `src/parse.test.ts` — unit tests for parsing the new syntax in both `.shout` and setup file contexts -3. `src/cli/index.ts` — wire up the parsed result in `runOne` (directive resolution, command merging, result handling) -4. `tests/*.shout` — integration test file exercising the feature end-to-end -5. `CLAUDE.md` — update `.shout file format` section -6. `README.md` — update Directives section -7. `web/index.html` — add or update a section on the website -8. Run `cargo test` to verify +1. `src/parse.rs` — update types (`Directive`, `ShoutFile`, `Command`) and both parsers (`parse` + `parse_setup`) +2. `src/main.rs` — wire up the parsed result in `run_one` (directive resolution, command merging, result handling) +3. `tests/*.shout` — integration test file exercising the feature end-to-end +4. `CLAUDE.md` — update `.shout file format` section +5. `README.md` — update Directives section +6. `web/index.html` — add or update a section on the website +7. Run `cargo test` to verify ## Style -- Strict TypeScript, Bun runtime -- No classes — plain functions and types +- Rust 2024 edition +- No OOP — plain functions and structs/enums - Integration tests in `tests/shout.rs`, example `.shout` files in `tests/`