mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-19 06:45:50 +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,151 +1,112 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { BLACK_CIRCLE, BULLET_OPERATOR } from '../constants/figures.js';
|
||||
import { Box, Text } from '../ink.js';
|
||||
import type { SkillUpdate } from '../utils/hooks/skillImprovement.js';
|
||||
import { normalizeFullWidthDigits } from '../utils/stringUtils.js';
|
||||
import { isValidResponseInput } from './FeedbackSurvey/FeedbackSurveyView.js';
|
||||
import type { FeedbackSurveyResponse } from './FeedbackSurvey/utils.js';
|
||||
import React, { useEffect, useRef } from 'react'
|
||||
import { BLACK_CIRCLE, BULLET_OPERATOR } from '../constants/figures.js'
|
||||
import { Box, Text } from '../ink.js'
|
||||
import type { SkillUpdate } from '../utils/hooks/skillImprovement.js'
|
||||
import { normalizeFullWidthDigits } from '../utils/stringUtils.js'
|
||||
import { isValidResponseInput } from './FeedbackSurvey/FeedbackSurveyView.js'
|
||||
import type { FeedbackSurveyResponse } from './FeedbackSurvey/utils.js'
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean;
|
||||
skillName: string;
|
||||
updates: SkillUpdate[];
|
||||
handleSelect: (selected: FeedbackSurveyResponse) => void;
|
||||
inputValue: string;
|
||||
setInputValue: (value: string) => void;
|
||||
};
|
||||
export function SkillImprovementSurvey(t0) {
|
||||
const $ = _c(6);
|
||||
const {
|
||||
isOpen,
|
||||
skillName,
|
||||
updates,
|
||||
handleSelect,
|
||||
inputValue,
|
||||
setInputValue
|
||||
} = t0;
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
if (inputValue && !isValidResponseInput(inputValue)) {
|
||||
return null;
|
||||
}
|
||||
let t1;
|
||||
if ($[0] !== handleSelect || $[1] !== inputValue || $[2] !== setInputValue || $[3] !== skillName || $[4] !== updates) {
|
||||
t1 = <SkillImprovementSurveyView skillName={skillName} updates={updates} onSelect={handleSelect} inputValue={inputValue} setInputValue={setInputValue} />;
|
||||
$[0] = handleSelect;
|
||||
$[1] = inputValue;
|
||||
$[2] = setInputValue;
|
||||
$[3] = skillName;
|
||||
$[4] = updates;
|
||||
$[5] = t1;
|
||||
} else {
|
||||
t1 = $[5];
|
||||
}
|
||||
return t1;
|
||||
isOpen: boolean
|
||||
skillName: string
|
||||
updates: SkillUpdate[]
|
||||
handleSelect: (selected: FeedbackSurveyResponse) => void
|
||||
inputValue: string
|
||||
setInputValue: (value: string) => void
|
||||
}
|
||||
|
||||
export function SkillImprovementSurvey({
|
||||
isOpen,
|
||||
skillName,
|
||||
updates,
|
||||
handleSelect,
|
||||
inputValue,
|
||||
setInputValue,
|
||||
}: Props): React.ReactNode {
|
||||
if (!isOpen) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Hide the survey if the user is typing anything other than a survey response
|
||||
if (inputValue && !isValidResponseInput(inputValue)) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<SkillImprovementSurveyView
|
||||
skillName={skillName}
|
||||
updates={updates}
|
||||
onSelect={handleSelect}
|
||||
inputValue={inputValue}
|
||||
setInputValue={setInputValue}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
type ViewProps = {
|
||||
skillName: string;
|
||||
updates: SkillUpdate[];
|
||||
onSelect: (option: FeedbackSurveyResponse) => void;
|
||||
inputValue: string;
|
||||
setInputValue: (value: string) => void;
|
||||
};
|
||||
skillName: string
|
||||
updates: SkillUpdate[]
|
||||
onSelect: (option: FeedbackSurveyResponse) => void
|
||||
inputValue: string
|
||||
setInputValue: (value: string) => void
|
||||
}
|
||||
|
||||
// Only 1 (apply) and 0 (dismiss) are valid for this survey
|
||||
const VALID_INPUTS = ['0', '1'] as const;
|
||||
const VALID_INPUTS = ['0', '1'] as const
|
||||
|
||||
function isValidInput(input: string): boolean {
|
||||
return (VALID_INPUTS as readonly string[]).includes(input);
|
||||
return (VALID_INPUTS as readonly string[]).includes(input)
|
||||
}
|
||||
function SkillImprovementSurveyView(t0) {
|
||||
const $ = _c(17);
|
||||
const {
|
||||
skillName,
|
||||
updates,
|
||||
onSelect,
|
||||
inputValue,
|
||||
setInputValue
|
||||
} = t0;
|
||||
const initialInputValue = useRef(inputValue);
|
||||
let t1;
|
||||
let t2;
|
||||
if ($[0] !== inputValue || $[1] !== onSelect || $[2] !== setInputValue) {
|
||||
t1 = () => {
|
||||
if (inputValue !== initialInputValue.current) {
|
||||
const lastChar = normalizeFullWidthDigits(inputValue.slice(-1));
|
||||
if (isValidInput(lastChar)) {
|
||||
setInputValue(inputValue.slice(0, -1));
|
||||
onSelect(lastChar === "1" ? "good" : "dismissed");
|
||||
}
|
||||
|
||||
function SkillImprovementSurveyView({
|
||||
skillName,
|
||||
updates,
|
||||
onSelect,
|
||||
inputValue,
|
||||
setInputValue,
|
||||
}: ViewProps): React.ReactNode {
|
||||
const initialInputValue = useRef(inputValue)
|
||||
|
||||
useEffect(() => {
|
||||
if (inputValue !== initialInputValue.current) {
|
||||
const lastChar = normalizeFullWidthDigits(inputValue.slice(-1))
|
||||
if (isValidInput(lastChar)) {
|
||||
setInputValue(inputValue.slice(0, -1))
|
||||
// Map: 1 = "good" (apply), 0 = "dismissed"
|
||||
onSelect(lastChar === '1' ? 'good' : 'dismissed')
|
||||
}
|
||||
};
|
||||
t2 = [inputValue, onSelect, setInputValue];
|
||||
$[0] = inputValue;
|
||||
$[1] = onSelect;
|
||||
$[2] = setInputValue;
|
||||
$[3] = t1;
|
||||
$[4] = t2;
|
||||
} else {
|
||||
t1 = $[3];
|
||||
t2 = $[4];
|
||||
}
|
||||
useEffect(t1, t2);
|
||||
let t3;
|
||||
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t3 = <Text color="ansi:cyan">{BLACK_CIRCLE} </Text>;
|
||||
$[5] = t3;
|
||||
} else {
|
||||
t3 = $[5];
|
||||
}
|
||||
let t4;
|
||||
if ($[6] !== skillName) {
|
||||
t4 = <Box>{t3}<Text bold={true}>Skill improvement suggested for "{skillName}"</Text></Box>;
|
||||
$[6] = skillName;
|
||||
$[7] = t4;
|
||||
} else {
|
||||
t4 = $[7];
|
||||
}
|
||||
let t5;
|
||||
if ($[8] !== updates) {
|
||||
t5 = updates.map(_temp);
|
||||
$[8] = updates;
|
||||
$[9] = t5;
|
||||
} else {
|
||||
t5 = $[9];
|
||||
}
|
||||
let t6;
|
||||
if ($[10] !== t5) {
|
||||
t6 = <Box flexDirection="column" marginLeft={2}>{t5}</Box>;
|
||||
$[10] = t5;
|
||||
$[11] = t6;
|
||||
} else {
|
||||
t6 = $[11];
|
||||
}
|
||||
let t7;
|
||||
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t7 = <Box width={12}><Text><Text color="ansi:cyan">1</Text>: Apply</Text></Box>;
|
||||
$[12] = t7;
|
||||
} else {
|
||||
t7 = $[12];
|
||||
}
|
||||
let t8;
|
||||
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t8 = <Box marginLeft={2} marginTop={1}>{t7}<Box width={14}><Text><Text color="ansi:cyan">0</Text>: Dismiss</Text></Box></Box>;
|
||||
$[13] = t8;
|
||||
} else {
|
||||
t8 = $[13];
|
||||
}
|
||||
let t9;
|
||||
if ($[14] !== t4 || $[15] !== t6) {
|
||||
t9 = <Box flexDirection="column" marginTop={1}>{t4}{t6}{t8}</Box>;
|
||||
$[14] = t4;
|
||||
$[15] = t6;
|
||||
$[16] = t9;
|
||||
} else {
|
||||
t9 = $[16];
|
||||
}
|
||||
return t9;
|
||||
}
|
||||
function _temp(u, i) {
|
||||
return <Text key={i} dimColor={true}>{BULLET_OPERATOR} {u.change}</Text>;
|
||||
}
|
||||
}, [inputValue, onSelect, setInputValue])
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" marginTop={1}>
|
||||
<Box>
|
||||
<Text color="ansi:cyan">{BLACK_CIRCLE} </Text>
|
||||
<Text bold>
|
||||
Skill improvement suggested for "{skillName}"
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<Box flexDirection="column" marginLeft={2}>
|
||||
{updates.map((u, i) => (
|
||||
<Text key={i} dimColor>
|
||||
{BULLET_OPERATOR} {u.change}
|
||||
</Text>
|
||||
))}
|
||||
</Box>
|
||||
|
||||
<Box marginLeft={2} marginTop={1}>
|
||||
<Box width={12}>
|
||||
<Text>
|
||||
<Text color="ansi:cyan">1</Text>: Apply
|
||||
</Text>
|
||||
</Box>
|
||||
<Box width={14}>
|
||||
<Text>
|
||||
<Text color="ansi:cyan">0</Text>: Dismiss
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user