diff --git a/.claude/sessions/2026-04-06.md b/.claude/sessions/2026-04-06.md index a6aae3d..b106ed7 100644 --- a/.claude/sessions/2026-04-06.md +++ b/.claude/sessions/2026-04-06.md @@ -123,4 +123,46 @@ Also raised: repopulating history from `history.jsonl` on startup (currently the loaded by `ConversationHistory` at construction time but the full history is displayed as just the raw message count — the user wants the previous conversation visible in the TUI). -SOLID discussion in progress — see conversation for analysis. +SOLID discussion complete — see conversation for full analysis. + +--- + +## Session continuation 2 (same day, later still) + +### Architecture refactor plan finalised and merged (PR #182) + +Full plan at `.claude/plans/architecture-refactor.md`. Key points: +- 13 substeps (1a–1b, 2, 3a–3c, 4a–4b, 5a–5e), each independently shippable +- CLI+SDK works at every commit; rollback cost is always one step +- CommandMode (5d) was added as a missing step; ScreenCoordinator becomes 5e +- Vitest prereq removed — already present in the monorepo +- CLAUDE.md updated to reference plan; corruption in architecture table fixed + +### Pairing ground rules established +- Do NOT use this CLI session to test — risk of corrupting history or breaking the session +- Testing: unit tests first, manual testing in a separate terminal with a separate session +- Pair programming: Stephen navigates, Claude drives; either can call a switch +- When ready to test manually, Claude gives an explicit prompt to run in a new terminal + +### Test conventions (from ~/.claude/skills/tdd/SKILL.md) +- Files: `src/` for source, `test/*.spec.ts` for tests +- Pattern: `const expected = ...; const actual = ...; expect(actual).toBe(expected)` +- One assertion per `it`, group with `describe` +- Existing `ConversationHistory.spec.ts` tests will be rewritten to this convention + when migrated to `Conversation.spec.ts` + +### Upcoming features considered for extensibility +- #179/#97/#96: conversation history as data, separate from display/navigation — + ConversationDisplay should expose sealed blocks as queryable. Plan already handles this. +- #178: file modification reminders — tool/CLI concern, hooks into FS/Exec tools, + injects into messages. AgentLoop needs a `beforeTurn` hook slot (leave the seam). +- #128/#130: keybind config — easy after TerminalEditor extraction; design key + mapping as a data structure in step 3b, not a switch. + +### State at compact +- Branch: `main`, clean, up to date (`185a4c0`) +- **Next: step 1a** — split `Conversation` (pure data) from `ConversationStore` (file I/O) + - Branch off main: `feature/conversation-split` + - Existing `ConversationHistory.spec.ts` tests become the spec for `Conversation` + - Rewrite tests to follow convention, then migrate implementation + - `AgentRun` receives `Conversation`; `AnthropicAgent` creates both diff --git a/apps/claude-sdk-cli/src/AppLayout.ts b/apps/claude-sdk-cli/src/AppLayout.ts index 721d1a8..4b507ef 100644 --- a/apps/claude-sdk-cli/src/AppLayout.ts +++ b/apps/claude-sdk-cli/src/AppLayout.ts @@ -169,6 +169,12 @@ export class AppLayout implements Disposable { this.render(); } + /** Push a sealed meta block at startup so version info appears before the first prompt. */ + public showStartupBanner(text: string): void { + this.#sealedBlocks.push({ type: 'meta', content: text }); + this.render(); + } + public exit(): void { this.#cleanupResize(); this.#screen.exitAltBuffer(); diff --git a/apps/claude-sdk-cli/src/entry/main.ts b/apps/claude-sdk-cli/src/entry/main.ts index e217048..d8935b7 100644 --- a/apps/claude-sdk-cli/src/entry/main.ts +++ b/apps/claude-sdk-cli/src/entry/main.ts @@ -2,7 +2,7 @@ import { parseArgs } from 'node:util'; import { AnthropicAuth, createAnthropicAgent } from '@shellicar/claude-sdk'; import { RefStore } from '@shellicar/claude-sdk-tools/RefStore'; import { AppLayout } from '../AppLayout.js'; -import { printUsage, printVersion, printVersionInfo } from '../help.js'; +import { printUsage, printVersion, printVersionInfo, startupBannerText } from '../help.js'; import { logger } from '../logger.js'; import { ReadLine } from '../ReadLine.js'; import { runAgent } from '../runAgent.js'; @@ -61,6 +61,7 @@ const main = async () => { rl.setLayout(layout); layout.enter(); + layout.showStartupBanner(startupBannerText()); const agent = createAnthropicAgent({ authToken, logger, historyFile: HISTORY_FILE }); const store = new RefStore(); diff --git a/apps/claude-sdk-cli/src/help.ts b/apps/claude-sdk-cli/src/help.ts index 00656df..b898041 100644 --- a/apps/claude-sdk-cli/src/help.ts +++ b/apps/claude-sdk-cli/src/help.ts @@ -15,6 +15,10 @@ export function printVersionInfo(log: Log): void { log(` buildDate: ${versionInfo.buildDate}`); } +export function startupBannerText(): string { + return `claude-sdk-cli ${versionInfo.version} · build ${versionInfo.buildDate}`; +} + export function printUsage(log: Log): void { log(`claude-sdk-cli ${versionInfo.version}`); log('');