a published surface is not only markdown

add appended .md unconditionally, so openapi.json became openapi.json.md. Reported
from use against a repository that publishes an OpenAPI document beside its prose.
It is now supplied only when the name carries no extension of its own.

Two consequences came with it that the report could not have seen. A facet's name
was built by stripping the extension, so openapi.json would have taken
openapi.usages.md and collided with the facet for a sibling openapi.md; only a
trailing .md is stripped now. And the unlocked walk matched *.md only, so a
hand-fetched .json under .loom/externals was adopted, unlocked, and invisible to
check; it now walks everything that is not the lock file or a dotfile.

The assumption was never decided, it was typed. externals says a repository
publishes documents and publication says prose in whatever form its readers need.
Neither says markdown and three places in this tool did.

Also records that the wrong diagnosis cost more than the bug: the repository is
private, a scratch config with no token made every fetch look broken, and loomctl
config would have said so in one line.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UTxuSizozEA8yDitPuris
This commit is contained in:
2026-09-11 11:16:31 -04:00
co-authored by Claude Opus 5
parent e0ef0d02f8
commit b92797b4a2
6 changed files with 92 additions and 6 deletions
+4 -2
View File
@@ -13,7 +13,6 @@ package orient
import (
"fmt"
"os"
"path"
"path/filepath"
"strings"
@@ -93,7 +92,10 @@ func Generate(root, out string) (string, error) {
// facetsFor finds the files written beside an adopted document.
func facetsFor(root, rel string) map[string]string {
found := map[string]string{}
stem := strings.TrimSuffix(rel, path.Ext(rel))
// Only a trailing .md is stripped: openapi.json keeps its extension, so
// its facet is openapi.json.usages.md and cannot collide with a facet for
// a sibling openapi.md.
stem := strings.TrimSuffix(rel, ".md")
for _, kind := range []string{"usages", "gaps"} {
p := stem + "." + kind + ".md"
if _, err := os.Stat(filepath.Join(root, lock.Dir, filepath.FromSlash(p))); err == nil {