Skip to content

feat(workspaces): import a VS Code .code-workspace as a workspace#22

Merged
danielss-dev merged 1 commit into
mainfrom
developements/code-workspace-import
Jul 2, 2026
Merged

feat(workspaces): import a VS Code .code-workspace as a workspace#22
danielss-dev merged 1 commit into
mainfrom
developements/code-workspace-import

Conversation

@danielss-dev

Copy link
Copy Markdown
Owner

Summary

Closes the second Workspaces Phase 3 item: a VS Code multi-root .code-workspace file imports as a named Strand workspace.

  • Surfaces: palette "Import .code-workspace..." (imports, opens the workspace, toasts added/skipped) and an "Import .code-workspace..." row in the manager dialog (imports and selects it for curation; skipped folders surface in the message slot).
  • Parsing is pure, unit-tested TS (lib/codeWorkspace.ts): JSONC-tolerant (string-aware comment + trailing-comma stripping), local path entries only (remote uri ignored), relative paths joined against the file directory without canonicalizing — each folder is validated through repoOpen and the canonical meta.path is what gets stored (the Windows re-spelling rule).
  • File reading is a new deliberately narrow IPC command workspace_file_read: the name must end .code-workspace and the file be <= 1 MB, so the webview gains no generic file reader out of this.
  • Non-repo folders are skipped and reported; the import only errors when no folder resolves to a repository.

Test plan

  • cargo test -p strand-tauri — 12/12 (incl. new workspace_file_read gate test)
  • cargo clippy -p strand-core -p strand-tauri -- -D warnings — clean
  • pnpm --filter ./ui exec tsc --noEmit — clean
  • pnpm --filter ./ui test — 171/171 (+13 codeWorkspace tests)
  • pnpm --filter ./ui exec vite build — green
  • End-to-end against the running Tauri app over WebView2 CDP: a JSONC fixture with two real repos + a non-repo folder + a remote uri imported as "acme" (2 added, 1 skipped, uri ignored) and opened with members tabbed; an all-non-repo file threw without creating anything; the backend refused a non-.code-workspace path.

🤖 Generated with Claude Code

Palette "Import .code-workspace..." and an import row in the manager
create a named workspace from a VS Code multi-root workspace file.

Parsing is pure, unit-tested TS (lib/codeWorkspace.ts): JSONC-tolerant
(string-aware comment + trailing-comma stripping), local `path` entries
only (remote `uri` ignored), relative paths joined against the file's
directory without canonicalizing - each folder is validated through
repoOpen and the canonical meta.path is what gets stored (the Windows
re-spelling rule). The file is read by a new deliberately narrow IPC
command, workspace_file_read: the name must end .code-workspace and the
file be <= 1 MB, so the webview gains no generic file reader.

useWorkspaces.importCodeWorkspace returns added/skipped; non-repo
folders are reported (toast / manager message) - only zero resolving
repos is an error.

Verified: cargo test -p strand-tauri (+1 gate test), clippy, tsc,
vitest (171, +13 codeWorkspace), vite build, and an end-to-end pass
against the running Tauri app over WebView2 CDP (JSONC fixture with two
real repos + a non-repo + a remote uri -> imported "acme" with 2 added
/ 1 skipped and members tabbed; all-non-repo file throws creating
nothing; backend refuses a non-workspace path).
@danielss-dev danielss-dev merged commit 3dfdca7 into main Jul 2, 2026
2 checks passed
@danielss-dev danielss-dev deleted the developements/code-workspace-import branch July 2, 2026 20:19
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.

1 participant