spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

mods/diff: the pane tests say why they draw the hint and what git answersBrowse files
poteat authored on Sep 11, 2026 parent 07313f0 · commit 55809f27e801
1 changed file+15 -5compared with 07313f0
Mmods/diff/tests/pane.test.ts
@@ -46,6 +46,10 @@
4646 scroll: { offset: 0, bodyRows: 30 },
4747 },
4848 }
49+/**
50+ * The prompt's hint on a 160-column terminal: drawing it is how the plugin
51+ * learns how wide the terminal is.
52+ */
4953 const HINT: RenderInput<'PromptHint'> = {
5054 component: 'PromptHint',
5155 surface: 'terminal',
@@ -53,15 +57,17 @@
5357 viewport: { columns: 160, rows: 40 },
5458 props: { isDraft: false, isWorking: false, hint: '' },
5559 }
60+/**
61+ * What the engine draws for the hint, standing in beneath the plugin.
62+ */
5663 const HINT_DRAWN: RenderElement = {
5764 type: 'Text',
5865 children: ['? for shortcuts'],
5966 }
6067
6168 /**
62- * A repository at /work with one changed file: an invocation of git whose
63- * command line holds a key answers that output, and any other fails as git
64- * does outside a repository.
69+ * A repository at /work with one changed file, as git's output for each
70+ * invocation whose command line holds the key.
6571 */
6672 const REPOSITORY: Readonly<Record<string, string>> = {
6773 'rev-parse --path-format=absolute': '/work\n/work/.git\n/work/.git\n',
@@ -71,6 +77,10 @@
7177 '-- app.ts': '@@ -1 +1 @@\n-const a = 1\n+const a = 2\n',
7278 }
7379
80+/**
81+ * What git answers in that repository; an invocation it does not know
82+ * fails as git does outside a repository.
83+ */
7484 function gitIn(argv: readonly string[]): ProcessRunResult {
7585 const line = argv.join(' ')
7686 const found = Object.entries(REPOSITORY).find(([key]) => line.includes(key))
@@ -134,8 +144,8 @@
134144 await clock.advance(1000)
135145 const [discovery, ...pinned] = world.runs
136146
137- expect(discovery?.argv).toContain('--show-toplevel')
138- expect(discovery?.init?.cwd).toBeUndefined()
147+ expect(discovery.argv).toContain('--show-toplevel')
148+ expect(discovery.init?.cwd).toBeUndefined()
139149 expect(pinned.length).toBeGreaterThan(0)
140150
141151 for (const run of pinned) {