Phase 7 part 5: add a section to an existing page

Sites → Sections and pages → Add a section, on any page built from
sections: choose one of the site's section types and where it goes; the
AI writes it from the page, its searches, the profile and the Inventory,
with the same rules as a new page. It's reviewed like a page (claims to
confirm, to-dos), and the pull request inserts it into the page's file as
text, so only that section is added; the build checks it. What to write
next suggests a FAQ for a section page found with questions, and a
comparison for one searched against something else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 07:25:19 -07:00
co-authored by Claude Opus 5.5
parent 5705a9b58b
commit fdfbcd3d3d
15 changed files with 873 additions and 39 deletions
+9 -4
View File
@@ -96,6 +96,9 @@ func (s *Server) campaignOf(p *sites.SitePage) string {
// compose has the AI write the page (again), then checks it.
func (s *Server) compose(ctx context.Context, cur siteRepo, p *sites.SitePage, previous bool) error {
if p.Kind == sites.KindSection {
return s.composeSection(ctx, cur, p)
}
client, prof, err := s.draftClient()
if err != nil {
return err
@@ -393,10 +396,12 @@ func (s *Server) sitePageAction(w http.ResponseWriter, r *http.Request) {
}
// Every action keeps the user's edits first.
if _, has := r.PostForm["sections"]; has {
p.Title = strings.TrimSpace(r.PostFormValue("title"))
p.Description = strings.TrimSpace(r.PostFormValue("description"))
if p.File == "" {
p.Path = sites.CleanPath(r.PostFormValue("path"))
if p.Kind != sites.KindSection { // a section keeps its page's title and address
p.Title = strings.TrimSpace(r.PostFormValue("title"))
p.Description = strings.TrimSpace(r.PostFormValue("description"))
if p.File == "" {
p.Path = sites.CleanPath(r.PostFormValue("path"))
}
}
p.Notes = strings.TrimSpace(r.PostFormValue("notes"))
p.Sections = strings.TrimSpace(strings.ReplaceAll(r.PostFormValue("sections"), "\r\n", "\n"))