GoReleaser's {{ .Version }} resolves to the git tag (without the v prefix, e.g. 0.1.15)
This overwrites the default var Version = "dev" in vendor/sandcastle-cli/cmd/root.go:10
So sandcastle version / sandcastle -v prints the release version
Web footer: Sandcastle.version
The footer (app/views/layouts/application.html.erb:32) calls Sandcastle.version, defined in config/initializers/version.rb. This does not use the git tag at all. It builds a string from:
git SHA (short, e.g. 2baffcd) — from BUILD_GIT_SHA env or git rev-parse --short HEAD
dirty flag — from BUILD_GIT_DIRTY env or git status --porcelain
date — from BUILD_DATE env or current date
Result looks like: 2baffcd / 2026-02-12
The deploy:local mise task sets BUILD_GIT_SHA, BUILD_GIT_DIRTY, and BUILD_DATE as build args. For Kamal deploys, these would come from whatever env is set during the Docker build.
Key takeaway
The git tag version only flows into the CLI binary (via GoReleaser ldflags). The web app footer shows the git SHA + date, not the semver tag. They're two independent version mechanisms.
User
reserch best proctises for a version number in the bianry and footer.
Assistant
Here's a summary of what well-known projects do and what would improve Sandcastle:
semver + commit + tree state + build date + Go version + platform
Terraform
Terraform v1.5.7 on darwin_arm64
Common denominator: semver is always primary, short SHA + build date are common extras.
A good target for Sandcastle CLI:
code
sandcastle 0.1.15 (abc1234) built 2026-02-10
Web footer — Industry patterns
Self-hosted tools (GitLab, Grafana, Sentry, WordPress) all show semver prominently, with SHA as optional debug detail. Raw SHA alone (what Sandcastle shows today) is meaningless to non-developer users.
Good target:
code
v0.1.15 (abc1234)
What Sandcastle is missing
CLI only injects Version via ldflags — no commit or date
Rails app only knows SHA + date — no semver tag at all
No BUILD_VERSION Docker build-arg to pass the git tag into the Rails image
Recommended changes
Go CLI — add Commit and Date variables alongside Version, update GoReleaser ldflags to inject all three
version.rb — read BUILD_VERSION env, format as v0.1.15 (abc1234) in production, fall back to dev (abc1234 / 2026-02-10) in development
Release workflow — pass BUILD_VERSION=${{ github.ref_name }} to Docker build
Dev builds — "dev" default in Go is already correct; Rails falls back to git commands
Want me to implement these changes?
User
yes
Assistant
Let me read all the files I need to modify first.
Assistant
Now let me also check the Kamal deploy config for build-args.
Assistant
Good, I have all the context. Let me implement the changes across all 6 files.
Assistant
Now update the deploy:local mise task and docker-compose to pass BUILD_VERSION too.
Assistant
Now let me verify everything compiles and the tests pass.
Assistant
Go compiles, all 26 tests pass. Let me verify the final state of each changed file.
Assistant
Everything looks good. Here's a summary of all changes:
Changes made (7 files)
File
Change
vendor/sandcastle-cli/cmd/root.go
Added Commit and Date variables; version command now prints sandcastle 0.1.15 (abc1234) built 2026-02-10 for release builds, falls back to sandcastle dev for local builds
vendor/sandcastle-cli/.goreleaser.yaml
Extended ldflags to inject Commit (ShortCommit) and Date (CommitDate) alongside Version
Dockerfile
Added BUILD_VERSION build-arg and env var
config/initializers/version.rb
Reads BUILD_VERSION env; production shows v0.1.15 (abc1234), dev shows dev (abc1234-dirty / 2026-02-10)
.github/workflows/release.yml
Passes BUILD_VERSION=${{ github.ref_name }} (the git tag) to Docker build
mise.toml
deploy:local task exports BUILD_VERSION from git describe --tags
docker-compose.local.yml
Passes BUILD_VERSION build-arg
Version output by context
Context
Example output
CLI release
sandcastle 0.1.15 (abc1234) built 2026-02-10
CLI dev
sandcastle dev
Footer (production)
v0.1.15 (abc1234)
Footer (dev)
dev (2baffcd-dirty / 2026-02-12)
User
commit this
Assistant
There are pre-existing uncommitted changes in installer.sh that aren't part of this work. I'll commit only the 7 files I changed.
Assistant
Committed 059b063 — 7 files, only the version-related changes. The pre-existing installer.sh changes remain uncommitted.
User
commit installer
Assistant
Committed bd18ac0 — adds the update subcommand and fixes the logs path in the install summary.
User
push it
Assistant
Pushed both commits (059b063 and bd18ac0) to origin/main.
User
sandcastle create should log on what host the sandcasle was created:
Sandbox "sandcastle-dev" created.
Server: https://demo.sandcastle.rocks/
Home: mounted (~/ persisted)
Data: mounted (user data root → /data)
Tailscale: enabled
Assistant
The server URL is already available on the Client struct (client.BaseURL). I just need to add it to the create output.
The Server: line always prints (since you always have a server), while the other lines remain conditional on the flags used.
User
commit this and push
Assistant
Not ignored. Let me check why git doesn't see the file.
Assistant
The file has never been tracked. It was added to git as part of the previous version commit — let me check.
Assistant
The file is in the git tree. Let me check the actual diff properly.
Assistant
The diff exists. The issue is likely a nested .gitignore or something odd with the vendor directory. Let me check further.
Assistant
Something strange is going on. It seems like the vendor/sandcastle-cli directory isn't actually tracked by git, yet git show HEAD:vendor/sandcastle-cli/cmd/sandbox.go works. Let me check if there's a sparse checkout or some special git config.
Assistant
The root of the git repo is the Go CLI itself (vendor/sandcastle-cli/). The Sandcastle Rails app must be in a parent repo. Let me check.
Assistant
The issue is that git is picking up a nested .git-like config in vendor/sandcastle-cli/. My earlier go build command changed the working directory. Let me commit from the project root explicitly.