Skip to content

fix(bundler): fix compile failures on CI and example type errors#96

Merged
zrosenbauer merged 3 commits intomainfrom
fix/compile-ci-externals
Mar 24, 2026
Merged

fix(bundler): fix compile failures on CI and example type errors#96
zrosenbauer merged 3 commits intomainfrom
fix/compile-ci-externals

Conversation

@zrosenbauer
Copy link
Member

Summary

  • Moved c12 optional dep externals to tsdown build stepchokidar, magicast, and giget were externalized at bun build --compile time via --external flags. In strict pnpm layouts (GitHub Actions), Bun couldn't resolve them even when marked external. Now they're stripped at the tsdown bundle level via neverBundle, so they never reach the compile step.
  • Added --verbose flag to kidd build — surfaces bun's stderr on compile failures instead of the opaque "bun build --compile failed" message.
  • Added report middleware module augmentationctx.report is now typed on all commands when report() middleware is registered at the cli() level, matching the existing icons middleware pattern.
  • Fixed icons example — replaced removed ctx.output API with ctx.log.raw() and ctx.format.table().

Test plan

  • pnpm check passes (typecheck + lint + format)
  • pnpm test passes (all 17 tasks)
  • pnpm typecheck --filter='./examples/*' passes (all 6 examples)
  • Verify kidd build --compile works in CI (GitHub Actions macOS runner)
  • Verify kidd build --compile --verbose surfaces stderr on failure

zrosenbauer and others added 2 commits March 23, 2026 22:17
The c12 config loader has optional peer deps (chokidar, magicast, giget) that
were externalized at `bun build --compile` time. In strict pnpm layouts (e.g.
GitHub Actions), Bun couldn't resolve them even when marked --external, causing
compile failures.

Moves the externalization to tsdown's neverBundle config so these imports are
stripped from the bundle before they reach bun. Also adds a --verbose flag to
`kidd build` that surfaces bun's stderr on compile failures.

Co-Authored-By: Claude <noreply@anthropic.com>
…types

- Add `declare module` augmentation to report middleware types so
  `ctx.report` is available on all commands when middleware is at cli() level
- Fix icons example to use `ctx.log.raw()` / `ctx.format.table()` instead
  of removed `ctx.output` API

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: 0b055a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@kidd-cli/bundler Minor
@kidd-cli/cli Minor
@kidd-cli/core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
oss-kidd Error Error Mar 24, 2026 2:21am

Request Review

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

The PR refactors output operations in example commands from ctx.output.* to ctx.log.raw() with explicit formatting. The bundler's external dependency handling is modified to include c12 optional dependencies (chokidar, magicast, giget) in the neverBundle list while removing them from compile-specific externals. A verbose boolean flag is added to CompileParams and wired through the CLI build command to control detailed error reporting in the compile step. TypeScript module augmentation is added for Context.report typing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately summarizes the main changes: fixing compile failures on CI and example type errors through bundler and external dependency management adjustments.
Description check ✅ Passed Description clearly outlines all four major changes and provides a concrete test plan, directly relating to the changeset across bundler, CLI, middleware, and example files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/compile-ci-externals

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 24, 2026

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing fix/compile-ci-externals (0b055a8) with main (9391a1f)

Open in CodSpeed

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bundler/src/compile/compile.ts`:
- Around line 224-227: The callback is mutating the Error parameter (execFileCb
callback) with Object.assign(error, { stderr }); instead create a new error-like
object and pass that (or return a tuple with stderr) to avoid mutating
parameters: build a fresh object that copies error.name, error.message,
error.stack (or use Object.create and assign those properties) plus stderr and
pass that to resolve(err(...)) instead of mutating the original Error; update
the code in the execFileCb callback (where Object.assign is used) and any
consumer (e.g., formatCompileError) to accept the new shape or tuple.
- Around line 200-213: formatCompileError currently returns only the header when
verbose is true but execError.stderr is empty, losing useful spawn-level
messages in execError.message; modify formatCompileError to fall back to
execError.message (trimmed) when stderr is empty and verbose is true, and ensure
you return header + newline + message when present; also avoid mutating the
original error (the Object.assign usage around stderr enrichment) by creating a
new enriched object like { ...error, stderr } instead of mutating error; finally
add a unit test for formatCompileError covering verbose: true with
empty/whitespace stderr but a populated execError.message to prevent
regressions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5b3f521c-1ced-408f-bffc-649435c84db6

📥 Commits

Reviewing files that changed from the base of the PR and between 9391a1f and 0b055a8.

⛔ Files ignored due to path filters (2)
  • .changeset/fix-compile-ci.md is excluded by !.changeset/**
  • .changeset/fix-report-augmentation.md is excluded by !.changeset/**
📒 Files selected for processing (9)
  • examples/icons/commands/category.ts
  • examples/icons/commands/show.ts
  • packages/bundler/src/build/map-config.test.ts
  • packages/bundler/src/build/map-config.ts
  • packages/bundler/src/compile/compile.test.ts
  • packages/bundler/src/compile/compile.ts
  • packages/bundler/src/types.ts
  • packages/cli/src/commands/build.ts
  • packages/core/src/middleware/report/types.ts

@zrosenbauer zrosenbauer merged commit ed3eb91 into main Mar 24, 2026
6 of 7 checks passed
@zrosenbauer zrosenbauer deleted the fix/compile-ci-externals branch March 24, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant