feat: weight field, fieldMappings config, and madrigal init wizard#14
Draft
delkc wants to merge 3 commits into
Draft
feat: weight field, fieldMappings config, and madrigal init wizard#14delkc wants to merge 3 commits into
delkc wants to merge 3 commits into
Conversation
Replaces the opinionated `enforcement` field with a flexible `weight` system so any team can use their existing frontmatter vocabulary without renaming files. Adds a `madrigal init` CLI command that scans source files and generates a starter config with suggested fieldMappings and levels. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…emanticSearchOptions Co-Authored-By: Claude Sonnet 4.6 <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.
Why
Madrigal's original
enforcementfield assumed all teams use the same must/should/may vocabulary, which blocked adoption by teams with different frontmatter conventions (design systems using maturity levels, compliance kits using status fields, etc.). This makes the field system flexible enough for any team without requiring file renames.What
src/weight.tswith config-driven level logic:parseWeight,compareWeight,isHighWeight,defaultWeight,buildWeightOrderenforcement→weightthroughout schema, loader, search, formats, compliance, MCP server —enforcement/severitykept as deprecated aliaseslevelsandfieldMappingstoMadrigalConfigso teams can define custom ordered levels and map their existing frontmatter field names (with optional value translation)applyFieldMappingsto loader pipelinemadrigal initCLI command that scans source files, detects non-standard field vocabularies, and generates a starter configsrc/init.tswithanalyzeKnowledgeSources,generateConfig,printAnalysisSummaryweightfield docs,levels/fieldMappingsconfig reference,madrigal initsectiondocs/field-mapping.md: comprehensive guide with team-specific examplesRisk Assessment
Medium — touches most files in the repo (field rename), but backward compatibility is preserved through deprecated aliases on
enforcement/severity. All 77 tests pass, typecheck clean.References
enforcement/severitystill parsed and mapped toweightat load time — no breaking change for existing knowledge filesGenerated with Claude Code