pipechecker 0.2.2 โ†’ 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,206 +1,570 @@
1
- # ๐Ÿ” Pipecheck
1
+ # PipeChecker
2
2
 
3
- [![CI](https://github.com/Ayyankhan101/PipeCheck/workflows/CI/badge.svg)](https://github.com/Ayyankhan101/PipeCheck/actions)
4
- [![Crates.io](https://img.shields.io/crates/v/pipecheck.svg)](https://crates.io/crates/pipecheck)
5
- [![npm](https://img.shields.io/npm/v/pipecheck.svg)](https://www.npmjs.com/package/pipecheck)
6
- [![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](LICENSE-MIT)
3
+ > **Catch CI/CD pipeline errors before you push โ€” not after CI fails.**
7
4
 
8
- **A blazingly fast CI/CD pipeline auditor that catches errors before you push.**
5
+ [![CI](https://github.com/Ayyankhan101/PipeChecker/actions/workflows/ci.yml/badge.svg)](https://github.com/Ayyankhan101/PipeChecker/actions/workflows/ci.yml)
6
+ [![Crates.io](https://img.shields.io/crates/v/pipechecker.svg)](https://crates.io/crates/pipechecker)
7
+ [![License](https://img.shields.io/badge/license-MIT%20%2F%20Apache--2.0-blue)](LICENSE-MIT)
8
+ [![Test Coverage](https://img.shields.io/badge/tests-103%20passing-brightgreen)]()
9
+ [![Rust](https://img.shields.io/badge/rust-2021-orange)](Cargo.toml)
9
10
 
10
- Stop wasting time debugging CI failures. Pipecheck validates your GitHub Actions, GitLab CI, and CircleCI configurations locally, catching syntax errors, circular dependencies, and security issues instantly.
11
+ ---
11
12
 
12
- ## ๐Ÿš€ Quick Start
13
+ ## What Problem Does This Solve?
13
14
 
14
- ### Install via npm (recommended)
15
+ Every developer has been here:
16
+
17
+ ```
18
+ ๐Ÿ’€ You push a small change โ†’ CI fails 10 minutes later โ†’
19
+ you fix it โ†’ push again โ†’ CI fails again โ†’ repeat 3 more times
20
+ ```
21
+
22
+ **PipeChecker runs locally** and validates your CI/CD workflows **before** you commit, so you catch:
23
+
24
+ | Catches | Example |
25
+ |---------|---------|
26
+ | โŒ **Circular dependencies** | Job A โ†’ Job B โ†’ Job A |
27
+ | โŒ **Missing job references** | `needs: [build]` but no `build` job exists |
28
+ | โŒ **Empty pipelines** | No jobs or steps defined |
29
+ | โš ๏ธ **Hardcoded secrets** | `API_KEY=sk_live_abc123` in env vars |
30
+ | โš ๏ธ **Undeclared env vars** | `${{ env.UNKNOWN }}` never defined |
31
+ | โš ๏ธ **Unpinned actions** | `uses: actions/checkout` without `@v4` |
32
+ | โš ๏ธ **Docker `:latest` tags** | `image: nginx:latest` (unreproducible builds) |
33
+ | โš ๏ธ **Missing job timeouts** | No `timeout-minutes` set โ€” jobs can run forever |
34
+
35
+ ---
36
+
37
+ ## Visual Overview
38
+
39
+ ```
40
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
41
+ โ”‚ YOUR WORKFLOW FILE โ”‚
42
+ โ”‚ (.github/workflows/ci.yml) โ”‚
43
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
44
+ โ”‚
45
+ โ–ผ
46
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
47
+ โ”‚ PIPECHECKER โ”‚
48
+ โ”‚ โ”‚
49
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
50
+ โ”‚ โ”‚ YAML Parser โ”‚ โ”‚
51
+ โ”‚ โ”‚ GitHub/GitLab โ”‚ โ”‚
52
+ โ”‚ โ”‚ CircleCI โ”‚ โ”‚
53
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
54
+ โ”‚ โ”‚ โ”‚
55
+ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
56
+ โ”‚ โ”‚ Auditors โ”‚ โ”‚
57
+ โ”‚ โ”‚ โ”‚ โ”‚
58
+ โ”‚ โ”‚ ๐Ÿ“‹ Syntax โ”‚ โ”‚
59
+ โ”‚ โ”‚ ๐Ÿ”— DAG/Cycle โ”‚ โ”‚
60
+ โ”‚ โ”‚ ๐Ÿ”’ Secrets โ”‚ โ”‚
61
+ โ”‚ โ”‚ ๐Ÿณ Docker โ”‚ โ”‚
62
+ โ”‚ โ”‚ ๐Ÿ“Œ Pinning โ”‚ โ”‚
63
+ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
64
+ โ”‚ โ”‚ โ”‚
65
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
66
+ โ”‚
67
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
68
+ โ–ผ โ–ผ โ–ผ
69
+ โœ… PASS โš ๏ธ WARNINGS โŒ ERRORS
70
+ No issues Fix before Must fix
71
+ found! production before push
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Supported Platforms
77
+
78
+ | Platform | File Pattern | Status |
79
+ |----------|-------------|--------|
80
+ | **GitHub Actions** | `.github/workflows/*.yml` | โœ… Full support |
81
+ | **GitLab CI** | `.gitlab-ci.yml` | โœ… Full support |
82
+ | **CircleCI** | `.circleci/config.yml` | โœ… Full support |
83
+
84
+ ---
85
+
86
+ ## Installation
87
+
88
+ ### From crates.io
89
+ ```bash
90
+ cargo install pipechecker
91
+ ```
92
+
93
+ ### From source
15
94
  ```bash
16
- npm install -g pipecheck
95
+ git clone https://github.com/Ayyankhan101/PipeChecker.git
96
+ cd PipeChecker
97
+ cargo install --path .
17
98
  ```
18
99
 
19
- ### Install via Cargo
100
+ ### Via npm (once published)
20
101
  ```bash
21
- cargo install pipecheck
102
+ npm install -g pipechecker
22
103
  ```
23
104
 
24
- ### Run
105
+ ---
106
+
107
+ ## Quick Start
108
+
109
+ ### 1. Check a single file
25
110
  ```bash
26
- pipecheck .github/workflows/ci.yml
111
+ pipechecker .github/workflows/ci.yml
112
+ ```
113
+
114
+ ### 2. Auto-detect your workflow
115
+ ```bash
116
+ pipechecker
117
+ # โœ“ Auto-detected: .github/workflows/ci.yml
118
+ # Provider: GitHubActions
119
+ # 0 errors, 0 warnings
120
+ ```
121
+
122
+ ### 3. Audit everything
123
+ ```bash
124
+ pipechecker --all
125
+ # Checking 3 workflow file(s)...
126
+ #
127
+ # ๐Ÿ“„ .github/workflows/ci.yml
128
+ # Provider: GitHubActions
129
+ # โœ… No issues found
130
+ #
131
+ # ๐Ÿ“„ .github/workflows/deploy.yml
132
+ # Provider: GitHubActions
133
+ # 1 errors, 2 warnings
134
+ # โŒ ERROR: Circular dependency detected (job: deploy)
135
+ # ๐Ÿ’ก Remove one of the dependencies to break the cycle
136
+ # โš ๏ธ WARNING: Job 'deploy' has no steps
137
+ #
138
+ # โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
139
+ # Total: 1 errors, 2 warnings across 3 files
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Interactive TUI
145
+
146
+ PipeChecker includes a **terminal UI** for browsing results across multiple files:
147
+
148
+ ```bash
149
+ pipechecker --tui
150
+ ```
151
+
152
+ ```
153
+ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
154
+ โ”‚ ๐Ÿ” Pipecheck - Interactive Mode โ”‚
155
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
156
+ โ”‚ Workflows โ”‚
157
+ โ”‚โ–ถ โŒ deploy.yml โ”‚ 2 errors โ”‚ 1 warnings โ”‚
158
+ โ”‚ โœ… ci.yml โ”‚ 0 errors โ”‚ 0 warnings โ”‚
159
+ โ”‚ โš ๏ธ lint.yml โ”‚ 0 errors โ”‚ 3 warnings โ”‚
160
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
161
+ โ”‚ [โ†‘/โ†“] Navigate [Enter] Details [Q] Quitโ”‚
162
+ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
163
+ ```
164
+
165
+ **Keyboard shortcuts:**
166
+
167
+ | Key | Action |
168
+ |-----|--------|
169
+ | `โ†‘` / `k` | Move up |
170
+ | `โ†“` / `j` | Move down |
171
+ | `Enter` / `Space` | Toggle detail view |
172
+ | `q` / `Esc` | Quit |
173
+
174
+ ---
175
+
176
+ ## All CLI Flags
177
+
178
+ | Flag | Description |
179
+ |------|-------------|
180
+ | `FILE` | Path to a specific workflow file |
181
+ | `--all`, `-a` | Audit **all** discovered workflow files |
182
+ | `--tui` | Launch the interactive terminal UI |
183
+ | `--watch`, `-w` | Watch for file changes and re-run audits |
184
+ | `--fix` | Auto-fix issues (pin unpinned actions + Docker `:latest` tags) |
185
+ | `--install-hook` | Install a git pre-commit hook |
186
+ | `--format`, `-f` `<text\|json>` | Output format (default: `text`) |
187
+ | `--strict`, `-s` | Treat warnings as errors (exit code 1) |
188
+ | `--quiet`, `-q` | Only output errors โ€” suppress warnings and info. Perfect for CI |
189
+ | `--verbose` | Show diagnostic info (auditors ran, per-severity counts, discovered files) |
190
+ | `--no-pinning` | Skip Docker image and action-pinning checks |
191
+ | `--version` | Show version |
192
+ | `--help` | Show help |
193
+
194
+ ---
195
+
196
+ ## Output Explained
197
+
198
+ ### Severity Levels
199
+
200
+ | Symbol | Level | Meaning |
201
+ |--------|-------|---------|
202
+ | โŒ | **Error** | Must fix โ€” will break your pipeline |
203
+ | โš ๏ธ | **Warning** | Should fix โ€” may cause issues later |
204
+ | โ„น๏ธ | **Info** | Informational โ€” nothing to worry about |
205
+
206
+ ### Example output with details
207
+
208
+ ```
209
+ Provider: GitHubActions
210
+ 2 errors, 1 warnings
211
+
212
+ โŒ ERROR: Circular dependency detected (job: deploy) [line 42]
213
+ ๐Ÿ’ก Remove one of the dependencies to break the cycle
214
+
215
+ โŒ ERROR: Job 'deploy' depends on non-existent job 'build' (job: deploy) [line 45]
216
+ ๐Ÿ’ก Add a job with id 'build' or remove the dependency
217
+
218
+ โš ๏ธ WARNING: Job 'lint' has no steps (job: lint) [line 12]
219
+ ๐Ÿ’ก Add steps to perform work in this job
27
220
  ```
28
221
 
29
- ## โœจ Features
222
+ Each issue includes:
223
+ - **What** went wrong (clear message)
224
+ - **Where** it happened (job name + line number)
225
+ - **How** to fix it (actionable suggestion)
30
226
 
31
- - โœ… **Syntax Validation** - Parse and validate GitHub Actions, GitLab CI, and CircleCI configs
32
- - ๐Ÿ”„ **Dependency Analysis** - Detect circular dependencies in job workflows
33
- - ๐Ÿ” **Secrets Auditing** - Identify hardcoded secrets and environment variable issues
34
- - ๐Ÿณ **Docker Validation** - Check Docker image references and tags
35
- - ๐Ÿ“Š **Multiple Output Formats** - Text and JSON output for CI integration
36
- - โšก **Fast** - Written in Rust for maximum performance
37
- - ๐ŸŽฏ **Zero Config** - Works out of the box
227
+ ---
38
228
 
39
- ## ๐Ÿ’ก Why Pipecheck?
229
+ ## JSON Output
40
230
 
41
- **Before Pipecheck:**
231
+ Perfect for CI/CD integration or programmatic consumption:
232
+
233
+ ```bash
234
+ pipechecker --format json
42
235
  ```
43
- git push
44
- โ†’ Wait 5 minutes
45
- โ†’ CI fails: "Circular dependency detected"
46
- โ†’ Fix locally
47
- โ†’ git push again
48
- โ†’ Wait 5 minutes...
236
+
237
+ ```json
238
+ {
239
+ "provider": "GitHubActions",
240
+ "issues": [
241
+ {
242
+ "severity": "Error",
243
+ "message": "Circular dependency detected: job-a -> job-b -> job-a",
244
+ "location": { "line": 42, "column": 3, "job": "deploy" },
245
+ "suggestion": "Remove one of the dependencies to break the cycle"
246
+ }
247
+ ],
248
+ "summary": "1 errors, 0 warnings"
249
+ }
49
250
  ```
50
251
 
51
- **With Pipecheck:**
252
+ ---
253
+
254
+ ## Modes of Operation
255
+
256
+ ### ๐Ÿ”ง Auto-Fix Mode
257
+ Automatically pins unpinned GitHub Actions to known versions:
258
+
259
+ ```bash
260
+ pipechecker --fix
52
261
  ```
53
- pipecheck .github/workflows/ci.yml
54
- โ†’ โŒ ERROR: Circular dependency detected: job-a -> job-c -> job-b
55
- โ†’ Fix immediately
56
- โ†’ git push with confidence โœ…
262
+
57
263
  ```
264
+ ๐Ÿ”ง Auto-fix mode
265
+
266
+ โœจ Fixed 2 issue(s) in .github/workflows/ci.yml:
267
+
268
+ actions/checkout โ†’ actions/checkout@v4
269
+ actions/setup-node โ†’ actions/setup-node@v4
58
270
 
59
- ## ๐Ÿ“– Usage
271
+ ๐Ÿ’ก Review the changes and commit them!
272
+ ```
60
273
 
61
- ### Quick Start
274
+ ### ๐Ÿ‘€ Watch Mode
275
+ Monitors workflow files and re-runs on every save โ€” perfect for development:
62
276
 
63
277
  ```bash
64
- # Auto-detect and check workflow
65
- pipecheck
278
+ pipechecker --watch
279
+ ```
280
+
281
+ ```
282
+ ๐Ÿ‘€ Watching for workflow changes...
283
+ Press Ctrl+C to stop
66
284
 
67
- # Check specific file
68
- pipecheck .github/workflows/ci.yml
285
+ ๐Ÿ”„ File changed: .github/workflows/ci.yml
286
+ Provider: GitHubActions
287
+ 0 errors, 0 warnings
288
+ โœ… All checks passed
289
+ ```
69
290
 
70
- # Check all workflows
71
- pipecheck --all
291
+ ### ๐Ÿคซ Quiet Mode (CI-Friendly)
292
+ Only output errors โ€” suppress warnings and info. Perfect for CI pipelines where you want clean output:
72
293
 
73
- # Interactive TUI mode
74
- pipecheck --tui
294
+ ```bash
295
+ pipechecker --quiet
296
+ # or
297
+ pipechecker -q
75
298
  ```
76
299
 
77
- ### All Options
300
+ ```
301
+ โŒ Circular dependency detected (job: deploy) (in .github/workflows/deploy.yml)
302
+ ```
78
303
 
304
+ Exit code is still `1` if there are errors โ€” works perfectly with `--strict` for failing CI on any issue.
305
+
306
+ ### ๐Ÿ“ข Verbose Mode
307
+ See exactly what PipeChecker is doing โ€” which files it found, which auditors ran, and per-severity breakdowns:
308
+
309
+ ```bash
310
+ pipechecker --verbose
79
311
  ```
80
- CI/CD Pipeline Auditor - Catch errors before you push
81
312
 
82
- Usage: pipecheck [OPTIONS] [FILE]
313
+ ```
314
+ ๐Ÿ“„ Auditing: .github/workflows/ci.yml
315
+ ๐Ÿ” Auditors ran: syntax, dag, secrets, pinning
316
+ ๐Ÿ“Š Found: 0 errors, 1 warnings, 0 info
317
+ โฑ๏ธ Checked in 3.2ms
318
+ ```
319
+
320
+ ### โฑ๏ธ Timing Metrics
321
+ Every audit now shows how long it took โ€” because speed matters:
83
322
 
84
- Arguments:
85
- [FILE] Path to pipeline configuration file (auto-detects if not provided)
323
+ ```bash
324
+ pipechecker .github/workflows/ci.yml
325
+ ```
86
326
 
87
- Options:
88
- -a, --all Check all workflow files in directory
89
- --install-hook Install pre-commit hook
90
- -w, --watch Watch for file changes and re-check
91
- --fix Automatically fix issues where possible
92
- --tui Interactive terminal UI mode
93
- -f, --format <FORMAT> Output format (text, json) [default: text]
94
- --no-docker Skip Docker image checks
95
- -s, --strict Enable strict mode (warnings as errors)
96
- -h, --help Print help
97
- -V, --version Print version
327
+ ```
328
+ Provider: GitHubActions
329
+ 0 errors, 0 warnings
330
+ โœ… All checks passed
331
+ โฑ๏ธ Checked in 2.1ms
98
332
  ```
99
333
 
100
- ### Interactive Features
334
+ ### ๐Ÿ”’ Pre-commit Hook
335
+ Never commit a broken workflow again:
101
336
 
102
337
  ```bash
103
- # Install pre-commit hook
104
- pipecheck --install-hook
338
+ pipechecker --install-hook
339
+ ```
340
+
341
+ ```
342
+ โœ… Pre-commit hook installed!
343
+ Pipecheck will run before every commit
344
+ Use 'git commit --no-verify' to skip
345
+ ```
105
346
 
106
- # Watch mode - auto-recheck on file changes
107
- pipecheck --watch
347
+ The hook automatically validates any workflow files you stage:
108
348
 
109
- # Interactive TUI mode
110
- pipecheck --tui
349
+ ```bash
350
+ $ git commit -m "Update CI pipeline"
351
+ ๐Ÿ” Checking workflows with pipechecker...
352
+ โŒ ERROR: Circular dependency detected (job: deploy) [line 42]
353
+ ๐Ÿ’ก Remove one of the dependencies to break the cycle
111
354
 
112
- # Auto-fix issues (Coming soon!)
113
- pipecheck --fix
355
+ โŒ Workflow validation failed!
356
+ Fix errors above or use 'git commit --no-verify' to skip
114
357
  ```
115
358
 
116
- ### Configuration File
359
+ ---
360
+
361
+ ## Configuration File
117
362
 
118
- Create `.pipecheckrc.yml` in your project root:
363
+ Create a `.pipecheckerrc.yml` in your project root to customize behavior:
119
364
 
120
365
  ```yaml
366
+ # Files to skip (glob patterns supported)
121
367
  ignore:
122
- - .github/workflows/old-*.yml
123
-
368
+ - .github/workflows/experimental-*.yml
369
+ - .github/workflows/draft-*.yml
370
+ - old-pipeline.yml
371
+
372
+ # Toggle individual audit rules
124
373
  rules:
125
- circular_dependencies: true
126
- missing_secrets: true
127
- docker_latest_tag: true
374
+ circular_dependencies: true # Detect dependency cycles
375
+ missing_secrets: true # Flag hardcoded secrets
376
+ docker_latest_tag: true # Warn about :latest tags
128
377
  ```
129
378
 
130
- ### Output Formats
379
+ PipeChecker searches for config in this order:
380
+ 1. `.pipecheckerrc.yml`
381
+ 2. `.pipecheckerrc.yaml`
382
+ 3. `.pipechecker.yml`
131
383
 
132
- ```bash
133
- # Text output (default)
134
- pipecheck .github/workflows/ci.yml
384
+ ---
385
+
386
+ ## How the Auditors Work
387
+
388
+ ### ๐Ÿ“‹ Syntax Auditor
389
+ Validates the structural integrity of your pipeline:
135
390
 
136
- # JSON output for CI integration
137
- pipecheck .github/workflows/ci.yml --format json
391
+ - โœ… Jobs are defined
392
+ - โœ… Steps exist within jobs
393
+ - โœ… No duplicate job IDs
394
+ - โœ… `needs` / `depends_on` targets exist
138
395
 
139
- # Strict mode (warnings as errors)
140
- pipecheck .github/workflows/ci.yml --strict
396
+ ### ๐Ÿ”— DAG Auditor (Cycle Detection)
397
+ Builds a **dependency graph** of your jobs and runs **Tarjan's Strongly Connected Components** algorithm:
141
398
 
142
- # Skip Docker checks
143
- pipecheck .github/workflows/ci.yml --no-docker
144
399
  ```
400
+ job-a โ”€โ”€dependsโ”€โ”€โ–ถ job-b
401
+ โ–ฒ โ”‚
402
+ โ”‚ โ–ผ
403
+ โ””โ”€โ”€โ”€โ”€dependsโ”€โ”€โ”€โ”€ job-c
404
+ ```
405
+ โ†’ โŒ **Circular dependency detected:** job-a โ†’ job-b โ†’ job-c โ†’ job-a
406
+
407
+ ### ๐Ÿ”’ Secrets Auditor
408
+ Scans for security issues in environment variables and run blocks:
409
+
410
+ ```yaml
411
+ env:
412
+ API_KEY: sk_live_abc123 # โš ๏ธ Hardcoded secret
413
+ TOKEN: ${{ secrets.TOKEN }} # โœ… Correct way
414
+ RUN: echo ${{ secrets.API_KEY }} # โ„น๏ธ Info โ€” ensure it's configured
415
+ RUN: echo ${{ env.UNDEFINED }} # โš ๏ธ Undeclared env var
416
+ ```
417
+
418
+ Detects:
419
+ - Hardcoded API keys, passwords, tokens
420
+ - Secret references in `with:` blocks
421
+ - Undeclared `${{ env.X }}` references
422
+ - Suspicious values (long alphanumeric strings, base64)
145
423
 
146
- ## ๐Ÿ“‹ Example Output
424
+ ### ๐Ÿณ Docker & ๐Ÿ“Œ Pinning Auditor
425
+ Ensures reproducible builds:
147
426
 
427
+ ```yaml
428
+ uses: actions/checkout # โš ๏ธ No version pin
429
+ uses: actions/checkout@v4 # โœ… Pinned
430
+ image: nginx:latest # โš ๏ธ Unpredictable
431
+ image: nginx:1.25-alpine # โœ… Specific
148
432
  ```
433
+
434
+ ---
435
+
436
+ ## Real-World Examples
437
+
438
+ ### Example 1: Valid workflow
439
+ ```bash
440
+ $ pipechecker .github/workflows/ci.yml
149
441
  Provider: GitHubActions
442
+ 0 errors, 0 warnings
443
+ ```
150
444
 
445
+ ### Example 2: Circular dependency
446
+ ```yaml
447
+ jobs:
448
+ deploy:
449
+ needs: [test]
450
+ steps: [{ run: echo deploy }]
451
+ test:
452
+ needs: [deploy]
453
+ steps: [{ run: echo test }]
454
+ ```
455
+ ```bash
456
+ $ pipechecker broken.yml
457
+ Provider: GitHubActions
151
458
  1 errors, 0 warnings
152
459
 
153
- โŒ ERROR: Circular dependency detected: job-a -> job-c -> job-b
460
+ โŒ ERROR: Circular dependency detected (job: deploy)
154
461
  ๐Ÿ’ก Remove one of the dependencies to break the cycle
462
+ ```
463
+
464
+ ### Example 3: Hardcoded secrets
465
+ ```yaml
466
+ jobs:
467
+ build:
468
+ env:
469
+ API_SECRET: sk_live_hardcoded_value
470
+ steps: [{ run: echo building }]
471
+ ```
472
+ ```bash
473
+ $ pipechecker secrets.yml
474
+ Provider: GitHubActions
475
+ 0 errors, 1 warnings
476
+
477
+ โš ๏ธ WARNING: Job 'build' env 'API_SECRET' may contain a hardcoded secret
478
+ ๐Ÿ’ก Use secrets.API_SECRET instead of hardcoding
479
+ ```
480
+
481
+ ---
155
482
 
156
- โ„น๏ธ INFO: Job 'build' uses secret: API_KEY
157
- ๐Ÿ’ก Ensure this secret is configured in repository settings
483
+ ## Architecture
484
+
485
+ ```
486
+ pipechecker/
487
+ โ”œโ”€โ”€ src/
488
+ โ”‚ โ”œโ”€โ”€ main.rs # CLI entry point (clap)
489
+ โ”‚ โ”œโ”€โ”€ lib.rs # Public API โ€” audit_file, audit_content, discover_workflows
490
+ โ”‚ โ”œโ”€โ”€ models.rs # Core types โ€” Pipeline, Job, Step, Issue, Severity
491
+ โ”‚ โ”œโ”€โ”€ error.rs # Error enum (thiserror)
492
+ โ”‚ โ”œโ”€โ”€ config.rs # .pipecheckerrc.yml loading
493
+ โ”‚ โ”œโ”€โ”€ fix.rs # Auto-fix for action pinning
494
+ โ”‚ โ”œโ”€โ”€ tui.rs # Interactive terminal UI (ratatui + crossterm)
495
+ โ”‚ โ”œโ”€โ”€ parsers/
496
+ โ”‚ โ”‚ โ”œโ”€โ”€ mod.rs # Provider detection + dispatch
497
+ โ”‚ โ”‚ โ”œโ”€โ”€ github.rs # GitHub Actions YAML parser
498
+ โ”‚ โ”‚ โ”œโ”€โ”€ gitlab.rs # GitLab CI YAML parser
499
+ โ”‚ โ”‚ โ””โ”€โ”€ circleci.rs # CircleCI YAML parser
500
+ โ”‚ โ””โ”€โ”€ auditors/
501
+ โ”‚ โ”œโ”€โ”€ mod.rs # Module gate
502
+ โ”‚ โ”œโ”€โ”€ syntax.rs # Structural validation
503
+ โ”‚ โ”œโ”€โ”€ dag.rs # Dependency graph + cycle detection (petgraph)
504
+ โ”‚ โ”œโ”€โ”€ secrets.rs # Secret/env var scanning (regex)
505
+ โ”‚ โ””โ”€โ”€ pinning.rs # Action/Docker image pinning
506
+ โ”œโ”€โ”€ tests/
507
+ โ”‚ โ”œโ”€โ”€ parser_test.rs # Parser integration tests
508
+ โ”‚ โ””โ”€โ”€ auditors_test.rs # Auditor + fixture tests
509
+ โ””โ”€โ”€ tests/fixtures/ # Sample workflow files for testing
158
510
  ```
159
511
 
160
- ## ๐Ÿ”ง Supported Platforms
512
+ ---
161
513
 
162
- | Platform | Status | File Pattern |
163
- |----------|--------|--------------|
164
- | **GitHub Actions** | โœ… Full Support | `.github/workflows/*.yml` |
165
- | **GitLab CI** | โœ… Full Support | `.gitlab-ci.yml` |
166
- | **CircleCI** | โœ… Full Support | `.circleci/config.yml` |
514
+ ## CI/CD Integration
167
515
 
168
- ## ๐Ÿ—๏ธ Use in CI/CD
516
+ Add PipeChecker to your own CI pipeline:
169
517
 
170
- ### GitHub Actions
171
518
  ```yaml
172
519
  - name: Validate workflows
173
520
  run: |
174
- npm install -g pipecheck
175
- pipecheck .github/workflows/*.yml --strict
521
+ cargo install pipechecker
522
+ pipechecker --all --strict --format json
176
523
  ```
177
524
 
178
- ### GitLab CI
179
- ```yaml
180
- validate:
181
- script:
182
- - cargo install pipecheck
183
- - pipecheck .gitlab-ci.yml --strict
525
+ Or use it as a pre-commit hook (recommended):
526
+
527
+ ```bash
528
+ pipechecker --install-hook
184
529
  ```
185
530
 
186
- ### Pre-commit Hook
531
+ ---
532
+
533
+ ## Development
534
+
535
+ ### Run tests
187
536
  ```bash
188
- #!/bin/bash
189
- pipecheck .github/workflows/*.yml --strict || exit 1
537
+ cargo test
538
+ # 103 tests โ€” all passing
190
539
  ```
191
540
 
192
- ## ๐Ÿค Contributing
541
+ ### Lint & format
542
+ ```bash
543
+ cargo clippy -- -D warnings
544
+ cargo fmt -- --check
545
+ ```
193
546
 
194
- Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
547
+ ### Coverage
548
+ ```bash
549
+ cargo tarpaulin --fail-under 55
550
+ ```
551
+
552
+ ---
553
+
554
+ ## License
555
+
556
+ This project is licensed under either **MIT** or **Apache-2.0** at your option.
557
+
558
+ ```
559
+ SPDX: MIT OR Apache-2.0
560
+ ```
195
561
 
196
- ## ๐Ÿ“ License
562
+ ---
197
563
 
198
- Licensed under either of:
199
- - MIT License ([LICENSE-MIT](LICENSE-MIT))
200
- - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
564
+ <div align="center">
201
565
 
202
- at your option.
566
+ **PipeChecker** โ€” *because waiting 10 minutes for CI to tell you about a typo is nobody's idea of fun.*
203
567
 
204
- ## ๐ŸŒŸ Show Your Support
568
+ [Report a bug](https://github.com/Ayyankhan101/PipeCheck/issues) ยท [Request a feature](https://github.com/Ayyankhan101/PipeCheck/issues) ยท [Contributing](CONTRIBUTING.md)
205
569
 
206
- If Pipecheck saves you time, give it a โญ on GitHub!
570
+ </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipechecker",
3
- "version": "0.2.2",
3
+ "version": "0.2.5",
4
4
  "description": "CI/CD Pipeline Auditor - Catch errors before you push",
5
5
  "bin": {
6
6
  "pipechecker": "./bin/pipechecker.js"
@@ -62,7 +62,7 @@ async function install() {
62
62
 
63
63
  // Check if binary already exists
64
64
  if (fs.existsSync(binaryPath)) {
65
- console.log('โœ“ Pipecheck binary already installed');
65
+ console.log('โœ“ Pipechecker binary already installed');
66
66
  return;
67
67
  }
68
68
 
@@ -78,7 +78,7 @@ async function install() {
78
78
  try {
79
79
  await download(url, binaryPath);
80
80
  fs.chmodSync(binaryPath, 0o755);
81
- console.log('โœ“ Pipecheck installed successfully');
81
+ console.log('โœ“ Pipechecker installed successfully');
82
82
  } catch (error) {
83
83
  console.error(`Failed to download binary from ${url}`);
84
84
  console.error('Falling back to building from source...');
@@ -89,7 +89,7 @@ async function install() {
89
89
  process.platform === 'win32' ? 'pipechecker.exe' : 'pipechecker');
90
90
  fs.copyFileSync(sourceBinary, binaryPath);
91
91
  fs.chmodSync(binaryPath, 0o755);
92
- console.log('โœ“ Pipecheck installed from source');
92
+ console.log('โœ“ Pipechecker installed from source');
93
93
  } catch (buildError) {
94
94
  console.error('Failed to build from source. Please ensure Rust is installed.');
95
95
  console.error('Visit https://rustup.rs to install Rust');