danube-cli 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/dist/danube.mjs +19 -2
  2. package/package.json +1 -1
package/dist/danube.mjs CHANGED
@@ -159,7 +159,7 @@ var package_default;
159
159
  var init_package = __esm(() => {
160
160
  package_default = {
161
161
  name: "danube-cli",
162
- version: "0.2.1",
162
+ version: "0.2.3",
163
163
  description: "Danube CLI — agent-first tool infrastructure for AI agents",
164
164
  type: "module",
165
165
  license: "MIT",
@@ -561,7 +561,24 @@ __export(exports_auth, {
561
561
  import chalk2 from "chalk";
562
562
  import { createInterface } from "node:readline";
563
563
  function register(program) {
564
- program.command("login").description("Log in to Danube via device code (opens browser)").action(handleErrors(async () => {
564
+ program.command("login").description("Log in to Danube (device code flow, or --api-key to save a key directly)").option("--api-key <key>", "Save an existing API key instead of using device code flow").addHelpText("after", `
565
+ Examples:
566
+ $ danube login # Interactive browser flow
567
+ $ danube login --api-key dk_xxx # Save an existing key
568
+ $ DANUBE_API_KEY=dk_xxx danube whoami # Use without saving`).action(handleErrors(async (opts) => {
569
+ if (opts.apiKey) {
570
+ const baseUrl2 = getBaseUrl(ctx.profile);
571
+ const client2 = new ApiClient(baseUrl2, opts.apiKey);
572
+ try {
573
+ await client2.get("/v1/identity/api");
574
+ } catch {
575
+ outputError("invalid_key", "API key is invalid or could not be verified.");
576
+ process.exit(1);
577
+ }
578
+ saveApiKey(opts.apiKey, ctx.profile);
579
+ outputSuccess(`API key saved to profile '${ctx.profile}'`);
580
+ return;
581
+ }
565
582
  const baseUrl = getBaseUrl(ctx.profile);
566
583
  const client = new ApiClient(baseUrl);
567
584
  const data = await client.publicPost("/v1/auth/device/code", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danube-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Danube CLI — agent-first tool infrastructure for AI agents",
5
5
  "type": "module",
6
6
  "license": "MIT",