Skip to content

feat: rename organizations → workspaces in CLI#85

Merged
enaboapps merged 5 commits intodevfrom
rename/org-to-workspace
Mar 11, 2026
Merged

feat: rename organizations → workspaces in CLI#85
enaboapps merged 5 commits intodevfrom
rename/org-to-workspace

Conversation

@enaboapps
Copy link
Copy Markdown
Owner

@enaboapps enaboapps commented Mar 11, 2026

Summary

  • Renames all organization/orgName/organizationName references to workspace/workspaceName across auth and whoami flows
  • Updates UI labels from Organization:Workspace:
  • Updates API response type expectation on /v1/whoami (organizationNameworkspaceName)
  • Updates token response type (organization_nameworkspace_name)

Closes #84. Part of timberlogs-core#863.

Files changed

  • src/commands/whoami.tsx
  • src/commands/login.tsx
  • src/components/ReplView.tsx
  • src/components/commandViews/LoginView.tsx
  • src/components/commandViews/WhoamiView.tsx

Test plan

  • timberlogs login — success message shows ✓ Workspace: <name>
  • timberlogs whoami — output shows Workspace: label
  • REPL header shows workspace name when authenticated
  • --json flag on whoami outputs workspace key (not organization)

Summary by CodeRabbit

  • Updates
    • Authentication and profile features now use "Workspace" terminology instead of "Organization" throughout the application.

enaboapps and others added 5 commits March 10, 2026 15:27
chore: sync dev → main (publish workflow fix)
chore: sync dev → main (trusted publishing)
chore: sync dev to main (oidc environment fix)
chore: sync dev to main
Updates all org-related terminology across auth, whoami, and repl
flows to match the workspace rebrand from timberlogs-core#863.
@enaboapps enaboapps added this to the v1.1.1 milestone Mar 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 11, 2026

📝 Walkthrough

Walkthrough

This PR systematically renames organizational concepts to workspace concepts across the CLI codebase. API response fields (organization_name → workspace_name), type definitions, state variables (orgName → workspaceName), helper functions, and UI labels are updated consistently across five files to align with backend rebranding.

Changes

Cohort / File(s) Summary
Login Command & View
src/commands/login.tsx, src/components/commandViews/LoginView.tsx
TokenResponse type updated: organization_name?workspace_name?. State renamed: orgName/setOrgNameworkspaceName/setWorkspaceName. JSON output and UI labels switched from "Organization" to "Workspace".
WhoAmI Command & View
src/commands/whoami.tsx, src/components/commandViews/WhoamiView.tsx
Result type field renamed: organization?workspace?. API response type changed: organizationName?workspaceName?. Local variable and info object construction updated accordingly. UI rendering and labels switched from "Organization" to "Workspace".
Component State Management
src/components/ReplView.tsx
Props and state renamed: orgNameworkspaceName. Fetch function renamed: fetchOrgNamefetchWorkspaceName. Effect updated to clear/fetch workspaceName based on token presence. ReplHeader prop binding updated.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 From orgs to spaces, we've hopped away,
Each workspace shines in a brand new way!
Variables renamed with careful grace,
The CLI discovers its rightful place,
A rebrand complete—let celebrations bloom! 🌱✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title clearly summarizes the main change: renaming organization references to workspace terminology across the CLI codebase.
Linked Issues check ✅ Passed All code changes align with linked issue #84 requirements: API/type renames, variable renames, and UI label updates are consistently applied across all specified files.
Out of Scope Changes check ✅ Passed All modifications are directly related to the organization-to-workspace rebrand scope defined in issue #84; no unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rename/org-to-workspace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/commands/whoami.tsx (1)

58-65: ⚠️ Potential issue | 🟠 Major

Route successful JSON output through the shared JSON-mode helper.

This branch still depends on options.json and writes JSON manually, so non-TTY stdout can miss JSON mode and still render Ink output before completion.

Suggested fix
 		const info: Result = {
 			authenticated: true,
 			...(workspaceName ? {workspace: workspaceName} : {}),
 		};
 
