From ae3371e3f106aa66377ac802d55cc1593ff1ee93 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Date: Thu, 26 Feb 2026 23:48:31 -0800 Subject: [PATCH 1/2] feat: add --request and --check flags to netlify login for agent-friendly auth Agents can't complete the browser-based OAuth flow on their own. This adds a non-blocking two-step flow: create a ticket with --request to get a shareable URL, then check its status with --check to finalize login. Co-Authored-By: Claude Opus 4.6 --- docs/commands/agents.md | 14 +-- docs/commands/api.md | 4 +- docs/commands/blobs.md | 18 ++-- docs/commands/build.md | 4 +- docs/commands/clone.md | 4 +- docs/commands/completion.md | 2 +- docs/commands/db.md | 8 +- docs/commands/dev.md | 4 +- docs/commands/env.md | 24 ++--- docs/commands/functions.md | 18 ++-- docs/commands/init.md | 4 +- docs/commands/link.md | 4 +- docs/commands/login.md | 5 +- docs/commands/logs.md | 8 +- docs/commands/open.md | 8 +- docs/commands/recipes.md | 4 +- docs/commands/sites.md | 10 +- docs/commands/status.md | 6 +- docs/commands/unlink.md | 2 +- docs/commands/watch.md | 2 +- src/commands/base-command.ts | 45 +++++---- src/commands/login/index.ts | 3 + src/commands/login/login-check.ts | 56 +++++++++++ src/commands/login/login-request.ts | 25 +++++ src/commands/login/login.ts | 18 +++- src/commands/main.ts | 5 +- .../help/__snapshots__/help.test.ts.snap | 3 + tests/unit/commands/login/login-check.test.ts | 92 +++++++++++++++++++ .../unit/commands/login/login-request.test.ts | 52 +++++++++++ 29 files changed, 358 insertions(+), 94 deletions(-) create mode 100644 src/commands/login/login-check.ts create mode 100644 src/commands/login/login-request.ts create mode 100644 tests/unit/commands/login/login-check.test.ts create mode 100644 tests/unit/commands/login/login-request.test.ts diff --git a/docs/commands/agents.md b/docs/commands/agents.md index 1f6cafdee62..215b3c64aee 100644 --- a/docs/commands/agents.md +++ b/docs/commands/agents.md @@ -21,9 +21,9 @@ netlify agents **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -91,12 +91,12 @@ netlify agents:list **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - output result as JSON - `project` (*string*) - project ID or name (if not in a linked directory) - `status` (*string*) - filter by status (new, running, done, error, cancelled) -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -123,11 +123,11 @@ netlify agents:show **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - output result as JSON - `project` (*string*) - project ID or name (if not in a linked directory) -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -153,11 +153,11 @@ netlify agents:stop **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - output result as JSON - `project` (*string*) - project ID or name (if not in a linked directory) -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/api.md b/docs/commands/api.md index a5561037f92..f5b74c676f8 100644 --- a/docs/commands/api.md +++ b/docs/commands/api.md @@ -24,10 +24,10 @@ netlify api **Flags** -- `data` (*string*) - Data to use -- `list` (*boolean*) - List out available API methods - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `data` (*string*) - Data to use +- `list` (*boolean*) - List out available API methods **Examples** diff --git a/docs/commands/blobs.md b/docs/commands/blobs.md index a0a6fb52b4f..a9c6b3d82cb 100644 --- a/docs/commands/blobs.md +++ b/docs/commands/blobs.md @@ -18,9 +18,9 @@ netlify blobs **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -59,10 +59,10 @@ netlify blobs:delete **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `force` (*boolean*) - Bypasses prompts & Force the command to run. - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `force` (*boolean*) - Bypasses prompts & Force the command to run. --- ## `blobs:get` @@ -82,10 +82,10 @@ netlify blobs:get **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `output` (*string*) - Defines the filesystem path where the blob data should be persisted - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `output` (*string*) - Defines the filesystem path where the blob data should be persisted --- ## `blobs:list` @@ -104,12 +104,12 @@ netlify blobs:list **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `directories` (*boolean*) - Indicates that keys with the '/' character should be treated as directories, returning a list of sub-directories at a given level rather than all the keys inside them - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output list contents as JSON - `prefix` (*string*) - A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `blobs:set` @@ -130,11 +130,11 @@ netlify blobs:set **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `input` (*string*) - Defines the filesystem path where the blob data should be read from -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/build.md b/docs/commands/build.md index 2b345292b36..1da787629f2 100644 --- a/docs/commands/build.md +++ b/docs/commands/build.md @@ -17,11 +17,11 @@ netlify build **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables read during the build (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: value of CONTEXT or ”production”) - `dry` (*boolean*) - Dry run: show instructions without running them - `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `offline` (*boolean*) - Disables any features that require network access **Examples** diff --git a/docs/commands/clone.md b/docs/commands/clone.md index d67d38b62b5..c82806c8769 100644 --- a/docs/commands/clone.md +++ b/docs/commands/clone.md @@ -28,11 +28,11 @@ netlify clone **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `id` (*string*) - ID of existing Netlify project to link to - `name` (*string*) - Name of existing Netlify project to link to -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/completion.md b/docs/commands/completion.md index 71e9ee5d967..c460b785bfb 100644 --- a/docs/commands/completion.md +++ b/docs/commands/completion.md @@ -46,9 +46,9 @@ netlify completion:install **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in --- diff --git a/docs/commands/db.md b/docs/commands/db.md index de8ca48e83c..dbf21b4d75f 100644 --- a/docs/commands/db.md +++ b/docs/commands/db.md @@ -19,9 +19,9 @@ netlify db **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -51,12 +51,12 @@ netlify init **Flags** - `assume-no` (*boolean*) - Non-interactive setup. Does not initialize any third-party tools/boilerplate. Ideal for CI environments or AI tools. -- `boilerplate` (*drizzle*) - Type of boilerplate to add to your project. -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `overwrite` (*boolean*) - Overwrites existing files that would be created when setting up boilerplate - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `boilerplate` (*drizzle*) - Type of boilerplate to add to your project. +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `no-boilerplate` (*boolean*) - Don't add any boilerplate to your project. +- `overwrite` (*boolean*) - Overwrites existing files that would be created when setting up boilerplate **Examples** diff --git a/docs/commands/dev.md b/docs/commands/dev.md index cba068156ce..a873f732a89 100644 --- a/docs/commands/dev.md +++ b/docs/commands/dev.md @@ -78,10 +78,10 @@ netlify dev:exec **Flags** -- `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: dev) -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: dev) +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** diff --git a/docs/commands/env.md b/docs/commands/env.md index f21e118241a..3aa7b84789b 100644 --- a/docs/commands/env.md +++ b/docs/commands/env.md @@ -18,9 +18,9 @@ netlify env **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -56,12 +56,12 @@ netlify env:clone **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `from` (*string*) - Project ID (From) - `to` (*string*) - Project ID (To) -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -87,11 +87,11 @@ netlify env:get **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output environment variables as JSON -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope **Examples** @@ -120,11 +120,11 @@ netlify env:import **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output environment variables as JSON - `replace-existing` (*boolean*) - Replace all existing variables instead of merging them with the current ones -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `env:list` @@ -139,13 +139,13 @@ netlify env:list **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: all contexts) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output environment variables as JSON -- `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `plain` (*boolean*) - Output environment variables as plaintext +- `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope **Examples** @@ -214,12 +214,12 @@ netlify env:unset **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: all contexts) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `json` (*boolean*) - Output environment variables as JSON -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/functions.md b/docs/commands/functions.md index 11f5da7b1ba..fc30702f885 100644 --- a/docs/commands/functions.md +++ b/docs/commands/functions.md @@ -19,9 +19,9 @@ netlify functions **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -52,11 +52,11 @@ netlify functions:build **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `functions` (*string*) - Specify a functions directory to build to - `src` (*string*) - Specify the source directory for the functions -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `functions:create` @@ -75,13 +75,13 @@ netlify functions:create **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `language` (*string*) - function language - `name` (*string*) - function name - `offline` (*boolean*) - Disables any features that require network access - `url` (*string*) - pull template from URL -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -149,11 +149,11 @@ netlify functions:list **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `functions` (*string*) - Specify a functions directory to list - `json` (*boolean*) - Output function data as JSON -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `functions:serve` @@ -168,12 +168,12 @@ netlify functions:serve **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `functions` (*string*) - Specify a functions directory to serve - `offline` (*boolean*) - Disables any features that require network access - `port` (*string*) - Specify a port for the functions server -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/init.md b/docs/commands/init.md index 9aa21e7e4fe..7521d8b24c0 100644 --- a/docs/commands/init.md +++ b/docs/commands/init.md @@ -18,12 +18,12 @@ netlify init **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Reinitialize CI hooks if the linked project is already configured to use CI - `git-remote-name` (*string*) - Name of Git remote to use. e.g. "origin" - `manual` (*boolean*) - Manually configure a git remote for CI -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in diff --git a/docs/commands/link.md b/docs/commands/link.md index 5d1b233e7b6..f7ad7656510 100644 --- a/docs/commands/link.md +++ b/docs/commands/link.md @@ -18,13 +18,13 @@ netlify link **Flags** +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `git-remote-name` (*string*) - Name of Git remote to use. e.g. "origin" - `git-remote-url` (*string*) - URL of the repository (or Github `owner/repo`) to link to - `id` (*string*) - ID of project to link to - `name` (*string*) - Name of project to link to -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/login.md b/docs/commands/login.md index 2fdd7b4865b..4ad07638734 100644 --- a/docs/commands/login.md +++ b/docs/commands/login.md @@ -19,9 +19,12 @@ netlify login **Flags** -- `new` (*boolean*) - Login to new Netlify account - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `check` (*string*) - Check the status of a login ticket created with --request +- `json` (*boolean*) - Output as JSON (for use with --request or --check) +- `new` (*boolean*) - Login to new Netlify account +- `request` (*string*) - Create a login ticket for agent/human-in-the-loop auth diff --git a/docs/commands/logs.md b/docs/commands/logs.md index 8c761e85b25..c5abf94a199 100644 --- a/docs/commands/logs.md +++ b/docs/commands/logs.md @@ -17,9 +17,9 @@ netlify logs **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -48,9 +48,9 @@ netlify logs:deploy **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in --- ## `logs:function` @@ -69,10 +69,10 @@ netlify logs:function **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `level` (*string*) - Log levels to stream. Choices are: trace, debug, info, warn, error, fatal - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `level` (*string*) - Log levels to stream. Choices are: trace, debug, info, warn, error, fatal **Examples** diff --git a/docs/commands/open.md b/docs/commands/open.md index fc15acdd7a9..1accfa6af95 100644 --- a/docs/commands/open.md +++ b/docs/commands/open.md @@ -18,10 +18,10 @@ netlify open **Flags** - `admin` (*boolean*) - Open Netlify project -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `site` (*boolean*) - Open project - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `site` (*boolean*) - Open project | Subcommand | description | |:--------------------------- |:-----| @@ -51,9 +51,9 @@ netlify open:admin **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** @@ -74,9 +74,9 @@ netlify open:site **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** diff --git a/docs/commands/recipes.md b/docs/commands/recipes.md index dcd1ed9ced1..29f5ddbd8a7 100644 --- a/docs/commands/recipes.md +++ b/docs/commands/recipes.md @@ -21,9 +21,9 @@ netlify recipes **Flags** -- `name` (*string*) - recipe name to use - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `name` (*string*) - recipe name to use | Subcommand | description | |:--------------------------- |:-----| @@ -50,9 +50,9 @@ netlify recipes:list **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** diff --git a/docs/commands/sites.md b/docs/commands/sites.md index 94ef29bcad2..69f65660496 100644 --- a/docs/commands/sites.md +++ b/docs/commands/sites.md @@ -19,9 +19,9 @@ netlify sites **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -78,10 +78,10 @@ netlify sites:delete **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `force` (*boolean*) - Delete without prompting (useful for CI). - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `force` (*boolean*) - Delete without prompting (useful for CI). **Examples** @@ -102,10 +102,10 @@ netlify sites:list **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `json` (*boolean*) - Output project data as JSON - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `json` (*boolean*) - Output project data as JSON --- diff --git a/docs/commands/status.md b/docs/commands/status.md index 9529891046a..8a76f13fe28 100644 --- a/docs/commands/status.md +++ b/docs/commands/status.md @@ -18,10 +18,10 @@ netlify status **Flags** -- `json` (*boolean*) - Output status information as JSON -- `verbose` (*boolean*) - Output system info - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `json` (*boolean*) - Output status information as JSON +- `verbose` (*boolean*) - Output system info | Subcommand | description | |:--------------------------- |:-----| @@ -41,9 +41,9 @@ netlify status:hooks **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in --- diff --git a/docs/commands/unlink.md b/docs/commands/unlink.md index 030a0506d15..c44e1f780e9 100644 --- a/docs/commands/unlink.md +++ b/docs/commands/unlink.md @@ -18,9 +18,9 @@ netlify unlink **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in diff --git a/docs/commands/watch.md b/docs/commands/watch.md index ac7062847d5..95a4c45727d 100644 --- a/docs/commands/watch.md +++ b/docs/commands/watch.md @@ -18,9 +18,9 @@ netlify watch **Flags** -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** diff --git a/src/commands/base-command.ts b/src/commands/base-command.ts index 99e1eb360e5..d710b892c96 100644 --- a/src/commands/base-command.ts +++ b/src/commands/base-command.ts @@ -51,7 +51,7 @@ type Analytics = { inquirer.registerPrompt('autocomplete', inquirerAutocompletePrompt) /** Netlify CLI client id. Lives in bot@netlify.com */ // TODO: setup client for multiple environments -const CLIENT_ID = 'd6f37de6614df7ae58664cfca524744d73807a377f5ee71f1a254f78412e3750' +export const CLIENT_ID = 'd6f37de6614df7ae58664cfca524744d73807a377f5ee71f1a254f78412e3750' const NANO_SECS_TO_MSECS = 1e6 /** The fallback width for the help terminal */ @@ -175,6 +175,26 @@ export type BaseOptionValues = { verbose?: boolean } +export function storeToken( + globalConfig: Awaited>, + { userId, name, email, accessToken }: { userId: string; name?: string; email?: string; accessToken: string }, +) { + const userData = merge(globalConfig.get(`users.${userId}`), { + id: userId, + name, + email, + auth: { + token: accessToken, + github: { + user: undefined, + token: undefined, + }, + }, + }) + globalConfig.set('userId', userId) + globalConfig.set(`users.${userId}`, userData) +} + /** Base command class that provides tracking and config initialization */ export default class BaseCommand extends Command { /** The netlify object inside each command with the state */ @@ -441,6 +461,9 @@ export default class BaseCommand extends Command { log(`Opening ${authLink}`) await openBrowser({ url: authLink }) + log() + log(`To request authorization from a human, run: ${chalk.cyanBright('netlify login --request ""')}`) + log() const accessToken = await pollForToken({ api: this.netlify.api, @@ -448,23 +471,11 @@ export default class BaseCommand extends Command { }) const { email, full_name: name, id: userId } = await this.netlify.api.getCurrentUser() + if (!userId) { + return logAndThrowError('Could not retrieve user ID from Netlify API') + } - const userData = merge(this.netlify.globalConfig.get(`users.${userId}`), { - id: userId, - name, - email, - auth: { - token: accessToken, - github: { - user: undefined, - token: undefined, - }, - }, - }) - // Set current userId - this.netlify.globalConfig.set('userId', userId) - // Set user data - this.netlify.globalConfig.set(`users.${userId}`, userData) + storeToken(this.netlify.globalConfig, { userId, name, email, accessToken }) await identify({ name, diff --git a/src/commands/login/index.ts b/src/commands/login/index.ts index 11aa119a2a7..e97caff7d26 100644 --- a/src/commands/login/index.ts +++ b/src/commands/login/index.ts @@ -11,6 +11,9 @@ export const createLoginCommand = (program: BaseCommand) => Opens a web browser to acquire an OAuth token.`, ) .option('--new', 'Login to new Netlify account') + .option('--request ', 'Create a login ticket for agent/human-in-the-loop auth') + .option('--check ', 'Check the status of a login ticket created with --request') + .option('--json', 'Output as JSON (for use with --request or --check)') .addHelpText('after', () => { const docsUrl = 'https://docs.netlify.com/cli/get-started/#authentication' return ` diff --git a/src/commands/login/login-check.ts b/src/commands/login/login-check.ts new file mode 100644 index 00000000000..24afd2b25e9 --- /dev/null +++ b/src/commands/login/login-check.ts @@ -0,0 +1,56 @@ +import { NetlifyAPI } from '@netlify/api' +import { getGlobalConfigStore } from '@netlify/dev-utils' +import { OptionValues } from 'commander' + +import { log, logAndThrowError, logJson, USER_AGENT } from '../../utils/command-helpers.js' +import { storeToken } from '../base-command.js' + +export const loginCheck = async (options: OptionValues) => { + const ticketId = options.check as string + + const api = new NetlifyAPI('', { userAgent: USER_AGENT }) + + let ticket: { authorized?: boolean } + try { + ticket = await api.showTicket({ ticketId }) + } catch { + logJson({ status: 'denied' }) + log('Status: denied') + return + } + + if (!ticket.authorized) { + logJson({ status: 'pending' }) + log('Status: pending') + return + } + + const tokenResponse = await api.exchangeTicket({ ticketId }) + const accessToken = tokenResponse.access_token + if (!accessToken) { + return logAndThrowError('Could not retrieve access token') + } + + api.accessToken = accessToken + const user = await api.getCurrentUser() + if (!user.id) { + return logAndThrowError('Could not retrieve user ID from Netlify API') + } + + const globalConfig = await getGlobalConfigStore() + storeToken(globalConfig, { + userId: user.id, + name: user.full_name, + email: user.email, + accessToken, + }) + + logJson({ + status: 'authorized', + user: { id: user.id, email: user.email, name: user.full_name }, + }) + + log('Status: authorized') + log(`Name: ${user.full_name ?? ''}`) + log(`Email: ${user.email ?? ''}`) +} diff --git a/src/commands/login/login-request.ts b/src/commands/login/login-request.ts new file mode 100644 index 00000000000..3ebcd251b47 --- /dev/null +++ b/src/commands/login/login-request.ts @@ -0,0 +1,25 @@ +import { NetlifyAPI } from '@netlify/api' + +import { log, logAndThrowError, logJson, USER_AGENT } from '../../utils/command-helpers.js' +import { CLIENT_ID } from '../base-command.js' + +export const loginRequest = async () => { + const webUI = process.env.NETLIFY_WEB_UI || 'https://app.netlify.com' + + const api = new NetlifyAPI('', { userAgent: USER_AGENT }) + + const ticket = await api.createTicket({ clientId: CLIENT_ID }) + + if (!ticket.id) { + return logAndThrowError('Failed to create login ticket') + } + const ticketId = ticket.id + const url = `${webUI}/authorize?response_type=ticket&ticket=${ticketId}` + + logJson({ ticket_id: ticketId, url, check_command: `netlify login --check ${ticketId}` }) + + log(`Ticket ID: ${ticketId}`) + log(`Authorize URL: ${url}`) + log() + log(`After authorizing, run: netlify login --check ${ticketId}`) +} diff --git a/src/commands/login/login.ts b/src/commands/login/login.ts index c4ca33f562b..fe232dc9621 100644 --- a/src/commands/login/login.ts +++ b/src/commands/login/login.ts @@ -1,6 +1,6 @@ import { OptionValues } from 'commander' -import { chalk, exit, getToken, log } from '../../utils/command-helpers.js' +import { chalk, exit, getToken, log, logAndThrowError } from '../../utils/command-helpers.js' import { TokenLocation } from '../../utils/types.js' import BaseCommand from '../base-command.js' @@ -18,6 +18,22 @@ const msg = function (location: TokenLocation) { } export const login = async (options: OptionValues, command: BaseCommand) => { + if (options.request && options.check) { + return logAndThrowError('`--request` and `--check` are mutually exclusive') + } + + if (options.request) { + const { loginRequest } = await import('./login-request.js') + await loginRequest() + return + } + + if (options.check) { + const { loginCheck } = await import('./login-check.js') + await loginCheck(options) + return + } + const [accessToken, location] = await getToken() command.setAnalyticsPayload({ new: options.new }) diff --git a/src/commands/main.ts b/src/commands/main.ts index cc8724ea8d4..5b1e95b4ed9 100644 --- a/src/commands/main.ts +++ b/src/commands/main.ts @@ -255,7 +255,10 @@ export const createMainCommand = (): BaseCommand => { const cliDocsEntrypointUrl = 'https://developers.netlify.com/cli' const docsUrl = 'https://docs.netlify.com' const bugsUrl = pkg.bugs?.url ?? '' - return `→ For more help with the CLI, visit ${NETLIFY_CYAN( + return `To get started run: ${NETLIFY_CYAN('netlify login')} +To ask a human for credentials: ${NETLIFY_CYAN('netlify login --request ')} + +→ For more help with the CLI, visit ${NETLIFY_CYAN( terminalLink(cliDocsEntrypointUrl, cliDocsEntrypointUrl, { fallback: false }), )} → For help with Netlify, visit ${NETLIFY_CYAN(terminalLink(docsUrl, docsUrl, { fallback: false }))} diff --git a/tests/integration/commands/help/__snapshots__/help.test.ts.snap b/tests/integration/commands/help/__snapshots__/help.test.ts.snap index c564dcaa2d9..4422d3af839 100644 --- a/tests/integration/commands/help/__snapshots__/help.test.ts.snap +++ b/tests/integration/commands/help/__snapshots__/help.test.ts.snap @@ -41,6 +41,9 @@ COMMANDS $ unlink Unlink a local folder from a Netlify project $ watch Watch for project deploy to finish +To get started run: netlify login +To ask a human for credentials: netlify login --request + → For more help with the CLI, visit https://developers.netlify.com/cli → For help with Netlify, visit https://docs.netlify.com → To report a CLI bug, visit https://github.com/netlify/cli/issues" diff --git a/tests/unit/commands/login/login-check.test.ts b/tests/unit/commands/login/login-check.test.ts new file mode 100644 index 00000000000..e33ed8b6b0e --- /dev/null +++ b/tests/unit/commands/login/login-check.test.ts @@ -0,0 +1,92 @@ +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + showTicket: vi.fn(), + exchangeTicket: vi.fn(), + getCurrentUser: vi.fn(), + globalConfigGet: vi.fn().mockReturnValue({}), + globalConfigSet: vi.fn(), +})) + +vi.mock('@netlify/api', () => ({ + NetlifyAPI: vi.fn().mockImplementation(() => ({ + showTicket: mocks.showTicket, + exchangeTicket: mocks.exchangeTicket, + getCurrentUser: mocks.getCurrentUser, + set accessToken(_val: string) { + // no-op for test + }, + })), +})) + +vi.mock('@netlify/dev-utils', () => ({ + getGlobalConfigStore: vi.fn().mockResolvedValue({ + get: mocks.globalConfigGet, + set: mocks.globalConfigSet, + }), +})) + +import { loginCheck } from '../../../../src/commands/login/login-check.js' + +describe('loginCheck', () => { + let stdoutOutput: string[] + const originalWrite = process.stdout.write.bind(process.stdout) + + beforeEach(() => { + stdoutOutput = [] + process.stdout.write = vi.fn((chunk: string) => { + stdoutOutput.push(chunk) + return true + }) as typeof process.stdout.write + }) + + afterEach(() => { + process.stdout.write = originalWrite + }) + + test('outputs pending when ticket is not authorized', async () => { + mocks.showTicket.mockResolvedValue({ authorized: false }) + + await loginCheck({ check: 'ticket-abc' }) + + const output = stdoutOutput.join('') + expect(output).toContain('Status: pending') + }) + + test('outputs denied when showTicket throws', async () => { + mocks.showTicket.mockRejectedValue(new Error('Not found')) + + await loginCheck({ check: 'ticket-bad' }) + + const output = stdoutOutput.join('') + expect(output).toContain('Status: denied') + }) + + test('outputs authorized and stores token when ticket is authorized', async () => { + mocks.showTicket.mockResolvedValue({ authorized: true }) + mocks.exchangeTicket.mockResolvedValue({ access_token: 'test-token-xyz' }) + mocks.getCurrentUser.mockResolvedValue({ + id: 'user-1', + email: 'test@example.com', + full_name: 'Test User', + }) + + await loginCheck({ check: 'ticket-ok' }) + + const output = stdoutOutput.join('') + expect(output).toContain('Status: authorized') + expect(output).toContain('Name: Test User') + expect(output).toContain('Email: test@example.com') + + expect(mocks.globalConfigSet).toHaveBeenCalledWith('userId', 'user-1') + expect(mocks.globalConfigSet).toHaveBeenCalledWith( + 'users.user-1', + expect.objectContaining({ + id: 'user-1', + email: 'test@example.com', + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + auth: expect.objectContaining({ token: 'test-token-xyz' }), + }), + ) + }) +}) diff --git a/tests/unit/commands/login/login-request.test.ts b/tests/unit/commands/login/login-request.test.ts new file mode 100644 index 00000000000..14ff51e57cb --- /dev/null +++ b/tests/unit/commands/login/login-request.test.ts @@ -0,0 +1,52 @@ +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest' + +const mocks = vi.hoisted(() => ({ + createTicket: vi.fn().mockResolvedValue({ id: 'test-ticket-123' }), +})) + +vi.mock('@netlify/api', () => ({ + NetlifyAPI: vi.fn().mockImplementation(() => ({ + createTicket: mocks.createTicket, + })), +})) + +import { loginRequest } from '../../../../src/commands/login/login-request.js' + +describe('loginRequest', () => { + let stdoutOutput: string[] + const originalEnv = { ...process.env } + const originalWrite = process.stdout.write.bind(process.stdout) + + beforeEach(() => { + stdoutOutput = [] + process.stdout.write = vi.fn((chunk: string) => { + stdoutOutput.push(chunk) + return true + }) as typeof process.stdout.write + }) + + afterEach(() => { + process.env = { ...originalEnv } + process.stdout.write = originalWrite + }) + + test('outputs ticket info as plain text', async () => { + await loginRequest() + + const output = stdoutOutput.join('') + expect(output).toContain('Ticket ID: test-ticket-123') + expect(output).toContain( + 'Authorize URL: https://app.netlify.com/authorize?response_type=ticket&ticket=test-ticket-123', + ) + expect(output).toContain('netlify login --check test-ticket-123') + }) + + test('uses custom NETLIFY_WEB_UI when set', async () => { + process.env.NETLIFY_WEB_UI = 'https://custom.netlify.com' + + await loginRequest() + + const output = stdoutOutput.join('') + expect(output).toContain('https://custom.netlify.com/authorize?response_type=ticket&ticket=test-ticket-123') + }) +}) From 358955c14b0d5ecd45b9ff977ef4207d0e7c4efa Mon Sep 17 00:00:00 2001 From: DavidWells Date: Fri, 27 Feb 2026 08:15:55 -0800 Subject: [PATCH 2/2] docs sync via npm run docs --- docs/commands/agents.md | 14 +++++++------- docs/commands/api.md | 4 ++-- docs/commands/blobs.md | 18 +++++++++--------- docs/commands/build.md | 4 ++-- docs/commands/clone.md | 4 ++-- docs/commands/completion.md | 2 +- docs/commands/db.md | 8 ++++---- docs/commands/dev.md | 4 ++-- docs/commands/env.md | 24 ++++++++++++------------ docs/commands/functions.md | 18 +++++++++--------- docs/commands/init.md | 4 ++-- docs/commands/link.md | 4 ++-- docs/commands/login.md | 4 ++-- docs/commands/logs.md | 8 ++++---- docs/commands/open.md | 8 ++++---- docs/commands/recipes.md | 4 ++-- docs/commands/sites.md | 10 +++++----- docs/commands/status.md | 6 +++--- docs/commands/unlink.md | 2 +- docs/commands/watch.md | 2 +- 20 files changed, 76 insertions(+), 76 deletions(-) diff --git a/docs/commands/agents.md b/docs/commands/agents.md index 215b3c64aee..1f6cafdee62 100644 --- a/docs/commands/agents.md +++ b/docs/commands/agents.md @@ -21,9 +21,9 @@ netlify agents **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -91,12 +91,12 @@ netlify agents:list **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - output result as JSON - `project` (*string*) - project ID or name (if not in a linked directory) - `status` (*string*) - filter by status (new, running, done, error, cancelled) +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -123,11 +123,11 @@ netlify agents:show **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - output result as JSON - `project` (*string*) - project ID or name (if not in a linked directory) +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -153,11 +153,11 @@ netlify agents:stop **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - output result as JSON - `project` (*string*) - project ID or name (if not in a linked directory) +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/api.md b/docs/commands/api.md index f5b74c676f8..a5561037f92 100644 --- a/docs/commands/api.md +++ b/docs/commands/api.md @@ -24,10 +24,10 @@ netlify api **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `data` (*string*) - Data to use - `list` (*boolean*) - List out available API methods +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/blobs.md b/docs/commands/blobs.md index a9c6b3d82cb..a0a6fb52b4f 100644 --- a/docs/commands/blobs.md +++ b/docs/commands/blobs.md @@ -18,9 +18,9 @@ netlify blobs **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -59,10 +59,10 @@ netlify blobs:delete **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `blobs:get` @@ -82,10 +82,10 @@ netlify blobs:get **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `output` (*string*) - Defines the filesystem path where the blob data should be persisted +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `blobs:list` @@ -104,12 +104,12 @@ netlify blobs:list **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `directories` (*boolean*) - Indicates that keys with the '/' character should be treated as directories, returning a list of sub-directories at a given level rather than all the keys inside them - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output list contents as JSON - `prefix` (*string*) - A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `blobs:set` @@ -130,11 +130,11 @@ netlify blobs:set **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `input` (*string*) - Defines the filesystem path where the blob data should be read from +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/build.md b/docs/commands/build.md index 1da787629f2..2b345292b36 100644 --- a/docs/commands/build.md +++ b/docs/commands/build.md @@ -17,11 +17,11 @@ netlify build **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables read during the build (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: value of CONTEXT or ”production”) - `dry` (*boolean*) - Dry run: show instructions without running them - `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `offline` (*boolean*) - Disables any features that require network access **Examples** diff --git a/docs/commands/clone.md b/docs/commands/clone.md index c82806c8769..d67d38b62b5 100644 --- a/docs/commands/clone.md +++ b/docs/commands/clone.md @@ -28,11 +28,11 @@ netlify clone **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `id` (*string*) - ID of existing Netlify project to link to - `name` (*string*) - Name of existing Netlify project to link to +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/completion.md b/docs/commands/completion.md index c460b785bfb..71e9ee5d967 100644 --- a/docs/commands/completion.md +++ b/docs/commands/completion.md @@ -46,9 +46,9 @@ netlify completion:install **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in --- diff --git a/docs/commands/db.md b/docs/commands/db.md index dbf21b4d75f..de8ca48e83c 100644 --- a/docs/commands/db.md +++ b/docs/commands/db.md @@ -19,9 +19,9 @@ netlify db **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -51,12 +51,12 @@ netlify init **Flags** - `assume-no` (*boolean*) - Non-interactive setup. Does not initialize any third-party tools/boilerplate. Ideal for CI environments or AI tools. -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `boilerplate` (*drizzle*) - Type of boilerplate to add to your project. - `filter` (*string*) - For monorepos, specify the name of the application to run the command in -- `no-boilerplate` (*boolean*) - Don't add any boilerplate to your project. - `overwrite` (*boolean*) - Overwrites existing files that would be created when setting up boilerplate +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `no-boilerplate` (*boolean*) - Don't add any boilerplate to your project. **Examples** diff --git a/docs/commands/dev.md b/docs/commands/dev.md index a873f732a89..cba068156ce 100644 --- a/docs/commands/dev.md +++ b/docs/commands/dev.md @@ -78,10 +78,10 @@ netlify dev:exec **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: dev) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/env.md b/docs/commands/env.md index 3aa7b84789b..f21e118241a 100644 --- a/docs/commands/env.md +++ b/docs/commands/env.md @@ -18,9 +18,9 @@ netlify env **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -56,12 +56,12 @@ netlify env:clone **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `from` (*string*) - Project ID (From) - `to` (*string*) - Project ID (To) +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -87,11 +87,11 @@ netlify env:get **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output environment variables as JSON +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope **Examples** @@ -120,11 +120,11 @@ netlify env:import **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output environment variables as JSON - `replace-existing` (*boolean*) - Replace all existing variables instead of merging them with the current ones +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `env:list` @@ -139,13 +139,13 @@ netlify env:list **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: all contexts) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output environment variables as JSON -- `plain` (*boolean*) - Output environment variables as plaintext - `scope` (*builds | functions | post-processing | runtime | any*) - Specify a scope +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in +- `plain` (*boolean*) - Output environment variables as plaintext **Examples** @@ -214,12 +214,12 @@ netlify env:unset **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `context` (*string*) - Specify a deploy context for environment variables (”production”, ”deploy-preview”, ”branch-deploy”, ”dev”) or `branch:your-branch` where `your-branch` is the name of a branch (default: all contexts) - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Bypasses prompts & Force the command to run. - `json` (*boolean*) - Output environment variables as JSON +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/functions.md b/docs/commands/functions.md index fc30702f885..11f5da7b1ba 100644 --- a/docs/commands/functions.md +++ b/docs/commands/functions.md @@ -19,9 +19,9 @@ netlify functions **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -52,11 +52,11 @@ netlify functions:build **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `functions` (*string*) - Specify a functions directory to build to - `src` (*string*) - Specify the source directory for the functions +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `functions:create` @@ -75,13 +75,13 @@ netlify functions:create **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `language` (*string*) - function language - `name` (*string*) - function name - `offline` (*boolean*) - Disables any features that require network access - `url` (*string*) - pull template from URL +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -149,11 +149,11 @@ netlify functions:list **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `functions` (*string*) - Specify a functions directory to list - `json` (*boolean*) - Output function data as JSON +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- ## `functions:serve` @@ -168,12 +168,12 @@ netlify functions:serve **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `functions` (*string*) - Specify a functions directory to serve - `offline` (*boolean*) - Disables any features that require network access - `port` (*string*) - Specify a port for the functions server +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/init.md b/docs/commands/init.md index 7521d8b24c0..9aa21e7e4fe 100644 --- a/docs/commands/init.md +++ b/docs/commands/init.md @@ -18,12 +18,12 @@ netlify init **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Reinitialize CI hooks if the linked project is already configured to use CI - `git-remote-name` (*string*) - Name of Git remote to use. e.g. "origin" - `manual` (*boolean*) - Manually configure a git remote for CI +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in diff --git a/docs/commands/link.md b/docs/commands/link.md index f7ad7656510..5d1b233e7b6 100644 --- a/docs/commands/link.md +++ b/docs/commands/link.md @@ -18,13 +18,13 @@ netlify link **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `git-remote-name` (*string*) - Name of Git remote to use. e.g. "origin" - `git-remote-url` (*string*) - URL of the repository (or Github `owner/repo`) to link to - `id` (*string*) - ID of project to link to - `name` (*string*) - Name of project to link to +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/login.md b/docs/commands/login.md index 4ad07638734..6304e5dceb4 100644 --- a/docs/commands/login.md +++ b/docs/commands/login.md @@ -19,12 +19,12 @@ netlify login **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `check` (*string*) - Check the status of a login ticket created with --request - `json` (*boolean*) - Output as JSON (for use with --request or --check) - `new` (*boolean*) - Login to new Netlify account - `request` (*string*) - Create a login ticket for agent/human-in-the-loop auth +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in diff --git a/docs/commands/logs.md b/docs/commands/logs.md index c5abf94a199..8c761e85b25 100644 --- a/docs/commands/logs.md +++ b/docs/commands/logs.md @@ -17,9 +17,9 @@ netlify logs **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -48,9 +48,9 @@ netlify logs:deploy **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in --- ## `logs:function` @@ -69,10 +69,10 @@ netlify logs:function **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `level` (*string*) - Log levels to stream. Choices are: trace, debug, info, warn, error, fatal +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** diff --git a/docs/commands/open.md b/docs/commands/open.md index 1accfa6af95..fc15acdd7a9 100644 --- a/docs/commands/open.md +++ b/docs/commands/open.md @@ -18,10 +18,10 @@ netlify open **Flags** - `admin` (*boolean*) - Open Netlify project -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `site` (*boolean*) - Open project +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -51,9 +51,9 @@ netlify open:admin **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** @@ -74,9 +74,9 @@ netlify open:site **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** diff --git a/docs/commands/recipes.md b/docs/commands/recipes.md index 29f5ddbd8a7..dcd1ed9ced1 100644 --- a/docs/commands/recipes.md +++ b/docs/commands/recipes.md @@ -21,9 +21,9 @@ netlify recipes **Flags** +- `name` (*string*) - recipe name to use - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `name` (*string*) - recipe name to use | Subcommand | description | |:--------------------------- |:-----| @@ -50,9 +50,9 @@ netlify recipes:list **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples** diff --git a/docs/commands/sites.md b/docs/commands/sites.md index 69f65660496..94ef29bcad2 100644 --- a/docs/commands/sites.md +++ b/docs/commands/sites.md @@ -19,9 +19,9 @@ netlify sites **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in | Subcommand | description | |:--------------------------- |:-----| @@ -78,10 +78,10 @@ netlify sites:delete **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `force` (*boolean*) - Delete without prompting (useful for CI). +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in **Examples** @@ -102,10 +102,10 @@ netlify sites:list **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `json` (*boolean*) - Output project data as JSON +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in --- diff --git a/docs/commands/status.md b/docs/commands/status.md index 8a76f13fe28..9529891046a 100644 --- a/docs/commands/status.md +++ b/docs/commands/status.md @@ -18,10 +18,10 @@ netlify status **Flags** -- `debug` (*boolean*) - Print debugging information -- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in - `json` (*boolean*) - Output status information as JSON - `verbose` (*boolean*) - Output system info +- `debug` (*boolean*) - Print debugging information +- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in | Subcommand | description | |:--------------------------- |:-----| @@ -41,9 +41,9 @@ netlify status:hooks **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in --- diff --git a/docs/commands/unlink.md b/docs/commands/unlink.md index c44e1f780e9..030a0506d15 100644 --- a/docs/commands/unlink.md +++ b/docs/commands/unlink.md @@ -18,9 +18,9 @@ netlify unlink **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in diff --git a/docs/commands/watch.md b/docs/commands/watch.md index 95a4c45727d..ac7062847d5 100644 --- a/docs/commands/watch.md +++ b/docs/commands/watch.md @@ -18,9 +18,9 @@ netlify watch **Flags** +- `filter` (*string*) - For monorepos, specify the name of the application to run the command in - `debug` (*boolean*) - Print debugging information - `auth` (*string*) - Netlify auth token - can be used to run this command without logging in -- `filter` (*string*) - For monorepos, specify the name of the application to run the command in **Examples**