@allocator-one/harness-cli 1.14.0 → 1.15.1
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/README.md +585 -26
- package/dist/chunk-FQWV5MIC.js +73 -0
- package/dist/{chunk-F2YVTB2A.js → chunk-L2OWOZ4N.js} +2362 -288
- package/dist/cli.js +533 -93
- package/dist/{login-page-UVUKFFTT.js → login-page-KGEJFFXR.js} +12 -5
- package/dist/{server-75QJASTY.js → server-KVRQBVXI.js} +264 -24
- package/package.json +2 -1
- package/spec/openapi.json +13100 -3920
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/version.ts
|
|
4
|
+
import { readFileSync } from "fs";
|
|
5
|
+
var pkg = JSON.parse(
|
|
6
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf8")
|
|
7
|
+
);
|
|
8
|
+
var CLI_VERSION = pkg.version;
|
|
9
|
+
var CLI_PACKAGE = pkg.name;
|
|
10
|
+
|
|
11
|
+
// src/invocation.ts
|
|
12
|
+
import { basename } from "path";
|
|
13
|
+
var OPERATOR_PACKAGE = "@allocator-one/operator";
|
|
14
|
+
function invokedName(argv1 = process.argv[1], packageName = CLI_PACKAGE) {
|
|
15
|
+
const typed = basename(argv1 ?? "").replace(/\.[cm]?js$/i, "").toLowerCase();
|
|
16
|
+
if (typed === "operator" || typed === "harness") return typed;
|
|
17
|
+
return packageName === OPERATOR_PACKAGE ? "operator" : "harness";
|
|
18
|
+
}
|
|
19
|
+
function named(text, name = invokedName()) {
|
|
20
|
+
if (name === "harness") return text;
|
|
21
|
+
return text.replace(/^harness: /gm, `${name}: `).replace(/(?<![\w@/.-])harness (?=[a-z])(?!disagree)/g, `${name} `).replaceAll("@allocator-one/harness-cli", OPERATOR_PACKAGE);
|
|
22
|
+
}
|
|
23
|
+
var OPERATOR_COMMANDS = [
|
|
24
|
+
"run",
|
|
25
|
+
"jobs",
|
|
26
|
+
"job",
|
|
27
|
+
"watch",
|
|
28
|
+
"steer",
|
|
29
|
+
"cancel",
|
|
30
|
+
"pause",
|
|
31
|
+
"continue",
|
|
32
|
+
"procedure",
|
|
33
|
+
"plan",
|
|
34
|
+
"gate",
|
|
35
|
+
"conditions",
|
|
36
|
+
"assignments",
|
|
37
|
+
"tools",
|
|
38
|
+
"tool",
|
|
39
|
+
"skills",
|
|
40
|
+
"mcp"
|
|
41
|
+
];
|
|
42
|
+
var GENERAL_COMMANDS = [
|
|
43
|
+
"login",
|
|
44
|
+
"logout",
|
|
45
|
+
"whoami",
|
|
46
|
+
"version",
|
|
47
|
+
"keys"
|
|
48
|
+
];
|
|
49
|
+
var OPERATOR_HEADING = "Operator:";
|
|
50
|
+
var ISSUES_HEADING = "Issues:";
|
|
51
|
+
var GENERAL_HEADING = "General:";
|
|
52
|
+
function layoutOperatorHelp(program) {
|
|
53
|
+
const rank = (name) => {
|
|
54
|
+
const operator = OPERATOR_COMMANDS.indexOf(name);
|
|
55
|
+
if (operator !== -1) return operator;
|
|
56
|
+
return GENERAL_COMMANDS.includes(name) ? 2 * OPERATOR_COMMANDS.length : OPERATOR_COMMANDS.length;
|
|
57
|
+
};
|
|
58
|
+
const heading = (name) => OPERATOR_COMMANDS.includes(name) ? OPERATOR_HEADING : GENERAL_COMMANDS.includes(name) ? GENERAL_HEADING : ISSUES_HEADING;
|
|
59
|
+
for (const command of program.commands) command.helpGroup(heading(command.name()));
|
|
60
|
+
program.commands.sort(
|
|
61
|
+
(left, right) => rank(left.name()) - rank(right.name())
|
|
62
|
+
);
|
|
63
|
+
program.commandsGroup(GENERAL_HEADING).helpCommand(true);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
CLI_VERSION,
|
|
68
|
+
CLI_PACKAGE,
|
|
69
|
+
OPERATOR_PACKAGE,
|
|
70
|
+
invokedName,
|
|
71
|
+
named,
|
|
72
|
+
layoutOperatorHelp
|
|
73
|
+
};
|