Skip to content

Commit 8aa3b1f

Browse files
authored
Merge branch 'main' into feat/whoami-account-me
2 parents 34fb47f + 8dfef34 commit 8aa3b1f

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

auth.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export function createTrpcClient(
113113
retryLink({
114114
retry(opts) {
115115
if (context.debug) {
116-
console.log(opts);
116+
console.error(opts);
117117
}
118118

119119
if (
@@ -243,7 +243,8 @@ export async function getAuth(
243243
message: "",
244244
color: "yellow",
245245
});
246-
console.log(`Visit ${authUrl} to authorize deploying your project.`);
246+
// Prompt-style message — goes to stderr so it doesn't pollute `--json` callers' stdout.
247+
console.error(`Visit ${authUrl} to authorize deploying your project.`);
247248
if (!quiet) {
248249
spinner.start();
249250
}
@@ -310,7 +311,8 @@ export function tokenExchange(
310311
const { token, user } = await res.json();
311312
spinner.stop();
312313
if (!quiet) {
313-
console.log(
314+
// Status message — stderr so JSON callers' stdout stays clean.
315+
console.error(
314316
`${
315317
green("✔")
316318
} Authorization successful. Authenticated as ${user.name}\n`,
@@ -368,7 +370,8 @@ export async function authedFetch(
368370
});
369371

370372
if (res.status === 401) {
371-
console.log(await res.text());
373+
// Diagnostic body — stderr only, and only when debugging.
374+
if (context.debug) console.error(await res.text());
372375
tokenStorage.remove();
373376
auth = await getAuth(context);
374377

deploy/mod.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,27 @@ export const deployCommand = new Command()
318318
.description(`Interact with Deno Deploy
319319
320320
Calling this subcommand without any further subcommands will
321-
deploy your local directory to the specified application.`)
321+
deploy your local directory to the specified application.
322+
323+
For non-interactive use (CI, AI agents), authenticate via the
324+
DENO_DEPLOY_TOKEN env var (or --token) and pass --json --non-interactive
325+
to every subcommand. The CLI then emits a single JSON object on stdout,
326+
a structured { error: { code, message, hint } } envelope on stderr,
327+
and a stable exit code (0 OK, 1 GENERIC, 2 USAGE, 3 AUTH, 4 NOT_FOUND,
328+
5 CONFLICT, 6 NETWORK). See https://docs.deno.com/runtime/reference/cli/deploy/#agent--ci-usage
329+
for the full reference.`)
330+
.example(
331+
"Verify the active token",
332+
"whoami --json",
333+
)
334+
.example(
335+
"Deploy current directory non-interactively",
336+
"--json --non-interactive --org my-org --app my-app --prod",
337+
)
338+
.example(
339+
"Create a static app from CI",
340+
"create --json --non-interactive --org my-org --app my-app --source local --runtime-mode static --static-dir dist --region us",
341+
)
322342
.globalOption("--endpoint <endpoint:string>", "the endpoint", {
323343
default: "https://console.deno.com",
324344
hidden: true,

sandbox/mod.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,12 @@ Example:
590590
export const sandboxCommand = new Command<GlobalContext>()
591591
.name("deno sandbox")
592592
.version(VERSION)
593-
.description("Interact with sandboxes")
593+
.description(`Interact with sandboxes
594+
595+
For headless / CI use, authenticate via the DENO_DEPLOY_TOKEN env var
596+
(or --token) — no browser flow is opened when a token is supplied.
597+
See https://docs.deno.com/runtime/reference/cli/sandbox/ for the
598+
full reference.`)
594599
.globalOption("--endpoint <endpoint:string>", "the endpoint", {
595600
default: "https://console.deno.com",
596601
hidden: true,

0 commit comments

Comments
 (0)