@dosu/cli 0.64.0 → 0.64.1

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/bin/dosu.js +53 -33
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -1083,7 +1083,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
1083
1083
  function getVersionString() {
1084
1084
  return `v${VERSION}`;
1085
1085
  }
1086
- var VERSION = "0.64.0", INSTALL_CHANNEL = "npm";
1086
+ var VERSION = "0.64.1", INSTALL_CHANNEL = "npm";
1087
1087
 
1088
1088
  // src/debug/logger.ts
1089
1089
  import {
@@ -11377,6 +11377,18 @@ var init_deployments = __esm(() => {
11377
11377
  import_picocolors15 = __toESM(require_picocolors(), 1);
11378
11378
  });
11379
11379
 
11380
+ // src/cli/errors.ts
11381
+ var CliUsageError;
11382
+ var init_errors = __esm(() => {
11383
+ CliUsageError = class CliUsageError extends Error {
11384
+ exitCode = 1;
11385
+ constructor(message) {
11386
+ super(message);
11387
+ this.name = "CliUsageError";
11388
+ }
11389
+ };
11390
+ });
11391
+
11380
11392
  // src/commands/doc-import.ts
11381
11393
  async function importDocuments(client, platform, context, ids) {
11382
11394
  const baseInput = {
@@ -11416,6 +11428,7 @@ var init_doc_import = __esm(() => {
11416
11428
 
11417
11429
  // src/commands/docs.ts
11418
11430
  import { readFileSync as readFileSync10 } from "node:fs";
11431
+ import { resolve } from "node:path";
11419
11432
  function requireConfig5() {
11420
11433
  const cfg = requireLoginConfig();
11421
11434
  if (!cfg.active_account?.target?.space_id) {
@@ -11435,9 +11448,21 @@ async function getKnowledgeStoreId(client, spaceId) {
11435
11448
  return store.id;
11436
11449
  }
11437
11450
  function readBody(opts) {
11438
- if (opts.bodyFile)
11439
- return readFileSync10(opts.bodyFile, "utf-8");
11440
- return opts.body;
11451
+ if (!opts.bodyFile)
11452
+ return opts.body;
11453
+ const path = opts.bodyFile;
11454
+ try {
11455
+ return readFileSync10(path, "utf-8");
11456
+ } catch (err) {
11457
+ const code = err.code;
11458
+ if (code === "ENOENT") {
11459
+ throw new CliUsageError(`--body-file not found: ${path} (looked in ${resolve(path)}). ` + "Check the path, or pass the content with --body.");
11460
+ }
11461
+ if (code === "EISDIR") {
11462
+ throw new CliUsageError(`--body-file is a directory, not a file: ${path}`);
11463
+ }
11464
+ throw new CliUsageError(`Could not read --body-file ${path}: ${err.message}`);
11465
+ }
11441
11466
  }
11442
11467
  function parseSerializedImportError(message) {
11443
11468
  let text = message;
@@ -11571,10 +11596,10 @@ ${page.body}`);
11571
11596
  }
11572
11597
  });
11573
11598
  cmd.command("create").description("Create a new document").requiredOption("--title <title>", "Document title").option("--body <markdown>", "Document body (markdown)").addOption(new Option("--body-file <path>", "Read body from file").conflicts("body")).option("--json", "Output as JSON").action(async (opts) => {
11599
+ const body = readBody(opts);
11574
11600
  const cfg = requireConfig5();
11575
11601
  const client = createTypedClient(cfg);
11576
11602
  const ksId = await getKnowledgeStoreId(client, cfg.active_account.target.space_id);
11577
- const body = readBody(opts);
11578
11603
  const result = await client.page.create.mutate({
11579
11604
  knowledge_store_id: ksId,
11580
11605
  title: opts.title,
@@ -11588,12 +11613,12 @@ ${page.body}`);
11588
11613
  });
11589
11614
  cmd.command("update").description("Update a document").argument("<id>", "Page ID").option("--title <title>", "New title").option("--body <markdown>", "New body (markdown)").addOption(new Option("--body-file <path>", "Read body from file").conflicts("body")).option("--json", "Output as JSON").action(async (id, opts) => {
11590
11615
  if (opts.title === undefined && opts.body === undefined && opts.bodyFile === undefined) {
11591
- throw new Error("Specify at least one of --title, --body, or --body-file.");
11616
+ throw new CliUsageError("Specify at least one of --title, --body, or --body-file.");
11592
11617
  }
11618
+ const body = readBody(opts);
11593
11619
  const cfg = requireConfig5();
11594
11620
  const client = createTypedClient(cfg);
11595
11621
  const ksId = await getKnowledgeStoreId(client, cfg.active_account.target.space_id);
11596
- const body = readBody(opts);
11597
11622
  await client.page.update.mutate({
11598
11623
  id,
11599
11624
  knowledge_store_id: ksId,
@@ -11818,6 +11843,7 @@ var init_docs = __esm(() => {
11818
11843
  init_dist8();
11819
11844
  init_dist();
11820
11845
  init_commander();
11846
+ init_errors();
11821
11847
  init_client();
11822
11848
  init_trpc();
11823
11849
  init_logger();
@@ -13571,13 +13597,13 @@ var init_notes = __esm(() => {
13571
13597
  // src/report/write.ts
13572
13598
  import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync9 } from "node:fs";
13573
13599
  import { tmpdir } from "node:os";
13574
- import { dirname as dirname4, join as join12, resolve } from "node:path";
13600
+ import { dirname as dirname4, join as join12, resolve as resolve2 } from "node:path";
13575
13601
  import { pathToFileURL } from "node:url";
13576
13602
  function defaultReportPath() {
13577
13603
  return join12(tmpdir(), "dosu-knowledge-report.html");
13578
13604
  }
13579
13605
  async function writeAndOpenReport(options) {
13580
- const out = resolve(options.out ?? defaultReportPath());
13606
+ const out = resolve2(options.out ?? defaultReportPath());
13581
13607
  mkdirSync9(dirname4(out), { recursive: true });
13582
13608
  writeFileSync9(out, options.html, "utf8");
13583
13609
  if (options.open !== false) {
@@ -14156,14 +14182,14 @@ var init_conflicts = __esm(() => {
14156
14182
  });
14157
14183
 
14158
14184
  // src/telemetry/debug-id.ts
14159
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "3b9a1619-fdbd-ebdd-6475-6e2164756e21";
14185
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "49497211-cd7a-a697-6475-6e2164756e21";
14160
14186
 
14161
14187
  // src/telemetry/telemetry.ts
14162
14188
  import { randomUUID as randomUUID2 } from "node:crypto";
14163
14189
  import { existsSync as existsSync15 } from "node:fs";
14164
14190
  import { request as httpRequest2 } from "node:http";
14165
14191
  import { request as httpsRequest } from "node:https";
14166
- import { isAbsolute, relative, resolve as resolve2, sep } from "node:path";
14192
+ import { isAbsolute, relative, resolve as resolve3, sep } from "node:path";
14167
14193
  import { fileURLToPath as fileURLToPath2 } from "node:url";
14168
14194
  function safeString(value, pattern, fallback) {
14169
14195
  if (typeof value !== "string" || !pattern.test(value))
@@ -14288,7 +14314,7 @@ function parseOwnedStackLine(originalLine, packageRoot) {
14288
14314
  }
14289
14315
  if (!isAbsolute(absolutePath))
14290
14316
  return;
14291
- const resolvedPath = resolve2(absolutePath);
14317
+ const resolvedPath = resolve3(absolutePath);
14292
14318
  const relativePath = relative(packageRoot, resolvedPath);
14293
14319
  if (relativePath === "" || relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath)) {
14294
14320
  return;
@@ -54360,7 +54386,7 @@ var _messageDesc, _zodDesc2, _issuesDesc, _installedToString, initializer = (ins
54360
54386
  });
54361
54387
  }
54362
54388
  }, $ZodError, $ZodRealError;
54363
- var init_errors = __esm(() => {
54389
+ var init_errors2 = __esm(() => {
54364
54390
  init_core();
54365
54391
  init_util();
54366
54392
  _messageDesc = {
@@ -54469,7 +54495,7 @@ var _parse = (_Err) => {
54469
54495
  };
54470
54496
  var init_parse = __esm(() => {
54471
54497
  init_core();
54472
- init_errors();
54498
+ init_errors2();
54473
54499
  init_util();
54474
54500
  safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
54475
54501
  safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
@@ -57471,7 +57497,7 @@ var init_core2 = __esm(() => {
57471
57497
  init_json_schema();
57472
57498
  init_core();
57473
57499
  init_parse();
57474
- init_errors();
57500
+ init_errors2();
57475
57501
  init_schemas();
57476
57502
  init_memoizer();
57477
57503
  init_checks();
@@ -57527,7 +57553,7 @@ var _installedErrorProtos, initializer2 = (inst, issues) => {
57527
57553
  }
57528
57554
  });
57529
57555
  }, ZodRealError;
57530
- var init_errors2 = __esm(() => {
57556
+ var init_errors3 = __esm(() => {
57531
57557
  init_core2();
57532
57558
  init_core2();
57533
57559
  init_util();
@@ -57541,7 +57567,7 @@ var init_errors2 = __esm(() => {
57541
57567
  var parse6, parseAsync2, safeParse2, safeParseAsync2, encode, decode, encodeAsync, decodeAsync, safeEncode, safeDecode, safeEncodeAsync, safeDecodeAsync;
57542
57568
  var init_parse2 = __esm(() => {
57543
57569
  init_core2();
57544
- init_errors2();
57570
+ init_errors3();
57545
57571
  parse6 = /* @__PURE__ */ _parse(ZodRealError);
57546
57572
  parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
57547
57573
  safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -58290,7 +58316,7 @@ var init_external = __esm(() => {
58290
58316
  init_coerce();
58291
58317
  init_schemas2();
58292
58318
  init_checks2();
58293
- init_errors2();
58319
+ init_errors3();
58294
58320
  init_parse2();
58295
58321
  init_compat();
58296
58322
  });
@@ -63204,7 +63230,7 @@ var init_skill_update_check = __esm(() => {
63204
63230
 
63205
63231
  // src/auth/errors.ts
63206
63232
  var OAuthCallbackError;
63207
- var init_errors3 = __esm(() => {
63233
+ var init_errors4 = __esm(() => {
63208
63234
  OAuthCallbackError = class OAuthCallbackError extends Error {
63209
63235
  error;
63210
63236
  errorCode;
@@ -64854,7 +64880,7 @@ if (hash) {
64854
64880
  </html>`, SUCCESS_COPY;
64855
64881
  var init_server = __esm(() => {
64856
64882
  init_logger();
64857
- init_errors3();
64883
+ init_errors4();
64858
64884
  SUCCESS_COPY = {
64859
64885
  auth: {
64860
64886
  title: "Dosu CLI - Authentication Successful",
@@ -65333,7 +65359,7 @@ async function stepSetupHandshake(cfg, onboardingRunID) {
65333
65359
  const msg = err instanceof Error ? err.message : String(err);
65334
65360
  logger.warn("setup", `Setup handshake did not complete: ${msg}`);
65335
65361
  s.stop("Setup not completed");
65336
- await Promise.resolve().then(() => init_errors3());
65362
+ await Promise.resolve().then(() => init_errors4());
65337
65363
  if (err instanceof OAuthCallbackError) {
65338
65364
  log2.error(err.userMessage);
65339
65365
  return false;
@@ -65874,7 +65900,7 @@ ${dim(wrapLog("Run it inside a session to keep that session out of studying. Rem
65874
65900
  }
65875
65901
  var import_picocolors34, OAUTH_ANALYTICS_REASONS, SETUP_HANDSHAKE_TIMEOUT_MS = 1800000, LIBRARY_SELECT_CANCELLED;
65876
65902
  var init_flow2 = __esm(() => {
65877
- init_errors3();
65903
+ init_errors4();
65878
65904
  init_client();
65879
65905
  init_skill();
65880
65906
  init_config();
@@ -67212,7 +67238,7 @@ async function handleAuthenticate(cfg) {
67212
67238
  });
67213
67239
  saveConfig(cfg);
67214
67240
  } catch (err) {
67215
- await Promise.resolve().then(() => init_errors3());
67241
+ await Promise.resolve().then(() => init_errors4());
67216
67242
  if (err instanceof OAuthCallbackError) {
67217
67243
  log2.error(err.userMessage);
67218
67244
  return;
@@ -68040,7 +68066,7 @@ Run 'dosu --help' to see available commands.`;
68040
68066
  }
68041
68067
  await Promise.resolve();
68042
68068
  const useDeviceFlow = !opts.browser || isHeadless();
68043
- await Promise.resolve().then(() => init_errors3());
68069
+ await Promise.resolve().then(() => init_errors4());
68044
68070
  let token;
68045
68071
  if (useDeviceFlow) {
68046
68072
  await Promise.resolve().then(() => init_device());
@@ -68372,7 +68398,7 @@ function processCommandTelemetry() {
68372
68398
  return;
68373
68399
  }
68374
68400
  }
68375
- var TELEMETRY_FLUSH_TIMEOUT_MS = 750, CliUsageError, FOLLOW_POLL_MS = 500, DEFAULT_TAIL_LINES = 50;
68401
+ var TELEMETRY_FLUSH_TIMEOUT_MS = 750, FOLLOW_POLL_MS = 500, DEFAULT_TAIL_LINES = 50;
68376
68402
  var init_cli = __esm(() => {
68377
68403
  init_commander();
68378
68404
  init_client();
@@ -68406,13 +68432,7 @@ var init_cli = __esm(() => {
68406
68432
  init_pending_tasks_check();
68407
68433
  init_skill_update_check();
68408
68434
  init_update_check();
68409
- CliUsageError = class CliUsageError extends Error {
68410
- exitCode = 1;
68411
- constructor(message) {
68412
- super(message);
68413
- this.name = "CliUsageError";
68414
- }
68415
- };
68435
+ init_errors();
68416
68436
  });
68417
68437
 
68418
68438
  // src/statusline/argv.ts
@@ -68446,4 +68466,4 @@ main().catch((err) => {
68446
68466
  process.exit(1);
68447
68467
  });
68448
68468
 
68449
- //# debugId=3b9a1619-fdbd-ebdd-6475-6e2164756e21
68469
+ //# debugId=49497211-cd7a-a697-6475-6e2164756e21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.64.0",
3
+ "version": "0.64.1",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Set up Dosu MCP for AI tools and work with Dosu Libraries, docs, and reviews",
6
6
  "license": "MIT",