Workspace Management

Overview

A sqry workspace groups multiple repositories under one root so you can run queries across all of them in a single command. Each repository is indexed independently — with its own .sqry/ directory and snapshot — but workspace queries merge results and let you filter by repository name.

This is useful for monorepo-style setups where related services live in separate git roots, or for teams that want to trace call paths across microservice boundaries.


Initialize a workspace

Create a workspace at a root directory. Every repository added later will be relative to this root.

sqry workspace init /srv/repos/myteam --name "backend-services"

The --name flag is optional. If omitted, sqry uses the directory name.


Discover repositories

Scan the workspace root for repositories automatically:

# Discover by .sqry index files (only repos already indexed)
sqry workspace scan /srv/repos/myteam --mode index-files

# Discover by git roots (finds all git repositories)
sqry workspace scan /srv/repos/myteam --mode git-roots

git-roots mode is more thorough — it finds every git repository under the root, even if they haven’t been indexed yet. index-files mode is faster and only includes repos that already have a sqry index.


Add and remove repositories

Manually add a specific repository to the workspace:

sqry workspace add /srv/repos/myteam /srv/repos/myteam/auth-service --name auth
sqry workspace add /srv/repos/myteam /srv/repos/myteam/api-gateway --name gateway
sqry workspace add /srv/repos/myteam /srv/repos/myteam/user-service --name users

Remove a repository by name:

sqry workspace remove /srv/repos/myteam users

Index all repositories

Each repository in the workspace needs its own index. You can index them individually or loop through them:

for repo in auth-service api-gateway user-service; do
  sqry index /srv/repos/myteam/$repo
done

Cross-repo queries

Run queries across all repositories in the workspace. Use the repo: filter to scope results:

# Find all public functions across all repos
sqry workspace query /srv/repos/myteam "kind:function AND visibility:public"

# Find callers of authenticate in the auth service only
sqry workspace query /srv/repos/myteam "callers:authenticate" --repo auth

# Dead code across the entire workspace
sqry workspace query /srv/repos/myteam "unused:true AND kind:function"

Results include the repository name alongside the file path, so you can tell which repo each symbol belongs to.


Workspace statistics

View aggregate statistics across all repositories:

sqry workspace stats /srv/repos/myteam

Returns per-repo breakdowns of node counts, edge counts, languages, and index freshness — useful for monitoring workspace health in CI or dashboards.


Workspace status

Use sqry workspace status when you need the live index state for every source root:

sqry workspace status /srv/repos/myteam
sqry workspace status /srv/repos/myteam --json --no-cache

Each source root reports one of:

StatusMeaning
okA usable index exists for that source root
buildingA build is currently in progress
missingNo usable index exists yet
errorsqry could not inspect or load the source-root index

The LSP server and VS Code extension use the same aggregate status model. In a saved .code-workspace, this prevents one missing fallback path from hiding healthy indexed source roots.


VS Code .code-workspace classification

For editor-driven multi-root workspaces, add a sqry.workspace block to the saved .code-workspace file:

{
  "folders": [
    { "path": "auth-service" },
    { "path": "api-gateway" },
    { "path": "docs" }
  ],
  "sqry.workspace": {
    "sourceRoots": ["auth-service", "api-gateway"],
    "memberFolders": ["docs"],
    "exclusions": ["vendor"],
    "projectRootMode": "gitRoot"
  }
}

sourceRoots are indexed and queried. memberFolders belong to the workspace but are not indexed as source roots. exclusions are never promoted to source roots. The extension forwards the workspace-file path to sqry lsp; the LSP loads the .code-workspace file directly as the authoritative logical workspace.