|
1 | 1 | # @noxify/gitlab-ci-builder |
2 | 2 |
|
| 3 | +## 1.3.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- 280e33e: Add CLI visualization tool for GitLab CI pipelines |
| 8 | + - New `gitlab-ci-builder` command-line tool with `visualize` subcommand |
| 9 | + - Supports multiple input formats: local YAML files and remote URLs |
| 10 | + - Three visualization formats: |
| 11 | + - Mermaid diagram: Interactive flowchart visualization |
| 12 | + - ASCII tree: Text-based dependency tree |
| 13 | + - Stage table: Organized view by pipeline stages |
| 14 | + - Built-in support for extends resolution and dependency analysis |
| 15 | + - Easy to use: `npx @noxify/gitlab-ci-builder visualize .gitlab-ci.yml` |
| 16 | + |
| 17 | + ## CLI Usage |
| 18 | + |
| 19 | + ```bash |
| 20 | + # Visualize local YAML file (all formats) |
| 21 | + gitlab-ci-builder visualize .gitlab-ci.yml |
| 22 | + |
| 23 | + # Show only Mermaid diagram |
| 24 | + gitlab-ci-builder visualize .gitlab-ci.yml -f mermaid |
| 25 | + |
| 26 | + # Visualize remote pipeline |
| 27 | + gitlab-ci-builder visualize https://gitlab.com/my-org/my-project/-/raw/main/.gitlab-ci.yml |
| 28 | + |
| 29 | + # Show ASCII tree without stages |
| 30 | + gitlab-ci-builder visualize pipeline.yml -f ascii --show-stages=false |
| 31 | + ``` |
| 32 | + |
| 33 | + ## Programmatic Usage |
| 34 | + |
| 35 | + ### Using YAML |
| 36 | + |
| 37 | + ```typescript |
| 38 | + import { visualizeYaml } from "@noxify/gitlab-ci-builder" |
| 39 | + |
| 40 | + const yamlContent = ` |
| 41 | + stages: [build, test] |
| 42 | + build: |
| 43 | + stage: build |
| 44 | + script: npm run build |
| 45 | + ` |
| 46 | + |
| 47 | + const result = await visualizeYaml(yamlContent, { format: "all" }) |
| 48 | + console.log(result.mermaid) // Mermaid diagram |
| 49 | + console.log(result.ascii) // ASCII tree |
| 50 | + console.log(result.table) // Stage table |
| 51 | + ``` |
| 52 | + |
| 53 | + ### Using ConfigBuilder - Show only local jobs |
| 54 | + |
| 55 | + ```typescript |
| 56 | + import { ConfigBuilder } from "@noxify/gitlab-ci-builder" |
| 57 | + |
| 58 | + const config = new ConfigBuilder() |
| 59 | + .stages("build", "test", "deploy") |
| 60 | + .template(".base", { image: "node:22" }) |
| 61 | + .extends(".base", "build", { stage: "build", script: ["npm run build"] }) |
| 62 | + .extends(".base", "test", { stage: "test", script: ["npm test"] }) |
| 63 | + |
| 64 | + // Generate visualizations directly from ConfigBuilder |
| 65 | + const mermaid = config.generateMermaidDiagram({ showStages: true }) |
| 66 | + const ascii = config.generateAsciiTree({ showRemotes: true }) |
| 67 | + const table = config.generateStageTable() |
| 68 | + |
| 69 | + console.log(mermaid) |
| 70 | + console.log(ascii) |
| 71 | + console.log(table) |
| 72 | + ``` |
| 73 | + |
| 74 | + ### Using ConfigBuilder - Resolve also configured `includes` |
| 75 | + |
| 76 | + ```typescript |
| 77 | + import { ConfigBuilder, visualizeYaml } from "@noxify/gitlab-ci-builder" |
| 78 | + |
| 79 | + const config = new ConfigBuilder() |
| 80 | + .include({ remote: "https://custom-gitlab-host.com/org/branch/spec.yml" }) |
| 81 | + .stages("build", "test", "deploy") |
| 82 | + .template(".base", { image: "node:22" }) |
| 83 | + .extends(".base", "build", { stage: "build", script: ["npm run build"] }) |
| 84 | + .extends(".base", "test", { stage: "test", script: ["npm test"] }) |
| 85 | + |
| 86 | + const yaml = config.toYaml() |
| 87 | + const result = await visualizeYaml(yaml, { |
| 88 | + format: "all", |
| 89 | + // Optional: Authentication for private repositories |
| 90 | + gitlabToken: process.env.GITLAB_TOKEN, |
| 91 | + // Optional: GitLab host URL for project/template includes (default: https://gitlab.com) |
| 92 | + gitlabUrl: "https://custom-gitlab-host.com", |
| 93 | + }) |
| 94 | + |
| 95 | + console.log(result.mermaid) |
| 96 | + console.log(result.ascii) |
| 97 | + console.log(result.table) |
| 98 | + ``` |
| 99 | + |
3 | 100 | ## 1.2.0 |
4 | 101 |
|
5 | 102 | ### Minor Changes |
|
0 commit comments