Skip to content

Plan 200: move docs/ embed out of internal/lsp/hover.go#375

Merged
jeduden merged 5 commits into
mainfrom
claude/tender-cray-BATq6
May 24, 2026
Merged

Plan 200: move docs/ embed out of internal/lsp/hover.go#375
jeduden merged 5 commits into
mainfrom
claude/tender-cray-BATq6

Conversation

@jeduden
Copy link
Copy Markdown
Owner

@jeduden jeduden commented May 24, 2026

Summary

Picks up the work from #374 (Plan 200) onto a fresh branch off
current main, since #374's branch had drifted out of sync.

  • internal/lsp/hover.go imported docs/guides/directives as a Go
    package, which put compiled source inside the docs tree and added a
    docs/ layer the architecture map doesn't have.
  • New internal/directives/ holds short, hover-sized stubs (the
    internal/concepts/placeholder-grammar.md pattern) embedded via
    embed.FS. Hover now imports internal/directives instead.
  • The full user guides stay in docs/guides/directives/ and remain
    indexed by docs/guides/index.md. Only embed.go was deleted there.
  • .mdsmith.yml and .mdsmith.pinned.yml gain internal/directives/**
    under directory-structure.allowed so the new package's markdown
    lints under default rules.
  • Plan 200 marked ✅; PLAN.md catalog refreshed.
  • Carries the Plan 200: move docs/ embed out of internal/lsp/hover.go #374 review fix: sort: numeric:id in the catalog stub
    example.

Closes the hover entry from
docs/development/architecture-audit.md
("internal/lsp/hover.go imports from docs/").

Test plan

  • go build ./...
  • go test ./...
  • go tool golangci-lint run — 0 issues
  • go run ./cmd/mdsmith check . — 353 files, 0 failures
  • grep -rn 'docs/guides/directives' internal/ --include='*.go'
    returns only the package comment in internal/directives/directives.go

Generated by Claude Code

claude added 3 commits May 24, 2026 00:23
internal/lsp/hover.go imported docs/guides/directives as
a Go package, putting compiled source inside the docs tree
and adding a docs/ layer to the import graph that the
architecture map does not have.

Move the embed to internal/directives, mirroring the
internal/concepts pattern: short hover-sized stubs in
internal/directives/*.md hold the per-directive copy that
the LSP serves; the full user guides stay in
docs/guides/directives/ and remain indexed by the catalog.

Adds internal/directives/** to directory-structure.allowed
so the new package's markdown lints under default rules.
The mdsmith-fixed-version CI job runs the pinned v0.15.0
binary against .mdsmith.pinned.yml. The previous commit
added internal/directives/** to .mdsmith.yml but not to
the pinned mirror, so v0.15.0 fired MDS033 on every new
markdown file in the package.
Copilot review on PR #374: a copy/pasteable plan catalog
example with `sort: id` collates lexicographically (100
before 52). Switch the stub to `sort: numeric:id` so it
matches the recommendation in the full generating-content
guide.
Copilot AI review requested due to automatic review settings May 24, 2026 00:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves LSP hover directive documentation out of the docs/ tree and into a Go-internal package, avoiding compiling Go source under documentation paths and aligning with the repo’s architecture layering.

Changes:

  • Replace internal/lsp/hover.go’s dependency on docs/guides/directives with internal/directives embedded stubs.
  • Add internal/directives/ package with embedded hover-sized Markdown stubs + a unit test to ensure embedded files exist.
  • Update directory-structure allowlists and mark Plan 200 complete (refresh PLAN catalog entry).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plan/200_arch-fix-hover-embed.md Marks Plan 200 complete and updates tasks/acceptance criteria text.
PLAN.md Updates Plan 200 status in the plan catalog.
internal/lsp/hover.go Switches directive hover docs FS import from docs/... to internal/directives.
internal/directives/directives.go New embedded FS for hover stubs (//go:embed *.md).
internal/directives/directives_test.go Adds a unit test to ensure embedded stub files exist and are non-empty.
internal/directives/build.md Adds hover stub content for <?build?>.
internal/directives/enforcing-structure.md Adds hover stub content for <?require?> and <?allow-empty-section?>.
internal/directives/generating-content.md Adds hover stub content for <?catalog?> and <?include?>.
docs/guides/directives/embed.go Removes the Go embed package from docs/ (docs remain as Markdown only).
.mdsmith.yml Allows internal/directives/** under directory-structure.allowed.
.mdsmith.pinned.yml Keeps pinned config in sync with the new allowed directory.

Comment thread internal/directives/generating-content.md Outdated
Comment thread internal/directives/directives_test.go Outdated
@jeduden jeduden marked this pull request as ready for review May 24, 2026 00:33
Two unresolved Copilot threads on PR #375:

generating-content.md: the heading-level paragraph was
backwards. The include rule only accepts
heading-level: "absolute", which SHIFTS included
headings to nest under the include site's parent
heading. Omitting heading-level keeps source levels.
There is no "relative" option — internal/rules/include
rejects any value other than "absolute". Rewrite the
sentence to match.

directives_test.go + new internal/lsp/hover_test.go:
the directives-side test only checks a hardcoded list,
so the comment claiming it guards directiveToDocFile
was misleading. Soften that comment and add the real
cross-package invariant test next to the map: walk
directiveToDocFile in internal/lsp and assert each
mapped file resolves in directives.FS.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.98%. Comparing base (4809097) to head (4ac7732).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
Components Coverage Δ
Go 96.95% <ø> (+0.48%) ⬆️
TypeScript 99.39% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread internal/directives/build.md Outdated
Comment thread internal/directives/generating-content.md Outdated
Two further Copilot threads on #375:

build.md said "No external tool runs at lint time",
which implies fix might execute the recipe. mdsmith
never runs recipe commands at all — fix only renders
the body-template, and MDS040 is a static check.

generating-content.md said the include body "is
regenerated whenever the source changes", which
implies automatic updates. Make it explicit: mdsmith
fix regenerates; mdsmith check reports drift.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment on lines +3 to +23
import (
"io/fs"
"testing"

"github.com/jeduden/mdsmith/internal/directives"
"github.com/stretchr/testify/assert"
)

// TestDirectiveToDocFileResolves walks directiveToDocFile and asserts
// every mapped filename resolves to a non-empty file in directives.FS.
// Adding a directive→file mapping without shipping the stub would
// otherwise return an empty payload at hover time.
func TestDirectiveToDocFileResolves(t *testing.T) {
for name, fname := range directiveToDocFile {
t.Run(name, func(t *testing.T) {
data, err := fs.ReadFile(directives.FS, fname)
assert.NoError(t, err, "directive %q maps to %q but stub is missing", name, fname)
assert.NotEmpty(t, data, "directive %q stub %q must have content", name, fname)
})
}
}
@jeduden jeduden merged commit f1b7e54 into main May 24, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants