Skip to content

Commit 282434f

Browse files
committed
WIP: extract dev sections and test catalog approaches
Extract coverage gate and file placement from dev index into separate files. Testing catalog vs static link approaches for the dev index — catalog glob context shifts when content is nested via include (see issue discussion). https://claude.ai/code/session_01J3g8NnEwGYyJWXD1bqtTii
1 parent 533b8df commit 282434f

7 files changed

Lines changed: 204 additions & 580 deletions

File tree

.github/copilot-instructions.md

Lines changed: 16 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ row: "- [{summary}](../{filename})"
2727
- [How generated sections work — markers, directives, and fix behavior.](../docs/background/archetypes/generated-section/README.md)
2828
- [Shared patterns (archetypes) reused across multiple linting rules.](../docs/background/archetypes/README.md)
2929
- [Comparison of mdsmith with other Markdown linters and formatters.](../docs/background/markdown-linters.md)
30+
- [Codecov coverage gate and CI status checks.](../docs/development/coverage.md)
31+
- [Where to place Markdown files and documentation types.](../docs/development/file-placement.md)
3032
- [Build commands, project layout, code style, test fixtures, coverage gate, and merge conflicts.](../docs/development/index.md)
31-
- [PR fixup workflow for rebase, CI monitoring, review comment resolution, and gh CLI setup.](../docs/development/pr-fixup-workflow.md)
33+
- [Rebase, CI monitoring, and review comment resolution.](../docs/development/pr-fixup-workflow.md)
3234
- [How to use schemas, require, and allow-empty-section to validate headings, front matter, and filenames.](../docs/guides/directives/enforcing-structure.md)
3335
- [How to use catalog and include directives to generate and embed content in Markdown files.](../docs/guides/directives/generating-content.md)
3436
- [Key differences between Hugo templates and mdsmith directives for users familiar with Hugo.](../docs/guides/directives/hugo-migration.md)
@@ -131,6 +133,19 @@ strip-frontmatter: "true"
131133
heading-level: "absolute"
132134
?>
133135
Build and test reference for mdsmith contributors.
136+
See also:
137+
138+
<?catalog
139+
glob:
140+
- "*.md"
141+
- "!index.md"
142+
sort: path
143+
row: "- [{summary}](../docs/development/{filename})"
144+
?>
145+
- [Codecov coverage gate and CI status checks.](../docs/development/coverage.md)
146+
- [Where to place Markdown files and documentation types.](../docs/development/file-placement.md)
147+
- [Rebase, CI monitoring, and review comment resolution.](../docs/development/pr-fixup-workflow.md)
148+
<?/catalog?>
134149

135150
#### Build & Test Commands
136151

@@ -194,51 +209,6 @@ When adding or changing a rule feature, add both:
194209
are discovered automatically by the integration test
195210
runner in `internal/integration/rules_test.go`.
196211

197-
#### Coverage Gate
198-
199-
Codecov blocks PRs that decrease per-file statement
200-
coverage. Fork PRs skip the upload and are not gated.
201-
Three status checks run on same-repo PRs:
202-
203-
- **project** — overall coverage must not drop below
204-
the base commit.
205-
- **patch** — changed lines must have coverage at
206-
least equal to the project baseline.
207-
- **changes** — no individual file's coverage may
208-
decrease vs the base commit.
209-
210-
If any check fails, Codecov posts a comment listing
211-
the affected files with baseline, current, and delta
212-
percentages. Fix regressions by adding tests for the
213-
uncovered code paths before merging.
214-
215-
Configuration lives in `codecov.yml` at the repo
216-
root. The `test` job in `.github/workflows/ci.yml`
217-
uploads the merged coverage profile to Codecov after
218-
each run.
219-
220-
To reproduce CI's merged coverage locally:
221-
222-
```bash
223-
mkdir -p e2e-cover
224-
E2E_COVERDIR=e2e-cover \
225-
go test -covermode=atomic \
226-
-coverprofile=unit.cov ./...
227-
head -1 unit.cov > merged.cov
228-
tail -n +2 unit.cov \
229-
| grep -v 'cmd/mdsmith/' >> merged.cov || true
230-
tail -n +2 e2e-cover/e2e_coverage.txt \
231-
| grep 'cmd/mdsmith/' >> merged.cov
232-
go tool cover -func=merged.cov
233-
```
234-
235-
Unit tests cannot cover `cmd/mdsmith/` because those
236-
functions run in a subprocess. The merge replaces
237-
those zero-count unit lines with the e2e counts. CI
238-
performs additional validation (mode header match,
239-
file existence); see the `test` job in
240-
`.github/workflows/ci.yml`.
241-
242212
#### Generated Sections
243213

