Likec4 cli codegen regression

From lza6/Armor-piercing-system-prompts · View interactive version

Likec4 cli codegen regression is an AI agent skill from the GitHub repository lza6/Armor-piercing-system-prompts. Use when changing or reviewing LikeC4 CLI code generation, exporters, output file naming, include-path codegen behavior, or `likec4 gen` commands. Trigger for bugs around `--outdir`, generated files escaping output folders, dot/d2/mermaid/plantuml output, or external include-path views.

How to use this skill

Skill file

LikeC4 CLI Codegen Regression

Protect likec4 gen output contracts with focused tests. The most important invariant is that multi-file generators write every emitted view under the requested output directory.

Ground rules

Output-path invariants

For likec4 gen dot, d2, mermaid or mmd, and plantuml:

Regression matrix

Cover the smallest matrix that proves the contract:

| Case | Expected result |

| ----------------------------------------- | ----------------------------------------------------------- |

| view in project folder | file under --outdir |

| view in nested project folder | nested file under --outdir |

| view from external include path | file under --outdir, not beside the included source |

| source path with .. relation to project | sanitized or re-rooted under --outdir |

| Windows drive-style source path | no drive-root escape such as C: output outside --outdir |

| absolute source path | no absolute-root escape outside --outdir |

Formats to consider:

Test shape

Use a temp workspace fixture:

workspace/
  project-a/
    likec4.config.ts
    project-view.c4
  shared/
    included-view.c4
  out/

Configure project-a to include ../shared. Run each generator with --outdir workspace/out.

Assert:

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.

Focused commands

pnpm --filter likec4 test -- codegen
pnpm --filter likec4 typecheck
pnpm exec dprint check packages/likec4/src/cli/codegen
git diff --check

If touching shared path utilities, also run the package tests that own those utilities.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.