@arbidocs/cli 0.3.36 → 0.3.38

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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.3.38
4
+
5
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.37...HEAD)
6
+
7
+ ### 🔥 Performance
8
+
9
+ - Cap and evict unbounded store state with debounced IDB writes ([#600](https://github.com/arbicity/ARBI-frontend/pull/600))
10
+ - Cap upload concurrency, throttle progress, and batch completion toasts ([#606](https://github.com/arbicity/ARBI-frontend/pull/606))
11
+ - Batch streaming tokens and memoize markdown pipeline ([#605](https://github.com/arbicity/ARBI-frontend/pull/605))
12
+ - Virtualize message and conversation lists ([#604](https://github.com/arbicity/ARBI-frontend/pull/604))
13
+ - Add paginated document listing to SDK and wire into CLI ([#608](https://github.com/arbicity/ARBI-frontend/pull/608))
14
+
15
+ ## v0.3.37
16
+
17
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.36...HEAD)
18
+
19
+ ### 🔥 Performance
20
+
21
+ - Lazy-load PDF.js, Mermaid, Cytoscape, KaTeX, xlsx, and Dashboard modals ([#601](https://github.com/arbicity/ARBI-frontend/pull/601))
22
+ - Abort on unmount, dedup concurrent GETs, and jittered retry ([#599](https://github.com/arbicity/ARBI-frontend/pull/599))
23
+ - Route document grid updates through applyTransactionAsync ([#602](https://github.com/arbicity/ARBI-frontend/pull/602))
24
+ - Progressive document loading for fast workspace open ([#607](https://github.com/arbicity/ARBI-frontend/pull/607))
25
+
26
+ ### 🩹 Fixes
27
+
28
+ - Document viewer blanks when mutations invalidate the detail cache ([#597](https://github.com/arbicity/ARBI-frontend/pull/597))
29
+
3
30
  ## v0.3.36
4
31
 
5
32
  [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.34...HEAD)
package/dist/index.js CHANGED
@@ -3637,7 +3637,7 @@ function getLatestVersion(skipCache = false) {
3637
3637
  }
3638
3638
  }
3639
3639
  function getCurrentVersion() {
3640
- return "0.3.36";
3640
+ return "0.3.38";
3641
3641
  }
3642
3642
  function readChangelog(fromVersion, toVersion) {
3643
3643
  try {
@@ -3690,17 +3690,17 @@ function showChangelog(fromVersion, toVersion) {
3690
3690
  async function checkForUpdates(autoUpdate) {
3691
3691
  try {
3692
3692
  const latest = getLatestVersion();
3693
- if (!latest || latest === "0.3.36") return;
3693
+ if (!latest || latest === "0.3.38") return;
3694
3694
  if (autoUpdate) {
3695
3695
  warn(`
3696
- Your arbi version is out of date (${"0.3.36"} \u2192 ${latest}). Updating...`);
3696
+ Your arbi version is out of date (${"0.3.38"} \u2192 ${latest}). Updating...`);
3697
3697
  child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
3698
- showChangelog("0.3.36", latest);
3698
+ showChangelog("0.3.38", latest);
3699
3699
  console.log(`Updated to ${latest}.`);
3700
3700
  } else {
3701
3701
  warn(
3702
3702
  `
3703
- Your arbi version is out of date (${"0.3.36"} \u2192 ${latest}).
3703
+ Your arbi version is out of date (${"0.3.38"} \u2192 ${latest}).
3704
3704
  Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3705
3705
  );
3706
3706
  }
@@ -3710,9 +3710,9 @@ Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3710
3710
  function hintUpdateOnError() {
3711
3711
  try {
3712
3712
  const cached = readCache();
3713
- if (cached && cached.latest !== "0.3.36") {
3713
+ if (cached && cached.latest !== "0.3.38") {
3714
3714
  warn(
3715
- `Your arbi version is out of date (${"0.3.36"} \u2192 ${cached.latest}). Run "arbi update".`
3715
+ `Your arbi version is out of date (${"0.3.38"} \u2192 ${cached.latest}). Run "arbi update".`
3716
3716
  );
3717
3717
  }
3718
3718
  } catch {
@@ -4657,7 +4657,7 @@ function filterDocs(data, opts) {
4657
4657
  return result;
4658
4658
  }
4659
4659
  async function fetchDocChoices(arbi) {
4660
- const data = await sdk.documents.listDocuments(arbi);
4660
+ const data = await sdk.documents.listAll(arbi, { fields: "lite", order: "created_desc" });
4661
4661
  if (data.length === 0) {
4662
4662
  console.log("No documents found.");
4663
4663
  process.exit(0);
@@ -4669,35 +4669,97 @@ async function fetchDocChoices(arbi) {
4669
4669
  }));
4670
4670
  }
4671
4671
  function registerDocsCommand(program2) {
4672
- program2.command("docs").description("List documents in the active workspace").option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").option("--json", "Output as JSON").option("--csv", "Output as CSV").option("--ids", "Output only document IDs (one per line)").option("--count", "Output only the count (combine with --status for filtered count)").option("-s, --status <status>", "Filter by status (comma-separated: completed,failed,queued)").option("-f, --folder <pattern>", "Filter by folder (substring match)").option("-e, --ext <extensions>", "Filter by file extension (comma-separated: pdf,docx,eml)").option("-q, --query <text>", "Search file name, title, or summary").option("--sort <field>", "Sort by field (name, status, date, size, created)", "status").option("-n, --limit <n>", "Limit number of results").option(
4672
+ program2.command("docs").description("List documents in the active workspace").option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").option("--json", "Output as JSON").option("--csv", "Output as CSV").option("--ids", "Output only document IDs (one per line)").option("--count", "Output only the count (combine with --status for filtered count)").option("-s, --status <status>", "Filter by status (comma-separated: completed,failed,queued)").option("-f, --folder <pattern>", "Filter by folder (substring match)").option("-e, --ext <extensions>", "Filter by file extension (comma-separated: pdf,docx,eml)").option("-q, --query <text>", "Search file name, title, or summary").option("--sort <field>", "Sort by field (name, status, date, size, created)", "status").option(
4673
+ "-n, --limit <n>",
4674
+ "Stop after N results. Fetching stops early \u2014 no unnecessary pages are loaded."
4675
+ ).option(
4676
+ "--lite",
4677
+ "Use lite field mode: skips per-doc decrypt and returns null metadata and empty doctags. Much faster on large workspaces; fetch full doc details on demand."
4678
+ ).option(
4673
4679
  "-o, --output <path>",
4674
4680
  "Write output to a file instead of stdout. Extension determines the format when combined with --ids/--json/--csv (default: csv with doc_id, file_name, folder, status)"
4675
4681
  ).action(
4676
4682
  (opts) => runAction(async () => {
4677
4683
  const { arbi } = await resolveWorkspace(opts.workspace);
4678
- let data = await sdk.documents.listDocuments(arbi);
4679
- if (data.length === 0) {
4684
+ const fields = opts.lite ? "lite" : void 0;
4685
+ const hardLimit = opts.limit ? parseInt(opts.limit, 10) : void 0;
4686
+ const needsSort = !!(opts.sort && opts.sort !== "status");
4687
+ const bufferAll = !!(opts.json || opts.output || opts.count || needsSort);
4688
+ const data = [];
4689
+ let totalFetched = 0;
4690
+ const csvEscape = (s) => `"${(s ?? "").replace(/"/g, '""')}"`;
4691
+ const csvHeader = "external_id,status,file_name,file_size,folder,n_pages,tokens,doc_date,title";
4692
+ const renderRow = (d) => {
4693
+ const meta = d.doc_metadata;
4694
+ return [
4695
+ d.external_id,
4696
+ d.status,
4697
+ csvEscape(d.file_name ?? ""),
4698
+ d.file_size ?? "",
4699
+ csvEscape(d.folder ?? ""),
4700
+ d.n_pages ?? "",
4701
+ d.tokens ?? "",
4702
+ meta?.doc_date ?? "",
4703
+ csvEscape(meta?.title ?? "")
4704
+ ].join(",");
4705
+ };
4706
+ if (!bufferAll && (opts.csv || !opts.ids && !opts.json && !opts.output)) {
4707
+ if (opts.csv) process.stdout.write(csvHeader + "\n");
4708
+ }
4709
+ for await (const page of sdk.documents.listPaginated(arbi, {
4710
+ pageSize: 500,
4711
+ order: "created_desc",
4712
+ fields
4713
+ })) {
4714
+ let filtered = filterDocs(page, opts);
4715
+ if (hardLimit !== void 0) {
4716
+ const remaining = hardLimit - totalFetched;
4717
+ if (remaining <= 0) break;
4718
+ filtered = filtered.slice(0, remaining);
4719
+ }
4720
+ if (filtered.length === 0) {
4721
+ if (hardLimit !== void 0 && totalFetched >= hardLimit) break;
4722
+ continue;
4723
+ }
4724
+ totalFetched += filtered.length;
4725
+ if (bufferAll) {
4726
+ data.push(...filtered);
4727
+ } else {
4728
+ if (opts.ids) {
4729
+ filtered.forEach((d) => process.stdout.write(d.external_id + "\n"));
4730
+ } else if (opts.csv) {
4731
+ filtered.forEach((d) => process.stdout.write(renderRow(d) + "\n"));
4732
+ } else {
4733
+ data.push(...filtered);
4734
+ }
4735
+ }
4736
+ if (hardLimit !== void 0 && totalFetched >= hardLimit) break;
4737
+ }
4738
+ if (totalFetched === 0 && data.length === 0) {
4680
4739
  console.log("No documents found.");
4681
4740
  return;
4682
4741
  }
4683
- data = filterDocs(data, opts);
4684
- const sortField = opts.sort ?? "status";
4685
- data.sort((a, b) => {
4686
- switch (sortField) {
4687
- case "name":
4688
- return (a.file_name ?? "").localeCompare(b.file_name ?? "");
4689
- case "size":
4690
- return (b.file_size ?? 0) - (a.file_size ?? 0);
4691
- case "date":
4692
- case "created":
4693
- return (b.created_at ?? "").localeCompare(a.created_at ?? "");
4694
- case "status":
4695
- default:
4696
- return (a.status ?? "").localeCompare(b.status ?? "");
4697
- }
4698
- });
4699
- if (opts.limit) {
4700
- data = data.slice(0, parseInt(opts.limit, 10));
4742
+ if (!bufferAll && (opts.ids || opts.csv)) {
4743
+ return;
4744
+ }
4745
+ if (bufferAll || !opts.ids && !opts.csv) {
4746
+ const sortField = opts.sort ?? "status";
4747
+ data.sort((a, b) => {
4748
+ switch (sortField) {
4749
+ case "name":
4750
+ return (a.file_name ?? "").localeCompare(b.file_name ?? "");
4751
+ case "size":
4752
+ return (b.file_size ?? 0) - (a.file_size ?? 0);
4753
+ case "date":
4754
+ case "created":
4755
+ return (b.created_at ?? "").localeCompare(
4756
+ a.created_at ?? ""
4757
+ );
4758
+ case "status":
4759
+ default:
4760
+ return (a.status ?? "").localeCompare(b.status ?? "");
4761
+ }
4762
+ });
4701
4763
  }
4702
4764
  if (opts.count) {
4703
4765
  if (opts.status || opts.folder || opts.ext || opts.query) {
@@ -4734,7 +4796,6 @@ function registerDocsCommand(program2) {
4734
4796
  console.log(payload.endsWith("\n") ? payload.slice(0, -1) : payload);
4735
4797
  }
4736
4798
  };
4737
- const csvEscape = (s) => `"${(s ?? "").replace(/"/g, '""')}"`;
4738
4799
  if (opts.ids) {
4739
4800
  writeOut(data.map((d) => d.external_id).join("\n"), "ids");
4740
4801
  return;
@@ -4744,24 +4805,9 @@ function registerDocsCommand(program2) {
4744
4805
  return;
4745
4806
  }
4746
4807
  if (opts.csv || opts.output && !opts.ids && !opts.json) {
4747
- const lines = [
4748
- "external_id,status,file_name,file_size,folder,n_pages,tokens,doc_date,title"
4749
- ];
4808
+ const lines = [csvHeader];
4750
4809
  for (const d of data) {
4751
- const meta = d.doc_metadata;
4752
- lines.push(
4753
- [
4754
- d.external_id,
4755
- d.status,
4756
- csvEscape(d.file_name ?? ""),
4757
- d.file_size ?? "",
4758
- csvEscape(d.folder ?? ""),
4759
- d.n_pages ?? "",
4760
- d.tokens ?? "",
4761
- meta?.doc_date ?? "",
4762
- csvEscape(meta?.title ?? "")
4763
- ].join(",")
4764
- );
4810
+ lines.push(renderRow(d));
4765
4811
  }
4766
4812
  writeOut(lines.join("\n"), "csv");
4767
4813
  return;
@@ -4955,7 +5001,10 @@ function registerDocsCommand(program2) {
4955
5001
  }
4956
5002
  docIds = ids;
4957
5003
  } else if (opts.status) {
4958
- const allDocs = await sdk.documents.listDocuments(arbi);
5004
+ const allDocs = await sdk.documents.listAll(arbi, {
5005
+ fields: "lite",
5006
+ order: "created_desc"
5007
+ });
4959
5008
  let filtered = allDocs.filter((d) => d.status === opts.status);
4960
5009
  if (opts.folder) {
4961
5010
  const pattern = opts.folder.toLowerCase();
@@ -8158,7 +8207,7 @@ console.info = (...args) => {
8158
8207
  _origInfo(...args);
8159
8208
  };
8160
8209
  var program = new commander.Command();
8161
- program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.36");
8210
+ program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.38");
8162
8211
  registerConfigCommand(program);
8163
8212
  registerLoginCommand(program);
8164
8213
  registerRegisterCommand(program);