Repository navigation
Conversation
ymichael
force-pushed
the
bb/code-workspace-import-thr_psx98pzvux
branch
from
November 24, 2026 22:41
5497cf2 to
b571634
Compare
ymichael
force-pushed
the
bb/code-workspace-import-thr_psx98pzvux
branch
from
November 25, 2026 01:00
b571634 to
78f5678
Compare
- Folder checks return a typed problem kind. add, update and import share one tryAddProjectSourceFolder path, so import maps the kind to a skip reason instead of re-checking the main folder and reading HTTP codes. - The import dialog embeds the remote path browser, which can now select files; clicking a .code-workspace file fills the path. - Parse JSONC with strip-json-comments (already installed via pino-pretty) instead of a hand-written stripper, and report a malformed folders entry as invalid instead of rejecting the whole file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
#2181 asks to bring a VS Code multi-root workspace into bb. Since #8007 a project's checkout on a machine can carry extra folders that its threads there can read and write, but each folder had to be added one at a time. A
.code-workspacefile already lists them, and there was no way to use it.What changed
Following timurkhakhalev's proposal on #2181 (one project with several folders), importing a
.code-workspacefills the folders of the project's checkout on one machine.Server.
POST /projects/:id/sources/:sourceId/folders/importwith{ path }. It reads the file on the checkout's machine withhost.read_file, so no daemon change and no protocol bump.code-workspace.tsparses VS Code's lenient JSON (comments, trailing commas, BOM) withstrip-json-comments, which the server already installs throughpino-pretty; the lockfile only adds the direct link. It readsfolders[].path, andfolders[].uriwhen it is afile:URI (local host only); other URI schemes (vscode-remote://, …) are reported, not added.tryAddProjectSourceFolder, the same path asbb project folder addandupdate. It returns the folder or a typed problem (main_folder,inside_main_folder,contains_main_folder,duplicate,not_found,limit, …) fromworkspaceFolderPathProblem;add/updateturn it into the same HTTP errors as before, and import maps it straight to a skip reason.addedfolders andskippedfolders, each with areason(main_folder,inside_main_folder,duplicate,not_found,limit,invalid,unsupported_uri) and a message.foldersentry (for example"path": 42) is skipped asinvalidunder its index (folders[5]); the rest of the file still imports.SDK and CLI.
sdk.projects.sources.experimental_folders.importCodeWorkspace({ projectId, sourceId, path });docs/api_to_audit.mdentry updated.bb project folder import <projectId> <file> [--machine]. Without--machine, the file path resolves against the current directory.App. Each machine's folder list in project settings gains an "Import .code-workspace" action next to "Add folder", shown while the machine is online. It opens a dialog with the machine's folder browser, starting at the main folder.
RemotePathBrowsergained an optionalfileSelectionprop, so clicking a.code-workspacefile fills the path; the path can also be typed. The dialog then shows what was added and what was skipped and why.Compared with T3 (
WorkspaceFolders.ts:decodeCodeWorkspace,scanFolders):.code-workspacein a scanned folder's root. Here the user names the file, so one anywhere on the machine works.urientries and drops missing folders silently. Herefile:URIs are imported, and every folder that is not added is reported with its reason.How you verified
Live (
pnpm start:worktree, real host daemon). The project's main folder wasws-demo/app, andws-demo/app/app.code-workspacelisted.,packages/ui,../api, an absolute…/ws-demo/docs-site,../not-cloned-yetand avscode-remote://URI, with comments and trailing commas:apianddocs-siteas already listed.HTTP 404: Path does not exist, and a non-workspace file givesis not a VS Code workspace file.app.code-workspacein the dialog's folder browser filled the path, and the import added both folders, the folder list updated, and the dialog listed the four skipped folders with their reasons. Checked at desktop and mobile sizes, including the pending state.Tests:
code-workspace.test.ts: comments, trailing commas, BOM,//inside strings,file:URIs (including Windows drive paths andlocalhost), other schemes, malformed entries reported per entry, and non-workspace input.public-project-source-folders.test.ts: one import covering added, main, inside, duplicate, missing, contains-the-main-folder, malformed-entry and URI folders; a broken file; a relative file path; a missing file.pnpm exec turbo run typecheck lint --filter='...[origin/main]'and the@bb/server,@bb/app,@bb/cli,@bb/sdk,@bb/server-contractand@bb/templatessuites.pnpm exec turbo run typecheck lint test --filter=@bb/server --filter=@bb/app --filter=@bb/templates(17/17 tasks), plus a live re-run of the CLI import and the dialog at desktop and phone widths.install-machine-scriptandtimeline-guard-coverage, under load average ~100. Both also fail on other branches and don't touch this code.Fixes #2181
🤖 Generated with Claude Code