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 aefb2cdb89
commit e25a89c971
12 changed files with 386 additions and 28 deletions

View File

@@ -86,7 +86,7 @@ describe("Database", () => {
});
it("seeds schema version", () => {
expect(db.getSchemaVersion()).toBe(3);
expect(db.getSchemaVersion()).toBe(4);
});
it("seeds lastModified", () => {
@@ -109,7 +109,7 @@ describe("Database", () => {
it("is idempotent - calling init() twice does not fail", () => {
expect(() => db.init()).not.toThrow();
expect(db.getSchemaVersion()).toBe(3);
expect(db.getSchemaVersion()).toBe(4);
});
it("does not overwrite existing config on re-init", () => {
@@ -683,8 +683,8 @@ describe("schema migrations", () => {
// Now run init() which should trigger migration
db.init();
// Verify version bumped to 3 (includes both v1→v2 and v2→v3 migrations)
expect(db.getSchemaVersion()).toBe(3);
// Verify version bumped to 4 (includes v1→v2, v2→v3, and v3→v4 migrations)
expect(db.getSchemaVersion()).toBe(4);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -709,11 +709,11 @@ describe("schema migrations", () => {
const db = new Database(kbDir);
db.init();
expect(db.getSchemaVersion()).toBe(3);
expect(db.getSchemaVersion()).toBe(4);
// Re-init should not fail
db.init();
expect(db.getSchemaVersion()).toBe(3);
expect(db.getSchemaVersion()).toBe(4);
db.close();
});
@@ -804,11 +804,11 @@ describe("schema migrations", () => {
// Insert a task on the v2 schema
db.exec(`INSERT INTO tasks (id, description, "column", createdAt, updatedAt) VALUES ('KB-2', 'test v2', 'triage', '2025-01-01', '2025-01-01')`);
// Now run init() which should trigger v2→v3 migration
// Now run init() which should trigger migrations v2→v3→v4
db.init();
// Verify version bumped to 3
expect(db.getSchemaVersion()).toBe(3);
// Verify version bumped to 4
expect(db.getSchemaVersion()).toBe(4);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -864,7 +864,7 @@ describe("createDatabase factory", () => {
const db = createDatabase(kbDir);
db.init();
expect(db.getSchemaVersion()).toBe(3);
expect(db.getSchemaVersion()).toBe(4);
expect(db.getLastModified()).toBeGreaterThan(0);
db.close();