git-repo-comitter 0.4.3 → 0.4.4

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/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("fs"),l=require("path"),u=require("os"),d=require("child_process"),f=require("openai");f=s(f,1);let p=require("readline/promises");var m=(0,l.resolve)((0,u.homedir)(),`.grc`,`config.json`),h={llm:{model:`deepseek-v4-flash`,temperature:.7,max_input_tokens:262144,max_output_tokens:16384},apiKey:``,endpoint:`https://api.openai.com/v1`};function g(){try{if(!(0,c.existsSync)(m))return{};let e=(0,c.readFileSync)(m,`utf-8`),t=JSON.parse(e);return{...t,llm:t.llm?{...t.llm}:void 0}}catch{return{}}}function _(e){let t=(0,l.resolve)((0,u.homedir)(),`.grc`);(0,c.existsSync)(t)||(0,c.mkdirSync)(t,{recursive:!0}),(0,c.writeFileSync)(m,JSON.stringify(e,null,2),`utf-8`)}function v(){let e=g(),t=process.env.LLM_MODEL,n=process.env.LLM_API_KEY,r=process.env.LLM_ENDPOINT;return{...h,...e,llm:{...h.llm,...e.llm||{},...t?{model:t}:{}},apiKey:n||e.apiKey||``,endpoint:r||e.endpoint||h.endpoint}}function y(){try{return(0,d.execSync)(`git diff --cached`,{cwd:process.cwd(),encoding:`utf-8`})}catch{return``}}function b(){try{return(0,d.execSync)(`git diff`,{cwd:process.cwd(),encoding:`utf-8`})}catch{return``}}function x(){let e=y(),t=b(),n=[];return e.trim()&&n.push(`=== Staged Changes ===
2
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("commander"),l=require("fs"),u=require("path"),d=require("os"),f=require("child_process"),p=require("openai");p=s(p,1);let m=require("readline/promises");var h=`0.4.4`,g={llm:{model:`deepseek-v4-flash`,temperature:.7,maxInputTokens:262144,maxOutputTokens:16384},apiKey:``,endpoint:`https://api.openai.com/v1`},_=(0,u.resolve)((0,d.homedir)(),`.grc`,`config.json`);function v(){try{if(!(0,l.existsSync)(_))return{};let e=(0,l.readFileSync)(_,`utf-8`),t=JSON.parse(e);return{...t,llm:t.llm?{...t.llm}:void 0}}catch{return{}}}function y(e){let t=(0,u.resolve)((0,d.homedir)(),`.grc`);(0,l.existsSync)(t)||(0,l.mkdirSync)(t,{recursive:!0}),(0,l.writeFileSync)(_,JSON.stringify(e,null,2),`utf-8`)}function b(){let e=v(),t=process.env.LLM_MODEL,n=process.env.LLM_API_KEY,r=process.env.LLM_ENDPOINT;return{...g,...e,llm:{...g.llm,...e.llm||{},...t?{model:t}:{}},apiKey:n||e.apiKey||``,endpoint:r||e.endpoint||g.endpoint}}function x(){try{return(0,f.execSync)(`git diff --cached`,{cwd:process.cwd(),encoding:`utf-8`})}catch{return``}}function S(){try{return(0,f.execSync)(`git diff`,{cwd:process.cwd(),encoding:`utf-8`})}catch{return``}}function C(){let e=x(),t=S(),n=[];return e.trim()&&n.push(`=== Staged Changes ===
3
3
  `+e),t.trim()&&n.push(`=== Unstaged Changes ===
4
4
  `+t),n.join(`
5
5
 
6
- `)}function S(){try{return(0,d.execSync)(`git diff --cached --name-only`,{cwd:process.cwd(),encoding:`utf-8`}).trim().length>0}catch{return!1}}function C(e){let t=(typeof e==`string`?JSON.parse(e):e).choices?.[0]?.message?.content;return typeof t==`string`?t.trim():Array.isArray(t)?t.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim():``}function w(e){let t=(0,p.createInterface)({input:process.stdin,output:process.stdout});return t.question(e).finally(()=>t.close())}var T=`你是一位擅长编写 Git 提交信息的专家。根据提供的 Git diff,生成简洁且描述准确的提交信息。
6
+ `)}function w(){try{return(0,f.execSync)(`git diff --cached --name-only`,{cwd:process.cwd(),encoding:`utf-8`}).trim().length>0}catch{return!1}}function T(e){(0,f.execSync)(`git commit -m "${e.replace(/"/g,`\\"`)}"`,{cwd:process.cwd(),encoding:`utf-8`})}function E(){(0,f.execSync)(`git add -A`,{cwd:process.cwd(),encoding:`utf-8`})}function D(e){let t=(typeof e==`string`?JSON.parse(e):e).choices?.[0]?.message?.content;return typeof t==`string`?t.trim():Array.isArray(t)?t.filter(e=>e.type===`text`).map(e=>e.text).join(``).trim():``}function O(e){let t=(0,m.createInterface)({input:process.stdin,output:process.stdout});return t.question(e).finally(()=>t.close())}var k=`你是一位擅长编写 Git 提交信息的专家。根据提供的 Git diff,生成简洁且描述准确的提交信息。
7
7
 
