Skip to content

fix(generators): preserved element title in likec4 DSL output#2825

Merged
davydkov merged 3 commits into
likec4:mainfrom
kavishkartha05:fix/generator-missing-element-name
Apr 1, 2026
Merged

fix(generators): preserved element title in likec4 DSL output#2825
davydkov merged 3 commits into
likec4:mainfrom
kavishkartha05:fix/generator-missing-element-name

Conversation

@kavishkartha05

@kavishkartha05 kavishkartha05 commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • [✓ ] I've thoroughly read the latest contribution guidelines.
  • [ ✓] I've rebased my branch onto main before creating this PR.
  • [ ✓] My commit messages follow conventional spec
  • [ ✓] I've added tests to cover my changes (if applicable).
  • [ ✓] I've verified that all new and existing tests have passed locally for mobile, tablet, and desktop screen sizes.
  • My change requires documentation updates.
  • I've updated the documentation accordingly.

Fixes #2815. Removes title from the normalization strip list in likec4data.ts so that an element's display name is always preserved for inline DSL rendering. Added a test case covering the scenario where the element title matches the spec default.

@changeset-bot

changeset-bot Bot commented Apr 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b6f6a35

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

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

@coderabbitai

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e992f7be-6b17-4aff-97bf-13b059844f1a

📥 Commits

Reviewing files that changed from the base of the PR and between 20a2cde and b6f6a35.

📒 Files selected for processing (1)
  • .changeset/fix-generator-element-name.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/fix-generator-element-name.md

📝 Walkthrough

Walkthrough

Preserves element titles in LikeC4 generator output by excluding title from element normalization. Adds a Vitest test asserting a system element is rendered with its concrete name and triple-quoted description. A changeset for a patch release was added.

Changes

Cohort / File(s) Summary
Test Coverage
packages/generators/src/likec4/operators/model.spec.ts
Added a Vitest test that builds a system('new-test-system', ...) element and asserts the rendered output includes the element name and the triple-quoted description block.
Element Normalization
packages/generators/src/likec4/schemas/likec4data.ts
Updated normalizeElementStyles to stop treating title as a removable field when it deep-equals the spec default, ensuring title is preserved in generated output.
Release Notes
.changeset/fix-generator-element-name.md
Added a changeset marking a patch release documenting the fix that restores element names in generator output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main fix: preserving element title in likec4 DSL output, directly matching the changeset and code modifications.
Description check ✅ Passed The PR description covers the key change, references the fixed issue #2815, and confirms all checklist items are properly addressed with tests added.
Linked Issues check ✅ Passed The code changes fully address issue #2815 by removing title from normalization strip list and adding a test verifying element names are preserved in DSL output.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the missing element name issue: test addition, normalization logic fix, and changeset documentation are all in-scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@davydkov davydkov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @kavishkartha05 Thank you much for the fix!
Do you mind to add changeset file (like this)? Then auto-generated release notes will mention you correctly

@kavishkartha05

Copy link
Copy Markdown
Contributor Author

@davydkov added!

@davydkov davydkov merged commit 3190615 into likec4:main Apr 1, 2026
9 checks passed
@likec4-ci likec4-ci Bot mentioned this pull request Apr 1, 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.

LikeC4 generator doesn't add element name

2 participants