From a81ced3503dae7b4c521cd260c5a4ef72dc47cbe Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 24 Nov 2026 12:38:50 -0700 Subject: [PATCH] Inventory is now the Market Everything the user sees says Market: the sidebar, titles, breadcrumbs, help text, messages, suggestions and the agent tool's description; the export downloads as supermarket-market.yaml. Its pages live under /market, and the old /inventory addresses redirect there (308, so a form's POST stays a POST). The YAML format (inventory:), the database and the code's names are unchanged, so exported files still import. A breadcrumb no longer repeats the page's own title. Co-Authored-By: Claude Opus 5.5 --- TEST.md | 18 ++++++------- internal/ai/ai.go | 2 +- internal/discovery/discovery.go | 2 +- internal/discovery/discovery_test.go | 2 +- internal/inventory/inventory.go | 2 +- internal/mcpserver/mcpserver.go | 2 +- internal/next/next.go | 4 +-- internal/web/inventory.go | 12 ++++----- internal/web/inventory_test.go | 21 ++++++++++++--- internal/web/links.go | 2 +- internal/web/pages.go | 2 +- internal/web/search.go | 4 +-- internal/web/server.go | 31 +++++++++++++++-------- internal/web/server_test.go | 20 +++++++-------- internal/web/sitepages.go | 2 +- internal/web/templates/backups.html | 2 +- internal/web/templates/content-entry.html | 2 +- internal/web/templates/content.html | 6 ++--- internal/web/templates/entry.html | 8 +++--- internal/web/templates/import.html | 10 ++++---- internal/web/templates/inventory.html | 16 ++++++------ internal/web/templates/layout.html | 4 +-- internal/web/templates/search.html | 2 +- internal/web/templates/seo-links.html | 6 ++--- internal/web/templates/sites-add.html | 2 +- 25 files changed, 105 insertions(+), 79 deletions(-) diff --git a/TEST.md b/TEST.md index 5669d77..c04a064 100644 --- a/TEST.md +++ b/TEST.md @@ -155,7 +155,7 @@ Throughout, also notice: `supermarket restore .tar.gz` brings back the data and the keys (Settings show them as saved). -## 4. Inventory +## 4. Market - [x] Add a partner and a competitor by hand, with websites, feeds, X handle and mention policy. They save and show in the list. @@ -168,7 +168,7 @@ Throughout, also notice: ### Sources -- [ ] *Fetch* on an inventory entry finds new items from its feeds and +- [ ] *Fetch* on a Market entry finds new items from its feeds and sitemap, and the list shows when it was last checked. - [x] Items can be dismissed and restored. - [ ] Your own products (`/content/own`) show your sites' and feeds' new @@ -418,7 +418,7 @@ Throughout, also notice: where it came from; buyer searches come first and are marked. - [ ] None of them is something a page of yours already covers (check two against your site). -- [ ] With competitors (and their websites) in the Inventory, some candidates +- [ ] With competitors (and their websites) in the Market, some candidates come from their sitemaps. - [ ] **(costs, up to 3 web searches)** *Read the live top 3* shows three results with what kind of site each is; check them in a private @@ -581,7 +581,7 @@ Throughout, also notice: - [x] Sites → New pages offers the eight kinds (landing, product, alternative, comparison, blog, home, about, contact), and lists your - products, competitors (from the Inventory), buying signals and SEO + products, competitors (from the Market), buying signals and SEO briefs for new pages. - [ ] **(costs)** *Build the page* for a landing page takes a minute or two and opens the page: a title under 60 characters, a description, an @@ -593,7 +593,7 @@ Throughout, also notice: you didn't give it. What it couldn't know is listed under "Still to add or check by hand". - [ ] An alternative or comparison page needs a competitor, and says only - what the Inventory says about them. + what the Market says about them. - [ ] Built from a signal, its links to the site carry `utm_campaign=&utm_medium=landing`. - [ ] Change a section's type to one the site lacks and *Save*: the error @@ -740,23 +740,23 @@ Throughout, also notice: with your page it links to. Add one that doesn't: it shows as gone. - [ ] A link to a page of yours that answers 404 shows as *points at a 404*, and *What to write next* suggests a redirect. -- [ ] With a partner (and its website) in the Inventory, *Look at the +- [ ] With a partner (and its website) in the Market, *Look at the partners' pages* finds their providers or hosting page when it lists others but not you; *I asked*, then *Won*, move it along. - [ ] **(costs, up to 4 web searches)** With a competitor in the - Inventory, *Find them* lists pages of alternatives to it that leave + Market, *Find them* lists pages of alternatives to it that leave you out; open two and check. ## 10. Search -- [ ] Searching for an inventory entry, a fetched item, a post, a prospect +- [ ] Searching for a Market entry, a fetched item, a post, a prospect (company or person) or a signal finds it, with a link to where it is. ## 11. Agents (MCP) - [x] `supermarket token` prints a token. - [ ] Claude Code (`claude mcp list`) shows Supermarket connected, and can - read the company profile, the inventory and the CRM queue through it + read the company profile, the Market and the CRM queue through it (`profile_get`, `inventory_list`, `crm_pending_actions`). - [ ] Hermes uses the Supermarket and Core MCP tools in its CRM job. diff --git a/internal/ai/ai.go b/internal/ai/ai.go index c6b8b58..18a3907 100644 --- a/internal/ai/ai.go +++ b/internal/ai/ai.go @@ -36,7 +36,7 @@ const ( // Tasks lists the tasks with a description, for the settings page. var Tasks = []struct{ ID, Label string }{ - {TaskProfile, "Drafting the profile and filling in inventory entries"}, + {TaskProfile, "Drafting the profile and filling in Market entries"}, {TaskContent, "Writing posts"}, {TaskProspects, "Finding prospects for a buying signal (needs Claude, for web search)"}, {TaskOutreach, "Writing emails and LinkedIn messages to prospects"}, diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go index ad014b6..c5fd43d 100644 --- a/internal/discovery/discovery.go +++ b/internal/discovery/discovery.go @@ -184,7 +184,7 @@ func loadKnown(d *db.DB, prof *profile.Profile) (*known, error) { } for _, e := range entries { for _, w := range e.Websites { - add(w, "in your inventory ("+e.Relationship+")") + add(w, "in your Market ("+e.Relationship+")") } } for _, q := range []struct{ sql, why string }{ diff --git a/internal/discovery/discovery_test.go b/internal/discovery/discovery_test.go index 98a9f74..159400a 100644 --- a/internal/discovery/discovery_test.go +++ b/internal/discovery/discovery_test.go @@ -79,7 +79,7 @@ func TestFindWithClaude(t *testing.T) { if run.Found != 6 || run.Added != 1 || run.Existing != 1 || run.Skipped != 4 || run.Searches != 4 || run.Status != "done" { t.Fatalf("run: %+v", run) } - for _, want := range []string{"Made Up: its source wasn't among the pages searched", "Rival: in your inventory", "Nope: on the suppression list", "Us: that's you"} { + for _, want := range []string{"Made Up: its source wasn't among the pages searched", "Rival: in your Market", "Nope: on the suppression list", "Us: that's you"} { if !strings.Contains(strings.Join(run.Notes, "\n"), want) { t.Errorf("notes lack %q: %q", want, run.Notes) } diff --git a/internal/inventory/inventory.go b/internal/inventory/inventory.go index 2ad74d5..005a295 100644 --- a/internal/inventory/inventory.go +++ b/internal/inventory/inventory.go @@ -228,7 +228,7 @@ func ParseYAML(data []byte, defaultRel string) ([]Entry, error) { Applications []Entry `yaml:"applications"` } if err2 := yaml.Unmarshal(data, &doc); err2 != nil { - return nil, fmt.Errorf("not an inventory list: %w", err2) + return nil, fmt.Errorf("not a Market list: %w", err2) } list = append(doc.Inventory, doc.Applications...) } diff --git a/internal/mcpserver/mcpserver.go b/internal/mcpserver/mcpserver.go index 801efc5..71c9003 100644 --- a/internal/mcpserver/mcpserver.go +++ b/internal/mcpserver/mcpserver.go @@ -174,7 +174,7 @@ func addTools(s *mcp.Server, d *db.DB) { mcp.AddTool(s, &mcp.Tool{ Name: "inventory_list", - Description: "The inventory: partners (whose news we amplify), competitors (whom we position against) and projects we watch, with their accounts, keywords and talking points.", + Description: "The Market: partners (whose news we amplify), competitors (whom we position against) and projects we watch, with their accounts, keywords and talking points.", }, func(ctx context.Context, _ *mcp.CallToolRequest, args inventoryArgs) (*mcp.CallToolResult, any, error) { entries, err := inventory.List(d, strings.ToLower(strings.TrimSpace(args.Relationship))) if err != nil { diff --git a/internal/next/next.go b/internal/next/next.go index dea6344..4c1522d 100644 --- a/internal/next/next.go +++ b/internal/next/next.go @@ -154,7 +154,7 @@ func MentionSuggestions(ms []Mention, p *profile.Profile) []Suggestion { kind, label, link := "Product page", "Set up its page", "/sites/pages?kind=product¬es="+url.QueryEscape("A page for "+m.Name+": people name it in their replies.")+"#new" if p != nil && slices.ContainsFunc(p.Targets.Technologies, func(t string) bool { return strings.EqualFold(t, m.Name) }) { kind, label = "Alternative page", "Set up an alternative page" - link = "/sites/pages?kind=alternative¬es=" + url.QueryEscape("For people leaving "+m.Name+": they name it in their replies. Add "+m.Name+" to the Inventory as a competitor first.") + "#new" + link = "/sites/pages?kind=alternative¬es=" + url.QueryEscape("For people leaving "+m.Name+": they name it in their replies. Add "+m.Name+" to the Market as a competitor first.") + "#new" } why := fmt.Sprintf("%s named it in their replies, and the site has no page for it.", count(m.People, "person", "people")) if m.Example != "" { @@ -420,7 +420,7 @@ func SectionIdeas(pages []SectionPage, searches map[string][]seo.QueryRow, siteT Key: "section:table:" + pg.Path, Kind: "Add a comparison", Title: pg.Path + " " + pg.Title, Why: fmt.Sprintf("Google shows it %s times in 90 days for searches that compare: %s.", seo.Thousands(vsImpr), quoteList(vs, 3)), Score: sectionScore(vsImpr, rate), - Action: link(table, "Compare, for the searches that bring people here: "+strings.Join(vs[:min(5, len(vs))], "; ")+". Say only what the Inventory and the profile say."), + Action: link(table, "Compare, for the searches that bring people here: "+strings.Join(vs[:min(5, len(vs))], "; ")+". Say only what the Market and the profile say."), }) } } diff --git a/internal/web/inventory.go b/internal/web/inventory.go index 2377be9..43ef9a2 100644 --- a/internal/web/inventory.go +++ b/internal/web/inventory.go @@ -25,7 +25,7 @@ func (s *Server) inventoryList(w http.ResponseWriter, r *http.Request) { s.serverError(w, err) return } - s.render(w, r, "inventory", page{Title: "Inventory", Nav: "inventory", Data: map[string]any{ + s.render(w, r, "inventory", page{Title: "Market", Nav: "inventory", Data: map[string]any{ "Entries": entries, "Relationship": rel, "Relationships": inventory.Relationships, @@ -94,7 +94,7 @@ func (s *Server) inventorySave(w http.ResponseWriter, r *http.Request) { s.render(w, r, "entry", page{Title: title, Nav: "inventory", Error: err.Error(), Data: s.entryForm(e)}) return } - redirect(w, r, "/inventory", "saved") + redirect(w, r, "/market", "saved") } func entryFromForm(r *http.Request) *inventory.Entry { @@ -197,11 +197,11 @@ func (s *Server) inventoryDelete(w http.ResponseWriter, r *http.Request) { s.serverError(w, err) return } - redirect(w, r, "/inventory", "deleted") + redirect(w, r, "/market", "deleted") } func (s *Server) inventoryImportPage(w http.ResponseWriter, r *http.Request) { - s.render(w, r, "import", page{Title: "Import inventory", Nav: "inventory", Data: map[string]any{ + s.render(w, r, "import", page{Title: "Import into the Market", Nav: "inventory", Data: map[string]any{ "Relationships": inventory.Relationships, }}) } @@ -217,7 +217,7 @@ func (s *Server) inventoryImport(w http.ResponseWriter, r *http.Request) { rel := r.FormValue("relationship") overwrite := r.FormValue("overwrite") == "on" show := func(errMsg string, res *inventory.ImportResult) { - s.render(w, r, "import", page{Title: "Import inventory", Nav: "inventory", Error: errMsg, Data: map[string]any{ + s.render(w, r, "import", page{Title: "Import into the Market", Nav: "inventory", Error: errMsg, Data: map[string]any{ "Relationships": inventory.Relationships, "Result": res, "YAML": r.FormValue("yaml"), @@ -269,7 +269,7 @@ func (s *Server) inventoryExport(w http.ResponseWriter, r *http.Request) { return } w.Header().Set("Content-Type", "application/yaml") - w.Header().Set("Content-Disposition", `attachment; filename="supermarket-inventory.yaml"`) + w.Header().Set("Content-Disposition", `attachment; filename="supermarket-market.yaml"`) w.Write(data) } diff --git a/internal/web/inventory_test.go b/internal/web/inventory_test.go index 930b47d..89b6d85 100644 --- a/internal/web/inventory_test.go +++ b/internal/web/inventory_test.go @@ -15,20 +15,35 @@ func TestInventoryPrices(t *testing.T) { form := url.Values{"name": {"Zendesk"}, "relationship": {"competitor"}, "mention_policy": {"name"}, "price_plan": {"Suite Team", ""}, "price_amount": {"$55", ""}, "price_per": {"per agent per month", ""}, "price_checked": {"2026-11-20", "2026-11-24"}, "price_source": {"https://zendesk.com/pricing", ""}} - if rec := postForm(h, "/inventory/save", form); rec.Code != http.StatusSeeOther { + if rec := postForm(h, "/market/save", form); rec.Code != http.StatusSeeOther { t.Fatalf("save: %d %s", rec.Code, rec.Body.String()) } es, _ := inventory.List(s.DB, "") if len(es) != 1 || len(es[0].Prices) != 1 || es[0].Prices[0].Amount != "$55" { t.Fatalf("saved: %+v", es) } - body := do(h, http.MethodGet, "/inventory/"+strconv.FormatInt(es[0].ID, 10), nil, nil).Body.String() + body := do(h, http.MethodGet, "/market/"+strconv.FormatInt(es[0].ID, 10), nil, nil).Body.String() if !strings.Contains(body, `name="price_amount" value="$55"`) || !strings.Contains(body, "Their prices") { t.Errorf("edit page: %s", body) } form.Set("price_checked", "") form["price_checked"] = []string{"", ""} - if rec := postForm(h, "/inventory/save", form); !strings.Contains(rec.Body.String(), "say when you checked the price $55") && !strings.Contains(rec.Body.String(), "Say when you checked the price $55") { + if rec := postForm(h, "/market/save", form); !strings.Contains(rec.Body.String(), "say when you checked the price $55") && !strings.Contains(rec.Body.String(), "Say when you checked the price $55") { t.Errorf("a price without its date was saved: %d", rec.Code) } } + +// The Market was the Inventory: its old addresses lead to the new ones, +// keeping the query and a form's POST. +func TestMarketMoved(t *testing.T) { + _, h := newTestServer(t, nil) + for old, want := range map[string]string{"/inventory": "/market", "/inventory/3?x=1": "/market/3?x=1", "/inventory/import": "/market/import"} { + rec := do(h, http.MethodGet, old, nil, nil) + if rec.Code != http.StatusPermanentRedirect || rec.Header().Get("Location") != want { + t.Errorf("%s: %d %s", old, rec.Code, rec.Header().Get("Location")) + } + } + if rec := postForm(h, "/inventory/save", url.Values{"name": {"X"}}); rec.Code != http.StatusPermanentRedirect || rec.Header().Get("Location") != "/market/save" { + t.Errorf("post: %d %s", rec.Code, rec.Header().Get("Location")) + } +} diff --git a/internal/web/links.go b/internal/web/links.go index befbb70..35060c8 100644 --- a/internal/web/links.go +++ b/internal/web/links.go @@ -198,7 +198,7 @@ func (s *Server) seoLinksAction(w http.ResponseWriter, r *http.Request) { id, _ := strconv.ParseInt(r.PostFormValue("competitor"), 10, 64) e, err := inventory.Get(s.DB, id) if err != nil || e.Relationship != inventory.Competitor { - s.renderLinks(w, r, "Choose a competitor from the Inventory.") + s.renderLinks(w, r, "Choose a competitor from the Market.") return } rs, err := s.researcher() diff --git a/internal/web/pages.go b/internal/web/pages.go index 2b5efaf..a7748b5 100644 --- a/internal/web/pages.go +++ b/internal/web/pages.go @@ -138,7 +138,7 @@ func (s *Server) dashboard(w http.ResponseWriter, r *http.Request) { Detail: ifElse(aiErr == nil, aiCfg.Provider+" · "+aiCfg.Model, "Choose Anthropic or a server on your network; the profile draft and posts need it")}, {Label: "Company profile", Done: p.IsSet(), Link: "/settings/profile", Detail: ifElse(p.IsSet(), p.Name, "Describe the company, its products and its customers (the AI can draft it from your website)")}, - {Label: "Inventory", Done: len(entries) > 0, Link: "/inventory", + {Label: "Market", Done: len(entries) > 0, Link: "/market", Detail: inventorySummary(counts)}, {Label: "Social accounts", Done: s.Secrets.Has(secrets.XAccessToken) || s.Secrets.Has(secrets.LinkedInAccessToken) || s.Secrets.Has(secrets.RedditAccessToken), Link: "/settings/accounts", Detail: s.connectionSummary(conns)}, diff --git a/internal/web/search.go b/internal/web/search.go index 776d6ae..038225b 100644 --- a/internal/web/search.go +++ b/internal/web/search.go @@ -100,7 +100,7 @@ func (s *Server) search(q string) ([]hitGroup, error) { if matches(e.Name, e.Description, e.TwitterHandle, e.TalkingPoints, strings.Join(e.Websites, " "), strings.Join(e.Hashtags, " "), strings.Join(e.Keywords, " "), strings.Join(e.Subreddits, " ")) { inv = append(inv, hit{Title: e.Name, Detail: e.Description, - Link: "/inventory/" + strconv.FormatInt(e.ID, 10), Badge: e.Relationship}) + Link: "/market/" + strconv.FormatInt(e.ID, 10), Badge: e.Relationship}) } } entryLink := func(name string) string { @@ -202,7 +202,7 @@ func (s *Server) search(q string) ([]hitGroup, error) { } var groups []hitGroup - for _, g := range []hitGroup{{"Posts", posts}, {"Fetched items", found}, {"Inventory", inv}, {"Prospects", prospectHits}, {"Settings", settings}} { + for _, g := range []hitGroup{{"Posts", posts}, {"Fetched items", found}, {"Market", inv}, {"Prospects", prospectHits}, {"Settings", settings}} { if len(g.Hits) > 0 { groups = append(groups, g) } diff --git a/internal/web/server.go b/internal/web/server.go index 7f28d52..7656fa3 100644 --- a/internal/web/server.go +++ b/internal/web/server.go @@ -97,15 +97,19 @@ func (s *Server) Handler() (http.Handler, error) { mux.HandleFunc("GET /search", s.searchPage) - mux.HandleFunc("GET /inventory", s.inventoryList) - mux.HandleFunc("GET /inventory/new", s.inventoryEdit) - mux.HandleFunc("GET /inventory/{id}", s.inventoryEdit) - mux.HandleFunc("POST /inventory/save", s.inventorySave) - mux.HandleFunc("POST /inventory/fill", s.inventoryFill) - mux.HandleFunc("POST /inventory/{id}/delete", s.inventoryDelete) - mux.HandleFunc("GET /inventory/import", s.inventoryImportPage) - mux.HandleFunc("POST /inventory/import", s.inventoryImport) - mux.HandleFunc("GET /inventory/export", s.inventoryExport) + mux.HandleFunc("GET /market", s.inventoryList) + mux.HandleFunc("GET /market/new", s.inventoryEdit) + mux.HandleFunc("GET /market/{id}", s.inventoryEdit) + mux.HandleFunc("POST /market/save", s.inventorySave) + mux.HandleFunc("POST /market/fill", s.inventoryFill) + mux.HandleFunc("POST /market/{id}/delete", s.inventoryDelete) + mux.HandleFunc("GET /market/import", s.inventoryImportPage) + mux.HandleFunc("POST /market/import", s.inventoryImport) + mux.HandleFunc("GET /market/export", s.inventoryExport) + // The Market was the Inventory: its old addresses lead to the new ones + // (308 keeps a form's POST a POST). + mux.HandleFunc("/inventory", marketMoved) + mux.HandleFunc("/inventory/", marketMoved) // Settings: the profile, social accounts, AI, and the Core & Hermes. mux.HandleFunc("GET /settings", func(w http.ResponseWriter, r *http.Request) { @@ -476,7 +480,7 @@ func (p page) Section() string { case strings.HasPrefix(p.Nav, "settings"): return "Settings" case p.Nav == "inventory": - return "Inventory" + return "Market" case strings.HasPrefix(p.Nav, "sites"): return "Sites" } @@ -705,3 +709,10 @@ func ago(t time.Time) string { return t.Local().Format("2 Jan 2006") } } + +// marketMoved sends an old /inventory address to its /market one. +func marketMoved(w http.ResponseWriter, r *http.Request) { + u := *r.URL + u.Path = "/market" + strings.TrimPrefix(r.URL.Path, "/inventory") + http.Redirect(w, r, u.RequestURI(), http.StatusPermanentRedirect) +} diff --git a/internal/web/server_test.go b/internal/web/server_test.go index 4a455a1..cf03f0f 100644 --- a/internal/web/server_test.go +++ b/internal/web/server_test.go @@ -95,8 +95,8 @@ func TestEveryPageRenders(t *testing.T) { t.Fatal(err) } - for _, path := range []string{"/", "/?msg=saved", "/settings/profile", "/inventory", "/inventory?relationship=partner", - "/inventory/new", "/inventory/1", "/inventory/import", "/inventory/export", + for _, path := range []string{"/", "/?msg=saved", "/settings/profile", "/market", "/market?relationship=partner", + "/market/new", "/market/1", "/market/import", "/market/export", "/settings/ai", "/settings/accounts", "/settings/core", "/static/app.css", "/favicon.ico", "/static/favicon.png", "/static/logo.png", "/static/apple-touch-icon.png", "/search", "/crm", "/search?q=rival", "/search?q=nothing+here", "/static/htmx.min.js", "/healthz", "/content", "/content/1", "/content/1?dismissed=1", "/posts", "/posts?msg=drafted", "/content/scheduled", "/content/published", @@ -107,7 +107,7 @@ func TestEveryPageRenders(t *testing.T) { t.Errorf("core=%v GET %s: %d %s", c != nil, path, rec.Code, rec.Body.String()) } } - if rec := do(h, http.MethodGet, "/inventory/999", nil, nil); rec.Code != http.StatusNotFound { + if rec := do(h, http.MethodGet, "/market/999", nil, nil); rec.Code != http.StatusNotFound { t.Errorf("missing entry: %d", rec.Code) } } @@ -179,7 +179,7 @@ func TestProfileAndInventoryForms(t *testing.T) { } entry := url.Values{"name": {"Rival"}, "relationship": {"competitor"}, "hashtags": {"rival, #Other"}, "twitter_handle": {"@rival"}} - if rec := postForm(h, "/inventory/save", entry); rec.Code != http.StatusSeeOther { + if rec := postForm(h, "/market/save", entry); rec.Code != http.StatusSeeOther { t.Fatalf("save entry: %d %s", rec.Code, rec.Body.String()) } entries, _ := inventory.List(s.DB, "competitor") @@ -188,12 +188,12 @@ func TestProfileAndInventoryForms(t *testing.T) { t.Fatalf("entry: %+v", entries) } // Same name, different case: refused. - rec = postForm(h, "/inventory/save", url.Values{"name": {"RIVAL"}, "relationship": {"partner"}}) + rec = postForm(h, "/market/save", url.Values{"name": {"RIVAL"}, "relationship": {"partner"}}) if rec.Code != http.StatusOK || !strings.Contains(rec.Body.String(), "already has that name") { t.Errorf("duplicate: %d", rec.Code) } - rec = postForm(h, "/inventory/import", url.Values{"example": {"federated"}, "relationship": {"watch"}}) + rec = postForm(h, "/market/import", url.Values{"example": {"federated"}, "relationship": {"watch"}}) if rec.Code != http.StatusOK || !strings.Contains(rec.Body.String(), "21 added") { t.Errorf("import example: %d %s", rec.Code, rec.Body.String()) } @@ -202,7 +202,7 @@ func TestProfileAndInventoryForms(t *testing.T) { t.Errorf("example entries are partners: got %d", len(partners)) } - if rec := postForm(h, "/inventory/1/delete", nil); rec.Code != http.StatusSeeOther { + if rec := postForm(h, "/market/1/delete", nil); rec.Code != http.StatusSeeOther { t.Errorf("delete: %d", rec.Code) } } @@ -384,17 +384,17 @@ func TestMCPNeedsTokenAndChecksIn(t *testing.T) { func TestInventoryFillNeedsAI(t *testing.T) { _, h := newTestServer(t, nil) - if body := do(h, http.MethodGet, "/inventory/new", nil, nil).Body.String(); !strings.Contains(body, `set up the AI`) { + if body := do(h, http.MethodGet, "/market/new", nil, nil).Body.String(); !strings.Contains(body, `set up the AI`) { t.Error("new entry without AI: no warning") } // The form comes back with what was typed, and says why. - rec := postForm(h, "/inventory/fill", url.Values{"name": {"Rival"}, "relationship": {"competitor"}, + rec := postForm(h, "/market/fill", url.Values{"name": {"Rival"}, "relationship": {"competitor"}, "description": {"Typed."}, "draft_url": {"https://rival.example"}}) body := rec.Body.String() if rec.Code != http.StatusOK || !strings.Contains(body, "AI provider not configured") || !strings.Contains(body, "Typed.") { t.Errorf("fill without AI: %d", rec.Code) } - rec = postForm(h, "/inventory/fill", url.Values{"name": {"Rival"}}) + rec = postForm(h, "/market/fill", url.Values{"name": {"Rival"}}) if !strings.Contains(rec.Body.String(), "Enter their website") { t.Error("fill without a website: no message") } diff --git a/internal/web/sitepages.go b/internal/web/sitepages.go index c42cbdf..dad612d 100644 --- a/internal/web/sitepages.go +++ b/internal/web/sitepages.go @@ -63,7 +63,7 @@ func (s *Server) pageInputs(p *sites.SitePage, prof *profile.Profile) (sites.Inp if id := p.Source.Competitor; id != 0 { e, err := inventory.Get(s.DB, id) if err != nil { - return in, "", errors.New("that competitor isn't in the Inventory any more") + return in, "", errors.New("that competitor isn't in the Market any more") } in.Competitor = e } diff --git a/internal/web/templates/backups.html b/internal/web/templates/backups.html index acdeb98..6f45e6b 100644 --- a/internal/web/templates/backups.html +++ b/internal/web/templates/backups.html @@ -1,6 +1,6 @@ {{define "content"}}{{template "settings-start" .}}{{with .Data}}{{$d := .}}

