reset-kilocode-state.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. # Accept optional parameter for VS Code directory
  3. # Can be: full path, relative path, or just directory name (default: "Code")
  4. # Examples:
  5. # ./reset-kilocode-state.sh # uses default "Code"
  6. # ./reset-kilocode-state.sh VSCodium # uses "VSCodium"
  7. # ./reset-kilocode-state.sh "Code - Insiders" # uses "Code - Insiders"
  8. # ./reset-kilocode-state.sh ~/custom/path # uses full path
  9. VSCODE_DIR="${1:-Code}"
  10. # Expand ~ to $HOME if present
  11. VSCODE_DIR="${VSCODE_DIR/#\~/$HOME}"
  12. # If the path exists as a directory, use it directly
  13. # Otherwise, treat it as a directory name under ~/Library/Application Support/
  14. if [[ -d "$VSCODE_DIR" ]]; then
  15. VSCODE_DIR="$VSCODE_DIR"
  16. else
  17. VSCODE_DIR="$HOME/Library/Application Support/$VSCODE_DIR"
  18. fi
  19. echo "Kilocode state is being reset for: $VSCODE_DIR"
  20. echo "This probably doesn't work while VS Code is running."
  21. # Reset the secrets:
  22. sqlite3 "$VSCODE_DIR/User/globalStorage/state.vscdb" \
  23. "DELETE FROM ItemTable WHERE \
  24. key = 'kilocode.kilo-code' OR \
  25. key LIKE 'workbench.view.extension.kilo-code%' OR \
  26. key LIKE 'secret://{\"extensionId\":\"kilocode.kilo-code\",%';"
  27. # delete all kilocode state files:
  28. rm -rf "$VSCODE_DIR/User/globalStorage/kilocode.kilo-code/"
  29. # clear some of the vscode cache that I've observed contains kilocode related entries:
  30. rm -f "$VSCODE_DIR/CachedProfilesData/__default__profile__/extensions.user.cache"