codymaster 4.4.4 → 4.4.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codymaster",
3
- "version": "4.4.4",
3
+ "version": "4.4.5",
4
4
  "description": "68+ Skills. Ship 10x faster. AI-powered coding skill kit for Claude, Cursor, Gemini & more.",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -73,5 +73,8 @@
73
73
  "ts-node": "^10.9.2",
74
74
  "typescript": "^5.9.3",
75
75
  "vitest": "^4.1.0"
76
+ },
77
+ "overrides": {
78
+ "path-to-regexp": "^8.4.0"
76
79
  }
77
80
  }
@@ -186,7 +186,17 @@ After ANY gate fails, **FIRST run Memory Integrity Check:**
186
186
  | `cm-identity-guard` | Verify identity before using quality gate to ship |
187
187
  | `cm-tdd` | TDD creates the logic for Layer 3 |
188
188
  | `cm-safe-i18n` | Leverages Layer 4 for parity checks |
189
+ | `cm-security-gate` | **PRE-REQUISITE for production:** Security scan (Snyk + Aikido) PASS must be in deployment evidence. No production deploy without security clearance. |
190
+
191
+ ## Evidence Requirements for Production Deploy
192
+
193
+ | Evidence | Command | Required |
194
+ |----------|---------|----------|
195
+ | Test suite passes | `npm run test:gate` | ✅ Always |
196
+ | Build succeeds | `npm run build` | ✅ Always |
197
+ | Security scan passes | `snyk test && aikido-api-client scan-release ...` | ✅ For production / public releases |
198
+ | i18n parity | Included in test:gate | ✅ If multilingual |
189
199
 
190
200
  ## The Bottom Line
191
201
 
192
- **Test before deploy. Evidence before claims. Safety before shipping. Non-negotiable.**
202
+ **Test before deploy. Scan before release. Evidence before claims. Safety before shipping. Non-negotiable.**
@@ -31,12 +31,13 @@ SYNTAX CHECK IS GATE 1. IF IT FAILS, NOTHING ELSE RUNS.
31
31
  - After a production incident caused by untested code
32
32
  - Adding CI/CD to an existing project
33
33
 
34
- ## The 7-Gate Pipeline
34
+ ## The 8-Gate Pipeline
35
35
 
