@proletariat/cli 0.3.16 → 0.3.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/action/create.d.ts +1 -0
- package/dist/commands/action/create.js +74 -38
- package/dist/commands/action/delete.d.ts +1 -0
- package/dist/commands/action/delete.js +23 -24
- package/dist/commands/action/index.d.ts +1 -0
- package/dist/commands/action/index.js +5 -10
- package/dist/commands/action/list.d.ts +1 -0
- package/dist/commands/action/list.js +3 -1
- package/dist/commands/action/run.d.ts +1 -0
- package/dist/commands/action/run.js +44 -32
- package/dist/commands/action/show.d.ts +2 -0
- package/dist/commands/action/update.d.ts +1 -0
- package/dist/commands/action/update.js +80 -39
- package/dist/commands/agent/auth.d.ts +2 -0
- package/dist/commands/agent/auth.js +44 -3
- package/dist/commands/agent/discover.d.ts +2 -0
- package/dist/commands/agent/discover.js +35 -3
- package/dist/commands/agent/index.d.ts +1 -0
- package/dist/commands/agent/index.js +25 -45
- package/dist/commands/agent/list.d.ts +8 -3
- package/dist/commands/agent/list.js +16 -29
- package/dist/commands/agent/login.d.ts +1 -0
- package/dist/commands/agent/login.js +14 -32
- package/dist/commands/agent/rebuild.d.ts +1 -0
- package/dist/commands/agent/rebuild.js +2 -2
- package/dist/commands/agent/remove.d.ts +17 -0
- package/dist/commands/agent/remove.js +144 -0
- package/dist/commands/agent/restart.d.ts +1 -0
- package/dist/commands/agent/restart.js +2 -2
- package/dist/commands/agent/shell.d.ts +1 -0
- package/dist/commands/agent/shell.js +63 -76
- package/dist/commands/agent/staff/add.d.ts +1 -0
- package/dist/commands/agent/staff/add.js +7 -1
- package/dist/commands/agent/staff/index.d.ts +1 -0
- package/dist/commands/agent/staff/index.js +5 -4
- package/dist/commands/agent/staff/remove.d.ts +1 -0
- package/dist/commands/agent/status.d.ts +1 -0
- package/dist/commands/agent/status.js +11 -23
- package/dist/commands/agent/temp/cleanup.d.ts +1 -0
- package/dist/commands/agent/temp/index.d.ts +1 -0
- package/dist/commands/agent/temp/index.js +4 -3
- package/dist/commands/agent/themes/index.d.ts +1 -0
- package/dist/commands/agent/themes/index.js +9 -3
- package/dist/commands/agent/themes/set.d.ts +1 -0
- package/dist/commands/agent/themes/set.js +7 -1
- package/dist/commands/agent/visit.d.ts +1 -0
- package/dist/commands/agent/visit.js +11 -23
- package/dist/commands/autocomplete/setup.d.ts +11 -0
- package/dist/commands/autocomplete/setup.js +113 -8
- package/dist/commands/board/index.d.ts +4 -0
- package/dist/commands/board/index.js +32 -30
- package/dist/commands/board/watch.d.ts +2 -0
- package/dist/commands/branch/create.d.ts +1 -0
- package/dist/commands/branch/create.js +33 -41
- package/dist/commands/branch/index.d.ts +1 -0
- package/dist/commands/branch/list.d.ts +2 -0
- package/dist/commands/branch/validate.d.ts +2 -0
- package/dist/commands/branch/where.d.ts +1 -0
- package/dist/commands/claude.d.ts +6 -0
- package/dist/commands/claude.js +166 -116
- package/dist/commands/commit.d.ts +6 -0
- package/dist/commands/commit.js +68 -73
- package/dist/commands/config/index.d.ts +13 -0
- package/dist/commands/config/index.js +142 -98
- package/dist/commands/docker/clean.d.ts +2 -1
- package/dist/commands/docker/clean.js +20 -29
- package/dist/commands/docker/index.d.ts +1 -0
- package/dist/commands/docker/index.js +37 -41
- package/dist/commands/docker/prune.d.ts +2 -1
- package/dist/commands/docker/prune.js +20 -27
- package/dist/commands/docker/restart.d.ts +2 -1
- package/dist/commands/docker/restart.js +20 -29
- package/dist/commands/docker/stop.d.ts +2 -1
- package/dist/commands/docker/stop.js +20 -29
- package/dist/commands/epic/activate.d.ts +1 -0
- package/dist/commands/epic/archive.d.ts +1 -0
- package/dist/commands/epic/create.d.ts +1 -0
- package/dist/commands/epic/index.d.ts +1 -0
- package/dist/commands/epic/link/block.d.ts +1 -0
- package/dist/commands/epic/link/duplicates.d.ts +1 -0
- package/dist/commands/epic/link/index.d.ts +1 -0
- package/dist/commands/epic/link/relates.d.ts +1 -0
- package/dist/commands/epic/link/remove.d.ts +1 -0
- package/dist/commands/epic/list.d.ts +2 -0
- package/dist/commands/epic/move.d.ts +1 -0
- package/dist/commands/epic/progress.d.ts +1 -0
- package/dist/commands/epic/project.d.ts +1 -0
- package/dist/commands/epic/reorder.d.ts +1 -0
- package/dist/commands/epic/spec.d.ts +1 -0
- package/dist/commands/epic/ticket.d.ts +1 -0
- package/dist/commands/epic/view.d.ts +1 -0
- package/dist/commands/execution/index.d.ts +1 -0
- package/dist/commands/execution/index.js +9 -25
- package/dist/commands/execution/list.d.ts +2 -0
- package/dist/commands/execution/logs.d.ts +1 -0
- package/dist/commands/execution/logs.js +6 -16
- package/dist/commands/execution/stop.d.ts +1 -0
- package/dist/commands/execution/stop.js +4 -15
- package/dist/commands/gh/index.d.ts +1 -0
- package/dist/commands/gh/index.js +27 -27
- package/dist/commands/gh/login.d.ts +4 -0
- package/dist/commands/gh/login.js +31 -0
- package/dist/commands/gh/status.d.ts +4 -0
- package/dist/commands/gh/status.js +27 -4
- package/dist/commands/gh/token.d.ts +4 -0
- package/dist/commands/gh/token.js +49 -5
- package/dist/commands/phase/create.d.ts +1 -1
- package/dist/commands/phase/create.js +116 -74
- package/dist/commands/phase/delete.d.ts +1 -0
- package/dist/commands/phase/delete.js +23 -22
- package/dist/commands/phase/list.d.ts +1 -0
- package/dist/commands/phase/list.js +3 -5
- package/dist/commands/phase/move.d.ts +1 -0
- package/dist/commands/phase/move.js +39 -39
- package/dist/commands/phase/template/apply.d.ts +1 -0
- package/dist/commands/phase/template/create.d.ts +2 -0
- package/dist/commands/phase/template/delete.d.ts +1 -0
- package/dist/commands/phase/template/index.d.ts +1 -0
- package/dist/commands/phase/template/list.d.ts +1 -0
- package/dist/commands/phase/template/update.d.ts +2 -0
- package/dist/commands/phase/update.d.ts +1 -1
- package/dist/commands/phase/update.js +89 -55
- package/dist/commands/pmo/init.d.ts +2 -0
- package/dist/commands/pmo/init.js +84 -22
- package/dist/commands/pr/create.d.ts +12 -3
- package/dist/commands/pr/create.js +130 -147
- package/dist/commands/pr/index.d.ts +6 -3
- package/dist/commands/pr/index.js +41 -39
- package/dist/commands/pr/link.d.ts +7 -3
- package/dist/commands/pr/link.js +126 -150
- package/dist/commands/pr/status.d.ts +6 -3
- package/dist/commands/pr/status.js +101 -126
- package/dist/commands/project/archive.d.ts +1 -0
- package/dist/commands/project/archive.js +15 -20
- package/dist/commands/project/create.d.ts +1 -0
- package/dist/commands/project/create.js +13 -5
- package/dist/commands/project/delete.d.ts +1 -0
- package/dist/commands/project/delete.js +14 -28
- package/dist/commands/project/index.d.ts +1 -0
- package/dist/commands/project/index.js +0 -5
- package/dist/commands/project/list.d.ts +2 -0
- package/dist/commands/project/list.js +21 -3
- package/dist/commands/project/spec.d.ts +1 -0
- package/dist/commands/project/spec.js +17 -23
- package/dist/commands/project/unarchive.d.ts +2 -0
- package/dist/commands/project/unarchive.js +21 -2
- package/dist/commands/project/view.d.ts +1 -0
- package/dist/commands/project/view.js +34 -22
- package/dist/commands/repo/add.d.ts +2 -0
- package/dist/commands/repo/add.js +44 -1
- package/dist/commands/repo/index.d.ts +1 -0
- package/dist/commands/repo/index.js +20 -38
- package/dist/commands/repo/list.d.ts +2 -0
- package/dist/commands/repo/remove.d.ts +1 -0
- package/dist/commands/repo/remove.js +45 -63
- package/dist/commands/repo/view.d.ts +2 -0
- package/dist/commands/repo/view.js +30 -5
- package/dist/commands/roadmap/add-project.d.ts +1 -0
- package/dist/commands/roadmap/create.d.ts +1 -0
- package/dist/commands/roadmap/delete.d.ts +1 -0
- package/dist/commands/roadmap/generate.d.ts +1 -0
- package/dist/commands/roadmap/index.d.ts +1 -0
- package/dist/commands/roadmap/list.d.ts +2 -0
- package/dist/commands/roadmap/remove-project.d.ts +1 -0
- package/dist/commands/roadmap/reorder.d.ts +1 -0
- package/dist/commands/roadmap/update.d.ts +1 -0
- package/dist/commands/roadmap/view.d.ts +1 -0
- package/dist/commands/session/attach.d.ts +1 -0
- package/dist/commands/session/index.d.ts +1 -0
- package/dist/commands/session/index.js +8 -25
- package/dist/commands/session/list.d.ts +2 -0
- package/dist/commands/spec/create.d.ts +1 -1
- package/dist/commands/spec/create.js +64 -65
- package/dist/commands/spec/index.d.ts +1 -0
- package/dist/commands/spec/index.js +36 -22
- package/dist/commands/spec/link/depends.d.ts +1 -0
- package/dist/commands/spec/link/depends.js +6 -6
- package/dist/commands/spec/link/duplicates.d.ts +1 -0
- package/dist/commands/spec/link/duplicates.js +6 -6
- package/dist/commands/spec/link/index.d.ts +2 -1
- package/dist/commands/spec/link/index.js +0 -4
- package/dist/commands/spec/link/relates.d.ts +1 -0
- package/dist/commands/spec/link/relates.js +6 -6
- package/dist/commands/spec/link/remove.d.ts +2 -1
- package/dist/commands/spec/link/remove.js +6 -6
- package/dist/commands/spec/list.d.ts +2 -0
- package/dist/commands/spec/list.js +25 -0
- package/dist/commands/spec/plan.d.ts +2 -1
- package/dist/commands/spec/plan.js +19 -26
- package/dist/commands/spec/ticket.d.ts +2 -1
- package/dist/commands/spec/ticket.js +48 -34
- package/dist/commands/spec/view.d.ts +2 -1
- package/dist/commands/spec/view.js +25 -16
- package/dist/commands/status/create.d.ts +1 -1
- package/dist/commands/status/create.js +80 -64
- package/dist/commands/status/delete.d.ts +2 -1
- package/dist/commands/status/delete.js +26 -22
- package/dist/commands/status/index.d.ts +1 -0
- package/dist/commands/status/index.js +26 -19
- package/dist/commands/status/list.d.ts +1 -0
- package/dist/commands/status/list.js +12 -7
- package/dist/commands/status/move.d.ts +2 -1
- package/dist/commands/status/move.js +62 -61
- package/dist/commands/status/update.d.ts +2 -2
- package/dist/commands/status/update.js +110 -77
- package/dist/commands/template/delete.d.ts +1 -0
- package/dist/commands/template/delete.js +47 -48
- package/dist/commands/template/index.d.ts +1 -0
- package/dist/commands/template/index.js +26 -33
- package/dist/commands/template/list.d.ts +1 -0
- package/dist/commands/template/phase/create.d.ts +1 -0
- package/dist/commands/template/phase/create.js +6 -0
- package/dist/commands/template/phase/index.d.ts +1 -0
- package/dist/commands/template/phase/index.js +27 -26
- package/dist/commands/template/phase/update.d.ts +1 -0
- package/dist/commands/template/phase/update.js +6 -0
- package/dist/commands/template/ticket/index.d.ts +1 -0
- package/dist/commands/template/ticket/index.js +27 -26
- package/dist/commands/template/ticket/save.d.ts +1 -0
- package/dist/commands/template/ticket/save.js +6 -0
- package/dist/commands/terminal/title.d.ts +26 -0
- package/dist/commands/terminal/title.js +37 -3
- package/dist/commands/ticket/bulk.d.ts +1 -0
- package/dist/commands/ticket/complete.d.ts +1 -0
- package/dist/commands/ticket/complete.js +18 -14
- package/dist/commands/ticket/create.d.ts +1 -0
- package/dist/commands/ticket/create.js +45 -41
- package/dist/commands/ticket/delete.d.ts +1 -0
- package/dist/commands/ticket/delete.js +1 -1
- package/dist/commands/ticket/edit.d.ts +1 -0
- package/dist/commands/ticket/edit.js +1 -1
- package/dist/commands/ticket/epic.d.ts +1 -0
- package/dist/commands/ticket/epic.js +2 -2
- package/dist/commands/ticket/index.d.ts +1 -0
- package/dist/commands/ticket/link/block.d.ts +1 -0
- package/dist/commands/ticket/link/block.js +1 -1
- package/dist/commands/ticket/link/duplicates.d.ts +1 -0
- package/dist/commands/ticket/link/duplicates.js +1 -1
- package/dist/commands/ticket/link/index.d.ts +1 -0
- package/dist/commands/ticket/link/index.js +9 -8
- package/dist/commands/ticket/link/relates.d.ts +1 -0
- package/dist/commands/ticket/link/relates.js +1 -1
- package/dist/commands/ticket/link/remove.d.ts +1 -0
- package/dist/commands/ticket/link/remove.js +1 -1
- package/dist/commands/ticket/list.d.ts +2 -0
- package/dist/commands/ticket/move.d.ts +1 -0
- package/dist/commands/ticket/move.js +27 -19
- package/dist/commands/ticket/project.d.ts +1 -0
- package/dist/commands/ticket/project.js +3 -3
- package/dist/commands/ticket/reassign.d.ts +1 -0
- package/dist/commands/ticket/reassign.js +1 -1
- package/dist/commands/ticket/spec.d.ts +1 -0
- package/dist/commands/ticket/spec.js +3 -3
- package/dist/commands/ticket/status.d.ts +1 -0
- package/dist/commands/ticket/status.js +1 -1
- package/dist/commands/ticket/template/apply.d.ts +1 -0
- package/dist/commands/ticket/template/create.d.ts +2 -0
- package/dist/commands/ticket/template/delete.d.ts +1 -0
- package/dist/commands/ticket/template/index.d.ts +1 -0
- package/dist/commands/ticket/template/list.d.ts +1 -0
- package/dist/commands/ticket/template/save.d.ts +2 -0
- package/dist/commands/ticket/update.d.ts +1 -0
- package/dist/commands/ticket/update.js +1 -1
- package/dist/commands/ticket/view.d.ts +1 -0
- package/dist/commands/ticket/view.js +1 -1
- package/dist/commands/work/complete.d.ts +1 -0
- package/dist/commands/work/index.d.ts +1 -0
- package/dist/commands/work/ready.d.ts +1 -0
- package/dist/commands/work/revise.d.ts +1 -0
- package/dist/commands/work/spawn-all.d.ts +2 -0
- package/dist/commands/work/spawn-all.js +11 -4
- package/dist/commands/work/spawn.d.ts +1 -0
- package/dist/commands/work/spawn.js +261 -166
- package/dist/commands/work/start.d.ts +1 -0
- package/dist/commands/work/start.js +270 -189
- package/dist/commands/work/watch.d.ts +1 -0
- package/dist/commands/work/watch.js +63 -58
- package/dist/commands/workflow/create.d.ts +1 -0
- package/dist/commands/workflow/create.js +2 -4
- package/dist/commands/workflow/delete.d.ts +1 -0
- package/dist/commands/workflow/delete.js +21 -33
- package/dist/commands/workflow/index.d.ts +1 -0
- package/dist/commands/workflow/list.d.ts +1 -0
- package/dist/commands/workflow/list.js +3 -6
- package/dist/commands/workflow/switch.d.ts +2 -0
- package/dist/commands/workflow/switch.js +46 -21
- package/dist/commands/workflow/view.d.ts +1 -0
- package/dist/commands/workflow/view.js +18 -27
- package/dist/commands/workspace/remove.d.ts +2 -2
- package/dist/commands/workspace/remove.js +16 -21
- package/dist/commands/workspace/use.d.ts +2 -2
- package/dist/commands/workspace/use.js +12 -18
- package/dist/lib/agents/commands.d.ts +1 -1
- package/dist/lib/agents/commands.js +4 -4
- package/dist/lib/database/drizzle-schema.d.ts +5009 -0
- package/dist/lib/database/drizzle-schema.js +699 -0
- package/dist/lib/database/drizzle.d.ts +29 -0
- package/dist/lib/database/drizzle.js +37 -0
- package/dist/lib/database/index.d.ts +1 -0
- package/dist/lib/database/index.js +1 -1
- package/dist/lib/execution/config.d.ts +6 -0
- package/dist/lib/execution/config.js +31 -13
- package/dist/lib/execution/devcontainer.js +13 -7
- package/dist/lib/execution/runners.js +24 -7
- package/dist/lib/execution/spawner.js +19 -0
- package/dist/lib/flags/index.d.ts +4 -0
- package/dist/lib/flags/index.js +4 -0
- package/dist/lib/flags/resolver.d.ts +224 -0
- package/dist/lib/flags/resolver.js +313 -0
- package/dist/lib/pmo/base-command.d.ts +53 -3
- package/dist/lib/pmo/base-command.js +92 -13
- package/dist/lib/pmo/find-pmo.d.ts +1 -1
- package/dist/lib/pmo/find-pmo.js +4 -4
- package/dist/lib/pmo/index.d.ts +1 -1
- package/dist/lib/pmo/index.js +1 -1
- package/dist/lib/pmo/storage/helpers.js +2 -1
- package/dist/lib/pmo/storage/index.d.ts +9 -0
- package/dist/lib/pmo/storage/index.js +14 -0
- package/dist/lib/pmo/storage/projects.d.ts +28 -13
- package/dist/lib/pmo/storage/projects.js +110 -34
- package/dist/lib/pmo/storage/roadmaps.d.ts +2 -0
- package/dist/lib/pmo/storage/roadmaps.js +182 -111
- package/dist/lib/pmo/storage/specs.js +13 -16
- package/dist/lib/pmo/storage/subtasks.js +17 -2
- package/dist/lib/pmo/storage/tickets.d.ts +12 -2
- package/dist/lib/pmo/storage/tickets.js +63 -5
- package/dist/lib/pmo/storage/types.d.ts +7 -3
- package/dist/lib/pmo/storage/views.d.ts +12 -1
- package/dist/lib/pmo/storage/views.js +61 -6
- package/dist/lib/prompt-command.d.ts +90 -0
- package/dist/lib/prompt-command.js +102 -0
- package/dist/lib/prompt-json.d.ts +34 -4
- package/dist/lib/prompt-json.js +35 -3
- package/dist/lib/repos/index.js +15 -15
- package/dist/lib/workspace.d.ts +4 -3
- package/dist/lib/workspace.js +3 -3
- package/oclif.manifest.json +4610 -2997
- package/package.json +13 -5
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drizzle ORM Schema Definitions
|
|
3
|
+
*
|
|
4
|
+
* This file defines all database tables using Drizzle ORM for type-safe queries.
|
|
5
|
+
* It serves as the single source of truth for the database schema.
|
|
6
|
+
*/
|
|
7
|
+
import { sqliteTable, text, integer, primaryKey, index, unique } from 'drizzle-orm/sqlite-core';
|
|
8
|
+
import { relations, sql } from 'drizzle-orm';
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// Core Workspace Tables
|
|
11
|
+
// =============================================================================
|
|
12
|
+
/**
|
|
13
|
+
* Workspace metadata - single row table
|
|
14
|
+
*/
|
|
15
|
+
export const workspace = sqliteTable('workspace', {
|
|
16
|
+
id: integer('id').primaryKey().$default(() => 1),
|
|
17
|
+
type: text('type', { enum: ['hq', 'workspace'] }).notNull(),
|
|
18
|
+
workspaceName: text('workspace_name').notNull(),
|
|
19
|
+
hasPmo: integer('has_pmo', { mode: 'boolean' }).default(false),
|
|
20
|
+
activeThemeId: text('active_theme_id'),
|
|
21
|
+
createdAt: text('created_at').notNull(),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Repository management
|
|
25
|
+
*/
|
|
26
|
+
export const repositories = sqliteTable('repositories', {
|
|
27
|
+
name: text('name').primaryKey(),
|
|
28
|
+
path: text('path').notNull(),
|
|
29
|
+
type: text('type', { enum: ['main', 'dependency'] }).default('main'),
|
|
30
|
+
sourceUrl: text('source_url'),
|
|
31
|
+
action: text('action', { enum: ['clone', 'move', 'link'] }),
|
|
32
|
+
addedAt: text('added_at').notNull(),
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Agent naming themes
|
|
36
|
+
*/
|
|
37
|
+
export const agentThemes = sqliteTable('agent_themes', {
|
|
38
|
+
id: text('id').primaryKey(),
|
|
39
|
+
name: text('name').notNull().unique(),
|
|
40
|
+
displayName: text('display_name').notNull(),
|
|
41
|
+
description: text('description'),
|
|
42
|
+
builtin: integer('builtin', { mode: 'boolean' }).default(false),
|
|
43
|
+
createdAt: text('created_at').notNull(),
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Names available within each theme
|
|
47
|
+
*/
|
|
48
|
+
export const agentThemeNames = sqliteTable('agent_theme_names', {
|
|
49
|
+
themeId: text('theme_id').notNull(),
|
|
50
|
+
name: text('name').notNull(),
|
|
51
|
+
}, (table) => ({
|
|
52
|
+
pk: primaryKey({ columns: [table.themeId, table.name] }),
|
|
53
|
+
idxTheme: index('idx_theme_names_theme').on(table.themeId),
|
|
54
|
+
}));
|
|
55
|
+
/**
|
|
56
|
+
* Agent instances in workspace
|
|
57
|
+
*/
|
|
58
|
+
export const agents = sqliteTable('agents', {
|
|
59
|
+
name: text('name').primaryKey(),
|
|
60
|
+
type: text('type', { enum: ['persistent', 'ephemeral'] }).notNull().default('persistent'),
|
|
61
|
+
status: text('status', { enum: ['active', 'cleaned'] }).notNull().default('active'),
|
|
62
|
+
baseName: text('base_name'),
|
|
63
|
+
themeId: text('theme_id'),
|
|
64
|
+
worktreePath: text('worktree_path'),
|
|
65
|
+
mountMode: text('mount_mode', { enum: ['worktree', 'clone'] }).notNull().default('worktree'),
|
|
66
|
+
createdAt: text('created_at').notNull(),
|
|
67
|
+
cleanedAt: text('cleaned_at'),
|
|
68
|
+
}, (table) => ({
|
|
69
|
+
idxTheme: index('idx_agents_theme').on(table.themeId),
|
|
70
|
+
}));
|
|
71
|
+
/**
|
|
72
|
+
* Agent-owned worktrees
|
|
73
|
+
*/
|
|
74
|
+
export const agentWorktrees = sqliteTable('agent_worktrees', {
|
|
75
|
+
agentName: text('agent_name').notNull(),
|
|
76
|
+
repoName: text('repo_name').notNull(),
|
|
77
|
+
worktreePath: text('worktree_path').notNull(),
|
|
78
|
+
branch: text('branch').notNull(),
|
|
79
|
+
createdAt: text('created_at').notNull(),
|
|
80
|
+
}, (table) => ({
|
|
81
|
+
pk: primaryKey({ columns: [table.agentName, table.repoName] }),
|
|
82
|
+
idxAgent: index('idx_worktrees_agent').on(table.agentName),
|
|
83
|
+
idxRepo: index('idx_worktrees_repo').on(table.repoName),
|
|
84
|
+
}));
|
|
85
|
+
/**
|
|
86
|
+
* Workspace-level settings (key-value store)
|
|
87
|
+
*/
|
|
88
|
+
export const workspaceSettings = sqliteTable('workspace_settings', {
|
|
89
|
+
key: text('key').primaryKey(),
|
|
90
|
+
value: text('value').notNull(),
|
|
91
|
+
});
|
|
92
|
+
// =============================================================================
|
|
93
|
+
// PMO Tables
|
|
94
|
+
// =============================================================================
|
|
95
|
+
/**
|
|
96
|
+
* Project lifecycle phases (workspace-scoped)
|
|
97
|
+
*/
|
|
98
|
+
export const pmoPhases = sqliteTable('pmo_phases', {
|
|
99
|
+
id: text('id').primaryKey(),
|
|
100
|
+
name: text('name').notNull().unique(),
|
|
101
|
+
category: text('category').notNull(),
|
|
102
|
+
position: integer('position').notNull().default(0),
|
|
103
|
+
color: text('color'),
|
|
104
|
+
description: text('description'),
|
|
105
|
+
isDefault: integer('is_default', { mode: 'boolean' }).notNull().default(false),
|
|
106
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
107
|
+
}, (table) => ({
|
|
108
|
+
idxCategory: index('idx_pmo_phases_category').on(table.category),
|
|
109
|
+
idxPosition: index('idx_pmo_phases_position').on(table.category, table.position),
|
|
110
|
+
}));
|
|
111
|
+
/**
|
|
112
|
+
* Phase templates (preset phase configurations)
|
|
113
|
+
*/
|
|
114
|
+
export const pmoPhaseTemplates = sqliteTable('pmo_phase_templates', {
|
|
115
|
+
id: text('id').primaryKey(),
|
|
116
|
+
name: text('name').notNull().unique(),
|
|
117
|
+
description: text('description'),
|
|
118
|
+
isBuiltin: integer('is_builtin', { mode: 'boolean' }).notNull().default(false),
|
|
119
|
+
phases: text('phases').notNull(), // JSON array of phase definitions
|
|
120
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* Shared workflow definitions
|
|
124
|
+
*/
|
|
125
|
+
export const pmoWorkflows = sqliteTable('pmo_workflows', {
|
|
126
|
+
id: text('id').primaryKey(),
|
|
127
|
+
name: text('name').notNull().unique(),
|
|
128
|
+
description: text('description'),
|
|
129
|
+
isBuiltin: integer('is_builtin', { mode: 'boolean' }).notNull().default(false),
|
|
130
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
131
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
132
|
+
}, (table) => ({
|
|
133
|
+
idxBuiltin: index('idx_pmo_workflows_builtin').on(table.isBuiltin),
|
|
134
|
+
}));
|
|
135
|
+
/**
|
|
136
|
+
* Workflow statuses (board columns)
|
|
137
|
+
*/
|
|
138
|
+
export const pmoWorkflowStatuses = sqliteTable('pmo_workflow_statuses', {
|
|
139
|
+
id: text('id').primaryKey(),
|
|
140
|
+
workflowId: text('workflow_id').notNull(),
|
|
141
|
+
name: text('name').notNull(),
|
|
142
|
+
category: text('category').notNull(),
|
|
143
|
+
position: integer('position').notNull().default(0),
|
|
144
|
+
color: text('color'),
|
|
145
|
+
description: text('description'),
|
|
146
|
+
isDefault: integer('is_default', { mode: 'boolean' }).notNull().default(false),
|
|
147
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
148
|
+
}, (table) => ({
|
|
149
|
+
uniqWorkflowName: unique().on(table.workflowId, table.name),
|
|
150
|
+
idxWorkflow: index('idx_pmo_workflow_statuses_workflow').on(table.workflowId),
|
|
151
|
+
idxCategory: index('idx_pmo_workflow_statuses_category').on(table.workflowId, table.category),
|
|
152
|
+
idxPosition: index('idx_pmo_workflow_statuses_position').on(table.workflowId, table.position),
|
|
153
|
+
}));
|
|
154
|
+
/**
|
|
155
|
+
* Projects
|
|
156
|
+
*/
|
|
157
|
+
export const pmoProjects = sqliteTable('pmo_projects', {
|
|
158
|
+
id: text('id').primaryKey(),
|
|
159
|
+
name: text('name').notNull(),
|
|
160
|
+
template: text('template'),
|
|
161
|
+
description: text('description'),
|
|
162
|
+
status: text('status').notNull().default('active'),
|
|
163
|
+
phaseId: text('phase_id'),
|
|
164
|
+
workflowId: text('workflow_id'),
|
|
165
|
+
isArchived: integer('is_archived', { mode: 'boolean' }).notNull().default(false),
|
|
166
|
+
targetDate: text('target_date'),
|
|
167
|
+
initiativeId: text('initiative_id'),
|
|
168
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
169
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
170
|
+
}, (table) => ({
|
|
171
|
+
idxInitiative: index('idx_pmo_projects_initiative').on(table.initiativeId),
|
|
172
|
+
idxStatus: index('idx_pmo_projects_status').on(table.status),
|
|
173
|
+
idxPhase: index('idx_pmo_projects_phase').on(table.phaseId),
|
|
174
|
+
idxWorkflow: index('idx_pmo_projects_workflow').on(table.workflowId),
|
|
175
|
+
idxArchived: index('idx_pmo_projects_archived').on(table.isArchived),
|
|
176
|
+
}));
|
|
177
|
+
/**
|
|
178
|
+
* Initiatives (high-level groupings)
|
|
179
|
+
*/
|
|
180
|
+
export const pmoInitiatives = sqliteTable('pmo_initiatives', {
|
|
181
|
+
id: text('id').primaryKey(),
|
|
182
|
+
name: text('name').notNull(),
|
|
183
|
+
objective: text('objective'),
|
|
184
|
+
keyResults: text('key_results'),
|
|
185
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
186
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
187
|
+
});
|
|
188
|
+
/**
|
|
189
|
+
* Specifications
|
|
190
|
+
*/
|
|
191
|
+
export const pmoSpecs = sqliteTable('pmo_specs', {
|
|
192
|
+
id: text('id').primaryKey(),
|
|
193
|
+
title: text('title').notNull(),
|
|
194
|
+
status: text('status').default('draft'),
|
|
195
|
+
type: text('type'),
|
|
196
|
+
tags: text('tags'),
|
|
197
|
+
dependsOn: text('depends_on'),
|
|
198
|
+
problem: text('problem'),
|
|
199
|
+
solution: text('solution'),
|
|
200
|
+
decisions: text('decisions'),
|
|
201
|
+
notNow: text('not_now'),
|
|
202
|
+
uiUx: text('ui_ux'),
|
|
203
|
+
acceptanceCriteria: text('acceptance_criteria'),
|
|
204
|
+
openQuestions: text('open_questions'),
|
|
205
|
+
requirementsFunctional: text('requirements_functional'),
|
|
206
|
+
requirementsTechnical: text('requirements_technical'),
|
|
207
|
+
context: text('context'),
|
|
208
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
209
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
210
|
+
}, (table) => ({
|
|
211
|
+
idxStatus: index('idx_pmo_specs_status').on(table.status),
|
|
212
|
+
idxType: index('idx_pmo_specs_type').on(table.type),
|
|
213
|
+
}));
|
|
214
|
+
/**
|
|
215
|
+
* Spec-to-spec dependencies
|
|
216
|
+
*/
|
|
217
|
+
export const pmoSpecDependencies = sqliteTable('pmo_spec_dependencies', {
|
|
218
|
+
specId: text('spec_id').notNull(),
|
|
219
|
+
dependsOnSpecId: text('depends_on_spec_id').notNull(),
|
|
220
|
+
dependencyType: text('dependency_type').notNull().default('depends_on'),
|
|
221
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
222
|
+
}, (table) => ({
|
|
223
|
+
pk: primaryKey({ columns: [table.specId, table.dependsOnSpecId, table.dependencyType] }),
|
|
224
|
+
idxDependsOn: index('idx_pmo_spec_deps_depends_on').on(table.dependsOnSpecId),
|
|
225
|
+
}));
|
|
226
|
+
/**
|
|
227
|
+
* Epics
|
|
228
|
+
*/
|
|
229
|
+
export const pmoEpics = sqliteTable('pmo_epics', {
|
|
230
|
+
id: text('id').primaryKey(),
|
|
231
|
+
projectId: text('project_id').notNull(),
|
|
232
|
+
title: text('title').notNull(),
|
|
233
|
+
description: text('description'),
|
|
234
|
+
status: text('status').notNull().default('active'),
|
|
235
|
+
position: integer('position').notNull().default(0),
|
|
236
|
+
filePath: text('file_path'),
|
|
237
|
+
specId: text('spec_id'),
|
|
238
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
239
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
240
|
+
}, (table) => ({
|
|
241
|
+
idxProject: index('idx_pmo_epics_project').on(table.projectId),
|
|
242
|
+
idxSpec: index('idx_pmo_epics_spec').on(table.specId),
|
|
243
|
+
idxPosition: index('idx_pmo_epics_position').on(table.projectId, table.position),
|
|
244
|
+
}));
|
|
245
|
+
/**
|
|
246
|
+
* Epic-to-epic dependencies
|
|
247
|
+
*/
|
|
248
|
+
export const pmoEpicDependencies = sqliteTable('pmo_epic_dependencies', {
|
|
249
|
+
epicId: text('epic_id').notNull(),
|
|
250
|
+
dependsOnEpicId: text('depends_on_epic_id').notNull(),
|
|
251
|
+
dependencyType: text('dependency_type').notNull().default('blocks'),
|
|
252
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
253
|
+
}, (table) => ({
|
|
254
|
+
pk: primaryKey({ columns: [table.epicId, table.dependsOnEpicId, table.dependencyType] }),
|
|
255
|
+
idxDependsOn: index('idx_pmo_epic_deps_depends_on').on(table.dependsOnEpicId),
|
|
256
|
+
}));
|
|
257
|
+
/**
|
|
258
|
+
* Project-to-spec associations
|
|
259
|
+
*/
|
|
260
|
+
export const pmoProjectSpecs = sqliteTable('pmo_project_specs', {
|
|
261
|
+
projectId: text('project_id').notNull(),
|
|
262
|
+
specId: text('spec_id').notNull(),
|
|
263
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
264
|
+
}, (table) => ({
|
|
265
|
+
pk: primaryKey({ columns: [table.projectId, table.specId] }),
|
|
266
|
+
idxSpec: index('idx_pmo_project_specs_spec').on(table.specId),
|
|
267
|
+
idxProject: index('idx_pmo_project_specs_project').on(table.projectId),
|
|
268
|
+
}));
|
|
269
|
+
/**
|
|
270
|
+
* Tickets
|
|
271
|
+
*/
|
|
272
|
+
export const pmoTickets = sqliteTable('pmo_tickets', {
|
|
273
|
+
id: text('id').primaryKey(),
|
|
274
|
+
projectId: text('project_id').notNull().default('default'),
|
|
275
|
+
title: text('title').notNull(),
|
|
276
|
+
description: text('description'),
|
|
277
|
+
priority: text('priority'),
|
|
278
|
+
category: text('category'),
|
|
279
|
+
status: text('status').notNull().default('backlog'),
|
|
280
|
+
statusId: text('status_id'),
|
|
281
|
+
owner: text('owner'),
|
|
282
|
+
assignee: text('assignee'),
|
|
283
|
+
branch: text('branch'),
|
|
284
|
+
specId: text('spec_id'),
|
|
285
|
+
epicId: text('epic_id'),
|
|
286
|
+
labels: text('labels').notNull().default('[]'),
|
|
287
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
288
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
289
|
+
lastSyncedFromSpec: text('last_synced_from_spec'),
|
|
290
|
+
lastSyncedFromBoard: text('last_synced_from_board'),
|
|
291
|
+
}, (table) => ({
|
|
292
|
+
idxProject: index('idx_pmo_tickets_project').on(table.projectId),
|
|
293
|
+
idxStatus: index('idx_pmo_tickets_status').on(table.status),
|
|
294
|
+
idxOwner: index('idx_pmo_tickets_owner').on(table.owner),
|
|
295
|
+
idxAssignee: index('idx_pmo_tickets_assignee').on(table.assignee),
|
|
296
|
+
idxSpec: index('idx_pmo_tickets_spec').on(table.specId),
|
|
297
|
+
idxEpic: index('idx_pmo_tickets_epic').on(table.epicId),
|
|
298
|
+
idxPriority: index('idx_pmo_tickets_priority').on(table.priority),
|
|
299
|
+
idxCategory: index('idx_pmo_tickets_category').on(table.category),
|
|
300
|
+
idxStatusId: index('idx_pmo_tickets_status_id').on(table.statusId),
|
|
301
|
+
}));
|
|
302
|
+
/**
|
|
303
|
+
* Board views (saved filter/display configurations)
|
|
304
|
+
*/
|
|
305
|
+
export const pmoBoardViews = sqliteTable('pmo_board_views', {
|
|
306
|
+
id: text('id').primaryKey(),
|
|
307
|
+
projectId: text('project_id').notNull(),
|
|
308
|
+
name: text('name').notNull(),
|
|
309
|
+
description: text('description'),
|
|
310
|
+
isDefault: integer('is_default', { mode: 'boolean' }).notNull().default(false),
|
|
311
|
+
filters: text('filters').notNull().default('{}'),
|
|
312
|
+
groupBy: text('group_by'),
|
|
313
|
+
sortBy: text('sort_by'),
|
|
314
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
315
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
316
|
+
}, (table) => ({
|
|
317
|
+
uniqProjectName: unique().on(table.projectId, table.name),
|
|
318
|
+
idxProject: index('idx_pmo_board_views_project').on(table.projectId),
|
|
319
|
+
idxDefault: index('idx_pmo_board_views_default').on(table.projectId, table.isDefault),
|
|
320
|
+
}));
|
|
321
|
+
/**
|
|
322
|
+
* Subtasks
|
|
323
|
+
*/
|
|
324
|
+
export const pmoSubtasks = sqliteTable('pmo_subtasks', {
|
|
325
|
+
id: text('id').notNull(),
|
|
326
|
+
ticketId: text('ticket_id').notNull(),
|
|
327
|
+
title: text('title').notNull(),
|
|
328
|
+
done: integer('done', { mode: 'boolean' }).default(false),
|
|
329
|
+
position: integer('position').notNull(),
|
|
330
|
+
}, (table) => ({
|
|
331
|
+
pk: primaryKey({ columns: [table.ticketId, table.id] }),
|
|
332
|
+
idxTicket: index('idx_pmo_subtasks_ticket').on(table.ticketId),
|
|
333
|
+
}));
|
|
334
|
+
/**
|
|
335
|
+
* Ticket metadata (key-value)
|
|
336
|
+
*/
|
|
337
|
+
export const pmoTicketMetadata = sqliteTable('pmo_ticket_metadata', {
|
|
338
|
+
ticketId: text('ticket_id').notNull(),
|
|
339
|
+
key: text('key').notNull(),
|
|
340
|
+
value: text('value'),
|
|
341
|
+
}, (table) => ({
|
|
342
|
+
pk: primaryKey({ columns: [table.ticketId, table.key] }),
|
|
343
|
+
}));
|
|
344
|
+
/**
|
|
345
|
+
* Ticket-to-ticket dependencies
|
|
346
|
+
*/
|
|
347
|
+
export const pmoTicketDependencies = sqliteTable('pmo_ticket_dependencies', {
|
|
348
|
+
ticketId: text('ticket_id').notNull(),
|
|
349
|
+
dependsOnTicketId: text('depends_on_ticket_id').notNull(),
|
|
350
|
+
dependencyType: text('dependency_type').notNull().default('blocks'),
|
|
351
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
352
|
+
}, (table) => ({
|
|
353
|
+
pk: primaryKey({ columns: [table.ticketId, table.dependsOnTicketId, table.dependencyType] }),
|
|
354
|
+
idxDependsOn: index('idx_pmo_ticket_deps_depends_on').on(table.dependsOnTicketId),
|
|
355
|
+
}));
|
|
356
|
+
/**
|
|
357
|
+
* Ticket affected paths (scope hints for agents)
|
|
358
|
+
*/
|
|
359
|
+
export const pmoTicketAffectedPaths = sqliteTable('pmo_ticket_affected_paths', {
|
|
360
|
+
id: integer('id').primaryKey({ autoIncrement: true }),
|
|
361
|
+
ticketId: text('ticket_id').notNull(),
|
|
362
|
+
pathPattern: text('path_pattern').notNull(),
|
|
363
|
+
pathType: text('path_type').notNull().default('file'),
|
|
364
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
365
|
+
}, (table) => ({
|
|
366
|
+
idxTicket: index('idx_pmo_ticket_paths_ticket').on(table.ticketId),
|
|
367
|
+
}));
|
|
368
|
+
/**
|
|
369
|
+
* Ticket acceptance criteria
|
|
370
|
+
*/
|
|
371
|
+
export const pmoTicketAcceptanceCriteria = sqliteTable('pmo_ticket_acceptance_criteria', {
|
|
372
|
+
id: text('id').notNull(),
|
|
373
|
+
ticketId: text('ticket_id').notNull(),
|
|
374
|
+
criterion: text('criterion').notNull(),
|
|
375
|
+
verifiable: integer('verifiable', { mode: 'boolean' }).default(true),
|
|
376
|
+
verified: integer('verified', { mode: 'boolean' }).default(false),
|
|
377
|
+
verifiedAt: text('verified_at'),
|
|
378
|
+
verifiedBy: text('verified_by'),
|
|
379
|
+
position: integer('position').notNull().default(0),
|
|
380
|
+
}, (table) => ({
|
|
381
|
+
pk: primaryKey({ columns: [table.ticketId, table.id] }),
|
|
382
|
+
idxTicket: index('idx_pmo_ticket_criteria_ticket').on(table.ticketId),
|
|
383
|
+
}));
|
|
384
|
+
/**
|
|
385
|
+
* Ticket-to-spec associations
|
|
386
|
+
*/
|
|
387
|
+
export const pmoTicketSpecs = sqliteTable('pmo_ticket_specs', {
|
|
388
|
+
ticketId: text('ticket_id').notNull(),
|
|
389
|
+
specId: text('spec_id').notNull(),
|
|
390
|
+
}, (table) => ({
|
|
391
|
+
pk: primaryKey({ columns: [table.ticketId, table.specId] }),
|
|
392
|
+
idxSpec: index('idx_pmo_ticket_specs_spec').on(table.specId),
|
|
393
|
+
}));
|
|
394
|
+
/**
|
|
395
|
+
* Ticket assignments
|
|
396
|
+
*/
|
|
397
|
+
export const pmoTicketAssignments = sqliteTable('pmo_ticket_assignments', {
|
|
398
|
+
ticketId: text('ticket_id').notNull(),
|
|
399
|
+
agentName: text('agent_name').notNull(),
|
|
400
|
+
assignedAt: text('assigned_at').default(sql `CURRENT_TIMESTAMP`),
|
|
401
|
+
}, (table) => ({
|
|
402
|
+
pk: primaryKey({ columns: [table.ticketId, table.agentName] }),
|
|
403
|
+
idxAgent: index('idx_pmo_assignments_agent').on(table.agentName),
|
|
404
|
+
}));
|
|
405
|
+
/**
|
|
406
|
+
* Cache metadata
|
|
407
|
+
*/
|
|
408
|
+
export const pmoCacheMetadata = sqliteTable('pmo_cache_metadata', {
|
|
409
|
+
key: text('key').primaryKey(),
|
|
410
|
+
value: text('value').notNull(),
|
|
411
|
+
});
|
|
412
|
+
/**
|
|
413
|
+
* PMO settings
|
|
414
|
+
*/
|
|
415
|
+
export const pmoSettings = sqliteTable('pmo_settings', {
|
|
416
|
+
key: text('key').primaryKey(),
|
|
417
|
+
value: text('value').notNull(),
|
|
418
|
+
});
|
|
419
|
+
/**
|
|
420
|
+
* Agent work execution tracking
|
|
421
|
+
*/
|
|
422
|
+
export const pmoAgentWork = sqliteTable('agent_work', {
|
|
423
|
+
id: text('id').primaryKey(),
|
|
424
|
+
ticketId: text('ticket_id').notNull(),
|
|
425
|
+
agentName: text('agent_name').notNull(),
|
|
426
|
+
executor: text('executor').notNull(),
|
|
427
|
+
environment: text('environment').notNull().default('host'),
|
|
428
|
+
displayMode: text('display_mode').notNull().default('terminal'),
|
|
429
|
+
sandboxed: integer('sandboxed', { mode: 'boolean' }).notNull().default(false),
|
|
430
|
+
status: text('status').notNull().default('starting'),
|
|
431
|
+
branch: text('branch'),
|
|
432
|
+
pid: text('pid'),
|
|
433
|
+
containerId: text('container_id'),
|
|
434
|
+
sessionId: text('session_id'),
|
|
435
|
+
host: text('host'),
|
|
436
|
+
logPath: text('log_path'),
|
|
437
|
+
startedAt: text('started_at').default(sql `CURRENT_TIMESTAMP`),
|
|
438
|
+
completedAt: text('completed_at'),
|
|
439
|
+
exitCode: integer('exit_code'),
|
|
440
|
+
}, (table) => ({
|
|
441
|
+
idxAgent: index('idx_agent_work_agent').on(table.agentName),
|
|
442
|
+
idxStatus: index('idx_agent_work_status').on(table.status),
|
|
443
|
+
idxTicket: index('idx_agent_work_ticket').on(table.ticketId),
|
|
444
|
+
}));
|
|
445
|
+
/**
|
|
446
|
+
* Docker containers per agent
|
|
447
|
+
*/
|
|
448
|
+
export const pmoContainers = sqliteTable('containers', {
|
|
449
|
+
id: text('id').primaryKey(),
|
|
450
|
+
agentName: text('agent_name').notNull(),
|
|
451
|
+
dockerId: text('docker_id').notNull(),
|
|
452
|
+
dockerName: text('docker_name'),
|
|
453
|
+
image: text('image'),
|
|
454
|
+
status: text('status').notNull().default('unknown'),
|
|
455
|
+
currentExecutionId: text('current_execution_id'),
|
|
456
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
457
|
+
lastSeenAt: text('last_seen_at').default(sql `CURRENT_TIMESTAMP`),
|
|
458
|
+
}, (table) => ({
|
|
459
|
+
idxAgent: index('idx_containers_agent').on(table.agentName),
|
|
460
|
+
idxDockerId: index('idx_containers_docker_id').on(table.dockerId),
|
|
461
|
+
idxStatus: index('idx_containers_status').on(table.status),
|
|
462
|
+
}));
|
|
463
|
+
/**
|
|
464
|
+
* ID sequence counters
|
|
465
|
+
*/
|
|
466
|
+
export const pmoIdSequences = sqliteTable('id_sequences', {
|
|
467
|
+
tableName: text('table_name').primaryKey(),
|
|
468
|
+
nextId: integer('next_id').notNull().default(1),
|
|
469
|
+
});
|
|
470
|
+
/**
|
|
471
|
+
* Work actions (reusable agent prompts)
|
|
472
|
+
*/
|
|
473
|
+
export const pmoActions = sqliteTable('pmo_actions', {
|
|
474
|
+
id: text('id').primaryKey(),
|
|
475
|
+
name: text('name').notNull().unique(),
|
|
476
|
+
description: text('description'),
|
|
477
|
+
prompt: text('prompt').notNull(),
|
|
478
|
+
endPrompt: text('end_prompt'),
|
|
479
|
+
suggestedForCategories: text('suggested_for_categories'),
|
|
480
|
+
defaultMoveToCategory: text('default_move_to_category'),
|
|
481
|
+
modifiesCode: integer('modifies_code', { mode: 'boolean' }).notNull().default(true),
|
|
482
|
+
isBuiltin: integer('is_builtin', { mode: 'boolean' }).notNull().default(false),
|
|
483
|
+
position: integer('position').notNull().default(0),
|
|
484
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
485
|
+
});
|
|
486
|
+
/**
|
|
487
|
+
* Ticket templates
|
|
488
|
+
*/
|
|
489
|
+
export const pmoTicketTemplates = sqliteTable('pmo_ticket_templates', {
|
|
490
|
+
id: text('id').primaryKey(),
|
|
491
|
+
name: text('name').notNull().unique(),
|
|
492
|
+
description: text('description'),
|
|
493
|
+
isBuiltin: integer('is_builtin', { mode: 'boolean' }).notNull().default(false),
|
|
494
|
+
titlePattern: text('title_pattern'),
|
|
495
|
+
descriptionTemplate: text('description_template'),
|
|
496
|
+
defaultPriority: text('default_priority'),
|
|
497
|
+
defaultCategory: text('default_category'),
|
|
498
|
+
defaultStatusId: text('default_status_id'),
|
|
499
|
+
defaultAssignee: text('default_assignee'),
|
|
500
|
+
defaultOwner: text('default_owner'),
|
|
501
|
+
defaultLabels: text('default_labels').notNull().default('[]'),
|
|
502
|
+
suggestedSubtasks: text('suggested_subtasks').notNull().default('[]'),
|
|
503
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
504
|
+
}, (table) => ({
|
|
505
|
+
idxBuiltin: index('idx_pmo_ticket_templates_builtin').on(table.isBuiltin),
|
|
506
|
+
}));
|
|
507
|
+
/**
|
|
508
|
+
* Roadmaps (named collections of projects)
|
|
509
|
+
*/
|
|
510
|
+
export const pmoRoadmaps = sqliteTable('pmo_roadmaps', {
|
|
511
|
+
id: text('id').primaryKey(),
|
|
512
|
+
name: text('name').notNull().unique(),
|
|
513
|
+
description: text('description'),
|
|
514
|
+
isDefault: integer('is_default', { mode: 'boolean' }).notNull().default(false),
|
|
515
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
516
|
+
updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
|
|
517
|
+
}, (table) => ({
|
|
518
|
+
idxDefault: index('idx_pmo_roadmaps_default').on(table.isDefault),
|
|
519
|
+
}));
|
|
520
|
+
/**
|
|
521
|
+
* Roadmap-to-project associations
|
|
522
|
+
*/
|
|
523
|
+
export const pmoRoadmapProjects = sqliteTable('pmo_roadmap_projects', {
|
|
524
|
+
roadmapId: text('roadmap_id').notNull(),
|
|
525
|
+
projectId: text('project_id').notNull(),
|
|
526
|
+
position: integer('position').notNull().default(0),
|
|
527
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
528
|
+
}, (table) => ({
|
|
529
|
+
pk: primaryKey({ columns: [table.roadmapId, table.projectId] }),
|
|
530
|
+
idxRoadmap: index('idx_pmo_roadmap_projects_roadmap').on(table.roadmapId),
|
|
531
|
+
idxProject: index('idx_pmo_roadmap_projects_project').on(table.projectId),
|
|
532
|
+
idxPosition: index('idx_pmo_roadmap_projects_position').on(table.roadmapId, table.position),
|
|
533
|
+
}));
|
|
534
|
+
// =============================================================================
|
|
535
|
+
// Legacy/Deprecated Tables (kept for migration compatibility)
|
|
536
|
+
// =============================================================================
|
|
537
|
+
/**
|
|
538
|
+
* @deprecated Use pmoWorkflowStatuses instead
|
|
539
|
+
*/
|
|
540
|
+
export const pmoColumns = sqliteTable('pmo_columns', {
|
|
541
|
+
id: text('id').notNull(),
|
|
542
|
+
projectId: text('project_id').notNull().default('default'),
|
|
543
|
+
name: text('name').notNull(),
|
|
544
|
+
position: integer('position').notNull(),
|
|
545
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
546
|
+
}, (table) => ({
|
|
547
|
+
pk: primaryKey({ columns: [table.projectId, table.id] }),
|
|
548
|
+
}));
|
|
549
|
+
/**
|
|
550
|
+
* @deprecated Tickets now use status_id directly
|
|
551
|
+
*/
|
|
552
|
+
export const pmoBoardTickets = sqliteTable('pmo_board_tickets', {
|
|
553
|
+
projectId: text('project_id').notNull(),
|
|
554
|
+
ticketId: text('ticket_id').notNull(),
|
|
555
|
+
columnId: text('column_id').notNull(),
|
|
556
|
+
position: integer('position').notNull(),
|
|
557
|
+
}, (table) => ({
|
|
558
|
+
pk: primaryKey({ columns: [table.projectId, table.ticketId] }),
|
|
559
|
+
}));
|
|
560
|
+
/**
|
|
561
|
+
* @deprecated Use pmoWorkflowStatuses instead
|
|
562
|
+
*/
|
|
563
|
+
export const pmoStatuses = sqliteTable('pmo_statuses', {
|
|
564
|
+
id: text('id').primaryKey(),
|
|
565
|
+
projectId: text('project_id').notNull(),
|
|
566
|
+
name: text('name').notNull(),
|
|
567
|
+
category: text('category').notNull(),
|
|
568
|
+
position: integer('position').notNull().default(0),
|
|
569
|
+
color: text('color'),
|
|
570
|
+
description: text('description'),
|
|
571
|
+
isDefault: integer('is_default', { mode: 'boolean' }).notNull().default(false),
|
|
572
|
+
createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
|
|
573
|
+
}, (table) => ({
|
|
574
|
+
uniqProjectName: unique().on(table.projectId, table.name),
|
|
575
|
+
}));
|
|
576
|
+
// =============================================================================
|
|
577
|
+
// Relations
|
|
578
|
+
// =============================================================================
|
|
579
|
+
export const workspaceRelations = relations(workspace, ({ one }) => ({
|
|
580
|
+
activeTheme: one(agentThemes, {
|
|
581
|
+
fields: [workspace.activeThemeId],
|
|
582
|
+
references: [agentThemes.id],
|
|
583
|
+
}),
|
|
584
|
+
}));
|
|
585
|
+
export const agentThemesRelations = relations(agentThemes, ({ many }) => ({
|
|
586
|
+
names: many(agentThemeNames),
|
|
587
|
+
agents: many(agents),
|
|
588
|
+
}));
|
|
589
|
+
export const agentThemeNamesRelations = relations(agentThemeNames, ({ one }) => ({
|
|
590
|
+
theme: one(agentThemes, {
|
|
591
|
+
fields: [agentThemeNames.themeId],
|
|
592
|
+
references: [agentThemes.id],
|
|
593
|
+
}),
|
|
594
|
+
}));
|
|
595
|
+
export const agentsRelations = relations(agents, ({ one, many }) => ({
|
|
596
|
+
theme: one(agentThemes, {
|
|
597
|
+
fields: [agents.themeId],
|
|
598
|
+
references: [agentThemes.id],
|
|
599
|
+
}),
|
|
600
|
+
worktrees: many(agentWorktrees),
|
|
601
|
+
containers: many(pmoContainers),
|
|
602
|
+
}));
|
|
603
|
+
export const agentWorktreesRelations = relations(agentWorktrees, ({ one }) => ({
|
|
604
|
+
agent: one(agents, {
|
|
605
|
+
fields: [agentWorktrees.agentName],
|
|
606
|
+
references: [agents.name],
|
|
607
|
+
}),
|
|
608
|
+
repository: one(repositories, {
|
|
609
|
+
fields: [agentWorktrees.repoName],
|
|
610
|
+
references: [repositories.name],
|
|
611
|
+
}),
|
|
612
|
+
}));
|
|
613
|
+
export const pmoProjectsRelations = relations(pmoProjects, ({ one, many }) => ({
|
|
614
|
+
phase: one(pmoPhases, {
|
|
615
|
+
fields: [pmoProjects.phaseId],
|
|
616
|
+
references: [pmoPhases.id],
|
|
617
|
+
}),
|
|
618
|
+
workflow: one(pmoWorkflows, {
|
|
619
|
+
fields: [pmoProjects.workflowId],
|
|
620
|
+
references: [pmoWorkflows.id],
|
|
621
|
+
}),
|
|
622
|
+
tickets: many(pmoTickets),
|
|
623
|
+
epics: many(pmoEpics),
|
|
624
|
+
boardViews: many(pmoBoardViews),
|
|
625
|
+
projectSpecs: many(pmoProjectSpecs),
|
|
626
|
+
roadmapProjects: many(pmoRoadmapProjects),
|
|
627
|
+
}));
|
|
628
|
+
export const pmoWorkflowsRelations = relations(pmoWorkflows, ({ many }) => ({
|
|
629
|
+
statuses: many(pmoWorkflowStatuses),
|
|
630
|
+
projects: many(pmoProjects),
|
|
631
|
+
}));
|
|
632
|
+
export const pmoWorkflowStatusesRelations = relations(pmoWorkflowStatuses, ({ one, many }) => ({
|
|
633
|
+
workflow: one(pmoWorkflows, {
|
|
634
|
+
fields: [pmoWorkflowStatuses.workflowId],
|
|
635
|
+
references: [pmoWorkflows.id],
|
|
636
|
+
}),
|
|
637
|
+
tickets: many(pmoTickets),
|
|
638
|
+
}));
|
|
639
|
+
export const pmoTicketsRelations = relations(pmoTickets, ({ one, many }) => ({
|
|
640
|
+
project: one(pmoProjects, {
|
|
641
|
+
fields: [pmoTickets.projectId],
|
|
642
|
+
references: [pmoProjects.id],
|
|
643
|
+
}),
|
|
644
|
+
status: one(pmoWorkflowStatuses, {
|
|
645
|
+
fields: [pmoTickets.statusId],
|
|
646
|
+
references: [pmoWorkflowStatuses.id],
|
|
647
|
+
}),
|
|
648
|
+
spec: one(pmoSpecs, {
|
|
649
|
+
fields: [pmoTickets.specId],
|
|
650
|
+
references: [pmoSpecs.id],
|
|
651
|
+
}),
|
|
652
|
+
epic: one(pmoEpics, {
|
|
653
|
+
fields: [pmoTickets.epicId],
|
|
654
|
+
references: [pmoEpics.id],
|
|
655
|
+
}),
|
|
656
|
+
subtasks: many(pmoSubtasks),
|
|
657
|
+
metadata: many(pmoTicketMetadata),
|
|
658
|
+
acceptanceCriteria: many(pmoTicketAcceptanceCriteria),
|
|
659
|
+
ticketSpecs: many(pmoTicketSpecs),
|
|
660
|
+
assignments: many(pmoTicketAssignments),
|
|
661
|
+
affectedPaths: many(pmoTicketAffectedPaths),
|
|
662
|
+
agentWork: many(pmoAgentWork),
|
|
663
|
+
}));
|
|
664
|
+
export const pmoSubtasksRelations = relations(pmoSubtasks, ({ one }) => ({
|
|
665
|
+
ticket: one(pmoTickets, {
|
|
666
|
+
fields: [pmoSubtasks.ticketId],
|
|
667
|
+
references: [pmoTickets.id],
|
|
668
|
+
}),
|
|
669
|
+
}));
|
|
670
|
+
export const pmoSpecsRelations = relations(pmoSpecs, ({ many }) => ({
|
|
671
|
+
tickets: many(pmoTickets),
|
|
672
|
+
ticketSpecs: many(pmoTicketSpecs),
|
|
673
|
+
projectSpecs: many(pmoProjectSpecs),
|
|
674
|
+
epics: many(pmoEpics),
|
|
675
|
+
}));
|
|
676
|
+
export const pmoEpicsRelations = relations(pmoEpics, ({ one, many }) => ({
|
|
677
|
+
project: one(pmoProjects, {
|
|
678
|
+
fields: [pmoEpics.projectId],
|
|
679
|
+
references: [pmoProjects.id],
|
|
680
|
+
}),
|
|
681
|
+
spec: one(pmoSpecs, {
|
|
682
|
+
fields: [pmoEpics.specId],
|
|
683
|
+
references: [pmoSpecs.id],
|
|
684
|
+
}),
|
|
685
|
+
tickets: many(pmoTickets),
|
|
686
|
+
}));
|
|
687
|
+
export const pmoRoadmapsRelations = relations(pmoRoadmaps, ({ many }) => ({
|
|
688
|
+
roadmapProjects: many(pmoRoadmapProjects),
|
|
689
|
+
}));
|
|
690
|
+
export const pmoRoadmapProjectsRelations = relations(pmoRoadmapProjects, ({ one }) => ({
|
|
691
|
+
roadmap: one(pmoRoadmaps, {
|
|
692
|
+
fields: [pmoRoadmapProjects.roadmapId],
|
|
693
|
+
references: [pmoRoadmaps.id],
|
|
694
|
+
}),
|
|
695
|
+
project: one(pmoProjects, {
|
|
696
|
+
fields: [pmoRoadmapProjects.projectId],
|
|
697
|
+
references: [pmoProjects.id],
|
|
698
|
+
}),
|
|
699
|
+
}));
|