pipechecker 0.2.2

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 ADDED
@@ -0,0 +1,206 @@
1
+ # 🔍 Pipecheck
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)
7
+
8
+ **A blazingly fast CI/CD pipeline auditor that catches errors before you push.**
9
+
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
+
12
+ ## 🚀 Quick Start
13
+
14
+ ### Install via npm (recommended)
15
+ ```bash
16
+ npm install -g pipecheck
17
+ ```
18
+
19
+ ### Install via Cargo
20
+ ```bash
21
+ cargo install pipecheck
22
+ ```
23
+
24
+ ### Run
25
+ ```bash
26
+ pipecheck .github/workflows/ci.yml
27
+ ```
28
+
29
+ ## ✨ Features
30
+
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
38
+
39
+ ## 💡 Why Pipecheck?
40
+
41
+ **Before Pipecheck:**
42
+ ```
43
+ git push
44
+ → Wait 5 minutes
45
+ → CI fails: "Circular dependency detected"
46
+ → Fix locally
47
+ → git push again
48
+ → Wait 5 minutes...
49
+ ```
50
+
51
+ **With Pipecheck:**
52
+ ```
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 ✅
57
+ ```
58
+
59
+ ## 📖 Usage
60
+
61
+ ### Quick Start
62
+
63
+ ```bash
64
+ # Auto-detect and check workflow
65
+ pipecheck
66
+
67
+ # Check specific file
68
+ pipecheck .github/workflows/ci.yml
69
+
70
+ # Check all workflows
71
+ pipecheck --all
72
+
73
+ # Interactive TUI mode
74
+ pipecheck --tui
75
+ ```
76
+
77
+ ### All Options
78
+
79
+ ```
80
+ CI/CD Pipeline Auditor - Catch errors before you push
81
+
82
+ Usage: pipecheck [OPTIONS] [FILE]
83
+
84
+ Arguments:
85
+ [FILE] Path to pipeline configuration file (auto-detects if not provided)
86
+
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
98
+ ```
99
+
100
+ ### Interactive Features
101
+
102
+ ```bash
103
+ # Install pre-commit hook
104
+ pipecheck --install-hook
105
+
106
+ # Watch mode - auto-recheck on file changes
107
+ pipecheck --watch
108
+
109
+ # Interactive TUI mode
110
+ pipecheck --tui
111
+
112
+ # Auto-fix issues (Coming soon!)
113
+ pipecheck --fix
114
+ ```
115
+
116
+ ### Configuration File
117
+
118
+ Create `.pipecheckrc.yml` in your project root:
119
+
120
+ ```yaml
121
+ ignore:
122
+ - .github/workflows/old-*.yml
123
+
124
+ rules:
125
+ circular_dependencies: true
126
+ missing_secrets: true
127
+ docker_latest_tag: true
128
+ ```
129
+
130
+ ### Output Formats
131
+
132
+ ```bash
133
+ # Text output (default)
134
+ pipecheck .github/workflows/ci.yml
135
+
136
+ # JSON output for CI integration
137
+ pipecheck .github/workflows/ci.yml --format json
138
+
139
+ # Strict mode (warnings as errors)
140
+ pipecheck .github/workflows/ci.yml --strict
141
+
142
+ # Skip Docker checks
143
+ pipecheck .github/workflows/ci.yml --no-docker
144
+ ```
145
+
146
+ ## 📋 Example Output
147
+
148
+ ```
149
+ Provider: GitHubActions
150
+
151
+ 1 errors, 0 warnings
152
+
153
+ ❌ ERROR: Circular dependency detected: job-a -> job-c -> job-b
154
+ 💡 Remove one of the dependencies to break the cycle
155
+
156
+ ℹ️ INFO: Job 'build' uses secret: API_KEY
157
+ 💡 Ensure this secret is configured in repository settings
158
+ ```
159
+
160
+ ## 🔧 Supported Platforms
161
+
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` |
167
+
168
+ ## 🏗️ Use in CI/CD
169
+
170
+ ### GitHub Actions
171
+ ```yaml
172
+ - name: Validate workflows
173
+ run: |
174
+ npm install -g pipecheck
175
+ pipecheck .github/workflows/*.yml --strict
176
+ ```
177
+
178
+ ### GitLab CI
179
+ ```yaml
180
+ validate:
181
+ script:
182
+ - cargo install pipecheck
183
+ - pipecheck .gitlab-ci.yml --strict
184
+ ```
185
+
186
+ ### Pre-commit Hook
187
+ ```bash
188
+ #!/bin/bash
189
+ pipecheck .github/workflows/*.yml --strict || exit 1
190
+ ```
191
+
192
+ ## 🤝 Contributing
193
+
194
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
195
+
196
+ ## 📝 License
197
+
198
+ Licensed under either of:
199
+ - MIT License ([LICENSE-MIT](LICENSE-MIT))
200
+ - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
201
+
202
+ at your option.
203
+
204
+ ## 🌟 Show Your Support
205
+
206
+ If Pipecheck saves you time, give it a ⭐ on GitHub!
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+
6
+ const binPath = path.join(__dirname, '..', 'npm', getBinaryName());
7
+
8
+ const child = spawn(binPath, process.argv.slice(2), { stdio: 'inherit' });
9
+
10
+ child.on('exit', (code) => {
11
+ process.exit(code);
12
+ });
13
+
14
+ function getBinaryName() {
15
+ const platform = process.platform;
16
+ const arch = process.arch;
17
+
18
+ if (platform === 'win32') {
19
+ return `pipechecker-${arch}.exe`;
20
+ }
21
+ return `pipechecker-${platform}-${arch}`;
22
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "pipechecker",
3
+ "version": "0.2.2",
4
+ "description": "CI/CD Pipeline Auditor - Catch errors before you push",
5
+ "bin": {
6
+ "pipechecker": "./bin/pipechecker.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node ./scripts/install.js",
10
+ "build": "cargo build --release"
11
+ },
12
+ "keywords": [
13
+ "ci",
14
+ "cd",
15
+ "pipeline",
16
+ "audit",
17
+ "github-actions",
18
+ "gitlab-ci",
19
+ "circleci",
20
+ "yaml",
21
+ "validation"
22
+ ],
23
+ "author": "Pipecheck Contributors",
24
+ "license": "MIT OR Apache-2.0",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/Ayyankhan101/PipeCheck.git"
28
+ },
29
+ "engines": {
30
+ "node": ">=14"
31
+ },
32
+ "os": [
33
+ "darwin",
34
+ "linux",
35
+ "win32"
36
+ ],
37
+ "cpu": [
38
+ "x64",
39
+ "arm64"
40
+ ],
41
+ "files": [
42
+ "bin/",
43
+ "scripts/",
44
+ "npm/"
45
+ ]
46
+ }
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const https = require('https');
6
+ const { execSync } = require('child_process');
7
+
8
+ const REPO = 'Ayyankhan101/PipeCheck';
9
+ const VERSION = require('../package.json').version.replace(/^v/, '');
10
+
11
+ function getBinaryName() {
12
+ const platform = process.platform;
13
+ const arch = process.arch;
14
+
15
+ if (platform === 'win32') {
16
+ return `pipechecker-${arch}.exe`;
17
+ }
18
+ return `pipechecker-${platform}-${arch}`;
19
+ }
20
+
21
+ function getReleaseAssetName() {
22
+ const platform = process.platform;
23
+ const arch = process.arch;
24
+
25
+ if (platform === 'win32') {
26
+ return `pipechecker-${arch}.exe`;
27
+ }
28
+ return `pipechecker-${platform}-${arch}`;
29
+ }
30
+
31
+ function download(url, dest) {
32
+ return new Promise((resolve, reject) => {
33
+ const request = https.get(url, { followRedirects: true }, (res) => {
34
+ if (res.statusCode === 302 || res.statusCode === 301) {
35
+ https.get(res.headers.location, { followRedirects: true }, (redirectRes) => {
36
+ const file = fs.createWriteStream(dest);
37
+ redirectRes.pipe(file);
38
+ file.on('finish', () => {
39
+ file.close();
40
+ resolve();
41
+ });
42
+ }).on('error', reject);
43
+ return;
44
+ }
45
+
46
+ const file = fs.createWriteStream(dest);
47
+ res.pipe(file);
48
+ file.on('finish', () => {
49
+ file.close();
50
+ resolve();
51
+ });
52
+ });
53
+ request.on('error', reject);
54
+ });
55
+ }
56
+
57
+ async function install() {
58
+ const binaryName = getBinaryName();
59
+ const assetName = getReleaseAssetName();
60
+ const npmDir = path.join(__dirname, '..', 'npm');
61
+ const binaryPath = path.join(npmDir, binaryName);
62
+
63
+ // Check if binary already exists
64
+ if (fs.existsSync(binaryPath)) {
65
+ console.log('✓ Pipecheck binary already installed');
66
+ return;
67
+ }
68
+
69
+ if (!fs.existsSync(npmDir)) {
70
+ fs.mkdirSync(npmDir, { recursive: true });
71
+ }
72
+
73
+ console.log(`Installing pipechecker v${VERSION}...`);
74
+
75
+ const tag = `v${VERSION}`;
76
+ const url = `https://github.com/${REPO}/releases/download/${tag}/${assetName}`;
77
+
78
+ try {
79
+ await download(url, binaryPath);
80
+ fs.chmodSync(binaryPath, 0o755);
81
+ console.log('✓ Pipecheck installed successfully');
82
+ } catch (error) {
83
+ console.error(`Failed to download binary from ${url}`);
84
+ console.error('Falling back to building from source...');
85
+
86
+ try {
87
+ execSync('cargo build --release', { stdio: 'inherit' });
88
+ const sourceBinary = path.join(__dirname, '..', 'target', 'release',
89
+ process.platform === 'win32' ? 'pipechecker.exe' : 'pipechecker');
90
+ fs.copyFileSync(sourceBinary, binaryPath);
91
+ fs.chmodSync(binaryPath, 0o755);
92
+ console.log('✓ Pipecheck installed from source');
93
+ } catch (buildError) {
94
+ console.error('Failed to build from source. Please ensure Rust is installed.');
95
+ console.error('Visit https://rustup.rs to install Rust');
96
+ process.exit(1);
97
+ }
98
+ }
99
+ }
100
+
101
+ install();