MCPcopy Index your code
hub / github.com/codeaashu/claude-code / call

Function call

src/commands/color/color.ts:20–93  ·  view source on GitHub ↗
(
  onDone: LocalJSXCommandOnDone,
  context: ToolUseContext & LocalJSXCommandContext,
  args: string,
)

Source from the content-addressed store, hash-verified

18const RESET_ALIASES = ['default', 'reset', 'none', 'gray', 'grey'] as const
19
20export async function call(
21 onDone: LocalJSXCommandOnDone,
22 context: ToolUseContext & LocalJSXCommandContext,
23 args: string,
24): Promise<null> {
25 // Teammates cannot set their own color
26 if (isTeammate()) {
27 onDone(
28 'Cannot set color: This session is a swarm teammate. Teammate colors are assigned by the team leader.',
29 { display: 'system' },
30 )
31 return null
32 }
33
34 if (!args || args.trim() === '') {
35 const colorList = AGENT_COLORS.join(', ')
36 onDone(`Please provide a color. Available colors: ${colorList}, default`, {
37 display: 'system',
38 })
39 return null
40 }
41
42 const colorArg = args.trim().toLowerCase()
43
44 // Handle reset to default (gray)
45 if (RESET_ALIASES.includes(colorArg as (typeof RESET_ALIASES)[number])) {
46 const sessionId = getSessionId() as UUID
47 const fullPath = getTranscriptPath()
48
49 // Use "default" sentinel (not empty string) so truthiness guards
50 // in sessionStorage.ts persist the reset across session restarts
51 await saveAgentColor(sessionId, 'default', fullPath)
52
53 context.setAppState(prev => ({
54 ...prev,
55 standaloneAgentContext: {
56 ...prev.standaloneAgentContext,
57 name: prev.standaloneAgentContext?.name ?? '',
58 color: undefined,
59 },
60 }))
61
62 onDone('Session color reset to default', { display: 'system' })
63 return null
64 }
65
66 if (!AGENT_COLORS.includes(colorArg as AgentColorName)) {
67 const colorList = AGENT_COLORS.join(', ')
68 onDone(
69 `Invalid color "${colorArg}". Available colors: ${colorList}, default`,
70 { display: 'system' },
71 )
72 return null
73 }
74
75 const sessionId = getSessionId() as UUID
76 const fullPath = getTranscriptPath()
77

Callers

nothing calls this directly

Calls 5

isTeammateFunction · 0.85
getSessionIdFunction · 0.85
getTranscriptPathFunction · 0.85
saveAgentColorFunction · 0.85
onDoneFunction · 0.50

Tested by

no test coverage detected