mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
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>
This commit is contained in:
@@ -1,18 +1,22 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import figures from 'figures';
|
||||
import * as React from 'react';
|
||||
import { Box, Text } from 'src/ink.js';
|
||||
import { AGENT_COLOR_TO_THEME_COLOR, AGENT_COLORS, type AgentColorName } from 'src/tools/AgentTool/agentColorManager.js';
|
||||
import type { PromptInputMode } from 'src/types/textInputTypes.js';
|
||||
import { getTeammateColor } from 'src/utils/teammate.js';
|
||||
import type { Theme } from 'src/utils/theme.js';
|
||||
import { isAgentSwarmsEnabled } from '../../utils/agentSwarmsEnabled.js';
|
||||
import figures from 'figures'
|
||||
import * as React from 'react'
|
||||
import { Box, Text } from 'src/ink.js'
|
||||
import {
|
||||
AGENT_COLOR_TO_THEME_COLOR,
|
||||
AGENT_COLORS,
|
||||
type AgentColorName,
|
||||
} from 'src/tools/AgentTool/agentColorManager.js'
|
||||
import type { PromptInputMode } from 'src/types/textInputTypes.js'
|
||||
import { getTeammateColor } from 'src/utils/teammate.js'
|
||||
import type { Theme } from 'src/utils/theme.js'
|
||||
import { isAgentSwarmsEnabled } from '../../utils/agentSwarmsEnabled.js'
|
||||
|
||||
type Props = {
|
||||
mode: PromptInputMode;
|
||||
isLoading: boolean;
|
||||
viewingAgentName?: string;
|
||||
viewingAgentColor?: AgentColorName;
|
||||
};
|
||||
mode: PromptInputMode
|
||||
isLoading: boolean
|
||||
viewingAgentName?: string
|
||||
viewingAgentColor?: AgentColorName
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the theme color key for the teammate's assigned color.
|
||||
@@ -20,73 +24,81 @@ type Props = {
|
||||
*/
|
||||
function getTeammateThemeColor(): keyof Theme | undefined {
|
||||
if (!isAgentSwarmsEnabled()) {
|
||||
return undefined;
|
||||
return undefined
|
||||
}
|
||||
const colorName = getTeammateColor();
|
||||
const colorName = getTeammateColor()
|
||||
if (!colorName) {
|
||||
return undefined;
|
||||
return undefined
|
||||
}
|
||||
if (AGENT_COLORS.includes(colorName as AgentColorName)) {
|
||||
return AGENT_COLOR_TO_THEME_COLOR[colorName as AgentColorName];
|
||||
return AGENT_COLOR_TO_THEME_COLOR[colorName as AgentColorName]
|
||||
}
|
||||
return undefined;
|
||||
return undefined
|
||||
}
|
||||
|
||||
type PromptCharProps = {
|
||||
isLoading: boolean;
|
||||
isLoading: boolean
|
||||
// Dead code elimination: parameter named themeColor to avoid "teammate" string in external builds
|
||||
themeColor?: keyof Theme;
|
||||
};
|
||||
themeColor?: keyof Theme
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the prompt character (❯).
|
||||
* Teammate color overrides the default color when set.
|
||||
*/
|
||||
function PromptChar(t0) {
|
||||
const $ = _c(3);
|
||||
const {
|
||||
isLoading,
|
||||
themeColor
|
||||
} = t0;
|
||||
const teammateColor = themeColor;
|
||||
const color = teammateColor ?? (false ? "subtle" : undefined);
|
||||
let t1;
|
||||
if ($[0] !== color || $[1] !== isLoading) {
|
||||
t1 = <Text color={color} dimColor={isLoading}>{figures.pointer} </Text>;
|
||||
$[0] = color;
|
||||
$[1] = isLoading;
|
||||
$[2] = t1;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
}
|
||||
return t1;
|
||||
function PromptChar({
|
||||
isLoading,
|
||||
themeColor,
|
||||
}: PromptCharProps): React.ReactNode {
|
||||
// Assign to original name for clarity within the function
|
||||
const teammateColor = themeColor
|
||||
const isAnt = process.env.USER_TYPE === 'ant'
|
||||
const color = teammateColor ?? (isAnt ? 'subtle' : undefined)
|
||||
|
||||
return (
|
||||
<Text color={color} dimColor={isLoading}>
|
||||
{figures.pointer}
|
||||
</Text>
|
||||
)
|
||||
}
|
||||
export function PromptInputModeIndicator(t0) {
|
||||
const $ = _c(6);
|
||||
const {
|
||||
mode,
|
||||
isLoading,
|
||||
viewingAgentName,
|
||||
viewingAgentColor
|
||||
} = t0;
|
||||
let t1;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = getTeammateThemeColor();
|
||||
$[0] = t1;
|
||||
} else {
|
||||
t1 = $[0];
|
||||
}
|
||||
const teammateColor = t1;
|
||||
const viewedTeammateThemeColor = viewingAgentColor ? AGENT_COLOR_TO_THEME_COLOR[viewingAgentColor] : undefined;
|
||||
let t2;
|
||||
if ($[1] !== isLoading || $[2] !== mode || $[3] !== viewedTeammateThemeColor || $[4] !== viewingAgentName) {
|
||||
t2 = <Box alignItems="flex-start" alignSelf="flex-start" flexWrap="nowrap" justifyContent="flex-start">{viewingAgentName ? <PromptChar isLoading={isLoading} themeColor={viewedTeammateThemeColor} /> : mode === "bash" ? <Text color="bashBorder" dimColor={isLoading}>! </Text> : <PromptChar isLoading={isLoading} themeColor={isAgentSwarmsEnabled() ? teammateColor : undefined} />}</Box>;
|
||||
$[1] = isLoading;
|
||||
$[2] = mode;
|
||||
$[3] = viewedTeammateThemeColor;
|
||||
$[4] = viewingAgentName;
|
||||
$[5] = t2;
|
||||
} else {
|
||||
t2 = $[5];
|
||||
}
|
||||
return t2;
|
||||
|
||||
export function PromptInputModeIndicator({
|
||||
mode,
|
||||
isLoading,
|
||||
viewingAgentName,
|
||||
viewingAgentColor,
|
||||
}: Props): React.ReactNode {
|
||||
const teammateColor = getTeammateThemeColor()
|
||||
|
||||
// Convert viewed teammate's color to theme color
|
||||
// Falls back to PromptChar's default (subtle for ants, undefined for external)
|
||||
const viewedTeammateThemeColor = viewingAgentColor
|
||||
? AGENT_COLOR_TO_THEME_COLOR[viewingAgentColor]
|
||||
: undefined
|
||||
|
||||
return (
|
||||
<Box
|
||||
alignItems="flex-start"
|
||||
alignSelf="flex-start"
|
||||
flexWrap="nowrap"
|
||||
justifyContent="flex-start"
|
||||
>
|
||||
{viewingAgentName ? (
|
||||
// Use teammate's color on the standard prompt character, matching established style
|
||||
<PromptChar
|
||||
isLoading={isLoading}
|
||||
themeColor={viewedTeammateThemeColor}
|
||||
/>
|
||||
) : mode === 'bash' ? (
|
||||
<Text color="bashBorder" dimColor={isLoading}>
|
||||
!
|
||||
</Text>
|
||||
) : (
|
||||
<PromptChar
|
||||
isLoading={isLoading}
|
||||
themeColor={isAgentSwarmsEnabled() ? teammateColor : undefined}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user