@lambdacurry/arbor 0.8.8 → 0.8.9

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/arbor.js +34 -6
  2. package/package.json +1 -1
package/dist/arbor.js CHANGED
@@ -17419,7 +17419,8 @@ function flagsForSchema(inputSchema) {
17419
17419
  };
17420
17420
  });
17421
17421
  }
17422
- function buildInput(inputSchema, flags) {
17422
+ function buildInput(inputSchema, flags, command) {
17423
+ const primary = primaryPositionalField(inputSchema);
17423
17424
  const input = {};
17424
17425
  for (const spec of flagsForSchema(inputSchema)) {
17425
17426
  if (spec.kind === "string") {
@@ -17436,8 +17437,10 @@ function buildInput(inputSchema, flags) {
17436
17437
  }
17437
17438
  const raw = flags[spec.flag];
17438
17439
  if (raw === undefined) {
17439
- if (spec.required)
17440
- throw new UsageError(`missing required flag: --${spec.flag}`);
17440
+ if (spec.required) {
17441
+ const positional = primary && primary.field === spec.field && command ? ` or pass it as the argument: arbor ${command} <${primary.field}>` : "";
17442
+ throw new UsageError(`missing required flag: --${spec.flag}${positional}`);
17443
+ }
17441
17444
  continue;
17442
17445
  }
17443
17446
  if (spec.kind !== "boolean" && raw === true) {
@@ -17498,6 +17501,29 @@ function commandWords(action) {
17498
17501
  var CLI_ACTIONS = ACTIONS.filter((a) => a.surfaces.includes("cli"));
17499
17502
  var BY_COMMAND = new Map(CLI_ACTIONS.map((a) => [commandWords(a), a]));
17500
17503
  var MAX_WORDS = Math.max(1, ...CLI_ACTIONS.map((a) => commandWords(a).split(" ").length));
17504
+ var KNOWN_MISREACHES = [
17505
+ { tried: "thread list", use: "tree --depth threads", why: "threads are listed by the tree" },
17506
+ { tried: "threads", use: "tree --depth threads", why: "threads are listed by the tree" },
17507
+ { tried: "list threads", use: "tree --depth threads", why: "threads are listed by the tree" },
17508
+ { tried: "spaces", use: "tree", why: "the tree lists spaces" },
17509
+ { tried: "space list", use: "tree", why: "the tree lists spaces" },
17510
+ { tried: "topics", use: "tree --depth topics", why: "topics are a tree depth" },
17511
+ { tried: "search", use: "recall <query>", why: "recall is the search surface" }
17512
+ ];
17513
+ function suggestCommand(positionals) {
17514
+ const typed = positionals.join(" ").toLowerCase();
17515
+ const known = KNOWN_MISREACHES.find((m) => m.tried === typed);
17516
+ if (known)
17517
+ return `use \`arbor ${known.use}\` — ${known.why}`;
17518
+ const head = positionals[0]?.toLowerCase();
17519
+ if (head) {
17520
+ const siblings = CLI_ACTIONS.map(commandWords).filter((c) => c === head || c.startsWith(`${head} `)).sort();
17521
+ if (siblings.length > 0) {
17522
+ return `\`${head}\` commands: ${siblings.slice(0, 8).join(", ")}${siblings.length > 8 ? ", …" : ""}`;
17523
+ }
17524
+ }
17525
+ return "run `arbor help` for the command list";
17526
+ }
17501
17527
  function matchCommand(positionals) {
17502
17528
  for (let n = Math.min(MAX_WORDS, positionals.length);n >= 1; n--) {
17503
17529
  const key = positionals.slice(0, n).join(" ");
@@ -17572,8 +17598,10 @@ function commandCatalog() {
17572
17598
  }
17573
17599
  async function runObjectVerb(positionals, flags, ctx) {
17574
17600
  const match = matchCommand(positionals);
17575
- if (!match)
17576
- throw new UsageError(`unknown command: ${positionals.join(" ") || "(none)"}`);
17601
+ if (!match) {
17602
+ const typed = positionals.join(" ") || "(none)";
17603
+ throw new UsageError(`unknown command: ${typed} — ${suggestCommand(positionals)}`);
17604
+ }
17577
17605
  const { action, words } = match;
17578
17606
  const extras = positionals.slice(words);
17579
17607
  if (extras.length > 0) {
@@ -17594,7 +17622,7 @@ async function runObjectVerb(positionals, flags, ctx) {
17594
17622
  if (unknown2.length > 0) {
17595
17623
  throw new UsageError(`unknown flag${unknown2.length > 1 ? "s" : ""}: ${unknown2.map((f) => `--${f}`).join(", ")}`);
17596
17624
  }
17597
- const input = buildInput(action.inputSchema, flags);
17625
+ const input = buildInput(action.inputSchema, flags, commandWords(action));
17598
17626
  if (action.name === "agent_register") {
17599
17627
  advise(`Agent registered. Save its apiKey now — it is shown only once:
17600
17628
  `, ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambdacurry/arbor",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "The Arbor CLI — a shared workspace for people and agents. The human + headless-agent write path over Arbor's guarded operation surface.",
5
5
  "keywords": [
6
6
  "agents",