ai-release-notes 0.0.1

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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -0
  3. package/dist/bin/cli.d.ts +6 -0
  4. package/dist/bin/cli.d.ts.map +1 -0
  5. package/dist/bin/cli.js +723 -0
  6. package/dist/bin/cli.js.map +1 -0
  7. package/dist/config.d.ts +23 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +176 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/context.d.ts +11 -0
  12. package/dist/context.d.ts.map +1 -0
  13. package/dist/context.js +58 -0
  14. package/dist/context.js.map +1 -0
  15. package/dist/generator.d.ts +21 -0
  16. package/dist/generator.d.ts.map +1 -0
  17. package/dist/generator.js +258 -0
  18. package/dist/generator.js.map +1 -0
  19. package/dist/git.d.ts +28 -0
  20. package/dist/git.d.ts.map +1 -0
  21. package/dist/git.js +116 -0
  22. package/dist/git.js.map +1 -0
  23. package/dist/index.d.ts +15 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +36 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/llm.d.ts +23 -0
  28. package/dist/llm.d.ts.map +1 -0
  29. package/dist/llm.js +105 -0
  30. package/dist/llm.js.map +1 -0
  31. package/dist/output-index.d.ts +13 -0
  32. package/dist/output-index.d.ts.map +1 -0
  33. package/dist/output-index.js +53 -0
  34. package/dist/output-index.js.map +1 -0
  35. package/dist/prompts/builder.d.ts +26 -0
  36. package/dist/prompts/builder.d.ts.map +1 -0
  37. package/dist/prompts/builder.js +82 -0
  38. package/dist/prompts/builder.js.map +1 -0
  39. package/dist/prompts/translation-system.md +8 -0
  40. package/dist/release.d.ts +37 -0
  41. package/dist/release.d.ts.map +1 -0
  42. package/dist/release.js +288 -0
  43. package/dist/release.js.map +1 -0
  44. package/dist/types.d.ts +224 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/types.js +78 -0
  47. package/dist/types.js.map +1 -0
  48. package/dist/version.d.ts +3 -0
  49. package/dist/version.d.ts.map +1 -0
  50. package/dist/version.js +10 -0
  51. package/dist/version.js.map +1 -0
  52. package/package.json +63 -0
  53. package/prompts/release-notes-instructions.md +21 -0
  54. package/prompts/release-notes-system.md +7 -0
  55. package/prompts/release-notes-translation-system.md +20 -0
  56. package/templates/default-release-note.html +133 -0
  57. package/templates/default-release-note.md +8 -0
  58. package/templates/default-release-summary.html +126 -0
  59. package/templates/default-release-summary.md +11 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Akram TABKA
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,261 @@
1
+ # 🤖 ai-release-notes
2
+
3
+ Generic AI-powered release notes generator using the [Vercel AI SDK](https://sdk.vercel.ai).
4
+
5
+ Transform your git changelog into clean, business-readable release notes — with support for OpenAI, Anthropic, Mistral, Google, Ollama, and more.
6
+
7
+ **Fully customizable** via configuration: language, instructions, output format, templates, and context files.
8
+
9
+ **Security-first**: API keys are never stored in config files. Only the key for your chosen provider is required via environment variable.
10
+
11
+ ---
12
+
13
+ ## Installation
14
+
15
+ ### Global (CLI usage)
16
+ ```bash
17
+ npm install -g ai-release-notes
18
+ ```
19
+
20
+ ### Local (programmatic usage)
21
+ ```bash
22
+ npm install ai-release-notes
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Quick Start
28
+
29
+ ### 1. Providers and API Keys
30
+
31
+ API keys are **never** stored in config files. Only the key for the active provider is read from environment variables at runtime.
32
+
33
+ | Provider | CLI alias | Environment variable | Default models | Setup guide |
34
+ |----------|-----------|----------------------|----------------|-------------|
35
+ | OpenAI | `gpt4`, `gpt`, or default | `OPENAI_API_KEY` | GPT-4o, GPT-4o-mini | [Get an OpenAI key](docs/api-keys.md#openai) |
36
+ | Anthropic | `claude` | `ANTHROPIC_API_KEY` | Claude 3.5 Sonnet, Claude 3 Opus | [Get an Anthropic key](docs/api-keys.md#anthropic-claude) |
37
+ | Mistral | `mistral` | `MISTRAL_API_KEY` | Mistral Large, Mistral Medium | [Get a Mistral key](docs/api-keys.md#mistral) |
38
+ | Google | `gemini` | `GOOGLE_API_KEY` | Gemini 1.5 Pro, Gemini 1.5 Flash | [Get a Google key](docs/api-keys.md#google-gemini) |
39
+ | Azure OpenAI | `azure` | `AZURE_OPENAI_API_KEY` and `AZURE_OPENAI_ENDPOINT` | GPT-4o via Azure | [Get Azure credentials](docs/api-keys.md#azure-openai) |
40
+ | Ollama | `ollama` | None for local use; optional `OLLAMA_API_KEY` for Ollama Cloud | Local models, including Llama and Mistral | [Set up Ollama](docs/api-keys.md#ollama) |
41
+
42
+ #### Setting environment variables
43
+
44
+ **macOS / Linux:**
45
+ ```bash
46
+ export OPENAI_API_KEY=sk-...
47
+ ```
48
+
49
+ **Windows (PowerShell):**
50
+ ```powershell
51
+ $env:OPENAI_API_KEY="sk-..."
52
+ ```
53
+
54
+ **Windows (CMD):**
55
+ ```cmd
56
+ set OPENAI_API_KEY=sk-...
57
+ ```
58
+
59
+ **`.env` file (with dotenv):**
60
+ ```bash
61
+ # Install dotenv-cli
62
+ npm install -g dotenv-cli
63
+
64
+ # Run with env file
65
+ dotenv -e .env -- npx ai-release-notes generate --from v1.0.0 --to v1.1.0 --env PROD
66
+ ```
67
+
68
+ ### 2. Initialize configuration
69
+
70
+ ```bash
71
+ npx ai-release-notes init
72
+ ```
73
+
74
+ This creates `.ai-release-notes.yml` in your project root. **No API keys are stored in this file.**
75
+
76
+ ### 3. Generate release notes
77
+
78
+ ```bash
79
+ # Uses the default provider (openai) — needs OPENAI_API_KEY
80
+ npx ai-release-notes generate --from v1.0.0 --to v1.1.0 --env PROD
81
+
82
+ # Uses Anthropic — needs ANTHROPIC_API_KEY
83
+ npx ai-release-notes generate --from v1.0.0 --to v1.1.0 --env PROD --with claude
84
+
85
+ # Uses Mistral — needs MISTRAL_API_KEY
86
+ npx ai-release-notes generate --from v1.0.0 --to v1.1.0 --env PROD --with mistral
87
+ ```
88
+
89
+ The command saves files according to your configuration and reports the paths
90
+ it updated. To generate notes for the terminal only—without writing release
91
+ files or indexes—use `--stdout`. The Markdown is written to standard output;
92
+ status and token information go to standard error:
93
+
94
+ ```bash
95
+ npx ai-release-notes generate --from v1.25.9 --to v1.28.0 --with mistral --env PROD --stdout
96
+ ```
97
+
98
+ `--dry-run` is different: it shows the prompt without calling the AI provider.
99
+ Use `--verbose` to see the instruction source, main language, and configured
100
+ translation steps. It reports execution details, not private model reasoning.
101
+
102
+ After a generation, the command shows the provider-reported input, output,
103
+ and total token counts, together with the number of model calls and elapsed
104
+ time. Translated releases include every translation call in these totals.
105
+
106
+ ## CLI Options
107
+
108
+ | Option | Description |
109
+ |--------|-------------|
110
+ | `--from <version>` | Previous version tag |
111
+ | `--to <version>` | Current version tag |
112
+ | `--env <env>` | **Required.** Environment name (PROD, STAGING, etc.) |
113
+ | `--release-date <value>` | Release date: `now` (default), `tag`, or an ISO date such as `2026-07-20` |
114
+ | `--date <value>` | Alias for `--release-date` |
115
+ | `--with <provider>` | LLM override; see [provider aliases](#1-providers-and-api-keys) |
116
+ | `--config <path>` | Path to config file |
117
+ | `--output <path>` | Output file path (overrides `output.saveTo`) |
118
+ | `--output-dir <dir>` | Output directory (auto-names the file) |
119
+ | `--format <md\|html>` | Output format (default: `md`) |
120
+ | `--template <path>` | Custom template file |
121
+ | `--changelog <path>` | Raw changelog file (skip git) |
122
+ | `--context <paths...>` | Context files or directories (mixed) |
123
+ | `--dry-run` | Show prompts without calling LLM |
124
+ | `-v, --verbose` | Show applied instructions and generation steps |
125
+ | `--stdout` | Write generated Markdown to standard output without saving files or indexes |
126
+ | `--clipboard` | Copy result to clipboard |
127
+
128
+ ### Release date
129
+
130
+ Use the current date (the default), the selected `--to` tag's creation date,
131
+ or an explicit ISO date:
132
+
133
+ ```bash
134
+ ai-release-notes generate --from v1.25.9 --to v1.28.0 --env PROD --release-date now
135
+ ai-release-notes generate --from v1.25.9 --to v1.28.0 --env PROD --release-date tag
136
+ ai-release-notes generate --from v1.25.9 --to v1.28.0 --env PROD --release-date 2026-07-20
137
+ ```
138
+
139
+ In the library API, pass the same values as `releaseDate`. The older `date`
140
+ field remains available when you need to supply an already formatted display
141
+ date.
142
+
143
+ ---
144
+
145
+ ## Configuration
146
+
147
+ `.ai-release-notes.yml` describes your project and where generated files
148
+ belong. Keep API keys in environment variables; they are never stored in the
149
+ configuration file.
150
+
151
+ The main parts are simple:
152
+
153
+ - `projectName` gives the generated notes their product name.
154
+ - `provider` chooses the AI provider; `providers` lets you set its model and
155
+ generation options.
156
+ - `prompt` selects the release languages and can point to an instructions file
157
+ when your team has writing rules. Its content replaces the built-in release
158
+ instructions through the `{{instructions}}` section.
159
+ - `output` lists the Markdown and/or HTML release files to create. Use
160
+ `{env}`, `{lang}`, `{from}`, and `{to}` in their names. Missing `--from` and
161
+ `--to` become `start` and `end`.
162
+ - `outputIndex` is optional. It maintains a release summary with links to
163
+ every release file. It may be one destination or a list, for example one
164
+ Markdown and one HTML summary. Add `{lang}` when each language needs its own
165
+ summary. Index templates can place links between those summaries with
166
+ `{{languages}}` (or `{{langages}}`). The switcher merges languages from the
167
+ current prompt with localized index files already present on disk.
168
+
169
+ Custom instruction and summary templates are optional. The generated config
170
+ keeps their lines commented until you need them.
171
+
172
+ For the exact configuration and comments, see the annotated
173
+ [example `.ai-release-notes.yml`](examples/.ai-release-notes.yml). The
174
+ [examples guide](examples/README.md) then walks through a first run, writing
175
+ instructions, templates, and output layouts.
176
+
177
+ ---
178
+
179
+ ## Context Files
180
+
181
+ Provide additional context to the LLM. Accepts a **mixed array** of files and directories:
182
+
183
+ ```bash
184
+ npx ai-release-notes generate --from v1.0.0 --to v1.1.0 --env PROD \
185
+ --context ./specs/main.md ./docs/models/ ./README.md
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Programmatic API
191
+
192
+ ```typescript
193
+ import { generate } from "ai-release-notes";
194
+
195
+ const result = await generate({
196
+ fromVersion: "v1.0.0",
197
+ toVersion: "v1.1.0",
198
+ environment: "PROD",
199
+ provider: "claude", // only ANTHROPIC_API_KEY is needed
200
+ format: "html",
201
+ outputDir: "./docs/releases",
202
+ context: ["./specs/api-v2.md", "./docs/models/"],
203
+ });
204
+
205
+ console.log(result.markdown);
206
+ console.log(result.html);
207
+ ```
208
+
209
+ ---
210
+
211
+ ## CI/CD Integration
212
+
213
+ ### GitHub Actions
214
+
215
+ ```yaml
216
+ name: Release Notes
217
+ on:
218
+ push:
219
+ tags: ["v*"]
220
+
221
+ jobs:
222
+ release-notes:
223
+ runs-on: ubuntu-latest
224
+ steps:
225
+ - uses: actions/checkout@v4
226
+ with:
227
+ fetch-depth: 0
228
+
229
+ - run: npm install -g ai-release-notes
230
+
231
+ - name: Generate
232
+ env:
233
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
234
+ run: |
235
+ CURRENT=${GITHUB_REF#refs/tags/}
236
+ PREVIOUS=$(git describe --tags --abbrev=0 ${CURRENT}^)
237
+ ai-release-notes generate --from $PREVIOUS --to $CURRENT --env PROD --output RELEASE_NOTES.md
238
+
239
+ - uses: softprops/action-gh-release@v1
240
+ with:
241
+ body_path: RELEASE_NOTES.md
242
+ ```
243
+
244
+ ---
245
+
246
+ ## Contributing 🤝
247
+
248
+ If you find any issues or have suggestions for improvement, feel free to open an issue or submit a pull request.
249
+ Contributions are welcome!
250
+
251
+ Before getting started, please read our [Contribution Guidelines](CONTRIBUTING.md).
252
+
253
+ This project is governed by the [Code of Conduct](CODE_OF_CONDUCT.md); security issues should follow the [Security Policy](security.md).
254
+
255
+ ## Community 👥
256
+
257
+ Love `ai-release-note` ? Give our repo a star ⭐ ⬆️.
258
+
259
+ ## License 📄
260
+
261
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry point
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AACA;;GAEG"}