@overaihq/cli 0.14.4 → 0.14.5
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/dist/index.js +65 -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);
|
|
@@ -34821,14 +34844,20 @@ var positionals = (args) => {
|
|
|
34821
34844
|
}
|
|
34822
34845
|
return out;
|
|
34823
34846
|
};
|
|
34847
|
+
var pushMessage = (args) => {
|
|
34848
|
+
const message = flagValue(args, "-m", "--message");
|
|
34849
|
+
if (message == null || message.startsWith("-"))
|
|
34850
|
+
throw new Error("Usage: overai push [filter] -m <message>. -m names the version this push creates.");
|
|
34851
|
+
return message;
|
|
34852
|
+
};
|
|
34824
34853
|
var runPush = async (args, clone) => {
|
|
34825
34854
|
if (clone != null && args.includes("--deploy")) throw new Error("Recursive push cannot deploy.");
|
|
34855
|
+
const message = pushMessage(args);
|
|
34826
34856
|
const { root, manifest } = clone ?? openClone();
|
|
34827
34857
|
let incomplete = false;
|
|
34828
34858
|
const currentIds = clone == null ? null : new Set((await Promise.all(
|
|
34829
34859
|
allAdapters.map((adapter) => adapter.fetchAll(manifest.workspaceId))
|
|
34830
34860
|
)).flat().map((resource) => resource.id));
|
|
34831
|
-
const message = flagValue(args, "-m", "--message") ?? "Pushed via overai CLI";
|
|
34832
34861
|
const deploy = args.includes("--deploy");
|
|
34833
34862
|
const force = args.includes("--force");
|
|
34834
34863
|
const allowBreaking = args.includes("--allow-breaking");
|
|
@@ -36313,6 +36342,7 @@ var runDiff = async (args, clone) => {
|
|
|
36313
36342
|
var runRecursiveSync = async (command2, args) => {
|
|
36314
36343
|
if (command2 === "push" && args.includes("--deploy"))
|
|
36315
36344
|
throw new Error("Recursive push saves versions only. Deploy from an individual workspace.");
|
|
36345
|
+
if (command2 === "push") pushMessage(args);
|
|
36316
36346
|
const origin = openClone();
|
|
36317
36347
|
const local = /* @__PURE__ */ new Map([[origin.manifest.workspaceId, origin]]);
|
|
36318
36348
|
const folders = [origin];
|
|
@@ -37896,13 +37926,44 @@ var withoutLeadingFlags = (argv) => {
|
|
|
37896
37926
|
}
|
|
37897
37927
|
return argv.slice(index);
|
|
37898
37928
|
};
|
|
37929
|
+
var COMMAND_ALIASES = {
|
|
37930
|
+
login: "signin",
|
|
37931
|
+
logout: "signout",
|
|
37932
|
+
ws: "workspace",
|
|
37933
|
+
upgrade: "update"
|
|
37934
|
+
};
|
|
37935
|
+
var WRITE_COMMAND_FLAGS = /* @__PURE__ */ new Map([
|
|
37936
|
+
["pull", { flags: ["--recursive"] }],
|
|
37937
|
+
[
|
|
37938
|
+
"push",
|
|
37939
|
+
{
|
|
37940
|
+
flags: ["-m", "--message", "--deploy", "--force", "--allow-breaking", "--recursive"],
|
|
37941
|
+
valueFlags: ["-m", "--message"]
|
|
37942
|
+
}
|
|
37943
|
+
],
|
|
37944
|
+
// --recursive stays listed for deploy and restore so the --recursive branch
|
|
37945
|
+
// below can explain that they are single-workspace, instead of "unknown flag".
|
|
37946
|
+
["deploy", { flags: ["--all", "--allow-breaking", "--recursive"] }],
|
|
37947
|
+
["restore", { flags: ["--all", "--recursive"] }]
|
|
37948
|
+
]);
|
|
37949
|
+
var usageOrHelp = (command2) => usageFor(HELP, COMMAND_ALIASES[command2] ?? command2) || HELP;
|
|
37899
37950
|
var run = async () => {
|
|
37900
37951
|
const [command2, ...rest] = withoutLeadingFlags(process.argv.slice(2));
|
|
37952
|
+
if (command2 != null && (rest.includes("--help") || rest.includes("-h"))) {
|
|
37953
|
+
process.stdout.write(usageOrHelp(command2));
|
|
37954
|
+
return;
|
|
37955
|
+
}
|
|
37901
37956
|
const misplaced = rest.find((arg) => LEADING_FLAGS.includes(arg));
|
|
37902
37957
|
if (misplaced != null)
|
|
37903
37958
|
throw new Error(
|
|
37904
37959
|
`${misplaced} goes before the command: overai ${misplaced} <ref> ${command2 ?? "<command>"} ...`
|
|
37905
37960
|
);
|
|
37961
|
+
const writeFlags = command2 == null ? void 0 : WRITE_COMMAND_FLAGS.get(command2);
|
|
37962
|
+
const unknown = writeFlags == null ? [] : unknownFlags(rest, writeFlags.flags, writeFlags.valueFlags);
|
|
37963
|
+
if (unknown.length > 0)
|
|
37964
|
+
throw new Error(
|
|
37965
|
+
`Unknown flag ${unknown.join(", ")} for ${command2 ?? ""}. See: overai ${command2 ?? ""} --help`
|
|
37966
|
+
);
|
|
37906
37967
|
const orgFromFolder = command2 != null && !ORG_AGNOSTIC_COMMANDS.has(command2);
|
|
37907
37968
|
if (orgFromFolder) pinOrgFromClone();
|
|
37908
37969
|
if (requireExplicitOrg && command2 != null && !ORG_OPTIONAL_COMMANDS.has(command2) && orgScopeSource() === "saved default")
|
|
@@ -38059,8 +38120,10 @@ var run = async () => {
|
|
|
38059
38120
|
process.stdout.write(`${cliVersion()}
|
|
38060
38121
|
`);
|
|
38061
38122
|
return;
|
|
38062
|
-
case void 0:
|
|
38063
38123
|
case "help":
|
|
38124
|
+
process.stdout.write(rest[0] == null ? HELP : usageOrHelp(rest[0]));
|
|
38125
|
+
return;
|
|
38126
|
+
case void 0:
|
|
38064
38127
|
case "--help":
|
|
38065
38128
|
case "-h":
|
|
38066
38129
|
process.stdout.write(HELP);
|