@dosu/cli 0.57.2 → 0.58.0
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/bin/dosu.js +111 -8
- 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.
|
|
1086
|
+
var VERSION = "0.58.0", INSTALL_CHANNEL = "npm";
|
|
1087
1087
|
|
|
1088
1088
|
// src/debug/logger.ts
|
|
1089
1089
|
import {
|
|
@@ -6786,7 +6786,7 @@ var init_dist4 = __esm(() => {
|
|
|
6786
6786
|
});
|
|
6787
6787
|
|
|
6788
6788
|
// src/client/contract.ts
|
|
6789
|
-
var CLI_CONTRACT_HASH = "
|
|
6789
|
+
var CLI_CONTRACT_HASH = "a6e002dff58e";
|
|
6790
6790
|
|
|
6791
6791
|
// src/client/trpc.ts
|
|
6792
6792
|
function createTypedClient(config) {
|
|
@@ -13742,7 +13742,7 @@ var init_sync = __esm(() => {
|
|
|
13742
13742
|
});
|
|
13743
13743
|
|
|
13744
13744
|
// src/telemetry/debug-id.ts
|
|
13745
|
-
var BUNDLE_DEBUG_ID_PLACEHOLDER = "
|
|
13745
|
+
var BUNDLE_DEBUG_ID_PLACEHOLDER = "102e2621-b1fd-c662-6475-6e2164756e21";
|
|
13746
13746
|
|
|
13747
13747
|
// src/telemetry/telemetry.ts
|
|
13748
13748
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
@@ -59378,6 +59378,95 @@ var init_org = __esm(() => {
|
|
|
59378
59378
|
import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
59379
59379
|
});
|
|
59380
59380
|
|
|
59381
|
+
// src/commands/time-range.ts
|
|
59382
|
+
function utcDay(year, month, day) {
|
|
59383
|
+
const [y, m, d] = [Number(year), Number(month), Number(day)];
|
|
59384
|
+
const ms = Date.UTC(y, m - 1, d);
|
|
59385
|
+
const check = new Date(ms);
|
|
59386
|
+
const exists = check.getUTCFullYear() === y && check.getUTCMonth() === m - 1 && check.getUTCDate() === d;
|
|
59387
|
+
return exists ? ms : undefined;
|
|
59388
|
+
}
|
|
59389
|
+
function offsetMs(offset) {
|
|
59390
|
+
if (!offset || offset.toUpperCase() === "Z")
|
|
59391
|
+
return 0;
|
|
59392
|
+
const sign = offset.startsWith("-") ? -1 : 1;
|
|
59393
|
+
const digits = offset.slice(1).replace(":", "");
|
|
59394
|
+
const hours = Number(digits.slice(0, 2));
|
|
59395
|
+
const minutes = Number(digits.slice(2) || "0");
|
|
59396
|
+
if (hours > 23 || minutes > 59)
|
|
59397
|
+
return;
|
|
59398
|
+
return sign * (hours * HOUR_MS + minutes * 60 * 1000);
|
|
59399
|
+
}
|
|
59400
|
+
function parseIsoDatetime(text) {
|
|
59401
|
+
const match = ISO_DATETIME.exec(text);
|
|
59402
|
+
if (!match)
|
|
59403
|
+
return;
|
|
59404
|
+
const [, year, month, day, hour, minute, second = "0", fraction = "", offset] = match;
|
|
59405
|
+
const dayMs = utcDay(year, month, day);
|
|
59406
|
+
const offsetValue = offsetMs(offset);
|
|
59407
|
+
const [h, mi, s] = [Number(hour), Number(minute), Number(second)];
|
|
59408
|
+
if (dayMs === undefined || offsetValue === undefined || h > 23 || mi > 59 || s > 59) {
|
|
59409
|
+
return;
|
|
59410
|
+
}
|
|
59411
|
+
const ms = Number(fraction.padEnd(3, "0").slice(0, 3));
|
|
59412
|
+
return dayMs + h * HOUR_MS + mi * 60 * 1000 + s * 1000 + ms - offsetValue;
|
|
59413
|
+
}
|
|
59414
|
+
function parseTimeBound(value, opts) {
|
|
59415
|
+
const text = value.trim();
|
|
59416
|
+
let ms;
|
|
59417
|
+
const relative = RELATIVE_BOUND.exec(text);
|
|
59418
|
+
const dateOnly = DATE_ONLY.exec(text);
|
|
59419
|
+
if (relative) {
|
|
59420
|
+
ms = opts.now.getTime() - Number(relative[1]) * RELATIVE_UNIT_MS[relative[2]];
|
|
59421
|
+
} else if (dateOnly) {
|
|
59422
|
+
const day = utcDay(dateOnly[1], dateOnly[2], dateOnly[3]);
|
|
59423
|
+
ms = day === undefined ? undefined : day + (opts.endOfDay ? 24 * HOUR_MS : 0);
|
|
59424
|
+
} else {
|
|
59425
|
+
ms = parseIsoDatetime(text);
|
|
59426
|
+
}
|
|
59427
|
+
const date = ms === undefined ? undefined : new Date(ms);
|
|
59428
|
+
if (!date || Number.isNaN(date.getTime()))
|
|
59429
|
+
throw new InvalidArgumentError(INVALID_BOUND);
|
|
59430
|
+
return date;
|
|
59431
|
+
}
|
|
59432
|
+
function timeBound(value) {
|
|
59433
|
+
parseTimeBound(value, { endOfDay: false, now: new Date });
|
|
59434
|
+
return value.trim();
|
|
59435
|
+
}
|
|
59436
|
+
function resolveTimeRange(since, until, now = new Date) {
|
|
59437
|
+
const range = {
|
|
59438
|
+
since: since ? parseTimeBound(since, { endOfDay: false, now }) : undefined,
|
|
59439
|
+
until: until ? parseTimeBound(until, { endOfDay: true, now }) : undefined
|
|
59440
|
+
};
|
|
59441
|
+
if (range.since && range.until && range.since >= range.until) {
|
|
59442
|
+
throw new InvalidArgumentError("--since must be earlier than --until");
|
|
59443
|
+
}
|
|
59444
|
+
return range;
|
|
59445
|
+
}
|
|
59446
|
+
function describeTimeRange(range) {
|
|
59447
|
+
const fmt = (d) => `${d.toISOString().slice(0, 16)}Z`;
|
|
59448
|
+
const parts = [];
|
|
59449
|
+
if (range.since)
|
|
59450
|
+
parts.push(`since ${fmt(range.since)}`);
|
|
59451
|
+
if (range.until)
|
|
59452
|
+
parts.push(`before ${fmt(range.until)}`);
|
|
59453
|
+
return parts.join(" and ");
|
|
59454
|
+
}
|
|
59455
|
+
var RELATIVE_BOUND, DATE_ONLY, ISO_DATETIME, HOUR_MS, RELATIVE_UNIT_MS, INVALID_BOUND;
|
|
59456
|
+
var init_time_range = __esm(() => {
|
|
59457
|
+
init_commander();
|
|
59458
|
+
RELATIVE_BOUND = /^(\d+)([hdw])$/;
|
|
59459
|
+
DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
59460
|
+
ISO_DATETIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|[+-]\d{2}(?::?\d{2})?)?$/i;
|
|
59461
|
+
HOUR_MS = 60 * 60 * 1000;
|
|
59462
|
+
RELATIVE_UNIT_MS = {
|
|
59463
|
+
h: HOUR_MS,
|
|
59464
|
+
d: 24 * HOUR_MS,
|
|
59465
|
+
w: 7 * 24 * HOUR_MS
|
|
59466
|
+
};
|
|
59467
|
+
INVALID_BOUND = 'must be a duration like "24h", "7d", or "2w", a UTC date like "2026-09-01", ' + 'or an ISO-8601 datetime like "2026-09-01T14:00:00Z"';
|
|
59468
|
+
});
|
|
59469
|
+
|
|
59381
59470
|
// src/commands/review.ts
|
|
59382
59471
|
import { readFileSync as readFileSync18 } from "node:fs";
|
|
59383
59472
|
function requireConfig10() {
|
|
@@ -59478,7 +59567,16 @@ async function getKnowledgeStoreId2(client, spaceId) {
|
|
|
59478
59567
|
}
|
|
59479
59568
|
function reviewCommand() {
|
|
59480
59569
|
const cmd = new Command("review").description("Review workflow (doc changes and draft replies)");
|
|
59481
|
-
cmd.command("list").description("List pending review items (doc changes and draft replies)").option("--json", "Output as JSON").action(async (opts) => {
|
|
59570
|
+
cmd.command("list").description("List pending review items (doc changes and draft replies)").addOption(new Option("--since <when>", "Only items created at or after <when>: a duration back from now (24h, 7d, 2w), " + "a UTC date (2026-09-01), or an ISO-8601 datetime").argParser(timeBound)).addOption(new Option("--until <when>", "Only items created before <when> (same forms; a date includes that whole day)").argParser(timeBound)).option("--json", "Output as JSON").action(async (opts) => {
|
|
59571
|
+
let range;
|
|
59572
|
+
try {
|
|
59573
|
+
range = resolveTimeRange(opts.since, opts.until);
|
|
59574
|
+
} catch (err) {
|
|
59575
|
+
console.error(import_picocolors25.default.red(`${err.message}.`));
|
|
59576
|
+
process.exit(1);
|
|
59577
|
+
}
|
|
59578
|
+
const rangeLabel = describeTimeRange(range);
|
|
59579
|
+
const inRange = rangeLabel ? ` ${rangeLabel}` : "";
|
|
59482
59580
|
const cfg = requireConfig10();
|
|
59483
59581
|
if (!cfg.active_account?.target?.space_id) {
|
|
59484
59582
|
console.error(import_picocolors25.default.red("Missing space config. Run 'dosu setup' to reconfigure."));
|
|
@@ -59488,7 +59586,9 @@ function reviewCommand() {
|
|
|
59488
59586
|
const ksId = await getKnowledgeStoreId2(client, cfg.active_account?.target?.space_id);
|
|
59489
59587
|
const result = await client.review.listPending.query({
|
|
59490
59588
|
knowledgeStoreId: ksId,
|
|
59491
|
-
deploymentId: cfg.active_account?.target?.deployment_id
|
|
59589
|
+
deploymentId: cfg.active_account?.target?.deployment_id,
|
|
59590
|
+
...range.since && { since: range.since.toISOString() },
|
|
59591
|
+
...range.until && { until: range.until.toISOString() }
|
|
59492
59592
|
});
|
|
59493
59593
|
const { items, truncated, total } = result;
|
|
59494
59594
|
if (opts.json) {
|
|
@@ -59496,9 +59596,11 @@ function reviewCommand() {
|
|
|
59496
59596
|
return;
|
|
59497
59597
|
}
|
|
59498
59598
|
if (!items || items.length === 0) {
|
|
59499
|
-
console.log(import_picocolors25.default.dim(
|
|
59599
|
+
console.log(import_picocolors25.default.dim(`No pending review items${inRange}.`));
|
|
59500
59600
|
return;
|
|
59501
59601
|
}
|
|
59602
|
+
if (rangeLabel)
|
|
59603
|
+
console.log(import_picocolors25.default.dim(`Pending review items created ${rangeLabel}:`));
|
|
59502
59604
|
printTable(["ID", "Kind", "Title", "Source", "Status", "Created"], items.map((i) => i.kind === "draft_message" ? [
|
|
59503
59605
|
i.id,
|
|
59504
59606
|
i.kind,
|
|
@@ -59515,7 +59617,7 @@ function reviewCommand() {
|
|
|
59515
59617
|
formatDate(i.createdAt)
|
|
59516
59618
|
]), { rawData: items });
|
|
59517
59619
|
if (truncated) {
|
|
59518
|
-
console.log(import_picocolors25.default.dim(`Showing ${items.length} of ${total}+ pending items (list truncated).`));
|
|
59620
|
+
console.log(import_picocolors25.default.dim(`Showing ${items.length} of ${total}+ pending items${inRange} (list truncated).`));
|
|
59519
59621
|
}
|
|
59520
59622
|
});
|
|
59521
59623
|
cmd.command("diff").description("Show a pending review item (doc-change diff or draft reply body)").argument("<id>", "Review item ID (from `dosu review list`)").option("--json", "Output as JSON").action(async (id, opts) => {
|
|
@@ -59693,6 +59795,7 @@ var init_review = __esm(() => {
|
|
|
59693
59795
|
init_auth();
|
|
59694
59796
|
init_confirmation();
|
|
59695
59797
|
init_output();
|
|
59798
|
+
init_time_range();
|
|
59696
59799
|
import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
59697
59800
|
});
|
|
59698
59801
|
|
|
@@ -66839,4 +66942,4 @@ main().catch((err) => {
|
|
|
66839
66942
|
process.exit(1);
|
|
66840
66943
|
});
|
|
66841
66944
|
|
|
66842
|
-
//# debugId=
|
|
66945
|
+
//# debugId=102e2621-b1fd-c662-6475-6e2164756e21
|