@overaihq/cli 0.14.4 → 0.14.6

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 +360 -33
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -27166,6 +27166,29 @@ import { hostname } from "os";
27166
27166
 
27167
27167
  // src/args.ts
27168
27168
  import { readFileSync as readFileSync2 } from "fs";
27169
+ var usageFor = (help, command2) => {
27170
+ const out = [];
27171
+ let inSection = false;
27172
+ for (const line of help.split("\n")) {
27173
+ const body = line.trimStart();
27174
+ if (body.startsWith("overai "))
27175
+ inSection = body === `overai ${command2}` || body.startsWith(`overai ${command2} `);
27176
+ else if (line === body) inSection = false;
27177
+ if (inSection) out.push(line);
27178
+ }
27179
+ return out.length === 0 ? "" : `${out.join("\n")}
27180
+ `;
27181
+ };
27182
+ var unknownFlags = (args, known, valueFlags = []) => {
27183
+ const out = [];
27184
+ for (let i = 0; i < args.length; i++) {
27185
+ const arg = args[i];
27186
+ if (arg == null || !arg.startsWith("-")) continue;
27187
+ if (!known.includes(arg)) out.push(arg);
27188
+ else if (valueFlags.includes(arg)) i++;
27189
+ }
27190
+ return out;
27191
+ };
27169
27192
  var flagValue = (args, ...names) => {
27170
27193
  for (const name2 of names) {
27171
27194
  const i = args.indexOf(name2);
@@ -27680,22 +27703,7 @@ var whoami = (args = []) => {
27680
27703
  };
27681
27704
 
27682
27705
  // src/commands/agent.ts
27683
- var runAgent = async (args) => {
27684
- const [operation, id] = args;
27685
- if (operation !== "generate" || id == null) throw new Error("Usage: overai agent generate <id> --message <text|@file|@->");
27686
- const message = await readValue(flagValue(args, "--message", "-m"), "--message");
27687
- if (message == null) throw new Error("Agent generate requires --message.");
27688
- const { organizationId } = await getAccessToken();
27689
- const response = await v2Fetch(`/v2/agents/${organizationId}/${id}/generate/text`, {
27690
- method: "POST",
27691
- headers: { "Content-Type": "application/json" },
27692
- body: JSON.stringify({ message })
27693
- });
27694
- const raw2 = await response.text();
27695
- if (!response.ok) throw v2Error("agent generate", response, raw2);
27696
- const body = JSON.parse(raw2);
27697
- printResult(body, resolveFormat(flagValue(args, "-o", "--output")));
27698
- };
27706
+ import { createInterface } from "readline";
27699
27707
 
27700
27708
  // src/gql.ts
27701
27709
  var gqlRequest = async (query, variables) => {
@@ -27725,6 +27733,283 @@ var gqlRequest = async (query, variables) => {
27725
27733
  return body.data;
27726
27734
  };
27727
27735
 
27736
+ // src/commands/agent.ts
27737
+ var USAGE = [
27738
+ "Usage:",
27739
+ " overai agent generate <id> --message <text|@file|@->",
27740
+ " overai agent tools <id> [--version <n>] [-o json|table|csv]",
27741
+ " overai agent chat <id> [--conversation <id>] [--message <text>]"
27742
+ ].join("\n");
27743
+ var generate = async (args, id) => {
27744
+ const message = await readValue(
27745
+ flagValue(args, "--message", "-m"),
27746
+ "--message"
27747
+ );
27748
+ if (message == null) throw new Error("Agent generate requires --message.");
27749
+ const { organizationId } = await getAccessToken();
27750
+ const response = await v2Fetch(
27751
+ `/v2/agents/${organizationId}/${id}/generate/text`,
27752
+ {
27753
+ method: "POST",
27754
+ headers: { "Content-Type": "application/json" },
27755
+ body: JSON.stringify({ message })
27756
+ }
27757
+ );
27758
+ const raw2 = await response.text();
27759
+ if (!response.ok) throw v2Error("agent generate", response, raw2);
27760
+ printResult(
27761
+ JSON.parse(raw2),
27762
+ resolveFormat(flagValue(args, "-o", "--output"))
27763
+ );
27764
+ };
27765
+ var deployedVersionNumber = async (id) => {
27766
+ const deployed = await gqlRequest(
27767
+ `query CliAgentDeployedVersion($id: String!) {
27768
+ agentDeployedVersions(condition: { agentId: $id }) { nodes { versionNumber } }
27769
+ }`,
27770
+ { id }
27771
+ );
27772
+ const versionNumber = deployed.agentDeployedVersions?.nodes[0]?.versionNumber;
27773
+ if (versionNumber == null) {
27774
+ throw new Error(
27775
+ `Agent ${id} has no deployed version; pass --version <n> to inspect a saved one.`
27776
+ );
27777
+ }
27778
+ return versionNumber;
27779
+ };
27780
+ var tools = async (args, id) => {
27781
+ const versionFlag = flagValue(args, "--version", "-v");
27782
+ if (versionFlag != null && !Number.isInteger(Number(versionFlag))) {
27783
+ throw new Error("--version must be an integer.");
27784
+ }
27785
+ const version = versionFlag == null ? await deployedVersionNumber(id) : Number(versionFlag);
27786
+ const data = await gqlRequest(
27787
+ `query CliAgentTools($id: String!, $version: Int!) {
27788
+ agent(id: $id) {
27789
+ name
27790
+ agentVersions(first: 1, condition: { versionNumber: $version }) {
27791
+ nodes {
27792
+ versionNumber
27793
+ model
27794
+ agentVersionFunctionsByAgentIdAndVersionNumber(orderBy: [FUNCTION_ID_ASC]) {
27795
+ nodes { functionId function { name } }
27796
+ }
27797
+ agentVersionTableSpacesByAgentIdAndVersionNumber(orderBy: [TABLE_SPACE_ID_ASC]) {
27798
+ nodes { tableSpaceId accessMode }
27799
+ }
27800
+ agentVersionAgentsByAgentIdAndVersionNumber(orderBy: [ATTACHED_AGENT_ID_ASC]) {
27801
+ nodes { attachedAgentId }
27802
+ }
27803
+ agentVersionKnowledgeBasesByAgentIdAndVersionNumber(orderBy: [KNOWLEDGE_BASE_ID_ASC]) {
27804
+ nodes { knowledgeBaseId }
27805
+ }
27806
+ agentVersionBuiltinToolSetsByAgentIdAndVersionNumber(orderBy: [TOOL_SET_ASC]) {
27807
+ nodes { toolSet }
27808
+ }
27809
+ }
27810
+ }
27811
+ }
27812
+ }`,
27813
+ { id, version }
27814
+ );
27815
+ if (data.agent == null) throw new Error(`Agent ${id} not found.`);
27816
+ const agentVersion = data.agent.agentVersions.nodes[0];
27817
+ if (agentVersion == null) {
27818
+ throw new Error(`Agent ${id} has no version ${String(version)}.`);
27819
+ }
27820
+ const rows = [
27821
+ ...agentVersion.agentVersionFunctionsByAgentIdAndVersionNumber.nodes.map(
27822
+ (link) => ({
27823
+ kind: "function",
27824
+ name: link.function?.name ?? link.functionId,
27825
+ detail: link.functionId
27826
+ })
27827
+ ),
27828
+ ...agentVersion.agentVersionTableSpacesByAgentIdAndVersionNumber.nodes.map(
27829
+ (link) => ({
27830
+ kind: "table space",
27831
+ name: link.tableSpaceId,
27832
+ detail: link.accessMode
27833
+ })
27834
+ ),
27835
+ ...agentVersion.agentVersionAgentsByAgentIdAndVersionNumber.nodes.map(
27836
+ (link) => ({
27837
+ kind: "sub-agent",
27838
+ name: link.attachedAgentId,
27839
+ detail: ""
27840
+ })
27841
+ ),
27842
+ ...agentVersion.agentVersionKnowledgeBasesByAgentIdAndVersionNumber.nodes.map(
27843
+ (link) => ({
27844
+ kind: "knowledge base",
27845
+ name: link.knowledgeBaseId,
27846
+ detail: ""
27847
+ })
27848
+ ),
27849
+ ...agentVersion.agentVersionBuiltinToolSetsByAgentIdAndVersionNumber.nodes.map(
27850
+ (link) => ({ kind: "built-in", name: link.toolSet, detail: "" })
27851
+ )
27852
+ ];
27853
+ const format2 = resolveFormat(flagValue(args, "-o", "--output"));
27854
+ if (format2 === "json") {
27855
+ printResult(
27856
+ {
27857
+ agent: data.agent.name,
27858
+ version: agentVersion.versionNumber,
27859
+ model: agentVersion.model,
27860
+ tools: rows
27861
+ },
27862
+ format2
27863
+ );
27864
+ return;
27865
+ }
27866
+ if (format2 === "table") {
27867
+ process.stdout.write(
27868
+ `${data.agent.name} \xB7 version ${String(agentVersion.versionNumber)} \xB7 ${agentVersion.model}
27869
+ `
27870
+ );
27871
+ }
27872
+ printResult(rows, format2);
27873
+ };
27874
+ var printStreamLine = (line) => {
27875
+ if (!line.startsWith("data: ")) return;
27876
+ const payload = line.slice(6);
27877
+ if (payload === "[DONE]") return;
27878
+ let event;
27879
+ try {
27880
+ event = JSON.parse(payload);
27881
+ } catch {
27882
+ return;
27883
+ }
27884
+ if (event.type === "text-delta" && event.delta != null) {
27885
+ process.stdout.write(event.delta);
27886
+ }
27887
+ if (event.type === "error") {
27888
+ process.stderr.write(`
27889
+ ${event.errorText ?? "agent turn failed"}
27890
+ `);
27891
+ }
27892
+ };
27893
+ var streamReply = async (response) => {
27894
+ const body = response.body;
27895
+ if (body == null) return;
27896
+ const decoder = new TextDecoder();
27897
+ let buffer = "";
27898
+ for await (const chunk of body) {
27899
+ buffer += decoder.decode(chunk, { stream: true });
27900
+ const lines = buffer.split("\n");
27901
+ buffer = lines.pop() ?? "";
27902
+ lines.forEach(printStreamLine);
27903
+ }
27904
+ printStreamLine(buffer + decoder.decode());
27905
+ };
27906
+ var send = async (organizationId, id, message, conversationId) => {
27907
+ const response = await v2Fetch(`/v2/agents/${organizationId}/${id}`, {
27908
+ method: "POST",
27909
+ headers: { "Content-Type": "application/json" },
27910
+ body: JSON.stringify({
27911
+ messages: [{ role: "user", parts: [{ type: "text", text: message }] }],
27912
+ conversationId
27913
+ })
27914
+ });
27915
+ if (!response.ok) {
27916
+ throw v2Error("agent chat", response, await response.text());
27917
+ }
27918
+ await streamReply(response);
27919
+ process.stdout.write("\n");
27920
+ };
27921
+ var createConversation = async (id, firstMessage) => {
27922
+ const versionNumber = await deployedVersionNumber(id);
27923
+ const created = await gqlRequest(
27924
+ `mutation CliCreateAgentConversation($input: CreateAgentConversationInput!) {
27925
+ createAgentConversation(input: $input) { agentConversation { id } }
27926
+ }`,
27927
+ {
27928
+ input: {
27929
+ agentConversation: {
27930
+ agentId: id,
27931
+ versionNumber,
27932
+ title: firstMessage.length > 50 ? `${firstMessage.slice(0, 47)}...` : firstMessage
27933
+ }
27934
+ }
27935
+ }
27936
+ );
27937
+ const conversationId = created.createAgentConversation?.agentConversation?.id;
27938
+ if (conversationId == null)
27939
+ throw new Error("Failed to create a conversation.");
27940
+ return conversationId;
27941
+ };
27942
+ var chat = async (args, id) => {
27943
+ const { organizationId } = await getAccessToken();
27944
+ let conversationId = flagValue(args, "--conversation", "-c") ?? null;
27945
+ const single = await readValue(
27946
+ flagValue(args, "--message", "-m"),
27947
+ "--message"
27948
+ );
27949
+ if (single != null) {
27950
+ conversationId ??= await createConversation(id, single);
27951
+ try {
27952
+ await send(organizationId, id, single, conversationId);
27953
+ } finally {
27954
+ process.stderr.write(`Conversation: ${conversationId}
27955
+ `);
27956
+ }
27957
+ return;
27958
+ }
27959
+ const interactive = process.stdin.isTTY;
27960
+ const rl = createInterface({
27961
+ input: process.stdin,
27962
+ ...interactive ? { output: process.stdout, historySize: 1e3, terminal: true } : {}
27963
+ });
27964
+ if (interactive) {
27965
+ process.stdout.write(
27966
+ `Chatting with ${id}. Ctrl-C to leave; each reply prints as it streams.
27967
+ `
27968
+ );
27969
+ rl.setPrompt("> ");
27970
+ rl.prompt();
27971
+ }
27972
+ for await (const line of rl) {
27973
+ const message = line.trim();
27974
+ if (message.length === 0) {
27975
+ if (interactive) rl.prompt();
27976
+ continue;
27977
+ }
27978
+ try {
27979
+ conversationId ??= await createConversation(id, message);
27980
+ await send(organizationId, id, message, conversationId);
27981
+ } catch (error) {
27982
+ process.stderr.write(
27983
+ `${error instanceof Error ? error.message : String(error)}
27984
+ `
27985
+ );
27986
+ }
27987
+ if (interactive) rl.prompt();
27988
+ }
27989
+ if (conversationId != null) {
27990
+ process.stderr.write(`
27991
+ Conversation: ${conversationId}
27992
+ `);
27993
+ }
27994
+ };
27995
+ var runAgent = async (args) => {
27996
+ const [operation, id] = args;
27997
+ if (id == null) throw new Error(USAGE);
27998
+ switch (operation) {
27999
+ case "generate":
28000
+ await generate(args, id);
28001
+ return;
28002
+ case "tools":
28003
+ await tools(args, id);
28004
+ return;
28005
+ case "chat":
28006
+ await chat(args, id);
28007
+ return;
28008
+ default:
28009
+ throw new Error(USAGE);
28010
+ }
28011
+ };
28012
+
27728
28013
  // src/commands/automation.ts
27729
28014
  var runRuns = async (automationId, args) => {
27730
28015
  const limit2 = Number(flagValue(args, "--limit") ?? 20);
@@ -28670,7 +28955,7 @@ var runList = async (args) => {
28670
28955
  resolveFormat(flagValue(args, "-o", "--output"))
28671
28956
  );
28672
28957
  };
28673
- var USAGE = "Usage: overai runner create <workspaceId> [--name <name>]\n overai runner token <runnerId> [--note <note>]\n overai runner run <runnerId> [--interpreter shell|powershell] --code '<code>'\n overai runner upload <runnerId> --path '<path>'\n overai runner list [workspaceId] [--limit <n>]\n";
28958
+ var USAGE2 = "Usage: overai runner create <workspaceId> [--name <name>]\n overai runner token <runnerId> [--note <note>]\n overai runner run <runnerId> [--interpreter shell|powershell] --code '<code>'\n overai runner upload <runnerId> --path '<path>'\n overai runner list [workspaceId] [--limit <n>]\n";
28674
28959
  var runRunner = async (args) => {
28675
28960
  const [sub, id, ...rest] = args;
28676
28961
  if (sub === "create" && id != null) return runCreate(id, rest);
@@ -28678,7 +28963,7 @@ var runRunner = async (args) => {
28678
28963
  if (sub === "run" && id != null) return runRun(id, rest);
28679
28964
  if (sub === "upload" && id != null) return runUpload(id, rest);
28680
28965
  if (sub === "list") return runList([id, ...rest].filter((a) => a != null));
28681
- process.stderr.write(USAGE);
28966
+ process.stderr.write(USAGE2);
28682
28967
  process.exitCode = 1;
28683
28968
  };
28684
28969
 
@@ -34821,14 +35106,20 @@ var positionals = (args) => {
34821
35106
  }
34822
35107
  return out;
34823
35108
  };
35109
+ var pushMessage = (args) => {
35110
+ const message = flagValue(args, "-m", "--message");
35111
+ if (message == null || message.startsWith("-"))
35112
+ throw new Error("Usage: overai push [filter] -m <message>. -m names the version this push creates.");
35113
+ return message;
35114
+ };
34824
35115
  var runPush = async (args, clone) => {
34825
35116
  if (clone != null && args.includes("--deploy")) throw new Error("Recursive push cannot deploy.");
35117
+ const message = pushMessage(args);
34826
35118
  const { root, manifest } = clone ?? openClone();
34827
35119
  let incomplete = false;
34828
35120
  const currentIds = clone == null ? null : new Set((await Promise.all(
34829
35121
  allAdapters.map((adapter) => adapter.fetchAll(manifest.workspaceId))
34830
35122
  )).flat().map((resource) => resource.id));
34831
- const message = flagValue(args, "-m", "--message") ?? "Pushed via overai CLI";
34832
35123
  const deploy = args.includes("--deploy");
34833
35124
  const force = args.includes("--force");
34834
35125
  const allowBreaking = args.includes("--allow-breaking");
@@ -35268,7 +35559,7 @@ var runGraphql = async (args) => {
35268
35559
  };
35269
35560
 
35270
35561
  // src/commands/integration.ts
35271
- var USAGE2 = "Usage: overai integration configure <id> --config <json|@file|@-> | integration config <id> | integration secret set <id> <KEY> --value <@file|@-> | integration secret unset <id> <KEY>";
35562
+ var USAGE3 = "Usage: overai integration configure <id> --config <json|@file|@-> | integration config <id> | integration secret set <id> <KEY> --value <@file|@-> | integration secret unset <id> <KEY>";
35272
35563
  var setSecret = async (integrationId, key, rawValue) => {
35273
35564
  if (rawValue == null) {
35274
35565
  throw new Error("Integration secret set requires --value.");
@@ -35302,7 +35593,7 @@ var runIntegration = async (args) => {
35302
35593
  if (operation === "secret") {
35303
35594
  const [, action, id2, key] = args;
35304
35595
  if (action !== "set" && action !== "unset" || id2 == null || key == null || key.startsWith("-")) {
35305
- throw new Error(USAGE2);
35596
+ throw new Error(USAGE3);
35306
35597
  }
35307
35598
  if (action === "set") {
35308
35599
  await setSecret(id2, key, flagValue(args, "--value"));
@@ -35318,7 +35609,7 @@ var runIntegration = async (args) => {
35318
35609
  }
35319
35610
  const [, id] = args;
35320
35611
  if (id == null || operation !== "configure" && operation !== "config") {
35321
- throw new Error(USAGE2);
35612
+ throw new Error(USAGE3);
35322
35613
  }
35323
35614
  if (operation === "configure") {
35324
35615
  const raw2 = await readValue(flagValue(args, "--config"), "--config");
@@ -35611,7 +35902,7 @@ var runOpen = async (args) => {
35611
35902
  };
35612
35903
 
35613
35904
  // src/commands/org.ts
35614
- import { createInterface } from "readline/promises";
35905
+ import { createInterface as createInterface2 } from "readline/promises";
35615
35906
  var USER_ORGS_QUERY = `
35616
35907
  query UserOrganizations($identityId: String!) {
35617
35908
  identityOrganizations(condition: { identityId: $identityId }) {
@@ -35741,7 +36032,7 @@ var promptForOrg = async () => {
35741
36032
  `
35742
36033
  );
35743
36034
  });
35744
- const rl = createInterface({ input: process.stdin, output: process.stdout });
36035
+ const rl = createInterface2({ input: process.stdin, output: process.stdout });
35745
36036
  try {
35746
36037
  const answer = await rl.question("Switch to: ");
35747
36038
  const chosen = rows[Number(answer.trim()) - 1];
@@ -36313,6 +36604,7 @@ var runDiff = async (args, clone) => {
36313
36604
  var runRecursiveSync = async (command2, args) => {
36314
36605
  if (command2 === "push" && args.includes("--deploy"))
36315
36606
  throw new Error("Recursive push saves versions only. Deploy from an individual workspace.");
36607
+ if (command2 === "push") pushMessage(args);
36316
36608
  const origin = openClone();
36317
36609
  const local = /* @__PURE__ */ new Map([[origin.manifest.workspaceId, origin]]);
36318
36610
  const folders = [origin];
@@ -37142,7 +37434,7 @@ var runReview = async () => {
37142
37434
  };
37143
37435
 
37144
37436
  // src/commands/sql.ts
37145
- import { createInterface as createInterface2 } from "readline";
37437
+ import { createInterface as createInterface3 } from "readline";
37146
37438
 
37147
37439
  // src/commands/sqlCredential.ts
37148
37440
  var connectionString = async (tableSpaceId, secret) => {
@@ -37286,7 +37578,7 @@ transaction \u2014 BEGIN/SET/temp tables don't carry across statements.
37286
37578
  `;
37287
37579
  var runRepl = async (organizationId, tableSpaceId, format2) => {
37288
37580
  const interactive = process.stdin.isTTY;
37289
- const rl = createInterface2({
37581
+ const rl = createInterface3({
37290
37582
  input: process.stdin,
37291
37583
  ...interactive ? { output: process.stdout, historySize: 1e3, terminal: true } : {}
37292
37584
  });
@@ -37432,10 +37724,10 @@ var runSql = async (args) => {
37432
37724
 
37433
37725
  // src/commands/storage.ts
37434
37726
  import { openAsBlob, writeFileSync as writeFileSync6 } from "fs";
37435
- var USAGE3 = "Usage: overai storage upload <path> [--no-random-prefix] | storage download <key> [path|-] | storage exists <key> | storage head <key> [--lines N] | storage presign <key> [--expires-in <seconds>]";
37727
+ var USAGE4 = "Usage: overai storage upload <path> [--no-random-prefix] | storage download <key> [path|-] | storage exists <key> | storage head <key> [--lines N] | storage presign <key> [--expires-in <seconds>]";
37436
37728
  var runStorage = async (args) => {
37437
37729
  const [operation, first2, second] = args;
37438
- if (operation == null) throw new Error(USAGE3);
37730
+ if (operation == null) throw new Error(USAGE4);
37439
37731
  const { organizationId } = await getAccessToken();
37440
37732
  const segment = (key) => encodeURIComponent(key);
37441
37733
  if (operation === "upload") {
@@ -37466,7 +37758,7 @@ var runStorage = async (args) => {
37466
37758
  `);
37467
37759
  return;
37468
37760
  }
37469
- if (first2 == null) throw new Error(USAGE3);
37761
+ if (first2 == null) throw new Error(USAGE4);
37470
37762
  if (operation === "download") {
37471
37763
  const response = await v2Fetch(
37472
37764
  `/v2/storage/${organizationId}/${segment(first2)}`,
@@ -37523,7 +37815,7 @@ var runStorage = async (args) => {
37523
37815
  `);
37524
37816
  return;
37525
37817
  }
37526
- throw new Error(USAGE3);
37818
+ throw new Error(USAGE4);
37527
37819
  };
37528
37820
 
37529
37821
  // src/commands/workspace.ts
@@ -37609,7 +37901,7 @@ var listWorkspaceUsers = async (args) => {
37609
37901
  resolveFormat(flagValue(args, "-o", "--output"))
37610
37902
  );
37611
37903
  };
37612
- var USAGE4 = `Usage:
37904
+ var USAGE5 = `Usage:
37613
37905
  overai workspace list [--archived] [--limit <n>]
37614
37906
  overai workspace show [workspaceId]
37615
37907
  overai workspace users [workspaceId]
@@ -37627,7 +37919,7 @@ var runWorkspace = async (args) => {
37627
37919
  await listWorkspaceUsers(args.slice(1));
37628
37920
  return;
37629
37921
  }
37630
- process.stderr.write(USAGE4);
37922
+ process.stderr.write(USAGE5);
37631
37923
  process.exitCode = 1;
37632
37924
  };
37633
37925
 
@@ -37785,6 +38077,8 @@ Automations:
37785
38077
 
37786
38078
  Other resources:
37787
38079
  overai agent generate <agentId> --message <text|@file|@->
38080
+ overai agent tools <agentId> [--version <n>]
38081
+ overai agent chat <agentId> [--conversation <id>] [--message <text>]
37788
38082
  overai data-stream append <id> <json|@file|@->
37789
38083
  overai data-stream query <id> --start <date> --end <date> [--query <filter>]
37790
38084
  overai data-file upload <id> <path> [-m <message>]
@@ -37896,13 +38190,44 @@ var withoutLeadingFlags = (argv) => {
37896
38190
  }
37897
38191
  return argv.slice(index);
37898
38192
  };
38193
+ var COMMAND_ALIASES = {
38194
+ login: "signin",
38195
+ logout: "signout",
38196
+ ws: "workspace",
38197
+ upgrade: "update"
38198
+ };
38199
+ var WRITE_COMMAND_FLAGS = /* @__PURE__ */ new Map([
38200
+ ["pull", { flags: ["--recursive"] }],
38201
+ [
38202
+ "push",
38203
+ {
38204
+ flags: ["-m", "--message", "--deploy", "--force", "--allow-breaking", "--recursive"],
38205
+ valueFlags: ["-m", "--message"]
38206
+ }
38207
+ ],
38208
+ // --recursive stays listed for deploy and restore so the --recursive branch
38209
+ // below can explain that they are single-workspace, instead of "unknown flag".
38210
+ ["deploy", { flags: ["--all", "--allow-breaking", "--recursive"] }],
38211
+ ["restore", { flags: ["--all", "--recursive"] }]
38212
+ ]);
38213
+ var usageOrHelp = (command2) => usageFor(HELP, COMMAND_ALIASES[command2] ?? command2) || HELP;
37899
38214
  var run = async () => {
37900
38215
  const [command2, ...rest] = withoutLeadingFlags(process.argv.slice(2));
38216
+ if (command2 != null && (rest.includes("--help") || rest.includes("-h"))) {
38217
+ process.stdout.write(usageOrHelp(command2));
38218
+ return;
38219
+ }
37901
38220
  const misplaced = rest.find((arg) => LEADING_FLAGS.includes(arg));
37902
38221
  if (misplaced != null)
37903
38222
  throw new Error(
37904
38223
  `${misplaced} goes before the command: overai ${misplaced} <ref> ${command2 ?? "<command>"} ...`
37905
38224
  );
38225
+ const writeFlags = command2 == null ? void 0 : WRITE_COMMAND_FLAGS.get(command2);
38226
+ const unknown = writeFlags == null ? [] : unknownFlags(rest, writeFlags.flags, writeFlags.valueFlags);
38227
+ if (unknown.length > 0)
38228
+ throw new Error(
38229
+ `Unknown flag ${unknown.join(", ")} for ${command2 ?? ""}. See: overai ${command2 ?? ""} --help`
38230
+ );
37906
38231
  const orgFromFolder = command2 != null && !ORG_AGNOSTIC_COMMANDS.has(command2);
37907
38232
  if (orgFromFolder) pinOrgFromClone();
37908
38233
  if (requireExplicitOrg && command2 != null && !ORG_OPTIONAL_COMMANDS.has(command2) && orgScopeSource() === "saved default")
@@ -38059,8 +38384,10 @@ var run = async () => {
38059
38384
  process.stdout.write(`${cliVersion()}
38060
38385
  `);
38061
38386
  return;
38062
- case void 0:
38063
38387
  case "help":
38388
+ process.stdout.write(rest[0] == null ? HELP : usageOrHelp(rest[0]));
38389
+ return;
38390
+ case void 0:
38064
38391
  case "--help":
38065
38392
  case "-h":
38066
38393
  process.stdout.write(HELP);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overaihq/cli",
3
- "version": "0.14.4",
3
+ "version": "0.14.6",
4
4
  "description": "Create, edit, deploy, and run OverAI workspace resources from the command line",
5
5
  "type": "module",
6
6
  "homepage": "https://overai.com",