| id | 98 |
|---|---|
| title | Replace `archetypes` with `kinds` |
| status | ✅ |
| model | sonnet |
| summary | Remove the `archetypes` CLI subcommand, config key, and doc directory. The `kinds` model from plans 92/95 is the single, generalized concept. No backward-compat shim. |
Today mdsmith has two overlapping concepts:
archetypes for named schema files, and kinds for
rule-config bundles. This plan collapses them into
one. The following surface goes away:
- the
archetypesCLI subcommand, - the
archetypes.roots:config key, - the
internal/archetypespackage, - the
docs/background/archetypes/doc directory.
Kinds take over the schema-by-name role through paths declared in their bodies.
No backward-compat shim is shipped — the user has
opted to break in place. Existing configs that use
archetypes.roots: or archetype: lookups must
migrate to kinds: with explicit schema: paths.
Today mdsmith has two parallel concepts of "named schema":
archetypes— thearchetypesCLI subcommand (init/list/show/path), thearchetypes.roots:config key, theinternal/archetypesResolver, and a doc directorydocs/background/archetypes/. Documented atinternal/archetypes/archetypes.go(since removed): "An archetype is a Markdown schema file whose basename (without the ".md" extension) is the archetype name."kinds(plans 92/95) — a named bundle of rule settings that may includerules.required-structure.schema:pointing to a schema file by path.
The two collide:
- Internally on the term:
archetypes(CLI/config: schema files) vsarchetypes(docs convention: rule patterns). - Externally with Hugo, where
archetypemeans a content scaffold — different from both. - Functionally: a kind with
required-structure .schema:is a generalization of an archetype.
- CLI:
mdsmith archetypes init/list/show/path. - Config key:
archetypes:(withroots:field). - Go package:
internal/archetypes/and itsResolver. - Doc directory:
docs/background/archetypes/. Its one current page (generated-section) moves todocs/background/concepts/generated-section.md.
archetypes list→mdsmith kinds list(introduced in plan 95): lists declared kinds with their merged bodies. Each kind that setsrules.required-structure.schema:is the new "named schema".archetypes show <name>→mdsmith kinds show <name>: prints one kind's body.archetypes path <name>→mdsmith kinds path <name>: prints the kind'sschema:path.archetypes init [dir]→ drop. Users hand-writekinds:blocks;mdsmith initcovers fresh-repo scaffolding.
The archetypes.roots: mechanism let required- structure accept a name (schema: story) and look
it up across configured roots. This is removed.
Kinds declare schema: as an explicit path. Any
project that relied on name lookup migrates to
explicit paths in kind bodies.
The archetypes/ doc directory has one page today,
generated-section. The page moves under
docs/background/concepts/, alongside plan 93's
placeholder-grammar page.
- Remove
cmd/mdsmith/archetypes.go, thearchetypesdispatch inmain.go, and theinternal/archetypes/package. Update affected tests. - Remove the
archetypes:config key (andRootsfield onConfig). Remove its loader code and theValidateRootshelper. - Remove the name-lookup path in
required- structure's schema resolution. The rule'sschema:setting accepts only a path now. - Move
docs/background/archetypes/generated-section/README.mdtodocs/background/concepts/generated-section.md. Update internal links throughout the repo. - Move the placeholder-grammar concept page (plan
93) to
docs/background/concepts/if it is not already there. - Delete
docs/background/archetypes/(including its README) once empty. - Update
CLAUDE.md's catalog directive include list to drop the archetypes glob and add the concepts glob. - Update
docs/reference/cli.mdto remove thearchetypessubcommand section. Thekindssubcommand replacement is documented under plan 95. - Update
mdsmith init: the generated.mdsmith.ymlmust contain noarchetypes:key and must remain accepted by the loader. Add a regression test that runsinitin a tempdir and greps for the absence ofarchetypes.
-
mdsmith archetypesexits 2 with "unknown command". -
mdsmith kinds listis the only listing surface for named schemas. -
archetypes:keys in.mdsmith.ymlproduce a config error directing the user tokinds:. -
required-structure.schema:accepts a path; a name (e.g.schema: story) produces a clear error. -
docs/background/concepts/generated-section.mdexists;docs/background/archetypes/no longer exists. -
mdsmith check .is green after all renames (internal links updated). -
internal/archetypes/no longer exists; no package imports it. -
mdsmith initin a fresh directory writes a.mdsmith.ymlcontaining noarchetypes:key; the file is accepted by the loader (covered by test). - All tests pass:
go test ./... -
go tool golangci-lint runreports no issues