Skip to content

fix(vite): remove server.fs.allow override in dev config#24

Merged
sraphaz merged 2 commits intomainfrom
feat/drawio-export
Feb 14, 2026
Merged

fix(vite): remove server.fs.allow override in dev config#24
sraphaz merged 2 commits intomainfrom
feat/drawio-export

Conversation

@sraphaz
Copy link
Copy Markdown
Owner

@sraphaz sraphaz commented Feb 14, 2026

Summary

This PR adds DrawIO (draw.io) export to LikeC4: export views to .drawio XML (single or multi-file), with optional round-trip options (layout, stroke colors/widths, edge waypoints), CLI command, and Playground context menu integration. It also includes a cleanup pass: removal of build artifacts that were accidentally committed, and addressing CodeRabbit review (actionable fixes + nitpicks).


Features

Export to DrawIO

  • @likec4/generators: generateDrawio, generateDrawioMulti produce draw.io-compatible XML; optional GenerateDrawioOptions for layout override, stroke colors/widths per node, edge waypoints, and round-trip comment blocks in source.
  • Round-trip: Export can embed // likec4.layout.viewId, // likec4.strokeColor, // likec4.strokeWidth, // likec4.edge.waypoints in .c4 source; parseDrawioRoundtripComments reads them for re-export after editing in draw.io.
  • CLI: likec4 export drawio <path> -o <outdir> with options --all-in-one, --roundtrip, --uncompressed, --project, --use-dot.
  • Playground: Right-click on diagram canvas → “Export to DrawIO” (current view) or “Export all” (all views). Optional getSourceContent for round-trip when used outside the provider.

Tests & E2E

  • Unit: generate-drawio.spec.ts, drawio-demo-export-import.spec.ts (cloud-system demo, element/edge counts, loadable XML). Timeouts increased for fromWorkspace/layoutedModel tests.
  • E2E: Playwright tests for DrawIO context menu in Playground (pnpm test:playground from e2e/).

Cleanup & CodeRabbit fixes

Build artifacts removal

  • Removed ~1555 compiled .js/.d.ts and PR temp docs that had been added in a previous commit (git add -A). All were verified to match strict criteria (only artifacts).
  • .gitignore updated: *.spec.js, *.test.js, apps/playground/src/**/*.js, packages/*/src/**/*.js, .cursor/, and comments on scope.

Actionable (CodeRabbit)

  • packages/config filenames: isLikeC4Config / isLikeC4NonJsonConfig return boolean instead of type predicates (they only check basename; narrowing full path was unsound).
  • .cursor/: Directory gitignored; git-push-remotes.mdc removed from tracking. AGENTS.md notes that contributors may use .cursor/rules/ locally and should not commit it.
  • pako: pako and @types/pako added to pnpm workspace catalog; packages/generators uses catalog:.
  • parse-drawio: In computeContainerTitles, title cells are created with parent="${containerId}" by the generator; parse logic now uses v.parent === cont.id instead of v.parent === cont.parent. Self-closing tag detection uses full trimmed open tag. TODO added for round-trip comment parser deduplication.
  • logger: ViteLogger type now omits both debug and hasErrorLogged so they are optional for Vite.
  • ci-validate-in-docker: NODE_ENV=production moved to after pnpm install so devDependencies are installed; Corepack pnpm set to 10.29.3 (match .tool-versions); comment added for version sync.
  • vitest: Root config merges configDefaults.exclude with custom patterns so default exclusions are preserved.

Nitpicks

  • Scripts: ci-validate-in-docker.ps1 uses Write-Output instead of Write-Host.
  • documentation-provider: Null guards for parseDeploymentNode and parseDeployedInstance (aligned with parseElement).
  • JSDoc: HoverProvider (class + constructor), browser startLanguageServer, drawio handler (sequential export comment).
  • Playground: useDrawioContextMenuActions — pass onExportError directly; comment on stabilizing viewStates for useMemo. Monaco: pass setLayoutedModelApi directly. LanguageClientSync: logger.warn in catch blocks for layouted model / layout view failures.
  • generate-drawio: Removed duplicate html=1; at end of vertex style; comments for getDefaultStrokeWidth and node sort. generate-drawio.spec: Comment on duplication with drawio-test-utils; mockViewModel as plain function (no vi.fn). e2e: Removed redundant $.nothrow = false; simplified assertion message (dead branch). .gitignore: Comments on glob scope and personal workflow files.

Changesets

  • drawio-related changesets are in .changeset/ (e.g. drawio-cli-roundtrip-e2e, drawio-roundtrip-options, drawio-import-postpack).

Checklist

  • Build and typecheck pass
  • Tests updated/added (unit + e2e)
  • CodeRabbit actionable and nitpick comments addressed
  • No build artifacts or personal config committed