Backups

-

Copies of Supermarket's database: your profile, inventory, signals, prospects, drafts, SEO and metrics. Each one is a single SQLite file. Your keys and tokens aren't in them; they stay in secrets.json.

+

Copies of Supermarket's database: your profile, the Market, signals, prospects, drafts, SEO and metrics. Each one is a single SQLite file. Your keys and tokens aren't in them; they stay in secrets.json.

{{with .Restored}}

Restored from {{.From}} {{ago .At}}{{if .Secrets}}, keys and tokens included{{end}}. What was there before is backed up as {{.Backup}}.

{{end}} {{if .Pending}} diff --git a/internal/web/templates/content-entry.html b/internal/web/templates/content-entry.html index 005e467..816d90e 100644 --- a/internal/web/templates/content-entry.html +++ b/internal/web/templates/content-entry.html @@ -5,7 +5,7 @@
- {{if .Own}}Edit profile{{else}}Edit entry{{end}} + {{if .Own}}Edit profile{{else}}Edit entry{{end}}

diff --git a/internal/web/templates/content.html b/internal/web/templates/content.html index e1e4a49..2c4f42f 100644 --- a/internal/web/templates/content.html +++ b/internal/web/templates/content.html @@ -1,6 +1,6 @@ {{define "content"}}{{with .Data}}