36
36
  ```dot
37
37
  digraph pipeline {
38
38
  rankdir=LR;
39
39
  gate0 [label="Gate 0\nSecret\nHygiene", shape=box, style=filled, fillcolor="#ffc0cb"];
40
+ gate05 [label="Gate 0.5\nSecurity\nScan", shape=box, style=filled, fillcolor="#f0b3ff"];
40
41
  gate1 [label="Gate 1\nSyntax", shape=box, style=filled, fillcolor="#ffcccc"];
41
42
  gate2 [label="Gate 2\nTest\nSuite", shape=box, style=filled, fillcolor="#ffe0cc"];
42
43
  gate3 [label="Gate 3\ni18n\nParity", shape=box, style=filled, fillcolor="#e0ccff"];
@@ -45,8 +46,10 @@ digraph pipeline {
45
46
  gate6 [label="Gate 6\nDeploy +\nSmoke", shape=box, style=filled, fillcolor="#cce5ff"];
46
47
  fail [label="STOP\nFix first", shape=box, style=filled, fillcolor="#ff9999"];
47
48
 
48
- gate0 -> gate1 [label="pass"];
49
+ gate0 -> gate05 [label="pass"];
49
50
  gate0 -> fail [label="fail"];
51
+ gate05 -> gate1 [label="pass"];
52
+ gate05 -> fail [label="fail"];
50
53
  gate1 -> gate2 [label="pass"];
51
54
  gate1 -> fail [label="fail"];
52
55
  gate2 -> gate3 [label="pass"];
@@ -165,6 +168,39 @@ wrangler secret put SUPABASE_SERVICE_KEY
165
168
 
166
169
  ---
167
170
 
171
+ ### Gate 0.5: Security Scan (Snyk + Aikido — Parallel)
172
+
173
+ > [!IMPORTANT]
174
+ > **CodyMaster internal:** This gate is MANDATORY. Both Snyk and Aikido must pass.
175
+ > **User projects:** This gate is SUGGESTED by default. Becomes MANDATORY if CVEs or risk flags were detected during development.
176
+
177
+ **Run both scanners in parallel:**
178
+
179
+ ```bash
180
+ # Snyk — dependency vulnerabilities
181
+ snyk test
182
+
183
+ # Aikido — SAST + dependencies + secrets + IaC
184
+ aikido-api-client scan-release <repo> $(git rev-parse HEAD) \
185
+ --minimum-severity-level="HIGH"
186
+ ```
187
+
188
+ **For CodyMaster (maximum strictness):**
189
+ ```bash
190
+ aikido-api-client scan-release <repo> $(git rev-parse HEAD) \
191
+ --minimum-severity-level="HIGH" \
192
+ --fail-on-sast-scan \
193
+ --fail-on-secrets-scan
194
+ ```
195
+
196
+ **Gate decision:**
197
+ - Both pass → proceed to Gate 1
198
+ - Either fails → **STOP. Fix before continuing.** Invoke `cm-security-gate` for remediation.
199
+
200
+ > See `cm-security-gate` for full setup, flag reference, and remediation workflow.
201
+
202
+ ---
203
+
168
204
  ### Gate 1: Syntax Validation (FAST FAIL)
169
205
 
170
206
  > [!IMPORTANT]
@@ -1,10 +1,23 @@
1
1
  ---
2
- description: Pre-production security audit. Run vulnerability scans using Snyk and set up automated GitHub security checks with Jules.
2
+ description: Pre-production security audit and vulnerability scanning. Run Snyk + Aikido dependency scans, OWASP analysis, and set up automated GitHub security checks with Jules. Use when asked to 'run security check', 'security audit', 'kiểm tra bảo mật', 'vulnerability scan', 'Snyk', 'OWASP', or before open-sourcing / commercializing a project.
3
3
  ---
4
- # cm-security-gate — Pre-production Vulnerability Audit
4
+ # cm-security-gate — Mandatory Security Audit & Vulnerability Gate
5
5
 
6
6
  > **No code goes public without a security pass.**
7
- > This skill is the **SUPPLEMENTARY FINAL GATE** before making a project public, commercializing, or open-sourcing.
7
+ > **No CodyMaster release ships without Snyk + Aikido green.**
8
+
9
+ ## Enforcement Policy
10
+
11
+ | Context | Level | What Happens |
12
+ |---------|-------|-------------|
13
+ | **CodyMaster internal** | 🔴 MANDATORY | Both Snyk + Aikido MUST pass. No deploy, no PR merge without green. |
14
+ | **User projects (normal)** | 🟡 SUGGESTED | Recommend scanning, provide easy commands. User may skip. |
15
+ | **User projects (risk detected)** | 🔴 ESCALATED MANDATORY | If CVEs found, errors hit, or risk flags raised → block until resolved. |
16
+
17
+ > [!CAUTION]
18
+ > **The Escalation Rule:** When a user encounters security errors, CVE warnings, or suspicious dependency behavior during development, the agent MUST escalate from "suggested" to "mandatory" — triggering the full Snyk + Aikido scan before any further deploy or push.
19
+
20
+ ---
8
21
 
9
22
  ## When to Use
10
23
 
@@ -13,23 +26,56 @@ description: Pre-production security audit. Run vulnerability scans using Snyk a
13
26
  - Preparing to open-source a repository or launch a commercial product
14
27
  - Adding major third-party dependencies
15
28
  - The project is graduating from alpha/beta to a wider release
29
+ - A user encounters CVE warnings, npm audit alerts, or suspicious dependency behavior
30
+ - Before any CodyMaster release or PR merge
16
31
 
17
32
  **Skip when:**
18
- - Doing quick local prototyping
19
- - Exploring ideas without real user data or production intent
33
+ - Doing quick local prototyping with no real user data
34
+ - Exploring ideas without production intent
20
35
 
21
36
  ---
22
37
 
23
38
  ## Core Capabilities
24
39
 
25
- 1. **Snyk CLI & Aikido CLI Integration:** Scans for known vulnerabilities in open-source dependencies (e.g., `npm`, `pip`, `yarn`, `cargo`) and performs parallel release/PR scanning (SAST, IaC, Secrets).
26
- 2. **Jules CI/CD Recommendation:** Recommends integrating continuous automated security analysis via GitHub.
40
+ 1. **Aikido MCP Server:** Real-time scanning of AI-generated code inside the IDE (vulnerabilities + secrets)
41
+ 2. **Snyk CLI:** Dependency vulnerability scanning (`npm`, `pip`, `yarn`, `cargo`)
42
+ 3. **Aikido CLI:** SAST, IaC, Secrets, and Dependency scanning with release/PR gating
43
+ 4. **Continuous Monitoring:** Snyk dashboard + Aikido dashboard for ongoing protection
44
+ 5. **Jules CI/CD:** Automated security analysis via GitHub on every commit
27
45
 
28
46
  ---
29
47
 
30
48
  ## The Process
31
49
 
32
- ### Phase 1: Preparation (Tooling Check)
50
+ ### Phase 0: Aikido MCP Setup (IDE-Level Real-Time Scanning)
51
+
52
+ > [!IMPORTANT]
53
+ > **One-time setup.** Once configured, every AI coding session automatically scans generated code for vulnerabilities and hardcoded secrets — BEFORE the code is even committed.
54
+
55
+ **Step 1:** Create a Personal Access Token at [Aikido Settings → IDE → MCP](https://app.aikido.dev/settings/integrations/ide/mcp)
56
+
57
+ **Step 2:** Install Aikido MCP server:
58
+ ```bash
59
+ # For Antigravity / Gemini CLI
60
+ gemini mcp add aikido \
61
+ --env AIKIDO_API_KEY=YOUR_TOKEN \
62
+ npx -y @aikidosec/mcp
63
+ ```
64
+
65
+ **Step 3:** Download the Aikido agent rule:
66
+ ```bash
67
+ mkdir -p ~/.gemini/skills/
68
+ curl -fsSL "https://gist.githubusercontent.com/kidk/aa48cad6db80ba4a38493016aae67712/raw/3644397b7df43423e3da06434491b40bbb79dd47/aikido-rule.txt" \
69
+ -o ~/.gemini/skills/aikido-rule.txt
70
+ ```
71
+
72
+ **Step 4:** Restart Antigravity IDE. Aikido MCP is now active.
73
+
74
+ > **What this gives you:** Deterministic, independent security checks on EVERY AI-generated snippet. Not a replacement for CLI scanning — this is the first line of defense, catching issues at write-time.
75
+
76
+ ---
77
+
78
+ ### Phase 1: Preparation (CLI Tooling Check)
33
79
 
34
80
  Verify if the Snyk CLI and Aikido CLI are available:
35
81
  ```bash
