@sudoji/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/index.js +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -223,12 +223,12 @@ function loadSettings(opts = {}) {
|
|
|
223
223
|
function doctorCommand() {
|
|
224
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) => {
|
|
225
225
|
const checks = [];
|
|
226
|
-
const
|
|
227
|
-
const keyOk =
|
|
226
|
+
const creds = await load(opts.profile);
|
|
227
|
+
const keyOk = creds !== null && isSudojiKey2(creds.token);
|
|
228
228
|
checks.push({
|
|
229
229
|
label: "API key stored",
|
|
230
230
|
ok: keyOk,
|
|
231
|
-
detail: keyOk ? `${
|
|
231
|
+
detail: keyOk ? `${creds.token.slice(0, 18)}\u2026` : `no key for profile "${opts.profile}" \u2014 run: sudoji login`
|
|
232
232
|
});
|
|
233
233
|
let settings = null;
|
|
234
234
|
try {
|
|
@@ -410,7 +410,7 @@ function askCommand() {
|
|
|
410
410
|
context,
|
|
411
411
|
maxSteps: Math.min(parseInt(opts.maxSteps, 10), 50)
|
|
412
412
|
},
|
|
413
|
-
key
|
|
413
|
+
key.token
|
|
414
414
|
);
|
|
415
415
|
if (!opts.json) process.stdout.write("\n");
|
|
416
416
|
for await (const event of stream) {
|
|
@@ -462,7 +462,7 @@ function logsCommand() {
|
|
|
462
462
|
console.error(`Failed to fetch logs: ${err instanceof Error ? err.message : err}`);
|
|
463
463
|
process.exit(1);
|
|
464
464
|
}
|
|
465
|
-
const redacted = redact3(raw);
|
|
465
|
+
const { text: redacted } = redact3(raw);
|
|
466
466
|
const message = `${opts.ask}
|
|
467
467
|
|
|
468
468
|
<logs source="${opts.source}">
|
|
@@ -477,7 +477,7 @@ ${redacted}
|
|
|
477
477
|
const baseUrl = opts.server ?? settings.apiBaseUrl;
|
|
478
478
|
const context = gatherContext();
|
|
479
479
|
context.logs = redacted;
|
|
480
|
-
const stream = streamAgent(baseUrl, { message, mode: "diagnose", context, maxSteps: 10 }, key);
|
|
480
|
+
const stream = streamAgent(baseUrl, { message, mode: "diagnose", context, maxSteps: 10 }, key.token);
|
|
481
481
|
process.stdout.write("\n");
|
|
482
482
|
for await (const event of stream) {
|
|
483
483
|
if (event.type === "text-delta") process.stdout.write(event.text);
|