Commit 13268a4
Plans 165–167: portable export + schema-driven extraction (#292)
* Add plan 163: schema-driven data extraction (mdsmith extract)
Introduces a `bind:` projection layer on schema scopes and
content entries plus an `extract` subcommand that turns a
kind-conformant Markdown file into JSON/YAML/Lua/msgpack.
Sequenced on top of the schema-composition rework (plan
156) and content-schema work (plan 149).
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* Rework plan 163: default binding layer; split custom bindings to plan 164
- Default projection derives the data tree from the
schema hierarchy; no annotations required.
- Custom bindings move to follow-up plan 164, layered on
a single keyFor() seam.
- Address Copilot review: disambiguate the duplicate
plan-156 id via explicit file link; name the concrete
schema.MatchTree type returned by an extended
schema.Validate.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 164: use *string for Bind to distinguish unset vs explicit-empty
Addresses Copilot review: a plain string cannot represent
"unset" vs `bind: ""` (hoist), so Bind is now *string.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 163: resolve open questions
- Repeating-scope elements always retain each placeholder
as a name:value field.
- Root holds `frontmatter` plus projected sections beside
it (no nesting under a single key).
- Preamble projected under `preamble`; wildcard/unlisted
skipped.
- Defer Lua; ship json/yaml/msgpack.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 163: use current repeat:{min,max} terminology, not repeats:true
The schema parser rejects the legacy `repeats` key;
repeating cardinality is `repeat: {min, max}`.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* Add plan 165: portable Markdown export (mdsmith export)
A source-to-source `export` subcommand that strips
directive markers, keeps generated bodies, and inlines
includes — distinct from schema extraction (163/164).
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 163: align with landed schema syntax — no-heading section, no preamble key
Plan 156 entry-unification landed in main (PR #295): the
standalone preamble: key is gone, replaced by heading:
null. Project the no-heading section's content into the
enclosing object instead of a preamble wrapper key.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* Renumber plans 163/164 -> 166/167; fix gensection API ref in 165
Rebasing onto main pulled in plan/163_public-markdown-library and
plan/164_github-ui-releases-and-split-website, colliding with the new
plans. Renumber schema-extraction 163->166 and custom-bindings 164->167
(export stays 165, no collision); update cross-references and depends-on.
Plan 165: marker stripping is driven by gensection.FindMarkerPairs
(MarkerPair.StartLine/EndLine), not lint.File.GeneratedRanges (which
only records include/catalog body ranges). Tighten the acceptance
criteria to distinguish engine-recognized markers from literal-content
marker-like text.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 167: fix remaining stale "plan 163" refs -> 166; plan 166 depends-on
Renumbering leftovers: three "plan 163" references in plan 167 (keyFor
seam origin, collision diagnostic, acceptance criterion) now point to
the renumbered extraction plan 166. Drop ambiguous id 156 from plan
166's depends-on (two plan files share id 156); the composition
dependency stays expressed as a filename link in the Sequencing section.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 165: export checks staleness by default, never auto-fixes
Auto-regenerating directive bodies on export is surprising and masks
drift. Default mode now fails on a stale body (exit non-zero, no
output); --fix opts into in-memory regeneration; --no-check skips the
check. The two flags are mutually exclusive. Tasks, acceptance
criteria, and decisions updated.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 165: align Export signature — ([]byte, []lint.Diagnostic) + Mode
Tasks 1 and 4 disagreed on the return shape. Settle on
Export(f, mode) ([]byte, []lint.Diagnostic), mirroring plan 166's
Extract: a non-empty diagnostic slice means refusal (nil bytes); a
stale body in Check mode appends a directive-positioned diagnostic;
hard error is reserved for I/O only.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
* plan 165: clarify Export contract — no error return, exactly one value set
Export operates on an in-memory *lint.File, so it does no I/O and
returns no error; reads/writes are the CLI layer's job (real error
there). Spell out the success vs refusal contract: success = non-nil
bytes + nil diagnostics; refusal = nil bytes + non-empty diagnostics.
https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 024dad8 commit 13268a4
4 files changed
Lines changed: 503 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
94 | 97 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
0 commit comments