From 1dc9c04eeb04b927a1a320e8ae5f82c0eb704b2b Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Fri, 20 Mar 2026 08:51:40 -0700 Subject: [PATCH] fix: standardize ESM import extensions across 35 production files (#2827) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add .js extensions to 124 relative imports that were missing them. The codebase is "type": "module" (ESM) and the dominant pattern already used .js extensions, but 35 files had a mix of extensionless and .js imports — sometimes within the same file. Standardize to .js everywhere. Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- packages/cli/src/aws/agents.ts | 4 ++-- packages/cli/src/aws/aws.ts | 18 +++++++------- packages/cli/src/aws/billing.ts | 2 +- packages/cli/src/aws/main.ts | 8 +++---- packages/cli/src/digitalocean/agents.ts | 4 ++-- packages/cli/src/digitalocean/billing.ts | 2 +- packages/cli/src/digitalocean/digitalocean.ts | 20 ++++++++-------- packages/cli/src/digitalocean/main.ts | 10 ++++---- packages/cli/src/gcp/agents.ts | 4 ++-- packages/cli/src/gcp/billing.ts | 2 +- packages/cli/src/gcp/gcp.ts | 16 ++++++------- packages/cli/src/gcp/main.ts | 8 +++---- packages/cli/src/hetzner/agents.ts | 4 ++-- packages/cli/src/hetzner/billing.ts | 2 +- packages/cli/src/hetzner/hetzner.ts | 18 +++++++------- packages/cli/src/hetzner/main.ts | 8 +++---- packages/cli/src/local/agents.ts | 4 ++-- packages/cli/src/local/local.ts | 6 ++--- packages/cli/src/local/main.ts | 8 +++---- packages/cli/src/shared/agent-setup.ts | 8 +++---- packages/cli/src/shared/agent-tarball.ts | 6 ++--- packages/cli/src/shared/agents.ts | 2 +- packages/cli/src/shared/billing-guidance.ts | 2 +- packages/cli/src/shared/cloud-init.ts | 2 +- packages/cli/src/shared/oauth.ts | 8 +++---- packages/cli/src/shared/orchestrate.ts | 24 +++++++++---------- packages/cli/src/shared/ssh-keys.ts | 4 ++-- packages/cli/src/shared/ssh.ts | 2 +- packages/cli/src/shared/ui.ts | 8 +++---- packages/cli/src/sprite/agents.ts | 4 ++-- packages/cli/src/sprite/main.ts | 8 +++---- packages/cli/src/sprite/sprite.ts | 6 ++--- packages/cli/src/update-check.ts | 10 ++++---- 33 files changed, 121 insertions(+), 121 deletions(-) diff --git a/packages/cli/src/aws/agents.ts b/packages/cli/src/aws/agents.ts index 77329c18..2c7c5f4c 100644 --- a/packages/cli/src/aws/agents.ts +++ b/packages/cli/src/aws/agents.ts @@ -1,7 +1,7 @@ // aws/agents.ts — AWS Lightsail agent configs (thin wrapper over shared) -import { createCloudAgents } from "../shared/agent-setup"; -import { downloadFile, runServer, uploadFile } from "./aws"; +import { createCloudAgents } from "../shared/agent-setup.js"; +import { downloadFile, runServer, uploadFile } from "./aws.js"; export const { agents, resolveAgent } = createCloudAgents({ runServer, diff --git a/packages/cli/src/aws/aws.ts b/packages/cli/src/aws/aws.ts index 3b4c5c1e..ca71b17d 100644 --- a/packages/cli/src/aws/aws.ts +++ b/packages/cli/src/aws/aws.ts @@ -1,17 +1,17 @@ // aws/aws.ts — Core AWS Lightsail provider: auth, provisioning, SSH execution import type { CloudInstance, VMConnection } from "../history.js"; -import type { CloudInitTier } from "../shared/agents"; +import type { CloudInitTier } from "../shared/agents.js"; import { createHash, createHmac } from "node:crypto"; import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { dirname, normalize } from "node:path"; import { getErrorMessage } from "@openrouter/spawn-shared"; import * as v from "valibot"; -import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance"; -import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init"; -import { parseJsonWith } from "../shared/parse"; -import { getSpawnCloudConfigPath } from "../shared/paths"; +import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js"; +import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js"; +import { parseJsonWith } from "../shared/parse.js"; +import { getSpawnCloudConfigPath } from "../shared/paths.js"; import { asyncTryCatch, isFileError, tryCatch, tryCatchIf, unwrapOr } from "../shared/result.js"; import { killWithTimeout, @@ -20,8 +20,8 @@ import { waitForSsh as sharedWaitForSsh, sleep, spawnInteractive, -} from "../shared/ssh"; -import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys"; +} from "../shared/ssh.js"; +import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys.js"; import { getServerNameFromEnv, jsonEscape, @@ -38,8 +38,8 @@ import { selectFromList, shellQuote, validateRegionName, -} from "../shared/ui"; -import { awsBilling } from "./billing"; +} from "../shared/ui.js"; +import { awsBilling } from "./billing.js"; const DASHBOARD_URL = "https://lightsail.aws.amazon.com/"; diff --git a/packages/cli/src/aws/billing.ts b/packages/cli/src/aws/billing.ts index 77424212..586fd8e7 100644 --- a/packages/cli/src/aws/billing.ts +++ b/packages/cli/src/aws/billing.ts @@ -1,4 +1,4 @@ -import type { BillingConfig } from "../shared/billing-guidance"; +import type { BillingConfig } from "../shared/billing-guidance.js"; export const awsBilling: BillingConfig = { billingUrl: "https://lightsail.aws.amazon.com/", diff --git a/packages/cli/src/aws/main.ts b/packages/cli/src/aws/main.ts index 7b4d9add..ab53cde5 100644 --- a/packages/cli/src/aws/main.ts +++ b/packages/cli/src/aws/main.ts @@ -2,11 +2,11 @@ // aws/main.ts — Orchestrator: deploys an agent on AWS Lightsail -import type { CloudOrchestrator } from "../shared/orchestrate"; +import type { CloudOrchestrator } from "../shared/orchestrate.js"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { runOrchestration } from "../shared/orchestrate"; -import { agents, resolveAgent } from "./agents"; +import { runOrchestration } from "../shared/orchestrate.js"; +import { agents, resolveAgent } from "./agents.js"; import { authenticate, createInstance, @@ -23,7 +23,7 @@ import { uploadFile, waitForCloudInit, waitForSshOnly, -} from "./aws"; +} from "./aws.js"; async function main() { const agentName = process.argv[2]; diff --git a/packages/cli/src/digitalocean/agents.ts b/packages/cli/src/digitalocean/agents.ts index b8545d30..61eec01c 100644 --- a/packages/cli/src/digitalocean/agents.ts +++ b/packages/cli/src/digitalocean/agents.ts @@ -1,7 +1,7 @@ // digitalocean/agents.ts — DigitalOcean agent configs (thin wrapper over shared) -import { createCloudAgents } from "../shared/agent-setup"; -import { downloadFile, runServer, uploadFile } from "./digitalocean"; +import { createCloudAgents } from "../shared/agent-setup.js"; +import { downloadFile, runServer, uploadFile } from "./digitalocean.js"; export const { agents, resolveAgent } = createCloudAgents({ runServer, diff --git a/packages/cli/src/digitalocean/billing.ts b/packages/cli/src/digitalocean/billing.ts index 6ebd4b71..160bd3ea 100644 --- a/packages/cli/src/digitalocean/billing.ts +++ b/packages/cli/src/digitalocean/billing.ts @@ -1,4 +1,4 @@ -import type { BillingConfig } from "../shared/billing-guidance"; +import type { BillingConfig } from "../shared/billing-guidance.js"; export const digitaloceanBilling: BillingConfig = { billingUrl: "https://cloud.digitalocean.com/account/billing", diff --git a/packages/cli/src/digitalocean/digitalocean.ts b/packages/cli/src/digitalocean/digitalocean.ts index c835d16e..397f578e 100644 --- a/packages/cli/src/digitalocean/digitalocean.ts +++ b/packages/cli/src/digitalocean/digitalocean.ts @@ -1,17 +1,17 @@ // digitalocean/digitalocean.ts — Core DigitalOcean provider: API, auth, SSH, provisioning import type { CloudInstance, VMConnection } from "../history.js"; -import type { CloudInitTier } from "../shared/agents"; +import type { CloudInitTier } from "../shared/agents.js"; import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { dirname, normalize } from "node:path"; import * as p from "@clack/prompts"; import { getErrorMessage, isNumber, isString, toObjectArray, toRecord } from "@openrouter/spawn-shared"; -import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance"; -import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init"; -import { generateCsrfState, OAUTH_CSS } from "../shared/oauth"; -import { parseJsonObj } from "../shared/parse"; -import { getSpawnCloudConfigPath } from "../shared/paths"; +import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js"; +import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js"; +import { generateCsrfState, OAUTH_CSS } from "../shared/oauth.js"; +import { parseJsonObj } from "../shared/parse.js"; +import { getSpawnCloudConfigPath } from "../shared/paths.js"; import { asyncTryCatch, asyncTryCatchIf, @@ -29,8 +29,8 @@ import { sleep, spawnInteractive, waitForSshSnapshotBoot, -} from "../shared/ssh"; -import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys"; +} from "../shared/ssh.js"; +import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys.js"; import { defaultSpawnName, getServerNameFromEnv, @@ -50,8 +50,8 @@ import { toKebabCase, validateRegionName, validateServerName, -} from "../shared/ui"; -import { digitaloceanBilling } from "./billing"; +} from "../shared/ui.js"; +import { digitaloceanBilling } from "./billing.js"; const DO_API_BASE = "https://api.digitalocean.com/v2"; const DO_DASHBOARD_URL = "https://cloud.digitalocean.com/droplets"; diff --git a/packages/cli/src/digitalocean/main.ts b/packages/cli/src/digitalocean/main.ts index bd4ceafa..e09cee94 100644 --- a/packages/cli/src/digitalocean/main.ts +++ b/packages/cli/src/digitalocean/main.ts @@ -2,12 +2,12 @@ // digitalocean/main.ts — Orchestrator: deploys an agent on DigitalOcean -import type { CloudOrchestrator } from "../shared/orchestrate"; +import type { CloudOrchestrator } from "../shared/orchestrate.js"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { runOrchestration } from "../shared/orchestrate"; -import { logInfo } from "../shared/ui"; -import { agents, resolveAgent } from "./agents"; +import { runOrchestration } from "../shared/orchestrate.js"; +import { logInfo } from "../shared/ui.js"; +import { agents, resolveAgent } from "./agents.js"; import { checkAccountStatus, createServer as createDroplet, @@ -24,7 +24,7 @@ import { uploadFile, waitForCloudInit, waitForSshOnly, -} from "./digitalocean"; +} from "./digitalocean.js"; /** Agents that need more than the default 2GB RAM (e.g. openclaw-plugins OOMs on 2GB) */ const AGENT_MIN_SIZE: Record = { diff --git a/packages/cli/src/gcp/agents.ts b/packages/cli/src/gcp/agents.ts index df6bdf07..7e2418c2 100644 --- a/packages/cli/src/gcp/agents.ts +++ b/packages/cli/src/gcp/agents.ts @@ -1,7 +1,7 @@ // gcp/agents.ts — GCP Compute Engine agent configs (thin wrapper over shared) -import { createCloudAgents } from "../shared/agent-setup"; -import { downloadFile, runServer, uploadFile } from "./gcp"; +import { createCloudAgents } from "../shared/agent-setup.js"; +import { downloadFile, runServer, uploadFile } from "./gcp.js"; export const { agents, resolveAgent } = createCloudAgents({ runServer, diff --git a/packages/cli/src/gcp/billing.ts b/packages/cli/src/gcp/billing.ts index dbf5dc47..e70df10a 100644 --- a/packages/cli/src/gcp/billing.ts +++ b/packages/cli/src/gcp/billing.ts @@ -1,4 +1,4 @@ -import type { BillingConfig } from "../shared/billing-guidance"; +import type { BillingConfig } from "../shared/billing-guidance.js"; export const gcpBilling: BillingConfig = { billingUrl: "https://console.cloud.google.com/billing", diff --git a/packages/cli/src/gcp/gcp.ts b/packages/cli/src/gcp/gcp.ts index 5e0a6f1c..ca78a156 100644 --- a/packages/cli/src/gcp/gcp.ts +++ b/packages/cli/src/gcp/gcp.ts @@ -1,14 +1,14 @@ // gcp/gcp.ts — Core GCP Compute Engine provider: gcloud CLI wrapper, auth, provisioning, SSH import type { CloudInstance, VMConnection } from "../history.js"; -import type { CloudInitTier } from "../shared/agents"; +import type { CloudInitTier } from "../shared/agents.js"; import { existsSync, readFileSync, writeFileSync } from "node:fs"; import { join, normalize } from "node:path"; import { isString, toObjectArray } from "@openrouter/spawn-shared"; -import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance"; -import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init"; -import { getUserHome } from "../shared/paths"; +import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js"; +import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js"; +import { getUserHome } from "../shared/paths.js"; import { asyncTryCatch, tryCatch } from "../shared/result.js"; import { killWithTimeout, @@ -17,8 +17,8 @@ import { waitForSsh as sharedWaitForSsh, sleep, spawnInteractive, -} from "../shared/ssh"; -import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys"; +} from "../shared/ssh.js"; +import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys.js"; import { getServerNameFromEnv, logError, @@ -34,8 +34,8 @@ import { sanitizeTermValue, selectFromList, shellQuote, -} from "../shared/ui"; -import { gcpBilling } from "./billing"; +} from "../shared/ui.js"; +import { gcpBilling } from "./billing.js"; const DASHBOARD_URL = "https://console.cloud.google.com/compute/instances"; diff --git a/packages/cli/src/gcp/main.ts b/packages/cli/src/gcp/main.ts index 5b787e83..31a93a48 100644 --- a/packages/cli/src/gcp/main.ts +++ b/packages/cli/src/gcp/main.ts @@ -2,11 +2,11 @@ // gcp/main.ts — Orchestrator: deploys an agent on GCP Compute Engine -import type { CloudOrchestrator } from "../shared/orchestrate"; +import type { CloudOrchestrator } from "../shared/orchestrate.js"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { runOrchestration } from "../shared/orchestrate"; -import { agents, resolveAgent } from "./agents"; +import { runOrchestration } from "../shared/orchestrate.js"; +import { agents, resolveAgent } from "./agents.js"; import { authenticate, checkBillingEnabled, @@ -24,7 +24,7 @@ import { uploadFile, waitForCloudInit, waitForSshOnly, -} from "./gcp"; +} from "./gcp.js"; async function main() { const agentName = process.argv[2]; diff --git a/packages/cli/src/hetzner/agents.ts b/packages/cli/src/hetzner/agents.ts index 700bca93..4a87f20f 100644 --- a/packages/cli/src/hetzner/agents.ts +++ b/packages/cli/src/hetzner/agents.ts @@ -1,7 +1,7 @@ // hetzner/agents.ts — Hetzner Cloud agent configs (thin wrapper over shared) -import { createCloudAgents } from "../shared/agent-setup"; -import { downloadFile, runServer, uploadFile } from "./hetzner"; +import { createCloudAgents } from "../shared/agent-setup.js"; +import { downloadFile, runServer, uploadFile } from "./hetzner.js"; export const { agents, resolveAgent } = createCloudAgents({ runServer, diff --git a/packages/cli/src/hetzner/billing.ts b/packages/cli/src/hetzner/billing.ts index 72603a64..180fadce 100644 --- a/packages/cli/src/hetzner/billing.ts +++ b/packages/cli/src/hetzner/billing.ts @@ -1,4 +1,4 @@ -import type { BillingConfig } from "../shared/billing-guidance"; +import type { BillingConfig } from "../shared/billing-guidance.js"; export const hetznerBilling: BillingConfig = { billingUrl: "https://console.hetzner.cloud/", diff --git a/packages/cli/src/hetzner/hetzner.ts b/packages/cli/src/hetzner/hetzner.ts index f44a6465..734b0609 100644 --- a/packages/cli/src/hetzner/hetzner.ts +++ b/packages/cli/src/hetzner/hetzner.ts @@ -1,15 +1,15 @@ // hetzner/hetzner.ts — Core Hetzner Cloud provider: API, auth, SSH, provisioning import type { CloudInstance, VMConnection } from "../history.js"; -import type { CloudInitTier } from "../shared/agents"; +import type { CloudInitTier } from "../shared/agents.js"; import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { dirname, normalize } from "node:path"; import { getErrorMessage, isNumber, isString, toObjectArray, toRecord } from "@openrouter/spawn-shared"; -import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance"; -import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init"; -import { parseJsonObj } from "../shared/parse"; -import { getSpawnCloudConfigPath } from "../shared/paths"; +import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js"; +import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js"; +import { parseJsonObj } from "../shared/parse.js"; +import { getSpawnCloudConfigPath } from "../shared/paths.js"; import { asyncTryCatch, asyncTryCatchIf, isNetworkError, unwrapOr } from "../shared/result.js"; import { killWithTimeout, @@ -19,8 +19,8 @@ import { sleep, spawnInteractive, waitForSshSnapshotBoot, -} from "../shared/ssh"; -import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys"; +} from "../shared/ssh.js"; +import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys.js"; import { getServerNameFromEnv, jsonEscape, @@ -38,8 +38,8 @@ import { selectFromList, shellQuote, validateRegionName, -} from "../shared/ui"; -import { hetznerBilling } from "./billing"; +} from "../shared/ui.js"; +import { hetznerBilling } from "./billing.js"; const HETZNER_API_BASE = "https://api.hetzner.cloud/v1"; const HETZNER_DASHBOARD_URL = "https://console.hetzner.cloud/"; diff --git a/packages/cli/src/hetzner/main.ts b/packages/cli/src/hetzner/main.ts index 7a780818..5806d210 100644 --- a/packages/cli/src/hetzner/main.ts +++ b/packages/cli/src/hetzner/main.ts @@ -2,11 +2,11 @@ // hetzner/main.ts — Orchestrator: deploys an agent on Hetzner Cloud -import type { CloudOrchestrator } from "../shared/orchestrate"; +import type { CloudOrchestrator } from "../shared/orchestrate.js"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { runOrchestration } from "../shared/orchestrate"; -import { agents, resolveAgent } from "./agents"; +import { runOrchestration } from "../shared/orchestrate.js"; +import { agents, resolveAgent } from "./agents.js"; import { createServer as createHetznerServer, downloadFile, @@ -23,7 +23,7 @@ import { uploadFile, waitForCloudInit, waitForSshOnly, -} from "./hetzner"; +} from "./hetzner.js"; async function main() { const agentName = process.argv[2]; diff --git a/packages/cli/src/local/agents.ts b/packages/cli/src/local/agents.ts index cb96f793..f2e7ec7c 100644 --- a/packages/cli/src/local/agents.ts +++ b/packages/cli/src/local/agents.ts @@ -1,7 +1,7 @@ // local/agents.ts — Local machine agent configs (thin wrapper over shared) -import { createCloudAgents } from "../shared/agent-setup"; -import { downloadFile, runLocal, uploadFile } from "./local"; +import { createCloudAgents } from "../shared/agent-setup.js"; +import { downloadFile, runLocal, uploadFile } from "./local.js"; export const { agents, resolveAgent } = createCloudAgents({ runServer: runLocal, diff --git a/packages/cli/src/local/local.ts b/packages/cli/src/local/local.ts index 2a412164..a51412bf 100644 --- a/packages/cli/src/local/local.ts +++ b/packages/cli/src/local/local.ts @@ -2,9 +2,9 @@ import { copyFileSync, mkdirSync } from "node:fs"; import { dirname } from "node:path"; -import { getUserHome } from "../shared/paths"; -import { getLocalShell } from "../shared/shell"; -import { spawnInteractive } from "../shared/ssh"; +import { getUserHome } from "../shared/paths.js"; +import { getLocalShell } from "../shared/shell.js"; +import { spawnInteractive } from "../shared/ssh.js"; // ─── Execution ─────────────────────────────────────────────────────────────── diff --git a/packages/cli/src/local/main.ts b/packages/cli/src/local/main.ts index 29f8abdf..4bd93244 100644 --- a/packages/cli/src/local/main.ts +++ b/packages/cli/src/local/main.ts @@ -2,12 +2,12 @@ // local/main.ts — Orchestrator: deploys an agent on the local machine -import type { CloudOrchestrator } from "../shared/orchestrate"; +import type { CloudOrchestrator } from "../shared/orchestrate.js"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { runOrchestration } from "../shared/orchestrate"; -import { agents, resolveAgent } from "./agents"; -import { downloadFile, interactiveSession, runLocal, uploadFile } from "./local"; +import { runOrchestration } from "../shared/orchestrate.js"; +import { agents, resolveAgent } from "./agents.js"; +import { downloadFile, interactiveSession, runLocal, uploadFile } from "./local.js"; async function main() { const agentName = process.argv[2]; diff --git a/packages/cli/src/shared/agent-setup.ts b/packages/cli/src/shared/agent-setup.ts index c147a1a6..785b888e 100644 --- a/packages/cli/src/shared/agent-setup.ts +++ b/packages/cli/src/shared/agent-setup.ts @@ -1,15 +1,15 @@ // shared/agent-setup.ts — Shared agent helpers + definitions for SSH-based clouds // Cloud-agnostic: receives runServer/uploadFile via CloudRunner interface. -import type { AgentConfig } from "./agents"; -import type { Result } from "./ui"; +import type { AgentConfig } from "./agents.js"; +import type { Result } from "./ui.js"; import { unlinkSync, writeFileSync } from "node:fs"; import { join, normalize } from "node:path"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { getTmpDir } from "./paths"; +import { getTmpDir } from "./paths.js"; import { asyncTryCatch, asyncTryCatchIf, isOperationalError, tryCatchIf } from "./result.js"; -import { Err, jsonEscape, logError, logInfo, logStep, logWarn, Ok, prompt, shellQuote, withRetry } from "./ui"; +import { Err, jsonEscape, logError, logInfo, logStep, logWarn, Ok, prompt, shellQuote, withRetry } from "./ui.js"; /** * Wrap an SSH-based async operation into a Result for use with withRetry. diff --git a/packages/cli/src/shared/agent-tarball.ts b/packages/cli/src/shared/agent-tarball.ts index 1c358fb6..0ff2b144 100644 --- a/packages/cli/src/shared/agent-tarball.ts +++ b/packages/cli/src/shared/agent-tarball.ts @@ -2,15 +2,15 @@ // Downloads a nightly tarball from GitHub Releases and extracts it on the remote VM. // Falls back gracefully (returns false) on any failure so the caller can use live install. -import type { CloudRunner } from "./agent-setup"; +import type { CloudRunner } from "./agent-setup.js"; import { unlinkSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { getErrorMessage } from "@openrouter/spawn-shared"; import * as v from "valibot"; -import { asyncTryCatch, tryCatch } from "./result"; -import { logDebug, logInfo, logStep, logWarn } from "./ui"; +import { asyncTryCatch, tryCatch } from "./result.js"; +import { logDebug, logInfo, logStep, logWarn } from "./ui.js"; const REPO = "OpenRouterTeam/spawn"; diff --git a/packages/cli/src/shared/agents.ts b/packages/cli/src/shared/agents.ts index 28c60ea0..68ba5351 100644 --- a/packages/cli/src/shared/agents.ts +++ b/packages/cli/src/shared/agents.ts @@ -1,6 +1,6 @@ // shared/agents.ts — AgentConfig interface + shared helpers (cloud-agnostic) -import { logError, shellQuote } from "./ui"; +import { logError, shellQuote } from "./ui.js"; // ─── Types ─────────────────────────────────────────────────────────────────── diff --git a/packages/cli/src/shared/billing-guidance.ts b/packages/cli/src/shared/billing-guidance.ts index b8195322..cd27c29f 100644 --- a/packages/cli/src/shared/billing-guidance.ts +++ b/packages/cli/src/shared/billing-guidance.ts @@ -1,7 +1,7 @@ // shared/billing-guidance.ts — Billing error detection, guidance, and browser-based retry flow import { asyncTryCatch, unwrapOr } from "./result.js"; -import { logInfo, logStep, logWarn, openBrowser, prompt } from "./ui"; +import { logInfo, logStep, logWarn, openBrowser, prompt } from "./ui.js"; // ─── BillingConfig interface ──────────────────────────────────────────────── diff --git a/packages/cli/src/shared/cloud-init.ts b/packages/cli/src/shared/cloud-init.ts index 06fccb9c..43b85017 100644 --- a/packages/cli/src/shared/cloud-init.ts +++ b/packages/cli/src/shared/cloud-init.ts @@ -1,6 +1,6 @@ // shared/cloud-init.ts — Tier-based cloud-init package selection -import type { CloudInitTier } from "./agents"; +import type { CloudInitTier } from "./agents.js"; const MINIMAL = [ "curl", diff --git a/packages/cli/src/shared/oauth.ts b/packages/cli/src/shared/oauth.ts index 35359f69..3bdc45b5 100644 --- a/packages/cli/src/shared/oauth.ts +++ b/packages/cli/src/shared/oauth.ts @@ -4,11 +4,11 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import { dirname } from "node:path"; import { getErrorMessage, isString } from "@openrouter/spawn-shared"; import * as v from "valibot"; -import { OAUTH_CODE_REGEX } from "./oauth-constants"; -import { parseJsonObj, parseJsonWith } from "./parse"; -import { getSpawnCloudConfigPath } from "./paths"; +import { OAUTH_CODE_REGEX } from "./oauth-constants.js"; +import { parseJsonObj, parseJsonWith } from "./parse.js"; +import { getSpawnCloudConfigPath } from "./paths.js"; import { asyncTryCatchIf, isFileError, isNetworkError, tryCatch } from "./result.js"; -import { logDebug, logError, logInfo, logStep, logWarn, openBrowser, prompt, retryOrQuit } from "./ui"; +import { logDebug, logError, logInfo, logStep, logWarn, openBrowser, prompt, retryOrQuit } from "./ui.js"; // ─── Schemas ───────────────────────────────────────────────────────────────── diff --git a/packages/cli/src/shared/orchestrate.ts b/packages/cli/src/shared/orchestrate.ts index 98e5e557..7ad94d2f 100644 --- a/packages/cli/src/shared/orchestrate.ts +++ b/packages/cli/src/shared/orchestrate.ts @@ -2,23 +2,23 @@ // Each cloud implements CloudOrchestrator and calls runOrchestration(). import type { VMConnection } from "../history.js"; -import type { CloudRunner } from "./agent-setup"; -import type { AgentConfig } from "./agents"; -import type { SshTunnelHandle } from "./ssh"; +import type { CloudRunner } from "./agent-setup.js"; +import type { AgentConfig } from "./agents.js"; +import type { SshTunnelHandle } from "./ssh.js"; import { readFileSync } from "node:fs"; import { getErrorMessage } from "@openrouter/spawn-shared"; import * as v from "valibot"; import { generateSpawnId, saveLaunchCmd, saveMetadata, saveSpawnRecord } from "../history.js"; -import { offerGithubAuth, setupAutoUpdate, wrapSshCall } from "./agent-setup"; -import { downloadTarballLocally, tryTarballInstall, uploadAndExtractTarball } from "./agent-tarball"; -import { generateEnvConfig } from "./agents"; -import { getOrPromptApiKey } from "./oauth"; -import { getSpawnPreferencesPath } from "./paths"; +import { offerGithubAuth, setupAutoUpdate, wrapSshCall } from "./agent-setup.js"; +import { downloadTarballLocally, tryTarballInstall, uploadAndExtractTarball } from "./agent-tarball.js"; +import { generateEnvConfig } from "./agents.js"; +import { getOrPromptApiKey } from "./oauth.js"; +import { getSpawnPreferencesPath } from "./paths.js"; import { asyncTryCatch, asyncTryCatchIf, isOperationalError, tryCatch } from "./result.js"; -import { isWindows } from "./shell"; -import { sleep, startSshTunnel } from "./ssh"; -import { ensureSshKeys, getSshKeyOpts } from "./ssh-keys"; +import { isWindows } from "./shell.js"; +import { sleep, startSshTunnel } from "./ssh.js"; +import { ensureSshKeys, getSshKeyOpts } from "./ssh-keys.js"; import { logDebug, logError, @@ -32,7 +32,7 @@ import { shellQuote, validateModelId, withRetry, -} from "./ui"; +} from "./ui.js"; export interface CloudOrchestrator { cloudName: string; diff --git a/packages/cli/src/shared/ssh-keys.ts b/packages/cli/src/shared/ssh-keys.ts index ab815b31..cbf39c53 100644 --- a/packages/cli/src/shared/ssh-keys.ts +++ b/packages/cli/src/shared/ssh-keys.ts @@ -1,9 +1,9 @@ // shared/ssh-keys.ts — SSH key discovery, selection, and generation import { existsSync, mkdirSync, readdirSync } from "node:fs"; -import { getSshDir } from "./paths"; +import { getSshDir } from "./paths.js"; import { isFileError, tryCatch, tryCatchIf, unwrapOr } from "./result.js"; -import { logInfo, logStep } from "./ui"; +import { logInfo, logStep } from "./ui.js"; // ─── Types ────────────────────────────────────────────────────────────────── diff --git a/packages/cli/src/shared/ssh.ts b/packages/cli/src/shared/ssh.ts index 31600ffe..439d2626 100644 --- a/packages/cli/src/shared/ssh.ts +++ b/packages/cli/src/shared/ssh.ts @@ -3,7 +3,7 @@ import { spawnSync as nodeSpawnSync } from "node:child_process"; import { connect } from "node:net"; import { asyncTryCatch, tryCatch } from "./result.js"; -import { logError, logInfo, logStep, logStepDone, logStepInline } from "./ui"; +import { logError, logInfo, logStep, logStepDone, logStepInline } from "./ui.js"; // ─── Shared SSH Options ────────────────────────────────────────────────────── diff --git a/packages/cli/src/shared/ui.ts b/packages/cli/src/shared/ui.ts index 542e0f2c..7ac5c83e 100644 --- a/packages/cli/src/shared/ui.ts +++ b/packages/cli/src/shared/ui.ts @@ -4,8 +4,8 @@ import { readFileSync } from "node:fs"; import * as p from "@clack/prompts"; import { isString } from "@openrouter/spawn-shared"; -import { parseJsonObj } from "./parse"; -import { getSpawnCloudConfigPath } from "./paths"; +import { parseJsonObj } from "./parse.js"; +import { getSpawnCloudConfigPath } from "./paths.js"; import { asyncTryCatch, tryCatch, unwrapOr } from "./result.js"; const RED = "\x1b[0;31m"; @@ -218,9 +218,9 @@ export async function retryOrQuit(message: string): Promise { // ─── Result-based retry ──────────────────────────────────────────────── -import type { Result } from "./result"; +import type { Result } from "./result.js"; -export { Err, Ok, type Result } from "./result"; +export { Err, Ok, type Result } from "./result.js"; /** * Phase-aware retry helper using the Result monad. diff --git a/packages/cli/src/sprite/agents.ts b/packages/cli/src/sprite/agents.ts index 5620bcbd..78d9cdeb 100644 --- a/packages/cli/src/sprite/agents.ts +++ b/packages/cli/src/sprite/agents.ts @@ -1,7 +1,7 @@ // sprite/agents.ts — Sprite agent configs (thin wrapper over shared) -import { createCloudAgents } from "../shared/agent-setup"; -import { downloadFileSprite, runSprite, uploadFileSprite } from "./sprite"; +import { createCloudAgents } from "../shared/agent-setup.js"; +import { downloadFileSprite, runSprite, uploadFileSprite } from "./sprite.js"; export const { agents, resolveAgent } = createCloudAgents({ runServer: runSprite, diff --git a/packages/cli/src/sprite/main.ts b/packages/cli/src/sprite/main.ts index 52bd85b3..10c545ae 100644 --- a/packages/cli/src/sprite/main.ts +++ b/packages/cli/src/sprite/main.ts @@ -2,11 +2,11 @@ // sprite/main.ts — Orchestrator: deploys an agent on Sprite -import type { CloudOrchestrator } from "../shared/orchestrate"; +import type { CloudOrchestrator } from "../shared/orchestrate.js"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { runOrchestration } from "../shared/orchestrate"; -import { agents, resolveAgent } from "./agents"; +import { runOrchestration } from "../shared/orchestrate.js"; +import { agents, resolveAgent } from "./agents.js"; import { createSprite, downloadFileSprite, @@ -21,7 +21,7 @@ import { setupShellEnvironment, uploadFileSprite, verifySpriteConnectivity, -} from "./sprite"; +} from "./sprite.js"; async function main() { const agentName = process.argv[2]; diff --git a/packages/cli/src/sprite/sprite.ts b/packages/cli/src/sprite/sprite.ts index d7def0da..f1cb979f 100644 --- a/packages/cli/src/sprite/sprite.ts +++ b/packages/cli/src/sprite/sprite.ts @@ -5,9 +5,9 @@ import type { VMConnection } from "../history.js"; import { existsSync } from "node:fs"; import { join, normalize } from "node:path"; import { getErrorMessage } from "@openrouter/spawn-shared"; -import { getUserHome } from "../shared/paths"; +import { getUserHome } from "../shared/paths.js"; import { asyncTryCatch } from "../shared/result.js"; -import { killWithTimeout, sleep, spawnInteractive } from "../shared/ssh"; +import { killWithTimeout, sleep, spawnInteractive } from "../shared/ssh.js"; import { getServerNameFromEnv, logError, @@ -17,7 +17,7 @@ import { logStepInline, logWarn, promptSpawnNameShared, -} from "../shared/ui"; +} from "../shared/ui.js"; // ─── Configurable Constants ────────────────────────────────────────────────── diff --git a/packages/cli/src/update-check.ts b/packages/cli/src/update-check.ts index b0d824d7..7583b4c0 100644 --- a/packages/cli/src/update-check.ts +++ b/packages/cli/src/update-check.ts @@ -9,11 +9,11 @@ import { getErrorMessage, hasStatus } from "@openrouter/spawn-shared"; import pc from "picocolors"; import pkg from "../package.json" with { type: "json" }; import { RAW_BASE, SPAWN_CDN, VERSION_URL } from "./manifest.js"; -import { PkgVersionSchema, parseJsonWith } from "./shared/parse"; -import { getUpdateCheckedPath, getUpdateFailedPath } from "./shared/paths"; -import { asyncTryCatchIf, isFileError, isNetworkError, tryCatch, tryCatchIf, unwrapOr } from "./shared/result"; -import { getInstallCmd, getInstallScriptUrl, getWhichCommand, isWindows } from "./shared/shell"; -import { logDebug, logWarn } from "./shared/ui"; +import { PkgVersionSchema, parseJsonWith } from "./shared/parse.js"; +import { getUpdateCheckedPath, getUpdateFailedPath } from "./shared/paths.js"; +import { asyncTryCatchIf, isFileError, isNetworkError, tryCatch, tryCatchIf, unwrapOr } from "./shared/result.js"; +import { getInstallCmd, getInstallScriptUrl, getWhichCommand, isWindows } from "./shared/shell.js"; +import { logDebug, logWarn } from "./shared/ui.js"; const VERSION = pkg.version;