Sources

-

Pick an inventory entry to fetch its latest news, choose what to write about, and get a draft for each channel to review under Posts.

+

Pick a Market entry to fetch its latest news, choose what to write about, and get a draft for each channel to review under Posts.

{{if .Rows}} @@ -15,7 +15,7 @@ {{else}} - + {{end}} @@ -25,7 +25,7 @@
{{.Name}} {{.Entry.Relationship}}{{if .Sources}}{{join .Sources ", "}}{{else}}none: add some{{end}}{{if .Sources}}{{join .Sources ", "}}{{else}}none: add some{{end}}{{if .Waiting}}{{.Waiting}}{{end}} {{ago .LastChecked}}
{{else}}
-

Add the partners and competitors you post about to the Inventory first.

+

Add the partners and competitors you post about to the Market first.

{{end}} {{end}}{{end}} diff --git a/internal/web/templates/entry.html b/internal/web/templates/entry.html index d14ce99..f279a6a 100644 --- a/internal/web/templates/entry.html +++ b/internal/web/templates/entry.html @@ -1,8 +1,8 @@ {{define "content"}}{{with .Data}}{{$d := .}}{{$e := .E}} -

← Inventory

+

← Market

{{if $e.ID}}{{$e.Name}}{{else}}New entry{{end}}

