feat: add multi-run fusion and session change walkthroughs

Fuse two to five completed multi-run entries into one synthesized session,
and explain a session's diff as ordered walkthrough stops cached by diff hash.

- Multi-run fusion service, persistence, routes and FuseRunDialog
- Change walkthrough service, persistence, routes and ChangesWalkthroughDialog
- Shared unified-diff parser plus bounded text generation, json-extract,
  text-truncate and service-error helpers
This commit is contained in:
Chris Scott committed 2026-10-06 15:27:14 -04:00
1 parent 90c6ccf236
commit b36d412ca2
66 files changed
+6228 -468

No files matched your search

@@ -1,18 +1,15 @@
import { truncateText } from '../../utils/text-truncate'
export const MAX_COMMIT_PROMPT_DIFF_CHARS = 60_000
const COMMIT_PROMPT_DIFF_TRUNCATION_MARKER = '\n[diff truncated]'
export interface CommitMessageContext {
stagedStat: string
stagedDiff: string
recentSubjects: string[]
}
function truncateDiff(diff: string): string {
if (diff.length <= MAX_COMMIT_PROMPT_DIFF_CHARS) {
return diff
}
return `${diff.slice(0, MAX_COMMIT_PROMPT_DIFF_CHARS)}\n[diff truncated]`
}
export function buildCommitMessagePrompt({ stagedStat, stagedDiff, recentSubjects }: CommitMessageContext): string {
const subjects = recentSubjects.length > 0
? recentSubjects.map(subject => `- ${subject}`).join('\n')
@@ -31,7 +28,7 @@ export function buildCommitMessagePrompt({ stagedStat, stagedDiff, recentSubject
stagedStat.trim(),
'',
'Staged diff:',
truncateDiff(stagedDiff),
truncateText(stagedDiff, MAX_COMMIT_PROMPT_DIFF_CHARS, COMMIT_PROMPT_DIFF_TRUNCATION_MARKER).text,
].join('\n')
}