Skip to content

fix: navgraph auto-include, scaffold Callout API + publish-copy + version-const bump, release-workflow pre-push guard (0.1.1-alpha) - #21

Merged
Shewart merged 7 commits into
mainfrom
fix/add-updates-navgraph
Jul 25, 2026
Merged

fix: navgraph auto-include, scaffold Callout API + publish-copy + version-const bump, release-workflow pre-push guard (0.1.1-alpha)#21
Shewart merged 7 commits into
mainfrom
fix/add-updates-navgraph

Conversation

@Shewart

@Shewart Shewart commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

First point-release after the dogfood smoke of 0.1.0-alpha. Three consumer-blocking fixes surfaced by the end-to-end install-and-scaffold test, plus release-workflow hardening so the "silently shipped a stale binary" class of failure can't recur.

The fixes

1. NavigationGraphBuilder auto-includes files/folders not in meta.json

Symptom: shelldocs add component Button wrote content/docs/components/button.md to disk, printed "created …" success, but /docs/components/button 404'd and the page never appeared in the sidebar. Consumer had to hand-edit meta.json to unbrick the file they just scaffolded.

Root cause: src/ShellDocs.Core/NavigationGraphBuilder.cs:62-67BuildFolder iterated meta.Pages and returned only those resolved nodes. Any .md file or subfolder not referenced was silently dropped from the graph.

Fix: meta.json now controls ordering of explicitly-listed items only; presence is driven by the file tree. BuildFolder tracks consumed slugs + folders while processing meta, then appends the leftovers alphabetically after the explicit ordering. Backward-compatible — consumers who list everything explicitly get their exact ordering verbatim before any auto-appended tail.

4 new tests in NavigationGraphBuilderTests cover: unreferenced .md file appended, unreferenced subfolder appended as section, alphabetical ordering of leftovers, explicit ordering preserved for meta-listed items.

2. shelldocs init scaffold uses the current <Callout> API

Symptom: content/docs/introduction.md template referenced a Text prop that doesn't exist on <Callout>. First dotnet run on a fresh scaffold rendered an empty callout — ugly first-impression.

Fix: template updated to the current API — <Callout Variant="info" Title="Live component">…body…</Callout> (non-self-closing, body renders as ChildContent).

3. shelldocs init inserts Content Update itemgroup so dotnet publish copies the markdown

Symptom: CLI-scaffolded csproj had no <Content Update="content/**/*.md" CopyToOutputDirectory="PreserveNewest" />. dotnet run worked (resolves ContentRoot to source), but dotnet publish silently omitted the markdown corpus — deployed sites had an empty NavigationGraph and every /docs/* route 404'd.

Fix: new AddContentCopyIfMissing(csproj, changes) helper (mirrors AddPackageIfMissing) inserts <Content Update="content/**/*.md;content/**/meta.json" CopyToOutputDirectory="PreserveNewest" /> before </Project>. Idempotent — no-op if already present. Called from ScaffoldPackages, runs in both CREATE and ATTACH modes.

4. CLI's hardcoded ShellDocsVersion const bumped to 0.1.1-alpha

Symptom (would have been): shelldocs init hardcodes the package version it inserts as <PackageReference Include="ShellDocs.Components" Version="..." />. If we shipped 0.1.1-alpha CLI still referencing 0.1.0-alpha packages, every fresh scaffold would pull last version's packages — the new CLI's fixes would silently not reach consumers.

Fix: const bumped alongside Directory.Build.props. docs/RELEASING.md step 1 updated to call out this second bump explicitly so it doesn't drift again.

Release-infrastructure harden

Release workflow pre-push existence check. New step queries nuget.org/v3-flatcontainer for each of the 6 package IDs at the tag's version before invoking dotnet nuget push. If any version already exists on nuget.org, the workflow fails loud with a "bump Directory.Build.props and re-tag" message. --skip-duplicate stays in the push step (still useful for resuming a workflow re-run that partially completed), but the pre-check catches the "you forgot to bump the version number" case explicitly instead of silently no-op'ing.

Docs

  • CHANGELOG.md[0.1.1-alpha] entry documenting all four fixes + workflow harden
  • docs/RELEASING.md — step 1 amended: bump InitCommand.ShellDocsVersion const alongside Directory.Build.props
  • docs/SHELLUI_DOGFOOD_FIXES.md — three entries moved from Open to Fixed with consistent branch attribution (first commit of this file to git — was previously working-tree-only across sessions)
  • docs/SHELLUI_ICONS.md — first commit of the design proposal to git (same story as the dogfood file)

Test plan

  • dotnet build shelldocs.slnx — clean, 0 warnings, 0 errors
  • dotnet test shelldocs.slnx143 / 143 passing (+4 new NavigationGraphBuilder tests)
  • bash scripts/pack-dry-run.sh — all six packages produce 0.1.1-alpha cleanly
  • Full end-to-end smoke against branch-packed CLI:
    1. Local pack + register as shelldocs-branch-preview NuGet source
    2. dotnet tool install -g ShellDocs.CLI --version 0.1.1-alpha from the branch feed
    3. Fresh shelldocs init MySmokeDocs in scratch dir
    4. Confirmed csproj references ShellDocs.Components 0.1.1-alpha + ShellDocs.Tokens 0.1.1-alpha + Content Update itemgroup present + introduction.md uses new Callout API
    5. shelldocs add component Button + shelldocs add guide getting-started → files created, meta.json untouched
    6. shelldocs dev --port 5100 starts cleanly
    7. GET /, GET /docs/introduction, GET /docs/components/button, GET /docs/guides/getting-started → all 200 OK, sidebar auto-shows Introduction + Components section + Guides section — no meta.json edits required (the primary fix)
  • Post-smoke: local branch source removed, user's global tool restored to nuget.org 0.1.0-alpha

Files touched

  • src/ShellDocs.Core/NavigationGraphBuilder.csBuildFolder auto-appends unreferenced files/folders; ResolveEntry signature extended with consumed-slug/folder tracking sets
  • src/ShellDocs.CLI/Commands/InitCommand.csShellDocsVersion const bumped t

@Shewart
Shewart merged commit f851881 into main Jul 25, 2026
1 check passed
@Shewart
Shewart deleted the fix/add-updates-navgraph branch July 25, 2026 15:06
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.

1 participant