From c9c77a8cff3d1dfb622cd08164d1c68ea3e237bd Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 20:26:36 -0500 Subject: [PATCH 1/9] feat(run-run): add TsdownService and export tools - Create TsdownService extending ToolService without getBinDir, relying on the shell's inherited localBaseBinPath for binary resolution - Make ToolService.getBinDir optional instead of abstract, so tools that are already resolvable via the shell PATH don't need a custom bin dir - Add tsdown to the tools command for direct CLI access - Export tools via package.json (./tools/*) to allow consumers to import { defineConfig } from '@vlandoss/run-run/tools/tsdown' Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/run-run/package.json | 3 ++- packages/run-run/src/program/commands/tools.ts | 6 +++++- packages/run-run/src/services/biome.ts | 2 +- packages/run-run/src/services/oxfmt.ts | 2 +- packages/run-run/src/services/oxlint.ts | 2 +- packages/run-run/src/services/tool.ts | 6 ++++-- packages/run-run/src/services/tsdown.ts | 9 +++++++++ packages/run-run/src/tools/tsdown.ts | 1 + packages/run-run/tools/tsdown | 2 ++ 9 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 packages/run-run/src/services/tsdown.ts create mode 100644 packages/run-run/src/tools/tsdown.ts create mode 100755 packages/run-run/tools/tsdown diff --git a/packages/run-run/package.json b/packages/run-run/package.json index 917a0fa..8060dbd 100644 --- a/packages/run-run/package.json +++ b/packages/run-run/package.json @@ -14,7 +14,8 @@ "author": "rcrd ", "type": "module", "exports": { - "./config": "./src/lib/config.ts" + "./config": "./src/lib/config.ts", + "./tools/*": "./src/tools/*.ts" }, "bin": { "rr": "./bin.ts", diff --git a/packages/run-run/src/program/commands/tools.ts b/packages/run-run/src/program/commands/tools.ts index ad581a7..f37341a 100644 --- a/packages/run-run/src/program/commands/tools.ts +++ b/packages/run-run/src/program/commands/tools.ts @@ -5,6 +5,7 @@ import type { Context } from "#/services/ctx"; import { OxfmtService } from "#/services/oxfmt"; import { OxlintService } from "#/services/oxlint"; import type { ToolService } from "#/services/tool"; +import { TsdownService } from "#/services/tsdown"; type ActionParams = { args: string[]; @@ -18,6 +19,8 @@ function getToolService(bin: string, shell: ShellService): ToolService { return new OxfmtService(shell); case "oxlint": return new OxlintService(shell); + case "tsdown": + return new TsdownService(shell); default: throw new Error(`Unknown tool: ${bin}`); } @@ -41,5 +44,6 @@ export function createToolsCommand(ctx: Context) { .description("expose the internal tools 🛠️") .addCommand(createToolCommand("biome", ctx.shell)) .addCommand(createToolCommand("oxfmt", ctx.shell)) - .addCommand(createToolCommand("oxlint", ctx.shell)); + .addCommand(createToolCommand("oxlint", ctx.shell)) + .addCommand(createToolCommand("tsdown", ctx.shell)); } diff --git a/packages/run-run/src/services/biome.ts b/packages/run-run/src/services/biome.ts index 06bd1b1..9fc8d65 100644 --- a/packages/run-run/src/services/biome.ts +++ b/packages/run-run/src/services/biome.ts @@ -9,7 +9,7 @@ export class BiomeService extends ToolService implements Formatter, Linter, Stat super({ bin: "biome", ui: TOOL_LABELS.BIOME, shellService }); } - getBinDir() { + override getBinDir() { return require.resolve("@biomejs/biome/bin/biome"); } diff --git a/packages/run-run/src/services/oxfmt.ts b/packages/run-run/src/services/oxfmt.ts index b978c85..e02eab2 100644 --- a/packages/run-run/src/services/oxfmt.ts +++ b/packages/run-run/src/services/oxfmt.ts @@ -8,7 +8,7 @@ export class OxfmtService extends ToolService implements Formatter { super({ bin: "oxfmt", ui: TOOL_LABELS.OXFMT, shellService }); } - getBinDir() { + override getBinDir() { return require.resolve("oxfmt/bin/oxfmt"); } diff --git a/packages/run-run/src/services/oxlint.ts b/packages/run-run/src/services/oxlint.ts index 4436434..90dede8 100644 --- a/packages/run-run/src/services/oxlint.ts +++ b/packages/run-run/src/services/oxlint.ts @@ -8,7 +8,7 @@ export class OxlintService extends ToolService implements Linter { super({ bin: "oxlint", ui: TOOL_LABELS.OXLINT, shellService }); } - getBinDir() { + override getBinDir() { return require.resolve("oxlint/bin/oxlint"); } diff --git a/packages/run-run/src/services/tool.ts b/packages/run-run/src/services/tool.ts index 4881e0e..352a7bb 100644 --- a/packages/run-run/src/services/tool.ts +++ b/packages/run-run/src/services/tool.ts @@ -19,7 +19,7 @@ export abstract class ToolService { this.#shellService = shellService; } - abstract getBinDir(): string; + getBinDir?(): string; exec(args: string | string[]) { const $ = this.#shell(); @@ -27,9 +27,11 @@ export abstract class ToolService { } #shell = memoize((cwd?: string) => { + const { getBinDir } = this; + return this.#shellService.child({ cwd, - preferLocal: gracefullBinDir(() => this.getBinDir()), + ...(getBinDir && { preferLocal: gracefullBinDir(() => getBinDir()) }), }).$; }); diff --git a/packages/run-run/src/services/tsdown.ts b/packages/run-run/src/services/tsdown.ts new file mode 100644 index 0000000..609b7f9 --- /dev/null +++ b/packages/run-run/src/services/tsdown.ts @@ -0,0 +1,9 @@ +import type { ShellService } from "@vlandoss/clibuddy"; +import { TOOL_LABELS } from "#/program/ui"; +import { ToolService } from "./tool"; + +export class TsdownService extends ToolService { + constructor(shellService: ShellService) { + super({ bin: "tsdown", ui: TOOL_LABELS.TSDOWN, shellService }); + } +} diff --git a/packages/run-run/src/tools/tsdown.ts b/packages/run-run/src/tools/tsdown.ts new file mode 100644 index 0000000..06f210b --- /dev/null +++ b/packages/run-run/src/tools/tsdown.ts @@ -0,0 +1 @@ +export * from "tsdown"; diff --git a/packages/run-run/tools/tsdown b/packages/run-run/tools/tsdown new file mode 100755 index 0000000..73b1c3c --- /dev/null +++ b/packages/run-run/tools/tsdown @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +bunx rr tools tsdown "$@" From 1ed8a27ad3e8b8427539e62df04f2c9ae1d24510 Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 20:27:47 -0500 Subject: [PATCH 2/9] test(run-run): update snapshots for tsdown tool command Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/program/__tests__/__snapshots__/snapshots.test.ts.snap | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/run-run/src/program/__tests__/__snapshots__/snapshots.test.ts.snap b/packages/run-run/src/program/__tests__/__snapshots__/snapshots.test.ts.snap index d651883..0e78d14 100644 --- a/packages/run-run/src/program/__tests__/__snapshots__/snapshots.test.ts.snap +++ b/packages/run-run/src/program/__tests__/__snapshots__/snapshots.test.ts.snap @@ -183,6 +183,7 @@ Commands: biome oxfmt oxlint + tsdown help [command] display help for command " `; From 7b53fc7d870cfd2a53fde2706661adf2790fb06c Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 20:29:02 -0500 Subject: [PATCH 3/9] docs(changeset): Add tsdown to tools --- .changeset/strong-buckets-nail.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-buckets-nail.md diff --git a/.changeset/strong-buckets-nail.md b/.changeset/strong-buckets-nail.md new file mode 100644 index 0000000..19677c3 --- /dev/null +++ b/.changeset/strong-buckets-nail.md @@ -0,0 +1,5 @@ +--- +"@vlandoss/run-run": patch +--- + +Add tsdown to tools From fd8a0cf833627a460cc1311661e49266ed5394b7 Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 20:49:46 -0500 Subject: [PATCH 4/9] fix: exports --- packages/run-run/package.json | 5 ++++- packages/run-run/src/lib/config.ts | 2 +- packages/run-run/src/tools/{tsdown.ts => tsdown.d.ts} | 0 packages/run-run/src/tools/tsdown.js | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) rename packages/run-run/src/tools/{tsdown.ts => tsdown.d.ts} (100%) create mode 100644 packages/run-run/src/tools/tsdown.js diff --git a/packages/run-run/package.json b/packages/run-run/package.json index 8060dbd..804f6b3 100644 --- a/packages/run-run/package.json +++ b/packages/run-run/package.json @@ -15,7 +15,10 @@ "type": "module", "exports": { "./config": "./src/lib/config.ts", - "./tools/*": "./src/tools/*.ts" + "./tools/*": { + "types": "./tools/*.d.ts", + "default": "./tools/*.js" + } }, "bin": { "rr": "./bin.ts", diff --git a/packages/run-run/src/lib/config.ts b/packages/run-run/src/lib/config.ts index fa269e4..47aec30 100644 --- a/packages/run-run/src/lib/config.ts +++ b/packages/run-run/src/lib/config.ts @@ -1,4 +1,4 @@ -import type { UserConfig } from "../types/config"; +import type { UserConfig } from "../types/config.ts"; export function defineConfig(config: UserConfig) { return config; diff --git a/packages/run-run/src/tools/tsdown.ts b/packages/run-run/src/tools/tsdown.d.ts similarity index 100% rename from packages/run-run/src/tools/tsdown.ts rename to packages/run-run/src/tools/tsdown.d.ts diff --git a/packages/run-run/src/tools/tsdown.js b/packages/run-run/src/tools/tsdown.js new file mode 100644 index 0000000..06f210b --- /dev/null +++ b/packages/run-run/src/tools/tsdown.js @@ -0,0 +1 @@ +export * from "tsdown"; From 9b7b388c9ee694df6bc2868374572268b7bfa3aa Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 21:03:33 -0500 Subject: [PATCH 5/9] fix: exports --- packages/run-run/package.json | 5 +---- packages/run-run/src/tools/tsdown.js | 1 - packages/run-run/src/tools/{tsdown.d.ts => tsdown.ts} | 0 3 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 packages/run-run/src/tools/tsdown.js rename packages/run-run/src/tools/{tsdown.d.ts => tsdown.ts} (100%) diff --git a/packages/run-run/package.json b/packages/run-run/package.json index 804f6b3..8060dbd 100644 --- a/packages/run-run/package.json +++ b/packages/run-run/package.json @@ -15,10 +15,7 @@ "type": "module", "exports": { "./config": "./src/lib/config.ts", - "./tools/*": { - "types": "./tools/*.d.ts", - "default": "./tools/*.js" - } + "./tools/*": "./src/tools/*.ts" }, "bin": { "rr": "./bin.ts", diff --git a/packages/run-run/src/tools/tsdown.js b/packages/run-run/src/tools/tsdown.js deleted file mode 100644 index 06f210b..0000000 --- a/packages/run-run/src/tools/tsdown.js +++ /dev/null @@ -1 +0,0 @@ -export * from "tsdown"; diff --git a/packages/run-run/src/tools/tsdown.d.ts b/packages/run-run/src/tools/tsdown.ts similarity index 100% rename from packages/run-run/src/tools/tsdown.d.ts rename to packages/run-run/src/tools/tsdown.ts From 4005997319c4a5995dd6c955cbee8976fe0a2232 Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 21:06:04 -0500 Subject: [PATCH 6/9] chore: run ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ab75f7..07655c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,6 @@ jobs: uses: variableland/gh-actions/actions/setup-pnpm-bun@main - name: 🚀 Preview release - uses: variableland/gh-actions/actions/monorepo-preview-release@main + uses: variableland/gh-actions/actions/monorepo-preview-release@dev with: github_token: ${{ secrets.GITHUB_TOKEN }} From 95285f8926c68e14ff7091b2f599d898836d38a0 Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 21:08:34 -0500 Subject: [PATCH 7/9] chore: run ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07655c7..1ab75f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,6 @@ jobs: uses: variableland/gh-actions/actions/setup-pnpm-bun@main - name: 🚀 Preview release - uses: variableland/gh-actions/actions/monorepo-preview-release@dev + uses: variableland/gh-actions/actions/monorepo-preview-release@main with: github_token: ${{ secrets.GITHUB_TOKEN }} From 431fc3636313149dffe5343fbd5a6d394fd1490b Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 21:26:48 -0500 Subject: [PATCH 8/9] fix(run-run): compile library exports to JS for Node.js compatibility Raw .ts exports in node_modules can't be type-stripped by Node.js or unrun, breaking consumers like tsdown config files. Compile lib exports to dist/ and move src/tools into src/lib/tools. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/run-run/package.json | 13 +++++++++++-- packages/run-run/src/{ => lib}/tools/tsdown.ts | 0 packages/run-run/tsdown.config.ts | 7 +++++++ 3 files changed, 18 insertions(+), 2 deletions(-) rename packages/run-run/src/{ => lib}/tools/tsdown.ts (100%) create mode 100644 packages/run-run/tsdown.config.ts diff --git a/packages/run-run/package.json b/packages/run-run/package.json index 8060dbd..a652238 100644 --- a/packages/run-run/package.json +++ b/packages/run-run/package.json @@ -14,8 +14,14 @@ "author": "rcrd ", "type": "module", "exports": { - "./config": "./src/lib/config.ts", - "./tools/*": "./src/tools/*.ts" + "./config": { + "types": "./dist/config.d.mts", + "default": "./dist/config.mjs" + }, + "./tools/*": { + "types": "./dist/tools/*.d.mts", + "default": "./dist/tools/*.mjs" + } }, "bin": { "rr": "./bin.ts", @@ -26,12 +32,15 @@ }, "files": [ "bin.ts", + "dist", "src", "tools", "tsconfig.json" ], "scripts": { + "build": "tsdown", "test": "bun test", + "prepublishOnly": "pnpm build", "test:types": "rr tsc" }, "dependencies": { diff --git a/packages/run-run/src/tools/tsdown.ts b/packages/run-run/src/lib/tools/tsdown.ts similarity index 100% rename from packages/run-run/src/tools/tsdown.ts rename to packages/run-run/src/lib/tools/tsdown.ts diff --git a/packages/run-run/tsdown.config.ts b/packages/run-run/tsdown.config.ts new file mode 100644 index 0000000..a844b7f --- /dev/null +++ b/packages/run-run/tsdown.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from "tsdown"; + +export default defineConfig({ + entry: ["src/lib/**/*.ts"], + format: "esm", + dts: true, +}); From b26aaa262813ea72ba7e8b4b73a76e692754895d Mon Sep 17 00:00:00 2001 From: "Ricardo Q. Bazan" Date: Fri, 13 Mar 2026 21:40:34 -0500 Subject: [PATCH 9/9] fix(run-run): add bun export condition and root tsconfig for module resolution Adds "bun" condition to package exports so Bun resolves source .ts files directly without requiring a build step. Adds root tsconfig.json with paths mapping so VSCode/TypeScript can resolve @vlandoss/run-run/* imports. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/run-run/package.json | 2 ++ tsconfig.json | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 tsconfig.json diff --git a/packages/run-run/package.json b/packages/run-run/package.json index a652238..cf24300 100644 --- a/packages/run-run/package.json +++ b/packages/run-run/package.json @@ -15,10 +15,12 @@ "type": "module", "exports": { "./config": { + "bun": "./src/lib/config.ts", "types": "./dist/config.d.mts", "default": "./dist/config.mjs" }, "./tools/*": { + "bun": "./src/lib/tools/*.ts", "types": "./dist/tools/*.d.mts", "default": "./dist/tools/*.mjs" } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6763df3 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "paths": { + "@vlandoss/run-run/*": ["./packages/run-run/src/lib/*"] + } + } +}