@verndale/ai-commit 2.2.0 → 2.3.0

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
@@ -18,13 +18,13 @@ The same package works with **npm** or **yarn** (for example `npm install -D @ve
18
18
  ## Quick setup (deterministic order)
19
19
 
20
20
  1. **Install** the dev dependency (see [Install](#install)).
21
- 2. **Init** — From the **git repo root** (where **`package.json`** lives), run **`pnpm exec ai-commit init`**. That merges **`.env`** and **`.env.example`** (creates **`.env.example`** from the bundled template if it is missing; see [`.env.example`](.env.example) for keys and comments), runs **`npx husky@9 init`** if Husky is not present, adds missing **`commit`** / **`prepare`** / **`husky`** entries to **`package.json`** when the file exists, and writes **`.husky`** hooks. **Install dependencies** afterward if **`package.json`** changed (`pnpm install`, `npm install`, etc.).
21
+ 2. **Init** — From the **git repo root** (where **`package.json`** lives), run **`pnpm exec ai-commit init`**. That merges **`.env`** and **`.env-example`** (creates **`.env-example`** from the bundled template if it is missing; see [`.env-example`](.env-example) for keys and comments), runs **`npx husky@9 init`** if Husky is not present, adds missing **`commit`** / **`prepare`** / **`husky`** entries to **`package.json`** when the file exists, and writes **`.husky`** hooks. **Install dependencies** afterward if **`package.json`** changed (`pnpm install`, `npm install`, etc.).
22
22
  - Not in a git repo? **init** only updates env files and explains that Git/Husky were skipped.
23
23
  - Env files only? Use **`pnpm exec ai-commit init --env-only`**.
24
24
  - Hooks only (no **`package.json`** changes)? Use **`pnpm exec ai-commit init --husky`**.
25
25
  3. **Secrets** — Set **`OPENAI_API_KEY`** in `.env` and/or `.env.local` (`.env.local` overrides `.env` for duplicate keys).
26
26
 
27
- Use **`ai-commit init --force`** to replace **`.env`** and **`.env.example`** with the bundled template (destructive) or to overwrite existing Husky hook files. Without **`--force`**, **init** creates **`.env.example`** when missing and otherwise appends missing ai-commit keys (same as **`.env`**).
27
+ Use **`ai-commit init --force`** to replace **`.env`** and **`.env-example`** with the bundled template (destructive) or to overwrite existing Husky hook files. Without **`--force`**, **init** creates **`.env-example`** when missing and otherwise appends missing ai-commit keys (same as **`.env`**). The published template file is **`.env-example`** (hyphen, not **`.env.example`**).
28
28
 
29
29
  ## Environment
30
30
 
@@ -50,7 +50,7 @@ Use **`ai-commit init --force`** to replace **`.env`** and **`.env.example`** wi
50
50
  | Command | Purpose |
51
51
  | --- | --- |
52
52
  | `ai-commit run` | Generate a message from the staged diff and run `git commit`. |
53
- | `ai-commit init [--force] [--env-only] [--husky] [--workspace]` | Merge env keys, then **`npx husky@9 init`** if needed, merge **`package.json`** when present, write hooks. **`--env-only`** stops after env files. **`--husky`** skips `package.json` (hooks + Husky only); use **`--husky --workspace`** to include **`package.json`** again. **`--force`** replaces `.env` / overwrites hooks. |
53
+ | `ai-commit init [--force] [--env-only] [--husky] [--workspace]` | Merge env keys (including **`.env-example`**), then **`npx husky@9 init`** if needed, merge **`package.json`** when present, write hooks. **`--env-only`** stops after env files. **`--husky`** skips `package.json` (hooks + Husky only); use **`--husky --workspace`** to include **`package.json`** again. **`--force`** replaces `.env` / `.env-example` / overwrites hooks. |
54
54
  | `ai-commit prepare-commit-msg <file> [source]` | Git `prepare-commit-msg` hook: fill an empty message; skips `merge` / `squash`. |
55
55
  | `ai-commit lint --edit <file>` | Git `commit-msg` hook: run commitlint with this package’s default config. |
56
56
 
@@ -118,7 +118,7 @@ corepack enable
118
118
  pnpm install
119
119
  ```
120
120
 
121
- Copy `.env.example` to `.env` and/or `.env.local` and set **`OPENAI_API_KEY`**. After staging, **`pnpm commit`** runs this repo’s CLI (`node ./bin/cli.js run`; the published package exposes `ai-commit` in `node_modules/.bin` for dependents). Hooks under `.husky/` call **`pnpm exec ai-commit`** from this checkout.
121
+ Copy **`.env-example`** to `.env` and/or `.env.local` and set **`OPENAI_API_KEY`**. After staging, **`pnpm commit`** runs this repo’s CLI (`node ./bin/cli.js run`; the published package exposes `ai-commit` in `node_modules/.bin` for dependents). Hooks under `.husky/` call **`pnpm exec ai-commit`** from this checkout.
122
122
 
123
123
  ### Repository automation
124
124
 
package/bin/cli.js CHANGED
@@ -42,7 +42,7 @@ Usage:
42
42
 
43
43
  Commands:
44
44
  run Generate a message from the staged diff and run git commit.
45
- init Merge env, then Husky + package.json + hooks (from a git repo). \`--env-only\` stops after env files. \`--husky\` skips package.json. \`--force\` replaces \`.env\` / hooks.
45
+ init Merge env, then Husky + package.json + hooks (from a git repo). \`--env-only\` stops after env files. \`--husky\` skips package.json. \`--force\` replaces \`.env\` / \`.env-example\` / hooks.
46
46
  prepare-commit-msg Git hook: fill an empty commit message file (merge/squash skipped).
47
47
  lint Run commitlint with the package default config (for commit-msg hook).
48
48
 
@@ -86,10 +86,10 @@ function cmdInit(argv) {
86
86
  const cwd = process.cwd();
87
87
  /** Full package.json merge: default on, or `--workspace`; off for `--husky` alone (legacy). */
88
88
  const mergePackageJson = !husky || workspace;
89
- const examplePath = path.join(__dirname, "..", ".env.example");
89
+ const examplePath = path.join(__dirname, "..", ".env-example");
90
90
 
91
91
  if (!fs.existsSync(examplePath)) {
92
- throw new Error("Missing bundled .env.example (corrupt install?).");
92
+ throw new Error("Missing bundled .env-example (corrupt install?).");
93
93
  }
94
94
 
95
95
  const envDest = path.join(cwd, ".env");
@@ -114,9 +114,9 @@ function cmdInit(argv) {
114
114
  break;
115
115
  }
116
116
 
117
- const envExampleDest = path.join(cwd, ".env.example");
117
+ const envExampleDest = path.join(cwd, ".env-example");
118
118
  const exResult = mergeAiCommitEnvFile(envExampleDest, examplePath, { force });
119
- const exRel = path.relative(cwd, envExampleDest) || ".env.example";
119
+ const exRel = path.relative(cwd, envExampleDest) || ".env-example";
120
120
  switch (exResult.kind) {
121
121
  case "replaced":
122
122
  process.stdout.write(`Replaced ${exRel} with bundled template (--force).\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verndale/ai-commit",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "AI-assisted conventional commits with bundled commitlint — one install, aligned rules",
5
5
  "license": "MIT",
6
6
  "author": "Verndale",
@@ -28,7 +28,7 @@
28
28
  "files": [
29
29
  "bin",
30
30
  "lib",
31
- ".env.example",
31
+ ".env-example",
32
32
  "README.md",
33
33
  "LICENSE"
34
34
  ],
File without changes