Skip to content

Commit 64a4820

Browse files
committed
initial
0 parents  commit 64a4820

Some content is hidden

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

53 files changed

+13679
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Release to Homebrew
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: release-homebrew-main
13+
cancel-in-progress: false
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
env:
19+
HOMEBREW_TAP_OWNER: ${{ vars.HOMEBREW_TAP_OWNER || github.repository_owner }}
20+
HOMEBREW_TAP_NAME: ${{ vars.HOMEBREW_TAP_NAME || 'sprout' }}
21+
HOMEBREW_TAP_BRANCH: ${{ vars.HOMEBREW_TAP_BRANCH || 'main' }}
22+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Go
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version-file: apps/sprout/go.mod
33+
cache: true
34+
cache-dependency-path: apps/sprout/go.sum
35+
36+
- name: Test
37+
run: go test ./...
38+
working-directory: apps/sprout
39+
40+
- name: Determine release tag
41+
id: tag
42+
shell: bash
43+
run: |
44+
set -euo pipefail
45+
46+
head_tag="$(git tag --points-at HEAD | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n1 || true)"
47+
if [[ -n "$head_tag" ]]; then
48+
echo "tag=$head_tag" >> "$GITHUB_OUTPUT"
49+
echo "create_tag=false" >> "$GITHUB_OUTPUT"
50+
exit 0
51+
fi
52+
53+
latest_tag=""
54+
while IFS= read -r candidate; do
55+
if [[ "$candidate" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
56+
latest_tag="$candidate"
57+
break
58+
fi
59+
done < <(git tag --sort=-v:refname)
60+
61+
if [[ -z "$latest_tag" ]]; then
62+
next_tag="v0.1.0"
63+
else
64+
[[ "$latest_tag" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
65+
major="${BASH_REMATCH[1]}"
66+
minor="${BASH_REMATCH[2]}"
67+
patch="${BASH_REMATCH[3]}"
68+
next_tag="v${major}.${minor}.$((patch + 1))"
69+
fi
70+
71+
echo "tag=$next_tag" >> "$GITHUB_OUTPUT"
72+
echo "create_tag=true" >> "$GITHUB_OUTPUT"
73+
74+
- name: Validate Homebrew tap token
75+
if: env.HOMEBREW_TAP_GITHUB_TOKEN == ''
76+
run: |
77+
echo "HOMEBREW_TAP_GITHUB_TOKEN is required to update the Homebrew tap." >&2
78+
exit 1
79+
80+
- name: Create and push tag
81+
if: steps.tag.outputs.create_tag == 'true'
82+
shell: bash
83+
run: |
84+
set -euo pipefail
85+
tag="${{ steps.tag.outputs.tag }}"
86+
git config user.name "github-actions[bot]"
87+
git config user.email "github-actions[bot]@users.noreply.github.com"
88+
git tag -a "$tag" -m "Release $tag"
89+
git push origin "$tag"
90+
91+
- name: Run GoReleaser
92+
uses: goreleaser/goreleaser-action@v6
93+
with:
94+
distribution: goreleaser
95+
version: "~> v2"
96+
args: release --clean
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Go
2+
*.test
3+
*.out
4+
5+
# Web
6+
apps/web/node_modules/
7+
apps/web/dist/

.goreleaser.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
project_name: sprout
2+
3+
builds:
4+
- id: sprout
5+
main: ./apps/sprout/cmd/sprout
6+
binary: sprout
7+
env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- darwin
11+
- linux
12+
goarch:
13+
- amd64
14+
- arm64
15+
ldflags:
16+
- -s -w -X sprout/internal/sprout.Version={{ .Version }}
17+
18+
archives:
19+
- id: binaries
20+
builds:
21+
- sprout
22+
format: tar.gz
23+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
24+
25+
checksum:
26+
name_template: checksums.txt
27+
28+
changelog:
29+
use: github-native
30+
31+
brews:
32+
- name: sprout
33+
commit_author:
34+
name: github-actions[bot]
35+
email: github-actions[bot]@users.noreply.github.com
36+
repository:
37+
owner: "{{ .Env.HOMEBREW_TAP_OWNER }}"
38+
name: "{{ .Env.HOMEBREW_TAP_NAME }}"
39+
branch: "{{ .Env.HOMEBREW_TAP_BRANCH }}"
40+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
41+
directory: Formula
42+
homepage: "https://github.com/{{ .Env.GITHUB_REPOSITORY }}"
43+
description: "Git worktree manager with terminal UI and tmux workflows."
44+
install: |
45+
bin.install "sprout"
46+
test: |
47+
system "#{bin}/sprout", "version"

AGENTS.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# AGENTS.md
2+
3+
Guidance for AI coding agents and automation working in this repository.
4+
5+
## Scope
6+
7+
- This file applies to the whole repo unless a nested `AGENTS.md` overrides it for a subdirectory.
8+
9+
## Repository Map
10+
11+
- `apps/sprout`: Go CLI/TUI application (primary product code).
12+
- `apps/web`: Documentation site (Docusaurus).
13+
- `Makefile`: Common dev/build/docs commands.
14+
- `go.work`: Go workspace config for monorepo development.
15+
16+
## Expected Workflow
17+
18+
1. Read the relevant README/docs before editing.
19+
2. Keep changes focused and minimal for the task.
20+
3. Run the smallest useful validation (tests/build/lint) before finishing.
21+
4. Report what changed, what was validated, and any gaps.
22+
23+
## Build and Test Commands
24+
25+
- `make sprout-build`: Build the CLI binary.
26+
- `cd apps/sprout && go test ./...`: Run Go tests.
27+
- `make docs-generate`: Regenerate auto-generated docs.
28+
- `make docs-dev`: Run docs dev server.
29+
- `make docs-build`: Build docs for production.
30+
- `make help`: List available make targets.
31+
32+
## Coding Standards
33+
34+
- Prefer idiomatic, readable Go in `apps/sprout`.
35+
- Avoid unrelated refactors unless requested.
36+
- Preserve existing patterns and naming in touched files.
37+
- Keep docs changes in sync with behavior changes.
38+
- Do not add license headers unless requested.
39+
40+
## Safety Rules
41+
42+
- Never run destructive git commands (e.g. `git reset --hard`) unless explicitly requested.
43+
- Do not revert user-authored unrelated changes.
44+
- If unexpected modifications appear, stop and ask before proceeding.
45+
46+
## Completion Checklist
47+
48+
- Code compiles or changed docs build cleanly.
49+
- Relevant tests/checks were run (or clearly explain why not).
50+
- Any follow-up work is called out explicitly.

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.PHONY: help docs-dev docs-build docs-generate docs-serve sprout-build
2+
3+
help:
4+
@echo "Sprout Development Commands"
5+
@echo ""
6+
@echo "Documentation:"
7+
@echo " make docs-dev - Generate docs and start dev server"
8+
@echo " make docs-build - Build production documentation site"
9+
@echo " make docs-generate - Generate auto-generated documentation"
10+
@echo " make docs-serve - Serve production build locally"
11+
@echo ""
12+
@echo "Sprout:"
13+
@echo " make sprout-build - Build sprout binary"
14+
@echo " make sprout-install - Build and install sprout to /usr/local/bin"
15+
16+
docs-dev:
17+
cd apps/web && bun run dev
18+
19+
docs-build:
20+
cd apps/web && bun run build
21+
22+
docs-generate:
23+
cd apps/web && bun run docs:generate
24+
25+
docs-serve:
26+
cd apps/web && bun serve
27+
28+
sprout-build:
29+
cd apps/sprout && go build -o ../../sprout ./cmd/sprout
30+
31+
sprout-install: sprout-build
32+
sudo mv sprout /usr/local/bin/sprout
33+
@echo "Sprout installed to /usr/local/bin/sprout"

0 commit comments

Comments
 (0)