@blinkdotnew/cli 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -190,35 +190,24 @@ blink usage # Usage breakdown
190
190
  blink usage --period month # Monthly summary
191
191
  ```
192
192
 
193
- ### Personal Access Tokens
194
-
195
- ```bash
196
- blink tokens list # List all PATs
197
- blink tokens create --name "CI key" # Create a new token (shown once)
198
- blink tokens revoke tok_xxx --yes # Revoke a token
199
- ```
200
-
201
193
  ## Authentication
202
194
 
203
- Three ways to authenticate, checked in this order:
204
-
205
- 1. **`--token` flag** — per-command override
206
- 2. **`BLINK_API_KEY` env var** — for CI/CD and coding agents
207
- 3. **Config file** — saved by `blink login --interactive` at `~/.config/blink/config.toml`
208
-
209
- Get your API key at [blink.new/settings?tab=api-keys](https://blink.new/settings?tab=api-keys).
195
+ Get your workspace API key from [blink.new/settings?tab=api-keys](https://blink.new/settings?tab=api-keys) (starts with `blnk_ak_`).
210
196
 
211
197
  ```bash
212
- # Interactive saves to config file
198
+ # Opens the API keys page in your browser, then prompts for the key
199
+ blink login
213
200
  blink login --interactive
214
201
 
215
- # Environment variable for CI/agents
202
+ # Or set the env var directly (CI/agents)
216
203
  export BLINK_API_KEY=blnk_ak_...
217
-
218
- # Per-command
219
- blink deploy ./dist --prod --token blnk_ak_...
220
204
  ```
221
205
 
206
+ Auth is resolved in this order:
207
+ 1. **`--token` flag** — per-command override
208
+ 2. **`BLINK_API_KEY` env var** — for CI/CD and coding agents
209
+ 3. **Config file** — saved by `blink login --interactive` at `~/.config/blink/config.toml`
210
+
222
211
  ## Project Context
223
212
 
224
213
  Commands that operate on a project resolve it in this order:
package/dist/cli.js CHANGED
@@ -2089,8 +2089,22 @@ For CI/GitHub Actions: set BLINK_API_KEY as a secret, skip login entirely.
2089
2089
  console.log(chalk10.green("\u2713") + " Already authenticated via BLINK_API_KEY env var.");
2090
2090
  return;
2091
2091
  }
2092
+ const url = "https://blink.new/settings?tab=api-keys";
2093
+ if (!opts.interactive) {
2094
+ console.log(chalk10.bold("\n Open this page to get your API key:\n"));
2095
+ console.log(` ${chalk10.cyan(url)}
2096
+ `);
2097
+ const open = await import("open").then((m) => m.default).catch(() => null);
2098
+ if (open) {
2099
+ await open(url).catch(() => {
2100
+ });
2101
+ console.log(chalk10.dim(" (opened in browser)"));
2102
+ }
2103
+ console.log(chalk10.dim(" Then run: blink login --interactive\n"));
2104
+ return;
2105
+ }
2092
2106
  const { password } = await import("@clack/prompts");
2093
- const apiKey = await password({ message: "Enter your Blink API key (blnk_ak_...):" });
2107
+ const apiKey = await password({ message: "Paste your API key (blnk_ak_...):" });
2094
2108
  if (!apiKey?.startsWith("blnk_ak_")) {
2095
2109
  console.error("Error: API key must start with blnk_ak_");
2096
2110
  process.exit(1);
@@ -3692,12 +3706,12 @@ var pkg = require2("../package.json");
3692
3706
  var program = new Command();
3693
3707
  program.name("blink").description("Blink platform CLI \u2014 build, deploy, and manage AI-powered apps").version(pkg.version).option("--token <key>", "Override API token for this command").option("--json", "Machine-readable JSON output (no colors, great for scripting)").option("-y, --yes", "Skip confirmation prompts").option("--debug", "Verbose request logging").option("--profile <name>", "Use named config profile from ~/.config/blink/config.toml").addHelpText("after", `
3694
3708
  Auth:
3695
- API key lives at blink.new \u2192 Settings \u2192 API Keys (starts with blnk_ak_)
3696
- $ blink login --interactive Save your API key to ~/.config/blink/config.toml
3697
- $ export BLINK_API_KEY=blnk_ak_... Or set env var directly (used in CI/agents)
3709
+ $ blink login Opens blink.new to copy your API key
3710
+ $ blink login --interactive Paste and save key to ~/.config/blink/config.toml
3711
+ $ export BLINK_API_KEY=blnk_ak_... Or set env var directly (CI/agents)
3698
3712
 
3699
3713
  Quick Start:
3700
- $ blink login --interactive Authenticate
3714
+ $ blink login Get your workspace API key
3701
3715
  $ blink link Link current dir to a project (interactive picker)
3702
3716
  $ npm run build && blink deploy ./dist --prod Build then deploy to production
3703
3717
 
@@ -3822,11 +3836,6 @@ Billing:
3822
3836
  $ blink credits Check credit balance
3823
3837
  $ blink usage Usage breakdown
3824
3838
 
