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.