pub fn run_clear(
cwd: &Path,
global: bool,
user: bool,
) -> Result<(), Box<dyn Error>>Expand description
tracevault context clear — remove/reset the context for the chosen scope.
Default scope:
- Linked worktree → DELETE
worktrees/<key>/context.jsonif it exists. A missing file means “no per-worktree context” (load_worktreereturnsNone,showprints “(none)”), so deleting preserves the absent-vs-empty distinction that the rest of the design relies on. - Primary checkout → write an empty (default)
context.json. The global file is the canonical one; there is no absent-vs-empty distinction to preserve, andshow/effectivealways read it.
global = true forces clearing the global file from any worktree.
user = true clears the resolved user-context file instead (wins over global);
like the global file, the user file is canonical, so it is overwritten with an
empty context rather than deleted.