Skip to content

Commit eba67ef

Browse files
continue[bot]sestinjContinue
authored
Add organization name display to CLI intro screen (#8041)
- Add organizationName prop to IntroMessage component - Display 'Org: [ORG_NAME]' above 'Agent: [AGENT_NAME]' - Fetch organization name from auth service in TUIChat - Add useOrganizationName hook to resolve org ID to name - Pass organizationName through StaticChatContent - Update tests to verify org display behavior Generated with [Continue](https://continue.dev) Co-authored-by: Continue Agent <[email protected]> Co-authored-by: Continue <[email protected]> Co-authored-by: Nate <[email protected]>
1 parent 80e99a5 commit eba67ef

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

extensions/cli/src/ui/IntroMessage.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,19 @@ describe("IntroMessage", () => {
8181
expect(lastFrame()).toContain("Model:");
8282
expect(lastFrame()).toContain("Loading...");
8383
});
84+
85+
it("renders organization name when provided", () => {
86+
const { lastFrame } = render(
87+
<IntroMessage organizationName="Test Organization" />,
88+
);
89+
90+
expect(lastFrame()).toContain("Org:");
91+
expect(lastFrame()).toContain("Test Organization");
92+
});
93+
94+
it("does not render organization section when not provided", () => {
95+
const { lastFrame } = render(<IntroMessage />);
96+
97+
expect(lastFrame()).not.toContain("Org:");
98+
});
8499
});

extensions/cli/src/ui/IntroMessage.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ interface IntroMessageProps {
1313
config?: AssistantUnrolled;
1414
model?: ModelConfig;
1515
mcpService?: MCPService;
16+
organizationName?: string;
1617
}
1718

1819
// Helper function to extract rule names
@@ -26,6 +27,7 @@ const IntroMessage: React.FC<IntroMessageProps> = ({
2627
config,
2728
model,
2829
mcpService,
30+
organizationName,
2931
}) => {
3032
// Get MCP prompts directly (not memoized since they can change after first render)
3133
const mcpPrompts = mcpService?.getState().prompts ?? [];
@@ -98,6 +100,13 @@ const IntroMessage: React.FC<IntroMessageProps> = ({
98100
{/* Tips Display - shown randomly 1 in 5 times */}
99101
{showTip && <TipsDisplay />}
100102

103+
{/* Organization name */}
104+
{organizationName && (
105+
<Text color="blue">
106+
<Text bold>Org:</Text> <Text color="white">{organizationName}</Text>
107+
</Text>
108+
)}
109+
101110
{/* Agent name */}
102111
{config && (
103112
<Text color="blue">

extensions/cli/src/ui/TUIChat.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import React, {
99

1010
import { ToolPermissionServiceState } from "src/services/ToolPermissionService.js";
1111

12+
import { listUserOrganizations } from "../auth/workos.js";
1213
import { useServices } from "../hooks/useService.js";
1314
import {
1415
ApiClientServiceState,
@@ -110,6 +111,44 @@ function useTUIChatServices(remoteUrl?: string) {
110111
return { services, allServicesReady, isRemoteMode };
111112
}
112113

114+
// Custom hook to fetch organization name
115+
function useOrganizationName(organizationId?: string): string | undefined {
116+
const [organizationName, setOrganizationName] = useState<string | undefined>(
117+
undefined,
118+
);
119+
120+
useEffect(() => {
121+
if (!organizationId) {
122+
setOrganizationName(undefined);
123+
return;
124+
}
125+
126+
let isMounted = true;
127+
128+
async function fetchOrgName() {
129+
try {
130+
const orgs = await listUserOrganizations();
131+
if (!isMounted) return;
132+
133+
const org = orgs?.find((o) => o.id === organizationId);
134+
if (org) {
135+
setOrganizationName(org.name);
136+
}
137+
} catch (error) {
138+
logger.debug("Failed to fetch organization name", { error });
139+
}
140+
}
141+
142+
fetchOrgName();
143+
144+
return () => {
145+
isMounted = false;
146+
};
147+
}, [organizationId]);
148+
149+
return organizationName;
150+
}
151+
113152
// Custom hook for chat handlers
114153
function useChatHandlers(
115154
setShowIntroMessage: (show: boolean) => void,
@@ -298,6 +337,9 @@ const TUIChat: React.FC<TUIChatProps> = ({
298337
// State for image in clipboard status
299338
const [hasImageInClipboard, setHasImageInClipboard] = useState(false);
300339

340+
// Fetch organization name based on auth state
341+
const organizationName = useOrganizationName(services.auth?.organizationId);
342+
301343
return (
302344
<Box flexDirection="column" height="100%">
303345
{/* Chat history - takes up all available space above input */}
@@ -320,6 +362,7 @@ const TUIChat: React.FC<TUIChatProps> = ({
320362
config={services.config?.config || undefined}
321363
model={services.model?.model || undefined}
322364
mcpService={services.mcp?.mcpService || undefined}
365+
organizationName={organizationName}
323366
chatHistory={chatHistory}
324367
queuedMessages={queuedMessages}
325368
renderMessage={renderMessage}

extensions/cli/src/ui/components/StaticChatContent.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface StaticChatContentProps {
1414
config?: AssistantUnrolled;
1515
model?: ModelConfig;
1616
mcpService?: MCPService;
17+
organizationName?: string;
1718
chatHistory: ChatHistoryItem[];
1819
queuedMessages?: QueuedMessage[];
1920
renderMessage: (
@@ -29,6 +30,7 @@ export const StaticChatContent: React.FC<StaticChatContentProps> = ({
2930
config,
3031
model,
3132
mcpService,
33+
organizationName,
3234
chatHistory,
3335
queuedMessages = [],
3436
renderMessage,
@@ -96,6 +98,7 @@ export const StaticChatContent: React.FC<StaticChatContentProps> = ({
9698
config={config}
9799
model={model}
98100
mcpService={mcpService}
101+
organizationName={organizationName}
99102
/>,
100103
);
101104
}
@@ -129,6 +132,7 @@ export const StaticChatContent: React.FC<StaticChatContentProps> = ({
129132
config,
130133
model,
131134
mcpService,
135+
organizationName,
132136
processedChatHistory,
133137
renderMessage,
134138
]);

0 commit comments

Comments
 (0)