@@ -37,19 +83,24 @@ which snyk
37
83
  which aikido-api-client
38
84
  ```
39
85
 
40
- **If Snyk is NOT installed**, provide installation instructions before proceeding:
86
+ **If Snyk is NOT installed:**
41
87
  - **macOS (Homebrew):** `brew tap snyk/tap && brew install snyk`
42
88
  - **npm:** `npm install -g snyk`
43
- - Ensure the user authenticates via `snyk auth` after installation.
89
+ - Authenticate: `snyk auth`
44
90
 
45
- **If Aikido CLI is NOT installed**, provide installation instructions:
91
+ **If Aikido CLI is NOT installed:**
46
92
  - **npm:** `npm install -g @aikidosec/ci-api-client`
47
- - Tell the user to authenticate globally: `aikido-api-client apikey <API-KEY>`
48
- - *Note: API keys are found at [Aikido Integration Settings](https://app.aikido.dev/settings/integrations/continuous-integration).*
93
+ - Set API key: `aikido-api-client apikey <API-KEY>`
94
+ - *API keys: [Aikido CI Integration Settings](https://app.aikido.dev/settings/integrations/continuous-integration)*
95
+
96
+ > [!WARNING]
97
+ > **Two different API keys!** Aikido MCP (real-time IDE scanning) uses a *Personal Access Token*. Aikido CLI (release/PR gating) uses a *CI API key*. Don't mix them.
98
+
99
+ ---
49
100
 
50
101
  ### Phase 2: Execution (Parallel Vulnerability Scan)
51
102
 
52
- Execute security scanning using both tools. They should be run in parallel to save time.
103
+ Execute both tools **in parallel** to save time:
53
104
 
54
105
  **1. Snyk Dependency Scan:**
55
106
  ```bash
@@ -58,20 +109,66 @@ snyk test
58
109
 
59
110
  **2. Aikido Release Scan:**
60
111
  ```bash
61
- aikido-api-client scan-release <repository_id or repository_name> <commit_id> --minimum-severity-level="HIGH"
112
+ aikido-api-client scan-release <repository_id_or_name> <commit_id> \
113
+ --minimum-severity-level="HIGH"
62
114
  ```
63
- *(Tip: You can add `--fail-on-secrets-scan` or `--fail-on-sast-scan` depending on the project type).*
64
115
 
