Skip to content

Commit 280e33e

Browse files
committed
feat: add CLI support for pipeline visualization
Add `gitlab-ci-builder visualize` command to generate Mermaid diagrams, ASCII trees, and stage tables directly from the terminal. Supports private repositories and self-hosted GitLab instances.
1 parent 6866625 commit 280e33e

27 files changed

+3150
-598
lines changed

.changeset/add-cli-visualize.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
"@noxify/gitlab-ci-builder": minor
3+
---
4+
5+
Add CLI visualization tool for GitLab CI pipelines
6+
7+
- New `gitlab-ci-builder` command-line tool with `visualize` subcommand
8+
- Supports multiple input formats: local YAML files, remote URLs, and TypeScript config files
9+
- Three visualization formats:
10+
- Mermaid diagram: Interactive flowchart visualization
11+
- ASCII tree: Text-based dependency tree
12+
- Stage table: Organized view by pipeline stages
13+
- Built-in support for extends resolution and dependency analysis
14+
- Easy to use: `npx @noxify/gitlab-ci-builder visualize .gitlab-ci.yml`
15+
16+
**CLI Usage:**
17+
18+
```bash
19+
# Visualize local YAML file (all formats)
20+
gitlab-ci-builder visualize .gitlab-ci.yml
21+
22+
# Show only Mermaid diagram
23+
gitlab-ci-builder visualize .gitlab-ci.yml -f mermaid
24+
25+
# Visualize remote pipeline
26+
gitlab-ci-builder visualize https://gitlab.com/my-org/my-project/-/raw/main/.gitlab-ci.yml
27+
28+
# Show ASCII tree without stages
29+
gitlab-ci-builder visualize pipeline.yml -f ascii --show-stages=false
30+
```
31+
32+
**Programmatic Usage:**
33+
34+
```typescript
35+
import { visualizeYaml } from "@noxify/gitlab-ci-builder"
36+
37+
const yamlContent = `
38+
stages: [build, test]
39+
build:
40+
stage: build
41+
script: npm run build
42+
`
43+
44+
const result = await visualizeYaml(yamlContent, { format: "all" })
45+
console.log(result.mermaid) // Mermaid diagram
46+
console.log(result.ascii) // ASCII tree
47+
console.log(result.table) // Stage table
48+
```
49+
50+
The CLI tool provides a quick way to understand complex pipeline configurations and visualize job dependencies without needing to write code. The subcommand structure allows for future expansion with additional commands. Future enhancements will include support for resolving external includes (local, remote, project, and template includes).

0 commit comments

Comments
 (0)