Skip to content

Commit 10e7822

Browse files
chore(cli): Update CLI commands and environment configuration
This commit modifies the command-line interface for the AI-assisted conventional commit tool. The primary change is the renaming of the command from `commit-ai` to `ai-commit`, which enhances clarity and consistency across the tool's usage. Additionally, the environment configuration file has been updated to include new provider options and model settings. This change allows users to customize their AI provider and model more effectively, improving the overall flexibility of the tool. These updates aim to streamline user experience and provide clearer guidance on configuration options.
1 parent 02440dc commit 10e7822

3 files changed

Lines changed: 35 additions & 169 deletions

File tree

.env-example

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
# ------------------------------------------------------------
22
# @verndale/ai-commit (pnpm commit / ai-commit run)
33
# ------------------------------------------------------------
4+
5+
# --- Provider configuration ---
6+
# COMMIT_AI_PROVIDER=openai # openai (default), anthropic, ollama, azure-openai
7+
# COMMIT_AI_MODEL=gpt-4o-mini # Model override (default depends on provider)
8+
# COMMIT_AI_API_KEY= # Universal API key (or use provider-specific below)
9+
# COMMIT_AI_BASE_URL= # Custom API base URL
10+
11+
# --- OpenAI (default provider) ---
412
# @verndale/ai-commit — OPENAI_API_KEY: OpenAI API key for conventional commit messages (ai-commit run; optional for prepare-commit-msg with AI).
513
OPENAI_API_KEY=
614

7-
# Optional — default is gpt-4o-mini
8-
# COMMIT_AI_MODEL=
15+
# --- Anthropic ---
16+
# ANTHROPIC_API_KEY=
17+
18+
# --- Azure OpenAI ---
19+
# AZURE_OPENAI_API_KEY=
20+
# AZURE_OPENAI_ENDPOINT=https://<resource>.openai.azure.com
21+
# AZURE_OPENAI_DEPLOYMENT=
22+
# AZURE_OPENAI_API_VERSION=2024-08-01-preview
23+
24+
# --- Ollama (local, no API key needed) ---
25+
# COMMIT_AI_PROVIDER=ollama
26+
# COMMIT_AI_BASE_URL=http://localhost:11434
27+
# COMMIT_AI_MODEL=llama3.2
928

bin/cli.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ function commitlintCliPath() {
4141
}
4242

4343
function printHelp() {
44-
process.stdout.write(`${bold("commit-ai")} — AI-assisted conventional commits with bundled commitlint
44+
process.stdout.write(`${bold("ai-commit")} — AI-assisted conventional commits with bundled commitlint
4545
4646
${bold("Usage:")}
47-
commit-ai run [options]
48-
commit-ai init [--force] [--env-only] [--husky] [--workspace]
49-
commit-ai prepare-commit-msg <file> [source]
50-
commit-ai lint --edit <file>
51-
commit-ai config [--init]
52-
commit-ai hooks install
47+
ai-commit run [options]
48+
ai-commit init [--force] [--env-only] [--husky] [--workspace]
49+
ai-commit prepare-commit-msg <file> [source]
50+
ai-commit lint --edit <file>
51+
ai-commit config [--init]
52+
ai-commit hooks install
5353
5454
${bold("Commands:")}
5555
${green("run")} Generate a message from the staged diff and run git commit.
5656
${green("init")} Merge env, then Husky + package.json + hooks. Use --env-only, --husky, --workspace, --force.
5757
${green("prepare-commit-msg")} Git hook: fill an empty commit message file.
5858
${green("lint")} Run commitlint with the bundled config (for commit-msg hook).
5959
${green("config")} Show resolved configuration (or --init to create config file).
60-
${green("hooks")} Install git hooks (commit-ai hooks install).
60+
${green("hooks")} Install git hooks (ai-commit hooks install).
6161
6262
${bold("Run Options:")}
6363
--dry-run Generate and display the message without committing.
@@ -311,7 +311,7 @@ function stripGitComments(text) {
311311
async function cmdRun(flags) {
312312
assertInGitRepo();
313313
if (!hasStagedChanges()) {
314-
fail("No staged changes. Stage files before running commit-ai.");
314+
fail("No staged changes. Stage files before running ai-commit.");
315315
process.exit(1);
316316
}
317317

@@ -399,7 +399,7 @@ function cmdLint(editFile) {
399399

400400
function cmdConfig(argv) {
401401
if (argv.includes("--init")) {
402-
const configPath = path.join(process.cwd(), ".commit-airc.json");
402+
const configPath = path.join(process.cwd(), ".ai-commitrc.json");
403403
if (fs.existsSync(configPath)) {
404404
info(`Config file already exists: ${configPath}`);
405405
return;
@@ -451,8 +451,8 @@ function cmdHooksInstall() {
451451
const huskyDir = path.join(cwd, ".husky");
452452
const gitHooksDir = path.join(cwd, ".git", "hooks");
453453

454-
const prepareCommitMsg = 'commit-ai prepare-commit-msg "$1" "$2"\n';
455-
const commitMsg = 'commit-ai lint --edit "$1"\n';
454+
const prepareCommitMsg = 'ai-commit prepare-commit-msg "$1" "$2"\n';
455+
const commitMsg = 'ai-commit lint --edit "$1"\n';
456456

457457
if (fs.existsSync(huskyDir)) {
458458
const prepareFile = path.join(huskyDir, "prepare-commit-msg");
@@ -524,9 +524,9 @@ async function main() {
524524
cmdHooksInstall();
525525
return;
526526
}
527-
throw new Error("Usage: commit-ai hooks install");
527+
throw new Error("Usage: ai-commit hooks install");
528528
}
529-
throw new Error(`Unknown command: ${cmd}. Run commit-ai --help for usage.`);
529+
throw new Error(`Unknown command: ${cmd}. Run ai-commit --help for usage.`);
530530
}
531531

532532
main().catch((e) => {

tools/lib/pr-ai.js

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)