Skip to content

Commit 7f1f9d1

Browse files
authored
Clarify README usage and platform support (#43)
* docs: clarify readme usage and platform support * docs: split config from advanced workflows * test: stabilize stdin tty smoke timing * test: slow pager smoke key timing on ci
1 parent 6c2b912 commit 7f1f9d1

2 files changed

Lines changed: 29 additions & 17 deletions

File tree

README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ npm i -g hunkdiff
2323
Requirements:
2424

2525
- Node.js 18+
26+
- Currently supported on macOS and Linux
2627
- Git is recommended for most workflows
2728

28-
## Basic usage
29+
## Usage
30+
31+
### Basics
2932

3033
```bash
31-
hunk # show help
32-
hunk --version # show the installed version
33-
hunk diff before.ts after.ts # compare two files directly
34-
git diff --no-color | hunk patch - # review a patch from stdin
34+
hunk # show help
35+
hunk --version # get version
3536
```
3637

3738
### Working with Git
@@ -43,6 +44,13 @@ hunk show # review the latest commit
4344
hunk show HEAD~1 # review an earlier commit
4445
```
4546

47+
### Working with raw files/patches
48+
49+
```bash
50+
hunk diff before.ts after.ts # compare two files directly
51+
git diff --no-color | hunk patch - # review a patch from stdin
52+
```
53+
4654
## Feature comparison
4755

4856
| Capability | hunk | difftastic | delta | diff |
@@ -90,24 +98,28 @@ Ready-to-run demo diffs live in [`examples/`](examples/README.md).
9098

9199
Each example includes the exact command to run from the repository root.
92100

93-
## Advanced features
101+
## Config
94102

95-
- `hunk patch [file|-]` opens patch files or patch stdin
96-
- `hunk pager` opens Hunk for diff-like stdin and falls back to plain-text paging otherwise
97-
- `hunk diff --agent-context <file>` loads inline agent rationale from a JSON sidecar
98-
- `hunk mcp serve` runs the local MCP daemon for agent-to-diff communication
99-
- Hunk reads config from `~/.config/hunk/config.toml` and `.hunk/config.toml`
103+
Hunk reads config from:
104+
105+
- `~/.config/hunk/config.toml`
106+
- `.hunk/config.toml`
100107

101-
Minimal config example:
108+
Example:
102109

103110
```toml
104-
theme = "midnight"
105-
mode = "auto"
111+
theme = "midnight" # midnight, graphite, paper, ember
112+
mode = "auto" # auto, split, stack
106113
line_numbers = true
107114
wrap_lines = false
108115
agent_notes = false
109116
```
110117

118+
## Advanced workflows
119+
120+
- `hunk diff --agent-context <file>` loads inline agent rationale from a JSON sidecar
121+
- `hunk mcp serve` runs the local MCP daemon for agent-to-diff communication
122+
111123
## Performance notes
112124

113125
Hunk spends more startup time than plain diff output tools because it launches an interactive UI with syntax highlighting, navigation state, and optional agent context. In exchange, it is optimized for reviewing a full changeset instead of printing static diff text and exiting.

test/tty-render-smoke.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ async function runStdinPagerSmoke(options?: { input?: string; inputCommand?: str
152152
const transcript = join(fixture.dir, "stdin-pager-transcript.txt");
153153
const subcommand = options?.command === "pager" ? "pager" : "patch -";
154154
const patchCommand = `cat ${shellQuote(fixture.coloredPatch)} | bun run ${shellQuote(sourceEntrypoint)} ${subcommand}`;
155-
const scriptCommand = `timeout 5 script -q -f -e -c ${shellQuote(patchCommand)} ${shellQuote(transcript)}`;
156-
const inputCommand = options?.inputCommand ?? `(sleep 1; printf ${shellQuote(options?.input ?? "q")})`;
155+
const scriptCommand = `timeout 7 script -q -f -e -c ${shellQuote(patchCommand)} ${shellQuote(transcript)}`;
156+
const inputCommand = options?.inputCommand ?? `(sleep 2; printf ${shellQuote(options?.input ?? "q")})`;
157157
const proc = Bun.spawnSync(["bash", "-lc", `${inputCommand} | ${scriptCommand}`], {
158158
cwd: fixture.dir,
159159
stdin: "ignore",
@@ -243,7 +243,7 @@ describe("TTY render smoke", () => {
243243

244244
const output = await runStdinPagerSmoke({
245245
lines: 40,
246-
inputCommand: `(sleep 1; printf ' '; sleep 1; printf q)`,
246+
inputCommand: `(sleep 2; printf ' '; sleep 2; printf q)`,
247247
});
248248

249249
expect(output).toContain("before_23");

0 commit comments

Comments
 (0)