@bradtaylorsf/alpha-loop 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.
Files changed (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +294 -0
  3. package/agents/implementer.md +30 -0
  4. package/agents/reviewer.md +29 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +57 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/auth.d.ts +1 -0
  9. package/dist/commands/auth.js +89 -0
  10. package/dist/commands/auth.js.map +1 -0
  11. package/dist/commands/history.d.ts +8 -0
  12. package/dist/commands/history.js +185 -0
  13. package/dist/commands/history.js.map +1 -0
  14. package/dist/commands/init.d.ts +1 -0
  15. package/dist/commands/init.js +241 -0
  16. package/dist/commands/init.js.map +1 -0
  17. package/dist/commands/run.d.ts +15 -0
  18. package/dist/commands/run.js +321 -0
  19. package/dist/commands/run.js.map +1 -0
  20. package/dist/commands/scan.d.ts +1 -0
  21. package/dist/commands/scan.js +50 -0
  22. package/dist/commands/scan.js.map +1 -0
  23. package/dist/commands/sync.d.ts +20 -0
  24. package/dist/commands/sync.js +149 -0
  25. package/dist/commands/sync.js.map +1 -0
  26. package/dist/commands/vision.d.ts +1 -0
  27. package/dist/commands/vision.js +194 -0
  28. package/dist/commands/vision.js.map +1 -0
  29. package/dist/engine/agents.d.ts +41 -0
  30. package/dist/engine/agents.js +90 -0
  31. package/dist/engine/agents.js.map +1 -0
  32. package/dist/engine/config.d.ts +71 -0
  33. package/dist/engine/config.js +73 -0
  34. package/dist/engine/config.js.map +1 -0
  35. package/dist/engine/prerequisites.d.ts +34 -0
  36. package/dist/engine/prerequisites.js +90 -0
  37. package/dist/engine/prerequisites.js.map +1 -0
  38. package/dist/lib/agent.d.ts +25 -0
  39. package/dist/lib/agent.js +97 -0
  40. package/dist/lib/agent.js.map +1 -0
  41. package/dist/lib/config.d.ts +35 -0
  42. package/dist/lib/config.js +179 -0
  43. package/dist/lib/config.js.map +1 -0
  44. package/dist/lib/context.d.ts +17 -0
  45. package/dist/lib/context.js +96 -0
  46. package/dist/lib/context.js.map +1 -0
  47. package/dist/lib/github.d.ts +61 -0
  48. package/dist/lib/github.js +313 -0
  49. package/dist/lib/github.js.map +1 -0
  50. package/dist/lib/learning.d.ts +43 -0
  51. package/dist/lib/learning.js +207 -0
  52. package/dist/lib/learning.js.map +1 -0
  53. package/dist/lib/logger.d.ts +9 -0
  54. package/dist/lib/logger.js +28 -0
  55. package/dist/lib/logger.js.map +1 -0
  56. package/dist/lib/pipeline.d.ts +18 -0
  57. package/dist/lib/pipeline.js +456 -0
  58. package/dist/lib/pipeline.js.map +1 -0
  59. package/dist/lib/preflight.d.ts +33 -0
  60. package/dist/lib/preflight.js +123 -0
  61. package/dist/lib/preflight.js.map +1 -0
  62. package/dist/lib/prerequisites.d.ts +12 -0
  63. package/dist/lib/prerequisites.js +54 -0
  64. package/dist/lib/prerequisites.js.map +1 -0
  65. package/dist/lib/prompts.d.ts +44 -0
  66. package/dist/lib/prompts.js +102 -0
  67. package/dist/lib/prompts.js.map +1 -0
  68. package/dist/lib/session.d.ts +28 -0
  69. package/dist/lib/session.js +173 -0
  70. package/dist/lib/session.js.map +1 -0
  71. package/dist/lib/shell.d.ts +32 -0
  72. package/dist/lib/shell.js +95 -0
  73. package/dist/lib/shell.js.map +1 -0
  74. package/dist/lib/testing.d.ts +10 -0
  75. package/dist/lib/testing.js +51 -0
  76. package/dist/lib/testing.js.map +1 -0
  77. package/dist/lib/verify.d.ts +18 -0
  78. package/dist/lib/verify.js +235 -0
  79. package/dist/lib/verify.js.map +1 -0
  80. package/dist/lib/vision.d.ts +9 -0
  81. package/dist/lib/vision.js +21 -0
  82. package/dist/lib/vision.js.map +1 -0
  83. package/dist/lib/worktree.d.ts +29 -0
  84. package/dist/lib/worktree.js +153 -0
  85. package/dist/lib/worktree.js.map +1 -0
  86. package/package.json +63 -0
  87. package/templates/agents/implementer.md +34 -0
  88. package/templates/agents/reviewer.md +48 -0
  89. package/templates/skills/code-review/SKILL.md +58 -0
  90. package/templates/skills/git-workflow/SKILL.md +53 -0
  91. package/templates/skills/implementation-planning/SKILL.md +64 -0
  92. package/templates/skills/security-analysis/SKILL.md +560 -0
  93. package/templates/skills/security-analysis/scripts/security-scanner.sh +227 -0
  94. package/templates/skills/test-robustness/SKILL.md +897 -0
  95. package/templates/skills/testing-patterns/SKILL.md +75 -0
@@ -0,0 +1,227 @@
1
+ #!/bin/bash
2
+
3
+ ##
4
+ # Security Scanner Script
5
+ # Comprehensive security scan for Node.js projects
6
+ #
7
+ # Usage:
8
+ # ./security-scanner.sh
9
+ # ./security-scanner.sh --strict # Exit on any violation
10
+ ##
11
+
12
+ STRICT_MODE=false
13
+
14
+ # Parse arguments
15
+ for arg in "$@"; do
16
+ case $arg in
17
+ --strict)
18
+ STRICT_MODE=true
19
+ shift
20
+ ;;
21
+ esac
22
+ done
23
+
24
+ echo "🔒 Running Security Scan..."
25
+ echo "Strict mode: $STRICT_MODE"
26
+ echo ""
27
+
28
+ VIOLATIONS=0
29
+
30
+ # ==============================================================================
31
+ # 1. NPM Audit
32
+ # ==============================================================================
33
+
34
+ echo "1️⃣ Checking dependencies for vulnerabilities..."
35
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
36
+
37
+ if npm audit --audit-level=moderate 2>/dev/null; then
38
+ echo "✅ No vulnerabilities found in dependencies"
39
+ else
40
+ echo "⚠️ Vulnerabilities detected in dependencies"
41
+ VIOLATIONS=$((VIOLATIONS + 1))
42
+ fi
43
+ echo ""
44
+
45
+ # ==============================================================================
46
+ # 2. Hardcoded Secrets
47
+ # ==============================================================================
48
+
49
+ echo "2️⃣ Scanning for hardcoded secrets..."
50
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
51
+
52
+ # Check for hardcoded passwords
53
+ PASSWORDS=$(grep -rn "password\s*=\s*['\"]" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:" | wc -l)
54
+ if [ "$PASSWORDS" -gt 0 ]; then
55
+ echo "⚠️ Found $PASSWORDS potential hardcoded password(s)"
56
+ grep -rn "password\s*=\s*['\"]" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:"
57
+ VIOLATIONS=$((VIOLATIONS + 1))
58
+ else
59
+ echo "✅ No hardcoded passwords detected"
60
+ fi
61
+
62
+ # Check for hardcoded API keys
63
+ API_KEYS=$(grep -rn "api[_-]?key\s*=\s*['\"][a-zA-Z0-9]" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:" | wc -l)
64
+ if [ "$API_KEYS" -gt 0 ]; then
65
+ echo "⚠️ Found $API_KEYS potential hardcoded API key(s)"
66
+ grep -rn "api[_-]?key\s*=\s*['\"][a-zA-Z0-9]" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:"
67
+ VIOLATIONS=$((VIOLATIONS + 1))
68
+ else
69
+ echo "✅ No hardcoded API keys detected"
70
+ fi
71
+
72
+ echo ""
73
+
74
+ # ==============================================================================
75
+ # 3. Weak Cryptography
76
+ # ==============================================================================
77
+
78
+ echo "3️⃣ Checking for weak cryptography..."
79
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
80
+
81
+ # Check for MD5/SHA1
82
+ WEAK_HASH=$(grep -rn "md5\|sha1\|createHash('sha1')" src/ --exclude-dir=node_modules 2>/dev/null | wc -l)
83
+ if [ "$WEAK_HASH" -gt 0 ]; then
84
+ echo "⚠️ Found $WEAK_HASH use(s) of weak hashing (MD5/SHA1)"
85
+ grep -rn "md5\|sha1" src/ --exclude-dir=node_modules 2>/dev/null
86
+ VIOLATIONS=$((VIOLATIONS + 1))
87
+ else
88
+ echo "✅ No weak hashing detected"
89
+ fi
90
+
91
+ # Check for low bcrypt rounds
92
+ LOW_BCRYPT=$(grep -rn "bcrypt\.hash.*,\s*[0-9])" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "1[0-9]" | wc -l)
93
+ if [ "$LOW_BCRYPT" -gt 0 ]; then
94
+ echo "⚠️ Found $LOW_BCRYPT bcrypt usage(s) with insufficient rounds (<10)"
95
+ grep -rn "bcrypt\.hash.*,\s*[0-9])" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "1[0-9]"
96
+ VIOLATIONS=$((VIOLATIONS + 1))
97
+ else
98
+ echo "✅ Bcrypt rounds appear sufficient"
99
+ fi
100
+
101
+ echo ""
102
+
103
+ # ==============================================================================
104
+ # 4. SQL Injection Risks
105
+ # ==============================================================================
106
+
107
+ echo "4️⃣ Checking for SQL injection risks..."
108
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
109
+
110
+ # Check for template literals in queries
111
+ SQL_INJECTION=$(grep -rn "query.*\${" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:" | wc -l)
112
+ if [ "$SQL_INJECTION" -gt 0 ]; then
113
+ echo "⚠️ Found $SQL_INJECTION potential SQL injection(s) (template literals in queries)"
114
+ grep -rn "query.*\${" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:"
115
+ VIOLATIONS=$((VIOLATIONS + 1))
116
+ else
117
+ echo "✅ No SQL injection risks detected"
118
+ fi
119
+
120
+ echo ""
121
+
122
+ # ==============================================================================
123
+ # 5. Command Injection Risks
124
+ # ==============================================================================
125
+
126
+ echo "5️⃣ Checking for command injection risks..."
127
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
128
+
129
+ CMD_INJECTION=$(grep -rn "exec\|spawn\|execSync" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:" | wc -l)
130
+ if [ "$CMD_INJECTION" -gt 0 ]; then
131
+ echo "⚠️ Found $CMD_INJECTION use(s) of command execution (potential injection risk)"
132
+ grep -rn "exec\|spawn\|execSync" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "// safe:"
133
+ VIOLATIONS=$((VIOLATIONS + 1))
134
+ else
135
+ echo "✅ No command injection risks detected"
136
+ fi
137
+
138
+ echo ""
139
+
140
+ # ==============================================================================
141
+ # 6. Missing Authentication
142
+ # ==============================================================================
143
+
144
+ echo "6️⃣ Checking for unauthenticated routes..."
145
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
146
+
147
+ if [ -d "src/server/routes" ]; then
148
+ UNAUTH_ROUTES=$(grep -rn "router\.\(get\|post\|put\|delete\|patch\)" src/server/routes/ 2>/dev/null | grep -v "requireAuth\|isAuthenticated\|checkPermission\|public" | wc -l)
149
+ if [ "$UNAUTH_ROUTES" -gt 0 ]; then
150
+ echo "⚠️ Found $UNAUTH_ROUTES route(s) without authentication middleware"
151
+ grep -rn "router\.\(get\|post\|put\|delete\|patch\)" src/server/routes/ 2>/dev/null | grep -v "requireAuth\|isAuthenticated\|checkPermission\|public"
152
+ echo ""
153
+ echo "💡 Review if these routes should be public or need auth middleware"
154
+ VIOLATIONS=$((VIOLATIONS + 1))
155
+ else
156
+ echo "✅ All routes appear to have authentication checks"
157
+ fi
158
+ else
159
+ echo "ℹ️ No routes directory found (skipping)"
160
+ fi
161
+
162
+ echo ""
163
+
164
+ # ==============================================================================
165
+ # 7. Debug Code
166
+ # ==============================================================================
167
+
168
+ echo "7️⃣ Checking for debug code..."
169
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
170
+
171
+ DEBUG_COUNT=$(grep -rn "console\.log\|debugger" src/ --exclude-dir=node_modules 2>/dev/null | wc -l)
172
+ if [ "$DEBUG_COUNT" -gt 0 ]; then
173
+ echo "⚠️ Found $DEBUG_COUNT instance(s) of debug code"
174
+ echo "💡 Consider removing console.log and debugger statements in production"
175
+ VIOLATIONS=$((VIOLATIONS + 1))
176
+ else
177
+ echo "✅ No debug code detected"
178
+ fi
179
+
180
+ echo ""
181
+
182
+ # ==============================================================================
183
+ # 8. XSS Risks (React)
184
+ # ==============================================================================
185
+
186
+ echo "8️⃣ Checking for XSS risks..."
187
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
188
+
189
+ XSS_COUNT=$(grep -rn "dangerouslySetInnerHTML" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "DOMPurify\|sanitize" | wc -l)
190
+ if [ "$XSS_COUNT" -gt 0 ]; then
191
+ echo "⚠️ Found $XSS_COUNT use(s) of dangerouslySetInnerHTML without sanitization"
192
+ grep -rn "dangerouslySetInnerHTML" src/ --exclude-dir=node_modules 2>/dev/null | grep -v "DOMPurify\|sanitize"
193
+ echo ""
194
+ echo "💡 Ensure all HTML is sanitized with DOMPurify before rendering"
195
+ VIOLATIONS=$((VIOLATIONS + 1))
196
+ else
197
+ echo "✅ No XSS risks detected"
198
+ fi
199
+
200
+ echo ""
201
+
202
+ # ==============================================================================
203
+ # Summary
204
+ # ==============================================================================
205
+
206
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
207
+ echo "SUMMARY"
208
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
209
+ echo ""
210
+
211
+ if [ "$VIOLATIONS" -eq 0 ]; then
212
+ echo "✅ Security scan passed! No violations found."
213
+ echo ""
214
+ exit 0
215
+ else
216
+ echo "⚠️ Security scan found $VIOLATIONS violation(s)."
217
+ echo " Please review and address the issues above."
218
+ echo ""
219
+
220
+ if [ "$STRICT_MODE" = true ]; then
221
+ echo "❌ Exiting with error due to --strict mode"
222
+ exit 1
223
+ else
224
+ echo "ℹ️ Run with --strict to fail on violations"
225
+ exit 0
226
+ fi
227
+ fi