mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,98 +1,68 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import * as React from 'react';
|
||||
import { type ReactNode, useEffect, useState } from 'react';
|
||||
import { Box, Text } from '../ink.js';
|
||||
import type { SandboxViolationEvent } from '../utils/sandbox/sandbox-adapter.js';
|
||||
import { SandboxManager } from '../utils/sandbox/sandbox-adapter.js';
|
||||
import * as React from 'react'
|
||||
import { type ReactNode, useEffect, useState } from 'react'
|
||||
import { Box, Text } from '../ink.js'
|
||||
import type { SandboxViolationEvent } from '../utils/sandbox/sandbox-adapter.js'
|
||||
import { SandboxManager } from '../utils/sandbox/sandbox-adapter.js'
|
||||
|
||||
/**
|
||||
* Format a timestamp as "h:mm:ssa" (e.g., "1:30:45pm").
|
||||
* Replaces date-fns format() to avoid pulling in a 39MB dependency for one call.
|
||||
*/
|
||||
function formatTime(date: Date): string {
|
||||
const h = date.getHours() % 12 || 12;
|
||||
const m = String(date.getMinutes()).padStart(2, '0');
|
||||
const s = String(date.getSeconds()).padStart(2, '0');
|
||||
const ampm = date.getHours() < 12 ? 'am' : 'pm';
|
||||
return `${h}:${m}:${s}${ampm}`;
|
||||
const h = date.getHours() % 12 || 12
|
||||
const m = String(date.getMinutes()).padStart(2, '0')
|
||||
const s = String(date.getSeconds()).padStart(2, '0')
|
||||
const ampm = date.getHours() < 12 ? 'am' : 'pm'
|
||||
return `${h}:${m}:${s}${ampm}`
|
||||
}
|
||||
import { getPlatform } from 'src/utils/platform.js';
|
||||
export function SandboxViolationExpandedView() {
|
||||
const $ = _c(15);
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t0 = [];
|
||||
$[0] = t0;
|
||||
} else {
|
||||
t0 = $[0];
|
||||
}
|
||||
const [violations, setViolations] = useState(t0);
|
||||
const [totalCount, setTotalCount] = useState(0);
|
||||
let t1;
|
||||
let t2;
|
||||
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = () => {
|
||||
const store = SandboxManager.getSandboxViolationStore();
|
||||
const unsubscribe = store.subscribe(allViolations => {
|
||||
setViolations(allViolations.slice(-10));
|
||||
setTotalCount(store.getTotalCount());
|
||||
});
|
||||
return unsubscribe;
|
||||
};
|
||||
t2 = [];
|
||||
$[1] = t1;
|
||||
$[2] = t2;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
t2 = $[2];
|
||||
}
|
||||
useEffect(t1, t2);
|
||||
if (!SandboxManager.isSandboxingEnabled() || getPlatform() === "linux") {
|
||||
return null;
|
||||
|
||||
import { getPlatform } from 'src/utils/platform.js'
|
||||
|
||||
export function SandboxViolationExpandedView(): ReactNode {
|
||||
const [violations, setViolations] = useState<SandboxViolationEvent[]>([])
|
||||
const [totalCount, setTotalCount] = useState(0)
|
||||
|
||||
useEffect(() => {
|
||||
// This is harmless if sandboxing is not enabled
|
||||
const store = SandboxManager.getSandboxViolationStore()
|
||||
const unsubscribe = store.subscribe(
|
||||
(allViolations: SandboxViolationEvent[]) => {
|
||||
setViolations(allViolations.slice(-10))
|
||||
setTotalCount(store.getTotalCount())
|
||||
},
|
||||
)
|
||||
return unsubscribe
|
||||
}, [])
|
||||
|
||||
if (!SandboxManager.isSandboxingEnabled() || getPlatform() === 'linux') {
|
||||
return null
|
||||
}
|
||||
|
||||
if (totalCount === 0) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
const t3 = totalCount === 1 ? "operation" : "operations";
|
||||
let t4;
|
||||
if ($[3] !== t3 || $[4] !== totalCount) {
|
||||
t4 = <Box marginLeft={0}><Text color="permission">⧈ Sandbox blocked {totalCount} total{" "}{t3}</Text></Box>;
|
||||
$[3] = t3;
|
||||
$[4] = totalCount;
|
||||
$[5] = t4;
|
||||
} else {
|
||||
t4 = $[5];
|
||||
}
|
||||
let t5;
|
||||
if ($[6] !== violations) {
|
||||
t5 = violations.map(_temp);
|
||||
$[6] = violations;
|
||||
$[7] = t5;
|
||||
} else {
|
||||
t5 = $[7];
|
||||
}
|
||||
const t6 = Math.min(10, violations.length);
|
||||
let t7;
|
||||
if ($[8] !== t6 || $[9] !== totalCount) {
|
||||
t7 = <Box paddingLeft={2}><Text dimColor={true}>… showing last {t6} of {totalCount}</Text></Box>;
|
||||
$[8] = t6;
|
||||
$[9] = totalCount;
|
||||
$[10] = t7;
|
||||
} else {
|
||||
t7 = $[10];
|
||||
}
|
||||
let t8;
|
||||
if ($[11] !== t4 || $[12] !== t5 || $[13] !== t7) {
|
||||
t8 = <Box flexDirection="column" marginTop={1}>{t4}{t5}{t7}</Box>;
|
||||
$[11] = t4;
|
||||
$[12] = t5;
|
||||
$[13] = t7;
|
||||
$[14] = t8;
|
||||
} else {
|
||||
t8 = $[14];
|
||||
}
|
||||
return t8;
|
||||
}
|
||||
function _temp(v, i) {
|
||||
return <Box key={`${v.timestamp.getTime()}-${i}`} paddingLeft={2}><Text dimColor={true}>{formatTime(v.timestamp)}{v.command ? ` ${v.command}:` : ""} {v.line}</Text></Box>;
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" marginTop={1}>
|
||||
<Box marginLeft={0}>
|
||||
<Text color="permission">
|
||||
⧈ Sandbox blocked {totalCount} total{' '}
|
||||
{totalCount === 1 ? 'operation' : 'operations'}
|
||||
</Text>
|
||||
</Box>
|
||||
{violations.map((v, i) => (
|
||||
<Box key={`${v.timestamp.getTime()}-${i}`} paddingLeft={2}>
|
||||
<Text dimColor>
|
||||
{formatTime(v.timestamp)}
|
||||
{v.command ? ` ${v.command}:` : ''} {v.line}
|
||||
</Text>
|
||||
</Box>
|
||||
))}
|
||||
<Box paddingLeft={2}>
|
||||
<Text dimColor>
|
||||
… showing last {Math.min(10, violations.length)} of {totalCount}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user