8
8
  格式规范:
9
9
  - 遵循 Conventional Commits:<type>(<scope>): <description>
@@ -33,9 +33,9 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
33
33
  - 迁移 session 和 permission 模块至新接口
34
34
  - 移除已废弃的 getCacheKey 方法
35
35
 
36
- 只回复提交信息本身,不要添加任何解释。`;async function E(e,t){if(!t.apiKey)throw Error(`LLM_API_KEY is not set. Please set it in .env or environment variables.`);let n=await new f.default({apiKey:t.apiKey,baseURL:t.endpoint}).chat.completions.create({model:t.llm.model,temperature:t.llm.temperature,max_tokens:t.llm.max_output_tokens,messages:[{role:`system`,content:T},{role:`user`,content:`以下是 Git diff 内容:\n\n${e}`}]}),r=C(n);if(!r)throw Error(`LLM returned an empty commit message. Response: ${JSON.stringify(n)}`);return r}function D(e){(0,d.execSync)(`git commit -m "${e.replace(/"/g,`\\"`)}"`,{cwd:process.cwd(),encoding:`utf-8`})}function O(){(0,d.execSync)(`git add -A`,{cwd:process.cwd(),encoding:`utf-8`})}async function k(){console.log(`LLM 配置初始化
37
- `);let e=g(),t=(await w(`大模型链接 (API 地址) [${e.endpoint||`https://api.openai.com/v1`}]: `)).trim()||e.endpoint||`https://api.openai.com/v1`,n=(await w(`模型名称 [${e.llm?.model||`deepseek-v4-flash`}]: `)).trim()||e.llm?.model||`deepseek-v4-flash`,r=(await w(`API Key [${e.apiKey?`***`:`(必填)`}]: `)).trim()||e.apiKey;r||(console.error(`
38
- 错误:API Key 不能为空。`),process.exit(1)),_({apiKey:r,endpoint:t,llm:{model:n,temperature:.7,max_input_tokens:262144,max_output_tokens:16384}}),console.log(`
39
- 配置已保存到 ~/.grc/config.json`)}async function A(){let e=v();e.apiKey||(console.error("Error: LLM_API_KEY is not set. Please run `grc init` to configure."),process.exit(1)),S()||(console.log(`No staged changes found. Staging all changes...`),O());let t=x();t.trim()||(console.log(`No changes to commit.`),process.exit(0)),console.log(`Generating commit message...
40
- `);let n=await E(t,e);console.log(`Commit message:\n ${n}\n`),D(n),console.log(`Commit successful!`)}async function j(){process.argv[2]===`init`?await k():await A()}j().catch(e=>{console.error(`Error:`,e.message),process.exit(1)});
36
+ 只回复提交信息本身,不要添加任何解释。`;async function A(e,t){if(!t.apiKey)throw Error(`LLM_API_KEY is not set. Please set it in .env or environment variables.`);let n=await new p.default({apiKey:t.apiKey,baseURL:t.endpoint}).chat.completions.create({model:t.llm.model,temperature:t.llm.temperature,max_tokens:t.llm.maxOutputTokens,messages:[{role:`system`,content:k},{role:`user`,content:`以下是 Git diff 内容:\n\n${e}`}]}),r=D(n);if(!r)throw Error(`LLM returned an empty commit message. Response: ${JSON.stringify(n)}`);return r}async function j(){let e=b();e.apiKey||(console.error("Error: LLM_API_KEY is not set. Please run `grc init` to configure."),process.exit(1)),w()||(console.log(`No staged changes found. Staging all changes...`),E());let t=C();t.trim()||(console.log(`No changes to commit.`),process.exit(0)),console.log(`Generating commit message...
37
+ `);let n=await A(t,e);console.log(`Commit message:\n ${n}\n`),T(n),console.log(`Commit successful!`)}async function M(){console.log(`LLM 配置初始化
38
+ `);let e=v(),t=(await O(`大模型链接 (API 地址) [${e.endpoint||`https://api.openai.com/v1`}]: `)).trim()||e.endpoint||`https://api.openai.com/v1`,n=(await O(`模型名称 [${e.llm?.model||`deepseek-v4-flash`}]: `)).trim()||e.llm?.model||`deepseek-v4-flash`,r=(await O(`API Key [${e.apiKey?`***`:`(必填)`}]: `)).trim()||e.apiKey;r||(console.error(`
39
+ 错误:API Key 不能为空。`),process.exit(1)),y({apiKey:r,endpoint:t,llm:{model:n,temperature:.7,maxInputTokens:262144,maxOutputTokens:16384}}),console.log(`
40
+ 配置已保存到 ~/.grc/config.json`)}var N=new c.Command;N.name(`grc`).description(`A CLI tool that uses LLM to generate Git commit messages and execute commits`).version(h,`-v, --version`,`Display the current version`),N.command(`init`).description(`Interactive LLM configuration initialization`).action(()=>{M().catch(e=>{console.error(`Error:`,e.message),process.exit(1)})});function P(){if(process.argv.slice(2).length===0){j().catch(e=>{console.error(`Error:`,e.message),process.exit(1)});return}N.parse(process.argv)}P();
41
41
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/config.ts","../src/git.ts","../src/util.ts","../src/llm.ts","../src/commit.ts","../src/init.ts","../src/index.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync, mkdirSync } from \"fs\";\nimport { resolve } from \"path\";\nimport { homedir } from \"os\";\n\nconst USER_CONFIG_PATH = resolve(homedir(), \".grc\", \"config.json\");\n\nexport interface LLMConfig {\n model: string;\n temperature: number;\n max_input_tokens: number;\n max_output_tokens: number;\n}\n\nexport interface AppConfig {\n llm: LLMConfig;\n apiKey: string;\n endpoint: string;\n}\n\nconst DEFAULT_CONFIG: AppConfig = {\n llm: {\n model: \"deepseek-v4-flash\",\n temperature: 0.7,\n max_input_tokens: 262144,\n max_output_tokens: 16384,\n },\n apiKey: \"\",\n endpoint: \"https://api.openai.com/v1\",\n};\n\nexport function loadUserConfig(): Partial<AppConfig> {\n try {\n if (!existsSync(USER_CONFIG_PATH)) return {};\n const raw = readFileSync(USER_CONFIG_PATH, \"utf-8\");\n const parsed = JSON.parse(raw);\n return {\n ...parsed,\n llm: parsed.llm ? { ...parsed.llm } : undefined,\n };\n } catch {\n return {};\n }\n}\n\nexport function saveUserConfig(config: Partial<AppConfig>): void {\n const dir = resolve(homedir(), \".grc\");\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n writeFileSync(USER_CONFIG_PATH, JSON.stringify(config, null, 2), \"utf-8\");\n}\n\nexport function loadConfig(): AppConfig {\n const userConfig = loadUserConfig();\n\n const envModel = process.env.LLM_MODEL;\n const envApiKey = process.env.LLM_API_KEY;\n const envEndpoint = process.env.LLM_ENDPOINT;\n\n return {\n ...DEFAULT_CONFIG,\n ...userConfig,\n llm: {\n ...DEFAULT_CONFIG.llm,\n ...(userConfig.llm || {}),\n ...(envModel ? { model: envModel } : {}),\n },\n apiKey: envApiKey || userConfig.apiKey || \"\",\n endpoint: envEndpoint || userConfig.endpoint || DEFAULT_CONFIG.endpoint,\n };\n}","import { execSync } from \"child_process\";\n\nfunction getStagedDiff(): string {\n try {\n return execSync(\"git diff --cached\", { cwd: process.cwd(), encoding: \"utf-8\" });\n } catch {\n return \"\";\n }\n}\n\nfunction getUnstagedDiff(): string {\n try {\n return execSync(\"git diff\", { cwd: process.cwd(), encoding: \"utf-8\" });\n } catch {\n return \"\";\n }\n}\n\nexport function getAllDiff(): string {\n const staged = getStagedDiff();\n const unstaged = getUnstagedDiff();\n\n const parts: string[] = [];\n if (staged.trim()) {\n parts.push(\"=== Staged Changes ===\\n\" + staged);\n }\n if (unstaged.trim()) {\n parts.push(\"=== Unstaged Changes ===\\n\" + unstaged);\n }\n return parts.join(\"\\n\\n\");\n}\n\nexport function hasStagedChanges(): boolean {\n try {\n const result = execSync(\"git diff --cached --name-only\", {\n cwd: process.cwd(),\n encoding: \"utf-8\",\n });\n return result.trim().length > 0;\n } catch {\n return false;\n }\n}","import { createInterface } from \"readline/promises\";\n\nexport interface MessageContentPart {\n type: string;\n text: string;\n}\n\nexport interface ChatCompletionMessage {\n content: string | MessageContentPart[] | null;\n}\n\nexport interface ChatCompletionChoice {\n message: ChatCompletionMessage;\n}\n\nexport interface ChatCompletionResponse {\n choices: ChatCompletionChoice[];\n}\n\nexport function extractContent(response: ChatCompletionResponse | string): string {\n const data = typeof response === \"string\" ? JSON.parse(response) : response;\n const content = data.choices?.[0]?.message?.content;\n if (typeof content === \"string\") return content.trim();\n if (Array.isArray(content)) {\n return content\n .filter((c) => c.type === \"text\")\n .map((c) => c.text)\n .join(\"\")\n .trim();\n }\n return \"\";\n}\n\nexport function question(query: string): Promise<string> {\n const rl = createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n return rl.question(query).finally(() => rl.close());\n}","import OpenAI from \"openai\";\nimport type { AppConfig } from \"./config\";\nimport { extractContent } from \"./util\";\n\nconst SYSTEM_PROMPT = `你是一位擅长编写 Git 提交信息的专家。根据提供的 Git diff,生成简洁且描述准确的提交信息。\n\n格式规范:\n- 遵循 Conventional Commits:<type>(<scope>): <description>\n- type 可选值:feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert\n- 标题行控制在 72 字符以内\n- 正文使用无序列表分条陈述,每条以 \"- \" 开头\n- 如变更较简单,可省略正文,仅保留标题行\n- 标题和正文之间用空行隔开\n- 提交的信息必须符合 Conventional Commits 格式\n- 描述语言使用中文,避免使用英文。\n\n示例:\n1. 仅标题行:\n fix(auth): 修复登录重定向丢失 query 参数的问题\n\n2. 标题 + 正文:\n feat(api): 新增用户批量导入接口\n\n - 支持 CSV 和 JSON 两种文件格式\n - 单次最多处理 1000 条记录\n - 导入失败时返回逐条错误详情\n\n3. 多处关联变更:\n refactor(storage): 统一缓存键的生成逻辑\n\n - 抽取 keyBuilder 工具函数替代各处硬编码\n - 迁移 session 和 permission 模块至新接口\n - 移除已废弃的 getCacheKey 方法\n\n只回复提交信息本身,不要添加任何解释。`;\n\nexport async function generateCommitMessage(\n diff: string,\n config: AppConfig,\n): Promise<string> {\n if (!config.apiKey) {\n throw new Error(\n \"LLM_API_KEY is not set. Please set it in .env or environment variables.\",\n );\n }\n\n const client = new OpenAI({\n apiKey: config.apiKey,\n baseURL: config.endpoint,\n });\n\n const response = await client.chat.completions.create({\n model: config.llm.model,\n temperature: config.llm.temperature,\n max_tokens: config.llm.max_output_tokens,\n messages: [\n { role: \"system\", content: SYSTEM_PROMPT },\n {\n role: \"user\",\n content: `以下是 Git diff 内容:\\n\\n${diff}`,\n },\n ],\n });\n\n const message = extractContent(response);\n if (!message) {\n throw new Error(\n `LLM returned an empty commit message. Response: ${JSON.stringify(response)}`,\n );\n }\n return message;\n}","import { execSync } from \"child_process\";\n\nexport function gitCommit(message: string): void {\n const escapedMessage = message.replace(/\"/g, '\\\\\"');\n execSync(`git commit -m \"${escapedMessage}\"`, {\n cwd: process.cwd(),\n encoding: \"utf-8\",\n });\n}\n\nexport function gitAddAll(): void {\n execSync(\"git add -A\", { cwd: process.cwd(), encoding: \"utf-8\" });\n}","import { loadUserConfig, saveUserConfig } from \"./config\";\nimport { question } from \"./util\";\n\nexport async function runInit(): Promise<void> {\n console.log(\"LLM 配置初始化\\n\");\n\n const existing = loadUserConfig();\n\n const endpoint =\n (\n await question(\n `大模型链接 (API 地址) [${existing.endpoint || \"https://api.openai.com/v1\"}]: `,\n )\n ).trim() ||\n existing.endpoint ||\n \"https://api.openai.com/v1\";\n\n const model =\n (\n await question(\n `模型名称 [${existing.llm?.model || \"deepseek-v4-flash\"}]: `,\n )\n ).trim() ||\n existing.llm?.model ||\n \"deepseek-v4-flash\";\n\n const apiKey =\n (\n await question(`API Key [${existing.apiKey ? \"***\" : \"(必填)\"}]: `)\n ).trim() || existing.apiKey;\n\n if (!apiKey) {\n console.error(\"\\n错误:API Key 不能为空。\");\n process.exit(1);\n }\n\n saveUserConfig({\n apiKey,\n endpoint,\n llm: { model, temperature: 0.7, max_input_tokens: 262144, max_output_tokens: 16384 },\n });\n console.log(\"\\n配置已保存到 ~/.grc/config.json\");\n}","import { loadConfig } from \"./config\";\nimport { getAllDiff, hasStagedChanges } from \"./git\";\nimport { generateCommitMessage } from \"./llm\";\nimport { gitCommit, gitAddAll } from \"./commit\";\nimport { runInit } from \"./init\";\n\nasync function runCommit() {\n const config = loadConfig();\n\n if (!config.apiKey) {\n console.error(\n \"Error: LLM_API_KEY is not set. Please run `grc init` to configure.\",\n );\n process.exit(1);\n }\n\n if (!hasStagedChanges()) {\n console.log(\"No staged changes found. Staging all changes...\");\n gitAddAll();\n }\n\n const diff = getAllDiff();\n if (!diff.trim()) {\n console.log(\"No changes to commit.\");\n process.exit(0);\n }\n\n console.log(\"Generating commit message...\\n\");\n const message = await generateCommitMessage(diff, config);\n console.log(`Commit message:\\n ${message}\\n`);\n\n gitCommit(message);\n console.log(\"Commit successful!\");\n}\n\nasync function main() {\n const subcommand = process.argv[2];\n\n if (subcommand === \"init\") {\n await runInit();\n } else {\n await runCommit();\n }\n}\n\nmain().catch((err) => {\n console.error(\"Error:\", err.message);\n process.exit(1);\n});"],"mappings":";+mBAIA,IAAM,GAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,CAAmC,EAAG,OAAQ,aAAa,EAe3D,EAA4B,CAChC,IAAK,CACH,MAAO,oBACP,YAAa,GACb,iBAAkB,OAClB,kBAAmB,KACrB,EACA,OAAQ,GACR,SAAU,2BACZ,EAEA,SAAgB,GAAqC,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DAAiD,EAC7D,EAAU,GAGZ,IAAM,EAAO,EAAW,EACnB,EAAK,KAAK,IACb,QAAQ,IAAI,uBAAuB,EACnC,QAAQ,KAAK,CAAC,GAGhB,QAAQ,IAAI;CAAgC,EAC5C,IAAM,EAAU,MAAM,EAAsB,EAAM,CAAM,EACxD,QAAQ,IAAI,sBAAsB,EAAQ,GAAG,EAE7C,EAAU,CAAO,EACjB,QAAQ,IAAI,oBAAoB,CAClC,CAEA,eAAe,GAAO,CACD,QAAQ,KAAK,KAEb,OACjB,MAAM,EAAQ,EAEd,MAAM,EAAU,CAEpB,CAEA,EAAK,CAAC,CAAC,MAAO,GAAQ,CACpB,QAAQ,MAAM,SAAU,EAAI,OAAO,EACnC,QAAQ,KAAK,CAAC,CAChB,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../package.json","../src/config/types.ts","../src/config/loader.ts","../src/git/diff.ts","../src/git/commit.ts","../src/utils.ts","../src/llm/client.ts","../src/commands/commit.ts","../src/commands/init.ts","../src/cli.ts","../src/index.ts"],"sourcesContent":["{\n \"name\": \"git-repo-comitter\",\n \"version\": \"0.4.4\",\n \"description\": \"A CLI tool that uses LLM to generate Git commit messages and execute commits\",\n \"type\": \"module\",\n \"main\": \"dist/index.cjs\",\n \"bin\": {\n \"git-repo-comitter\": \"dist/index.cjs\",\n \"grc\": \"dist/index.cjs\"\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"dev\": \"vite\",\n \"build\": \"tsc && vite build\",\n \"preview\": \"vite preview\",\n \"lint\": \"eslint src/\",\n \"format\": \"prettier --write \\\"src/**/*.ts\\\"\",\n \"prepare\": \"husky\"\n },\n \"keywords\": [\n \"git\",\n \"commit\",\n \"llm\",\n \"ai\",\n \"openai\"\n ],\n \"author\": \"jeanhwea\",\n \"license\": \"unlicense\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Jeanhwea/git-repo-comitter.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/Jeanhwea/git-repo-comitter/issues\"\n },\n \"homepage\": \"https://github.com/Jeanhwea/git-repo-comitter#readme\",\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org\",\n \"access\": \"public\"\n },\n \"lint-staged\": {\n \"*.ts\": [\n \"prettier --write\",\n \"eslint --fix\"\n ]\n },\n \"devDependencies\": {\n \"@eslint/js\": \"^10.0.1\",\n \"@types/node\": \"^26.1.1\",\n \"@typescript-eslint/eslint-plugin\": \"^8.63.0\",\n \"@typescript-eslint/parser\": \"^8.63.0\",\n \"eslint\": \"^10.7.0\",\n \"eslint-config-prettier\": \"^10.1.8\",\n \"globals\": \"^17.7.0\",\n \"husky\": \"^9.1.7\",\n \"lint-staged\": \"^16.4.0\",\n \"prettier\": \"^3.9.5\",\n \"typescript\": \"^6.0.3\",\n \"vite\": \"^8.1.4\"\n },\n \"dependencies\": {\n \"commander\": \"^15.0.0\",\n \"dotenv\": \"^17.4.2\",\n \"openai\": \"^6.46.0\",\n \"yaml\": \"^2.9.0\"\n }\n}\n","export interface LLMConfig {\n model: string;\n temperature: number;\n maxInputTokens: number;\n maxOutputTokens: number;\n}\n\nexport interface AppConfig {\n llm: LLMConfig;\n apiKey: string;\n endpoint: string;\n}\n\nexport const DEFAULT_CONFIG: AppConfig = {\n llm: {\n model: \"deepseek-v4-flash\",\n temperature: 0.7,\n maxInputTokens: 262144,\n maxOutputTokens: 16384,\n },\n apiKey: \"\",\n endpoint: \"https://api.openai.com/v1\",\n};\n","import { readFileSync, writeFileSync, existsSync, mkdirSync } from \"fs\";\nimport { resolve } from \"path\";\nimport { homedir } from \"os\";\nimport { DEFAULT_CONFIG, type AppConfig } from \"./types\";\n\nconst USER_CONFIG_PATH = resolve(homedir(), \".grc\", \"config.json\");\n\nexport function loadUserConfig(): Partial<AppConfig> {\n try {\n if (!existsSync(USER_CONFIG_PATH)) return {};\n const raw = readFileSync(USER_CONFIG_PATH, \"utf-8\");\n const parsed = JSON.parse(raw);\n return {\n ...parsed,\n llm: parsed.llm ? { ...parsed.llm } : undefined,\n };\n } catch {\n return {};\n }\n}\n\nexport function saveUserConfig(config: Partial<AppConfig>): void {\n const dir = resolve(homedir(), \".grc\");\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n writeFileSync(USER_CONFIG_PATH, JSON.stringify(config, null, 2), \"utf-8\");\n}\n\nexport function loadConfig(): AppConfig {\n const userConfig = loadUserConfig();\n\n const envModel = process.env.LLM_MODEL;\n const envApiKey = process.env.LLM_API_KEY;\n const envEndpoint = process.env.LLM_ENDPOINT;\n\n return {\n ...DEFAULT_CONFIG,\n ...userConfig,\n llm: {\n ...DEFAULT_CONFIG.llm,\n ...(userConfig.llm || {}),\n ...(envModel ? { model: envModel } : {}),\n },\n apiKey: envApiKey || userConfig.apiKey || \"\",\n endpoint: envEndpoint || userConfig.endpoint || DEFAULT_CONFIG.endpoint,\n };\n}\n","import { execSync } from \"child_process\";\n\nfunction getStagedDiff(): string {\n try {\n return execSync(\"git diff --cached\", {\n cwd: process.cwd(),\n encoding: \"utf-8\",\n });\n } catch {\n return \"\";\n }\n}\n\nfunction getUnstagedDiff(): string {\n try {\n return execSync(\"git diff\", { cwd: process.cwd(), encoding: \"utf-8\" });\n } catch {\n return \"\";\n }\n}\n\nexport function getAllDiff(): string {\n const staged = getStagedDiff();\n const unstaged = getUnstagedDiff();\n\n const parts: string[] = [];\n if (staged.trim()) {\n parts.push(\"=== Staged Changes ===\\n\" + staged);\n }\n if (unstaged.trim()) {\n parts.push(\"=== Unstaged Changes ===\\n\" + unstaged);\n }\n return parts.join(\"\\n\\n\");\n}\n\nexport function hasStagedChanges(): boolean {\n try {\n const result = execSync(\"git diff --cached --name-only\", {\n cwd: process.cwd(),\n encoding: \"utf-8\",\n });\n return result.trim().length > 0;\n } catch {\n return false;\n }\n}\n","import { execSync } from \"child_process\";\n\nexport function gitCommit(message: string): void {\n const escapedMessage = message.replace(/\"/g, '\\\\\"');\n execSync(`git commit -m \"${escapedMessage}\"`, {\n cwd: process.cwd(),\n encoding: \"utf-8\",\n });\n}\n\nexport function gitAddAll(): void {\n execSync(\"git add -A\", { cwd: process.cwd(), encoding: \"utf-8\" });\n}\n","import { createInterface } from \"readline/promises\";\n\nexport interface MessageContentPart {\n type: string;\n text: string;\n}\n\nexport interface ChatCompletionMessage {\n content: string | MessageContentPart[] | null;\n}\n\nexport interface ChatCompletionChoice {\n message: ChatCompletionMessage;\n}\n\nexport interface ChatCompletionResponse {\n choices: ChatCompletionChoice[];\n}\n\nexport function extractContent(\n response: ChatCompletionResponse | string,\n): string {\n const data = typeof response === \"string\" ? JSON.parse(response) : response;\n const content = data.choices?.[0]?.message?.content;\n if (typeof content === \"string\") return content.trim();\n if (Array.isArray(content)) {\n return content\n .filter((c) => c.type === \"text\")\n .map((c) => c.text)\n .join(\"\")\n .trim();\n }\n return \"\";\n}\n\nexport function question(query: string): Promise<string> {\n const rl = createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n return rl.question(query).finally(() => rl.close());\n}\n","import OpenAI from \"openai\";\nimport type { AppConfig } from \"../config/types\";\nimport { extractContent } from \"../utils\";\n\nconst SYSTEM_PROMPT = `你是一位擅长编写 Git 提交信息的专家。根据提供的 Git diff,生成简洁且描述准确的提交信息。\n\n格式规范:\n- 遵循 Conventional Commits:<type>(<scope>): <description>\n- type 可选值:feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert\n- 标题行控制在 72 字符以内\n- 正文使用无序列表分条陈述,每条以 \"- \" 开头\n- 如变更较简单,可省略正文,仅保留标题行\n- 标题和正文之间用空行隔开\n- 提交的信息必须符合 Conventional Commits 格式\n- 描述语言使用中文,避免使用英文。\n\n示例:\n1. 仅标题行:\n fix(auth): 修复登录重定向丢失 query 参数的问题\n\n2. 标题 + 正文:\n feat(api): 新增用户批量导入接口\n\n - 支持 CSV 和 JSON 两种文件格式\n - 单次最多处理 1000 条记录\n - 导入失败时返回逐条错误详情\n\n3. 多处关联变更:\n refactor(storage): 统一缓存键的生成逻辑\n\n - 抽取 keyBuilder 工具函数替代各处硬编码\n - 迁移 session 和 permission 模块至新接口\n - 移除已废弃的 getCacheKey 方法\n\n只回复提交信息本身,不要添加任何解释。`;\n\nexport async function generateCommitMessage(\n diff: string,\n config: AppConfig,\n): Promise<string> {\n if (!config.apiKey) {\n throw new Error(\n \"LLM_API_KEY is not set. Please set it in .env or environment variables.\",\n );\n }\n\n const client = new OpenAI({\n apiKey: config.apiKey,\n baseURL: config.endpoint,\n });\n\n const response = await client.chat.completions.create({\n model: config.llm.model,\n temperature: config.llm.temperature,\n max_tokens: config.llm.maxOutputTokens,\n messages: [\n { role: \"system\", content: SYSTEM_PROMPT },\n {\n role: \"user\",\n content: `以下是 Git diff 内容:\\n\\n${diff}`,\n },\n ],\n });\n\n const message = extractContent(response);\n if (!message) {\n throw new Error(\n `LLM returned an empty commit message. Response: ${JSON.stringify(response)}`,\n );\n }\n return message;\n}\n","import { loadConfig } from \"../config/loader\";\nimport { getAllDiff, hasStagedChanges } from \"../git/diff\";\nimport { gitCommit, gitAddAll } from \"../git/commit\";\nimport { generateCommitMessage } from \"../llm/client\";\n\nexport async function runCommit(): Promise<void> {\n const config = loadConfig();\n\n if (!config.apiKey) {\n console.error(\n \"Error: LLM_API_KEY is not set. Please run `grc init` to configure.\",\n );\n process.exit(1);\n }\n\n if (!hasStagedChanges()) {\n console.log(\"No staged changes found. Staging all changes...\");\n gitAddAll();\n }\n\n const diff = getAllDiff();\n if (!diff.trim()) {\n console.log(\"No changes to commit.\");\n process.exit(0);\n }\n\n console.log(\"Generating commit message...\\n\");\n const message = await generateCommitMessage(diff, config);\n console.log(`Commit message:\\n ${message}\\n`);\n\n gitCommit(message);\n console.log(\"Commit successful!\");\n}\n","import { loadUserConfig, saveUserConfig } from \"../config/loader\";\nimport { question } from \"../utils\";\n\nexport async function runInit(): Promise<void> {\n console.log(\"LLM 配置初始化\\n\");\n\n const existing = loadUserConfig();\n\n const endpoint =\n (\n await question(\n `大模型链接 (API 地址) [${existing.endpoint || \"https://api.openai.com/v1\"}]: `,\n )\n ).trim() ||\n existing.endpoint ||\n \"https://api.openai.com/v1\";\n\n const model =\n (\n await question(\n `模型名称 [${existing.llm?.model || \"deepseek-v4-flash\"}]: `,\n )\n ).trim() ||\n existing.llm?.model ||\n \"deepseek-v4-flash\";\n\n const apiKey =\n (\n await question(`API Key [${existing.apiKey ? \"***\" : \"(必填)\"}]: `)\n ).trim() || existing.apiKey;\n\n if (!apiKey) {\n console.error(\"\\n错误:API Key 不能为空。\");\n process.exit(1);\n }\n\n saveUserConfig({\n apiKey,\n endpoint,\n llm: {\n model,\n temperature: 0.7,\n maxInputTokens: 262144,\n maxOutputTokens: 16384,\n },\n });\n console.log(\"\\n配置已保存到 ~/.grc/config.json\");\n}\n","import { Command } from \"commander\";\nimport { version } from \"../package.json\" with { type: \"json\" };\nimport { runCommit } from \"./commands/commit\";\nimport { runInit } from \"./commands/init\";\n\nconst program = new Command();\n\nprogram\n .name(\"grc\")\n .description(\n \"A CLI tool that uses LLM to generate Git commit messages and execute commits\",\n )\n .version(version, \"-v, --version\", \"Display the current version\");\n\nprogram\n .command(\"init\")\n .description(\"Interactive LLM configuration initialization\")\n .action(() => {\n runInit().catch((err: Error) => {\n console.error(\"Error:\", err.message);\n process.exit(1);\n });\n });\n\nexport function runCli(): void {\n const args = process.argv.slice(2);\n\n if (args.length === 0) {\n runCommit().catch((err: Error) => {\n console.error(\"Error:\", err.message);\n process.exit(1);\n });\n return;\n }\n\n program.parse(process.argv);\n}\n","import { runCli } from \"./cli\";\n\nrunCli();\n"],"mappings":";opBCaa,EAA4B,CACvC,IAAK,CACH,MAAO,oBACP,YAAa,GACb,eAAgB,OAChB,gBAAiB,KACnB,EACA,OAAQ,GACR,SAAU,2BACZ,ECjBM,GAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,CAAmC,EAAG,OAAQ,aAAa,EAEjE,SAAgB,GAAqC,CACnD,GAAI,CACF,GAAI,EAAA,EAAA,EAAA,W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,OAAO,IAAI,EAAA,CAChE,KAAK,GAAK,EAAS,OAElB,IACH,QAAQ,MAAM;iBAAoB,EAClC,QAAQ,KAAK,CAAC,GAGhB,EAAe,CACb,SACA,WACA,IAAK,CACH,QACA,YAAa,GACb,eAAgB,OAChB,gBAAiB,KACnB,CACF,CAAC,EACD,QAAQ,IAAI;0BAA6B,CAC3C,CC1CA,IAAM,EAAU,IAAI,EAAA,QAEpB,EACG,KAAK,KAAK,CAAC,CACX,YACC,8EACF,CAAC,CACA,QAAQ,EAAS,gBAAiB,6BAA6B,EAElE,EACG,QAAQ,MAAM,CAAC,CACf,YAAY,8CAA8C,CAAC,CAC3D,WAAa,CACZ,EAAQ,CAAC,CAAC,MAAO,GAAe,CAC9B,QAAQ,MAAM,SAAU,EAAI,OAAO,EACnC,QAAQ,KAAK,CAAC,CAChB,CAAC,CACH,CAAC,EAEH,SAAgB,GAAe,CAG7B,GAFa,QAAQ,KAAK,MAAM,CAE5B,CAAA,CAAK,SAAW,EAAG,CACrB,EAAU,CAAC,CAAC,MAAO,GAAe,CAChC,QAAQ,MAAM,SAAU,EAAI,OAAO,EACnC,QAAQ,KAAK,CAAC,CAChB,CAAC,EACD,MACF,CAEA,EAAQ,MAAM,QAAQ,IAAI,CAC5B,CClCA,EAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-repo-comitter",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "A CLI tool that uses LLM to generate Git commit messages and execute commits",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -61,6 +61,7 @@
61
61
  "vite": "^8.1.4"
62
62
  },
63
63
  "dependencies": {
64
+ "commander": "^15.0.0",
64
65
  "dotenv": "^17.4.2",
65
66
  "openai": "^6.46.0",
66
67
  "yaml": "^2.9.0"