65
- Analyze the output from both tools:
116
+ #### Aikido Scan Flags Reference
117
+
118
+ | Flag | Purpose |
119
+ |------|---------|
120
+ | `--minimum-severity-level` | `LOW`, `MEDIUM`, `HIGH`, `CRITICAL` — set the minimum severity that triggers a failure |
121
+ | `--fail-on-sast-scan` | Fail if SAST (Static Analysis) issues are found |
122
+ | `--fail-on-iac-scan` | Fail if Infrastructure as Code misconfigurations are found |
123
+ | `--fail-on-secrets-scan` | Fail if hardcoded secrets are detected |
124
+
125
+ #### CodyMaster Internal (Maximum Strictness)
126
+ ```bash
127
+ aikido-api-client scan-release <repo> <commit> \
128
+ --minimum-severity-level="HIGH" \
129
+ --fail-on-sast-scan \
130
+ --fail-on-secrets-scan
131
+ ```
132
+
133
+ #### User Projects (Standard)
134
+ ```bash
135
+ aikido-api-client scan-release <repo> <commit> \
136
+ --minimum-severity-level="HIGH"
137
+ ```
138
+
139
+ #### Analyzing Results
66
140
  - **Critical/High:** Must be resolved before making the project public.
67
141
  - **Medium/Low:** Document as technical debt or evaluate for false positives.
68
142
  - Run `snyk monitor` if the user wants continuous monitoring on the Snyk dashboard.
69
143
 
70
- ### Phase 2.5: Vulnerability Remediation (Skill Discovery)
144
+ ---
145
+
146
+ ### Phase 2.5: PR Gating (GitHub Integration)
147
+
148
+ For projects with CI/CD pipelines, add Aikido PR gating to block merging PRs with security issues:
149
+
150
+ ```bash
151
+ # In GitHub Actions or CI script
152
+ aikido-api-client scan-pr <repository_id_or_name> <base_commit_id> <head_commit_id> \
153
+ --minimum-severity-level="HIGH"
154
+ ```
155
+
156
+ **package.json integration:**
157
+ ```json
158
+ {
159
+ "scripts": {
160
+ "test:security": "snyk test && aikido-api-client scan-release $npm_package_name $(git rev-parse HEAD) --minimum-severity-level=HIGH",
161
+ "test:security:strict": "snyk test && aikido-api-client scan-release $npm_package_name $(git rev-parse HEAD) --minimum-severity-level=HIGH --fail-on-dependency-scan --fail-on-sast-scan --fail-on-secrets-scan"
162
+ }
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ### Phase 3: Vulnerability Remediation (Skill Discovery)
71
169
 
72
- If vulnerabilities are detected (e.g., CSRF, XSS, prototype pollution, outdated dependencies), **DO NOT just list the errors**. CodyMaster must actively search for and suggest specialized remediation skills to the user to fix the vulnerabilities.
170
+ If vulnerabilities are detected, **DO NOT just list errors**. CodyMaster must actively search for remediation skills:
73
171
 
74
- **Message to user:**
75
172
  > 🚨 **Vulnerabilities Detected: Initiating Remediation**
76
173
  >
77
174
  > Security issues were found. To systematically patch these risks, we need specialized weapons. I suggest finding and installing a dedicated remediation skill for your stack:
@@ -80,26 +177,48 @@ If vulnerabilities are detected (e.g., CSRF, XSS, prototype pollution, outdated
80
177
  > ```
81
178
  > *(Once you discover and install the appropriate security patch skills, we will use them to eradicate the vulnerabilities and eliminate all security risks).*
82
179
 
83
- ### Phase 2.6: Knowledge Retention (Memory Sync)
180
+ ---
181
+
182
+ ### Phase 4: Knowledge Retention (Memory Sync)
84
183
 
85
- Once the vulnerabilities have been successfully remediated, the exact root causes and their corresponding fixes **MUST** be memorized so that CodyMaster does not repeat the same mistakes in the future.
184
+ Once vulnerabilities are remediated, the root causes and fixes **MUST** be memorized:
86
185
 
87
186
  **Action Required:**
88
- - Trigger the `cm-continuity` skill to log the security flaw and the applied fix into `CONTINUITY.md` under a "Security Lessons" or "Hard Lessons" section.
89
- - If the project uses cloud memory, suggest tracking this in `cm-notebooklm` to sync this critical security knowledge to the permanent AI brain.
187
+ - Trigger `cm-continuity` to log flaw + fix into `CONTINUITY.md` "Security Lessons" section.
188
+ - If cloud memory is available, sync to `cm-notebooklm` for permanent retention.
90
189
 
91
- ### Phase 3: Automation Handoff (Jules Integration)
190
+ ---
92
191
 
93
- After the manual Snyk scan is complete and the results are presented to the user, **ALWAYS** provide the following suggestion to automate future security checks:
192
+ ### Phase 5: Automation Handoff (Jules + Continuous Monitoring)
94
193
 