-		if (options.json) {
-			console.log(JSON.stringify(info));
-			process.exit(0);
+		if (isJsonMode(options)) {
+			jsonOutput(info);
+			return;
 		}

Add the corresponding helper imports at the top of the file.

As per coding guidelines, "Use isJsonMode(options) to detect JSON output mode (when stdout is not a TTY or --json flag is set)" and "use jsonOutput(data) for success".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/commands/whoami.tsx` around lines 58 - 65, Replace the manual JSON branch
that checks options.json and does console.log/ process.exit with the shared
helpers: import isJsonMode and jsonOutput at the top, then use if
(isJsonMode(options)) { jsonOutput(info); return; } instead of
console.log(JSON.stringify(info)); process.exit(0); so JSON output is routed
through the common JSON-mode detection and formatting; update the surrounding
code to return after jsonOutput to avoid Ink rendering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/commands/login.tsx`:
- Around line 116-121: Replace the direct options.json check and console.log in
the successful auth branch with the shared JSON path: call isJsonMode(options)
to detect JSON mode and use jsonOutput({...}) to emit the machine-readable
object (including token.workspace_name as workspace when present) instead of
console.log; ensure you import isJsonMode and jsonOutput at the top of the file
and retain the process.exit(0) behavior if needed.

In `@src/components/ReplView.tsx`:
- Around line 78-82: The fetchWorkspaceName function only sets workspace name on
truthy responses, so when the token changes or the /v1/whoami call fails you
must clear any stale value; update fetchWorkspaceName (and the other place that
sets workspaceName) to setWorkspaceName(undefined) before/when starting the
fetch and also in the catch/failure branch (or when whoami.workspaceName is
absent) so the header cannot display a previous session's workspace; reference
the fetchWorkspaceName function and setWorkspaceName state updater when making
these changes.

---

Outside diff comments:
In `@src/commands/whoami.tsx`:
- Around line 58-65: Replace the manual JSON branch that checks options.json and
does console.log/ process.exit with the shared helpers: import isJsonMode and
jsonOutput at the top, then use if (isJsonMode(options)) { jsonOutput(info);
return; } instead of console.log(JSON.stringify(info)); process.exit(0); so JSON
output is routed through the common JSON-mode detection and formatting; update
the surrounding code to return after jsonOutput to avoid Ink rendering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a9f539d1-f468-4e0d-a4fa-b7769bbd4327

📥 Commits

Reviewing files that changed from the base of the PR and between fcff0ab and 8f0aeb4.

📒 Files selected for processing (5)
  • src/commands/login.tsx
  • src/commands/whoami.tsx
  • src/components/ReplView.tsx
  • src/components/commandViews/LoginView.tsx
  • src/components/commandViews/WhoamiView.tsx

Comment on lines 116 to 121
if (options.json) {
console.log(JSON.stringify({
authenticated: true,
...(token.organization_name ? {organization: token.organization_name} : {}),
...(token.workspace_name ? {workspace: token.workspace_name} : {}),
}));
process.exit(0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use the shared JSON-mode path here instead of options.json + console.log.

This success branch still keys off --json only and bypasses jsonOutput(...), so redirected stdout can miss the machine-readable path and still emit Ink output.

Suggested fix
-				if (options.json) {
-					console.log(JSON.stringify({
-						authenticated: true,
-						...(token.workspace_name ? {workspace: token.workspace_name} : {}),
-					}));
-					process.exit(0);
-				}
+				if (isJsonMode(options)) {
+					jsonOutput({
+						authenticated: true,
+						...(token.workspace_name ? {workspace: token.workspace_name} : {}),
+					});
+					return;
+				}

Add the corresponding helper imports at the top of the file.

As per coding guidelines, "Use isJsonMode(options) to detect JSON output mode (when stdout is not a TTY or --json flag is set)" and "use jsonOutput(data) for success".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/commands/login.tsx` around lines 116 - 121, Replace the direct
options.json check and console.log in the successful auth branch with the shared
JSON path: call isJsonMode(options) to detect JSON mode and use
jsonOutput({...}) to emit the machine-readable object (including
token.workspace_name as workspace when present) instead of console.log; ensure
you import isJsonMode and jsonOutput at the top of the file and retain the
process.exit(0) behavior if needed.

Comment on lines +78 to +82
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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Clear stale workspaceName when the token changes or the fetch fails.

This branch only writes truthy values, so a previous workspace can survive a failed /v1/whoami call or a response without workspaceName. The header can then show the wrong workspace for the current session.

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
Verify each finding against the current code and only fix it if needed.

In `@src/components/ReplView.tsx` around lines 78 - 82, The fetchWorkspaceName
function only sets workspace name on truthy responses, so when the token changes
or the /v1/whoami call fails you must clear any stale value; update
fetchWorkspaceName (and the other place that sets workspaceName) to
setWorkspaceName(undefined) before/when starting the fetch and also in the
catch/failure branch (or when whoami.workspaceName is absent) so the header
cannot display a previous session's workspace; reference the fetchWorkspaceName
function and setWorkspaceName state updater when making these changes.

@enaboapps enaboapps merged commit cb34269 into dev Mar 11, 2026
2 checks passed
@enaboapps enaboapps deleted the rename/org-to-workspace branch March 11, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename organizations → workspaces in CLI

2 participants