@vellumai/cli 0.4.3 → 0.4.4
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/package.json +1 -1
- package/src/commands/hatch.ts +21 -6
- package/src/lib/assistant-config.ts +1 -1
package/package.json
CHANGED
package/src/commands/hatch.ts
CHANGED
|
@@ -145,6 +145,7 @@ interface HatchArgs {
|
|
|
145
145
|
name: string | null;
|
|
146
146
|
remote: RemoteHost;
|
|
147
147
|
daemonOnly: boolean;
|
|
148
|
+
restart: boolean;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
function parseArgs(): HatchArgs {
|
|
@@ -154,6 +155,7 @@ function parseArgs(): HatchArgs {
|
|
|
154
155
|
let name: string | null = null;
|
|
155
156
|
let remote: RemoteHost = DEFAULT_REMOTE;
|
|
156
157
|
let daemonOnly = false;
|
|
158
|
+
let restart = false;
|
|
157
159
|
|
|
158
160
|
for (let i = 0; i < args.length; i++) {
|
|
159
161
|
const arg = args[i];
|
|
@@ -171,11 +173,14 @@ function parseArgs(): HatchArgs {
|
|
|
171
173
|
console.log(" --name <name> Custom instance name");
|
|
172
174
|
console.log(" --remote <host> Remote host (local, gcp, aws, custom)");
|
|
173
175
|
console.log(" --daemon-only Start daemon only, skip gateway");
|
|
176
|
+
console.log(" --restart Restart processes without onboarding side effects");
|
|
174
177
|
process.exit(0);
|
|
175
178
|
} else if (arg === "-d") {
|
|
176
179
|
detached = true;
|
|
177
180
|
} else if (arg === "--daemon-only") {
|
|
178
181
|
daemonOnly = true;
|
|
182
|
+
} else if (arg === "--restart") {
|
|
183
|
+
restart = true;
|
|
179
184
|
} else if (arg === "--name") {
|
|
180
185
|
const next = args[i + 1];
|
|
181
186
|
if (!next || next.startsWith("-")) {
|
|
@@ -204,13 +209,13 @@ function parseArgs(): HatchArgs {
|
|
|
204
209
|
species = arg as Species;
|
|
205
210
|
} else {
|
|
206
211
|
console.error(
|
|
207
|
-
`Error: Unknown argument '${arg}'. Valid options: ${VALID_SPECIES.join(", ")}, -d, --daemon-only, --name <name>, --remote <${VALID_REMOTE_HOSTS.join("|")}>`,
|
|
212
|
+
`Error: Unknown argument '${arg}'. Valid options: ${VALID_SPECIES.join(", ")}, -d, --daemon-only, --restart, --name <name>, --remote <${VALID_REMOTE_HOSTS.join("|")}>`,
|
|
208
213
|
);
|
|
209
214
|
process.exit(1);
|
|
210
215
|
}
|
|
211
216
|
}
|
|
212
217
|
|
|
213
|
-
return { species, detached, name, remote, daemonOnly };
|
|
218
|
+
return { species, detached, name, remote, daemonOnly, restart };
|
|
214
219
|
}
|
|
215
220
|
|
|
216
221
|
function formatElapsed(ms: number): string {
|
|
@@ -545,7 +550,12 @@ async function displayPairingQRCode(runtimeUrl: string, bearerToken: string | un
|
|
|
545
550
|
}
|
|
546
551
|
}
|
|
547
552
|
|
|
548
|
-
async function hatchLocal(species: Species, name: string | null, daemonOnly: boolean = false): Promise<void> {
|
|
553
|
+
async function hatchLocal(species: Species, name: string | null, daemonOnly: boolean = false, restart: boolean = false): Promise<void> {
|
|
554
|
+
if (restart && !name && !process.env.VELLUM_ASSISTANT_NAME) {
|
|
555
|
+
console.error("Error: Cannot restart without a known assistant ID. Provide --name or ensure VELLUM_ASSISTANT_NAME is set.");
|
|
556
|
+
process.exit(1);
|
|
557
|
+
}
|
|
558
|
+
|
|
549
559
|
const instanceName =
|
|
550
560
|
name ?? process.env.VELLUM_ASSISTANT_NAME ?? `${species}-${generateRandomSuffix()}`;
|
|
551
561
|
|
|
@@ -627,7 +637,7 @@ async function hatchLocal(species: Species, name: string | null, daemonOnly: boo
|
|
|
627
637
|
species,
|
|
628
638
|
hatchedAt: new Date().toISOString(),
|
|
629
639
|
};
|
|
630
|
-
if (!daemonOnly) {
|
|
640
|
+
if (!daemonOnly && !restart) {
|
|
631
641
|
saveAssistantEntry(localEntry);
|
|
632
642
|
syncConfigToLockfile();
|
|
633
643
|
|
|
@@ -656,10 +666,15 @@ export async function hatch(): Promise<void> {
|
|
|
656
666
|
const cliVersion = getCliVersion();
|
|
657
667
|
console.log(`@vellumai/cli v${cliVersion}`);
|
|
658
668
|
|
|
659
|
-
const { species, detached, name, remote, daemonOnly } = parseArgs();
|
|
669
|
+
const { species, detached, name, remote, daemonOnly, restart } = parseArgs();
|
|
670
|
+
|
|
671
|
+
if (restart && remote !== "local") {
|
|
672
|
+
console.error("Error: --restart is only supported for local hatch targets.");
|
|
673
|
+
process.exit(1);
|
|
674
|
+
}
|
|
660
675
|
|
|
661
676
|
if (remote === "local") {
|
|
662
|
-
await hatchLocal(species, name, daemonOnly);
|
|
677
|
+
await hatchLocal(species, name, daemonOnly, restart);
|
|
663
678
|
return;
|
|
664
679
|
}
|
|
665
680
|
|
|
@@ -99,7 +99,7 @@ export function loadAllAssistants(): AssistantEntry[] {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export function saveAssistantEntry(entry: AssistantEntry): void {
|
|
102
|
-
const entries = readAssistants();
|
|
102
|
+
const entries = readAssistants().filter((e) => e.assistantId !== entry.assistantId);
|
|
103
103
|
entries.unshift(entry);
|
|
104
104
|
writeAssistants(entries);
|
|
105
105
|
}
|