Conversation
WalkthroughReplaces Node with Bun (>=1.2.22) across CI, package metadata, docs, and examples; removes js-yaml and switches YAML parsing/serialization to Bun.YAML.parse()/Bun.YAML.stringify() in source and tests; CI matrix and conditional steps updated to use Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/zenko/README.md (1)
99-114: Update programmatic example to use Bun.YAML.The programmatic usage example still imports
js-yaml(line 104), but this dependency has been removed in favor of Bun's native YAML parsing. Users following this example will encounter import errors.Apply this diff to update the example:
import { generate, type OpenAPISpec } from "zenko" import * as fs from "fs" -import { load } from "js-yaml" // Load your OpenAPI spec -const spec = load(fs.readFileSync("api.yaml", "utf8")) as OpenAPISpec +const spec = Bun.YAML.parse(fs.readFileSync("api.yaml", "utf8")) as OpenAPISpec // Generate TypeScript code const output = generate(spec)
🧹 Nitpick comments (3)
packages/zenko/src/__tests__/form-data.test.ts (1)
10-12: YAML parsing swap toBun.YAML.parselooks consistent; consider a small helper to DRY the repeated read/parse.Also applies to: 18-20, 31-33, 44-46, 57-59, 70-72, 86-88, 101-103, 114-116, 132-134, 144-146, 165-167, 187-190, 204-206, 216-218
packages/zenko/src/utils/__tests__/topological-sort.test.ts (1)
73-80:Bun.YAML.parseswap is fine; consider resolvingpetstore.yamlviaimport.meta.dirto avoid CWD-dependent tests.packages/examples/generate.js (1)
15-21:Bun.YAML.parseswap looks good; consider hardening the catch to handle non-Errorthrows.Also applies to: 45-50
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (13)
.github/workflows/ci.yml(4 hunks)README.md(1 hunks)package.json(1 hunks)packages/examples/generate.js(1 hunks)packages/examples/package.json(0 hunks)packages/zenko/README.md(1 hunks)packages/zenko/package.json(2 hunks)packages/zenko/src/__tests__/cli.test.ts(1 hunks)packages/zenko/src/__tests__/form-data.test.ts(14 hunks)packages/zenko/src/cli.ts(2 hunks)packages/zenko/src/utils/__tests__/topological-sort.test.ts(1 hunks)packages/zenko/src/utils/yaml.ts(1 hunks)packages/zenko/tsup.config.ts(1 hunks)
💤 Files with no reviewable changes (1)
- packages/examples/package.json
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Organize imports in order: built-in → third-party → local; always use double quotes
Use 2-space indentation with no semicolons and trailing commas (ES5 style) with 80 character line width
Use camelCase for variable and function names; use PascalCase for classes and types
Prefer Result-style returns or descriptive throws for error handling
Files:
packages/examples/generate.jspackages/zenko/src/utils/__tests__/topological-sort.test.tspackages/zenko/src/cli.tspackages/zenko/src/__tests__/cli.test.tspackages/zenko/src/utils/yaml.tspackages/zenko/src/__tests__/form-data.test.tspackages/zenko/tsup.config.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Export inferred Zod types and maintain strict TypeScript settings with
noUncheckedIndexedAccessandnoUnusedLocalsenabled
Files:
packages/zenko/src/utils/__tests__/topological-sort.test.tspackages/zenko/src/cli.tspackages/zenko/src/__tests__/cli.test.tspackages/zenko/src/utils/yaml.tspackages/zenko/src/__tests__/form-data.test.tspackages/zenko/tsup.config.ts
packages/zenko/src/__tests__/**/*.{ts,tsx,test.ts,test.tsx,spec.ts,spec.tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Store test specifications in
packages/zenko/src/__tests__and use snapshots for output verification
Files:
packages/zenko/src/__tests__/cli.test.tspackages/zenko/src/__tests__/form-data.test.ts
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Run scripts from workspace root and maintain compatibility with Bun 1.3+ and Node >=18
Learnt from: RawToast
Repo: RawToast/zenko PR: 1
File: package.json:20-20
Timestamp: 2025-10-12T14:20:34.939Z
Learning: In package.json scripts, "bun run --cwd <workspace>" without a script name is a valid helper alias pattern that forwards additional arguments. For example, a script like "zenko": "bun run --cwd packages/zenko" can be invoked as `bun zenko build` which forwards "build" to the workspace package, effectively running `bun run --cwd packages/zenko build`. This is an intentional design for flexible workspace helpers, not an error.
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Run scripts from workspace root and maintain compatibility with Bun 1.3+ and Node >=18
Applied to files:
.github/workflows/ci.ymlpackages/zenko/package.jsonpackage.json
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Applies to packages/zenko/src/__tests__/**/*.{ts,tsx,test.ts,test.tsx,spec.ts,spec.tsx} : Store test specifications in `packages/zenko/src/__tests__` and use snapshots for output verification
Applied to files:
packages/zenko/src/utils/__tests__/topological-sort.test.tspackages/zenko/src/cli.tspackages/zenko/src/__tests__/cli.test.tsREADME.mdpackages/zenko/src/__tests__/form-data.test.tspackages/zenko/README.mdpackages/zenko/tsup.config.ts
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Applies to packages/zenko/dist/** : Never manually edit generated artifacts in `packages/zenko/dist`; this directory is auto-generated
Applied to files:
packages/zenko/package.jsonREADME.mdpackages/zenko/README.md
📚 Learning: 2025-10-12T14:20:34.939Z
Learnt from: RawToast
Repo: RawToast/zenko PR: 1
File: package.json:20-20
Timestamp: 2025-10-12T14:20:34.939Z
Learning: In package.json scripts, "bun run --cwd <workspace>" without a script name is a valid helper alias pattern that forwards additional arguments. For example, a script like "zenko": "bun run --cwd packages/zenko" can be invoked as `bun zenko build` which forwards "build" to the workspace package, effectively running `bun run --cwd packages/zenko build`. This is an intentional design for flexible workspace helpers, not an error.
Applied to files:
packages/zenko/package.jsonpackage.jsonpackages/zenko/README.md
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Use `bun check` command to run lint, format, and type check together instead of individual commands
Applied to files:
package.json
📚 Learning: 2025-10-16T00:11:55.898Z
Learnt from: RawToast
Repo: RawToast/zenko PR: 15
File: packages/zenko/src/zenko.ts:917-921
Timestamp: 2025-10-16T00:11:55.898Z
Learning: In packages/zenko/src/zenko.ts, the `response` field in operation objects can contain TypeScript type expressions like `z.ZodArray<typeof SchemaName>` for inline array responses. These expressions are intended for type definitions and type checking, not for runtime validation. Users should not attempt to use these type expressions as runtime Zod schemas.
Applied to files:
README.md
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Applies to **/*.{ts,tsx} : Export inferred Zod types and maintain strict TypeScript settings with `noUncheckedIndexedAccess` and `noUnusedLocals` enabled
Applied to files:
packages/zenko/tsup.config.ts
🧬 Code graph analysis (1)
packages/zenko/src/cli.ts (2)
packages/zenko/src/zenko.ts (1)
OpenAPISpec(25-34)packages/zenko/index.ts (1)
OpenAPISpec(3-3)
🪛 GitHub Check: Test (Bun 1.2.21)
packages/zenko/src/__tests__/cli.test.ts
[failure] 174-174: TypeError: Bun.YAML.stringify is not a function. (In 'Bun.YAML.stringify(strictSpec)'
at <anonymous> (/home/runner/work/zenko/zenko/packages/zenko/src/__tests__/cli.test.ts:174:41)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test (Bun 1.2.21)
🔇 Additional comments (11)
packages/zenko/tsup.config.ts (1)
35-37: Droppingjs-yamlfrom tsup externals is consistent with the migration.README.md (1)
5-6: README branding update matches the Bun-first direction.packages/zenko/src/__tests__/cli.test.ts (1)
173-175:Bun.YAML.stringifyis the correct API and is available in Bun 1.2.21 and 1.3.x. No fix required—the code at line 174 is valid.The API signature is
YAML.stringify(input, replacer?, space?)where thespaceparameter controls indentation (omit for flow-style, provide a number for block-style). The current code will serializestrictSpeccorrectly.packages/zenko/src/cli.ts (1)
165-176:Bun.YAML.parseis stable and properly implemented across the codebase. The project requires Bun >=1.2.22, which includes the native YAML support introduced in v1.2.21. The API signature (Bun.YAML.parse(input: string): unknown) is stable through v1.3.x with no breaking changes—only bug fixes and correctness improvements in later 1.3.x releases. Usage is consistent:loadConfigreturns the parsed value, whilereadSpecapplies theas OpenAPISpectype assertion. No issues..github/workflows/ci.yml (3)
11-16: Verify minimum Bun version vs learnings.The matrix tests Bun 1.2.21, 1.3, and latest, while retrieved learnings state "maintain compatibility with Bun 1.3+ and Node >=18". This PR removes Node support entirely and sets the minimum to 1.2.21. Please confirm whether the minimum version is intentionally lowered to 1.2.21 or if the matrix should start at 1.3.
Based on learnings, which indicate a Bun 1.3+ requirement.
22-25: LGTM!The setup-bun action correctly uses the matrix variable to test across multiple Bun versions.
41-51: LGTM!The conditionals correctly limit coverage upload and security scanning to the
latestversion, avoiding redundant operations across the matrix.packages/zenko/README.md (2)
20-22: LGTM!Clear runtime requirement documentation with appropriate future-proofing note about npm package availability.
24-39: LGTM!Installation instructions correctly updated to use Bun commands (
bun install -g,bun add) instead of npm/yarn/pnpm.packages/zenko/src/utils/yaml.ts (1)
18-21: LGTM!The
loadOpenAPISpecfunction correctly delegates to the updatedparseYamlimplementation.packages/zenko/package.json (1)
64-72: LGTM!Dependencies correctly cleaned up after migrating from js-yaml to Bun's native YAML parsing. The removal of
js-yamland@types/js-yamlis appropriate.
| export function parseYaml(content: string): OpenAPISpec { | ||
| return jsYaml.load(content, YAML_OPTIONS) as OpenAPISpec | ||
| return Bun.YAML.parse(content) as OpenAPISpec | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Check the current file and its context
cat -n packages/zenko/src/utils/yaml.tsRepository: RawToast/zenko
Length of output: 826
🏁 Script executed:
# Search for OpenAPISpec type definition and exports
rg "OpenAPISpec" packages/zenko/src --type ts --type tsx -B 2 -A 2Repository: RawToast/zenko
Length of output: 85
🏁 Script executed:
# Check git history for this file to see if it was migrated from js-yaml
cd packages/zenko && git log --oneline -p src/utils/yaml.ts 2>/dev/null | head -100 || echo "Git history not available"Repository: RawToast/zenko
Length of output: 926
🏁 Script executed:
# Search for any YAML test files or examples
fd -e yaml -e yml packages/zenko --type fRepository: RawToast/zenko
Length of output: 419
🏁 Script executed:
# Check if there are references to js-yaml elsewhere in the codebase
rg "js-yaml|JSON_SCHEMA" packages/zenko --type ts --type tsxRepository: RawToast/zenko
Length of output: 85
🏁 Script executed:
# Search for OpenAPISpec definition in the zenko module
rg "OpenAPISpec" packages/zenko/src --type ts -B 5 -A 10Repository: RawToast/zenko
Length of output: 50371
🏁 Script executed:
# Check tsconfig.json for TypeScript strict settings
cat packages/zenko/tsconfig.json 2>/dev/null || cat tsconfig.json 2>/dev/null || echo "tsconfig not found in expected locations"Repository: RawToast/zenko
Length of output: 766
🏁 Script executed:
# Look for the zenko.ts file that exports OpenAPISpec
fd "zenko.ts" packages/zenko/srcRepository: RawToast/zenko
Length of output: 85
Remove incorrect migration premise and address missing error handling.
This is a new file, not a migration from js-yaml. The review comment's assumption about js-yaml compatibility is unfounded. Additionally, the functions lack error handling for invalid YAML input—Bun.YAML.parse() can throw, but the functions don't catch or handle these errors. Consider adding try-catch blocks or Result-style returns to handle parse failures gracefully.
🤖 Prompt for AI Agents
In packages/zenko/src/utils/yaml.ts around lines 9–11, remove any comment or
wording that claims this file is a migration from js-yaml (that premise is
incorrect), and add proper error handling around Bun.YAML.parse: wrap the parse
call in a try/catch, and on failure either throw a new Error with a clear
message like "Failed to parse YAML" including the original error details (or set
it as the cause), or return a Result-style object indicating failure; ensure the
exported API documents/propagates parse errors instead of letting Bun.YAML.parse
throw uncaught.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/zenko/package.json (1)
3-3: Version bump to 0.2.0 is optional but would clarify the breaking change.The package version remains
0.1.12while the runtime requirement has shifted from Node to Bun only. For pre-1.0 releases, this is acceptable, but incrementing to0.2.0would provide clearer signal to downstream consumers that this is a breaking runtime change. This is a soft recommendation, not a blocker.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/ci.yml(4 hunks)package.json(1 hunks)packages/zenko/README.md(1 hunks)packages/zenko/package.json(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- .github/workflows/ci.yml
- packages/zenko/README.md
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Run scripts from workspace root and maintain compatibility with Bun 1.3+ and Node >=18
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Run scripts from workspace root and maintain compatibility with Bun 1.3+ and Node >=18
Applied to files:
package.jsonpackages/zenko/package.json
📚 Learning: 2025-10-12T14:20:34.939Z
Learnt from: RawToast
Repo: RawToast/zenko PR: 1
File: package.json:20-20
Timestamp: 2025-10-12T14:20:34.939Z
Learning: In package.json scripts, "bun run --cwd <workspace>" without a script name is a valid helper alias pattern that forwards additional arguments. For example, a script like "zenko": "bun run --cwd packages/zenko" can be invoked as `bun zenko build` which forwards "build" to the workspace package, effectively running `bun run --cwd packages/zenko build`. This is an intentional design for flexible workspace helpers, not an error.
Applied to files:
package.jsonpackages/zenko/package.json
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Use `bun check` command to run lint, format, and type check together instead of individual commands
Applied to files:
package.json
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Applies to packages/zenko/dist/** : Never manually edit generated artifacts in `packages/zenko/dist`; this directory is auto-generated
Applied to files:
packages/zenko/package.json
📚 Learning: 2025-11-24T15:55:12.838Z
Learnt from: CR
Repo: RawToast/zenko PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T15:55:12.838Z
Learning: Applies to packages/zenko/src/__tests__/**/*.{ts,tsx,test.ts,test.tsx,spec.ts,spec.tsx} : Store test specifications in `packages/zenko/src/__tests__` and use snapshots for output verification
Applied to files:
packages/zenko/package.json
🔇 Additional comments (3)
package.json (1)
11-13: ✅ Engines constraint correctly set to support Bun.YAML.stringify.The
engines.bunfield is properly updated to>=1.2.22, which aligns with the YAML migration strategy.Bun.YAML.stringifywas introduced in Bun v1.2.22, and this constraint ensures compatible versions will be installed.packages/zenko/package.json (2)
47-49: ✅ Critical engine constraint fixed; Bun 1.2.22+ requirement properly enforced.The engines field now correctly specifies
"bun": ">=1.2.22", addressing the earlier concern aboutBun.YAML.stringifyavailability. This prevents installation on Bun v1.2.21 where the API doesn't exist.
64-72: ✅ Dependencies properly migrated to Bun-only toolchain.The removal of
js-yamland@types/js-yaml, along with the addition of@types/bun, correctly reflects the migration toBun.YAMLAPIs. Dev dependencies are appropriate for the Bun runtime.
Summary by CodeRabbit
Documentation
Chores
Tests
✏️ Tip: You can customize this high-level summary in your review settings.