{"_id":"@abhi5404/contextswitch","_rev":"2-d6afab49eda838579884040676fb98a6","name":"@abhi5404/contextswitch","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@abhi5404/contextswitch","version":"1.0.0","keywords":["git","developer-tools","context","productivity","cli","branch-switching"],"author":{"name":"abhi5404"},"license":"MIT","_id":"@abhi5404/contextswitch@1.0.0","maintainers":[{"name":"abhi5404","email":"abhijitamp378@gmail.com"}],"homepage":"https://github.com/abhi5404/ContextSwitch#readme","bugs":{"url":"https://github.com/abhi5404/ContextSwitch/issues"},"bin":{"ctx":"bin/ctx.js"},"dist":{"shasum":"4a4f475f463febee5d6533b984d8aa14ea303fa0","tarball":"https://registry.npmjs.org/@abhi5404/contextswitch/-/contextswitch-1.0.0.tgz","fileCount":21,"integrity":"sha512-TF94PH4p+gfqYhDQdMDV737pRlcM3pjivALVsJ2ew4CoiTFB4mBEdRVPEsUdYS3j+uaG/+Pb8v82jZbtg/6wpA==","signatures":[{"sig":"MEUCIQDeLEwcvb7hKCrgr2GRB4imwD1ln7/iOMqkVNfZM5ZgyQIgMkXnGOsN5NcwTDf7zPDg6NEAJHjsclG2r6oQ5HcrCr4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26669},"main":"src/index.js","gitHead":"487928060adec7bcfe3c619c56ec5e7483890fab","scripts":{"test":"jest"},"_npmUser":{"name":"abhi5404","email":"abhijitamp378@gmail.com"},"repository":{"url":"git+https://github.com/abhi5404/ContextSwitch.git","type":"git"},"_npmVersion":"10.9.2","description":"Save and restore your full developer context when switching branches","directories":{},"_nodeVersion":"22.13.1","dependencies":{"chalk":"^4.1.2","ps-list":"^8.1.1","commander":"^11.0.0","simple-git":"^3.20.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0"},"_npmOperationalInternal":{"tmp":"tmp/contextswitch_1.0.0_1775137859581_0.9063906600080842","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@abhi5404/contextswitch","version":"1.0.1","description":"Save and restore your full developer context when switching branches","bin":{"ctx":"bin/ctx.js"},"main":"src/index.js","scripts":{"test":"jest"},"keywords":["git","developer-tools","context","productivity","cli","branch-switching"],"author":{"name":"abhi5404"},"repository":{"type":"git","url":"git+https://github.com/abhi5404/ContextSwitch.git"},"homepage":"https://github.com/abhi5404/ContextSwitch#readme","dependencies":{"chalk":"^4.1.2","commander":"^11.0.0","ps-list":"^8.1.1","simple-git":"^3.20.0"},"devDependencies":{"jest":"^29.7.0"},"license":"MIT","_id":"@abhi5404/contextswitch@1.0.1","gitHead":"487928060adec7bcfe3c619c56ec5e7483890fab","bugs":{"url":"https://github.com/abhi5404/ContextSwitch/issues"},"_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-yeHnEOq4aMaBp7hHdjEk/ZXfdjQ3QdjvkSU37DpAp7LnkFZq7odxAGFfoyWBI2xg0JqXtO1W/lQ1E1y746NPRg==","shasum":"d4ea7f36acc24a03d8cad02bb72fd94bb597faa5","tarball":"https://registry.npmjs.org/@abhi5404/contextswitch/-/contextswitch-1.0.1.tgz","fileCount":21,"unpackedSize":33690,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGHrd7aUDUmi3aiocCc/8bHn8DWkjvl4OSJha5Xaj3TKAiEApx9EcQf2qDYC7YJVxSJbYE/nZ1YPyoZHX8O+cUYaXJA="}]},"_npmUser":{"name":"abhi5404","email":"abhijitamp378@gmail.com"},"directories":{},"maintainers":[{"name":"abhi5404","email":"abhijitamp378@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/contextswitch_1.0.1_1775138068895_0.9186939304984427"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-02T13:50:59.475Z","modified":"2026-04-02T13:54:29.172Z","1.0.0":"2026-04-02T13:50:59.716Z","1.0.1":"2026-04-02T13:54:29.032Z"},"bugs":{"url":"https://github.com/abhi5404/ContextSwitch/issues"},"author":{"name":"abhi5404"},"license":"MIT","homepage":"https://github.com/abhi5404/ContextSwitch#readme","keywords":["git","developer-tools","context","productivity","cli","branch-switching"],"repository":{"type":"git","url":"git+https://github.com/abhi5404/ContextSwitch.git"},"description":"Save and restore your full developer context when switching branches","maintainers":[{"name":"abhi5404","email":"abhijitamp378@gmail.com"}],"readme":"<p align=\"center\">\n  <h1 align=\"center\">🔀 ContextSwitch</h1>\n  <p align=\"center\">\n    <strong>Stop losing your train of thought when switching git branches.</strong>\n  </p>\n  <p align=\"center\">\n    <a href=\"https://www.npmjs.com/package/@abhi5404/contextswitch\"><img src=\"https://img.shields.io/npm/v/@abhi5404/contextswitch?color=0ea5e9&label=npm\" alt=\"npm version\" /></a>\n    <a href=\"https://github.com/abhi5404/ContextSwitch/blob/main/LICENSE\"><img src=\"https://img.shields.io/npm/l/@abhi5404/contextswitch?color=22c55e\" alt=\"license\" /></a>\n    <a href=\"https://www.npmjs.com/package/@abhi5404/contextswitch\"><img src=\"https://img.shields.io/npm/dt/@abhi5404/contextswitch?color=a855f7\" alt=\"downloads\" /></a>\n  </p>\n</p>\n\n---\n\n**ContextSwitch** snapshots your entire developer context — git state, open files, running processes, failing tests, and recent TODOs — so you can switch branches fearlessly and pick up exactly where you left off.\n\n## ✨ The Problem\n\nYou're deep in a feature branch. 6 files open, a failing test you're debugging, `npm run dev` humming in the background. Then someone asks you to review a hotfix on `main`.\n\nYou switch branches, fix the issue, switch back — and now you're staring at a blank slate. *What file was I in? What was failing? What was I even doing?*\n\n**ContextSwitch remembers everything for you.**\n\n## 🚀 Quick Start\n\n```bash\n# Install globally\nnpm install -g @abhi5404/contextswitch\n\n# Save your context before switching away\nctx save \"debugging auth token refresh\"\n\n# Switch branches, do your work...\ngit checkout main\n\n# Come back and restore everything\ngit checkout feature/auth\nctx restore\n```\n\nThat's it. Your files reopen, your git stash pops, and you get a full summary of where you left off.\n\n## 📦 Installation\n\n```bash\n# npm\nnpm install -g @abhi5404/contextswitch\n\n# npx (no install needed)\nnpx @abhi5404/contextswitch save \"my note\"\n```\n\n> **Requirements:** Node.js 16+ and Git\n\n## 🛠️ Commands\n\n### `ctx save [note]`\n\nSnapshots your full developer context for the current branch.\n\n```bash\nctx save                           # save without a note\nctx save \"halfway through refactor\" # save with a note\nctx save --no-stash                # skip git stash (keep changes unstaged)\n```\n\n**What gets captured:**\n\n| Layer | Details |\n|-------|---------|\n| 🌿 **Git** | Branch, commit SHA, modified files, untracked files, auto-stash |\n| 📝 **Editor** | Open files and cursor positions (VS Code) |\n| 💻 **Terminal** | Last 5 commands from shell history |\n| 🔄 **Processes** | Running dev servers (node, vite, next, webpack, jest, nodemon…) |\n| 🧪 **Tests** | Last failing test from Jest cache |\n| 📌 **TODOs** | Recent `TODO`, `FIXME`, `HACK`, `XXX` comments in your code |\n\n### `ctx restore [branch]`\n\nRestores a previously saved context.\n\n```bash\nctx restore                        # restore most recent context\nctx restore feature/auth           # restore a specific branch's context\nctx restore --rebase               # rebase onto main before restoring\nctx restore --no-processes         # skip process restart suggestions\n```\n\n**What gets restored:**\n\n- ✅ Checks out the branch\n- ✅ Pops the saved git stash\n- ✅ Reopens files in VS Code at the exact line\n- ✅ Lists processes that were running\n- ✅ Shows configured restart commands\n- ✅ Prints a full \"where you left off\" summary\n\n### `ctx where`\n\nShows what you were doing on the current branch — without restoring anything.\n\n```\n  where you left off\n\n  ─────────────────────────────────────\n  branch   feature/auth\n  saved    23 minutes ago\n  note     debugging auth token refresh\n  last in  src/auth/refresh.js:47\n  last cmd npm test -- --watch\n  \n  failing test you were working on:\n  src/auth/__tests__/refresh.test.js › should retry on 401\n\n  recent TODO you added:\n  src/auth/refresh.js:52  handle edge case where token expires mid-request\n\n  uncommitted when you saved:\n  • src/auth/refresh.js\n  • src/auth/middleware.js\n  ─────────────────────────────────────\n```\n\n### `ctx list`\n\nShows all saved contexts across branches.\n\n```\n  saved contexts\n\n  feature/auth ← current\n  23m ago · 6 files open · 1 failing test · \"debugging auth token refresh\"\n\n  fix/nav-crash (branch deleted)\n  2d ago · 3 files open · \"quick nav fix\"\n\n  feature/dashboard\n  5d ago · 8 files open\n```\n\n### `ctx clean`\n\nRemoves saved contexts for branches that no longer exist locally.\n\n```bash\nctx clean\n#  cleaned contexts\n#  removed fix/nav-crash\n#  removed experiment/old-api\n```\n\n## ⚙️ Configuration\n\nCreate `.ctx/config.json` in your project root to auto-suggest restart commands when restoring a branch:\n\n```json\n{\n  \"onRestore\": {\n    \"feature/*\": [\"npm run dev\", \"npm run db:seed\"],\n    \"fix/*\": [\"npm run dev\"],\n    \"main\": [\"npm run build\"]\n  }\n}\n```\n\nBranch patterns support wildcards (`*`), so `feature/*` matches `feature/auth`, `feature/dashboard`, etc.\n\n## 🏗️ Architecture\n\n```\ncontextswitch/\n├── bin/ctx.js              # CLI entry point\n├── src/\n│   ├── index.js            # Public API\n│   ├── store.js            # JSON file storage (.ctx/ directory)\n│   ├── cli/\n│   │   ├── commands.js     # Commander.js command definitions\n│   │   └── flags.js        # Option normalization\n│   ├── capturers/          # Context capture modules\n│   │   ├── git.js          # Branch, status, stash\n│   │   ├── editor.js       # VS Code open files\n│   │   ├── terminal.js     # Shell history & running processes\n│   │   ├── tests.js        # Jest test results\n│   │   └── todos.js        # TODO/FIXME scanner\n│   └── restorers/          # Context restore modules\n│       ├── git.js          # Checkout, stash pop, rebase\n│       ├── editor.js       # Reopen files in VS Code\n│       ├── terminal.js     # Process restart suggestions\n│       └── summary.js      # \"Where you left off\" display\n```\n\n### How it works\n\n1. **Save** → Each capturer module collects its slice of context. Everything is serialized to `.ctx/<branch-name>.json`.\n2. **Restore** → The branch is checked out, stash is popped, files are reopened in your editor, and a full summary is printed.\n3. **Storage** → All data lives in `.ctx/` inside your project (auto-added to `.gitignore`). No cloud, no accounts, no telemetry.\n\n## 🔒 Privacy\n\nContextSwitch is **100% local**. Your context data never leaves your machine.\n\n- All data stored in `.ctx/` inside your project\n- Automatically added to `.gitignore`\n- No network requests, no analytics, no telemetry\n- No accounts or sign-ups\n\n## 🐚 Shell Support\n\n| Shell | History Capture | Platform |\n|-------|----------------|----------|\n| PowerShell | ✅ PSReadLine history | Windows |\n| Zsh | ✅ `.zsh_history` | macOS / Linux |\n| Bash | ✅ `.bash_history` | macOS / Linux |\n| Fish | ✅ `fish_history` | macOS / Linux |\n\n## 🤝 Contributing\n\nContributions are welcome! Feel free to open issues and pull requests.\n\n```bash\n# Clone the repo\ngit clone https://github.com/abhi5404/ContextSwitch.git\ncd ContextSwitch\n\n# Install dependencies\nnpm install\n\n# Link for local development\nnpm link\n\n# Now 'ctx' command is available globally for testing\nctx save \"testing my changes\"\n```\n\n## 📄 License\n\n[MIT](LICENSE) — use it however you want.\n\n---\n\n<p align=\"center\">\n  <strong>Built because context-switching shouldn't mean losing context.</strong>\n</p>\n","readmeFilename":"README.md"}