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,214 +1,167 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import chalk from 'chalk';
|
||||
import type { UUID } from 'crypto';
|
||||
import * as React from 'react';
|
||||
import { getSessionId } from '../../bootstrap/state.js';
|
||||
import type { CommandResultDisplay } from '../../commands.js';
|
||||
import { Select } from '../../components/CustomSelect/select.js';
|
||||
import { Dialog } from '../../components/design-system/Dialog.js';
|
||||
import { COMMON_HELP_ARGS, COMMON_INFO_ARGS } from '../../constants/xml.js';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import { logEvent } from '../../services/analytics/index.js';
|
||||
import type { LocalJSXCommandOnDone } from '../../types/command.js';
|
||||
import { recursivelySanitizeUnicode } from '../../utils/sanitization.js';
|
||||
import { getCurrentSessionTag, getTranscriptPath, saveTag } from '../../utils/sessionStorage.js';
|
||||
function ConfirmRemoveTag(t0) {
|
||||
const $ = _c(11);
|
||||
const {
|
||||
tagName,
|
||||
onConfirm,
|
||||
onCancel
|
||||
} = t0;
|
||||
const t1 = `Current tag: #${tagName}`;
|
||||
let t2;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t2 = <Text>This will remove the tag from the current session.</Text>;
|
||||
$[0] = t2;
|
||||
} else {
|
||||
t2 = $[0];
|
||||
}
|
||||
let t3;
|
||||
if ($[1] !== onCancel || $[2] !== onConfirm) {
|
||||
t3 = value => value === "yes" ? onConfirm() : onCancel();
|
||||
$[1] = onCancel;
|
||||
$[2] = onConfirm;
|
||||
$[3] = t3;
|
||||
} else {
|
||||
t3 = $[3];
|
||||
}
|
||||
let t4;
|
||||
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t4 = [{
|
||||
label: "Yes, remove tag",
|
||||
value: "yes"
|
||||
}, {
|
||||
label: "No, keep tag",
|
||||
value: "no"
|
||||
}];
|
||||
$[4] = t4;
|
||||
} else {
|
||||
t4 = $[4];
|
||||
}
|
||||
let t5;
|
||||
if ($[5] !== t3) {
|
||||
t5 = <Box flexDirection="column" gap={1}>{t2}<Select onChange={t3} options={t4} /></Box>;
|
||||
$[5] = t3;
|
||||
$[6] = t5;
|
||||
} else {
|
||||
t5 = $[6];
|
||||
}
|
||||
let t6;
|
||||
if ($[7] !== onCancel || $[8] !== t1 || $[9] !== t5) {
|
||||
t6 = <Dialog title="Remove tag?" subtitle={t1} onCancel={onCancel} color="warning">{t5}</Dialog>;
|
||||
$[7] = onCancel;
|
||||
$[8] = t1;
|
||||
$[9] = t5;
|
||||
$[10] = t6;
|
||||
} else {
|
||||
t6 = $[10];
|
||||
}
|
||||
return t6;
|
||||
import chalk from 'chalk'
|
||||
import type { UUID } from 'crypto'
|
||||
import * as React from 'react'
|
||||
import { getSessionId } from '../../bootstrap/state.js'
|
||||
import type { CommandResultDisplay } from '../../commands.js'
|
||||
import { Select } from '../../components/CustomSelect/select.js'
|
||||
import { Dialog } from '../../components/design-system/Dialog.js'
|
||||
import { COMMON_HELP_ARGS, COMMON_INFO_ARGS } from '../../constants/xml.js'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import { logEvent } from '../../services/analytics/index.js'
|
||||
import type { LocalJSXCommandOnDone } from '../../types/command.js'
|
||||
import { recursivelySanitizeUnicode } from '../../utils/sanitization.js'
|
||||
import {
|
||||
getCurrentSessionTag,
|
||||
getTranscriptPath,
|
||||
saveTag,
|
||||
} from '../../utils/sessionStorage.js'
|
||||
|
||||
function ConfirmRemoveTag({
|
||||
tagName,
|
||||
onConfirm,
|
||||
onCancel,
|
||||
}: {
|
||||
tagName: string
|
||||
onConfirm: () => void
|
||||
onCancel: () => void
|
||||
}): React.ReactNode {
|
||||
return (
|
||||
<Dialog
|
||||
title="Remove tag?"
|
||||
subtitle={`Current tag: #${tagName}`}
|
||||
onCancel={onCancel}
|
||||
color="warning"
|
||||
>
|
||||
<Box flexDirection="column" gap={1}>
|
||||
<Text>This will remove the tag from the current session.</Text>
|
||||
<Select<'yes' | 'no'>
|
||||
onChange={value => (value === 'yes' ? onConfirm() : onCancel())}
|
||||
options={[
|
||||
{ label: 'Yes, remove tag', value: 'yes' },
|
||||
{ label: 'No, keep tag', value: 'no' },
|
||||
]}
|
||||
/>
|
||||
</Box>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
function ToggleTagAndClose(t0) {
|
||||
const $ = _c(17);
|
||||
const {
|
||||
tagName,
|
||||
onDone
|
||||
} = t0;
|
||||
const [showConfirm, setShowConfirm] = React.useState(false);
|
||||
const [sessionId, setSessionId] = React.useState(null);
|
||||
let t1;
|
||||
if ($[0] !== tagName) {
|
||||
t1 = recursivelySanitizeUnicode(tagName).trim();
|
||||
$[0] = tagName;
|
||||
$[1] = t1;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
}
|
||||
const normalizedTag = t1;
|
||||
let t2;
|
||||
let t3;
|
||||
if ($[2] !== normalizedTag || $[3] !== onDone) {
|
||||
t2 = () => {
|
||||
const id = getSessionId() as UUID;
|
||||
if (!id) {
|
||||
onDone("No active session to tag", {
|
||||
display: "system"
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!normalizedTag) {
|
||||
onDone("Tag name cannot be empty", {
|
||||
display: "system"
|
||||
});
|
||||
return;
|
||||
}
|
||||
setSessionId(id);
|
||||
const currentTag = getCurrentSessionTag(id);
|
||||
if (currentTag === normalizedTag) {
|
||||
logEvent("tengu_tag_command_remove_prompt", {});
|
||||
setShowConfirm(true);
|
||||
} else {
|
||||
const isReplacing = !!currentTag;
|
||||
logEvent("tengu_tag_command_add", {
|
||||
is_replacing: isReplacing
|
||||
});
|
||||
(async () => {
|
||||
const fullPath = getTranscriptPath();
|
||||
await saveTag(id, normalizedTag, fullPath);
|
||||
onDone(`Tagged session with ${chalk.cyan(`#${normalizedTag}`)}`, {
|
||||
display: "system"
|
||||
});
|
||||
})();
|
||||
}
|
||||
};
|
||||
t3 = [normalizedTag, onDone];
|
||||
$[2] = normalizedTag;
|
||||
$[3] = onDone;
|
||||
$[4] = t2;
|
||||
$[5] = t3;
|
||||
} else {
|
||||
t2 = $[4];
|
||||
t3 = $[5];
|
||||
}
|
||||
React.useEffect(t2, t3);
|
||||
|
||||
function ToggleTagAndClose({
|
||||
tagName,
|
||||
onDone,
|
||||
}: {
|
||||
tagName: string
|
||||
onDone: (
|
||||
result?: string,
|
||||
options?: { display?: CommandResultDisplay },
|
||||
) => void
|
||||
}): React.ReactNode {
|
||||
const [showConfirm, setShowConfirm] = React.useState(false)
|
||||
const [sessionId, setSessionId] = React.useState<UUID | null>(null)
|
||||
// Sanitize unicode to prevent hidden character attacks and normalize
|
||||
const normalizedTag = recursivelySanitizeUnicode(tagName).trim()
|
||||
|
||||
React.useEffect(() => {
|
||||
const id = getSessionId() as UUID
|
||||
|
||||
if (!id) {
|
||||
onDone('No active session to tag', { display: 'system' })
|
||||
return
|
||||
}
|
||||
|
||||
if (!normalizedTag) {
|
||||
onDone('Tag name cannot be empty', { display: 'system' })
|
||||
return
|
||||
}
|
||||
|
||||
setSessionId(id)
|
||||
const currentTag = getCurrentSessionTag(id)
|
||||
|
||||
// If same tag exists, show confirmation dialog
|
||||
if (currentTag === normalizedTag) {
|
||||
logEvent('tengu_tag_command_remove_prompt', {})
|
||||
setShowConfirm(true)
|
||||
} else {
|
||||
// Add the new tag directly
|
||||
const isReplacing = !!currentTag
|
||||
logEvent('tengu_tag_command_add', { is_replacing: isReplacing })
|
||||
void (async () => {
|
||||
const fullPath = getTranscriptPath()
|
||||
await saveTag(id, normalizedTag, fullPath)
|
||||
onDone(`Tagged session with ${chalk.cyan(`#${normalizedTag}`)}`, {
|
||||
display: 'system',
|
||||
})
|
||||
})()
|
||||
}
|
||||
}, [normalizedTag, onDone])
|
||||
|
||||
if (showConfirm && sessionId) {
|
||||
let t4;
|
||||
if ($[6] !== normalizedTag || $[7] !== onDone || $[8] !== sessionId) {
|
||||
t4 = async () => {
|
||||
logEvent("tengu_tag_command_remove_confirmed", {});
|
||||
const fullPath_0 = getTranscriptPath();
|
||||
await saveTag(sessionId, "", fullPath_0);
|
||||
onDone(`Removed tag ${chalk.cyan(`#${normalizedTag}`)}`, {
|
||||
display: "system"
|
||||
});
|
||||
};
|
||||
$[6] = normalizedTag;
|
||||
$[7] = onDone;
|
||||
$[8] = sessionId;
|
||||
$[9] = t4;
|
||||
} else {
|
||||
t4 = $[9];
|
||||
}
|
||||
let t5;
|
||||
if ($[10] !== normalizedTag || $[11] !== onDone) {
|
||||
t5 = () => {
|
||||
logEvent("tengu_tag_command_remove_cancelled", {});
|
||||
onDone(`Kept tag ${chalk.cyan(`#${normalizedTag}`)}`, {
|
||||
display: "system"
|
||||
});
|
||||
};
|
||||
$[10] = normalizedTag;
|
||||
$[11] = onDone;
|
||||
$[12] = t5;
|
||||
} else {
|
||||
t5 = $[12];
|
||||
}
|
||||
let t6;
|
||||
if ($[13] !== normalizedTag || $[14] !== t4 || $[15] !== t5) {
|
||||
t6 = <ConfirmRemoveTag tagName={normalizedTag} onConfirm={t4} onCancel={t5} />;
|
||||
$[13] = normalizedTag;
|
||||
$[14] = t4;
|
||||
$[15] = t5;
|
||||
$[16] = t6;
|
||||
} else {
|
||||
t6 = $[16];
|
||||
}
|
||||
return t6;
|
||||
return (
|
||||
<ConfirmRemoveTag
|
||||
tagName={normalizedTag}
|
||||
onConfirm={async () => {
|
||||
logEvent('tengu_tag_command_remove_confirmed', {})
|
||||
const fullPath = getTranscriptPath()
|
||||
await saveTag(sessionId, '', fullPath)
|
||||
onDone(`Removed tag ${chalk.cyan(`#${normalizedTag}`)}`, {
|
||||
display: 'system',
|
||||
})
|
||||
}}
|
||||
onCancel={() => {
|
||||
logEvent('tengu_tag_command_remove_cancelled', {})
|
||||
onDone(`Kept tag ${chalk.cyan(`#${normalizedTag}`)}`, {
|
||||
display: 'system',
|
||||
})
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
return null;
|
||||
|
||||
return null
|
||||
}
|
||||
function ShowHelp(t0) {
|
||||
const $ = _c(3);
|
||||
const {
|
||||
onDone
|
||||
} = t0;
|
||||
let t1;
|
||||
let t2;
|
||||
if ($[0] !== onDone) {
|
||||
t1 = () => {
|
||||
onDone("Usage: /tag <tag-name>\n\nToggle a searchable tag on the current session.\nRun the same command again to remove the tag.\nTags are displayed after the branch name in /resume and can be searched with /.\n\nExamples:\n /tag bugfix # Add tag\n /tag bugfix # Remove tag (toggle)\n /tag feature-auth\n /tag wip", {
|
||||
display: "system"
|
||||
});
|
||||
};
|
||||
t2 = [onDone];
|
||||
$[0] = onDone;
|
||||
$[1] = t1;
|
||||
$[2] = t2;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
t2 = $[2];
|
||||
}
|
||||
React.useEffect(t1, t2);
|
||||
return null;
|
||||
|
||||
function ShowHelp({
|
||||
onDone,
|
||||
}: {
|
||||
onDone: (
|
||||
result?: string,
|
||||
options?: { display?: CommandResultDisplay },
|
||||
) => void
|
||||
}): React.ReactNode {
|
||||
React.useEffect(() => {
|
||||
onDone(
|
||||
`Usage: /tag <tag-name>
|
||||
|
||||
Toggle a searchable tag on the current session.
|
||||
Run the same command again to remove the tag.
|
||||
Tags are displayed after the branch name in /resume and can be searched with /.
|
||||
|
||||
Examples:
|
||||
/tag bugfix # Add tag
|
||||
/tag bugfix # Remove tag (toggle)
|
||||
/tag feature-auth
|
||||
/tag wip`,
|
||||
{ display: 'system' },
|
||||
)
|
||||
}, [onDone])
|
||||
|
||||
return null
|
||||
}
|
||||
export async function call(onDone: LocalJSXCommandOnDone, _context: unknown, args?: string): Promise<React.ReactNode> {
|
||||
args = args?.trim() || '';
|
||||
|
||||
export async function call(
|
||||
onDone: LocalJSXCommandOnDone,
|
||||
_context: unknown,
|
||||
args?: string,
|
||||
): Promise<React.ReactNode> {
|
||||
args = args?.trim() || ''
|
||||
|
||||
if (COMMON_INFO_ARGS.includes(args) || COMMON_HELP_ARGS.includes(args)) {
|
||||
return <ShowHelp onDone={onDone} />;
|
||||
return <ShowHelp onDone={onDone} />
|
||||
}
|
||||
|
||||
if (!args) {
|
||||
return <ShowHelp onDone={onDone} />;
|
||||
return <ShowHelp onDone={onDone} />
|
||||
}
|
||||
return <ToggleTagAndClose tagName={args} onDone={onDone} />;
|
||||
|
||||
return <ToggleTagAndClose tagName={args} onDone={onDone} />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user