Repository navigation
cmd: add heygen update command - #50
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
09a7966 to
775033f
Compare
| Check for and apply updates after install: | ||
|
|
||
| ```bash | ||
| heygen update check |
There was a problem hiding this comment.
does this need to be a separate command or a flag? just curious if we have examples here of
I coudl see heygen version being waht does the check vs heygen update does check + downloads
There was a problem hiding this comment.
Initially, I wanted --version to also check for an update. Both codex and claude pushed back saying that this is usually a non-networked call.
But I still feel that it might be useful. What do you think? Running --version also checks if there is a newer version available. However, we would need to see how agents react to this behaviour (version flag for checking for a new version and then update to actually update the package)
There was a problem hiding this comment.
@jrusso1020 The passive notice pattern above is below:
When you run any gh or stripe command, they occasionally print a message to stderr like:
A new release of gh is available: 2.44.0 → 2.45.0
https://github.com/cli/cli/releases/tag/v2.45.0It's "passive" because:
- You didn't ask for it — it just appears alongside your normal command output
- It's on stderr so it doesn't break JSON piping
- It has a 24-hour cooldown so it doesn't show every time
- It's informational only — you still have to run brew upgrade gh yourself
There was a problem hiding this comment.
Yeah makes sense to me I think --version could be teh default cobra and we could add version command to if we wnat to have custom logic?
I just find the update check command confusing/unnecessary can eitehr include that info with version or just have an update command
There was a problem hiding this comment.
Okay. We can simplify to the below for now:
heygen --version— local version string (Cobra built-in, what everyone expects)
heygen update— checks for newer version + installs if available. If already current, tells you.
We can add a passive note as a follow up feature.
| newReleaseUpdater = func(prerelease bool) (releaseUpdater, error) { | ||
| source, err := selfupdate.NewGitHubSource(selfupdate.GitHubConfig{ | ||
| APIToken: githubReleaseToken(), | ||
| }) |
There was a problem hiding this comment.
if you don't have github account you can't download from here? is that a potential concern
There was a problem hiding this comment.
Only while the repo is private. This flow won't be used once the repo is public.
This code should already work for a public repo. An empty string will be returned if user doesn't have a GitHub account, and then it would proceed with an unauthenticated request to GitHub. It wouldn't throw an error when the repo is public.
b375061 to
5066125
Compare
775033f to
4853044
Compare
## Description Adds a `.gitleaks.toml` allowlist so the PostHog project API token in `internal/analytics/analytics.go` doesn't fail the secrets CI check. PostHog project tokens are public client-side ingest tokens by design — they're embedded in every frontend and CLI that uses PostHog. This is not a secret leak. The allowlist is scoped narrowly: only matches the exact `const posthogAPIKey = "phc_..."` assignment in that one file. Without this, the `secrets` CI job fails on PRs #23, #49, and #50 (the entire M6 stack). ## Testing CI `secrets` job should pass after this merges. Verified the allowlist regex matches the token assignment pattern.
## Description Adds a manual GitHub Actions workflow for cutting stable releases. This is the first PR in the M6 release cycle stack (#23 → #49 → #50). ### Versioning Strategy The CLI uses semver with a `v` prefix everywhere — git tags, `--version` output, `--version` flag input, JSON responses, install script. | Build type | Tag format | Example | How triggered | |---|---|---|---| | **Stable** | `v{major}.{minor}.{patch}` | `v0.1.0` | Manual — GitHub Actions UI, operator inputs version | | **Dev** | `v{base}-dev.{YYYYMMDD}.{shorthash}` | `v0.1.1-dev.20260406.abc1234` | Manual — GitHub Actions UI, version auto-computed | | **Local** | — | `dev` | `go build` without ldflags | **Semver ordering:** `v0.2.0` > `v0.1.1-dev.20260407.def` > `v0.1.1-dev.20260406.abc` > `v0.1.0`. Stable always beats prerelease. Dev builds sort chronologically by date. **Dev version auto-derivation (PR #49):** The dev workflow reads the latest stable tag, bumps patch (`v0.1.0` → `v0.1.1`), and appends `-dev.YYYYMMDD.SHORTHASH`. No VERSION file, no manual bumps. Dev builds always sort above the latest stable. **Bumping rules:** Pre-1.0 (`v0.x.y`): minor = features, patch = fixes, no stability guarantees. Post-1.0: full semver contract. ### This PR — Stable Release Workflow **Trigger:** GitHub Actions UI → "Stable Release" → input version tag (e.g., `v0.1.0`) → "Run workflow" **What it does:** 1. Validates version is semver format (`v0.1.0` — rejects `1.0` or `foo`) 2. Validates the tag doesn't already exist (prevents accidental overwrite) 3. Runs tests 4. Creates git tag on current `main` HEAD 5. GoReleaser builds platform binaries + `checksums.txt`, publishes as a stable GitHub release **Downstream PRs:** - PR #49 — rewrites dev release workflow + installer for versioned assets - PR #50 — adds `heygen update` / `heygen update check` commands (channel-aware: stable users get stable updates, dev users get dev updates) ## Testing Workflow syntax validated. GoReleaser config tested by `goreleaser-check` CI job. Version validation tested manually with valid/invalid inputs.
a7c9b3f to
dd325d3
Compare
4853044 to
510af22
Compare
dd325d3 to
b8981b7
Compare
510af22 to
4145847
Compare
4145847 to
ee30836
Compare
Merge activity
|


Description
Adds
heygen updateandheygen update check— explicit self-update commands for the CLI. No auto-update, no startup notifications, no network calls in--helpor--version.heygen update check— queries GitHub Releases for the latest stable version, returns JSON:{"current": "v0.1.0", "latest": "v0.2.0", "update_available": true}heygen update— downloads the latest stable release, verifies SHA256 checksum, replaces the binary. Returns JSON:{"previous": "v0.1.0", "current": "v0.2.0", "message": "Updated heygen from v0.1.0 to v0.2.0"}heygen update --version v0.1.0— pins to a specific version. Thevprefix is required; bare0.1.0returns exit 2 (usage error).Design decisions:
skipAuth: true— no HeyGen API key needed. GitHub Releases are the source.GITHUB_TOKEN→GH_TOKEN→gh auth token(same chain as the installer). Empty token works once the repo is public./homebrew/,/Cellar/,/linuxbrew/, ornode_modules/, returns aCLIErrortelling the user to use their package manager instead.devbuilds (no ldflags) get a clear error: "reinstall from a release build to use heygen update."releaseUpdaterinterface abstractsgo-selfupdatefor testability. All tests use a mock — no real GitHub API calls.--help:Use "heygen update check" to see if a newer version is available.No dynamic notifications.versionfield added tocmdContextto pass the build-time version string to the update command.Dependencies added:
creativeprojects/go-selfupdate(GitHub Releases source, checksum validation, atomic binary replacement, rollback on failure) andMasterminds/semver(version parsing and validation).Stacked on PR #49 (installer rewrite).
Testing
7 tests with mock
releaseUpdater:TestUpdateCheck_NewVersionAvailable— newer version returnsupdate_available: trueTestUpdateCheck_AlreadyCurrent— same version returnsupdate_available: falseTestUpdateCheck_LocalDevVersion—devbuild returns exit 1 with "not release-tagged" errorTestUpdate_SkipsAuth— no API key needed, exit 0TestUpdate_PackageManagerWarning— Homebrew path returnswrong_install_methoderror with brew hintTestUpdate_JSONOutput— success returns valid JSON with previous/current/messageTestUpdate_RejectsBareVersion—--version 0.1.0(nov) returns exit 2Root help test updated to verify the static update hint line.