Expand description
sqry workspace clean <root> — discover and (optionally) remove
stale .sqry/, .sqry-cache, .sqry-prof, and legacy
.sqry-index artifacts (cluster-E §E.4).
Dry-run-by-default. The command emits a WorkspaceCleanReport
summarising every artifact below <root>, classifies each, and
prints the planned-removal set. Pass --apply to actually delete
the planned set; the canonical active artifact and any artifact
the running daemon currently has loaded are excluded unless
--force is also passed. .sqry-index.user (user-curated state —
aliases, recent queries) is excluded unless --include-user-state.
§Safety
walkdiris constructed withfollow_links(false). A symlink that resolves to a.sqry/-shaped target is recorded asSkippedArtifact { reason: SymlinkRefused }and never deleted.- Every discovered path is canonicalised; entries whose canonical
form does not start with
canonical(root)land underSkippedArtifact { reason: OutsideRoot }. - Removal uses
fs::remove_dir_all/fs::remove_fileonly on canonicalised absolute paths.
§Daemon hand-off
Before discovery, the command queries the running daemon’s
daemon/active-artifacts IPC method (250 ms budget) for the list
of .sqry/graph directories currently loaded. Those paths get
is_daemon_locked = true in the report and are excluded from the
removal plan unless --force is passed. When the daemon is down
the list is treated as empty and a warning surfaces in the JSON
envelope.
Functions§
- run
- Entry point for
sqry workspace clean.