Repository navigation
feat(content): set the site type from the editor and tell the Content Agent (CE-056) - #1449
Merged
Merged
Conversation
… Agent (CE-056) Quality phase 2's business type is the brand's site type (00205), set in Brand settings and guessed until someone does. - the page type menu offers it to admins and managers once NEXT_PUBLIC_CONTENT_QUALITY_PHASE is 2, for the whole brand; the page types offered, My rules (read again once saved) and the Rules tab follow it, and a detected page type is saved again for the new site type - the fix, write and brief prompts get a "Site type:" line after the industry once the server's CONTENT_QUALITY_PHASE is 2 (new content-quality.js qualityPhase()) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 24, 2026
feat(content): read the kind of a source's site the rules can't place with AI (CE-046, part b)
#1451
Merged
Keep ansvisor#1438's useUserRole import and canManage declaration; drop this branch's duplicates.
gkhngyk
approved these changes
Oct 24, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good. One small follow-up, fine after merge.
Checked:
- Server flag unset.
qualityPhase()is 0 andsiteTypeLine()returns'', so the fix, write and brief prompts are the same as on main. The only other server change issite_type, shopping_mode_enabledadded to the three brand selects, and both columns exist. No other server code readsCONTENT_QUALITY_PHASE. The people guard and the link checks have no phase gate, and the web's phase-1 Quality (trust, readability, the Quality tab, authors) stays onqualityPhase() >= 1. So nothing turns off while the server flag is unset, and the two flags can go live in either order. - Who can save. The site type group shows only for
canManage, which matches brands' admin/manager update policy.updateBrandwrites through the user's client, so RLS enforces it, and a refused save throws and showssiteFailed. - What follows a pick.
getMyRuleSetsandsaveMyRuleSetread the site type from the database, so the re-read after the save gets the new type's sets.saveContentDraftre-detects a detected page type against the brand's current site type, and autosave doesn't skip an unchanged page, so the extra save re-detects it as intended. The update handler readssiteTypeRef, so detection while someone types uses the new type too. All callers ofPageTypeMenu,EditorSidePanelanduseDraftRulesare updated.
- (low)
_draft-editor.tsx:1892: you can't confirm a guessed site type from the editor. While the brand has none picked, the menu says "Guessed until someone picks one." (_page-type-menu.tsx:107), and the guessed type is already the selected radio. Clicking it reachespickSite(Base UI's radio group callsonValueChangeeven when the value doesn't change), butnext === siteTypereturns early, so nothing is saved and the note stays. Fix: whensiteGuessed, let the current value through and save it withupdateBrand, then skip the re-detect and the autosave, since the type doesn't change. Otherwise, reword the note to point to the other types.
Merge note: #1438 also adds import { useUserRole } from '@/hooks/use-user-role' and const { canManage } = useUserRole(); to _draft-editor.tsx. Git merges the two without a textual conflict, but the combined file has a duplicate import and a second canManage declaration, so typecheck fails and the editor's page test doesn't load. The merge of main on this branch (c0f448e) keeps #1438's import and declaration and drops this PR's. All of this PR's canManage uses come after #1438's declaration. It also keeps both imports where they touched (SendDialog and updateBrand).
7 of 12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First PR of the Quality spec's Phase 2. CE-056: "Business type (B2B / B2C / E-commerce) in project settings, guessed at onboarding, switch in the editor."
The brand already has it as
brands.site_type(00205): the Site type select in Brand settings, guessed from the industry and Shopping mode until someone picks one (siteTypeOf). So this PR adds the two missing pieces. I kept the app's own name, "Site type", in the UI and in the prompt line, as Brand settings and the opportunity generator use it.NEXT_PUBLIC_CONTENT_QUALITY_PHASEis 2):updateBrandaction and updates the brand store, so the Library, Plan and Prompts follow it too. Only then does the editor take it:CONTENT_QUALITY_PHASEis 2):Site type: E-commerce (an online shop selling products).server/src/lib/content-quality.jsmirrors the web'squalityPhase(). The later Phase 2 PRs need it too (the auto hand-off, the brand facts sweep)..env.examplefiles say to set the two together."Guessed at onboarding": onboarding saves the industry and Shopping mode, and the site type is guessed from them when it's read, as Brand settings shows it. That gives the same result without writing a guess, so I left onboarding as it is.
Phase 2 plan (one PR each, in this order):
Related issue
Quality spec (Drive), Phase 2, CE-056.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
NEXT_PUBLIC_CONTENT_QUALITY_PHASE=2inweb/.env.localandCONTENT_QUALITY_PHASE=2inserver/.env, then restart both.Site type: E-commerce (an online shop selling products)after the industry.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Server: format, lint and 2,329 tests pass. Web: 3,343 tests and the build pass.
I haven't checked this in the browser yet; it goes into the next local test session, with screenshots.
🤖 Generated with Claude Code