Skip to content

threenative login and deploy: publish from the terminal like Studio's Publish button (PRD-904) - #712

Merged
jonit-dev merged 20 commits into
developfrom
prd-904-login-deploy
Nov 22, 2026
Merged

jonit-dev merged 20 commits into
developfrom
prd-904-login-deploy

Conversation

@jonit-dev

@jonit-dev jonit-dev commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What is this PR about?

threenative login signs in to a threenative.com account from the terminal, and threenative deploy publishes the game to the same share link Studio's Publish button makes. threenative logout revokes the token. PRD: docs/PRDs/tooling/PRD-904-threenative-login-and-deploy-publish-like-studio-share.md.

Why does it matter?

A game built outside Studio had no command to put it online, so an agent stopped at a local build.

Companion branches (other repos)

  • Site ThreeNativeHQ/threenative-site branch prd-904-cli-token: StudioAccounts.tokenAccount, bearer DELETE /api/store/token, device page keeps the code through verify and terms.
  • Studio ThreeNativeHQ/threenative-studio branch prd-904-cli-share: PUT /api/cli/share.

Checklist (mirrors the PRD)

  • Phase 1: login/logout against a fake site (17/17)
  • Phase 1: device page keeps the code through verify and terms (site e2e 4/4)
  • Phase 2: token check passes site tests (229/229)
  • Phase 2: CLI share route passes Studio tests (359/359)
  • Phase 3: deploy unit behaviour (deploy.spec.ts 5/5)
  • Phase 3: local end-to-end through both real Workers (AC-6, run log in the comments)
  • Phase 3: live clean-room deploy (AC-7, blocked on production deploys and an engine release)

…ds borrow established CLI names (owner, 2026-11-21)
…rule on CLI tokens, .threenative/ link, device page keeps the code
…h to the Studio share link (PRD-904)

login runs the threenative.com device flow and saves a 0600 token (THREENATIVE_TOKEN overrides);
logout revokes it on the site; deploy runs build:web, packs dist/ in Studio's share archive format,
PUTs it to Studio's /api/cli/share and keeps the link in .threenative/share.json.
@jonit-dev jonit-dev added the prd:50% PRD half the phases verified label Nov 22, 2026
@jonit-dev

Copy link
Copy Markdown
Contributor Author

PRD-904 AC-6 run log (local site + Studio Workers, scaffolded starter)

Site: threenative-site branch prd-904-cli-token, scripts/e2e-wrangler.mjs on 127.0.0.1:4180. Studio: threenative-studio branch prd-904-cli-share, wrangler dev on :8788 (containers off, routes removed so share-*.localhost is not rewritten to the control host). Game: create-threenative ac6-game --template starter + pnpm add -D create-threenative-0.2.25.tgz from this branch.

== login (scripted Authorize)
Open http://127.0.0.1:4180/account/device/?code=C4LN-AN6B and click Authorize.
Code: C4LN-AN6B
{"ok":true,"userCode":"C4LN-AN6B","expiresIn":599}
login exit=0
Signed in as e2e@example.com.
auth.json mode 600
== deploy 1
deploy1 exit=0
url1=http://share-ac6-game-g226.localhost
{
  "projectId": "095e83ba-f83a-4e0f-b569-44216dcb3129"
}
== deploy 2
deploy2 exit=0
url2=http://share-ac6-game-g226.localhost
{
  "projectId": "095e83ba-f83a-4e0f-b569-44216dcb3129"
}
SAME URL: yes
== share URL (on :8788)
http 200; served.html == dist/index.html except Studio's injected 'Report this game' div (serveShare)
== Studio games list (local D1)
{"id":"095e83ba-f83a-4e0f-b569-44216dcb3129","name":"ac6-game","share_id":"ac6-game-g226","email":"e2e@example.com"}
== AC-5 packer parity on the same dist/
studio 16474839 1645cccf991dd52f074ac2465a8cae56c5c08083a84fd90e1c764ceff2830462
engine 16474839 1645cccf991dd52f074ac2465a8cae56c5c08083a84fd90e1c764ceff2830462
== logout
Signed out. / auth.json removed / site D1: Store CLI (device) push token revoked=1 used=1
deploy3 exit=3: Not signed in. Run threenative login.

@jonit-dev jonit-dev added prd:75% PRD phases in, acceptance open and removed prd:50% PRD half the phases verified labels Nov 22, 2026
…omic 0600 token write; a dropped body exits 5 (PRD-904 Sol review)
…, first deploy carries a key so a lost reply retries onto one game (PRD-904 Sol re-review)
@jonit-dev

Copy link
Copy Markdown
Contributor Author

AC-6 rerun after the Sol 6.2 review fixes (site 3db86c6, Studio rebased + cc0c1b0/0015 migration, engine 4a288db): login exit 0 (Signed in as e2e@example.com., auth.json 600, no temp files), deploy 1 and 2 → same http://share-ac6-game-i7bm.localhost:8788, share.json {projectId, deployKey}, served page = dist/index.html + Studio's report link, Studio D1 lists the game, engine and Studio packDirectory sha256 equal (1645cccf…0462), logout revoked the device token (site D1 device=1 revoked=1), deploy after logout exits 3.

…d renamed, so an interrupted write cannot lose the deploy key (PRD-904 Sol review 3)
…e deploy key through an atomic link (PRD-904 Sol review 4)
…still holds the revoked token (PRD-904 Sol review 8)
… and login writes it once, so neither loses or revives the other's token (PRD-904 Sol review 9)
…en in its claimed file and retries it next time; an empty whoami reply still saves the token (PRD-904 Sol review 10)
… a file it cannot read; empty replies exit 4; the deploy key claim works without hard links (PRD-904 Sol review 11)
…ved, and logout claims auth.json in a directory it cannot list (PRD-904 Sol review 12)
…g directory and has nothing to claim, instead of saying signed out (PRD-904 Sol review 13)
@jonit-dev
jonit-dev marked this pull request as ready for review November 22, 2026 04:49
@jonit-dev
jonit-dev added this pull request to the merge queue Nov 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The merge queue stopped on test-unit (2/4) (failure).

Fix, push, re-enqueue.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 22, 2026
@jonit-dev
jonit-dev enabled auto-merge November 22, 2026 05:11
@jonit-dev
jonit-dev added this pull request to the merge queue Nov 22, 2026
Merged via the queue into develop with commit 6e4289d Nov 22, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prd:75% PRD phases in, acceptance open

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant