Skip to content

feat: expose app production URL (apps get) + fix apps list org bug#121

Open
tcerqueira wants to merge 4 commits into
mainfrom
tc/app-production-url
Open

feat: expose app production URL (apps get) + fix apps list org bug#121
tcerqueira wants to merge 4 commits into
mainfrom
tc/app-production-url

Conversation

@tcerqueira

Copy link
Copy Markdown
Member

Addresses #108 (machine-readable production URL) plus a related apps list bug.

Changes

Fix: apps list never forwarded org

apps list --org <org> resolved the org but omitted it from the
apps.listByPage query, so the backend rejected it with
MALFORMED_REQUEST ("org: expected string, received undefined"). Now the
resolved org slug is forwarded (matching deployments list). orgs list
takes no org and deployments list already forwarded it, so neither was
affected.

Feat: apps get (#108)

apps get --org <org> --app <app> --json returns
{ slug, productionUrl, domains, productionRevisionId, timelines, ... }.
Domains live on revision timelines (not the app record), so we read the
latest revision's timelines and select the Production-context partition.
Apps with no deployment report productionUrl: null. A human-readable
table is shown in non-json mode.

Feat: deploy --json (#108)

  • deno deploy --json now includes an explicit productionUrl field
    (in addition to the existing builds-page url and timelines).
  • deno deploy --no-wait --json previously emitted empty stdout; it now
    emits a JSON object with revisionId (status pending).
  • Fixes a latent hang where the upload progress bar's render timer kept
    the event loop alive in --json/--quiet mode, so the process never
    exited.

Verification (live, throwaway org)

  • apps list --org … --json → exit 0, returns apps.
  • apps get … --json → correct productionUrl + domains + timelines.
  • deploy --prod --jsonproductionUrl present, status routed, URL
    serves HTTP 200, exit 0.
  • deploy --prod --no-wait --json → emits revisionId, exit 0 (~1.7s).

`apps list --org <org>` resolved the org but never forwarded it to the
`apps.listByPage` procedure, so the backend rejected the request with a
MALFORMED_REQUEST error ("org: expected string, received undefined").
Forward the resolved org slug like `deployments list` already does.
Closes the gap from #108: agents/CI with only a token, org slug and app
slug had no machine-readable way to discover an app's live production URL.

`apps get --org <org> --app <app> --json` returns { slug, productionUrl,
domains, productionRevisionId, timelines, ... }. Domains live on revision
timelines rather than the app record, so we read the latest revision's
timelines and pick the Production-context partition; apps with no
deployment yet report a null productionUrl gracefully. A human-readable
table is printed in non-json mode.
For #108, the deploy `--json` payload now includes an explicit
`productionUrl` (derived from the Production-context timeline) alongside
the existing builds-page `url` and `timelines`.

`--no-wait --json` previously wrote nothing to stdout; it now emits a
JSON object with org/app/revisionId/url and status "pending" so agents
can track the in-flight build.

Also fixes a latent hang: the upload ProgressBar was constructed
unconditionally but only stopped when drawn, so in --json/--quiet mode
its render timer kept the event loop alive and the process never exited.
The bar is now only instantiated when it will actually be rendered.
Standardize stdout discipline across deploy/apps.ts and deploy/publish.ts:
stdout now carries only data payloads (the --json result object, and in
human mode the list/query tables and apps-get data), while all
post-action confirmations, progress/status chrome, and debug diagnostics
go to stderr — in both --json and human modes.

publish.ts: the `log()` helper (used for "You can view the revision
here", "Loaded previously uploaded files", "Successfully uploaded your
application!", "No files were changed…", "Waiting for deployment to
complete…", "To see the deployment…") now writes to stderr; the
"Successfully deployed" confirmation, per-timeline URL lines, the
cancelled/failed notice, and all debug console.log calls were moved to
console.error.

apps.ts: the "No applications in this organization." notice and the
"More results available…" pagination hint moved to stderr; the apps list
table and the apps get data display stay on stdout.
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