commitstash 0.4.0__tar.gz → 0.5.0__tar.gz
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.
- commitstash-0.5.0/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- commitstash-0.5.0/.github/ISSUE_TEMPLATE/config.yml +1 -0
- commitstash-0.5.0/.github/ISSUE_TEMPLATE/feature_request.md +26 -0
- commitstash-0.5.0/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- {commitstash-0.4.0 → commitstash-0.5.0}/.github/workflows/ci.yml +1 -1
- {commitstash-0.4.0 → commitstash-0.5.0}/.gitignore +3 -0
- {commitstash-0.4.0 → commitstash-0.5.0}/AGENTS.md +10 -10
- {commitstash-0.4.0 → commitstash-0.5.0}/CHANGELOG.md +9 -1
- commitstash-0.5.0/CONTRIBUTING.md +85 -0
- {commitstash-0.4.0 → commitstash-0.5.0}/PKG-INFO +59 -59
- {commitstash-0.4.0 → commitstash-0.5.0}/README.md +55 -55
- commitstash-0.5.0/commitstash/__init__.py +1 -0
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/changelog.py +1 -1
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/cli.py +21 -21
- commitstash-0.5.0/commitstash/config.py +59 -0
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/git.py +17 -3
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/llm.py +0 -1
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/onboarding.py +3 -3
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/providers.py +3 -3
- {commitstash-0.4.0 → commitstash-0.5.0}/pyproject.toml +5 -5
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/conftest.py +1 -1
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_changelog.py +2 -3
- commitstash-0.5.0/tests/test_cli.py +135 -0
- commitstash-0.5.0/tests/test_config.py +97 -0
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_explain.py +2 -2
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_git.py +12 -12
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_llm.py +2 -2
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_onboarding.py +3 -3
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_pr.py +4 -4
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_review.py +2 -2
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_secrets.py +1 -1
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/test_split.py +9 -11
- commitstash-0.4.0/autocommit/__init__.py +0 -1
- commitstash-0.4.0/autocommit/config.py +0 -35
- commitstash-0.4.0/tests/test_cli.py +0 -135
- commitstash-0.4.0/tests/test_config.py +0 -38
- {commitstash-0.4.0 → commitstash-0.5.0}/.github/workflows/publish.yml +0 -0
- {commitstash-0.4.0 → commitstash-0.5.0}/.pre-commit-config.yaml +0 -0
- {commitstash-0.4.0 → commitstash-0.5.0}/LICENSE +0 -0
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/explain.py +0 -0
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/pr.py +0 -0
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/review.py +0 -0
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/secrets.py +0 -0
- {commitstash-0.4.0/autocommit → commitstash-0.5.0/commitstash}/split.py +0 -0
- {commitstash-0.4.0 → commitstash-0.5.0}/tests/__init__.py +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Something isn't working as expected
|
|
4
|
+
title: "bug: "
|
|
5
|
+
labels: bug
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## What happened
|
|
9
|
+
|
|
10
|
+
<!-- A clear description of the bug. -->
|
|
11
|
+
|
|
12
|
+
## Steps to reproduce
|
|
13
|
+
|
|
14
|
+
1.
|
|
15
|
+
2.
|
|
16
|
+
3.
|
|
17
|
+
|
|
18
|
+
## Expected behavior
|
|
19
|
+
|
|
20
|
+
<!-- What you expected instead. -->
|
|
21
|
+
|
|
22
|
+
## Command & output
|
|
23
|
+
|
|
24
|
+
<!-- The commitstash command you ran and its output. Redact any secrets. -->
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
$ commitstash ...
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Environment
|
|
31
|
+
|
|
32
|
+
- commitstash version (`commitstash version`):
|
|
33
|
+
- Install source (PyPI `commitstash` / from source):
|
|
34
|
+
- OS:
|
|
35
|
+
- Python version (`python --version`):
|
|
36
|
+
- LLM provider (anthropic / openai / ollama / local `--no-ai`):
|
|
37
|
+
|
|
38
|
+
## Additional context
|
|
39
|
+
|
|
40
|
+
<!-- Anything else that helps — a minimal repo, git state, config. -->
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
blank_issues_enabled: true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea or improvement
|
|
4
|
+
title: "feat: "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Problem / motivation
|
|
9
|
+
|
|
10
|
+
<!-- What are you trying to do that commitstash doesn't support today? -->
|
|
11
|
+
|
|
12
|
+
## Proposed solution
|
|
13
|
+
|
|
14
|
+
<!-- What you'd like to see. If it's a new command or flag, sketch the usage. -->
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
$ commitstash ...
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Alternatives considered
|
|
21
|
+
|
|
22
|
+
<!-- Other approaches you thought about. -->
|
|
23
|
+
|
|
24
|
+
## Additional context
|
|
25
|
+
|
|
26
|
+
<!-- Is this a new LLM provider, a new command, output formatting, etc.? -->
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Thanks for contributing! Keep this short — see CONTRIBUTING.md for the full guide.
|
|
3
|
+
Use a Conventional Commit-style title, e.g. "feat: add Gemini provider".
|
|
4
|
+
-->
|
|
5
|
+
|
|
6
|
+
## Summary
|
|
7
|
+
|
|
8
|
+
<!-- What does this change and why? -->
|
|
9
|
+
|
|
10
|
+
## Type of change
|
|
11
|
+
|
|
12
|
+
- [ ] Bug fix
|
|
13
|
+
- [ ] New feature
|
|
14
|
+
- [ ] Docs
|
|
15
|
+
- [ ] Refactor / chore
|
|
16
|
+
- [ ] Tests
|
|
17
|
+
|
|
18
|
+
## Testing performed
|
|
19
|
+
|
|
20
|
+
<!-- Commands run and their result. Include CLI output only if it clarifies interactive behavior. -->
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
ruff check .
|
|
24
|
+
mypy commitstash/
|
|
25
|
+
pytest -q
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## User-facing CLI changes
|
|
29
|
+
|
|
30
|
+
<!-- New/changed commands or flags, or "none". -->
|
|
31
|
+
|
|
32
|
+
## Checklist
|
|
33
|
+
|
|
34
|
+
- [ ] Commits follow Conventional Commits (`feat:`, `fix:`, `docs:`, …)
|
|
35
|
+
- [ ] `ruff`, `mypy`, and `pytest` pass locally
|
|
36
|
+
- [ ] Added/updated tests where it makes sense
|
|
37
|
+
- [ ] No secrets or local config committed
|
|
38
|
+
- [ ] Linked any related issue (`Closes #123`)
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
This repository contains a small Python CLI package for generating commit messages from staged diffs.
|
|
6
6
|
|
|
7
|
-
- `
|
|
8
|
-
- `
|
|
9
|
-
- `
|
|
10
|
-
- `
|
|
7
|
+
- `commitstash/cli.py` defines the Click command group, interactive prompts, and subcommands.
|
|
8
|
+
- `commitstash/git.py` wraps git operations such as reading staged files and creating commits.
|
|
9
|
+
- `commitstash/llm.py` builds prompts and calls Anthropic or OpenAI providers.
|
|
10
|
+
- `commitstash/config.py` loads and saves user preferences in `~/.commitstash/config.json`.
|
|
11
11
|
- `README.md` documents user-facing installation, setup, and CLI usage.
|
|
12
12
|
- `pyproject.toml` contains package metadata, dependencies, console script wiring, and Ruff settings.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Tests live in `tests/`, organized by source module as `test_<module>.py`.
|
|
15
15
|
|
|
16
16
|
## Build, Test, and Development Commands
|
|
17
17
|
|
|
@@ -25,12 +25,12 @@ pip install -e ".[dev]"
|
|
|
25
25
|
|
|
26
26
|
Common commands:
|
|
27
27
|
|
|
28
|
-
- `
|
|
29
|
-
- `pytest` runs the test suite
|
|
28
|
+
- `commitstash version` verifies the editable console script is installed.
|
|
29
|
+
- `pytest` runs the test suite.
|
|
30
30
|
- `ruff check .` runs lint checks with the repository line length setting.
|
|
31
31
|
- `python -m build` builds distribution artifacts, if the `build` package is installed.
|
|
32
32
|
|
|
33
|
-
For manual testing, stage a small change in a disposable git repo and run `
|
|
33
|
+
For manual testing, stage a small change in a disposable git repo and run `commitstash`.
|
|
34
34
|
|
|
35
35
|
## Coding Style & Naming Conventions
|
|
36
36
|
|
|
@@ -44,10 +44,10 @@ Use `pytest` for new tests. Place tests under `tests/` and name files `test_<mod
|
|
|
44
44
|
|
|
45
45
|
## Commit & Pull Request Guidelines
|
|
46
46
|
|
|
47
|
-
Recent history uses Conventional Commit-style messages, for example `docs: add README` and `feat: initial
|
|
47
|
+
Recent history uses Conventional Commit-style messages, for example `docs: add README` and `feat: initial commitstash CLI`. Continue using concise prefixes such as `feat:`, `fix:`, `docs:`, `test:`, and `chore:`.
|
|
48
48
|
|
|
49
49
|
Pull requests should include a short summary, testing performed, and any user-facing CLI behavior changes. Link related issues when available. Include terminal output only when it clarifies interactive CLI changes.
|
|
50
50
|
|
|
51
51
|
## Security & Configuration Tips
|
|
52
52
|
|
|
53
|
-
Never commit API keys or generated local config. `ANTHROPIC_API_KEY` and `OPENAI_API_KEY` must stay in environment variables. Do not persist secrets in `~/.
|
|
53
|
+
Never commit API keys or generated local config. `ANTHROPIC_API_KEY` and `OPENAI_API_KEY` must stay in environment variables. Do not persist secrets in `~/.commitstash/config.json` or test fixtures.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.5.0 (2026-09-07)
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- standardize the distribution, command, Python package, configuration path, and documentation as `commitstash`
|
|
8
|
+
- config moves to `~/.commitstash/config.json`; an existing `~/.autocommit/config.json` is
|
|
9
|
+
carried over automatically on first run, so settings and onboarding state survive the upgrade
|
|
10
|
+
|
|
3
11
|
## v0.4.0 (2026-07-19)
|
|
4
12
|
|
|
5
13
|
### Features
|
|
@@ -14,7 +22,7 @@
|
|
|
14
22
|
|
|
15
23
|
### Features
|
|
16
24
|
|
|
17
|
-
- initial
|
|
25
|
+
- initial commitstash CLI — AI-powered git commit message generator
|
|
18
26
|
- **secrets:** add regex-based secret scanner
|
|
19
27
|
- **llm:** add ollama provider and shared completion dispatch
|
|
20
28
|
- **review:** add staged-diff code review module
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Contributing to commitstash
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in improving **commitstash** (published on PyPI as
|
|
4
|
+
[`commitstash`](https://pypi.org/project/commitstash/)) — an AI-powered git
|
|
5
|
+
workflow CLI that writes commit messages, scans for secrets, reviews diffs, and
|
|
6
|
+
drafts PRs from your staged changes.
|
|
7
|
+
|
|
8
|
+
This guide covers the fast path for contributors. For deeper conventions on
|
|
9
|
+
structure, style, and testing, see [`AGENTS.md`](./AGENTS.md).
|
|
10
|
+
|
|
11
|
+
## Development setup
|
|
12
|
+
|
|
13
|
+
Requires **Python 3.9+**.
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/suryaSPS/commitstash.git
|
|
17
|
+
cd commitstash
|
|
18
|
+
|
|
19
|
+
python -m venv .venv
|
|
20
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
21
|
+
|
|
22
|
+
pip install -e ".[dev]" # editable install + dev tooling
|
|
23
|
+
pre-commit install # run lint/type checks on every commit
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Verify the console script is wired up:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
commitstash version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Running the checks
|
|
33
|
+
|
|
34
|
+
CI (`.github/workflows/ci.yml`) runs these across Python 3.9–3.12, so run them
|
|
35
|
+
locally before pushing:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
ruff check . # lint (100-char line length)
|
|
39
|
+
mypy commitstash/ # type-check
|
|
40
|
+
pytest -q # tests
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Making a change
|
|
44
|
+
|
|
45
|
+
1. Branch off `master`: `git checkout -b feat/short-description`.
|
|
46
|
+
2. Make focused commits — this repo **dogfoods itself**, so stage your changes
|
|
47
|
+
and run `commitstash` to generate the message.
|
|
48
|
+
3. Follow [Conventional Commits](https://www.conventionalcommits.org/): prefixes
|
|
49
|
+
like `feat:`, `fix:`, `docs:`, `test:`, `chore:`, `refactor:`. The
|
|
50
|
+
`commitstash changelog` command relies on these to generate release notes.
|
|
51
|
+
4. Add or update tests under `tests/` (`test_<module>.py`). Mock network clients
|
|
52
|
+
and subprocess calls — never require a real API key or make real commits.
|
|
53
|
+
5. Open a PR against `master` using the pull request template.
|
|
54
|
+
|
|
55
|
+
## Adding a new LLM provider
|
|
56
|
+
|
|
57
|
+
Providers live in [`commitstash/providers.py`](./commitstash/providers.py) behind a
|
|
58
|
+
small abstraction, so adding one (e.g. Gemini or Groq) is self-contained:
|
|
59
|
+
|
|
60
|
+
1. Subclass `LLMProvider` and implement `complete(self, prompt, config, max_tokens)`,
|
|
61
|
+
returning the model's text response.
|
|
62
|
+
2. Give it a `name` and register it in the `PROVIDERS` registry (follow how
|
|
63
|
+
`AnthropicProvider`, `OpenAIProvider`, and `OllamaProvider` do it).
|
|
64
|
+
3. If the provider runs locally with no key (like Ollama), add its name to
|
|
65
|
+
`LOCAL_PROVIDERS` in `commitstash/llm.py`.
|
|
66
|
+
4. Add unit tests that mock the client — assert prompt handling and error paths,
|
|
67
|
+
not live network calls.
|
|
68
|
+
|
|
69
|
+
## Reporting bugs & requesting features
|
|
70
|
+
|
|
71
|
+
Use the [issue templates](./.github/ISSUE_TEMPLATE/) — they prompt for the
|
|
72
|
+
version (`commitstash version`), OS, provider, and steps to reproduce, which makes
|
|
73
|
+
triage much faster.
|
|
74
|
+
|
|
75
|
+
## Security
|
|
76
|
+
|
|
77
|
+
Never commit API keys or generated local config. `ANTHROPIC_API_KEY` and
|
|
78
|
+
`OPENAI_API_KEY` belong in environment variables only, never in
|
|
79
|
+
`~/.commitstash/config.json` or test fixtures. If you find a security issue,
|
|
80
|
+
please open a minimal report rather than including real secrets.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
By contributing, you agree that your contributions are licensed under the
|
|
85
|
+
project's [MIT License](./LICENSE).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: commitstash
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: AI-powered git commit message generator — reads your staged diff, writes the commit for you
|
|
5
|
-
Project-URL: Homepage, https://github.com/suryaSPS/
|
|
6
|
-
Project-URL: Issues, https://github.com/suryaSPS/
|
|
5
|
+
Project-URL: Homepage, https://github.com/suryaSPS/commitstash
|
|
6
|
+
Project-URL: Issues, https://github.com/suryaSPS/commitstash/issues
|
|
7
7
|
Author-email: Surya Pratap Singh <suryasps20@gmail.com>
|
|
8
8
|
License: MIT
|
|
9
9
|
License-File: LICENSE
|
|
@@ -29,7 +29,7 @@ Description-Content-Type: text/markdown
|
|
|
29
29
|
|
|
30
30
|
<div align="center">
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# commitstash
|
|
33
33
|
|
|
34
34
|
**AI-powered git commit message generator — reads your staged diff, writes the commit for you**
|
|
35
35
|
|
|
@@ -50,18 +50,18 @@ Writing good commit messages is tedious. Most developers either:
|
|
|
50
50
|
|
|
51
51
|
## The Solution
|
|
52
52
|
|
|
53
|
-
`
|
|
53
|
+
`commitstash` reads your staged diff and generates a precise, conventional commit message using Claude or GPT — in under 3 seconds. No API key? Run it fully offline with `--no-ai` and it builds a message straight from the diff, or point it at a local model with Ollama.
|
|
54
54
|
|
|
55
55
|
It does more than messages:
|
|
56
56
|
|
|
57
57
|
- **Blocks secrets** — every commit is scanned for API keys, tokens, and credentials in your staged changes. Leaks are stopped before they land.
|
|
58
|
-
- **Reviews your diff** — `
|
|
59
|
-
- **Writes your PR** — `
|
|
58
|
+
- **Reviews your diff** — `commitstash review` flags bugs and issues before you commit.
|
|
59
|
+
- **Writes your PR** — `commitstash pr` drafts a title and description from your branch's commits and diff.
|
|
60
60
|
|
|
61
61
|
```
|
|
62
62
|
git add orders/views.py orders/serializers.py
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
commitstash
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
```
|
|
@@ -109,7 +109,7 @@ Add the export to your `~/.zshrc` or `~/.bashrc` so it persists.
|
|
|
109
109
|
git add <files>
|
|
110
110
|
|
|
111
111
|
# Generate and commit
|
|
112
|
-
|
|
112
|
+
commitstash
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
That's it. Press Enter to accept, `e` to edit, `r` to regenerate, `q` to quit.
|
|
@@ -120,26 +120,26 @@ That's it. Press Enter to accept, `e` to edit, `r` to regenerate, `q` to quit.
|
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
122
|
# Stage everything, then generate
|
|
123
|
-
|
|
123
|
+
commitstash -a
|
|
124
124
|
|
|
125
125
|
# Auto-accept without prompting (CI / hooks)
|
|
126
|
-
|
|
126
|
+
commitstash -a -y
|
|
127
127
|
|
|
128
128
|
# Change style for one commit
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
commitstash --style simple
|
|
130
|
+
commitstash --style angular
|
|
131
131
|
|
|
132
132
|
# Add emoji prefix (✨ feat, 🐛 fix, ♻️ refactor...)
|
|
133
|
-
|
|
133
|
+
commitstash --emoji
|
|
134
134
|
|
|
135
135
|
# Include a commit body explaining WHY
|
|
136
|
-
|
|
136
|
+
commitstash --body
|
|
137
137
|
|
|
138
138
|
# Switch provider for one commit
|
|
139
|
-
|
|
139
|
+
commitstash --provider openai
|
|
140
140
|
|
|
141
141
|
# No API key — generate offline from the diff
|
|
142
|
-
|
|
142
|
+
commitstash --no-ai
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
---
|
|
@@ -147,12 +147,12 @@ autocommit --no-ai
|
|
|
147
147
|
## No-AI (offline) mode
|
|
148
148
|
|
|
149
149
|
Don't have an API key, working offline, or just want zero-cost commits? Add `--no-ai`
|
|
150
|
-
and `
|
|
150
|
+
and `commitstash` builds the message locally by analyzing your staged diff — no network,
|
|
151
151
|
no key, no SDK required.
|
|
152
152
|
|
|
153
153
|
```bash
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
commitstash --no-ai # generate offline
|
|
155
|
+
commitstash --no-ai -a -y # stage all, offline, auto-accept
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
It inspects the diff to pick a sensible message:
|
|
@@ -173,14 +173,14 @@ reader — press `e` to tweak anything before committing.
|
|
|
173
173
|
Make it the default so you never pass the flag:
|
|
174
174
|
|
|
175
175
|
```bash
|
|
176
|
-
|
|
176
|
+
commitstash configure # choose "local" when prompted for provider
|
|
177
177
|
```
|
|
178
178
|
|
|
179
179
|
---
|
|
180
180
|
|
|
181
181
|
## Secret Scanning
|
|
182
182
|
|
|
183
|
-
Before every commit, `
|
|
183
|
+
Before every commit, `commitstash` scans your **staged changes** for secrets — AWS keys,
|
|
184
184
|
GitHub tokens, Anthropic/OpenAI keys, Slack/Stripe/Google keys, private key blocks, JWTs,
|
|
185
185
|
and hardcoded `password`/`api_key`/`token` assignments. If it finds one, the commit is
|
|
186
186
|
blocked and the finding is shown with the secret redacted:
|
|
@@ -199,10 +199,10 @@ Run the scan on its own — it exits non-zero when anything is found, so it drop
|
|
|
199
199
|
a pre-commit hook or CI step:
|
|
200
200
|
|
|
201
201
|
```bash
|
|
202
|
-
|
|
202
|
+
commitstash scan
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
Turn the automatic commit-time gate off in `
|
|
205
|
+
Turn the automatic commit-time gate off in `commitstash configure` (or set `"scan_secrets": false`
|
|
206
206
|
in your config).
|
|
207
207
|
|
|
208
208
|
---
|
|
@@ -212,8 +212,8 @@ in your config).
|
|
|
212
212
|
Get a review of your staged diff before you commit:
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
commitstash review # AI review with your configured provider
|
|
216
|
+
commitstash review --no-ai # offline pattern checks only
|
|
217
217
|
```
|
|
218
218
|
|
|
219
219
|
With an AI provider it looks for bugs, security issues, and clear mistakes in the changed
|
|
@@ -228,9 +228,9 @@ and tells you it isn't a correctness review.
|
|
|
228
228
|
Draft a PR title and description from the commits and diff on your current branch:
|
|
229
229
|
|
|
230
230
|
```bash
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
commitstash pr # base branch autodetected (origin/HEAD, then main/master)
|
|
232
|
+
commitstash pr --base develop # compare against a specific branch
|
|
233
|
+
commitstash pr --no-ai # assemble from commit subjects, no API key
|
|
234
234
|
```
|
|
235
235
|
|
|
236
236
|
Output is a title plus a `## Summary` / `## Changes` / `## Testing` markdown body — paste it
|
|
@@ -253,14 +253,14 @@ straight into GitHub.
|
|
|
253
253
|
Run the interactive setup to save your preferences:
|
|
254
254
|
|
|
255
255
|
```bash
|
|
256
|
-
|
|
256
|
+
commitstash configure
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
Preferences are saved to `~/.
|
|
259
|
+
Preferences are saved to `~/.commitstash/config.json`.
|
|
260
260
|
API keys are **never** written to disk — always read from environment variables.
|
|
261
261
|
|
|
262
262
|
<details>
|
|
263
|
-
<summary>Manual config (~/.
|
|
263
|
+
<summary>Manual config (~/.commitstash/config.json)</summary>
|
|
264
264
|
|
|
265
265
|
```json
|
|
266
266
|
{
|
|
@@ -291,12 +291,12 @@ API keys are **never** written to disk — always read from environment variable
|
|
|
291
291
|
|
|
292
292
|
Switch permanently:
|
|
293
293
|
```bash
|
|
294
|
-
|
|
294
|
+
commitstash configure # select openai when prompted
|
|
295
295
|
```
|
|
296
296
|
|
|
297
297
|
Switch for one commit:
|
|
298
298
|
```bash
|
|
299
|
-
|
|
299
|
+
commitstash -p openai
|
|
300
300
|
```
|
|
301
301
|
|
|
302
302
|
### Ollama (local LLM)
|
|
@@ -307,8 +307,8 @@ Run a real model on your own machine — no API key, no network calls off-box:
|
|
|
307
307
|
ollama serve
|
|
308
308
|
ollama pull llama3.2
|
|
309
309
|
|
|
310
|
-
|
|
311
|
-
|
|
310
|
+
commitstash -p ollama # one commit
|
|
311
|
+
commitstash configure # choose "ollama"; set model + host
|
|
312
312
|
```
|
|
313
313
|
|
|
314
314
|
Model and host are configurable (`ollama_model`, `ollama_host`).
|
|
@@ -317,10 +317,10 @@ Model and host are configurable (`ollama_model`, `ollama_host`).
|
|
|
317
317
|
|
|
318
318
|
## Git Hook
|
|
319
319
|
|
|
320
|
-
Install `
|
|
320
|
+
Install `commitstash` as a `prepare-commit-msg` hook so every `git commit` auto-generates a message:
|
|
321
321
|
|
|
322
322
|
```bash
|
|
323
|
-
|
|
323
|
+
commitstash install-hook
|
|
324
324
|
```
|
|
325
325
|
|
|
326
326
|
To uninstall:
|
|
@@ -332,13 +332,13 @@ rm .git/hooks/prepare-commit-msg
|
|
|
332
332
|
|
|
333
333
|
## Commit Splitting
|
|
334
334
|
|
|
335
|
-
Staged everything at once? `
|
|
335
|
+
Staged everything at once? `commitstash split` clusters the staged files into
|
|
336
336
|
logical commits — source changes by scope, then tests, docs, and config — and
|
|
337
337
|
commits each group with its own generated message:
|
|
338
338
|
|
|
339
339
|
```
|
|
340
340
|
git add .
|
|
341
|
-
|
|
341
|
+
commitstash split
|
|
342
342
|
|
|
343
343
|
Proposed split (3 commits, AI grouping)
|
|
344
344
|
|
|
@@ -369,19 +369,19 @@ silently dragging unstaged work into a commit.
|
|
|
369
369
|
|
|
370
370
|
```bash
|
|
371
371
|
# Plain-language explanation of the staged diff — what, why, impact, risk
|
|
372
|
-
|
|
372
|
+
commitstash explain
|
|
373
373
|
|
|
374
374
|
# Changelog section from conventional commits since the last tag
|
|
375
|
-
|
|
375
|
+
commitstash changelog
|
|
376
376
|
|
|
377
377
|
# ...or a labelled release, prepended to CHANGELOG.md
|
|
378
|
-
|
|
378
|
+
commitstash changelog --label v0.3.0 --write
|
|
379
379
|
```
|
|
380
380
|
|
|
381
381
|
`changelog` is deliberately deterministic — the same history always produces
|
|
382
382
|
the same changelog, so it needs no API key and works in CI.
|
|
383
383
|
|
|
384
|
-
`
|
|
384
|
+
`commitstash` also reads your recent commit history when generating messages,
|
|
385
385
|
so suggestions match the tone and scope conventions your repo already uses.
|
|
386
386
|
|
|
387
387
|
---
|
|
@@ -392,7 +392,7 @@ Backends are pluggable. Anything that can complete a prompt can drive every
|
|
|
392
392
|
feature — subclass, register, done:
|
|
393
393
|
|
|
394
394
|
```python
|
|
395
|
-
from
|
|
395
|
+
from commitstash.providers import LLMProvider, register
|
|
396
396
|
|
|
397
397
|
class GroqProvider(LLMProvider):
|
|
398
398
|
name = "groq"
|
|
@@ -409,19 +409,19 @@ register(GroqProvider())
|
|
|
409
409
|
|
|
410
410
|
| Command | Description |
|
|
411
411
|
|---|---|
|
|
412
|
-
| `
|
|
413
|
-
| `
|
|
414
|
-
| `
|
|
415
|
-
| `
|
|
416
|
-
| `
|
|
417
|
-
| `
|
|
418
|
-
| `
|
|
419
|
-
| `
|
|
420
|
-
| `
|
|
421
|
-
| `
|
|
422
|
-
| `
|
|
423
|
-
| `
|
|
424
|
-
| `
|
|
412
|
+
| `commitstash` | Generate from staged diff (interactive) |
|
|
413
|
+
| `commitstash -a` | Stage all changes, then generate |
|
|
414
|
+
| `commitstash -y` | Auto-accept first suggestion |
|
|
415
|
+
| `commitstash --no-ai` | Generate offline, no API key needed |
|
|
416
|
+
| `commitstash scan` | Scan staged changes for secrets (exits 1 on findings) |
|
|
417
|
+
| `commitstash review` | Review the staged diff for bugs and issues |
|
|
418
|
+
| `commitstash pr` | Draft a PR title and description for the branch |
|
|
419
|
+
| `commitstash split` | Split staged changes into a series of atomic commits |
|
|
420
|
+
| `commitstash explain` | Explain the staged diff: what, why, impact, risk |
|
|
421
|
+
| `commitstash changelog` | Generate a changelog from conventional commit history |
|
|
422
|
+
| `commitstash configure` | Interactive setup |
|
|
423
|
+
| `commitstash install-hook` | Install as git hook in current repo |
|
|
424
|
+
| `commitstash version` | Show version |
|
|
425
425
|
|
|
426
426
|
---
|
|
427
427
|
|