Skip to content

Commit 9d020cb

Browse files
committed
refactor(config): extract shared free-body kind schema via extends
Seven doc kinds (cli-command, architecture-doc, secret-rotation, audit-log, feature, feature-index, website-page) each repeated the identical closed:false + free-form sections skeleton. Add a free-body base kind and have them extend it, mirroring the existing directive-rule-readme -> rule-readme pattern. mdsmith check . stays green; inherited-schema enforcement verified (a removed required frontmatter field still fires MDS020). https://claude.ai/code/session_01NKdWdyXRSuprJWeLARKvBE
1 parent 07615cf commit 9d020cb

1 file changed

Lines changed: 21 additions & 42 deletions

File tree

.mdsmith.yml

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,20 @@ ignore:
315315
- "editors/**/dist/**"
316316

317317
kinds:
318+
free-body:
319+
# Shared schema skeleton for doc kinds whose body is
320+
# free-form prose: a preamble followed by any headings.
321+
# Each consumer sets only its own `frontmatter:` and
322+
# reuses this section shape plus `closed: false` via
323+
# `extends:`, removing the duplication these kinds used
324+
# to each carry.
325+
schema:
326+
closed: false
327+
sections:
328+
- heading: null
329+
- heading:
330+
regex: '.+'
331+
repeat: { min: 0 }
318332
proto:
319333
rules:
320334
# proto.md files lead with directives and placeholder
@@ -364,37 +378,28 @@ kinds:
364378
required-structure:
365379
schema: docs/security/proto.md
366380
architecture-doc:
381+
extends: free-body
367382
schema:
368383
frontmatter:
369384
title: nonEmpty
370385
slug: nonEmpty
371386
summary: nonEmpty
372-
closed: false
373-
sections:
374-
- heading: null
375-
- heading:
376-
regex: '.+'
377-
repeat: { min: 0 }
378387
rules:
379388
max-file-length:
380389
max: 500
381390
cli-command:
391+
extends: free-body
382392
schema:
383393
frontmatter:
384394
command: nonEmpty
385395
summary: nonEmpty
386-
closed: false
387-
sections:
388-
- heading: null
389-
- heading:
390-
regex: '.+'
391-
repeat: { min: 0 }
392396
release-channel:
393397
path-pattern: "{docs,website/content/docs}/development/release-channels/{proto.md,*.md}"
394398
rules:
395399
required-structure:
396400
schema: docs/development/release-channels/proto.md
397401
secret-rotation:
402+
extends: free-body
398403
schema:
399404
frontmatter:
400405
title: nonEmpty
@@ -406,31 +411,21 @@ kinds:
406411
usedBy: nonEmpty
407412
scope: nonEmpty
408413
releaseEnvScoped: bool
409-
closed: false
410-
sections:
411-
- heading: null
412-
- heading:
413-
regex: '.+'
414-
repeat: { min: 0 }
415414
audit-log:
415+
extends: free-body
416416
schema:
417417
frontmatter:
418418
title: nonEmpty
419419
"summary?": string
420420
audit-from: '=~"^[0-9a-f]{7,40}$"'
421421
filename: "architecture-audit.md"
422-
closed: false
423-
sections:
424-
- heading: null
425-
- heading:
426-
regex: '.+'
427-
repeat: { min: 0 }
428422
feature:
429423
# Marketing feature pages under docs/features/. The homepage
430424
# feature grid (website/layouts/partials/feature-grid.html)
431425
# and the README <?include?> both depend on this front
432426
# matter, so the schema makes a missing/typo'd field fail
433427
# `mdsmith check` instead of silently breaking a card.
428+
extends: free-body
434429
schema:
435430
frontmatter:
436431
title: nonEmpty
@@ -446,26 +441,15 @@ kinds:
446441
group: '"Clean, consistent Markdown" | "One engine, every surface" | "A connected docs tree" | "Markdown as a single source of truth" | "Built for your pipeline"'
447442
"link?": string
448443
"rules?": '[...string]'
449-
closed: false
450-
sections:
451-
- heading: null
452-
- heading:
453-
regex: '.+'
454-
repeat: { min: 0 }
455444
feature-index:
456445
# docs/features/index.md is the shared "Why mdsmith"
457446
# overview, not a card: it carries only title + summary
458447
# (no icon/weight), so it gets its own kind.
448+
extends: free-body
459449
schema:
460450
frontmatter:
461451
title: nonEmpty
462452
summary: nonEmpty
463-
closed: false
464-
sections:
465-
- heading: null
466-
- heading:
467-
regex: '.+'
468-
repeat: { min: 0 }
469453
messaging:
470454
# docs/brand/messaging.md is the single source of truth
471455
# for the product slogan, lead, tagline, and per-surface
@@ -537,6 +521,7 @@ kinds:
537521
# the same content can be indexed by either Hugo or
538522
# `<?catalog?>`.
539523
path-pattern: "website/content/*.md"
524+
extends: free-body
540525
schema:
541526
frontmatter:
542527
title: nonEmpty
@@ -548,12 +533,6 @@ kinds:
548533
# consume the specific keys.
549534
"hero?": '{...}'
550535
"install?": '[...{...}]'
551-
closed: false
552-
sections:
553-
- heading: null
554-
- heading:
555-
regex: '.+'
556-
repeat: { min: 0 }
557536
rules:
558537
first-line-heading: false
559538
heading-increment: false

0 commit comments

Comments
 (0)