@plaud-ai/cli 0.3.0 → 0.3.2

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 +242 -217
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16059,6 +16059,7 @@ var require_axios = __commonJS({
16059
16059
  // src/index.ts
16060
16060
  import "dotenv/config";
16061
16061
  import { Command as Command13 } from "commander";
16062
+ import chalk15 from "chalk";
16062
16063
 
16063
16064
  // ../telemetry/dist/config.js
16064
16065
  var DEFAULT_HOST = "https://us.i.posthog.com";
@@ -16084,7 +16085,7 @@ function loadConfig() {
16084
16085
  optOutReason: "PLAUD_TELEMETRY_DISABLED is set"
16085
16086
  };
16086
16087
  }
16087
- const apiKey = process.env.PLAUD_POSTHOG_KEY ?? null;
16088
+ const apiKey = "phc_Be6wE0Vfi6lsbbfKfl4tgpzqKkB1UG29ddOlSA6B8NW";
16088
16089
  const host = process.env.PLAUD_POSTHOG_HOST ?? DEFAULT_HOST;
16089
16090
  return { apiKey, host, optedOut: false, optOutReason: null };
16090
16091
  }
@@ -20295,34 +20296,162 @@ async function telemetryExit(code) {
20295
20296
  return process.exit(code);
20296
20297
  }
20297
20298
 
20298
- // src/commands/login.ts
20299
+ // src/commands/version.ts
20300
+ import { Command as Command2 } from "commander";
20301
+ import chalk3 from "chalk";
20302
+ import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
20303
+ import { homedir as homedir2 } from "os";
20304
+ import { join as join2, dirname as dirname2 } from "path";
20305
+
20306
+ // src/commands/update.ts
20299
20307
  import { Command } from "commander";
20300
- import { createServer as createServer2 } from "net";
20301
- import open from "open";
20302
20308
  import chalk2 from "chalk";
20303
20309
  import ora from "ora";
20304
20310
 
