Metadata-Version: 2.4
Name: cursor-storage-reset
Version: 1.0.0
Summary: Safely regenerate Cursor globalStorage telemetry fields in storage.json
Author: Shivanshu814
License-Expression: MIT
Project-URL: Homepage, https://github.com/shivanshu814/cursor-storage-reset
Project-URL: Repository, https://github.com/shivanshu814/cursor-storage-reset
Project-URL: Issues, https://github.com/shivanshu814/cursor-storage-reset/issues
Keywords: cursor,storage,telemetry,privacy
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-cov>=4.1; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: ruff>=0.3; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Dynamic: license-file

# Cursor storage reset

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![PyPI](https://img.shields.io/pypi/v/cursor-storage-reset.svg)](https://pypi.org/project/cursor-storage-reset/)

**Repository:** [github.com/shivanshu814/cursor-storage-reset](https://github.com/shivanshu814/cursor-storage-reset) · **Author:** [@shivanshu814](https://github.com/shivanshu814)

Small, tested, cross-platform utility. It regenerates these fields in Cursor’s `storage.json`:

- `telemetry.macMachineId`
- `telemetry.machineId`
- `telemetry.devDeviceId`

Writes use an **atomic replace** (temp file + `fsync`) so a crash mid-save is unlikely to leave truncated JSON. Keys outside the telemetry trio are preserved.

## Install

### From PyPI (recommended)

```bash
pip install cursor-storage-reset
```

PyPI project: [pypi.org/project/cursor-storage-reset](https://pypi.org/project/cursor-storage-reset/).

### From source

Clone (same name as on GitHub):

```bash
git clone https://github.com/shivanshu814/cursor-storage-reset.git
cd cursor-storage-reset
```

From the repository root (editable install for development):

```bash
python3 -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
```

Or install without dev tools:

```bash
pip install .
```

After install, the console entry point `cursor-storage-reset` is available.

## Usage

```bash
# Use the default path for the current OS
cursor-storage-reset

# Custom file
cursor-storage-reset /path/to/storage.json

# Show the resolved default for this machine
cursor-storage-reset --print-default

python -m cursor_storage_reset --version
```

Restart Cursor after a successful run.

### Default paths

| OS      | Default `storage.json` |
|--------|-------------------------|
| macOS  | `~/Library/Application Support/Cursor/User/globalStorage/storage.json` |
| Linux  | `$XDG_CONFIG_HOME/Cursor/User/globalStorage/storage.json`, or `~/.config/...` if unset |
| Windows | `%APPDATA%\Cursor\User\globalStorage\storage.json` |

## Development

```bash
pip install -e ".[dev]"
pytest
```

### Maintainer: publish to PyPI

1. Create an account on [pypi.org](https://pypi.org) and an **API token** (scope: entire account or this project).
2. Build and upload (do **not** commit the token):

```bash
pip install build twine
python -m build
twine check dist/*
TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-YOUR_TOKEN_HERE twine upload dist/*
```

Use [TestPyPI](https://test.pypi.org/) first if you want a dry run (`twine upload --repository testpypi dist/*` after configuring `~/.pypirc`).

**Without storing a token in GitHub:** enable [Trusted Publishing](https://docs.pypi.org/trusted-publishers/) on PyPI for project `cursor-storage-reset`, repository `shivanshu814/cursor-storage-reset`, workflow `publish-pypi.yml`. Then open **Actions → Publish Python package to PyPI → Run workflow**, or push a tag `v1.0.0` to trigger a release build.

## API

```python
from pathlib import Path
from cursor_storage_reset import default_storage_path, refresh_telemetry_ids

refresh_telemetry_ids(Path("/explicit/storage.json"))
print(default_storage_path())
```

## Responsibility

This tool only edits **local** files you point it at. You must follow Cursor’s terms of service and applicable law. Use for legitimate purposes (e.g. privacy, troubleshooting your own setup).

## Layout

| Path | Role |
|------|------|
| `src/cursor_storage_reset/paths.py` | Pure path resolution (testable per OS) |
| `src/cursor_storage_reset/storage.py` | JSON load/save + atomic write + ID generation |
| `src/cursor_storage_reset/cli.py` | `argparse` CLI |
| `src/cursor_storage_reset/exceptions.py` | Narrow error types |
| `tests/` | Pytest coverage for paths + storage |

Legacy root-level `mac.py` / `linux.py` / `windows.py` scripts were removed in favor of one cross-platform CLI and `python -m cursor_storage_reset`.
