@sudoji/cli 0.1.6 → 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.
Files changed (2) hide show
  1. package/dist/index.js +10 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import "./chunk-RWRJASDG.js";
3
3
 
4
4
  // src/index.ts
5
5
  import { Command as Command7 } from "commander";
6
+ import { createRequire } from "module";
6
7
 
7
8
  // src/commands/login.ts
8
9
  import { Command } from "commander";
@@ -222,12 +223,12 @@ function loadSettings(opts = {}) {
222
223
  function doctorCommand() {
223
224
  return new Command3("doctor").description("Verify auth, connectivity, settings, and redaction").option("--profile <name>", "Credentials profile to check", "default").option("--server <url>", "Override API base URL for this check").action(async (opts) => {
224
225
  const checks = [];
225
- const key = await load(opts.profile);
226
- const keyOk = key !== null && isSudojiKey2(key);
226
+ const creds = await load(opts.profile);
227
+ const keyOk = creds !== null && isSudojiKey2(creds.token);
227
228
  checks.push({
228
229
  label: "API key stored",
229
230
  ok: keyOk,
230
- detail: keyOk ? `${key.slice(0, 18)}\u2026` : `no key for profile "${opts.profile}" \u2014 run: sudoji login`
231
+ detail: keyOk ? `${creds.token.slice(0, 18)}\u2026` : `no key for profile "${opts.profile}" \u2014 run: sudoji login`
231
232
  });
232
233
  let settings = null;
233
234
  try {
@@ -409,7 +410,7 @@ function askCommand() {
409
410
  context,
410
411
  maxSteps: Math.min(parseInt(opts.maxSteps, 10), 50)
411
412
  },
412
- key
413
+ key.token
413
414
  );
414
415
  if (!opts.json) process.stdout.write("\n");
415
416
  for await (const event of stream) {
@@ -461,7 +462,7 @@ function logsCommand() {
461
462
  console.error(`Failed to fetch logs: ${err instanceof Error ? err.message : err}`);
462
463
  process.exit(1);
463
464
  }
464
- const redacted = redact3(raw);
465
+ const { text: redacted } = redact3(raw);
465
466
  const message = `${opts.ask}
466
467
 
467
468
  <logs source="${opts.source}">
@@ -476,7 +477,7 @@ ${redacted}
476
477
  const baseUrl = opts.server ?? settings.apiBaseUrl;
477
478
  const context = gatherContext();
478
479
  context.logs = redacted;
479
- const stream = streamAgent(baseUrl, { message, mode: "diagnose", context, maxSteps: 10 }, key);
480
+ const stream = streamAgent(baseUrl, { message, mode: "diagnose", context, maxSteps: 10 }, key.token);
480
481
  process.stdout.write("\n");
481
482
  for await (const event of stream) {
482
483
  if (event.type === "text-delta") process.stdout.write(event.text);
@@ -509,7 +510,9 @@ function keysCommand() {
509
510
  }
510
511
 
511
512
  // src/index.ts
512
- var program = new Command7().name("sudoji").description("Sudoji Agent \u2014 AI-powered IT operations for Linux servers").version("0.1.0", "--version", "print version and exit");
513
+ var require2 = createRequire(import.meta.url);
514
+ var { version } = require2("../package.json");
515
+ var program = new Command7().name("sudoji").description("Sudoji Agent \u2014 AI-powered IT operations for Linux servers").version(version, "--version", "print version and exit");
513
516
  program.addCommand(loginCommand());
514
517
  program.addCommand(logoutCommand());
515
518
  program.addCommand(doctorCommand());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudoji/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Sudoji installable IT agent CLI — diagnose, approve, fix on your Linux server.",
5
5
  "type": "module",
6
6
  "bin": {