@sudoji/cli 0.1.9 → 0.1.11

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 +22 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -252,7 +252,7 @@ function doctorCommand() {
252
252
  detail: `${baseUrl}/healthz \u2014 ${err instanceof Error ? err.message : err}`
253
253
  });
254
254
  }
255
- const testInput = "password=super$ecret TOKEN=abc123 STRIPE_KEY=sk_live_xxx";
255
+ const testInput = "password=super$ecret123 token=abcdefgh12 STRIPE_KEY=sk_live_xxx";
256
256
  const { text: testRedacted } = redact(testInput);
257
257
  const redactionWorking = !testRedacted.includes("super$ecret") && !testRedacted.includes("abc123");
258
258
  checks.push({
@@ -286,7 +286,7 @@ import os from "os";
286
286
  import { redact as redact2 } from "@sudoji/core";
287
287
  function tryExec(cmd, cwd, timeout = 4e3) {
288
288
  try {
289
- return execSync(cmd, { encoding: "utf8", cwd, timeout }).trim();
289
+ return execSync(cmd, { encoding: "utf8", cwd, timeout, stdio: ["pipe", "pipe", "pipe"] }).trim();
290
290
  } catch {
291
291
  return void 0;
292
292
  }
@@ -303,14 +303,14 @@ function gatherContext(opts = {}) {
303
303
  const status = tryExec("git status --short", cwd);
304
304
  if (branch !== void 0 || status !== void 0) {
305
305
  git = redact2(`branch: ${branch ?? "unknown"}
306
- ${status ?? ""}`);
306
+ ${status ?? ""}`).text;
307
307
  }
308
308
  const files = {};
309
309
  const pkgPath = join3(cwd, "package.json");
310
310
  if (existsSync3(pkgPath)) {
311
311
  try {
312
312
  const raw = readFileSync3(pkgPath, "utf8").slice(0, maxFileBytes);
313
- files["package.json"] = redact2(raw);
313
+ files["package.json"] = redact2(raw).text;
314
314
  } catch {
315
315
  }
316
316
  }
@@ -319,7 +319,7 @@ ${status ?? ""}`);
319
319
  let logs;
320
320
  if (lastStderr) {
321
321
  const trimmed = lastStderr.split("\n").slice(-maxLogLines).join("\n");
322
- logs = redact2(trimmed);
322
+ logs = redact2(trimmed).text;
323
323
  }
324
324
  return {
325
325
  cwd,
@@ -412,14 +412,29 @@ function askCommand() {
412
412
  },
413
413
  key.token
414
414
  );
415
- if (!opts.json) process.stdout.write("\n");
415
+ const C2 = "\x1B[36m";
416
+ const B2 = "\x1B[1m";
417
+ const _2 = "\x1B[0m";
418
+ const D2 = "\x1B[2m";
419
+ const bar = "\u2500".repeat(44);
420
+ if (!opts.json) {
421
+ process.stdout.write(`
422
+ ${C2}${B2}\u{1F99A} sudoji${_2} ${D2}${bar}${_2}
423
+
424
+ `);
425
+ }
416
426
  for await (const event of stream) {
417
427
  if (opts.json) {
418
428
  console.log(JSON.stringify(event));
419
429
  continue;
420
430
  }
421
431
  if (event.type === "text-delta") process.stdout.write(event.text);
422
- if (event.type === "final") process.stdout.write("\n");
432
+ if (event.type === "final") {
433
+ process.stdout.write(`
434
+
435
+ ${D2}${bar}${_2}
436
+ `);
437
+ }
423
438
  if (event.type === "error") {
424
439
  console.error(`
425
440
  [${event.code}] ${event.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudoji/cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Sudoji installable IT agent CLI — diagnose, approve, fix on your Linux server.",
5
5
  "type": "module",
6
6
  "bin": {