docs: update CLAUDE.md and minor cleanup

This commit is contained in:
Chris Wanstrath 2026-03-13 14:06:44 -07:00
parent 5d2a4618d9
commit 945925fd99
5 changed files with 6 additions and 8 deletions

View File

@ -23,6 +23,7 @@ Transcript-based shell integration test runner. Bun + TypeScript.
- `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

View File

@ -15,9 +15,7 @@
},
"scripts": {
"check": "bunx tsc --noEmit",
"cli:install": "bun cli:build && sudo cp dist/shout /usr/local/bin",
"cli:link": "ln -sf $(pwd)/src/cli/index.ts ~/.bun/bin/shout",
"cli:uninstall": "sudo rm /usr/local/bin",
"test": "bun test"
},
"devDependencies": {

View File

@ -3,11 +3,12 @@ export function parseDuration(s: string): number {
if (!match) throw new Error(`Invalid duration: ${s}`)
const value = parseFloat(match[1]!)
const unit = match[2] as "ms" | "s" | "m"
const unit = match[2]!
switch (unit) {
case "ms": return value
case "s": return value * 1000
case "m": return value * 60_000
default: throw new Error(`Unknown unit: ${unit}`)
}
}

View File

@ -1,4 +1,4 @@
export type { Command, ShoutFile } from "./parse.ts"
export type { Command, Directive, ShoutFile } from "./parse.ts"
export type { CommandResult, FileResult } from "./run.ts"
export type { DiffLine } from "./match.ts"
export type { TestResult } from "./format.ts"

View File

@ -3,7 +3,7 @@ import { tmpdir } from "node:os"
import { join } from "node:path"
import type { Command, ShoutFile } from "./parse.ts"
import { trimTrailingEmpty, escapeRegex } from "./utils.ts"
import { trimTrailingEmpty } from "./utils.ts"
export type CommandResult = {
command: Command
@ -46,7 +46,6 @@ function buildScript(commands: Command[]): string {
function parseSentinelOutput(
raw: string,
sentinel: string,
commandCount: number,
): { outputs: string[][]; exitCodes: number[] } {
const outputs: string[][] = []
@ -54,7 +53,7 @@ function parseSentinelOutput(
// Split by sentinel lines
const sentinelRegex = new RegExp(
`${escapeRegex(sentinel)}(\\d+)_(\\d+)__`,
`${SENTINEL_PREFIX}(\\d+)_(\\d+)__`,
)
let remaining = raw
@ -146,7 +145,6 @@ export async function runFile(
const { outputs, exitCodes } = parseSentinelOutput(
stdout,
SENTINEL_PREFIX,
file.commands.length,
)