Skip to content

feat: Make Kimchi Workflows bundle-safe - #43

Merged
pmateusz merged 6 commits into
masterfrom
feat/bundled-kimchi-workflows
Aug 25, 2026
Merged

feat: Make Kimchi Workflows bundle-safe#43
pmateusz merged 6 commits into
masterfrom
feat/bundled-kimchi-workflows

Conversation

@pmateusz

Copy link
Copy Markdown
Collaborator

Summary

Prepares the Kimchi Workflows extension for bundling into a standalone Kimchi executable. The release
build now carries its package identity as ordinary code, the project's .kimchi/workflows package is the
sole validation environment (no production path resolves a toolchain from the physical extension
package), and Node.js 22.19+ is the supported floor with actionable prerequisite errors.

What changed

Bundle-safe distribution metadata

  • Added src/host/distribution.ts — stamped version, package-manager pin, and compatible toolchain
    versions embedded in source so a compiled binary carries release identity without package-relative
    filesystem reads
  • Added scripts/generate-distribution-metadata.mjs with a --check mode that fails CI when checked-in
    metadata is stale

Project-owned validation environment

  • Extracted shared toolchain resolution into src/verification/toolchain.ts — framework declarations,
    TypeBox, PI types, native TypeScript compiler, and runtime module resolver all resolved through the
    project package
  • Removed the FRAMEWORK_ROOT / nearestPackageRoot fallback — no production path resolves a toolchain from
    import.meta.url (which points into Bun's virtual filesystem in a compiled binary)
  • verify.ts resolves framework aliases from the project package; removed assertInsidePackage so
    external-path workflows validate against the central package
  • run and resume prepare the project package before validation; read-only discovery never installs
  • Switched jiti to its static entry (jiti/static) for Bun standalone compatibility

Supported runtime floor and prerequisite UX

  • Lowered engines.node from >=24 to >=22.19; lowered @types/node to ^22.19.18
  • Added src/host/workflow-prerequisites.ts — probes external node and pnpm commands (not
    process.versions, which reflects Bun in a compiled binary) and produces concise errors with recovery
    commands
  • Prerequisite check runs only when installation is actually required; the extension loads and discovery
    works without Node or pnpm on PATH
  • Added Node 22.19 to the CI test matrix

@kimchi-review

kimchi-review Bot commented Aug 25, 2026

Copy link
Copy Markdown

Kimchi Code Review

A review is being prepared and will be posted shortly.

Property Value
Commit fb51030
Author @pmateusz
Files changed 42
Review status Pending
What to expect

Kimchi will analyze the changes in this pull request and post:

  • A summary of the overall changes
  • Inline comments on specific lines with findings categorized by issue type

The review typically completes within a few minutes. This comment will be updated once the review is ready.

Interact with Kimchi
  • @getkimchi review — re-trigger a full review on the latest commit
  • @getkimchi summary — regenerate the PR summary
  • @getkimchi ignore — skip this PR (no review will be posted)
  • Reply to any inline comment to ask follow-up questions or request clarification
Configuration

Reviews are configured by your organization admin.
Review instructions, excluded directories, and severity thresholds can be adjusted per repository in the Kimchi dashboard.


Powered by Kimchi — AI-powered code review by CAST AI

pmateusz and others added 4 commits August 25, 2026 14:01
Replace prepareWorkflowPackage's import.meta.url-relative read of the
framework package.json with package-owned generated metadata, so a
bundled executable can prepare a project workflow package without a
workflows manifest beside it. prepack regenerates the stamp after the
release version injection; a dist:check CI job guards staleness, and a
packaging test asserts the packed metadata matches the packed manifest.

Unstamped source builds resolve the framework location through an
explicit KIMCHI_WORKFLOWS_PACKAGE_DIR, validated to belong to the
workflow package, with the on-disk package root as fallback. A Bun
compiled-executable regression fixture proves project preparation with
no package metadata on disk; Bun ships as a pinned devDependency so
local, CI, and release runs share one version.

Co-Authored-By: Kimchi <noreply@kimchi.dev>
The project's `.kimchi/workflows` package is now the explicit environment
for static validation and focused-test verification. Run and resume prepare
it lazily before validating; read-only discovery never installs.

- Extract shared toolchain resolution into `src/verification/toolchain.ts`
  (package-owned declarations, native compiler, runtime module resolver)
- Remove `FRAMEWORK_ROOT` / `nearestPackageRoot` fallback in
  `workflow-candidate-validator.ts` — no production path resolves a
  toolchain from the physical extension package (`import.meta.url`)
- `verify.ts` resolves framework aliases from the project package, not
  `import.meta.url`; removes `assertInsidePackage` so external-path
  workflows validate against the central package
- `run` / `resume` call `prepareProjectWorkflowPackage` before validation
- Update all test fixtures to prepare the project package offline
- Switch jiti to its static entry for Bun standalone compatibility

Phase 2 of the bundled-kimchi-workflows-extension plan.

Co-Authored-By: Kimchi <noreply@kimchi.dev>
Co-Authored-By: Kimchi <noreply@kimchi.dev>
Align the workflows extension with a Node.js 22.19+ floor and make Node
and pnpm requirements apply only when a workflow command needs to prepare
or verify the project toolchain.

- Lower engines.node from >=24 to >=22.19 in package.json and examples
- Lower @types/node from ^26.2.0 to ^22.19.18 to match the runtime floor
- Add src/host/workflow-prerequisites.ts: probes external node and pnpm
  commands (not process.versions, which reflects Bun in a compiled binary)
  and produces concise errors with recovery commands
- Wire checkWorkflowPrerequisites into prepareWorkflowPackage (only when
  installation is required) and verifyWorkflowTest, with test seams
- Forward the checkPrerequisites seam through prepareProjectWorkflowPackage
- Add compiled-binary test proving the host loads without Node/pnpm on PATH
- Add Node 22.19 to the CI test matrix

Phase 3 of the bundled-kimchi-workflows-extension plan.

Co-Authored-By: Kimchi <noreply@kimchi.dev>
@pmateusz
pmateusz force-pushed the feat/bundled-kimchi-workflows branch from fb51030 to f4cc215 Compare August 25, 2026 13:00
Test seams bypass the external node/pnpm probe so fixture-based tests
never spawn real processes. Also adds ENOENT recovery message test and
asserts the prerequisite check fires exactly once per install.

Co-Authored-By: Kimchi <noreply@kimchi.dev>
@pmateusz
pmateusz force-pushed the feat/bundled-kimchi-workflows branch from f4cc215 to a8c46c1 Compare August 25, 2026 13:06
The kimchi-binary-e2e job failed with `bun: not found` because the
runner has no Bun on PATH. Add an oven-sh/setup-bun step (pinned to
1.4.0, matching the Kimchi devDependency) before the build step.

Co-Authored-By: Kimchi <noreply@kimchi.dev>
@pmateusz
pmateusz merged commit 4edbd15 into master Aug 25, 2026
8 checks passed
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