Skip to content

feat(cli): publish and status (plan 05 session 3) - #14

Merged
ommgh merged 4 commits into
mainfrom
cli-publish
Nov 14, 2026
Merged

ommgh merged 4 commits into
mainfrom
cli-publish

Conversation

@ommgh

@ommgh ommgh commented Nov 13, 2026

Copy link
Copy Markdown
Member

Plan 05 session 3. Stacked on #13 (itself on #12). Merge in order: #12, #13, then this one.

upwell publish

Puts policy.json (and releases.json when there is one) at a stable public URL, with no hosting:

Target URL
gist (default): created on the first run, updated after https://gist.githubusercontent.com/<owner>/<id>/raw/policy.json
--repo owner/name: Contents API, one commit per changed file https://raw.githubusercontent.com/<owner>/<repo>/<branch>/<path>/policy.json
  • Validates both files, shows the diff against what's live, and applies the same risk rules as policy set: --yes without a terminal, --confirm for raising minimum / lowering latest / changing the OTA runtime. A first publish has no risks, since nothing reads the URL yet. The rules now live in src/risks.ts, shared with policy set.
  • Records publish (to, the gist or repo/branch/path, and urls) in upwell.json, creating the file if needed and editing it in place otherwise.
  • Refuses private repos (REPO_PRIVATE) and missing ones (REPO_NOT_FOUND, with the gh repo create … --public command), and handles a deleted gist (GIST_NOT_FOUND).
  • Auth: GITHUB_TOKEN / GH_TOKEN, else gh auth token; a missing scope gets a hint. --dry-run needs no token.

upwell status

Shows the target, the last revision, whether each file is in sync / differs / unpublished, and whether the raw URL already serves the latest copy (GitHub caches raw files for 5 minutes). It needs no token for public targets.

Also

  • In a terminal, init offers to publish at the end. If publishing fails, setup still succeeds and prints how to retry.
  • doctor's fixes now point at upwell publish.
  • Docs: "Hosting the policy" is rewritten around publish (gist, repo, auth, caching, rollback) and keeps self-hosting as its own section. The CLI page has publish/status and the new error codes; the quick start gets a pointer.

Testing

  • 105 Jest tests. publish/status run against an in-memory GitHub (gists, repo contents with sha checks, commits, raw URLs with a stale cache) through the injected fetch, so no MSW.
  • Read-only run against the real API: publish --repo updateswell/upwell --path docs/examples --dry-run reported the unchanged files as up to date (byte-exact base64 decoding) and showed the right diff after an edit. It wrote nothing.
  • The bundle test now also runs status.

Left for the maintainer (unchecked in plan 05)

  • One real npx @upwell/cli publish to a throwaway gist. It creates a public gist on your account, so I didn't run it.
  • End to end on the smoke app: init → publish → release build reads the gist; raise minimum, publish --confirm, and see the required update within ~5 minutes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RX4BmNghPADsZ6GMRb2ALH

ommgh and others added 2 commits November 13, 2026 11:39
`upwell init` sets Upwell up in an Expo app after one confirmation (or
--yes): npx expo install upwell (and expo-updates with
--with-expo-updates), "upwell" added to app.json plugins (instructions for
a dynamic app.config), upwell/policy.json at the current version and
builds (with the OTA runtime when it can be computed) and upwell.json, then
the provider snippet. Never edits source files; nothing is written when the
install fails.

`upwell doctor` reads the resolved app config (npx expo config, falling back
to app.json), package.json, eas.json, upwell.json and the documents, fetches
the published policy like a device, and reports findings with a code,
severity and fix: packages, expo-updates setup (update URL, runtime
version, channel, upwell >= 0.1.3 for runtime policies), local and
published documents (HTTPS, reachability, validity, Cache-Control, out of
date) and the policy against the app being built. Exits 1 on errors.

Tried on a fresh create-expo-app project and on the smoke app; the bundle
test now also runs doctor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RX4BmNghPADsZ6GMRb2ALH
`upwell publish` puts policy.json (and releases.json when there is one) at
a stable public URL without hosting anything: a public GitHub gist by
default (created on the first run, updated after), or a file in a public
repo with --repo (Contents API, one commit per changed file, current sha).
It validates both files, shows the diff against what's live, applies the
same risk rules as `policy set` (now shared in src/risks.ts), and records
the target and URLs in upwell.json. Private and missing repos are refused
with a fix. Auth: GITHUB_TOKEN / GH_TOKEN, else `gh auth token`; a dry run
needs no token.

`upwell status` shows the target, last revision, local vs published per
file, and whether the raw URL already serves the latest copy.

init offers to publish at the end (in a terminal); doctor's fixes point at
publish. Tests run against an in-memory GitHub; a read-only dry run against
the real API (this repo's docs/examples) matched. Docs: "Hosting the policy"
rewritten around publish, publish/status on the CLI page, quick start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RX4BmNghPADsZ6GMRb2ALH
@vercel

vercel Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
upwell-docs Ready Ready Preview Nov 14, 2026 7:53am UTC

@ommgh
ommgh changed the base branch from cli-init-doctor to main November 14, 2026 07:51
@ommgh
ommgh merged commit da9388a into main Nov 14, 2026
6 checks passed
@ommgh
ommgh deleted the cli-publish branch November 14, 2026 07:59
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