@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,140 @@
|
|
|
1
|
+
import { Button } from "@/components/ui/button";
|
|
2
|
+
import { Input } from "@/components/ui/input";
|
|
3
|
+
import {
|
|
4
|
+
Select,
|
|
5
|
+
SelectContent,
|
|
6
|
+
SelectItem,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue,
|
|
9
|
+
} from "@/components/ui/select";
|
|
10
|
+
import { Plus, Trash2, Loader2, RefreshCw, Server } from "lucide-react";
|
|
11
|
+
import type { DevServerConfig } from "./NewProjectDialog.types";
|
|
12
|
+
|
|
13
|
+
interface DevServersSectionProps {
|
|
14
|
+
devServers: DevServerConfig[];
|
|
15
|
+
isDetecting: boolean;
|
|
16
|
+
workingDirectory: string;
|
|
17
|
+
onDetect: () => void;
|
|
18
|
+
onAdd: () => void;
|
|
19
|
+
onRemove: (id: string) => void;
|
|
20
|
+
onUpdate: (id: string, updates: Partial<DevServerConfig>) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function DevServersSection({
|
|
24
|
+
devServers,
|
|
25
|
+
isDetecting,
|
|
26
|
+
workingDirectory,
|
|
27
|
+
onDetect,
|
|
28
|
+
onAdd,
|
|
29
|
+
onRemove,
|
|
30
|
+
onUpdate,
|
|
31
|
+
}: DevServersSectionProps) {
|
|
32
|
+
return (
|
|
33
|
+
<div className="space-y-3">
|
|
34
|
+
<div className="flex items-center justify-between">
|
|
35
|
+
<label className="flex items-center gap-2 text-sm font-medium">
|
|
36
|
+
<Server className="h-4 w-4" />
|
|
37
|
+
Dev Servers
|
|
38
|
+
</label>
|
|
39
|
+
<div className="flex gap-1">
|
|
40
|
+
<Button
|
|
41
|
+
type="button"
|
|
42
|
+
variant="outline"
|
|
43
|
+
size="sm"
|
|
44
|
+
onClick={onDetect}
|
|
45
|
+
disabled={
|
|
46
|
+
isDetecting || !workingDirectory || workingDirectory === "~"
|
|
47
|
+
}
|
|
48
|
+
>
|
|
49
|
+
{isDetecting ? (
|
|
50
|
+
<Loader2 className="mr-1 h-3 w-3 animate-spin" />
|
|
51
|
+
) : (
|
|
52
|
+
<RefreshCw className="mr-1 h-3 w-3" />
|
|
53
|
+
)}
|
|
54
|
+
Detect
|
|
55
|
+
</Button>
|
|
56
|
+
<Button type="button" variant="outline" size="sm" onClick={onAdd}>
|
|
57
|
+
<Plus className="mr-1 h-3 w-3" />
|
|
58
|
+
Add
|
|
59
|
+
</Button>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
{devServers.length === 0 ? (
|
|
64
|
+
<p className="text-muted-foreground py-2 text-sm">
|
|
65
|
+
No dev servers configured. Click Detect to auto-find or Add to
|
|
66
|
+
configure manually.
|
|
67
|
+
</p>
|
|
68
|
+
) : (
|
|
69
|
+
<div className="space-y-2">
|
|
70
|
+
{devServers.map((ds) => (
|
|
71
|
+
<div key={ds.id} className="bg-accent/30 space-y-2 rounded-lg p-3">
|
|
72
|
+
<div className="flex items-center gap-2">
|
|
73
|
+
<Input
|
|
74
|
+
value={ds.name}
|
|
75
|
+
onChange={(e) => onUpdate(ds.id, { name: e.target.value })}
|
|
76
|
+
placeholder="Server name"
|
|
77
|
+
className="h-8 flex-1"
|
|
78
|
+
/>
|
|
79
|
+
<Select
|
|
80
|
+
value={ds.type}
|
|
81
|
+
onValueChange={(v) =>
|
|
82
|
+
onUpdate(ds.id, { type: v as "node" | "docker" })
|
|
83
|
+
}
|
|
84
|
+
>
|
|
85
|
+
<SelectTrigger className="h-8 w-24">
|
|
86
|
+
<SelectValue />
|
|
87
|
+
</SelectTrigger>
|
|
88
|
+
<SelectContent>
|
|
89
|
+
<SelectItem value="node">Node</SelectItem>
|
|
90
|
+
<SelectItem value="docker">Docker</SelectItem>
|
|
91
|
+
</SelectContent>
|
|
92
|
+
</Select>
|
|
93
|
+
<Button
|
|
94
|
+
type="button"
|
|
95
|
+
variant="ghost"
|
|
96
|
+
size="icon-sm"
|
|
97
|
+
onClick={() => onRemove(ds.id)}
|
|
98
|
+
className="text-red-500 hover:text-red-600"
|
|
99
|
+
>
|
|
100
|
+
<Trash2 className="h-3 w-3" />
|
|
101
|
+
</Button>
|
|
102
|
+
</div>
|
|
103
|
+
<Input
|
|
104
|
+
value={ds.command}
|
|
105
|
+
onChange={(e) => onUpdate(ds.id, { command: e.target.value })}
|
|
106
|
+
placeholder={
|
|
107
|
+
ds.type === "docker" ? "Service name" : "npm run dev"
|
|
108
|
+
}
|
|
109
|
+
className="h-8"
|
|
110
|
+
/>
|
|
111
|
+
<div className="flex gap-2">
|
|
112
|
+
<Input
|
|
113
|
+
type="number"
|
|
114
|
+
value={ds.port || ""}
|
|
115
|
+
onChange={(e) =>
|
|
116
|
+
onUpdate(ds.id, {
|
|
117
|
+
port: e.target.value
|
|
118
|
+
? parseInt(e.target.value)
|
|
119
|
+
: undefined,
|
|
120
|
+
})
|
|
121
|
+
}
|
|
122
|
+
placeholder="Port (e.g., 3000)"
|
|
123
|
+
className="h-8 w-32"
|
|
124
|
+
/>
|
|
125
|
+
<Input
|
|
126
|
+
value={ds.portEnvVar || ""}
|
|
127
|
+
onChange={(e) =>
|
|
128
|
+
onUpdate(ds.id, { portEnvVar: e.target.value })
|
|
129
|
+
}
|
|
130
|
+
placeholder="Port env var (e.g., PORT)"
|
|
131
|
+
className="h-8 flex-1"
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
))}
|
|
136
|
+
</div>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Button } from "@/components/ui/button";
|
|
3
|
+
import { Input } from "@/components/ui/input";
|
|
4
|
+
import { Loader2, GitBranch, FolderOpen } from "lucide-react";
|
|
5
|
+
import { FolderPicker } from "@/components/FolderPicker";
|
|
6
|
+
import { useHomePath } from "@/hooks/useHomePath";
|
|
7
|
+
|
|
8
|
+
interface DirectoryFieldProps {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
onChange: (value: string) => void;
|
|
12
|
+
checkingDir: boolean;
|
|
13
|
+
isGitRepo: boolean;
|
|
14
|
+
recentDirs: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function DirectoryField({
|
|
18
|
+
label,
|
|
19
|
+
value,
|
|
20
|
+
onChange,
|
|
21
|
+
checkingDir,
|
|
22
|
+
isGitRepo,
|
|
23
|
+
recentDirs,
|
|
24
|
+
}: DirectoryFieldProps) {
|
|
25
|
+
const [showPicker, setShowPicker] = useState(false);
|
|
26
|
+
const { toTildePath } = useHomePath();
|
|
27
|
+
|
|
28
|
+
const handleSelect = (absolutePath: string) => {
|
|
29
|
+
onChange(toTildePath(absolutePath));
|
|
30
|
+
setShowPicker(false);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<div className="space-y-2">
|
|
36
|
+
<label className="text-sm font-medium">{label}</label>
|
|
37
|
+
<div className="flex gap-2">
|
|
38
|
+
<div className="relative flex-1">
|
|
39
|
+
<Input
|
|
40
|
+
value={value}
|
|
41
|
+
onChange={(e) => onChange(e.target.value)}
|
|
42
|
+
placeholder="~/projects/my-app"
|
|
43
|
+
/>
|
|
44
|
+
{checkingDir && (
|
|
45
|
+
<div className="absolute top-1/2 right-3 -translate-y-1/2">
|
|
46
|
+
<Loader2 className="text-muted-foreground h-4 w-4 animate-spin" />
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
<Button
|
|
51
|
+
type="button"
|
|
52
|
+
variant="outline"
|
|
53
|
+
size="icon"
|
|
54
|
+
onClick={() => setShowPicker(true)}
|
|
55
|
+
title="Browse folders"
|
|
56
|
+
>
|
|
57
|
+
<FolderOpen className="h-4 w-4" />
|
|
58
|
+
</Button>
|
|
59
|
+
</div>
|
|
60
|
+
{isGitRepo && (
|
|
61
|
+
<p className="text-muted-foreground flex items-center gap-1 text-xs">
|
|
62
|
+
<GitBranch className="h-3 w-3" />
|
|
63
|
+
Git repository
|
|
64
|
+
</p>
|
|
65
|
+
)}
|
|
66
|
+
{recentDirs.length > 0 && (
|
|
67
|
+
<div className="flex flex-wrap gap-1 pt-1">
|
|
68
|
+
{recentDirs.map((dir) => (
|
|
69
|
+
<button
|
|
70
|
+
key={dir}
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={() => onChange(dir)}
|
|
73
|
+
className="bg-muted/50 hover:bg-muted text-muted-foreground hover:text-foreground max-w-[200px] truncate rounded-full px-2 py-0.5 text-xs transition-colors"
|
|
74
|
+
title={dir}
|
|
75
|
+
>
|
|
76
|
+
{dir.replace(/^~\//, "").split("/").pop() || dir}
|
|
77
|
+
</button>
|
|
78
|
+
))}
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
{showPicker && (
|
|
84
|
+
<FolderPicker
|
|
85
|
+
initialPath={value || "~"}
|
|
86
|
+
onSelect={handleSelect}
|
|
87
|
+
onClose={() => setShowPicker(false)}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
</>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogHeader,
|
|
7
|
+
DialogTitle,
|
|
8
|
+
DialogFooter,
|
|
9
|
+
} from "@/components/ui/dialog";
|
|
10
|
+
import { Button } from "@/components/ui/button";
|
|
11
|
+
import { Input } from "@/components/ui/input";
|
|
12
|
+
import {
|
|
13
|
+
Select,
|
|
14
|
+
SelectContent,
|
|
15
|
+
SelectItem,
|
|
16
|
+
SelectTrigger,
|
|
17
|
+
SelectValue,
|
|
18
|
+
} from "@/components/ui/select";
|
|
19
|
+
import { Link, GitBranch, FolderPlus, Check } from "lucide-react";
|
|
20
|
+
import type { AgentType } from "@/lib/providers";
|
|
21
|
+
import {
|
|
22
|
+
AGENT_OPTIONS,
|
|
23
|
+
MODEL_OPTIONS,
|
|
24
|
+
CLONE_STEP,
|
|
25
|
+
} from "./NewProjectDialog.types";
|
|
26
|
+
import type { NewProjectDialogProps } from "./NewProjectDialog.types";
|
|
27
|
+
import { useNewProjectForm } from "./hooks/useNewProjectForm";
|
|
28
|
+
import { DevServersSection } from "./DevServersSection";
|
|
29
|
+
import { DirectoryField } from "./DirectoryField";
|
|
30
|
+
import {
|
|
31
|
+
CreatingOverlay,
|
|
32
|
+
type StepConfig,
|
|
33
|
+
} from "@/components/NewSessionDialog/CreatingOverlay";
|
|
34
|
+
|
|
35
|
+
const cloneSteps: StepConfig[] = [
|
|
36
|
+
{ id: CLONE_STEP.CLONING, label: "Cloning repository", icon: GitBranch },
|
|
37
|
+
{ id: CLONE_STEP.CREATING, label: "Creating project", icon: FolderPlus },
|
|
38
|
+
{ id: CLONE_STEP.DONE, label: "Done", icon: Check },
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export function NewProjectDialog({
|
|
42
|
+
open,
|
|
43
|
+
mode = "new",
|
|
44
|
+
onClose,
|
|
45
|
+
onCreated,
|
|
46
|
+
}: NewProjectDialogProps) {
|
|
47
|
+
const form = useNewProjectForm(mode, onClose, onCreated);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Dialog open={open} onOpenChange={(o) => !o && form.handleClose()}>
|
|
51
|
+
<DialogContent className="max-h-[90vh] max-w-lg overflow-y-auto">
|
|
52
|
+
{form.isCloning && (
|
|
53
|
+
<CreatingOverlay
|
|
54
|
+
isWorktree={false}
|
|
55
|
+
step={form.cloneStep}
|
|
56
|
+
steps={cloneSteps}
|
|
57
|
+
hint="This may take a moment depending on the repository size"
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
60
|
+
<DialogHeader>
|
|
61
|
+
<DialogTitle>
|
|
62
|
+
{form.isCloneMode ? "Clone from GitHub" : "New Project"}
|
|
63
|
+
</DialogTitle>
|
|
64
|
+
</DialogHeader>
|
|
65
|
+
|
|
66
|
+
<form onSubmit={form.handleSubmit} className="space-y-4">
|
|
67
|
+
{/* GitHub URL (clone mode only) */}
|
|
68
|
+
{form.isCloneMode && (
|
|
69
|
+
<div className="space-y-2">
|
|
70
|
+
<label className="text-sm font-medium">Repository URL</label>
|
|
71
|
+
<div className="relative">
|
|
72
|
+
<Input
|
|
73
|
+
value={form.githubUrl}
|
|
74
|
+
onChange={(e) => form.handleGithubUrlChange(e.target.value)}
|
|
75
|
+
placeholder="https://github.com/user/repo"
|
|
76
|
+
autoFocus
|
|
77
|
+
/>
|
|
78
|
+
<Link className="text-muted-foreground absolute top-1/2 right-3 h-4 w-4 -translate-y-1/2" />
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
{/* Project Name */}
|
|
84
|
+
<div className="space-y-2">
|
|
85
|
+
<label className="text-sm font-medium">
|
|
86
|
+
Project Name
|
|
87
|
+
{form.isCloneMode && (
|
|
88
|
+
<span className="text-muted-foreground ml-1 font-normal">
|
|
89
|
+
(optional, derived from URL)
|
|
90
|
+
</span>
|
|
91
|
+
)}
|
|
92
|
+
</label>
|
|
93
|
+
<Input
|
|
94
|
+
value={form.name}
|
|
95
|
+
onChange={(e) => form.setName(e.target.value)}
|
|
96
|
+
placeholder={
|
|
97
|
+
form.isCloneMode
|
|
98
|
+
? "auto-detected from URL"
|
|
99
|
+
: "my-awesome-project"
|
|
100
|
+
}
|
|
101
|
+
autoFocus={!form.isCloneMode}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
{/* Working Directory */}
|
|
106
|
+
<DirectoryField
|
|
107
|
+
label={form.isCloneMode ? "Clone Into" : "Working Directory"}
|
|
108
|
+
value={form.workingDirectory}
|
|
109
|
+
onChange={form.setWorkingDirectory}
|
|
110
|
+
checkingDir={form.checkingDir}
|
|
111
|
+
isGitRepo={form.isGitRepo}
|
|
112
|
+
recentDirs={form.recentDirs}
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
{/* Agent Type */}
|
|
116
|
+
<div className="space-y-2">
|
|
117
|
+
<label className="text-sm font-medium">Default Agent</label>
|
|
118
|
+
<Select
|
|
119
|
+
value={form.agentType}
|
|
120
|
+
onValueChange={(v) => form.setAgentType(v as AgentType)}
|
|
121
|
+
>
|
|
122
|
+
<SelectTrigger>
|
|
123
|
+
<SelectValue />
|
|
124
|
+
</SelectTrigger>
|
|
125
|
+
<SelectContent>
|
|
126
|
+
{AGENT_OPTIONS.map((opt) => (
|
|
127
|
+
<SelectItem key={opt.value} value={opt.value}>
|
|
128
|
+
{opt.label}
|
|
129
|
+
</SelectItem>
|
|
130
|
+
))}
|
|
131
|
+
</SelectContent>
|
|
132
|
+
</Select>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
{/* Default Model */}
|
|
136
|
+
<div className="space-y-2">
|
|
137
|
+
<label className="text-sm font-medium">Default Model</label>
|
|
138
|
+
<Select
|
|
139
|
+
value={form.defaultModel}
|
|
140
|
+
onValueChange={form.setDefaultModel}
|
|
141
|
+
>
|
|
142
|
+
<SelectTrigger>
|
|
143
|
+
<SelectValue />
|
|
144
|
+
</SelectTrigger>
|
|
145
|
+
<SelectContent>
|
|
146
|
+
{MODEL_OPTIONS.map((opt) => (
|
|
147
|
+
<SelectItem key={opt.value} value={opt.value}>
|
|
148
|
+
{opt.label}
|
|
149
|
+
</SelectItem>
|
|
150
|
+
))}
|
|
151
|
+
</SelectContent>
|
|
152
|
+
</Select>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{/* Dev Servers (hidden in clone mode) */}
|
|
156
|
+
{!form.isCloneMode && (
|
|
157
|
+
<DevServersSection
|
|
158
|
+
devServers={form.devServers}
|
|
159
|
+
isDetecting={form.isDetecting}
|
|
160
|
+
workingDirectory={form.workingDirectory}
|
|
161
|
+
onDetect={form.detectDevServers}
|
|
162
|
+
onAdd={form.addDevServer}
|
|
163
|
+
onRemove={form.removeDevServer}
|
|
164
|
+
onUpdate={form.updateDevServer}
|
|
165
|
+
/>
|
|
166
|
+
)}
|
|
167
|
+
|
|
168
|
+
{form.error && <p className="text-sm text-red-500">{form.error}</p>}
|
|
169
|
+
|
|
170
|
+
<DialogFooter>
|
|
171
|
+
<Button type="button" variant="outline" onClick={form.handleClose}>
|
|
172
|
+
Cancel
|
|
173
|
+
</Button>
|
|
174
|
+
<Button type="submit" disabled={form.isPending || form.isCloning}>
|
|
175
|
+
{form.isCloning
|
|
176
|
+
? "Cloning..."
|
|
177
|
+
: form.isPending
|
|
178
|
+
? "Creating..."
|
|
179
|
+
: form.isCloneMode
|
|
180
|
+
? "Clone & Create"
|
|
181
|
+
: "Create Project"}
|
|
182
|
+
</Button>
|
|
183
|
+
</DialogFooter>
|
|
184
|
+
</form>
|
|
185
|
+
</DialogContent>
|
|
186
|
+
</Dialog>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AgentType } from "@/lib/providers";
|
|
2
|
+
|
|
3
|
+
export const CLONE_STEP = {
|
|
4
|
+
IDLE: "idle",
|
|
5
|
+
CLONING: "cloning",
|
|
6
|
+
CREATING: "creating",
|
|
7
|
+
DONE: "done",
|
|
8
|
+
} as const;
|
|
9
|
+
|
|
10
|
+
export type CloneStep = (typeof CLONE_STEP)[keyof typeof CLONE_STEP];
|
|
11
|
+
|
|
12
|
+
export interface DevServerConfig {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
type: "node" | "docker";
|
|
16
|
+
command: string;
|
|
17
|
+
port?: number;
|
|
18
|
+
portEnvVar?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface NewProjectDialogProps {
|
|
22
|
+
open: boolean;
|
|
23
|
+
mode?: "new" | "clone";
|
|
24
|
+
onClose: () => void;
|
|
25
|
+
onCreated: (projectId: string) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const RECENT_DIRS_KEY = "agentOS:recentDirectories";
|
|
29
|
+
export const MAX_RECENT_DIRS = 5;
|
|
30
|
+
|
|
31
|
+
export const AGENT_OPTIONS: { value: AgentType; label: string }[] = [
|
|
32
|
+
{ value: "claude", label: "Claude Code" },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export const MODEL_OPTIONS = [
|
|
36
|
+
{ value: "sonnet", label: "Sonnet" },
|
|
37
|
+
{ value: "opus", label: "Opus" },
|
|
38
|
+
{ value: "haiku", label: "Haiku" },
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export function extractRepoName(url: string): string | null {
|
|
42
|
+
const match = url.match(
|
|
43
|
+
/(?:github\.com[/:][\w.-]+\/([\w.-]+?)(?:\.git)?|^([\w.-]+)\.git)$/
|
|
44
|
+
);
|
|
45
|
+
return match ? match[1] || match[2] || null : null;
|
|
46
|
+
}
|