20311
+ // src/error.ts
20312
+ import chalk from "chalk";
20313
+ function printError(code, message, detail) {
20314
+ console.error(chalk.red(`\u2717 [${code}] ${message}`));
20315
+ if (detail) console.error(chalk.gray(String(detail)));
20316
+ }
20317
+ function isAuthError(err) {
20318
+ if (!(err instanceof Error)) return false;
20319
+ return err.message.includes("Not authenticated") || err.message.includes("401");
20320
+ }
20321
+ function isNetworkError(err) {
20322
+ if (!(err instanceof Error)) return false;
20323
+ return err instanceof TypeError || err.message.includes("ECONNREFUSED") || err.message.includes("ENOTFOUND") || err.message.includes("fetch failed");
20324
+ }
20325
+ function isTimeoutError(err) {
20326
+ if (!(err instanceof Error)) return false;
20327
+ return err.name === "AbortError" || err.message.toLowerCase().includes("timeout");
20328
+ }
20329
+
20330
+ // src/commands/update.ts
20331
+ var PKG_NAME = "@plaud-ai/cli";
20332
+ var REGISTRY = "https://registry.npmjs.org";
20333
+ async function fetchLatestVersion(timeoutMs = 5e3) {
20334
+ const ctrl = new AbortController();
20335
+ const t = setTimeout(() => ctrl.abort(), timeoutMs);
20336
+ try {
20337
+ const res = await fetch(`${REGISTRY}/${encodeURIComponent(PKG_NAME)}/latest`, { signal: ctrl.signal });
20338
+ if (!res.ok) return null;
20339
+ const json = await res.json();
20340
+ return json.version ?? null;
20341
+ } catch {
20342
+ return null;
20343
+ } finally {
20344
+ clearTimeout(t);
20345
+ }
20346
+ }
20347
+ function isNewer(current, latest) {
20348
+ const c = current.split(".").map(Number);
20349
+ const l = latest.split(".").map(Number);
20350
+ for (let i = 0; i < Math.max(c.length, l.length); i++) {
20351
+ const cv = c[i] ?? 0;
20352
+ const lv = l[i] ?? 0;
20353
+ if (lv > cv) return true;
20354
+ if (lv < cv) return false;
20355
+ }
20356
+ return false;
20357
+ }
20358
+ var updateCommand = new Command("update").description("Check npm for the latest Plaud CLI and print the upgrade command").action(async () => {
20359
+ const current = "0.3.2";
20360
+ const spinner = ora("Checking npm for latest version...").start();
20361
+ const latest = await fetchLatestVersion();
20362
+ spinner.stop();
20363
+ if (!latest) {
20364
+ printError("UNREACHABLE", "Could not reach npm registry to check for updates.");
20365
+ await telemetryExit(ExitCode.UNREACHABLE);
20366
+ return;
20367
+ }
20368
+ if (!isNewer(current, latest)) {
20369
+ console.log(chalk2.green(`You're on the latest version (${current}).`));
20370
+ return;
20371
+ }
20372
+ console.log(chalk2.yellow(`A newer version is available: ${current} \u2192 ${latest}`));
20373
+ console.log();
20374
+ console.log("Run this command to upgrade:");
20375
+ console.log();
20376
+ console.log(chalk2.bold(` npm install -g ${PKG_NAME}@latest`));
20377
+ console.log();
20378
+ });
20379
+
20380
+ // src/commands/version.ts
20381
+ var CACHE_PATH = join2(homedir2(), ".plaud", "version-check.json");
20382
+ var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
20383
+ async function readCache() {
20384
+ try {
20385
+ const raw = await readFile2(CACHE_PATH, "utf-8");
20386
+ const parsed = JSON.parse(raw);
20387
+ if (typeof parsed.checked_at !== "number" || typeof parsed.latest !== "string") return null;
20388
+ return parsed;
20389
+ } catch {
20390
+ return null;
20391
+ }
20392
+ }
20393
+ async function writeCache(entry) {
20394
+ try {
20395
+ await mkdir2(dirname2(CACHE_PATH), { recursive: true });
20396
+ await writeFile2(CACHE_PATH, JSON.stringify(entry), "utf-8");
20397
+ } catch {
20398
+ }
20399
+ }
20400
+ async function checkForUpdate(current) {
20401
+ const cached = await readCache();
20402
+ const now = Date.now();
20403
+ let latest = null;
20404
+ if (cached && now - cached.checked_at < CACHE_TTL_MS) {
20405
+ latest = cached.latest;
20406
+ } else {
20407
+ latest = await fetchLatestVersion(2e3);
20408
+ if (latest) await writeCache({ checked_at: now, latest });
20409
+ }
20410
+ if (!latest) return null;
20411
+ return isNewer(current, latest) ? latest : null;
20412
+ }
20413
+ var versionCommand = new Command2("version").description("Show CLI version information").action(async () => {
20414
+ const current = "0.3.2";
20415
+ console.log(`plaud ${current}`);
20416
+ if ("cebd8b5") console.log(`commit ${"cebd8b5"}`);
20417
+ if ("2026-06-12T06:59:36.525Z") console.log(`built ${"2026-06-12T06:59:36.525Z"}`);
20418
+ if (current === "unknown") return;
20419
+ const newer = await checkForUpdate(current);
20420
+ if (newer) {
20421
+ console.log();
20422
+ console.log(chalk3.yellow(`A newer version is available: ${current} \u2192 ${newer}`));
20423
+ console.log(chalk3.gray(`Run \`plaud update\` for upgrade instructions.`));
20424
+ }
20425
+ });
20426
+
20427
+ // src/commands/login.ts
20428
+ import { Command as Command3 } from "commander";
20429
+ import { createServer as createServer2 } from "net";
20430
+ import open from "open";
20431
+ import chalk4 from "chalk";
20432
+ import ora2 from "ora";
20433
+
20305
20434
  // ../shared/dist/oauth.js
20306
20435
  import { randomBytes, createHash } from "crypto";
20307
20436
 
20308
20437
  // ../shared/dist/token-store.js
