mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-03 11:05:35 +08:00
Compare commits
12 Commits
fix/use-fa
...
fix/claude
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a87214050b | ||
|
|
b988e0da51 | ||
|
|
f132a21cd7 | ||
|
|
36b860e322 | ||
|
|
1e125f3db5 | ||
|
|
dbc41dc91d | ||
|
|
38bf21ddf5 | ||
|
|
86948097aa | ||
|
|
951f58751c | ||
|
|
27e509a9b8 | ||
|
|
295bad9c00 | ||
|
|
3b79aab958 |
19
CHANGELOG.md
19
CHANGELOG.md
@@ -3,6 +3,25 @@
|
|||||||
All notable changes to CloudCLI UI will be documented in this file.
|
All notable changes to CloudCLI UI will be documented in this file.
|
||||||
|
|
||||||
|
|
||||||
|
## [](https://github.com/siteboon/claudecodeui/compare/v1.32.0...vnull) (2026-06-01)
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
* add opencode support ([#762](https://github.com/siteboon/claudecodeui/issues/762)) ([374e9de](https://github.com/siteboon/claudecodeui/commit/374e9de71934c41ce2c19c796e35a19234b240ec))
|
||||||
|
* **sidebar:** tooltip for the active-session indicator dot ([#782](https://github.com/siteboon/claudecodeui/issues/782)) ([27e509a](https://github.com/siteboon/claudecodeui/commit/27e509a9b8bb25c35ae0abbda44c536e15c332c8))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **chat:** prevent double send on mobile by removing redundant submit handlers ([#719](https://github.com/siteboon/claudecodeui/issues/719)) ([dbc41dc](https://github.com/siteboon/claudecodeui/commit/dbc41dc91dbf1fb54f92f5536d64646b4e924f31))
|
||||||
|
* preserve WebSocket frame type in plugin proxy ([#594](https://github.com/siteboon/claudecodeui/issues/594)) ([36b860e](https://github.com/siteboon/claudecodeui/commit/36b860e322454df62ebf5309018590b596e6b913)), closes [CoderLuii/HolyClaude#11](https://github.com/CoderLuii/HolyClaude/issues/11)
|
||||||
|
* refine token usage reporting ([#807](https://github.com/siteboon/claudecodeui/issues/807)) ([38bf21d](https://github.com/siteboon/claudecodeui/commit/38bf21ddf554ed28676d86b5221c25adf6f07afd))
|
||||||
|
* refresh Claude auth status after login flow ([#617](https://github.com/siteboon/claudecodeui/issues/617)) ([1e125f3](https://github.com/siteboon/claudecodeui/commit/1e125f3db5248399cd50dc3d40b1f8f44cf7ccb6))
|
||||||
|
* **sidebar:** keep session rename input visible while editing ([#781](https://github.com/siteboon/claudecodeui/issues/781)) ([951f587](https://github.com/siteboon/claudecodeui/commit/951f58751c152fbbb3f8b3ce3c814c06c061de18))
|
||||||
|
|
||||||
|
### Styling
|
||||||
|
|
||||||
|
* fix project star button location by replacing folder icon ([#793](https://github.com/siteboon/claudecodeui/issues/793)) ([295bad9](https://github.com/siteboon/claudecodeui/commit/295bad9c006b669878cbf52940794f29f7370178))
|
||||||
|
|
||||||
## [1.32.0](https://github.com/siteboon/claudecodeui/compare/v1.31.5...v1.32.0) (2026-05-13)
|
## [1.32.0](https://github.com/siteboon/claudecodeui/compare/v1.31.5...v1.32.0) (2026-05-13)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@cloudcli-ai/cloudcli",
|
"name": "@cloudcli-ai/cloudcli",
|
||||||
"version": "1.32.0",
|
"version": "1.33.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@cloudcli-ai/cloudcli",
|
"name": "@cloudcli-ai/cloudcli",
|
||||||
"version": "1.32.0",
|
"version": "1.33.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cloudcli-ai/cloudcli",
|
"name": "@cloudcli-ai/cloudcli",
|
||||||
"version": "1.32.0",
|
"version": "1.33.0",
|
||||||
"description": "A web-based UI for Claude Code CLI",
|
"description": "A web-based UI for Claude Code CLI",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist-server/server/index.js",
|
"main": "dist-server/server/index.js",
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ type ClaudeCredentialsStatus = {
|
|||||||
error?: string;
|
error?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hasErrorCode = (error: unknown, code: string): boolean => (
|
||||||
|
error instanceof Error && 'code' in error && error.code === code
|
||||||
|
);
|
||||||
|
|
||||||
export class ClaudeProviderAuth implements IProviderAuth {
|
export class ClaudeProviderAuth implements IProviderAuth {
|
||||||
/**
|
/**
|
||||||
* Checks whether the Claude Code CLI is available on this host.
|
* Checks whether the Claude Code CLI is available on this host.
|
||||||
@@ -77,6 +81,12 @@ export class ClaudeProviderAuth implements IProviderAuth {
|
|||||||
* Checks Claude credentials in the same priority order used by Claude Code.
|
* Checks Claude credentials in the same priority order used by Claude Code.
|
||||||
*/
|
*/
|
||||||
private async checkCredentials(): Promise<ClaudeCredentialsStatus> {
|
private async checkCredentials(): Promise<ClaudeCredentialsStatus> {
|
||||||
|
const missingCredentialsError = 'Claude CLI is not authenticated. Run claude /login or configure ANTHROPIC_API_KEY.';
|
||||||
|
|
||||||
|
if (process.env.ANTHROPIC_AUTH_TOKEN?.trim()) {
|
||||||
|
return { authenticated: true, email: 'Auth Token', method: 'api_key' };
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.ANTHROPIC_API_KEY?.trim()) {
|
if (process.env.ANTHROPIC_API_KEY?.trim()) {
|
||||||
return { authenticated: true, email: 'API Key Auth', method: 'api_key' };
|
return { authenticated: true, email: 'API Key Auth', method: 'api_key' };
|
||||||
}
|
}
|
||||||
@@ -110,15 +120,33 @@ export class ClaudeProviderAuth implements IProviderAuth {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
email,
|
email: null,
|
||||||
method: 'credentials_file',
|
method: null,
|
||||||
error: 'OAuth token has expired. Please re-authenticate with claude login',
|
error: 'Claude login has expired. Run claude /login again.',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return { authenticated: false, email: null, method: null };
|
return {
|
||||||
} catch {
|
authenticated: false,
|
||||||
return { authenticated: false, email: null, method: null };
|
email: null,
|
||||||
|
method: null,
|
||||||
|
error: missingCredentialsError,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
let errorMessage = 'Unable to read Claude credentials. Run claude /login again.';
|
||||||
|
|
||||||
|
if (hasErrorCode(error, 'ENOENT')) {
|
||||||
|
errorMessage = missingCredentialsError;
|
||||||
|
} else if (error instanceof SyntaxError) {
|
||||||
|
errorMessage = 'Claude credentials are unreadable. Run claude /login again.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
authenticated: false,
|
||||||
|
email: null,
|
||||||
|
method: null,
|
||||||
|
error: errorMessage,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const CLAUDE_FALLBACK_MODELS: ProviderModelsDefinition = {
|
|||||||
description: 'Haiku 4.5 · Fastest for quick answers · $1/$5 per Mtok',
|
description: 'Haiku 4.5 · Fastest for quick answers · $1/$5 per Mtok',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
DEFAULT: 'sonnet',
|
DEFAULT: 'default',
|
||||||
};
|
};
|
||||||
type ClaudeInitEvent = {
|
type ClaudeInitEvent = {
|
||||||
sessionId?: string;
|
sessionId?: string;
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ export function handlePluginWsProxy(
|
|||||||
console.log(`[Plugins] WS proxy connected to "${pluginName}" on port ${port}`);
|
console.log(`[Plugins] WS proxy connected to "${pluginName}" on port ${port}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
upstream.on('message', (data) => {
|
upstream.on('message', (data, isBinary) => {
|
||||||
if (clientWs.readyState === WebSocket.OPEN) {
|
if (clientWs.readyState === WebSocket.OPEN) {
|
||||||
clientWs.send(data);
|
clientWs.send(data, { binary: isBinary });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
clientWs.on('message', (data) => {
|
clientWs.on('message', (data, isBinary) => {
|
||||||
if (upstream.readyState === WebSocket.OPEN) {
|
if (upstream.readyState === WebSocket.OPEN) {
|
||||||
upstream.send(data);
|
upstream.send(data, { binary: isBinary });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
95
src/App.tsx
95
src/App.tsx
@@ -1,5 +1,6 @@
|
|||||||
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
|
||||||
import { I18nextProvider } from 'react-i18next';
|
import { I18nextProvider } from 'react-i18next';
|
||||||
|
|
||||||
import { ThemeProvider } from './contexts/ThemeContext';
|
import { ThemeProvider } from './contexts/ThemeContext';
|
||||||
import { AuthProvider, ProtectedRoute } from './components/auth';
|
import { AuthProvider, ProtectedRoute } from './components/auth';
|
||||||
import { TaskMasterProvider } from './contexts/TaskMasterContext';
|
import { TaskMasterProvider } from './contexts/TaskMasterContext';
|
||||||
@@ -9,7 +10,99 @@ import { PluginsProvider } from './contexts/PluginsContext';
|
|||||||
import AppContent from './components/app/AppContent';
|
import AppContent from './components/app/AppContent';
|
||||||
import i18n from './i18n/config.js';
|
import i18n from './i18n/config.js';
|
||||||
|
|
||||||
|
const DEPLOYMENT_ASSET_DIRECTORIES = new Set(['assets', 'static', 'icons', 'images']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect the router basename from explicit runtime config or deployment hints.
|
||||||
|
*
|
||||||
|
* CloudCLI can be served from a path prefix by a reverse proxy, for example:
|
||||||
|
* /ai/manifest.json
|
||||||
|
* /ai/assets/index-abc123.js
|
||||||
|
* /ai/icons/icon-192x192.png
|
||||||
|
*
|
||||||
|
* React Router needs that prefix as its basename, but the packaged app should
|
||||||
|
* also keep working when served directly from the domain root. The direct-root
|
||||||
|
* case is easy to misread because asset URLs such as /icons/icon-192x192.png
|
||||||
|
* contain a directory even though there is no application basename.
|
||||||
|
*/
|
||||||
|
function detectRouterBasename() {
|
||||||
|
const explicitBasename = typeof window !== 'undefined' ? window.__ROUTER_BASENAME__ || '' : '';
|
||||||
|
if (explicitBasename) {
|
||||||
|
// Keep the deployment escape hatch authoritative. A trailing slash is
|
||||||
|
// harmless for humans but React Router expects a normalized basename.
|
||||||
|
return explicitBasename.replace(/\/+$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const candidatePaths = [
|
||||||
|
{ kind: 'manifest' as const, value: document.querySelector('link[rel="manifest"]')?.getAttribute('href') },
|
||||||
|
{ kind: 'script' as const, value: document.querySelector('script[type="module"][src]')?.getAttribute('src') },
|
||||||
|
...Array.from(
|
||||||
|
document.querySelectorAll(
|
||||||
|
'link[rel~="icon"][href], link[rel="apple-touch-icon"][href], link[rel="apple-touch-icon-precomposed"][href], link[rel="mask-icon"][href]'
|
||||||
|
)
|
||||||
|
).map((node) => ({
|
||||||
|
kind: 'icon' as const,
|
||||||
|
value: node.getAttribute('href'),
|
||||||
|
})),
|
||||||
|
].filter((candidate): candidate is { kind: 'manifest' | 'script' | 'icon'; value: string } => Boolean(candidate.value));
|
||||||
|
|
||||||
|
let detectedBasename = '';
|
||||||
|
for (const candidate of candidatePaths) {
|
||||||
|
try {
|
||||||
|
const candidateUrl = new URL(candidate.value, document.baseURI || window.location.href);
|
||||||
|
if (candidateUrl.origin !== window.location.origin) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pathname = candidateUrl.pathname;
|
||||||
|
const normalizedPathname = pathname.replace(/\/+$/, '');
|
||||||
|
|
||||||
|
let normalized = '';
|
||||||
|
if (candidate.kind === 'script') {
|
||||||
|
const match = normalizedPathname.match(/^(.*)\/assets\//);
|
||||||
|
normalized = match?.[1] ? match[1].replace(/\/+$/, '') : '';
|
||||||
|
} else {
|
||||||
|
const manifestMatch = normalizedPathname.match(/^(.*)\/(?:manifest\.json|site\.webmanifest)$/);
|
||||||
|
const iconMatch = normalizedPathname.match(
|
||||||
|
/^(.*)\/(?:favicon(?:\.[^/]+)?|apple-touch-icon(?:-[^/]+)?(?:\.[^/]+)?|mask-icon(?:\.[^/]+)?|[^/]*icon[^/]*)$/
|
||||||
|
);
|
||||||
|
const match = candidate.kind === 'manifest' ? manifestMatch : iconMatch;
|
||||||
|
if (match?.[1]) {
|
||||||
|
const segments = match[1].split('/').filter(Boolean);
|
||||||
|
|
||||||
|
// Strip directories that describe where static files live, not where
|
||||||
|
// the app is mounted. This must also run for a single segment:
|
||||||
|
// /icons/icon-192x192.png -> ''
|
||||||
|
// /ai/icons/icon-192x192.png -> '/ai'
|
||||||
|
// The previous implementation only stripped while more than one
|
||||||
|
// segment remained, which incorrectly turned root deployments into a
|
||||||
|
// Router basename of /icons and caused a blank page after login.
|
||||||
|
while (segments.length > 0 && DEPLOYMENT_ASSET_DIRECTORIES.has(segments[segments.length - 1])) {
|
||||||
|
segments.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
normalized = segments.length > 0 ? `/${segments.join('/')}` : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (normalized.length > detectedBasename.length) {
|
||||||
|
detectedBasename = normalized;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Ignore invalid candidate URLs and continue checking other hints.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return detectedBasename;
|
||||||
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
const routerBasename = detectRouterBasename();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<I18nextProvider i18n={i18n}>
|
<I18nextProvider i18n={i18n}>
|
||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
@@ -19,7 +112,7 @@ export default function App() {
|
|||||||
<TasksSettingsProvider>
|
<TasksSettingsProvider>
|
||||||
<TaskMasterProvider>
|
<TaskMasterProvider>
|
||||||
<ProtectedRoute>
|
<ProtectedRoute>
|
||||||
<Router basename={window.__ROUTER_BASENAME__ || ''}>
|
<Router basename={routerBasename}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<AppContent />} />
|
<Route path="/" element={<AppContent />} />
|
||||||
<Route path="/session/:sessionId" element={<AppContent />} />
|
<Route path="/session/:sessionId" element={<AppContent />} />
|
||||||
|
|||||||
@@ -401,14 +401,6 @@ export default function ChatComposer({
|
|||||||
<PromptInputSubmit
|
<PromptInputSubmit
|
||||||
disabled={!input.trim() || isLoading}
|
disabled={!input.trim() || isLoading}
|
||||||
className="h-10 w-10 sm:h-10 sm:w-10"
|
className="h-10 w-10 sm:h-10 sm:w-10"
|
||||||
onMouseDown={(event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
onSubmit(event as unknown as MouseEvent<HTMLButtonElement>);
|
|
||||||
}}
|
|
||||||
onTouchStart={(event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
onSubmit(event as unknown as TouchEvent<HTMLButtonElement>);
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</PromptInputFooter>
|
</PromptInputFooter>
|
||||||
|
|||||||
@@ -1,12 +1,93 @@
|
|||||||
import { useState } from 'react';
|
import { useState, type ReactNode } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Trash2, RefreshCw, GitBranch, Loader2, ServerCrash, ShieldAlert, ExternalLink, BookOpen, Download, BarChart3 } from 'lucide-react';
|
import {
|
||||||
|
Activity,
|
||||||
|
BarChart3,
|
||||||
|
BookOpen,
|
||||||
|
Clock,
|
||||||
|
Download,
|
||||||
|
ExternalLink,
|
||||||
|
GitBranch,
|
||||||
|
Loader2,
|
||||||
|
RefreshCw,
|
||||||
|
ServerCrash,
|
||||||
|
ShieldAlert,
|
||||||
|
Terminal,
|
||||||
|
Trash2,
|
||||||
|
type LucideIcon,
|
||||||
|
} from 'lucide-react';
|
||||||
|
|
||||||
import { usePlugins } from '../../../contexts/PluginsContext';
|
import { usePlugins } from '../../../contexts/PluginsContext';
|
||||||
import type { Plugin } from '../../../contexts/PluginsContext';
|
import type { Plugin } from '../../../contexts/PluginsContext';
|
||||||
|
|
||||||
import PluginIcon from './PluginIcon';
|
import PluginIcon from './PluginIcon';
|
||||||
|
|
||||||
const STARTER_PLUGIN_URL = 'https://github.com/cloudcli-ai/cloudcli-plugin-starter';
|
const STARTER_PLUGIN_URL = 'https://github.com/cloudcli-ai/cloudcli-plugin-starter';
|
||||||
const TERMINAL_PLUGIN_URL = 'https://github.com/cloudcli-ai/cloudcli-plugin-terminal';
|
const TERMINAL_PLUGIN_URL = 'https://github.com/cloudcli-ai/cloudcli-plugin-terminal';
|
||||||
|
const SCHEDULED_PROMPT_PLUGIN_URL = 'https://github.com/grostim/cloudcli-cron';
|
||||||
|
const CLAUDE_WATCH_PLUGIN_URL = 'https://github.com/satsuki19980613/cloudcli-claude-watch';
|
||||||
|
|
||||||
|
type PluginRecommendation = {
|
||||||
|
id: string;
|
||||||
|
translationKey: string;
|
||||||
|
repoUrl: string;
|
||||||
|
installedNames: string[];
|
||||||
|
icon: LucideIcon;
|
||||||
|
source: 'official' | 'unofficial';
|
||||||
|
};
|
||||||
|
|
||||||
|
const OFFICIAL_PLUGIN_RECOMMENDATIONS: PluginRecommendation[] = [
|
||||||
|
{
|
||||||
|
id: 'project-stats',
|
||||||
|
translationKey: 'starterPlugin',
|
||||||
|
repoUrl: STARTER_PLUGIN_URL,
|
||||||
|
installedNames: ['project-stats'],
|
||||||
|
icon: BarChart3,
|
||||||
|
source: 'official',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'web-terminal',
|
||||||
|
translationKey: 'terminalPlugin',
|
||||||
|
repoUrl: TERMINAL_PLUGIN_URL,
|
||||||
|
installedNames: ['web-terminal'],
|
||||||
|
icon: Terminal,
|
||||||
|
source: 'official',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const UNOFFICIAL_PLUGIN_RECOMMENDATIONS: PluginRecommendation[] = [
|
||||||
|
{
|
||||||
|
id: 'cloudcli-claude-watch',
|
||||||
|
translationKey: 'claudeWatchPlugin',
|
||||||
|
repoUrl: CLAUDE_WATCH_PLUGIN_URL,
|
||||||
|
installedNames: ['cloudcli-claude-watch'],
|
||||||
|
icon: Activity,
|
||||||
|
source: 'unofficial',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'workspace-scheduled-prompts',
|
||||||
|
translationKey: 'scheduledPromptPlugin',
|
||||||
|
repoUrl: SCHEDULED_PROMPT_PLUGIN_URL,
|
||||||
|
installedNames: ['workspace-scheduled-prompts'],
|
||||||
|
icon: Clock,
|
||||||
|
source: 'unofficial',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
function repoSlug(repoUrl: string) {
|
||||||
|
return repoUrl.replace(/^https?:\/\/(www\.)?github\.com\//, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeRepoUrl(repoUrl: string | null) {
|
||||||
|
return repoUrl?.replace(/\.git$/, '').replace(/\/$/, '').toLowerCase() ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function pluginMatchesRecommendation(plugin: Plugin, recommendation: PluginRecommendation) {
|
||||||
|
return (
|
||||||
|
recommendation.installedNames.includes(plugin.name)
|
||||||
|
|| normalizeRepoUrl(plugin.repoUrl) === normalizeRepoUrl(recommendation.repoUrl)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/* ─── Toggle Switch ─────────────────────────────────────────────────────── */
|
/* ─── Toggle Switch ─────────────────────────────────────────────────────── */
|
||||||
function ToggleSwitch({ checked, onChange, ariaLabel }: { checked: boolean; onChange: (v: boolean) => void; ariaLabel: string }) {
|
function ToggleSwitch({ checked, onChange, ariaLabel }: { checked: boolean; onChange: (v: boolean) => void; ariaLabel: string }) {
|
||||||
@@ -208,117 +289,95 @@ function PluginCard({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ─── Starter Plugin Card ───────────────────────────────────────────────── */
|
/* ─── Recommendation Section ────────────────────────────────────────────── */
|
||||||
function StarterPluginCard({ onInstall, installing }: { onInstall: () => void; installing: boolean }) {
|
function RecommendationSection({
|
||||||
const { t } = useTranslation('settings');
|
title,
|
||||||
|
description,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
children: ReactNode;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="relative flex overflow-hidden rounded-lg border border-dashed border-border bg-card transition-all duration-200 hover:border-blue-400 dark:hover:border-blue-500">
|
<section className="space-y-2">
|
||||||
<div className="w-[3px] flex-shrink-0 bg-blue-500/30" />
|
<div>
|
||||||
<div className="min-w-0 flex-1 p-4">
|
<h4 className="text-xs font-semibold uppercase tracking-wide text-muted-foreground">
|
||||||
<div className="flex items-start justify-between gap-3">
|
{title}
|
||||||
<div className="flex min-w-0 items-center gap-2.5">
|
</h4>
|
||||||
<div className="h-5 w-5 flex-shrink-0 text-blue-500">
|
<p className="mt-0.5 text-xs text-muted-foreground/70">
|
||||||
<BarChart3 className="h-5 w-5" />
|
{description}
|
||||||
</div>
|
|
||||||
<div className="min-w-0">
|
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
|
||||||
<span className="text-sm font-semibold leading-none text-foreground">
|
|
||||||
{t('pluginSettings.starterPlugin.name')}
|
|
||||||
</span>
|
|
||||||
<span className="rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-medium text-blue-600 dark:bg-blue-950/50 dark:text-blue-400">
|
|
||||||
{t('pluginSettings.starterPlugin.badge')}
|
|
||||||
</span>
|
|
||||||
<span className="rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground">
|
|
||||||
{t('pluginSettings.tab')}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<p className="mt-1 text-sm leading-snug text-muted-foreground">
|
|
||||||
{t('pluginSettings.starterPlugin.description')}
|
|
||||||
</p>
|
</p>
|
||||||
<a
|
|
||||||
href={STARTER_PLUGIN_URL}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground/60 transition-colors hover:text-foreground"
|
|
||||||
>
|
|
||||||
<GitBranch className="h-3 w-3" />
|
|
||||||
cloudcli-ai/cloudcli-plugin-starter
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
onClick={onInstall}
|
|
||||||
disabled={installing}
|
|
||||||
className="flex flex-shrink-0 items-center gap-1.5 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50"
|
|
||||||
>
|
|
||||||
{installing ? (
|
|
||||||
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
|
||||||
) : (
|
|
||||||
<Download className="h-3.5 w-3.5" />
|
|
||||||
)}
|
|
||||||
{installing ? t('pluginSettings.installing') : t('pluginSettings.starterPlugin.install')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="space-y-2">
|
||||||
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ─── Terminal Plugin Card ──────────────────────────────────────────────── */
|
/* ─── Plugin Recommendation Card ────────────────────────────────────────── */
|
||||||
function TerminalPluginCard({ onInstall, installing }: { onInstall: () => void; installing: boolean }) {
|
function PluginRecommendationCard({
|
||||||
|
recommendation,
|
||||||
|
onInstall,
|
||||||
|
disabled,
|
||||||
|
installing,
|
||||||
|
}: {
|
||||||
|
recommendation: PluginRecommendation;
|
||||||
|
onInstall: () => void;
|
||||||
|
disabled: boolean;
|
||||||
|
installing: boolean;
|
||||||
|
}) {
|
||||||
const { t } = useTranslation('settings');
|
const { t } = useTranslation('settings');
|
||||||
|
const Icon = recommendation.icon;
|
||||||
|
const isOfficial = recommendation.source === 'official';
|
||||||
|
const accentClass = isOfficial ? 'bg-blue-500/30' : 'bg-amber-500/40';
|
||||||
|
const hoverClass = isOfficial ? 'hover:border-blue-400 dark:hover:border-blue-500' : 'hover:border-amber-400 dark:hover:border-amber-500';
|
||||||
|
const iconClass = isOfficial ? 'text-blue-500' : 'text-amber-500';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative flex overflow-hidden rounded-lg border border-dashed border-border bg-card transition-all duration-200 hover:border-blue-400 dark:hover:border-blue-500">
|
<div className={`relative flex overflow-hidden rounded-lg border border-dashed border-border bg-card transition-all duration-200 ${hoverClass}`}>
|
||||||
<div className="w-[3px] flex-shrink-0 bg-blue-500/30" />
|
<div className={`w-[3px] flex-shrink-0 ${accentClass}`} />
|
||||||
<div className="min-w-0 flex-1 p-4">
|
<div className="min-w-0 flex-1 p-4">
|
||||||
<div className="flex items-start justify-between gap-3">
|
<div className="flex items-start justify-between gap-3">
|
||||||
<div className="flex min-w-0 items-center gap-2.5">
|
<div className="flex min-w-0 items-center gap-2.5">
|
||||||
<div className="h-5 w-5 flex-shrink-0 text-blue-500">
|
<div className={`h-5 w-5 flex-shrink-0 ${iconClass}`}>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="h-5 w-5">
|
<Icon className="h-5 w-5" />
|
||||||
<rect x="3" y="3" width="18" height="18" rx="2"/>
|
|
||||||
<path d="M7 8l4 4-4 4"/>
|
|
||||||
<line x1="13" y1="16" x2="17" y2="16"/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
<span className="text-sm font-semibold leading-none text-foreground">
|
<span className="text-sm font-semibold leading-none text-foreground">
|
||||||
{t('pluginSettings.terminalPlugin.name')}
|
{t(`pluginSettings.${recommendation.translationKey}.name`)}
|
||||||
</span>
|
|
||||||
<span className="rounded bg-blue-50 px-1.5 py-0.5 text-[10px] font-medium text-blue-600 dark:bg-blue-950/50 dark:text-blue-400">
|
|
||||||
{t('pluginSettings.terminalPlugin.badge')}
|
|
||||||
</span>
|
</span>
|
||||||
<span className="rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground">
|
<span className="rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground">
|
||||||
{t('pluginSettings.tab')}
|
{t('pluginSettings.tab')}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-sm leading-snug text-muted-foreground">
|
<p className="mt-1 text-sm leading-snug text-muted-foreground">
|
||||||
{t('pluginSettings.terminalPlugin.description')}
|
{t(`pluginSettings.${recommendation.translationKey}.description`)}
|
||||||
</p>
|
</p>
|
||||||
<a
|
<a
|
||||||
href={TERMINAL_PLUGIN_URL}
|
href={recommendation.repoUrl}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground/60 transition-colors hover:text-foreground"
|
className="mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground/60 transition-colors hover:text-foreground"
|
||||||
>
|
>
|
||||||
<GitBranch className="h-3 w-3" />
|
<GitBranch className="h-3 w-3" />
|
||||||
cloudcli-ai/cloudcli-plugin-terminal
|
{repoSlug(recommendation.repoUrl)}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
onClick={onInstall}
|
onClick={onInstall}
|
||||||
disabled={installing}
|
disabled={disabled}
|
||||||
className="flex flex-shrink-0 items-center gap-1.5 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-blue-700 disabled:opacity-50"
|
className="flex flex-shrink-0 items-center gap-1.5 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90 disabled:opacity-50"
|
||||||
>
|
>
|
||||||
{installing ? (
|
{installing ? (
|
||||||
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
||||||
) : (
|
) : (
|
||||||
<Download className="h-3.5 w-3.5" />
|
<Download className="h-3.5 w-3.5" />
|
||||||
)}
|
)}
|
||||||
{installing ? t('pluginSettings.installing') : t('pluginSettings.terminalPlugin.install')}
|
{installing ? t('pluginSettings.installing') : t(`pluginSettings.${recommendation.translationKey}.install`)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -334,8 +393,7 @@ export default function PluginSettingsTab() {
|
|||||||
|
|
||||||
const [gitUrl, setGitUrl] = useState('');
|
const [gitUrl, setGitUrl] = useState('');
|
||||||
const [installing, setInstalling] = useState(false);
|
const [installing, setInstalling] = useState(false);
|
||||||
const [installingStarter, setInstallingStarter] = useState(false);
|
const [installingRecommendation, setInstallingRecommendation] = useState<string | null>(null);
|
||||||
const [installingTerminal, setInstallingTerminal] = useState(false);
|
|
||||||
const [installError, setInstallError] = useState<string | null>(null);
|
const [installError, setInstallError] = useState<string | null>(null);
|
||||||
const [confirmUninstall, setConfirmUninstall] = useState<string | null>(null);
|
const [confirmUninstall, setConfirmUninstall] = useState<string | null>(null);
|
||||||
const [updatingPlugins, setUpdatingPlugins] = useState<Set<string>>(new Set());
|
const [updatingPlugins, setUpdatingPlugins] = useState<Set<string>>(new Set());
|
||||||
@@ -364,24 +422,18 @@ export default function PluginSettingsTab() {
|
|||||||
setInstalling(false);
|
setInstalling(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleInstallStarter = async () => {
|
const handleInstallRecommendation = async (recommendation: PluginRecommendation) => {
|
||||||
setInstallingStarter(true);
|
if (installingRecommendation) return;
|
||||||
|
setInstallingRecommendation(recommendation.id);
|
||||||
setInstallError(null);
|
setInstallError(null);
|
||||||
const result = await installPlugin(STARTER_PLUGIN_URL);
|
try {
|
||||||
|
const result = await installPlugin(recommendation.repoUrl);
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
setInstallError(result.error || t('pluginSettings.installFailed'));
|
setInstallError(result.error || t('pluginSettings.installFailed'));
|
||||||
}
|
}
|
||||||
setInstallingStarter(false);
|
} finally {
|
||||||
};
|
setInstallingRecommendation(null);
|
||||||
|
|
||||||
const handleInstallTerminal = async () => {
|
|
||||||
setInstallingTerminal(true);
|
|
||||||
setInstallError(null);
|
|
||||||
const result = await installPlugin(TERMINAL_PLUGIN_URL);
|
|
||||||
if (!result.success) {
|
|
||||||
setInstallError(result.error || t('pluginSettings.installFailed'));
|
|
||||||
}
|
}
|
||||||
setInstallingTerminal(false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUninstall = async (name: string) => {
|
const handleUninstall = async (name: string) => {
|
||||||
@@ -398,8 +450,50 @@ export default function PluginSettingsTab() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasStarterInstalled = plugins.some((p) => p.name === 'project-stats');
|
const isRecommendationInstalled = (recommendation: PluginRecommendation) => {
|
||||||
const hasTerminalInstalled = plugins.some((p) => p.name === 'web-terminal');
|
return plugins.some((plugin) => pluginMatchesRecommendation(plugin, recommendation));
|
||||||
|
};
|
||||||
|
|
||||||
|
const isOfficialPlugin = (plugin: Plugin) => {
|
||||||
|
return OFFICIAL_PLUGIN_RECOMMENDATIONS.some((recommendation) => (
|
||||||
|
pluginMatchesRecommendation(plugin, recommendation)
|
||||||
|
));
|
||||||
|
};
|
||||||
|
|
||||||
|
const officialPlugins = plugins.filter(isOfficialPlugin);
|
||||||
|
const otherPlugins = plugins.filter((plugin) => !isOfficialPlugin(plugin));
|
||||||
|
const officialRecommendations = OFFICIAL_PLUGIN_RECOMMENDATIONS.filter(
|
||||||
|
(recommendation) => !isRecommendationInstalled(recommendation),
|
||||||
|
);
|
||||||
|
const unofficialRecommendations = UNOFFICIAL_PLUGIN_RECOMMENDATIONS.filter(
|
||||||
|
(recommendation) => !isRecommendationInstalled(recommendation),
|
||||||
|
);
|
||||||
|
const hasOfficialSection = officialPlugins.length > 0 || officialRecommendations.length > 0;
|
||||||
|
const hasOtherSection = otherPlugins.length > 0 || unofficialRecommendations.length > 0;
|
||||||
|
|
||||||
|
const renderPluginCard = (plugin: Plugin, index: number) => {
|
||||||
|
const handleToggle = async (enabled: boolean) => {
|
||||||
|
const r = await togglePlugin(plugin.name, enabled);
|
||||||
|
if (!r.success) {
|
||||||
|
setInstallError(r.error || t('pluginSettings.toggleFailed'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PluginCard
|
||||||
|
key={plugin.name}
|
||||||
|
plugin={plugin}
|
||||||
|
index={index}
|
||||||
|
onToggle={(enabled) => void handleToggle(enabled)}
|
||||||
|
onUpdate={() => void handleUpdate(plugin.name)}
|
||||||
|
onUninstall={() => void handleUninstall(plugin.name)}
|
||||||
|
updating={updatingPlugins.has(plugin.name)}
|
||||||
|
confirmingUninstall={confirmUninstall === plugin.name}
|
||||||
|
onCancelUninstall={() => setConfirmUninstall(null)}
|
||||||
|
updateError={updateErrors[plugin.name] ?? null}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
@@ -456,51 +550,49 @@ export default function PluginSettingsTab() {
|
|||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Official plugin suggestions — above the list */}
|
{/* Plugin sections */}
|
||||||
{!loading && (!hasStarterInstalled || !hasTerminalInstalled) && (
|
|
||||||
<div className="space-y-2">
|
|
||||||
{!hasStarterInstalled && (
|
|
||||||
<StarterPluginCard onInstall={handleInstallStarter} installing={installingStarter} />
|
|
||||||
)}
|
|
||||||
{!hasTerminalInstalled && (
|
|
||||||
<TerminalPluginCard onInstall={handleInstallTerminal} installing={installingTerminal} />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Plugin List */}
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground">
|
<div className="flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground">
|
||||||
<Loader2 className="h-4 w-4 animate-spin" />
|
<Loader2 className="h-4 w-4 animate-spin" />
|
||||||
{t('pluginSettings.scanningPlugins')}
|
{t('pluginSettings.scanningPlugins')}
|
||||||
</div>
|
</div>
|
||||||
) : plugins.length === 0 ? (
|
|
||||||
<p className="py-8 text-center text-sm text-muted-foreground">{t('pluginSettings.noPluginsInstalled')}</p>
|
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-2">
|
<div className="space-y-4">
|
||||||
{plugins.map((plugin, index) => {
|
{hasOfficialSection && (
|
||||||
const handleToggle = async (enabled: boolean) => {
|
<RecommendationSection
|
||||||
const r = await togglePlugin(plugin.name, enabled);
|
title={t('pluginSettings.sections.officialTitle')}
|
||||||
if (!r.success) {
|
description={t('pluginSettings.sections.officialDescription')}
|
||||||
setInstallError(r.error || t('pluginSettings.toggleFailed'));
|
>
|
||||||
}
|
{officialPlugins.map((plugin, index) => renderPluginCard(plugin, index))}
|
||||||
};
|
{officialRecommendations.map((recommendation) => (
|
||||||
|
<PluginRecommendationCard
|
||||||
return (
|
key={recommendation.id}
|
||||||
<PluginCard
|
recommendation={recommendation}
|
||||||
key={plugin.name}
|
onInstall={() => void handleInstallRecommendation(recommendation)}
|
||||||
plugin={plugin}
|
disabled={!!installingRecommendation}
|
||||||
index={index}
|
installing={installingRecommendation === recommendation.id}
|
||||||
onToggle={(enabled) => void handleToggle(enabled)}
|
|
||||||
onUpdate={() => void handleUpdate(plugin.name)}
|
|
||||||
onUninstall={() => void handleUninstall(plugin.name)}
|
|
||||||
updating={updatingPlugins.has(plugin.name)}
|
|
||||||
confirmingUninstall={confirmUninstall === plugin.name}
|
|
||||||
onCancelUninstall={() => setConfirmUninstall(null)}
|
|
||||||
updateError={updateErrors[plugin.name] ?? null}
|
|
||||||
/>
|
/>
|
||||||
);
|
))}
|
||||||
})}
|
</RecommendationSection>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{hasOtherSection && (
|
||||||
|
<RecommendationSection
|
||||||
|
title={t('pluginSettings.sections.unofficialTitle')}
|
||||||
|
description={t('pluginSettings.sections.unofficialDescription')}
|
||||||
|
>
|
||||||
|
{otherPlugins.map((plugin, index) => renderPluginCard(plugin, officialPlugins.length + index))}
|
||||||
|
{unofficialRecommendations.map((recommendation) => (
|
||||||
|
<PluginRecommendationCard
|
||||||
|
key={recommendation.id}
|
||||||
|
recommendation={recommendation}
|
||||||
|
onInstall={() => void handleInstallRecommendation(recommendation)}
|
||||||
|
disabled={!!installingRecommendation}
|
||||||
|
installing={installingRecommendation === recommendation.id}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</RecommendationSection>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -70,34 +70,39 @@ export function useProviderAuthStatus(
|
|||||||
}));
|
}));
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const checkProviderAuthStatus = useCallback(async (provider: LLMProvider) => {
|
const checkProviderAuthStatus = useCallback(async (provider: LLMProvider): Promise<ProviderAuthStatus> => {
|
||||||
setProviderLoading(provider);
|
setProviderLoading(provider);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await authenticatedFetch(PROVIDER_AUTH_STATUS_ENDPOINTS[provider]);
|
const response = await authenticatedFetch(PROVIDER_AUTH_STATUS_ENDPOINTS[provider]);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
setProviderStatus(provider, {
|
const status: ProviderAuthStatus = {
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
email: null,
|
email: null,
|
||||||
method: null,
|
method: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
error: FALLBACK_STATUS_ERROR,
|
error: FALLBACK_STATUS_ERROR,
|
||||||
});
|
};
|
||||||
return;
|
setProviderStatus(provider, status);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = (await response.json()) as ProviderAuthStatusApiResponse;
|
const payload = (await response.json()) as ProviderAuthStatusApiResponse;
|
||||||
setProviderStatus(provider, toProviderAuthStatus(payload.data));
|
const status = toProviderAuthStatus(payload.data);
|
||||||
|
setProviderStatus(provider, status);
|
||||||
|
return status;
|
||||||
} catch (caughtError) {
|
} catch (caughtError) {
|
||||||
console.error(`Error checking ${provider} auth status:`, caughtError);
|
console.error(`Error checking ${provider} auth status:`, caughtError);
|
||||||
setProviderStatus(provider, {
|
const status: ProviderAuthStatus = {
|
||||||
authenticated: false,
|
authenticated: false,
|
||||||
email: null,
|
email: null,
|
||||||
method: null,
|
method: null,
|
||||||
loading: false,
|
loading: false,
|
||||||
error: toErrorMessage(caughtError),
|
error: toErrorMessage(caughtError),
|
||||||
});
|
};
|
||||||
|
setProviderStatus(provider, status);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
}, [setProviderLoading, setProviderStatus]);
|
}, [setProviderLoading, setProviderStatus]);
|
||||||
|
|
||||||
|
|||||||
@@ -213,12 +213,19 @@ export function useSettingsController({ isOpen, initialTab }: UseSettingsControl
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleLoginComplete = useCallback((exitCode: number) => {
|
const handleLoginComplete = useCallback((exitCode: number) => {
|
||||||
if (exitCode !== 0 || !loginProvider) {
|
if (!loginProvider) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSaveStatus('success');
|
void (async () => {
|
||||||
void checkProviderAuthStatus(loginProvider);
|
const authStatus = await checkProviderAuthStatus(loginProvider);
|
||||||
|
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
console.warn(`Login process exited with code ${exitCode}; refreshing auth status before setting save status.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
setSaveStatus(authStatus.authenticated ? 'success' : 'error');
|
||||||
|
})();
|
||||||
}, [checkProviderAuthStatus, loginProvider]);
|
}, [checkProviderAuthStatus, loginProvider]);
|
||||||
|
|
||||||
const saveSettings = useCallback(async () => {
|
const saveSettings = useCallback(async () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Check, ChevronDown, ChevronRight, Edit3, Folder, FolderOpen, Star, Trash2, X } from 'lucide-react';
|
import { Check, ChevronDown, ChevronRight, Edit3, Star, Trash2, X } from 'lucide-react';
|
||||||
import type { TFunction } from 'i18next';
|
import type { TFunction } from 'i18next';
|
||||||
|
|
||||||
import { Button } from '../../../../shared/view/ui';
|
import { Button } from '../../../../shared/view/ui';
|
||||||
@@ -131,18 +131,28 @@ export default function SidebarProjectItem({
|
|||||||
>
|
>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex min-w-0 flex-1 items-center gap-3">
|
<div className="flex min-w-0 flex-1 items-center gap-3">
|
||||||
<div
|
<button
|
||||||
className={cn(
|
className={cn(
|
||||||
'w-8 h-8 rounded-lg flex items-center justify-center transition-colors',
|
'w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border',
|
||||||
isExpanded ? 'bg-primary/10' : 'bg-muted',
|
isStarred
|
||||||
|
? 'bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800'
|
||||||
|
: 'bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800',
|
||||||
)}
|
)}
|
||||||
|
onClick={(event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
toggleStarProject();
|
||||||
|
}}
|
||||||
|
title={isStarred ? t('tooltips.removeFromFavorites') : t('tooltips.addToFavorites')}
|
||||||
>
|
>
|
||||||
{isExpanded ? (
|
<Star
|
||||||
<FolderOpen className="h-4 w-4 text-primary" />
|
className={cn(
|
||||||
) : (
|
'w-4 h-4 transition-colors',
|
||||||
<Folder className="h-4 w-4 text-muted-foreground" />
|
isStarred
|
||||||
|
? 'text-yellow-600 dark:text-yellow-400 fill-current'
|
||||||
|
: 'text-gray-600 dark:text-gray-400',
|
||||||
)}
|
)}
|
||||||
</div>
|
/>
|
||||||
|
</button>
|
||||||
|
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
@@ -212,29 +222,6 @@ export default function SidebarProjectItem({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<button
|
|
||||||
className={cn(
|
|
||||||
'w-8 h-8 rounded-lg flex items-center justify-center active:scale-90 transition-all duration-150 border',
|
|
||||||
isStarred
|
|
||||||
? 'bg-yellow-500/10 dark:bg-yellow-900/30 border-yellow-200 dark:border-yellow-800'
|
|
||||||
: 'bg-gray-500/10 dark:bg-gray-900/30 border-gray-200 dark:border-gray-800',
|
|
||||||
)}
|
|
||||||
onClick={(event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
toggleStarProject();
|
|
||||||
}}
|
|
||||||
title={isStarred ? t('tooltips.removeFromFavorites') : t('tooltips.addToFavorites')}
|
|
||||||
>
|
|
||||||
<Star
|
|
||||||
className={cn(
|
|
||||||
'w-4 h-4 transition-colors',
|
|
||||||
isStarred
|
|
||||||
? 'text-yellow-600 dark:text-yellow-400 fill-current'
|
|
||||||
: 'text-gray-600 dark:text-gray-400',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30"
|
className="flex h-8 w-8 items-center justify-center rounded-lg border border-red-200 bg-red-500/10 active:scale-90 dark:border-red-800 dark:bg-red-900/30"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
@@ -281,11 +268,28 @@ export default function SidebarProjectItem({
|
|||||||
onClick={selectAndToggleProject}
|
onClick={selectAndToggleProject}
|
||||||
>
|
>
|
||||||
<div className="flex min-w-0 flex-1 items-center gap-3">
|
<div className="flex min-w-0 flex-1 items-center gap-3">
|
||||||
{isExpanded ? (
|
<div
|
||||||
<FolderOpen className="h-4 w-4 flex-shrink-0 text-primary" />
|
className={cn(
|
||||||
) : (
|
'w-6 h-6 flex items-center justify-center rounded cursor-pointer transition-all duration-200',
|
||||||
<Folder className="h-4 w-4 flex-shrink-0 text-muted-foreground" />
|
isStarred
|
||||||
|
? 'hover:bg-yellow-50 dark:hover:bg-yellow-900/20'
|
||||||
|
: 'opacity-40 hover:opacity-100 hover:bg-accent',
|
||||||
)}
|
)}
|
||||||
|
onClick={(event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
toggleStarProject();
|
||||||
|
}}
|
||||||
|
title={isStarred ? t('tooltips.removeFromFavorites') : t('tooltips.addToFavorites')}
|
||||||
|
>
|
||||||
|
<Star
|
||||||
|
className={cn(
|
||||||
|
'w-3 h-3 transition-colors',
|
||||||
|
isStarred
|
||||||
|
? 'text-yellow-600 dark:text-yellow-400 fill-current'
|
||||||
|
: 'text-muted-foreground',
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className="min-w-0 flex-1 text-left">
|
<div className="min-w-0 flex-1 text-left">
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
@@ -352,26 +356,6 @@ export default function SidebarProjectItem({
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div
|
|
||||||
className={cn(
|
|
||||||
'w-6 h-6 opacity-0 group-hover:opacity-100 transition-all duration-200 flex items-center justify-center rounded cursor-pointer touch:opacity-100',
|
|
||||||
isStarred ? 'hover:bg-yellow-50 dark:hover:bg-yellow-900/20 opacity-100' : 'hover:bg-accent',
|
|
||||||
)}
|
|
||||||
onClick={(event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
toggleStarProject();
|
|
||||||
}}
|
|
||||||
title={isStarred ? t('tooltips.removeFromFavorites') : t('tooltips.addToFavorites')}
|
|
||||||
>
|
|
||||||
<Star
|
|
||||||
className={cn(
|
|
||||||
'w-3 h-3 transition-colors',
|
|
||||||
isStarred
|
|
||||||
? 'text-yellow-600 dark:text-yellow-400 fill-current'
|
|
||||||
: 'text-muted-foreground',
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div
|
<div
|
||||||
className="touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100"
|
className="touch:opacity-100 flex h-6 w-6 cursor-pointer items-center justify-center rounded opacity-0 transition-all duration-200 hover:bg-accent group-hover:opacity-100"
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
import { useEffect, useRef } from 'react';
|
||||||
import { Check, Edit2, Trash2, X } from 'lucide-react';
|
import { Check, Edit2, Trash2, X } from 'lucide-react';
|
||||||
import type { TFunction } from 'i18next';
|
import type { TFunction } from 'i18next';
|
||||||
|
|
||||||
import { Badge, Button } from '../../../../shared/view/ui';
|
import { Badge, Button, Tooltip } from '../../../../shared/view/ui';
|
||||||
import { cn } from '../../../../lib/utils';
|
import { cn } from '../../../../lib/utils';
|
||||||
import type { Project, ProjectSession, LLMProvider } from '../../../../types/app';
|
import type { Project, ProjectSession, LLMProvider } from '../../../../types/app';
|
||||||
import type { SessionWithProvider } from '../../types/types';
|
import type { SessionWithProvider } from '../../types/types';
|
||||||
@@ -76,7 +77,28 @@ export default function SidebarSessionItem({
|
|||||||
}: SidebarSessionItemProps) {
|
}: SidebarSessionItemProps) {
|
||||||
const sessionView = createSessionViewModel(session, currentTime, t);
|
const sessionView = createSessionViewModel(session, currentTime, t);
|
||||||
const isSelected = selectedSession?.id === session.id;
|
const isSelected = selectedSession?.id === session.id;
|
||||||
|
const isEditing = editingSession === session.id;
|
||||||
const compactSessionAge = formatCompactSessionAge(sessionView.sessionTime, currentTime);
|
const compactSessionAge = formatCompactSessionAge(sessionView.sessionTime, currentTime);
|
||||||
|
const editingContainerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
// The rename panel sits inside a group-hover opacity wrapper, so leaving the row
|
||||||
|
// would visually hide it. While editing, dismiss only when the user clicks outside
|
||||||
|
// the panel (matches Escape / cancel-button behaviour).
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isEditing) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const handlePointerDown = (event: MouseEvent) => {
|
||||||
|
const container = editingContainerRef.current;
|
||||||
|
if (container && !container.contains(event.target as Node)) {
|
||||||
|
onCancelEditingSession();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', handlePointerDown);
|
||||||
|
return () => document.removeEventListener('mousedown', handlePointerDown);
|
||||||
|
}, [isEditing, onCancelEditingSession]);
|
||||||
|
|
||||||
// Sessions are owned by a project identified by `projectId` (DB primary key)
|
// Sessions are owned by a project identified by `projectId` (DB primary key)
|
||||||
// after the projectName → projectId migration.
|
// after the projectName → projectId migration.
|
||||||
@@ -97,7 +119,13 @@ export default function SidebarSessionItem({
|
|||||||
<div className="group relative">
|
<div className="group relative">
|
||||||
{sessionView.isActive && (
|
{sessionView.isActive && (
|
||||||
<div className="absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform">
|
<div className="absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2 transform">
|
||||||
<div className="h-2 w-2 animate-pulse rounded-full bg-green-500" />
|
<Tooltip content={t('tooltips.activeSessionIndicator')} position="right">
|
||||||
|
<div
|
||||||
|
role="status"
|
||||||
|
aria-label={t('tooltips.activeSessionIndicator')}
|
||||||
|
className="h-2 w-2 animate-pulse rounded-full bg-green-500"
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -168,7 +196,12 @@ export default function SidebarSessionItem({
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="truncate text-xs font-medium text-foreground">{sessionView.sessionName}</div>
|
<div className="truncate text-xs font-medium text-foreground">{sessionView.sessionName}</div>
|
||||||
{compactSessionAge && (
|
{compactSessionAge && (
|
||||||
<span className="ml-auto flex-shrink-0 text-[11px] text-muted-foreground transition-opacity duration-200 group-hover:opacity-0">
|
<span
|
||||||
|
className={cn(
|
||||||
|
'ml-auto flex-shrink-0 text-[11px] text-muted-foreground transition-opacity duration-200',
|
||||||
|
isEditing ? 'opacity-0' : 'group-hover:opacity-0',
|
||||||
|
)}
|
||||||
|
>
|
||||||
{compactSessionAge}
|
{compactSessionAge}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -180,8 +213,14 @@ export default function SidebarSessionItem({
|
|||||||
</div>
|
</div>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<div className="absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 opacity-0 transition-all duration-200 group-hover:opacity-100">
|
<div
|
||||||
{editingSession === session.id ? (
|
ref={editingContainerRef}
|
||||||
|
className={cn(
|
||||||
|
'absolute right-2 top-1/2 flex -translate-y-1/2 transform items-center gap-1 transition-all duration-200',
|
||||||
|
isEditing ? 'opacity-100' : 'opacity-0 group-hover:opacity-100',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{isEditing ? (
|
||||||
<>
|
<>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "Aus Favoriten entfernen",
|
"removeFromFavorites": "Aus Favoriten entfernen",
|
||||||
"editSessionName": "Sitzungsname manuell bearbeiten",
|
"editSessionName": "Sitzungsname manuell bearbeiten",
|
||||||
"deleteSession": "Diese Sitzung dauerhaft löschen",
|
"deleteSession": "Diese Sitzung dauerhaft löschen",
|
||||||
|
"activeSessionIndicator": "Kürzlich aktive Sitzung (letzte 10 Minuten)",
|
||||||
"save": "Speichern",
|
"save": "Speichern",
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
"clearSearch": "Suche leeren",
|
"clearSearch": "Suche leeren",
|
||||||
|
|||||||
@@ -472,6 +472,12 @@
|
|||||||
"starterPluginLabel": "Starter Plugin",
|
"starterPluginLabel": "Starter Plugin",
|
||||||
"starter": "Starter",
|
"starter": "Starter",
|
||||||
"docs": "Docs",
|
"docs": "Docs",
|
||||||
|
"sections": {
|
||||||
|
"officialTitle": "Official Plugins",
|
||||||
|
"officialDescription": "Maintained by the CloudCLI team and ready for direct install.",
|
||||||
|
"unofficialTitle": "Other Plugins",
|
||||||
|
"unofficialDescription": "Unofficial plugins and integrations from other users. Review the source before installing."
|
||||||
|
},
|
||||||
"starterPlugin": {
|
"starterPlugin": {
|
||||||
"name": "Project Stats",
|
"name": "Project Stats",
|
||||||
"badge": "starter",
|
"badge": "starter",
|
||||||
@@ -484,6 +490,18 @@
|
|||||||
"description": "Integrated terminal with full shell access directly within the interface.",
|
"description": "Integrated terminal with full shell access directly within the interface.",
|
||||||
"install": "Install"
|
"install": "Install"
|
||||||
},
|
},
|
||||||
|
"scheduledPromptPlugin": {
|
||||||
|
"name": "Scheduled Prompts",
|
||||||
|
"badge": "unofficial",
|
||||||
|
"description": "Schedule workspace prompts, review run history, and manage recurring local tasks.",
|
||||||
|
"install": "Install"
|
||||||
|
},
|
||||||
|
"claudeWatchPlugin": {
|
||||||
|
"name": "Claude Watch",
|
||||||
|
"badge": "unofficial",
|
||||||
|
"description": "Watch long-running Claude Code sessions for hangs and expose process controls.",
|
||||||
|
"install": "Install"
|
||||||
|
},
|
||||||
"morePlugins": "More",
|
"morePlugins": "More",
|
||||||
"enable": "Enable",
|
"enable": "Enable",
|
||||||
"disable": "Disable",
|
"disable": "Disable",
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "Remove from favorites",
|
"removeFromFavorites": "Remove from favorites",
|
||||||
"editSessionName": "Manually edit session name",
|
"editSessionName": "Manually edit session name",
|
||||||
"deleteSession": "Delete this session permanently",
|
"deleteSession": "Delete this session permanently",
|
||||||
|
"activeSessionIndicator": "Recently active session (last 10 minutes)",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"clearSearch": "Clear search",
|
"clearSearch": "Clear search",
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "Rimuovi dai preferiti",
|
"removeFromFavorites": "Rimuovi dai preferiti",
|
||||||
"editSessionName": "Modifica manualmente il nome della sessione",
|
"editSessionName": "Modifica manualmente il nome della sessione",
|
||||||
"deleteSession": "Elimina questa sessione permanentemente",
|
"deleteSession": "Elimina questa sessione permanentemente",
|
||||||
|
"activeSessionIndicator": "Sessione attiva di recente (ultimi 10 minuti)",
|
||||||
"save": "Salva",
|
"save": "Salva",
|
||||||
"cancel": "Annulla",
|
"cancel": "Annulla",
|
||||||
"clearSearch": "Cancella ricerca",
|
"clearSearch": "Cancella ricerca",
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "お気に入りから削除",
|
"removeFromFavorites": "お気に入りから削除",
|
||||||
"editSessionName": "セッション名を手動で編集",
|
"editSessionName": "セッション名を手動で編集",
|
||||||
"deleteSession": "このセッションを完全に削除",
|
"deleteSession": "このセッションを完全に削除",
|
||||||
|
"activeSessionIndicator": "最近アクティブなセッション(過去10分以内)",
|
||||||
"save": "保存",
|
"save": "保存",
|
||||||
"cancel": "キャンセル",
|
"cancel": "キャンセル",
|
||||||
"openCommandPalette": "コマンドパレットを開く"
|
"openCommandPalette": "コマンドパレットを開く"
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "즐겨찾기에서 제거",
|
"removeFromFavorites": "즐겨찾기에서 제거",
|
||||||
"editSessionName": "세션 이름 직접 편집",
|
"editSessionName": "세션 이름 직접 편집",
|
||||||
"deleteSession": "이 세션 영구 삭제",
|
"deleteSession": "이 세션 영구 삭제",
|
||||||
|
"activeSessionIndicator": "최근 활성 세션 (지난 10분)",
|
||||||
"save": "저장",
|
"save": "저장",
|
||||||
"cancel": "취소",
|
"cancel": "취소",
|
||||||
"openCommandPalette": "명령 팔레트 열기"
|
"openCommandPalette": "명령 팔레트 열기"
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "Удалить из избранного",
|
"removeFromFavorites": "Удалить из избранного",
|
||||||
"editSessionName": "Вручную редактировать имя сеанса",
|
"editSessionName": "Вручную редактировать имя сеанса",
|
||||||
"deleteSession": "Удалить этот сеанс навсегда",
|
"deleteSession": "Удалить этот сеанс навсегда",
|
||||||
|
"activeSessionIndicator": "Недавно активный сеанс (последние 10 минут)",
|
||||||
"save": "Сохранить",
|
"save": "Сохранить",
|
||||||
"cancel": "Отмена",
|
"cancel": "Отмена",
|
||||||
"clearSearch": "Очистить поиск",
|
"clearSearch": "Очистить поиск",
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "Favorilerden çıkar",
|
"removeFromFavorites": "Favorilerden çıkar",
|
||||||
"editSessionName": "Oturum adını elle düzenle",
|
"editSessionName": "Oturum adını elle düzenle",
|
||||||
"deleteSession": "Bu oturumu kalıcı olarak sil",
|
"deleteSession": "Bu oturumu kalıcı olarak sil",
|
||||||
|
"activeSessionIndicator": "Yakın zamanda etkin oturum (son 10 dakika)",
|
||||||
"save": "Kaydet",
|
"save": "Kaydet",
|
||||||
"cancel": "İptal",
|
"cancel": "İptal",
|
||||||
"clearSearch": "Aramayı temizle",
|
"clearSearch": "Aramayı temizle",
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
"removeFromFavorites": "从收藏移除",
|
"removeFromFavorites": "从收藏移除",
|
||||||
"editSessionName": "手动编辑会话名称",
|
"editSessionName": "手动编辑会话名称",
|
||||||
"deleteSession": "永久删除此会话",
|
"deleteSession": "永久删除此会话",
|
||||||
|
"activeSessionIndicator": "最近活跃的会话(最近 10 分钟)",
|
||||||
"save": "保存",
|
"save": "保存",
|
||||||
"cancel": "取消",
|
"cancel": "取消",
|
||||||
"clearSearch": "清除搜索",
|
"clearSearch": "清除搜索",
|
||||||
|
|||||||
Reference in New Issue
Block a user