From 49c7629c17abea6fb85f4a931da325c0dc450558 Mon Sep 17 00:00:00 2001 From: rgarcia <72655+rgarcia@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:15:42 +0000 Subject: [PATCH 1/2] Fix ESM import specifiers in cua-cli and smoke-test the bin in CI packages/cli used extensionless relative imports, which compile cleanly under moduleResolution Bundler and work in vitest, but fail at runtime with ERR_MODULE_NOT_FOUND when Node executes the published dist. Add .js extensions to all relative imports and switch the package to module/moduleResolution NodeNext so tsc enforces them from now on. Run the packed-tarball bin smoke test in the cli-unit CI job (mirrors release-cua-cli.yml) so the real binary is executed on every PR instead of only at release time. --- .github/workflows/ci.yml | 14 ++++++++++++++ packages/cli/src/action/harness-runner.ts | 6 +++--- packages/cli/src/action/result.ts | 2 +- packages/cli/src/cli-harness.ts | 22 +++++++++++----------- packages/cli/src/cli.ts | 6 +++--- packages/cli/src/harness-named-sessions.ts | 2 +- packages/cli/src/print.ts | 8 ++++---- packages/cli/src/tui/main.ts | 20 ++++++++++---------- packages/cli/src/tui/message-list.ts | 2 +- packages/cli/src/tui/screenshot-widget.ts | 2 +- packages/cli/src/tui/status-line.ts | 2 +- packages/cli/src/tui/telemetry-footer.ts | 2 +- packages/cli/tsconfig.json | 4 +++- 13 files changed, 54 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fcef7a..798e6e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,20 @@ jobs: env: PTYWRIGHT_REQUIRED: "1" run: npm test --workspace @onkernel/cua-cli + - name: Build cua-cli + run: npm run build --workspace @onkernel/cua-cli + - name: Pack tarball + run: npm pack --workspace @onkernel/cua-cli --pack-destination "$RUNNER_TEMP" + - name: CLI bin smoke test + run: | + SMOKE_DIR=$(mktemp -d) + cd "$SMOKE_DIR" + npm init -y > /dev/null + npm install "$RUNNER_TEMP"/onkernel-cua-cli-*.tgz + OUTPUT=$(./node_modules/.bin/cua --help) + echo "$OUTPUT" + echo "$OUTPUT" | grep -q "Usage:" + echo "$OUTPUT" | grep -q "cua \[options\] \[prompt\.\.\.\]" integration: runs-on: ubuntu-latest diff --git a/packages/cli/src/action/harness-runner.ts b/packages/cli/src/action/harness-runner.ts index da1f68d..a9344f5 100644 --- a/packages/cli/src/action/harness-runner.ts +++ b/packages/cli/src/action/harness-runner.ts @@ -2,9 +2,9 @@ import type { AgentHarnessEvent, CuaAgentHarness, Session } from "@onkernel/cua- import type { AssistantMessage, ImageContent } from "@onkernel/cua-ai"; import { writeFile } from "node:fs/promises"; import { stderr, stdout } from "node:process"; -import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser"; -import { type ActionRequest, buildPrompt, DEFAULT_MAX_TURNS } from "./prompts"; -import { type ActionEventInfo, type ActionResult, exitCodeFor, formatCompact, parseResult } from "./result"; +import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser.js"; +import { type ActionRequest, buildPrompt, DEFAULT_MAX_TURNS } from "./prompts.js"; +import { type ActionEventInfo, type ActionResult, exitCodeFor, formatCompact, parseResult } from "./result.js"; export interface HarnessRunOptions { harness: CuaAgentHarness; diff --git a/packages/cli/src/action/result.ts b/packages/cli/src/action/result.ts index 61b81e3..dcaaad1 100644 --- a/packages/cli/src/action/result.ts +++ b/packages/cli/src/action/result.ts @@ -1,4 +1,4 @@ -import type { ActionType } from "./prompts"; +import type { ActionType } from "./prompts.js"; export type Status = "ok" | "not_found" | "error" | "timeout"; diff --git a/packages/cli/src/cli-harness.ts b/packages/cli/src/cli-harness.ts index 5182efa..72e2a35 100644 --- a/packages/cli/src/cli-harness.ts +++ b/packages/cli/src/cli-harness.ts @@ -13,15 +13,15 @@ import { } from "@onkernel/cua-ai"; import { parseArgs } from "node:util"; import { stderr, stdout } from "node:process"; -import type { CuaBrowserHandle } from "./harness-browser"; +import type { CuaBrowserHandle } from "./harness-browser.js"; import { type ActionRequest, type ActionType, -} from "./action/prompts"; -import { runAction, emitCompact } from "./action/harness-runner"; -import { buildCuaHarness } from "./harness"; -import { provisionBrowser } from "./harness-browser"; -import { DEFAULT_CUA_MODEL_REF, listSupportedModels, resolveCuaModelRef } from "./harness-models"; +} from "./action/prompts.js"; +import { runAction, emitCompact } from "./action/harness-runner.js"; +import { buildCuaHarness } from "./harness.js"; +import { provisionBrowser } from "./harness-browser.js"; +import { DEFAULT_CUA_MODEL_REF, listSupportedModels, resolveCuaModelRef } from "./harness-models.js"; import { attachNamedSession, formatRelativeAge, @@ -32,7 +32,7 @@ import { startNamedSession, stopNamedSession, validateSlug, -} from "./harness-named-sessions"; +} from "./harness-named-sessions.js"; import { appendBrowserEntry, createSession, @@ -42,9 +42,9 @@ import { openSession, readMetadataFromFile, resolveSessionRef, -} from "./harness-sessions"; -import { discoverCuaSkills } from "./harness-skills"; -import { runPrint } from "./print"; +} from "./harness-sessions.js"; +import { discoverCuaSkills } from "./harness-skills.js"; +import { runPrint } from "./print.js"; const MODELS_HELP = `cua models — list supported -m/--model values @@ -498,7 +498,7 @@ export async function runInteractiveCommand( flags: HarnessCliFlags, ): Promise { const runtime = await setupHarnessRuntime(flags); - const { runInteractive } = await import("./tui/main"); + const { runInteractive } = await import("./tui/main.js"); try { return await runInteractive({ cwd: process.cwd(), diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index b3fae70..a271f8a 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import { stderr, stdout } from "node:process"; import { parseArgs } from "node:util"; -import { type ActionType } from "./action/prompts"; +import { type ActionType } from "./action/prompts.js"; import { runActionCommand, runInteractiveCommand, @@ -9,8 +9,8 @@ import { runPrintCommand, runSessionSubcommand as runSessionSubcommandHarness, type HarnessCliFlags, -} from "./cli-harness"; -import { DEFAULT_CUA_MODEL_REF } from "./harness-models"; +} from "./cli-harness.js"; +import { DEFAULT_CUA_MODEL_REF } from "./harness-models.js"; const HELP = `cua — Kernel-cloud-browser computer-use agent diff --git a/packages/cli/src/harness-named-sessions.ts b/packages/cli/src/harness-named-sessions.ts index 9b703d3..54786f7 100644 --- a/packages/cli/src/harness-named-sessions.ts +++ b/packages/cli/src/harness-named-sessions.ts @@ -3,7 +3,7 @@ import Kernel from "@onkernel/sdk"; import { mkdir, readdir, readFile, stat, unlink, writeFile } from "node:fs/promises"; import { homedir } from "node:os"; import { join } from "node:path"; -import { createKernelClient, resolveProfileId } from "./harness-browser"; +import { createKernelClient, resolveProfileId } from "./harness-browser.js"; /** * Named sessions: durable, slug-keyed pointers to a Kernel cloud browser diff --git a/packages/cli/src/print.ts b/packages/cli/src/print.ts index 8d244a9..6158c0d 100644 --- a/packages/cli/src/print.ts +++ b/packages/cli/src/print.ts @@ -1,10 +1,10 @@ import type { AgentHarnessEvent, CuaAgentHarness, Session, Skill } from "@onkernel/cua-agent"; import type { ImageContent } from "@onkernel/cua-ai"; import { stderr, stdout } from "node:process"; -import { captureScreenshot } from "./harness-browser"; -import type { CuaBrowserHandle } from "./harness-browser"; -import { attachHarnessJsonlSink } from "./output/harness-jsonl"; -import { parseSkillInvocation } from "./harness-skills"; +import { captureScreenshot } from "./harness-browser.js"; +import type { CuaBrowserHandle } from "./harness-browser.js"; +import { attachHarnessJsonlSink } from "./output/harness-jsonl.js"; +import { parseSkillInvocation } from "./harness-skills.js"; export interface RunPrintOptions { harness: CuaAgentHarness; diff --git a/packages/cli/src/tui/main.ts b/packages/cli/src/tui/main.ts index a186a69..a4c612d 100644 --- a/packages/cli/src/tui/main.ts +++ b/packages/cli/src/tui/main.ts @@ -21,16 +21,16 @@ import { TUI_KEYBINDINGS, } from "@earendil-works/pi-tui"; import type { ImageContent, Model } from "@onkernel/cua-ai"; -import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser"; -import { resolveCuaModelRef } from "../harness-models"; -import { openTuiDebugLog } from "./debug-log"; -import { applyAndSummarizeImageProtocol } from "./diagnostics"; -import { type AssistantBuffer, MessageList } from "./message-list"; -import { ScreenshotWidget } from "./screenshot-widget"; -import { buildAutocompleteProvider, parseSlashCommand } from "./slash-commands"; -import { StatusLine } from "./status-line"; -import { TelemetryFooter } from "./telemetry-footer"; -import { colors, editorTheme } from "./themes"; +import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser.js"; +import { resolveCuaModelRef } from "../harness-models.js"; +import { openTuiDebugLog } from "./debug-log.js"; +import { applyAndSummarizeImageProtocol } from "./diagnostics.js"; +import { type AssistantBuffer, MessageList } from "./message-list.js"; +import { ScreenshotWidget } from "./screenshot-widget.js"; +import { buildAutocompleteProvider, parseSlashCommand } from "./slash-commands.js"; +import { StatusLine } from "./status-line.js"; +import { TelemetryFooter } from "./telemetry-footer.js"; +import { colors, editorTheme } from "./themes.js"; export interface InteractiveOptions { cwd: string; diff --git a/packages/cli/src/tui/message-list.ts b/packages/cli/src/tui/message-list.ts index f567942..72ceef5 100644 --- a/packages/cli/src/tui/message-list.ts +++ b/packages/cli/src/tui/message-list.ts @@ -1,5 +1,5 @@ import { Container, Markdown, Text } from "@earendil-works/pi-tui"; -import { colors, markdownTheme } from "./themes"; +import { colors, markdownTheme } from "./themes.js"; /** * Append-only chat log of user prompts, assistant text, tool-call summaries, diff --git a/packages/cli/src/tui/screenshot-widget.ts b/packages/cli/src/tui/screenshot-widget.ts index 34cfac6..707aa02 100644 --- a/packages/cli/src/tui/screenshot-widget.ts +++ b/packages/cli/src/tui/screenshot-widget.ts @@ -1,5 +1,5 @@ import { Container, Image, allocateImageId } from "@earendil-works/pi-tui"; -import { imageTheme } from "./themes"; +import { imageTheme } from "./themes.js"; const MAX_WIDTH_CELLS = 60; diff --git a/packages/cli/src/tui/status-line.ts b/packages/cli/src/tui/status-line.ts index d7c9720..e5548cf 100644 --- a/packages/cli/src/tui/status-line.ts +++ b/packages/cli/src/tui/status-line.ts @@ -1,5 +1,5 @@ import { Text, hyperlink } from "@earendil-works/pi-tui"; -import { colors } from "./themes"; +import { colors } from "./themes.js"; export interface StatusLineState { model: string; diff --git a/packages/cli/src/tui/telemetry-footer.ts b/packages/cli/src/tui/telemetry-footer.ts index aedc8f1..a2ff145 100644 --- a/packages/cli/src/tui/telemetry-footer.ts +++ b/packages/cli/src/tui/telemetry-footer.ts @@ -1,5 +1,5 @@ import { type Component, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui"; -import { colors } from "./themes"; +import { colors } from "./themes.js"; export interface TelemetryFooterState { provider?: string; diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 95f9f63..af0be7c 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -2,7 +2,9 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "./dist", - "rootDir": "./src" + "rootDir": "./src", + "module": "NodeNext", + "moduleResolution": "NodeNext" }, "include": ["src/**/*"], "references": [ From 1e0664bfcb688eee6aa1ec801923f62aaa1d022a Mon Sep 17 00:00:00 2001 From: rgarcia <72655+rgarcia@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:30:20 +0000 Subject: [PATCH 2/2] Bundle cua-cli with tsdown instead of adding import extensions Revert the .js-extension sweep and NodeNext switch; bundle the cli with tsdown (matching cua-ai and cua-agent) so extensionless relative imports keep working and the published dist runs under Node ESM. tsc -b now does declaration-only emit to dist-tsc for typechecking, tsdown owns dist/, and the root build bundles the cli after typechecking. --- package-lock.json | 1 + package.json | 2 +- packages/cli/package.json | 9 +++++---- packages/cli/src/action/harness-runner.ts | 6 +++--- packages/cli/src/action/result.ts | 2 +- packages/cli/src/cli-harness.ts | 22 +++++++++++----------- packages/cli/src/cli.ts | 6 +++--- packages/cli/src/harness-named-sessions.ts | 2 +- packages/cli/src/print.ts | 8 ++++---- packages/cli/src/tui/main.ts | 20 ++++++++++---------- packages/cli/src/tui/message-list.ts | 2 +- packages/cli/src/tui/screenshot-widget.ts | 2 +- packages/cli/src/tui/status-line.ts | 2 +- packages/cli/src/tui/telemetry-footer.ts | 2 +- packages/cli/tsconfig.build.json | 15 +++++++++++++++ packages/cli/tsconfig.json | 12 +----------- packages/cli/tsdown.config.ts | 11 +++++++++++ 17 files changed, 71 insertions(+), 53 deletions(-) create mode 100644 packages/cli/tsconfig.build.json create mode 100644 packages/cli/tsdown.config.ts diff --git a/package-lock.json b/package-lock.json index beae503..d1618ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6116,6 +6116,7 @@ }, "devDependencies": { "@onkernel/ptywright": "0.1.0", + "tsdown": "^0.22.2", "vitest": "^3.2.4" }, "engines": { diff --git a/package.json b/package.json index a189916..1f5397e 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "packages/cli" ], "scripts": { - "build": "npm run build --workspace @onkernel/cua-ai && npm run build --workspace @onkernel/cua-agent && tsc -b && npm run build:native --workspace @onkernel/ptywright --if-present", + "build": "npm run build --workspace @onkernel/cua-ai && npm run build --workspace @onkernel/cua-agent && tsc -b && npm run build --workspace @onkernel/cua-cli && npm run build:native --workspace @onkernel/ptywright --if-present", "build:cli": "npm run build --workspace @onkernel/cua-cli", "dev": "tsc -b --watch", "typecheck": "npm run build --workspace @onkernel/cua-ai && npm run build --workspace @onkernel/cua-agent && tsc -b", diff --git a/packages/cli/package.json b/packages/cli/package.json index 061eeca..4a43a43 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -5,7 +5,6 @@ "license": "MIT", "type": "module", "main": "./dist/cli.js", - "types": "./dist/cli.d.ts", "repository": { "type": "git", "url": "git+https://github.com/kernel/cua.git", @@ -29,9 +28,10 @@ "node": ">=22.19.0" }, "scripts": { - "build": "tsc -b && chmod +x dist/cli.js", - "clean": "tsc -b --clean", - "test": "vitest --run" + "build": "tsdown && chmod +x dist/cli.js", + "clean": "tsc -b --clean && rm -rf dist dist-tsc", + "test": "vitest --run", + "typecheck": "tsc -b" }, "dependencies": { "@earendil-works/pi-coding-agent": "0.79.1", @@ -42,6 +42,7 @@ }, "devDependencies": { "@onkernel/ptywright": "0.1.0", + "tsdown": "^0.22.2", "vitest": "^3.2.4" } } diff --git a/packages/cli/src/action/harness-runner.ts b/packages/cli/src/action/harness-runner.ts index a9344f5..da1f68d 100644 --- a/packages/cli/src/action/harness-runner.ts +++ b/packages/cli/src/action/harness-runner.ts @@ -2,9 +2,9 @@ import type { AgentHarnessEvent, CuaAgentHarness, Session } from "@onkernel/cua- import type { AssistantMessage, ImageContent } from "@onkernel/cua-ai"; import { writeFile } from "node:fs/promises"; import { stderr, stdout } from "node:process"; -import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser.js"; -import { type ActionRequest, buildPrompt, DEFAULT_MAX_TURNS } from "./prompts.js"; -import { type ActionEventInfo, type ActionResult, exitCodeFor, formatCompact, parseResult } from "./result.js"; +import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser"; +import { type ActionRequest, buildPrompt, DEFAULT_MAX_TURNS } from "./prompts"; +import { type ActionEventInfo, type ActionResult, exitCodeFor, formatCompact, parseResult } from "./result"; export interface HarnessRunOptions { harness: CuaAgentHarness; diff --git a/packages/cli/src/action/result.ts b/packages/cli/src/action/result.ts index dcaaad1..61b81e3 100644 --- a/packages/cli/src/action/result.ts +++ b/packages/cli/src/action/result.ts @@ -1,4 +1,4 @@ -import type { ActionType } from "./prompts.js"; +import type { ActionType } from "./prompts"; export type Status = "ok" | "not_found" | "error" | "timeout"; diff --git a/packages/cli/src/cli-harness.ts b/packages/cli/src/cli-harness.ts index 72e2a35..5182efa 100644 --- a/packages/cli/src/cli-harness.ts +++ b/packages/cli/src/cli-harness.ts @@ -13,15 +13,15 @@ import { } from "@onkernel/cua-ai"; import { parseArgs } from "node:util"; import { stderr, stdout } from "node:process"; -import type { CuaBrowserHandle } from "./harness-browser.js"; +import type { CuaBrowserHandle } from "./harness-browser"; import { type ActionRequest, type ActionType, -} from "./action/prompts.js"; -import { runAction, emitCompact } from "./action/harness-runner.js"; -import { buildCuaHarness } from "./harness.js"; -import { provisionBrowser } from "./harness-browser.js"; -import { DEFAULT_CUA_MODEL_REF, listSupportedModels, resolveCuaModelRef } from "./harness-models.js"; +} from "./action/prompts"; +import { runAction, emitCompact } from "./action/harness-runner"; +import { buildCuaHarness } from "./harness"; +import { provisionBrowser } from "./harness-browser"; +import { DEFAULT_CUA_MODEL_REF, listSupportedModels, resolveCuaModelRef } from "./harness-models"; import { attachNamedSession, formatRelativeAge, @@ -32,7 +32,7 @@ import { startNamedSession, stopNamedSession, validateSlug, -} from "./harness-named-sessions.js"; +} from "./harness-named-sessions"; import { appendBrowserEntry, createSession, @@ -42,9 +42,9 @@ import { openSession, readMetadataFromFile, resolveSessionRef, -} from "./harness-sessions.js"; -import { discoverCuaSkills } from "./harness-skills.js"; -import { runPrint } from "./print.js"; +} from "./harness-sessions"; +import { discoverCuaSkills } from "./harness-skills"; +import { runPrint } from "./print"; const MODELS_HELP = `cua models — list supported -m/--model values @@ -498,7 +498,7 @@ export async function runInteractiveCommand( flags: HarnessCliFlags, ): Promise { const runtime = await setupHarnessRuntime(flags); - const { runInteractive } = await import("./tui/main.js"); + const { runInteractive } = await import("./tui/main"); try { return await runInteractive({ cwd: process.cwd(), diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index a271f8a..b3fae70 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import { stderr, stdout } from "node:process"; import { parseArgs } from "node:util"; -import { type ActionType } from "./action/prompts.js"; +import { type ActionType } from "./action/prompts"; import { runActionCommand, runInteractiveCommand, @@ -9,8 +9,8 @@ import { runPrintCommand, runSessionSubcommand as runSessionSubcommandHarness, type HarnessCliFlags, -} from "./cli-harness.js"; -import { DEFAULT_CUA_MODEL_REF } from "./harness-models.js"; +} from "./cli-harness"; +import { DEFAULT_CUA_MODEL_REF } from "./harness-models"; const HELP = `cua — Kernel-cloud-browser computer-use agent diff --git a/packages/cli/src/harness-named-sessions.ts b/packages/cli/src/harness-named-sessions.ts index 54786f7..9b703d3 100644 --- a/packages/cli/src/harness-named-sessions.ts +++ b/packages/cli/src/harness-named-sessions.ts @@ -3,7 +3,7 @@ import Kernel from "@onkernel/sdk"; import { mkdir, readdir, readFile, stat, unlink, writeFile } from "node:fs/promises"; import { homedir } from "node:os"; import { join } from "node:path"; -import { createKernelClient, resolveProfileId } from "./harness-browser.js"; +import { createKernelClient, resolveProfileId } from "./harness-browser"; /** * Named sessions: durable, slug-keyed pointers to a Kernel cloud browser diff --git a/packages/cli/src/print.ts b/packages/cli/src/print.ts index 6158c0d..8d244a9 100644 --- a/packages/cli/src/print.ts +++ b/packages/cli/src/print.ts @@ -1,10 +1,10 @@ import type { AgentHarnessEvent, CuaAgentHarness, Session, Skill } from "@onkernel/cua-agent"; import type { ImageContent } from "@onkernel/cua-ai"; import { stderr, stdout } from "node:process"; -import { captureScreenshot } from "./harness-browser.js"; -import type { CuaBrowserHandle } from "./harness-browser.js"; -import { attachHarnessJsonlSink } from "./output/harness-jsonl.js"; -import { parseSkillInvocation } from "./harness-skills.js"; +import { captureScreenshot } from "./harness-browser"; +import type { CuaBrowserHandle } from "./harness-browser"; +import { attachHarnessJsonlSink } from "./output/harness-jsonl"; +import { parseSkillInvocation } from "./harness-skills"; export interface RunPrintOptions { harness: CuaAgentHarness; diff --git a/packages/cli/src/tui/main.ts b/packages/cli/src/tui/main.ts index a4c612d..a186a69 100644 --- a/packages/cli/src/tui/main.ts +++ b/packages/cli/src/tui/main.ts @@ -21,16 +21,16 @@ import { TUI_KEYBINDINGS, } from "@earendil-works/pi-tui"; import type { ImageContent, Model } from "@onkernel/cua-ai"; -import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser.js"; -import { resolveCuaModelRef } from "../harness-models.js"; -import { openTuiDebugLog } from "./debug-log.js"; -import { applyAndSummarizeImageProtocol } from "./diagnostics.js"; -import { type AssistantBuffer, MessageList } from "./message-list.js"; -import { ScreenshotWidget } from "./screenshot-widget.js"; -import { buildAutocompleteProvider, parseSlashCommand } from "./slash-commands.js"; -import { StatusLine } from "./status-line.js"; -import { TelemetryFooter } from "./telemetry-footer.js"; -import { colors, editorTheme } from "./themes.js"; +import { captureScreenshot, type CuaBrowserHandle } from "../harness-browser"; +import { resolveCuaModelRef } from "../harness-models"; +import { openTuiDebugLog } from "./debug-log"; +import { applyAndSummarizeImageProtocol } from "./diagnostics"; +import { type AssistantBuffer, MessageList } from "./message-list"; +import { ScreenshotWidget } from "./screenshot-widget"; +import { buildAutocompleteProvider, parseSlashCommand } from "./slash-commands"; +import { StatusLine } from "./status-line"; +import { TelemetryFooter } from "./telemetry-footer"; +import { colors, editorTheme } from "./themes"; export interface InteractiveOptions { cwd: string; diff --git a/packages/cli/src/tui/message-list.ts b/packages/cli/src/tui/message-list.ts index 72ceef5..f567942 100644 --- a/packages/cli/src/tui/message-list.ts +++ b/packages/cli/src/tui/message-list.ts @@ -1,5 +1,5 @@ import { Container, Markdown, Text } from "@earendil-works/pi-tui"; -import { colors, markdownTheme } from "./themes.js"; +import { colors, markdownTheme } from "./themes"; /** * Append-only chat log of user prompts, assistant text, tool-call summaries, diff --git a/packages/cli/src/tui/screenshot-widget.ts b/packages/cli/src/tui/screenshot-widget.ts index 707aa02..34cfac6 100644 --- a/packages/cli/src/tui/screenshot-widget.ts +++ b/packages/cli/src/tui/screenshot-widget.ts @@ -1,5 +1,5 @@ import { Container, Image, allocateImageId } from "@earendil-works/pi-tui"; -import { imageTheme } from "./themes.js"; +import { imageTheme } from "./themes"; const MAX_WIDTH_CELLS = 60; diff --git a/packages/cli/src/tui/status-line.ts b/packages/cli/src/tui/status-line.ts index e5548cf..d7c9720 100644 --- a/packages/cli/src/tui/status-line.ts +++ b/packages/cli/src/tui/status-line.ts @@ -1,5 +1,5 @@ import { Text, hyperlink } from "@earendil-works/pi-tui"; -import { colors } from "./themes.js"; +import { colors } from "./themes"; export interface StatusLineState { model: string; diff --git a/packages/cli/src/tui/telemetry-footer.ts b/packages/cli/src/tui/telemetry-footer.ts index a2ff145..aedc8f1 100644 --- a/packages/cli/src/tui/telemetry-footer.ts +++ b/packages/cli/src/tui/telemetry-footer.ts @@ -1,5 +1,5 @@ import { type Component, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui"; -import { colors } from "./themes.js"; +import { colors } from "./themes"; export interface TelemetryFooterState { provider?: string; diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.json new file mode 100644 index 0000000..d57acd1 --- /dev/null +++ b/packages/cli/tsconfig.build.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist-tsc", + "rootDir": "./src", + "emitDeclarationOnly": true, + "sourceMap": false, + "declarationMap": false + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "dist", "**/*.d.ts"], + "references": [ + { "path": "../ptywright" } + ] +} diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index af0be7c..d8faaf5 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,13 +1,3 @@ { - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "outDir": "./dist", - "rootDir": "./src", - "module": "NodeNext", - "moduleResolution": "NodeNext" - }, - "include": ["src/**/*"], - "references": [ - { "path": "../ptywright" } - ] + "extends": "./tsconfig.build.json" } diff --git a/packages/cli/tsdown.config.ts b/packages/cli/tsdown.config.ts new file mode 100644 index 0000000..cb7d4f7 --- /dev/null +++ b/packages/cli/tsdown.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from "tsdown"; + +export default defineConfig({ + entry: ["src/cli.ts"], + format: ["esm"], + platform: "node", + dts: false, + sourcemap: false, + clean: true, + outExtensions: () => ({ js: ".js" }), +});