feat(KB-617): add diff viewer tab to task detail modal

- Add modifiedFiles and baseCommitSha tracking during task execution
- Create GET /tasks/:id/diff API endpoint for file list and patches
- Build TaskChangesTab component with expandable file diffs
- Integrate Changes tab into TaskDetailModal for in-progress, in-review, and done tasks
- Add database columns and types for diff tracking
- Update executor to capture modified files during agent sessions
This commit is contained in:
gsxdsm
2026-03-31 23:31:04 -07:00
parent 7eca797c0f
commit e5c598122f
12 changed files with 386 additions and 28 deletions

View File

@@ -58,7 +58,7 @@ export function fromJson<T>(json: string | null | undefined): T | undefined {
// ── Schema Definition ────────────────────────────────────────────────
const SCHEMA_VERSION = 3;
const SCHEMA_VERSION = 4;
const SCHEMA_SQL = `
-- Tasks table with JSON columns for nested data
@@ -75,6 +75,7 @@ CREATE TABLE IF NOT EXISTS tasks (
blockedBy TEXT,
paused INTEGER DEFAULT 0,
baseBranch TEXT,
baseCommitSha TEXT,
modelPresetId TEXT,
modelProvider TEXT,
modelId TEXT,
@@ -99,7 +100,8 @@ CREATE TABLE IF NOT EXISTS tasks (
issueInfo TEXT,
mergeDetails TEXT,
breakIntoSubtasks INTEGER DEFAULT 0,
enabledWorkflowSteps TEXT DEFAULT '[]'
enabledWorkflowSteps TEXT DEFAULT '[]',
modifiedFiles TEXT DEFAULT '[]'
);
-- Config table (single row with project settings)
@@ -322,6 +324,15 @@ export class Database {
});
}
if (version < 4) {
this.applyMigration(4, () => {
// Add modifiedFiles column to track files changed during agent execution
this.addColumnIfMissing("tasks", "modifiedFiles", "TEXT DEFAULT '[]'");
// Add baseCommitSha column to store the base commit for diff computation
this.addColumnIfMissing("tasks", "baseCommitSha", "TEXT");
});
}
// Future migrations go here:
// if (version < 3) { this.applyMigration(3, () => { ... }); }
}