| id | 167 | |
|---|---|---|
| title | Custom binding overrides for mdsmith extract | |
| status | ✅ | |
| model | opus | |
| depends-on |
|
|
| summary | Add an opt-in `bind:` key that overrides the default schema-derived key in `mdsmith extract`, layered on the `keyFor` seam from plan 166. |
Plan 166 derives
the extracted data tree from the schema hierarchy with no
annotations. This plan adds an opt-in bind: key that
renames or restructures a node when the default key is
wrong, without changing the default behavior.
Plan 166 routes every key through one keyFor(node)
function. This plan only changes that function and adds
parsing. The walk, encoders, and CLI are untouched.
keyFor(node)returns the bind value when present, else the default slug.Bindis a*stringso an unset key and an explicit empty one are distinct.- A node with
bind: ""(present, empty) is hoisted: its children merge into the parent instead of nesting. - Composition rule: two kinds binding one composed node to different names is a compose-time error, reusing the collision diagnostic from plan 166.
- Parse
bind:. AddBind *stringtoScopeandContentEntry(nil = unset, non-nil = present, sobind: ""is distinguishable); parse inparse_inline.goandparse_file.go. Unit-test round-trip including unset vs. explicit-empty. - Override
keyFor. Return the bind value when present; implement hoist forbind: "". - Validate binds. Reject duplicate sibling binds and unreachable binds via the schema diagnostic path.
- Compose binds. Extend
schema.Compose()so merged headings union bound children; conflicting names are a compose-time error. - Fixtures and docs. Add bind-override golden cases;
document
bind:under schemas.md.
-
bind:overrides the default key; output is otherwise identical to plan 166. -
bind: ""hoists a node's children into its parent. - Duplicate or unreachable binds are rejected with actionable diagnostics.
- Conflicting binds across composed kinds are a compose-time error.
- All tests pass:
go test ./... -
go tool golangci-lint runreports no issues -
mdsmith check .passes