fix: resolve 4 production TypeScript type errors (#3266)
Some checks are pending
CLI Release / Build and release CLI (push) Waiting to run
Lint / ShellCheck (push) Waiting to run
Lint / Biome Lint (push) Waiting to run
Lint / macOS Compatibility (push) Waiting to run

- local.ts: spread ReadonlyArray into mutable array for Bun.spawn
- run.ts: capture optional fields in local vars for proper narrowing
- delete.ts: filter SpawnRecordSchema output for required id field

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-04-11 03:16:47 -07:00 committed by GitHub
parent 35c436b876
commit 187595283e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 14 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@openrouter/spawn",
"version": "1.0.2",
"version": "1.0.3",
"type": "module",
"bin": {
"spawn": "cli.js"

View file

@ -319,8 +319,11 @@ export async function pullChildHistory(record: SpawnRecord): Promise<void> {
const childRecords: SpawnRecord[] = [];
for (const el of parsed) {
const result = v.safeParse(SpawnRecordSchema, el);
if (result.success) {
childRecords.push(result.output);
if (result.success && result.output.id) {
childRecords.push({
...result.output,
id: result.output.id,
});
}
}
if (childRecords.length > 0) {

View file

@ -1196,11 +1196,13 @@ export async function cmdRunHeadless(agent: string, cloud: string, opts: Headles
if (conn.user && tryCatch(() => validateUsername(conn.user)).ok) {
connectionFields.ssh_user = conn.user;
}
if (conn.server_id && tryCatch(() => validateServerIdentifier(conn.server_id)).ok) {
connectionFields.server_id = conn.server_id;
const serverId = conn.server_id;
if (serverId && tryCatch(() => validateServerIdentifier(serverId)).ok) {
connectionFields.server_id = serverId;
}
if (conn.server_name && tryCatch(() => validateServerIdentifier(conn.server_name)).ok) {
connectionFields.server_name = conn.server_name;
const serverName = conn.server_name;
if (serverName && tryCatch(() => validateServerIdentifier(serverName)).ok) {
connectionFields.server_name = serverName;
}
}

View file

@ -83,14 +83,19 @@ export async function runLocal(cmd: string): Promise<void> {
/** Run a command locally using an argument array (no shell interpretation). */
export async function runLocalArgs(args: ReadonlyArray<string>): Promise<void> {
const proc = Bun.spawn(args, {
stdio: [
"inherit",
"inherit",
"inherit",
const proc = Bun.spawn(
[
...args,
],
env: process.env,
});
{
stdio: [
"inherit",
"inherit",
"inherit",
],
env: process.env,
},
);
const exitCode = await proc.exited;
if (exitCode !== 0) {
throw new Error(`Command failed (exit ${exitCode}): ${args.join(" ")}`);