Skip to content

feat(cli): export view notation in screenshots#2950

Merged
davydkov merged 2 commits into
mainfrom
cgk/export-legend
May 16, 2026
Merged

feat(cli): export view notation in screenshots#2950
davydkov merged 2 commits into
mainfrom
cgk/export-legend

Conversation

@ckeller42

@ckeller42 ckeller42 commented May 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add --notation to PNG/JPEG exports.
  • Render view notation beside the diagram without covering nodes.
  • Document the new CLI option.

Example

notations_example.png

Checks

  • Focused Vitest suites
  • Focused typechecks
  • likec4... build

@changeset-bot

changeset-bot Bot commented May 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 63b62ba

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

This PR includes changesets to release 22 packages
Name Type
likec4 Patch
@likec4/docs-astro Patch
likec4-vscode Patch
@likec4/playground Patch
@likec4/style-preset Patch
@likec4/styles Patch
@likec4/config Patch
@likec4/core Patch
@likec4/diagram Patch
@likec4/generators Patch
@likec4/language-server Patch
@likec4/language-services Patch
@likec4/layouts Patch
@likec4/leanix-bridge Patch
@likec4/spa Patch
@likec4/log Patch
@likec4/lsp Patch
@likec4/mcp Patch
@likec4/react Patch
@likec4/tsconfig Patch
@likec4/vite-plugin Patch
@likec4/vscode-preview 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

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds --notation and --description export flags and implements layout, route validation, CLI wiring, URL/viewport screenshot handling, SPA rendering of description/notation panels, and tests/docs to support non-overlapping view notation and optional top descriptions in PNG/JPEG exports.

Changes

Notation Export Feature

Layer / File(s) Summary
Export layout types and helpers
packages/likec4-spa/src/pages/export-layout.ts
Defines layout constants and ExportPageLayout shape; adds exportNotationHeight(), exportDescriptionHeight(), estimateWrappedLines(), and computeExportPageLayout() to compute non-overlapping diagram, optional top description, and optional right notation sidebar.
Layout calculation tests
packages/likec4-spa/src/pages/export-layout.spec.ts
Vitest tests cover padded bounds, description banner sizing/clamping, right-side notation panel placement, and export height growth when notation exceeds diagram height.
Export search param helpers & tests
packages/likec4-spa/src/pages/export-page-params.ts, packages/likec4-spa/src/pages/export-page-params.spec.ts
Adds isExportSearchFlagEnabled() and tests to normalize boolean-like search flags (true / 'true').
React ExportPage integration
packages/likec4-spa/src/pages/ExportPage.tsx
Reads notation/description search flags, derives notationEntries, computes layout via computeExportPageLayout(), sizes export container from layout, and conditionally renders ExportDescriptionPanel, ExportNotationPanel, and ExportNotationItem.
Route query parameter validation
packages/likec4-spa/src/routes/_single/export.$viewId.tsx, packages/likec4-spa/src/routes/project.$projectId/export.$viewId.tsx
Adds description and notation boolean params to validateSearch (default false) and normalizes them in stripSearchParams middleware defaults.
CLI PNG wiring & threading
packages/likec4/src/cli/export/png/handler.ts
Adds notation?: boolean and description?: boolean to PngExportArgs, threads flags into exportViewsToPNGtakeScreenshot, and registers --notation/--description on the png command.
CLI JPG wiring
packages/likec4/src/cli/export/jpg/handler.ts
Registers --notation and --description on the export jpg command and forwards them into the JPG export handler.
Screenshot URL builder & viewport resizing
packages/likec4/src/cli/export/png/takeScreenshot.ts
Adds exported createExportViewUrl() including optional notation/description params; takeScreenshot() accepts these flags, navigates to the SPA export URL, measures export-page bbox, resizes Playwright viewport if needed, and screenshots the export locator.
Screenshot URL builder tests
packages/likec4/src/cli/export/png/takeScreenshot.spec.ts
Tests createExportViewUrl() for default/explicit notation and description inclusion and preservation of existing export query params.
Documentation and changesets
.changeset/export-image-notation.md, .changeset/export-image-description.md, apps/docs/src/content/docs/tooling/cli.mdx
Adds changesets documenting --notation and --description, updates CLI docs to include JPEG export example, --quality, and --notation/--description options and shared Playwright note.

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant takeScreenshot
  participant Playwright
  participant ExportPage
  CLI->>takeScreenshot: call(viewId,padding,theme,format,notation,description)
  takeScreenshot->>takeScreenshot: createExportViewUrl()
  takeScreenshot->>Playwright: navigate(export URL)
  Playwright->>ExportPage: load (query includes notation/description)
  Playwright->>Playwright: locate export-page & measure bbox
  Playwright->>Playwright: resize viewport if bbox > viewport
  Playwright->>Playwright: exportPage.screenshot()
  Playwright-->>takeScreenshot: image buffer
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • likec4/likec4#2951: Modifies the same export description plumbing (CLI --description, URL/query handling, route flags, and layout/Render of description banner).

