@rahul05ranjan/dhruv-cli 1.4.6 → 1.5.0

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 (76) hide show
  1. package/.github/workflows/ci.yml +18 -238
  2. package/.github/workflows/contribution.yml +6 -141
  3. package/.github/workflows/dependabot-auto-merge.yml +1 -0
  4. package/.github/workflows/labeler.yml +1 -0
  5. package/.github/workflows/security.yml +3 -0
  6. package/CHANGELOG.md +9 -4
  7. package/README.md +145 -40
  8. package/__tests__/cli-contract.test.ts +104 -0
  9. package/__tests__/core.test.ts +121 -0
  10. package/__tests__/diagnostics.test.ts +155 -0
  11. package/__tests__/file-workflows.test.ts +195 -0
  12. package/__tests__/interactive.test.ts +119 -0
  13. package/__tests__/setup.ts +1 -0
  14. package/__tests__/workflows.test.ts +27 -4
  15. package/dist/commands/generate.d.ts +6 -1
  16. package/dist/commands/generate.js +18 -4
  17. package/dist/commands/health.d.ts +4 -1
  18. package/dist/commands/health.js +59 -16
  19. package/dist/commands/init.js +11 -2
  20. package/dist/commands/menu.js +125 -100
  21. package/dist/commands/metrics.d.ts +5 -1
  22. package/dist/commands/metrics.js +37 -8
  23. package/dist/commands/optimize.js +1 -1
  24. package/dist/commands/review.d.ts +4 -1
  25. package/dist/commands/review.js +48 -8
  26. package/dist/commands/security-check.d.ts +4 -1
  27. package/dist/commands/security-check.js +67 -6
  28. package/dist/commands/status.js +40 -2
  29. package/dist/config/config.d.ts +5 -1
  30. package/dist/config/config.js +24 -7
  31. package/dist/core/ai.d.ts +11 -0
  32. package/dist/core/ai.js +33 -9
  33. package/dist/core/command-catalog.d.ts +10 -0
  34. package/dist/core/command-catalog.js +27 -0
  35. package/dist/core/command-runner.js +100 -21
  36. package/dist/core/logger.js +1 -0
  37. package/dist/core/metrics.d.ts +28 -0
  38. package/dist/core/metrics.js +78 -0
  39. package/dist/index.js +46 -24
  40. package/dist/utils/projectType.d.ts +1 -1
  41. package/dist/utils/projectType.js +26 -7
  42. package/docs/api/assets/highlight.css +4 -4
  43. package/docs/api/index.html +161 -39
  44. package/docs/api/media/CONTRIBUTING.md +60 -0
  45. package/docs/api/media/SECURITY.md +8 -0
  46. package/docs/api/media/dhruv-cli-preview.svg +42 -0
  47. package/docs/api/media/publishing-fix.md +34 -0
  48. package/docs/dhruv-cli-preview.svg +42 -0
  49. package/docs/index.html +631 -533
  50. package/docs/publishing-fix.md +34 -0
  51. package/package.json +1 -1
  52. package/src/commands/generate.ts +23 -4
  53. package/src/commands/health.ts +62 -17
  54. package/src/commands/init.ts +11 -2
  55. package/src/commands/menu.ts +54 -30
  56. package/src/commands/metrics.ts +42 -7
  57. package/src/commands/optimize.ts +1 -1
  58. package/src/commands/review.ts +53 -8
  59. package/src/commands/security-check.ts +80 -6
  60. package/src/commands/status.ts +39 -3
  61. package/src/config/config.ts +26 -7
  62. package/src/core/ai.ts +36 -8
  63. package/src/core/command-catalog.ts +37 -0
  64. package/src/core/command-runner.ts +102 -22
  65. package/src/core/logger.ts +1 -0
  66. package/src/core/metrics.ts +103 -0
  67. package/src/index.ts +45 -24
  68. package/src/utils/projectType.ts +22 -7
  69. package/tsconfig.json +1 -1
  70. package/.github/workflows/auto-assign.yml +0 -14
  71. package/.github/workflows/build-publish.yml +0 -154
  72. package/.github/workflows/deploy.yml +0 -336
  73. package/.github/workflows/monitoring.yml +0 -270
  74. package/PUBLISHING_FIX.md +0 -92
  75. package/logs/.8a99b6cf655346317fdbf29f4fffcf91131432f3-audit.json +0 -15
  76. package/logs/.eee104bf8fff5ecd38a6a2842df260de6470a7c3-audit.json +0 -15
