Skip to content

feat: enhance prompt health checks with additional hints and improve …#12

Merged
peixl merged 1 commit into
mainfrom
develop
May 19, 2026
Merged

feat: enhance prompt health checks with additional hints and improve …#12
peixl merged 1 commit into
mainfrom
develop

Conversation

@peixl
Copy link
Copy Markdown
Owner

@peixl peixl commented May 19, 2026

…user guidance in both English and Chinese

Summary / 概要

  • What changed?
  • 这次改动解决了什么问题?

Why / 背景

  • Why is this change needed?
  • 这项改动想改善什么用户体验、流程或稳定性?

Scope / 范围

  • Docs / 文档
  • UI / UX
  • i18n / 多语言
  • Build / CI / Deploy
  • Content / 教程内容
  • Other / 其他

Validation / 验证

  • npm run build
  • Manual smoke test / 手动冒烟验证
  • Screenshots attached when UI changed / UI 改动已附截图

Validation notes / 验证说明:

Risks / 风险

  • Any known risks, tradeoffs, or follow-up work?
  • 是否有已知风险、权衡或后续待办?

Checklist / 检查清单

  • I tested the changed behavior locally
  • 我已检查文案、链接和中英文内容是否一致
  • I updated docs when needed
  • 我确认没有提交本地构建产物或临时文件

Summary by CodeRabbit

  • New Features

    • Added helpful hint guidance displayed when quality checks fail in the generator
  • Bug Fixes

    • Improved detection of user roles and quantified metrics in prompts
    • Fixed recovery prompt step numbering
  • Documentation

    • Updated case descriptions emphasizing one-click usability and friendly user experience
    • Enhanced safety rules to clarify "Save as" requirements and conflict handling
    • Strengthened prompt opening guidelines with numbered format requirements
    • Clarified Windows exe installer delivery in finance reconciliation case

Review Change Stack

Copilot AI review requested due to automatic review settings May 19, 2026 08:15
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
codex-getting-started-tutorial 4549fd7 Commit Preview URL

Branch Preview URL
May 19 2026, 08:13 AM

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d672323d-1b10-4587-ba77-87fa8ec374bc

📥 Commits

Reviewing files that changed from the base of the PR and between d755049 and 4549fd7.

📒 Files selected for processing (11)
  • src/components/generator/GeneratorApp.tsx
  • src/data/cases/_more.ts
  • src/data/cases/finance.ts
  • src/i18n/dictionaries/en.ts
  • src/i18n/dictionaries/zh.ts
  • src/lib/generatorPromptHealth.ts
  • src/lib/promptBuilder.ts
  • src/lib/promptModules.test.ts
  • src/lib/promptModules.ts
  • src/lib/promptQuality.test.ts
  • src/lib/promptQuality.ts

📝 Walkthrough

Walkthrough

This PR enhances prompt validation and user guidance by introducing quality-check hints in the UI, expanding health detection patterns, refactoring baseline prompt modules to consolidate safety rules and update opening/warm-UX guidance, simplifying prompt cleanup logic, and updating case prompts for finance and cross-business scenarios.

Changes

Prompt Health, Quality Hints, and Prompt Module Updates

Layer / File(s) Summary
Quality Check Hint Rendering
src/components/generator/GeneratorApp.tsx, src/i18n/dictionaries/en.ts, src/i18n/dictionaries/zh.ts
GeneratorApp defines QUALITY_HINT_KEYS mapping from health-check IDs to dictionary hint keys. When prompt health is not ready, the UI renders the first two failing checks as a bullet list with both label and hint text. Chip elements receive tooltips from the hint mapping for failing checks. English and Chinese dictionaries provide corresponding hint strings for goal, features, IO, acceptance, user target, and metric fields.
Prompt Health Detection Expansion
src/lib/generatorPromptHealth.ts
WHO_WORDS keyword lists are expanded with additional Chinese (学生, 教师, etc.) and English (student, teacher, etc.) person/role terms. METRIC_WORDS gains Chinese metric phrases. A new METRIC_NUMBER_UNIT regex detects quantified patterns. The metric health check now passes when text matches either METRIC_WORDS keywords or the new regex pattern.
Prompt Baseline Modules Refactoring
src/lib/promptModules.ts, src/lib/promptModules.test.ts
SAFETY_RULES in both Chinese and English now explicitly require "Save as" write behavior and auto-timestamp on conflicts. OPENING_BRIEF is rewritten to enforce a short, numbered 3–8 line format and immediate workflow start without waiting for reply (English version references Quick Start Protocol). WARM_UX_ZH updates step/confirmation guidance and caps progress bar refresh to once per second; WARM_UX_EN removes the "Save as" write rule (now in SAFETY_RULES). SUCCESS_PICTURE_ZH rephrases the final screen as a lasting impression. Tests are updated to verify save-as presence in CONSTRAINTS, numbered lines in OPENING_BRIEF_EN, and absence of write rules from WARM_UX modules.
Prompt Quality Blank-Line Deduping
src/lib/promptQuality.ts, src/lib/promptQuality.test.ts
A new local dedupeBlankLines helper collapses 3+ consecutive newlines to a single blank line and trims whitespace. withDesktopQualityBar now uses this helper instead of legacy boilerplate compaction. Tests replace coverage of old repeated-ending compaction with a new test verifying 3+ blank-line folding.
Case Prompt and Recovery Updates
src/data/cases/finance.ts, src/data/cases/_more.ts, src/lib/promptBuilder.ts
Finance reconciliation case (both zh and en) now explicitly states Windows .exe installer packaging and removes the local/network processing feature item. dataSkuProfitRadar and productListingQualityChecker cases update their role text to emphasize one-click and friendly UX for cross-business and product teammates. Chinese recovery prompt step 5 text is corrected in buildRecoveryPrompt.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A health check now whispers its hints so clear,
Metrics expand to hear "quantity" near,
Modules refactor with safety rules neat,
Blank lines collapse in a dedup so sweet,
Cases bloom brightly—prompts now complete! 🌟

✨ 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 develop

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.

@peixl peixl merged commit 44756ee into main May 19, 2026
7 of 9 checks passed
@peixl peixl review requested due to automatic review settings May 19, 2026 08:36
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