Skip to content

Commit fd424cb

Browse files
committed
initial
0 parents  commit fd424cb

Some content is hidden

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

54 files changed

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

Formula/sprout.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# typed: false
2+
# frozen_string_literal: true
3+
4+
# This file was generated by GoReleaser. DO NOT EDIT.
5+
class Sprout < Formula
6+
desc "Git worktree manager with terminal UI and tmux workflows."
7+
homepage "https://github.com/joegrabski/sprout"
8+
version "0.1.3"
9+
10+
on_macos do
11+
if Hardware::CPU.intel?
12+
url "https://github.com/joegrabski/sprout/releases/download/v0.1.3/sprout_0.1.3_darwin_amd64.tar.gz"
13+
sha256 "d5a97e66e29f47244179d64db9d0ec13ac2ff985870887d6107463760f028c93"
14+
15+
def install
16+
bin.install "sprout"
17+
end
18+
end
19+
if Hardware::CPU.arm?
20+
url "https://github.com/joegrabski/sprout/releases/download/v0.1.3/sprout_0.1.3_darwin_arm64.tar.gz"
21+
sha256 "692123f62328e4f3d5ea1b8a40424881ede3ed5bcc6fa60e201d08ee5540e491"
22+
23+
def install
24+
bin.install "sprout"
25+
end
26+
end
27+
end
28+
29+
on_linux do
30+
if Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
31+
url "https://github.com/joegrabski/sprout/releases/download/v0.1.3/sprout_0.1.3_linux_amd64.tar.gz"
32+
sha256 "8d798c958b700a5521be33b49a4b47ac1407f5a0a5ddf3010fa82233adea3afd"
33+
def install
34+
bin.install "sprout"
35+
end
36+
end
37+
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
38+
url "https://github.com/joegrabski/sprout/releases/download/v0.1.3/sprout_0.1.3_linux_arm64.tar.gz"
39+
sha256 "c68a0e9d61ab23797843c37305279a7545e9323a7636902c44c427bbb529f550"
40+
def install
41+
bin.install "sprout"
42+
end
43+
end
44+
end
45+
46+
test do
47+
system "#{bin}/sprout", "version"
48+
end
49+
end

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)