-
Notifications
You must be signed in to change notification settings - Fork 3
Description
What
Add CI/CD platform detection to the scanner. When a repo uses GitHub Actions, GitLab CI, CircleCI, etc., report it in the scan results.
Why
Knowing the CI/CD platform helps Claude understand the deployment pipeline and write better skills (e.g., "tests run via GitHub Actions on PR" or "deploy triggered by GitLab CI merge to main").
How
Edit src/lib/scanner.js. Add a detectCICD(repoPath) function that checks for these files:
| Platform | Detection Signal |
|---|---|
| GitHub Actions | .github/workflows/*.yml or .github/workflows/*.yaml (use readdirSync) |
| GitLab CI | .gitlab-ci.yml at repo root |
| CircleCI | .circleci/config.yml |
| Jenkins | Jenkinsfile at repo root |
| Travis CI | .travis.yml at repo root |
| Azure Pipelines | azure-pipelines.yml at repo root |
| Bitbucket Pipelines | bitbucket-pipelines.yml at repo root |
| Buildkite | .buildkite/pipeline.yml |
All checks are just existsSync() calls — no file content reading needed (except GitHub Actions which needs a readdirSync on the workflows directory).
Implementation steps
-
Add
detectCICD(repoPath)tosrc/lib/scanner.js:function detectCICD(repoPath) { const detected = []; // GitHub Actions — check if .github/workflows/ has any .yml/.yaml files const workflowsDir = join(repoPath, '.github', 'workflows'); if (existsSync(workflowsDir)) { try { const files = readdirSync(workflowsDir); if (files.some(f => f.endsWith('.yml') || f.endsWith('.yaml'))) { detected.push('github-actions'); } } catch {} } // GitLab CI if (existsSync(join(repoPath, '.gitlab-ci.yml'))) detected.push('gitlab-ci'); // ... etc for each platform return detected; }
-
Call it from
scanRepo()and add to the result object:result.cicd = detectCICD(repoPath);
-
Display in
src/commands/scan.js— add after the Frameworks line:if (result.cicd && result.cicd.length > 0) { console.log(pc.cyan(' CI/CD: ') + result.cicd.join(', ')); }
-
Add tests in
tests/scanner.test.js:describe('CI/CD detection', () => { it('detects GitHub Actions', () => { const dir = createFixture('cicd-gha', { '.github/workflows/ci.yml': 'name: CI', }); const scan = scanRepo(dir); expect(scan.cicd).toContain('github-actions'); }); it('detects GitLab CI', () => { const dir = createFixture('cicd-gitlab', { '.gitlab-ci.yml': 'stages: [test]', }); const scan = scanRepo(dir); expect(scan.cicd).toContain('gitlab-ci'); }); it('returns empty for no CI/CD', () => { const dir = createFixture('cicd-none', { 'package.json': '{}', }); const scan = scanRepo(dir); expect(scan.cicd).toEqual([]); }); });
Files to change
src/lib/scanner.js— adddetectCICD(), call fromscanRepo()src/commands/scan.js— display CI/CD in outputtests/scanner.test.js— add tests
Acceptance criteria
-
npm testpasses -
aspens scanon a repo with.github/workflows/showsCI/CD: github-actions - At least 3 platforms tested (GitHub Actions, GitLab CI, and one other)