Skip to content

Commit 08da055

Browse files
riccardogioratoWiegerWolfNutlopehenryxwongImFeH2
authored
aicommits v 2 first release! (#323)
* docs: `type` flag/config for Conventional Commits (#215) * formatting * edited README * updated github action to pnpm v8 * fixed type error in aicommits * formatting and fixed type error * Update to pnpm 10, TypeScript 5.9, and default model Bump pnpm version to 10 in GitHub workflows and update TypeScript to 5.9.3 in package.json. Change the default OpenAI model in README and config to 'gpt-5-mini' and update related documentation. Refresh pnpm-lock.yaml for dependency updates. * wip * Add TogetherAI support and update dependencies Switched default AI provider to TogetherAI, updated documentation to reflect new API key usage, and changed default model and max commit message length. Updated dependencies in package.json and pnpm-lock.yaml, including OpenAI and pkgroll versions. Refactored code to support both OpenAI and TogetherAI API keys and models. * Add validation for OPENAI_KEY and update prompt message OPENAI_KEY in config now requires the key to start with 'sk-'. The prompt message for commit generation was updated to request a more detailed and accurate description of code changes. Test for config max-length was updated to expect 72 instead of 50. * Update package.json * Move and extend OpenAI tests; add TogetherAI tests Migrates OpenAI conventional commit tests from a separate file into tests/specs/openai/index.ts, removing the old file. Adds initial TogetherAI conventional commit tests in tests/specs/togetherai/index.ts and updates the main test suite to include TogetherAI. This refactor centralizes and expands coverage for commit message generation across providers. * Remove tiktoken dependency and update packages Removed @dqbd/tiktoken from dependencies and refactored config file path handling in config.ts. Updated devDependencies: clean-pkg-json, https-proxy-agent, and tsx to latest versions. Replaced createHttpsProxyAgent with HttpsProxyAgent in openai.ts and improved type usage and message sanitization. * Add provider-specific model support * Update pnpm version to 10 across workflows and default model settings * Upgrade GitHub Actions to latest versions * Update GitHub Actions to use newer versions * Add version flag and version number display * wip * Implement onboarding and API key setup for AI providers * Create .env.example * Added clipboard and confirm flags * Refactor commit message selection logic Extracted commit message selection and confirmation into a reusable getCommitMessage function in aicommits.ts for improved readability and maintainability. Updated the refactor commit type description in prompt.ts for clarity. * Add TOGETHER_API_KEY validation and locale check * Add support for gitmoji commit message format * Added CLI options and download badge to README * Restore clipboardy dependency * clipboardy 5 * Update dependency types and cleye versions * wip * wip * wip * Refactor provider handling and model selection Introduces a provider abstraction layer with dedicated classes for OpenAI, Together AI, Ollama, and custom endpoints. Refactors commands to use provider instances for configuration, validation, and model selection. Updates setup and model selection flows for extensibility and improved error handling. Adjusts tests and config parsing for new provider logic. * together as first provider * Refactor provider and OpenAI API integration Replaces custom HTTPS request logic with fetch for OpenAI API calls, removes proxy support, and standardizes provider model selection and base URL handling. Improves error handling and code readability across aicommits, prepare-commit-msg-hook, ollama provider, and openai utility modules. * Refactor provider and model config to unified structure Replaces individual provider classes with a single Provider class and unified ProviderDef structure. All provider configuration is now managed via OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL keys. Removes legacy config keys and simplifies model selection, setup, and validation logic. Updates commands and utilities to use the new config and provider structure, improving maintainability and reducing code duplication. * Update deprecated proxy config * Update README.md * Update README.md * Refactor config resolution and update documentation Improves configuration precedence by explicitly handling environment variables in getConfig and updates related command files to use the new signature. The README is updated to clarify the order of precedence for configuration sources and provide guidance on consistent environment variable usage. * Update OpenAI integration with new API endpoint * Refactor provider setup and model filtering logic Moved custom provider base URL input to setup command and removed duplicate prompt from Provider class. Updated Ollama default base URL and removed model list slicing from provider definitions to allow full model lists. These changes improve configuration flow and provider flexibility. * Add model search feature and remove provider parameter * Remove name parameter from fetchModels call * Update README.md * Handle empty model responses and update default model * Update models.ts * Implement provider selection and config backup in setup command * Add command descriptions and help * Rename environment variables and update test suites * Refactor setup command * Refactor model filtering and provider handling * Improve provider detection and configuration handling * Refactor configuration management and provider imports * fixes * wip * Allow releases on both main and develop branches * wip * fix tests * Update Node.js version to v20 * Update Node.js version to v22 * fixing tests due to missing env * feat: major CLI refactor * Add update-notifier dependency and notify for prerelease versions * Fix Together AI model setting * Refactor setup command to simplify config updates * feat: stop setup if missing api key * Add caching to model fetching * Update commit message prompt and spinner text * Update aicommits.ts * Refactor commit message helpers * feat: improve commit message handling for better clarity and consistency acros * fix: fixing typescript issue * fix: fixing cli updates in theory * feat: Add OpenRouter provider and generalize model defaults * Add interactive terminal checks before commit prompts * Return usage from generateCommitMessage and display tokens * Update test.yml * Update README.md * Inline retries and enhance error handling in generateCommitMessage * add conditional file listing for staged files in spinner (≤10) * tokens x second * wip * Add OpenAI-compatible provider support and UX ideas doc * Update command model and selectModel logic * Implement retry with timeout and abort signal * Update openai.ts * feat: set default openai model to 4o mini! * Modify prepare-commit-msg hook to prepend commit message * Update .gitignore * feat: use pbcopy on macOS for clipboard copy * Add `pr` command to generate and create GitHub PRs * feat: highlight provider default models in model selection * feat: prepare for v2 release BREAKING CHANGE: This commit triggers the major version bump to v2.0.0 for the aicommits project * feat: Implement chunking for large diffs in commit message generation * Update README.md * Update prompt.ts * Update openai.ts * feat: Add page generation and deletion functionality to the story editor * Update dependencies to latest versions: ai@^6.0.13, * feat: Add instruction to be specific in commit messages * feat: Enhance setup to handle cancellation, improve model selection messaging * feat: Add clipboard functionality and improve commit message generation * feat(cli): Add --no-verify flag to bypass pre-commit hooks * Update package.json * feat: Limit model options to prevent UI breaking in terminals * feat: shorten commit messages * Add support for reasoning models by extracting response after think tags * Add LMStudio provider with local API endpoint * Create AGENTS.md * fix: exclude lock files from git diff only when non-lock files are staged * feat: Update TogetherProvider default models to Kimi and Qwen3-Next-80B * feat: Implement auto-update functionality for CLI tool * fix: fixing autoupdater versions * Delete web.ts * fix: move exclude pathspecs after `--` separator in `getStagedDiffForFiles` * Fix lock file detection to handle subdirectories * refactor: replace update-notifier with custom auto-update implementation * feat: readme for LM Studio * fix: fixing pnpm lock * feat: add type choice in setup command and fix cli description * docs: update README with commit message format and options * Create aic.png * fix: replace npm update with npm install for package upgrades * fix: suppress AI SDK warnings for unsupported parameters * fix: update commit message format guidelines to enforce lowercase starting letters * Add VS Code extension for AI Commits with CLI integration * Update AI Commits icon to use custom PNG instead of sparkle * Update VS Code extension icon and aic.png logo * Update repository URL and categories in package.json * feat: add multi-provider support for GitHub, GitLab, Bitbucket, and Azure * Add automatic CLI update checks and activation on startup * docs(vscode): update readme and use defaultType for generate * chore(vscode-extension): bump version to 1.0.0 and update cursor script * Create release-vscode.yml * Update AI SDK packages to latest versions * refactor: replace clipboardy with native clipboard commands * feat: update together provider model list and test config with new models * feat: add provider name and current model indicator to model selection * Replace checkmark emoji with green check in model labels * Add --prompt flag and rename --confirm to --yes * fix: add --prompt flag for custom LLM behavior guidance * fix(utils/openai,aicommits): pass abortSignal for timeout, fix diff truncation and token usage keys Co-authored-by: Riccardo <riccardoemanuelegiorato@gmail.com> * feat: add Groq and xAI providers with API key support * feat: add provider headers support for AI commit generation * feat(aicommits): implement headless mode for non-interactive usage and improve file detection feedback * make sure that vscode extension will use stdout without clipboard * wip * fix: fixing deprecated kimi models * fix: skip auto-update in headless mode * fix: suppress headless stdout leaks * refactor: accept options object in generateCommitMessage instead of positional params (#325) refactor: accept options object in generateCommitMessage instead of positional params * Update README.md --------- Co-authored-by: Wieger Wolf <124579865+WiegerWolf@users.noreply.github.com> Co-authored-by: Hassan El Mghari <hassan4709@gmail.com> Co-authored-by: Henry Wong <henryxwong@gmail.com> Co-authored-by: ImFeH2 <i@feh2.im> Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>
1 parent 7631c2f commit 08da055

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+11216
-4276
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ end_of_line = lf
66
charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
9+
quote_type = single
910

1011
[*.yml]
1112
indent_style = space

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
OPENAI_API_KEY=
2+
3+
TOGETHER_API_KEY=

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release VSCode Extension
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'vscode-extension/**'
8+
workflow_dispatch:
9+
10+
jobs:
11+
release:
12+
name: Publish Extension
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 10
15+
permissions:
16+
contents: write
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v6
24+
with:
25+
node-version-file: '.nvmrc'
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v4.2.0
29+
with:
30+
version: 9
31+
32+
- name: Install dependencies
33+
working-directory: vscode-extension
34+
run: pnpm install
35+
36+
- name: Build
37+
working-directory: vscode-extension
38+
run: pnpm run compile
39+
40+
- name: Publish to VSCode Marketplace
41+
working-directory: vscode-extension
42+
env:
43+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
44+
run: pnpm run package && npx @vscode/vsce publish --no-dependencies
45+
46+
- name: Upload VSIX artifact
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: vscode-extension
50+
path: vscode-extension/*.vsix

.github/workflows/release.yml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Release
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, develop]
66

77
jobs:
88
release:
@@ -13,23 +13,22 @@ jobs:
1313
contents: write
1414

1515
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v5
1618

17-
- name: Checkout
18-
uses: actions/checkout@v3
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v6
21+
with:
22+
node-version-file: '.nvmrc'
1923

20-
- name: Setup Node.js
21-
uses: actions/setup-node@v3
22-
with:
23-
node-version-file: '.nvmrc'
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4.2.0
26+
with:
27+
version: 9
28+
run_install: true
2429

25-
- name: Setup pnpm
26-
uses: pnpm/action-setup@v2
27-
with:
28-
version: 7
29-
run_install: true
30-
31-
- name: Release
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
35-
run: pnpm dlx semantic-release
30+
- name: Release
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
run: pnpm dlx semantic-release

.github/workflows/test.yml

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,33 @@ jobs:
1616
timeout-minutes: 10
1717

1818
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v3
21-
22-
- name: Use Node.js
23-
uses: actions/setup-node@v3
24-
with:
25-
node-version-file: '.nvmrc'
26-
27-
- name: Setup pnpm
28-
uses: pnpm/action-setup@v2
29-
with:
30-
version: 7
31-
run_install: true
32-
33-
- name: Type check
34-
run: pnpm type-check
35-
36-
- name: Lint
37-
run: pnpm lint
38-
39-
- name: Build
40-
run: pnpm build
41-
42-
- name: Install tinyproxy
43-
if: matrix.os == 'ubuntu-latest'
44-
run: |
45-
sudo apt-get install tinyproxy
46-
tinyproxy
47-
- name: Test
48-
env:
49-
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
50-
run: |
51-
pnpm test
52-
pnpm --use-node-version=14.21.3 test
19+
- name: Checkout
20+
uses: actions/checkout@v5
21+
22+
- name: Use Node.js
23+
uses: actions/setup-node@v6
24+
with:
25+
node-version-file: '.nvmrc'
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v4.2.0
29+
with:
30+
version: 9
31+
run_install: true
32+
33+
- name: Type check
34+
run: pnpm type-check
35+
36+
- name: Build
37+
run: pnpm build
38+
39+
- name: Install tinyproxy
40+
if: matrix.os == 'ubuntu-latest'
41+
run: |
42+
sudo apt-get install tinyproxy
43+
tinyproxy
44+
- name: Test
45+
env:
46+
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
47+
run: |
48+
pnpm test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ yarn-error.log*
1010
lerna-debug.log*
1111

1212
# Dependency directories
13-
/node_modules/
13+
node_modules/
1414

1515
# Output of 'npm pack'
1616
*.tgz

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.14.0
1+
v22.14.0

AGENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# AGENTS.md
2+
3+
## Commands
4+
- **Build:** `pnpm build` (uses pkgroll with minify)
5+
- **Type check:** `pnpm type-check` (runs tsc)
6+
- **Test all:** `pnpm test` (runs `tsx tests`)
7+
- **Test single file:** `pnpm tsx tests/specs/<file>.ts`
8+
9+
## Architecture
10+
CLI tool that generates git commit messages using AI (OpenAI/Together AI or any OpenAI compatible endpoint).
11+
- `src/cli.ts` - Main entry point using cleye for CLI parsing
12+
- `src/commands/` - CLI subcommands (aicommits, config, hook, model, pr, setup)
13+
- `src/utils/` - Shared utilities (git, openai, config, prompts)
14+
- `src/feature/` - Feature-specific logic
15+
- `tests/specs/` - Test files using manten framework
16+
17+
## Code Style
18+
- **Indentation:** Tabs (spaces for YAML)
19+
- **Quotes:** Single quotes
20+
- **Line endings:** LF
21+
- **Module system:** ESM (`"type": "module"`)
22+
- **TypeScript:** Strict mode, ES2020 target, Node16 module resolution
23+
- **Imports:** Use `.js` extension for local imports (ESM requirement)
24+
- **Final newline:** Required

CONTRIBUTING.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,63 +3,71 @@
33
## Setting up the project
44

55
Use [nvm](https://nvm.sh) to use the appropriate Node.js version from `.nvmrc`:
6+
67
```sh
78
nvm i
89
```
910

1011
Install the dependencies using pnpm:
12+
1113
```sh
1214
pnpm i
1315
```
1416

1517
## Building the project
18+
1619
Run the `build` script:
20+
1721
```sh
1822
pnpm build
1923
```
2024

2125
The package is bundled using [pkgroll](https://github.com/privatenumber/pkgroll) (Rollup). It infers the entry-points from `package.json` so there are no build configurations.
2226

23-
2427
### Development (watch) mode
28+
2529
During development, you can use the watch flag (`--watch, -w`) to automatically rebuild the package on file changes:
30+
2631
```sh
2732
pnpm build -w
2833
```
2934

3035
## Running the package locally
36+
3137
Since pkgroll knows the entry-point is a binary (being in `package.json#bin`), it automatically adds the Node.js hashbang to the top of the file, and chmods it so it's executable.
3238

3339
You can run the distribution file in any directory:
40+
3441
```sh
3542
./dist/cli.mjs
3643
```
3744

3845
Or in non-UNIX environments, you can use Node.js to run the file:
46+
3947
```sh
4048
node ./dist/cli.mjs
4149
```
4250

4351
## Testing
4452

45-
Testing requires passing in `OPENAI_KEY` as an environment variable:
53+
Testing requires passing in `OPENAI_API_KEY` as an environment variable:
4654

4755
```sh
48-
OPENAI_KEY=<your OPENAI key> pnpm test
56+
OPENAI_API_KEY=<your OPENAI key> pnpm test
4957
```
5058

59+
You can still run tests that don't require `OPENAI_API_KEY` but will not test the main functionality:
5160

52-
You can still run tests that don't require `OPENAI_KEY` but will not test the main functionality:
5361
```
5462
pnpm test
5563
```
5664

57-
5865
## Using & testing your changes
5966

6067
Let's say you made some changes in a fork/branch and you want to test it in a project. You can publish the package to a GitHub branch using [`git-publish`](https://github.com/privatenumber/git-publish):
6168

6269
Publish your current branch to a `npm/*` branch on your GitHub repository:
70+
6371
```sh
6472
$ pnpm dlx git-publish
6573

@@ -70,6 +78,7 @@ $ pnpm dlx git-publish
7078
> Note: The `Nutlope/aicommits` will be replaced with your fork's URL.
7179
7280
Now, you can run the branch in your project:
81+
7382
```sh
7483
$ pnpm dlx 'Nutlope/aicommits#npm/develop' # same as running `npx aicommits`
7584
```

0 commit comments

Comments
 (0)