Skip to content

chore: align every version on 1.2.0 and guard against drift - #46

Merged
ralyodio merged 1 commit into
masterfrom
chore/align-versions
Aug 9, 2026
Merged

chore: align every version on 1.2.0 and guard against drift#46
ralyodio merged 1 commit into
masterfrom
chore/align-versions

Conversation

@ralyodio

@ralyodio ralyodio commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

The repo carried its version in five places and they disagreed:

where was now
package.json (root) 0.1.0 1.2.0
apps/web/package.json 0.1.0 1.2.0
apps/cli/package.json 0.1.0 1.2.0
apps/cli/src/index.ts.version(…) '0.1.0' hardcoded reads package.json
apps/web/public/cli/c0uponsVERSION= 1.2.0 1.2.0 (unchanged)

The git tag v1.2.0 agreed 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/cli 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 — verified both:

$ node apps/cli/dist/index.js --version   →  1.2.0
$ pnpm exec tsx src/index.ts --version    →  1.2.0

Checked where it can't be

The shell script is downloaded standalone, so it cannot read package.json at runtime — its literal has to stay a literal. That is exactly why it needs a check rather than a convention. test/versions.test.mjs asserts every workspace matches the root and that the script's VERSION= agrees, with a message that says to bump both.

Root test now runs it before turbo, so the pnpm test CI already invokes covers it.

I verified the guard fails, not just that it passes — with VERSION deliberately drifted to 9.9.9:

✖ the shipped CLI reports the repo version
  AssertionError: apps/web/public/cli/c0upons VERSION= is out of step with
  package.json — bump both, since the script is served standalone and cannot
  read package.json at runtime

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/cli is a second, divergent implementation of the same CLI — TypeScript/commander, claiming the same c0upons bin 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

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>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

ThreatCrush Security Scan

17 finding(s)

MEDIUM: 17

Severity Rule Location
MEDIUM sql-template-interpolation apps/web/app/api/bounties/[id]/claim/route.ts:18
MEDIUM sql-template-interpolation apps/web/app/api/bounties/[id]/claim/route.ts:34
MEDIUM sql-template-interpolation apps/web/app/api/bounties/[id]/claim/route.ts:43
MEDIUM sql-template-interpolation apps/web/app/api/bounties/[id]/claim/route.ts:73
MEDIUM sql-template-interpolation apps/web/app/api/bounties/route.ts:81
MEDIUM sql-template-interpolation apps/web/app/api/coupons/route.ts:68
MEDIUM sql-template-interpolation apps/web/app/api/coupons/route.ts:75
MEDIUM sql-template-interpolation apps/web/app/api/coupons/vote/route.ts:30
MEDIUM sql-template-interpolation apps/web/app/api/coupons/vote/route.ts:31
MEDIUM sql-template-interpolation apps/web/app/api/coupons/vote/route.ts:33
MEDIUM sql-template-interpolation apps/web/app/api/stores/[slug]/route.ts:9
MEDIUM sql-template-interpolation apps/web/app/api/webhooks/crawlproof/route.ts:83
MEDIUM sql-template-interpolation apps/web/app/api/webhooks/crawlproof/route.ts:90
MEDIUM js-open-redirect apps/web/app/bounties/new/page.tsx:57
MEDIUM js-unescaped-html-sink apps/web/app/layout.tsx:77
MEDIUM sql-template-interpolation apps/web/app/stores/[slug]/page.tsx:12
MEDIUM sql-template-interpolation apps/web/scripts/migrate.mjs:154

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 8409ce7 into master Aug 9, 2026
6 checks passed
@ralyodio
ralyodio deleted the chore/align-versions branch August 9, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant