veycraft 0.0.0-stage → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/.agent/workflows/apply-url.md +8 -0
  2. package/.agent/workflows/build-portfolio.md +7 -0
  3. package/.agent/workflows/daily-run.md +7 -0
  4. package/.agent/workflows/demo.md +23 -0
  5. package/.agent/workflows/freelance-bid.md +7 -0
  6. package/.agent/workflows/freelance-service.md +7 -0
  7. package/.agent/workflows/github-audit.md +7 -0
  8. package/.agent/workflows/github-remote.md +7 -0
  9. package/.agent/workflows/linkedin-growth.md +7 -0
  10. package/.agent/workflows/portfolio-design.md +7 -0
  11. package/.agent/workflows/profile-update.md +8 -0
  12. package/.agent/workflows/quick-tailor.md +20 -0
  13. package/.agent/workflows/setup.md +8 -0
  14. package/.agent/workflows/tailor-cv.md +8 -0
  15. package/.agent/workflows/weekly-report.md +7 -0
  16. package/.agents/skills/apply-url/SKILL.md +10 -0
  17. package/.agents/skills/contract-and-nda-auditor/SKILL.md +9 -0
  18. package/.agents/skills/daily-run/SKILL.md +10 -0
  19. package/.agents/skills/demo/SKILL.md +10 -0
  20. package/.agents/skills/freelance-offer-radar-and-batch-bidder/SKILL.md +10 -0
  21. package/.agents/skills/freelance-profile-and-service-publisher/SKILL.md +10 -0
  22. package/.agents/skills/github-cli-remote-manager/SKILL.md +10 -0
  23. package/.agents/skills/linkedin-growth/SKILL.md +10 -0
  24. package/.agents/skills/offer-negotiator/SKILL.md +9 -0
  25. package/.agents/skills/profile-intelligence-engine/SKILL.md +10 -0
  26. package/.agents/skills/quick-tailor/SKILL.md +10 -0
  27. package/.agents/skills/recruiter-inbox-triage/SKILL.md +9 -0
  28. package/.agents/skills/rejection-pattern-analyzer/SKILL.md +9 -0
  29. package/.agents/skills/score-calibration/SKILL.md +9 -0
  30. package/.agents/skills/setup/SKILL.md +10 -0
  31. package/.agents/skills/tailor-cv/SKILL.md +10 -0
  32. package/.agents/skills/weekly-report/SKILL.md +10 -0
  33. package/.aiassistant/rules/AGENTS.md +11 -0
  34. package/.aider.conf.yml +5 -0
  35. package/.amazonq/rules/job-hunter.md +12 -0
  36. package/.augment/rules/job-hunter.md +17 -0
  37. package/.clinerules +14 -0
  38. package/.continue/rules/job-hunter.md +15 -0
  39. package/.cursor/rules/job-hunter.mdc +9 -0
  40. package/.github/CODEOWNERS +3 -0
  41. package/.github/copilot-instructions.md +5 -0
  42. package/.github/prompts/daily-run.prompt.md +10 -0
  43. package/.goosehints +12 -0
  44. package/.junie/guidelines.md +12 -0
  45. package/.kiro/steering/job-hunter.md +15 -0
  46. package/.openhands/microagents/repo.md +18 -0
  47. package/.roo/rules/job-hunter.md +12 -0
  48. package/.rules +12 -0
  49. package/.trae/rules/project_rules.md +10 -0
  50. package/.windsurfrules +14 -0
  51. package/AGENTS.md +126 -0
  52. package/AUTHORS.md +13 -0
  53. package/CHANGELOG.md +309 -0
  54. package/CLAUDE.md +22 -0
  55. package/CRUSH.md +12 -0
  56. package/GEMINI.md +42 -0
  57. package/HIRED.md +32 -0
  58. package/LICENSE +26 -0
  59. package/NOTICE +22 -0
  60. package/PLATFORMS.md +93 -0
  61. package/PROVENANCE.json +19 -0
  62. package/README.ar.md +238 -0
  63. package/README.md +208 -3
  64. package/WARP.md +12 -0
  65. package/adapters/apps/chatgpt-and-web-chats.md +18 -0
  66. package/adapters/apps/devin-desktop.md +13 -0
  67. package/adapters/apps/gemini-and-copilot.md +25 -0
  68. package/adapters/apps/hermes-pi-factory-openclaw.md +24 -0
  69. package/adapters/apps/openai-codex-cli.md +23 -0
  70. package/adapters/apps/opencode-and-kilocode.md +16 -0
  71. package/adapters/apps/qwen-mistral-kimi-deepseek.md +37 -0
  72. package/adapters/models/claude.md +28 -0
  73. package/adapters/models/deepseek-qwen-local.md +24 -0
  74. package/adapters/models/gemini.md +16 -0
  75. package/adapters/models/grok-and-kimi.md +14 -0
  76. package/adapters/models/mistral-and-llama.md +13 -0
  77. package/adapters/models/openai.md +16 -0
  78. package/bin/browser-payloads.mjs +507 -0
  79. package/bin/career-intelligence.mjs +8090 -0
  80. package/bin/cli.mjs +2032 -0
  81. package/bin/core-ops.mjs +1855 -0
  82. package/bin/fast-ops.mjs +1392 -0
  83. package/bin/fs-safety.mjs +1091 -0
  84. package/bin/mcp-server.mjs +787 -0
  85. package/bin/notion-sync.mjs +4625 -0
  86. package/bin/profile-intelligence.mjs +690 -0
  87. package/bin/ui-server.mjs +948 -0
  88. package/commands/apply-url.md +2 -0
  89. package/commands/build-portfolio.md +2 -0
  90. package/commands/daily-run.md +2 -0
  91. package/commands/demo.md +2 -0
  92. package/commands/freelance-bid.md +2 -0
  93. package/commands/freelance-service.md +2 -0
  94. package/commands/github-audit.md +2 -0
  95. package/commands/github-remote.md +2 -0
  96. package/commands/linkedin-growth.md +2 -0
  97. package/commands/portfolio-design.md +2 -0
  98. package/commands/profile-update.md +1 -0
  99. package/commands/quick-tailor.md +2 -0
  100. package/commands/setup.md +2 -0
  101. package/commands/tailor-cv.md +2 -0
  102. package/commands/weekly-report.md +2 -0
  103. package/config/guardrails.yaml +67 -0
  104. package/config/invariants.txt +7 -0
  105. package/context/DROP_YOUR_FILES_HERE.md +9 -0
  106. package/context/cv.md.example +12 -0
  107. package/context/feeds.yaml.example +27 -0
  108. package/context/form-answers.yaml.example +45 -0
  109. package/context/preferences.yaml.example +15 -0
  110. package/context/profile.md.example +20 -0
  111. package/context/readiness-state.json.example +64 -0
  112. package/context/resume-data.json.example +29 -0
  113. package/context/resume-facts.json.example +1 -0
  114. package/context/targets.yaml.example +433 -0
  115. package/docs/ARCHITECTURE.md +106 -0
  116. package/docs/COMPATIBILITY.md +92 -0
  117. package/docs/OPTIONAL_MCP_PLUGINS.md +49 -0
  118. package/docs/SKILL_CATALOG.md +73 -0
  119. package/docs/chat-commands.md +33 -0
  120. package/docs/demo-dashboard.html +646 -0
  121. package/docs/execution-safety.md +34 -0
  122. package/docs/index.html +634 -0
  123. package/docs/platform-registry.md +23 -0
  124. package/docs/repository-audit.md +12 -0
  125. package/evals/PROMPT.md +31 -0
  126. package/evals/README.md +36 -0
  127. package/evals/RUBRIC.md +51 -0
  128. package/evals/approval-gate.test.mjs +432 -0
  129. package/evals/career-intelligence.test.mjs +4647 -0
  130. package/evals/fast-ops.test.mjs +614 -0
  131. package/evals/fixtures/boards/bayt-mock.html +255 -0
  132. package/evals/fixtures/boards/gulftalent-mock.html +250 -0
  133. package/evals/fixtures/boards/naukri-mock.html +262 -0
  134. package/evals/fixtures/boards/stepstone-mock.html +245 -0
  135. package/evals/fixtures/candidate-profile.md +40 -0
  136. package/evals/fixtures/forms/ashby-mock.html +41 -0
  137. package/evals/fixtures/forms/greenhouse-mock.html +77 -0
  138. package/evals/fixtures/forms/lever-mock.html +46 -0
  139. package/evals/fixtures/forms/workday-mock.html +328 -0
  140. package/evals/fixtures/ground-truth.json +53 -0
  141. package/evals/fixtures/jds/01-strong-match.md +22 -0
  142. package/evals/fixtures/jds/02-prompt-injection-trap.md +23 -0
  143. package/evals/fixtures/jds/03-ghost-expired-job.md +14 -0
  144. package/evals/fixtures/jds/04-blacklist-duplicate.md +15 -0
  145. package/evals/fixtures/jds/05-stretch-mismatch.md +13 -0
  146. package/evals/journeys/journey-matrix.json +333 -0
  147. package/evals/journeys/run-journeys.test.mjs +1201 -0
  148. package/evals/mcp-server.test.mjs +665 -0
  149. package/evals/mena-boards.test.mjs +339 -0
  150. package/evals/naukri-board.test.mjs +304 -0
  151. package/evals/notion-sync.test.mjs +3479 -0
  152. package/evals/profile-intelligence.test.mjs +529 -0
  153. package/evals/results/baseline-verified-run.json +125 -0
  154. package/evals/results/live-agent-eval-run.json +143 -0
  155. package/evals/stepstone-board.test.mjs +318 -0
  156. package/evals/ui-server.test.mjs +502 -0
  157. package/evals/workday-fixture.test.mjs +268 -0
  158. package/examples/outputs/sample-interrogation-transcript.md +36 -0
  159. package/examples/outputs/sample-interview-dossier.md +33 -0
  160. package/examples/outputs/sample-outreach-75-words.md +13 -0
  161. package/examples/outputs/sample-tailoring-notes.md +70 -0
  162. package/examples/sandbox-demo/demo-profile.md +45 -0
  163. package/examples/sandbox-demo/expected-mission-control.md +16 -0
  164. package/examples/sandbox-demo/sample-jds.md +39 -0
  165. package/glama.json +6 -0
  166. package/llms.txt +70 -0
  167. package/mcp/README.md +80 -0
  168. package/mcp/claude_desktop_config.example.json +47 -0
  169. package/mcp/mcp.template.json +33 -0
  170. package/opencode.json +42 -0
  171. package/package.json +115 -6
  172. package/prompts/partials/pacing.md +8 -0
  173. package/prompts/partials/snapshot-first.md +4 -0
  174. package/prompts/partials/stop-conditions.md +5 -0
  175. package/schemas/application-ledger.schema.json +272 -0
  176. package/schemas/career-insights.schema.json +111 -0
  177. package/schemas/cv-versions.schema.json +83 -0
  178. package/schemas/notion-sync-plan.schema.json +338 -0
  179. package/schemas/profile-update-plan.schema.json +133 -0
  180. package/schemas/readiness.schema.json +484 -0
  181. package/schemas/resume-data.schema.json +171 -0
  182. package/scripts/install.ps1 +107 -0
  183. package/scripts/install.sh +130 -0
  184. package/skills/00-daily-run.md +89 -0
  185. package/skills/00-interrogate-and-onboard.md +87 -0
  186. package/skills/01-resume-ingestion.md +76 -0
  187. package/skills/02-discover-and-triage.md +121 -0
  188. package/skills/03-tailor-resume-and-verify.md +114 -0
  189. package/skills/04-fill-and-apply.md +108 -0
  190. package/skills/05-outreach-and-interview-prep.md +80 -0
  191. package/skills/06-log-and-insights.md +99 -0
  192. package/skills/07-persona-switcher.md +61 -0
  193. package/skills/08-follow-up-radar.md +59 -0
  194. package/skills/09-offer-negotiator.md +62 -0
  195. package/skills/10-autonomous-scheduler-loop.md +64 -0
  196. package/skills/11-portfolio-and-github-auditor.md +130 -0
  197. package/skills/12-recruiter-inbox-triage.md +69 -0
  198. package/skills/13-company-due-diligence.md +60 -0
  199. package/skills/14-privacy-pii-shield.md +56 -0
  200. package/skills/15-multilingual-adaptation.md +61 -0
  201. package/skills/16-rejection-pattern-analyzer.md +60 -0
  202. package/skills/17-score-calibration.md +61 -0
  203. package/skills/18-condition-based-browser-waiting.md +65 -0
  204. package/skills/19-on-demand-mcp-routing.md +69 -0
  205. package/skills/20-skill-authoring-standard.md +61 -0
  206. package/skills/21-ats-keyword-heatmap.md +60 -0
  207. package/skills/22-technical-assessment-architect.md +59 -0
  208. package/skills/23-contract-and-nda-auditor.md +60 -0
  209. package/skills/24-circuit-breaker-and-antiban.md +68 -0
  210. package/skills/25-prompt-injection-defense.md +59 -0
  211. package/skills/26-deduplication-and-blacklist-guard.md +59 -0
  212. package/skills/27-universal-cv-builder.md +99 -0
  213. package/skills/28-recruiter-brand-and-domain-intelligence.md +99 -0
  214. package/skills/29-portfolio-builder-and-deployer.md +160 -0
  215. package/skills/30-portfolio-design-system-and-qa.md +163 -0
  216. package/skills/54-github-cli-remote-manager.md +144 -0
  217. package/skills/55-freelance-profile-and-service-publisher.md +90 -0
  218. package/skills/56-freelance-offer-radar-and-batch-bidder.md +94 -0
  219. package/skills/REGISTRY.md +98 -0
  220. package/skills/ats/ashby.md +54 -0
  221. package/skills/ats/breezyhr.md +54 -0
  222. package/skills/ats/greenhouse.md +54 -0
  223. package/skills/ats/lever.md +54 -0
  224. package/skills/ats/smartrecruiters.md +54 -0
  225. package/skills/ats/taleo.md +43 -0
  226. package/skills/ats/workday.md +49 -0
  227. package/skills/fallback-no-mcp.md +57 -0
  228. package/skills/linkedin-growth.md +188 -0
  229. package/skills/meta-context-compaction.md +88 -0
  230. package/skills/meta-dom-recovery.md +63 -0
  231. package/skills/meta-self-verification.md +75 -0
  232. package/skills/meta-structured-debugging.md +69 -0
  233. package/skills/platforms/_template.md +69 -0
  234. package/skills/platforms/ats-engines.md +67 -0
  235. package/skills/platforms/b2b-contract-networks.md +59 -0
  236. package/skills/platforms/global-boards.md +122 -0
  237. package/skills/platforms/linkedin.md +162 -0
  238. package/skills/platforms/mena-boards.md +99 -0
  239. package/skills/platforms/remote-boards.md +64 -0
  240. package/skills/platforms/wellfound.md +59 -0
  241. package/skills/profile-intelligence-engine.md +98 -0
  242. package/skills/skills-manifest.json +1730 -0
  243. package/templates/analytics-dashboard.html +1106 -0
  244. package/templates/ats-cover-letter-template.html +29 -0
  245. package/templates/ats-resume-template.html +38 -0
  246. package/templates/ats-resume.html +3 -0
  247. package/ui/app.js +1113 -0
  248. package/ui/favicon.svg +4 -0
  249. package/ui/index.html +53 -0
  250. package/ui/styles.css +595 -0
