aienvmp 0.1.8 → 0.1.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.9
4
+
5
+ - Added top vulnerable package summaries for AI context, handoff, `AIENV.md`, and the dashboard.
6
+ - Ranked vulnerable packages by severity so agents can prioritize review without reading full audit output.
7
+ - Kept security package details bounded to preserve lightweight output.
8
+
3
9
  ## 0.1.8
4
10
 
5
11
  - Added optional `sync --security` / `scan --security` vulnerability summary collection.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aienvmp",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "AI-first environment maps and lightweight runtime SBOMs for shared development machines.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,7 +42,8 @@ function securitySummary(security = {}) {
42
42
  return {
43
43
  mode: security.mode || "basic",
44
44
  enabled: security.enabled === true,
45
- summary: security.summary || { total: 0, critical: 0, high: 0, moderate: 0, low: 0, info: 0 }
45
+ summary: security.summary || { total: 0, critical: 0, high: 0, moderate: 0, low: 0, info: 0 },
46
+ topPackages: security.topPackages || []
46
47
  };
47
48
  }
48
49
 
@@ -79,7 +79,8 @@ function securitySummary(security = {}) {
79
79
  return {
80
80
  mode: security.mode || "basic",
81
81
  enabled: security.enabled === true,
82
- summary: security.summary || { total: 0, critical: 0, high: 0, moderate: 0, low: 0, info: 0 }
82
+ summary: security.summary || { total: 0, critical: 0, high: 0, moderate: 0, low: 0, info: 0 },
83
+ topPackages: security.topPackages || []
83
84
  };
84
85
  }
85
86
 
package/src/render.js CHANGED
@@ -219,7 +219,8 @@ const inventoryCount=Object.values(inventoryGroups).reduce((sum,items)=>sum+(Arr
219
219
  const inventoryHtml=manifest.inventory?.enabled?('<table>'+Object.entries(inventoryGroups).map(([k,v])=>\`<tr><th>\${esc(k)}</th><td><code>\${Array.isArray(v)?v.length:0} tools</code></td></tr>\`).join('')+'</table>'):'<div class="okline">Deep global inventory is off. Run <code>aienvmp sync --deep</code> when an AI needs global tool awareness.</div>';
220
220
  const sec=manifest.security||{};
221
221
  const secSummary=sec.summary||{total:0,critical:0,high:0,moderate:0,low:0,info:0};
222
- const securityHtml=sec.enabled?\`<table><tr><th>Total</th><td><code>\${esc(secSummary.total||0)}</code></td></tr><tr><th>Critical</th><td><code>\${esc(secSummary.critical||0)}</code></td></tr><tr><th>High</th><td><code>\${esc(secSummary.high||0)}</code></td></tr><tr><th>Moderate</th><td><code>\${esc(secSummary.moderate||0)}</code></td></tr><tr><th>Low</th><td><code>\${esc(secSummary.low||0)}</code></td></tr></table>\`:'<div class="okline">Security scan is off. Run <code>aienvmp sync --security</code> for read-only vulnerability summary.</div>';
222
+ const secPackages=sec.topPackages||[];
223
+ const securityHtml=sec.enabled?\`<table><tr><th>Total</th><td><code>\${esc(secSummary.total||0)}</code></td></tr><tr><th>Critical</th><td><code>\${esc(secSummary.critical||0)}</code></td></tr><tr><th>High</th><td><code>\${esc(secSummary.high||0)}</code></td></tr><tr><th>Moderate</th><td><code>\${esc(secSummary.moderate||0)}</code></td></tr><tr><th>Low</th><td><code>\${esc(secSummary.low||0)}</code></td></tr></table>\${secPackages.length?'<div class="timeline">'+secPackages.slice(0,5).map(p=>\`<div class="event"><time>\${esc(p.severity)}</time><div><b>\${esc(p.name)}</b> \${p.fixAvailable?'fix available':'review required'}</div></div>\`).join('')+'</div>':'<div class="okline" style="margin-top:10px">No vulnerable packages reported.</div>'}\`:'<div class="okline">Security scan is off. Run <code>aienvmp sync --security</code> for read-only vulnerability summary.</div>';
223
224
  const change=c=>c.type==='changed'?\`\${c.scope} \${c.key}: \${c.before} -> \${c.after}\`:\`\${c.scope} \${c.key}: \${c.type} \${c.after||c.before}\`;
224
225
  const timelineLabel=t=>t.change?change(t.change):(t.summary||t.action||t.type||'recorded change');
225
226
  const agentNames={agents:'Codex',claude:'Claude',gemini:'Gemini'};
@@ -337,7 +338,7 @@ function inventoryLines(inventory = {}) {
337
338
  function securityLines(security = {}) {
338
339
  if (!security.enabled) return ["- Mode: basic", "- Security scan is disabled. Run `aienvmp sync --security` when vulnerability context is needed."];
339
340
  const summary = security.summary || {};
340
- return [
341
+ const lines = [
341
342
  "- Mode: security",
342
343
  `- Total vulnerabilities: ${summary.total || 0}`,
343
344
  `- Critical: ${summary.critical || 0}`,
@@ -345,6 +346,14 @@ function securityLines(security = {}) {
345
346
  `- Moderate: ${summary.moderate || 0}`,
346
347
  `- Low: ${summary.low || 0}`
347
348
  ];
349
+ const packages = security.topPackages || [];
350
+ if (packages.length) {
351
+ lines.push("- Top vulnerable packages:");
352
+ for (const pkg of packages.slice(0, 8)) {
353
+ lines.push(` - ${pkg.name}: ${pkg.severity}; ${pkg.fixAvailable ? "fix available" : "review required"}`);
354
+ }
355
+ }
356
+ return lines;
348
357
  }
349
358
 
350
359
  function policyLines(policy) {
package/src/security.js CHANGED
@@ -21,7 +21,8 @@ export async function scanSecurity(dir, options = {}) {
21
21
  scanners: {
22
22
  npmAudit
23
23
  },
24
- summary: summarizeScanners({ npmAudit })
24
+ summary: summarizeScanners({ npmAudit }),
25
+ topPackages: topVulnerablePackages({ npmAudit })
25
26
  };
26
27
  }
27
28
 
@@ -81,6 +82,15 @@ export function summarizeScanners(scanners = {}) {
81
82
  return summary;
82
83
  }
83
84
 
85
+ export function topVulnerablePackages(scanners = {}, limit = 8) {
86
+ const rank = { critical: 0, high: 1, moderate: 2, low: 3, info: 4, unknown: 5 };
87
+ return Object.values(scanners)
88
+ .filter((scanner) => scanner?.available)
89
+ .flatMap((scanner) => (scanner.vulnerablePackages || []).map((pkg) => ({ ...pkg, scanner: scanner.scanner })))
90
+ .sort((a, b) => (rank[a.severity] ?? rank.unknown) - (rank[b.severity] ?? rank.unknown) || a.name.localeCompare(b.name))
91
+ .slice(0, limit);
92
+ }
93
+
84
94
  function unavailable(scanner, reason) {
85
95
  return {
86
96
  scanner,