{"_id":"@code.siddharth/code","_rev":"7-7cbcf12928e1ddc9187019841dd29c59","name":"@code.siddharth/code","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.0":{"name":"@code.siddharth/code","version":"1.0.0","keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"author":{"name":"Siddharth Vaishnav"},"license":"ISC","_id":"@code.siddharth/code@1.0.0","maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"homepage":"https://github.com/siddharth17vaishnav/ai-assistant#readme","bugs":{"url":"https://github.com/siddharth17vaishnav/ai-assistant/issues"},"bin":{"code":"dist/cli/main.js"},"dist":{"shasum":"9cf6a86bf345aaa7d69fe34a7d0a572783534763","tarball":"https://registry.npmjs.org/@code.siddharth/code/-/code-1.0.0.tgz","fileCount":146,"integrity":"sha512-p83Fu8DPBZJkyD64GTk0pumB+rTcIQ/rXOrlbQep1OQVydbQqNa/IYSRr3dBQUHQ2H5j9OkM80hzCJNPJ+w0Xw==","signatures":[{"sig":"MEUCIFrgW9/WnWofLYljw8ZeNCpXIkn5J/44eKkGSLPzl0NsAiEA5FLw7fQPchcszZljUG5h1aglimD166eTMt75ixINn3k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214766},"main":"./dist/cli/main.js","type":"module","types":"./dist/cli/main.d.ts","engines":{"node":">=18"},"gitHead":"fc4ea741f923388ca78a726b22d7e68422a5aa12","scripts":{"dev":"tsx src/cli/dev.ts","chat":"tsx src/cli/chat.ts","build":"tsc","index":"tsx src/cli/indexer.ts","query":"tsx src/cli/query.ts","start":"node dist/cli/main.js","watch":"tsx src/cli/watch.ts","prepack":"npm run build","chat:watch":"tsx src/cli/chat.ts --watch","index:full":"tsx src/cli/indexer.ts --full","chat:simple":"tsx src/cli/chat.ts --simple"},"_npmUser":{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"},"repository":{"url":"git+https://github.com/siddharth17vaishnav/ai-assistant.git","type":"git"},"_npmVersion":"11.8.0","description":"Code — local RAG coding assistant powered by Ollama and LanceDB","directories":{},"_nodeVersion":"25.5.0","dependencies":{"dotenv":"^17.4.2","ignore":"^7.0.5","ts-morph":"^28.0.0","fast-glob":"^3.3.3","@lancedb/lancedb":"^0.31.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.0","typescript":"^6.0.3","@types/node":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/code_1.0.0_1783102971070_0.7319423560006406","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@code.siddharth/code","version":"1.0.1","keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"author":{"name":"Siddharth Vaishnav"},"license":"ISC","_id":"@code.siddharth/code@1.0.1","maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"homepage":"https://github.com/siddharth17vaishnav/code#readme","bugs":{"url":"https://github.com/siddharth17vaishnav/code/issues"},"bin":{"code":"dist/cli/main.js"},"dist":{"shasum":"a262bd59cb853fadd0e27b91c2c88523952013ea","tarball":"https://registry.npmjs.org/@code.siddharth/code/-/code-1.0.1.tgz","fileCount":146,"integrity":"sha512-5eD+WsIfzEKRWvKjoA19zX2yZcRraKMxMUAYc1jE30jot4XW65vZeJwJ3GASbSr245qt0QtLoXOqyoLJZbfAww==","signatures":[{"sig":"MEQCIGH9lpiI3aln3q/QSFyNuCyI2HNxHHqSZD/23pnN1Z9LAiBgdV6/oQcdEYUkiveXH0Fm3wpP30/2xcMKexsnpZuZSg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214948},"main":"./dist/cli/main.js","type":"module","types":"./dist/cli/main.d.ts","engines":{"node":">=18"},"gitHead":"dd6ad0ad23b998ebeca51b6005443bef007f08a0","scripts":{"dev":"tsx src/cli/dev.ts","chat":"tsx src/cli/chat.ts","build":"tsc","index":"tsx src/cli/indexer.ts","query":"tsx src/cli/query.ts","start":"node dist/cli/main.js","watch":"tsx src/cli/watch.ts","prepack":"npm run build","chat:watch":"tsx src/cli/chat.ts --watch","index:full":"tsx src/cli/indexer.ts --full","chat:simple":"tsx src/cli/chat.ts --simple"},"_npmUser":{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"},"repository":{"url":"git+https://github.com/siddharth17vaishnav/code.git","type":"git"},"_npmVersion":"11.8.0","description":"code — local RAG coding assistant powered by Ollama and LanceDB","directories":{},"_nodeVersion":"25.5.0","dependencies":{"dotenv":"^17.4.2","ignore":"^7.0.5","ts-morph":"^28.0.0","fast-glob":"^3.3.3","@lancedb/lancedb":"^0.31.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.0","typescript":"^6.0.3","@types/node":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/code_1.0.1_1783103856044_0.945962986017507","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@code.siddharth/code","version":"1.0.2","keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"author":{"name":"Siddharth Vaishnav"},"license":"ISC","_id":"@code.siddharth/code@1.0.2","maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"homepage":"https://github.com/siddharth17vaishnav/code#readme","bugs":{"url":"https://github.com/siddharth17vaishnav/code/issues"},"bin":{"code":"dist/cli/main.js"},"dist":{"shasum":"44a200e6de6a3233d8359935209a2c1c2dd44eef","tarball":"https://registry.npmjs.org/@code.siddharth/code/-/code-1.0.2.tgz","fileCount":146,"integrity":"sha512-2gWrM9RmrO3un2TfxYArxJ3LwfaUOcYUBh4ybqA3ja+y2cbQo+hwTthndAFlTwfKXce3wVHaP2/Xs9b0ZHmwRA==","signatures":[{"sig":"MEYCIQCJaaic5as/VSAl7CDV+6WzB2u2ilGUH6obSgHGDooPFQIhAKvPDFacsEKloR6f6JT2rhLudkfhluK0EM3CUGLMbLOm","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":215616},"main":"./dist/cli/main.js","type":"module","types":"./dist/cli/main.d.ts","engines":{"node":">=18"},"gitHead":"9bb0ff4e38fcb7794d4ee83840949312ad270fe4","scripts":{"dev":"tsx src/cli/dev.ts","chat":"tsx src/cli/chat.ts","test":"tsx --test tests/**/*.test.ts","build":"tsc","index":"tsx src/cli/indexer.ts","query":"tsx src/cli/query.ts","start":"node dist/cli/main.js","watch":"tsx src/cli/watch.ts","prepack":"npm run build","chat:watch":"tsx src/cli/chat.ts --watch","index:full":"tsx src/cli/indexer.ts --full","chat:simple":"tsx src/cli/chat.ts --simple"},"_npmUser":{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"},"repository":{"url":"git+https://github.com/siddharth17vaishnav/code.git","type":"git"},"_npmVersion":"11.8.0","description":"code — local RAG coding assistant powered by Ollama and LanceDB","directories":{},"_nodeVersion":"25.5.0","dependencies":{"dotenv":"^17.4.2","ignore":"^7.0.5","ts-morph":"^28.0.0","fast-glob":"^3.3.3","@lancedb/lancedb":"^0.31.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.0","typescript":"^6.0.3","@types/node":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/code_1.0.2_1783104602319_0.5724183468486423","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@code.siddharth/code","version":"1.0.3","keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"author":{"name":"Siddharth Vaishnav"},"license":"ISC","_id":"@code.siddharth/code@1.0.3","maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"homepage":"https://github.com/siddharth17vaishnav/code#readme","bugs":{"url":"https://github.com/siddharth17vaishnav/code/issues"},"bin":{"code":"dist/cli/main.js"},"dist":{"shasum":"d1c96336d2b3bbdfa030d1e1486547a9c93c2559","tarball":"https://registry.npmjs.org/@code.siddharth/code/-/code-1.0.3.tgz","fileCount":146,"integrity":"sha512-dY6AFUk55jzCB6R62Sv612xQlQLBNnxe2QWRD2Gkt9kCG8Pu6+PG5TfvLFGh8E1w1K7YVQMB3Vj0219xEA8Jew==","signatures":[{"sig":"MEUCIBp73oVYCvFOgspWSaXfldWr5mg31cIeEEJBdgz5UXsSAiEAxmP0yLmEctzo7lkChlQcIl4Jp/muNziMNL/axtgcaTQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":216167},"main":"./dist/cli/main.js","type":"module","types":"./dist/cli/main.d.ts","engines":{"node":">=18"},"gitHead":"f34b313a2240a08385071babb7418727ae24413c","scripts":{"dev":"tsx src/cli/dev.ts","chat":"tsx src/cli/chat.ts","test":"tsx --test tests/**/*.test.ts","build":"tsc","index":"tsx src/cli/indexer.ts","query":"tsx src/cli/query.ts","start":"node dist/cli/main.js","watch":"tsx src/cli/watch.ts","prepack":"npm run build","chat:watch":"tsx src/cli/chat.ts --watch","index:full":"tsx src/cli/indexer.ts --full","chat:simple":"tsx src/cli/chat.ts --simple"},"_npmUser":{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"},"repository":{"url":"git+https://github.com/siddharth17vaishnav/code.git","type":"git"},"_npmVersion":"11.8.0","description":"code — local RAG coding assistant powered by Ollama and LanceDB","directories":{},"_nodeVersion":"25.5.0","dependencies":{"dotenv":"^17.4.2","ignore":"^7.0.5","ts-morph":"^28.0.0","fast-glob":"^3.3.3","@lancedb/lancedb":"^0.31.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.0","typescript":"^6.0.3","@types/node":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/code_1.0.3_1783105197914_0.7933284145123032","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@code.siddharth/code","version":"1.0.4","keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"author":{"name":"Siddharth Vaishnav"},"license":"ISC","_id":"@code.siddharth/code@1.0.4","maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"homepage":"https://github.com/siddharth17vaishnav/code#readme","bugs":{"url":"https://github.com/siddharth17vaishnav/code/issues"},"bin":{"code":"dist/cli/main.js"},"dist":{"shasum":"76f8be6f818299f9bbe3496cb02238b2acb26cf6","tarball":"https://registry.npmjs.org/@code.siddharth/code/-/code-1.0.4.tgz","fileCount":150,"integrity":"sha512-Yf8k/QBTE3lR5AZHdkyH7zfqS9f5dy0d11VP+pc8KL5lCm/i8/qVleypZyS1hjf6spnWX+zri18Q6S82sL3bvw==","signatures":[{"sig":"MEUCIQCT90lGU+forQYEbVJ+8qAFFJ3Jp0aflIH57EDouauS+wIgZaSimcXyF8muq3mpaXsz5OJ8M1rYRETVIzC/UpUC16A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":217369},"main":"./dist/cli/main.js","type":"module","types":"./dist/cli/main.d.ts","engines":{"node":">=18"},"gitHead":"5e6ea7e3a832320efcb0f82cdd28081e64e63e1a","scripts":{"dev":"tsx src/cli/dev.ts","chat":"tsx src/cli/chat.ts","test":"tsx --test tests/**/*.test.ts","build":"tsc","index":"tsx src/cli/indexer.ts","query":"tsx src/cli/query.ts","start":"node dist/cli/main.js","watch":"tsx src/cli/watch.ts","prepack":"npm run build","chat:watch":"tsx src/cli/chat.ts --watch","index:full":"tsx src/cli/indexer.ts --full","chat:simple":"tsx src/cli/chat.ts --simple"},"_npmUser":{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"},"repository":{"url":"git+https://github.com/siddharth17vaishnav/code.git","type":"git"},"_npmVersion":"11.8.0","description":"code — local RAG coding assistant powered by Ollama and LanceDB","directories":{},"_nodeVersion":"25.5.0","dependencies":{"dotenv":"^17.4.2","ignore":"^7.0.5","ts-morph":"^28.0.0","fast-glob":"^3.3.3","@lancedb/lancedb":"^0.31.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.0","typescript":"^6.0.3","@types/node":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/code_1.0.4_1783105768162_0.5087013729475574","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@code.siddharth/code","version":"1.0.5","keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"author":{"name":"Siddharth Vaishnav"},"license":"ISC","_id":"@code.siddharth/code@1.0.5","maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"homepage":"https://github.com/siddharth17vaishnav/code#readme","bugs":{"url":"https://github.com/siddharth17vaishnav/code/issues"},"bin":{"code":"dist/cli/main.js"},"dist":{"shasum":"8231a2666ec78da64f534fd2b7d71e82eacbcf82","tarball":"https://registry.npmjs.org/@code.siddharth/code/-/code-1.0.5.tgz","fileCount":150,"integrity":"sha512-tD6Y2z+ATfzHcKCRsVuoM+FRBeWCsaf6kiXvyFavGa30st5YX48e5VeX2It0v8hKVQO4Pe3pLXcxVw+9q3H9oQ==","signatures":[{"sig":"MEYCIQDGSvDdfxnnY/3+X5Zg7a02nUO2NLRgqsbIQp0xo/gvDgIhAM6RH9mRnuU1KQTECYbwoeraX3nQbpItbRogZBGF0KuR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":219660},"main":"./dist/cli/main.js","type":"module","types":"./dist/cli/main.d.ts","engines":{"node":">=18"},"gitHead":"6dc3190558846d45b8041f48850a95cafa6bf276","scripts":{"dev":"tsx src/cli/dev.ts","chat":"tsx src/cli/chat.ts","test":"tsx --test tests/**/*.test.ts","build":"tsc","index":"tsx src/cli/indexer.ts","query":"tsx src/cli/query.ts","start":"node dist/cli/main.js","watch":"tsx src/cli/watch.ts","prepack":"npm run build","chat:watch":"tsx src/cli/chat.ts --watch","index:full":"tsx src/cli/indexer.ts --full","chat:simple":"tsx src/cli/chat.ts --simple"},"_npmUser":{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"},"repository":{"url":"git+https://github.com/siddharth17vaishnav/code.git","type":"git"},"_npmVersion":"11.8.0","description":"code — local RAG coding assistant powered by Ollama and LanceDB","directories":{},"_nodeVersion":"25.5.0","dependencies":{"dotenv":"^17.4.2","ignore":"^7.0.5","ts-morph":"^28.0.0","fast-glob":"^3.3.3","@lancedb/lancedb":"^0.31.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.0","typescript":"^6.0.3","@types/node":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/code_1.0.5_1783106068646_0.18747304283685984","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@code.siddharth/code","version":"1.0.6","description":"code — local RAG coding assistant powered by Ollama and LanceDB","type":"module","main":"./dist/cli/main.js","bin":{"code":"dist/cli/main.js"},"scripts":{"build":"tsc","prepack":"npm run build","dev":"tsx src/cli/dev.ts","chat":"tsx src/cli/chat.ts","chat:simple":"tsx src/cli/chat.ts --simple","chat:plan":"tsx src/cli/chat.ts --plan","chat:plan:resume":"tsx src/cli/chat.ts --plan --resume","chat:watch":"tsx src/cli/chat.ts --watch","index":"tsx src/cli/indexer.ts","index:full":"tsx src/cli/indexer.ts --full","query":"tsx src/cli/query.ts","watch":"tsx src/cli/watch.ts","start":"node dist/cli/main.js","test":"tsx --test tests/**/*.test.ts"},"keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"author":{"name":"Siddharth Vaishnav"},"license":"ISC","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/siddharth17vaishnav/code.git"},"engines":{"node":">=18"},"dependencies":{"@lancedb/lancedb":"^0.31.0","dotenv":"^17.4.2","fast-glob":"^3.3.3","ignore":"^7.0.5","ts-morph":"^28.0.0"},"devDependencies":{"@types/node":"^26.1.0","tsx":"^4.23.0","typescript":"^6.0.3"},"gitHead":"c2e7425343493f5d55bbe6d36dbfce317068f6b8","types":"./dist/cli/main.d.ts","_id":"@code.siddharth/code@1.0.6","bugs":{"url":"https://github.com/siddharth17vaishnav/code/issues"},"homepage":"https://github.com/siddharth17vaishnav/code#readme","_nodeVersion":"25.5.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-VC70KFRgVVGxDKMRIDP/Fh83vshc957udMo48gnUus7FCBUbU2F53uq+OjBn79PzzGdVvyOn0q9JYJtp/sy0cQ==","shasum":"a6cb138f5d52cdfad41de12ed748fa06122d6868","tarball":"https://registry.npmjs.org/@code.siddharth/code/-/code-1.0.6.tgz","fileCount":166,"unpackedSize":303437,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCFaxiETqlyL3mKLU9svRu2h10N4gvIafCKkxDGmW7j2AIhANmbqyM4h5WtG3VoqBYGk+jGZpNTZOF0wuWbrmva3bGu"}]},"_npmUser":{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"},"directories":{},"maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/code_1.0.6_1783107971086_0.8055436288959104"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-03T18:22:50.960Z","modified":"2026-07-03T19:46:11.339Z","1.0.0":"2026-07-03T18:22:51.208Z","1.0.1":"2026-07-03T18:37:36.183Z","1.0.2":"2026-07-03T18:50:02.509Z","1.0.3":"2026-07-03T18:59:58.023Z","1.0.4":"2026-07-03T19:09:28.294Z","1.0.5":"2026-07-03T19:14:28.780Z","1.0.6":"2026-07-03T19:46:11.220Z"},"bugs":{"url":"https://github.com/siddharth17vaishnav/code/issues"},"author":{"name":"Siddharth Vaishnav"},"license":"ISC","homepage":"https://github.com/siddharth17vaishnav/code#readme","keywords":["ai","ollama","rag","lancedb","coding-assistant","local-llm","vector-search"],"repository":{"type":"git","url":"git+https://github.com/siddharth17vaishnav/code.git"},"description":"code — local RAG coding assistant powered by Ollama and LanceDB","maintainers":[{"name":"code.siddharth","email":"siddharth17vaishnav@gmail.com"}],"readme":"# code\r\n\r\nLocal RAG coding assistant powered by **Ollama** and **LanceDB**. Index any codebase, ask questions, and run an agent with tools — all on your machine.\r\n\r\n**npm:** `@code.siddharth/code` · **CLI command:** `code`\r\n\r\n> The unscoped name `code` is taken on npm. Install with the scoped package name — the command is still `code`.\r\n\r\nNo cloud API. No code leaving your laptop.\r\n\r\n## Features\r\n\r\n- **Local LLM** — Qwen2.5-Coder via Ollama\r\n- **RAG pipeline** — scan → chunk → embed → store in LanceDB\r\n- **Multi-project indexes** — each repo gets its own vector store; switch without re-indexing\r\n- **Incremental sync** — only re-embeds changed files\r\n- **Agent mode** — multi-step tool loop (read, grep, edit, git, AST references)\r\n- **Plan mode** — read-only exploration, approaches + questions, then `/execute` to implement\r\n- **Saved plans** — auto-save under `storage/projects/<id>/plans/`; resume with `/resume` or `--resume`\r\n- **Simple RAG mode** — single-shot Q&A without the agent loop\r\n- **Browser diff preview** — Claude-style review UI before applying writes/edits\r\n- **Slash commands** — `/grep`, `/read`, `/edit`, `/projects`, and more\r\n- **Conversation memory** — follow-up questions in chat\r\n\r\n## Architecture\r\n\r\n```\r\nProject Files → File Loader → Chunker → Ollama Embeddings → LanceDB\r\n                                                              ↓\r\nUser Question → Vector Search → Relevant Chunks → Prompt + Context\r\n                                                              ↓\r\n                              Local LLM → Tools → Diff Review → Apply\r\n```\r\n\r\n```mermaid\r\nflowchart LR\r\n    A[Project Files] --> B[File Loader]\r\n    B --> C[Chunker]\r\n    C --> D[Ollama Embeddings]\r\n    D --> E[(LanceDB)]\r\n\r\n    F[User Question] --> G[Vector Search]\r\n    E --> G\r\n    G --> H[Prompt + Context]\r\n    H --> I[Qwen2.5-Coder]\r\n    I --> J[Code Tools]\r\n    J --> K[Diff Preview]\r\n    K --> L[File Update]\r\n```\r\n\r\n## Prerequisites\r\n\r\n- [Node.js](https://nodejs.org/) 18+\r\n- [Ollama](https://ollama.com/) running locally\r\n\r\nPull the required models:\r\n\r\n```bash\r\nollama pull qwen2.5-coder:14b\r\nollama pull nomic-embed-text\r\n```\r\n\r\n## Installation\r\n\r\n### From source\r\n\r\n```bash\r\ngit clone https://github.com/siddharth17vaishnav/code.git\r\ncd code\r\nnpm install\r\nnpm run build\r\n```\r\n\r\n### As a global CLI\r\n\r\n```bash\r\nnpm install -g @code.siddharth/code\r\n```\r\n\r\nThen run **`code`** anywhere (the command name, not the scoped package name):\r\n\r\n```bash\r\ncode index ./my-app\r\ncode chat ./my-app\r\ncode query ./my-app \"How does routing work?\"\r\ncode --help\r\n```\r\n\r\n> **Note:** If you have VS Code installed, its `code` command may conflict. Use `npx @code.siddharth/code` or rename the VS Code alias instead.\r\n\r\n### Build the package\r\n\r\n```bash\r\nnpm run build          # compile to dist/\r\nnpm pack               # create package tarball\r\n```\r\n\r\nCopy `.env.example` to `.env` and edit as needed:\r\n\r\n```bash\r\ncp .env.example .env\r\n```\r\n\r\n```env\r\n# Optional — defaults to current directory if omitted\r\nPROJECT_PATH=D:\\path\\to\\your\\project\r\nOLLAMA_BASE_URL=http://localhost:11434\r\nLLM_MODEL=qwen2.5-coder:14b\r\nEMBED_MODEL=nomic-embed-text\r\n```\r\n\r\n`PROJECT_PATH` is optional. If you omit it, pass the project on the CLI or run commands from inside the repo.\r\n\r\n## Quick Start\r\n\r\n```bash\r\n# 1. Index a project\r\nnpm run index -- D:\\path\\to\\your\\project\r\n\r\n# 2. Chat with the agent (from inside the repo, path is optional)\r\ncd D:\\path\\to\\your\\project\r\nnpm run chat\r\n\r\n# 3. Plan mode — explore read-only, then /execute\r\nnpm run chat:plan -- D:\\path\\to\\your\\project\r\n\r\n# 4. Resume a saved plan\r\nnpm run chat:plan:resume -- D:\\path\\to\\your\\project\r\n\r\n# 5. One-shot question (no agent loop)\r\nnpm run query -- D:\\path\\to\\your\\project \"How does routing work?\"\r\n```\r\n\r\n## Project Path\r\n\r\nThe target codebase can be passed as a CLI argument, via `--project`, set in `.env`, or omitted to use the **current working directory**:\r\n\r\n```bash\r\nnpm run chat                              # uses cwd\r\nnpm run chat -- D:\\Projects\\MyApp\r\nnpm run chat -- --project ../my-app\r\nnpm run index -- -p ./portfolio\r\n```\r\n\r\nWith npm, put a `--` before script arguments so npm does not swallow flags like `--project` or `--resume`:\r\n\r\n```bash\r\nnpm run chat:plan -- --resume ./my-app\r\nnpm run index -- --project ./my-app\r\n```\r\n\r\n## Scripts\r\n\r\nDevelopment (TypeScript directly via tsx):\r\n\r\n| Command | Description |\r\n|---------|-------------|\r\n| `npm run build` | Compile TypeScript to `dist/` |\r\n| `npm run test` | Run unit tests |\r\n| `npm run index` | Incremental index sync |\r\n| `npm run index:full` | Full rebuild of the index |\r\n| `npm run chat` | Interactive agent chat (default) |\r\n| `npm run chat:simple` | Single-shot RAG mode |\r\n| `npm run chat:plan` | Plan mode — read-only exploration, then `/execute` |\r\n| `npm run chat:plan:resume` | Plan mode + pick a saved plan on startup |\r\n| `npm run chat:watch` | Chat + auto re-index on file changes |\r\n| `npm run query` | One-shot question from the terminal |\r\n| `npm run watch` | Watch files and re-index on changes |\r\n| `npm run dev` | List loaded project files (smoke test) |\r\n\r\nProduction (compiled CLI):\r\n\r\n```bash\r\ncode chat ./my-app\r\ncode chat --plan --resume ./my-app\r\ncode index ./my-app --full\r\n```\r\n\r\n### Flags\r\n\r\n| Flag | Description |\r\n|------|-------------|\r\n| `--project <path>` / `-p` | Target codebase path (default: current directory) |\r\n| `--plan` | Start in plan mode (read-only exploration) |\r\n| `--resume` | Pick a saved plan on startup (plan mode) |\r\n| `--simple` | RAG mode instead of agent |\r\n| `--watch` | Auto-sync index on file changes |\r\n| `--no-ui` | Terminal-only diff preview (skip browser) |\r\n| `--full` | Force full index rebuild |\r\n\r\n## Plan Mode\r\n\r\nPlan mode works like Cursor or Claude Code planning: explore the codebase read-only, discuss approaches, produce a plan, then implement it.\r\n\r\n**Phases**\r\n\r\n1. **Discovery** — inspect files with read-only tools, present approaches and questions\r\n2. **Finalize** — produce a structured plan with steps and proposed changes\r\n3. **Execute** — run `/execute` to switch to agent mode and implement the plan\r\n\r\n**Workflow**\r\n\r\n```bash\r\nnpm run chat:plan -- ./my-app\r\n# Describe what you want → answer questions → /finalize if needed → /execute\r\n```\r\n\r\nFollow-up prompts **update the current plan** — they do not restart discovery. Plans auto-save after each turn.\r\n\r\n**Saved plans**\r\n\r\nPlans are stored per project under:\r\n\r\n```\r\nstorage/projects/<hash>/plans/<plan-id>/\r\n  session.json    # conversation + plan state\r\n  plan.md         # exported markdown\r\n```\r\n\r\nUse `/plans` to list saved plans, `/resume` to pick one and continue, or start with `--resume`:\r\n\r\n```bash\r\nnpm run chat:plan:resume -- ./my-app\r\ncode chat --plan --resume ./my-app\r\n```\r\n\r\nExport a plan to a file with `/save [path]` (default: `./plan.md`).\r\n\r\nIf a model response fails to update the plan (e.g. a generic refusal), the previous saved plan is kept and recovered on resume from `plan.md` or chat history.\r\n\r\n## Chat Commands\r\n\r\nInside `npm run chat`:\r\n\r\n| Command | Description |\r\n|---------|-------------|\r\n| `/help` | Show available commands |\r\n| `/clear` | Clear conversation memory |\r\n| `/read <path>` | Read a file with line numbers |\r\n| `/write <path>` | Write a file (multiline, end with `---`) |\r\n| `/edit <path> <start> <end>` | Replace a line range |\r\n| `/grep <pattern>` | Regex search across the codebase |\r\n| `/find <symbol>` | Find definitions (function, class, type) |\r\n| `/refs <symbol>` | Find all references via AST |\r\n| `/imports <path>` | List imports in a file |\r\n| `/importers <path>` | Find files that import a module |\r\n| `/git` | Git status and diff summary |\r\n| `/projects` | List all indexed projects |\r\n| `/reindex` | Run incremental index sync |\r\n| `/plan` | Switch to plan mode (starts a new plan) |\r\n| `/agent` | Switch to agent mode (can edit files) |\r\n| `/finalize` | Produce final plan from current discussion |\r\n| `/save [path]` | Export plan to markdown (default: `./plan.md`) |\r\n| `/plans` | List saved plans for this project |\r\n| `/resume` | Pick a saved plan and continue |\r\n| `/execute` | Implement the last plan (after it is ready) |\r\n| `exit` / `quit` | Exit chat |\r\n\r\n## Agent Tools\r\n\r\nIn agent mode, the LLM can call these tools automatically:\r\n\r\n| Tool | Description |\r\n|------|-------------|\r\n| `search_codebase` | Semantic search over the index |\r\n| `read_file` | Read a project file |\r\n| `grep` | Regex search |\r\n| `find_symbol` | Find symbol definitions |\r\n| `find_references` | AST reference search |\r\n| `list_imports` | Imports in a file |\r\n| `find_importers` | Files importing a module |\r\n| `git_status` | Git status and recent diff |\r\n| `edit_file` | Replace a line range |\r\n| `write_file` | Write or overwrite a file |\r\n\r\nMutating tools (`edit_file`, `write_file`) open a **browser diff preview** for approval before applying. In plan mode, only read-only tools are available until you run `/execute`.\r\n\r\nPreview server runs at `http://127.0.0.1:3847`. Use `--no-ui` to fall back to terminal `y/N`.\r\n\r\n## Index Storage\r\n\r\nEach project gets its own isolated index:\r\n\r\n```\r\nstorage/\r\n  projects.json\r\n  projects/\r\n    <hash>/\r\n      manifest.json    # file mtimes for incremental sync\r\n      lancedb/         # vector embeddings\r\n      plans/           # saved plan sessions (plan mode)\r\n        index.json\r\n        <plan-id>/\r\n          session.json\r\n          plan.md\r\n```\r\n\r\nSwitch between indexed projects instantly — no full rebuild unless files changed.\r\n\r\n```\r\nnpm run index -- D:\\Projects\\App-A\r\nnpm run index -- D:\\Projects\\App-B\r\nnpm run chat -- D:\\Projects\\App-A   # uses App-A index\r\nnpm run chat -- D:\\Projects\\App-B   # uses App-B index\r\n```\r\n\r\n## Project Structure\r\n\r\n```\r\nsrc/\r\n├── cli/           # Entry points (chat, index, query, watch)\r\n├── core/          # Config, types, CLI args, project storage\r\n├── indexing/      # Loader, chunker, embedder, LanceDB, sync\r\n├── retrieval/     # Vector search + context assembly\r\n├── llm/           # Ollama client and prompt builder\r\n├── agent/         # Agent loop, plan mode, plan storage, session memory\r\n├── tools/         # Read, write, grep, git, AST tools\r\n└── preview/       # Browser diff review UI\r\n```\r\n\r\n## Tech Stack\r\n\r\n| Layer | Technology |\r\n|-------|------------|\r\n| Runtime | TypeScript, Node.js |\r\n| LLM | Ollama (Qwen2.5-Coder) |\r\n| Embeddings | Ollama (nomic-embed-text) |\r\n| Vector DB | LanceDB |\r\n| AST analysis | ts-morph |\r\n| File scanning | fast-glob |\r\n\r\n## License\r\n\r\nISC\r\n","readmeFilename":"README.md"}