feat(KB-617): add Changes tab to task detail modal with file diffs

- Add modifiedFiles and baseCommitSha fields to task schema for tracking changes
- Capture list of modified files during task execution in the executor
- Add GET /tasks/:id/diff API endpoint to retrieve file list and patches
- Create TaskChangesTab component with expandable file diffs
- Integrate Changes tab into TaskDetailModal for in-progress, in-review, and done tasks
- Add CSS styles for diff viewer with syntax highlighting
- Update API client with fetchTaskDiff function and Project Management types
This commit is contained in:
gsxdsm
2026-04-01 06:56:32 -07:00
parent 16c504228d
commit 08079da9ea
11 changed files with 561 additions and 55 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();