ma-agents 3.2.0 → 3.3.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 (86) hide show
  1. package/.opencode/skills/.ma-agents.json +99 -99
  2. package/.roo/rules/00-ma-agents.md +13 -0
  3. package/.roo/skills/.ma-agents.json +241 -0
  4. package/.roo/skills/MANIFEST.yaml +254 -0
  5. package/.roo/skills/ai-audit-trail/SKILL.md +23 -0
  6. package/.roo/skills/auto-bug-detection/SKILL.md +169 -0
  7. package/.roo/skills/cmake-best-practices/SKILL.md +64 -0
  8. package/.roo/skills/cmake-best-practices/examples/cmake.md +59 -0
  9. package/.roo/skills/code-documentation/SKILL.md +57 -0
  10. package/.roo/skills/code-documentation/examples/cpp.md +29 -0
  11. package/.roo/skills/code-documentation/examples/csharp.md +28 -0
  12. package/.roo/skills/code-documentation/examples/javascript_typescript.md +28 -0
  13. package/.roo/skills/code-documentation/examples/python.md +57 -0
  14. package/.roo/skills/code-review/SKILL.md +43 -0
  15. package/.roo/skills/commit-message/SKILL.md +79 -0
  16. package/.roo/skills/cpp-best-practices/SKILL.md +234 -0
  17. package/.roo/skills/cpp-best-practices/examples/modern-idioms.md +189 -0
  18. package/.roo/skills/cpp-best-practices/examples/naming-and-organization.md +102 -0
  19. package/.roo/skills/cpp-concurrency-safety/SKILL.md +60 -0
  20. package/.roo/skills/cpp-concurrency-safety/examples/concurrency.md +73 -0
  21. package/.roo/skills/cpp-const-correctness/SKILL.md +63 -0
  22. package/.roo/skills/cpp-const-correctness/examples/const_correctness.md +54 -0
  23. package/.roo/skills/cpp-memory-handling/SKILL.md +42 -0
  24. package/.roo/skills/cpp-memory-handling/examples/modern-cpp.md +49 -0
  25. package/.roo/skills/cpp-memory-handling/examples/smart-pointers.md +46 -0
  26. package/.roo/skills/cpp-modern-composition/SKILL.md +64 -0
  27. package/.roo/skills/cpp-modern-composition/examples/composition.md +51 -0
  28. package/.roo/skills/cpp-robust-interfaces/SKILL.md +55 -0
  29. package/.roo/skills/cpp-robust-interfaces/examples/interfaces.md +56 -0
  30. package/.roo/skills/create-hardened-docker-skill/SKILL.md +637 -0
  31. package/.roo/skills/create-hardened-docker-skill/scripts/create-all.sh +489 -0
  32. package/.roo/skills/csharp-best-practices/SKILL.md +278 -0
  33. package/.roo/skills/docker-hardening-verification/SKILL.md +28 -0
  34. package/.roo/skills/docker-hardening-verification/scripts/verify-hardening.sh +39 -0
  35. package/.roo/skills/docker-image-signing/SKILL.md +28 -0
  36. package/.roo/skills/docker-image-signing/scripts/sign-image.sh +33 -0
  37. package/.roo/skills/document-revision-history/SKILL.md +104 -0
  38. package/.roo/skills/git-workflow-skill/SKILL.md +194 -0
  39. package/.roo/skills/git-workflow-skill/hooks/commit-msg +61 -0
  40. package/.roo/skills/git-workflow-skill/hooks/pre-commit +38 -0
  41. package/.roo/skills/git-workflow-skill/hooks/prepare-commit-msg +56 -0
  42. package/.roo/skills/git-workflow-skill/scripts/finish-feature.sh +192 -0
  43. package/.roo/skills/git-workflow-skill/scripts/install-hooks.sh +55 -0
  44. package/.roo/skills/git-workflow-skill/scripts/start-feature.sh +110 -0
  45. package/.roo/skills/git-workflow-skill/scripts/validate-workflow.sh +229 -0
  46. package/.roo/skills/js-ts-dependency-mgmt/SKILL.md +49 -0
  47. package/.roo/skills/js-ts-dependency-mgmt/examples/dependency_mgmt.md +60 -0
  48. package/.roo/skills/js-ts-security-skill/SKILL.md +64 -0
  49. package/.roo/skills/js-ts-security-skill/scripts/verify-security.sh +136 -0
  50. package/.roo/skills/logging-best-practices/SKILL.md +50 -0
  51. package/.roo/skills/logging-best-practices/examples/cpp.md +36 -0
  52. package/.roo/skills/logging-best-practices/examples/csharp.md +49 -0
  53. package/.roo/skills/logging-best-practices/examples/javascript.md +77 -0
  54. package/.roo/skills/logging-best-practices/examples/python.md +57 -0
  55. package/.roo/skills/logging-best-practices/references/logging-standards.md +29 -0
  56. package/.roo/skills/open-presentation/SKILL.md +35 -0
  57. package/.roo/skills/opentelemetry-best-practices/SKILL.md +34 -0
  58. package/.roo/skills/opentelemetry-best-practices/examples/go.md +32 -0
  59. package/.roo/skills/opentelemetry-best-practices/examples/javascript.md +58 -0
  60. package/.roo/skills/opentelemetry-best-practices/examples/python.md +37 -0
  61. package/.roo/skills/opentelemetry-best-practices/references/otel-standards.md +37 -0
  62. package/.roo/skills/python-best-practices/SKILL.md +385 -0
  63. package/.roo/skills/python-dependency-mgmt/SKILL.md +42 -0
  64. package/.roo/skills/python-dependency-mgmt/examples/dependency_mgmt.md +67 -0
  65. package/.roo/skills/python-security-skill/SKILL.md +56 -0
  66. package/.roo/skills/python-security-skill/examples/security.md +56 -0
  67. package/.roo/skills/self-signed-cert/SKILL.md +42 -0
  68. package/.roo/skills/self-signed-cert/scripts/generate-cert.ps1 +45 -0
  69. package/.roo/skills/self-signed-cert/scripts/generate-cert.sh +43 -0
  70. package/.roo/skills/skill-creator/SKILL.md +196 -0
  71. package/.roo/skills/skill-creator/references/output-patterns.md +82 -0
  72. package/.roo/skills/skill-creator/references/workflows.md +28 -0
  73. package/.roo/skills/skill-creator/scripts/init_skill.py +208 -0
  74. package/.roo/skills/skill-creator/scripts/package_skill.py +99 -0
  75. package/.roo/skills/skill-creator/scripts/quick_validate.py +113 -0
  76. package/.roo/skills/story-status-lookup/SKILL.md +78 -0
  77. package/.roo/skills/test-accompanied-development/SKILL.md +50 -0
  78. package/.roo/skills/test-generator/SKILL.md +65 -0
  79. package/.roo/skills/vercel-react-best-practices/SKILL.md +109 -0
  80. package/.roo/skills/verify-hardened-docker-skill/SKILL.md +442 -0
  81. package/.roo/skills/verify-hardened-docker-skill/scripts/verify-docker-hardening.sh +439 -0
  82. package/README.md +2 -1
  83. package/lib/agents.js +23 -0
  84. package/package.json +4 -3
  85. package/test/roo-code-agent.test.js +166 -0
  86. package/test/roo-code-injection.test.js +172 -0
