cursor-devops-commands 1.0.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.
@@ -0,0 +1,215 @@
1
+ ---
2
+ description: Analyze impact of reverting a PR - dependency chains, downstream effects
3
+ category: Ops & Monitoring
4
+ aliases: [rollback, revert-impact, undo-impact]
5
+ ---
6
+
7
+ # Rollback Impact - Simulate Revert Risk and Dependencies
8
+
9
+ Analyze the impact of reverting a PR, including dependency chains and downstream effects.
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ /rollback-impact {PR_NUMBER}
15
+ /rollback-impact {COMMIT_SHA}
16
+ /rollback-impact {PR_NUMBER} --simulate # Dry run
17
+ ```
18
+
19
+ ## What This Does
20
+
21
+ 1. **Identifies all changes** - Files, exports, types modified
22
+ 2. **Traces dependencies** - What depends on changed code
23
+ 3. **Simulates revert** - Tests if revert would compile
24
+ 4. **Estimates blast radius** - Apps, teams, features affected
25
+ 5. **Recommends action** - Safe rollback vs. fix-forward
26
+
27
+ ## Dependency Analysis
28
+
29
+ ```
30
+ ┌─────────────────────────────────────────────────────────────┐
31
+ │ DEPENDENCY CHAIN ANALYSIS │
32
+ ├─────────────────────────────────────────────────────────────┤
33
+ │ │
34
+ │ PR #23043 (LineItems.tsx) │
35
+ │ ↓ │
36
+ │ ProtectionPackageCard.tsx (imports TooltipTitle) │
37
+ │ ↓ │
38
+ │ FLFPackagesV2.tsx (uses ProtectionPackageCard) │
39
+ │ ↓ │
40
+ │ CoverageAndAddOns/index.tsx (exports FLFPackagesV2) │
41
+ │ ↓ │
42
+ │ rent-checkout app (renders CoverageAndAddOns) │
43
+ │ │
44
+ │ BLAST RADIUS: 1 app, 4 components, 1 team │
45
+ └─────────────────────────────────────────────────────────────┘
46
+ ```
47
+
48
+ ## Risk Assessment Matrix
49
+
50
+ | Risk Factor | Weight | Description |
51
+ | ----------------------- | -------- | --------------------------- |
52
+ | **Type changes** | High | Breaking type modifications |
53
+ | **Export changes** | High | New/removed exports |
54
+ | **API changes** | Critical | External contract changes |
55
+ | **Database migrations** | Critical | Data model changes |
56
+ | **Feature flag deps** | Medium | Flag-dependent code |
57
+ | **Style changes** | Low | CSS/styled changes only |
58
+
59
+ ## Output Format
60
+
61
+ ````
62
+ 📋 Analyzing rollback impact for PR #23043...
63
+
64
+ ════════════════════════════════════════════════════════════════
65
+ PR SUMMARY
66
+ ════════════════════════════════════════════════════════════════
67
+
68
+ PR: #23043 - [TICKET-123] Marketing texts for protection
69
+ Author: SharathChandraSIXT
70
+ Merged: 2024-12-23 15:30:00 UTC
71
+ Commits: 3
72
+
73
+ Files Changed:
74
+ - src/components/src/.../LineItems.tsx
75
+ - src/components/src/.../ProtectionPackageCard.styled.ts
76
+ - src/components/src/.../ProtectionPackageCard.types.ts
77
+ - src/features/checkout/src/.../helpers.ts
78
+ - src/features/checkout/src/.../PackagesV2.tsx
79
+
80
+ ════════════════════════════════════════════════════════════════
81
+ DEPENDENCY ANALYSIS
82
+ ════════════════════════════════════════════════════════════════
83
+
84
+ ## Direct Dependencies (files importing changed code)
85
+
86
+ | File | Import | Risk |
87
+ |------|--------|------|
88
+ | ProtectionPackageCard.tsx | TooltipTitle | 🟠 Medium |
89
+ | FLFPackagesV2.tsx | getModifiedLineItems | 🔴 High |
90
+ | PackagesV2.tsx | getModifiedLineItems | 🔴 High |
91
+
92
+ ## Transitive Dependencies (downstream)
93
+
94
+ | Level | Files | Apps | Teams |
95
+ |-------|-------|------|-------|
96
+ | Direct | 5 | 1 | 1 |
97
+ | Level 2 | 8 | 1 | 1 |
98
+ | Level 3 | 12 | 2 | 2 |
99
+ | **Total Blast Radius** | **25 files** | **2 apps** | **2 teams** |
100
+
101
+ ## Type Analysis
102
+
103
+ | Change | Type | Revert Risk |
104
+ |--------|------|-------------|
105
+ | Added `originalName?: string` to ILineItemInfo | Addition | ✅ Safe |
106
+ | Added `LineItemInfoWithOriginalName` type | Addition | ✅ Safe |
107
+ | Added `TooltipTitle` styled component | Addition | ✅ Safe |
108
+ | Modified `getModifiedLineItems` signature | Modification | 🟠 Medium |
109
+
110
+ ════════════════════════════════════════════════════════════════
111
+ REVERT SIMULATION
112
+ ════════════════════════════════════════════════════════════════
113
+
114
+ ## Compile Test
115
+ ```bash
116
+ git revert ed304bcf4fb --no-commit
117
+ pnpm compile
118
+ ````
119
+
120
+ Result: ✅ COMPILES SUCCESSFULLY
121
+
122
+ ## Type Check
123
+
124
+ No breaking type changes detected.
125
+
126
+ ## Runtime Risk
127
+
128
+ 🟠 MEDIUM - Some call sites may expect new behavior
129
+
130
+ ════════════════════════════════════════════════════════════════
131
+ RECOMMENDATION
132
+ ════════════════════════════════════════════════════════════════
133
+
134
+ ## Risk Score: 35/100 (Low-Medium)
135
+
136
+ ### Option A: Safe Rollback ✅
137
+
138
+ - Revert is compile-safe
139
+ - No breaking type changes
140
+ - Feature flag can disable behavior
141
+ - Estimated time: 15 minutes
142
+
143
+ ### Option B: Fix Forward
144
+
145
+ - If issue is minor, fix in new PR
146
+ - Preserves git history
147
+ - Estimated time: 30-60 minutes
148
+
149
+ **RECOMMENDED: Option A (Safe Rollback)**
150
+
151
+ Rollback command:
152
+
153
+ ```bash
154
+ git revert ed304bcf4fb
155
+ git push origin master
156
+ ```
157
+
158
+ Post-rollback:
159
+
160
+ 1. Monitor error rates for 30 minutes
161
+ 2. Notify team in #web-booking
162
+ 3. Create follow-up ticket for investigation
163
+
164
+ ````
165
+
166
+ ## Commands Used
167
+
168
+ ```bash
169
+ # Get PR details
170
+ gh pr view {PR_NUMBER} --json files,commits,mergeCommit
171
+
172
+ # Find dependents
173
+ grep -rl "TooltipTitle\|getModifiedLineItems" --include="*.tsx" apps/ libraries/
174
+
175
+ # Simulate revert
176
+ git stash
177
+ git checkout master
178
+ git revert {SHA} --no-commit
179
+ pnpm compile
180
+ git reset --hard HEAD
181
+ git stash pop
182
+
183
+ # Check CODEOWNERS for affected teams
184
+ for file in $(gh pr diff {PR} --name-only); do
185
+ grep -E "^$(dirname $file)" .github/CODEOWNERS
186
+ done | awk '{print $NF}' | sort -u
187
+ ````
188
+
189
+ ## Risk Scoring
190
+
191
+ | Factor | Points | Max |
192
+ | ---------------- | ------ | -------------- |
193
+ | Type changes | 0-30 | Breaking = 30 |
194
+ | Export changes | 0-25 | Removed = 25 |
195
+ | Dependency depth | 0-20 | >3 levels = 20 |
196
+ | Apps affected | 0-15 | >2 apps = 15 |
197
+ | Teams affected | 0-10 | >2 teams = 10 |
198
+
199
+ **Score Interpretation:**
200
+
201
+ - 0-25: ✅ Safe to rollback
202
+ - 26-50: 🟠 Rollback with caution
203
+ - 51-75: 🟠 Consider fix-forward
204
+ - 76-100: 🔴 Fix-forward recommended
205
+
206
+ ## AI Execution
207
+
208
+ When user runs `/rollback-impact {PR}`:
209
+
210
+ 1. **Fetch PR details** - Files, commits, merge info
211
+ 2. **Trace dependencies** - Find all importing files
212
+ 3. **Calculate blast radius** - Apps, teams, depth
213
+ 4. **Simulate revert** - Test compilation
214
+ 5. **Score risk** - Calculate impact score
215
+ 6. **Recommend action** - Rollback vs fix-forward
@@ -0,0 +1,238 @@
1
+ ---
2
+ description: Scan for secrets, vulnerabilities, supply chain risks before PR
3
+ category: Code Quality
4
+ aliases: [security, scan, audit]
5
+ ---
6
+
7
+ # Security Shift-Left - Pre-PR Security Scanning
8
+
9
+ Scan for vulnerabilities, secrets, and supply chain risks before PR.
10
+
11
+ **Alias:** `/security-audit`, `/supply-chain-audit`
12
+
13
+ ## Usage
14
+
15
+ ```
16
+ /security-audit
17
+ /security-audit {FILE_PATH}
18
+ /security-audit --pr {PR_NUMBER}
19
+ /security-audit --deep # Full SAST scan
20
+ ```
21
+
22
+ ## Why This Matters
23
+
24
+ 2025 has seen a rise in:
25
+
26
+ - **MCPoison attacks** - Malicious MCP servers
27
+ - **Prompt injection** - AI command manipulation
28
+ - **Secret leakage** - API keys in code/prompts
29
+ - **Dependency vulnerabilities** - Supply chain attacks
30
+
31
+ ## What This Does
32
+
33
+ 1. **Secret scanning** - API keys, tokens, credentials
34
+ 2. **Dependency audit** - CVEs in npm packages
35
+ 3. **SAST analysis** - Static security patterns
36
+ 4. **Prompt injection** - AI-specific vulnerabilities
37
+ 5. **Code patterns** - XSS, injection, auth issues
38
+
39
+ ## Security Checks
40
+
41
+ ### 🔴 Critical (Block PR)
42
+
43
+ | Check | Pattern | Action |
44
+ | ------------ | ------------------------------------- | ------ |
45
+ | API Keys | `/[A-Za-z0-9_-]{32,}/` | Block |
46
+ | AWS Keys | `/AKIA[0-9A-Z]{16}/` | Block |
47
+ | Private Keys | `/-----BEGIN.*PRIVATE KEY-----/` | Block |
48
+ | Passwords | `/password\s*[:=]\s*['"][^'"]+['"]/i` | Block |
49
+ | Tokens | `/token\s*[:=]\s*['"][^'"]+['"]/i` | Review |
50
+
51
+ ### 🟠 High (Requires Review)
52
+
53
+ | Check | Issue | Mitigation |
54
+ | ------------------------- | -------------- | ----------------- |
55
+ | `dangerouslySetInnerHTML` | XSS risk | Sanitize input |
56
+ | `eval()` | Code injection | Remove usage |
57
+ | `innerHTML` | XSS risk | Use textContent |
58
+ | Unsanitized URLs | Open redirect | Validate URLs |
59
+ | SQL concatenation | Injection | Use parameterized |
60
+
61
+ ### 🟡 Medium (Warning)
62
+
63
+ | Check | Issue | Recommendation |
64
+ | ------------- | ---------------- | ------------------ |
65
+ | `console.log` | Info leakage | Remove in prod |
66
+ | Hardcoded IPs | Environment leak | Use env vars |
67
+ | `any` type | Type safety | Use specific types |
68
+ | Missing CSRF | Security gap | Add protection |
69
+
70
+ ## Output Format
71
+
72
+ ````
73
+ 📋 Running security audit...
74
+
75
+ ════════════════════════════════════════════════════════════════
76
+ SECURITY SCAN RESULTS
77
+ ════════════════════════════════════════════════════════════════
78
+
79
+ ## Summary
80
+
81
+ | Severity | Count | Status |
82
+ |----------|-------|--------|
83
+ | 🔴 Critical | 0 | ✅ Pass |
84
+ | 🟠 High | 2 | ⚠️ Review |
85
+ | 🟡 Medium | 5 | 📝 Note |
86
+ | 🟢 Low | 8 | ℹ️ Info |
87
+
88
+ ════════════════════════════════════════════════════════════════
89
+ 🔴 CRITICAL FINDINGS
90
+ ════════════════════════════════════════════════════════════════
91
+
92
+ None found ✅
93
+
94
+ ════════════════════════════════════════════════════════════════
95
+ 🟠 HIGH FINDINGS
96
+ ════════════════════════════════════════════════════════════════
97
+
98
+ ## 1. Potential XSS via dangerouslySetInnerHTML
99
+
100
+ **File:** src/features/checkout/src/components/RichText.tsx:45
101
+ **Code:**
102
+ ```typescript
103
+ <div dangerouslySetInnerHTML={{ __html: content }} />
104
+ ````
105
+
106
+ **Risk:** User-controlled content could execute scripts
107
+ **Mitigation:** Use `DOMPurify.sanitize()` or `OXRichTextBlock`
108
+
109
+ **Suggested fix:**
110
+
111
+ ```typescript
112
+ import DOMPurify from 'dompurify';
113
+ <div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }} />
114
+ ```
115
+
116
+ ---
117
+
118
+ ## 2. Missing Input Validation
119
+
120
+ **File:** src/features/checkout/src/hooks/useBookingUpdate.ts:67
121
+ **Code:**
122
+
123
+ ```typescript
124
+ const url = `${API_BASE}/${userInput}`;
125
+ fetch(url);
126
+ ```
127
+
128
+ **Risk:** URL manipulation, SSRF
129
+ **Mitigation:** Validate and sanitize userInput
130
+
131
+ ════════════════════════════════════════════════════════════════
132
+ 🟡 MEDIUM FINDINGS
133
+ ════════════════════════════════════════════════════════════════
134
+
135
+ | # | File | Issue | Line |
136
+ | --- | ---------- | ----------------------------- | ---- |
137
+ | 1 | helpers.ts | console.log in production | 23 |
138
+ | 2 | api.ts | Hardcoded timeout value | 45 |
139
+ | 3 | config.ts | Environment variable fallback | 12 |
140
+ | 4 | types.ts | Use of `any` type | 78 |
141
+ | 5 | auth.ts | Token stored in localStorage | 34 |
142
+
143
+ ════════════════════════════════════════════════════════════════
144
+ 🔍 DEPENDENCY AUDIT
145
+ ════════════════════════════════════════════════════════════════
146
+
147
+ Running `npm audit`...
148
+
149
+ | Package | Severity | CVE | Fixed In |
150
+ | ------- | -------- | -------------- | -------- |
151
+ | lodash | High | CVE-2021-23337 | 4.17.21 |
152
+ | axios | Medium | CVE-2023-45857 | 1.6.0 |
153
+
154
+ **Recommendation:** Run `pnpm update lodash axios`
155
+
156
+ ════════════════════════════════════════════════════════════════
157
+ 🤖 AI/PROMPT SECURITY
158
+ ════════════════════════════════════════════════════════════════
159
+
160
+ ## Prompt Injection Scan
161
+
162
+ Checking for:
163
+
164
+ - [ ] User input in AI prompts: None found ✅
165
+ - [ ] Unvalidated MCP calls: None found ✅
166
+ - [ ] Prompt templates with injection risk: None found ✅
167
+
168
+ ## MCP Server Audit
169
+
170
+ Connected MCP servers:
171
+
172
+ - Atlassian (Jira) - ✅ Official
173
+ - GitHub - ✅ Official
174
+ - Figma - ✅ Official
175
+
176
+ ⚠️ No untrusted MCP servers detected
177
+
178
+ ════════════════════════════════════════════════════════════════
179
+ VERDICT
180
+ ════════════════════════════════════════════════════════════════
181
+
182
+ ## Overall Security Score: 78/100 (🟠 Needs Attention)
183
+
184
+ ### Blocking Issues: 0
185
+
186
+ ### Review Required: 2
187
+
188
+ ### Improvements Suggested: 5
189
+
190
+ **Recommendation:**
191
+
192
+ 1. Fix the 2 HIGH findings before PR
193
+ 2. Address MEDIUM findings in follow-up
194
+ 3. Run `pnpm audit fix` for dependencies
195
+
196
+ ### Pre-PR Checklist
197
+
198
+ - [ ] Fix dangerouslySetInnerHTML (HIGH)
199
+ - [ ] Add URL validation (HIGH)
200
+ - [ ] Remove console.log statements
201
+ - [ ] Update vulnerable dependencies
202
+
203
+ ````
204
+
205
+ ## Commands Used
206
+
207
+ ```bash
208
+ # Secret scanning
209
+ grep -rn "AKIA\|api[_-]key\|password\s*=" --include="*.ts" .
210
+
211
+ # Dependency audit
212
+ pnpm audit --json
213
+
214
+ # SAST with semgrep (if available)
215
+ semgrep --config=p/security-audit .
216
+
217
+ # Find dangerous patterns
218
+ grep -rn "dangerouslySetInnerHTML\|eval(\|innerHTML" --include="*.tsx" .
219
+ ````
220
+
221
+ ## Integration with Workflow
222
+
223
+ This command is automatically invoked by:
224
+
225
+ - `/full-flow` - Before PR creation
226
+ - `/pre-pr-check` - As part of validation
227
+ - `/orchestrate` - Via Security Agent
228
+
229
+ ## AI Execution
230
+
231
+ When user runs `/security-audit`:
232
+
233
+ 1. **Scan secrets** - Regex patterns for credentials
234
+ 2. **Audit dependencies** - npm/pnpm vulnerability check
235
+ 3. **SAST analysis** - Security antipatterns
236
+ 4. **Prompt security** - AI-specific risks
237
+ 5. **Generate report** - Severity-ranked findings
238
+ 6. **Recommend fixes** - Specific mitigations
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "cursor-devops-commands",
3
+ "version": "1.0.0",
4
+ "description": "DevOps & Git Commands for Cursor IDE - Security, Deployment, Git Operations",
5
+ "bin": {
6
+ "cursor-devops": "./bin/cli.js",
7
+ "devops-commands": "./bin/cli.js"
8
+ },
9
+ "main": "./bin/cli.js",
10
+ "keywords": [
11
+ "cursor",
12
+ "cursor-rules",
13
+ "cursor-commands",
14
+ "devops",
15
+ "git",
16
+ "security",
17
+ "deployment",
18
+ "dev-productivity",
19
+ "ai-coding"
20
+ ],
21
+ "author": "Sharath Chandra",
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/sharath317/cursor-devops-commands"
26
+ },
27
+ "homepage": "https://github.com/sharath317/cursor-devops-commands#readme",
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
31
+ "files": [
32
+ "bin/",
33
+ "commands/"
34
+ ]
35
+ }
36
+