Add TUI add and preview commands

Use charmbracelet/huh for an interactive add flow. Add a preview
subcommand to enter/exit per-project pre-release tags. Move stamp.toml
into .stamp/ and add ConfigPath helper. Prefer --snapshot then project
PreTag when computing versions and promote bumps to pre-release when
appropriate. Export CurrentVersion and add required TUI deps to go.mod.
This commit is contained in:
Thomas
2026-03-12 22:59:20 +01:00
parent fb347eaa54
commit 8049c505a0
12 changed files with 323 additions and 87 deletions

View File

@@ -32,7 +32,7 @@ go build -o bin/stamp ./cmd/stamp
## Quick Start
### 1. Create `stamp.toml` at the root of your repository
### 1. Create `.stamp/stamp.toml`
```toml
[[projects]]
@@ -46,6 +46,8 @@ version = "0.1.0"
artifacts = ["dist/my-app-*"]
```
Because `stamp.toml` lives inside `.stamp/`, git will track the directory without needing a `.gitignore` file in it.
See [`examples/stamp.toml`](examples/stamp.toml) for a fully annotated example.
### 2. Add a stamp file when making a change
@@ -108,7 +110,7 @@ Shows all pending stamp files and the projected next version for each project.
### `stamp version`
Consumes all pending stamp files, bumps versions in `stamp.toml`, and prepends a new entry to each project's `CHANGELOG.md`. Then stages and commits the changes via git.
Consumes all pending stamp files, bumps versions in `.stamp/stamp.toml`, and prepends a new entry to each project's `CHANGELOG.md`. Then stages and commits the changes via git.
| Flag | Description |
|------|-------------|
@@ -142,7 +144,7 @@ Posts or updates a PR comment summarising pending stamps. Useful in CI to remind
## Stamp File Format
Stamp files live in `.stamp/` and use Markdown with YAML or TOML frontmatter.
Stamp files live in `.stamp/` alongside `stamp.toml`, and use Markdown with YAML or TOML frontmatter.
### YAML (default)
@@ -181,13 +183,12 @@ Short description.
| `prepatch` | Pre-release patch — `1.2.3``1.2.4-alpha.0` |
| `prerelease` | Increment pre-release — `1.2.4-rc.0``1.2.4-rc.1` |
## Configuration Reference (`stamp.toml`)
## Configuration Reference (`.stamp/stamp.toml`)
```toml
# Global settings (all optional)
[config]
base_branch = "main" # Base branch for PR change detection (default: main)
changeset_dir = ".stamp" # Directory for stamp files (default: .stamp)
base_branch = "main" # Base branch for PR change detection (default: main)
[[projects]]
name = "my-app"
@@ -209,8 +210,8 @@ changelog = "CHANGELOG.md" # Relative to path (default: CHANGELOG.md)
| Variable | Purpose |
|----------|---------|
| `STAMP_REPO` | Repository slug `owner/repo` — required for `publish` and `comment` |
| `GITHUB_TOKEN` | GitHub personal access token for releases and PR comments |
| `GITEA_TOKEN` | Gitea access token |
| `GITHUB_TOKEN` | GitHub token for releases and PR comments — automatically provided by the GitHub Actions runner; no manual setup needed |
| `GITEA_TOKEN` | Gitea access token **must be created manually** (Gitea Actions does not inject one automatically); create a token in your Gitea account settings and store it as a repository secret |
| `GITEA_BASE_URL` | Gitea instance URL (e.g. `https://gitea.example.com`) — also enables Gitea mode |
## CI Integration
@@ -306,4 +307,4 @@ stamp/
## License
MIT
MIT