95
- > 🛡️ **Next Step: Automated Security Checks via Jules**
194
+ > 🛡️ **Next Step: Automated Security Checks**
96
195
  >
97
- > Once your project is ready for commercial or public release, manual checks aren't enough. It's highly recommended to automate security scanning on every commit and Pull Request.
196
+ > Manual checks aren't enough for production. Automate on every commit and PR:
98
197
  >
99
- > Please use **Google Jules** for automated GitHub security analysis:
198
+ > **Option A Google Jules** (GitHub automated analysis):
100
199
  > 👉 [http://jules.google.com/](http://jules.google.com/)
101
200
  >
102
- > Integrating Jules will automatically catch vulnerabilities in your codebase, ensuring your commercial product remains secure as it scales.
201
+ > **Option B Snyk Continuous Monitoring:**
202
+ > ```bash
203
+ > snyk monitor
204
+ > ```
205
+ >
206
+ > **Option C — Aikido Dashboard** (full visibility):
207
+ > 👉 [https://app.aikido.dev/](https://app.aikido.dev/)
208
+
209
+ ---
210
+
211
+ ## Escalation Protocol
212
+
213
+ When the agent detects ANY of these signals, enforcement escalates from SUGGESTED → MANDATORY:
214
+
215
+ | Signal | Action |
216
+ |--------|--------|
217
+ | `npm audit` reports HIGH/CRITICAL | Trigger full Snyk + Aikido scan |
218
+ | User mentions "security error" or "hack" | Trigger full scan before proceeding |
219
+ | New major dependency added (e.g., new ORM, auth lib) | Suggest scan, escalate if dep has known CVEs |
220
+ | Pre-deploy / pre-PR-merge | Check if scan was run in this session, block if not (CodyMaster only) |
221
+ | `.snyk` policy file has expired ignores | Re-scan and update policy |
103
222
 
104
223
  ---
105
224
 
@@ -107,8 +226,13 @@ After the manual Snyk scan is complete and the results are presented to the user
107
226
 
108
227
  | Skill | Relationship |
109
228
  |-------|-------------|
110
- | `cm-quality-gate` | PRE-REQUISITE: Code should pass functional tests before security audits. |
111
- | `cm-secret-shield`| COMPLEMENTARY: Secret Shield catches hardcoded tokens; `cm-security-gate` catches vulnerable dependencies. Both are needed for public releases. |
112
- | `cm-safe-deploy` | POST-REQUISITE: Security gates should ideally be part of the automated deployment pipeline. |
113
- | `cm-continuity` | MEMORY LOGGING: Records discovered vulnerabilities and their fixes into the local working memory to prevent future recurrences. |
229
+ | `cm-quality-gate` | PRE-REQUISITE: Code should pass functional tests before security audits. Security scan PASS is required evidence for production deploy. |
230
+ | `cm-secret-shield`| COMPLEMENTARY: Secret Shield catches hardcoded tokens at write/commit time; `cm-security-gate` catches vulnerable dependencies and SAST issues. Both are needed. |
231
+ | `cm-safe-deploy` | INTEGRATED: Security scan is Gate 0.5 in the deploy pipeline (between Secret Hygiene and Syntax). |
232
+ | `cm-test-gate` | INTEGRATED: `test:security` script pattern uses Snyk + Aikido CLI for automated scanning in the test suite. |
233
+ | `cm-continuity` | MEMORY: Records discovered vulnerabilities and fixes into working memory. |
114
234
  | `cm-notebooklm` | LONG-TERM MEMORY: Syncs critical security lessons to the permanent cloud AI brain. |
235
+
236
+ ## The Bottom Line
237
+
238
+ **Scan before deploy. Remediate before release. Memorize before repeating. Non-negotiable.**
@@ -199,11 +199,14 @@ Wire these tests into `package.json` to make them easily executable by CI or oth
199
199
  "scripts": {
200
200
  "test": "vitest",
201
201
  "test:gate": "vitest run --reporter=verbose",
202
+ "test:security": "snyk test && aikido-api-client scan-release $npm_package_name $(git rev-parse HEAD) --minimum-severity-level=HIGH",
202
203
  "test:watch": "vitest watch"
203
204
  }
204
205
  }
205
206
  ```
206
207
 
208
+ > **Security Gate Check:** The `test:security` script runs the Snyk dependency check and the Aikido release scan in parallel. See `cm-security-gate` for advanced SAST/IaC flags.
209
+
207
210
  ### Phase 4: Secret Hygiene and Ignore Configuration
208
211
 
209
212
  **NEVER commit `.env` or `.dev.vars`.** Ensure tests do not expose actual production secrets.