@rahul05ranjan/dhruv-cli 1.3.0 → 1.4.6

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.
Files changed (103) hide show
  1. package/.github/ENTERPRISE.md +275 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +45 -17
  3. package/.github/ISSUE_TEMPLATE/documentation_issue.md +61 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.md +61 -9
  5. package/.github/ISSUE_TEMPLATE/security_vulnerability.md +74 -0
  6. package/.github/dependabot.yml +42 -2
  7. package/.github/pull_request_template.md +13 -0
  8. package/.github/workflows/build-publish.yml +154 -0
  9. package/.github/workflows/ci.yml +251 -18
  10. package/.github/workflows/contribution.yml +169 -27
  11. package/.github/workflows/dependabot-auto-merge.yml +61 -2
  12. package/.github/workflows/deploy.yml +336 -0
  13. package/.github/workflows/monitoring.yml +270 -0
  14. package/.github/workflows/release.yml +229 -0
  15. package/.github/workflows/security.yml +198 -0
  16. package/.releaserc.json +50 -0
  17. package/AGENTS.md +13 -0
  18. package/CHANGELOG.md +8 -0
  19. package/PUBLISHING_FIX.md +92 -0
  20. package/__tests__/core.test.ts +318 -0
  21. package/__tests__/setup.ts +61 -0
  22. package/__tests__/workflows.test.ts +95 -0
  23. package/dist/commands/explain.js +13 -44
  24. package/dist/commands/fix.js +13 -38
  25. package/dist/commands/generate.js +45 -54
  26. package/dist/commands/health.d.ts +1 -0
  27. package/dist/commands/health.js +376 -0
  28. package/dist/commands/init.js +47 -42
  29. package/dist/commands/menu.js +90 -2
  30. package/dist/commands/metrics.d.ts +1 -0
  31. package/dist/commands/metrics.js +51 -0
  32. package/dist/commands/optimize.js +42 -34
  33. package/dist/commands/review.js +52 -48
  34. package/dist/commands/security-check.js +52 -42
  35. package/dist/commands/status.d.ts +1 -0
  36. package/dist/commands/status.js +45 -0
  37. package/dist/commands/suggest.js +13 -39
  38. package/dist/config/config.js +30 -2
  39. package/dist/core/ai.d.ts +77 -2
  40. package/dist/core/ai.js +207 -30
  41. package/dist/core/command-runner.d.ts +17 -0
  42. package/dist/core/command-runner.js +78 -0
  43. package/dist/core/logger.d.ts +40 -0
  44. package/dist/core/logger.js +138 -0
  45. package/dist/core/metrics.d.ts +34 -0
  46. package/dist/core/metrics.js +206 -0
  47. package/dist/core/prompts.d.ts +1 -0
  48. package/dist/core/prompts.js +121 -0
  49. package/dist/core/security.d.ts +34 -0
  50. package/dist/core/security.js +197 -0
  51. package/dist/index.js +43 -3
  52. package/dist/utils/ux.d.ts +3 -0
  53. package/dist/utils/ux.js +15 -0
  54. package/docs/agents/domain.md +51 -0
  55. package/docs/agents/issue-tracker.md +45 -0
  56. package/docs/agents/triage-labels.md +15 -0
  57. package/docs/api/.nojekyll +1 -0
  58. package/docs/api/assets/hierarchy.js +1 -0
  59. package/docs/api/assets/highlight.css +71 -0
  60. package/docs/api/assets/icons.js +18 -0
  61. package/docs/api/assets/icons.svg +1 -0
  62. package/docs/api/assets/main.js +60 -0
  63. package/docs/api/assets/navigation.js +1 -0
  64. package/docs/api/assets/search.js +1 -0
  65. package/docs/api/assets/style.css +1633 -0
  66. package/docs/api/hierarchy.html +1 -0
  67. package/docs/api/index.html +39 -0
  68. package/docs/api/modules.html +1 -0
  69. package/eslint.config.js +170 -0
  70. package/jest.config.json +37 -0
  71. package/lighthouserc.json +22 -0
  72. package/logs/.8a99b6cf655346317fdbf29f4fffcf91131432f3-audit.json +15 -0
  73. package/logs/.eee104bf8fff5ecd38a6a2842df260de6470a7c3-audit.json +15 -0
  74. package/package.json +62 -8
  75. package/src/commands/explain.ts +13 -42
  76. package/src/commands/fix.ts +13 -31
  77. package/src/commands/generate.ts +47 -46
  78. package/src/commands/health.ts +440 -0
  79. package/src/commands/init.ts +48 -42
  80. package/src/commands/menu.ts +86 -2
  81. package/src/commands/metrics.ts +65 -0
  82. package/src/commands/optimize.ts +40 -28
  83. package/src/commands/review.ts +54 -40
  84. package/src/commands/security-check.ts +54 -34
  85. package/src/commands/status.ts +47 -0
  86. package/src/commands/suggest.ts +13 -32
  87. package/src/config/config.ts +35 -2
  88. package/src/core/ai.ts +237 -26
  89. package/src/core/command-runner.ts +105 -0
  90. package/src/core/logger.ts +194 -0
  91. package/src/core/metrics.ts +232 -0
  92. package/src/core/prompts.ts +128 -0
  93. package/src/core/security.ts +243 -0
  94. package/src/index.ts +50 -3
  95. package/src/utils/ux.ts +18 -0
  96. package/test-suite.sh +147 -0
  97. package/tsconfig.json +3 -2
  98. package/typedoc.json +44 -0
  99. package/types/global.d.ts +13 -0
  100. package/validate-workflows.sh +270 -0
  101. package/.eslintignore +0 -1
  102. package/.eslintrc.cjs +0 -43
  103. package/src/core/ai.test.js +0 -40
