@arbidocs/cli 0.3.40 β†’ 0.3.41

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,12 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## v0.3.40
3
+ ## v0.3.41
4
4
 
5
- [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.39...HEAD)
5
+ [compare changes](https://github.com/arbicity/ARBI-frontend/compare/v0.3.40...HEAD)
6
6
 
7
- ### πŸš€ Enhancements
7
+ ### 🏑 Chore
8
8
 
9
- - **cli:** Add --json to list commands + agent-aware not-logged-in hint ([#629](https://github.com/arbicity/ARBI-frontend/pull/629))
9
+ - Release v0.3.40 [skip ci] ([5e404545](https://github.com/arbicity/ARBI-frontend/commit/5e404545))
10
10
 
11
11
  ## v0.3.39
12
12
 
package/SKILL.md CHANGED
@@ -76,3 +76,19 @@ Scripting notes:
76
76
  - **No color leakage**: chalk auto-disables ANSI codes when stdout is not a TTY, so `arbi docs --json | jq`, `arbi workspaces --json | jq`, etc. work cleanly. Status messages and spinners go to stderr; stdout is safe to pipe.
77
77
  - **Typo suggestions**: `arbi updat` β†’ `error: unknown command 'updat' (Did you mean update?)` (exit 1). Works for top-level commands and nested subcommands.
78
78
  - **Completion**: `arbi completion install` (no `bash`/`zsh` arg β€” auto-detected from `$SHELL`).
79
+
80
+ ## Document Lifecycle (for agents)
81
+
82
+ All document list/search/meta commands support machine-readable output. Prefer `--json`.
83
+
84
+ - **Upload**: `arbi add <paths...> --json --no-watch` β€” prints a single JSON summary line with `docIds` and `skippedDetails`. Progress and reconnect noise are routed to stderr; stdout stays clean when `--json` is set.
85
+ - **List**: `arbi docs --json` returns an array (or `[]` when empty). `--ids` prints one doc id per line. `--csv` prints a CSV with header. All three work on an empty workspace without erroring.
86
+ - **Filter**: `arbi docs --status completed,failed`, `--folder <pattern>`, `--ext pdf,docx`, `--query <text>`. Combine with `--limit <n>` to stop early.
87
+ - **Lite mode**: `arbi docs --lite --json` skips per-doc decryption for speed, but `doctags` and `doc_metadata` come back empty/null. Use full mode (omit `--lite`) if you need those.
88
+ - **Per-doc**: `arbi doc get <id...>` returns full JSON (no flag needed). `arbi doc delete <id...>` and `arbi doc update <id> '<json>'` take IDs directly.
89
+ - **Upload by URL**: `arbi doc upload-url <url> --json`.
90
+ - **Download**: `arbi download <id> -o <path>` writes the file; `-o -` streams raw bytes to stdout; `--json` emits a `{doc_id, path, bytes, filename}` metadata line after writing.
91
+ - **Tags**: `arbi tags list --json`, `arbi tags create <name> -t <type>`, `arbi tags delete <id>`.
92
+ - **Doctags** (tag↔doc link): `arbi doctags create <tag-id> <doc-id...>` / `arbi doctags delete <tag-id> <doc-id...>`.
93
+ - **Retrieve only**: `arbi find <query> --json` returns raw retrieval results without running the LLM.
94
+ - **Exit codes**: 0 on success (including clean skips), 1 on error. Errors print to stderr.
package/dist/index.js CHANGED
@@ -3641,7 +3641,7 @@ function getLatestVersion(skipCache = false) {
3641
3641
  }
3642
3642
  }
3643
3643
  function getCurrentVersion() {
3644
- return "0.3.40";
3644
+ return "0.3.41";
3645
3645
  }
3646
3646
  function readChangelog(fromVersion, toVersion) {
3647
3647
  try {
@@ -3694,17 +3694,17 @@ function showChangelog(fromVersion, toVersion) {
3694
3694
  async function checkForUpdates(autoUpdate) {
3695
3695
  try {
3696
3696
  const latest = getLatestVersion();
3697
- if (!latest || latest === "0.3.40") return;
3697
+ if (!latest || latest === "0.3.41") return;
3698
3698
  if (autoUpdate) {
3699
3699
  warn(`
3700
- Your arbi version is out of date (${"0.3.40"} \u2192 ${latest}). Updating...`);
3700
+ Your arbi version is out of date (${"0.3.41"} \u2192 ${latest}). Updating...`);
3701
3701
  child_process.execSync("npm install -g @arbidocs/cli@latest", { stdio: "inherit" });
3702
- showChangelog("0.3.40", latest);
3702
+ showChangelog("0.3.41", latest);
3703
3703
  console.log(`Updated to ${latest}.`);
3704
3704
  } else {
3705
3705
  warn(
3706
3706
  `
3707
- Your arbi version is out of date (${"0.3.40"} \u2192 ${latest}).
3707
+ Your arbi version is out of date (${"0.3.41"} \u2192 ${latest}).
3708
3708
  Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3709
3709
  );
3710
3710
  }
@@ -3714,9 +3714,9 @@ Run "arbi update" to upgrade, or "arbi update auto" to always stay up to date.`
3714
3714
  function hintUpdateOnError() {
3715
3715
  try {
3716
3716
  const cached = readCache();
3717
- if (cached && cached.latest !== "0.3.40") {
3717
+ if (cached && cached.latest !== "0.3.41") {
3718
3718
  warn(
3719
- `Your arbi version is out of date (${"0.3.40"} \u2192 ${cached.latest}). Run "arbi update".`
3719
+ `Your arbi version is out of date (${"0.3.41"} \u2192 ${cached.latest}). Run "arbi update".`
3720
3720
  );
3721
3721
  }
3722
3722
  } catch {
@@ -4756,7 +4756,18 @@ function registerDocsCommand(program2) {
4756
4756
  if (hardLimit !== void 0 && totalFetched >= hardLimit) break;
4757
4757
  }
4758
4758
  if (totalFetched === 0 && data.length === 0) {
4759
- console.log("No documents found.");
4759
+ if (opts.json) {
4760
+ if (opts.output) fs5.writeFileSync(opts.output, "[]\n");
4761
+ else console.log("[]");
4762
+ } else if (opts.ids) {
4763
+ if (opts.output) fs5.writeFileSync(opts.output, "");
4764
+ } else if (opts.csv) {
4765
+ if (opts.output) fs5.writeFileSync(opts.output, csvHeader + "\n");
4766
+ } else if (opts.count) {
4767
+ console.log("0");
4768
+ } else {
4769
+ console.log("No documents found.");
4770
+ }
4760
4771
  return;
4761
4772
  }
4762
4773
  if (!bufferAll && (opts.ids || opts.csv)) {
@@ -4967,10 +4978,19 @@ function registerDocsCommand(program2) {
4967
4978
  }
4968
4979
  })()
4969
4980
  );
4970
- doc.command("upload-url <urls...>").description("Upload documents from URLs").option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").option("--shared", "Make documents shared", false).action(
4981
+ doc.command("upload-url <urls...>").description("Upload documents from URLs").option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").option("--shared", "Make documents shared", false).option("--json", "Output results as JSON").action(
4971
4982
  (urls, opts) => runAction(async () => {
4972
4983
  const { arbi, workspaceId } = await resolveWorkspace(opts.workspace);
4973
4984
  const data = await sdk.documents.uploadUrl(arbi, urls, workspaceId, opts.shared ?? false);
4985
+ if (opts.json) {
4986
+ console.log(
4987
+ JSON.stringify({
4988
+ docIds: data.doc_ext_ids ?? [],
4989
+ skipped: data.skipped ?? []
4990
+ })
4991
+ );
4992
+ return;
4993
+ }
4974
4994
  success(`Uploaded: ${(data.doc_ext_ids ?? []).join(", ")}`);
4975
4995
  if (data.skipped && data.skipped.length > 0) {
4976
4996
  warn(
@@ -5705,7 +5725,7 @@ Connection closed. ${pending.size} document(s) still processing.`);
5705
5725
  }
5706
5726
  });
5707
5727
  await done;
5708
- } else if (uploadedDocs.size > 0 && !willWatch) {
5728
+ } else if (uploadedDocs.size > 0 && !willWatch && !opts.json) {
5709
5729
  dim(
5710
5730
  'Tip: Use -W/--watch to monitor processing progress, or run "arbi docs" to check status.'
5711
5731
  );
@@ -6209,7 +6229,13 @@ Connection closed. ${pending.size} document(s) still processing.`);
6209
6229
  }
6210
6230
  }
6211
6231
  function registerDownloadCommand(program2) {
6212
- program2.command("download [doc-id]").description("Download a document (interactive picker if no ID given)").option("-o, --output <path>", "Output file path").option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").action(
6232
+ program2.command("download [doc-id]").description("Download a document (interactive picker if no ID given)").option(
6233
+ "-o, --output <path>",
6234
+ 'Output file path. Use "-" to stream raw bytes to stdout (for piping).'
6235
+ ).option("-w, --workspace <id>", "Workspace ID (defaults to selected workspace)").option(
6236
+ "--json",
6237
+ 'Emit a JSON metadata line to stdout after writing the file (doc_id, path, bytes, filename). Implies a file write \u2014 use "-o -" or pipe stdout to get bytes without JSON.'
6238
+ ).action(
6213
6239
  (docId, opts) => runAction(async () => {
6214
6240
  const { arbi, config, accessToken } = await resolveWorkspace(opts.workspace);
6215
6241
  if (!docId) {
@@ -6235,9 +6261,24 @@ function registerDownloadCommand(program2) {
6235
6261
  const match = disposition.match(/filename[*]?=(?:UTF-8''|"?)([^";]+)/i);
6236
6262
  if (match) filename = decodeURIComponent(match[1].replace(/"/g, ""));
6237
6263
  }
6238
- const outputPath = opts.output || path5__default.default.join(process.cwd(), filename);
6239
6264
  const buffer = Buffer.from(await res.arrayBuffer());
6265
+ if (opts.output === "-") {
6266
+ process.stdout.write(buffer);
6267
+ return;
6268
+ }
6269
+ const outputPath = opts.output || path5__default.default.join(process.cwd(), filename);
6240
6270
  fs5__default.default.writeFileSync(outputPath, buffer);
6271
+ if (opts.json) {
6272
+ console.log(
6273
+ JSON.stringify({
6274
+ doc_id: docId,
6275
+ path: outputPath,
6276
+ bytes: buffer.length,
6277
+ filename: path5__default.default.basename(outputPath)
6278
+ })
6279
+ );
6280
+ return;
6281
+ }
6241
6282
  success(
6242
6283
  `Downloaded: ${path5__default.default.basename(outputPath)} (${(buffer.length / (1024 * 1024)).toFixed(1)} MB)`
6243
6284
  );
@@ -8258,7 +8299,7 @@ console.info = (...args) => {
8258
8299
  _origInfo(...args);
8259
8300
  };
8260
8301
  var program = new commander.Command();
8261
- program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.40");
8302
+ program.name("arbi").description("ARBI CLI \u2014 interact with ARBI from the terminal").version("0.3.41");
8262
8303
  registerConfigCommand(program);
8263
8304
  registerLoginCommand(program);
8264
8305
  registerRegisterCommand(program);