Skip to content

Conversation

@sxzz
Copy link
Contributor

@sxzz sxzz commented Nov 17, 2025

Requires #3018 first

https://github.com/sxzz/obug is a newly developed project, forked from debug.

obug addresses several issues:

  • Built-in TypeScript support—no need to install @types/debug (More accurate)
  • Zero dependencies, achieved by dropping support for legacy browsers and older Node.js versions
    • Optimized for modern environments
    • Supports ES2015+ browsers
    • Compatible with Node.js 20.19 and above
  • Pure ESM
  • Extremely small footprint
    • Unpacked size: 21 KB vs 42 KB (including dependencies)
    • Production bundle size for browsers: only 3.22 kB, gzip: 1.5kB.
  • Uses trusted publishing (although some consider this meaningless, this is simply to inform those who care about it; related discussions are outside the scope of this post)

See e18e/ecosystem-issues#217 for discussion

Summary by CodeRabbit

  • Refactor
    • Enhanced debugging library with improved error logging capabilities, including support for error-level debug output alongside existing info and warning levels.

@graphite-app
Copy link

graphite-app bot commented Nov 17, 2025

How to use the Graphite Merge Queue

Add the label ready-to-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Walkthrough

The pull request replaces the debug library with obug across the CLI codebase. Dependencies are updated in package.json, and cli/src/utils/log.ts is modified to import from obug instead, update module augmentation, and apply a custom formatter for colored output.

Changes

Cohort / File(s) Summary
Dependency migration
cli/package.json
Removed debug (^4.4.3) and @types/debug (^4.1.12); added obug (^2.0.0) as runtime dependency
Logger implementation update
cli/src/utils/log.ts
Changed import from debug to createDebug from obug; updated module augmentation from declare module 'debug' to declare module 'obug'; modified debugFactory to use createDebug with a custom formatter for green-colored output

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Straightforward library substitution with minimal logic changes
  • Only two files modified with clear, parallel updates
  • Module augmentation change is localized and follows expected pattern
  • Verify obug API compatibility and formatter behavior matches original intent

Poem

🐰✨ A rabbit hops with glee,
As debug swaps for obug spree,
Green colors shine so bright and true,
Logs now dance in emerald hue! 🌿

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'perf: replace debug with obug' clearly and specifically summarizes the main change—replacing one debugging library with another for performance reasons.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1dcc4e and 9c6c2dc.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • cli/package.json (1 hunks)
  • cli/src/utils/log.ts (2 hunks)
🔇 Additional comments (4)
cli/src/utils/log.ts (3)

4-10: Module augmentation updated correctly for obug.

The module augmentation has been properly updated from 'debug' to 'obug', extending the Debugger interface with info, warn, and error methods that are manually attached in lines 22-32.


13-20: Custom formatter implementation looks correct.

The createDebug call adds a custom formatter i that colorizes output with green. The usage pattern is well-documented with the inline comment. The implementation aligns with the typical debug/formatters pattern, pending verification of obug's API compatibility.


2-2: Verify obug package existence and createDebug API support.

Unable to confirm via public sources that obug exports createDebug or supports the formatters option shown in lines 13-20. While the code usage pattern matches the debug package API, obug cannot be verified in public npm registries. Confirm that obug is the correct dependency name and that it provides the expected API.

cli/package.json (1)

9-10: Let me search for obug's changelog and documentation to verify the Node.js requirement claim.

Let me search more specifically for the obug package documentation.

The review comment is based on unverified assumptions about obug's Node.js compatibility.

The npm registry query confirmed that obug v2.0.0 has no specified Node.js engine requirement ("not specified"), which means it has no enforced minimum version constraint. The claim in the review that obug is "optimized for Node.js 20.19+ and drops legacy support" lacks supporting evidence in publicly available documentation. Without proof that obug 2.0.0 actually requires Node.js 20.19+, there is no compatibility issue with the current engines: { "node": ">= 16" } field in cli/package.json.

Likely an incorrect or invalid review comment.


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

@Brooooooklyn Brooooooklyn merged commit f70331b into napi-rs:main Nov 21, 2025
58 checks passed
@sxzz sxzz deleted the perf/obug branch November 21, 2025 04:41
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.

2 participants