-
Notifications
You must be signed in to change notification settings - Fork 0
feat: rename organizations → workspaces in CLI #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c744268
5195602
a5303e6
569ed3f
8f0aeb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ import type {ReplEntry} from './ReplOutput.js'; | |
|
|
||
| const COMMANDS_HINT = 'logs stats flows flows show whoami login logout config list help exit'; | ||
|
|
||
| function ReplHeader({token, orgName}: {token: string | null; orgName: string | null}) { | ||
| function ReplHeader({token, workspaceName}: {token: string | null; workspaceName: string | null}) { | ||
| const cols = process.stdout.columns || 80; | ||
| return ( | ||
| <Box flexDirection="column"> | ||
|
|
@@ -34,7 +34,7 @@ function ReplHeader({token, orgName}: {token: string | null; orgName: string | n | |
| <Text dimColor>v{CLI_VERSION}</Text> | ||
| </Box> | ||
| {token ? ( | ||
| <Text><Text color="green">● </Text><Text>{orgName ?? 'Authenticated'}</Text></Text> | ||
| <Text><Text color="green">● </Text><Text>{workspaceName ?? 'Authenticated'}</Text></Text> | ||
| ) : ( | ||
| <Text><Text color="red">● </Text><Text dimColor>Not logged in</Text></Text> | ||
| )} | ||
|
|
@@ -73,13 +73,13 @@ export default function ReplView() { | |
| const [phase, setPhase] = useState<Phase>({tag: 'idle'}); | ||
| const [history, setHistory] = useState<string[]>([]); | ||
| const [token, setToken] = useState<string | null>(null); | ||
| const [orgName, setOrgName] = useState<string | null>(null); | ||
| const [workspaceName, setWorkspaceName] = useState<string | null>(null); | ||
|
|
||
| const fetchOrgName = useCallback(async (t: string) => { | ||
| const fetchWorkspaceName = useCallback(async (t: string) => { | ||
| try { | ||
| const client = createApiClient({token: t}); | ||
| const whoami = await client.get<{organizationName?: string}>('/v1/whoami'); | ||
| if (whoami.organizationName) setOrgName(whoami.organizationName); | ||
| const whoami = await client.get<{workspaceName?: string}>('/v1/whoami'); | ||
| if (whoami.workspaceName) setWorkspaceName(whoami.workspaceName); | ||
|
Comment on lines
+78
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clear stale This branch only writes truthy values, so a previous workspace can survive a failed Suggested fix const fetchWorkspaceName = useCallback(async (t: string) => {
try {
const client = createApiClient({token: t});
const whoami = await client.get<{workspaceName?: string}>('/v1/whoami');
- if (whoami.workspaceName) setWorkspaceName(whoami.workspaceName);
+ setWorkspaceName(whoami.workspaceName ?? null);
} catch {
+ setWorkspaceName(null);
// silently fail — header shows "Authenticated" fallback
}
}, []);
useEffect(() => {
- if (!token) { setWorkspaceName(null); return; }
+ if (!token) { setWorkspaceName(null); return; }
+ setWorkspaceName(null);
void fetchWorkspaceName(token);
-}, [token]);
+}, [token, fetchWorkspaceName]);Also applies to: 94-95 🤖 Prompt for AI Agents |
||
| } catch { | ||
| // silently fail — header shows "Authenticated" fallback | ||
| } | ||
|
|
@@ -91,8 +91,8 @@ export default function ReplView() { | |
| }, []); | ||
|
|
||
| useEffect(() => { | ||
| if (!token) { setOrgName(null); return; } | ||
| void fetchOrgName(token); | ||
| if (!token) { setWorkspaceName(null); return; } | ||
| void fetchWorkspaceName(token); | ||
| }, [token]); | ||
|
|
||
| function addEntry(entry: ReplEntry) { | ||
|
|
@@ -276,7 +276,7 @@ export default function ReplView() { | |
|
|
||
| return ( | ||
| <Box flexDirection="column"> | ||
| <ReplHeader token={token} orgName={orgName} /> | ||
| <ReplHeader token={token} workspaceName={workspaceName} /> | ||
| {visibleEntries.map((entry, i) => ( | ||
| <ReplOutput key={i} entry={entry} /> | ||
| ))} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the shared JSON-mode path here instead of
options.json+console.log.This success branch still keys off
--jsononly and bypassesjsonOutput(...), so redirected stdout can miss the machine-readable path and still emit Ink output.Suggested fix
Add the corresponding helper imports at the top of the file.
🤖 Prompt for AI Agents