Skip to content

Update prompts.ts#1245

Open
yuzzjj wants to merge 1 commit into
claude-code-best:mainfrom
yuzzjj:main
Open

Update prompts.ts#1245
yuzzjj wants to merge 1 commit into
claude-code-best:mainfrom
yuzzjj:main

Conversation

@yuzzjj
Copy link
Copy Markdown

@yuzzjj yuzzjj commented May 20, 2026

fix bun run dev repl no Response

Summary by CodeRabbit

  • Refactor
    • Optimized module loading mechanism to ensure consistent feature flag handling across the application and improve performance.

Review Change Stack

fix bun run dev   repl no Response
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 69221459-3e62-4cb9-82dc-d218eadde64f

📥 Commits

Reviewing files that changed from the base of the PR and between 5b5fbb2 and 84aafac.

📒 Files selected for processing (1)
  • src/constants/prompts.ts

📝 Walkthrough

Walkthrough

BriefTool module loading is refactored from eager evaluation to lazy initialization with caching. A new getBriefToolModule() function defers the require call until the KAIROS and KAIROS_BRIEF feature flags are enabled. Call sites in getBriefSection() and getProactiveSection() are updated to invoke the function instead of accessing the constant.

Changes

BriefTool lazy-loading refactor

Layer / File(s) Summary
Lazy-loaded BriefTool module and call site updates
src/constants/prompts.ts
Cached lazy loader getBriefToolModule() replaces eager module constant and defers require to feature-flag check time. Both getBriefSection() and getProactiveSection() updated to invoke the loader function for brief-enabled checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A module waits until called to load,
Feature flags now pave the lazy road,
No eager require to block the way,
Just-in-time loading saves the day,
Cached and checked, the briefs appear with grace! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Update prompts.ts' is vague and generic, describing only the file being modified rather than the actual change being made. Consider a more descriptive title that captures the core change, such as 'Lazy-load BriefTool module with feature gating' or 'Convert BriefTool eager loading to lazy-initialized cached loader'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

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

@yuzzjj
Copy link
Copy Markdown
Author

yuzzjj commented May 20, 2026

根因是:原来的 require() 在模块顶层执行(文件被 import 时立即运行),此时 BriefTool.ts 因循环依赖尚未完成评估,isBriefEnabled
还没被定义。改为懒加载后,require() 推迟到第一次实际调用 getBriefToolModule() 时才执行,此时所有模块都已初始化完毕

@claude-code-best
Copy link
Copy Markdown
Owner

@yuzzjj CI 坏了, 请修复一下

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