@@ -0,0 +1,154 @@
1
+ name: Build & Publish
2
+
3
+ on:
4
+ # Automatic main releases are owned by release.yml.
5
+ workflow_dispatch:
6
+ inputs:
7
+ version_type:
8
+ description: 'Version bump type'
9
+ required: true
10
+ default: 'patch'
11
+ type: choice
12
+ options:
13
+ - patch
14
+ - minor
15
+ - major
16
+ - prerelease
17
+
18
+ permissions:
19
+ contents: write
20
+ packages: write
21
+ id-token: write
22
+
23
+ jobs:
24
+ build-and-publish:
25
+ name: Build and Publish
26
+ runs-on: ubuntu-latest
27
+ timeout-minutes: 20
28
+ environment: npm-publish
29
+ steps:
30
+ - name: Harden Runner
31
+ uses: step-security/harden-runner@v2
32
+ with:
33
+ egress-policy: audit
34
+
35
+ - uses: actions/checkout@v4
36
+ with:
37
+ fetch-depth: 0
38
+ token: ${{ secrets.GITHUB_TOKEN }}
39
+
40
+ - name: Set up Node.js
41
+ uses: actions/setup-node@v4
42
+ with:
43
+ node-version: '22.14.0'
44
+ cache: 'npm'
45
+ registry-url: 'https://registry.npmjs.org'
46
+
47
+ - name: Install npm with trusted publishing support
48
+ run: npm install --global npm@11.17.0
49
+
50
+ - name: Install dependencies
51
+ run: npm ci --prefer-offline --no-audit
52
+
53
+ - name: Run tests
54
+ run: npm run test:ci
55
+
56
+ - name: Run linting
57
+ run: npm run lint
58
+
59
+ - name: Build project
60
+ run: npm run build
61
+
62
+ - name: Generate documentation
63
+ run: npm run docs
64
+
65
+ - name: Configure Git
66
+ run: |
67
+ git config --global user.name "GitHub Actions"
68
+ git config --global user.email "actions@github.com"
69
+
70
+ - name: Check if version needs update
71
+ id: check_version
72
+ run: |
73
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
74
+ echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
75
+
76
+ # Check if this version exists on NPM
77
+ if npm view @rahul05ranjan/dhruv-cli@$CURRENT_VERSION version 2>/dev/null; then
78
+ echo "needs_version_bump=true" >> $GITHUB_OUTPUT
79
+ echo "Version $CURRENT_VERSION already exists on NPM, needs bump"
80
+ else
81
+ echo "needs_version_bump=false" >> $GITHUB_OUTPUT
82
+ echo "Version $CURRENT_VERSION is new, can publish"
83
+ fi
84
+
85
+ - name: Manual version bump
86
+ if: github.event_name == 'workflow_dispatch'
87
+ run: |
88
+ npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
89
+ git add package.json package-lock.json
90
+ git commit -m "chore: bump version to $(node -p "require('./package.json').version") [skip ci]"
91
+ git push
92
+
93
+ - name: Get final version
94
+ id: final_version
95
+ run: |
96
+ VERSION=$(node -p "require('./package.json').version")
97
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
98
+ echo "Final version to publish: $VERSION"
99
+
100
+ - name: Create Git tag
101
+ run: |
102
+ TAG="v${{ steps.final_version.outputs.version }}"
103
+ if git rev-parse "$TAG" >/dev/null 2>&1; then
104
+ echo "Tag $TAG already exists, skipping tag creation"
105
+ else
106
+ git tag "$TAG"
107
+ git push origin "$TAG"
108
+ fi
109
+
110
+ - name: Publish to NPM
111
+ # npm 11.5.1+ uses the workflow's OIDC identity without a stored token.
112
+ run: |
113
+ echo "Publishing version ${{ steps.final_version.outputs.version }}"
114
+ npm publish --access public --tag latest --provenance
115
+
116
+ - name: Create GitHub Release
117
+ uses: softprops/action-gh-release@v2
118
+ with:
119
+ tag_name: v${{ steps.final_version.outputs.version }}
120
+ name: Release v${{ steps.final_version.outputs.version }}
121
+ body: |
122
+ ## What's Changed
123
+
124
+ Version ${{ steps.final_version.outputs.version }} of dhruv-cli
125
+
126
+ ### Installation
127
+ ```bash
128
+ npm install -g @rahul05ranjan/dhruv-cli@${{ steps.final_version.outputs.version }}
129
+ ```
130
+
131
+ **Full Changelog**: https://github.com/${{ github.repository }}/compare/v${{ steps.check_version.outputs.current_version }}...v${{ steps.final_version.outputs.version }}
132
+ files: |
133
+ dist/**
134
+ docs/api/**
135
+ draft: false
136
+ prerelease: false
137
+ env:
138
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139
+
140
+ - name: Update documentation
141
+ uses: peaceiris/actions-gh-pages@v4
142
+ with:
143
+ github_token: ${{ secrets.GITHUB_TOKEN }}
144
+ publish_dir: ./docs/api
145
+ publish_branch: gh-pages
146
+ enable_jekyll: false
147
+
148
+ - name: Notify success
149
+ if: success()
150
+ run: |
151
+ echo "✅ Successfully published @rahul05ranjan/dhruv-cli@${{ steps.final_version.outputs.version }}"
152
+ echo "📦 NPM: https://www.npmjs.com/package/@rahul05ranjan/dhruv-cli"
153
+ echo "📖 Documentation: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
154
+ echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/v${{ steps.final_version.outputs.version }}"
@@ -2,42 +2,268 @@ name: Dhruv CLI CI/CD
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [ main ]
5
+ branches: [ main, develop ]
6
6
  pull_request:
7
- branches: [ main ]
7
+ branches: [ main, develop ]
8
+ schedule:
9
+ - cron: '0 2 * * 1' # Weekly security scans
10
+
11
+ env:
12
+ NODE_VERSION: '22.14.0'
13
+ NODE_VERSION_MATRIX: '[18.x, 20.x, 21.x]'
8
14
 
9
15
  permissions:
10
16
  contents: write
17
+ security-events: write
18
+ actions: read
19
+ pull-requests: write
20
+ id-token: write
21
+ checks: write
11
22
 
12
23
  jobs:
24
+ security:
25
+ name: Security Scan
26
+ runs-on: ubuntu-latest
27
+ timeout-minutes: 15
28
+ steps:
29
+ - name: Harden Runner
30
+ uses: step-security/harden-runner@v2
31
+ with:
32
+ egress-policy: audit
33
+
34
+ - uses: actions/checkout@v4
35
+ with:
36
+ fetch-depth: 0 # Full history for better security scanning
37
+
38
+ - name: Set up Node.js
39
+ uses: actions/setup-node@v4
40
+ with:
41
+ node-version: ${{ env.NODE_VERSION }}
42
+ cache: 'npm'
43
+
44
+ - name: Install dependencies
45
+ run: npm ci --prefer-offline --no-audit
46
+
47
+ - name: Run security audit
48
+ run: npm audit --audit-level=moderate
49
+ continue-on-error: true
50
+
51
+ - name: Run Semgrep Security Scan
52
+ uses: semgrep/semgrep-action@v1
53
+ with:
54
+ config: auto
55
+ env:
56
+ SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
57
+ continue-on-error: true
58
+
59
+ - name: Run Trivy vulnerability scanner
60
+ uses: aquasecurity/trivy-action@master
61
+ with:
62
+ scan-type: 'fs'
63
+ scan-ref: '.'
64
+ format: 'sarif'
65
+ output: 'trivy-results.sarif'
66
+ severity: 'CRITICAL,HIGH,MEDIUM'
67
+
68
+ - name: Upload Trivy scan results to GitHub Security tab
69
+ uses: github/codeql-action/upload-sarif@v3
70
+ if: always()
71
+ with:
72
+ sarif_file: 'trivy-results.sarif'
73
+
74
+ - name: Run CodeQL Analysis
75
+ uses: github/codeql-action/init@v3
76
+ with:
77
+ languages: javascript
78
+ queries: security-and-quality
79
+
80
+ - name: Perform CodeQL Analysis
81
+ uses: github/codeql-action/analyze@v3
82
+ with:
83
+ category: "/language:javascript"
84
+
85
+ test:
86
+ name: Test Suite
87
+ runs-on: ubuntu-latest
88
+ timeout-minutes: 20
89
+ strategy:
90
+ fail-fast: false
91
+ matrix:
92
+ node-version: [18.x, 20.x, 21.x]
93
+ os: [ubuntu-latest, windows-latest, macos-latest]
94
+ include:
95
+ - node-version: 20.x
96
+ coverage: true
97
+ exclude:
98
+ - os: windows-latest
99
+ node-version: 18.x
100
+ - os: macos-latest
101
+ node-version: 18.x
102
+ steps:
103
+ - name: Harden Runner
104
+ uses: step-security/harden-runner@v2
105
+ with:
106
+ egress-policy: audit
107
+
108
+ - uses: actions/checkout@v4
109
+ with:
110
+ fetch-depth: 0
111
+
112
+ - name: Set up Node.js ${{ matrix.node-version }}
113
+ uses: actions/setup-node@v4
114
+ with:
115
+ node-version: ${{ matrix.node-version }}
116
+ cache: 'npm'
117
+
118
+ - name: Install dependencies
119
+ run: npm ci --prefer-offline --no-audit
120
+
121
+ - name: Run linter
122
+ run: npm run lint
123
+
124
+ - name: Type checking
125
+ run: npm run type-check
126
+
127
+ - name: Build project
128
+ run: npm run build
129
+
130
+ - name: Run unit tests
131
+ run: npm run test:ci
132
+ env:
133
+ CI: true
134
+
135
+ - name: Generate coverage report
136
+ if: matrix.coverage
137
+ run: npm run test:coverage
138
+
139
+ - name: Upload coverage to Codecov
140
+ if: matrix.coverage
141
+ uses: codecov/codecov-action@v4
142
+ with:
143
+ file: ./coverage/lcov.info
144
+ flags: unittests
145
+ name: codecov-${{ matrix.node-version }}
146
+ fail_ci_if_error: false
147
+ token: ${{ secrets.CODECOV_TOKEN }}
148
+
149
+ - name: Upload test results
150
+ uses: dorny/test-reporter@v1
151
+ if: always()
152
+ continue-on-error: true
153
+ with:
154
+ name: Test Results (${{ matrix.node-version }})
155
+ path: coverage/junit.xml
156
+ reporter: jest-junit
157
+ fail-on-error: false
158
+
159
+ performance:
160
+ name: Performance Testing
161
+ runs-on: ubuntu-latest
162
+ timeout-minutes: 15
163
+ if: github.event_name == 'push' || github.event.pull_request.draft == false
164
+ steps:
165
+ - name: Harden Runner
166
+ uses: step-security/harden-runner@v2
167
+ with:
168
+ egress-policy: audit
169
+
170
+ - uses: actions/checkout@v4
171
+
172
+ - name: Set up Node.js
173
+ uses: actions/setup-node@v4
174
+ with:
175
+ node-version: ${{ env.NODE_VERSION }}
176
+ cache: 'npm'
177
+
178
+ - name: Install dependencies
179
+ run: npm ci --prefer-offline --no-audit
180
+
181
+ - name: Build project
182
+ run: npm run build
183
+
184
+ - name: Run Lighthouse CI
185
+ run: |
186
+ npm install -g @lhci/cli
187
+ lhci autorun --config=lighthouserc.json || echo "Lighthouse CI completed with warnings"
188
+ continue-on-error: true
189
+
190
+ - name: Performance benchmark
191
+ run: |
192
+ npm install -g autocannon
193
+ npm run benchmark || echo "Benchmark completed"
194
+ continue-on-error: true
195
+
196
+ - name: Bundle size analysis
197
+ run: |
198
+ npm install -g bundlesize
199
+ bundlesize || echo "Bundle size check completed"
200
+ continue-on-error: true
201
+
13
202
  build:
203
+ name: Build & Publish
14
204
  runs-on: ubuntu-latest
205
+ timeout-minutes: 15
206
+ needs: [security, test, performance]
207
+ if: always() && (needs.security.result == 'success' && needs.test.result == 'success')
208
+ environment:
209
+ name: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
15
210
  steps:
211
+ - name: Harden Runner
212
+ uses: step-security/harden-runner@v2
213
+ with:
214
+ egress-policy: audit
215
+
16
216
  - uses: actions/checkout@v4
217
+ with:
218
+ fetch-depth: 0
219
+ token: ${{ secrets.GITHUB_TOKEN }}
220
+
17
221
  - name: Set up Node.js
18
222
  uses: actions/setup-node@v4
19
223
  with:
20
- node-version: '20.8.1'
224
+ node-version: ${{ env.NODE_VERSION }}
225
+ cache: 'npm'
226
+ registry-url: 'https://registry.npmjs.org'
227
+
21
228
  - name: Install dependencies
22
- run: npm ci
229
+ run: npm ci --prefer-offline --no-audit
230
+
23
231
  - name: Lint
24
- run: npx eslint .
232
+ run: npm run lint
233
+
25
234
  - name: Build
26
235
  run: npm run build
27
- - name: Test
28
- run: npm test || echo "No tests yet"
236
+
237
+ - name: Generate API documentation
238
+ run: npm run docs
239
+
240
+ - name: Run security checks on build
241
+ run: |
242
+ npx audit-ci --config audit-ci.json || echo "Security check completed with warnings"
243
+ continue-on-error: true
244
+
245
+ - name: Upload build artifacts
246
+ uses: actions/upload-artifact@v4
247
+ with:
248
+ name: build-artifacts
249
+ path: |
250
+ dist/
251
+ docs/
252
+ retention-days: 30
253
+
29
254
  - name: Upload docs to GitHub Pages
30
- if: github.ref == 'refs/heads/main'
255
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
31
256
  uses: peaceiris/actions-gh-pages@v4
32
257
  with:
33
258
  github_token: ${{ secrets.GITHUB_TOKEN }}
34
259
  publish_dir: ./docs
35
260
  publish_branch: gh-pages
36
- - name: Publish to npm
37
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
38
- run: |
39
- npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
40
- npm publish --access public
261
+ enable_jekyll: false
262
+
263
+ - name: Publish package (Dry Run)
264
+ if: github.event_name == 'pull_request'
265
+ run: npm publish --dry-run
266
+
41
267
  - name: Create GitHub Release
42
268
  if: startsWith(github.ref, 'refs/tags/v')
43
269
  uses: softprops/action-gh-release@v2
@@ -45,9 +271,16 @@ jobs:
45
271
  files: |
46
272
  dist/**
47
273
  docs/**
48
- - name: Release (semantic-release)
49
- if: github.ref == 'refs/heads/main' && github.event_name == 'push'
274
+ generate_release_notes: true
275
+ draft: false
276
+ prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
277
+
278
+ - name: Notify deployment status
279
+ if: always() && github.ref == 'refs/heads/main'
280
+ uses: 8398a7/action-slack@v3
281
+ continue-on-error: true
282
+ with:
283
+ status: ${{ job.status }}
284
+ channel: '#deployments'
50
285
  env:
51
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
53
- run: npx semantic-release
286
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
@@ -1,51 +1,193 @@
1
- name: Community Contribution Checks
1
+ name: Pull Request Validation
2
2
 
3
3
  on:
4
4
  pull_request:
5
- types: [opened, synchronize, reopened]
5
+ types: [opened, synchronize, reopened, ready_for_review]
6
+
7
+ permissions:
8
+ contents: read
9
+ pull-requests: write
10
+ checks: write
6
11
 
7
12
  jobs:
8
- lint:
13
+ validate-pr:
14
+ name: PR Validation
15
+ runs-on: ubuntu-latest
16
+ timeout-minutes: 10
17
+ if: github.event.pull_request.draft == false
18
+ steps:
19
+ - name: Harden Runner
20
+ uses: step-security/harden-runner@v2
21
+ with:
22
+ egress-policy: audit
23
+
24
+ - uses: actions/checkout@v4
25
+ with:
26
+ fetch-depth: 0
27
+
28
+ - name: Validate PR title
29
+ uses: amannn/action-semantic-pull-request@v5
30
+ with:
31
+ types: |
32
+ feat
33
+ fix
34
+ docs
35
+ style
36
+ refactor
37
+ perf
38
+ test
39
+ build
40
+ ci
41
+ chore
42
+ revert
43
+ requireScope: false
44
+ disallowScopes: |
45
+ release
46
+ subjectPattern: ^(?![A-Z]).+$
47
+ subjectPatternError: |
48
+ The subject "{subject}" found in the pull request title "{title}"
49
+ didn't match the configured pattern. Please ensure that the subject
50
+ doesn't start with an uppercase character.
51
+ env:
52
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
+
54
+ - name: Check PR size
55
+ uses: pascalgn/size-label-action@v0.5.0
56
+ env:
57
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58
+ with:
59
+ sizes: >
60
+ {
61
+ "0": "XS",
62
+ "20": "S",
63
+ "50": "M",
64
+ "200": "L",
65
+ "800": "XL",
66
+ "2000": "XXL"
67
+ }
68
+
69
+ lint-and-test:
70
+ name: Quality Checks
9
71
  runs-on: ubuntu-latest
72
+ timeout-minutes: 15
73
+ if: github.event.pull_request.draft == false
10
74
  steps:
75
+ - name: Harden Runner
76
+ uses: step-security/harden-runner@v2
77
+ with:
78
+ egress-policy: audit
79
+
11
80
  - uses: actions/checkout@v4
81
+ with:
82
+ fetch-depth: 0
83
+
12
84
  - name: Set up Node.js
13
85
  uses: actions/setup-node@v4
14
86
  with:
15
- node-version: '18.x'
87
+ node-version: '20.8.1'
88
+ cache: 'npm'
89
+
16
90
  - name: Install dependencies
17
- run: npm ci
18
- - name: Lint
19
- run: npx eslint .
91
+ run: npm ci --prefer-offline --no-audit
92
+
93
+ - name: Run linter
94
+ run: npm run lint
95
+
96
+ - name: Type checking
97
+ run: npm run type-check
98
+
99
+ - name: Run tests
100
+ run: npm run test:ci
101
+ env:
102
+ CI: true
103
+
104
+ - name: Build project
105
+ run: npm run build
20
106
 
21
- test:
107
+ - name: Check for breaking changes
108
+ run: |
109
+ npm run build
110
+ git diff --exit-code dist/ || (echo "Build artifacts changed, please commit the changes" && exit 1)
111
+ continue-on-error: true
112
+
113
+ security-check:
114
+ name: Security Validation
22
115
  runs-on: ubuntu-latest
116
+ timeout-minutes: 10
117
+ if: github.event.pull_request.draft == false
23
118
  steps:
119
+ - name: Harden Runner
120
+ uses: step-security/harden-runner@v2
121
+ with:
122
+ egress-policy: audit
123
+
24
124
  - uses: actions/checkout@v4
125
+ with:
126
+ fetch-depth: 0
127
+
25
128
  - name: Set up Node.js
26
129
  uses: actions/setup-node@v4
27
130
  with:
28
- node-version: '18.x'
131
+ node-version: '20.8.1'
132
+ cache: 'npm'
133
+
29
134
  - name: Install dependencies
30
- run: npm ci
31
- - name: Run tests
32
- run: npm test || echo "No tests yet"
135
+ run: npm ci --prefer-offline --no-audit
136
+
137
+ - name: Run security audit
138
+ run: npm audit --audit-level=moderate
139
+ continue-on-error: true
140
+
141
+ - name: Scan for secrets
142
+ uses: trufflesecurity/trufflehog@main
143
+ with:
144
+ path: ./
145
+ base: ${{ github.event.repository.default_branch }}
146
+ head: HEAD
147
+ extra_args: --debug --only-verified
148
+ continue-on-error: true
33
149
 
34
- pr-title:
35
- if: github.event.pull_request.head.repo.full_name == github.repository
150
+ documentation:
151
+ name: Documentation Check
36
152
  runs-on: ubuntu-latest
153
+ timeout-minutes: 10
154
+ if: github.event.pull_request.draft == false
37
155
  steps:
38
- - uses: amannn/action-semantic-pull-request@v5
156
+ - name: Harden Runner
157
+ uses: step-security/harden-runner@v2
39
158
  with:
40
- types: |
41
- feat
42
- fix
43
- chore
44
- docs
45
- refactor
46
- style
47
- test
48
- ci
49
- githubBaseUrl: https://api.github.com
50
- env:
51
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
159
+ egress-policy: audit
160
+
161
+ - uses: actions/checkout@v4
162
+
163
+ - name: Set up Node.js
164
+ uses: actions/setup-node@v4
165
+ with:
166
+ node-version: '20.8.1'
167
+ cache: 'npm'
168
+
169
+ - name: Install dependencies
170
+ run: npm ci --prefer-offline --no-audit
171
+
172
+ - name: Generate documentation
173
+ run: npm run docs
174
+
175
+ - name: Check for documentation changes
176
+ run: |
177
+ if git diff --quiet HEAD^ HEAD -- '*.md' 'docs/' ; then
178
+ echo "No documentation changes detected"
179
+ else
180
+ echo "Documentation changes detected"
181
+ fi
182
+
183
+ auto-assign:
184
+ name: Auto Assignment
185
+ runs-on: ubuntu-latest
186
+ timeout-minutes: 5
187
+ if: github.event.action == 'opened'
188
+ steps:
189
+ - name: Auto assign PR
190
+ uses: kentaro-m/auto-assign-action@v1.2.6
191
+ with:
192
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
193
+ configuration-path: .github/auto_assign.yml