3825
- Tokens (Personal Access Tokens):
3826
- $ blink tokens list List PATs
3827
- $ blink tokens create --name "CI" Create PAT (shown once!)
3828
- $ blink tokens revoke <id> --yes Revoke a PAT
3829
-
3830
3839
  Init:
3831
3840
  $ blink init Create project + link to current dir
3832
3841
  $ blink init --name "My App" Create with custom name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/cli",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Blink CLI — full-stack cloud infrastructure from your terminal. Deploy, database, auth, storage, backend, domains, and more.",
5
5
  "bin": {
6
6
  "blink": "dist/cli.js"
@@ -39,16 +39,17 @@
39
39
  "compile": "bun build src/cli.ts --compile --target bun --outfile dist/blink-bin"
40
40
  },
41
41
  "dependencies": {
42
+ "@clack/prompts": "^0.10.0",
42
43
  "chalk": "^5.3.0",
43
- "ora": "^8.1.1",
44
+ "cli-table3": "^0.6.5",
44
45
  "commander": "^12.1.0",
45
- "@clack/prompts": "^0.10.0",
46
- "cli-table3": "^0.6.5"
46
+ "open": "^11.0.0",
47
+ "ora": "^8.1.1"
47
48
  },
48
49
  "devDependencies": {
50
+ "@types/node": "^22.0.0",
49
51
  "tsup": "^8.3.0",
50
- "typescript": "^5.6.0",
51
- "@types/node": "^22.0.0"
52
+ "typescript": "^5.6.0"
52
53
  },
53
54
  "engines": {
54
55
  "node": ">=22"
package/src/cli.ts CHANGED
@@ -28,6 +28,8 @@ import { registerInitCommands } from './commands/init.js'
28
28
  import { registerWorkspaceCommands } from './commands/workspace.js'
29
29
  import { registerVersionCommands } from './commands/versions.js'
30
30
  import { registerBillingCommands } from './commands/billing.js'
31
+ // PAT tokens are deprecated in favor of workspace API keys (blnk_ak_*).
32
+ // The tokens command is kept for backward compat but hidden from help.
31
33
  import { registerTokenCommands } from './commands/tokens.js'
32
34
 
33
35
  const require = createRequire(import.meta.url)
@@ -46,12 +48,12 @@ program
46
48
  .option('--profile <name>', 'Use named config profile from ~/.config/blink/config.toml')
47
49
  .addHelpText('after', `
48
50
  Auth:
49
- API key lives at blink.new Settings API Keys (starts with blnk_ak_)
50
- $ blink login --interactive Save your API key to ~/.config/blink/config.toml
51
- $ export BLINK_API_KEY=blnk_ak_... Or set env var directly (used in CI/agents)
51
+ $ blink login Opens blink.new to copy your API key
52
+ $ blink login --interactive Paste and save key to ~/.config/blink/config.toml
53
+ $ export BLINK_API_KEY=blnk_ak_... Or set env var directly (CI/agents)
52
54
 
53
55
  Quick Start:
54
- $ blink login --interactive Authenticate
56
+ $ blink login Get your workspace API key
55
57
  $ blink link Link current dir to a project (interactive picker)
56
58
  $ npm run build && blink deploy ./dist --prod Build then deploy to production
57
59
 
@@ -176,11 +178,6 @@ Billing:
176
178
  $ blink credits Check credit balance
177
179
  $ blink usage Usage breakdown
178
180
 
179
- Tokens (Personal Access Tokens):
180
- $ blink tokens list List PATs
181
- $ blink tokens create --name "CI" Create PAT (shown once!)
182
- $ blink tokens revoke <id> --yes Revoke a PAT
183
-
184
181
  Init:
185
182
  $ blink init Create project + link to current dir
186
183
  $ blink init --name "My App" Create with custom name
@@ -24,8 +24,22 @@ For CI/GitHub Actions: set BLINK_API_KEY as a secret, skip login entirely.
24
24
  console.log(chalk.green('✓') + ' Already authenticated via BLINK_API_KEY env var.')
25
25
  return
26
26
  }
27
+
28
+ const url = 'https://blink.new/settings?tab=api-keys'
29
+ if (!opts.interactive) {
30
+ console.log(chalk.bold('\n Open this page to get your API key:\n'))
31
+ console.log(` ${chalk.cyan(url)}\n`)
32
+ const open = await import('open').then(m => m.default).catch(() => null)
33
+ if (open) {
34
+ await open(url).catch(() => {})
35
+ console.log(chalk.dim(' (opened in browser)'))
36
+ }
37
+ console.log(chalk.dim(' Then run: blink login --interactive\n'))
38
+ return
39
+ }
40
+
27
41
  const { password } = await import('@clack/prompts')
28
- const apiKey = await password({ message: 'Enter your Blink API key (blnk_ak_...):' }) as string
42
+ const apiKey = await password({ message: 'Paste your API key (blnk_ak_...):' }) as string
29
43
  if (!apiKey?.startsWith('blnk_ak_')) {
30
44
  console.error('Error: API key must start with blnk_ak_')
31
45
  process.exit(1)