From b77017daade37482697413665ac906fcf23a4957 Mon Sep 17 00:00:00 2001 From: Charlie Greenman Date: Fri, 17 Jul 2026 06:22:11 -0400 Subject: [PATCH 1/2] feat: target diverse US job discovery --- .github/workflows/quality.yml | 6 + CONTRIBUTING.md | 7 +- README.md | 8 +- batch/batch-prompt.md | 8 +- bin/job-forge.mjs | 6 + config/profile.example.yml | 27 +- docs/ARCHITECTURE.md | 14 +- docs/CUSTOMIZATION.md | 59 +++- docs/SETUP.md | 13 +- fixtures/instructions.yml | 14 + fixtures/modes/apply.yml | 14 + iso/commands/job-forge.md | 7 +- iso/instructions.md | 19 +- lib/jobforge-preflight.mjs | 90 ++++- lib/jobforge-timeline.mjs | 9 +- lib/portal-diversity.mjs | 66 ++++ modes/_shared.md | 11 +- modes/apply.md | 57 ++-- modes/auto-pipeline.md | 46 ++- modes/contact.md | 12 + modes/offer.md | 7 +- modes/pipeline.md | 13 +- modes/reference-setup.md | 6 +- modes/scan.md | 147 +++++--- package.json | 6 +- scripts/add-tags.mjs | 27 +- scripts/balance-scan-results.mjs | 229 +++++++++++++ scripts/check-iso-smoke.mjs | 1 + scripts/verify-portal-diversity.mjs | 502 ++++++++++++++++++++++++++++ templates/context.json | 16 +- templates/facts.json | 62 ++-- templates/index.json | 4 +- templates/portals.example.yml | 149 ++++++++- templates/preflight.json | 12 +- test/context-mode-budgets.test.mjs | 21 ++ test/diversity-cli.test.mjs | 62 ++++ test/facts-us-location.test.mjs | 81 +++++ test/index-scan-history.test.mjs | 34 ++ test/portal-diversity.test.mjs | 290 ++++++++++++++++ test/preflight-us.test.mjs | 60 ++++ test/scan-balance.test.mjs | 144 ++++++++ test/scan-history.test.mjs | 24 ++ 42 files changed, 2211 insertions(+), 179 deletions(-) create mode 100644 lib/portal-diversity.mjs create mode 100644 scripts/balance-scan-results.mjs create mode 100644 scripts/verify-portal-diversity.mjs create mode 100644 test/context-mode-budgets.test.mjs create mode 100644 test/diversity-cli.test.mjs create mode 100644 test/facts-us-location.test.mjs create mode 100644 test/index-scan-history.test.mjs create mode 100644 test/portal-diversity.test.mjs create mode 100644 test/preflight-us.test.mjs create mode 100644 test/scan-balance.test.mjs create mode 100644 test/scan-history.test.mjs diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index f8726b6..6c2dfb4 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -19,6 +19,12 @@ jobs: - name: Install dependencies run: npm ci + - name: Run Node tests + run: npm test + + - name: Verify strict US portal coverage + run: npm run verify:diversity -- --strict + - name: ISO source smoke checks run: npm run smoke:iso diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 126a3da..09edd64 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,12 +41,13 @@ Before opening a PR, from the harness repo root: ```bash npm run verify npm run smoke:iso +npm test npm run build:dashboard ``` (`npm run build:dashboard` is the same as `(cd dashboard && go build .)` — requires Go on PATH.) -`npm run verify` runs `verify-pipeline.mjs`. It exits successfully when no tracker exists (fresh clone). +`npm run verify` runs `verify-pipeline.mjs` followed by the offline US portal-policy and source-coverage check. The tracker portion exits successfully when no tracker exists (fresh clone). > **Contributor note:** Inside the harness repo, scripts resolve PROJECT_DIR via `process.cwd()`, so running `npm run verify` from the repo root operates on your local `data/` directory (gitignored). If you have a personal project that you want to test changes against, use `JOB_FORGE_PROJECT=/path/to/personal/project npm run verify`. @@ -58,12 +59,14 @@ Other npm scripts: | `npm run lint:helpers` | `scripts/check-helper-integration.mjs` | Verifies local helper deps, CLI aliases, scaffolder scripts, migrations, generated ignores, templates, docs, and helper reference stay aligned | | `npm run build:dashboard` | `go build` in `dashboard/` | Optional TUI; same check as manual `cd dashboard && go build .` | | `npm run sync-check` | `cv-sync-check.mjs` | Optional setup lint: `cv.md`, `config/profile.yml`, hardcoded-metric scan; fails if those files are missing | +| `npm run verify:diversity` | `scripts/verify-portal-diversity.mjs` | Offline check for the US-only policy, US location queries, and US-tagged catalog coverage | +| `npm run balance:scan -- candidates.json portals.yml` | `scripts/balance-scan-results.mjs` | Deterministic US-eligibility and company/location-balanced shortlist JSON | | `npm run normalize` | `normalize-statuses.mjs` | Maps non-canonical statuses in tracker files; no-op if no tracker exists | | `npm run dedup` | `dedup-tracker.mjs` | Merges duplicate company/role rows; no-op if no tracker exists | | `npm run merge` | `merge-tracker.mjs` | Merges `batch/tracker-additions/*.tsv` into the tracker (day-based or single-file); no-op if no TSVs exist; creates tracker when no tracker file exists yet | | `npm run pdf` | `generate-pdf.mjs` | Pass HTML and PDF paths after `--`, e.g. `npm run pdf -- output/cv.html output/cv.pdf`; missing parent dirs for the PDF path are created | -Utility scripts `verify`, `merge`, `normalize`, `dedup`, `sync-check`, and `pdf` accept `--help` / `-h` (e.g. `npm run verify -- --help`, `npm run sync-check -- --help`, `npm run pdf -- --help`). +Utility scripts `verify`, `verify:diversity`, `balance:scan`, `merge`, `normalize`, `dedup`, `sync-check`, and `pdf` accept `--help` / `-h` (e.g. `npm run verify:diversity -- --help`, `npm run balance:scan -- --help`, `npm run pdf -- --help`). You can run the same `.mjs` files with `node