Skip to content

feat(evangeliser): implement phases 1-5 — scanner, tests, CLI, 40 patterns#41

Merged
hyperpolymath merged 2 commits intomainfrom
feat/rescript-evangeliser-phases-1-5
Mar 13, 2026
Merged

feat(evangeliser): implement phases 1-5 — scanner, tests, CLI, 40 patterns#41
hyperpolymath merged 2 commits intomainfrom
feat/rescript-evangeliser-phases-1-5

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

  • Phase 1: Consolidate canonical/satellite drift, fix SPDX headers to PMPL-1.0-or-later, replace npx with Deno, update rescript.json for v12 deprecations
  • Phase 2: New Scanner.res + Analyser.res — regex-based JS pattern detection engine with confidence scoring, coverage analysis, difficulty assessment, and pattern suggestions
  • Phase 3: 38 tests across 6 suites (Types, Glyphs, Narrative, Patterns, Scanner, Analyser) — all passing
  • Phase 4: Expand pattern library from 15 to 40 patterns covering all 21 categories (added Destructuring, Defaults, Templates, ArrowFunctions, Variants, Modules, TypeSafety, Immutability, PatternMatching, PipeOperator, OopToFp, ClassesToRecords, InheritanceToComposition, StateMachines, DataModeling)
  • Phase 5: CLI with scan/patterns/legend/stats commands, RAW/FOLDED/GLYPHED view layers, plain/markdown/html output formats

Test plan

  • deno run -A npm:rescript build — 0 errors, 0 warnings
  • deno run --allow-read --allow-env test/run_all.js — 38/38 tests pass
  • bin/evangeliser.js scan <file> — scans JS files, outputs narratives with glyphs
  • bin/evangeliser.js patterns — lists all 40 patterns by category
  • bin/evangeliser.js stats — shows library statistics
  • CI workflows pass

🤖 Generated with Claude Code

…terns

ReScript Evangeliser goes from 50% to ~90% completion:

- Phase 1: Consolidate canonical/satellite, fix SPDX to PMPL-1.0-or-later,
  fix npx→Deno, update rescript.json for v12 deprecations
- Phase 2: Scanner.res + Analyser.res with regex pattern detection engine,
  confidence scoring, coverage analysis, and difficulty assessment
- Phase 3: 38 tests across 6 suites (Types, Glyphs, Narrative, Patterns,
  Scanner, Analyser) — all passing
- Phase 4: Expand from 15 to 40 patterns covering all 21 categories
  (Destructuring, Variants, PipeOperator, StateMachines, DataModeling, etc.)
- Phase 5: CLI with scan/patterns/legend/stats commands, RAW/FOLDED/GLYPHED
  views, plain/markdown/html output formats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hyperpolymath hyperpolymath enabled auto-merge March 13, 2026 14:30
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa81e791e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

switch regex->RegExp.exec(code) {
| None => continue_ := false
| Some(result) =>
let matchedText = result->RegExp.Result.input
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Capture matched fragment, not the full source text

scanPattern assigns matchedText from RegExp.Result.input, which is the entire scanned file, so every patternMatch.code becomes the full source and startLine/endLine are computed from that full text instead of the actual regex hit. Any consumer relying on match snippets or line spans (including diagnostics and editor integrations) will receive incorrect locations for virtually all matches.

Useful? React with 👍 / 👎.


// Compute coverage: what percentage of available categories were matched
let computeCoverage = (matches: array<patternMatch>): float => {
let totalCategories = 20 // from Types.patternCategory
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the real pattern-category count for coverage

computeCoverage hard-codes totalCategories = 20, but Types.patternCategory defines 21 categories, so coverage is systematically inflated and can exceed 100% when all categories are matched. This makes the reported metric inaccurate for users and downstream reporting.

Useful? React with 👍 / 👎.

Comment on lines +138 to +139
| "patterns" =>
Output.formatPatternList(opts.format)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor --difficulty when listing patterns

The CLI advertises and parses --difficulty (including the patterns --difficulty beginner example), but the patterns branch ignores opts.difficulty and always calls Output.formatPatternList(opts.format), so users cannot filter the list as documented. This is a functional mismatch between help text and command behavior.

Useful? React with 👍 / 👎.

Remove scripts/build.ts, clean.ts, validate.ts (TypeScript violates
language policy). Build/clean now use `deno run -A npm:rescript` directly.
Validation handled by justfile recipes. Update deno.json to remove
stale references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hyperpolymath hyperpolymath merged commit 25f2709 into main Mar 13, 2026
14 of 16 checks passed
@hyperpolymath hyperpolymath deleted the feat/rescript-evangeliser-phases-1-5 branch March 13, 2026 16:13
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