@blinkdotnew/cli 0.1.7 → 0.1.8
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 +8 -7
- package/package.json +1 -1
- package/src/commands/agent.ts +1 -1
- package/src/commands/secrets.ts +7 -6
package/dist/cli.js
CHANGED
|
@@ -1344,7 +1344,7 @@ Agent ID resolution for all agent/secrets commands (priority: high \u2192 low):
|
|
|
1344
1344
|
requireToken();
|
|
1345
1345
|
const result = await withSpinner("Loading agents...", () => appRequest("/api/claw/agents"));
|
|
1346
1346
|
if (isJsonMode()) return printJson(result);
|
|
1347
|
-
const agents = result
|
|
1347
|
+
const agents = Array.isArray(result) ? result : result?.agents ?? [];
|
|
1348
1348
|
if (!agents.length) {
|
|
1349
1349
|
console.log(chalk9.dim("No agents found. Deploy one at blink.new/claw"));
|
|
1350
1350
|
return;
|
|
@@ -1432,7 +1432,7 @@ Examples:
|
|
|
1432
1432
|
() => appRequest(`/api/claw/agents/${agentId}/secrets`)
|
|
1433
1433
|
);
|
|
1434
1434
|
if (isJsonMode()) return printJson(result);
|
|
1435
|
-
const keys = result?.
|
|
1435
|
+
const keys = result?.secrets?.map((s) => s.key) ?? result?.keys ?? [];
|
|
1436
1436
|
if (!keys.length) {
|
|
1437
1437
|
console.log(chalk10.dim("(no secrets set \u2014 use `blink secrets set KEY value`)"));
|
|
1438
1438
|
return;
|
|
@@ -1456,14 +1456,15 @@ After setting, the secret is available as $KEY_NAME in agent shell commands.
|
|
|
1456
1456
|
`Setting ${key}...`,
|
|
1457
1457
|
() => appRequest(`/api/claw/agents/${agentId}/secrets`, {
|
|
1458
1458
|
method: "POST",
|
|
1459
|
-
body: { key
|
|
1459
|
+
body: { key, value }
|
|
1460
1460
|
})
|
|
1461
1461
|
);
|
|
1462
|
+
const normalised = key.toUpperCase();
|
|
1462
1463
|
if (!isJsonMode()) {
|
|
1463
|
-
console.log(chalk10.green("\u2713") + ` ${
|
|
1464
|
-
console.log(chalk10.dim(" Value hidden. Use $" +
|
|
1464
|
+
console.log(chalk10.green("\u2713") + ` ${normalised} saved`);
|
|
1465
|
+
console.log(chalk10.dim(" Value hidden. Use $" + normalised + " in shell commands."));
|
|
1465
1466
|
} else {
|
|
1466
|
-
printJson({ status: "ok", key:
|
|
1467
|
+
printJson({ status: "ok", key: normalised, agent_id: agentId });
|
|
1467
1468
|
}
|
|
1468
1469
|
});
|
|
1469
1470
|
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", `
|
|
@@ -1484,7 +1485,7 @@ Examples:
|
|
|
1484
1485
|
}
|
|
1485
1486
|
await withSpinner(
|
|
1486
1487
|
`Deleting ${key}...`,
|
|
1487
|
-
() => appRequest(`/api/claw/agents/${agentId}/secrets
|
|
1488
|
+
() => appRequest(`/api/claw/agents/${agentId}/secrets?key=${encodeURIComponent(key)}`, { method: "DELETE" })
|
|
1488
1489
|
);
|
|
1489
1490
|
if (!isJsonMode()) console.log("Deleted: " + key);
|
|
1490
1491
|
else printJson({ status: "ok", key, agent_id: agentId });
|
package/package.json
CHANGED
package/src/commands/agent.ts
CHANGED
|
@@ -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
|
|
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
|
package/src/commands/secrets.ts
CHANGED
|
@@ -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?.
|
|
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
|
|
74
|
+
body: { key, value },
|
|
75
75
|
})
|
|
76
76
|
)
|
|
77
|
+
const normalised = key.toUpperCase()
|
|
77
78
|
if (!isJsonMode()) {
|
|
78
|
-
console.log(chalk.green('✓') + ` ${
|
|
79
|
-
console.log(chalk.dim(' Value hidden. Use $' +
|
|
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:
|
|
82
|
+
printJson({ status: 'ok', key: normalised, agent_id: agentId })
|
|
82
83
|
}
|
|
83
84
|
})
|
|
84
85
|
|
|
@@ -101,7 +102,7 @@ Examples:
|
|
|
101
102
|
if (!ok) { console.log('Cancelled.'); return }
|
|
102
103
|
}
|
|
103
104
|
await withSpinner(`Deleting ${key}...`, () =>
|
|
104
|
-
appRequest(`/api/claw/agents/${agentId}/secrets
|
|
105
|
+
appRequest(`/api/claw/agents/${agentId}/secrets?key=${encodeURIComponent(key)}`, { method: 'DELETE' })
|
|
105
106
|
)
|
|
106
107
|
if (!isJsonMode()) console.log('Deleted: ' + key)
|
|
107
108
|
else printJson({ status: 'ok', key, agent_id: agentId })
|