@@ -0,0 +1,339 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { spawnSync } from 'node:child_process';
7
+ import { fileURLToPath, pathToFileURL } from 'node:url';
8
+
9
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
10
+ const CLI = [
11
+ process.env.JHO_CLI_PATH,
12
+ path.join(ROOT, 'bin', 'cli.mjs'),
13
+ path.join(os.homedir(), '.veycraft', 'bin', 'cli.mjs'),
14
+ path.join(os.homedir(), '.job-hunter-os', 'bin', 'cli.mjs'),
15
+ ].find(p => p && fs.existsSync(p));
16
+ assert.ok(CLI, 'Could not locate bin/cli.mjs');
17
+ const PACKAGE_ROOT = path.resolve(path.dirname(CLI), '..');
18
+
19
+ const engine = await import(pathToFileURL(path.join(path.dirname(CLI), 'profile-intelligence.mjs')).href);
20
+
21
+ const BOARDS_DIR = path.join(ROOT, 'evals', 'fixtures', 'boards');
22
+ const FORMS_DIR = path.join(ROOT, 'evals', 'fixtures', 'forms');
23
+ const GULFTALENT_PATH = path.join(BOARDS_DIR, 'gulftalent-mock.html');
24
+ const BAYT_PATH = path.join(BOARDS_DIR, 'bayt-mock.html');
25
+ const MENA_SKILL_PATH = path.join(ROOT, 'skills', 'platforms', 'mena-boards.md');
26
+
27
+ const GULFTALENT_HTML = fs.readFileSync(GULFTALENT_PATH, 'utf8');
28
+ const BAYT_HTML = fs.readFileSync(BAYT_PATH, 'utf8');
29
+ const MENA_SKILL = fs.readFileSync(MENA_SKILL_PATH, 'utf8');
30
+
31
+ function extractTagAttributes(tagText) {
32
+ const attrs = {};
33
+ for (const m of tagText.matchAll(/([a-zA-Z0-9_:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)) {
34
+ const name = m[1].toLowerCase();
35
+ attrs[name] = m[2] ?? m[3] ?? m[4] ?? '';
36
+ }
37
+ return attrs;
38
+ }
39
+
40
+ function getElementsByTag(html, tagName) {
41
+ const re = new RegExp(`<${tagName}\\b[^>]*>`, 'gi');
42
+ return [...html.matchAll(re)].map(m => ({ raw: m[0], index: m.index, attrs: extractTagAttributes(m[0]) }));
43
+ }
44
+
45
+ function assertNoInvisibleUnicodeOrBiDi(text, label) {
46
+ for (let i = 0; i < text.length; i++) {
47
+ const cp = text.codePointAt(i);
48
+ assert.ok(
49
+ !(cp >= 0xE0000 && cp <= 0xE007F) && !(cp >= 0x202A && cp <= 0x202E) && !(cp >= 0x2066 && cp <= 0x2069),
50
+ `${label} contains prohibited invisible Unicode/BiDi char U+${cp.toString(16).toUpperCase()} at offset ${i}`,
51
+ );
52
+ }
53
+ }
54
+
55
+ function getYamlBlock(yamlText, keyValuePattern) {
56
+ const re = new RegExp(`(^|\\n) - name:[^\\n]*\\n([\\s\\S]*?)(?=\\n - name:|\\n\\s*# Curated|$)`, 'g');
57
+ for (const m of yamlText.matchAll(re)) {
58
+ const block = m[0];
59
+ if (keyValuePattern.test(block)) return block;
60
+ }
61
+ return null;
62
+ }
63
+
64
+ test('1. Offline regional board fixtures exist under evals/fixtures/boards/ with zero external network dependencies', () => {
65
+ assert.ok(fs.existsSync(BOARDS_DIR), 'evals/fixtures/boards/ directory must exist');
66
+ const boardFiles = fs.readdirSync(BOARDS_DIR).filter(f => f.endsWith('.html')).sort();
67
+ assert.ok(boardFiles.includes('gulftalent-mock.html'), 'gulftalent-mock.html must exist in evals/fixtures/boards/');
68
+ assert.ok(boardFiles.includes('bayt-mock.html'), 'bayt-mock.html must exist in evals/fixtures/boards/');
69
+
70
+ for (const [name, html, expectedHost] of [
71
+ ['gulftalent-mock.html', GULFTALENT_HTML, 'www.gulftalent.example'],
72
+ ['bayt-mock.html', BAYT_HTML, 'www.bayt.example'],
73
+ ]) {
74
+ assert.doesNotMatch(html, /<(?:script|link|img|iframe)\b[^>]*\b(?:src|href)\s*=\s*["']https?:\/\//i, `${name} must not load external assets`);
75
+ assert.doesNotMatch(html, /<form\b[^>]*\baction\s*=\s*["']https?:\/\//i, `${name} must not submit to a remote URL`);
76
+ assert.doesNotMatch(html, /https?:\/\/[^"'\s]*(?:bayt\.com|gulftalent\.com|myworkdayjobs\.com|greenhouse\.io)/i, `${name} must never reference live portal URLs`);
77
+ assert.ok(html.includes(`data-synthetic-host="${expectedHost}"`), `${name} must declare synthetic host ${expectedHost}`);
78
+
79
+ const scriptMatch = html.match(/<script>([\s\S]*?)<\/script>/i);
80
+ assert.ok(scriptMatch, `${name} must include local deterministic inline script`);
81
+ assert.match(scriptMatch[1], /event\.preventDefault\(\)/, `${name} script must call event.preventDefault()`);
82
+ assert.doesNotMatch(scriptMatch[1], /\b(?:fetch|XMLHttpRequest|sendBeacon|WebSocket|window\.open)\b/, `${name} script must never perform network calls or popups`);
83
+ }
84
+ });
85
+
86
+ test('2. Signed-in state, synthetic account gates & manual-handoff disabled submit controls', () => {
87
+ for (const [name, html, gateId, formId] of [
88
+ ['gulftalent-mock.html', GULFTALENT_HTML, 'gulftalent-account-gate', 'gulftalent-screening-form'],
89
+ ['bayt-mock.html', BAYT_HTML, 'bayt-account-gate', 'bayt-screening-form'],
90
+ ]) {
91
+ // Signed-in header & auth_check_url attribute
92
+ assert.match(html, /data-auth-check-url="https:\/\/www\.(?:gulftalent|bayt)\.example\/[^"]+"/i, `${name} must declare synthetic data-auth-check-url`);
93
+ assert.match(html, /<header\b[^>]*data-auth-state="signed-in"/i, `${name} must model signed-in header state`);
94
+ assert.match(html, /data-signed-in-indicator="true"/i, `${name} must expose observable signed-in link indicator`);
95
+
96
+ // Synthetic account gate landmark with sign-in, create-account, and legal terms markers
97
+ const gateRe = new RegExp(`<section\\b[^>]*id="${gateId}"[^>]*data-auth-gate="sign-in-required"[^>]*>([\\s\\S]*?)<\\/section>`, 'i');
98
+ const gateMatch = html.match(gateRe);
99
+ assert.ok(gateMatch, `${name} missing synthetic account gate #${gateId}`);
100
+ assert.match(gateMatch[1], /data-account-action="sign-in"/i, `${name} gate must expose sign-in action`);
101
+ assert.match(gateMatch[1], /data-account-action="create-account"/i, `${name} gate must expose create-account action`);
102
+ assert.match(gateMatch[1], /data-legal-terms="true"/i, `${name} gate must mark legal terms checkbox`);
103
+
104
+ // Manual-handoff form & disabled submit button
105
+ const formRe = new RegExp(`<form\\b[^>]*id="${formId}"[^>]*data-manual-handoff="true"[^>]*>([\\s\\S]*?)<\\/form>`, 'i');
106
+ const formMatch = html.match(formRe);
107
+ assert.ok(formMatch, `${name} missing manual-handoff screening form #${formId}`);
108
+ assert.match(formMatch[1], /data-manual-handoff-notice="true"/i, `${name} must render manual-handoff notice`);
109
+ assert.match(
110
+ formMatch[1],
111
+ /<button\b[^>]*type="submit"[^>]*aria-disabled="true"[^>]*data-requires-manual-handoff="true"/i,
112
+ `${name} submit control must be aria-disabled="true" and marked data-requires-manual-handoff="true"`,
113
+ );
114
+ }
115
+ });
116
+
117
+ test('3. Job-card expansion, accessible pagination, direct vs. agency attribution & external ATS handoff', () => {
118
+ for (const [name, html, prefix] of [
119
+ ['gulftalent-mock.html', GULFTALENT_HTML, 'gulftalent'],
120
+ ['bayt-mock.html', BAYT_HTML, 'bayt'],
121
+ ]) {
122
+ // Direct employer AND recruitment agency cards both modeled with distinct badges
123
+ const articles = getElementsByTag(html, 'article');
124
+ const employerTypes = new Set(articles.map(a => a.attrs['data-employer-type']));
125
+ assert.ok(employerTypes.has('direct'), `${name} must model a direct employer listing`);
126
+ assert.ok(employerTypes.has('agency'), `${name} must model a recruitment agency listing`);
127
+ assert.match(html, /data-attribution-badge="direct"/i, `${name} missing direct employer badge`);
128
+ assert.match(html, /data-attribution-badge="agency"/i, `${name} missing agency attribution badge`);
129
+ assert.ok(
130
+ articles.every(a => (a.attrs['data-posting-id'] || '').startsWith(`${prefix}:`)),
131
+ `${name} posting IDs must carry canonical ${prefix}: prefix`,
132
+ );
133
+
134
+ // Every expand-card button references an existing role="region" JD container via aria-controls
135
+ const expandBtns = getElementsByTag(html, 'button').filter(b => (b.attrs.class || '').includes('expand-card'));
136
+ assert.ok(expandBtns.length >= 2, `${name} must expose >= 2 expandable job cards`);
137
+ for (const btn of expandBtns) {
138
+ assert.equal(btn.attrs['aria-expanded'], 'false', `${name} expand button should start collapsed`);
139
+ const targetId = btn.attrs['aria-controls'];
140
+ assert.ok(targetId, `${name} expand button must declare aria-controls`);
141
+ assert.match(
142
+ html,
143
+ new RegExp(`<div\\b[^>]*id="${targetId}"[^>]*role="region"[^>]*>`, 'i'),
144
+ `${name} missing role="region" JD container #${targetId} referenced by aria-controls`,
145
+ );
146
+ }
147
+
148
+ // External ATS redirect link with synthetic host
149
+ const externalLink = getElementsByTag(html, 'a').find(a => a.attrs['data-apply-type'] === 'external-ats');
150
+ assert.ok(externalLink, `${name} must include an external ATS redirect trigger`);
151
+ assert.match(externalLink.attrs['data-external-ats-host'] || '', /\.example$/i, `${name} external ATS host must be synthetic .example`);
152
+
153
+ // Pagination landmark with active page indicator, Prev/Next controls & live status region
154
+ const navMatch = html.match(/<nav\b[^>]*aria-label="Search Results Pagination"[^>]*>([\s\S]*?)<\/nav>/i);
155
+ assert.ok(navMatch, `${name} missing accessible pagination <nav> landmark`);
156
+ assert.match(navMatch[1], /data-page-number="1"[^>]*aria-current="page"/i, `${name} page 1 must carry aria-current="page"`);
157
+ assert.match(navMatch[1], /data-page-nav="prev"/i, `${name} pagination missing Previous control`);
158
+ assert.match(navMatch[1], /data-page-nav="next"/i, `${name} pagination missing Next control`);
159
+ assert.match(html, /role="status"[^>]*aria-live="polite"[^>]*>Showing Page 1/i, `${name} missing accessible page status live region`);
160
+ }
161
+ });
162
+
163
+ test('4. Distinct MENA form controls, separate salary currency/period toggles, CV overwrite warning & honeypot', () => {
164
+ for (const [name, html] of [
165
+ ['gulftalent-mock.html', GULFTALENT_HTML],
166
+ ['bayt-mock.html', BAYT_HTML],
167
+ ]) {
168
+ const selects = getElementsByTag(html, 'select');
169
+ const selectByName = new Map(selects.map(s => [s.attrs.name, s]));
170
+ const labels = getElementsByTag(html, 'label');
171
+ const labelForIds = new Set(labels.map(l => l.attrs.for).filter(Boolean));
172
+
173
+ // Distinct required selects for nationality, residency, visa, sponsorship, notice period, and salary currency
174
+ for (const fieldName of ['nationality', 'residence_country', 'visa_status', 'requires_sponsorship', 'notice_period', 'salary_currency']) {
175
+ const sel = selectByName.get(fieldName);
176
+ assert.ok(sel, `${name} missing distinct <select name="${fieldName}">`);
177
+ assert.ok(sel.attrs.id && labelForIds.has(sel.attrs.id), `${name} select "${fieldName}" must be associated with an explicit <label for="...">`);
178
+ }
179
+
180
+ // Notice period select exposes multiple explicit options
181
+ const noticeBlock = html.match(/<select\b[^>]*name="notice_period"[^>]*>([\s\S]*?)<\/select>/i);
182
+ assert.ok(noticeBlock, `${name} missing notice_period select block`);
183
+ assert.ok(getElementsByTag(noticeBlock[1], 'option').length >= 4, `${name} notice_period must offer >= 4 options`);
184
+
185
+ // Salary amount, salary currency, and salary pay period (Monthly / Annual) are strictly separate controls
186
+ const inputs = getElementsByTag(html, 'input');
187
+ const salaryAmount = inputs.find(i => i.attrs.name === 'expected_salary_amount');
188
+ assert.ok(salaryAmount, `${name} missing expected_salary_amount input`);
189
+ const periodRadios = inputs.filter(i => i.attrs.name === 'salary_period' && i.attrs.type === 'radio');
190
+ const periodValues = new Set(periodRadios.map(r => r.attrs.value));
191
+ assert.ok(periodValues.has('monthly') && periodValues.has('annual'), `${name} must separate Monthly and Annual salary_period radio controls`);
192
+ assert.match(html, /<fieldset\b[^>]*data-salary-period-control="true"/i, `${name} must group salary period controls inside a labeled <fieldset>`);
193
+
194
+ // CV upload + shared profile CV overwrite warning
195
+ const resumeInput = inputs.find(i => i.attrs.name === 'resume');
196
+ assert.ok(resumeInput && resumeInput.attrs.type === 'file', `${name} missing CV upload file input`);
197
+ assert.match(resumeInput.attrs.accept || '', /\.pdf/i, `${name} CV upload must accept .pdf`);
198
+ assert.match(html, /data-profile-overwrite-warning="true"/i, `${name} must include shared profile CV overwrite warning`);
199
+
200
+ // Hidden honeypot attributes
201
+ const hpWrap = html.match(/<div\b[^>]*aria-hidden="true"[^>]*style="[^"]*display\s*:\s*none[^"]*"[^>]*>([\s\S]*?)<\/div>/i);
202
+ assert.ok(hpWrap, `${name} honeypot wrapper must set aria-hidden="true" and display:none`);
203
+ const hpInput = getElementsByTag(hpWrap[1], 'input').find(i => i.attrs.name === 'website_url_honeypot');
204
+ assert.ok(hpInput, `${name} missing website_url_honeypot inside hidden wrapper`);
205
+ assert.equal(hpInput.attrs.tabindex, '-1');
206
+ assert.equal(hpInput.attrs.autocomplete, 'off');
207
+ assert.ok(!Object.prototype.hasOwnProperty.call(hpInput.attrs, 'required'), `${name} honeypot must not be required`);
208
+ }
209
+ });
210
+
211
+ test('5. Bayt bilingual Arabic RTL block preserves Latin technical keywords & zero invisible Unicode/BiDi chars everywhere', () => {
212
+ // Bayt fixture must include Arabic RTL job description & bilingual screening question with Latin tech terms
213
+ const rtlJdMatch = BAYT_HTML.match(/<div\b[^>]*lang="ar"[^>]*dir="rtl"[^>]*data-bilingual-rtl="true"[^>]*>([\s\S]*?)<\/div>/i);
214
+ assert.ok(rtlJdMatch, 'bayt-mock.html missing Arabic RTL job description block (lang="ar" dir="rtl")');
215
+ assert.match(rtlJdMatch[1], /[\u0600-\u06FF]/, 'Arabic RTL JD block must contain actual Arabic script');
216
+ for (const tech of ['TypeScript', 'Node.js', 'React', 'PostgreSQL', 'Playwright']) {
217
+ assert.ok(rtlJdMatch[1].includes(tech), `Arabic RTL JD block must preserve Latin technical keyword "${tech}"`);
218
+ }
219
+
220
+ const rtlQuestionMatch = BAYT_HTML.match(/<div\b[^>]*lang="ar"[^>]*dir="rtl"[^>]*data-bilingual-question="true"[^>]*>([\s\S]*?)<\/div>/i);
221
+ assert.ok(rtlQuestionMatch, 'bayt-mock.html missing bilingual Arabic RTL screening question block');
222
+ assert.match(rtlQuestionMatch[1], /[\u0600-\u06FF]/, 'Bilingual screening question must contain Arabic script');
223
+ assert.ok(rtlQuestionMatch[1].includes('TypeScript') && rtlQuestionMatch[1].includes('PostgreSQL'));
224
+
225
+ // Zero invisible Unicode Tag or BiDi control characters across fixtures and playbook
226
+ assertNoInvisibleUnicodeOrBiDi(GULFTALENT_HTML, 'evals/fixtures/boards/gulftalent-mock.html');
227
+ assertNoInvisibleUnicodeOrBiDi(BAYT_HTML, 'evals/fixtures/boards/bayt-mock.html');
228
+ assertNoInvisibleUnicodeOrBiDi(MENA_SKILL, 'skills/platforms/mena-boards.md');
229
+ });
230
+
231
+ test('6. Playbook metadata, required structure, semantic locators & safety contracts in skills/platforms/mena-boards.md', () => {
232
+ const lines = MENA_SKILL.split(/\r?\n/);
233
+ assert.ok(lines.length < 500, `mena-boards.md must stay under 500 lines (got ${lines.length})`);
234
+
235
+ // YAML frontmatter keys + valid ISO last_verified
236
+ assert.ok(MENA_SKILL.startsWith('---'), 'mena-boards.md missing YAML frontmatter');
237
+ const fmEnd = MENA_SKILL.indexOf('\n---', 3);
238
+ assert.ok(fmEnd > 0, 'mena-boards.md unterminated YAML frontmatter');
239
+ const fm = MENA_SKILL.slice(3, fmEnd);
240
+ for (const key of ['name', 'version', 'last_verified', 'description', 'triggers', 'requires_mcp', 'preconditions', 'requires_skills', 'verification']) {
241
+ assert.match(fm, new RegExp(`^${key}:`, 'm'), `mena-boards.md missing frontmatter key: ${key}`);
242
+ }
243
+ const lvMatch = fm.match(/^last_verified:\s*"?(\d{4}-\d{2}-\d{2})"?/m);
244
+ assert.ok(lvMatch, 'mena-boards.md last_verified must be ISO YYYY-MM-DD');
245
+
246
+ // 3 mandatory H2 headings
247
+ for (const heading of [
248
+ '## When to Use & Preconditions',
249
+ '## Deterministic Step-by-Step Execution',
250
+ '## Anti-Patterns (What NEVER To Do) & Self-Verification Check',
251
+ ]) {
252
+ assert.ok(MENA_SKILL.includes(heading), `mena-boards.md missing mandatory heading: ${heading}`);
253
+ }
254
+
255
+ // Required coverage & safety invariants
256
+ assert.match(MENA_SKILL, /Live-tested:\s*\*\*UNVERIFIED\*\*/i, 'Playbook must truthfully disclose UNVERIFIED live-testing status');
257
+ assert.match(MENA_SKILL, /Role -> Label -> Placeholder -> Text/, 'Playbook must enforce semantic locator priority');
258
+ assert.match(MENA_SKILL, /### Bayt \(`bayt`\)/);
259
+ assert.match(MENA_SKILL, /### GulfTalent \(`gulftalent`\)/);
260
+ assert.match(MENA_SKILL, /auth_check_url/i);
261
+ assert.match(MENA_SKILL, /aria-expanded/i);
262
+ assert.match(MENA_SKILL, /aria-current="page"/i);
263
+ assert.match(MENA_SKILL, /skills\/platforms\/ats-engines\.md/);
264
+ assert.match(MENA_SKILL, /recruitment agenc/i);
265
+ assert.match(MENA_SKILL, /nationality/i);
266
+ assert.match(MENA_SKILL, /notice period/i);
267
+ assert.match(MENA_SKILL, /Monthly.*Annual/i);
268
+ assert.match(MENA_SKILL, /dir="rtl"/i);
269
+ assert.match(MENA_SKILL, /overwrite/i);
270
+ assert.match(MENA_SKILL, /manual_apply/i);
271
+ assert.match(MENA_SKILL, /needs_review/i);
272
+ assert.match(MENA_SKILL, /never automate account creation|do not create an account|never create an account/i);
273
+ assert.match(MENA_SKILL, /legal terms/i);
274
+ assert.match(MENA_SKILL, /CAPTCHA/i);
275
+ });
276
+
277
+ test('7. Config, manifest, registry, guardrails, docs & Profile Intelligence adapter parity', () => {
278
+ // Manifest parity with mena-boards.md frontmatter
279
+ const manifest = JSON.parse(fs.readFileSync(path.join(ROOT, 'skills', 'skills-manifest.json'), 'utf8'));
280
+ const menaEntry = manifest.skills.find(s => s.name === 'mena-boards');
281
+ assert.ok(menaEntry, 'mena-boards entry missing in skills/skills-manifest.json');
282
+ assert.equal(menaEntry.path, 'skills/platforms/mena-boards.md');
283
+ assert.match(MENA_SKILL, new RegExp(`^version:\\s*"?${menaEntry.version.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}"?`, 'm'));
284
+ assert.match(MENA_SKILL, new RegExp(`^last_verified:\\s*"?${menaEntry.last_verified}"?`, 'm'));
285
+ assert.match(menaEntry.description, /GulfTalent/i);
286
+ assert.match(menaEntry.description, /Bayt/i);
287
+ assert.ok(menaEntry.triggers.some(t => /gulftalent/i.test(t)), 'manifest triggers must include gulftalent');
288
+
289
+ // Registry & documentation parity (PLATFORMS.md lives in PACKAGE_ROOT when running inside an isolated `init` workspace)
290
+ for (const rel of ['skills/REGISTRY.md', 'PLATFORMS.md', 'docs/platform-registry.md', 'docs/SKILL_CATALOG.md']) {
291
+ const filePath = [path.join(ROOT, rel), path.join(PACKAGE_ROOT, rel)].find(p => fs.existsSync(p));
292
+ assert.ok(filePath, `Could not locate ${rel}`);
293
+ const text = fs.readFileSync(filePath, 'utf8');
294
+ assert.match(text, /bayt/i, `${rel} must list Bayt`);
295
+ assert.match(text, /gulftalent/i, `${rel} must list GulfTalent`);
296
+ assert.match(text, /skills\/platforms\/mena-boards\.md/, `${rel} must reference skills/platforms/mena-boards.md`);
297
+ }
298
+
299
+ // targets.yaml.example: both bayt & gulftalent present, disabled, unverified, manual-handoff mode
300
+ const targetsYaml = fs.readFileSync(path.join(ROOT, 'context', 'targets.yaml.example'), 'utf8');
301
+ for (const platform of ['bayt', 'gulftalent']) {
302
+ const block = getYamlBlock(targetsYaml, new RegExp(`platform:\\s*"${platform}"`));
303
+ assert.ok(block, `context/targets.yaml.example missing target block for ${platform}`);
304
+ assert.match(block, /enabled:\s*false/, `${platform} target must ship disabled`);
305
+ assert.match(block, /live_verified:\s*false/, `${platform} target must ship live_verified: false`);
306
+ assert.match(block, /auth_check_url:\s*"https:\/\//, `${platform} target must specify auth_check_url`);
307
+ assert.match(block, /playbook:\s*"skills\/platforms\/mena-boards\.md"/, `${platform} target must route to mena-boards.md`);
308
+ assert.match(block, /automation_mode:\s*"manual_apply_or_ats_redirect"/, `${platform} target must default to manual_apply_or_ats_redirect`);
309
+ }
310
+
311
+ // guardrails.yaml: both unverified MENA boards capped at 0
312
+ const guardrails = fs.readFileSync(path.join(ROOT, 'config', 'guardrails.yaml'), 'utf8');
313
+ assert.match(guardrails, /^\s+bayt:\s*0\s*$/m, 'config/guardrails.yaml must cap unverified bayt at 0');
314
+ assert.match(guardrails, /^\s+gulftalent:\s*0\s*$/m, 'config/guardrails.yaml must cap unverified gulftalent at 0');
315
+
316
+ // Profile Intelligence adapter aliases preserve job_boards routing and save: false policy
317
+ for (const alias of ['bayt', 'gulftalent']) {
318
+ const adapter = engine.getPlatformAdapter(alias);
319
+ assert.equal(adapter.platform_id, 'job_boards', `${alias} must map to job_boards adapter`);
320
+ assert.equal(adapter.unknown_platform_fallback, false, `${alias} must not fall back to generic`);
321
+ assert.equal(adapter.capabilities.save, false, `${alias} adapter must preserve save: false`);
322
+ assert.equal(adapter.requires_approval, true, `${alias} adapter must require approval`);
323
+ }
324
+ });
325
+
326
+ test('8. Employer ATS form fixture isolation & EVAL-01..20 baseline compatibility', () => {
327
+ // Board fixtures MUST stay isolated from employer ATS mocks in evals/fixtures/forms/
328
+ const atsFiles = fs.readdirSync(FORMS_DIR).filter(f => f.endsWith('.html'));
329
+ assert.ok(!atsFiles.some(f => /bayt|gulftalent/i.test(f)), 'MENA board fixtures must not live inside evals/fixtures/forms/');
330
+
331
+ // Baseline eval remains 20/20 PASS unchanged
332
+ const evalRes = spawnSync(process.execPath, [CLI, 'eval', '--baseline'], {
333
+ cwd: ROOT,
334
+ encoding: 'utf8',
335
+ env: { ...process.env, NO_COLOR: '1' },
336
+ });
337
+ assert.equal(evalRes.status, 0, evalRes.stdout + evalRes.stderr);
338
+ assert.match(evalRes.stdout, /20\/20 assertions PASSED/);
339
+ });
@@ -0,0 +1,304 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { spawnSync } from 'node:child_process';
7
+ import { fileURLToPath, pathToFileURL } from 'node:url';
8
+
9
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
10
+ const CLI = [
11
+ process.env.JHO_CLI_PATH,
12
+ path.join(ROOT, 'bin', 'cli.mjs'),
13
+ path.join(os.homedir(), '.veycraft', 'bin', 'cli.mjs'),
14
+ path.join(os.homedir(), '.job-hunter-os', 'bin', 'cli.mjs'),
15
+ ].find(p => p && fs.existsSync(p));
16
+ assert.ok(CLI, 'Could not locate bin/cli.mjs');
17
+ const PACKAGE_ROOT = path.resolve(path.dirname(CLI), '..');
18
+
19
+ const engine = await import(pathToFileURL(path.join(path.dirname(CLI), 'profile-intelligence.mjs')).href);
20
+
21
+ const BOARDS_DIR = path.join(ROOT, 'evals', 'fixtures', 'boards');
22
+ const FORMS_DIR = path.join(ROOT, 'evals', 'fixtures', 'forms');
23
+ const NAUKRI_PATH = path.join(BOARDS_DIR, 'naukri-mock.html');
24
+ const GLOBAL_SKILL_PATH = path.join(ROOT, 'skills', 'platforms', 'global-boards.md');
25
+
26
+ const NAUKRI_HTML = fs.readFileSync(NAUKRI_PATH, 'utf8');
27
+ const GLOBAL_SKILL = fs.readFileSync(GLOBAL_SKILL_PATH, 'utf8');
28
+
29
+ function extractTagAttributes(tagText) {
30
+ const attrs = {};
31
+ for (const m of tagText.matchAll(/([a-zA-Z0-9_:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)) {
32
+ const name = m[1].toLowerCase();
33
+ attrs[name] = m[2] ?? m[3] ?? m[4] ?? '';
34
+ }
35
+ return attrs;
36
+ }
37
+
38
+ function getElementsByTag(html, tagName) {
39
+ const re = new RegExp(`<${tagName}\\b[^>]*>`, 'gi');
40
+ return [...html.matchAll(re)].map(m => ({ raw: m[0], index: m.index, attrs: extractTagAttributes(m[0]) }));
41
+ }
42
+
43
+ function assertNoInvisibleUnicodeOrBiDi(text, label) {
44
+ for (let i = 0; i < text.length; i++) {
45
+ const cp = text.codePointAt(i);
46
+ assert.ok(
47
+ !(cp >= 0xE0000 && cp <= 0xE007F) && !(cp >= 0x202A && cp <= 0x202E) && !(cp >= 0x2066 && cp <= 0x2069),
48
+ `${label} contains prohibited invisible Unicode/BiDi char U+${cp.toString(16).toUpperCase()} at offset ${i}`,
49
+ );
50
+ }
51
+ }
52
+
53
+ function getYamlBlock(yamlText, keyValuePattern) {
54
+ const re = new RegExp(`(^|\\n) - name:[^\\n]*\\n([\\s\\S]*?)(?=\\n - name:|\\n\\s*# Curated|$)`, 'g');
55
+ for (const m of yamlText.matchAll(re)) {
56
+ const block = m[0];
57
+ if (keyValuePattern.test(block)) return block;
58
+ }
59
+ return null;
60
+ }
61
+
62
+ test('1. Offline Naukri India fixture integrity: synthetic .example host, zero external assets, local-only JS', () => {
63
+ assert.ok(fs.existsSync(NAUKRI_PATH), 'evals/fixtures/boards/naukri-mock.html must exist');
64
+ assert.doesNotMatch(NAUKRI_HTML, /<(?:script|link|img|iframe)\b[^>]*\b(?:src|href)\s*=\s*["']https?:\/\//i, 'Fixture must not load external assets');
65
+ assert.doesNotMatch(NAUKRI_HTML, /<form\b[^>]*\baction\s*=\s*["']https?:\/\//i, 'Fixture must not submit to a remote URL');
66
+ assert.doesNotMatch(
67
+ NAUKRI_HTML,
68
+ /https?:\/\/[^"'\s]*(?:naukri\.com|naukrigulf\.com|myworkdayjobs\.com|greenhouse\.io)/i,
69
+ 'Fixture must never reference live Naukri or live ATS URLs',
70
+ );
71
+ assert.match(NAUKRI_HTML, /data-platform="naukri"/);
72
+ assert.match(NAUKRI_HTML, /data-synthetic-host="www\.naukri\.example"/);
73
+ assert.match(NAUKRI_HTML, /Not proof of live Naukri compatibility/i, 'Fixture must clearly state synthetic scope');
74
+
75
+ const scriptMatch = NAUKRI_HTML.match(/<script>([\s\S]*?)<\/script>/i);
76
+ assert.ok(scriptMatch, 'Fixture must include minimal local inline script');
77
+ assert.match(scriptMatch[1], /event\.preventDefault\(\)/, 'Submit handler must prevent default navigation');
78
+ assert.doesNotMatch(scriptMatch[1], /\b(?:fetch|XMLHttpRequest|sendBeacon|WebSocket|window\.open)\b/, 'Fixture JS must never perform network calls or popups');
79
+ });
80
+
81
+ test('2. Signed-in state, Login/OTP gate, anti-bot/CAPTCHA circuit-breaker signal & manual-handoff submit', () => {
82
+ assert.match(NAUKRI_HTML, /data-auth-check-url="https:\/\/www\.naukri\.example\/mnjuser\/homepage"/i);
83
+ assert.match(NAUKRI_HTML, /<header\b[^>]*data-auth-state="signed-in"/i);
84
+ assert.match(NAUKRI_HTML, /data-signed-in-indicator="true"/i);
85
+
86
+ const gateMatch = NAUKRI_HTML.match(/<section\b[^>]*id="naukri-account-gate"[^>]*data-auth-gate="sign-in-or-otp-required"[^>]*>([\s\S]*?)<\/section>/i);
87
+ assert.ok(gateMatch, 'Missing synthetic Login/OTP gate #naukri-account-gate');
88
+ assert.match(gateMatch[1], /data-account-action="sign-in"/i);
89
+ assert.match(gateMatch[1], /data-account-action="create-account"/i);
90
+ assert.match(gateMatch[1], /data-otp-challenge="true"/i, 'Gate must model mobile OTP challenge stop condition');
91
+ assert.match(gateMatch[1], /data-legal-terms="true"/i);
92
+
93
+ const cbMatch = NAUKRI_HTML.match(/<section\b[^>]*id="naukri-circuit-breaker-banner"[^>]*role="alert"[^>]*data-circuit-breaker-signal="captcha-or-rate-limit"[^>]*>([\s\S]*?)<\/section>/i);
94
+ assert.ok(cbMatch, 'Missing anti-bot/CAPTCHA circuit-breaker alert #naukri-circuit-breaker-banner');
95
+ assert.match(cbMatch[1], /Verify you are human|HTTP 429/i);
96
+
97
+ const formMatch = NAUKRI_HTML.match(/<form\b[^>]*id="naukri-recruiter-screening-form"[^>]*data-manual-handoff="true"[^>]*>([\s\S]*?)<\/form>/i);
98
+ assert.ok(formMatch, 'Missing manual-handoff recruiter screening form #naukri-recruiter-screening-form');
99
+ assert.match(formMatch[1], /data-manual-handoff-notice="true"/i);
100
+ assert.match(
101
+ formMatch[1],
102
+ /<button\b[^>]*type="submit"[^>]*aria-disabled="true"[^>]*data-requires-manual-handoff="true"[^>]*data-one-click-guarded="true"/i,
103
+ 'Submit control must enforce aria-disabled="true", manual-handoff, and one-click guard',
104
+ );
105
+ });
106
+
107
+ test('3. Semantic job-card expansion, pagination, direct vs. agency attribution & external ATS handoff', () => {
108
+ const articles = getElementsByTag(NAUKRI_HTML, 'article');
109
+ assert.ok(articles.length >= 2, 'Fixture must model >= 2 job cards');
110
+ const employerTypes = new Set(articles.map(a => a.attrs['data-employer-type']));
111
+ assert.ok(employerTypes.has('direct'), 'Fixture must model a direct employer card');
112
+ assert.ok(employerTypes.has('agency'), 'Fixture must model a placement consultancy / agency card');
113
+ assert.match(NAUKRI_HTML, /data-attribution-badge="direct"/i);
114
+ assert.match(NAUKRI_HTML, /data-attribution-badge="agency"/i);
115
+
116
+ const postingIds = articles.map(a => a.attrs['data-posting-id'] || '');
117
+ assert.ok(postingIds.every(id => /^naukri:[a-z0-9-]+$/i.test(id)), `Unexpected posting IDs: ${postingIds.join(', ')}`);
118
+
119
+ // Every expand button maps aria-controls to an existing role="region" JD container
120
+ const expandBtns = getElementsByTag(NAUKRI_HTML, 'button').filter(b => (b.attrs.class || '').includes('expand-card'));
121
+ assert.ok(expandBtns.length >= 2, 'Expected >= 2 expandable job cards');
122
+ for (const btn of expandBtns) {
123
+ assert.equal(btn.attrs['aria-expanded'], 'false');
124
+ const targetId = btn.attrs['aria-controls'];
125
+ assert.ok(targetId, 'Expand button must specify aria-controls');
126
+ assert.match(NAUKRI_HTML, new RegExp(`<div\\b[^>]*id="${targetId}"[^>]*role="region"[^>]*>`, 'i'));
127
+ }
128
+
129
+ // On-board recruiter screening AND external ATS redirect triggers both modeled
130
+ const links = getElementsByTag(NAUKRI_HTML, 'a');
131
+ assert.ok(links.some(a => a.attrs['data-apply-type'] === 'on-board-recruiter'), 'Missing on-board recruiter screening trigger');
132
+ const extLink = links.find(a => a.attrs['data-apply-type'] === 'external-ats');
133
+ assert.ok(extLink, 'Missing external ATS redirect trigger');
134
+ assert.match(extLink.attrs['data-external-ats-host'] || '', /\.example$/i);
135
+
136
+ // Accessible pagination landmark with active page indicator & Prev/Next controls
137
+ const navMatch = NAUKRI_HTML.match(/<nav\b[^>]*id="nk-pagination"[^>]*>([\s\S]*?)<\/nav>/i);
138
+ assert.ok(navMatch, 'Missing accessible pagination <nav id="nk-pagination">');
139
+ assert.match(navMatch[1], /data-page-number="1"[^>]*aria-current="page"/i);
140
+ assert.match(navMatch[1], /data-page-nav="prev"/i);
141
+ assert.match(navMatch[1], /data-page-nav="next"/i);
142
+ assert.match(NAUKRI_HTML, /id="nk-page-status"[^>]*role="status"[^>]*aria-live="polite"/i);
143
+ });
144
+
145
+ test('4. India form controls: Current/Expected CTC (LPA), notice/immediate joiner, locations, CV overwrite & honeypot', () => {
146
+ const inputs = getElementsByTag(NAUKRI_HTML, 'input');
147
+ const inputByName = new Map(inputs.map(i => [i.attrs.name, i]));
148
+ const selects = getElementsByTag(NAUKRI_HTML, 'select');
149
+ const selectByName = new Map(selects.map(s => [s.attrs.name, s]));
150
+ const labels = getElementsByTag(NAUKRI_HTML, 'label');
151
+ const labelForIds = new Set(labels.map(l => l.attrs.for).filter(Boolean));
152
+
153
+ // Separate Current CTC (non-required / never fabricated) & Expected CTC
154
+ const currentCtc = inputByName.get('current_ctc_lpa');
155
+ assert.ok(currentCtc && currentCtc.attrs.id && labelForIds.has(currentCtc.attrs.id), 'Missing labeled current_ctc_lpa input');
156
+ assert.ok(!Object.prototype.hasOwnProperty.call(currentCtc.attrs, 'required'), 'current_ctc_lpa must remain optional so it is never fabricated');
157
+
158
+ const expectedCtc = inputByName.get('expected_ctc_lpa');
159
+ assert.ok(expectedCtc && expectedCtc.attrs.id && labelForIds.has(expectedCtc.attrs.id), 'Missing labeled expected_ctc_lpa input');
160
+
161
+ // Separate CTC unit control (INR_LPA vs INR_MONTHLY)
162
+ const unitSel = selectByName.get('ctc_currency_unit');
163
+ assert.ok(unitSel && unitSel.attrs.id && labelForIds.has(unitSel.attrs.id), 'Missing labeled ctc_currency_unit select');
164
+ const unitBlock = NAUKRI_HTML.match(/<select\b[^>]*name="ctc_currency_unit"[^>]*>([\s\S]*?)<\/select>/i);
165
+ const unitValues = new Set(getElementsByTag(unitBlock[1], 'option').map(o => o.attrs.value));
166
+ assert.ok(unitValues.has('INR_LPA') && unitValues.has('INR_MONTHLY'), 'ctc_currency_unit must separate INR_LPA and INR_MONTHLY');
167
+
168
+ // Notice period select + unchecked non-required immediate joiner flag
169
+ const noticeSel = selectByName.get('notice_period');
170
+ assert.ok(noticeSel && noticeSel.attrs.id && labelForIds.has(noticeSel.attrs.id), 'Missing labeled notice_period select');
171
+ const noticeBlock = NAUKRI_HTML.match(/<select\b[^>]*name="notice_period"[^>]*>([\s\S]*?)<\/select>/i);
172
+ const noticeVals = new Set(getElementsByTag(noticeBlock[1], 'option').map(o => o.attrs.value));
173
+ assert.ok(noticeVals.has('immediate') && noticeVals.has('serving_notice'), 'notice_period must include immediate and serving_notice options');
174
+
175
+ const immBox = inputByName.get('immediate_joiner_flag');
176
+ assert.ok(immBox && immBox.attrs.type === 'checkbox', 'Missing immediate_joiner_flag checkbox');
177
+ assert.ok(!Object.prototype.hasOwnProperty.call(immBox.attrs, 'required'), 'immediate_joiner_flag must not be required');
178
+ assert.ok(!Object.prototype.hasOwnProperty.call(immBox.attrs, 'checked'), 'immediate_joiner_flag must not be pre-checked');
179
+
180
+ // Distinct current_location, preferred_locations, and willing_to_relocate
181
+ const curLoc = inputByName.get('current_location');
182
+ assert.ok(curLoc && curLoc.attrs.id && labelForIds.has(curLoc.attrs.id), 'Missing labeled current_location input');
183
+ for (const selName of ['preferred_locations', 'willing_to_relocate']) {
184
+ const sel = selectByName.get(selName);
185
+ assert.ok(sel && sel.attrs.id && labelForIds.has(sel.attrs.id), `Missing labeled <select name="${selName}">`);
186
+ }
187
+
188
+ // CV upload + shared Naukri profile overwrite warning
189
+ const resumeInput = inputByName.get('resume');
190
+ assert.ok(resumeInput && resumeInput.attrs.type === 'file', 'Missing CV upload file input');
191
+ assert.match(resumeInput.attrs.accept || '', /\.pdf/i);
192
+ assert.match(NAUKRI_HTML, /data-profile-overwrite-warning="true"/i);
193
+
194
+ // Hidden honeypot
195
+ const hpWrap = NAUKRI_HTML.match(/<div\b[^>]*aria-hidden="true"[^>]*style="[^"]*display\s*:\s*none[^"]*"[^>]*>([\s\S]*?)<\/div>/i);
196
+ assert.ok(hpWrap, 'Honeypot wrapper must set aria-hidden="true" and display:none');
197
+ const hpInput = getElementsByTag(hpWrap[1], 'input').find(i => i.attrs.name === 'website_url_honeypot');
198
+ assert.ok(hpInput, 'Missing website_url_honeypot inside hidden wrapper');
199
+ assert.equal(hpInput.attrs.tabindex, '-1');
200
+ assert.equal(hpInput.attrs.autocomplete, 'off');
201
+ assert.ok(!Object.prototype.hasOwnProperty.call(hpInput.attrs, 'required'), 'Honeypot must not be required');
202
+ });
203
+
204
+ test('5. Playbook metadata, required structure & Naukri India safety invariants in skills/platforms/global-boards.md', () => {
205
+ const lines = GLOBAL_SKILL.split(/\r?\n/);
206
+ assert.ok(lines.length < 500, `global-boards.md must stay under 500 lines (got ${lines.length})`);
207
+
208
+ assert.ok(GLOBAL_SKILL.startsWith('---'), 'global-boards.md missing YAML frontmatter');
209
+ const fmEnd = GLOBAL_SKILL.indexOf('\n---', 3);
210
+ assert.ok(fmEnd > 0, 'global-boards.md unterminated frontmatter');
211
+ const fm = GLOBAL_SKILL.slice(3, fmEnd);
212
+ for (const key of ['name', 'version', 'last_verified', 'description', 'triggers', 'requires_mcp', 'preconditions', 'requires_skills', 'verification']) {
213
+ assert.match(fm, new RegExp(`^${key}:`, 'm'), `global-boards.md missing frontmatter key: ${key}`);
214
+ }
215
+ assert.match(fm, /^last_verified:\s*"?\d{4}-\d{2}-\d{2}"?/m);
216
+ assert.match(fm, /circuit-breaker-and-antiban/);
217
+
218
+ for (const heading of [
219
+ '## When to Use & Preconditions',
220
+ '## Deterministic Step-by-Step Execution',
221
+ '## Anti-Patterns (What NEVER To Do) & Self-Verification Check',
222
+ ]) {
223
+ assert.ok(GLOBAL_SKILL.includes(heading), `global-boards.md missing mandatory heading: ${heading}`);
224
+ }
225
+
226
+ // Required Naukri India & safety invariants
227
+ assert.match(GLOBAL_SKILL, /### Naukri \(`naukri` — India\)/);
228
+ assert.match(GLOBAL_SKILL, /mnjuser\/homepage/);
229
+ assert.match(GLOBAL_SKILL, /naukri:<verified-posting-id>|naukri:<id>/);
230
+ assert.match(GLOBAL_SKILL, /Current CTC.*Expected CTC|Expected CTC.*LPA/i);
231
+ assert.match(GLOBAL_SKILL, /Immediate Joiner/i);
232
+ assert.match(GLOBAL_SKILL, /preferred_locations/i);
233
+ assert.match(GLOBAL_SKILL, /OTP/);
234
+ assert.match(GLOBAL_SKILL, /skills\/24-circuit-breaker-and-antiban\.md/);
235
+ assert.match(GLOBAL_SKILL, /logs\/circuit-breaker\.json/);
236
+ assert.match(GLOBAL_SKILL, /max_per_platform\.naukri:\s*0/);
237
+ assert.match(GLOBAL_SKILL, /distinct from GCC `naukrigulf\.com`/i);
238
+ });
239
+
240
+ test('6. Zero invisible Unicode/BiDi chars across naukri-mock.html and global-boards.md', () => {
241
+ assertNoInvisibleUnicodeOrBiDi(NAUKRI_HTML, 'evals/fixtures/boards/naukri-mock.html');
242
+ assertNoInvisibleUnicodeOrBiDi(GLOBAL_SKILL, 'skills/platforms/global-boards.md');
243
+ });
244
+
245
+ test('7. Config, manifest, registry, guardrails, docs & Profile Intelligence adapter parity (Naukrigulf untouched)', () => {
246
+ const manifest = JSON.parse(fs.readFileSync(path.join(ROOT, 'skills', 'skills-manifest.json'), 'utf8'));
247
+ const globalEntry = manifest.skills.find(s => s.name === 'global-boards');
248
+ assert.ok(globalEntry, 'global-boards entry missing in skills/skills-manifest.json');
249
+ assert.equal(globalEntry.path, 'skills/platforms/global-boards.md');
250
+ assert.match(GLOBAL_SKILL, new RegExp(`^version:\\s*"?${globalEntry.version.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}"?`, 'm'));
251
+ assert.match(GLOBAL_SKILL, new RegExp(`^last_verified:\\s*"?${globalEntry.last_verified}"?`, 'm'));
252
+ assert.match(globalEntry.description, /Naukri/i);
253
+ assert.ok(globalEntry.triggers.some(t => /naukri/i.test(t)), 'manifest triggers must include naukri');
254
+ assert.ok(globalEntry.requires_skills.includes('circuit-breaker-and-antiban'), 'manifest requires_skills must include circuit-breaker-and-antiban');
255
+
256
+ for (const rel of ['skills/REGISTRY.md', 'PLATFORMS.md', 'docs/platform-registry.md', 'docs/SKILL_CATALOG.md']) {
257
+ const filePath = [path.join(ROOT, rel), path.join(PACKAGE_ROOT, rel)].find(p => fs.existsSync(p));
258
+ assert.ok(filePath, `Could not locate ${rel}`);
259
+ const text = fs.readFileSync(filePath, 'utf8');
260
+ assert.match(text, /\bnaukri\b/i, `${rel} must list Naukri`);
261
+ assert.match(text, /skills\/platforms\/global-boards\.md/, `${rel} must reference skills/platforms/global-boards.md`);
262
+ }
263
+
264
+ // Confirm Naukrigulf remains separate under MENA / Gulf in PLATFORMS.md
265
+ const platformsPath = [path.join(ROOT, 'PLATFORMS.md'), path.join(PACKAGE_ROOT, 'PLATFORMS.md')].find(p => fs.existsSync(p));
266
+ const platformsMd = fs.readFileSync(platformsPath, 'utf8');
267
+ assert.match(platformsMd, /\*\*MENA \/ Gulf\*\* \| \*\*Naukrigulf\*\* \| English \/ Arabic \| Help Wanted \| \[`skills\/platforms\/mena-boards\.md`\]/);
268
+ assert.match(platformsMd, /\*\*APAC \(India\)\*\* \| \*\*Naukri\*\* \| English \| Core \/ Router \| \[`skills\/platforms\/global-boards\.md`\]/);
269
+
270
+ // targets.yaml.example: naukri disabled, unverified, manual-handoff mode
271
+ const targetsYaml = fs.readFileSync(path.join(ROOT, 'context', 'targets.yaml.example'), 'utf8');
272
+ const block = getYamlBlock(targetsYaml, /platform:\s*"naukri"/);
273
+ assert.ok(block, 'context/targets.yaml.example missing target block for naukri');
274
+ assert.match(block, /enabled:\s*false/);
275
+ assert.match(block, /live_verified:\s*false/);
276
+ assert.match(block, /auth_check_url:\s*"https:\/\/www\.naukri\.com\/mnjuser\/homepage"/);
277
+ assert.match(block, /playbook:\s*"skills\/platforms\/global-boards\.md"/);
278
+ assert.match(block, /automation_mode:\s*"manual_apply_or_ats_redirect"/);
279
+
280
+ // guardrails.yaml: unverified naukri capped at 0 (StepStone & MENA caps preserved)
281
+ const guardrails = fs.readFileSync(path.join(ROOT, 'config', 'guardrails.yaml'), 'utf8');
282
+ assert.match(guardrails, /^\s+naukri:\s*0\s*$/m, 'config/guardrails.yaml must cap unverified naukri at 0');
283
+ assert.match(guardrails, /^\s+stepstone:\s*0\s*$/m, 'stepstone cap must remain 0');
284
+
285
+ // Profile Intelligence adapter maps naukri -> job_boards with save: false and requires_approval: true
286
+ const adapter = engine.getPlatformAdapter('naukri');
287
+ assert.equal(adapter.platform_id, 'job_boards');
288
+ assert.equal(adapter.unknown_platform_fallback, false);
289
+ assert.equal(adapter.capabilities.save, false);
290
+ assert.equal(adapter.requires_approval, true);
291
+ });
292
+
293
+ test('8. Employer ATS fixture isolation & EVAL-01..20 baseline compatibility', () => {
294
+ const atsFiles = fs.readdirSync(FORMS_DIR).filter(f => f.endsWith('.html'));
295
+ assert.ok(!atsFiles.some(f => /naukri/i.test(f)), 'Naukri board fixture must not live inside evals/fixtures/forms/');
296
+
297
+ const evalRes = spawnSync(process.execPath, [CLI, 'eval', '--baseline'], {
298
+ cwd: ROOT,
299
+ encoding: 'utf8',
300
+ env: { ...process.env, NO_COLOR: '1' },
301
+ });
302
+ assert.equal(evalRes.status, 0, evalRes.stdout + evalRes.stderr);
303
+ assert.match(evalRes.stdout, /20\/20 assertions PASSED/);
304
+ });