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
| @@ -46,6 +46,10 @@ | ||
| 46 | 46 | scroll: { offset: 0, bodyRows: 30 }, |
| 47 | 47 | }, |
| 48 | 48 | } |
| 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 | + */ | |
| 49 | 53 | const HINT: RenderInput<'PromptHint'> = { |
| 50 | 54 | component: 'PromptHint', |
| 51 | 55 | surface: 'terminal', |
| @@ -53,15 +57,17 @@ | ||
| 53 | 57 | viewport: { columns: 160, rows: 40 }, |
| 54 | 58 | props: { isDraft: false, isWorking: false, hint: '' }, |
| 55 | 59 | } |
| 60 | +/** | |
| 61 | + * What the engine draws for the hint, standing in beneath the plugin. | |
| 62 | + */ | |
| 56 | 63 | const HINT_DRAWN: RenderElement = { |
| 57 | 64 | type: 'Text', |
| 58 | 65 | children: ['? for shortcuts'], |
| 59 | 66 | } |
| 60 | 67 | |
| 61 | 68 | /** |
| 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. | |
| 65 | 71 | */ |
| 66 | 72 | const REPOSITORY: Readonly<Record<string, string>> = { |
| 67 | 73 | 'rev-parse --path-format=absolute': '/work\n/work/.git\n/work/.git\n', |
| @@ -71,6 +77,10 @@ | ||
| 71 | 77 | '-- app.ts': '@@ -1 +1 @@\n-const a = 1\n+const a = 2\n', |
| 72 | 78 | } |
| 73 | 79 | |
| 80 | +/** | |
| 81 | + * What git answers in that repository; an invocation it does not know | |
| 82 | + * fails as git does outside a repository. | |
| 83 | + */ | |
| 74 | 84 | function gitIn(argv: readonly string[]): ProcessRunResult { |
| 75 | 85 | const line = argv.join(' ') |
| 76 | 86 | const found = Object.entries(REPOSITORY).find(([key]) => line.includes(key)) |
| @@ -134,8 +144,8 @@ | ||
| 134 | 144 | await clock.advance(1000) |
| 135 | 145 | const [discovery, ...pinned] = world.runs |
| 136 | 146 | |
| 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() | |
| 139 | 149 | expect(pinned.length).toBeGreaterThan(0) |
| 140 | 150 | |
| 141 | 151 | for (const run of pinned) { |