@@ -0,0 +1,489 @@
1
+ #!/bin/bash
2
+ #
3
+ # create-all.sh
4
+ # Creates all hardened Docker configuration files
5
+ #
6
+
7
+ set -e
8
+
9
+ # Colors for output
10
+ GREEN='\033[0;32m'
11
+ BLUE='\033[0;34m'
12
+ YELLOW='\033[1;33m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Configuration
16
+ APP_NAME="${1:-contacts-app}"
17
+ NODE_VERSION="${2:-18.20.4-alpine3.20}"
18
+ NGINX_VERSION="${3:-1.27.3-alpine3.20}"
19
+
20
+ echo -e "${BLUE}🐳 Creating Hardened Docker Configuration${NC}"
21
+ echo -e "${BLUE}==========================================${NC}"
22
+ echo "Application: $APP_NAME"
23
+ echo "Node version: $NODE_VERSION"
24
+ echo "Nginx version: $NGINX_VERSION"
25
+ echo ""
26
+
27
+ # Check if files exist and warn
28
+ check_file() {
29
+ if [ -f "$1" ]; then
30
+ echo -e "${YELLOW}⚠️ Warning: $1 already exists${NC}"
31
+ read -p " Overwrite? (y/N): " -n 1 -r
32
+ echo
33
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
34
+ return 1
35
+ fi
36
+ fi
37
+ return 0
38
+ }
39
+
40
+ # ============================================================================
41
+ # Create Dockerfile
42
+ # ============================================================================
43
+ echo -e "${BLUE}Creating Dockerfile...${NC}"
44
+
45
+ if check_file "Dockerfile"; then
46
+ cat > Dockerfile << 'EOF'
47
+ # syntax=docker/dockerfile:1
48
+ # @fileoverview Multi-stage hardened Dockerfile for production deployment
49
+ # @module Dockerfile
50
+
51
+ # ============================================================================
52
+ # Stage 1: Build
53
+ # ============================================================================
54
+ FROM node:NODE_VERSION AS builder
55
+
56
+ # Security: Create non-root user for build stage
57
+ RUN addgroup -g 1001 -S nodejs && adduser -S nodejs -u 1001
58
+
59
+ # Set working directory
60
+ WORKDIR /app
61
+
62
+ # Copy package files with correct ownership
63
+ COPY --chown=nodejs:nodejs package*.json ./
64
+
65
+ # Install dependencies (production only)
66
+ RUN npm ci --only=production && \
67
+ npm cache clean --force
68
+
69
+ # Copy source files
70
+ COPY --chown=nodejs:nodejs . .
71
+
72
+ # Build application
73
+ RUN npm run build
74
+
75
+ # ============================================================================
76
+ # Stage 2: Production
77
+ # ============================================================================
78
+ FROM nginx:NGINX_VERSION
79
+
80
+ # Security: Run as non-root user (nginx:alpine already has nginx user)
81
+ RUN touch /var/run/nginx.pid && \
82
+ # Create necessary directories with correct ownership
83
+ mkdir -p /var/cache/nginx /var/log/nginx && \
84
+ # Set ownership for nginx user
85
+ chown -R nginx:nginx /var/cache/nginx /var/log/nginx /var/run/nginx.pid && \
86
+ # Set correct permissions
87
+ chmod -R 755 /var/cache/nginx /var/log/nginx && \
88
+ # Remove default nginx files
89
+ rm -rf /usr/share/nginx/html/* && \
90
+ # Remove unnecessary packages (if any were added)
91
+ apk del --purge apk-tools
92
+
93
+ # Set working directory
94
+ WORKDIR /usr/share/nginx/html
95
+
96
+ # Copy build artifacts from builder stage with correct ownership
97
+ COPY --from=builder --chown=nginx:nginx /app/build .
98
+
99
+ # Copy nginx configuration
100
+ COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
101
+
102
+ # Security: Set read-only permissions for static files
103
+ RUN find /usr/share/nginx/html -type f -exec chmod 444 {} \; && \
104
+ find /usr/share/nginx/html -type d -exec chmod 555 {} \;
105
+
106
+ # Expose ports (8080/8443 for non-root user)
107
+ EXPOSE 8080 8443
108
+
109
+ # Security: Switch to non-root user
110
+ USER nginx
111
+
112
+ # Health check
113
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
114
+ CMD wget --quiet --tries=1 --spider http://localhost:8080/health || exit 1
115
+
116
+ # Run nginx in foreground
117
+ CMD ["nginx", "-g", "daemon off;"]
118
+ EOF
119
+
120
+ # Replace placeholders
121
+ sed -i "s/NODE_VERSION/$NODE_VERSION/g" Dockerfile
122
+ sed -i "s/NGINX_VERSION/$NGINX_VERSION/g" Dockerfile
123
+
124
+ echo -e "${GREEN}✅ Created Dockerfile${NC}"
125
+ fi
126
+
127
+ # ============================================================================
128
+ # Create docker-compose.yml
129
+ # ============================================================================
130
+ echo -e "${BLUE}Creating docker-compose.yml...${NC}"
131
+
132
+ if check_file "docker-compose.yml"; then
133
+ cat > docker-compose.yml << EOF
134
+ version: '3.8'
135
+
136
+ services:
137
+ ${APP_NAME}:
138
+ build:
139
+ context: .
140
+ dockerfile: Dockerfile
141
+ container_name: ${APP_NAME}
142
+
143
+ # Port mapping (host:container)
144
+ ports:
145
+ - "80:8080" # HTTP
146
+ - "443:8443" # HTTPS
147
+
148
+ # Environment variables
149
+ environment:
150
+ - NODE_ENV=production
151
+
152
+ # Mount .env file as read-only
153
+ env_file:
154
+ - .env
155
+
156
+ # Security: Read-only root filesystem
157
+ read_only: true
158
+
159
+ # Security: Tmpfs mounts for writable directories
160
+ tmpfs:
161
+ - /tmp
162
+ - /var/cache/nginx
163
+ - /var/run
164
+
165
+ # Security: Drop all capabilities and add only required ones
166
+ cap_drop:
167
+ - ALL
168
+ cap_add:
169
+ - CHOWN
170
+ - SETGID
171
+ - SETUID
172
+
173
+ # Security: Prevent privilege escalation
174
+ security_opt:
175
+ - no-new-privileges:true
176
+
177
+ # Resource limits
178
+ deploy:
179
+ resources:
180
+ limits:
181
+ cpus: '1.0'
182
+ memory: 512M
183
+ reservations:
184
+ cpus: '0.5'
185
+ memory: 256M
186
+
187
+ # Restart policy
188
+ restart: unless-stopped
189
+
190
+ # Health check
191
+ healthcheck:
192
+ test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
193
+ interval: 30s
194
+ timeout: 10s
195
+ retries: 3
196
+ start_period: 40s
197
+
198
+ # Network isolation
199
+ networks:
200
+ - ${APP_NAME}-network
201
+
202
+ networks:
203
+ ${APP_NAME}-network:
204
+ driver: bridge
205
+ EOF
206
+
207
+ echo -e "${GREEN}✅ Created docker-compose.yml${NC}"
208
+ fi
209
+
210
+ # ============================================================================
211
+ # Create nginx.conf
212
+ # ============================================================================
213
+ echo -e "${BLUE}Creating nginx.conf...${NC}"
214
+
215
+ if check_file "nginx.conf"; then
216
+ cat > nginx.conf << 'EOF'
217
+ # @fileoverview Production nginx configuration with security hardening
218
+ # @module nginx.conf
219
+
220
+ worker_processes auto;
221
+ error_log /var/log/nginx/error.log warn;
222
+
223
+ events {
224
+ worker_connections 1024;
225
+ }
226
+
227
+ http {
228
+ include /etc/nginx/mime.types;
229
+ default_type application/octet-stream;
230
+
231
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
232
+ '$status $body_bytes_sent "$http_referer" '
233
+ '"$http_user_agent" "$http_x_forwarded_for"';
234
+
235
+ access_log /var/log/nginx/access.log main;
236
+
237
+ sendfile on;
238
+ tcp_nopush on;
239
+ tcp_nodelay on;
240
+ keepalive_timeout 65;
241
+ types_hash_max_size 2048;
242
+
243
+ # Security: Hide nginx version
244
+ server_tokens off;
245
+
246
+ # Gzip compression
247
+ gzip on;
248
+ gzip_disable "msie6";
249
+ gzip_vary on;
250
+ gzip_proxied any;
251
+ gzip_comp_level 6;
252
+ gzip_types text/plain text/css text/xml text/javascript
253
+ application/json application/javascript application/xml+rss
254
+ application/rss+xml font/truetype font/opentype
255
+ application/vnd.ms-fontobject image/svg+xml;
256
+ gzip_min_length 1000;
257
+
258
+ # HTTP server - redirect to HTTPS (port 8080 for non-root)
259
+ server {
260
+ listen 8080;
261
+ server_name _;
262
+
263
+ # Allow health check on HTTP
264
+ location /health {
265
+ access_log off;
266
+ return 200 "healthy\n";
267
+ add_header Content-Type text/plain;
268
+ }
269
+
270
+ # Redirect all other traffic to HTTPS
271
+ location / {
272
+ return 301 https://$host$request_uri;
273
+ }
274
+ }
275
+
276
+ # HTTPS server (port 8443 for non-root)
277
+ server {
278
+ listen 8443 ssl http2;
279
+ server_name _;
280
+
281
+ # SSL certificate paths (user must provide)
282
+ # ssl_certificate /etc/nginx/ssl/cert.pem;
283
+ # ssl_certificate_key /etc/nginx/ssl/key.pem;
284
+
285
+ # SSL security settings
286
+ ssl_protocols TLSv1.2 TLSv1.3;
287
+ ssl_prefer_server_ciphers on;
288
+ ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384';
289
+
290
+ root /usr/share/nginx/html;
291
+ index index.html;
292
+
293
+ # Security headers
294
+ add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' https://people.googleapis.com https://oauth2.googleapis.com; font-src 'self' data:;" always;
295
+ add_header X-Content-Type-Options "nosniff" always;
296
+ add_header X-Frame-Options "DENY" always;
297
+ add_header X-XSS-Protection "1; mode=block" always;
298
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
299
+
300
+ # SPA fallback routing
301
+ location / {
302
+ try_files $uri $uri/ /index.html;
303
+ }
304
+
305
+ # Cache static assets
306
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
307
+ expires 1y;
308
+ add_header Cache-Control "public, immutable";
309
+ }
310
+
311
+ # No caching for index.html
312
+ location = /index.html {
313
+ add_header Cache-Control "no-store, no-cache, must-revalidate";
314
+ }
315
+
316
+ # Health check endpoint
317
+ location /health {
318
+ access_log off;
319
+ return 200 "healthy\n";
320
+ add_header Content-Type text/plain;
321
+ }
322
+ }
323
+ }
324
+ EOF
325
+
326
+ echo -e "${GREEN}✅ Created nginx.conf${NC}"
327
+ fi
328
+
329
+ # ============================================================================
330
+ # Create .dockerignore
331
+ # ============================================================================
332
+ echo -e "${BLUE}Creating .dockerignore...${NC}"
333
+
334
+ if check_file ".dockerignore"; then
335
+ cat > .dockerignore << 'EOF'
336
+ # Dependencies (will be installed via npm ci)
337
+ node_modules/
338
+ npm-debug.log*
339
+ yarn.lock
340
+ package-lock.json
341
+
342
+ # Build outputs (will be generated in Docker build)
343
+ build/
344
+ dist/
345
+ .cache/
346
+
347
+ # Environment files (security - never bake into image)
348
+ .env
349
+ .env.local
350
+ .env.*.local
351
+
352
+ # Git (not needed in container)
353
+ .git/
354
+ .gitignore
355
+ .gitattributes
356
+
357
+ # Tests (not needed in production image)
358
+ **/*.test.ts
359
+ **/*.test.tsx
360
+ **/*.test.js
361
+ **/*.test.jsx
362
+ **/__tests__/
363
+ coverage/
364
+ .nyc_output/
365
+
366
+ # Documentation (not needed in container)
367
+ *.md
368
+ docs/
369
+ CHANGELOG
370
+ LICENSE
371
+
372
+ # IDE files (not needed in container)
373
+ .vscode/
374
+ .idea/
375
+ *.swp
376
+ *.swo
377
+ *.sublime-*
378
+
379
+ # CI/CD (not needed in container)
380
+ .github/
381
+ .gitlab-ci.yml
382
+ .travis.yml
383
+ Jenkinsfile
384
+
385
+ # Storybook (not needed in production)
386
+ .storybook/
387
+ storybook-static/
388
+
389
+ # Misc
390
+ .DS_Store
391
+ Thumbs.db
392
+ *.log
393
+ tmp/
394
+ temp/
395
+
396
+ # Docker files (already in context)
397
+ Dockerfile*
398
+ docker-compose*.yml
399
+ .dockerignore
400
+
401
+ # Agent files (not needed in container)
402
+ .agent/
403
+ _bmad-output/
404
+ EOF
405
+
406
+ echo -e "${GREEN}✅ Created .dockerignore${NC}"
407
+ fi
408
+
409
+ # ============================================================================
410
+ # Create .env.example (if doesn't exist)
411
+ # ============================================================================
412
+ echo -e "${BLUE}Creating .env.example (if not exists)...${NC}"
413
+
414
+ if [ ! -f ".env.example" ]; then
415
+ cat > .env.example << 'EOF'
416
+ # Environment Configuration Template
417
+ # Copy this file to .env and fill in your actual values
418
+ # NEVER commit .env to git!
419
+
420
+ # Google OAuth Configuration
421
+ REACT_APP_GOOGLE_CLIENT_ID=<your-client-id-here>.apps.googleusercontent.com
422
+
423
+ # API Configuration
424
+ REACT_APP_API_BASE_URL=https://people.googleapis.com/v1
425
+
426
+ # Application Environment
427
+ NODE_ENV=production
428
+ EOF
429
+
430
+ echo -e "${GREEN}✅ Created .env.example${NC}"
431
+ else
432
+ echo -e "${YELLOW} .env.example already exists, skipping${NC}"
433
+ fi
434
+
435
+ # ============================================================================
436
+ # Update .gitignore
437
+ # ============================================================================
438
+ echo -e "${BLUE}Updating .gitignore...${NC}"
439
+
440
+ if [ -f ".gitignore" ]; then
441
+ if ! grep -q "^\.env$" .gitignore; then
442
+ echo "" >> .gitignore
443
+ echo "# Environment variables (secrets)" >> .gitignore
444
+ echo ".env" >> .gitignore
445
+ echo -e "${GREEN}✅ Added .env to .gitignore${NC}"
446
+ else
447
+ echo -e "${YELLOW} .env already in .gitignore${NC}"
448
+ fi
449
+ else
450
+ cat > .gitignore << 'EOF'
451
+ # Environment variables (secrets)
452
+ .env
453
+
454
+ # Dependencies
455
+ node_modules/
456
+
457
+ # Build outputs
458
+ build/
459
+ dist/
460
+
461
+ # Logs
462
+ *.log
463
+ EOF
464
+ echo -e "${GREEN}✅ Created .gitignore${NC}"
465
+ fi
466
+
467
+ # ============================================================================
468
+ # Summary
469
+ # ============================================================================
470
+ echo ""
471
+ echo -e "${GREEN}✅ Hardened Docker configuration created successfully!${NC}"
472
+ echo ""
473
+ echo "Files created:"
474
+ echo " - Dockerfile (multi-stage, non-root, hardened)"
475
+ echo " - docker-compose.yml (security-hardened)"
476
+ echo " - nginx.conf (production configuration)"
477
+ echo " - .dockerignore (optimized build context)"
478
+ echo " - .env.example (template)"
479
+ echo ""
480
+ echo "Next steps:"
481
+ echo " 1. Copy .env.example to .env and fill in your credentials"
482
+ echo " 2. Build the image: docker build -t ${APP_NAME} ."
483
+ echo " 3. Scan for vulnerabilities: trivy image ${APP_NAME}"
484
+ echo " 4. Start the container: docker-compose up -d"
485
+ echo " 5. Verify security: docker exec ${APP_NAME} whoami (should show 'nginx')"
486
+ echo ""
487
+ echo "To verify hardening, run:"
488
+ echo " ./.agent/develop/verify-hardened-docker-skill/scripts/verify-docker-hardening.sh ${APP_NAME}"
489
+ echo ""