feat(wix-headless): merge index.astro home contributions in orchestrator#210
Draft
moranshe-max wants to merge 1 commit into
Draft
feat(wix-headless): merge index.astro home contributions in orchestrator#210moranshe-max wants to merge 1 commit into
moranshe-max wants to merge 1 commit into
Conversation
Two Phase 4 page agents currently patch src/pages/index.astro at home:*
markers (different markers, so no same-marker race like nav:links, but
the same brittleness pattern):
- stores-pages-home-and-nav → <!-- home:stores -->
- gift-cards-pages → <!-- home:gift-cards -->
The 2026-05 Moran's Bakery run exposed a subtle failure mode this PR
fixes directly: the designer didn't emit <!-- home:gift-cards --> in
its index.astro (because the gift-cards pack is `disabled: true` and
the designer was told to skip its surfaces), and the gift-cards-pages
agent then returned MARKER_NOT_FOUND. With orchestrator-merge, that
omission becomes observable in the script's `skipped[]` output rather
than masked inside an agent return.
New contract (mirrors PR (b) / merge-navigation.mjs):
- Each Phase 4 page agent that targets a home:* marker returns its
contribution as `data.homeContributions = { imports, frontmatter,
byMarker }` per RETURN_CONTRACT.md.
- The orchestrator collects all returns and invokes the new
`scripts/merge-home.mjs` ONCE to splice contributions in.
scripts/merge-home.mjs:
- Same shape and behavior as scripts/merge-navigation.mjs:
dedupes imports/frontmatter, groups contributions per marker so
input order = render order, mirrors indentation onto snippet
lines, reports unknown markers in `skipped[]` non-fatally, atomic
write. Not idempotent at the snippet level — orchestrator must
invoke once.
Note on stores home-and-nav scope: that agent STILL writes
src/pages/index.astro directly to perform category-card href
rewrites (non-marker surgical edits). The orchestrator reads the
post-edit file before invoking merge-home.mjs, so those rewrites
are preserved. Only the home:stores featured-grid section moved
to the contribution model.
Touched files:
- scripts/merge-home.mjs (new)
- SKILL.md: Wave 6 step list adds a new `merge-home` step before
`manifest-check-pages`; `requiredPhases` adds `merge-home`;
renumbered subsequent steps; wave table row 6 mentions the
script.
- shared/RETURN_CONTRACT.md: new section "Phase 2:
homeContributions" documenting the shape with stores example.
- stores/HOME_AND_NAV.md: section 1 (home page: featured products)
rewritten — returns JSON instead of patching the marker; the
category-href rewrite section (2) is unchanged because it's a
direct edit. Return-format example updated.
- gift-cards/PAGES.md: section 3 (Patch index.astro) rewritten —
returns JSON; the disabled-pack MARKER_NOT_FOUND case now
surfaces via merge-home.mjs `skipped[]` rather than the agent
returning `status: "partial"` with a custom error code.
- verticals/gift-cards.md: remove src/pages/index.astro from
pages.gift-cards-pages.files[] — agent no longer writes it.
stores.md keeps src/pages/index.astro because that scope still
writes it for non-marker category-href rewrites.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
home:*markers insrc/pages/index.astrono longer patch the file at those markers themselves.data.homeContributions = { imports, frontmatter, byMarker }.scripts/merge-home.mjsonce to splice contributions in deterministically.Why
Two Phase 4 page agents currently patch
index.astroat distincthome:*markers:stores-pages-home-and-navhome:stores(featured products grid)gift-cards-pageshome:gift-cards(probe-gated teaser)The markers don't collide (unlike
nav:linksin PR #209), but the failure mode this PR fixes is real: the 2026-05 Moran's Bakery run hit aMARKER_NOT_FOUNDon<!-- home:gift-cards -->because the designer didn't emit it — gift-cards is adisabled: truepack and the designer was told to skip its surfaces. With orchestrator-merge, that omission becomes a structuredskipped[]output from the merge script (non-fatal, observable) rather than getting buried inside an agent return.The model also matches the sibling PR #209 (Navigation.astro) — both shared shells now use the same contribution → merge pattern, which keeps the surface area of "who can write what file" small and explicit.
Design
scripts/merge-home.mjsis structurally identical toscripts/merge-navigation.mjs:imports[]andfrontmatter[]against the designer's existing content (exact-line match after trim).skipped[](status:partial) rather than hard-failing. This is the key motivation: the missing<!-- home:gift-cards -->from the disabled gift-cards pack now surfaces here rather than failing silently inside an agent.Note on stores home-and-nav scope
That agent still writes
src/pages/index.astrodirectly for non-marker category-card href rewrites (rewriting designer-placeholder slugs against the realcategoriesV3catalog). Those edits are independent of thehome:storesmarker insertion. The orchestrator reads the post-edit file before invokingmerge-home.mjs, so the rewrites are preserved.In other words: only the marker-bound portion of each agent's home work moves to the contribution model. Non-marker surgical edits keep happening as direct writes by the owning agent.
What changed
skills/wix-headless/scripts/merge-home.mjsskills/wix-headless/SKILL.mdskills/wix-headless/references/shared/RETURN_CONTRACT.mdskills/wix-headless/references/stores/HOME_AND_NAV.mdskills/wix-headless/references/gift-cards/PAGES.mdskills/wix-headless/references/verticals/gift-cards.mdTest plan
skipped[]withMARKER_NOT_FOUND; status:partial; exit code 0 (non-fatal)---frontmatter → script exits 2Open follow-ups (not in this PR)
contributes:entries; their Phase 4 agents would adopt this contract when those flows are exercised.scripts/merge-shared-astro.mjs <file>covering both Navigation.astro and index.astro (the splicer logic is identical). Left for a future cleanup — keeping two scripts is clearer for now.Notes
🤖 Generated with Claude Code