chore: align every version on 1.2.0 and guard against drift - #46
Merged
Conversation
The repo carried its version in five places and they disagreed: the root, @c0upons/web and @c0upons/cli all said 0.1.0, while the shipped shell CLI said 1.2.0 — and the git tag agreed with the CLI, not the packages. The shell script is the one users see (`c0upons version`), so the version in a bug report did not identify the tree it came from. All three package.json files move to 1.2.0, matching the shipped CLI and the v1.2.0 tag. @c0upons/cli additionally hardcoded '0.1.0' a second time in its commander setup; it now reads package.json, resolved relative to the module so it works both from src/ under tsx and from dist/ after a build. The shell script cannot read package.json at runtime — it is downloaded standalone — so its literal is checked rather than derived: test/ asserts every workspace matches the root and that the script's VERSION= agrees, with a message that says to bump both. Root `test` runs it before turbo, so `pnpm test` in CI covers it. Verified it fails on a deliberately drifted version, not just that it passes today. Also asserts the script still upgrades from the canonical URL, since a CLI pointing elsewhere would strand every installed copy. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan17 finding(s) MEDIUM: 17
Snippets are redacted; ThreatCrush never prints matched credential material. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The repo carried its version in five places and they disagreed:
package.json(root)0.1.01.2.0apps/web/package.json0.1.01.2.0apps/cli/package.json0.1.01.2.0apps/cli/src/index.ts→.version(…)'0.1.0'hardcodedpackage.jsonapps/web/public/cli/c0upons→VERSION=1.2.01.2.0(unchanged)The git tag
v1.2.0agreed with the shipped CLI, not with any package. Since the shell script is the one users actually see (c0upons version), the version someone quotes in a bug report did not identify the tree it came from.Single-sourced where possible
@c0upons/clihardcoded0.1.0a second time in its commander setup. It now readspackage.json, resolved relative to the module so it works both fromsrc/undertsxand fromdist/after a build — verified both:Checked where it can't be
The shell script is downloaded standalone, so it cannot read
package.jsonat runtime — its literal has to stay a literal. That is exactly why it needs a check rather than a convention.test/versions.test.mjsasserts every workspace matches the root and that the script'sVERSION=agrees, with a message that says to bump both.Root
testnow runs it before turbo, so thepnpm testCI already invokes covers it.I verified the guard fails, not just that it passes — with
VERSIONdeliberately drifted to9.9.9:It also asserts the script still upgrades from the canonical URL, since a CLI pointing elsewhere would strand every installed copy on its current version.
Verification
pnpm typecheck→ 2/2 successful.pnpm test→ 3/3 guard tests pass, then turbo. No behaviour change to the shipped CLI or the site.Noted, not fixed
apps/cliis a second, divergent implementation of the same CLI — TypeScript/commander, claiming the samec0uponsbin name, and it is not the artifact that ships. It has none of the 503 handling from #45. This PR only stops it lying about its version; it does not reconcile the duplication. Worth a decision separately.🤖 Generated with Claude Code