@hpreet/gitpilot 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
  ## 🚀 Features
8
8
 
9
9
  * Generate commit messages with AI (OpenAI by default)
10
+ * Supports hosted providers: **OpenAI**, **Claude**, and **Gemini**
10
11
  * Supports **local LLMs** (Ollama, LLaMA, etc.)
11
12
  * Interactive mode: approve or edit AI-generated messages
12
13
  * Optional **Git wrapper mode** (`git commit -ai`)
@@ -20,7 +21,7 @@
20
21
  ### 1. Install GitPilot globally
21
22
 
22
23
  ```bash
23
- npm install -g @hpreet/git-pilot
24
+ npm install -g @hpreet/gitpilot
24
25
  ```
25
26
 
26
27
  ### 2. Setup your AI provider
@@ -31,7 +32,7 @@ gitpilot setup
31
32
 
32
33
  * Follow the prompts:
33
34
 
34
- * Choose provider (OpenAI or local LLM)
35
+ * Choose provider (OpenAI, Claude, Gemini, or local LLM)
35
36
  * Enter your API key if needed
36
37
  * This creates your `~/.gitpilotrc` with defaults
37
38
 
@@ -96,7 +97,9 @@ export GITPILOT_API_KEY="YOUR_API_KEY"
96
97
  ## 🧉 Supported Providers
97
98
 
98
99
  * **OpenAI** (default)
99
- * **Local LLMs** (stub included; future support for Claude, GPT-4 local models)
100
+ * **Claude**
101
+ * **Gemini**
102
+ * **Local LLMs** (stub included)
100
103
 
101
104
  ---
102
105
 
package/bin/gitpilot.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
+ import { readFileSync } from "node:fs";
3
4
  import { commitCommand } from "../src/commands/commit.js";
4
5
  import { setupCommand } from "../src/commands/setup.js";
5
6
  import { enableWrapper } from "../src/commands/enable-wrapper.js";
@@ -9,7 +10,7 @@ const program = new Command();
9
10
  program
10
11
  .name("gitpilot")
11
12
  .description("Your AI copilot for git commits")
12
- .version("0.1.0");
13
+ .version(JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version);
13
14
 
14
15
  program
15
16
  .command("commit")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpreet/gitpilot",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "AI-powered Git commit assistant — generates commit messages intelligently and fits seamlessly into your workflow.",
5
5
  "main": "bin/gitpilot.js",
6
6
  "type": "module",
@@ -22,6 +22,7 @@
22
22
  "author": "Harpreet Singh <thesinghharpreet@gmail.com>",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
+ "@anthropic-ai/sdk": "^0.90.0",
25
26
  "@google/generative-ai": "^0.24.1",
26
27
  "commander": "^14.0.2",
27
28
  "inquirer": "^12.11.1",
@@ -7,13 +7,16 @@ export async function setupCommand() {
7
7
  type: "list",
8
8
  name: "provider",
9
9
  message: "Choose your AI provider:",
10
- choices: ["openai", "local", "gemini"]
10
+ choices: ["openai", "claude", "gemini", "local"]
11
11
  },
12
12
  {
13
13
  type: "input",
14
14
  name: "apiKey",
15
- message: "Enter your OpenAI/Gemini API key (leave blank for local models):",
16
- when: (answers) => answers.provider === "openai" || answers.provider === "gemini"
15
+ message: "Enter your OpenAI/Claude/Gemini API key (leave blank for local models):",
16
+ when: (answers) =>
17
+ answers.provider === "openai" ||
18
+ answers.provider === "claude" ||
19
+ answers.provider === "gemini"
17
20
  },
18
21
  {
19
22
  type: "list",
@@ -0,0 +1,21 @@
1
+ import Anthropic from "@anthropic-ai/sdk";
2
+
3
+ export class ClaudeProvider {
4
+ constructor(config) {
5
+ this.client = new Anthropic({ apiKey: config.apiKey });
6
+ }
7
+
8
+ async generateCommitMessage(prompt) {
9
+ const message = await this.client.messages.create({
10
+ model: "claude-opus-4-1",
11
+ max_tokens: 256,
12
+ messages: [{ role: "user", content: prompt }]
13
+ });
14
+
15
+ return message.content
16
+ .filter((item) => item.type === "text")
17
+ .map((item) => item.text)
18
+ .join("\n")
19
+ .trim();
20
+ }
21
+ }
@@ -1,11 +1,14 @@
1
1
  import { OpenAIProvider } from "./openaiProvider.js";
2
2
  import { LocalProvider } from "./localProvider.js";
3
3
  import { GeminiProvider } from "./geminiProvider.js";
4
+ import { ClaudeProvider } from "./claudeProvider.js";
4
5
 
5
6
  export function getProvider(name, config) {
6
7
  switch (name) {
7
8
  case "openai":
8
9
  return new OpenAIProvider(config);
10
+ case "claude":
11
+ return new ClaudeProvider(config);
9
12
  case "gemini":
10
13
  return new GeminiProvider(config);
11
14
  case "local":
package/.editorconfig DELETED
@@ -1,22 +0,0 @@
1
- # top-most EditorConfig file
2
- root = true
3
-
4
- [*]
5
- # Use spaces instead of tabs
6
- indent_style = space
7
- # 2 spaces per indent
8
- indent_size = 2
9
- # Trim trailing whitespace on save
10
- trim_trailing_whitespace = true
11
- # Insert final newline at end of file
12
- insert_final_newline = true
13
- # File encoding
14
- charset = utf-8
15
-
16
- [*.md]
17
- # Markdown files usually need trailing whitespace (for line breaks)
18
- trim_trailing_whitespace = false
19
-
20
- [*.json]
21
- # JSON files usually 2-space indentation
22
- indent_size = 2