Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install Go tools
run: |
go install golang.org/x/tools/cmd/goimports@latest
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v2.12.2
- uses: pre-commit/action@v3.0.1
55 changes: 55 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 26.3.1
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
hooks:
- id: prettier
types_or: [javascript, jsx, ts, tsx, json, css, scss, less, html, markdown, yaml]
- repo: local
hooks:
- id: gofmt
name: gofmt
entry: gofmt -w
language: system
types: [go]
- id: goimports
name: goimports
entry: goimports -w
language: system
types: [go]
- id: go-vet
name: go vet
entry: go vet ./...
language: system
types: [go]
pass_filenames: false
- id: go-build
name: go build
entry: go build -o /dev/null ./...
language: system
types: [go]
pass_filenames: false
- id: go-mod-tidy
name: go mod tidy
entry: go mod tidy
language: system
pass_filenames: false
files: '(\.go|go\.mod|go\.sum)$'
- id: golangci-lint
name: golangci-lint
entry: golangci-lint run
language: system
types: [go]
pass_filenames: false
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 100,
"proseWrap": "always"
}
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# flow

A small Git/GitHub workflow helper.

## Prerequisites

- [Go](https://go.dev/dl/) 1.22+
- [GitHub CLI](https://cli.github.com/) (`gh`), authenticated via `gh auth login`

## Install

Clone the repo and install the binary into your `GOBIN` (typically `~/go/bin`):

```sh
git clone https://github.com/plinehan/flow.git
cd flow
go install .
```

Make sure `~/go/bin` is on your `PATH`:

```sh
export PATH="$PATH:$(go env GOBIN):$(go env GOPATH)/bin"
```

## Development

Install [pre-commit](https://pre-commit.com/) and enable the hooks:

```sh
brew install pre-commit # or: pip install pre-commit
pre-commit install
```

This runs `gofmt`, `go vet`, and `go build` on every commit.

## Commands

- `flow branch [name]` — create and check out a new branch (`<user>/<name>` or a random slug)
- `flow create [-v]` — push the current branch and open a PR (`-v` opens it in the browser)
- `flow view` — open the current branch's PR in the browser
- `flow merge` — auto-squash-merge the current branch's PR, then return to the default branch
- `flow rebase` — rebase the current branch onto the latest default branch
- `flow push` — force-push the current branch (refused on the default branch)
- `flow clean` — delete local branches whose PRs have been merged
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ func run(name string, args ...string) {
}
}


func main() {
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "usage: flow <command> [args]\n")
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[project]
name = "www"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.14"
dependencies = []

[dependency-groups]
dev = [
"pre-commit>=4.5.1",
]
142 changes: 142 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading