@plaud-ai/cli 0.3.6 → 0.3.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 +82 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19899,10 +19899,18 @@ async function shutdown() {
|
|
|
19899
19899
|
return;
|
|
19900
19900
|
const client2 = cachedClient;
|
|
19901
19901
|
cachedClient = null;
|
|
19902
|
-
|
|
19903
|
-
|
|
19904
|
-
|
|
19905
|
-
|
|
19902
|
+
let timer;
|
|
19903
|
+
try {
|
|
19904
|
+
await Promise.race([
|
|
19905
|
+
client2.shutdown(),
|
|
19906
|
+
new Promise((resolve) => {
|
|
19907
|
+
timer = setTimeout(resolve, SHUTDOWN_TIMEOUT_MS);
|
|
19908
|
+
})
|
|
19909
|
+
]);
|
|
19910
|
+
} finally {
|
|
19911
|
+
if (timer)
|
|
19912
|
+
clearTimeout(timer);
|
|
19913
|
+
}
|
|
19906
19914
|
}
|
|
19907
19915
|
|
|
19908
19916
|
// ../telemetry/dist/identity.js
|
|
@@ -20257,6 +20265,13 @@ var currentCommand = "unknown";
|
|
|
20257
20265
|
var currentRequestId = "";
|
|
20258
20266
|
var startedAt = 0;
|
|
20259
20267
|
var currentFileId;
|
|
20268
|
+
var HARD_EXIT_GRACE_MS = 500;
|
|
20269
|
+
function drainAndExit(code) {
|
|
20270
|
+
process.exitCode = code;
|
|
20271
|
+
setTimeout(() => process.exit(code), HARD_EXIT_GRACE_MS).unref();
|
|
20272
|
+
return new Promise(() => {
|
|
20273
|
+
});
|
|
20274
|
+
}
|
|
20260
20275
|
function errorTypeForExit(code) {
|
|
20261
20276
|
switch (code) {
|
|
20262
20277
|
case ExitCode.AUTH_FAILED:
|
|
@@ -20301,7 +20316,7 @@ async function telemetryExit(code) {
|
|
|
20301
20316
|
});
|
|
20302
20317
|
}
|
|
20303
20318
|
await shutdown();
|
|
20304
|
-
return
|
|
20319
|
+
return drainAndExit(code);
|
|
20305
20320
|
}
|
|
20306
20321
|
|
|
20307
20322
|
// src/commands/version.ts
|
|
@@ -20364,7 +20379,7 @@ function isNewer(current, latest) {
|
|
|
20364
20379
|
return false;
|
|
20365
20380
|
}
|
|
20366
20381
|
var updateCommand = new Command("update").description("Check npm for the latest Plaud CLI and print the upgrade command").action(async () => {
|
|
20367
|
-
const current = "0.3.
|
|
20382
|
+
const current = "0.3.8";
|
|
20368
20383
|
const spinner = ora("Checking npm for latest version...").start();
|
|
20369
20384
|
const latest = await fetchLatestVersion();
|
|
20370
20385
|
spinner.stop();
|
|
@@ -20419,10 +20434,10 @@ async function checkForUpdate(current) {
|
|
|
20419
20434
|
return isNewer(current, latest) ? latest : null;
|
|
20420
20435
|
}
|
|
20421
20436
|
var versionCommand = new Command2("version").description("Show CLI version information").action(async () => {
|
|
20422
|
-
const current = "0.3.
|
|
20437
|
+
const current = "0.3.8";
|
|
20423
20438
|
console.log(`plaud ${current}`);
|
|
20424
|
-
if ("
|
|
20425
|
-
if ("2026-
|
|
20439
|
+
if ("be0dfaa") console.log(`commit ${"be0dfaa"}`);
|
|
20440
|
+
if ("2026-08-10T08:40:12.325Z") console.log(`built ${"2026-08-10T08:40:12.325Z"}`);
|
|
20426
20441
|
if (current === "unknown") return;
|
|
20427
20442
|
const newer = await checkForUpdate(current);
|
|
20428
20443
|
if (newer) {
|
|
@@ -20887,6 +20902,49 @@ async function loadBlockContent(block) {
|
|
|
20887
20902
|
return "";
|
|
20888
20903
|
}
|
|
20889
20904
|
|
|
20905
|
+
// ../shared/dist/time.js
|
|
20906
|
+
var HAS_TIMEZONE = /(?:[Zz]|[+-]\d{2}(?::?\d{2})?)$/;
|
|
20907
|
+
var HAS_TIME = /\d{2}:\d{2}/;
|
|
20908
|
+
var DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
20909
|
+
function parseApiTimestamp(value) {
|
|
20910
|
+
if (!value)
|
|
20911
|
+
return null;
|
|
20912
|
+
const trimmed = value.trim();
|
|
20913
|
+
if (!trimmed)
|
|
20914
|
+
return null;
|
|
20915
|
+
const normalised = HAS_TIME.test(trimmed) && !HAS_TIMEZONE.test(trimmed) ? `${trimmed}Z` : trimmed;
|
|
20916
|
+
const ms = new Date(normalised).getTime();
|
|
20917
|
+
return Number.isNaN(ms) ? null : ms;
|
|
20918
|
+
}
|
|
20919
|
+
function localDayStart(value) {
|
|
20920
|
+
const parts = parseDateOnly(value);
|
|
20921
|
+
if (!parts)
|
|
20922
|
+
return null;
|
|
20923
|
+
const [y, m, d] = parts;
|
|
20924
|
+
return new Date(y, m - 1, d, 0, 0, 0, 0).getTime();
|
|
20925
|
+
}
|
|
20926
|
+
function localDayEnd(value) {
|
|
20927
|
+
const parts = parseDateOnly(value);
|
|
20928
|
+
if (!parts)
|
|
20929
|
+
return null;
|
|
20930
|
+
const [y, m, d] = parts;
|
|
20931
|
+
return new Date(y, m - 1, d + 1, 0, 0, 0, 0).getTime() - 1;
|
|
20932
|
+
}
|
|
20933
|
+
function parseDateOnly(value) {
|
|
20934
|
+
if (!value)
|
|
20935
|
+
return null;
|
|
20936
|
+
const match = DATE_ONLY.exec(value.trim());
|
|
20937
|
+
if (!match)
|
|
20938
|
+
return null;
|
|
20939
|
+
const y = Number(match[1]);
|
|
20940
|
+
const m = Number(match[2]);
|
|
20941
|
+
const d = Number(match[3]);
|
|
20942
|
+
const probe = new Date(y, m - 1, d);
|
|
20943
|
+
if (probe.getFullYear() !== y || probe.getMonth() !== m - 1 || probe.getDate() !== d)
|
|
20944
|
+
return null;
|
|
20945
|
+
return [y, m, d];
|
|
20946
|
+
}
|
|
20947
|
+
|
|
20890
20948
|
// src/config.ts
|
|
20891
20949
|
import { readFileSync, existsSync } from "fs";
|
|
20892
20950
|
import { homedir as homedir4 } from "os";
|
|
@@ -21123,8 +21181,9 @@ function formatDuration(ms) {
|
|
|
21123
21181
|
}
|
|
21124
21182
|
function formatDate(iso) {
|
|
21125
21183
|
if (!iso) return "-";
|
|
21126
|
-
const
|
|
21127
|
-
if (
|
|
21184
|
+
const ms = parseApiTimestamp(iso);
|
|
21185
|
+
if (ms === null) return iso;
|
|
21186
|
+
const d = new Date(ms);
|
|
21128
21187
|
const y = d.getFullYear();
|
|
21129
21188
|
const m = String(d.getMonth() + 1).padStart(2, "0");
|
|
21130
21189
|
const day = String(d.getDate()).padStart(2, "0");
|
|
@@ -21216,7 +21275,8 @@ var getFileCommand = new Command7("file").description("Get details of a specific
|
|
|
21216
21275
|
console.log(` ${chalk8.cyan("start_at")}: ${file.start_at ?? "-"}`);
|
|
21217
21276
|
console.log(` ${chalk8.cyan("duration")}: ${formatDuration(file.duration)}`);
|
|
21218
21277
|
console.log(` ${chalk8.cyan("serial_number")}: ${file.serial_number ?? "-"}`);
|
|
21219
|
-
|
|
21278
|
+
const audioState = file.presigned_url ? chalk8.green("available") : chalk8.gray("unknown (run `plaud audio` to check)");
|
|
21279
|
+
console.log(` ${chalk8.cyan("audio")}: ${audioState}`);
|
|
21220
21280
|
console.log(` ${chalk8.cyan("transcript")}: ${hasTranscript ? chalk8.green("available") : chalk8.gray("unavailable")}`);
|
|
21221
21281
|
console.log(` ${chalk8.cyan("summary")}: ${hasSummary ? chalk8.green("available") : chalk8.gray("unavailable")}`);
|
|
21222
21282
|
console.log();
|
|
@@ -21411,25 +21471,19 @@ import chalk12 from "chalk";
|
|
|
21411
21471
|
import ora9 from "ora";
|
|
21412
21472
|
var MAX_PAGES = 5;
|
|
21413
21473
|
var PAGE_SIZE = 100;
|
|
21414
|
-
function parseDate(s) {
|
|
21415
|
-
if (!s) return null;
|
|
21416
|
-
const d = new Date(s);
|
|
21417
|
-
return Number.isNaN(d.getTime()) ? null : d.getTime();
|
|
21418
|
-
}
|
|
21419
21474
|
var searchCommand = new Command11("search").description("Search recordings by name keyword (client-side, scans up to 500 most recent recordings)").argument("<keyword>", "Case-insensitive substring to match against recording names").option("--from <date>", "Start date inclusive, YYYY-MM-DD").option("--to <date>", "End date inclusive, YYYY-MM-DD").option("--max <n>", "Maximum matches to display", "50").action(async (keyword, opts) => {
|
|
21420
21475
|
const max = parseInt(opts.max);
|
|
21421
21476
|
if (isNaN(max) || max < 1 || max > 500) {
|
|
21422
21477
|
printError("INVALID_ARGS", "--max must be a number between 1 and 500");
|
|
21423
21478
|
await telemetryExit(ExitCode.ERROR);
|
|
21424
21479
|
}
|
|
21425
|
-
const from =
|
|
21426
|
-
const
|
|
21427
|
-
const to = toRaw !== null ? toRaw + 24 * 60 * 60 * 1e3 - 1 : null;
|
|
21480
|
+
const from = localDayStart(opts.from);
|
|
21481
|
+
const to = localDayEnd(opts.to);
|
|
21428
21482
|
if (opts.from && from === null) {
|
|
21429
21483
|
printError("INVALID_ARGS", `Invalid --from date: ${opts.from}`);
|
|
21430
21484
|
await telemetryExit(ExitCode.ERROR);
|
|
21431
21485
|
}
|
|
21432
|
-
if (opts.to &&
|
|
21486
|
+
if (opts.to && to === null) {
|
|
21433
21487
|
printError("INVALID_ARGS", `Invalid --to date: ${opts.to}`);
|
|
21434
21488
|
await telemetryExit(ExitCode.ERROR);
|
|
21435
21489
|
}
|
|
@@ -21447,7 +21501,7 @@ var searchCommand = new Command11("search").description("Search recordings by na
|
|
|
21447
21501
|
for (const file of result.data) {
|
|
21448
21502
|
if (!(file.name ?? "").toLowerCase().includes(q)) continue;
|
|
21449
21503
|
if (from !== null || to !== null) {
|
|
21450
|
-
const created =
|
|
21504
|
+
const created = parseApiTimestamp(file.created_at);
|
|
21451
21505
|
if (created === null) continue;
|
|
21452
21506
|
if (from !== null && created < from) continue;
|
|
21453
21507
|
if (to !== null && created > to) continue;
|
|
@@ -21522,8 +21576,8 @@ var recentCommand = new Command12("recent").description("List recordings from th
|
|
|
21522
21576
|
let allOlder = true;
|
|
21523
21577
|
let hasValidTimestamps = false;
|
|
21524
21578
|
for (const file of result.data) {
|
|
21525
|
-
const created =
|
|
21526
|
-
if (
|
|
21579
|
+
const created = parseApiTimestamp(file.created_at);
|
|
21580
|
+
if (created === null) continue;
|
|
21527
21581
|
hasValidTimestamps = true;
|
|
21528
21582
|
if (created >= from) {
|
|
21529
21583
|
matches.push(file);
|
|
@@ -21576,8 +21630,8 @@ var todayCommand = new Command12("today").description("List recordings created t
|
|
|
21576
21630
|
const result = await client2.listFiles(1, 50);
|
|
21577
21631
|
spinner.stop();
|
|
21578
21632
|
const matches = result.data.filter((f2) => {
|
|
21579
|
-
const t =
|
|
21580
|
-
return
|
|
21633
|
+
const t = parseApiTimestamp(f2.created_at);
|
|
21634
|
+
return t !== null && t >= startMs;
|
|
21581
21635
|
});
|
|
21582
21636
|
if (matches.length === 0) {
|
|
21583
21637
|
console.log(chalk13.yellow("No recordings created today."));
|
|
@@ -21701,7 +21755,7 @@ async function runWizard() {
|
|
|
21701
21755
|
try {
|
|
21702
21756
|
await initTelemetry({
|
|
21703
21757
|
surface: "cli",
|
|
21704
|
-
appVersion: "0.3.
|
|
21758
|
+
appVersion: "0.3.8"
|
|
21705
21759
|
});
|
|
21706
21760
|
} catch {
|
|
21707
21761
|
}
|
|
@@ -21710,7 +21764,7 @@ async function notifyUpdate() {
|
|
|
21710
21764
|
if (sub === "version" || sub === "update") return;
|
|
21711
21765
|
if (process.env.PLAUD_NO_UPDATE_NOTIFIER) return;
|
|
21712
21766
|
if (!process.stderr.isTTY) return;
|
|
21713
|
-
const current = "0.3.
|
|
21767
|
+
const current = "0.3.8";
|
|
21714
21768
|
if (current === "0.0.0") return;
|
|
21715
21769
|
try {
|
|
21716
21770
|
const newer = await checkForUpdate(current);
|