@blinkdotnew/cli 0.4.0 → 0.4.2

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/dist/cli.js CHANGED
@@ -1980,7 +1980,7 @@ After creating a project, link it to your current directory:
1980
1980
  `);
1981
1981
  project.command("list").description("List all projects").action(async () => {
1982
1982
  requireToken();
1983
- const result = await withSpinner("Loading projects...", () => appRequest("/api/projects"));
1983
+ const result = await withSpinner("Loading projects...", () => appRequest("/api/v1/projects"));
1984
1984
  if (isJsonMode()) return printJson(result);
1985
1985
  const projects = result?.projects ?? result ?? [];
1986
1986
  const table = createTable(["ID", "Name", "URL"]);
@@ -2026,7 +2026,7 @@ After linking, most commands work without specifying a project_id:
2026
2026
  requireToken();
2027
2027
  let id = projectId;
2028
2028
  if (!id) {
2029
- const result = await withSpinner("Loading projects...", () => appRequest("/api/projects"));
2029
+ const result = await withSpinner("Loading projects...", () => appRequest("/api/v1/projects"));
2030
2030
  const projects = result?.projects ?? result ?? [];
2031
2031
  if (!projects.length) {
2032
2032
  console.log("No projects found. Create one with `blink project create <name>`.");
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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"
@@ -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)
@@ -23,7 +23,7 @@ After creating a project, link it to your current directory:
23
23
  .description('List all projects')
24
24
  .action(async () => {
25
25
  requireToken()
26
- const result = await withSpinner('Loading projects...', () => appRequest('/api/projects'))
26
+ const result = await withSpinner('Loading projects...', () => appRequest('/api/v1/projects'))
27
27
  if (isJsonMode()) return printJson(result)
28
28
  const projects: Array<{ id: string; name: string; slug: string }> = result?.projects ?? result ?? []
29
29
  const table = createTable(['ID', 'Name', 'URL'])
@@ -76,7 +76,7 @@ After linking, most commands work without specifying a project_id:
76
76
  requireToken()
77
77
  let id = projectId
78
78
  if (!id) {
79
- const result = await withSpinner('Loading projects...', () => appRequest('/api/projects'))
79
+ const result = await withSpinner('Loading projects...', () => appRequest('/api/v1/projects'))
80
80
  const projects: Array<{ id: string; name: string }> = result?.projects ?? result ?? []
81
81
  if (!projects.length) {
82
82
  console.log('No projects found. Create one with `blink project create <name>`.')