-
+

Fill in with AI

@@ -10,7 +10,7 @@ {{if .NoAI}}

This needs the AI: first set up the AI, then come back. Or fill in the form by hand.

{{end}}
- +

Takes up to a minute or two.

{{if .Drafted}}{{if .Filled}}

Filled in: {{join .Filled ", "}}. Check them, correct what's wrong, then Save.

{{else}}

Nothing to fill in: every box the website could answer is already filled, or the site doesn't say.

{{end}}{{end}} @@ -97,7 +97,7 @@ {{if $e.ID}} -
+
{{end}} diff --git a/internal/web/templates/import.html b/internal/web/templates/import.html index cce4a2c..e5eb795 100644 --- a/internal/web/templates/import.html +++ b/internal/web/templates/import.html @@ -1,16 +1,16 @@ {{define "content"}}{{with .Data}} -

← Inventory

-

Import inventory

+

← Market

+

Import into the Market

{{with .Result}}
-

{{.Added}} added, {{.Updated}} updated, {{.Skipped}} skipped (already in the inventory).

+

{{.Added}} added, {{.Updated}} updated, {{.Skipped}} skipped (already in the Market).

{{if .Errors}}
    {{range .Errors}}
  • {{.}}
  • {{end}}
{{end}} -

See the inventory

+

See the Market

{{end}} -
+

YAML: a list of entries, or a document with an inventory: list. The old app's config.yaml works too (its applications: list).