@vellumai/cli 0.1.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/bun.lock +291 -0
- package/eslint.config.mjs +17 -0
- package/package.json +26 -0
- package/src/adapters/install.sh +99 -0
- package/src/adapters/openclaw-http-server.ts +189 -0
- package/src/adapters/openclaw.ts +118 -0
- package/src/commands/hatch.ts +806 -0
- package/src/components/DefaultMainScreen.tsx +217 -0
- package/src/index.ts +39 -0
- package/src/lib/constants.ts +75 -0
- package/src/lib/gcp.ts +261 -0
- package/src/lib/health-check.ts +38 -0
- package/src/lib/interfaces-seed.ts +25 -0
- package/src/lib/openclaw-runtime-server.ts +18 -0
- package/src/lib/random-name.ts +133 -0
- package/src/lib/status-emoji.ts +14 -0
- package/src/lib/step-runner.ts +103 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
const ADJECTIVES = [
|
|
2
|
+
"brave",
|
|
3
|
+
"calm",
|
|
4
|
+
"eager",
|
|
5
|
+
"fair",
|
|
6
|
+
"glad",
|
|
7
|
+
"keen",
|
|
8
|
+
"bold",
|
|
9
|
+
"cool",
|
|
10
|
+
"fast",
|
|
11
|
+
"warm",
|
|
12
|
+
"wise",
|
|
13
|
+
"kind",
|
|
14
|
+
"pure",
|
|
15
|
+
"safe",
|
|
16
|
+
"true",
|
|
17
|
+
"wild",
|
|
18
|
+
"free",
|
|
19
|
+
"deep",
|
|
20
|
+
"firm",
|
|
21
|
+
"soft",
|
|
22
|
+
"rich",
|
|
23
|
+
"rare",
|
|
24
|
+
"slim",
|
|
25
|
+
"vast",
|
|
26
|
+
"neat",
|
|
27
|
+
"pale",
|
|
28
|
+
"dark",
|
|
29
|
+
"lean",
|
|
30
|
+
"raw",
|
|
31
|
+
"dry",
|
|
32
|
+
"bright",
|
|
33
|
+
"crisp",
|
|
34
|
+
"deft",
|
|
35
|
+
"faint",
|
|
36
|
+
"grand",
|
|
37
|
+
"hale",
|
|
38
|
+
"just",
|
|
39
|
+
"lush",
|
|
40
|
+
"mild",
|
|
41
|
+
"prime",
|
|
42
|
+
"quick",
|
|
43
|
+
"sharp",
|
|
44
|
+
"stark",
|
|
45
|
+
"swift",
|
|
46
|
+
"tame",
|
|
47
|
+
"tight",
|
|
48
|
+
"vivid",
|
|
49
|
+
"plush",
|
|
50
|
+
"dense",
|
|
51
|
+
"lucid",
|
|
52
|
+
"fresh",
|
|
53
|
+
"fleet",
|
|
54
|
+
"stout",
|
|
55
|
+
"brisk",
|
|
56
|
+
"clear",
|
|
57
|
+
"quiet",
|
|
58
|
+
"noble",
|
|
59
|
+
"sleek",
|
|
60
|
+
"agile",
|
|
61
|
+
"spry",
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const NOUNS = [
|
|
65
|
+
"fox",
|
|
66
|
+
"owl",
|
|
67
|
+
"elk",
|
|
68
|
+
"ant",
|
|
69
|
+
"bee",
|
|
70
|
+
"ram",
|
|
71
|
+
"eel",
|
|
72
|
+
"cod",
|
|
73
|
+
"jay",
|
|
74
|
+
"yak",
|
|
75
|
+
"bat",
|
|
76
|
+
"cub",
|
|
77
|
+
"doe",
|
|
78
|
+
"hen",
|
|
79
|
+
"kit",
|
|
80
|
+
"pup",
|
|
81
|
+
"ray",
|
|
82
|
+
"tern",
|
|
83
|
+
"wren",
|
|
84
|
+
"lark",
|
|
85
|
+
"hawk",
|
|
86
|
+
"dove",
|
|
87
|
+
"lynx",
|
|
88
|
+
"hare",
|
|
89
|
+
"frog",
|
|
90
|
+
"newt",
|
|
91
|
+
"crab",
|
|
92
|
+
"moth",
|
|
93
|
+
"seal",
|
|
94
|
+
"toad",
|
|
95
|
+
"wolf",
|
|
96
|
+
"bear",
|
|
97
|
+
"deer",
|
|
98
|
+
"swan",
|
|
99
|
+
"crane",
|
|
100
|
+
"finch",
|
|
101
|
+
"robin",
|
|
102
|
+
"otter",
|
|
103
|
+
"mink",
|
|
104
|
+
"vole",
|
|
105
|
+
"shrew",
|
|
106
|
+
"pike",
|
|
107
|
+
"bass",
|
|
108
|
+
"trout",
|
|
109
|
+
"perch",
|
|
110
|
+
"stork",
|
|
111
|
+
"egret",
|
|
112
|
+
"heron",
|
|
113
|
+
"snipe",
|
|
114
|
+
"quail",
|
|
115
|
+
"raven",
|
|
116
|
+
"swift",
|
|
117
|
+
"grouse",
|
|
118
|
+
"ibis",
|
|
119
|
+
"mole",
|
|
120
|
+
"asp",
|
|
121
|
+
"koi",
|
|
122
|
+
"gnu",
|
|
123
|
+
"dace",
|
|
124
|
+
"skua",
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
function randomElement<T>(arr: T[]): T {
|
|
128
|
+
return arr[Math.floor(Math.random() * arr.length)];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function generateRandomSuffix(): string {
|
|
132
|
+
return `${randomElement(ADJECTIVES)}-${randomElement(NOUNS)}`;
|
|
133
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function statusEmoji(status: string): string {
|
|
2
|
+
const s = status.toLowerCase();
|
|
3
|
+
if (s === "running" || s === "healthy" || s === "ok" || s.startsWith("up ")) {
|
|
4
|
+
return "🟢";
|
|
5
|
+
}
|
|
6
|
+
if (s.startsWith("error") || s === "unreachable" || s.startsWith("exited")) {
|
|
7
|
+
return "🔴";
|
|
8
|
+
}
|
|
9
|
+
return "🟡";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function withStatusEmoji(status: string): string {
|
|
13
|
+
return `${statusEmoji(status)} ${status}`;
|
|
14
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
|
|
3
|
+
const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
4
|
+
|
|
5
|
+
interface Step {
|
|
6
|
+
name: string;
|
|
7
|
+
run: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function clearLine(): void {
|
|
11
|
+
process.stdout.write("\r\x1b[K");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function showSpinner(name: string): NodeJS.Timeout {
|
|
15
|
+
let frameIndex = 0;
|
|
16
|
+
return setInterval(() => {
|
|
17
|
+
clearLine();
|
|
18
|
+
process.stdout.write(` ${SPINNER_FRAMES[frameIndex]} ${name}...`);
|
|
19
|
+
frameIndex = (frameIndex + 1) % SPINNER_FRAMES.length;
|
|
20
|
+
}, 80);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function runSteps(steps: Step[]): Promise<void> {
|
|
24
|
+
for (let i = 0; i < steps.length; i++) {
|
|
25
|
+
const step = steps[i];
|
|
26
|
+
const label = `[${i + 1}/${steps.length}] ${step.name}`;
|
|
27
|
+
|
|
28
|
+
const spinner = showSpinner(label);
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
await step.run();
|
|
32
|
+
clearInterval(spinner);
|
|
33
|
+
clearLine();
|
|
34
|
+
console.log(` ✔ ${label}`);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
clearInterval(spinner);
|
|
37
|
+
clearLine();
|
|
38
|
+
console.log(` ✖ ${label}`);
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function exec(
|
|
45
|
+
command: string,
|
|
46
|
+
args: string[],
|
|
47
|
+
options: { cwd?: string } = {},
|
|
48
|
+
): Promise<void> {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const child = spawn(command, args, {
|
|
51
|
+
cwd: options.cwd,
|
|
52
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
let stderr = "";
|
|
56
|
+
child.stderr.on("data", (data: Buffer) => {
|
|
57
|
+
stderr += data.toString();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
child.on("close", (code) => {
|
|
61
|
+
if (code === 0) {
|
|
62
|
+
resolve();
|
|
63
|
+
} else {
|
|
64
|
+
const msg = `"${command} ${args.join(" ")}" exited with code ${code}`;
|
|
65
|
+
reject(new Error(stderr.trim() ? `${msg}\n${stderr.trim()}` : msg));
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
child.on("error", reject);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function execOutput(
|
|
73
|
+
command: string,
|
|
74
|
+
args: string[],
|
|
75
|
+
options: { cwd?: string } = {},
|
|
76
|
+
): Promise<string> {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const child = spawn(command, args, {
|
|
79
|
+
cwd: options.cwd,
|
|
80
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
let stdout = "";
|
|
84
|
+
child.stdout.on("data", (data: Buffer) => {
|
|
85
|
+
stdout += data.toString();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
let stderr = "";
|
|
89
|
+
child.stderr.on("data", (data: Buffer) => {
|
|
90
|
+
stderr += data.toString();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
child.on("close", (code) => {
|
|
94
|
+
if (code === 0) {
|
|
95
|
+
resolve(stdout.trim());
|
|
96
|
+
} else {
|
|
97
|
+
const msg = `"${command} ${args.join(" ")}" exited with code ${code}`;
|
|
98
|
+
reject(new Error(stderr.trim() ? `${msg}\n${stderr.trim()}` : msg));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
child.on("error", reject);
|
|
102
|
+
});
|
|
103
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"jsx": "react-jsx",
|
|
13
|
+
"types": ["bun-types"]
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*", "src/**/*.tsx"],
|
|
16
|
+
"exclude": ["node_modules"]
|
|
17
|
+
}
|