Skip to content

[create-content-sdk-app] document auto-generated component maps in agent guides#523

Open
sc-naveenhedallaarachchi wants to merge 6 commits into
devfrom
fix/JSS-9678
Open

[create-content-sdk-app] document auto-generated component maps in agent guides#523
sc-naveenhedallaarachchi wants to merge 6 commits into
devfrom
fix/JSS-9678

Conversation

@sc-naveenhedallaarachchi

Copy link
Copy Markdown
Contributor

Description / Motivation

Template agent docs still described manually editing component maps. All three Next.js templates already generate maps during npm run dev and npm run build via sitecore-tools:generate-map.

This PR updates AGENTS.md, Skills.md, and related component skills in nextjs, nextjs-app-router, and nextjs-app-router-cache-components to reflect that workflow.

Testing Details

Documentation-only change. Reviewed for consistency across templates.

  • Unit Test Added
  • Manual Test/Other (Please elaborate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7352c53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-content-sdk-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

📦 Package Size and Test Coverage Report

Package Base Size PR Size Δ Change Base Coverage PR Coverage Δ Change
analytics-core 67.34 KB 67.34 KB ✅ 0.00 KB 97.40% 97.40% 0.00%
cli 61.06 KB 61.06 KB ✅ 0.00 KB 71.36% 71.36% 0.00%
content 432.99 KB 432.99 KB ✅ 0.00 KB 92.46% 92.46% 0.00%
core 120.61 KB 120.61 KB ✅ 0.00 KB 91.27% 91.27% 0.00%
create-content-sdk-app 535.58 KB 539.78 KB 🔺 +4.20 KB 96.47% 96.47% 0.00%
events 72.27 KB 72.27 KB ✅ 0.00 KB 97.97% 97.97% 0.00%
nextjs 566.30 KB 566.30 KB ✅ 0.00 KB 90.99% 90.99% 0.00%
personalize 64.01 KB 64.01 KB ✅ 0.00 KB 99.74% 99.74% 0.00%
react 232.23 KB 232.23 KB ✅ 0.00 KB 94.00% 94.00% 0.00%
search 8.10 KB 8.10 KB ✅ 0.00 KB 98.57% 98.57% 0.00%
Total 🔺 +4.20 KB

@sc-naveenhedallaarachchi sc-naveenhedallaarachchi changed the title document auto-generated component maps in agent guides [create-content-sdk-app] document auto-generated component maps in agent guides Jun 18, 2026
- Prefer `sitecore-tools:generate-map` to regenerate `.sitecore/component-map.ts` instead of hand-editing it. Only manually register the component if the generator cannot handle the change.
- Define a props interface with the component's fields (e.g. `fields: { title: Field; ... }`) and any params. Use types from `@sitecore-content-sdk/react` or the app's types.
- Export a single default component; one component per file unless the app pattern differs.
- After creating the component file, register it in `.sitecore/component-map.ts` (see content-sdk-component-registration). Do not leave the component unregistered. Pages Router has a single map used by getComponentData and editing API routes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line directly contradicts the new guidance added a few lines above: "Prefer sitecore-tools:generate-map... Only manually register the component if the generator cannot handle the change."

An agent reading this file will get "don't hand-edit" and "you must register it, don't leave it unregistered" in the same Hard Rules block - I think this is the exact failure reported in the issue.

I would suggest rewording to something like: "Ensure the component map regenerates (or update it manually only if the generator can't handle the case) before considering the task complete."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

## Hard Rules

- Place components under `src/components/`. Use existing folder conventions.
- Prefer `sitecore-tools:generate-map` to regenerate the component maps instead of hand-editing them. Only manually register the component if the generator cannot handle the change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new rule conflicts with line 30 just below
("After creating the component file, register it in the correct component map ... Do not leave the component unregistered."). The contradiction is the same as in the Pages Router template: "prefer the generator, only hand-edit if it can't handle it" vs. "you must manually register it, don't leave it unregistered." Please reconcile line 30.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

## Hard Rules

- Place components under `src/components/`. Use existing folder conventions.
- Prefer `sitecore-tools:generate-map` to regenerate the component maps instead of hand-editing them. Only manually register the component if the generator cannot handle the change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as the other two templates: this new rule conflicts with line 31 just below ("After creating the component file, register it in the correct component map ... Do not leave the component unregistered.")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

### Component map and layout

- **Component map:** `.sitecore/component-map.ts` — register all Sitecore components. Keep in sync with components under `src/components/`.
- **Component map:** `.sitecore/component-map.ts` — register all Sitecore components. Is auto-generated from `src/components/`. Do not edit manually unless needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's improve a bit:
register all Sitecore components. Is auto-generated from -> Lists every Sitecore component the layout can render, the map is auto-generated from

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread .changeset/forty-lions-hug.md Outdated
@@ -0,0 +1,5 @@
---
'create-content-sdk-app': minor

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set a patch release, since it doesn't really bring any features to the create-content-sdk-app CLI, usually if we have some internal changes in templates we just mark it as patch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

### More (component map, editing, env)

- **Component map:** `.sitecore/component-map.ts` — register every Sitecore component here; keep in sync with `src/components/`. Used by `getComponentData` and by the editing API routes.
- **Component map:** `.sitecore/component-map.ts` — register every Sitecore component here; Is auto-generated from `src/components/`. Do not edit manually unless needed. Used by `getComponentData` and by the editing API routes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's improve a bit:
register all Sitecore components. Is auto-generated from -> Lists every Sitecore component the layout can render, the map is auto-generated from

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

### Component maps and layout

- **Server/client components:** `.sitecore/component-map.ts` (Server); `.sitecore/component-map.client.ts` (Client). Register all Sitecore components; keep in sync with `src/components/`.
- **Server/client components:** `.sitecore/component-map.ts` (Server) and `.sitecore/component-map.client.ts` (Client) — register all Sitecore components. Are auto-generated from `src/components/`. Do not edit manually unless needed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update all the similar occurrences?

Suggested change
- **Server/client components:** `.sitecore/component-map.ts` (Server) and `.sitecore/component-map.client.ts` (Client) — register all Sitecore components. Are auto-generated from `src/components/`. Do not edit manually unless needed.
- **Server/client components:** `.sitecore/component-map.ts` (Server) and `.sitecore/component-map.client.ts` (Client) — Lists every Sitecore component the layout can render, the map is auto-generated from `src/components/`. Do not edit manually unless needed.

@sc-naveenhedallaarachchi sc-naveenhedallaarachchi Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, updated all occurrences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants