likec4-cli-codegen-regression

Tests LikeC4 CLI code generators to keep all emitted files inside the output directory.

5.6k|377|Updated Mar 24, 2023
One-click install
npx skills add https://github.com/likec4/likec4 --skill likec4-cli-codegen-regression
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: likec4-cli-codegen-regression
Source: https://github.com/likec4/likec4/tree/main/.agents/skills/likec4-cli-codegen-regression
Command: npx skills add https://github.com/likec4/likec4 --skill likec4-cli-codegen-regression

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Changes to LikeC4 CLI code generation can silently break output contracts, letting generated dot, d2, mermaid, or plantuml files escape the requested --outdir when views come from external include paths, absolute paths, or Windows drive paths.

Core Features & Use Cases

  • Output containment invariants: Defines the contract that every multi-file generator (dot, d2, mermaid/mmd, plantuml) writes all emitted views under the requested --outdir.
  • Regression test matrix: Provides a minimal test matrix covering nested project views, external include paths, parent-relative paths, absolute paths, and Windows drive-style paths.
  • Temp workspace fixture pattern: Describes a workspace/project-a/shared/out fixture layout with assertions that no file lands outside the output root.
  • Use Case: When fixing a bug where likec4 gen dot --outdir out writes a file next to an externally included source, use this Skill to add a failing regression test first, then verify all four formats against the containment contract.

Quick Start

Ask the AI to add a regression test proving that likec4 gen dot, d2, mermaid, and plantuml keep every generated file inside the --outdir folder, including views from external include paths.

Frequently Asked Questions about likec4-cli-codegen-regression

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test likec4 gen output stays inside --outdir?

Create a temp workspace with a project folder, a shared folder included via ../shared, and an out folder. Run each generator with --outdir pointing at out, then assert every generated file passes an isInside(outdir, filepath) check and nothing appears beside the sources.

Which likec4 gen formats need output containment tests?

The multi-file generators dot, d2, mermaid (mmd), and plantuml (puml) all need containment tests. Single-file generators such as model, react, and webcomponent keep their existing --outfile behavior and are out of scope.

Why do generated files escape the output directory?

Escapes happen when source-relative view paths are resolved against absolute source paths, parent-relative paths with .. segments, or Windows drive-root paths instead of being re-rooted under --outdir. Views from external include paths are a common trigger.

How do I test Windows drive paths without a Windows fixture?

If the real fixture cannot produce absolute or Windows drive-style sourcePath values, extract a small path-resolution helper and cover those cases with pure unit tests instead of full CLI runs.

What commands verify a LikeC4 codegen change?

Run pnpm --filter likec4 test -- codegen, pnpm --filter likec4 typecheck, pnpm exec dprint check on the codegen directory, and git diff --check. If shared path utilities changed, also run the tests of the packages that own them.