Suggested reviewers

  • davydkov
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(cli): export view notation in screenshots' accurately summarizes the main change: adding a --notation CLI option for PNG/JPEG exports to include view notation in exported images.
Description check ✅ Passed The PR description provides a clear summary of changes, includes an example image, and lists verification checks performed. However, it does not explicitly address the repository's contribution template checklist items (rebased, tests added, typecheck/test verification, changesets, documentation updates).
Docstring Coverage ✅ Passed Docstring coverage is 95.24% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cgk/export-legend

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (5)
packages/likec4-spa/src/pages/ExportPage.tsx (2)

284-374: 💤 Low value

Consider marking component props as readonly.

Similar to ExportNotationPanel, marking props as readonly provides compile-time safety.

🔒 Suggested readonly props
-function ExportNotationItem({ entry }: { entry: NodeNotation }) {
+function ExportNotationItem({ entry }: Readonly<{ entry: NodeNotation }>) {

Based on learnings: The SonarCloud warning aligns with React best practices for immutability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4-spa/src/pages/ExportPage.tsx` around lines 284 - 374, The
prop object for ExportNotationItem should be made readonly to enforce
immutability at compile time; update the component signature
(ExportNotationItem) so its parameter type is { readonly entry: NodeNotation }
(or define a ReadonlyProps interface and use it) and ensure any references still
use entry but do not attempt to mutate it.

240-246: 💤 Low value

Consider marking component props as readonly.

React 19 treats props as immutable at runtime, but TypeScript doesn't enforce this by default. Marking the props interface as Readonly<{...}> provides compile-time safety against accidental mutations.

🔒 Suggested readonly props
 function ExportNotationPanel({
   entries,
   layout,
-}: {
+}: Readonly<{
   entries: NodeNotation[]
   layout: NonNullable<ReturnType<typeof computeExportPageLayout>['notation']>
-}) {
+}>) {

Based on learnings: The SonarCloud warning aligns with React best practices for immutability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4-spa/src/pages/ExportPage.tsx` around lines 240 - 246, The
ExportNotationPanel component props should be marked readonly to prevent
accidental mutations: update the props type for ExportNotationPanel (the object
containing entries: NodeNotation[] and layout: NonNullable<ReturnType<typeof
computeExportPageLayout>['notation']>) to be Readonly<...> (or use a readonly
modifier on the entries and layout properties) so TypeScript enforces
immutability for entries and layout inside ExportNotationPanel.
packages/likec4-spa/src/pages/export-layout.spec.ts (1)

58-70: ⚡ Quick win

Review the assertion logic on line 69.

The assertion expect(layout.notation!.height).toBeGreaterThan(layout.diagram.height - 20 * 2 - EXPORT_NOTATION_INSET) seems to verify that notation is taller than the diagram's available content area. However, this formula doesn't clearly align with the layout calculation in computeExportPageLayout (line 57), which uses Math.max(diagram.height, notationHeight + padding * 2).

Consider simplifying the assertion to directly verify the intended behavior, such as:

expect(layout.height).toBeGreaterThan(layout.diagram.height)

This would more clearly express that the export height grew to accommodate the notation panel.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4-spa/src/pages/export-layout.spec.ts` around lines 58 - 70,
The assertion comparing layout.notation!.height to layout.diagram.height - 20 *
2 - EXPORT_NOTATION_INSET is brittle and doesn't match the Math.max logic in
computeExportPageLayout; update the test in export-layout.spec.ts to assert the
exported page height grew because notation dominated by verifying
computeExportPageLayout produced a height larger than the original diagram
height (e.g., expect(layout.height).toBeGreaterThan(layout.diagram.height))
and/or assert layout.height equals Math.max(layout.diagram.height,
exportNotationHeight(5) + padding * 2) using the same helpers
(computeExportPageLayout, exportNotationHeight, padding, EXPORT_NOTATION_INSET)
so the test directly reflects the function's intended behavior.
packages/likec4-spa/src/pages/export-layout.ts (1)

59-69: ⚡ Quick win

Verify the width calculation includes correct padding.

On line 60, the total width adds padding once at the end. This suggests padding is only applied to the right side of the notation panel. Ensure this matches the intended layout—typically, you'd want symmetric padding on both sides, or clarify if the diagram already includes left padding.

Looking at line 43, diagram.width already includes padding * 2, so the notation side needs only one additional padding on its right edge. This appears correct, but consider adding a comment to clarify the padding distribution.

💡 Suggested comment for clarity
   return {
+    // Total width: diagram (with 2x padding) + gap + notation width + right padding
     width: diagram.width + EXPORT_NOTATION_GAP + EXPORT_NOTATION_WIDTH + padding,
     height,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4-spa/src/pages/export-layout.ts` around lines 59 - 69, The
width calculation currently returns width: diagram.width + EXPORT_NOTATION_GAP +
EXPORT_NOTATION_WIDTH + padding and is correct because diagram.width already
includes padding * 2; add a short clarifying comment next to this return (or
above the calculation) explaining that diagram.width contains both left and
right padding and the extra padding added here is only the right-side padding
for the notation panel—reference the symbols diagram.width, EXPORT_NOTATION_GAP,
EXPORT_NOTATION_WIDTH, padding and notation.left to make the intent clear.
packages/likec4/src/cli/export/png/takeScreenshot.ts (1)

33-55: ⚡ Quick win

Add JSDoc for the exported function.

The createExportViewUrl function is exported and used by other modules, but lacks documentation. Consider adding a JSDoc comment describing its purpose and parameters.

📝 Suggested JSDoc
+/**
+ * Constructs the export page URL with query parameters for padding, theme, and optional notation/format.
+ * `@param` params - Configuration object with viewId, padding, theme, and optional export settings
+ * `@returns` Formatted URL path with encoded viewId and query string
+ */
 export function createExportViewUrl({

As per coding guidelines: Use JSDoc to document public classes and methods.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4/src/cli/export/png/takeScreenshot.ts` around lines 33 - 55,
Add a JSDoc block above the exported createExportViewUrl function that briefly
describes its purpose (builds an export URL for a view with padding, theme,
optional dynamicVariant, format, and notation), documents each parameter
(viewId, padding, theme, dynamicVariant, format with default 'png', notation
boolean) including accepted values/types, and documents the return value (string
URL). Reference the behavior that it encodes viewId and includes query keys
padding, theme, dynamic, notation, and format so callers understand what query
params are produced.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/likec4-spa/src/pages/export-layout.spec.ts`:
- Around line 58-70: The assertion comparing layout.notation!.height to
layout.diagram.height - 20 * 2 - EXPORT_NOTATION_INSET is brittle and doesn't
match the Math.max logic in computeExportPageLayout; update the test in
export-layout.spec.ts to assert the exported page height grew because notation
dominated by verifying computeExportPageLayout produced a height larger than the
original diagram height (e.g.,
expect(layout.height).toBeGreaterThan(layout.diagram.height)) and/or assert
layout.height equals Math.max(layout.diagram.height, exportNotationHeight(5) +
padding * 2) using the same helpers (computeExportPageLayout,
exportNotationHeight, padding, EXPORT_NOTATION_INSET) so the test directly
reflects the function's intended behavior.

In `@packages/likec4-spa/src/pages/export-layout.ts`:
- Around line 59-69: The width calculation currently returns width:
diagram.width + EXPORT_NOTATION_GAP + EXPORT_NOTATION_WIDTH + padding and is
correct because diagram.width already includes padding * 2; add a short
clarifying comment next to this return (or above the calculation) explaining
that diagram.width contains both left and right padding and the extra padding
added here is only the right-side padding for the notation panel—reference the
symbols diagram.width, EXPORT_NOTATION_GAP, EXPORT_NOTATION_WIDTH, padding and
notation.left to make the intent clear.

In `@packages/likec4-spa/src/pages/ExportPage.tsx`:
- Around line 284-374: The prop object for ExportNotationItem should be made
readonly to enforce immutability at compile time; update the component signature
(ExportNotationItem) so its parameter type is { readonly entry: NodeNotation }
(or define a ReadonlyProps interface and use it) and ensure any references still
use entry but do not attempt to mutate it.
- Around line 240-246: The ExportNotationPanel component props should be marked
readonly to prevent accidental mutations: update the props type for
ExportNotationPanel (the object containing entries: NodeNotation[] and layout:
NonNullable<ReturnType<typeof computeExportPageLayout>['notation']>) to be
Readonly<...> (or use a readonly modifier on the entries and layout properties)
so TypeScript enforces immutability for entries and layout inside
ExportNotationPanel.

In `@packages/likec4/src/cli/export/png/takeScreenshot.ts`:
- Around line 33-55: Add a JSDoc block above the exported createExportViewUrl
function that briefly describes its purpose (builds an export URL for a view
with padding, theme, optional dynamicVariant, format, and notation), documents
each parameter (viewId, padding, theme, dynamicVariant, format with default
'png', notation boolean) including accepted values/types, and documents the
return value (string URL). Reference the behavior that it encodes viewId and
includes query keys padding, theme, dynamic, notation, and format so callers
understand what query params are produced.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88f66ac6-b921-4645-8e1e-4bff741ea40e

📥 Commits

Reviewing files that changed from the base of the PR and between 87aabdb and f053497.

📒 Files selected for processing (11)
  • .changeset/export-image-notation.md
  • apps/docs/src/content/docs/tooling/cli.mdx
  • packages/likec4-spa/src/pages/ExportPage.tsx
  • packages/likec4-spa/src/pages/export-layout.spec.ts
  • packages/likec4-spa/src/pages/export-layout.ts
  • packages/likec4-spa/src/routes/_single/export.$viewId.tsx
  • packages/likec4-spa/src/routes/project.$projectId/export.$viewId.tsx
  • packages/likec4/src/cli/export/jpg/handler.ts
  • packages/likec4/src/cli/export/png/handler.ts
  • packages/likec4/src/cli/export/png/takeScreenshot.spec.ts
  • packages/likec4/src/cli/export/png/takeScreenshot.ts

@ckeller42 ckeller42 force-pushed the cgk/export-legend branch from f053497 to afeca8c Compare May 11, 2026 14:46
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread packages/likec4-spa/src/pages/export-layout.spec.ts Fixed
@ckeller42 ckeller42 force-pushed the cgk/export-legend branch from afeca8c to c27bee3 Compare May 11, 2026 14:51
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/likec4-spa/src/pages/ExportPage.tsx (1)

287-293: ⚡ Quick win

Remove the as CSSProperties cast and use explicit type instead.

The cast on line 292 violates the coding guideline to avoid as casts. Replace it with an explicit PaletteCssVars type that properly documents the expected CSS custom properties:

Proposed fix
+type PaletteCssVars = CSSProperties & Record<
+  '--likec4-palette-fill' | '--likec4-palette-stroke' | '--likec4-palette-hiContrast' | '--likec4-palette-loContrast',
+  string
+>
+
 function ExportNotationItem({ entry }: Readonly<{ entry: NodeNotation }>) {
   const styles = useLikeC4Styles()
   const elementColors = styles.colors(entry.color).elements
-  const colorVars = {
+  const colorVars: PaletteCssVars = {
     '--likec4-palette-fill': elementColors.fill,
     '--likec4-palette-stroke': elementColors.stroke,
     '--likec4-palette-hiContrast': elementColors.hiContrast,
     '--likec4-palette-loContrast': elementColors.loContrast,
-  } as CSSProperties
+  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4-spa/src/pages/ExportPage.tsx` around lines 287 - 293, Replace
the inline "as CSSProperties" cast on colorVars with a proper explicit type:
define or import a PaletteCssVars interface/type that maps the CSS custom
property names ('--likec4-palette-fill', '--likec4-palette-stroke',
'--likec4-palette-hiContrast', '--likec4-palette-loContrast') to string (or
string | undefined if needed) and declare colorVars with that type (e.g., const
colorVars: PaletteCssVars = { ... }), using
elementColors.fill/stroke/hiContrast/loContrast for values so the cast is
removed and the expected shape is documented.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/likec4-spa/src/pages/ExportPage.tsx`:
- Around line 287-293: Replace the inline "as CSSProperties" cast on colorVars
with a proper explicit type: define or import a PaletteCssVars interface/type
that maps the CSS custom property names ('--likec4-palette-fill',
'--likec4-palette-stroke', '--likec4-palette-hiContrast',
'--likec4-palette-loContrast') to string (or string | undefined if needed) and
declare colorVars with that type (e.g., const colorVars: PaletteCssVars = { ...
}), using elementColors.fill/stroke/hiContrast/loContrast for values so the cast
is removed and the expected shape is documented.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b7f0bac-3653-4c39-978d-882e206e1c97

📥 Commits

Reviewing files that changed from the base of the PR and between f053497 and c27bee3.

📒 Files selected for processing (11)
  • .changeset/export-image-notation.md
  • apps/docs/src/content/docs/tooling/cli.mdx
  • packages/likec4-spa/src/pages/ExportPage.tsx
  • packages/likec4-spa/src/pages/export-layout.spec.ts
  • packages/likec4-spa/src/pages/export-layout.ts
  • packages/likec4-spa/src/routes/_single/export.$viewId.tsx
  • packages/likec4-spa/src/routes/project.$projectId/export.$viewId.tsx
  • packages/likec4/src/cli/export/jpg/handler.ts
  • packages/likec4/src/cli/export/png/handler.ts
  • packages/likec4/src/cli/export/png/takeScreenshot.spec.ts
  • packages/likec4/src/cli/export/png/takeScreenshot.ts
✅ Files skipped from review due to trivial changes (3)
  • .changeset/export-image-notation.md
  • packages/likec4/src/cli/export/png/takeScreenshot.spec.ts
  • apps/docs/src/content/docs/tooling/cli.mdx
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/likec4-spa/src/pages/export-layout.ts
  • packages/likec4-spa/src/pages/export-layout.spec.ts
  • packages/likec4/src/cli/export/png/handler.ts
  • packages/likec4/src/cli/export/png/takeScreenshot.ts

@ckeller42 ckeller42 force-pushed the cgk/export-legend branch from c27bee3 to 389d304 Compare May 11, 2026 14:59
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/likec4-spa/src/pages/ExportPage.tsx (1)

247-289: 💤 Low value

Consider simplifying the key prop.

The key ${entry.title}-${index} works but might not be unique if entries share titles. Since this is a static render of a readonly array, using just the index would be simpler and sufficient.

-        {entries.map((entry, index) => <ExportNotationItem key={`${entry.title}-${index}`} entry={entry} />)}
+        {entries.map((entry, index) => <ExportNotationItem key={index} entry={entry} />)}

This is a minor point; the current implementation is functional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4-spa/src/pages/ExportPage.tsx` around lines 247 - 289, In
ExportNotationPanel, simplify the list key used in entries.map by using the map
index as the key instead of the interpolated `${entry.title}-${index}`; update
the call that renders ExportNotationItem (the entries.map callback) to pass
key={index} since the array is a static readonly render and index is sufficient,
which removes reliance on potentially non-unique titles.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/likec4-spa/src/pages/ExportPage.tsx`:
- Around line 247-289: In ExportNotationPanel, simplify the list key used in
entries.map by using the map index as the key instead of the interpolated
`${entry.title}-${index}`; update the call that renders ExportNotationItem (the
entries.map callback) to pass key={index} since the array is a static readonly
render and index is sufficient, which removes reliance on potentially non-unique
titles.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3bf8610-2ed2-42de-84d6-02a2ebe6e6fc

📥 Commits

Reviewing files that changed from the base of the PR and between 87aabdb and 389d304.

📒 Files selected for processing (11)
  • .changeset/export-image-notation.md
  • apps/docs/src/content/docs/tooling/cli.mdx
  • packages/likec4-spa/src/pages/ExportPage.tsx
  • packages/likec4-spa/src/pages/export-layout.spec.ts
  • packages/likec4-spa/src/pages/export-layout.ts
  • packages/likec4-spa/src/routes/_single/export.$viewId.tsx
  • packages/likec4-spa/src/routes/project.$projectId/export.$viewId.tsx
  • packages/likec4/src/cli/export/jpg/handler.ts
  • packages/likec4/src/cli/export/png/handler.ts
  • packages/likec4/src/cli/export/png/takeScreenshot.spec.ts
  • packages/likec4/src/cli/export/png/takeScreenshot.ts

@ckeller42

Copy link
Copy Markdown
Collaborator Author

CodeRabbit nitpick on the notation item key: keeping key={${entry.title}-${index}} as-is. It already includes the index, so duplicate titles do not collide, and changing it to key={index} would not improve uniqueness or behavior for this static export render. No code change needed.

@ckeller42 ckeller42 requested a review from davydkov May 11, 2026 15:39
@ckeller42 ckeller42 marked this pull request as ready for review May 11, 2026 15:39
@davydkov davydkov enabled auto-merge (squash) May 16, 2026 11:15
@davydkov davydkov merged commit dcbf674 into main May 16, 2026
17 of 18 checks passed
@davydkov davydkov deleted the cgk/export-legend branch May 16, 2026 11:18
@likec4-ci likec4-ci Bot mentioned this pull request May 16, 2026
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