-
Notifications
You must be signed in to change notification settings - Fork 0
Capability map, domain bundles, page metadata, deterministic validation, first CI workflow #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b6af174
Capability map: source, generator, JSON route, readable page, domain …
next-devin a7ace15
Deterministic validation: regenerate before validate-links, all headi…
next-devin d0970bb
Page metadata: descriptions on 60 authored pages, capability_ids deri…
next-devin 55f1096
Reciprocal merchant links on developer pages, live surface checks
next-devin 339676e
Review fixes: dedupe merchant links, escape bundle text in llms.txt, …
next-devin d9434c7
Keep file line endings when writing capability_ids; reject impossible…
next-devin 0843dea
check-frontmatter: detect line ending from the frontmatter block, not…
next-devin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: CI | ||
|
|
||
| # The same sequence a clean checkout runs locally: | ||
| # npm ci -> npm run build (generates references, stats, capability map, previews, | ||
| # then next build) -> npm run check (post-build agent-surface assertions, | ||
| # frontmatter, link validation against the generated tree). | ||
| # `validate-links` alone regenerates first; here the build already did. | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| push: | ||
| branches: [main] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| build-and-validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | ||
|
|
||
| - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 | ||
| with: | ||
| node-version: '22' | ||
| cache: npm | ||
|
|
||
| - run: npm ci | ||
|
|
||
| - run: npm run build | ||
|
|
||
| - run: npm run check | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: Live agent surfaces | ||
|
|
||
| # Checks the deployed sites, not the branch: sitemap, robots, llms.txt links, | ||
| # capability map, bundles, 404 recovery, search index budget, and the | ||
| # deterministic half of the prospect-agent smoke set. Runs on a schedule and | ||
| # by hand; a failure here means production drifted, not that a PR is wrong. | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '17 3 * * 1' # Mondays 03:17 UTC | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| live: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | ||
|
|
||
| - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 | ||
| with: | ||
| node-version: '22' | ||
|
|
||
| - run: node scripts/check-live-surfaces.mjs |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { capabilityMap } from '@/lib/capabilities'; | ||
|
|
||
| export const revalidate = false; | ||
|
|
||
| /** | ||
| * The platform capability map, generated at build time by | ||
| * scripts/generate-capability-map.mjs from content/capabilities.yaml. | ||
| * Stable URL: https://developers.nextcommerce.com/capabilities.json | ||
| */ | ||
| export function GET() { | ||
| return new Response(JSON.stringify(capabilityMap, null, 2) + '\n', { | ||
| headers: { 'Content-Type': 'application/json; charset=utf-8' }, | ||
| }); | ||
| } |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { bundleResponse } from '@/lib/bundles'; | ||
|
|
||
| export const revalidate = false; | ||
|
|
||
| export const GET = bundleResponse('admin-api'); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { bundleResponse } from '@/lib/bundles'; | ||
|
|
||
| export const revalidate = false; | ||
|
|
||
| export const GET = bundleResponse('apps-webhooks'); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { bundleResponse } from '@/lib/bundles'; | ||
|
|
||
| export const revalidate = false; | ||
|
|
||
| export const GET = bundleResponse('campaigns'); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { bundleResponse } from '@/lib/bundles'; | ||
|
|
||
| export const revalidate = false; | ||
|
|
||
| export const GET = bundleResponse('payments'); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { bundleResponse } from '@/lib/bundles'; | ||
|
|
||
| export const revalidate = false; | ||
|
|
||
| export const GET = bundleResponse('platform'); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { bundleResponse } from '@/lib/bundles'; | ||
|
|
||
| export const revalidate = false; | ||
|
|
||
| export const GET = bundleResponse('storefront'); |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import { capabilitiesForPage, getCapability, MERCHANT_SITE, type Capability } from '@/lib/capabilities'; | ||
|
|
||
| /** | ||
| * Reciprocal links from a developer page back to the merchant guides for the | ||
| * same capability. Driven entirely by the capability map: a page is linked when | ||
| * the map's developer_docs cite it or its frontmatter declares capability_ids. | ||
| */ | ||
| export function CapabilityLinks({ pageUrl, declaredIds }: { pageUrl: string; declaredIds?: string[] }) { | ||
| const byId = new Map<string, Capability>(); | ||
| for (const c of capabilitiesForPage(pageUrl)) byId.set(c.id, c); | ||
| for (const id of declaredIds ?? []) { | ||
| const c = getCapability(id); | ||
| if (c) byId.set(c.id, c); | ||
| } | ||
| const capabilities = [...byId.values()]; | ||
| if (capabilities.length === 0) return null; | ||
|
|
||
| // Several capabilities on one page can cite the same merchant guide; list it once. | ||
| const merchantLinks = [...new Set(capabilities.flatMap((c) => c.operator_docs))].map((url) => ({ url })); | ||
|
|
||
| return ( | ||
| <aside | ||
| aria-label="Related merchant guides" | ||
| className="mt-10 rounded-lg border bg-fd-card p-4 text-sm text-fd-card-foreground" | ||
| > | ||
| <p className="font-medium"> | ||
| Capabilit{capabilities.length === 1 ? 'y' : 'ies'}:{' '} | ||
| {capabilities.map((c, i) => ( | ||
| <span key={c.id}> | ||
| {i > 0 && ', '} | ||
| <a href={`/docs/capabilities#${c.id}`} className="underline underline-offset-4"> | ||
| {c.title} | ||
| </a> | ||
| </span> | ||
| ))} | ||
| </p> | ||
| {merchantLinks.length > 0 && ( | ||
| <> | ||
| <p className="mt-2 text-fd-muted-foreground"> | ||
| Merchant and operator guides for the same capability on docs.nextcommerce.com: | ||
| </p> | ||
| <ul className="mt-1 list-disc pl-5"> | ||
| {merchantLinks.map(({ url }) => ( | ||
| <li key={url}> | ||
| <a href={url} className="underline underline-offset-4"> | ||
| {url.replace(MERCHANT_SITE, '')} | ||
| </a> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| </> | ||
| )} | ||
| </aside> | ||
| ); | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.