chore(scripts): extract shared utils, add tests, enforce standards#35
Merged
zrosenbauer merged 2 commits intomainfrom Mar 11, 2026
Merged
chore(scripts): extract shared utils, add tests, enforce standards#35zrosenbauer merged 2 commits intomainfrom
zrosenbauer merged 2 commits intomainfrom
Conversation
- Extract shared utilities into scripts/lib/ (frontmatter, config, status, ansi, diff) eliminating ~100 lines of duplication across the three .lauf.ts scripts - Add vitest test infrastructure with 66 tests across 9 test files - Remove optional chaining, ternaries, and for loops from pure logic by extracting helper functions - Replace local utility copies with shared lib imports in all three .lauf.ts scripts - Replace inline ANSI colors and diff rendering with shared constants and displayDiff function - Add Result tuple error handling for readProjectConfig call sites Co-Authored-By: Claude <noreply@anthropic.com>
…and tests Fix unsafe parseYaml cast in frontmatter.ts, resolveDirection cancelled-by-value bug in project.lauf.ts, and status badge mismatches in roadmap docs. Consolidate duplicate ANSI codes and extractErrorMessage patterns into shared modules, replace optional chaining and mutable array patterns in github-client.ts, and improve test quality with consistent naming and explicit assertions. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/lib/(frontmatter, config, status, ansi, diff) eliminating ~100 lines of duplication across the three.lauf.tsscripts?.), ternaries, andforloops from pure logic by extracting helper functions.lauf.tsscriptsANSIconstant anddisplayDifffunctionreadProjectConfigcall sitesChanges
Phase 1: Test Infrastructure
vitestdevDependency andtestscript topackage.jsonscripts/vitest.config.tsPhase 2: Shared Utility Extraction
scripts/lib/frontmatter.ts—parseFrontmatter,updateFrontmatter,extractTitle,FRONTMATTER_REscripts/lib/config.ts—readProjectConfig(Result tuple),FEATURES_DIR, config typesscripts/lib/status.ts—reverseStatusMappingscripts/lib/ansi.ts— consolidatedANSIescape codesbackup.tsdynamic imports andproduct-area-colors.tsduplicate keyPhase 3: Tests (66 total)
frontmatter.test.ts(10),config.test.ts(3),status.test.ts(3),diff.test.ts(3)product-area-colors.test.ts(4),query-loader.test.ts(2)features.test.ts(5),project.test.ts(17),readme.test.ts(19)Phase 4: Standards Compliance
?.with explicit null checksresolveVisibility,formatStatusLabel,conditionalValue, etc.)forloops tonew Map(items.filter.map)patternShared Lib Integration
.lauf.tsfiles now import from shared libs instead of local copiesyamlimport fromfeatures.lauf.tsandreadme.lauf.tsProjectConfig,FeaturesConfig,ConfigField,ConfigViewtype definitionsproject.lauf.tswithdisplayDiffTest plan
pnpm test— 66/66 tests passpnpm lint— 0 warnings, 0 errorspnpm format:check— all files formattednpx tsc -p scripts/tsconfig.json --noEmit— 0 TypeScript errors