Skip to main content

run_clear

Function run_clear 

Source
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.json if it exists. A missing file means “no per-worktree context” (load_worktree returns None, show prints “(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, and show/effective always 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.