@siteboon/claude-code-ui 1.10.5 → 1.11.0
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/README.md +55 -17
- package/dist/assets/{index-C4hbM6ph.js → index-BZX1vtg9.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +3 -2
- package/server/cli.js +225 -0
- package/server/database/db.js +26 -1
- package/server/index.js +59 -30
package/README.md
CHANGED
|
@@ -69,8 +69,7 @@ npx @siteboon/claude-code-ui
|
|
|
69
69
|
|
|
70
70
|
The server will start and be accessible at `http://localhost:3001` (or your configured PORT).
|
|
71
71
|
|
|
72
|
-
**To restart**: Simply run the same `npx` command again after stopping the server
|
|
73
|
-
|
|
72
|
+
**To restart**: Simply run the same `npx` command again after stopping the server
|
|
74
73
|
### Global Installation (For Regular Use)
|
|
75
74
|
|
|
76
75
|
For frequent use, install globally once:
|
|
@@ -85,32 +84,71 @@ Then start with a simple command:
|
|
|
85
84
|
claude-code-ui
|
|
86
85
|
```
|
|
87
86
|
|
|
88
|
-
**Benefits**:
|
|
89
|
-
- Faster startup (no download/cache check)
|
|
90
|
-
- Simple command to remember
|
|
91
|
-
- Same experience every time
|
|
92
87
|
|
|
93
88
|
**To restart**: Stop with Ctrl+C and run `claude-code-ui` again.
|
|
94
89
|
|
|
95
|
-
###
|
|
90
|
+
### CLI Commands
|
|
96
91
|
|
|
97
|
-
|
|
92
|
+
After global installation, you have access to both `claude-code-ui` and `cloudcli` commands:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Start the server (default command)
|
|
96
|
+
claude-code-ui
|
|
97
|
+
cloudcli start
|
|
98
|
+
|
|
99
|
+
# Show configuration and data locations
|
|
100
|
+
cloudcli status
|
|
101
|
+
|
|
102
|
+
# Show help information
|
|
103
|
+
cloudcli help
|
|
104
|
+
|
|
105
|
+
# Show version
|
|
106
|
+
cloudcli version
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**The `cloudcli status` command shows you:**
|
|
110
|
+
- Installation directory location
|
|
111
|
+
- Database location (where credentials are stored)
|
|
112
|
+
- Current configuration (PORT, DATABASE_PATH, etc.)
|
|
113
|
+
- Claude projects folder location
|
|
114
|
+
- Configuration file location
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Run as Background Service (Recommended for Production)
|
|
119
|
+
|
|
120
|
+
For production use, run Claude Code UI as a background service using PM2 (Process Manager 2):
|
|
121
|
+
|
|
122
|
+
#### Install PM2
|
|
98
123
|
|
|
99
124
|
```bash
|
|
100
|
-
# Install PM2 globally (one-time)
|
|
101
125
|
npm install -g pm2
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Start as Background Service
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Start the server in background
|
|
132
|
+
pm2 start claude-code-ui --name "claude-code-ui"
|
|
133
|
+
|
|
134
|
+
# Or using the shorter alias
|
|
135
|
+
pm2 start cloudcli --name "claude-code-ui"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
#### Auto-Start on System Boot
|
|
102
140
|
|
|
103
|
-
|
|
104
|
-
pm2 start claude-code-ui --name "claude-ui"
|
|
141
|
+
To make Claude Code UI start automatically when your system boots:
|
|
105
142
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
pm2
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
pm2
|
|
143
|
+
```bash
|
|
144
|
+
# Generate startup script for your platform
|
|
145
|
+
pm2 startup
|
|
146
|
+
|
|
147
|
+
# Save current process list
|
|
148
|
+
pm2 save
|
|
112
149
|
```
|
|
113
150
|
|
|
151
|
+
|
|
114
152
|
### Local Development Installation
|
|
115
153
|
|
|
116
154
|
1. **Clone the repository:**
|
|
@@ -918,7 +918,7 @@ abc123`})]})]}),F.importMode==="form"&&(F.type==="sse"||F.type==="http")&&t.jsxs
|
|
|
918
918
|
DEBUG=true`})]}),F.importMode==="form"&&(F.type==="sse"||F.type==="http")&&t.jsxs("div",{children:[t.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:"Headers (KEY=value, one per line)"}),t.jsx("textarea",{value:Object.entries(F.config.headers||{}).map(([A,ie])=>`${A}=${ie}`).join(`
|
|
919
919
|
`),onChange:A=>{const ie={};A.target.value.split(`
|
|
920
920
|
`).forEach(Oe=>{const[ut,...pt]=Oe.split("=");ut&&ut.trim()&&(ie[ut.trim()]=pt.join("=").trim())}),Tt("headers",ie)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-lg focus:ring-blue-500 focus:border-blue-500",rows:"3",placeholder:`Authorization=Bearer token
|
|
921
|
-
X-API-Key=your-key`})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[t.jsx(Le,{type:"button",variant:"outline",onClick:wt,children:"Cancel"}),t.jsx(Le,{type:"submit",disabled:v,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:v?"Saving...":z?"Update Server":"Add Server"})]})]})]})})]}),ge==="cursor"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(En,{className:"w-5 h-5 text-orange-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Cursor Permission Settings"})]}),t.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("label",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"checkbox",checked:ne,onChange:A=>Ce(A.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2 checked:bg-blue-600 dark:checked:bg-blue-600"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),t.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to -f flag in Cursor CLI"})]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Xn,{className:"w-5 h-5 text-purple-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),t.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-purple-900 dark:text-purple-100",children:"Cursor CLI Login"}),t.jsx("div",{className:"text-sm text-purple-700 dark:text-purple-300",children:"Sign in to your Cursor account to enable AI features"})]}),t.jsxs(Le,{onClick:$,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[t.jsx(Xn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Os,{className:"w-5 h-5 text-green-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that are automatically allowed without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:De,onChange:A=>ee(A.target.value),placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',onKeyPress:A=>{A.key==="Enter"&&De&&!Q.includes(De)&&(de([...Q,De]),ee(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>{De&&!Q.includes(De)&&(de([...Q,De]),ee(""))},disabled:!De,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common commands:"}),t.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:Kt.map(A=>t.jsx(Le,{variant:"outline",size:"sm",onClick:()=>{Q.includes(A)||de([...Q,A])},disabled:Q.includes(A),className:"text-xs h-8 touch-manipulation truncate",children:A},A))})]}),t.jsxs("div",{className:"space-y-2",children:[Q.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>de(Q.filter(ie=>ie!==A)),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),Q.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed shell commands configured"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Os,{className:"w-5 h-5 text-red-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that should always be denied"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:me,onChange:A=>oe(A.target.value),placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',onKeyPress:A=>{A.key==="Enter"&&me&&!T.includes(me)&&(O([...T,me]),oe(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>{me&&!T.includes(me)&&(O([...T,me]),oe(""))},disabled:!me,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[T.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>O(T.filter(ie=>ie!==A)),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),T.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed shell commands configured"})]})]}),t.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:"Cursor Shell Command Examples:"}),t.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," - Allow ls command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," - Allow git status command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(mkdir)"'})," - Allow mkdir command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"-f"'})," flag - Skip all permission prompts (dangerous)"]})]})]})]})]}),Pe==="tasks"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:m?t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking TaskMaster installation..."})]})}):t.jsxs(t.Fragment,{children:[!c&&t.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:"TaskMaster AI CLI Not Installed"}),t.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[t.jsx("p",{children:"TaskMaster CLI is required to use task management features. Install it to get started:"}),t.jsxs("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:[t.jsx("code",{children:"npm install -g task-master-ai"}),t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"font-medium",children:"After installation:"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[t.jsx("li",{children:"Restart this application"}),t.jsx("li",{children:"TaskMaster features will automatically become available"}),t.jsxs("li",{children:["Use ",t.jsx("code",{className:"bg-orange-100 dark:bg-orange-800 px-1 rounded",children:"task-master init"})," in your project directory"]})]})]})]})]})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Enable TaskMaster Integration"}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"}),!c&&t.jsx("div",{className:"text-xs text-orange-600 dark:text-orange-400 mt-1",children:"TaskMaster CLI must be installed first"})]}),t.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:o,onChange:A=>l(A.target.checked),disabled:!c,className:"sr-only peer"}),t.jsx("div",{className:`w-11 h-6 ${c?"bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800":"bg-gray-300 dark:bg-gray-600"} rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600`})]})]})}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(va,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"🎯 About TaskMaster AI"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:[t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks with AI assistance"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"PRD:"})," Generate structured tasks from Product Requirements Documents"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards, and detailed task views"]})]})]}),t.jsx("div",{className:"mt-4 pt-4 border-t border-blue-200 dark:border-blue-700",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-6 h-6 bg-blue-100 dark:bg-blue-800 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-3 h-3 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"📚 Learn More & Tutorial"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:["TaskMaster AI (aka ",t.jsx("strong",{children:"claude-task-master"})," ) is an advanced AI-powered task management system built for developers."]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]}),t.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Find documentation, setup guides, and examples for advanced TaskMaster workflows"})]})]})]})]})})]})})]})]})}),Pe==="api"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:t.jsx(c1,{})})]})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[t.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[L==="success"&&t.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Settings saved successfully!"]}),L==="error"&&t.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"Failed to save settings"]})]}),t.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[t.jsx(Le,{variant:"outline",onClick:r,disabled:M,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"Cancel"}),t.jsx(Le,{onClick:q,disabled:M,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:M?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"Saving..."]}):"Save Settings"})]})]})]}),Be&&t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 max-md:items-stretch max-md:justify-stretch",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:Xe==="claude"?"Claude CLI Login":"Cursor CLI Login"}),t.jsx("button",{onClick:()=>ze(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:t.jsx(ct,{className:"w-6 h-6"})})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(iu,{project:ot,command:Xe==="claude"?"claude /login":"cursor-agent login",onComplete:ae,showHeader:!1})})]})})]}):null}function u1(){const{isDarkMode:e,toggleDarkMode:r}=Ti();return t.jsxs("button",{onClick:r,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":e,"aria-label":"Toggle dark mode",children:[t.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),t.jsx("span",{className:`${e?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:e?t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):t.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const m1=({isOpen:e,onToggle:r,autoExpandTools:n,onAutoExpandChange:s,showRawParameters:a,onShowRawParametersChange:i,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:c,onAutoScrollChange:d,sendByCtrlEnter:u,onSendByCtrlEnterChange:m,isMobile:h})=>{const[p,g]=f.useState(e),[x,b]=f.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:k}=Ti();f.useEffect(()=>{g(e)},[e]);const N=()=>{const y=!p;g(y),r(y)};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`fixed ${h?"bottom-44":"top-1/2 -translate-y-1/2"} ${p?"right-64":"right-0"} z-50 transition-all duration-150 ease-out`,children:t.jsx("button",{onClick:N,className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg","aria-label":p?"Close settings panel":"Open settings panel",children:p?t.jsx(Er,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):t.jsx(xm,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}),t.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl transform transition-transform duration-150 ease-out z-40 ${p?"translate-x-0":"translate-x-full"} ${h?"h-screen":""}`,children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:t.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[t.jsx(Tp,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),"Quick Settings"]})}),t.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-white dark:bg-gray-900 ${h?"pb-20":""}`,children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Appearance"}),t.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[k?t.jsx(ba,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):t.jsx(ka,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Dark Mode"]}),t.jsx(u1,{})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Tool Display"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ri,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-expand tools"]}),t.jsx("input",{type:"checkbox",checked:n,onChange:y=>s(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx($n,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show raw parameters"]}),t.jsx("input",{type:"checkbox",checked:a,onChange:y=>i(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ql,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show thinking"]}),t.jsx("input",{type:"checkbox",checked:o,onChange:y=>l(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"View Options"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(Hl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-scroll to bottom"]}),t.jsx("input",{type:"checkbox",checked:c,onChange:y=>d(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Input Settings"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ip,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Send by Ctrl+Enter"]}),t.jsx("input",{type:"checkbox",checked:u,onChange:y=>m(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends."})]}),t.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Whisper Dictation"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:x==="default",onChange:()=>{b("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(ds,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Default Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Direct transcription of your speech"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:x==="prompt",onChange:()=>{b("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(Ir,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Prompt Enhancement"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Transform rough ideas into clear, detailed AI prompts"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:x==="vibe"||x==="instructions"||x==="architect",onChange:()=>{b("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx($t,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Vibe Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Format ideas as clear agent instructions with details"})]})]})]})]})]})]})}),p&&t.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:N})]})},p1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(""),{register:u}=Es(),m=async h=>{if(h.preventDefault(),d(""),n!==a){d("Passwords do not match");return}if(e.length<3){d("Username must be at least 3 characters long");return}if(n.length<6){d("Password must be at least 6 characters long");return}l(!0);const p=await u(e,n);p.success||d(p.error),l(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(lr,{size:64})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),t.jsxs("form",{onSubmit:m,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:h=>r(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),t.jsx("input",{type:"password",id:"confirmPassword",value:a,onChange:h=>i(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),c&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),t.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},h1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(!1),[o,l]=f.useState(""),{login:c}=Es(),d=async u=>{if(u.preventDefault(),l(""),!e||!n){l("Please enter both username and password");return}i(!0);const m=await c(e,n);m.success||l(m.error),i(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(Dn,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome Back"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign in to your Claude Code UI account"})]}),t.jsxs("form",{onSubmit:d,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:u=>r(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:a})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:u=>s(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:a})]}),o&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),t.jsx("button",{type:"submit",disabled:a,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"Signing in...":"Sign In"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},f1=()=>t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(Dn,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),g1=({children:e})=>{const{user:r,isLoading:n,needsSetup:s}=Es();return n?t.jsx(f1,{}):s?t.jsx(p1,{}):r?e:t.jsx(h1,{})},Ll="1.10.4",x1=(e,r)=>{const[n,s]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null);return f.useEffect(()=>{const c=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${r}/releases/latest`)).json();if(m.tag_name){const h=m.tag_name.replace(/^v/,"");i(h),s(Ll!==h),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${r}/releases/latest`,publishedAt:m.published_at})}else s(!1),i(null),l(null)}catch(u){console.error("Version check failed:",u),s(!1),i(null),l(null)}};c();const d=setInterval(c,300*1e3);return()=>clearInterval(d)},[e,r]),{updateAvailable:n,latestVersion:a,currentVersion:Ll,releaseInfo:o}};function Qr(e,r){const[n,s]=f.useState(()=>{if(typeof window>"u")return r;try{const i=window.localStorage.getItem(e);return i?JSON.parse(i):r}catch(i){return console.log(i),r}});return[n,i=>{if(!(typeof window>"u"))try{const o=i instanceof Function?i(n):i;window.localStorage.setItem(e,JSON.stringify(o)),s(o)}catch(o){console.log(o)}}]}function Rl(){const e=Gu(),{sessionId:r}=Ku(),{updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i}=x1("siteboon","claudecodeui"),[o,l]=f.useState(!1),[c,d]=f.useState([]),[u,m]=f.useState(null),[h,p]=f.useState(null),[g,x]=f.useState("chat"),[b,k]=f.useState(!1),[N,y]=f.useState(!1),[P,W]=f.useState(!0),[M,B]=f.useState(!1),[L,U]=f.useState(!1),[j,R]=f.useState("tools"),[D,_]=f.useState(!1),[C,V]=Qr("autoExpandTools",!1),[z,Z]=Qr("showRawParameters",!1),[F,ce]=Qr("showThinking",!0),[v,ue]=Qr("autoScrollToBottom",!0),[fe,w]=Qr("sendByCtrlEnter",!1),[J,he]=Qr("sidebarVisible",!0),[ye,re]=f.useState(new Set),[Pe,X]=f.useState(new Set),[le,ke]=f.useState(0),{ws:ge,sendMessage:Ie,messages:Ke}=mc(),[et,st]=f.useState(!1);f.useEffect(()=>{const ee=()=>{const me=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");st(me),me?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return ee(),window.matchMedia("(display-mode: standalone)").addEventListener("change",ee),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",ee)}},[]),f.useEffect(()=>{const ee=()=>{k(window.innerWidth<768)};return ee(),window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)},[]),f.useEffect(()=>{tt()},[]);const ft=(ee,me,oe,we)=>{if(!oe||!we)return!0;const Ee=ee?.find(ot=>ot.name===oe.name),Be=me?.find(ot=>ot.name===oe.name);if(!Ee||!Be)return!1;const ze=Ee.sessions?.find(ot=>ot.id===we.id),Xe=Be.sessions?.find(ot=>ot.id===we.id);return!ze||!Xe?!1:ze.id===Xe.id&&ze.title===Xe.title&&ze.created_at===Xe.created_at&&ze.updated_at===Xe.updated_at};f.useEffect(()=>{if(Ke.length>0){const ee=Ke[Ke.length-1];if(ee.type==="projects_updated"){if(ee.changedFile&&h&&u){const we=ee.changedFile.split("/");we.length>=2&&we[we.length-1].replace(".jsonl","")===h.id&&(ye.has(h.id)||ke(Xe=>Xe+1))}if(h&&ye.has(h.id)||ye.size>0&&Array.from(ye).some(we=>we.startsWith("new-session-"))){const we=ee.projects;if(!ft(c,we,u,h))return}const oe=ee.projects;if(d(oe),u){const we=oe.find(Ee=>Ee.name===u.name);we&&(JSON.stringify(we)!==JSON.stringify(u)&&m(we),h&&(we.sessions?.find(Be=>Be.id===h.id)||p(null)))}}}},[Ke,u,h,ye]);const tt=async()=>{try{W(!0);const me=await(await Ue.projects()).json();for(let oe of me)try{const we=`/api/cursor/sessions?projectPath=${encodeURIComponent(oe.fullPath||oe.path)}`,Ee=await Fe(we);if(Ee.ok){const Be=await Ee.json();Be.success&&Be.sessions?oe.cursorSessions=Be.sessions:oe.cursorSessions=[]}else oe.cursorSessions=[]}catch(we){console.error(`Error fetching Cursor sessions for project ${oe.name}:`,we),oe.cursorSessions=[]}d(oe=>oe.length===0||me.some((Ee,Be)=>{const ze=oe[Be];return ze?Ee.name!==ze.name||Ee.displayName!==ze.displayName||Ee.fullPath!==ze.fullPath||JSON.stringify(Ee.sessionMeta)!==JSON.stringify(ze.sessionMeta)||JSON.stringify(Ee.sessions)!==JSON.stringify(ze.sessions)||JSON.stringify(Ee.cursorSessions)!==JSON.stringify(ze.cursorSessions):!0})||me.length!==oe.length?me:oe)}catch(ee){console.error("Error fetching projects:",ee)}finally{W(!1)}};window.refreshProjects=tt,window.openSettings=f.useCallback((ee="tools")=>{R(ee),U(!0)},[]),f.useEffect(()=>{if(r&&c.length>0){const ee=!h||h.id!==r;for(const me of c){let oe=me.sessions?.find(Ee=>Ee.id===r);if(oe){m(me),p({...oe,__provider:"claude"}),ee&&x("chat");return}const we=me.cursorSessions?.find(Ee=>Ee.id===r);if(we){m(me),p({...we,__provider:"cursor"}),ee&&x("chat");return}}}},[r,c,e]);const xe=ee=>{m(ee),p(null),e("/"),b&&y(!1)},qe=ee=>{if(p(ee),g!=="git"&&g!=="preview"&&x("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",ee.id),b){const oe=ee.__projectName,we=u?.name;oe!==we&&y(!1)}e(`/session/${ee.id}`)},it=ee=>{m(ee),p(null),x("chat"),e("/"),b&&y(!1)},ve=ee=>{h?.id===ee&&(p(null),e("/")),d(me=>me.map(oe=>({...oe,sessions:oe.sessions?.filter(we=>we.id!==ee)||[],sessionMeta:{...oe.sessionMeta,total:Math.max(0,(oe.sessionMeta?.total||0)-1)}})))},Ct=async()=>{try{const me=await(await Ue.projects()).json();if(d(oe=>me.some((Ee,Be)=>{const ze=oe[Be];return ze?Ee.name!==ze.name||Ee.displayName!==ze.displayName||Ee.fullPath!==ze.fullPath||JSON.stringify(Ee.sessionMeta)!==JSON.stringify(ze.sessionMeta)||JSON.stringify(Ee.sessions)!==JSON.stringify(ze.sessions):!0})||me.length!==oe.length?me:oe),u){const oe=me.find(we=>we.name===u.name);if(oe&&(JSON.stringify(oe)!==JSON.stringify(u)&&m(oe),h)){const we=oe.sessions?.find(Ee=>Ee.id===h.id);we&&JSON.stringify(we)!==JSON.stringify(h)&&p(we)}}}catch(ee){console.error("Error refreshing sidebar:",ee)}},Q=ee=>{u?.name===ee&&(m(null),p(null),e("/")),d(me=>me.filter(oe=>oe.name!==ee))},de=f.useCallback(ee=>{ee&&re(me=>new Set([...me,ee]))},[]),T=f.useCallback(ee=>{ee&&re(me=>{const oe=new Set(me);return oe.delete(ee),oe})},[]),O=f.useCallback(ee=>{ee&&X(me=>new Set([...me,ee]))},[]),ne=f.useCallback(ee=>{ee&&X(me=>{const oe=new Set(me);return oe.delete(ee),oe})},[]),Ce=f.useCallback(ee=>{ee&&re(me=>{const oe=new Set;for(const we of me)we.startsWith("new-session-")||oe.add(we);return oe.add(ee),oe})},[]),De=()=>{const[ee,me]=f.useState(!1),[oe,we]=f.useState(""),[Ee,Be]=f.useState("");if(!o)return null;const ze=gt=>gt?gt.replace(/\b[0-9a-f]{40}\b/gi,"").replace(/(?:^|\s|-)([0-9a-f]{7,10})\b/gi,"").replace(/\*\*Full Changelog\*\*:.*$/gim,"").replace(/https?:\/\/github\.com\/[^\/]+\/[^\/]+\/compare\/[^\s)]+/gi,"").replace(/\n\s*\n\s*\n/g,`
|
|
921
|
+
X-API-Key=your-key`})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[t.jsx(Le,{type:"button",variant:"outline",onClick:wt,children:"Cancel"}),t.jsx(Le,{type:"submit",disabled:v,className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50",children:v?"Saving...":z?"Update Server":"Add Server"})]})]})]})})]}),ge==="cursor"&&t.jsxs("div",{className:"space-y-6 md:space-y-8",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(En,{className:"w-5 h-5 text-orange-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Cursor Permission Settings"})]}),t.jsx("div",{className:"bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("label",{className:"flex items-center gap-3",children:[t.jsx("input",{type:"checkbox",checked:ne,onChange:A=>Ce(A.target.checked),className:"w-4 h-4 text-blue-600 bg-gray-100 dark:bg-gray-700 border-gray-300 dark:border-gray-600 rounded focus:ring-blue-500 focus:ring-2 checked:bg-blue-600 dark:checked:bg-blue-600"}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100",children:"Skip permission prompts (use with caution)"}),t.jsx("div",{className:"text-sm text-orange-700 dark:text-orange-300",children:"Equivalent to -f flag in Cursor CLI"})]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Xn,{className:"w-5 h-5 text-purple-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Authentication"})]}),t.jsx("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-purple-900 dark:text-purple-100",children:"Cursor CLI Login"}),t.jsx("div",{className:"text-sm text-purple-700 dark:text-purple-300",children:"Sign in to your Cursor account to enable AI features"})]}),t.jsxs(Le,{onClick:$,className:"bg-purple-600 hover:bg-purple-700 text-white",size:"sm",children:[t.jsx(Xn,{className:"w-4 h-4 mr-2"}),"Login"]})]})})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Os,{className:"w-5 h-5 text-green-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Allowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that are automatically allowed without prompting for permission"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:De,onChange:A=>ee(A.target.value),placeholder:'e.g., "Shell(ls)" or "Shell(git status)"',onKeyPress:A=>{A.key==="Enter"&&De&&!Q.includes(De)&&(de([...Q,De]),ee(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>{De&&!Q.includes(De)&&(de([...Q,De]),ee(""))},disabled:!De,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:"Quick add common commands:"}),t.jsx("div",{className:"grid grid-cols-2 sm:flex sm:flex-wrap gap-2",children:Kt.map(A=>t.jsx(Le,{variant:"outline",size:"sm",onClick:()=>{Q.includes(A)||de([...Q,A])},disabled:Q.includes(A),className:"text-xs h-8 touch-manipulation truncate",children:A},A))})]}),t.jsxs("div",{className:"space-y-2",children:[Q.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-green-800 dark:text-green-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>de(Q.filter(ie=>ie!==A)),className:"text-green-600 hover:text-green-700 dark:text-green-400 dark:hover:text-green-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),Q.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No allowed shell commands configured"})]})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Os,{className:"w-5 h-5 text-red-500"}),t.jsx("h3",{className:"text-lg font-medium text-foreground",children:"Disallowed Shell Commands"})]}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Shell commands that should always be denied"}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[t.jsx(Et,{value:me,onChange:A=>oe(A.target.value),placeholder:'e.g., "Shell(rm -rf)" or "Shell(sudo)"',onKeyPress:A=>{A.key==="Enter"&&me&&!T.includes(me)&&(O([...T,me]),oe(""))},className:"flex-1 h-10 touch-manipulation",style:{fontSize:"16px"}}),t.jsxs(Le,{onClick:()=>{me&&!T.includes(me)&&(O([...T,me]),oe(""))},disabled:!me,size:"sm",className:"h-10 px-4 touch-manipulation",children:[t.jsx(Dt,{className:"w-4 h-4 mr-2 sm:mr-0"}),t.jsx("span",{className:"sm:hidden",children:"Add Command"})]})]}),t.jsxs("div",{className:"space-y-2",children:[T.map(A=>t.jsxs("div",{className:"flex items-center justify-between bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:[t.jsx("span",{className:"font-mono text-sm text-red-800 dark:text-red-200",children:A}),t.jsx(Le,{variant:"ghost",size:"sm",onClick:()=>O(T.filter(ie=>ie!==A)),className:"text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300",children:t.jsx(ct,{className:"w-4 h-4"})})]},A)),T.length===0&&t.jsx("div",{className:"text-center py-8 text-gray-500 dark:text-gray-400",children:"No disallowed shell commands configured"})]})]}),t.jsxs("div",{className:"bg-purple-50 dark:bg-purple-900/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:[t.jsx("h4",{className:"font-medium text-purple-900 dark:text-purple-100 mb-2",children:"Cursor Shell Command Examples:"}),t.jsxs("ul",{className:"text-sm text-purple-800 dark:text-purple-200 space-y-1",children:[t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(ls)"'})," - Allow ls command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(git status)"'})," - Allow git status command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"Shell(mkdir)"'})," - Allow mkdir command"]}),t.jsxs("li",{children:[t.jsx("code",{className:"bg-purple-100 dark:bg-purple-800 px-1 rounded",children:'"-f"'})," flag - Skip all permission prompts (dangerous)"]})]})]})]})]}),Pe==="tasks"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:m?t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("div",{className:"animate-spin w-5 h-5 border-2 border-blue-600 border-t-transparent rounded-full"}),t.jsx("span",{className:"text-sm text-muted-foreground",children:"Checking TaskMaster installation..."})]})}):t.jsxs(t.Fragment,{children:[!c&&t.jsx("div",{className:"bg-orange-50 dark:bg-orange-950/50 border border-orange-200 dark:border-orange-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-orange-100 dark:bg-orange-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-4 h-4 text-orange-600 dark:text-orange-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-orange-900 dark:text-orange-100 mb-2",children:"TaskMaster AI CLI Not Installed"}),t.jsxs("div",{className:"text-sm text-orange-800 dark:text-orange-200 space-y-3",children:[t.jsx("p",{children:"TaskMaster CLI is required to use task management features. Install it to get started:"}),t.jsxs("div",{className:"bg-orange-100 dark:bg-orange-900/50 rounded-lg p-3 font-mono text-sm",children:[t.jsx("code",{children:"npm install -g task-master-ai"}),t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"font-medium",children:"After installation:"}),t.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-xs",children:[t.jsx("li",{children:"Restart this application"}),t.jsx("li",{children:"TaskMaster features will automatically become available"}),t.jsxs("li",{children:["Use ",t.jsx("code",{className:"bg-orange-100 dark:bg-orange-800 px-1 rounded",children:"task-master init"})," in your project directory"]})]})]})]})]})]})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("div",{className:"bg-gray-50 dark:bg-gray-900/50 border border-gray-200 dark:border-gray-700 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-foreground",children:"Enable TaskMaster Integration"}),t.jsx("div",{className:"text-sm text-muted-foreground mt-1",children:"Show TaskMaster tasks, banners, and sidebar indicators across the interface"}),!c&&t.jsx("div",{className:"text-xs text-orange-600 dark:text-orange-400 mt-1",children:"TaskMaster CLI must be installed first"})]}),t.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:o,onChange:A=>l(A.target.checked),disabled:!c,className:"sr-only peer"}),t.jsx("div",{className:`w-11 h-6 ${c?"bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800":"bg-gray-300 dark:bg-gray-600"} rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600`})]})]})}),t.jsx("div",{className:"bg-blue-50 dark:bg-blue-950/50 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-8 h-8 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx(va,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),t.jsxs("div",{children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"🎯 About TaskMaster AI"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:[t.jsx("strong",{children:"AI-Powered Task Management:"})," Break complex projects into manageable subtasks with AI assistance"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"PRD:"})," Generate structured tasks from Product Requirements Documents"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Dependency Tracking:"})," Understand task relationships and execution order"]}),t.jsxs("p",{children:[t.jsx("strong",{children:"Progress Visualization:"})," Kanban boards, and detailed task views"]})]})]}),t.jsx("div",{className:"mt-4 pt-4 border-t border-blue-200 dark:border-blue-700",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("div",{className:"w-6 h-6 bg-blue-100 dark:bg-blue-800 rounded-full flex items-center justify-center flex-shrink-0 mt-0.5",children:t.jsx("svg",{className:"w-3 h-3 text-blue-600 dark:text-blue-400",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5zm-5 5a2 2 0 012.828 0 1 1 0 101.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5a2 2 0 11-2.828-2.828l3-3z",clipRule:"evenodd"})})}),t.jsxs("div",{className:"flex-1",children:[t.jsx("div",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"📚 Learn More & Tutorial"}),t.jsxs("div",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-2",children:[t.jsxs("p",{children:["TaskMaster AI (aka ",t.jsx("strong",{children:"claude-task-master"})," ) is an advanced AI-powered task management system built for developers."]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("a",{href:"https://github.com/eyaltoledano/claude-task-master",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z",clipRule:"evenodd"})}),"View on GitHub",t.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]}),t.jsx("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:"Find documentation, setup guides, and examples for advanced TaskMaster workflows"})]})]})]})]})})]})})]})]})}),Pe==="api"&&t.jsx("div",{className:"space-y-6 md:space-y-8",children:t.jsx(c1,{})})]})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between p-4 md:p-6 border-t border-border flex-shrink-0 gap-3 pb-safe-area-inset-bottom",children:[t.jsxs("div",{className:"flex items-center justify-center sm:justify-start gap-2 order-2 sm:order-1",children:[L==="success"&&t.jsxs("div",{className:"text-green-600 dark:text-green-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Settings saved successfully!"]}),L==="error"&&t.jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm flex items-center gap-1",children:[t.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),"Failed to save settings"]})]}),t.jsxs("div",{className:"flex items-center gap-3 order-1 sm:order-2",children:[t.jsx(Le,{variant:"outline",onClick:r,disabled:M,className:"flex-1 sm:flex-none h-10 touch-manipulation",children:"Cancel"}),t.jsx(Le,{onClick:q,disabled:M,className:"flex-1 sm:flex-none h-10 bg-blue-600 hover:bg-blue-700 disabled:opacity-50 touch-manipulation",children:M?t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"w-4 h-4 animate-spin rounded-full border-2 border-white border-t-transparent"}),"Saving..."]}):"Save Settings"})]})]})]}),Be&&t.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 max-md:items-stretch max-md:justify-stretch",children:t.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[t.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[t.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:Xe==="claude"?"Claude CLI Login":"Cursor CLI Login"}),t.jsx("button",{onClick:()=>ze(!1),className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",children:t.jsx(ct,{className:"w-6 h-6"})})]}),t.jsx("div",{className:"flex-1 overflow-hidden",children:t.jsx(iu,{project:ot,command:Xe==="claude"?"claude /login":"cursor-agent login",onComplete:ae,showHeader:!1})})]})})]}):null}function u1(){const{isDarkMode:e,toggleDarkMode:r}=Ti();return t.jsxs("button",{onClick:r,className:"relative inline-flex h-8 w-14 items-center rounded-full bg-gray-200 dark:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 dark:focus:ring-offset-gray-900",role:"switch","aria-checked":e,"aria-label":"Toggle dark mode",children:[t.jsx("span",{className:"sr-only",children:"Toggle dark mode"}),t.jsx("span",{className:`${e?"translate-x-7":"translate-x-1"} inline-block h-6 w-6 transform rounded-full bg-white shadow-lg transition-transform duration-200 flex items-center justify-center`,children:e?t.jsx("svg",{className:"w-3.5 h-3.5 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})}):t.jsx("svg",{className:"w-3.5 h-3.5 text-yellow-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})})})]})}const m1=({isOpen:e,onToggle:r,autoExpandTools:n,onAutoExpandChange:s,showRawParameters:a,onShowRawParametersChange:i,showThinking:o,onShowThinkingChange:l,autoScrollToBottom:c,onAutoScrollChange:d,sendByCtrlEnter:u,onSendByCtrlEnterChange:m,isMobile:h})=>{const[p,g]=f.useState(e),[x,b]=f.useState(()=>localStorage.getItem("whisperMode")||"default"),{isDarkMode:k}=Ti();f.useEffect(()=>{g(e)},[e]);const N=()=>{const y=!p;g(y),r(y)};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:`fixed ${h?"bottom-44":"top-1/2 -translate-y-1/2"} ${p?"right-64":"right-0"} z-50 transition-all duration-150 ease-out`,children:t.jsx("button",{onClick:N,className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-l-md p-2 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors shadow-lg","aria-label":p?"Close settings panel":"Open settings panel",children:p?t.jsx(Er,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}):t.jsx(xm,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"})})}),t.jsx("div",{className:`fixed top-0 right-0 h-full w-64 bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl transform transition-transform duration-150 ease-out z-40 ${p?"translate-x-0":"translate-x-full"} ${h?"h-screen":""}`,children:t.jsxs("div",{className:"h-full flex flex-col",children:[t.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900",children:t.jsxs("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white flex items-center gap-2",children:[t.jsx(Tp,{className:"h-5 w-5 text-gray-600 dark:text-gray-400"}),"Quick Settings"]})}),t.jsxs("div",{className:`flex-1 overflow-y-auto overflow-x-hidden p-4 space-y-6 bg-white dark:bg-gray-900 ${h?"pb-20":""}`,children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Appearance"}),t.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[k?t.jsx(ba,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}):t.jsx(ka,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Dark Mode"]}),t.jsx(u1,{})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Tool Display"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ri,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-expand tools"]}),t.jsx("input",{type:"checkbox",checked:n,onChange:y=>s(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx($n,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show raw parameters"]}),t.jsx("input",{type:"checkbox",checked:a,onChange:y=>i(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ql,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Show thinking"]}),t.jsx("input",{type:"checkbox",checked:o,onChange:y=>l(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"View Options"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(Hl,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Auto-scroll to bottom"]}),t.jsx("input",{type:"checkbox",checked:c,onChange:y=>d(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Input Settings"}),t.jsxs("label",{className:"flex items-center justify-between p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm text-gray-900 dark:text-white",children:[t.jsx(ip,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Send by Ctrl+Enter"]}),t.jsx("input",{type:"checkbox",checked:u,onChange:y=>m(y.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 focus:ring-2 dark:focus:ring-blue-400 bg-gray-100 dark:bg-gray-800 checked:bg-blue-600 dark:checked:bg-blue-600"})]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 ml-3",children:"When enabled, pressing Ctrl+Enter will send the message instead of just Enter. This is useful for IME users to avoid accidental sends."})]}),t.jsxs("div",{className:"space-y-2",style:{display:"none"},children:[t.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400 mb-2",children:"Whisper Dictation"}),t.jsxs("div",{className:"space-y-2",children:[t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"default",checked:x==="default",onChange:()=>{b("default"),localStorage.setItem("whisperMode","default"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(ds,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Default Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Direct transcription of your speech"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"prompt",checked:x==="prompt",onChange:()=>{b("prompt"),localStorage.setItem("whisperMode","prompt"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx(Ir,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Prompt Enhancement"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Transform rough ideas into clear, detailed AI prompts"})]})]}),t.jsxs("label",{className:"flex items-start p-3 rounded-lg bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer transition-colors border border-transparent hover:border-gray-300 dark:hover:border-gray-600",children:[t.jsx("input",{type:"radio",name:"whisperMode",value:"vibe",checked:x==="vibe"||x==="instructions"||x==="architect",onChange:()=>{b("vibe"),localStorage.setItem("whisperMode","vibe"),window.dispatchEvent(new Event("whisperModeChanged"))},className:"mt-0.5 h-4 w-4 border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-800 dark:checked:bg-blue-600"}),t.jsxs("div",{className:"ml-3 flex-1",children:[t.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-gray-900 dark:text-white",children:[t.jsx($t,{className:"h-4 w-4 text-gray-600 dark:text-gray-400"}),"Vibe Mode"]}),t.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Format ideas as clear agent instructions with details"})]})]})]})]})]})]})}),p&&t.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-30 transition-opacity duration-150 ease-out",onClick:N})]})},p1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(""),[o,l]=f.useState(!1),[c,d]=f.useState(""),{register:u}=Es(),m=async h=>{if(h.preventDefault(),d(""),n!==a){d("Passwords do not match");return}if(e.length<3){d("Username must be at least 3 characters long");return}if(n.length<6){d("Password must be at least 6 characters long");return}l(!0);const p=await u(e,n);p.success||d(p.error),l(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx(lr,{size:64})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome to Claude Code UI"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Set up your account to get started"})]}),t.jsxs("form",{onSubmit:m,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:h=>r(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:h=>s(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:o})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),t.jsx("input",{type:"password",id:"confirmPassword",value:a,onChange:h=>i(h.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:o})]}),c&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),t.jsx("button",{type:"submit",disabled:o,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:o?"Setting up...":"Create Account"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a single-user system. Only one account can be created."})})]})})})},h1=()=>{const[e,r]=f.useState(""),[n,s]=f.useState(""),[a,i]=f.useState(!1),[o,l]=f.useState(""),{login:c}=Es(),d=async u=>{if(u.preventDefault(),l(""),!e||!n){l("Please enter both username and password");return}i(!0);const m=await c(e,n);m.success||l(m.error),i(!1)};return t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsx("div",{className:"w-full max-w-md",children:t.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(Dn,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Welcome Back"}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign in to your Claude Code UI account"})]}),t.jsxs("form",{onSubmit:d,className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-foreground mb-1",children:"Username"}),t.jsx("input",{type:"text",id:"username",value:e,onChange:u=>r(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your username",required:!0,disabled:a})]}),t.jsxs("div",{children:[t.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),t.jsx("input",{type:"password",id:"password",value:n,onChange:u=>s(u.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Enter your password",required:!0,disabled:a})]}),o&&t.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:t.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:o})}),t.jsx("button",{type:"submit",disabled:a,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:a?"Signing in...":"Sign In"})]}),t.jsx("div",{className:"text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your credentials to access Claude Code UI"})})]})})})},f1=()=>t.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"text-center",children:[t.jsx("div",{className:"flex justify-center mb-4",children:t.jsx("div",{className:"w-16 h-16 bg-primary rounded-lg flex items-center justify-center shadow-sm",children:t.jsx(Dn,{className:"w-8 h-8 text-primary-foreground"})})}),t.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Claude Code UI"}),t.jsxs("div",{className:"flex items-center justify-center space-x-2",children:[t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce"}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),t.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),t.jsx("p",{className:"text-muted-foreground mt-2",children:"Loading..."})]})}),g1=({children:e})=>{const{user:r,isLoading:n,needsSetup:s}=Es();return n?t.jsx(f1,{}):s?t.jsx(p1,{}):r?e:t.jsx(h1,{})},Ll="1.10.5",x1=(e,r)=>{const[n,s]=f.useState(!1),[a,i]=f.useState(null),[o,l]=f.useState(null);return f.useEffect(()=>{const c=async()=>{try{const m=await(await fetch(`https://api.github.com/repos/${e}/${r}/releases/latest`)).json();if(m.tag_name){const h=m.tag_name.replace(/^v/,"");i(h),s(Ll!==h),l({title:m.name||m.tag_name,body:m.body||"",htmlUrl:m.html_url||`https://github.com/${e}/${r}/releases/latest`,publishedAt:m.published_at})}else s(!1),i(null),l(null)}catch(u){console.error("Version check failed:",u),s(!1),i(null),l(null)}};c();const d=setInterval(c,300*1e3);return()=>clearInterval(d)},[e,r]),{updateAvailable:n,latestVersion:a,currentVersion:Ll,releaseInfo:o}};function Qr(e,r){const[n,s]=f.useState(()=>{if(typeof window>"u")return r;try{const i=window.localStorage.getItem(e);return i?JSON.parse(i):r}catch(i){return console.log(i),r}});return[n,i=>{if(!(typeof window>"u"))try{const o=i instanceof Function?i(n):i;window.localStorage.setItem(e,JSON.stringify(o)),s(o)}catch(o){console.log(o)}}]}function Rl(){const e=Gu(),{sessionId:r}=Ku(),{updateAvailable:n,latestVersion:s,currentVersion:a,releaseInfo:i}=x1("siteboon","claudecodeui"),[o,l]=f.useState(!1),[c,d]=f.useState([]),[u,m]=f.useState(null),[h,p]=f.useState(null),[g,x]=f.useState("chat"),[b,k]=f.useState(!1),[N,y]=f.useState(!1),[P,W]=f.useState(!0),[M,B]=f.useState(!1),[L,U]=f.useState(!1),[j,R]=f.useState("tools"),[D,_]=f.useState(!1),[C,V]=Qr("autoExpandTools",!1),[z,Z]=Qr("showRawParameters",!1),[F,ce]=Qr("showThinking",!0),[v,ue]=Qr("autoScrollToBottom",!0),[fe,w]=Qr("sendByCtrlEnter",!1),[J,he]=Qr("sidebarVisible",!0),[ye,re]=f.useState(new Set),[Pe,X]=f.useState(new Set),[le,ke]=f.useState(0),{ws:ge,sendMessage:Ie,messages:Ke}=mc(),[et,st]=f.useState(!1);f.useEffect(()=>{const ee=()=>{const me=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone||document.referrer.includes("android-app://");st(me),me?(document.documentElement.classList.add("pwa-mode"),document.body.classList.add("pwa-mode")):(document.documentElement.classList.remove("pwa-mode"),document.body.classList.remove("pwa-mode"))};return ee(),window.matchMedia("(display-mode: standalone)").addEventListener("change",ee),()=>{window.matchMedia("(display-mode: standalone)").removeEventListener("change",ee)}},[]),f.useEffect(()=>{const ee=()=>{k(window.innerWidth<768)};return ee(),window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)},[]),f.useEffect(()=>{tt()},[]);const ft=(ee,me,oe,we)=>{if(!oe||!we)return!0;const Ee=ee?.find(ot=>ot.name===oe.name),Be=me?.find(ot=>ot.name===oe.name);if(!Ee||!Be)return!1;const ze=Ee.sessions?.find(ot=>ot.id===we.id),Xe=Be.sessions?.find(ot=>ot.id===we.id);return!ze||!Xe?!1:ze.id===Xe.id&&ze.title===Xe.title&&ze.created_at===Xe.created_at&&ze.updated_at===Xe.updated_at};f.useEffect(()=>{if(Ke.length>0){const ee=Ke[Ke.length-1];if(ee.type==="projects_updated"){if(ee.changedFile&&h&&u){const we=ee.changedFile.split("/");we.length>=2&&we[we.length-1].replace(".jsonl","")===h.id&&(ye.has(h.id)||ke(Xe=>Xe+1))}if(h&&ye.has(h.id)||ye.size>0&&Array.from(ye).some(we=>we.startsWith("new-session-"))){const we=ee.projects;if(!ft(c,we,u,h))return}const oe=ee.projects;if(d(oe),u){const we=oe.find(Ee=>Ee.name===u.name);we&&(JSON.stringify(we)!==JSON.stringify(u)&&m(we),h&&(we.sessions?.find(Be=>Be.id===h.id)||p(null)))}}}},[Ke,u,h,ye]);const tt=async()=>{try{W(!0);const me=await(await Ue.projects()).json();for(let oe of me)try{const we=`/api/cursor/sessions?projectPath=${encodeURIComponent(oe.fullPath||oe.path)}`,Ee=await Fe(we);if(Ee.ok){const Be=await Ee.json();Be.success&&Be.sessions?oe.cursorSessions=Be.sessions:oe.cursorSessions=[]}else oe.cursorSessions=[]}catch(we){console.error(`Error fetching Cursor sessions for project ${oe.name}:`,we),oe.cursorSessions=[]}d(oe=>oe.length===0||me.some((Ee,Be)=>{const ze=oe[Be];return ze?Ee.name!==ze.name||Ee.displayName!==ze.displayName||Ee.fullPath!==ze.fullPath||JSON.stringify(Ee.sessionMeta)!==JSON.stringify(ze.sessionMeta)||JSON.stringify(Ee.sessions)!==JSON.stringify(ze.sessions)||JSON.stringify(Ee.cursorSessions)!==JSON.stringify(ze.cursorSessions):!0})||me.length!==oe.length?me:oe)}catch(ee){console.error("Error fetching projects:",ee)}finally{W(!1)}};window.refreshProjects=tt,window.openSettings=f.useCallback((ee="tools")=>{R(ee),U(!0)},[]),f.useEffect(()=>{if(r&&c.length>0){const ee=!h||h.id!==r;for(const me of c){let oe=me.sessions?.find(Ee=>Ee.id===r);if(oe){m(me),p({...oe,__provider:"claude"}),ee&&x("chat");return}const we=me.cursorSessions?.find(Ee=>Ee.id===r);if(we){m(me),p({...we,__provider:"cursor"}),ee&&x("chat");return}}}},[r,c,e]);const xe=ee=>{m(ee),p(null),e("/"),b&&y(!1)},qe=ee=>{if(p(ee),g!=="git"&&g!=="preview"&&x("chat"),(localStorage.getItem("selected-provider")||"claude")==="cursor"&&sessionStorage.setItem("cursorSessionId",ee.id),b){const oe=ee.__projectName,we=u?.name;oe!==we&&y(!1)}e(`/session/${ee.id}`)},it=ee=>{m(ee),p(null),x("chat"),e("/"),b&&y(!1)},ve=ee=>{h?.id===ee&&(p(null),e("/")),d(me=>me.map(oe=>({...oe,sessions:oe.sessions?.filter(we=>we.id!==ee)||[],sessionMeta:{...oe.sessionMeta,total:Math.max(0,(oe.sessionMeta?.total||0)-1)}})))},Ct=async()=>{try{const me=await(await Ue.projects()).json();if(d(oe=>me.some((Ee,Be)=>{const ze=oe[Be];return ze?Ee.name!==ze.name||Ee.displayName!==ze.displayName||Ee.fullPath!==ze.fullPath||JSON.stringify(Ee.sessionMeta)!==JSON.stringify(ze.sessionMeta)||JSON.stringify(Ee.sessions)!==JSON.stringify(ze.sessions):!0})||me.length!==oe.length?me:oe),u){const oe=me.find(we=>we.name===u.name);if(oe&&(JSON.stringify(oe)!==JSON.stringify(u)&&m(oe),h)){const we=oe.sessions?.find(Ee=>Ee.id===h.id);we&&JSON.stringify(we)!==JSON.stringify(h)&&p(we)}}}catch(ee){console.error("Error refreshing sidebar:",ee)}},Q=ee=>{u?.name===ee&&(m(null),p(null),e("/")),d(me=>me.filter(oe=>oe.name!==ee))},de=f.useCallback(ee=>{ee&&re(me=>new Set([...me,ee]))},[]),T=f.useCallback(ee=>{ee&&re(me=>{const oe=new Set(me);return oe.delete(ee),oe})},[]),O=f.useCallback(ee=>{ee&&X(me=>new Set([...me,ee]))},[]),ne=f.useCallback(ee=>{ee&&X(me=>{const oe=new Set(me);return oe.delete(ee),oe})},[]),Ce=f.useCallback(ee=>{ee&&re(me=>{const oe=new Set;for(const we of me)we.startsWith("new-session-")||oe.add(we);return oe.add(ee),oe})},[]),De=()=>{const[ee,me]=f.useState(!1),[oe,we]=f.useState(""),[Ee,Be]=f.useState("");if(!o)return null;const ze=gt=>gt?gt.replace(/\b[0-9a-f]{40}\b/gi,"").replace(/(?:^|\s|-)([0-9a-f]{7,10})\b/gi,"").replace(/\*\*Full Changelog\*\*:.*$/gim,"").replace(/https?:\/\/github\.com\/[^\/]+\/[^\/]+\/compare\/[^\s)]+/gi,"").replace(/\n\s*\n\s*\n/g,`
|
|
922
922
|
|
|
923
923
|
`).trim():"",Xe=async()=>{me(!0),we(`Starting update...
|
|
924
924
|
`),Be("");try{const gt=await Fe("/api/system/update",{method:"POST"}),ot=await gt.json();gt.ok?(we(vt=>vt+ot.output+`
|
package/dist/index.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<!-- Prevent zoom on iOS -->
|
|
27
27
|
<meta name="format-detection" content="telephone=no" />
|
|
28
|
-
<script type="module" crossorigin src="/assets/index-
|
|
28
|
+
<script type="module" crossorigin src="/assets/index-BZX1vtg9.js"></script>
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-7V_UDHjJ.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-B7BYDWj-.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/vendor-xterm-jI4BCHEb.js">
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siteboon/claude-code-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "A web-based UI for Claude Code CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"claude-code-ui": "server/
|
|
8
|
+
"claude-code-ui": "server/cli.js",
|
|
9
|
+
"cloudcli": "server/cli.js"
|
|
9
10
|
},
|
|
10
11
|
"files": [
|
|
11
12
|
"server/",
|
package/server/cli.js
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code UI CLI
|
|
4
|
+
*
|
|
5
|
+
* Provides command-line utilities for managing Claude Code UI
|
|
6
|
+
*
|
|
7
|
+
* Commands:
|
|
8
|
+
* (no args) - Start the server (default)
|
|
9
|
+
* start - Start the server
|
|
10
|
+
* status - Show configuration and data locations
|
|
11
|
+
* help - Show help information
|
|
12
|
+
* version - Show version information
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import fs from 'fs';
|
|
16
|
+
import path from 'path';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
import { dirname } from 'path';
|
|
19
|
+
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = dirname(__filename);
|
|
22
|
+
|
|
23
|
+
// ANSI color codes for terminal output
|
|
24
|
+
const colors = {
|
|
25
|
+
reset: '\x1b[0m',
|
|
26
|
+
bright: '\x1b[1m',
|
|
27
|
+
dim: '\x1b[2m',
|
|
28
|
+
|
|
29
|
+
// Foreground colors
|
|
30
|
+
cyan: '\x1b[36m',
|
|
31
|
+
green: '\x1b[32m',
|
|
32
|
+
yellow: '\x1b[33m',
|
|
33
|
+
blue: '\x1b[34m',
|
|
34
|
+
magenta: '\x1b[35m',
|
|
35
|
+
white: '\x1b[37m',
|
|
36
|
+
gray: '\x1b[90m',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Helper to colorize text
|
|
40
|
+
const c = {
|
|
41
|
+
info: (text) => `${colors.cyan}${text}${colors.reset}`,
|
|
42
|
+
ok: (text) => `${colors.green}${text}${colors.reset}`,
|
|
43
|
+
warn: (text) => `${colors.yellow}${text}${colors.reset}`,
|
|
44
|
+
error: (text) => `${colors.yellow}${text}${colors.reset}`,
|
|
45
|
+
tip: (text) => `${colors.blue}${text}${colors.reset}`,
|
|
46
|
+
bright: (text) => `${colors.bright}${text}${colors.reset}`,
|
|
47
|
+
dim: (text) => `${colors.dim}${text}${colors.reset}`,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Load package.json for version info
|
|
51
|
+
const packageJsonPath = path.join(__dirname, '../package.json');
|
|
52
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
53
|
+
|
|
54
|
+
// Load environment variables from .env file if it exists
|
|
55
|
+
function loadEnvFile() {
|
|
56
|
+
try {
|
|
57
|
+
const envPath = path.join(__dirname, '../.env');
|
|
58
|
+
const envFile = fs.readFileSync(envPath, 'utf8');
|
|
59
|
+
envFile.split('\n').forEach(line => {
|
|
60
|
+
const trimmedLine = line.trim();
|
|
61
|
+
if (trimmedLine && !trimmedLine.startsWith('#')) {
|
|
62
|
+
const [key, ...valueParts] = trimmedLine.split('=');
|
|
63
|
+
if (key && valueParts.length > 0 && !process.env[key]) {
|
|
64
|
+
process.env[key] = valueParts.join('=').trim();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
} catch (e) {
|
|
69
|
+
// .env file is optional
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Get the database path (same logic as db.js)
|
|
74
|
+
function getDatabasePath() {
|
|
75
|
+
loadEnvFile();
|
|
76
|
+
return process.env.DATABASE_PATH || path.join(__dirname, 'database', 'auth.db');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Get the installation directory
|
|
80
|
+
function getInstallDir() {
|
|
81
|
+
return path.join(__dirname, '..');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Show status command
|
|
85
|
+
function showStatus() {
|
|
86
|
+
console.log(`\n${c.bright('Claude Code UI - Status')}\n`);
|
|
87
|
+
console.log(c.dim('═'.repeat(60)));
|
|
88
|
+
|
|
89
|
+
// Version info
|
|
90
|
+
console.log(`\n${c.info('[INFO]')} Version: ${c.bright(packageJson.version)}`);
|
|
91
|
+
|
|
92
|
+
// Installation location
|
|
93
|
+
const installDir = getInstallDir();
|
|
94
|
+
console.log(`\n${c.info('[INFO]')} Installation Directory:`);
|
|
95
|
+
console.log(` ${c.dim(installDir)}`);
|
|
96
|
+
|
|
97
|
+
// Database location
|
|
98
|
+
const dbPath = getDatabasePath();
|
|
99
|
+
const dbExists = fs.existsSync(dbPath);
|
|
100
|
+
console.log(`\n${c.info('[INFO]')} Database Location:`);
|
|
101
|
+
console.log(` ${c.dim(dbPath)}`);
|
|
102
|
+
console.log(` Status: ${dbExists ? c.ok('[OK] Exists') : c.warn('[WARN] Not created yet (will be created on first run)')}`);
|
|
103
|
+
|
|
104
|
+
if (dbExists) {
|
|
105
|
+
const stats = fs.statSync(dbPath);
|
|
106
|
+
console.log(` Size: ${c.dim((stats.size / 1024).toFixed(2) + ' KB')}`);
|
|
107
|
+
console.log(` Modified: ${c.dim(stats.mtime.toLocaleString())}`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Environment variables
|
|
111
|
+
console.log(`\n${c.info('[INFO]')} Configuration:`);
|
|
112
|
+
console.log(` PORT: ${c.bright(process.env.PORT || '3001')} ${c.dim(process.env.PORT ? '' : '(default)')}`);
|
|
113
|
+
console.log(` DATABASE_PATH: ${c.dim(process.env.DATABASE_PATH || '(using default location)')}`);
|
|
114
|
+
console.log(` CLAUDE_CLI_PATH: ${c.dim(process.env.CLAUDE_CLI_PATH || 'claude (default)')}`);
|
|
115
|
+
console.log(` CONTEXT_WINDOW: ${c.dim(process.env.CONTEXT_WINDOW || '160000 (default)')}`);
|
|
116
|
+
|
|
117
|
+
// Claude projects folder
|
|
118
|
+
const claudeProjectsPath = path.join(process.env.HOME, '.claude', 'projects');
|
|
119
|
+
const projectsExists = fs.existsSync(claudeProjectsPath);
|
|
120
|
+
console.log(`\n${c.info('[INFO]')} Claude Projects Folder:`);
|
|
121
|
+
console.log(` ${c.dim(claudeProjectsPath)}`);
|
|
122
|
+
console.log(` Status: ${projectsExists ? c.ok('[OK] Exists') : c.warn('[WARN] Not found')}`);
|
|
123
|
+
|
|
124
|
+
// Config file location
|
|
125
|
+
const envFilePath = path.join(__dirname, '../.env');
|
|
126
|
+
const envExists = fs.existsSync(envFilePath);
|
|
127
|
+
console.log(`\n${c.info('[INFO]')} Configuration File:`);
|
|
128
|
+
console.log(` ${c.dim(envFilePath)}`);
|
|
129
|
+
console.log(` Status: ${envExists ? c.ok('[OK] Exists') : c.warn('[WARN] Not found (using defaults)')}`);
|
|
130
|
+
|
|
131
|
+
console.log('\n' + c.dim('═'.repeat(60)));
|
|
132
|
+
console.log(`\n${c.tip('[TIP]')} Hints:`);
|
|
133
|
+
console.log(` ${c.dim('>')} Set DATABASE_PATH env variable to use a custom database location`);
|
|
134
|
+
console.log(` ${c.dim('>')} Create .env file in installation directory for persistent config`);
|
|
135
|
+
console.log(` ${c.dim('>')} Run "claude-code-ui" or "cloudcli start" to start the server`);
|
|
136
|
+
console.log(` ${c.dim('>')} Access the UI at http://localhost:3001 (or custom PORT)\n`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Show help
|
|
140
|
+
function showHelp() {
|
|
141
|
+
console.log(`
|
|
142
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
143
|
+
║ Claude Code UI - Command Line Tool ║
|
|
144
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
145
|
+
|
|
146
|
+
Usage:
|
|
147
|
+
claude-code-ui [command]
|
|
148
|
+
cloudcli [command]
|
|
149
|
+
|
|
150
|
+
Commands:
|
|
151
|
+
start Start the Claude Code UI server (default)
|
|
152
|
+
status Show configuration and data locations
|
|
153
|
+
help Show this help information
|
|
154
|
+
version Show version information
|
|
155
|
+
|
|
156
|
+
Examples:
|
|
157
|
+
$ claude-code-ui # Start the server
|
|
158
|
+
$ cloudcli status # Show configuration
|
|
159
|
+
$ cloudcli help # Show help
|
|
160
|
+
|
|
161
|
+
Environment Variables:
|
|
162
|
+
PORT Set server port (default: 3001)
|
|
163
|
+
DATABASE_PATH Set custom database location
|
|
164
|
+
CLAUDE_CLI_PATH Set custom Claude CLI path
|
|
165
|
+
CONTEXT_WINDOW Set context window size (default: 160000)
|
|
166
|
+
|
|
167
|
+
Configuration:
|
|
168
|
+
Create a .env file in the installation directory to set
|
|
169
|
+
persistent environment variables. Use 'cloudcli status' to
|
|
170
|
+
see the installation directory path.
|
|
171
|
+
|
|
172
|
+
Documentation:
|
|
173
|
+
${packageJson.homepage || 'https://github.com/siteboon/claudecodeui'}
|
|
174
|
+
|
|
175
|
+
Report Issues:
|
|
176
|
+
${packageJson.bugs?.url || 'https://github.com/siteboon/claudecodeui/issues'}
|
|
177
|
+
`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Show version
|
|
181
|
+
function showVersion() {
|
|
182
|
+
console.log(`${packageJson.version}`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Start the server
|
|
186
|
+
async function startServer() {
|
|
187
|
+
// Import and run the server
|
|
188
|
+
await import('./index.js');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Main CLI handler
|
|
192
|
+
async function main() {
|
|
193
|
+
const args = process.argv.slice(2);
|
|
194
|
+
const command = args[0] || 'start';
|
|
195
|
+
|
|
196
|
+
switch (command) {
|
|
197
|
+
case 'start':
|
|
198
|
+
await startServer();
|
|
199
|
+
break;
|
|
200
|
+
case 'status':
|
|
201
|
+
case 'info':
|
|
202
|
+
showStatus();
|
|
203
|
+
break;
|
|
204
|
+
case 'help':
|
|
205
|
+
case '-h':
|
|
206
|
+
case '--help':
|
|
207
|
+
showHelp();
|
|
208
|
+
break;
|
|
209
|
+
case 'version':
|
|
210
|
+
case '-v':
|
|
211
|
+
case '--version':
|
|
212
|
+
showVersion();
|
|
213
|
+
break;
|
|
214
|
+
default:
|
|
215
|
+
console.error(`\n❌ Unknown command: ${command}`);
|
|
216
|
+
console.log(' Run "cloudcli help" for usage information.\n');
|
|
217
|
+
process.exit(1);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Run the CLI
|
|
222
|
+
main().catch(error => {
|
|
223
|
+
console.error('\n❌ Error:', error.message);
|
|
224
|
+
process.exit(1);
|
|
225
|
+
});
|
package/server/database/db.js
CHANGED
|
@@ -8,6 +8,20 @@ import { dirname } from 'path';
|
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const __dirname = dirname(__filename);
|
|
10
10
|
|
|
11
|
+
// ANSI color codes for terminal output
|
|
12
|
+
const colors = {
|
|
13
|
+
reset: '\x1b[0m',
|
|
14
|
+
bright: '\x1b[1m',
|
|
15
|
+
cyan: '\x1b[36m',
|
|
16
|
+
dim: '\x1b[2m',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const c = {
|
|
20
|
+
info: (text) => `${colors.cyan}${text}${colors.reset}`,
|
|
21
|
+
bright: (text) => `${colors.bright}${text}${colors.reset}`,
|
|
22
|
+
dim: (text) => `${colors.dim}${text}${colors.reset}`,
|
|
23
|
+
};
|
|
24
|
+
|
|
11
25
|
// Use DATABASE_PATH environment variable if set, otherwise use default location
|
|
12
26
|
const DB_PATH = process.env.DATABASE_PATH || path.join(__dirname, 'auth.db');
|
|
13
27
|
const INIT_SQL_PATH = path.join(__dirname, 'init.sql');
|
|
@@ -28,7 +42,18 @@ if (process.env.DATABASE_PATH) {
|
|
|
28
42
|
|
|
29
43
|
// Create database connection
|
|
30
44
|
const db = new Database(DB_PATH);
|
|
31
|
-
|
|
45
|
+
|
|
46
|
+
// Show app installation path prominently
|
|
47
|
+
const appInstallPath = path.join(__dirname, '../..');
|
|
48
|
+
console.log('');
|
|
49
|
+
console.log(c.dim('═'.repeat(60)));
|
|
50
|
+
console.log(`${c.info('[INFO]')} App Installation: ${c.bright(appInstallPath)}`);
|
|
51
|
+
console.log(`${c.info('[INFO]')} Database: ${c.dim(path.relative(appInstallPath, DB_PATH))}`);
|
|
52
|
+
if (process.env.DATABASE_PATH) {
|
|
53
|
+
console.log(` ${c.dim('(Using custom DATABASE_PATH from environment)')}`);
|
|
54
|
+
}
|
|
55
|
+
console.log(c.dim('═'.repeat(60)));
|
|
56
|
+
console.log('');
|
|
32
57
|
|
|
33
58
|
// Initialize database with schema
|
|
34
59
|
const initializeDatabase = async () => {
|
package/server/index.js
CHANGED
|
@@ -8,6 +8,26 @@ import { dirname } from 'path';
|
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const __dirname = dirname(__filename);
|
|
10
10
|
|
|
11
|
+
// ANSI color codes for terminal output
|
|
12
|
+
const colors = {
|
|
13
|
+
reset: '\x1b[0m',
|
|
14
|
+
bright: '\x1b[1m',
|
|
15
|
+
cyan: '\x1b[36m',
|
|
16
|
+
green: '\x1b[32m',
|
|
17
|
+
yellow: '\x1b[33m',
|
|
18
|
+
blue: '\x1b[34m',
|
|
19
|
+
dim: '\x1b[2m',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const c = {
|
|
23
|
+
info: (text) => `${colors.cyan}${text}${colors.reset}`,
|
|
24
|
+
ok: (text) => `${colors.green}${text}${colors.reset}`,
|
|
25
|
+
warn: (text) => `${colors.yellow}${text}${colors.reset}`,
|
|
26
|
+
tip: (text) => `${colors.blue}${text}${colors.reset}`,
|
|
27
|
+
bright: (text) => `${colors.bright}${text}${colors.reset}`,
|
|
28
|
+
dim: (text) => `${colors.dim}${text}${colors.reset}`,
|
|
29
|
+
};
|
|
30
|
+
|
|
11
31
|
try {
|
|
12
32
|
const envPath = path.join(__dirname, '../.env');
|
|
13
33
|
const envFile = fs.readFileSync(envPath, 'utf8');
|
|
@@ -116,7 +136,7 @@ async function setupProjectsWatcher() {
|
|
|
116
136
|
});
|
|
117
137
|
|
|
118
138
|
} catch (error) {
|
|
119
|
-
console.error('
|
|
139
|
+
console.error('[ERROR] Error handling project changes:', error);
|
|
120
140
|
}
|
|
121
141
|
}, 300); // 300ms debounce (slightly faster than before)
|
|
122
142
|
};
|
|
@@ -129,13 +149,13 @@ async function setupProjectsWatcher() {
|
|
|
129
149
|
.on('addDir', (dirPath) => debouncedUpdate('addDir', dirPath))
|
|
130
150
|
.on('unlinkDir', (dirPath) => debouncedUpdate('unlinkDir', dirPath))
|
|
131
151
|
.on('error', (error) => {
|
|
132
|
-
console.error('
|
|
152
|
+
console.error('[ERROR] Chokidar watcher error:', error);
|
|
133
153
|
})
|
|
134
154
|
.on('ready', () => {
|
|
135
155
|
});
|
|
136
156
|
|
|
137
157
|
} catch (error) {
|
|
138
|
-
console.error('
|
|
158
|
+
console.error('[ERROR] Failed to setup projects watcher:', error);
|
|
139
159
|
}
|
|
140
160
|
}
|
|
141
161
|
|
|
@@ -157,13 +177,13 @@ const wss = new WebSocketServer({
|
|
|
157
177
|
// Verify token
|
|
158
178
|
const user = authenticateWebSocket(token);
|
|
159
179
|
if (!user) {
|
|
160
|
-
console.log('
|
|
180
|
+
console.log('[WARN] WebSocket authentication failed');
|
|
161
181
|
return false;
|
|
162
182
|
}
|
|
163
183
|
|
|
164
184
|
// Store user info in the request for later use
|
|
165
185
|
info.req.user = user;
|
|
166
|
-
console.log('
|
|
186
|
+
console.log('[OK] WebSocket authenticated for user:', user.username);
|
|
167
187
|
return true;
|
|
168
188
|
}
|
|
169
189
|
});
|
|
@@ -462,7 +482,7 @@ app.get('/api/projects/:projectName/file', authenticateToken, async (req, res) =
|
|
|
462
482
|
const { projectName } = req.params;
|
|
463
483
|
const { filePath } = req.query;
|
|
464
484
|
|
|
465
|
-
console.log('
|
|
485
|
+
console.log('[DEBUG] File read request:', projectName, filePath);
|
|
466
486
|
|
|
467
487
|
// Security: ensure the requested path is inside the project root
|
|
468
488
|
if (!filePath) {
|
|
@@ -503,7 +523,7 @@ app.get('/api/projects/:projectName/files/content', authenticateToken, async (re
|
|
|
503
523
|
const { projectName } = req.params;
|
|
504
524
|
const { path: filePath } = req.query;
|
|
505
525
|
|
|
506
|
-
console.log('
|
|
526
|
+
console.log('[DEBUG] Binary file serve request:', projectName, filePath);
|
|
507
527
|
|
|
508
528
|
// Security: ensure the requested path is inside the project root
|
|
509
529
|
if (!filePath) {
|
|
@@ -557,7 +577,7 @@ app.put('/api/projects/:projectName/file', authenticateToken, async (req, res) =
|
|
|
557
577
|
const { projectName } = req.params;
|
|
558
578
|
const { filePath, content } = req.body;
|
|
559
579
|
|
|
560
|
-
console.log('
|
|
580
|
+
console.log('[DEBUG] File save request:', projectName, filePath);
|
|
561
581
|
|
|
562
582
|
// Security: ensure the requested path is inside the project root
|
|
563
583
|
if (!filePath) {
|
|
@@ -628,7 +648,7 @@ app.get('/api/projects/:projectName/files', authenticateToken, async (req, res)
|
|
|
628
648
|
const hiddenFiles = files.filter(f => f.name.startsWith('.'));
|
|
629
649
|
res.json(files);
|
|
630
650
|
} catch (error) {
|
|
631
|
-
console.error('
|
|
651
|
+
console.error('[ERROR] File tree error:', error.message);
|
|
632
652
|
res.status(500).json({ error: error.message });
|
|
633
653
|
}
|
|
634
654
|
});
|
|
@@ -636,7 +656,7 @@ app.get('/api/projects/:projectName/files', authenticateToken, async (req, res)
|
|
|
636
656
|
// WebSocket connection handler that routes based on URL path
|
|
637
657
|
wss.on('connection', (ws, request) => {
|
|
638
658
|
const url = request.url;
|
|
639
|
-
console.log('
|
|
659
|
+
console.log('[INFO] Client connected to:', url);
|
|
640
660
|
|
|
641
661
|
// Parse URL to get pathname without query parameters
|
|
642
662
|
const urlObj = new URL(url, 'http://localhost');
|
|
@@ -647,14 +667,14 @@ wss.on('connection', (ws, request) => {
|
|
|
647
667
|
} else if (pathname === '/ws') {
|
|
648
668
|
handleChatConnection(ws);
|
|
649
669
|
} else {
|
|
650
|
-
console.log('
|
|
670
|
+
console.log('[WARN] Unknown WebSocket path:', pathname);
|
|
651
671
|
ws.close();
|
|
652
672
|
}
|
|
653
673
|
});
|
|
654
674
|
|
|
655
675
|
// Handle chat WebSocket connections
|
|
656
676
|
function handleChatConnection(ws) {
|
|
657
|
-
console.log('
|
|
677
|
+
console.log('[INFO] Chat WebSocket connected');
|
|
658
678
|
|
|
659
679
|
// Add to connected clients for project updates
|
|
660
680
|
connectedClients.add(ws);
|
|
@@ -664,28 +684,28 @@ function handleChatConnection(ws) {
|
|
|
664
684
|
const data = JSON.parse(message);
|
|
665
685
|
|
|
666
686
|
if (data.type === 'claude-command') {
|
|
667
|
-
console.log('
|
|
687
|
+
console.log('[DEBUG] User message:', data.command || '[Continue/Resume]');
|
|
668
688
|
console.log('📁 Project:', data.options?.projectPath || 'Unknown');
|
|
669
689
|
console.log('🔄 Session:', data.options?.sessionId ? 'Resume' : 'New');
|
|
670
690
|
|
|
671
691
|
// Use Claude Agents SDK
|
|
672
692
|
await queryClaudeSDK(data.command, data.options, ws);
|
|
673
693
|
} else if (data.type === 'cursor-command') {
|
|
674
|
-
console.log('
|
|
694
|
+
console.log('[DEBUG] Cursor message:', data.command || '[Continue/Resume]');
|
|
675
695
|
console.log('📁 Project:', data.options?.cwd || 'Unknown');
|
|
676
696
|
console.log('🔄 Session:', data.options?.sessionId ? 'Resume' : 'New');
|
|
677
697
|
console.log('🤖 Model:', data.options?.model || 'default');
|
|
678
698
|
await spawnCursor(data.command, data.options, ws);
|
|
679
699
|
} else if (data.type === 'cursor-resume') {
|
|
680
700
|
// Backward compatibility: treat as cursor-command with resume and no prompt
|
|
681
|
-
console.log('
|
|
701
|
+
console.log('[DEBUG] Cursor resume session (compat):', data.sessionId);
|
|
682
702
|
await spawnCursor('', {
|
|
683
703
|
sessionId: data.sessionId,
|
|
684
704
|
resume: true,
|
|
685
705
|
cwd: data.options?.cwd
|
|
686
706
|
}, ws);
|
|
687
707
|
} else if (data.type === 'abort-session') {
|
|
688
|
-
console.log('
|
|
708
|
+
console.log('[DEBUG] Abort session request:', data.sessionId);
|
|
689
709
|
const provider = data.provider || 'claude';
|
|
690
710
|
let success;
|
|
691
711
|
|
|
@@ -703,7 +723,7 @@ function handleChatConnection(ws) {
|
|
|
703
723
|
success
|
|
704
724
|
}));
|
|
705
725
|
} else if (data.type === 'cursor-abort') {
|
|
706
|
-
console.log('
|
|
726
|
+
console.log('[DEBUG] Abort Cursor session:', data.sessionId);
|
|
707
727
|
const success = abortCursorSession(data.sessionId);
|
|
708
728
|
ws.send(JSON.stringify({
|
|
709
729
|
type: 'session-aborted',
|
|
@@ -742,7 +762,7 @@ function handleChatConnection(ws) {
|
|
|
742
762
|
}));
|
|
743
763
|
}
|
|
744
764
|
} catch (error) {
|
|
745
|
-
console.error('
|
|
765
|
+
console.error('[ERROR] Chat WebSocket error:', error.message);
|
|
746
766
|
ws.send(JSON.stringify({
|
|
747
767
|
type: 'error',
|
|
748
768
|
error: error.message
|
|
@@ -776,7 +796,7 @@ function handleShellConnection(ws) {
|
|
|
776
796
|
const initialCommand = data.initialCommand;
|
|
777
797
|
const isPlainShell = data.isPlainShell || (!!initialCommand && !hasSession) || provider === 'plain-shell';
|
|
778
798
|
|
|
779
|
-
console.log('
|
|
799
|
+
console.log('[INFO] Starting shell in:', projectPath);
|
|
780
800
|
console.log('📋 Session info:', hasSession ? `Resume session ${sessionId}` : (isPlainShell ? 'Plain shell mode' : 'New session'));
|
|
781
801
|
console.log('🤖 Provider:', isPlainShell ? 'plain-shell' : provider);
|
|
782
802
|
if (initialCommand) {
|
|
@@ -889,7 +909,7 @@ function handleShellConnection(ws) {
|
|
|
889
909
|
let match;
|
|
890
910
|
while ((match = pattern.exec(data)) !== null) {
|
|
891
911
|
const url = match[1];
|
|
892
|
-
console.log('
|
|
912
|
+
console.log('[DEBUG] Detected URL for opening:', url);
|
|
893
913
|
|
|
894
914
|
// Send URL opening message to client
|
|
895
915
|
ws.send(JSON.stringify({
|
|
@@ -899,7 +919,7 @@ function handleShellConnection(ws) {
|
|
|
899
919
|
|
|
900
920
|
// Replace the OPEN_URL pattern with a user-friendly message
|
|
901
921
|
if (pattern.source.includes('OPEN_URL')) {
|
|
902
|
-
outputData = outputData.replace(match[0],
|
|
922
|
+
outputData = outputData.replace(match[0], `[INFO] Opening in browser: ${url}`);
|
|
903
923
|
}
|
|
904
924
|
}
|
|
905
925
|
});
|
|
@@ -925,7 +945,7 @@ function handleShellConnection(ws) {
|
|
|
925
945
|
});
|
|
926
946
|
|
|
927
947
|
} catch (spawnError) {
|
|
928
|
-
console.error('
|
|
948
|
+
console.error('[ERROR] Error spawning process:', spawnError);
|
|
929
949
|
ws.send(JSON.stringify({
|
|
930
950
|
type: 'output',
|
|
931
951
|
data: `\r\n\x1b[31mError: ${spawnError.message}\x1b[0m\r\n`
|
|
@@ -951,7 +971,7 @@ function handleShellConnection(ws) {
|
|
|
951
971
|
}
|
|
952
972
|
}
|
|
953
973
|
} catch (error) {
|
|
954
|
-
console.error('
|
|
974
|
+
console.error('[ERROR] Shell WebSocket error:', error.message);
|
|
955
975
|
if (ws.readyState === WebSocket.OPEN) {
|
|
956
976
|
ws.send(JSON.stringify({
|
|
957
977
|
type: 'output',
|
|
@@ -970,7 +990,7 @@ function handleShellConnection(ws) {
|
|
|
970
990
|
});
|
|
971
991
|
|
|
972
992
|
ws.on('error', (error) => {
|
|
973
|
-
console.error('
|
|
993
|
+
console.error('[ERROR] Shell WebSocket error:', error);
|
|
974
994
|
});
|
|
975
995
|
}
|
|
976
996
|
// Audio transcription endpoint
|
|
@@ -1411,28 +1431,37 @@ async function startServer() {
|
|
|
1411
1431
|
try {
|
|
1412
1432
|
// Initialize authentication database
|
|
1413
1433
|
await initializeDatabase();
|
|
1414
|
-
console.log('✅ Database initialization skipped (testing)');
|
|
1415
1434
|
|
|
1416
1435
|
// Check if running in production mode (dist folder exists)
|
|
1417
1436
|
const distIndexPath = path.join(__dirname, '../dist/index.html');
|
|
1418
1437
|
const isProduction = fs.existsSync(distIndexPath);
|
|
1419
1438
|
|
|
1420
1439
|
// Log Claude implementation mode
|
|
1421
|
-
console.log('
|
|
1422
|
-
console.log(
|
|
1440
|
+
console.log(`${c.info('[INFO]')} Using Claude Agents SDK for Claude integration`);
|
|
1441
|
+
console.log(`${c.info('[INFO]')} Running in ${c.bright(isProduction ? 'PRODUCTION' : 'DEVELOPMENT')} mode`);
|
|
1423
1442
|
|
|
1424
1443
|
if (!isProduction) {
|
|
1425
|
-
console.log(
|
|
1444
|
+
console.log(`${c.warn('[WARN]')} Note: Requests will be proxied to Vite dev server at ${c.dim('http://localhost:' + (process.env.VITE_PORT || 5173))}`);
|
|
1426
1445
|
}
|
|
1427
1446
|
|
|
1428
1447
|
server.listen(PORT, '0.0.0.0', async () => {
|
|
1429
|
-
|
|
1448
|
+
const appInstallPath = path.join(__dirname, '..');
|
|
1449
|
+
|
|
1450
|
+
console.log('');
|
|
1451
|
+
console.log(c.dim('═'.repeat(63)));
|
|
1452
|
+
console.log(` ${c.bright('Claude Code UI Server - Ready')}`);
|
|
1453
|
+
console.log(c.dim('═'.repeat(63)));
|
|
1454
|
+
console.log('');
|
|
1455
|
+
console.log(`${c.info('[INFO]')} Server URL: ${c.bright('http://0.0.0.0:' + PORT)}`);
|
|
1456
|
+
console.log(`${c.info('[INFO]')} Installed at: ${c.dim(appInstallPath)}`);
|
|
1457
|
+
console.log(`${c.tip('[TIP]')} Run "cloudcli status" for full configuration details`);
|
|
1458
|
+
console.log('');
|
|
1430
1459
|
|
|
1431
1460
|
// Start watching the projects folder for changes
|
|
1432
1461
|
await setupProjectsWatcher();
|
|
1433
1462
|
});
|
|
1434
1463
|
} catch (error) {
|
|
1435
|
-
console.error('
|
|
1464
|
+
console.error('[ERROR] Failed to start server:', error);
|
|
1436
1465
|
process.exit(1);
|
|
1437
1466
|
}
|
|
1438
1467
|
}
|