Merge C24 docs portal and client guide
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
e81f1cba4c
17 files changed
+1328
-56
No files matched your search
@@ -2,7 +2,6 @@ package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -24,60 +23,17 @@ type docTopic struct {
|
||||
src func() string
|
||||
}
|
||||
|
||||
// docOrder is the documents in the order someone new reads them.
|
||||
var docOrder = []string{"console", "quick-install", "install", "node-onboarding", "onboarding",
|
||||
"guardrails", "choosing-models", "fabrics", "facility-aware-placement", "data", "reference", "development"}
|
||||
|
||||
// docTopics is the manual: the documents in llmgw.Manual's order, which the
|
||||
// gateway's docs portal shares, with a page for the commands after the
|
||||
// configuration reference — the one page only the command tree can write.
|
||||
func docTopics() []docTopic {
|
||||
read := func(path string) func() string {
|
||||
return func() string {
|
||||
b, err := fs.ReadFile(llmgw.Docs, path)
|
||||
if err != nil {
|
||||
return "# " + path + "\n\nNot in this build."
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
}
|
||||
titleOf := func(path string) string {
|
||||
b, _ := fs.ReadFile(llmgw.Docs, path)
|
||||
for _, l := range strings.Split(string(b), "\n") {
|
||||
if strings.HasPrefix(l, "# ") {
|
||||
return strings.TrimPrefix(l, "# ")
|
||||
}
|
||||
}
|
||||
return path
|
||||
}
|
||||
var out []docTopic
|
||||
seen := map[string]bool{}
|
||||
add := func(key, path string) {
|
||||
if seen[key] {
|
||||
return
|
||||
}
|
||||
if _, err := fs.Stat(llmgw.Docs, path); err != nil {
|
||||
return
|
||||
}
|
||||
seen[key] = true
|
||||
out = append(out, docTopic{key: key, title: titleOf(path), src: read(path)})
|
||||
}
|
||||
for _, k := range docOrder {
|
||||
add(k, "docs/"+k+".md")
|
||||
if k == "reference" {
|
||||
for _, d := range llmgw.Manual() {
|
||||
out = append(out, docTopic{key: d.Key, title: d.Title, src: d.Source})
|
||||
if d.Key == "reference" {
|
||||
out = append(out, docTopic{key: "commands", title: "Commands", src: commandsManual})
|
||||
seen["commands"] = true
|
||||
}
|
||||
}
|
||||
// Any document not placed above, so a new one is never missing.
|
||||
entries, _ := fs.ReadDir(llmgw.Docs, "docs")
|
||||
var rest []string
|
||||
for _, e := range entries {
|
||||
rest = append(rest, strings.TrimSuffix(e.Name(), ".md"))
|
||||
}
|
||||
sort.Strings(rest)
|
||||
for _, k := range rest {
|
||||
add(k, "docs/"+k+".md")
|
||||
}
|
||||
add("readme", "README.md")
|
||||
add("changes", "CHANGELOG.md")
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user