244214
Content between `<?directive ... ?>` and
@@ -256,104 +226,5 @@ mdsmith merge-driver install [files...]
256226
```
257227

258228
Run `mdsmith merge-driver install` once per clone.
259-
260-
#### Where to Place Markdown Files
261-
262-
Every Markdown file checked by mdsmith must live in
263-
one of the allowed directories. The
264-
`directory-structure` rule (MDS033) enforces this for
265-
linted files. When creating a new `.md` file, use the
266-
decision list below — take the **first match**.
267-
268-
##### Decision list
269-
270-
1. **Well-known root file?**
271-
(`README.md`, `CLAUDE.md`, `AGENTS.md`, `PLAN.md`)
272-
→ Place in repo root (`.`)
273-
274-
2. **Plan file?** (has front matter with `id`, `title`,
275-
`status` matching plan schema)
276-
→ Place in `plan/` as `<id>_<slug>.md`
277-
278-
3. **Rule documentation?** (front matter `id` starts
279-
with `MDS`)
280-
→ Place in `internal/rules/<id>-<name>/README.md`
281-
282-
4. **Metric documentation?** (front matter `id` starts
283-
with `MET`)
284-
→ Place in `internal/metrics/<id>-<name>/README.md`
285-
286-
5. **Agent skill?** (SKILL.md with skill front matter)
287-
→ Place in `.claude/skills/<name>/SKILL.md`
288-
289-
6. **GitHub integration?** (copilot instructions,
290-
workflows)
291-
→ Place in `.github/`
292-
293-
7. **Task-oriented: "how do I...?"** (steps, examples,
294-
practical guidance)
295-
→ Place in `docs/guides/`
296-
297-
8. **Lookup-oriented: "what is the spec?"**
298-
(exhaustive, complete, for reference)
299-
→ Place in `docs/reference/`
300-
301-
9. **Learning-oriented: "teach me"** (sequential
302-
tutorial, concrete outcome)
303-
→ Place in `docs/tutorials/`
304-
305-
10. **Context-oriented: "why?"** (rationale,
306-
comparisons, trade-offs, design decisions)
307-
→ Place in `docs/background/`
308-
309-
11. **Contributor workflow?** (build, test, CI, release
310-
procedures)
311-
→ Place in `docs/development/`
312-
313-
12. **Security analysis?** (audits, threat models)
314-
`docs/security/<YYYY-MM-DD>-<slug>.md`
315-
Front matter: `date`, `scope`, `method`.
316-
Schema: `docs/security/proto.md`.
317-
318-
13. **Research?** (spikes, experiments, corpus data,
319-
not user-facing)
320-
→ Place in `docs/research/`
321-
322-
14. **Demo fixture?** (VHS terminal recording samples)
323-
→ Place in `demo/`
324-
325-
15. **Rule test fixture?** (good/bad/fixed examples)
326-
→ Place in `internal/rules/<id>-<name>/good/`,
327-
`bad/`, or `fixed/`
328-
329-
If a file does not match any of these, it does not
330-
belong in the repo as a standalone Markdown file.
331-
Consider whether it should be a section in an existing
332-
document instead.
333-
334-
#### Documentation Types
335-
336-
mdsmith documentation follows four types. Place each
337-
file in the matching directory:
338-
339-
| Type | Directory | Purpose | Example |
340-
|------------|-------------------------------------------|--------------------------------------|-------------------------------------|
341-
| Guide | `docs/guides/` | Task-oriented: how to achieve a goal | "How to enforce document structure" |
342-
| Reference | `docs/reference/`, `internal/rules/MDS*/` | Lookup-oriented: complete specs | CLI flags, rule README |
343-
| Tutorial | `docs/tutorials/` | Learning-oriented: step-by-step | "Your first schema" |
344-
| Background | `docs/background/` | Understanding-oriented: context | Comparison with other linters |
345-
346-
When writing documentation:
347-
348-
- **Guides** answer "how do I...?" — start with a
349-
use case, show examples, link to reference for
350-
full details
351-
- **References** answer "what is...?" — complete,
352-
accurate, generated where possible (use catalog
353-
directives)
354-
- **Tutorials** answer "teach me..." — sequential
355-
steps, minimal prerequisites, concrete outcome
356-
- **Background** answers "why...?" — context,
357-
trade-offs, comparisons, design rationale
358229
<?/include?>
359230
<?/include?>

AGENTS.md

Lines changed: 16 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ row: "- [{summary}]({filename})"
3434
- [How generated sections work — markers, directives, and fix behavior.](docs/background/archetypes/generated-section/README.md)
3535
- [Shared patterns (archetypes) reused across multiple linting rules.](docs/background/archetypes/README.md)
3636
- [Comparison of mdsmith with other Markdown linters and formatters.](docs/background/markdown-linters.md)
37+
- [Codecov coverage gate and CI status checks.](docs/development/coverage.md)
38+
- [Where to place Markdown files and documentation types.](docs/development/file-placement.md)
3739
- [Build commands, project layout, code style, test fixtures, coverage gate, and merge conflicts.](docs/development/index.md)
38-
- [PR fixup workflow for rebase, CI monitoring, review comment resolution, and gh CLI setup.](docs/development/pr-fixup-workflow.md)
40+
- [Rebase, CI monitoring, and review comment resolution.](docs/development/pr-fixup-workflow.md)
3941
- [How to use schemas, require, and allow-empty-section to validate headings, front matter, and filenames.](docs/guides/directives/enforcing-structure.md)
4042
- [How to use catalog and include directives to generate and embed content in Markdown files.](docs/guides/directives/generating-content.md)
4143
- [Key differences between Hugo templates and mdsmith directives for users familiar with Hugo.](docs/guides/directives/hugo-migration.md)
@@ -138,6 +140,19 @@ strip-frontmatter: "true"
138140
heading-level: "absolute"
139141
?>
140142
Build and test reference for mdsmith contributors.
143+
See also:
144+
145+
<?catalog
146+
glob:
147+
- "*.md"
148+
- "!index.md"
149+
sort: path
150+
row: "- [{summary}](docs/development/{filename})"
151+
?>
152+
- [Codecov coverage gate and CI status checks.](docs/development/coverage.md)
153+
- [Where to place Markdown files and documentation types.](docs/development/file-placement.md)
154+
- [Rebase, CI monitoring, and review comment resolution.](docs/development/pr-fixup-workflow.md)
155+
<?/catalog?>
141156

142157
### Build & Test Commands
143158

@@ -201,51 +216,6 @@ When adding or changing a rule feature, add both:
201216
are discovered automatically by the integration test
202217
runner in `internal/integration/rules_test.go`.
203218

204-
### Coverage Gate
205-
206-
Codecov blocks PRs that decrease per-file statement
207-
coverage. Fork PRs skip the upload and are not gated.
208-
Three status checks run on same-repo PRs:
209-
210-
- **project** — overall coverage must not drop below
211-
the base commit.
212-
- **patch** — changed lines must have coverage at
213-
least equal to the project baseline.
214-
- **changes** — no individual file's coverage may
215-
decrease vs the base commit.
216-
217-
If any check fails, Codecov posts a comment listing
218-
the affected files with baseline, current, and delta
219-
percentages. Fix regressions by adding tests for the
220-
uncovered code paths before merging.
221-
222-
Configuration lives in `codecov.yml` at the repo
223-
root. The `test` job in `.github/workflows/ci.yml`
224-
uploads the merged coverage profile to Codecov after
225-
each run.
226-
227-
To reproduce CI's merged coverage locally:
228-
229-
```bash
230-
mkdir -p e2e-cover
231-
E2E_COVERDIR=e2e-cover \
232-
go test -covermode=atomic \
233-
-coverprofile=unit.cov ./...
234-
head -1 unit.cov > merged.cov
235-
tail -n +2 unit.cov \
236-
| grep -v 'cmd/mdsmith/' >> merged.cov || true
237-
tail -n +2 e2e-cover/e2e_coverage.txt \
238-
| grep 'cmd/mdsmith/' >> merged.cov
239-
go tool cover -func=merged.cov
240-
```
241-
242-
Unit tests cannot cover `cmd/mdsmith/` because those
243-
functions run in a subprocess. The merge replaces
244-
those zero-count unit lines with the e2e counts. CI
245-
performs additional validation (mode header match,
246-
file existence); see the `test` job in
247-
`.github/workflows/ci.yml`.
248-
249219
### Generated Sections
250220

251221
Content between `<?directive ... ?>` and
@@ -263,104 +233,5 @@ mdsmith merge-driver install [files...]
263233
```
264234

