skill-reference-readability-smoke.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env node
  2. const fs = require('fs');
  3. const path = require('path');
  4. const ROOT = path.resolve(__dirname, '..');
  5. const FILES = [
  6. path.join(ROOT, 'docs', 'manual-review-handoff.md'),
  7. path.join(ROOT, 'skills', 'tihao', 'references', 'user-workflow.md'),
  8. path.join(ROOT, 'skills', 'tihao', 'references', 'output-format.md')
  9. ];
  10. function main() {
  11. const checks = FILES.map(file => {
  12. const text = fs.readFileSync(file, 'utf8');
  13. const summary = {
  14. file: path.relative(ROOT, file).replace(/\\/g, '/'),
  15. hasBusinessSop: text.includes('商务 SOP') || text.includes('用户工作流'),
  16. hasManualReviewLabels: text.includes('人工复核标签'),
  17. hasAttributionTypes: text.includes('归因类型'),
  18. hasCustomerEffectBoundary: text.includes('不得宣称命中率提升') ||
  19. text.includes('效果证明边界') ||
  20. text.includes('不能宣称客户效果'),
  21. hasDoubaoModel: text.includes('doubao-seed-2-0-pro') || text.includes('视频分析'),
  22. hasSoftwareFields: text.includes('软件端交付表') || text.includes('tihao-sourcing-client-list.csv'),
  23. hasCommonMojibake: /[閹荤粵閺嶉崣鐟欑拠閻╂潏闁导缂傞弬閸熸矮娑斾梗]{3,}/.test(text) ||
  24. /[閵嗕梗閳ユ粣绱漖]/.test(text) ||
  25. /\uFFFD/.test(text)
  26. };
  27. return summary;
  28. });
  29. for (const check of checks) {
  30. assert(check.hasManualReviewLabels, `${check.file} should expose manual review labels`);
  31. assert(check.hasAttributionTypes, `${check.file} should expose attribution types`);
  32. assert(check.hasCustomerEffectBoundary, `${check.file} should expose customer-effect proof boundary`);
  33. assert(check.hasCommonMojibake === false, `${check.file} should not contain common mojibake`);
  34. }
  35. assert(checks.some(item => item.hasBusinessSop), 'skill references should preserve business SOP or workflow');
  36. assert(checks.some(item => item.hasDoubaoModel), 'skill references should preserve Doubao video analysis guidance');
  37. assert(checks.some(item => item.hasSoftwareFields), 'skill references should preserve software table guidance');
  38. console.log(JSON.stringify({ ok: true, checks }, null, 2));
  39. }
  40. function assert(condition, message) {
  41. if (!condition) throw new Error(message);
  42. }
  43. if (require.main === module) main();