Skip to content

Commit 6b6bef7

Browse files
committed
chore: add project scaffold and initial implementation
* Nix development environment and build system * CI/CD workflows for pull requests and releases * Basic project structure for Go implementation * Providers for OpenAI, Anthropic, and OpenCode Zen APIs * Commands for asking questions and generating commit messages
1 parent 8cd2993 commit 6b6bef7

28 files changed

Lines changed: 1387 additions & 0 deletions

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/pull-request.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
lint:
9+
name: Lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: DeterminateSystems/nix-installer-action@main
14+
- run: nix run .#lint
15+
16+
test:
17+
name: Test
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: DeterminateSystems/nix-installer-action@main
22+
- run: nix run .#test
23+
24+
build:
25+
name: Build
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: DeterminateSystems/nix-installer-action@main
30+
- run: nix run .#build
31+
- uses: actions/upload-artifact@v4
32+
with:
33+
name: dist
34+
path: dist/
35+
36+
merge-ready:
37+
runs-on: ubuntu-latest
38+
if: ${{ always() }}
39+
needs: [lint, test, build]
40+
steps:
41+
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
42+
run: exit 1
43+
- run: echo "LGTM"

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
- uses: DeterminateSystems/nix-installer-action@main
20+
- run: nix run .#release
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Binaries
2+
dist/
3+
*.exe
4+
5+
# Test/coverage
6+
*.test
7+
coverage.out
8+
9+
# IDE
10+
.idea/
11+
.vscode/
12+
13+
# OS
14+
.DS_Store
15+
16+
# Direnv
17+
!.envrc

.goreleaser.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
ldflags:
11+
- -s -w -X main.version={{ .Version }}
12+
goos:
13+
- linux
14+
- windows
15+
- darwin
16+
goarch:
17+
- amd64
18+
- arm64
19+
20+
archives:
21+
- formats:
22+
- tar.gz
23+
name_template: >-
24+
{{ .ProjectName }}_{{ title .Os }}_
25+
{{- if eq .Arch "amd64" }}x86_64{{ else }}{{ .Arch }}{{ end }}
26+
format_overrides:
27+
- goos: windows
28+
formats:
29+
- zip
30+
31+
changelog:
32+
sort: asc
33+
groups:
34+
- title: Features
35+
regexp: '^.*?feat(\([[:word:]]+\))??!?:.+$'
36+
- title: Bug Fixes
37+
regexp: '^.*?fix(\([[:word:]]+\))??!?:.+$'
38+
- title: Other changes

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Christian
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.

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# llm-cli
2+
3+
A lightweight CLI tool for interacting with LLMs from the terminal.
4+
5+
## Features
6+
7+
- **Generate commit messages** — AI-powered conventional commit messages from your staged changes
8+
- **Ask questions** — Get answers from an LLM directly in your terminal
9+
10+
## Installation
11+
12+
### Nix
13+
14+
```bash
15+
nix profile install github:csvenke/llm-cli
16+
```
17+
18+
### Binary releases
19+
20+
Download pre-built binaries from [GitHub Releases](https://github.com/csvenke/llm-cli/releases).
21+
22+
## Usage
23+
24+
### Ask a question
25+
26+
```bash
27+
llm ask "How do I reverse a string in Go?"
28+
```
29+
30+
### Generate a commit message
31+
32+
Stage your changes and run:
33+
34+
```bash
35+
llm commit
36+
```
37+
38+
To amend the previous commit:
39+
40+
```bash
41+
llm commit -a
42+
```
43+
44+
## Configuration
45+
46+
Set one of the following environment variables (checked in order):
47+
48+
| Variable | Description |
49+
|---|---|
50+
| `OPENCODE_ZEN_API_KEY` | OpenCode Zen API key |
51+
| `ANTHROPIC_API_KEY` | Anthropic API key |
52+
| `OPENAI_API_KEY` | OpenAI API key |
53+
54+
## License
55+
56+
[MIT](LICENSE)

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4+
flake-parts.url = "github:hercules-ci/flake-parts";
5+
};
6+
7+
outputs =
8+
inputs@{
9+
self,
10+
flake-parts,
11+
nixpkgs,
12+
...
13+
}:
14+
flake-parts.lib.mkFlake { inherit inputs; } {
15+
systems = nixpkgs.lib.systems.flakeExposed;
16+
perSystem =
17+
{ system, ... }:
18+
let
19+
pkgs = import nixpkgs {
20+
inherit system;
21+
overlays = [
22+
(final: prev: { go = prev.go_1_24; })
23+
];
24+
};
25+
inherit (pkgs) lib callPackage;
26+
version = self.shortRev or self.dirtyShortRev or "snapshot";
27+
scripts = lib.packagesFromDirectoryRecursive {
28+
inherit callPackage;
29+
directory = ./nix/scripts;
30+
};
31+
llm-cli = callPackage ./nix/package.nix {
32+
inherit version;
33+
};
34+
shell = callPackage ./nix/shell.nix { };
35+
in
36+
{
37+
packages = scripts // {
38+
default = llm-cli;
39+
};
40+
devShells = {
41+
default = shell;
42+
};
43+
};
44+
};
45+
}

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module llm
2+
3+
go 1.24.4

0 commit comments

Comments
 (0)