OverviewFilesCommitsIssuesDocsReleasesPeers

codetree commits / 0b71657

Parser: accept em-dash / en-dash as module-title separator
The module-spec parser's title regex required literal `--` (double hyphen). Real specs often use `—` (em-dash U+2014) or `–` (en-dash U+2013) — markdown renderers typosetter-style conversions, or authors typing Unicode directly. In pear-git-v3, 4 of 12 module specs use em-dash in their title (anproto, hyperident, pgh, trust-map). Before this fix they silently failed to parse, meaning codetree couldn't apply any fixes to them (including high-confidence LOC drift and deprecation markers). Regex updated from /^#\s+(\S+)\s+--/m to /^#\s+(\S+)\s+(?:--|—|–)\s+/m. Impact: running codetree against pear-git-v3 after this fix: Before: 26 fixes detected (8 specs parsed) After: 41 fixes detected (12 specs parsed) — +15 from anproto, hyperident, pgh, trust-map now being visible to detectors. Also: - formatSuggest grew an `appliedFloor` param distinct from `confidenceFloor`, so `--suggest` shows ALL fixes (low/medium/high) while still labeling which are applicable at the current --apply floor. Previously --suggest with the default confidence 'high' hid all low-tier items. 96/96 tests pass unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0b716570e697ecbb26e7ef4285b21b55befe93b9
by plankatron <fleeky@gmail.com> · 2026-04-16T18:11:47.000Z

Changed files (3) +16 -6

index.js +4 -2
……@@ -456,11 +456,13 @@ async function runSuggestOrApplyOrCheck (tree) {
456456 return
457457 }
458458
459 // --suggest: print proposals
459 // --suggest: print ALL proposals (the --confidence flag affects `result.applicable`
460 // for --apply purposes; the printed suggestion view should show every tier so the
461 // operator can see what MANUAL REVIEW items are queued up).
460462 if (format === 'json') {
461463 console.log(formatSuggestJson(result))
462464 } else {
463 console.log(formatSuggest(result, { confidenceFloor: confidence }))
465 console.log(formatSuggest(result, { confidenceFloor: 'low', appliedFloor: confidence }))
464466 }
465467}
466468
lib/doc-parser.js +6 -2
……@@ -118,8 +118,12 @@ function parseModuleSpec (content, filename) {
118118 replacedBy: null
119119 }
120120
121 // Module name from title: "# hyper-orgs -- Module Spec"
122 const titleMatch = content.match(/^#\s+(\S+)\s+--/m)
121 // Module name from title. Accepts both "--" (double-hyphen) and "—"
122 // (em-dash) as separators — both are common in hand-written specs and
123 // markdown renderers often auto-convert one to the other.
124 // "# hyper-orgs -- Module Spec"
125 // "# hyperident — Module Spec"
126 const titleMatch = content.match(/^#\s+(\S+)\s+(?:--|—|–)\s+/m)
123127 if (titleMatch) spec.name = titleMatch[1]
124128
125129 // Location
lib/suggest-fixes.js +6 -2
……@@ -462,10 +462,14 @@ function todayIso () {
462462
463463/**
464464 * Human-readable suggest output.
465 *
466 * opts.confidenceFloor — tier floor for DISPLAY (default 'low' = show all)
467 * opts.appliedFloor — tier floor used by --apply (for labeling sections)
465468 */
466469export function formatSuggest (result, opts = {}) {
467470 const lines = []
468471 const show = opts.confidenceFloor || 'low' // show everything by default
472 const appliedFloor = opts.appliedFloor || opts.confidenceFloor || 'high'
469473
470474 const byConfidence = {
471475 high: result.fixes.filter(f => f.confidence === 'high'),
……@@ -479,7 +483,7 @@ export function formatSuggest (result, opts = {}) {
479483 '(' + byConfidence.high.length + ' high, ' +
480484 byConfidence.medium.length + ' medium, ' +
481485 byConfidence.low.length + ' low).')
482 lines.push('Applicable at --confidence ' + (opts.confidenceFloor || 'high') +
486 lines.push('Applicable at --confidence ' + appliedFloor +
483487 ': ' + result.applicable.length)
484488 lines.push('')
485489
……@@ -487,7 +491,7 @@ export function formatSuggest (result, opts = {}) {
487491 if (byConfidence[tier].length === 0) continue
488492 if (!ge(tier, show)) continue
489493
490 const isAuto = ge(tier, opts.confidenceFloor || 'high')
494 const isAuto = ge(tier, appliedFloor)
491495 const heading = tier === 'high'
492496 ? '## High-confidence fixes (auto-applicable)'
493497 : tier === 'medium'