Skip to content

Commit 6e39c7e

Browse files
tyler-daneclaude
andauthored
feat(web): show app version in command palette (#1749)
* docs: update gcal and server guide * feat(web): show app version in command palette Adds a Version entry to the More section of the command palette so users can see and copy their running version for bug reports. Also simplifies BUILD_VERSION to drop the redundant timestamp prefix in git and CI builds — tagged releases now show a clean semver (e.g. 0.5.4) instead of a timestamp-prefixed string. Adds a versioning reference doc. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(web): remove Donate and View Code from command palette Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 28e805c commit 6e39c7e

6 files changed

Lines changed: 53 additions & 22 deletions

File tree

docs/CI-CD/versioning.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Versioning
2+
3+
Compass uses two complementary version identifiers.
4+
5+
## Semver tag (git)
6+
7+
Format: `v{MAJOR}.{MINOR}.{PATCH}` — e.g. `v0.5.4`
8+
9+
- Bumped automatically on every merge to `main` (patch) by `bump-and-tag.yml`
10+
- Minor/major bumps are manual: push a tag like `v0.6.0` directly
11+
- Used to tag Docker images on Docker Hub (`switchbacktech/compass-web:0.5.4`, `:0.5`, `:latest`)
12+
13+
## BUILD_VERSION (frontend runtime)
14+
15+
A string baked into the web bundle at build time by `packages/web/build.ts` and written to `build/web/version.json`. Used by `useVersionCheck` to detect when a newer deployment is available, and displayed in the command palette under **More → Version**.
16+
17+
| Build context | Value |
18+
|---|---|
19+
| Tagged CI release | Semver without `v` — e.g. `0.5.4` (from `COMPASS_BUILD_REF`) |
20+
| Local dev (git available) | Short git SHA — e.g. `a1b2c3d` |
21+
| Self-hosted (no env set) | `{timestamp}-self-host` |
22+
23+
### How it flows in CI
24+
25+
1. `bump-and-tag.yml` pushes `v0.5.4`
26+
2. `publish-images.yml` fires, sets `COMPASS_BUILD_REF=0.5.4` as a Docker build arg
27+
3. `build.ts` reads `COMPASS_BUILD_REF`, sets `BUILD_VERSION = "0.5.4"`
28+
4. Bundle and `version.json` both contain `"0.5.4"`
29+
30+
### Adding a new build context
31+
32+
To inject a custom version (e.g. a self-hosted build with a known tag):
33+
34+
```sh
35+
COMPASS_BUILD_REF=my-version bun run build
36+
```
37+
38+
The `"self-host"` fallback (with timestamp prefix) is only used when git is unavailable **and** `COMPASS_BUILD_REF` is not set.

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Markdown files in this `docs/` directory are automatically mirrored to [docs.com
4242
- [Types And Validation](./development/types-and-validation.md)
4343
- [CI/CD](./ci-cd/README.md)
4444
- [CLI And Maintenance Commands](./ci-cd/cli-and-maintenance-commands.md)
45+
- [Versioning](./ci-cd/versioning.md)
4546

4647
## Feature Deep Dives
4748

docs/self-hosting/google-calendar.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ Before you call continuous Google Calendar sync "working" on any self-host insta
153153
- Google watch registration succeeds
154154
- watch repair and refresh behavior holds up over time
155155

156+
To confirm sync is live: create or edit one event directly in Google Calendar and confirm it appears in Compass without reconnecting Google. Then restart Compass and confirm the connection still works after restart.
157+
156158
The repo has the code paths for Google watches and repair. The self-host Docker stack does not schedule watch renewal, so you need to verify and wire up maintenance separately before treating ongoing Google sync as dependable.
157159

158160
## What to read next

docs/self-hosting/server-guide.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,7 @@ You want the Compass containers healthy, Caddy listening on public `80` and
299299

300300
## 7. Add Google Calendar (optional)
301301

302-
If you want Google sign-in or Google Calendar watch notifications, see [Google Calendar — Public watch notifications](./google-calendar.md#public-watch-notifications). The short version:
303-
304-
- add `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, and `TOKEN_GCAL_NOTIFICATION` to `~/compass/.env`
305-
- in your Google OAuth client, set the authorized JavaScript origin and redirect URI to `https://compass.example.com`
306-
- `./compass rebuild`
307-
308-
Test Google connect, import, and webhook delivery on this install before relying on Google sync. Create or edit one event directly in Google Calendar and confirm it appears in Compass without reconnecting Google. Then restart Compass and confirm the connection still works.
309-
310-
Long-running Google watch renewal is not scheduled by the self-host Docker stack. If you rely on ongoing Google sync, you still need to verify renewal on your server and wire up maintenance separately.
302+
See [Connect Google Calendar — Public watch notifications](./google-calendar.md#public-watch-notifications) for the full setup. Test Google connect, import, and webhook delivery on this install before relying on Google sync.
311303

312304
## Updating
313305

packages/web/build.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ function getBuildHash(): string {
2929
.trim();
3030
}
3131

32-
const BUILD_VERSION = `${Date.now()}-${getBuildHash()}`;
32+
const buildHash = getBuildHash();
33+
const BUILD_VERSION =
34+
buildHash === "self-host" ? `${Date.now()}-self-host` : buildHash;
3335
const OUTDIR = path.resolve(import.meta.dir, "../../build/web");
3436

3537
const GOOGLE_CLIENT_ID = process.env.GOOGLE_CLIENT_ID;

packages/web/src/common/constants/more.cmd.constants.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ export const moreCommandPaletteItems: Array<{
99
heading: "More",
1010
id: "advanced",
1111
items: [
12-
{
13-
id: "code",
14-
children: "View Code",
15-
icon: "CodeBracketIcon",
16-
href: "https://github.com/SwitchbackTech/compass",
17-
target: "_blank",
18-
},
1912
{
2013
id: "report-bug",
2114
children: "Report Bug",
@@ -31,11 +24,14 @@ export const moreCommandPaletteItems: Array<{
3124
target: "_blank",
3225
},
3326
{
34-
id: "donate",
35-
children: "Donate",
36-
icon: "CreditCardIcon",
37-
href: "https://buy.stripe.com/cNi8wQ6pE9gyejz6hZ9sk00",
38-
target: "_blank",
27+
id: "version",
28+
children: `Version: ${typeof BUILD_VERSION === "string" ? BUILD_VERSION : "dev"}`,
29+
icon: "InformationCircleIcon",
30+
onClick: () => {
31+
const v =
32+
typeof BUILD_VERSION === "string" ? BUILD_VERSION : "dev";
33+
void navigator.clipboard.writeText(v);
34+
},
3935
},
4036
],
4137
},

0 commit comments

Comments
 (0)