Skip to main content

Tools

Code

The Code tool is Spruce's file browser. It shows up in two places:

SurfaceWhereWhat it shows
Global Code pageTools section of the sidebarThe current branch's tree of every linked code repo
Artifact-scope Code tabThe tool panel on an open artifactThe artifact's worktree, the actual checkout the artifact's branch lives on

Both surfaces share the same file viewer, the same syntax highlighting, and the same affordances (open files, blame, diffs, comments). The difference is what they're rooted at and how they handle multiple files.

The global Code page

Reach it from the Tools section of the sidebar (⌘⌥E on macOS, Ctrl+Alt+E elsewhere). The page is split:

  • File tree on the left: full repository tree, with the current branch's contents.
  • Branch picker at the top: switch which branch's tree you're browsing without leaving the page.
  • Split-screen viewer on the right: opens when you click a file; selection stays local to the page.

Code page with the tree on the left and a TypeScript file open in the split-screen viewerCode page with the tree on the left and a TypeScript file open in the split-screen viewer

If your project links more than one code repo, the file tree shows each as a top-level root. Expand the one you want.

The artifact-scope Code tab

When an artifact is open, the Code tab in the tool panel (toggle with ⌘⇧E) shows the artifact's worktree — not the global repo's current branch. So you're browsing the actual checkout the artifact's branch lives on, including any uncommitted changes.

Two practical differences from the global page:

  • Rooted at the worktree. The file tree shows what's at <repo>/.worktrees/SPR-xxxxx/, not the main branch.
  • Files replace the artifact editor. Clicking a file swaps the artifact body for the file viewer in the same pane. Use the breadcrumb at the top to navigate back to the artifact (or between files you've opened). The artifact already scopes the workspace, so a separate split-screen pane would be redundant.

Opening a file

Identical from either surface: click in the tree. Spruce syntax-highlights most common languages and renders markdown inline. Large binary files are replaced with a summary panel (size, type, commit history).

Finding a file

Two ways to skip the scroll:

  • The file tree's built-in search box. Type to filter the tree to matching paths. Results stay in place, so the tree's hierarchy is preserved.
  • The Command Palette (⌘K / Ctrl+K). Fuzzy-match across file paths anywhere in the project, including from outside the Code tool.

From a file, you can

  • Open the artifact linked to the file's branch, if there is one.
  • View Blame and File History: per-line authorship.
  • Open a commit's Diff: from a blame line, or a linked commit.
  • Leave a Comment at a specific line.