feat(11.1-02): check links, commands, forbidden names and fence policy
- relative links and anchors resolve against the renderer's heading IDs - summer and ./bin/<app> command names come from the real command constructors through docsite.Options.Commands; a nil set is a problem - consuming-application names fail in page sources and built outputs - go fences in docs/ pages need src=, callouts are NOTE, TIP or WARNING, docs/ headings are plain ASCII - gate gains --claude and self-test plants for each new rule
This commit is contained in:
@@ -5,7 +5,15 @@ import (
|
||||
"errors"
|
||||
|
||||
"git.golem15.com/golem15/summercms/internal/docsite"
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/bonfire"
|
||||
"git.golem15.com/golem15/summercms/modules/cabana"
|
||||
"git.golem15.com/golem15/summercms/modules/compass"
|
||||
"git.golem15.com/golem15/summercms/modules/conga"
|
||||
"git.golem15.com/golem15/summercms/modules/flare"
|
||||
"git.golem15.com/golem15/summercms/modules/lagoon"
|
||||
"git.golem15.com/golem15/summercms/modules/lighthouse/centrifugo"
|
||||
"git.golem15.com/golem15/summercms/modules/surf"
|
||||
)
|
||||
|
||||
func docsBuildCommand() bonfire.Command {
|
||||
@@ -72,7 +80,7 @@ func docsSyncCommand() bonfire.Command {
|
||||
}
|
||||
|
||||
func docsOptions(in bonfire.Input) docsite.Options {
|
||||
var opts docsite.Options
|
||||
opts := docsite.Options{Commands: docsCommands()}
|
||||
opts.Root, _ = in.Flag("root")
|
||||
opts.Src, _ = in.Flag("src")
|
||||
opts.Out, _ = in.Flag("out")
|
||||
@@ -80,6 +88,34 @@ func docsOptions(in bonfire.Input) docsite.Options {
|
||||
return opts
|
||||
}
|
||||
|
||||
// docsCommands collects the command names docs pages may show: the summer
|
||||
// tool's own commands, and every command the generated application main
|
||||
// registers (TestDocsCommandsMirrorGeneratedMain keeps this list in step
|
||||
// with internal/build) plus the realtime and push commands applications
|
||||
// append. The constructors only capture the app, so an empty config is
|
||||
// enough; nothing runs.
|
||||
func docsCommands() *docsite.Commands {
|
||||
var tool []string
|
||||
for _, c := range toolCommands() {
|
||||
tool = append(tool, c.Name)
|
||||
}
|
||||
app := backpack.New(&compass.Config{})
|
||||
var appCmds []bonfire.Command
|
||||
appCmds = append(appCmds, lagoon.RuntimeCommands(app, nil)...)
|
||||
appCmds = append(appCmds, lagoon.KeyGenerateCommand())
|
||||
appCmds = append(appCmds, conga.RuntimeCommands(app, nil)...)
|
||||
appCmds = append(appCmds, surf.ServeCommand(app, nil))
|
||||
appCmds = append(appCmds, surf.RouteListCommand(app, nil))
|
||||
appCmds = append(appCmds, cabana.RuntimeCommands(app)...)
|
||||
appCmds = append(appCmds, centrifugo.Commands(app)...)
|
||||
appCmds = append(appCmds, flare.Commands(app)...)
|
||||
names := make([]string, 0, len(appCmds))
|
||||
for _, c := range appCmds {
|
||||
names = append(names, c.Name)
|
||||
}
|
||||
return &docsite.Commands{Tool: tool, App: names}
|
||||
}
|
||||
|
||||
// reportDocsProblems prints one line per problem and a summary, and returns
|
||||
// a short error so the binary exits 1.
|
||||
func reportDocsProblems(out bonfire.Output, cmd string, problems []docsite.Problem) error {
|
||||
|
||||
Reference in New Issue
Block a user