{"_id":"@durgaravi04/smart-git-assistant","name":"@durgaravi04/smart-git-assistant","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@durgaravi04/smart-git-assistant","version":"1.0.0","description":"AI-powered CLI that automates staging, commit messages, branches, pushes, and PR creation.","main":"bin/sga.js","bin":{"sga":"bin/sga.js"},"type":"commonjs","scripts":{"start":"node bin/sga.js"},"dependencies":{"@octokit/rest":"^20.1.1","chalk":"^4.1.2","commander":"^12.1.0","conf":"^10.2.0","inquirer":"^8.2.6","node-fetch":"^2.7.0","ora":"^5.4.1","simple-git":"^3.25.0"},"engines":{"node":">=18"},"gitHead":"477967ab2415f6bfd39e5544e8bda1dd9521a162","_id":"@durgaravi04/smart-git-assistant@1.0.0","_nodeVersion":"26.3.1","_npmVersion":"11.16.0","dist":{"integrity":"sha512-h4Hqasy0becBTwtUVyKMwYAmNxOrZ27jUqbJq4U0lbv2jcN4JxgA0IYlkOZhSKLHtnC6k5EFHnfAuV0ydezz/w==","shasum":"d1d1dc60b7edce7645d34bcb8ba26b01aa0816d3","tarball":"https://registry.npmjs.org/@durgaravi04/smart-git-assistant/-/smart-git-assistant-1.0.0.tgz","fileCount":7,"unpackedSize":20092,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIClHwOSeGwmjh7S+2kx9TU4nCVRQQ94R8tLguUhbyIi6AiEAtggLZ6Zoa4ke1wt2E8IZEupvS1zU78BIjMkL3VJnbxE="}]},"_npmUser":{"name":"durgaravi04","email":"durgaravi28052004@gmail.com"},"directories":{},"maintainers":[{"name":"durgaravi04","email":"durgaravi28052004@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/smart-git-assistant_1.0.0_1785825246340_0.067752366576465"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-04T06:34:06.156Z","1.0.0":"2026-08-04T06:34:06.478Z","modified":"2026-08-04T06:34:06.689Z"},"maintainers":[{"name":"durgaravi04","email":"durgaravi28052004@gmail.com"}],"description":"AI-powered CLI that automates staging, commit messages, branches, pushes, and PR creation.","readme":"# Smart Git Assistant (sga)\n\nAn AI-powered CLI that automates the repetitive parts of Git: staging,\nwriting commit messages, creating branches, pushing, and opening pull\nrequests — with Claude generating the commit/PR text from your actual diff.\n\n## Architecture\n\n```\nDeveloper / Terminal\n        |\n        v\n   sga CLI (bin/sga.js)\n   ├── src/gitOps.js   → local git operations (simple-git)\n   ├── src/aiCommit.js → Claude API calls for commit/PR text\n   └── src/github.js   → GitHub REST API (Octokit) for repos & PRs\n        |                       |\n        v                       v\n   Local .git                GitHub\n```\n\n## Setup\n\n```bash\ncd smart-git-assistant\nnpm install\nnpm link          # makes the `sga` command available globally\n```\n\nConfigure your credentials once:\n\n```bash\nsga auth <your_github_personal_access_token>\nsga ai-key <your_anthropic_api_key>\n```\n\n- GitHub PAT: create one at https://github.com/settings/tokens with `repo` scope.\n- Anthropic API key: from https://console.anthropic.com — optional; without\n  it, commit messages fall back to a simple heuristic instead of AI.\n\nBoth can also be set via environment variables instead of storing on disk:\n\n```bash\nexport GITHUB_TOKEN=ghp_xxx\nexport ANTHROPIC_API_KEY=sk-ant-xxx\n```\n\n## Usage\n\n```bash\nsga status              # see what's changed\nsga commit               # stage everything, get an AI commit message, confirm, commit\nsga commit -y            # accept the AI message without a confirmation prompt\nsga branch feature/login # create + switch to a new branch\nsga push                 # push current branch (offers to auto-create a GitHub repo if none exists)\nsga pr                   # draft and open a PR from the current branch\n```\n\n### Example commit flow\n\n```\n$ sga commit\n✔ Commit message generated.\n\nProposed commit message:\nfeat(auth): add OAuth2 GitHub login\n\n- Add passport-github2 strategy\n- Wire up callback route and session serialization\n\n? What would you like to do? Accept and commit\n✔ Commit created.\n```\n\n## Notes on security\n\n- Tokens are stored via `conf`, which writes a JSON file under your OS\n  config directory. For anything beyond personal/local use, swap this for\n  an OS keychain library such as `keytar` so secrets aren't stored as\n  plaintext on disk.\n- The AI calls send only the **staged diff** (truncated to ~12k characters)\n  to the Anthropic API — no full repository contents are transmitted.\n\n## Extending it\n\n- **VS Code extension**: reuse `src/gitOps.js`, `src/aiCommit.js`, and\n  `src/github.js` as-is; swap the `commander`/`inquirer` CLI layer for\n  VS Code's extension API (status bar item + command palette entries).\n- **OAuth App login**: replace the `sga auth <token>` flow with a GitHub\n  App / OAuth device flow so users click \"Sign in with GitHub\" instead of\n  pasting a PAT.\n- **Diff chunking**: for large diffs, split `git diff --staged` output by\n  file and let the user select which logical group to commit first.\n","readmeFilename":"README.md","_rev":"1-fa8168c5b1d6c1c2830b2069c43f480b"}