diff --git a/apps/server/db/repositories/drizzle/initiative.test.ts b/apps/server/db/repositories/drizzle/initiative.test.ts index 2d9fe32..3b2cf4a 100644 --- a/apps/server/db/repositories/drizzle/initiative.test.ts +++ b/apps/server/db/repositories/drizzle/initiative.test.ts @@ -147,4 +147,32 @@ describe('DrizzleInitiativeRepository', () => { expect(archived[0].name).toBe('Archived'); }); }); + + describe('qualityReview', () => { + it('defaults to false on create', async () => { + const initiative = await repo.create({ name: 'QR Test' }); + expect(initiative.qualityReview).toBe(false); + }); + + it('can be set to true via update', async () => { + const created = await repo.create({ name: 'QR Toggle' }); + const updated = await repo.update(created.id, { qualityReview: true }); + expect(updated.qualityReview).toBe(true); + }); + + it('round-trips through findById', async () => { + const created = await repo.create({ name: 'QR Round-trip' }); + await repo.update(created.id, { qualityReview: true }); + const found = await repo.findById(created.id); + expect(found!.qualityReview).toBe(true); + }); + + it('round-trips false value', async () => { + const created = await repo.create({ name: 'QR False' }); + await repo.update(created.id, { qualityReview: true }); + await repo.update(created.id, { qualityReview: false }); + const found = await repo.findById(created.id); + expect(found!.qualityReview).toBe(false); + }); + }); }); diff --git a/apps/server/db/repositories/drizzle/task.test.ts b/apps/server/db/repositories/drizzle/task.test.ts index 5f19065..1126e36 100644 --- a/apps/server/db/repositories/drizzle/task.test.ts +++ b/apps/server/db/repositories/drizzle/task.test.ts @@ -196,4 +196,38 @@ describe('DrizzleTaskRepository', () => { ); }); }); + + describe('quality_review status', () => { + it('can set status to quality_review', async () => { + const task = await taskRepo.create({ + phaseId: testPhaseId, + name: 'QR Status Task', + order: 99, + }); + const updated = await taskRepo.update(task.id, { status: 'quality_review' }); + expect(updated.status).toBe('quality_review'); + }); + + it('round-trips quality_review through findById', async () => { + const task = await taskRepo.create({ + phaseId: testPhaseId, + name: 'QR Round-trip Task', + order: 100, + }); + await taskRepo.update(task.id, { status: 'quality_review' }); + const found = await taskRepo.findById(task.id); + expect(found!.status).toBe('quality_review'); + }); + + it('can transition from quality_review to completed', async () => { + const task = await taskRepo.create({ + phaseId: testPhaseId, + name: 'QR to Completed', + order: 101, + }); + await taskRepo.update(task.id, { status: 'quality_review' }); + const completed = await taskRepo.update(task.id, { status: 'completed' }); + expect(completed.status).toBe('completed'); + }); + }); }); diff --git a/apps/server/db/schema.ts b/apps/server/db/schema.ts index ce35cec..c6cd84a 100644 --- a/apps/server/db/schema.ts +++ b/apps/server/db/schema.ts @@ -26,6 +26,7 @@ export const initiatives = sqliteTable('initiatives', { executionMode: text('execution_mode', { enum: ['yolo', 'review_per_phase'] }) .notNull() .default('review_per_phase'), + qualityReview: integer('quality_review', { mode: 'boolean' }).notNull().default(false), createdAt: integer('created_at', { mode: 'timestamp' }).notNull(), updatedAt: integer('updated_at', { mode: 'timestamp' }).notNull(), }); @@ -151,7 +152,7 @@ export const tasks = sqliteTable('tasks', { .notNull() .default('medium'), status: text('status', { - enum: ['pending', 'in_progress', 'completed', 'blocked'], + enum: ['pending', 'in_progress', 'quality_review', 'completed', 'blocked'], }) .notNull() .default('pending'), diff --git a/apps/server/drizzle/0037_worthless_princess_powerful.sql b/apps/server/drizzle/0037_worthless_princess_powerful.sql new file mode 100644 index 0000000..402633f --- /dev/null +++ b/apps/server/drizzle/0037_worthless_princess_powerful.sql @@ -0,0 +1 @@ +ALTER TABLE `initiatives` ADD `quality_review` integer DEFAULT false NOT NULL; \ No newline at end of file diff --git a/apps/server/drizzle/meta/0035_snapshot.json b/apps/server/drizzle/meta/0035_snapshot.json index d735a97..ace4c45 100644 --- a/apps/server/drizzle/meta/0035_snapshot.json +++ b/apps/server/drizzle/meta/0035_snapshot.json @@ -2,7 +2,7 @@ "version": "6", "dialect": "sqlite", "id": "c84e499f-7df8-4091-b2a5-6b12847898bd", - "prevId": "5fbe1151-1dfb-4b0c-a7fa-2177369543fd", + "prevId": "443071fe-31d6-498a-9f4a-4a3ff24a46fc", "tables": { "accounts": { "name": "accounts", @@ -238,6 +238,13 @@ "notNull": false, "autoincrement": false }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "exit_code": { "name": "exit_code", "type": "integer", diff --git a/apps/server/drizzle/meta/0036_snapshot.json b/apps/server/drizzle/meta/0037_snapshot.json similarity index 53% rename from apps/server/drizzle/meta/0036_snapshot.json rename to apps/server/drizzle/meta/0037_snapshot.json index f60484b..b710946 100644 --- a/apps/server/drizzle/meta/0036_snapshot.json +++ b/apps/server/drizzle/meta/0037_snapshot.json @@ -1,8 +1,8 @@ { - "id": "f85b9df3-dead-4c46-90ac-cf36bcaa6eb4", - "prevId": "c0b6d7d3-c9da-440a-9fb8-9dd88df5672a", "version": "6", "dialect": "sqlite", + "id": "ef1d4ce7-a9c4-4e86-9cac-2e9cbbd0e688", + "prevId": "c84e499f-7df8-4091-b2a5-6b12847898bd", "tables": { "accounts": { "name": "accounts", @@ -29,11 +29,18 @@ "autoincrement": false, "default": "'claude'" }, - "config_dir": { - "name": "config_dir", + "config_json": { + "name": "config_json", "type": "text", "primaryKey": false, - "notNull": true, + "notNull": false, + "autoincrement": false + }, + "credentials": { + "name": "credentials", + "type": "text", + "primaryKey": false, + "notNull": false, "autoincrement": false }, "is_exhausted": { @@ -87,6 +94,67 @@ "uniqueConstraints": {}, "checkConstraints": {} }, + "agent_log_chunks": { + "name": "agent_log_chunks", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "agent_name": { + "name": "agent_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "session_number": { + "name": "session_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "agent_log_chunks_agent_id_idx": { + "name": "agent_log_chunks_agent_id_idx", + "columns": [ + "agent_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, "agents": { "name": "agents", "columns": { @@ -170,6 +238,13 @@ "notNull": false, "autoincrement": false }, + "exit_code": { + "name": "exit_code", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "prompt": { "name": "prompt", "type": "text", @@ -211,6 +286,13 @@ "primaryKey": false, "notNull": true, "autoincrement": false + }, + "user_dismissed_at": { + "name": "user_dismissed_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false } }, "indexes": { @@ -226,41 +308,715 @@ "agents_task_id_tasks_id_fk": { "name": "agents_task_id_tasks_id_fk", "tableFrom": "agents", + "tableTo": "tasks", "columnsFrom": [ "task_id" ], - "tableTo": "tasks", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "set null" + "onDelete": "set null", + "onUpdate": "no action" }, "agents_initiative_id_initiatives_id_fk": { "name": "agents_initiative_id_initiatives_id_fk", "tableFrom": "agents", + "tableTo": "initiatives", "columnsFrom": [ "initiative_id" ], - "tableTo": "initiatives", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "set null" + "onDelete": "set null", + "onUpdate": "no action" }, "agents_account_id_accounts_id_fk": { "name": "agents_account_id_accounts_id_fk", "tableFrom": "agents", + "tableTo": "accounts", "columnsFrom": [ "account_id" ], - "tableTo": "accounts", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "set null" + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "change_set_entries": { + "name": "change_set_entries", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "change_set_id": { + "name": "change_set_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entity_type": { + "name": "entity_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entity_id": { + "name": "entity_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "previous_state": { + "name": "previous_state", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "new_state": { + "name": "new_state", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "change_set_entries_change_set_id_idx": { + "name": "change_set_entries_change_set_id_idx", + "columns": [ + "change_set_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "change_set_entries_change_set_id_change_sets_id_fk": { + "name": "change_set_entries_change_set_id_change_sets_id_fk", + "tableFrom": "change_set_entries", + "tableTo": "change_sets", + "columnsFrom": [ + "change_set_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "change_sets": { + "name": "change_sets", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "agent_name": { + "name": "agent_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "initiative_id": { + "name": "initiative_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "mode": { + "name": "mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'applied'" + }, + "reverted_at": { + "name": "reverted_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "change_sets_initiative_id_idx": { + "name": "change_sets_initiative_id_idx", + "columns": [ + "initiative_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "change_sets_agent_id_agents_id_fk": { + "name": "change_sets_agent_id_agents_id_fk", + "tableFrom": "change_sets", + "tableTo": "agents", + "columnsFrom": [ + "agent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "change_sets_initiative_id_initiatives_id_fk": { + "name": "change_sets_initiative_id_initiatives_id_fk", + "tableFrom": "change_sets", + "tableTo": "initiatives", + "columnsFrom": [ + "initiative_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "chat_messages": { + "name": "chat_messages", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "chat_session_id": { + "name": "chat_session_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "change_set_id": { + "name": "change_set_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "chat_messages_session_id_idx": { + "name": "chat_messages_session_id_idx", + "columns": [ + "chat_session_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "chat_messages_chat_session_id_chat_sessions_id_fk": { + "name": "chat_messages_chat_session_id_chat_sessions_id_fk", + "tableFrom": "chat_messages", + "tableTo": "chat_sessions", + "columnsFrom": [ + "chat_session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_messages_change_set_id_change_sets_id_fk": { + "name": "chat_messages_change_set_id_change_sets_id_fk", + "tableFrom": "chat_messages", + "tableTo": "change_sets", + "columnsFrom": [ + "change_set_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "chat_sessions": { + "name": "chat_sessions", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "target_type": { + "name": "target_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "initiative_id": { + "name": "initiative_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "chat_sessions_target_idx": { + "name": "chat_sessions_target_idx", + "columns": [ + "target_type", + "target_id" + ], + "isUnique": false + }, + "chat_sessions_initiative_id_idx": { + "name": "chat_sessions_initiative_id_idx", + "columns": [ + "initiative_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "chat_sessions_initiative_id_initiatives_id_fk": { + "name": "chat_sessions_initiative_id_initiatives_id_fk", + "tableFrom": "chat_sessions", + "tableTo": "initiatives", + "columnsFrom": [ + "initiative_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "chat_sessions_agent_id_agents_id_fk": { + "name": "chat_sessions_agent_id_agents_id_fk", + "tableFrom": "chat_sessions", + "tableTo": "agents", + "columnsFrom": [ + "agent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "conversations": { + "name": "conversations", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "from_agent_id": { + "name": "from_agent_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "to_agent_id": { + "name": "to_agent_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "initiative_id": { + "name": "initiative_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "phase_id": { + "name": "phase_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "task_id": { + "name": "task_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "question": { + "name": "question", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "answer": { + "name": "answer", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "conversations_to_agent_status_idx": { + "name": "conversations_to_agent_status_idx", + "columns": [ + "to_agent_id", + "status" + ], + "isUnique": false + }, + "conversations_from_agent_idx": { + "name": "conversations_from_agent_idx", + "columns": [ + "from_agent_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "conversations_from_agent_id_agents_id_fk": { + "name": "conversations_from_agent_id_agents_id_fk", + "tableFrom": "conversations", + "tableTo": "agents", + "columnsFrom": [ + "from_agent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "conversations_to_agent_id_agents_id_fk": { + "name": "conversations_to_agent_id_agents_id_fk", + "tableFrom": "conversations", + "tableTo": "agents", + "columnsFrom": [ + "to_agent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "conversations_initiative_id_initiatives_id_fk": { + "name": "conversations_initiative_id_initiatives_id_fk", + "tableFrom": "conversations", + "tableTo": "initiatives", + "columnsFrom": [ + "initiative_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "conversations_phase_id_phases_id_fk": { + "name": "conversations_phase_id_phases_id_fk", + "tableFrom": "conversations", + "tableTo": "phases", + "columnsFrom": [ + "phase_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "conversations_task_id_tasks_id_fk": { + "name": "conversations_task_id_tasks_id_fk", + "tableFrom": "conversations", + "tableTo": "tasks", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "errands": { + "name": "errands", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "branch": { + "name": "branch", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "base_branch": { + "name": "base_branch", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'main'" + }, + "agent_id": { + "name": "agent_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "project_id": { + "name": "project_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'active'" + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": { + "errands_agent_id_agents_id_fk": { + "name": "errands_agent_id_agents_id_fk", + "tableFrom": "errands", + "tableTo": "agents", + "columnsFrom": [ + "agent_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + }, + "errands_project_id_projects_id_fk": { + "name": "errands_project_id_projects_id_fk", + "tableFrom": "errands", + "tableTo": "projects", + "columnsFrom": [ + "project_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -313,28 +1069,28 @@ "initiative_projects_initiative_id_initiatives_id_fk": { "name": "initiative_projects_initiative_id_initiatives_id_fk", "tableFrom": "initiative_projects", + "tableTo": "initiatives", "columnsFrom": [ "initiative_id" ], - "tableTo": "initiatives", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "initiative_projects_project_id_projects_id_fk": { "name": "initiative_projects_project_id_projects_id_fk", "tableFrom": "initiative_projects", + "tableTo": "projects", "columnsFrom": [ "project_id" ], - "tableTo": "projects", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -358,13 +1114,6 @@ "notNull": true, "autoincrement": false }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, "status": { "name": "status", "type": "text", @@ -373,21 +1122,29 @@ "autoincrement": false, "default": "'active'" }, - "merge_requires_approval": { - "name": "merge_requires_approval", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": true - }, - "merge_target": { - "name": "merge_target", + "branch": { + "name": "branch", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, + "execution_mode": { + "name": "execution_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'review_per_phase'" + }, + "quality_review": { + "name": "quality_review", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, "created_at": { "name": "created_at", "type": "integer", @@ -505,41 +1262,41 @@ "messages_sender_id_agents_id_fk": { "name": "messages_sender_id_agents_id_fk", "tableFrom": "messages", + "tableTo": "agents", "columnsFrom": [ "sender_id" ], - "tableTo": "agents", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "set null" + "onDelete": "set null", + "onUpdate": "no action" }, "messages_recipient_id_agents_id_fk": { "name": "messages_recipient_id_agents_id_fk", "tableFrom": "messages", + "tableTo": "agents", "columnsFrom": [ "recipient_id" ], - "tableTo": "agents", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "set null" + "onDelete": "set null", + "onUpdate": "no action" }, "messages_parent_message_id_messages_id_fk": { "name": "messages_parent_message_id_messages_id_fk", "tableFrom": "messages", + "tableTo": "messages", "columnsFrom": [ "parent_message_id" ], - "tableTo": "messages", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "set null" + "onDelete": "set null", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -612,28 +1369,28 @@ "pages_initiative_id_initiatives_id_fk": { "name": "pages_initiative_id_initiatives_id_fk", "tableFrom": "pages", + "tableTo": "initiatives", "columnsFrom": [ "initiative_id" ], - "tableTo": "initiatives", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "pages_parent_page_id_pages_id_fk": { "name": "pages_parent_page_id_pages_id_fk", "tableFrom": "pages", + "tableTo": "pages", "columnsFrom": [ "parent_page_id" ], - "tableTo": "pages", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -677,28 +1434,28 @@ "phase_dependencies_phase_id_phases_id_fk": { "name": "phase_dependencies_phase_id_phases_id_fk", "tableFrom": "phase_dependencies", + "tableTo": "phases", "columnsFrom": [ "phase_id" ], - "tableTo": "phases", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "phase_dependencies_depends_on_phase_id_phases_id_fk": { "name": "phase_dependencies_depends_on_phase_id_phases_id_fk", "tableFrom": "phase_dependencies", + "tableTo": "phases", "columnsFrom": [ "depends_on_phase_id" ], - "tableTo": "phases", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -722,13 +1479,6 @@ "notNull": true, "autoincrement": false }, - "number": { - "name": "number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, "name": { "name": "name", "type": "text", @@ -736,8 +1486,8 @@ "notNull": true, "autoincrement": false }, - "description": { - "name": "description", + "content": { + "name": "content", "type": "text", "primaryKey": false, "notNull": false, @@ -751,6 +1501,13 @@ "autoincrement": false, "default": "'pending'" }, + "merge_base": { + "name": "merge_base", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "created_at": { "name": "created_at", "type": "integer", @@ -771,96 +1528,15 @@ "phases_initiative_id_initiatives_id_fk": { "name": "phases_initiative_id_initiatives_id_fk", "tableFrom": "phases", + "tableTo": "initiatives", "columnsFrom": [ "initiative_id" ], - "tableTo": "initiatives", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "checkConstraints": {} - }, - "plans": { - "name": "plans", - "columns": { - "id": { - "name": "id", - "type": "text", - "primaryKey": true, - "notNull": true, - "autoincrement": false - }, - "phase_id": { - "name": "phase_id", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "number": { - "name": "number", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, - "status": { - "name": "status", - "type": "text", - "primaryKey": false, - "notNull": true, - "autoincrement": false, - "default": "'pending'" - }, - "created_at": { - "name": "created_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - }, - "updated_at": { - "name": "updated_at", - "type": "integer", - "primaryKey": false, - "notNull": true, - "autoincrement": false - } - }, - "indexes": {}, - "foreignKeys": { - "plans_phase_id_phases_id_fk": { - "name": "plans_phase_id_phases_id_fk", - "tableFrom": "plans", - "columnsFrom": [ - "phase_id" - ], - "tableTo": "phases", - "columnsTo": [ - "id" - ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -891,6 +1567,21 @@ "notNull": true, "autoincrement": false }, + "default_branch": { + "name": "default_branch", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'main'" + }, + "last_fetched_at": { + "name": "last_fetched_at", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "created_at": { "name": "created_at", "type": "integer", @@ -927,6 +1618,137 @@ "uniqueConstraints": {}, "checkConstraints": {} }, + "review_comments": { + "name": "review_comments", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "phase_id": { + "name": "phase_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "file_path": { + "name": "file_path", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line_number": { + "name": "line_number", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line_type": { + "name": "line_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author": { + "name": "author", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'you'" + }, + "parent_comment_id": { + "name": "parent_comment_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resolved": { + "name": "resolved", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "review_comments_phase_id_idx": { + "name": "review_comments_phase_id_idx", + "columns": [ + "phase_id" + ], + "isUnique": false + }, + "review_comments_parent_id_idx": { + "name": "review_comments_parent_id_idx", + "columns": [ + "parent_comment_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "review_comments_phase_id_phases_id_fk": { + "name": "review_comments_phase_id_phases_id_fk", + "tableFrom": "review_comments", + "tableTo": "phases", + "columnsFrom": [ + "phase_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "review_comments_parent_comment_id_review_comments_id_fk": { + "name": "review_comments_parent_comment_id_review_comments_id_fk", + "tableFrom": "review_comments", + "tableTo": "review_comments", + "columnsFrom": [ + "parent_comment_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, "task_dependencies": { "name": "task_dependencies", "columns": { @@ -964,28 +1786,28 @@ "task_dependencies_task_id_tasks_id_fk": { "name": "task_dependencies_task_id_tasks_id_fk", "tableFrom": "task_dependencies", + "tableTo": "tasks", "columnsFrom": [ "task_id" ], - "tableTo": "tasks", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "task_dependencies_depends_on_task_id_tasks_id_fk": { "name": "task_dependencies_depends_on_task_id_tasks_id_fk", "tableFrom": "task_dependencies", + "tableTo": "tasks", "columnsFrom": [ "depends_on_task_id" ], - "tableTo": "tasks", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -1002,13 +1824,6 @@ "notNull": true, "autoincrement": false }, - "plan_id": { - "name": "plan_id", - "type": "text", - "primaryKey": false, - "notNull": false, - "autoincrement": false - }, "phase_id": { "name": "phase_id", "type": "text", @@ -1023,6 +1838,13 @@ "notNull": false, "autoincrement": false }, + "parent_task_id": { + "name": "parent_task_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, "name": { "name": "name", "type": "text", @@ -1069,15 +1891,23 @@ "autoincrement": false, "default": "'pending'" }, - "requires_approval": { - "name": "requires_approval", + "order": { + "name": "order", "type": "integer", "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, "notNull": false, "autoincrement": false }, - "order": { - "name": "order", + "retry_count": { + "name": "retry_count", "type": "integer", "primaryKey": false, "notNull": true, @@ -1101,44 +1931,44 @@ }, "indexes": {}, "foreignKeys": { - "tasks_plan_id_plans_id_fk": { - "name": "tasks_plan_id_plans_id_fk", - "tableFrom": "tasks", - "columnsFrom": [ - "plan_id" - ], - "tableTo": "plans", - "columnsTo": [ - "id" - ], - "onUpdate": "no action", - "onDelete": "cascade" - }, "tasks_phase_id_phases_id_fk": { "name": "tasks_phase_id_phases_id_fk", "tableFrom": "tasks", + "tableTo": "phases", "columnsFrom": [ "phase_id" ], - "tableTo": "phases", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" }, "tasks_initiative_id_initiatives_id_fk": { "name": "tasks_initiative_id_initiatives_id_fk", "tableFrom": "tasks", + "tableTo": "initiatives", "columnsFrom": [ "initiative_id" ], - "tableTo": "initiatives", "columnsTo": [ "id" ], - "onUpdate": "no action", - "onDelete": "cascade" + "onDelete": "cascade", + "onUpdate": "no action" + }, + "tasks_parent_task_id_tasks_id_fk": { + "name": "tasks_parent_task_id_tasks_id_fk", + "tableFrom": "tasks", + "tableTo": "tasks", + "columnsFrom": [ + "parent_task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" } }, "compositePrimaryKeys": {}, @@ -1149,9 +1979,9 @@ "views": {}, "enums": {}, "_meta": { - "columns": {}, "schemas": {}, - "tables": {} + "tables": {}, + "columns": {} }, "internal": { "indexes": {} diff --git a/apps/server/drizzle/meta/_journal.json b/apps/server/drizzle/meta/_journal.json index a58f2cf..1f15581 100644 --- a/apps/server/drizzle/meta/_journal.json +++ b/apps/server/drizzle/meta/_journal.json @@ -260,6 +260,13 @@ "when": 1772798869413, "tag": "0036_icy_silvermane", "breakpoints": true + }, + { + "idx": 37, + "version": "6", + "when": 1772829916655, + "tag": "0037_worthless_princess_powerful", + "breakpoints": true } ] -} +} \ No newline at end of file diff --git a/docs/database.md b/docs/database.md index 3d7ccd5..f877251 100644 --- a/docs/database.md +++ b/docs/database.md @@ -20,6 +20,8 @@ All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.r | name | text NOT NULL | | | status | text enum | 'active' \| 'pending_review' \| 'completed' \| 'archived', default 'active' | | branch | text nullable | auto-generated initiative branch (e.g., 'cw/user-auth') | +| executionMode | text enum | 'yolo' \| 'review_per_phase', default 'review_per_phase' | +| qualityReview | integer (boolean) | default false; flags initiative for quality review workflow | | createdAt, updatedAt | integer/timestamp | | ### phases @@ -48,7 +50,7 @@ All adapters use nanoid() for IDs, auto-manage timestamps, and use Drizzle's `.r | type | text enum | 'auto' | | category | text enum | 'execute' \| 'research' \| 'discuss' \| 'plan' \| 'detail' \| 'refine' \| 'verify' \| 'merge' \| 'review' | | priority | text enum | 'low' \| 'medium' \| 'high' | -| status | text enum | 'pending' \| 'in_progress' \| 'completed' \| 'blocked' | +| status | text enum | 'pending' \| 'in_progress' \| 'quality_review' \| 'completed' \| 'blocked' | | order | integer | default 0 | | summary | text nullable | Agent result summary — propagated to dependent tasks as context | | retryCount | integer NOT NULL | default 0, incremented on agent crash auto-retry, reset on manual retry |