@blinkdotnew/cli 0.1.7 → 0.1.9

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
@@ -1203,7 +1203,8 @@ After creating a project, link it to your current directory:
1203
1203
  });
1204
1204
  project.command("delete <project_id>").description("Delete a project").option("--yes", "Skip confirmation").action(async (projectId, opts) => {
1205
1205
  requireToken();
1206
- if (!opts.yes) {
1206
+ const skipConfirm = opts.yes || process.argv.includes("--yes") || process.argv.includes("-y");
1207
+ if (!skipConfirm && process.stdout.isTTY) {
1207
1208
  const { confirm } = await import("@clack/prompts");
1208
1209
  const ok = await confirm({ message: `Delete project ${projectId}? This cannot be undone.` });
1209
1210
  if (!ok) {
@@ -1344,7 +1345,7 @@ Agent ID resolution for all agent/secrets commands (priority: high \u2192 low):
1344
1345
  requireToken();
1345
1346
  const result = await withSpinner("Loading agents...", () => appRequest("/api/claw/agents"));
1346
1347
  if (isJsonMode()) return printJson(result);
1347
- const agents = result?.agents ?? result ?? [];
1348
+ const agents = Array.isArray(result) ? result : result?.agents ?? [];
1348
1349
  if (!agents.length) {
1349
1350
  console.log(chalk9.dim("No agents found. Deploy one at blink.new/claw"));
1350
1351
  return;
@@ -1432,7 +1433,7 @@ Examples:
1432
1433
  () => appRequest(`/api/claw/agents/${agentId}/secrets`)
1433
1434
  );
1434
1435
  if (isJsonMode()) return printJson(result);
1435
- const keys = result?.keys ?? result?.secrets?.map((s) => s.key) ?? result ?? [];
1436
+ const keys = result?.secrets?.map((s) => s.key) ?? result?.keys ?? [];
1436
1437
  if (!keys.length) {
1437
1438
  console.log(chalk10.dim("(no secrets set \u2014 use `blink secrets set KEY value`)"));
1438
1439
  return;
@@ -1456,14 +1457,15 @@ After setting, the secret is available as $KEY_NAME in agent shell commands.
1456
1457
  `Setting ${key}...`,
1457
1458
  () => appRequest(`/api/claw/agents/${agentId}/secrets`, {
1458
1459
  method: "POST",
1459
- body: { key: key.toUpperCase(), value }
1460
+ body: { key, value }
1460
1461
  })
1461
1462
  );
1463
+ const normalised = key.toUpperCase();
1462
1464
  if (!isJsonMode()) {
1463
- console.log(chalk10.green("\u2713") + ` ${key.toUpperCase()} saved`);
1464
- console.log(chalk10.dim(" Value hidden. Use $" + key.toUpperCase() + " in shell commands."));
1465
+ console.log(chalk10.green("\u2713") + ` ${normalised} saved`);
1466
+ console.log(chalk10.dim(" Value hidden. Use $" + normalised + " in shell commands."));
1465
1467
  } else {
1466
- printJson({ status: "ok", key: key.toUpperCase(), agent_id: agentId });
1468
+ printJson({ status: "ok", key: normalised, agent_id: agentId });
1467
1469
  }
1468
1470
  });
1469
1471
  secrets.command("delete <key>").description("Delete a secret from the agent vault").option("--agent <id>", "Agent ID (defaults to BLINK_AGENT_ID or BLINK_ACTIVE_AGENT)").option("--yes", "Skip confirmation").addHelpText("after", `
@@ -1474,7 +1476,8 @@ Examples:
1474
1476
  `).action(async (key, opts) => {
1475
1477
  requireToken();
1476
1478
  const agentId = requireAgentId(opts.agent);
1477
- if (!opts.yes && !isJsonMode()) {
1479
+ const skipConfirm = opts.yes || process.argv.includes("--yes") || process.argv.includes("-y");
1480
+ if (!skipConfirm && !isJsonMode() && process.stdout.isTTY) {
1478
1481
  const { confirm } = await import("@clack/prompts");
1479
1482
  const ok = await confirm({ message: `Delete secret "${key}" from agent ${agentId}?` });
1480
1483
  if (!ok) {
@@ -1484,7 +1487,7 @@ Examples:
1484
1487
  }
1485
1488
  await withSpinner(
1486
1489
  `Deleting ${key}...`,
1487
- () => appRequest(`/api/claw/agents/${agentId}/secrets/${key}`, { method: "DELETE" })
1490
+ () => appRequest(`/api/claw/agents/${agentId}/secrets?key=${encodeURIComponent(key)}`, { method: "DELETE" })
1488
1491
  );
1489
1492
  if (!isJsonMode()) console.log("Deleted: " + key);
1490
1493
  else printJson({ status: "ok", key, agent_id: agentId });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Blink platform CLI — deploy apps, manage databases, generate AI content",
5
5
  "bin": {
6
6
  "blink": "dist/cli.js"
@@ -28,7 +28,7 @@ Agent ID resolution for all agent/secrets commands (priority: high → low):
28
28
  const result = await withSpinner('Loading agents...', () => appRequest('/api/claw/agents'))
29
29
  if (isJsonMode()) return printJson(result)
30
30
  const agents: Array<{ id: string; name: string; status: string; model?: string; machine_size?: string }> =
31
- result?.agents ?? result ?? []
31
+ Array.isArray(result) ? result : result?.agents ?? []
32
32
  if (!agents.length) {
33
33
  console.log(chalk.dim('No agents found. Deploy one at blink.new/claw'))
34
34
  return
@@ -49,7 +49,8 @@ After creating a project, link it to your current directory:
49
49
  .option('--yes', 'Skip confirmation')
50
50
  .action(async (projectId: string, opts) => {
51
51
  requireToken()
52
- if (!opts.yes) {
52
+ const skipConfirm = opts.yes || process.argv.includes('--yes') || process.argv.includes('-y')
53
+ if (!skipConfirm && process.stdout.isTTY) {
53
54
  const { confirm } = await import('@clack/prompts')
54
55
  const ok = await confirm({ message: `Delete project ${projectId}? This cannot be undone.` })
55
56
  if (!ok) { console.log('Cancelled.'); return }
@@ -44,7 +44,7 @@ Examples:
44
44
  appRequest(`/api/claw/agents/${agentId}/secrets`)
45
45
  )
46
46
  if (isJsonMode()) return printJson(result)
47
- const keys: string[] = result?.keys ?? result?.secrets?.map((s: { key: string }) => s.key) ?? result ?? []
47
+ const keys: string[] = result?.secrets?.map((s: { key: string }) => s.key) ?? result?.keys ?? []
48
48
  if (!keys.length) {
49
49
  console.log(chalk.dim('(no secrets set — use `blink secrets set KEY value`)'))
50
50
  return
@@ -71,14 +71,15 @@ After setting, the secret is available as $KEY_NAME in agent shell commands.
71
71
  await withSpinner(`Setting ${key}...`, () =>
72
72
  appRequest(`/api/claw/agents/${agentId}/secrets`, {
73
73
  method: 'POST',
74
- body: { key: key.toUpperCase(), value },
74
+ body: { key, value },
75
75
  })
76
76
  )
77
+ const normalised = key.toUpperCase()
77
78
  if (!isJsonMode()) {
78
- console.log(chalk.green('✓') + ` ${key.toUpperCase()} saved`)
79
- console.log(chalk.dim(' Value hidden. Use $' + key.toUpperCase() + ' in shell commands.'))
79
+ console.log(chalk.green('✓') + ` ${normalised} saved`)
80
+ console.log(chalk.dim(' Value hidden. Use $' + normalised + ' in shell commands.'))
80
81
  } else {
81
- printJson({ status: 'ok', key: key.toUpperCase(), agent_id: agentId })
82
+ printJson({ status: 'ok', key: normalised, agent_id: agentId })
82
83
  }
83
84
  })
84
85
 
@@ -95,13 +96,14 @@ Examples:
95
96
  .action(async (key: string, opts) => {
96
97
  requireToken()
97
98
  const agentId = requireAgentId(opts.agent)
98
- if (!opts.yes && !isJsonMode()) {
99
+ const skipConfirm = opts.yes || process.argv.includes('--yes') || process.argv.includes('-y')
100
+ if (!skipConfirm && !isJsonMode() && process.stdout.isTTY) {
99
101
  const { confirm } = await import('@clack/prompts')
100
102
  const ok = await confirm({ message: `Delete secret "${key}" from agent ${agentId}?` })
101
103
  if (!ok) { console.log('Cancelled.'); return }
102
104
  }
103
105
  await withSpinner(`Deleting ${key}...`, () =>
104
- appRequest(`/api/claw/agents/${agentId}/secrets/${key}`, { method: 'DELETE' })
106
+ appRequest(`/api/claw/agents/${agentId}/secrets?key=${encodeURIComponent(key)}`, { method: 'DELETE' })
105
107
  )
106
108
  if (!isJsonMode()) console.log('Deleted: ' + key)
107
109
  else printJson({ status: 'ok', key, agent_id: agentId })