@atercates/claude-deck 0.2.1
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/LICENSE +21 -0
- package/README.md +123 -0
- package/app/api/claude/hidden/route.ts +66 -0
- package/app/api/claude/projects/[name]/sessions/route.ts +71 -0
- package/app/api/claude/projects/route.ts +44 -0
- package/app/api/code-search/available/route.ts +12 -0
- package/app/api/code-search/route.ts +47 -0
- package/app/api/dev-servers/[id]/logs/route.ts +23 -0
- package/app/api/dev-servers/[id]/restart/route.ts +20 -0
- package/app/api/dev-servers/[id]/route.ts +51 -0
- package/app/api/dev-servers/[id]/stop/route.ts +20 -0
- package/app/api/dev-servers/detect/route.ts +39 -0
- package/app/api/dev-servers/route.ts +48 -0
- package/app/api/exec/route.ts +60 -0
- package/app/api/files/content/route.ts +76 -0
- package/app/api/files/route.ts +37 -0
- package/app/api/files/upload-temp/route.ts +41 -0
- package/app/api/git/check/route.ts +54 -0
- package/app/api/git/clone/route.ts +99 -0
- package/app/api/git/commit/route.ts +75 -0
- package/app/api/git/discard/route.ts +38 -0
- package/app/api/git/file-content/route.ts +64 -0
- package/app/api/git/history/[hash]/diff/route.ts +38 -0
- package/app/api/git/history/[hash]/route.ts +34 -0
- package/app/api/git/history/route.ts +27 -0
- package/app/api/git/multi-status/route.ts +46 -0
- package/app/api/git/pr/route.ts +164 -0
- package/app/api/git/push/route.ts +64 -0
- package/app/api/git/stage/route.ts +40 -0
- package/app/api/git/status/route.ts +51 -0
- package/app/api/git/unstage/route.ts +46 -0
- package/app/api/groups/[...path]/route.ts +136 -0
- package/app/api/groups/route.ts +93 -0
- package/app/api/orchestrate/spawn/route.ts +45 -0
- package/app/api/orchestrate/workers/[id]/route.ts +89 -0
- package/app/api/orchestrate/workers/route.ts +31 -0
- package/app/api/projects/[id]/detect/route.ts +27 -0
- package/app/api/projects/[id]/dev-servers/[dsId]/route.ts +66 -0
- package/app/api/projects/[id]/dev-servers/route.ts +51 -0
- package/app/api/projects/[id]/repositories/[repoId]/route.ts +67 -0
- package/app/api/projects/[id]/repositories/route.ts +74 -0
- package/app/api/projects/[id]/route.ts +108 -0
- package/app/api/projects/detect/route.ts +33 -0
- package/app/api/projects/route.ts +59 -0
- package/app/api/sessions/[id]/claude-session/route.ts +42 -0
- package/app/api/sessions/[id]/fork/route.ts +74 -0
- package/app/api/sessions/[id]/mcp-config/route.ts +34 -0
- package/app/api/sessions/[id]/messages/route.ts +60 -0
- package/app/api/sessions/[id]/pr/route.ts +188 -0
- package/app/api/sessions/[id]/preview/route.ts +42 -0
- package/app/api/sessions/[id]/route.ts +229 -0
- package/app/api/sessions/[id]/send-keys/route.ts +119 -0
- package/app/api/sessions/[id]/summarize/route.ts +331 -0
- package/app/api/sessions/init-script/route.ts +84 -0
- package/app/api/sessions/route.ts +209 -0
- package/app/api/sessions/status/route.ts +237 -0
- package/app/api/system/route.ts +9 -0
- package/app/api/tmux/kill-all/route.ts +57 -0
- package/app/api/tmux/rename/route.ts +30 -0
- package/app/globals.css +174 -0
- package/app/icon.svg +11 -0
- package/app/layout.tsx +122 -0
- package/app/page.tsx +629 -0
- package/components/ChatMessage.tsx +65 -0
- package/components/ChatView.tsx +276 -0
- package/components/ClaudeProjects/ClaudeProjectCard.tsx +195 -0
- package/components/ClaudeProjects/ClaudeProjectsSection.tsx +89 -0
- package/components/ClaudeProjects/ClaudeSessionCard.tsx +100 -0
- package/components/ClaudeProjects/index.ts +1 -0
- package/components/CodeSearch/CodeSearchResults.tsx +177 -0
- package/components/ConductorPanel.tsx +256 -0
- package/components/DevServers/DevServerCard.tsx +311 -0
- package/components/DevServers/DevServersSection.tsx +91 -0
- package/components/DevServers/ServerLogsModal.tsx +151 -0
- package/components/DevServers/StartServerDialog.tsx +359 -0
- package/components/DevServers/index.ts +4 -0
- package/components/DiffViewer/DiffModal.tsx +151 -0
- package/components/DiffViewer/UnifiedDiff.tsx +185 -0
- package/components/DiffViewer/index.tsx +2 -0
- package/components/DirectoryPicker.tsx +355 -0
- package/components/FileExplorer/FileEditor.tsx +276 -0
- package/components/FileExplorer/FileTabs.tsx +118 -0
- package/components/FileExplorer/FileTree.tsx +214 -0
- package/components/FileExplorer/HtmlRenderer.tsx +16 -0
- package/components/FileExplorer/MarkdownRenderer.tsx +18 -0
- package/components/FileExplorer/index.tsx +520 -0
- package/components/FilePicker.tsx +339 -0
- package/components/FolderPicker.tsx +201 -0
- package/components/GitDrawer/FileEditDialog.tsx +400 -0
- package/components/GitDrawer/index.tsx +464 -0
- package/components/GitPanel/CommitForm.tsx +205 -0
- package/components/GitPanel/CommitHistory.tsx +174 -0
- package/components/GitPanel/CommitItem.tsx +196 -0
- package/components/GitPanel/FileChanges.tsx +414 -0
- package/components/GitPanel/GitPanelTabs.tsx +39 -0
- package/components/GitPanel/index.tsx +817 -0
- package/components/MessageInput.tsx +82 -0
- package/components/NewClaudeSessionDialog.tsx +166 -0
- package/components/NewSessionDialog/AdvancedSettings.tsx +78 -0
- package/components/NewSessionDialog/AgentSelector.tsx +37 -0
- package/components/NewSessionDialog/CreatingOverlay.tsx +94 -0
- package/components/NewSessionDialog/NewSessionDialog.types.ts +136 -0
- package/components/NewSessionDialog/ProjectSelector.tsx +146 -0
- package/components/NewSessionDialog/WorkingDirectoryInput.tsx +55 -0
- package/components/NewSessionDialog/WorktreeSection.tsx +92 -0
- package/components/NewSessionDialog/hooks/useNewSessionForm.ts +370 -0
- package/components/NewSessionDialog/index.tsx +106 -0
- package/components/NotificationSettings.tsx +127 -0
- package/components/PRCreationModal.tsx +272 -0
- package/components/Pane/DesktopTabBar.tsx +353 -0
- package/components/Pane/MobileTabBar.tsx +210 -0
- package/components/Pane/OpenInVSCode.tsx +69 -0
- package/components/Pane/PaneSkeletons.tsx +57 -0
- package/components/Pane/index.tsx +558 -0
- package/components/PaneLayout.tsx +60 -0
- package/components/Projects/DevServersSection.tsx +140 -0
- package/components/Projects/DirectoryField.tsx +92 -0
- package/components/Projects/NewProjectDialog.tsx +188 -0
- package/components/Projects/NewProjectDialog.types.ts +46 -0
- package/components/Projects/ProjectCard.tsx +276 -0
- package/components/Projects/ProjectSettingsDialog.tsx +811 -0
- package/components/Projects/hooks/useNewProjectForm.ts +249 -0
- package/components/Projects/index.ts +3 -0
- package/components/Providers.tsx +49 -0
- package/components/QuickSwitcher.tsx +306 -0
- package/components/SessionList/KillAllConfirm.tsx +46 -0
- package/components/SessionList/SelectionToolbar.tsx +164 -0
- package/components/SessionList/SessionList.types.ts +37 -0
- package/components/SessionList/SessionListHeader.tsx +71 -0
- package/components/SessionList/hooks/useSessionListMutations.ts +269 -0
- package/components/SessionList/index.tsx +189 -0
- package/components/ShellDrawer/index.tsx +106 -0
- package/components/SidebarFooter.tsx +55 -0
- package/components/Terminal/KeybarToggleButton.tsx +45 -0
- package/components/Terminal/ScrollToBottomButton.tsx +32 -0
- package/components/Terminal/SearchBar.tsx +71 -0
- package/components/Terminal/TerminalToolbar.tsx +551 -0
- package/components/Terminal/VirtualKeyboard.tsx +711 -0
- package/components/Terminal/constants.ts +20 -0
- package/components/Terminal/hooks/index.ts +5 -0
- package/components/Terminal/hooks/resize-handlers.ts +140 -0
- package/components/Terminal/hooks/terminal-init.ts +151 -0
- package/components/Terminal/hooks/touch-scroll.ts +155 -0
- package/components/Terminal/hooks/useTerminalConnection.ts +282 -0
- package/components/Terminal/hooks/useTerminalConnection.types.ts +39 -0
- package/components/Terminal/hooks/useTerminalSearch.ts +103 -0
- package/components/Terminal/hooks/websocket-connection.ts +274 -0
- package/components/Terminal/index.tsx +320 -0
- package/components/ThemeToggle.tsx +168 -0
- package/components/TmuxSessions.tsx +132 -0
- package/components/ToolCallDisplay.tsx +71 -0
- package/components/WorkerCard.tsx +245 -0
- package/components/a/ABadge.tsx +115 -0
- package/components/a/AButton.tsx +163 -0
- package/components/a/ADialog.tsx +93 -0
- package/components/a/ADropdownMenu.tsx +279 -0
- package/components/a/AIconButton.tsx +190 -0
- package/components/a/ASheet.tsx +150 -0
- package/components/a/ATooltip.tsx +77 -0
- package/components/a/index.ts +64 -0
- package/components/mobile/SwipeSidebar.tsx +122 -0
- package/components/ui/badge.tsx +41 -0
- package/components/ui/button.tsx +60 -0
- package/components/ui/context-menu.tsx +197 -0
- package/components/ui/dialog.tsx +143 -0
- package/components/ui/dropdown-menu.tsx +257 -0
- package/components/ui/input.tsx +21 -0
- package/components/ui/scroll-area.tsx +52 -0
- package/components/ui/select.tsx +159 -0
- package/components/ui/skeleton.tsx +111 -0
- package/components/ui/switch.tsx +31 -0
- package/components/ui/textarea.tsx +21 -0
- package/components/ui/tooltip.tsx +32 -0
- package/components/views/DesktopView.tsx +244 -0
- package/components/views/MobileView.tsx +110 -0
- package/components/views/types.ts +75 -0
- package/contexts/PaneContext.tsx +336 -0
- package/data/claude/index.ts +9 -0
- package/data/claude/keys.ts +6 -0
- package/data/claude/queries.ts +120 -0
- package/data/claude/useClaudeUpdates.ts +37 -0
- package/data/code-search/index.ts +2 -0
- package/data/code-search/keys.ts +7 -0
- package/data/code-search/queries.ts +61 -0
- package/data/dev-servers/index.ts +8 -0
- package/data/dev-servers/keys.ts +4 -0
- package/data/dev-servers/queries.ts +104 -0
- package/data/files/index.ts +3 -0
- package/data/files/keys.ts +4 -0
- package/data/files/queries.ts +25 -0
- package/data/git/keys.ts +15 -0
- package/data/git/queries.ts +395 -0
- package/data/groups/index.ts +1 -0
- package/data/groups/mutations.ts +95 -0
- package/data/projects/index.ts +10 -0
- package/data/projects/keys.ts +4 -0
- package/data/projects/queries.ts +193 -0
- package/data/repositories/index.ts +7 -0
- package/data/repositories/keys.ts +5 -0
- package/data/repositories/queries.ts +122 -0
- package/data/sessions/index.ts +12 -0
- package/data/sessions/keys.ts +8 -0
- package/data/sessions/queries.ts +218 -0
- package/data/statuses/index.ts +1 -0
- package/data/statuses/queries.ts +69 -0
- package/hooks/useCopyToClipboard.ts +48 -0
- package/hooks/useDevServersManager.ts +73 -0
- package/hooks/useDirectoryBrowser.ts +90 -0
- package/hooks/useDrawerAnimation.ts +27 -0
- package/hooks/useFileDrop.ts +87 -0
- package/hooks/useFileEditor.ts +184 -0
- package/hooks/useGroups.ts +37 -0
- package/hooks/useHomePath.ts +34 -0
- package/hooks/useKeyRepeat.ts +55 -0
- package/hooks/useKeybarVisibility.ts +42 -0
- package/hooks/useNotifications.ts +257 -0
- package/hooks/useProjects.ts +53 -0
- package/hooks/useSessionStatuses.ts +30 -0
- package/hooks/useSessions.ts +86 -0
- package/hooks/useSpeechRecognition.ts +124 -0
- package/hooks/useViewport.ts +32 -0
- package/hooks/useViewportHeight.ts +50 -0
- package/lib/async-operations.ts +35 -0
- package/lib/banner.ts +81 -0
- package/lib/claude/jsonl-cache.ts +86 -0
- package/lib/claude/jsonl-reader.ts +271 -0
- package/lib/claude/process-manager.ts +278 -0
- package/lib/claude/stream-parser.ts +173 -0
- package/lib/claude/types.ts +154 -0
- package/lib/claude/watcher.ts +71 -0
- package/lib/client/session-registry.ts +111 -0
- package/lib/code-search.ts +121 -0
- package/lib/db/index.ts +48 -0
- package/lib/db/migrations.ts +45 -0
- package/lib/db/queries.ts +460 -0
- package/lib/db/schema.ts +114 -0
- package/lib/db/types.ts +92 -0
- package/lib/db.ts +2 -0
- package/lib/dev-servers.ts +509 -0
- package/lib/diff-parser.ts +221 -0
- package/lib/env-setup.ts +285 -0
- package/lib/file-upload.ts +34 -0
- package/lib/file-utils.ts +50 -0
- package/lib/files.ts +207 -0
- package/lib/git-history.ts +294 -0
- package/lib/git-status.ts +391 -0
- package/lib/git.ts +257 -0
- package/lib/mcp-config.ts +81 -0
- package/lib/multi-repo-git.ts +179 -0
- package/lib/notifications.ts +219 -0
- package/lib/orchestration.ts +448 -0
- package/lib/panes.ts +232 -0
- package/lib/ports.ts +97 -0
- package/lib/pr-generation.ts +307 -0
- package/lib/pr.ts +234 -0
- package/lib/projects.ts +578 -0
- package/lib/providers/registry.ts +70 -0
- package/lib/providers.ts +121 -0
- package/lib/query-client.ts +14 -0
- package/lib/rangeSelectionUtils.ts +65 -0
- package/lib/status-detector.ts +375 -0
- package/lib/terminal-themes.ts +265 -0
- package/lib/theme-config.ts +327 -0
- package/lib/utils.ts +6 -0
- package/lib/worktrees.ts +262 -0
- package/mcp/orchestration-server.ts +438 -0
- package/package.json +139 -0
- package/postcss.config.mjs +7 -0
- package/public/icon.svg +10 -0
- package/public/icons/icon-128x128.png +0 -0
- package/public/icons/icon-144x144.png +0 -0
- package/public/icons/icon-152x152.png +0 -0
- package/public/icons/icon-192x192.png +0 -0
- package/public/icons/icon-384x384.png +0 -0
- package/public/icons/icon-512x512.png +0 -0
- package/public/icons/icon-72x72.png +0 -0
- package/public/icons/icon-96x96.png +0 -0
- package/public/manifest.json +61 -0
- package/public/sw.js +64 -0
- package/scripts/agent-os +91 -0
- package/scripts/install.sh +48 -0
- package/scripts/lib/ai-clis.sh +132 -0
- package/scripts/lib/commands.sh +487 -0
- package/scripts/lib/common.sh +89 -0
- package/scripts/lib/prerequisites.sh +462 -0
- package/scripts/setup.sh +134 -0
- package/server.ts +155 -0
- package/stores/fileOpen.ts +26 -0
- package/stores/index.ts +1 -0
- package/stores/initialPrompt.ts +24 -0
- package/stores/sessionSelection.ts +48 -0
- package/styles/themes.css +603 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
|
|
3
|
+
interface Migration {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
up: (db: Database.Database) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const migrations: Migration[] = [];
|
|
10
|
+
|
|
11
|
+
export function runMigrations(db: Database.Database): void {
|
|
12
|
+
db.exec(`
|
|
13
|
+
CREATE TABLE IF NOT EXISTS _migrations (
|
|
14
|
+
id INTEGER PRIMARY KEY,
|
|
15
|
+
name TEXT NOT NULL,
|
|
16
|
+
applied_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
17
|
+
)
|
|
18
|
+
`);
|
|
19
|
+
|
|
20
|
+
const applied = new Set(
|
|
21
|
+
db
|
|
22
|
+
.prepare("SELECT id FROM _migrations")
|
|
23
|
+
.all()
|
|
24
|
+
.map((r) => (r as { id: number }).id)
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
for (const migration of migrations) {
|
|
28
|
+
if (applied.has(migration.id)) continue;
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
migration.up(db);
|
|
32
|
+
db.prepare("INSERT INTO _migrations (id, name) VALUES (?, ?)").run(
|
|
33
|
+
migration.id,
|
|
34
|
+
migration.name
|
|
35
|
+
);
|
|
36
|
+
console.log(`Migration ${migration.id}: ${migration.name} applied`);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error(
|
|
39
|
+
`Migration ${migration.id}: ${migration.name} failed:`,
|
|
40
|
+
error
|
|
41
|
+
);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { getDb } from "./index";
|
|
2
|
+
import type {
|
|
3
|
+
Session,
|
|
4
|
+
Group,
|
|
5
|
+
Project,
|
|
6
|
+
ProjectDevServer,
|
|
7
|
+
ProjectRepository,
|
|
8
|
+
DevServer,
|
|
9
|
+
} from "./types";
|
|
10
|
+
|
|
11
|
+
function query<T>(sql: string, params: unknown[] = []): T[] {
|
|
12
|
+
return getDb()
|
|
13
|
+
.prepare(sql)
|
|
14
|
+
.all(...params) as T[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function queryOne<T>(sql: string, params: unknown[] = []): T | null {
|
|
18
|
+
return (
|
|
19
|
+
(getDb()
|
|
20
|
+
.prepare(sql)
|
|
21
|
+
.get(...params) as T) ?? null
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function execute(sql: string, params: unknown[] = []): void {
|
|
26
|
+
getDb()
|
|
27
|
+
.prepare(sql)
|
|
28
|
+
.run(...params);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const queries = {
|
|
32
|
+
createSession: (
|
|
33
|
+
id: string,
|
|
34
|
+
name: string,
|
|
35
|
+
tmuxName: string | null,
|
|
36
|
+
workingDirectory: string,
|
|
37
|
+
parentSessionId: string | null,
|
|
38
|
+
model: string | null,
|
|
39
|
+
systemPrompt: string | null,
|
|
40
|
+
groupPath: string,
|
|
41
|
+
agentType: string,
|
|
42
|
+
autoApprove: boolean,
|
|
43
|
+
projectId: string | null
|
|
44
|
+
) =>
|
|
45
|
+
execute(
|
|
46
|
+
`INSERT INTO sessions (id, name, tmux_name, working_directory, parent_session_id, model, system_prompt, group_path, agent_type, auto_approve, project_id)
|
|
47
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
48
|
+
[
|
|
49
|
+
id,
|
|
50
|
+
name,
|
|
51
|
+
tmuxName,
|
|
52
|
+
workingDirectory,
|
|
53
|
+
parentSessionId,
|
|
54
|
+
model,
|
|
55
|
+
systemPrompt,
|
|
56
|
+
groupPath,
|
|
57
|
+
agentType,
|
|
58
|
+
autoApprove ? 1 : 0,
|
|
59
|
+
projectId,
|
|
60
|
+
]
|
|
61
|
+
),
|
|
62
|
+
|
|
63
|
+
getSession: (id: string) =>
|
|
64
|
+
queryOne<Session>("SELECT * FROM sessions WHERE id = ?", [id]),
|
|
65
|
+
|
|
66
|
+
getAllSessions: () =>
|
|
67
|
+
query<Session>("SELECT * FROM sessions ORDER BY updated_at DESC"),
|
|
68
|
+
|
|
69
|
+
updateSessionStatus: (status: string, id: string) =>
|
|
70
|
+
execute(
|
|
71
|
+
"UPDATE sessions SET status = ?, updated_at = datetime('now') WHERE id = ?",
|
|
72
|
+
[status, id]
|
|
73
|
+
),
|
|
74
|
+
|
|
75
|
+
updateSessionClaudeId: (claudeSessionId: string, id: string) =>
|
|
76
|
+
execute(
|
|
77
|
+
"UPDATE sessions SET claude_session_id = ?, updated_at = datetime('now') WHERE id = ?",
|
|
78
|
+
[claudeSessionId, id]
|
|
79
|
+
),
|
|
80
|
+
|
|
81
|
+
updateSessionName: (name: string, tmuxName: string, id: string) =>
|
|
82
|
+
execute(
|
|
83
|
+
"UPDATE sessions SET name = ?, tmux_name = ?, updated_at = datetime('now') WHERE id = ?",
|
|
84
|
+
[name, tmuxName, id]
|
|
85
|
+
),
|
|
86
|
+
|
|
87
|
+
deleteSession: (id: string) =>
|
|
88
|
+
execute("DELETE FROM sessions WHERE id = ?", [id]),
|
|
89
|
+
|
|
90
|
+
updateSessionWorktree: (
|
|
91
|
+
worktreePath: string | null,
|
|
92
|
+
branchName: string | null,
|
|
93
|
+
baseBranch: string | null,
|
|
94
|
+
port: number | null,
|
|
95
|
+
id: string
|
|
96
|
+
) =>
|
|
97
|
+
execute(
|
|
98
|
+
"UPDATE sessions SET worktree_path = ?, branch_name = ?, base_branch = ?, dev_server_port = ?, updated_at = datetime('now') WHERE id = ?",
|
|
99
|
+
[worktreePath, branchName, baseBranch, port, id]
|
|
100
|
+
),
|
|
101
|
+
|
|
102
|
+
updateSessionPR: (
|
|
103
|
+
prUrl: string | null,
|
|
104
|
+
prNumber: number | null,
|
|
105
|
+
prStatus: string | null,
|
|
106
|
+
id: string
|
|
107
|
+
) =>
|
|
108
|
+
execute(
|
|
109
|
+
"UPDATE sessions SET pr_url = ?, pr_number = ?, pr_status = ?, updated_at = datetime('now') WHERE id = ?",
|
|
110
|
+
[prUrl, prNumber, prStatus, id]
|
|
111
|
+
),
|
|
112
|
+
|
|
113
|
+
updateSessionGroup: (groupPath: string, id: string) =>
|
|
114
|
+
execute(
|
|
115
|
+
"UPDATE sessions SET group_path = ?, updated_at = datetime('now') WHERE id = ?",
|
|
116
|
+
[groupPath, id]
|
|
117
|
+
),
|
|
118
|
+
|
|
119
|
+
getSessionsByGroup: (groupPath: string) =>
|
|
120
|
+
query<Session>(
|
|
121
|
+
"SELECT * FROM sessions WHERE group_path = ? ORDER BY updated_at DESC",
|
|
122
|
+
[groupPath]
|
|
123
|
+
),
|
|
124
|
+
|
|
125
|
+
moveSessionsToGroup: (newGroupPath: string, oldGroupPath: string) =>
|
|
126
|
+
execute(
|
|
127
|
+
"UPDATE sessions SET group_path = ?, updated_at = datetime('now') WHERE group_path = ?",
|
|
128
|
+
[newGroupPath, oldGroupPath]
|
|
129
|
+
),
|
|
130
|
+
|
|
131
|
+
updateSessionProject: (projectId: string, id: string) =>
|
|
132
|
+
execute(
|
|
133
|
+
"UPDATE sessions SET project_id = ?, updated_at = datetime('now') WHERE id = ?",
|
|
134
|
+
[projectId, id]
|
|
135
|
+
),
|
|
136
|
+
|
|
137
|
+
getSessionsByProject: (projectId: string) =>
|
|
138
|
+
query<Session>(
|
|
139
|
+
"SELECT * FROM sessions WHERE project_id = ? ORDER BY updated_at DESC",
|
|
140
|
+
[projectId]
|
|
141
|
+
),
|
|
142
|
+
|
|
143
|
+
getWorkersByConductor: (conductorId: string) =>
|
|
144
|
+
query<Session>(
|
|
145
|
+
"SELECT * FROM sessions WHERE conductor_session_id = ? ORDER BY created_at ASC",
|
|
146
|
+
[conductorId]
|
|
147
|
+
),
|
|
148
|
+
|
|
149
|
+
updateWorkerStatus: (workerStatus: string, id: string) =>
|
|
150
|
+
execute(
|
|
151
|
+
"UPDATE sessions SET worker_status = ?, updated_at = datetime('now') WHERE id = ?",
|
|
152
|
+
[workerStatus, id]
|
|
153
|
+
),
|
|
154
|
+
|
|
155
|
+
createWorkerSession: (
|
|
156
|
+
id: string,
|
|
157
|
+
name: string,
|
|
158
|
+
tmuxName: string,
|
|
159
|
+
workingDirectory: string,
|
|
160
|
+
conductorSessionId: string,
|
|
161
|
+
workerTask: string,
|
|
162
|
+
model: string | null,
|
|
163
|
+
groupPath: string,
|
|
164
|
+
agentType: string,
|
|
165
|
+
projectId: string | null
|
|
166
|
+
) =>
|
|
167
|
+
execute(
|
|
168
|
+
`INSERT INTO sessions (id, name, tmux_name, working_directory, conductor_session_id, worker_task, worker_status, model, group_path, agent_type, project_id)
|
|
169
|
+
VALUES (?, ?, ?, ?, ?, ?, 'pending', ?, ?, ?, ?)`,
|
|
170
|
+
[
|
|
171
|
+
id,
|
|
172
|
+
name,
|
|
173
|
+
tmuxName,
|
|
174
|
+
workingDirectory,
|
|
175
|
+
conductorSessionId,
|
|
176
|
+
workerTask,
|
|
177
|
+
model,
|
|
178
|
+
groupPath,
|
|
179
|
+
agentType,
|
|
180
|
+
projectId,
|
|
181
|
+
]
|
|
182
|
+
),
|
|
183
|
+
|
|
184
|
+
getAllGroups: () =>
|
|
185
|
+
query<Group>("SELECT * FROM groups ORDER BY sort_order ASC, name ASC"),
|
|
186
|
+
|
|
187
|
+
getGroup: (path: string) =>
|
|
188
|
+
queryOne<Group>("SELECT * FROM groups WHERE path = ?", [path]),
|
|
189
|
+
|
|
190
|
+
createGroup: (path: string, name: string, sortOrder: number) =>
|
|
191
|
+
execute("INSERT INTO groups (path, name, sort_order) VALUES (?, ?, ?)", [
|
|
192
|
+
path,
|
|
193
|
+
name,
|
|
194
|
+
sortOrder,
|
|
195
|
+
]),
|
|
196
|
+
|
|
197
|
+
updateGroupName: (name: string, path: string) =>
|
|
198
|
+
execute("UPDATE groups SET name = ? WHERE path = ?", [name, path]),
|
|
199
|
+
|
|
200
|
+
updateGroupExpanded: (expanded: boolean, path: string) =>
|
|
201
|
+
execute("UPDATE groups SET expanded = ? WHERE path = ?", [
|
|
202
|
+
expanded ? 1 : 0,
|
|
203
|
+
path,
|
|
204
|
+
]),
|
|
205
|
+
|
|
206
|
+
updateGroupOrder: (sortOrder: number, path: string) =>
|
|
207
|
+
execute("UPDATE groups SET sort_order = ? WHERE path = ?", [
|
|
208
|
+
sortOrder,
|
|
209
|
+
path,
|
|
210
|
+
]),
|
|
211
|
+
|
|
212
|
+
deleteGroup: (path: string) =>
|
|
213
|
+
execute("DELETE FROM groups WHERE path = ?", [path]),
|
|
214
|
+
|
|
215
|
+
createProject: (
|
|
216
|
+
id: string,
|
|
217
|
+
name: string,
|
|
218
|
+
workingDirectory: string,
|
|
219
|
+
agentType: string,
|
|
220
|
+
defaultModel: string,
|
|
221
|
+
initialPrompt: string | null,
|
|
222
|
+
sortOrder: number
|
|
223
|
+
) =>
|
|
224
|
+
execute(
|
|
225
|
+
`INSERT INTO projects (id, name, working_directory, agent_type, default_model, initial_prompt, sort_order)
|
|
226
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)`,
|
|
227
|
+
[
|
|
228
|
+
id,
|
|
229
|
+
name,
|
|
230
|
+
workingDirectory,
|
|
231
|
+
agentType,
|
|
232
|
+
defaultModel,
|
|
233
|
+
initialPrompt,
|
|
234
|
+
sortOrder,
|
|
235
|
+
]
|
|
236
|
+
),
|
|
237
|
+
|
|
238
|
+
getProject: (id: string) =>
|
|
239
|
+
queryOne<Project>("SELECT * FROM projects WHERE id = ?", [id]),
|
|
240
|
+
|
|
241
|
+
getAllProjects: () =>
|
|
242
|
+
query<Project>(
|
|
243
|
+
"SELECT * FROM projects ORDER BY is_uncategorized ASC, sort_order ASC, name ASC"
|
|
244
|
+
),
|
|
245
|
+
|
|
246
|
+
updateProject: (
|
|
247
|
+
name: string,
|
|
248
|
+
workingDirectory: string,
|
|
249
|
+
agentType: string,
|
|
250
|
+
defaultModel: string,
|
|
251
|
+
initialPrompt: string | null,
|
|
252
|
+
id: string
|
|
253
|
+
) =>
|
|
254
|
+
execute(
|
|
255
|
+
"UPDATE projects SET name = ?, working_directory = ?, agent_type = ?, default_model = ?, initial_prompt = ?, updated_at = datetime('now') WHERE id = ?",
|
|
256
|
+
[name, workingDirectory, agentType, defaultModel, initialPrompt, id]
|
|
257
|
+
),
|
|
258
|
+
|
|
259
|
+
updateProjectExpanded: (expanded: boolean, id: string) =>
|
|
260
|
+
execute("UPDATE projects SET expanded = ? WHERE id = ?", [
|
|
261
|
+
expanded ? 1 : 0,
|
|
262
|
+
id,
|
|
263
|
+
]),
|
|
264
|
+
|
|
265
|
+
updateProjectOrder: (sortOrder: number, id: string) =>
|
|
266
|
+
execute("UPDATE projects SET sort_order = ? WHERE id = ?", [sortOrder, id]),
|
|
267
|
+
|
|
268
|
+
deleteProject: (id: string) =>
|
|
269
|
+
execute("DELETE FROM projects WHERE id = ? AND is_uncategorized = 0", [id]),
|
|
270
|
+
|
|
271
|
+
createProjectDevServer: (
|
|
272
|
+
id: string,
|
|
273
|
+
projectId: string,
|
|
274
|
+
name: string,
|
|
275
|
+
type: string,
|
|
276
|
+
command: string,
|
|
277
|
+
port: number | null,
|
|
278
|
+
portEnvVar: string | null,
|
|
279
|
+
sortOrder: number
|
|
280
|
+
) =>
|
|
281
|
+
execute(
|
|
282
|
+
`INSERT INTO project_dev_servers (id, project_id, name, type, command, port, port_env_var, sort_order)
|
|
283
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
284
|
+
[id, projectId, name, type, command, port, portEnvVar, sortOrder]
|
|
285
|
+
),
|
|
286
|
+
|
|
287
|
+
getProjectDevServer: (id: string) =>
|
|
288
|
+
queryOne<ProjectDevServer>(
|
|
289
|
+
"SELECT * FROM project_dev_servers WHERE id = ?",
|
|
290
|
+
[id]
|
|
291
|
+
),
|
|
292
|
+
|
|
293
|
+
getProjectDevServers: (projectId: string) =>
|
|
294
|
+
query<ProjectDevServer>(
|
|
295
|
+
"SELECT * FROM project_dev_servers WHERE project_id = ? ORDER BY sort_order ASC",
|
|
296
|
+
[projectId]
|
|
297
|
+
),
|
|
298
|
+
|
|
299
|
+
updateProjectDevServer: (
|
|
300
|
+
name: string,
|
|
301
|
+
type: string,
|
|
302
|
+
command: string,
|
|
303
|
+
port: number | null,
|
|
304
|
+
portEnvVar: string | null,
|
|
305
|
+
sortOrder: number,
|
|
306
|
+
id: string
|
|
307
|
+
) =>
|
|
308
|
+
execute(
|
|
309
|
+
"UPDATE project_dev_servers SET name = ?, type = ?, command = ?, port = ?, port_env_var = ?, sort_order = ? WHERE id = ?",
|
|
310
|
+
[name, type, command, port, portEnvVar, sortOrder, id]
|
|
311
|
+
),
|
|
312
|
+
|
|
313
|
+
deleteProjectDevServer: (id: string) =>
|
|
314
|
+
execute("DELETE FROM project_dev_servers WHERE id = ?", [id]),
|
|
315
|
+
|
|
316
|
+
deleteProjectDevServers: (projectId: string) =>
|
|
317
|
+
execute("DELETE FROM project_dev_servers WHERE project_id = ?", [
|
|
318
|
+
projectId,
|
|
319
|
+
]),
|
|
320
|
+
|
|
321
|
+
createProjectRepository: (
|
|
322
|
+
id: string,
|
|
323
|
+
projectId: string,
|
|
324
|
+
name: string,
|
|
325
|
+
path: string,
|
|
326
|
+
isPrimary: boolean,
|
|
327
|
+
sortOrder: number
|
|
328
|
+
) =>
|
|
329
|
+
execute(
|
|
330
|
+
`INSERT INTO project_repositories (id, project_id, name, path, is_primary, sort_order)
|
|
331
|
+
VALUES (?, ?, ?, ?, ?, ?)`,
|
|
332
|
+
[id, projectId, name, path, isPrimary ? 1 : 0, sortOrder]
|
|
333
|
+
),
|
|
334
|
+
|
|
335
|
+
getProjectRepository: (id: string) =>
|
|
336
|
+
queryOne<ProjectRepository>(
|
|
337
|
+
"SELECT * FROM project_repositories WHERE id = ?",
|
|
338
|
+
[id]
|
|
339
|
+
),
|
|
340
|
+
|
|
341
|
+
getProjectRepositories: (projectId: string) =>
|
|
342
|
+
query<ProjectRepository>(
|
|
343
|
+
"SELECT * FROM project_repositories WHERE project_id = ? ORDER BY sort_order ASC",
|
|
344
|
+
[projectId]
|
|
345
|
+
),
|
|
346
|
+
|
|
347
|
+
updateProjectRepository: (
|
|
348
|
+
name: string,
|
|
349
|
+
path: string,
|
|
350
|
+
isPrimary: boolean,
|
|
351
|
+
sortOrder: number,
|
|
352
|
+
id: string
|
|
353
|
+
) =>
|
|
354
|
+
execute(
|
|
355
|
+
"UPDATE project_repositories SET name = ?, path = ?, is_primary = ?, sort_order = ? WHERE id = ?",
|
|
356
|
+
[name, path, isPrimary ? 1 : 0, sortOrder, id]
|
|
357
|
+
),
|
|
358
|
+
|
|
359
|
+
deleteProjectRepository: (id: string) =>
|
|
360
|
+
execute("DELETE FROM project_repositories WHERE id = ?", [id]),
|
|
361
|
+
|
|
362
|
+
deleteProjectRepositories: (projectId: string) =>
|
|
363
|
+
execute("DELETE FROM project_repositories WHERE project_id = ?", [
|
|
364
|
+
projectId,
|
|
365
|
+
]),
|
|
366
|
+
|
|
367
|
+
createDevServer: (
|
|
368
|
+
id: string,
|
|
369
|
+
projectId: string,
|
|
370
|
+
type: string,
|
|
371
|
+
name: string,
|
|
372
|
+
command: string,
|
|
373
|
+
status: string,
|
|
374
|
+
pid: number | null,
|
|
375
|
+
containerId: string | null,
|
|
376
|
+
ports: string,
|
|
377
|
+
workingDirectory: string
|
|
378
|
+
) =>
|
|
379
|
+
execute(
|
|
380
|
+
`INSERT INTO dev_servers (id, project_id, type, name, command, status, pid, container_id, ports, working_directory)
|
|
381
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
382
|
+
[
|
|
383
|
+
id,
|
|
384
|
+
projectId,
|
|
385
|
+
type,
|
|
386
|
+
name,
|
|
387
|
+
command,
|
|
388
|
+
status,
|
|
389
|
+
pid,
|
|
390
|
+
containerId,
|
|
391
|
+
ports,
|
|
392
|
+
workingDirectory,
|
|
393
|
+
]
|
|
394
|
+
),
|
|
395
|
+
|
|
396
|
+
getDevServer: (id: string) =>
|
|
397
|
+
queryOne<DevServer>("SELECT * FROM dev_servers WHERE id = ?", [id]),
|
|
398
|
+
|
|
399
|
+
getAllDevServers: () =>
|
|
400
|
+
query<DevServer>("SELECT * FROM dev_servers ORDER BY created_at DESC"),
|
|
401
|
+
|
|
402
|
+
getDevServersByProject: (projectId: string) =>
|
|
403
|
+
query<DevServer>(
|
|
404
|
+
"SELECT * FROM dev_servers WHERE project_id = ? ORDER BY created_at DESC",
|
|
405
|
+
[projectId]
|
|
406
|
+
),
|
|
407
|
+
|
|
408
|
+
updateDevServerStatus: (status: string, id: string) =>
|
|
409
|
+
execute(
|
|
410
|
+
"UPDATE dev_servers SET status = ?, updated_at = datetime('now') WHERE id = ?",
|
|
411
|
+
[status, id]
|
|
412
|
+
),
|
|
413
|
+
|
|
414
|
+
updateDevServerPid: (pid: number | null, status: string, id: string) =>
|
|
415
|
+
execute(
|
|
416
|
+
"UPDATE dev_servers SET pid = ?, status = ?, updated_at = datetime('now') WHERE id = ?",
|
|
417
|
+
[pid, status, id]
|
|
418
|
+
),
|
|
419
|
+
|
|
420
|
+
updateDevServer: (
|
|
421
|
+
status: string,
|
|
422
|
+
pid: number | null,
|
|
423
|
+
containerId: string | null,
|
|
424
|
+
ports: string,
|
|
425
|
+
id: string
|
|
426
|
+
) =>
|
|
427
|
+
execute(
|
|
428
|
+
"UPDATE dev_servers SET status = ?, pid = ?, container_id = ?, ports = ?, updated_at = datetime('now') WHERE id = ?",
|
|
429
|
+
[status, pid, containerId, ports, id]
|
|
430
|
+
),
|
|
431
|
+
|
|
432
|
+
deleteDevServer: (id: string) =>
|
|
433
|
+
execute("DELETE FROM dev_servers WHERE id = ?", [id]),
|
|
434
|
+
|
|
435
|
+
deleteDevServersByProject: (projectId: string) =>
|
|
436
|
+
execute("DELETE FROM dev_servers WHERE project_id = ?", [projectId]),
|
|
437
|
+
|
|
438
|
+
getHiddenItems: (itemType: string) =>
|
|
439
|
+
query<{ item_id: string }>(
|
|
440
|
+
"SELECT item_id FROM hidden_items WHERE item_type = ?",
|
|
441
|
+
[itemType]
|
|
442
|
+
),
|
|
443
|
+
|
|
444
|
+
getAllHiddenItems: () =>
|
|
445
|
+
query<{ item_type: string; item_id: string }>(
|
|
446
|
+
"SELECT item_type, item_id FROM hidden_items"
|
|
447
|
+
),
|
|
448
|
+
|
|
449
|
+
hideItem: (itemType: string, itemId: string) =>
|
|
450
|
+
execute(
|
|
451
|
+
"INSERT OR IGNORE INTO hidden_items (item_type, item_id) VALUES (?, ?)",
|
|
452
|
+
[itemType, itemId]
|
|
453
|
+
),
|
|
454
|
+
|
|
455
|
+
unhideItem: (itemType: string, itemId: string) =>
|
|
456
|
+
execute("DELETE FROM hidden_items WHERE item_type = ? AND item_id = ?", [
|
|
457
|
+
itemType,
|
|
458
|
+
itemId,
|
|
459
|
+
]),
|
|
460
|
+
};
|
package/lib/db/schema.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
|
|
3
|
+
export function createSchema(db: Database.Database): void {
|
|
4
|
+
db.exec(`
|
|
5
|
+
CREATE TABLE IF NOT EXISTS sessions (
|
|
6
|
+
id TEXT PRIMARY KEY,
|
|
7
|
+
name TEXT NOT NULL,
|
|
8
|
+
tmux_name TEXT,
|
|
9
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
10
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
11
|
+
status TEXT NOT NULL DEFAULT 'idle',
|
|
12
|
+
working_directory TEXT NOT NULL DEFAULT '~',
|
|
13
|
+
parent_session_id TEXT REFERENCES sessions(id),
|
|
14
|
+
claude_session_id TEXT,
|
|
15
|
+
model TEXT DEFAULT 'sonnet',
|
|
16
|
+
system_prompt TEXT,
|
|
17
|
+
group_path TEXT NOT NULL DEFAULT 'sessions',
|
|
18
|
+
project_id TEXT,
|
|
19
|
+
agent_type TEXT NOT NULL DEFAULT 'claude',
|
|
20
|
+
auto_approve INTEGER NOT NULL DEFAULT 0,
|
|
21
|
+
worktree_path TEXT,
|
|
22
|
+
branch_name TEXT,
|
|
23
|
+
base_branch TEXT,
|
|
24
|
+
dev_server_port INTEGER,
|
|
25
|
+
pr_url TEXT,
|
|
26
|
+
pr_number INTEGER,
|
|
27
|
+
pr_status TEXT,
|
|
28
|
+
conductor_session_id TEXT REFERENCES sessions(id),
|
|
29
|
+
worker_task TEXT,
|
|
30
|
+
worker_status TEXT
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
CREATE TABLE IF NOT EXISTS groups (
|
|
34
|
+
path TEXT PRIMARY KEY,
|
|
35
|
+
name TEXT NOT NULL,
|
|
36
|
+
expanded INTEGER NOT NULL DEFAULT 1,
|
|
37
|
+
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
38
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
INSERT OR IGNORE INTO groups (path, name, sort_order)
|
|
42
|
+
VALUES ('sessions', 'Sessions', 0);
|
|
43
|
+
|
|
44
|
+
CREATE TABLE IF NOT EXISTS dev_servers (
|
|
45
|
+
id TEXT PRIMARY KEY,
|
|
46
|
+
project_id TEXT,
|
|
47
|
+
type TEXT NOT NULL DEFAULT 'node',
|
|
48
|
+
name TEXT NOT NULL DEFAULT '',
|
|
49
|
+
command TEXT NOT NULL DEFAULT '',
|
|
50
|
+
status TEXT NOT NULL DEFAULT 'stopped',
|
|
51
|
+
pid INTEGER,
|
|
52
|
+
container_id TEXT,
|
|
53
|
+
ports TEXT NOT NULL DEFAULT '[]',
|
|
54
|
+
working_directory TEXT NOT NULL DEFAULT '',
|
|
55
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
56
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
CREATE TABLE IF NOT EXISTS projects (
|
|
60
|
+
id TEXT PRIMARY KEY,
|
|
61
|
+
name TEXT NOT NULL,
|
|
62
|
+
working_directory TEXT NOT NULL,
|
|
63
|
+
agent_type TEXT NOT NULL DEFAULT 'claude',
|
|
64
|
+
default_model TEXT NOT NULL DEFAULT 'sonnet',
|
|
65
|
+
initial_prompt TEXT,
|
|
66
|
+
expanded INTEGER NOT NULL DEFAULT 1,
|
|
67
|
+
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
68
|
+
is_uncategorized INTEGER NOT NULL DEFAULT 0,
|
|
69
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
70
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
CREATE TABLE IF NOT EXISTS project_dev_servers (
|
|
74
|
+
id TEXT PRIMARY KEY,
|
|
75
|
+
project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
76
|
+
name TEXT NOT NULL,
|
|
77
|
+
type TEXT NOT NULL DEFAULT 'node',
|
|
78
|
+
command TEXT NOT NULL,
|
|
79
|
+
port INTEGER,
|
|
80
|
+
port_env_var TEXT,
|
|
81
|
+
sort_order INTEGER NOT NULL DEFAULT 0
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
CREATE TABLE IF NOT EXISTS project_repositories (
|
|
85
|
+
id TEXT PRIMARY KEY,
|
|
86
|
+
project_id TEXT NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
|
|
87
|
+
name TEXT NOT NULL,
|
|
88
|
+
path TEXT NOT NULL,
|
|
89
|
+
is_primary INTEGER NOT NULL DEFAULT 0,
|
|
90
|
+
sort_order INTEGER NOT NULL DEFAULT 0
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_parent ON sessions(parent_session_id);
|
|
94
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_group ON sessions(group_path);
|
|
95
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_project ON sessions(project_id);
|
|
96
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_conductor ON sessions(conductor_session_id);
|
|
97
|
+
CREATE INDEX IF NOT EXISTS idx_project_dev_servers_project ON project_dev_servers(project_id);
|
|
98
|
+
CREATE INDEX IF NOT EXISTS idx_project_repositories_project ON project_repositories(project_id);
|
|
99
|
+
CREATE INDEX IF NOT EXISTS idx_dev_servers_project ON dev_servers(project_id);
|
|
100
|
+
|
|
101
|
+
CREATE TABLE IF NOT EXISTS hidden_items (
|
|
102
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
103
|
+
item_type TEXT NOT NULL,
|
|
104
|
+
item_id TEXT NOT NULL,
|
|
105
|
+
hidden_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
106
|
+
UNIQUE(item_type, item_id)
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
CREATE INDEX IF NOT EXISTS idx_hidden_items_type ON hidden_items(item_type);
|
|
110
|
+
|
|
111
|
+
INSERT OR IGNORE INTO projects (id, name, working_directory, is_uncategorized, sort_order)
|
|
112
|
+
VALUES ('uncategorized', 'Uncategorized', '~', 1, 999999);
|
|
113
|
+
`);
|
|
114
|
+
}
|
package/lib/db/types.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { AgentType } from "../providers";
|
|
2
|
+
|
|
3
|
+
export interface Session {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
tmux_name: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
updated_at: string;
|
|
9
|
+
status: "idle" | "running" | "waiting" | "error";
|
|
10
|
+
working_directory: string;
|
|
11
|
+
parent_session_id: string | null;
|
|
12
|
+
claude_session_id: string | null;
|
|
13
|
+
model: string;
|
|
14
|
+
system_prompt: string | null;
|
|
15
|
+
group_path: string; // Deprecated - use project_id
|
|
16
|
+
project_id: string | null;
|
|
17
|
+
agent_type: AgentType;
|
|
18
|
+
auto_approve: boolean;
|
|
19
|
+
// Worktree fields (optional)
|
|
20
|
+
worktree_path: string | null;
|
|
21
|
+
branch_name: string | null;
|
|
22
|
+
base_branch: string | null;
|
|
23
|
+
dev_server_port: number | null;
|
|
24
|
+
// PR tracking
|
|
25
|
+
pr_url: string | null;
|
|
26
|
+
pr_number: number | null;
|
|
27
|
+
pr_status: "open" | "merged" | "closed" | null;
|
|
28
|
+
// Orchestration fields
|
|
29
|
+
conductor_session_id: string | null;
|
|
30
|
+
worker_task: string | null;
|
|
31
|
+
worker_status: "pending" | "running" | "completed" | "failed" | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface Group {
|
|
35
|
+
path: string;
|
|
36
|
+
name: string;
|
|
37
|
+
expanded: boolean;
|
|
38
|
+
sort_order: number;
|
|
39
|
+
created_at: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface Project {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
working_directory: string;
|
|
46
|
+
agent_type: AgentType;
|
|
47
|
+
default_model: string;
|
|
48
|
+
initial_prompt: string | null;
|
|
49
|
+
expanded: boolean;
|
|
50
|
+
sort_order: number;
|
|
51
|
+
is_uncategorized: boolean;
|
|
52
|
+
created_at: string;
|
|
53
|
+
updated_at: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ProjectDevServer {
|
|
57
|
+
id: string;
|
|
58
|
+
project_id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
type: DevServerType;
|
|
61
|
+
command: string;
|
|
62
|
+
port: number | null;
|
|
63
|
+
port_env_var: string | null;
|
|
64
|
+
sort_order: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ProjectRepository {
|
|
68
|
+
id: string;
|
|
69
|
+
project_id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
path: string;
|
|
72
|
+
is_primary: boolean;
|
|
73
|
+
sort_order: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type DevServerType = "node" | "docker";
|
|
77
|
+
export type DevServerStatus = "stopped" | "starting" | "running" | "failed";
|
|
78
|
+
|
|
79
|
+
export interface DevServer {
|
|
80
|
+
id: string;
|
|
81
|
+
project_id: string;
|
|
82
|
+
type: DevServerType;
|
|
83
|
+
name: string;
|
|
84
|
+
command: string;
|
|
85
|
+
status: DevServerStatus;
|
|
86
|
+
pid: number | null;
|
|
87
|
+
container_id: string | null;
|
|
88
|
+
ports: string; // JSON array of port numbers
|
|
89
|
+
working_directory: string;
|
|
90
|
+
created_at: string;
|
|
91
|
+
updated_at: string;
|
|
92
|
+
}
|
package/lib/db.ts
ADDED