-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add config file support, rewrite README, automate releases #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Tag and Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: [VERSION] | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| tag-release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Read version | ||
| id: version | ||
| run: echo "version=$(cat VERSION | tr -d '[:space:]')" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Check if tag exists | ||
| id: check | ||
| run: | | ||
| if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then | ||
| echo "exists=true" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "exists=false" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Create tag and release | ||
| if: steps.check.outputs.exists == 'false' | ||
| run: gh release create "v${{ steps.version.outputs.version }}" --generate-notes --title "v${{ steps.version.outputs.version }}" | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| bin/ | ||
| dist/ | ||
| commit-msg.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## What this is | ||
|
|
||
| A Temporal CLI extension (`temporal ts-net`) that runs `temporal server start-dev` and exposes it on a Tailscale tailnet via tsnet. The binary must be named `temporal-ts_net` (underscores for subcommand separators, required by the Temporal extension system). | ||
|
|
||
| ## Build and test commands | ||
|
|
||
| ```bash | ||
| go run mage.go build # Build to ./bin/temporal-ts_net | ||
| go run mage.go test # All tests with -race -shuffle=on | ||
| go run mage.go install # Install to $GOPATH/bin | ||
| go test ./internal/app/ # Run only app package tests | ||
| go test -short ./... # Skip integration tests (tsnet e2e) | ||
| go test ./internal/app/ -run TestLoadConfig # Single test | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| cmd/temporal-ts_net/main.go Entry point, delegates to app.Run() | ||
| internal/app/ | ||
| app.go Orchestration: parse args → load config → start temporal subprocess → start tsnet proxy | ||
| parse.go Hand-rolled arg parser. Extension flags extracted, everything else passed through to temporal server start-dev | ||
| config.go TOML config loading from [ts-net] section of the Temporal CLI config file | ||
| internal/tailscale/ | ||
| tsnet.go TCP proxy: tsnet listeners accept tailnet connections, proxy to local temporal server | ||
| ``` | ||
|
|
||
| The extension starts `temporal server start-dev` as a child process, then starts a tsnet node that proxies tailnet connections to it. Both gRPC and UI ports are proxied. | ||
|
|
||
| ## Config precedence | ||
|
|
||
| CLI flags > `TS_AUTHKEY` env var > `[ts-net]` section in `~/.config/temporalio/temporal.toml` > defaults. | ||
|
|
||
| The `flagsSet` map on `ExtensionOptions` tracks which flags were explicitly passed so config file values only fill in gaps. | ||
|
|
||
| ## Key patterns | ||
|
|
||
| - **Flag tracking**: `opts.flagsSet["flag-name"] = true` in every parse branch. `IsSet()` checks this during config merge. | ||
| - **Pointer types in FileConfig**: `*int` and `*float64` distinguish "absent from TOML" (nil) from "set to zero." | ||
| - **Config file sharing**: Reads from the same `temporal.toml` the Temporal CLI uses. The CLI's TOML parser ignores unknown top-level sections (non-strict mode), so `[ts-net]` coexists safely. | ||
| - **Graceful shutdown**: SIGINT to child process, wait with timeout, then SIGKILL. tsnet listeners close first, WaitGroup drains active proxies. | ||
|
|
||
| ## Testing | ||
|
|
||
| - `internal/app/`: Unit tests for arg parsing, config loading, config merging, precedence | ||
| - `internal/tailscale/`: Integration tests using Tailscale's testcontrol (in-memory coordination server, no real Tailscale needed) | ||
| - `internal/app/e2e_test.go`: Full workflow execution through the proxy using a real Temporal dev server | ||
|
|
||
| ## Releases | ||
|
|
||
| Bump the `VERSION` file and merge to main. GitHub Actions creates the tag and release, GoReleaser builds cross-platform binaries. The goreleaser config targets the real GitHub repo name (`temporal-start-dev-ext`) since that can't be renamed yet, but `project_name` is set to `temporal-ts-net` for archive naming. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Contributors | ||
|
|
||
| - [@masonegger](https://github.com/masonegger) - Mason Egger | ||
| - [@chaptersix](https://github.com/chaptersix) - Alex Stanfield |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just use normal github released. not super opinionated in this project though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a way of having github do the go release as part of CI merge to main