Summary by CodeRabbit

  • Chores

    • Dev server now relies on default filesystem access behavior.
  • New Features / Improvements

    • “Export all views” is enabled in more cases.
    • Per-view export now creates output folders and follows symlinked source files.
  • Bug Fixes

    • Improved container title handling and detection to produce more consistent DrawIO output.
    • Layout parsing made local-coordinate checks more accurate.
  • Tests / Types

    • Minor type and test updates and clarifying comments.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

Multiple focused changes across Draw.io export/import, CLI export handling, generator defaults, parsing logic, playground UI/type imports, a Vite config tweak, and tests. Key functional edits include safer generator defaults, container-local title detection, symlink-aware workspace reading and per-view output directory creation, plus minor type/comment updates.

Changes

Cohort / File(s) Summary
Vite dev config
packages/likec4/src/vite/vite-dev.ts
Removed explicit empty fs.allow entry from Vite dev server config; no other server options changed.
CLI export handler
packages/likec4/src/cli/export/drawio/handler.ts
Add symlink handling when reading workspace sources (stat target, read if valid source); ensure parent directories exist before writing per-view exports; normalize view ID to String(...); change empty-views log from warning to error.
Draw.io generator defaults
packages/generators/src/drawio/generate-drawio.ts
Replace non-null assertions with safe defaults for container title fields (title, titleCellId, font size, color); add ExtendedNode type note.
Draw.io parser coordinate logic
packages/generators/src/drawio/parse-drawio.ts
Switch container title bounds checks from absolute sheet coords to container-local coordinates (0..cw, 0..titleAreaHeight); remove cx/cy usage and clarify container-local space.
Playground UI / types
apps/playground/src/components/drawio/useDrawioContextMenuActions.ts, apps/playground/src/monaco/LanguageClientSync.tsx
Change an import to be type-only; broaden canExportAllViews condition to include layoutViews; add a comment on logging failed view layout and omitted failures.
Tests / types update
packages/likec4/src/drawio-demo-export-import.spec.ts, e2e/src/likec4-cli-export-drawio.spec.ts
Simplify test viewmodel typing to Array<DrawioViewModelLike>; update a test comment about accepted exit codes (no behavioral change).

Sequence Diagram(s)

mermaid
sequenceDiagram
autonumber
participant CLI as CLI export command
participant FS as Filesystem
participant Reader as readWorkspaceSourceContent
participant Generator as DrawIO generator
participant Disk as Output writer
CLI->>Reader: request workspace traversal
Reader->>FS: lstat entry / detect symlink
alt entry is symlink
Reader->>FS: stat symlink target
FS-->>Reader: target is file (or not)
alt target is source file
Reader->>FS: read target contents
Reader-->>Generator: provide file chunk
else not source
Reader-->>CLI: skip
end
else not symlink
Reader->>FS: read file contents
Reader-->>Generator: provide file chunk
end
Generator->>Generator: generate per-view DrawIO XML
Generator->>FS: ensure parent directory exists
Generator->>Disk: write output file

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped through code and night,
Found symlinks hiding out of sight,
I read their tails and made a way,
Wrote views to folders, safe by day,
A tiny carrot of a fix — hooray! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title accurately reflects a subset of changes (Vite dev server config) but the PR scope is substantially broader—adding DrawIO export features, tests, cleanup, and multiple fixes across numerous files. Update title to reflect the primary feature: something like 'feat: add DrawIO export support with CLI, Playground integration, and cleanup' or adjust scope to match title.
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (8 files):

⚔️ apps/playground/src/components/drawio/useDrawioContextMenuActions.ts (content)
⚔️ apps/playground/src/monaco/LanguageClientSync.tsx (content)
⚔️ e2e/src/likec4-cli-export-drawio.spec.ts (content)
⚔️ packages/generators/src/drawio/generate-drawio.ts (content)
⚔️ packages/generators/src/drawio/parse-drawio.ts (content)
⚔️ packages/likec4/src/cli/export/drawio/handler.ts (content)
⚔️ packages/likec4/src/drawio-demo-export-import.spec.ts (content)
⚔️ packages/likec4/src/vite/vite-dev.ts (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is comprehensive and well-structured with clear sections covering features, cleanup, fixes, tests, changesets, and a completed checklist matching the template requirements.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/drawio-export
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feat/drawio-export
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


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

…ler symlinks+mkdir, parse-drawio container-local coords, nitpicks

Co-authored-by: Cursor <[email protected]>
@sraphaz sraphaz changed the title feat: DrawIO export (CLI, Playground, round-trip) fix(vite): remove server.fs.allow override in dev config Feb 14, 2026
@sraphaz sraphaz merged commit d82b153 into main Feb 14, 2026
37 of 46 checks passed
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.

1 participant