20309
- import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, rm as rm2 } from "fs/promises";
20310
- import { join as join2 } from "path";
20311
- import { homedir as homedir2 } from "os";
20438
+ import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3, rm as rm2 } from "fs/promises";
20439
+ import { join as join3 } from "path";
20440
+ import { homedir as homedir3 } from "os";
20312
20441
  var TokenStore = class {
20313
20442
  configDir;
20314
20443
  tokenPath;
20315
20444
  constructor(filename = "tokens.json") {
20316
- this.configDir = join2(homedir2(), ".plaud");
20317
- this.tokenPath = join2(this.configDir, filename);
20445
+ this.configDir = join3(homedir3(), ".plaud");
20446
+ this.tokenPath = join3(this.configDir, filename);
20318
20447
  }
20319
20448
  async save(tokenSet) {
20320
- await mkdir2(this.configDir, { recursive: true });
20321
- await writeFile2(this.tokenPath, JSON.stringify(tokenSet, null, 2), "utf-8");
20449
+ await mkdir3(this.configDir, { recursive: true });
20450
+ await writeFile3(this.tokenPath, JSON.stringify(tokenSet, null, 2), "utf-8");
20322
20451
  }
20323
20452
  async load() {
20324
20453
  try {
20325
- const data = await readFile2(this.tokenPath, "utf-8");
20454
+ const data = await readFile3(this.tokenPath, "utf-8");
20326
20455
  return JSON.parse(data);
20327
20456
  } catch {
20328
20457
  return null;
@@ -20725,11 +20854,11 @@ function runOAuthCallback(opts) {
20725
20854
 
20726
20855
  // src/config.ts
20727
20856
  import { readFileSync, existsSync } from "fs";
20728
- import { homedir as homedir3 } from "os";
20729
- import { join as join3 } from "path";
20857
+ import { homedir as homedir4 } from "os";
20858
+ import { join as join4 } from "path";
20730
20859
  import { parse } from "yaml";
20731
20860
  function loadCliConfig() {
20732
- const configPath = join3(homedir3(), ".plaud", "cli.yaml");
20861
+ const configPath = join4(homedir4(), ".plaud", "cli.yaml");
20733
20862
  if (!existsSync(configPath)) return {};
20734
20863
  try {
20735
20864
  return parse(readFileSync(configPath, "utf8")) ?? {};
@@ -20765,25 +20894,6 @@ function getClient2() {
20765
20894
  return client;
20766
20895
  }
20767
20896
 
20768
- // src/error.ts
20769
- import chalk from "chalk";
20770
- function printError(code, message, detail) {
20771
- console.error(chalk.red(`\u2717 [${code}] ${message}`));
20772
- if (detail) console.error(chalk.gray(String(detail)));
20773
- }
20774
- function isAuthError(err) {
20775
- if (!(err instanceof Error)) return false;
20776
- return err.message.includes("Not authenticated") || err.message.includes("401");
20777
- }
20778
- function isNetworkError(err) {
20779
- if (!(err instanceof Error)) return false;
20780
- return err instanceof TypeError || err.message.includes("ECONNREFUSED") || err.message.includes("ENOTFOUND") || err.message.includes("fetch failed");
20781
- }
20782
- function isTimeoutError(err) {
20783
- if (!(err instanceof Error)) return false;
20784
- return err.name === "AbortError" || err.message.toLowerCase().includes("timeout");
20785
- }
20786
-
20787
20897
  // src/commands/login.ts
20788
20898
  var CALLBACK_PORT = 8199;
20789
20899
  var LOGIN_TIMEOUT_MS = 12e4;
@@ -20796,18 +20906,18 @@ function probeCallbackPort(port) {
20796
20906
  });
20797
20907
  });
20798
20908
  }
20799
- var loginCommand = new Command("login").description("Authenticate with Plaud via OAuth").action(async () => {
20909
+ var loginCommand = new Command3("login").description("Authenticate with Plaud via OAuth").action(async () => {
20800
20910
  const client2 = getClient2();
20801
20911
  try {
20802
20912
  const token = await client2.auth.getAccessToken();
20803
20913
  if (token) {
20804
20914
  try {
20805
20915
  await client2.getCurrentUser();
20806
- console.log(chalk2.yellow("Already logged in. Run `plaud logout` first to switch accounts."));
20916
+ console.log(chalk4.yellow("Already logged in. Run `plaud logout` first to switch accounts."));
20807
20917
  return;
20808
20918
  } catch (err) {
20809
20919
  if (isAuthError(err)) {
20810
- console.log(chalk2.yellow("Existing credentials are no longer valid. Starting fresh login..."));
20920
+ console.log(chalk4.yellow("Existing credentials are no longer valid. Starting fresh login..."));
20811
20921
  await client2.auth.logout();
20812
20922
  } else if (isNetworkError(err)) {
20813
20923
  printError("UNREACHABLE", "Cannot reach Plaud servers to verify login state. Check your network.", err);
@@ -20831,15 +20941,15 @@ var loginCommand = new Command("login").description("Authenticate with Plaud via
20831
20941
  "PORT_IN_USE",
20832
20942
  `OAuth callback port ${CALLBACK_PORT} is already in use. Another Plaud process is likely holding it (e.g. \`plaud-mcp http\` or another \`plaud login\`). The OAuth redirect_uri is fixed to localhost:${CALLBACK_PORT}, so login cannot proceed until the port is free.`
20833
20943
  );
20834
- console.error(chalk2.gray(` Find the process: lsof -nP -iTCP:${CALLBACK_PORT} -sTCP:LISTEN`));
20835
- console.error(chalk2.gray(` Then stop it and retry \`plaud login\`.`));
20944
+ console.error(chalk4.gray(` Find the process: lsof -nP -iTCP:${CALLBACK_PORT} -sTCP:LISTEN`));
20945
+ console.error(chalk4.gray(` Then stop it and retry \`plaud login\`.`));
20836
20946
  } else {
20837
20947
  printError("PORT_PROBE_FAILED", `Could not bind callback port ${CALLBACK_PORT}.`, portError);
20838
20948
  }
20839
20949
  await telemetryExit(ExitCode.ERROR);
20840
20950
  }
20841
20951
  const { url, codeVerifier, state: state2 } = client2.auth.createAuthorizationRequest();
20842
- const spinner = ora("Waiting for browser authentication...").start();
20952
+ const spinner = ora2("Waiting for browser authentication...").start();
20843
20953
  const result = await runOAuthCallback({
20844
20954
  port: CALLBACK_PORT,
20845
20955
  expectedState: state2,
@@ -20848,11 +20958,11 @@ var loginCommand = new Command("login").description("Authenticate with Plaud via
20848
20958
  await client2.auth.exchangeCode(code, codeVerifier, state2);
20849
20959
  },
20850
20960
  onListening: () => {
20851
- console.log(chalk2.blue(`
20961
+ console.log(chalk4.blue(`
20852
20962
  Opening browser for authentication...
20853
20963
  `));
20854
20964
  open(url).catch(() => {
20855
- console.log(chalk2.yellow(`Could not open browser. Open this URL manually:
20965
+ console.log(chalk4.yellow(`Could not open browser. Open this URL manually:
20856
20966
  ${url}`));
20857
20967
  });
20858
20968
  }
@@ -20896,13 +21006,13 @@ Opening browser for authentication...
20896
21006
  });
20897
21007
 
20898
21008
  // src/commands/logout.ts
20899
- import { Command as Command2 } from "commander";
20900
- import chalk3 from "chalk";
20901
- var logoutCommand = new Command2("logout").description("Log out and revoke authorization").action(async () => {
21009
+ import { Command as Command4 } from "commander";
21010
+ import chalk5 from "chalk";
21011
+ var logoutCommand = new Command4("logout").description("Log out and revoke authorization").action(async () => {
20902
21012
  const client2 = getClient2();
20903
21013
  const token = await client2.auth.getAccessToken();
20904
21014
  if (!token) {
20905
- console.log(chalk3.yellow("Not logged in."));
21015
+ console.log(chalk5.yellow("Not logged in."));
20906
21016
  return;
20907
21017
  }
20908
21018
  try {
@@ -20919,22 +21029,22 @@ var logoutCommand = new Command2("logout").description("Log out and revoke autho
20919
21029
  await clearUser();
20920
21030
  } catch {
20921
21031
  }
20922
- console.log(chalk3.green("Logged out and revoked authorization."));
21032
+ console.log(chalk5.green("Logged out and revoked authorization."));
20923
21033
  });
20924
21034
 
20925
21035
  // src/commands/me.ts
20926
- import { Command as Command3 } from "commander";
20927
- import chalk4 from "chalk";
20928
- import ora2 from "ora";
20929
- var meCommand = new Command3("me").description("Show current authenticated user info").action(async () => {
21036
+ import { Command as Command5 } from "commander";
21037
+ import chalk6 from "chalk";
21038
+ import ora3 from "ora";
21039
+ var meCommand = new Command5("me").description("Show current authenticated user info").action(async () => {
20930
21040
  const client2 = getClient2();
20931
- const spinner = ora2("Fetching user info...").start();
21041
+ const spinner = ora3("Fetching user info...").start();
20932
21042
  try {
20933
21043
  const user = await client2.getCurrentUser();
20934
21044
  spinner.stop();
20935
- console.log(chalk4.bold("\nUser Info:\n"));
21045
+ console.log(chalk6.bold("\nUser Info:\n"));
20936
21046
  for (const [key, value] of Object.entries(user)) {
20937
- console.log(` ${chalk4.cyan(key)}: ${value}`);
21047
+ console.log(` ${chalk6.cyan(key)}: ${value}`);
20938
21048
  }
20939
21049
  console.log();
20940
21050
  } catch (err) {
@@ -20957,9 +21067,9 @@ var meCommand = new Command3("me").description("Show current authenticated user
20957
21067
  });
20958
21068
 
20959
21069
  // src/commands/list-files.ts
20960
- import { Command as Command4 } from "commander";
20961
- import chalk5 from "chalk";
20962
- import ora3 from "ora";
21070
+ import { Command as Command6 } from "commander";
21071
+ import chalk7 from "chalk";
21072
+ import ora4 from "ora";
20963
21073
 
20964
21074
  // src/format.ts
20965
21075
  function formatDuration(ms) {
@@ -20996,7 +21106,7 @@ function truncate2(s, width) {
20996
21106
  if (s.length <= width) return s.padEnd(width);
20997
21107
  return s.slice(0, width - 1) + "\u2026";
20998
21108
  }
20999
- var listFilesCommand = new Command4("files").description("List your Plaud recordings").option("-p, --page <number>", "Page number", "1").option("-s, --page-size <number>", "Page size", "20").action(async (opts) => {
21109
+ var listFilesCommand = new Command6("files").description("List your Plaud recordings").option("-p, --page <number>", "Page number", "1").option("-s, --page-size <number>", "Page size", "20").action(async (opts) => {
21000
21110
  const page = parseInt(opts.page);
21001
21111
  const pageSize = parseInt(opts.pageSize);
21002
21112
  if (isNaN(page) || page < 1 || page > 1e3) {
@@ -21008,24 +21118,24 @@ var listFilesCommand = new Command4("files").description("List your Plaud record
21008
21118
  await telemetryExit(ExitCode.ERROR);
21009
21119
  }
21010
21120
  const client2 = getClient2();
21011
- const spinner = ora3("Fetching files...").start();
21121
+ const spinner = ora4("Fetching files...").start();
21012
21122
  try {
21013
21123
  const result = await client2.listFiles(page, pageSize);
21014
21124
  spinner.stop();
21015
- console.log(chalk5.bold(`
21125
+ console.log(chalk7.bold(`
21016
21126
  Files on this page: ${result.data.length}
21017
21127
  `));
21018
- const header = ` ${chalk5.bold("ID".padEnd(ID_WIDTH))} ${chalk5.bold("NAME".padEnd(NAME_WIDTH))} ${chalk5.bold("DATE".padEnd(DATE_WIDTH))} ${chalk5.bold("DURATION")}`;
21128
+ const header = ` ${chalk7.bold("ID".padEnd(ID_WIDTH))} ${chalk7.bold("NAME".padEnd(NAME_WIDTH))} ${chalk7.bold("DATE".padEnd(DATE_WIDTH))} ${chalk7.bold("DURATION")}`;
21019
21129
  console.log(header);
21020
- console.log(chalk5.gray(" " + "\u2500".repeat(ID_WIDTH + NAME_WIDTH + DATE_WIDTH + 16)));
21130
+ console.log(chalk7.gray(" " + "\u2500".repeat(ID_WIDTH + NAME_WIDTH + DATE_WIDTH + 16)));
21021
21131
  for (const file of result.data) {
21022
- const id = chalk5.cyan(file.id.padEnd(ID_WIDTH));
21132
+ const id = chalk7.cyan(file.id.padEnd(ID_WIDTH));
21023
21133
  const name = truncate2(file.name ?? "", NAME_WIDTH);
21024
- const date = chalk5.gray(formatDate(file.created_at).padEnd(DATE_WIDTH));
21025
- const duration = chalk5.gray(formatDuration(file.duration));
21134
+ const date = chalk7.gray(formatDate(file.created_at).padEnd(DATE_WIDTH));
21135
+ const duration = chalk7.gray(formatDuration(file.duration));
21026
21136
  console.log(` ${id} ${name} ${date} ${duration}`);
21027
21137
  }
21028
- console.log(chalk5.gray(`
21138
+ console.log(chalk7.gray(`
21029
21139
  Page ${result.page}`));
21030
21140
  } catch (err) {
21031
21141
  spinner.stop();
@@ -21047,12 +21157,12 @@ Page ${result.page}`));
21047
21157
  });
21048
21158
 
21049
21159
  // src/commands/get-file.ts
21050
- import { Command as Command5 } from "commander";
21051
- import chalk6 from "chalk";
21052
- import ora4 from "ora";
21053
- var getFileCommand = new Command5("file").description("Get details of a specific Plaud recording").argument("<file_id>", "The file ID to retrieve").action(async (fileId) => {
21160
+ import { Command as Command7 } from "commander";
21161
+ import chalk8 from "chalk";
21162
+ import ora5 from "ora";
21163
+ var getFileCommand = new Command7("file").description("Get details of a specific Plaud recording").argument("<file_id>", "The file ID to retrieve").action(async (fileId) => {
21054
21164
  const client2 = getClient2();
21055
- const spinner = ora4("Fetching file...").start();
21165
+ const spinner = ora5("Fetching file...").start();
21056
21166
  try {
21057
21167
  const file = await client2.getFile(fileId);
21058
21168
  spinner.stop();
@@ -21060,16 +21170,16 @@ var getFileCommand = new Command5("file").description("Get details of a specific
21060
21170
  const noteList = file.note_list ?? [];
21061
21171
  const hasTranscript = sourceList.some((s) => s.data_type === "transaction");
21062
21172
  const hasSummary = noteList.some((n) => n.data_type === "auto_sum_note");
21063
- console.log(chalk6.bold("\nFile Details:\n"));
21064
- console.log(` ${chalk6.cyan("id")}: ${file.id}`);
21065
- console.log(` ${chalk6.cyan("name")}: ${file.name}`);
21066
- console.log(` ${chalk6.cyan("created_at")}: ${file.created_at}`);
21067
- console.log(` ${chalk6.cyan("start_at")}: ${file.start_at ?? "-"}`);
21068
- console.log(` ${chalk6.cyan("duration")}: ${formatDuration(file.duration)}`);
21069
- console.log(` ${chalk6.cyan("serial_number")}: ${file.serial_number ?? "-"}`);
21070
- console.log(` ${chalk6.cyan("audio")}: ${file.presigned_url ? chalk6.green("available") : chalk6.gray("unavailable")}`);
21071
- console.log(` ${chalk6.cyan("transcript")}: ${hasTranscript ? chalk6.green("available") : chalk6.gray("unavailable")}`);
21072
- console.log(` ${chalk6.cyan("summary")}: ${hasSummary ? chalk6.green("available") : chalk6.gray("unavailable")}`);
21173
+ console.log(chalk8.bold("\nFile Details:\n"));
21174
+ console.log(` ${chalk8.cyan("id")}: ${file.id}`);
21175
+ console.log(` ${chalk8.cyan("name")}: ${file.name}`);
21176
+ console.log(` ${chalk8.cyan("created_at")}: ${file.created_at}`);
21177
+ console.log(` ${chalk8.cyan("start_at")}: ${file.start_at ?? "-"}`);
21178
+ console.log(` ${chalk8.cyan("duration")}: ${formatDuration(file.duration)}`);
21179
+ console.log(` ${chalk8.cyan("serial_number")}: ${file.serial_number ?? "-"}`);
21180
+ console.log(` ${chalk8.cyan("audio")}: ${file.presigned_url ? chalk8.green("available") : chalk8.gray("unavailable")}`);
21181
+ console.log(` ${chalk8.cyan("transcript")}: ${hasTranscript ? chalk8.green("available") : chalk8.gray("unavailable")}`);
21182
+ console.log(` ${chalk8.cyan("summary")}: ${hasSummary ? chalk8.green("available") : chalk8.gray("unavailable")}`);
21073
21183
  console.log();
21074
21184
  } catch (err) {
21075
21185
  spinner.stop();
@@ -21095,22 +21205,22 @@ var getFileCommand = new Command5("file").description("Get details of a specific
21095
21205
  });
21096
21206
 
21097
21207
  // src/commands/audio.ts
21098
- import { Command as Command6 } from "commander";
21099
- import chalk7 from "chalk";
21100
- import ora5 from "ora";
21101
- var audioCommand = new Command6("audio").description("Get the audio download URL for a Plaud recording").argument("<file_id>", "The file ID to retrieve audio for").action(async (fileId) => {
21208
+ import { Command as Command8 } from "commander";
21209
+ import chalk9 from "chalk";
21210
+ import ora6 from "ora";
21211
+ var audioCommand = new Command8("audio").description("Get the audio download URL for a Plaud recording").argument("<file_id>", "The file ID to retrieve audio for").action(async (fileId) => {
21102
21212
  const client2 = getClient2();
21103
- const spinner = ora5("Fetching audio URL...").start();
21213
+ const spinner = ora6("Fetching audio URL...").start();
21104
21214
  try {
21105
21215
  const file = await client2.getFile(fileId);
21106
21216
  spinner.stop();
21107
21217
  if (!file.presigned_url) {
21108
- console.log(chalk7.yellow("Audio not available for this recording."));
21218
+ console.log(chalk9.yellow("Audio not available for this recording."));
21109
21219
  return;
21110
21220
  }
21111
- console.log(chalk7.bold("\nAudio Download URL:\n"));
21221
+ console.log(chalk9.bold("\nAudio Download URL:\n"));
21112
21222
  console.log(file.presigned_url);
21113
- console.log(chalk7.gray("\nNote: This URL expires in 24 hours."));
21223
+ console.log(chalk9.gray("\nNote: This URL expires in 24 hours."));
21114
21224
  console.log();
21115
21225
  } catch (err) {
21116
21226
  spinner.stop();
@@ -21132,20 +21242,20 @@ var audioCommand = new Command6("audio").description("Get the audio download URL
21132
21242
  });
21133
21243
 
21134
21244
  // src/commands/transcript.ts
21135
- import { Command as Command7 } from "commander";
21136
- import chalk8 from "chalk";
21137
- import ora6 from "ora";
21138
- import { writeFile as writeFile3 } from "fs/promises";
21139
- var transcriptCommand = new Command7("transcript").description("Get the transcript for a Plaud recording").argument("<file_id>", "The file ID to retrieve transcript for").option("-o, --output <file>", "Save transcript to a file").action(async (fileId, opts) => {
21245
+ import { Command as Command9 } from "commander";
21246
+ import chalk10 from "chalk";
21247
+ import ora7 from "ora";
21248
+ import { writeFile as writeFile4 } from "fs/promises";
21249
+ var transcriptCommand = new Command9("transcript").description("Get the transcript for a Plaud recording").argument("<file_id>", "The file ID to retrieve transcript for").option("-o, --output <file>", "Save transcript to a file").action(async (fileId, opts) => {
21140
21250
  const client2 = getClient2();
21141
- const spinner = ora6("Fetching transcript...").start();
21251
+ const spinner = ora7("Fetching transcript...").start();
21142
21252
  try {
21143
21253
  const file = await client2.getFile(fileId);
21144
21254
  spinner.stop();
21145
21255
  const sourceList = file.source_list ?? [];
21146
21256
  const source = sourceList.find((s) => s.data_type === "transaction");
21147
21257
  if (!source) {
21148
- console.log(chalk8.yellow("Transcript not available for this recording."));
21258
+ console.log(chalk10.yellow("Transcript not available for this recording."));
21149
21259
  return;
21150
21260
  }
21151
21261
  const segments = JSON.parse(source.data_content);
@@ -21156,10 +21266,10 @@ var transcriptCommand = new Command7("transcript").description("Get the transcri
21156
21266
  });
21157
21267
  const output = lines.join("\n");
21158
21268
  if (opts.output) {
21159
- await writeFile3(opts.output, output, "utf-8");
21160
- console.log(chalk8.green(`Transcript saved to ${opts.output}`));
21269
+ await writeFile4(opts.output, output, "utf-8");
21270
+ console.log(chalk10.green(`Transcript saved to ${opts.output}`));
21161
21271
  } else {
21162
- console.log(chalk8.bold(`
21272
+ console.log(chalk10.bold(`
21163
21273
  Transcript: ${file.name}
21164
21274
  `));
21165
21275
  console.log(output);
@@ -21185,28 +21295,28 @@ Transcript: ${file.name}
21185
21295
  });
21186
21296
 
21187
21297
  // src/commands/summary.ts
21188
- import { Command as Command8 } from "commander";
21189
- import chalk9 from "chalk";
21190
- import ora7 from "ora";
21191
- import { writeFile as writeFile4 } from "fs/promises";
21192
- var summaryCommand = new Command8("summary").description("Get the AI summary for a Plaud recording").argument("<file_id>", "The file ID to retrieve summary for").option("-o, --output <file>", "Save summary to a file").action(async (fileId, opts) => {
21298
+ import { Command as Command10 } from "commander";
21299
+ import chalk11 from "chalk";
21300
+ import ora8 from "ora";
21301
+ import { writeFile as writeFile5 } from "fs/promises";
21302
+ var summaryCommand = new Command10("summary").description("Get the AI summary for a Plaud recording").argument("<file_id>", "The file ID to retrieve summary for").option("-o, --output <file>", "Save summary to a file").action(async (fileId, opts) => {
21193
21303
  const client2 = getClient2();
21194
- const spinner = ora7("Fetching summary...").start();
21304
+ const spinner = ora8("Fetching summary...").start();
21195
21305
  try {
21196
21306
  const file = await client2.getFile(fileId);
21197
21307
  spinner.stop();
21198
21308
  const noteList = file.note_list ?? [];
21199
21309
  const note = noteList.find((n) => n.data_type === "auto_sum_note");
21200
21310
  if (!note || !note.data_content) {
21201
- console.log(chalk9.yellow("Summary not available for this recording."));
21311
+ console.log(chalk11.yellow("Summary not available for this recording."));
21202
21312
  return;
21203
21313
  }
21204
21314
  const content = note.data_content;
21205
21315
  if (opts.output) {
21206
- await writeFile4(opts.output, content, "utf-8");
21207
- console.log(chalk9.green(`Summary saved to ${opts.output}`));
21316
+ await writeFile5(opts.output, content, "utf-8");
21317
+ console.log(chalk11.green(`Summary saved to ${opts.output}`));
21208
21318
  } else {
21209
- console.log(chalk9.bold(`
21319
+ console.log(chalk11.bold(`
21210
21320
  Summary: ${file.name}
21211
21321
  `));
21212
21322
  console.log(content);
@@ -21231,113 +21341,6 @@ Summary: ${file.name}
21231
21341
  }
21232
21342
  });
21233
21343
 
21234
- // src/commands/version.ts
21235
- import { Command as Command10 } from "commander";
21236
- import chalk11 from "chalk";
21237
- import { readFile as readFile3, writeFile as writeFile5, mkdir as mkdir3 } from "fs/promises";
21238
- import { homedir as homedir4 } from "os";
21239
- import { join as join4, dirname as dirname2 } from "path";
21240
-
21241
- // src/commands/update.ts
21242
- import { Command as Command9 } from "commander";
21243
- import chalk10 from "chalk";
21244
- import ora8 from "ora";
21245
- var PKG_NAME = "@plaud-ai/cli";
21246
- var REGISTRY = "https://registry.npmjs.org";
21247
- async function fetchLatestVersion(timeoutMs = 5e3) {
21248
- const ctrl = new AbortController();
21249
- const t = setTimeout(() => ctrl.abort(), timeoutMs);
21250
- try {
21251
- const res = await fetch(`${REGISTRY}/${encodeURIComponent(PKG_NAME)}/latest`, { signal: ctrl.signal });
21252
- if (!res.ok) return null;
21253
- const json = await res.json();
21254
- return json.version ?? null;
21255
- } catch {
21256
- return null;
21257
- } finally {
21258
- clearTimeout(t);
21259
- }
21260
- }
21261
- function isNewer(current, latest) {
21262
- const c = current.split(".").map(Number);
21263
- const l = latest.split(".").map(Number);
21264
- for (let i = 0; i < Math.max(c.length, l.length); i++) {
21265
- const cv = c[i] ?? 0;
21266
- const lv = l[i] ?? 0;
21267
- if (lv > cv) return true;
21268
- if (lv < cv) return false;
21269
- }
21270
- return false;
21271
- }
21272
- var updateCommand = new Command9("update").description("Check npm for the latest Plaud CLI and print the upgrade command").action(async () => {
21273
- const current = "0.3.0";
21274
- const spinner = ora8("Checking npm for latest version...").start();
21275
- const latest = await fetchLatestVersion();
21276
- spinner.stop();
21277
- if (!latest) {
21278
- printError("UNREACHABLE", "Could not reach npm registry to check for updates.");
21279
- await telemetryExit(ExitCode.UNREACHABLE);
21280
- return;
21281
- }
21282
- if (!isNewer(current, latest)) {
21283
- console.log(chalk10.green(`You're on the latest version (${current}).`));
21284
- return;
21285
- }
21286
- console.log(chalk10.yellow(`A newer version is available: ${current} \u2192 ${latest}`));
21287
- console.log();
21288
- console.log("Run this command to upgrade:");
21289
- console.log();
21290
- console.log(chalk10.bold(` npm install -g ${PKG_NAME}@latest`));
21291
- console.log();
21292
- });
21293
-
21294
- // src/commands/version.ts
21295
- var CACHE_PATH = join4(homedir4(), ".plaud", "version-check.json");
21296
- var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
21297
- async function readCache() {
21298
- try {
21299
- const raw = await readFile3(CACHE_PATH, "utf-8");
21300
- const parsed = JSON.parse(raw);
21301
- if (typeof parsed.checked_at !== "number" || typeof parsed.latest !== "string") return null;
21302
- return parsed;
21303
- } catch {
21304
- return null;
21305
- }
21306
- }
21307
- async function writeCache(entry) {
21308
- try {
21309
- await mkdir3(dirname2(CACHE_PATH), { recursive: true });
21310
- await writeFile5(CACHE_PATH, JSON.stringify(entry), "utf-8");
21311
- } catch {
21312
- }
21313
- }
21314
- async function checkForUpdate(current) {
21315
- const cached = await readCache();
21316
- const now = Date.now();
21317
- let latest = null;
21318
- if (cached && now - cached.checked_at < CACHE_TTL_MS) {
21319
- latest = cached.latest;
21320
- } else {
21321
- latest = await fetchLatestVersion(2e3);
21322
- if (latest) await writeCache({ checked_at: now, latest });
21323
- }
21324
- if (!latest) return null;
21325
- return isNewer(current, latest) ? latest : null;
21326
- }
21327
- var versionCommand = new Command10("version").description("Show CLI version information").action(async () => {
21328
- const current = "0.3.0";
21329
- console.log(`plaud ${current}`);
21330
- if ("24269f2") console.log(`commit ${"24269f2"}`);
21331
- if ("2026-06-11T07:45:31.154Z") console.log(`built ${"2026-06-11T07:45:31.154Z"}`);
21332
- if (current === "unknown") return;
21333
- const newer = await checkForUpdate(current);
21334
- if (newer) {
21335
- console.log();
21336
- console.log(chalk11.yellow(`A newer version is available: ${current} \u2192 ${newer}`));
21337
- console.log(chalk11.gray(`Run \`plaud update\` for upgrade instructions.`));
21338
- }
21339
- });
21340
-
21341
21344
  // src/commands/search.ts
21342
21345
  import { Command as Command11 } from "commander";
21343
21346
  import chalk12 from "chalk";
@@ -21634,10 +21637,32 @@ async function runWizard() {
21634
21637
  try {
21635
21638
  await initTelemetry({
21636
21639
  surface: "cli",
21637
- appVersion: "0.3.0"
21640
+ appVersion: "0.3.2"
21638
21641
  });
21639
21642
  } catch {
21640
21643
  }
21644
+ async function notifyUpdate() {
21645
+ const sub = process.argv[2];
21646
+ if (sub === "version" || sub === "update") return;
21647
+ if (process.env.PLAUD_NO_UPDATE_NOTIFIER) return;
21648
+ if (!process.stderr.isTTY) return;
21649
+ const current = "0.3.2";
21650
+ if (current === "0.0.0") return;
21651
+ try {
21652
+ const newer = await checkForUpdate(current);
21653
+ if (newer) {
21654
+ process.stderr.write(
21655
+ chalk15.yellow(`
21656
+ \u26A0 A new Plaud CLI is available: ${current} \u2192 ${newer}
21657
+ `) + chalk15.gray(` Update: npm install -g @plaud-ai/cli@latest
21658
+
21659
+ `)
21660
+ );
21661
+ }
21662
+ } catch {
21663
+ }
21664
+ }
21665
+ await notifyUpdate();
21641
21666
  var program = new Command13();
21642
21667
  program.name("plaud").description("Plaud CLI - manage your Plaud recordings").action(async () => {
21643
21668
  await runWizard();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plaud-ai/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "plaud": "dist/index.js"