265235
Run `mdsmith merge-driver install` once per clone.
266-
267-
### Where to Place Markdown Files
268-
269-
Every Markdown file checked by mdsmith must live in
270-
one of the allowed directories. The
271-
`directory-structure` rule (MDS033) enforces this for
272-
linted files. When creating a new `.md` file, use the
273-
decision list below — take the **first match**.
274-
275-
#### Decision list
276-
277-
1. **Well-known root file?**
278-
(`README.md`, `CLAUDE.md`, `AGENTS.md`, `PLAN.md`)
279-
→ Place in repo root (`.`)
280-
281-
2. **Plan file?** (has front matter with `id`, `title`,
282-
`status` matching plan schema)
283-
→ Place in `plan/` as `<id>_<slug>.md`
284-
285-
3. **Rule documentation?** (front matter `id` starts
286-
with `MDS`)
287-
→ Place in `internal/rules/<id>-<name>/README.md`
288-
289-
4. **Metric documentation?** (front matter `id` starts
290-
with `MET`)
291-
→ Place in `internal/metrics/<id>-<name>/README.md`
292-
293-
5. **Agent skill?** (SKILL.md with skill front matter)
294-
→ Place in `.claude/skills/<name>/SKILL.md`
295-
296-
6. **GitHub integration?** (copilot instructions,
297-
workflows)
298-
→ Place in `.github/`
299-
300-
7. **Task-oriented: "how do I...?"** (steps, examples,
301-
practical guidance)
302-
→ Place in `docs/guides/`
303-
304-
8. **Lookup-oriented: "what is the spec?"**
305-
(exhaustive, complete, for reference)
306-
→ Place in `docs/reference/`
307-
308-
9. **Learning-oriented: "teach me"** (sequential
309-
tutorial, concrete outcome)
310-
→ Place in `docs/tutorials/`
311-
312-
10. **Context-oriented: "why?"** (rationale,
313-
comparisons, trade-offs, design decisions)
314-
→ Place in `docs/background/`
315-
316-
11. **Contributor workflow?** (build, test, CI, release
317-
procedures)
318-
→ Place in `docs/development/`
319-
320-
12. **Security analysis?** (audits, threat models)
321-
`docs/security/<YYYY-MM-DD>-<slug>.md`
322-
Front matter: `date`, `scope`, `method`.
323-
Schema: `docs/security/proto.md`.
324-
325-
13. **Research?** (spikes, experiments, corpus data,
326-
not user-facing)
327-
→ Place in `docs/research/`
328-
329-
14. **Demo fixture?** (VHS terminal recording samples)
330-
→ Place in `demo/`
331-
332-
15. **Rule test fixture?** (good/bad/fixed examples)
333-
→ Place in `internal/rules/<id>-<name>/good/`,
334-
`bad/`, or `fixed/`
335-
336-
If a file does not match any of these, it does not
337-
belong in the repo as a standalone Markdown file.
338-
Consider whether it should be a section in an existing
339-
document instead.
340-
341-
### Documentation Types
342-
343-
mdsmith documentation follows four types. Place each
344-
file in the matching directory:
345-
346-
| Type | Directory | Purpose | Example |
347-
|------------|-------------------------------------------|--------------------------------------|-------------------------------------|
348-
| Guide | `docs/guides/` | Task-oriented: how to achieve a goal | "How to enforce document structure" |
349-
| Reference | `docs/reference/`, `internal/rules/MDS*/` | Lookup-oriented: complete specs | CLI flags, rule README |
350-
| Tutorial | `docs/tutorials/` | Learning-oriented: step-by-step | "Your first schema" |
351-
| Background | `docs/background/` | Understanding-oriented: context | Comparison with other linters |
352-
353-
When writing documentation:
354-
355-
- **Guides** answer "how do I...?" — start with a
356-
use case, show examples, link to reference for
357-
full details
358-
- **References** answer "what is...?" — complete,
359-
accurate, generated where possible (use catalog
360-
directives)
361-
- **Tutorials** answer "teach me..." — sequential
362-
steps, minimal prerequisites, concrete outcome
363-
- **Background** answers "why...?" — context,
364-
trade-offs, comparisons, design rationale
365236
<?/include?>
366237
<?/include?>

0 commit comments

Comments
 (0)