@@ -1,336 +0,0 @@
1
- name: Deployment Pipeline
2
-
3
- on:
4
- release:
5
- types: [published]
6
- workflow_dispatch:
7
- inputs:
8
- environment:
9
- description: 'Deployment environment'
10
- required: true
11
- default: 'staging'
12
- type: choice
13
- options:
14
- - staging
15
- - production
16
- version:
17
- description: 'Version to deploy (leave empty for latest)'
18
- required: false
19
- type: string
20
-
21
- permissions:
22
- contents: read
23
- packages: write
24
- deployments: write
25
- id-token: write
26
-
27
- env:
28
- NODE_VERSION: '22.14.0'
29
- REGISTRY_URL: 'https://registry.npmjs.org'
30
-
31
- jobs:
32
- pre-deployment:
33
- name: Pre-deployment Checks
34
- runs-on: ubuntu-latest
35
- timeout-minutes: 15
36
- outputs:
37
- version: ${{ steps.version.outputs.version }}
38
- environment: ${{ steps.environment.outputs.environment }}
39
- steps:
40
- - name: Harden Runner
41
- uses: step-security/harden-runner@v2
42
- with:
43
- egress-policy: audit
44
-
45
- - uses: actions/checkout@v4
46
-
47
- - name: Determine version
48
- id: version
49
- run: |
50
- if [[ "${{ github.event_name }}" == "release" ]]; then
51
- VERSION="${{ github.event.release.tag_name }}"
52
- elif [[ -n "${{ github.event.inputs.version }}" ]]; then
53
- VERSION="${{ github.event.inputs.version }}"
54
- else
55
- VERSION=$(cat package.json | jq -r '.version')
56
- fi
57
- echo "version=${VERSION}" >> $GITHUB_OUTPUT
58
- echo "Deploying version: ${VERSION}"
59
-
60
- - name: Determine environment
61
- id: environment
62
- run: |
63
- if [[ "${{ github.event_name }}" == "release" ]]; then
64
- if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
65
- ENVIRONMENT="staging"
66
- else
67
- ENVIRONMENT="production"
68
- fi
69
- else
70
- ENVIRONMENT="${{ github.event.inputs.environment }}"
71
- fi
72
- echo "environment=${ENVIRONMENT}" >> $GITHUB_OUTPUT
73
- echo "Deploying to environment: ${ENVIRONMENT}"
74
-
75
- - name: Set up Node.js
76
- uses: actions/setup-node@v4
77
- with:
78
- node-version: ${{ env.NODE_VERSION }}
79
- cache: 'npm'
80
- registry-url: ${{ env.REGISTRY_URL }}
81
-
82
- - name: Install dependencies
83
- run: npm ci --prefer-offline --no-audit
84
-
85
- - name: Run comprehensive tests
86
- run: |
87
- npm run test:ci
88
- npm run lint
89
- npm run build
90
-
91
- - name: Security scan
92
- run: npm audit --audit-level=moderate
93
-
94
- - name: Package validation
95
- run: |
96
- npm pack --dry-run
97
- echo "Package size check..."
98
- npm pack
99
- ls -lah *.tgz
100
-
101
- deploy-staging:
102
- name: Deploy to Staging
103
- runs-on: ubuntu-latest
104
- needs: pre-deployment
105
- if: needs.pre-deployment.outputs.environment == 'staging' || (github.event_name == 'release' && github.event.release.prerelease)
106
- timeout-minutes: 20
107
- environment:
108
- name: staging
109
- url: https://staging.example.com
110
- steps:
111
- - name: Harden Runner
112
- uses: step-security/harden-runner@v2
113
- with:
114
- egress-policy: audit
115
-
116
- - uses: actions/checkout@v4
117
-
118
- - name: Set up Node.js
119
- uses: actions/setup-node@v4
120
- with:
121
- node-version: ${{ env.NODE_VERSION }}
122
- cache: 'npm'
123
- registry-url: ${{ env.REGISTRY_URL }}
124
-
125
- - name: Install dependencies
126
- run: npm ci --prefer-offline --no-audit
127
-
128
- - name: Install npm with trusted publishing support
129
- run: npm install --global npm@11.17.0
130
-
131
- - name: Build for staging
132
- run: |
133
- NODE_ENV=staging npm run build
134
- npm run docs
135
-
136
- - name: Deploy to staging NPM registry
137
- if: github.event_name == 'release' && github.event.release.prerelease
138
- # npm 11.5.1+ authenticates using the workflow's OIDC identity.
139
- run: npm publish --tag beta --access public --provenance
140
-
141
- - name: Deploy documentation to staging
142
- uses: peaceiris/actions-gh-pages@v4
143
- with:
144
- github_token: ${{ secrets.GITHUB_TOKEN }}
145
- publish_dir: ./docs
146
- publish_branch: gh-pages-staging
147
- destination_dir: staging
148
-
149
- - name: Staging health check
150
- run: |
151
- echo "Running staging health checks..."
152
- # Add your staging health check commands here
153
- curl -f https://staging.example.com/health || echo "Health check failed"
154
-
155
- - name: Notify staging deployment
156
- uses: 8398a7/action-slack@v3
157
- if: always()
158
- continue-on-error: true
159
- with:
160
- status: ${{ job.status }}
161
- channel: '#deployments'
162
- text: |
163
- 🚀 Staging Deployment ${{ job.status }}
164
-
165
- **Version:** ${{ needs.pre-deployment.outputs.version }}
166
- **Branch:** ${{ github.ref_name }}
167
- **Commit:** ${{ github.sha }}
168
- env:
169
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
170
-
171
- deploy-production:
172
- name: Deploy to Production
173
- runs-on: ubuntu-latest
174
- needs: [pre-deployment, deploy-staging]
175
- if: needs.pre-deployment.outputs.environment == 'production' && (github.event_name == 'release' && !github.event.release.prerelease)
176
- timeout-minutes: 30
177
- environment:
178
- name: production
179
- url: https://www.npmjs.com/package/dhruv-cli
180
- steps:
181
- - name: Harden Runner
182
- uses: step-security/harden-runner@v2
183
- with:
184
- egress-policy: audit
185
-
186
- - uses: actions/checkout@v4
187
-
188
- - name: Set up Node.js
189
- uses: actions/setup-node@v4
190
- with:
191
- node-version: ${{ env.NODE_VERSION }}
192
- cache: 'npm'
193
- registry-url: ${{ env.REGISTRY_URL }}
194
-
195
- - name: Install dependencies
196
- run: npm ci --prefer-offline --no-audit
197
-
198
- - name: Install npm with trusted publishing support
199
- run: npm install --global npm@11.17.0
200
-
201
- - name: Build for production
202
- run: |
203
- NODE_ENV=production npm run build
204
- npm run docs
205
-
206
- - name: Final production tests
207
- run: |
208
- npm run test:ci
209
- npm run lint
210
- npm audit --audit-level=moderate
211
-
212
- - name: Deploy to NPM
213
- # OIDC trusted publisher (no token: see staging step above).
214
- run: npm publish --access public --provenance
215
-
216
- - name: Deploy documentation to production
217
- uses: peaceiris/actions-gh-pages@v4
218
- with:
219
- github_token: ${{ secrets.GITHUB_TOKEN }}
220
- publish_dir: ./docs
221
- publish_branch: gh-pages
222
- enable_jekyll: false
223
-
224
- - name: Create deployment artifact
225
- run: |
226
- mkdir -p artifacts
227
- cp -r dist/* artifacts/
228
- cp package.json artifacts/
229
- cp README.md artifacts/
230
- tar -czf deployment-${{ needs.pre-deployment.outputs.version }}.tar.gz artifacts/
231
-
232
- - name: Upload deployment artifact
233
- uses: actions/upload-artifact@v4
234
- with:
235
- name: deployment-${{ needs.pre-deployment.outputs.version }}
236
- path: deployment-${{ needs.pre-deployment.outputs.version }}.tar.gz
237
- retention-days: 90
238
-
239
- - name: Production health check
240
- run: |
241
- echo "Waiting for NPM propagation..."
242
- sleep 60
243
-
244
- echo "Verifying NPM package..."
245
- npm view dhruv-cli version
246
-
247
- echo "Testing package installation..."
248
- npm install -g dhruv-cli@${{ needs.pre-deployment.outputs.version }}
249
- dhruv-cli --version
250
-
251
- - name: Update GitHub release
252
- uses: actions/github-script@v7
253
- with:
254
- script: |
255
- await github.rest.repos.updateRelease({
256
- owner: context.repo.owner,
257
- repo: context.repo.repo,
258
- release_id: ${{ github.event.release.id }},
259
- body: ${{ github.event.release.body }} + '\n\n---\n\n✅ **Successfully deployed to production**\n\n- 📦 NPM: https://www.npmjs.com/package/dhruv-cli\n- 📚 Documentation: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}\n- 🔍 Health Status: ✅ All systems operational'
260
- });
261
-
262
- - name: Notify production deployment
263
- uses: 8398a7/action-slack@v3
264
- if: always()
265
- continue-on-error: true
266
- with:
267
- status: ${{ job.status }}
268
- channel: '#releases'
269
- text: |
270
- 🎉 Production Deployment ${{ job.status }}
271
-
272
- **Version:** ${{ needs.pre-deployment.outputs.version }}
273
- **NPM:** https://www.npmjs.com/package/dhruv-cli
274
- **Docs:** https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
275
- **Release:** ${{ github.event.release.html_url }}
276
- env:
277
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
278
-
279
- rollback:
280
- name: Rollback Capability
281
- runs-on: ubuntu-latest
282
- if: failure() && (needs.deploy-staging.result == 'failure' || needs.deploy-production.result == 'failure')
283
- needs: [pre-deployment, deploy-staging, deploy-production]
284
- timeout-minutes: 10
285
- steps:
286
- - name: Harden Runner
287
- uses: step-security/harden-runner@v2
288
- with:
289
- egress-policy: audit
290
-
291
- - uses: actions/checkout@v4
292
-
293
- - name: Create rollback issue
294
- uses: actions/github-script@v7
295
- with:
296
- script: |
297
- const title = `🚨 Deployment Failure - Rollback Required`;
298
- const body = `
299
- ## Deployment Failure Alert
300
-
301
- A deployment has failed and may require rollback procedures.
302
-
303
- ### Failure Details
304
- - **Version:** ${{ needs.pre-deployment.outputs.version }}
305
- - **Environment:** ${{ needs.pre-deployment.outputs.environment }}
306
- - **Workflow:** ${{ github.workflow }}
307
- - **Run ID:** ${{ github.run_id }}
308
-
309
- ### Failed Jobs
310
- - Deploy Staging: ${{ needs.deploy-staging.result }}
311
- - Deploy Production: ${{ needs.deploy-production.result }}
312
-
313
- ### Immediate Actions Required
314
- - [ ] Assess impact of deployment failure
315
- - [ ] Determine if rollback is necessary
316
- - [ ] Execute rollback procedures if needed
317
- - [ ] Investigate root cause
318
- - [ ] Fix underlying issues
319
-
320
- ### Rollback Commands
321
- \`\`\`bash
322
- # If NPM package was published, deprecate if necessary
323
- npm deprecate dhruv-cli@${{ needs.pre-deployment.outputs.version }} "Deployment failed, please use previous version"
324
- \`\`\`
325
-
326
- **This issue was automatically created by the deployment pipeline.**
327
- `;
328
-
329
- await github.rest.issues.create({
330
- owner: context.repo.owner,
331
- repo: context.repo.repo,
332
- title: title,
333
- body: body,
334
- labels: ['deployment', 'urgent', 'rollback'],
335
- assignees: ['${{ github.repository_owner }}']
336
- });
@@ -1,270 +0,0 @@
1
- name: Monitoring & Health Check
2
-
3
- on:
4
- schedule:
5
- - cron: '0 0 * * *' # Daily at midnight UTC
6
- - cron: '0 12 * * *' # Daily at noon UTC
7
- workflow_dispatch:
8
- push:
9
- branches: [main]
10
- paths:
11
- - 'package.json'
12
- - 'src/**'
13
-
14
- permissions:
15
- contents: read
16
- issues: write
17
- security-events: write
18
-
19
- jobs:
20
- health-check:
21
- name: Application Health Check
22
- runs-on: ubuntu-latest
23
- timeout-minutes: 10
24
- steps:
25
- - name: Harden Runner
26
- uses: step-security/harden-runner@v2
27
- with:
28
- egress-policy: audit
29
-
30
- - uses: actions/checkout@v4
31
-
32
- - name: Set up Node.js
33
- uses: actions/setup-node@v4
34
- with:
35
- node-version: '20.8.1'
36
- cache: 'npm'
37
-
38
- - name: Install dependencies
39
- run: npm ci --prefer-offline --no-audit
40
-
41
- - name: Build application
42
- run: npm run build
43
-
44
- - name: Test CLI functionality
45
- run: |
46
- echo "Testing CLI help command"
47
- node dist/index.js --help || echo "CLI help failed"
48
-
49
- echo "Testing CLI version command"
50
- node dist/index.js --version || echo "CLI version failed"
51
-
52
- echo "Testing CLI status command"
53
- node dist/index.js status || echo "CLI status failed"
54
-
55
- - name: Performance benchmark
56
- run: |
57
- echo "Running performance tests..."
58
- time node dist/index.js --version
59
-
60
- # Memory usage check
61
- echo "Checking memory usage..."
62
- /usr/bin/time -v node dist/index.js --help 2>&1 | grep "Maximum resident set size" || echo "Memory check failed"
63
-
64
- - name: Check bundle size
65
- run: |
66
- echo "Checking bundle sizes..."
67
- du -h dist/ | sort -hr
68
-
69
- # Check if any bundle exceeds size limits
70
- find dist/ -name "*.js" -size +1M -exec echo "WARNING: Large bundle found: {}" \;
71
-
72
- dependency-security:
73
- name: Dependency Security Scan
74
- runs-on: ubuntu-latest
75
- timeout-minutes: 15
76
- steps:
77
- - name: Harden Runner
78
- uses: step-security/harden-runner@v2
79
- with:
80
- egress-policy: audit
81
-
82
- - uses: actions/checkout@v4
83
-
84
- - name: Set up Node.js
85
- uses: actions/setup-node@v4
86
- with:
87
- node-version: '20.8.1'
88
- cache: 'npm'
89
-
90
- - name: Install dependencies
91
- run: npm ci --prefer-offline --no-audit
92
-
93
- - name: Run npm audit
94
- run: |
95
- echo "Running npm security audit..."
96
- npm audit --audit-level=moderate || echo "Audit found issues"
97
-
98
- - name: Check for known vulnerabilities
99
- uses: anchore/scan-action@v3
100
- continue-on-error: true
101
- with:
102
- path: "."
103
- fail-build: false
104
- output-format: sarif
105
-
106
- - name: Upload SARIF results
107
- if: always()
108
- uses: github/codeql-action/upload-sarif@v3
109
- continue-on-error: true
110
- with:
111
- sarif_file: results.sarif
112
-
113
- - name: License compliance check
114
- run: |
115
- echo "Checking license compliance..."
116
- npx license-checker --summary || echo "License checker not available"
117
-
118
- availability-monitor:
119
- name: Service Availability Monitor
120
- runs-on: ubuntu-latest
121
- timeout-minutes: 10
122
- if: github.event_name == 'schedule'
123
- steps:
124
- - name: Harden Runner
125
- uses: step-security/harden-runner@v2
126
- with:
127
- egress-policy: audit
128
-
129
- - name: Check NPM package availability
130
- run: |
131
- echo "Checking NPM package availability..."
132
- curl -f https://registry.npmjs.org/dhruv-cli || echo "NPM package check failed"
133
-
134
- - name: Check GitHub repository health
135
- run: |
136
- echo "Checking GitHub repository health..."
137
- curl -f https://api.github.com/repos/${{ github.repository }} || echo "GitHub API check failed"
138
-
139
- - name: Check documentation site
140
- run: |
141
- echo "Checking documentation availability..."
142
- curl -f https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/ || echo "Documentation site check failed"
143
-
144
- quality-metrics:
145
- name: Code Quality Metrics
146
- runs-on: ubuntu-latest
147
- timeout-minutes: 20
148
- steps:
149
- - name: Harden Runner
150
- uses: step-security/harden-runner@v2
151
- with:
152
- egress-policy: audit
153
-
154
- - uses: actions/checkout@v4
155
- with:
156
- fetch-depth: 0
157
-
158
- - name: Set up Node.js
159
- uses: actions/setup-node@v4
160
- with:
161
- node-version: '20.8.1'
162
- cache: 'npm'
163
-
164
- - name: Install dependencies
165
- run: npm ci --prefer-offline --no-audit
166
-
167
- - name: Run test coverage
168
- run: npm run test:ci
169
-
170
- - name: Upload coverage to Codecov
171
- uses: codecov/codecov-action@v4
172
- with:
173
- file: ./coverage/lcov.info
174
- flags: unittests
175
- name: codecov-umbrella
176
- fail_ci_if_error: false
177
-
178
- - name: Code complexity analysis
179
- run: |
180
- echo "Running code complexity analysis..."
181
- npx complexity-report src/ --format json > complexity.json || echo "Complexity analysis failed"
182
- cat complexity.json | jq '.reports[] | select(.complexity.cyclomatic > 10)' || echo "No high complexity functions found"
183
-
184
- - name: Technical debt analysis
185
- run: |
186
- echo "Analyzing technical debt..."
187
- # Count TODO/FIXME comments
188
- find src/ -name "*.ts" -exec grep -c "TODO\|FIXME\|HACK" {} + | awk -F: '{sum+=$2} END {print "Technical debt items:", sum}'
189
-
190
- # Check for code smells
191
- find src/ -name "*.ts" -exec wc -l {} + | sort -nr | head -10
192
-
193
- create-issue-on-failure:
194
- name: Create Issue on Failure
195
- runs-on: ubuntu-latest
196
- needs: [health-check, dependency-security, availability-monitor, quality-metrics]
197
- if: always() && (needs.health-check.result == 'failure' || needs.dependency-security.result == 'failure' || needs.availability-monitor.result == 'failure' || needs.quality-metrics.result == 'failure')
198
- timeout-minutes: 5
199
- steps:
200
- - name: Harden Runner
201
- uses: step-security/harden-runner@v2
202
- with:
203
- egress-policy: audit
204
-
205
- - uses: actions/checkout@v4
206
-
207
- - name: Create failure issue
208
- uses: actions/github-script@v7
209
- with:
210
- script: |
211
- const title = `🚨 Monitoring Alert: Workflow Failure Detected`;
212
- const body = `
213
- ## Monitoring Alert
214
-
215
- A monitoring workflow has failed. Please investigate immediately.
216
-
217
- ### Failure Details
218
- - **Workflow**: ${{ github.workflow }}
219
- - **Run ID**: ${{ github.run_id }}
220
- - **Commit**: ${{ github.sha }}
221
- - **Trigger**: ${{ github.event_name }}
222
- - **Time**: ${new Date().toISOString()}
223
-
224
- ### Job Results
225
- - Health Check: ${{ needs.health-check.result }}
226
- - Dependency Security: ${{ needs.dependency-security.result }}
227
- - Availability Monitor: ${{ needs.availability-monitor.result }}
228
- - Quality Metrics: ${{ needs.quality-metrics.result }}
229
-
230
- ### Action Required
231
- - [ ] Check workflow logs: [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
232
- - [ ] Investigate failures
233
- - [ ] Fix underlying issues
234
- - [ ] Verify fixes work
235
- - [ ] Close this issue when resolved
236
-
237
- **This issue was automatically created by the monitoring workflow.**
238
- `;
239
-
240
- // Check if similar issue already exists
241
- const issues = await github.rest.issues.listForRepo({
242
- owner: context.repo.owner,
243
- repo: context.repo.repo,
244
- labels: ['monitoring', 'automated'],
245
- state: 'open'
246
- });
247
-
248
- const existingIssue = issues.data.find(issue =>
249
- issue.title.includes('Monitoring Alert') &&
250
- issue.body.includes('${{ github.run_id }}')
251
- );
252
-
253
- if (!existingIssue) {
254
- await github.rest.issues.create({
255
- owner: context.repo.owner,
256
- repo: context.repo.repo,
257
- title: title,
258
- body: body,
259
- labels: ['bug', 'monitoring', 'automated', 'urgent'],
260
- assignees: ['${{ github.repository_owner }}']
261
- });
262
- }
263
-
264
- - name: Send failure notification
265
- if: always() && (needs.health-check.result == 'failure' || needs.dependency-security.result == 'failure' || needs.availability-monitor.result == 'failure' || needs.quality-metrics.result == 'failure')
266
- uses: actions/github-script@v7
267
- with:
268
- script: |
269
- console.log('Failure notification system activated');
270
- // Additional notification logic can be added here
package/PUBLISHING_FIX.md DELETED
@@ -1,92 +0,0 @@
1
- # 🔧 NPM Publishing Issue Resolution
2
-
3
- ## Issue Description
4
- The GitHub Actions workflow was failing with:
5
- ```
6
- npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/@rahul05ranjan%2fdhruv-cli - You cannot publish over the previously published versions: 0.0.0-development.
7
- ```
8
-
9
- ## Root Cause
10
- The package.json had version `0.0.0-development` which already exists on NPM and cannot be republished.
11
-
12
- ## Solution Applied
13
-
14
- ### 1. ✅ Updated Package Version
15
- - Changed version from `0.0.0-development` to `1.4.0` (next logical version after `1.3.0`)
16
- - This avoids the conflict with existing published versions
17
-
18
- ### 2. ✅ Added Semantic Release Configuration
19
- - Created `.releaserc.json` with proper semantic-release configuration
20
- - Added support for conventional commits and automated versioning
21
- - Installed required semantic-release plugins
22
-
23
- ### 3. ✅ Improved CI/CD Workflows
24
- - **Modified `ci.yml`**: Removed direct npm publish to avoid conflicts
25
- - **Updated `release.yml`**: Enhanced with semantic-release support
26
- - **Created `build-publish.yml`**: New dedicated publishing workflow with version conflict detection
27
-
28
- ### 4. ✅ Version Conflict Prevention
29
- The new `build-publish.yml` workflow includes:
30
- - Automatic version conflict detection
31
- - Smart version bumping based on commit messages
32
- - Support for manual version bumping
33
- - Proper Git tagging and GitHub releases
34
-
35
- ## Current Status
36
- - ✅ Package version: `1.4.0` (ready for publishing)
37
- - ✅ Dry run successful: Package can be published without conflicts
38
- - ✅ All tests passing
39
- - ✅ Build successful
40
- - ✅ Linting clean
41
- - ✅ Documentation generated
42
-
43
- ## Published Versions on NPM
44
- ```json
45
- [
46
- "0.0.0-development",
47
- "1.0.0", "1.0.1", "1.1.0", "1.1.1",
48
- "1.1.2", "1.1.3", "1.1.4", "1.1.5",
49
- "1.1.6", "1.2.0", "1.2.1", "1.2.2",
50
- "1.2.3", "1.2.4", "1.3.0"
51
- ]
52
- ```
53
-
54
- ## Next Steps
55
- 1. **For immediate fix**: The package is ready to publish as version `1.4.0`
56
- 2. **For future releases**: Use the new `build-publish.yml` workflow
57
- 3. **For semantic releases**: Commit messages should follow conventional commits format
58
-
59
- ## Workflow Recommendations
60
-
61
- ### For Hotfixes/Patches
62
- ```bash
63
- # Commit with conventional format
64
- git commit -m "fix: resolve critical issue"
65
- # This will trigger a patch release (1.4.1)
66
- ```
67
-
68
- ### For Features
69
- ```bash
70
- # Commit with conventional format
71
- git commit -m "feat: add new functionality"
72
- # This will trigger a minor release (1.5.0)
73
- ```
74
-
75
- ### For Breaking Changes
76
- ```bash
77
- # Commit with breaking change notation
78
- git commit -m "feat!: major API changes
79
-
80
- BREAKING CHANGE: This changes the API structure"
81
- # This will trigger a major release (2.0.0)
82
- ```
83
-
84
- ## Files Modified
85
- - ✅ `package.json` - Updated version to 1.4.0
86
- - ✅ `.releaserc.json` - Added semantic-release configuration
87
- - ✅ `.github/workflows/ci.yml` - Removed direct publishing
88
- - ✅ `.github/workflows/release.yml` - Enhanced with semantic-release
89
- - ✅ `.github/workflows/build-publish.yml` - New intelligent publishing workflow
90
- - ✅ `package.json` - Added semantic-release dependencies
91
-
92
- The publishing issue is now resolved! 🎉