commitstash 0.3.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.3.0 → commitstash-0.5.0}/.github/workflows/ci.yml +1 -1
- {commitstash-0.3.0 → commitstash-0.5.0}/.gitignore +3 -0
- {commitstash-0.3.0 → commitstash-0.5.0}/AGENTS.md +10 -10
- {commitstash-0.3.0 → commitstash-0.5.0}/CHANGELOG.md +19 -1
- commitstash-0.5.0/CONTRIBUTING.md +85 -0
- {commitstash-0.3.0 → commitstash-0.5.0}/PKG-INFO +60 -59
- {commitstash-0.3.0 → commitstash-0.5.0}/README.md +55 -55
- commitstash-0.5.0/commitstash/__init__.py +1 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/changelog.py +1 -1
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/cli.py +34 -22
- commitstash-0.5.0/commitstash/config.py +59 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/git.py +17 -3
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/llm.py +0 -1
- commitstash-0.5.0/commitstash/onboarding.py +139 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/providers.py +3 -3
- {commitstash-0.3.0 → commitstash-0.5.0}/pyproject.toml +6 -5
- {commitstash-0.3.0 → commitstash-0.5.0}/tests/conftest.py +1 -1
- {commitstash-0.3.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.3.0 → commitstash-0.5.0}/tests/test_explain.py +2 -2
- {commitstash-0.3.0 → commitstash-0.5.0}/tests/test_git.py +12 -12
- {commitstash-0.3.0 → commitstash-0.5.0}/tests/test_llm.py +2 -2
- commitstash-0.5.0/tests/test_onboarding.py +53 -0
- {commitstash-0.3.0 → commitstash-0.5.0}/tests/test_pr.py +4 -4
- {commitstash-0.3.0 → commitstash-0.5.0}/tests/test_review.py +2 -2
- {commitstash-0.3.0 → commitstash-0.5.0}/tests/test_secrets.py +1 -1
- {commitstash-0.3.0 → commitstash-0.5.0}/tests/test_split.py +9 -11
- commitstash-0.3.0/autocommit/__init__.py +0 -1
- commitstash-0.3.0/autocommit/config.py +0 -35
- commitstash-0.3.0/tests/test_cli.py +0 -135
- commitstash-0.3.0/tests/test_config.py +0 -38
- {commitstash-0.3.0 → commitstash-0.5.0}/.github/workflows/publish.yml +0 -0
- {commitstash-0.3.0 → commitstash-0.5.0}/.pre-commit-config.yaml +0 -0
- {commitstash-0.3.0 → commitstash-0.5.0}/LICENSE +0 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/explain.py +0 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/pr.py +0 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/review.py +0 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/secrets.py +0 -0
- {commitstash-0.3.0/autocommit → commitstash-0.5.0/commitstash}/split.py +0 -0
- {commitstash-0.3.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,10 +1,28 @@
|
|
|
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
|
+
|
|
11
|
+
## v0.4.0 (2026-07-19)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
- **onboarding:** add first-run setup flow
|
|
16
|
+
|
|
17
|
+
### Chores
|
|
18
|
+
|
|
19
|
+
- add author metadata to pyproject
|
|
20
|
+
|
|
3
21
|
## v0.3.0 (2026-07-18)
|
|
4
22
|
|
|
5
23
|
### Features
|
|
6
24
|
|
|
7
|
-
- initial
|
|
25
|
+
- initial commitstash CLI — AI-powered git commit message generator
|
|
8
26
|
- **secrets:** add regex-based secret scanner
|
|
9
27
|
- **llm:** add ollama provider and shared completion dispatch
|
|
10
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,10 @@
|
|
|
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
|
+
Author-email: Surya Pratap Singh <suryasps20@gmail.com>
|
|
7
8
|
License: MIT
|
|
8
9
|
License-File: LICENSE
|
|
9
10
|
Keywords: ai,cli,commit,developer-tools,git
|
|
@@ -28,7 +29,7 @@ Description-Content-Type: text/markdown
|
|
|
28
29
|
|
|
29
30
|
<div align="center">
|
|
30
31
|
|
|
31
|
-
#
|
|
32
|
+
# commitstash
|
|
32
33
|
|
|
33
34
|
**AI-powered git commit message generator — reads your staged diff, writes the commit for you**
|
|
34
35
|
|
|
@@ -49,18 +50,18 @@ Writing good commit messages is tedious. Most developers either:
|
|
|
49
50
|
|
|
50
51
|
## The Solution
|
|
51
52
|
|
|
52
|
-
`
|
|
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.
|
|
53
54
|
|
|
54
55
|
It does more than messages:
|
|
55
56
|
|
|
56
57
|
- **Blocks secrets** — every commit is scanned for API keys, tokens, and credentials in your staged changes. Leaks are stopped before they land.
|
|
57
|
-
- **Reviews your diff** — `
|
|
58
|
-
- **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.
|
|
59
60
|
|
|
60
61
|
```
|
|
61
62
|
git add orders/views.py orders/serializers.py
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
commitstash
|
|
64
65
|
```
|
|
65
66
|
|
|
66
67
|
```
|
|
@@ -108,7 +109,7 @@ Add the export to your `~/.zshrc` or `~/.bashrc` so it persists.
|
|
|
108
109
|
git add <files>
|
|
109
110
|
|
|
110
111
|
# Generate and commit
|
|
111
|
-
|
|
112
|
+
commitstash
|
|
112
113
|
```
|
|
113
114
|
|
|
114
115
|
That's it. Press Enter to accept, `e` to edit, `r` to regenerate, `q` to quit.
|
|
@@ -119,26 +120,26 @@ That's it. Press Enter to accept, `e` to edit, `r` to regenerate, `q` to quit.
|
|
|
119
120
|
|
|
120
121
|
```bash
|
|
121
122
|
# Stage everything, then generate
|
|
122
|
-
|
|
123
|
+
commitstash -a
|
|
123
124
|
|
|
124
125
|
# Auto-accept without prompting (CI / hooks)
|
|
125
|
-
|
|
126
|
+
commitstash -a -y
|
|
126
127
|
|
|
127
128
|
# Change style for one commit
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
commitstash --style simple
|
|
130
|
+
commitstash --style angular
|
|
130
131
|
|
|
131
132
|
# Add emoji prefix (✨ feat, 🐛 fix, ♻️ refactor...)
|
|
132
|
-
|
|
133
|
+
commitstash --emoji
|
|
133
134
|
|
|
134
135
|
# Include a commit body explaining WHY
|
|
135
|
-
|
|
136
|
+
commitstash --body
|
|
136
137
|
|
|
137
138
|
# Switch provider for one commit
|
|
138
|
-
|
|
139
|
+
commitstash --provider openai
|
|
139
140
|
|
|
140
141
|
# No API key — generate offline from the diff
|
|
141
|
-
|
|
142
|
+
commitstash --no-ai
|
|
142
143
|
```
|
|
143
144
|
|
|
144
145
|
---
|
|
@@ -146,12 +147,12 @@ autocommit --no-ai
|
|
|
146
147
|
## No-AI (offline) mode
|
|
147
148
|
|
|
148
149
|
Don't have an API key, working offline, or just want zero-cost commits? Add `--no-ai`
|
|
149
|
-
and `
|
|
150
|
+
and `commitstash` builds the message locally by analyzing your staged diff — no network,
|
|
150
151
|
no key, no SDK required.
|
|
151
152
|
|
|
152
153
|
```bash
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
commitstash --no-ai # generate offline
|
|
155
|
+
commitstash --no-ai -a -y # stage all, offline, auto-accept
|
|
155
156
|
```
|
|
156
157
|
|
|
157
158
|
It inspects the diff to pick a sensible message:
|
|
@@ -172,14 +173,14 @@ reader — press `e` to tweak anything before committing.
|
|
|
172
173
|
Make it the default so you never pass the flag:
|
|
173
174
|
|
|
174
175
|
```bash
|
|
175
|
-
|
|
176
|
+
commitstash configure # choose "local" when prompted for provider
|
|
176
177
|
```
|
|
177
178
|
|
|
178
179
|
---
|
|
179
180
|
|
|
180
181
|
## Secret Scanning
|
|
181
182
|
|
|
182
|
-
Before every commit, `
|
|
183
|
+
Before every commit, `commitstash` scans your **staged changes** for secrets — AWS keys,
|
|
183
184
|
GitHub tokens, Anthropic/OpenAI keys, Slack/Stripe/Google keys, private key blocks, JWTs,
|
|
184
185
|
and hardcoded `password`/`api_key`/`token` assignments. If it finds one, the commit is
|
|
185
186
|
blocked and the finding is shown with the secret redacted:
|
|
@@ -198,10 +199,10 @@ Run the scan on its own — it exits non-zero when anything is found, so it drop
|
|
|
198
199
|
a pre-commit hook or CI step:
|
|
199
200
|
|
|
200
201
|
```bash
|
|
201
|
-
|
|
202
|
+
commitstash scan
|
|
202
203
|
```
|
|
203
204
|
|
|
204
|
-
Turn the automatic commit-time gate off in `
|
|
205
|
+
Turn the automatic commit-time gate off in `commitstash configure` (or set `"scan_secrets": false`
|
|
205
206
|
in your config).
|
|
206
207
|
|
|
207
208
|
---
|
|
@@ -211,8 +212,8 @@ in your config).
|
|
|
211
212
|
Get a review of your staged diff before you commit:
|
|
212
213
|
|
|
213
214
|
```bash
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
commitstash review # AI review with your configured provider
|
|
216
|
+
commitstash review --no-ai # offline pattern checks only
|
|
216
217
|
```
|
|
217
218
|
|
|
218
219
|
With an AI provider it looks for bugs, security issues, and clear mistakes in the changed
|
|
@@ -227,9 +228,9 @@ and tells you it isn't a correctness review.
|
|
|
227
228
|
Draft a PR title and description from the commits and diff on your current branch:
|
|
228
229
|
|
|
229
230
|
```bash
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
|
233
234
|
```
|
|
234
235
|
|
|
235
236
|
Output is a title plus a `## Summary` / `## Changes` / `## Testing` markdown body — paste it
|
|
@@ -252,14 +253,14 @@ straight into GitHub.
|
|
|
252
253
|
Run the interactive setup to save your preferences:
|
|
253
254
|
|
|
254
255
|
```bash
|
|
255
|
-
|
|
256
|
+
commitstash configure
|
|
256
257
|
```
|
|
257
258
|
|
|
258
|
-
Preferences are saved to `~/.
|
|
259
|
+
Preferences are saved to `~/.commitstash/config.json`.
|
|
259
260
|
API keys are **never** written to disk — always read from environment variables.
|
|
260
261
|
|
|
261
262
|
<details>
|
|
262
|
-
<summary>Manual config (~/.
|
|
263
|
+
<summary>Manual config (~/.commitstash/config.json)</summary>
|
|
263
264
|
|
|
264
265
|
```json
|
|
265
266
|
{
|
|
@@ -290,12 +291,12 @@ API keys are **never** written to disk — always read from environment variable
|
|
|
290
291
|
|
|
291
292
|
Switch permanently:
|
|
292
293
|
```bash
|
|
293
|
-
|
|
294
|
+
commitstash configure # select openai when prompted
|
|
294
295
|
```
|
|
295
296
|
|
|
296
297
|
Switch for one commit:
|
|
297
298
|
```bash
|
|
298
|
-
|
|
299
|
+
commitstash -p openai
|
|
299
300
|
```
|
|
300
301
|
|
|
301
302
|
### Ollama (local LLM)
|
|
@@ -306,8 +307,8 @@ Run a real model on your own machine — no API key, no network calls off-box:
|
|
|
306
307
|
ollama serve
|
|
307
308
|
ollama pull llama3.2
|
|
308
309
|
|
|
309
|
-
|
|
310
|
-
|
|
310
|
+
commitstash -p ollama # one commit
|
|
311
|
+
commitstash configure # choose "ollama"; set model + host
|
|
311
312
|
```
|
|
312
313
|
|
|
313
314
|
Model and host are configurable (`ollama_model`, `ollama_host`).
|
|
@@ -316,10 +317,10 @@ Model and host are configurable (`ollama_model`, `ollama_host`).
|
|
|
316
317
|
|
|
317
318
|
## Git Hook
|
|
318
319
|
|
|
319
|
-
Install `
|
|
320
|
+
Install `commitstash` as a `prepare-commit-msg` hook so every `git commit` auto-generates a message:
|
|
320
321
|
|
|
321
322
|
```bash
|
|
322
|
-
|
|
323
|
+
commitstash install-hook
|
|
323
324
|
```
|
|
324
325
|
|
|
325
326
|
To uninstall:
|
|
@@ -331,13 +332,13 @@ rm .git/hooks/prepare-commit-msg
|
|
|
331
332
|
|
|
332
333
|
## Commit Splitting
|
|
333
334
|
|
|
334
|
-
Staged everything at once? `
|
|
335
|
+
Staged everything at once? `commitstash split` clusters the staged files into
|
|
335
336
|
logical commits — source changes by scope, then tests, docs, and config — and
|
|
336
337
|
commits each group with its own generated message:
|
|
337
338
|
|
|
338
339
|
```
|
|
339
340
|
git add .
|
|
340
|
-
|
|
341
|
+
commitstash split
|
|
341
342
|
|
|
342
343
|
Proposed split (3 commits, AI grouping)
|
|
343
344
|
|
|
@@ -368,19 +369,19 @@ silently dragging unstaged work into a commit.
|
|
|
368
369
|
|
|
369
370
|
```bash
|
|
370
371
|
# Plain-language explanation of the staged diff — what, why, impact, risk
|
|
371
|
-
|
|
372
|
+
commitstash explain
|
|
372
373
|
|
|
373
374
|
# Changelog section from conventional commits since the last tag
|
|
374
|
-
|
|
375
|
+
commitstash changelog
|
|
375
376
|
|
|
376
377
|
# ...or a labelled release, prepended to CHANGELOG.md
|
|
377
|
-
|
|
378
|
+
commitstash changelog --label v0.3.0 --write
|
|
378
379
|
```
|
|
379
380
|
|
|
380
381
|
`changelog` is deliberately deterministic — the same history always produces
|
|
381
382
|
the same changelog, so it needs no API key and works in CI.
|
|
382
383
|
|
|
383
|
-
`
|
|
384
|
+
`commitstash` also reads your recent commit history when generating messages,
|
|
384
385
|
so suggestions match the tone and scope conventions your repo already uses.
|
|
385
386
|
|
|
386
387
|
---
|
|
@@ -391,7 +392,7 @@ Backends are pluggable. Anything that can complete a prompt can drive every
|
|
|
391
392
|
feature — subclass, register, done:
|
|
392
393
|
|
|
393
394
|
```python
|
|
394
|
-
from
|
|
395
|
+
from commitstash.providers import LLMProvider, register
|
|
395
396
|
|
|
396
397
|
class GroqProvider(LLMProvider):
|
|
397
398
|
name = "groq"
|
|
@@ -408,19 +409,19 @@ register(GroqProvider())
|
|
|
408
409
|
|
|
409
410
|
| Command | Description |
|
|
410
411
|
|---|---|
|
|
411
|
-
| `
|
|
412
|
-
| `
|
|
413
|
-
| `
|
|
414
|
-
| `
|
|
415
|
-
| `
|
|
416
|
-
| `
|
|
417
|
-
| `
|
|
418
|
-
| `
|
|
419
|
-
| `
|
|
420
|
-
| `
|
|
421
|
-
| `
|
|
422
|
-
| `
|
|
423
|
-
| `
|
|
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 |
|
|
424
425
|
|
|
425
426
|
---
|
|
426
427
|
|