kirograph 0.28.1 → 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.
- package/dist/architecture/index.js +4 -1
- package/dist/architecture/index.js.map +2 -2
- package/dist/architecture/manifest/index.js +13 -2
- package/dist/architecture/manifest/index.js.map +2 -2
- package/dist/bin/commands/install.js +2 -1
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/status.js +2 -1
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/uninit.js +2 -1
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/commands/vulns.js +10 -5
- package/dist/bin/commands/vulns.js.map +2 -2
- package/dist/bin/installer/common.js +7 -1
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/detect.js +10 -0
- package/dist/bin/installer/detect.js.map +2 -2
- package/dist/bin/installer/hooks.js +13 -8
- package/dist/bin/installer/hooks.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.js +1 -1
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/claude.js +1 -1
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/codex.js +1 -1
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/commandcode.js +84 -0
- package/dist/bin/installer/targets/commandcode.js.map +7 -0
- package/dist/bin/installer/targets/copilot.js +1 -1
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.js +2 -2
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.js +1 -1
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.js +1 -1
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/index.js +10 -0
- package/dist/bin/installer/targets/index.js.map +2 -2
- package/dist/bin/installer/targets/opencode.js +1 -1
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.js +1 -1
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +1 -1
- package/dist/bin/kirograph.js.map +1 -1
- package/dist/config.js +21 -1
- package/dist/config.js.map +2 -2
- package/dist/core/pipeline.js +18 -6
- package/dist/core/pipeline.js.map +2 -2
- package/dist/extraction/extractor.js +58 -1
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.js +38 -3
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/wasm/tree-sitter-bash.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-csharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-css.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-elisp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-elixir.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-elm.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-embedded_template.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-embeddedtemplate.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-html.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-json.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-objc.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ocaml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ql.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rescript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-solidity.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-systemrdl.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tlaplus.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-toml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vue.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-yaml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-zig.wasm +0 -0
- package/dist/frameworks/index.js +68 -7
- package/dist/frameworks/index.js.map +2 -2
- package/dist/security/manifest/adapter.js +17 -2
- package/dist/security/manifest/adapter.js.map +2 -2
- package/dist/security/manifest/parser.js +2 -2
- package/dist/security/manifest/parser.js.map +2 -2
- package/dist/security/pipeline.js +4 -1
- package/dist/security/pipeline.js.map +2 -2
- package/dist/security/reachability.js +61 -45
- package/dist/security/reachability.js.map +3 -3
- package/dist/security/types.js.map +1 -1
- package/dist/security/vuln/epss-client.js +1 -1
- package/dist/security/vuln/epss-client.js.map +1 -1
- package/dist/security/vuln/osv-adapter.js +99 -31
- package/dist/security/vuln/osv-adapter.js.map +2 -2
- package/dist/sync/index.js +9 -2
- package/dist/sync/index.js.map +2 -2
- package/dist/vectors/libsql-index.js +287 -0
- package/dist/vectors/libsql-index.js.map +7 -0
- package/dist/vectors/turso-index.js +307 -0
- package/dist/vectors/turso-index.js.map +7 -0
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/vulns.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport { loadConfig } from '../../config';\nimport { dim, reset, violet, bold, green } from '../ui';\nimport { formatFixSuggestion } from '../../security/export/fix-suggestions';\nimport { SuppressionManager } from '../../security/suppressions';\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Parse an `epss=N` fail-on value and return the threshold, or null if not an epss condition. */\nfunction parseEpssFailOn(failOn: string): number | null {\n const m = failOn.match(/^epss=(.+)$/);\n if (!m) return null;\n const n = parseFloat(m[1]);\n return isNaN(n) ? null : n;\n}\n\n/** Extract workspace label from a source_manifests JSON string. */\nfunction workspaceFromManifests(sourceManifests: string | null): string {\n if (!sourceManifests) return 'root';\n try {\n const manifests: string[] = JSON.parse(sourceManifests);\n if (!manifests.length) return 'root';\n const dir = path.dirname(manifests[0]);\n return dir === '.' ? 'root' : dir;\n } catch {\n return 'root';\n }\n}\n\nexport function register(program: Command): void {\n program\n .command('vulns [projectPath]')\n .description('List vulnerabilities with reachability verdicts and severity')\n .option('--severity <level>', 'Filter by severity: critical, high, medium, low')\n .option('--verdict <verdict>', 'Filter by verdict: affected, not_affected, under_investigation')\n .option('--refresh', 'Trigger fresh vulnerability enrichment before listing')\n .option('--epss <threshold>', 'Filter by EPSS score (e.g. 0.5 shows only vulns with EPSS >= 0.5)')\n .option('--stale', 'Show staleness score of the affected dependency alongside each CVE')\n .option('--sort <key>', 'Sort results by: risk (default), cvss, epss, name')\n .option('--add <cveId>', 'Manually register a CVE')\n .option('--package <name>', 'Package name for --add')\n .option('--version <ver>', 'Package version for --add')\n .option('--fail-on <condition>', 'Exit 1 if condition is met: affected, any, critical, high, epss=N')\n .option('--group-by <key>', 'Group output by: workspace')\n .action(async (projectPath: string | undefined, opts: {\n severity?: string;\n verdict?: string;\n refresh?: boolean;\n epss?: string;\n stale?: boolean;\n sort?: string;\n add?: string;\n package?: string;\n version?: string;\n failOn?: string;\n groupBy?: string;\n }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const config = await loadConfig(target);\n\n if (!config.enableSecurity) {\n console.error(`\\n ${'\\x1b[33m'}\u26A0 Security analysis is disabled.${reset}`);\n console.error(` ${dim}Enable it in .kirograph/config.json:${reset} ${violet}${bold}\"enableSecurity\": true${reset}`);\n console.error(` ${dim}Then re-run:${reset} ${violet}${bold}kirograph index${reset}\\n`);\n process.exit(1);\n }\n\n // Validate --fail-on early\n if (opts.failOn !== undefined) {\n const validFailOns = ['affected', 'any', 'critical', 'high'];\n const isEpss = parseEpssFailOn(opts.failOn) !== null;\n if (!validFailOns.includes(opts.failOn) && !isEpss) {\n console.error(` \u2716 Invalid --fail-on value: ${opts.failOn}. Use: affected, any, critical, high, epss=N`);\n process.exit(1);\n }\n }\n\n // Validate --group-by early\n if (opts.groupBy !== undefined && opts.groupBy !== 'workspace') {\n console.error(` \u2716 Invalid --group-by value: ${opts.groupBy}. Supported: workspace`);\n process.exit(1);\n }\n\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n if (!KiroGraph.isInitialized(target)) {\n console.error(' \u2716 KiroGraph not initialized. Run: kirograph init');\n process.exit(1);\n }\n\n const cg = await KiroGraph.open(target);\n const db = cg.getDatabase();\n db.applySecuritySchema();\n const rawDb = db.getRawDb();\n\n // Handle --add: manually register a CVE\n if (opts.add) {\n if (!opts.package || !opts.version) {\n console.error(` \u2716 --add requires --package <name> and --version <ver>`);\n cg.close(); process.exit(1);\n }\n\n const cveId = opts.add;\n const pkgName = opts.package;\n const pkgVersion = opts.version;\n\n // Find the matching dependency node\n const depRow: { node_id: string; ecosystem: string } | undefined = rawDb.get(\n `SELECT node_id, ecosystem FROM sec_dependencies\n WHERE package_name = ? AND (resolved_version = ? OR declared_constraint = ?)`,\n [pkgName, pkgVersion, pkgVersion],\n );\n\n if (!depRow) {\n console.error(` \u2716 No dependency found matching ${violet}${pkgName}@${pkgVersion}${reset}`);\n console.error(` ${dim}Run${reset} ${violet}${bold}kirograph index${reset} ${dim}first to discover dependencies.${reset}`);\n cg.close(); process.exit(1);\n }\n\n // Create the vulnerability node\n const vulnNodeId = `vuln:${cveId}`;\n const now = Date.now();\n\n rawDb.run(\n `INSERT OR REPLACE INTO nodes\n (id, kind, name, qualified_name, file_path, language,\n start_line, end_line, start_column, end_column,\n is_exported, is_async, is_static, is_abstract, updated_at)\n VALUES (?, 'vulnerability', ?, ?, '', 'unknown', 0, 0, 0, 0, 0, 0, 0, 0, ?)`,\n [vulnNodeId, cveId, cveId, now],\n );\n\n rawDb.run(\n `INSERT OR REPLACE INTO sec_vulnerabilities\n (node_id, cve_id, severity_score, affected_ranges, fixed_version, summary, source_database)\n VALUES (?, ?, NULL, '[]', NULL, 'Manually registered', 'manual')`,\n [vulnNodeId, cveId],\n );\n\n // Create has_vulnerability edge\n rawDb.run(\n `INSERT OR IGNORE INTO edges (source, target, kind, confidence, confidence_score)\n VALUES (?, ?, 'has_vulnerability', 'extracted', 1.0)`,\n [depRow.node_id, vulnNodeId],\n );\n\n console.log(` ${green}\u2713${reset} Registered ${violet}${bold}${cveId}${reset} against ${violet}${pkgName}@${pkgVersion}${reset}`);\n cg.close();\n return;\n }\n\n // Handle --refresh: trigger fresh vulnerability enrichment\n if (opts.refresh) {\n console.error(` ${dim}Refreshing vulnerability data from configured databases...${reset}`);\n const { OsvAdapter } = await Promise.resolve().then(() => require('../../security/vuln/osv-adapter.js'));\n const { VulnerabilityDatabaseClient } = await Promise.resolve().then(() => require('../../security/vuln/client.js'));\n\n const adapters = config.securityDatabases.map((dbName: string) => {\n if (dbName.toUpperCase() === 'OSV') return new OsvAdapter();\n return null;\n }).filter(Boolean) as any[];\n\n const client = new VulnerabilityDatabaseClient(adapters, db);\n const result = await client.enrichAll();\n\n console.error(` ${green}\u2713${reset} Checked ${bold}${result.dependenciesChecked}${reset} dependencies, found ${bold}${result.vulnerabilitiesFound}${reset} vulnerabilities`);\n if (result.errors.length > 0) {\n console.error(` ${'\\x1b[33m'}\u26A0${reset} ${result.errors.length} error(s) during enrichment`);\n }\n console.error();\n }\n\n // Build query for listing vulnerabilities\n // Include source_manifests when group-by workspace is requested\n const selectSourceManifests = opts.groupBy === 'workspace' ? `,\\n d.source_manifests` : '';\n let query = `\n SELECT\n v.node_id, v.cve_id, v.severity_score, v.fixed_version, v.summary, v.source_database,\n v.epss_score, v.epss_percentile, v.risk_score,\n d.package_name, d.ecosystem, d.resolved_version, d.declared_constraint,\n d.staleness_score,\n r.verdict${selectSourceManifests}\n FROM sec_vulnerabilities v\n LEFT JOIN edges e ON e.target = v.node_id AND e.kind = 'has_vulnerability'\n LEFT JOIN sec_dependencies d ON d.node_id = e.source\n LEFT JOIN sec_reachability r ON r.vulnerability_node_id = v.node_id\n WHERE 1=1\n `;\n const params: any[] = [];\n\n // Apply severity filter\n if (opts.severity) {\n const severityRanges: Record<string, [number, number]> = {\n critical: [9.0, 10.0],\n high: [7.0, 8.9],\n medium: [4.0, 6.9],\n low: [0.1, 3.9],\n };\n const range = severityRanges[opts.severity.toLowerCase()];\n if (!range) {\n console.error(` \u2716 Invalid severity: ${opts.severity}. Use: critical, high, medium, low`);\n cg.close(); process.exit(1);\n }\n query += ` AND v.severity_score >= ? AND v.severity_score <= ?`;\n params.push(range[0], range[1]);\n }\n\n // Apply verdict filter\n if (opts.verdict) {\n const validVerdicts = ['affected', 'not_affected', 'under_investigation'];\n if (!validVerdicts.includes(opts.verdict)) {\n console.error(` \u2716 Invalid verdict: ${opts.verdict}. Use: affected, not_affected, under_investigation`);\n cg.close(); process.exit(1);\n }\n query += ` AND r.verdict = ?`;\n params.push(opts.verdict);\n }\n\n // Apply EPSS threshold filter\n if (opts.epss !== undefined) {\n const epssThreshold = parseFloat(opts.epss);\n if (isNaN(epssThreshold) || epssThreshold < 0 || epssThreshold > 1) {\n console.error(` \u2716 Invalid EPSS threshold: ${opts.epss}. Use a number between 0 and 1 (e.g. 0.5)`);\n cg.close(); process.exit(1);\n }\n query += ` AND v.epss_score >= ?`;\n params.push(epssThreshold);\n }\n\n // Resolve sort order\n const sortKey = opts.sort?.toLowerCase() ?? 'risk';\n const validSortKeys = ['risk', 'cvss', 'epss', 'name'];\n if (!validSortKeys.includes(sortKey)) {\n console.error(` \u2716 Invalid sort key: ${opts.sort}. Use: risk, cvss, epss, name`);\n cg.close(); process.exit(1);\n }\n const sortClause =\n sortKey === 'risk' ? `v.risk_score DESC NULLS LAST` :\n sortKey === 'cvss' ? `v.severity_score DESC NULLS LAST` :\n sortKey === 'epss' ? `v.epss_score DESC NULLS LAST` :\n `v.cve_id ASC`;\n query += ` ORDER BY ${sortClause}`;\n\n const rows: Array<{\n node_id: string;\n cve_id: string;\n severity_score: number | null;\n fixed_version: string | null;\n summary: string | null;\n source_database: string;\n epss_score: number | null;\n epss_percentile: number | null;\n risk_score: number | null;\n package_name: string | null;\n ecosystem: string | null;\n resolved_version: string | null;\n declared_constraint: string | null;\n staleness_score: number | null;\n verdict: string | null;\n source_manifests?: string | null;\n }> = rawDb.all(query, params);\n\n // Deduplicate by (cve_id, package_name, ecosystem) \u2014 same CVE can appear multiple\n // times if a package is declared in multiple manifests (monorepo) or has multiple\n // dep nodes. Keep the row with the worst verdict (affected > under_investigation > not_affected > null).\n const verdictRank = (v: string | null) =>\n v === 'affected' ? 3 : v === 'under_investigation' ? 2 : v === 'not_affected' ? 1 : 0;\n const deduped = new Map<string, typeof rows[0]>();\n for (const row of rows) {\n const key = `${row.cve_id}::${row.package_name ?? ''}::${row.ecosystem ?? ''}`;\n const existing = deduped.get(key);\n if (!existing || verdictRank(row.verdict) > verdictRank(existing.verdict)) {\n deduped.set(key, row);\n }\n }\n const dedupedRows = [...deduped.values()];\n\n // Filter out suppressed CVEs\n const suppressions = new SuppressionManager(target);\n const suppressedRows = dedupedRows.filter(row => suppressions.isSuppressed(row.cve_id));\n const filteredRows = dedupedRows.filter(row => !suppressions.isSuppressed(row.cve_id));\n\n if (filteredRows.length === 0) {\n const filterNote = (opts.severity || opts.verdict)\n ? ` matching filters`\n : '';\n console.log(`\\n ${dim}No vulnerabilities found${filterNote}.${reset}\\n`);\n if (suppressedRows.length > 0) {\n console.log(` ${dim}${suppressedRows.length} CVE(s) suppressed \u2014 kirograph vuln suppressions to review${reset}\\n`);\n }\n cg.close();\n return;\n }\n\n // \u2500\u2500 Render a single vulnerability row \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n function printVulnRow(row: (typeof filteredRows)[0], indent = ' '): void {\n // Severity badge\n const score = row.severity_score;\n let severityLabel: string;\n let severityColor: string;\n if (score == null) {\n severityLabel = 'unknown';\n severityColor = dim;\n } else if (score >= 9.0) {\n severityLabel = 'CRITICAL';\n severityColor = '\\x1b[31m';\n } else if (score >= 7.0) {\n severityLabel = 'HIGH';\n severityColor = '\\x1b[31m';\n } else if (score >= 4.0) {\n severityLabel = 'MEDIUM';\n severityColor = '\\x1b[33m';\n } else {\n severityLabel = 'LOW';\n severityColor = dim;\n }\n\n // Verdict badge\n let verdictLabel: string;\n let verdictColor: string;\n if (!row.verdict) {\n verdictLabel = 'pending';\n verdictColor = dim;\n } else if (row.verdict === 'affected') {\n verdictLabel = 'affected';\n verdictColor = '\\x1b[31m';\n } else if (row.verdict === 'not_affected') {\n verdictLabel = 'not affected';\n verdictColor = green;\n } else {\n verdictLabel = 'investigating';\n verdictColor = '\\x1b[33m';\n }\n\n const pkg = row.package_name\n ? `${row.package_name}@${row.resolved_version || row.declared_constraint || '?'}`\n : 'unknown package';\n\n // EPSS badge\n let epssBadge = '';\n if (row.epss_score != null && row.epss_percentile != null) {\n const epssColor = row.epss_score >= 0.3 ? '\\x1b[33m' : dim;\n const scoreStr = row.epss_score.toFixed(2);\n const pctStr = `${Math.round(row.epss_percentile * 100)}th%`;\n epssBadge = ` ${epssColor}${dim}[EPSS: ${scoreStr} / ${pctStr}]${reset}`;\n }\n\n // Risk score badge\n let riskBadge = '';\n if (row.risk_score != null) {\n const riskColor = row.risk_score >= 7 ? '\\x1b[31m' : row.risk_score >= 4 ? '\\x1b[33m' : dim;\n riskBadge = ` ${riskColor}[Risk: ${row.risk_score.toFixed(1)}]${reset}`;\n }\n\n console.log(`${indent}${severityColor}${severityLabel}${reset} ${violet}${bold}${row.cve_id}${reset} ${dim}${pkg}${reset} [${verdictColor}${verdictLabel}${reset}]${epssBadge}${riskBadge}`);\n\n if (row.summary && row.summary !== 'Manually registered') {\n const truncated = row.summary.length > 100 ? row.summary.slice(0, 100) + '\u2026' : row.summary;\n console.log(`${indent} ${dim}${truncated}${reset}`);\n }\n\n // Staleness badge (when --stale flag is set)\n if (opts.stale && row.staleness_score != null) {\n const s = row.staleness_score;\n const staleColor = s >= 0.7 ? '\\x1b[31m' : s >= 0.4 ? '\\x1b[33m' : dim;\n console.log(`${indent} ${staleColor}${dim}[staleness: ${s.toFixed(2)}]${reset}`);\n }\n\n // Fix suggestion\n if (row.fixed_version && row.ecosystem && row.package_name) {\n const fix = formatFixSuggestion(row.ecosystem, row.package_name, row.fixed_version);\n if (fix) {\n console.log(`${indent} ${fix}`);\n }\n }\n\n console.log();\n }\n\n // \u2500\u2500 Output: grouped or flat \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n if (opts.groupBy === 'workspace') {\n // Group by workspace (directory of first source manifest)\n const groups = new Map<string, Array<(typeof filteredRows)[0]>>();\n for (const row of filteredRows) {\n const ws = workspaceFromManifests(row.source_manifests ?? null);\n if (!groups.has(ws)) groups.set(ws, []);\n groups.get(ws)!.push(row);\n }\n\n // Only apply workspace grouping when there are multiple distinct workspaces\n const workspaces = Array.from(groups.keys());\n if (workspaces.length <= 1) {\n // Single workspace \u2014 fall through to flat output\n console.log(`\\n ${bold}Vulnerabilities${reset} (${filteredRows.length})\\n`);\n for (const row of filteredRows) {\n printVulnRow(row);\n }\n } else {\n console.log(`\\n ${bold}Vulnerabilities${reset} (${filteredRows.length})\\n`);\n for (const ws of workspaces) {\n const wsRows = groups.get(ws)!;\n const count = wsRows.length;\n const header = `Workspace: ${ws} (${count} vulnerabilit${count === 1 ? 'y' : 'ies'})`;\n const line = '\u2500'.repeat(header.length);\n console.log(` ${bold}${header}${reset}`);\n console.log(` ${dim}${line}${reset}`);\n for (const row of wsRows) {\n printVulnRow(row);\n }\n }\n }\n } else {\n console.log(`\\n ${bold}Vulnerabilities${reset} (${filteredRows.length})\\n`);\n for (const row of filteredRows) {\n printVulnRow(row);\n }\n }\n\n if (suppressedRows.length > 0) {\n console.log(` ${dim}${suppressedRows.length} CVE(s) suppressed \u2014 kirograph vuln suppressions to review${reset}\\n`);\n }\n\n // \u2500\u2500 CI exit codes: --fail-on \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n if (opts.failOn !== undefined) {\n const failOn = opts.failOn;\n\n let failCount = 0;\n let failReason = '';\n\n if (failOn === 'affected') {\n failCount = filteredRows.filter(r => r.verdict === 'affected').length;\n failReason = `affected`;\n } else if (failOn === 'any') {\n failCount = filteredRows.length;\n failReason = `any`;\n } else if (failOn === 'critical') {\n failCount = filteredRows.filter(r => r.severity_score != null && r.severity_score >= 9.0).length;\n failReason = `critical`;\n } else if (failOn === 'high') {\n failCount = filteredRows.filter(r => r.severity_score != null && r.severity_score >= 7.0).length;\n failReason = `high`;\n } else {\n const epssThreshold = parseEpssFailOn(failOn);\n if (epssThreshold !== null) {\n failCount = filteredRows.filter(r => r.epss_score != null && r.epss_score >= epssThreshold).length;\n failReason = `epss=${epssThreshold}`;\n }\n }\n\n if (failCount > 0) {\n console.log(` \\x1b[31m\u2716\\x1b[0m --fail-on ${failReason}: ${failCount} ${failReason === 'any' ? '' : `${failReason} `}vulnerabilit${failCount === 1 ? 'y' : 'ies'} found. Exiting with code 1.`);\n cg.close();\n process.exit(1);\n }\n }\n\n cg.close();\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,oBAA2B;AAC3B,gBAAgD;AAChD,6BAAoC;AACpC,0BAAmC;AAKnC,SAAS,gBAAgB,QAA+B;AACtD,QAAM,IAAI,OAAO,MAAM,aAAa;AACpC,MAAI,CAAC,EAAG,QAAO;AACf,QAAM,IAAI,WAAW,EAAE,CAAC,CAAC;AACzB,SAAO,MAAM,CAAC,IAAI,OAAO;AAC3B;AAGA,SAAS,uBAAuB,iBAAwC;AACtE,MAAI,CAAC,gBAAiB,QAAO;AAC7B,MAAI;AACF,UAAM,YAAsB,KAAK,MAAM,eAAe;AACtD,QAAI,CAAC,UAAU,OAAQ,QAAO;AAC9B,UAAM,MAAM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AA,qBAMG,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOpC,UAAM,SAAgB,CAAC;
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport { loadConfig } from '../../config';\nimport { dim, reset, violet, bold, green } from '../ui';\nimport { formatFixSuggestion } from '../../security/export/fix-suggestions';\nimport { SuppressionManager } from '../../security/suppressions';\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Parse an `epss=N` fail-on value and return the threshold, or null if not an epss condition. */\nfunction parseEpssFailOn(failOn: string): number | null {\n const m = failOn.match(/^epss=(.+)$/);\n if (!m) return null;\n const n = parseFloat(m[1]);\n return isNaN(n) ? null : n;\n}\n\n/** Extract workspace label from a source_manifests JSON string. */\nfunction workspaceFromManifests(sourceManifests: string | null): string {\n if (!sourceManifests) return 'root';\n try {\n const manifests: string[] = JSON.parse(sourceManifests);\n if (!manifests.length) return 'root';\n const dir = path.dirname(manifests[0]);\n return dir === '.' ? 'root' : dir;\n } catch {\n return 'root';\n }\n}\n\nexport function register(program: Command): void {\n program\n .command('vulns [projectPath]')\n .description('List vulnerabilities with reachability verdicts and severity')\n .option('--severity <level>', 'Filter by severity: critical, high, medium, low')\n .option('--verdict <verdict>', 'Filter by verdict: affected, not_affected, under_investigation')\n .option('--refresh', 'Trigger fresh vulnerability enrichment before listing')\n .option('--epss <threshold>', 'Filter by EPSS score (e.g. 0.5 shows only vulns with EPSS >= 0.5)')\n .option('--stale', 'Show staleness score of the affected dependency alongside each CVE')\n .option('--sort <key>', 'Sort results by: risk (default), cvss, epss, name')\n .option('--add <cveId>', 'Manually register a CVE')\n .option('--package <name>', 'Package name for --add')\n .option('--version <ver>', 'Package version for --add')\n .option('--fail-on <condition>', 'Exit 1 if condition is met: affected, any, critical, high, epss=N')\n .option('--group-by <key>', 'Group output by: workspace')\n .action(async (projectPath: string | undefined, opts: {\n severity?: string;\n verdict?: string;\n refresh?: boolean;\n epss?: string;\n stale?: boolean;\n sort?: string;\n add?: string;\n package?: string;\n version?: string;\n failOn?: string;\n groupBy?: string;\n }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const config = await loadConfig(target);\n\n if (!config.enableSecurity) {\n console.error(`\\n ${'\\x1b[33m'}\u26A0 Security analysis is disabled.${reset}`);\n console.error(` ${dim}Enable it in .kirograph/config.json:${reset} ${violet}${bold}\"enableSecurity\": true${reset}`);\n console.error(` ${dim}Then re-run:${reset} ${violet}${bold}kirograph index${reset}\\n`);\n process.exit(1);\n }\n\n // Validate --fail-on early\n if (opts.failOn !== undefined) {\n const validFailOns = ['affected', 'any', 'critical', 'high'];\n const isEpss = parseEpssFailOn(opts.failOn) !== null;\n if (!validFailOns.includes(opts.failOn) && !isEpss) {\n console.error(` \u2716 Invalid --fail-on value: ${opts.failOn}. Use: affected, any, critical, high, epss=N`);\n process.exit(1);\n }\n }\n\n // Validate --group-by early\n if (opts.groupBy !== undefined && opts.groupBy !== 'workspace') {\n console.error(` \u2716 Invalid --group-by value: ${opts.groupBy}. Supported: workspace`);\n process.exit(1);\n }\n\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n if (!KiroGraph.isInitialized(target)) {\n console.error(' \u2716 KiroGraph not initialized. Run: kirograph init');\n process.exit(1);\n }\n\n const cg = await KiroGraph.open(target);\n const db = cg.getDatabase();\n db.applySecuritySchema();\n const rawDb = db.getRawDb();\n\n // Handle --add: manually register a CVE\n if (opts.add) {\n if (!opts.package || !opts.version) {\n console.error(` \u2716 --add requires --package <name> and --version <ver>`);\n cg.close(); process.exit(1);\n }\n\n const cveId = opts.add;\n const pkgName = opts.package;\n const pkgVersion = opts.version;\n\n // Find the matching dependency node\n const depRow: { node_id: string; ecosystem: string } | undefined = rawDb.get(\n `SELECT node_id, ecosystem FROM sec_dependencies\n WHERE package_name = ? AND (resolved_version = ? OR declared_constraint = ?)`,\n [pkgName, pkgVersion, pkgVersion],\n );\n\n if (!depRow) {\n console.error(` \u2716 No dependency found matching ${violet}${pkgName}@${pkgVersion}${reset}`);\n console.error(` ${dim}Run${reset} ${violet}${bold}kirograph index${reset} ${dim}first to discover dependencies.${reset}`);\n cg.close(); process.exit(1);\n }\n\n // Create the vulnerability node\n const vulnNodeId = `vuln:${cveId}`;\n const now = Date.now();\n\n rawDb.run(\n `INSERT OR REPLACE INTO nodes\n (id, kind, name, qualified_name, file_path, language,\n start_line, end_line, start_column, end_column,\n is_exported, is_async, is_static, is_abstract, updated_at)\n VALUES (?, 'vulnerability', ?, ?, '', 'unknown', 0, 0, 0, 0, 0, 0, 0, 0, ?)`,\n [vulnNodeId, cveId, cveId, now],\n );\n\n rawDb.run(\n `INSERT OR REPLACE INTO sec_vulnerabilities\n (node_id, cve_id, severity_score, affected_ranges, fixed_version, summary, source_database)\n VALUES (?, ?, NULL, '[]', NULL, 'Manually registered', 'manual')`,\n [vulnNodeId, cveId],\n );\n\n // Create has_vulnerability edge\n rawDb.run(\n `INSERT OR IGNORE INTO edges (source, target, kind, confidence, confidence_score)\n VALUES (?, ?, 'has_vulnerability', 'extracted', 1.0)`,\n [depRow.node_id, vulnNodeId],\n );\n\n console.log(` ${green}\u2713${reset} Registered ${violet}${bold}${cveId}${reset} against ${violet}${pkgName}@${pkgVersion}${reset}`);\n cg.close();\n return;\n }\n\n // Handle --refresh: trigger fresh vulnerability enrichment\n if (opts.refresh) {\n console.error(` ${dim}Refreshing vulnerability data from configured databases...${reset}`);\n const { OsvAdapter } = await Promise.resolve().then(() => require('../../security/vuln/osv-adapter.js'));\n const { VulnerabilityDatabaseClient } = await Promise.resolve().then(() => require('../../security/vuln/client.js'));\n\n const adapters = config.securityDatabases.map((dbName: string) => {\n if (dbName.toUpperCase() === 'OSV') return new OsvAdapter();\n return null;\n }).filter(Boolean) as any[];\n\n const client = new VulnerabilityDatabaseClient(adapters, db);\n const result = await client.enrichAll();\n\n console.error(` ${green}\u2713${reset} Checked ${bold}${result.dependenciesChecked}${reset} dependencies, found ${bold}${result.vulnerabilitiesFound}${reset} vulnerabilities`);\n if (result.errors.length > 0) {\n console.error(` ${'\\x1b[33m'}\u26A0${reset} ${result.errors.length} error(s) during enrichment`);\n }\n console.error();\n }\n\n // Build query for listing vulnerabilities\n // Include source_manifests when group-by workspace is requested\n const selectSourceManifests = opts.groupBy === 'workspace' ? `,\\n d.source_manifests` : '';\n let query = `\n SELECT\n v.node_id, v.cve_id, v.severity_score, v.fixed_version, v.summary, v.source_database,\n v.epss_score, v.epss_percentile, v.risk_score,\n d.package_name, d.ecosystem, d.resolved_version, d.declared_constraint,\n d.staleness_score,\n r.verdict${selectSourceManifests}\n FROM sec_vulnerabilities v\n LEFT JOIN edges e ON e.target = v.node_id AND e.kind = 'has_vulnerability'\n LEFT JOIN sec_dependencies d ON d.node_id = e.source\n LEFT JOIN sec_reachability r ON r.vulnerability_node_id = v.node_id\n WHERE 1=1\n `;\n const params: any[] = [];\n\n // Apply severity filter.\n // Bounds are half-open [min, max) and MUST mirror the display buckets in\n // printVulnRow() so the filter and the rendered label never disagree:\n // CRITICAL >= 9.0, HIGH >= 7.0, MEDIUM >= 4.0, LOW < 4.0 (incl. 0.0).\n if (opts.severity) {\n const severityRanges: Record<string, [number, number]> = {\n critical: [9.0, 10.01],\n high: [7.0, 9.0],\n medium: [4.0, 7.0],\n low: [0.0, 4.0],\n };\n const range = severityRanges[opts.severity.toLowerCase()];\n if (!range) {\n console.error(` \u2716 Invalid severity: ${opts.severity}. Use: critical, high, medium, low`);\n cg.close(); process.exit(1);\n }\n // severity_score IS NULL means \"unknown\" \u2014 excluded from every band.\n query += ` AND v.severity_score IS NOT NULL AND v.severity_score >= ? AND v.severity_score < ?`;\n params.push(range[0], range[1]);\n }\n\n // Apply verdict filter\n if (opts.verdict) {\n const validVerdicts = ['affected', 'not_affected', 'under_investigation'];\n if (!validVerdicts.includes(opts.verdict)) {\n console.error(` \u2716 Invalid verdict: ${opts.verdict}. Use: affected, not_affected, under_investigation`);\n cg.close(); process.exit(1);\n }\n query += ` AND r.verdict = ?`;\n params.push(opts.verdict);\n }\n\n // Apply EPSS threshold filter\n if (opts.epss !== undefined) {\n const epssThreshold = parseFloat(opts.epss);\n if (isNaN(epssThreshold) || epssThreshold < 0 || epssThreshold > 1) {\n console.error(` \u2716 Invalid EPSS threshold: ${opts.epss}. Use a number between 0 and 1 (e.g. 0.5)`);\n cg.close(); process.exit(1);\n }\n query += ` AND v.epss_score >= ?`;\n params.push(epssThreshold);\n }\n\n // Resolve sort order\n const sortKey = opts.sort?.toLowerCase() ?? 'risk';\n const validSortKeys = ['risk', 'cvss', 'epss', 'name'];\n if (!validSortKeys.includes(sortKey)) {\n console.error(` \u2716 Invalid sort key: ${opts.sort}. Use: risk, cvss, epss, name`);\n cg.close(); process.exit(1);\n }\n const sortClause =\n sortKey === 'risk' ? `v.risk_score DESC NULLS LAST` :\n sortKey === 'cvss' ? `v.severity_score DESC NULLS LAST` :\n sortKey === 'epss' ? `v.epss_score DESC NULLS LAST` :\n `v.cve_id ASC`;\n query += ` ORDER BY ${sortClause}`;\n\n const rows: Array<{\n node_id: string;\n cve_id: string;\n severity_score: number | null;\n fixed_version: string | null;\n summary: string | null;\n source_database: string;\n epss_score: number | null;\n epss_percentile: number | null;\n risk_score: number | null;\n package_name: string | null;\n ecosystem: string | null;\n resolved_version: string | null;\n declared_constraint: string | null;\n staleness_score: number | null;\n verdict: string | null;\n source_manifests?: string | null;\n }> = rawDb.all(query, params);\n\n // Deduplicate by (cve_id, package_name, ecosystem) \u2014 same CVE can appear multiple\n // times if a package is declared in multiple manifests (monorepo) or has multiple\n // dep nodes. Keep the row with the worst verdict (affected > under_investigation > not_affected > null).\n const verdictRank = (v: string | null) =>\n v === 'affected' ? 3 : v === 'under_investigation' ? 2 : v === 'not_affected' ? 1 : 0;\n const deduped = new Map<string, typeof rows[0]>();\n for (const row of rows) {\n const key = `${row.cve_id}::${row.package_name ?? ''}::${row.ecosystem ?? ''}`;\n const existing = deduped.get(key);\n if (!existing || verdictRank(row.verdict) > verdictRank(existing.verdict)) {\n deduped.set(key, row);\n }\n }\n const dedupedRows = [...deduped.values()];\n\n // Filter out suppressed CVEs\n const suppressions = new SuppressionManager(target);\n const suppressedRows = dedupedRows.filter(row => suppressions.isSuppressed(row.cve_id));\n const filteredRows = dedupedRows.filter(row => !suppressions.isSuppressed(row.cve_id));\n\n if (filteredRows.length === 0) {\n const filterNote = (opts.severity || opts.verdict)\n ? ` matching filters`\n : '';\n console.log(`\\n ${dim}No vulnerabilities found${filterNote}.${reset}\\n`);\n if (suppressedRows.length > 0) {\n console.log(` ${dim}${suppressedRows.length} CVE(s) suppressed \u2014 kirograph vuln suppressions to review${reset}\\n`);\n }\n cg.close();\n return;\n }\n\n // \u2500\u2500 Render a single vulnerability row \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n function printVulnRow(row: (typeof filteredRows)[0], indent = ' '): void {\n // Severity badge\n const score = row.severity_score;\n let severityLabel: string;\n let severityColor: string;\n if (score == null) {\n severityLabel = 'unknown';\n severityColor = dim;\n } else if (score >= 9.0) {\n severityLabel = 'CRITICAL';\n severityColor = '\\x1b[31m';\n } else if (score >= 7.0) {\n severityLabel = 'HIGH';\n severityColor = '\\x1b[31m';\n } else if (score >= 4.0) {\n severityLabel = 'MEDIUM';\n severityColor = '\\x1b[33m';\n } else {\n severityLabel = 'LOW';\n severityColor = dim;\n }\n\n // Verdict badge\n let verdictLabel: string;\n let verdictColor: string;\n if (!row.verdict) {\n verdictLabel = 'pending';\n verdictColor = dim;\n } else if (row.verdict === 'affected') {\n verdictLabel = 'affected';\n verdictColor = '\\x1b[31m';\n } else if (row.verdict === 'not_affected') {\n verdictLabel = 'not affected';\n verdictColor = green;\n } else {\n verdictLabel = 'investigating';\n verdictColor = '\\x1b[33m';\n }\n\n const pkg = row.package_name\n ? `${row.package_name}@${row.resolved_version || row.declared_constraint || '?'}`\n : 'unknown package';\n\n // EPSS badge\n let epssBadge = '';\n if (row.epss_score != null && row.epss_percentile != null) {\n const epssColor = row.epss_score >= 0.3 ? '\\x1b[33m' : dim;\n const scoreStr = row.epss_score.toFixed(2);\n const pctStr = `${Math.round(row.epss_percentile * 100)}th%`;\n epssBadge = ` ${epssColor}${dim}[EPSS: ${scoreStr} / ${pctStr}]${reset}`;\n }\n\n // Risk score badge\n let riskBadge = '';\n if (row.risk_score != null) {\n const riskColor = row.risk_score >= 7 ? '\\x1b[31m' : row.risk_score >= 4 ? '\\x1b[33m' : dim;\n riskBadge = ` ${riskColor}[Risk: ${row.risk_score.toFixed(1)}]${reset}`;\n }\n\n console.log(`${indent}${severityColor}${severityLabel}${reset} ${violet}${bold}${row.cve_id}${reset} ${dim}${pkg}${reset} [${verdictColor}${verdictLabel}${reset}]${epssBadge}${riskBadge}`);\n\n if (row.summary && row.summary !== 'Manually registered') {\n const truncated = row.summary.length > 100 ? row.summary.slice(0, 100) + '\u2026' : row.summary;\n console.log(`${indent} ${dim}${truncated}${reset}`);\n }\n\n // Staleness badge (when --stale flag is set)\n if (opts.stale && row.staleness_score != null) {\n const s = row.staleness_score;\n const staleColor = s >= 0.7 ? '\\x1b[31m' : s >= 0.4 ? '\\x1b[33m' : dim;\n console.log(`${indent} ${staleColor}${dim}[staleness: ${s.toFixed(2)}]${reset}`);\n }\n\n // Fix suggestion\n if (row.fixed_version && row.ecosystem && row.package_name) {\n const fix = formatFixSuggestion(row.ecosystem, row.package_name, row.fixed_version);\n if (fix) {\n console.log(`${indent} ${fix}`);\n }\n }\n\n console.log();\n }\n\n // \u2500\u2500 Output: grouped or flat \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n if (opts.groupBy === 'workspace') {\n // Group by workspace (directory of first source manifest)\n const groups = new Map<string, Array<(typeof filteredRows)[0]>>();\n for (const row of filteredRows) {\n const ws = workspaceFromManifests(row.source_manifests ?? null);\n if (!groups.has(ws)) groups.set(ws, []);\n groups.get(ws)!.push(row);\n }\n\n // Only apply workspace grouping when there are multiple distinct workspaces\n const workspaces = Array.from(groups.keys());\n if (workspaces.length <= 1) {\n // Single workspace \u2014 fall through to flat output\n console.log(`\\n ${bold}Vulnerabilities${reset} (${filteredRows.length})\\n`);\n for (const row of filteredRows) {\n printVulnRow(row);\n }\n } else {\n console.log(`\\n ${bold}Vulnerabilities${reset} (${filteredRows.length})\\n`);\n for (const ws of workspaces) {\n const wsRows = groups.get(ws)!;\n const count = wsRows.length;\n const header = `Workspace: ${ws} (${count} vulnerabilit${count === 1 ? 'y' : 'ies'})`;\n const line = '\u2500'.repeat(header.length);\n console.log(` ${bold}${header}${reset}`);\n console.log(` ${dim}${line}${reset}`);\n for (const row of wsRows) {\n printVulnRow(row);\n }\n }\n }\n } else {\n console.log(`\\n ${bold}Vulnerabilities${reset} (${filteredRows.length})\\n`);\n for (const row of filteredRows) {\n printVulnRow(row);\n }\n }\n\n if (suppressedRows.length > 0) {\n console.log(` ${dim}${suppressedRows.length} CVE(s) suppressed \u2014 kirograph vuln suppressions to review${reset}\\n`);\n }\n\n // Hint when reachability hasn't been computed yet (verdict is pending).\n // vulns --refresh only re-queries vulnerability data; the call-graph\n // reachability analysis that resolves [pending] \u2192 [affected]/[not affected]\n // runs during `kirograph index`.\n const pendingCount = filteredRows.filter(r => !r.verdict).length;\n if (pendingCount > 0) {\n console.log(` ${dim}${pendingCount} vulnerabilit${pendingCount === 1 ? 'y is' : 'ies are'} [pending] reachability analysis \u2014 run ${reset}kirograph index${dim} to compute call-graph verdicts.${reset}\\n`);\n }\n\n // \u2500\u2500 CI exit codes: --fail-on \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n if (opts.failOn !== undefined) {\n const failOn = opts.failOn;\n\n let failCount = 0;\n let failReason = '';\n\n if (failOn === 'affected') {\n failCount = filteredRows.filter(r => r.verdict === 'affected').length;\n failReason = `affected`;\n } else if (failOn === 'any') {\n failCount = filteredRows.length;\n failReason = `any`;\n } else if (failOn === 'critical') {\n failCount = filteredRows.filter(r => r.severity_score != null && r.severity_score >= 9.0).length;\n failReason = `critical`;\n } else if (failOn === 'high') {\n failCount = filteredRows.filter(r => r.severity_score != null && r.severity_score >= 7.0).length;\n failReason = `high`;\n } else {\n const epssThreshold = parseEpssFailOn(failOn);\n if (epssThreshold !== null) {\n failCount = filteredRows.filter(r => r.epss_score != null && r.epss_score >= epssThreshold).length;\n failReason = `epss=${epssThreshold}`;\n }\n }\n\n if (failCount > 0) {\n console.log(` \\x1b[31m\u2716\\x1b[0m --fail-on ${failReason}: ${failCount} ${failReason === 'any' ? '' : `${failReason} `}vulnerabilit${failCount === 1 ? 'y' : 'ies'} found. Exiting with code 1.`);\n cg.close();\n process.exit(1);\n }\n }\n\n cg.close();\n });\n}\n"],
|
|
5
|
+
"mapp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AK,GAAG,UAAU,GAAG,eAAe,cAAc,IAAI,MAAM,KAAK,8BAA8B;AAC9L,WAAG,MAAM;AACT,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF;AAEA,OAAG,MAAM;AAAA,EACX,CAAC;AACL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,6 +44,7 @@ __export(common_exports, {
|
|
|
44
44
|
removeGeneratedBlock: () => removeGeneratedBlock,
|
|
45
45
|
removeImportLine: () => removeImportLine,
|
|
46
46
|
removeMcpServersConfig: () => removeMcpServersConfig,
|
|
47
|
+
silentCommand: () => silentCommand,
|
|
47
48
|
upsertGeneratedBlock: () => upsertGeneratedBlock,
|
|
48
49
|
writeJson: () => writeJson,
|
|
49
50
|
writeMcpServersConfig: () => writeMcpServersConfig
|
|
@@ -55,7 +56,11 @@ var import_tool_names = require("../../mcp/tool-names");
|
|
|
55
56
|
const KIROGRAPH_SERVER_NAME = "kirograph";
|
|
56
57
|
const KIROGRAPH_COMMAND = "kirograph";
|
|
57
58
|
const KIROGRAPH_MCP_ARGS = ["serve", "--mcp"];
|
|
58
|
-
|
|
59
|
+
function silentCommand(baseCommand) {
|
|
60
|
+
const isWindows = process.platform === "win32";
|
|
61
|
+
return isWindows ? `${baseCommand} >nul 2>&1 || exit /b 0` : `${baseCommand} >/dev/null 2>&1 || true`;
|
|
62
|
+
}
|
|
63
|
+
const KIROGRAPH_SYNC_CMD = silentCommand("kirograph sync-if-dirty --quiet");
|
|
59
64
|
const KIROGRAPH_TOOLS = import_tool_names.KIROGRAPH_TOOL_NAMES;
|
|
60
65
|
const KIROGRAPH_SCOPED_TOOLS = import_tool_names.KIROGRAPH_TOOL_NAMES.map((name) => `@kirograph/${name}`);
|
|
61
66
|
function ensureDir(p) {
|
|
@@ -214,6 +219,7 @@ function printMcpCommand(command) {
|
|
|
214
219
|
removeGeneratedBlock,
|
|
215
220
|
removeImportLine,
|
|
216
221
|
removeMcpServersConfig,
|
|
222
|
+
silentCommand,
|
|
217
223
|
upsertGeneratedBlock,
|
|
218
224
|
writeJson,
|
|
219
225
|
writeMcpServersConfig
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/common.ts"],
|
|
4
|
-
"sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { KIROGRAPH_TOOL_NAMES } from '../../mcp/tool-names';\nimport type { InstructionOptions } from './instructions';\nimport type { CavemanMode } from './caveman';\n\n/** Single options object passed to every target's installLate(). */\nexport interface LateInstallOptions {\n cavemanMode?: CavemanMode | 'off';\n shellCompressionLevel?: string;\n enableMemory?: boolean;\n enableDocs?: boolean;\n enableData?: boolean;\n enableSecurity?: boolean;\n enableArchitecture?: boolean;\n enablePatterns?: boolean;\n enableWatchmen?: boolean;\n watchmenSynthesisMode?: 'local' | 'agent';\n enableWiki?: boolean;\n wikiSynthesisMode?: 'local' | 'agent';\n wikiLocalModel?: string;\n enableCodeHealth?: boolean;\n enableNavigation?: boolean;\n enableComplexity?: boolean;\n enableGitContext?: boolean;\n enableEditPrimitives?: boolean;\n enableBranch?: boolean;\n enableAgentUtils?: boolean;\n enableGeneralCompression?: boolean;\n trackCallSites?: boolean;\n kiroHookFormat?: 'v1-legacy' | 'v2';\n}\n\nexport type InstallTarget = 'kiro' | 'claude' | 'codex' | 'cursor' | 'antigravity' | 'opencode' | 'windsurf' | 'cline' | 'copilot' | 'copilot-cli' | 'junie' | 'gemini-cli' | 'continue' | 'roo' | 'warp' | 'aider' | 'trae' | 'augment' | 'kilo' | 'amp' | 'devin' | 'replit' | 'goose' | 'openhands' | 'tabnine' | 'mistral-vibe' | 'ibm-bob' | 'crush' | 'droid-factory' | 'forgecode' | 'iflow' | 'qwen' | 'rovo' | 'qoder';\n\nexport const KIROGRAPH_SERVER_NAME = 'kirograph';\nexport const KIROGRAPH_COMMAND = 'kirograph';\nexport const KIROGRAPH_MCP_ARGS = ['serve', '--mcp'];\nexport const KIROGRAPH_SYNC_CMD = 'kirograph sync-if-dirty --quiet 2>/dev/null || true';\nexport const KIROGRAPH_TOOLS = KIROGRAPH_TOOL_NAMES;\nexport const KIROGRAPH_SCOPED_TOOLS = KIROGRAPH_TOOL_NAMES.map(name => `@kirograph/${name}`);\n\nexport function ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nexport function readJson(p: string): any {\n try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch { return {}; }\n}\n\nexport function writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\n/**\n * Write MCP server config to a JSON file under the mcpServers key.\n * Returns true if the config was written, false if already configured (idempotent).\n */\nexport function writeMcpServersConfig(configPath: string, serverConfig: object): boolean {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n if (existing.mcpServers[KIROGRAPH_SERVER_NAME]) {\n return false; // Already configured\n }\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n return true;\n}\n\n/**\n * Always write (overwrite) the MCP server config entry, regardless of whether it already exists.\n * Used when the final state is known upfront and idempotency would cause stale data.\n */\nexport function overwriteMcpServersConfig(configPath: string, serverConfig: object): void {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n}\n\nexport function removeMcpServersConfig(configPath: string): boolean {\n if (!fs.existsSync(configPath)) return false;\n const existing = readJson(configPath);\n if (!existing.mcpServers?.[KIROGRAPH_SERVER_NAME]) return false;\n delete existing.mcpServers[KIROGRAPH_SERVER_NAME];\n writeJson(configPath, existing);\n return true;\n}\n\nexport function appendImportLine(filePath: string, line: string, heading: string): boolean {\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n if (existing.includes(line)) return false;\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + heading + '\\n' + line + '\\n');\n return true;\n}\n\nexport function removeImportLine(filePath: string, line: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const original = fs.readFileSync(filePath, 'utf8');\n const next = original\n .split('\\n')\n .filter(l => l.trim() !== line)\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nexport function upsertGeneratedBlock(filePath: string, blockId: string, heading: string, content: string): boolean {\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const block = `${start}\\n${heading}\\n\\n${content.trim()}\\n${end}`;\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n const pattern = new RegExp(`${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}`);\n\n if (pattern.test(existing)) {\n const next = existing.replace(pattern, block);\n if (next === existing) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n }\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + block + '\\n');\n return true;\n}\n\nexport function removeGeneratedBlock(filePath: string, blockId: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const original = fs.readFileSync(filePath, 'utf8');\n const pattern = new RegExp(`\\\\n?${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}\\\\n?`);\n const next = original.replace(pattern, '\\n').replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Build InstructionOptions from the installLate parameters.\n * Used by all targets to pass full feature config to buildAgentInstructions.\n */\nexport function buildInstructionOpts(opts: LateInstallOptions, hasHooks?: boolean): InstructionOptions {\n return {\n cavemanMode: opts.cavemanMode,\n shellCompressionLevel: (opts.shellCompressionLevel as InstructionOptions['shellCompressionLevel']) ?? undefined,\n enableArchitecture: opts.enableArchitecture ?? false,\n enableMemory: opts.enableMemory ?? false,\n enableDocs: opts.enableDocs ?? false,\n enableData: opts.enableData ?? false,\n enableSecurity: opts.enableSecurity ?? false,\n enablePatterns: opts.enablePatterns ?? false,\n enableWiki: opts.enableWiki ?? false,\n enableCodeHealth: opts.enableCodeHealth ?? false,\n enableNavigation: opts.enableNavigation ?? false,\n enableComplexity: opts.enableComplexity ?? false,\n enableGitContext: opts.enableGitContext ?? false,\n enableEditPrimitives: opts.enableEditPrimitives ?? false,\n enableBranch: opts.enableBranch ?? false,\n enableAgentUtils: opts.enableAgentUtils ?? false,\n enableGeneralCompression: opts.enableGeneralCompression ?? false,\n trackCallSites: opts.trackCallSites ?? false,\n hasHooks: hasHooks ?? false,\n };\n}\n\nconst violet = '\\x1b[38;5;99m';\nconst resetAnsi = '\\x1b[0m';\nconst dimAnsi = '\\x1b[2m';\nconst boldAnsi = '\\x1b[1m';\n\n/**\n * Print a highlighted MCP config JSON block for targets that need user-scoped setup.\n */\nexport function printMcpSetup(configPath: string, projectRoot: string): void {\n const escapedPath = projectRoot.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n console.log(`\\n ${dimAnsi}Add the MCP server manually:${resetAnsi}`);\n console.log(` ${dimAnsi}Edit${resetAnsi} ${violet}${boldAnsi}${configPath}${resetAnsi} ${dimAnsi}and add:${resetAnsi}`);\n console.log(` ${violet}{${resetAnsi}`);\n console.log(` ${violet} \"mcpServers\": {${resetAnsi}`);\n console.log(` ${violet} \"kirograph\": {${resetAnsi}`);\n console.log(` ${violet} \"command\": \"kirograph\",${resetAnsi}`);\n console.log(` ${violet} \"args\": [\"serve\", \"--mcp\", \"--path\", \"${escapedPath}\"]${resetAnsi}`);\n console.log(` ${violet} }${resetAnsi}`);\n console.log(` ${violet} }${resetAnsi}`);\n console.log(` ${violet}}${resetAnsi}\\n`);\n}\n\n/**\n * Print a highlighted CLI command for MCP registration.\n */\nexport function printMcpCommand(command: string): void {\n console.log(`\\n ${dimAnsi}Add the MCP server with:${resetAnsi}`);\n console.log(` ${violet}${boldAnsi}${command}${resetAnsi}\\n`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,wBAAqC;AAiC9B,MAAM,wBAAwB;AAC9B,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB,CAAC,SAAS,OAAO;
|
|
4
|
+
"sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { KIROGRAPH_TOOL_NAMES } from '../../mcp/tool-names';\nimport type { InstructionOptions } from './instructions';\nimport type { CavemanMode } from './caveman';\n\n/** Single options object passed to every target's installLate(). */\nexport interface LateInstallOptions {\n cavemanMode?: CavemanMode | 'off';\n shellCompressionLevel?: string;\n enableMemory?: boolean;\n enableDocs?: boolean;\n enableData?: boolean;\n enableSecurity?: boolean;\n enableArchitecture?: boolean;\n enablePatterns?: boolean;\n enableWatchmen?: boolean;\n watchmenSynthesisMode?: 'local' | 'agent';\n enableWiki?: boolean;\n wikiSynthesisMode?: 'local' | 'agent';\n wikiLocalModel?: string;\n enableCodeHealth?: boolean;\n enableNavigation?: boolean;\n enableComplexity?: boolean;\n enableGitContext?: boolean;\n enableEditPrimitives?: boolean;\n enableBranch?: boolean;\n enableAgentUtils?: boolean;\n enableGeneralCompression?: boolean;\n trackCallSites?: boolean;\n kiroHookFormat?: 'v1-legacy' | 'v2';\n}\n\nexport type InstallTarget = 'kiro' | 'claude' | 'codex' | 'cursor' | 'antigravity' | 'opencode' | 'windsurf' | 'cline' | 'copilot' | 'copilot-cli' | 'junie' | 'gemini-cli' | 'continue' | 'roo' | 'warp' | 'aider' | 'trae' | 'augment' | 'kilo' | 'amp' | 'devin' | 'replit' | 'goose' | 'openhands' | 'tabnine' | 'mistral-vibe' | 'ibm-bob' | 'crush' | 'droid-factory' | 'forgecode' | 'iflow' | 'qwen' | 'rovo' | 'qoder' | 'commandcode';\n\nexport const KIROGRAPH_SERVER_NAME = 'kirograph';\nexport const KIROGRAPH_COMMAND = 'kirograph';\nexport const KIROGRAPH_MCP_ARGS = ['serve', '--mcp'];\n\n/**\n * Wrap a kirograph command so it runs quietly and never fails the host process,\n * emitting shell syntax appropriate for the OS the install is running on.\n *\n * Hook commands are executed by the host agent's shell: POSIX sh/bash on\n * macOS/Linux, cmd.exe on Windows. The two use incompatible syntax for\n * discarding output and swallowing a non-zero exit code:\n * - POSIX: `<cmd> >/dev/null 2>&1 || true`\n * - cmd.exe: `<cmd> >nul 2>&1 || exit /b 0`\n *\n * On Windows `/dev/null` is treated as a literal path and `true` is not a valid\n * command, so the bash form silently breaks hooks (see issue #40).\n *\n * @param baseCommand the kirograph invocation without redirection, e.g. `kirograph sync --quiet`\n */\nexport function silentCommand(baseCommand: string): string {\n const isWindows = process.platform === 'win32';\n return isWindows\n ? `${baseCommand} >nul 2>&1 || exit /b 0`\n : `${baseCommand} >/dev/null 2>&1 || true`;\n}\n\nexport const KIROGRAPH_SYNC_CMD = silentCommand('kirograph sync-if-dirty --quiet');\nexport const KIROGRAPH_TOOLS = KIROGRAPH_TOOL_NAMES;\nexport const KIROGRAPH_SCOPED_TOOLS = KIROGRAPH_TOOL_NAMES.map(name => `@kirograph/${name}`);\n\nexport function ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nexport function readJson(p: string): any {\n try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch { return {}; }\n}\n\nexport function writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\n/**\n * Write MCP server config to a JSON file under the mcpServers key.\n * Returns true if the config was written, false if already configured (idempotent).\n */\nexport function writeMcpServersConfig(configPath: string, serverConfig: object): boolean {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n if (existing.mcpServers[KIROGRAPH_SERVER_NAME]) {\n return false; // Already configured\n }\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n return true;\n}\n\n/**\n * Always write (overwrite) the MCP server config entry, regardless of whether it already exists.\n * Used when the final state is known upfront and idempotency would cause stale data.\n */\nexport function overwriteMcpServersConfig(configPath: string, serverConfig: object): void {\n ensureDir(path.dirname(configPath));\n const existing = readJson(configPath);\n existing.mcpServers = existing.mcpServers ?? {};\n existing.mcpServers[KIROGRAPH_SERVER_NAME] = serverConfig;\n writeJson(configPath, existing);\n}\n\nexport function removeMcpServersConfig(configPath: string): boolean {\n if (!fs.existsSync(configPath)) return false;\n const existing = readJson(configPath);\n if (!existing.mcpServers?.[KIROGRAPH_SERVER_NAME]) return false;\n delete existing.mcpServers[KIROGRAPH_SERVER_NAME];\n writeJson(configPath, existing);\n return true;\n}\n\nexport function appendImportLine(filePath: string, line: string, heading: string): boolean {\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n if (existing.includes(line)) return false;\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + heading + '\\n' + line + '\\n');\n return true;\n}\n\nexport function removeImportLine(filePath: string, line: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const original = fs.readFileSync(filePath, 'utf8');\n const next = original\n .split('\\n')\n .filter(l => l.trim() !== line)\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nexport function upsertGeneratedBlock(filePath: string, blockId: string, heading: string, content: string): boolean {\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const block = `${start}\\n${heading}\\n\\n${content.trim()}\\n${end}`;\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : '';\n const pattern = new RegExp(`${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}`);\n\n if (pattern.test(existing)) {\n const next = existing.replace(pattern, block);\n if (next === existing) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n }\n\n const prefix = existing.length > 0 && !existing.endsWith('\\n') ? '\\n' : '';\n const separator = existing.trim().length > 0 ? '\\n' : '';\n fs.writeFileSync(filePath, existing + prefix + separator + block + '\\n');\n return true;\n}\n\nexport function removeGeneratedBlock(filePath: string, blockId: string): boolean {\n if (!fs.existsSync(filePath)) return false;\n const start = `<!-- kirograph:${blockId}:start -->`;\n const end = `<!-- kirograph:${blockId}:end -->`;\n const original = fs.readFileSync(filePath, 'utf8');\n const pattern = new RegExp(`\\\\n?${escapeRegExp(start)}[\\\\s\\\\S]*?${escapeRegExp(end)}\\\\n?`);\n const next = original.replace(pattern, '\\n').replace(/\\n{3,}/g, '\\n\\n');\n if (next === original) return false;\n fs.writeFileSync(filePath, next.endsWith('\\n') ? next : next + '\\n');\n return true;\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Build InstructionOptions from the installLate parameters.\n * Used by all targets to pass full feature config to buildAgentInstructions.\n */\nexport function buildInstructionOpts(opts: LateInstallOptions, hasHooks?: boolean): InstructionOptions {\n return {\n cavemanMode: opts.cavemanMode,\n shellCompressionLevel: (opts.shellCompressionLevel as InstructionOptions['shellCompressionLevel']) ?? undefined,\n enableArchitecture: opts.enableArchitecture ?? false,\n enableMemory: opts.enableMemory ?? false,\n enableDocs: opts.enableDocs ?? false,\n enableData: opts.enableData ?? false,\n enableSecurity: opts.enableSecurity ?? false,\n enablePatterns: opts.enablePatterns ?? false,\n enableWiki: opts.enableWiki ?? false,\n enableCodeHealth: opts.enableCodeHealth ?? false,\n enableNavigation: opts.enableNavigation ?? false,\n enableComplexity: opts.enableComplexity ?? false,\n enableGitContext: opts.enableGitContext ?? false,\n enableEditPrimitives: opts.enableEditPrimitives ?? false,\n enableBranch: opts.enableBranch ?? false,\n enableAgentUtils: opts.enableAgentUtils ?? false,\n enableGeneralCompression: opts.enableGeneralCompression ?? false,\n trackCallSites: opts.trackCallSites ?? false,\n hasHooks: hasHooks ?? false,\n };\n}\n\nconst violet = '\\x1b[38;5;99m';\nconst resetAnsi = '\\x1b[0m';\nconst dimAnsi = '\\x1b[2m';\nconst boldAnsi = '\\x1b[1m';\n\n/**\n * Print a highlighted MCP config JSON block for targets that need user-scoped setup.\n */\nexport function printMcpSetup(configPath: string, projectRoot: string): void {\n const escapedPath = projectRoot.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n console.log(`\\n ${dimAnsi}Add the MCP server manually:${resetAnsi}`);\n console.log(` ${dimAnsi}Edit${resetAnsi} ${violet}${boldAnsi}${configPath}${resetAnsi} ${dimAnsi}and add:${resetAnsi}`);\n console.log(` ${violet}{${resetAnsi}`);\n console.log(` ${violet} \"mcpServers\": {${resetAnsi}`);\n console.log(` ${violet} \"kirograph\": {${resetAnsi}`);\n console.log(` ${violet} \"command\": \"kirograph\",${resetAnsi}`);\n console.log(` ${violet} \"args\": [\"serve\", \"--mcp\", \"--path\", \"${escapedPath}\"]${resetAnsi}`);\n console.log(` ${violet} }${resetAnsi}`);\n console.log(` ${violet} }${resetAnsi}`);\n console.log(` ${violet}}${resetAnsi}\\n`);\n}\n\n/**\n * Print a highlighted CLI command for MCP registration.\n */\nexport function printMcpCommand(command: string): void {\n console.log(`\\n ${dimAnsi}Add the MCP server with:${resetAnsi}`);\n console.log(` ${violet}${boldAnsi}${command}${resetAnsi}\\n`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,wBAAqC;AAiC9B,MAAM,wBAAwB;AAC9B,MAAM,oBAAoB;AAC1B,MAAM,qBAAqB,CAAC,SAAS,OAAO;AAiB5C,SAAS,cAAc,aAA6B;AACzD,QAAM,YAAY,QAAQ,aAAa;AACvC,SAAO,YACH,GAAG,WAAW,4BACd,GAAG,WAAW;AACpB;AAEO,MAAM,qBAAqB,cAAc,iCAAiC;AAC1E,MAAM,kBAAkB;AACxB,MAAM,yBAAyB,uCAAqB,IAAI,UAAQ,cAAc,IAAI,EAAE;AAEpF,SAAS,UAAU,GAAiB;AACzC,KAAG,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AACrC;AAEO,SAAS,SAAS,GAAgB;AACvC,MAAI;AAAE,WAAO,KAAK,MAAM,GAAG,aAAa,GAAG,MAAM,CAAC;AAAA,EAAG,QAAQ;AAAE,WAAO,CAAC;AAAA,EAAG;AAC5E;AAEO,SAAS,UAAU,GAAW,MAAqB;AACxD,KAAG,cAAc,GAAG,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,IAAI;AAC1D;AAMO,SAAS,sBAAsB,YAAoB,cAA+B;AACvF,YAAU,KAAK,QAAQ,UAAU,CAAC;AAClC,QAAM,WAAW,SAAS,UAAU;AACpC,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S,EAAE;AACvH,UAAQ,IAAI,KAAK,MAAM,IAAI,SAAS,EAAE;AACtC,UAAQ,IAAI,KAAK,MAAM,oBAAoB,SAAS,EAAE;AACtD,UAAQ,IAAI,KAAK,MAAM,qBAAqB,SAAS,EAAE;AACvD,UAAQ,IAAI,KAAK,MAAM,gCAAgC,SAAS,EAAE;AAClE,UAAQ,IAAI,KAAK,MAAM,+CAA+C,WAAW,KAAK,SAAS,EAAE;AACjG,UAAQ,IAAI,KAAK,MAAM,QAAQ,SAAS,EAAE;AAC1C,UAAQ,IAAI,KAAK,MAAM,MAAM,SAAS,EAAE;AACxC,UAAQ,IAAI,KAAK,MAAM,IAAI,SAAS;AAAA,CAAI;AAC1C;AAKO,SAAS,gBAAgB,SAAuB;AACrD,UAAQ,IAAI;AAAA,IAAO,OAAO,2BAA2B,SAAS,EAAE;AAChE,UAAQ,IAAI,KAAK,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS;AAAA,CAAI;AAC9D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -286,6 +286,16 @@ const DETECTORS = [
|
|
|
286
286
|
if (dirExists(path.join(root, ".qoder"))) return { target: "qoder", label: "Qoder", reason: ".qoder/ found in project" };
|
|
287
287
|
return false;
|
|
288
288
|
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
target: "commandcode",
|
|
292
|
+
label: "Command Code",
|
|
293
|
+
reason: "",
|
|
294
|
+
detect: () => {
|
|
295
|
+
if (dirExists(path.join(home, ".commandcode"))) return { target: "commandcode", label: "Command Code", reason: "~/.commandcode/ found" };
|
|
296
|
+
if (whichExists("command-code")) return { target: "commandcode", label: "Command Code", reason: "command-code binary found in PATH" };
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
289
299
|
}
|
|
290
300
|
];
|
|
291
301
|
function detectPlatforms(projectRoot) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/detect.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Platform auto-detection for KiroGraph installer.\n *\n * Detects which AI coding tools are installed on the system by checking\n * for known config directories and CLI binaries. Used by `kirograph install`\n * (with no --target flag) to auto-configure all detected platforms.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { execSync } from 'child_process';\nimport type { InstallTarget } from './common';\n\nexport interface PlatformDetector {\n target: InstallTarget;\n label: string;\n /** How the platform was detected (shown to user) */\n reason: string;\n detect: (projectRoot: string) => DetectionResult | false;\n}\n\nexport interface DetectionResult {\n target: InstallTarget;\n label: string;\n reason: string;\n}\n\nfunction whichExists(binary: string): boolean {\n try {\n execSync(`which ${binary}`, { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction dirExists(p: string): boolean {\n return fs.existsSync(p) && fs.statSync(p).isDirectory();\n}\n\nfunction fileExists(p: string): boolean {\n return fs.existsSync(p) && fs.statSync(p).isFile();\n}\n\nconst home = process.env.HOME || process.env.USERPROFILE || '';\n\nconst DETECTORS: PlatformDetector[] = [\n {\n target: 'kiro',\n label: 'Kiro',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.kiro'))) return { target: 'kiro', label: 'Kiro', reason: '.kiro/ found in project' };\n if (dirExists(path.join(home, '.kiro'))) return { target: 'kiro', label: 'Kiro', reason: '~/.kiro/ found' };\n return false;\n },\n },\n {\n target: 'claude',\n label: 'Claude Code',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, '.mcp.json'))) return { target: 'claude', label: 'Claude Code', reason: '.mcp.json found in project' };\n if (whichExists('claude')) return { target: 'claude', label: 'Claude Code', reason: 'claude binary on PATH' };\n return false;\n },\n },\n {\n target: 'cursor',\n label: 'Cursor',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.cursor'))) return { target: 'cursor', label: 'Cursor', reason: '.cursor/ found in project' };\n if (dirExists(path.join(home, '.cursor'))) return { target: 'cursor', label: 'Cursor', reason: '~/.cursor/ found' };\n return false;\n },\n },\n {\n target: 'windsurf',\n label: 'Windsurf',\n reason: '',\n detect: () => {\n if (dirExists(path.join(home, '.codeium', 'windsurf'))) return { target: 'windsurf', label: 'Windsurf', reason: '~/.codeium/windsurf/ found' };\n return false;\n },\n },\n {\n target: 'codex',\n label: 'Codex',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.codex'))) return { target: 'codex', label: 'Codex', reason: '.codex/ found in project' };\n if (dirExists(path.join(home, '.codex'))) return { target: 'codex', label: 'Codex', reason: '~/.codex/ found' };\n if (whichExists('codex')) return { target: 'codex', label: 'Codex', reason: 'codex binary on PATH' };\n return false;\n },\n },\n {\n target: 'copilot',\n label: 'GitHub Copilot',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.vscode'))) return { target: 'copilot', label: 'GitHub Copilot', reason: '.vscode/ found in project' };\n if (dirExists(path.join(home, '.vscode'))) return { target: 'copilot', label: 'GitHub Copilot', reason: '~/.vscode/ found' };\n return false;\n },\n },\n {\n target: 'gemini-cli',\n label: 'Gemini CLI',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.gemini'))) return { target: 'gemini-cli', label: 'Gemini CLI', reason: '.gemini/ found in project' };\n if (whichExists('gemini')) return { target: 'gemini-cli', label: 'Gemini CLI', reason: 'gemini binary on PATH' };\n if (dirExists(path.join(home, '.gemini'))) return { target: 'gemini-cli', label: 'Gemini CLI', reason: '~/.gemini/ found' };\n return false;\n },\n },\n {\n target: 'cline',\n label: 'Cline',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.cline'))) return { target: 'cline', label: 'Cline', reason: '.cline/ found in project' };\n if (dirExists(path.join(root, '.clinerules'))) return { target: 'cline', label: 'Cline', reason: '.clinerules/ found in project' };\n return false;\n },\n },\n {\n target: 'roo',\n label: 'Roo Code',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.roo'))) return { target: 'roo', label: 'Roo Code', reason: '.roo/ found in project' };\n return false;\n },\n },\n {\n target: 'warp',\n label: 'Warp',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.warp'))) return { target: 'warp', label: 'Warp', reason: '.warp/ found in project' };\n if (whichExists('warp')) return { target: 'warp', label: 'Warp', reason: 'warp binary on PATH' };\n return false;\n },\n },\n {\n target: 'continue',\n label: 'Continue',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.continue'))) return { target: 'continue', label: 'Continue', reason: '.continue/ found in project' };\n if (dirExists(path.join(home, '.continue'))) return { target: 'continue', label: 'Continue', reason: '~/.continue/ found' };\n return false;\n },\n },\n {\n target: 'opencode',\n label: 'OpenCode',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, '.opencode.json'))) return { target: 'opencode', label: 'OpenCode', reason: '.opencode.json found in project' };\n return false;\n },\n },\n {\n target: 'antigravity',\n label: 'Antigravity',\n reason: '',\n detect: () => {\n if (dirExists(path.join(home, '.gemini', 'antigravity'))) return { target: 'antigravity', label: 'Antigravity', reason: '~/.gemini/antigravity/ found' };\n return false;\n },\n },\n {\n target: 'trae',\n label: 'Trae',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.trae'))) return { target: 'trae', label: 'Trae', reason: '.trae/ found in project' };\n return false;\n },\n },\n {\n target: 'amp',\n label: 'Sourcegraph Amp',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.amp'))) return { target: 'amp', label: 'Sourcegraph Amp', reason: '.amp/ found in project' };\n return false;\n },\n },\n {\n target: 'aider',\n label: 'Aider',\n reason: '',\n detect: () => {\n if (whichExists('aider')) return { target: 'aider', label: 'Aider', reason: 'aider binary on PATH' };\n return false;\n },\n },\n {\n target: 'goose',\n label: 'Block Goose',\n reason: '',\n detect: () => {\n if (whichExists('goose')) return { target: 'goose', label: 'Block Goose', reason: 'goose binary on PATH' };\n return false;\n },\n },\n {\n target: 'junie',\n label: 'JetBrains Junie',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.junie'))) return { target: 'junie', label: 'JetBrains Junie', reason: '.junie/ found in project' };\n return false;\n },\n },\n {\n target: 'augment',\n label: 'Augment Code',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.augment'))) return { target: 'augment', label: 'Augment Code', reason: '.augment/ found in project' };\n return false;\n },\n },\n {\n target: 'kilo',\n label: 'Kilo Code',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, 'kilo.json'))) return { target: 'kilo', label: 'Kilo Code', reason: 'kilo.json found in project' };\n return false;\n },\n },\n {\n target: 'devin',\n label: 'Devin',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.devin'))) return { target: 'devin', label: 'Devin', reason: '.devin/ found in project' };\n return false;\n },\n },\n {\n target: 'openhands',\n label: 'OpenHands',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.openhands'))) return { target: 'openhands', label: 'OpenHands', reason: '.openhands/ found in project' };\n return false;\n },\n },\n {\n target: 'tabnine',\n label: 'Tabnine',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.tabnine'))) return { target: 'tabnine', label: 'Tabnine', reason: '.tabnine/ found in project' };\n return false;\n },\n },\n {\n target: 'replit',\n label: 'Replit Agent',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, '.replit'))) return { target: 'replit', label: 'Replit Agent', reason: '.replit found in project' };\n return false;\n },\n },\n {\n target: 'qoder',\n label: 'Qoder',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.qoder'))) return { target: 'qoder', label: 'Qoder', reason: '.qoder/ found in project' };\n return false;\n },\n },\n];\n\n/**\n * Detect all AI coding platforms installed on this system / in this project.\n * Returns detection results for all platforms that were found.\n */\nexport function detectPlatforms(projectRoot: string): DetectionResult[] {\n const results: DetectionResult[] = [];\n for (const detector of DETECTORS) {\n const result = detector.detect(projectRoot);\n if (result) {\n results.push(result);\n }\n }\n return results;\n}\n\n/**\n * Get just the target names of detected platforms.\n */\nexport function detectTargets(projectRoot: string): InstallT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CAAC,SAAS;AAChB,UAAI,UAAU,KAAK,KAAK,MAAM,QAAQ,CAAC,EAAG,QAAO,EAAE,QAAQ,SAAS,OAAO,SAAS,QAAQ,2BAA2B;AACvH,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAMO,SAAS,gBAAgB,aAAwC;AACtE,QAAM,UAA6B,CAAC;AACpC,aAAW,YAAY,WAAW;AAChC,UAAM,SAAS,SAAS,OAAO,WAAW;AAC1C,QAAI,QAAQ;AACV,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACA,SAAO;AACT;AAKO,SAAS,cAAc,aAAsC;AAClE,SAAO,gBAAgB,WAAW,EAAE,IAAI,OAAK,EAAE,MAAM;AACvD;",
|
|
4
|
+
"sourcesContent": ["/**\n * Platform auto-detection for KiroGraph installer.\n *\n * Detects which AI coding tools are installed on the system by checking\n * for known config directories and CLI binaries. Used by `kirograph install`\n * (with no --target flag) to auto-configure all detected platforms.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { execSync } from 'child_process';\nimport type { InstallTarget } from './common';\n\nexport interface PlatformDetector {\n target: InstallTarget;\n label: string;\n /** How the platform was detected (shown to user) */\n reason: string;\n detect: (projectRoot: string) => DetectionResult | false;\n}\n\nexport interface DetectionResult {\n target: InstallTarget;\n label: string;\n reason: string;\n}\n\nfunction whichExists(binary: string): boolean {\n try {\n execSync(`which ${binary}`, { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction dirExists(p: string): boolean {\n return fs.existsSync(p) && fs.statSync(p).isDirectory();\n}\n\nfunction fileExists(p: string): boolean {\n return fs.existsSync(p) && fs.statSync(p).isFile();\n}\n\nconst home = process.env.HOME || process.env.USERPROFILE || '';\n\nconst DETECTORS: PlatformDetector[] = [\n {\n target: 'kiro',\n label: 'Kiro',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.kiro'))) return { target: 'kiro', label: 'Kiro', reason: '.kiro/ found in project' };\n if (dirExists(path.join(home, '.kiro'))) return { target: 'kiro', label: 'Kiro', reason: '~/.kiro/ found' };\n return false;\n },\n },\n {\n target: 'claude',\n label: 'Claude Code',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, '.mcp.json'))) return { target: 'claude', label: 'Claude Code', reason: '.mcp.json found in project' };\n if (whichExists('claude')) return { target: 'claude', label: 'Claude Code', reason: 'claude binary on PATH' };\n return false;\n },\n },\n {\n target: 'cursor',\n label: 'Cursor',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.cursor'))) return { target: 'cursor', label: 'Cursor', reason: '.cursor/ found in project' };\n if (dirExists(path.join(home, '.cursor'))) return { target: 'cursor', label: 'Cursor', reason: '~/.cursor/ found' };\n return false;\n },\n },\n {\n target: 'windsurf',\n label: 'Windsurf',\n reason: '',\n detect: () => {\n if (dirExists(path.join(home, '.codeium', 'windsurf'))) return { target: 'windsurf', label: 'Windsurf', reason: '~/.codeium/windsurf/ found' };\n return false;\n },\n },\n {\n target: 'codex',\n label: 'Codex',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.codex'))) return { target: 'codex', label: 'Codex', reason: '.codex/ found in project' };\n if (dirExists(path.join(home, '.codex'))) return { target: 'codex', label: 'Codex', reason: '~/.codex/ found' };\n if (whichExists('codex')) return { target: 'codex', label: 'Codex', reason: 'codex binary on PATH' };\n return false;\n },\n },\n {\n target: 'copilot',\n label: 'GitHub Copilot',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.vscode'))) return { target: 'copilot', label: 'GitHub Copilot', reason: '.vscode/ found in project' };\n if (dirExists(path.join(home, '.vscode'))) return { target: 'copilot', label: 'GitHub Copilot', reason: '~/.vscode/ found' };\n return false;\n },\n },\n {\n target: 'gemini-cli',\n label: 'Gemini CLI',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.gemini'))) return { target: 'gemini-cli', label: 'Gemini CLI', reason: '.gemini/ found in project' };\n if (whichExists('gemini')) return { target: 'gemini-cli', label: 'Gemini CLI', reason: 'gemini binary on PATH' };\n if (dirExists(path.join(home, '.gemini'))) return { target: 'gemini-cli', label: 'Gemini CLI', reason: '~/.gemini/ found' };\n return false;\n },\n },\n {\n target: 'cline',\n label: 'Cline',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.cline'))) return { target: 'cline', label: 'Cline', reason: '.cline/ found in project' };\n if (dirExists(path.join(root, '.clinerules'))) return { target: 'cline', label: 'Cline', reason: '.clinerules/ found in project' };\n return false;\n },\n },\n {\n target: 'roo',\n label: 'Roo Code',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.roo'))) return { target: 'roo', label: 'Roo Code', reason: '.roo/ found in project' };\n return false;\n },\n },\n {\n target: 'warp',\n label: 'Warp',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.warp'))) return { target: 'warp', label: 'Warp', reason: '.warp/ found in project' };\n if (whichExists('warp')) return { target: 'warp', label: 'Warp', reason: 'warp binary on PATH' };\n return false;\n },\n },\n {\n target: 'continue',\n label: 'Continue',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.continue'))) return { target: 'continue', label: 'Continue', reason: '.continue/ found in project' };\n if (dirExists(path.join(home, '.continue'))) return { target: 'continue', label: 'Continue', reason: '~/.continue/ found' };\n return false;\n },\n },\n {\n target: 'opencode',\n label: 'OpenCode',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, '.opencode.json'))) return { target: 'opencode', label: 'OpenCode', reason: '.opencode.json found in project' };\n return false;\n },\n },\n {\n target: 'antigravity',\n label: 'Antigravity',\n reason: '',\n detect: () => {\n if (dirExists(path.join(home, '.gemini', 'antigravity'))) return { target: 'antigravity', label: 'Antigravity', reason: '~/.gemini/antigravity/ found' };\n return false;\n },\n },\n {\n target: 'trae',\n label: 'Trae',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.trae'))) return { target: 'trae', label: 'Trae', reason: '.trae/ found in project' };\n return false;\n },\n },\n {\n target: 'amp',\n label: 'Sourcegraph Amp',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.amp'))) return { target: 'amp', label: 'Sourcegraph Amp', reason: '.amp/ found in project' };\n return false;\n },\n },\n {\n target: 'aider',\n label: 'Aider',\n reason: '',\n detect: () => {\n if (whichExists('aider')) return { target: 'aider', label: 'Aider', reason: 'aider binary on PATH' };\n return false;\n },\n },\n {\n target: 'goose',\n label: 'Block Goose',\n reason: '',\n detect: () => {\n if (whichExists('goose')) return { target: 'goose', label: 'Block Goose', reason: 'goose binary on PATH' };\n return false;\n },\n },\n {\n target: 'junie',\n label: 'JetBrains Junie',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.junie'))) return { target: 'junie', label: 'JetBrains Junie', reason: '.junie/ found in project' };\n return false;\n },\n },\n {\n target: 'augment',\n label: 'Augment Code',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.augment'))) return { target: 'augment', label: 'Augment Code', reason: '.augment/ found in project' };\n return false;\n },\n },\n {\n target: 'kilo',\n label: 'Kilo Code',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, 'kilo.json'))) return { target: 'kilo', label: 'Kilo Code', reason: 'kilo.json found in project' };\n return false;\n },\n },\n {\n target: 'devin',\n label: 'Devin',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.devin'))) return { target: 'devin', label: 'Devin', reason: '.devin/ found in project' };\n return false;\n },\n },\n {\n target: 'openhands',\n label: 'OpenHands',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.openhands'))) return { target: 'openhands', label: 'OpenHands', reason: '.openhands/ found in project' };\n return false;\n },\n },\n {\n target: 'tabnine',\n label: 'Tabnine',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.tabnine'))) return { target: 'tabnine', label: 'Tabnine', reason: '.tabnine/ found in project' };\n return false;\n },\n },\n {\n target: 'replit',\n label: 'Replit Agent',\n reason: '',\n detect: (root) => {\n if (fileExists(path.join(root, '.replit'))) return { target: 'replit', label: 'Replit Agent', reason: '.replit found in project' };\n return false;\n },\n },\n {\n target: 'qoder',\n label: 'Qoder',\n reason: '',\n detect: (root) => {\n if (dirExists(path.join(root, '.qoder'))) return { target: 'qoder', label: 'Qoder', reason: '.qoder/ found in project' };\n return false;\n },\n },\n {\n target: 'commandcode',\n label: 'Command Code',\n reason: '',\n detect: () => {\n // Command Code stores user/global state in ~/.commandcode/ and ships the\n // `command-code` binary (run as `cmd`). Avoid keying off .mcp.json \u2014 it's\n // shared with other agents (e.g. Claude) and would misfire.\n if (dirExists(path.join(home, '.commandcode'))) return { target: 'commandcode', label: 'Command Code', reason: '~/.commandcode/ found' };\n if (whichExists('command-code')) return { target: 'commandcode', label: 'Command Code', reason: 'command-code binary found in PATH' };\n return false;\n },\n },\n];\n\n/**\n * Detect all AI coding platforms installed on this system / in this project.\n * Returns detection results for all platforms that were found.\n */\nexport function detectPlatforms(projectRoot: string): DetectionResult[] {\n const results: DetectionResult[] = [];\n for (const detector of DETECTORS) {\n const result = detector.detect(projectRoot);\n if (result) {\n results.push(result);\n }\n }\n return results;\n}\n\n/**\n * Get just the target names of detected platforms.\n */\nexport function detectTargets(projectRoot: string): InstallTarget[] {\n return detectPlatforms(projectRoot).map(r => r.target);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,SAAoB;AACpB,WAAsB;AACtB,2BAAyB;AAiBzB,SAAS,YAAY,QAAyB;AAC5C,MAAI;AACF,uCAAS,SAAS,MAAM,IAAI,EAAE,OAAO,SAAS,CAAC;AAC/C,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,UAAU,GAAoB;AACrC,SAAO,GAAG,WAAW,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,YAAY;AACxD;AAEA,SAAS,WAAW,GAAoB;AACtC,SAAO,GAAG,WAAW,CAAC,KAAK,GAAG,SAAS,CAAC,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ACtE,QAAM,UAA6B,CAAC;AACpC,aAAW,YAAY,WAAW;AAChC,UAAM,SAAS,SAAS,OAAO,WAAW;AAC1C,QAAI,QAAQ;AACV,cAAQ,KAAK,MAAM;AAAA,IACrB;AAAA,EACF;AACA,SAAO;AACT;AAKO,SAAS,cAAc,aAAsC;AAClE,SAAO,gBAAgB,WAAW,EAAE,IAAI,OAAK,EAAE,MAAM;AACvD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,8 +33,13 @@ __export(hooks_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(hooks_exports);
|
|
34
34
|
var fs = __toESM(require("fs"));
|
|
35
35
|
var path = __toESM(require("path"));
|
|
36
|
+
var import_common = require("./common");
|
|
36
37
|
const V2_EXT = ".json";
|
|
37
38
|
const V1_EXT = ".kiro.hook";
|
|
39
|
+
const SYNC_CMD = (0, import_common.silentCommand)("kirograph sync --quiet");
|
|
40
|
+
const WATCHMEN_SYNTH_CMD = (0, import_common.silentCommand)("kirograph mem watchmen synthesize --quiet");
|
|
41
|
+
const WIKI_SYNTH_CMD = (0, import_common.silentCommand)("kirograph wiki synthesize --quiet");
|
|
42
|
+
const WIKI_LINT_CMD = (0, import_common.silentCommand)("kirograph wiki lint");
|
|
38
43
|
function buildWatchmenHook(synthesisMode) {
|
|
39
44
|
if (synthesisMode === "local") {
|
|
40
45
|
return {
|
|
@@ -45,7 +50,7 @@ function buildWatchmenHook(synthesisMode) {
|
|
|
45
50
|
hooks: [{
|
|
46
51
|
name: "KiroGraph Watchmen",
|
|
47
52
|
trigger: "Stop",
|
|
48
|
-
action: { type: "command", command:
|
|
53
|
+
action: { type: "command", command: WATCHMEN_SYNTH_CMD }
|
|
49
54
|
}]
|
|
50
55
|
},
|
|
51
56
|
v1: {
|
|
@@ -53,7 +58,7 @@ function buildWatchmenHook(synthesisMode) {
|
|
|
53
58
|
version: "1.0.0",
|
|
54
59
|
description: "After memory capture, run local model synthesis if enough observations have accumulated.",
|
|
55
60
|
when: { type: "agentStop" },
|
|
56
|
-
then: { type: "runCommand", command:
|
|
61
|
+
then: { type: "runCommand", command: WATCHMEN_SYNTH_CMD }
|
|
57
62
|
}
|
|
58
63
|
};
|
|
59
64
|
}
|
|
@@ -93,7 +98,7 @@ const HOOKS = [
|
|
|
93
98
|
hooks: [{
|
|
94
99
|
name: "KiroGraph Sync on Agent Stop",
|
|
95
100
|
trigger: "Stop",
|
|
96
|
-
action: { type: "command", command:
|
|
101
|
+
action: { type: "command", command: SYNC_CMD }
|
|
97
102
|
}]
|
|
98
103
|
},
|
|
99
104
|
v1: {
|
|
@@ -101,7 +106,7 @@ const HOOKS = [
|
|
|
101
106
|
version: "1.0.0",
|
|
102
107
|
description: "Sync the KiroGraph index when the agent stops, picking up any file edits, creates, or deletes from the session.",
|
|
103
108
|
when: { type: "agentStop" },
|
|
104
|
-
then: { type: "runCommand", command:
|
|
109
|
+
then: { type: "runCommand", command: SYNC_CMD }
|
|
105
110
|
}
|
|
106
111
|
},
|
|
107
112
|
{
|
|
@@ -235,7 +240,7 @@ Skip if the session was trivial (simple bug fix, no new knowledge).`;
|
|
|
235
240
|
hooks: [{
|
|
236
241
|
name: "KiroGraph Wiki Synthesize",
|
|
237
242
|
trigger: "Stop",
|
|
238
|
-
action: { type: "command", command:
|
|
243
|
+
action: { type: "command", command: WIKI_SYNTH_CMD }
|
|
239
244
|
}]
|
|
240
245
|
},
|
|
241
246
|
v1: {
|
|
@@ -243,7 +248,7 @@ Skip if the session was trivial (simple bug fix, no new knowledge).`;
|
|
|
243
248
|
version: "1.0.0",
|
|
244
249
|
description: "After each session, run local-model wiki synthesis over queued sources.",
|
|
245
250
|
when: { type: "agentStop" },
|
|
246
|
-
then: { type: "runCommand", command:
|
|
251
|
+
then: { type: "runCommand", command: WIKI_SYNTH_CMD }
|
|
247
252
|
}
|
|
248
253
|
}, format);
|
|
249
254
|
} else {
|
|
@@ -275,7 +280,7 @@ Skip if the session was trivial (simple bug fix, no new knowledge).`;
|
|
|
275
280
|
hooks: [{
|
|
276
281
|
name: "KiroGraph Wiki Lint",
|
|
277
282
|
trigger: "Stop",
|
|
278
|
-
action: { type: "command", command:
|
|
283
|
+
action: { type: "command", command: WIKI_LINT_CMD }
|
|
279
284
|
}]
|
|
280
285
|
},
|
|
281
286
|
v1: {
|
|
@@ -283,7 +288,7 @@ Skip if the session was trivial (simple bug fix, no new knowledge).`;
|
|
|
283
288
|
version: "1.0.0",
|
|
284
289
|
description: `Run wiki health check every ${lintFreq} sessions to catch broken links, orphan pages, and contradictions.`,
|
|
285
290
|
when: { type: "agentStop" },
|
|
286
|
-
then: { type: "runCommand", command:
|
|
291
|
+
then: { type: "runCommand", command: WIKI_LINT_CMD }
|
|
287
292
|
}
|
|
288
293
|
}, format);
|
|
289
294
|
} else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/installer/hooks.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro hook file management\n *\n * Generates hooks in BOTH formats for compatibility:\n *\n * v2 (new Kiro IDE): `.kiro/hooks/<id>.json`\n * { \"version\": \"v1\", \"hooks\": [{ \"name\", \"trigger\", \"matcher?\", \"action\": { type, command|prompt } }] }\n *\n * v1 (legacy Kiro IDE): `.kiro/hooks/<id>.kiro.hook`\n * { \"name\", \"version\", \"description\", \"when\": { type, toolTypes? }, \"then\": { type, command|prompt } }\n *\n * Old Kiro ignores .json files; new Kiro ignores .kiro.hook files.\n * Writing both ensures KiroGraph works regardless of which IDE version the user runs.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst V2_EXT = '.json';\nconst V1_EXT = '.kiro.hook';\n\n// \u2500\u2500 Hook builders \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface HookDef {\n id: string;\n description: string;\n v2: object; // new Kiro IDE format\n v1: object; // legacy Kiro IDE format\n}\n\nfunction buildWatchmenHook(synthesisMode: 'local' | 'agent'): HookDef {\n if (synthesisMode === 'local') {\n return {\n id: 'kirograph-watchmen',\n description: 'After memory capture, run local model synthesis if enough observations have accumulated.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Watchmen',\n trigger: 'Stop',\n action: { type: 'command', command: 'kirograph mem watchmen synthesize --quiet 2>&1 || true' },\n }],\n },\n v1: {\n name: 'KiroGraph Watchmen',\n version: '1.0.0',\n description: 'After memory capture, run local model synthesis if enough observations have accumulated.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph mem watchmen synthesize --quiet 2>&1 || true' },\n },\n };\n }\n\n const watchmenPrompt = `Check if KiroGraph Watchmen synthesis should run: call kirograph_mem_store with kind='note' and content='watchmen check'. If the response does not include watchmenReady: true, do nothing and stop.\n\nIf watchmenReady: true:\n1. Call kirograph_mem_search for each kind (decision, error, pattern, architecture, note) with limit 20.\n2. Write or update the workspace brief: upsert the ## KiroGraph Watchmen section in each file listed in targetFiles. For .kiro/steering/kirograph-watchmen.md use inclusion: always frontmatter with sections for Decisions, Known Errors & Fixes, Recurring Patterns, and Architecture Notes. For all other files write a compact ## KiroGraph Watchmen block.\n3. Generate skill files: if skillTargetDir is present in the response, identify recurring procedures (any procedure appearing in 3+ observations). For each, write a .kiro/steering/watchmen-<slug>.md file with inclusion: manual frontmatter, a short title, a \"When to use\" line with trigger phrases, and numbered steps. Prefix all generated files with watchmen- so they are distinguishable from hand-written steering files. Remove any .kiro/steering/watchmen-*.md files from previous runs that no longer match current patterns. If skillTargetDir is absent, embed a ## Recurring Procedures section in each targetFile instead, listing each procedure with trigger context and steps.\n4. Store a kind='summary' observation briefly describing what was synthesized (e.g. \"Synthesized 8 observations: updated kirograph-watchmen.md, wrote watchmen-auth-flow.md and watchmen-test-pattern.md\").`;\n\n return {\n id: 'kirograph-watchmen',\n description: 'After memory capture, check if enough observations have accumulated. If so, synthesize them into workspace brief files.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Watchmen',\n trigger: 'Stop',\n action: { type: 'agent', prompt: watchmenPrompt },\n }],\n },\n v1: {\n name: 'KiroGraph Watchmen',\n version: '1.0.0',\n description: 'After memory capture, check if enough observations have accumulated. If so, synthesize them into workspace brief files.',\n when: { type: 'agentStop' },\n then: { type: 'askAgent', prompt: watchmenPrompt },\n },\n };\n}\n\nconst HOOKS: HookDef[] = [\n {\n id: 'kirograph-sync-if-dirty',\n description: 'Sync the KiroGraph index when the agent stops, picking up any file edits, creates, or deletes from the session.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Sync on Agent Stop',\n trigger: 'Stop',\n action: { type: 'command', command: 'kirograph sync --quiet 2>&1 > /dev/null' },\n }],\n },\n v1: {\n name: 'KiroGraph Sync on Agent Stop',\n version: '1.0.0',\n description: 'Sync the KiroGraph index when the agent stops, picking up any file edits, creates, or deletes from the session.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph sync --quiet 2>&1 > /dev/null' },\n },\n },\n {\n id: 'kirograph-compress-hint',\n description: 'Remind the agent to use kirograph_exec for shell commands that benefit from token compression.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Compression Hint',\n trigger: 'PreToolUse',\n matcher: 'execute_bash',\n action: {\n type: 'agent',\n prompt: 'If this shell command is a git operation, GitHub CLI, test runner, linter, build tool, file listing, grep/rg, docker/kubectl, AWS CLI, or package manager command, consider using the kirograph_exec MCP tool instead for 60-90% token savings. The tool compresses output automatically while preserving error details.',\n },\n }],\n },\n v1: {\n name: 'KiroGraph Compression Hint',\n version: '1.0.0',\n description: 'Remind the agent to use kirograph_exec for shell commands that benefit from token compression.',\n when: { type: 'preToolUse', toolTypes: ['shell'] },\n then: {\n type: 'askAgent',\n prompt: 'If this shell command is a git operation, GitHub CLI, test runner, linter, build tool, file listing, grep/rg, docker/kubectl, AWS CLI, or package manager command, consider using the kirograph_exec MCP tool instead for 60-90% token savings. The tool compresses output automatically while preserving error details.',\n },\n },\n },\n {\n id: 'kirograph-mem-capture',\n description: 'Prompt the agent to store important observations in memory at the end of each session.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Memory Capture',\n trigger: 'Stop',\n action: {\n type: 'agent',\n prompt: 'Before ending, review what happened in this session. If there were any important decisions, bug root causes, architecture insights, error patterns, or lessons learned, store them using kirograph_mem_store with the appropriate kind (decision, error, pattern, architecture, note). Keep observations concise \u2014 one fact per observation. Skip if nothing noteworthy happened.',\n },\n }],\n },\n v1: {\n name: 'KiroGraph Memory Capture',\n version: '1.0.0',\n description: 'Prompt the agent to store important observations in memory at the end of each session.',\n when: { type: 'agentStop' },\n then: {\n type: 'askAgent',\n prompt: 'Before ending, review what happened in this session. If there were any important decisions, bug root causes, architecture insights, error patterns, or lessons learned, store them using kirograph_mem_store with the appropriate kind (decision, error, pattern, architecture, note). Keep observations concise \u2014 one fact per observation. Skip if nothing noteworthy happened.',\n },\n },\n },\n];\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nfunction writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\n/** Write a hook in both v2 (.json) and v1 (.kiro.hook) formats */\nfunction writeHookDual(hooksDir: string, def: HookDef): void {\n writeJson(path.join(hooksDir, `${def.id}${V2_EXT}`), def.v2);\n writeJson(path.join(hooksDir, `${def.id}${V1_EXT}`), def.v1);\n}\n\n/** Write a hook in the specified format only, removing the other */\nfunction writeHookForFormat(hooksDir: string, def: HookDef, format: KiroHookFormat): void {\n if (format === 'v2') {\n writeJson(path.join(hooksDir, `${def.id}${V2_EXT}`), def.v2);\n // Remove legacy file if it exists\n const legacyPath = path.join(hooksDir, `${def.id}${V1_EXT}`);\n if (fs.existsSync(legacyPath)) fs.unlinkSync(legacyPath);\n } else {\n writeJson(path.join(hooksDir, `${def.id}${V1_EXT}`), def.v1);\n // Remove v2 file if it exists\n const v2Path = path.join(hooksDir, `${def.id}${V2_EXT}`);\n if (fs.existsSync(v2Path)) fs.unlinkSync(v2Path);\n }\n}\n\n/** Remove both format files for a given hook id */\nfunction removeHookDual(hooksDir: string, id: string): void {\n for (const ext of [V2_EXT, V1_EXT]) {\n const p = path.join(hooksDir, `${id}${ext}`);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n}\n\n// \u2500\u2500 Public \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport type KiroHookFormat = 'v1-legacy' | 'v2';\n\nexport function writeHooks(kiroDir: string, opts?: { enableCompression?: boolean; enableMemory?: boolean; enableWatchmen?: boolean; watchmenSynthesisMode?: 'local' | 'agent'; enableWiki?: boolean; wikiSynthesisMode?: 'local' | 'agent'; wikiLintFrequency?: number; kiroHookFormat?: KiroHookFormat }): void {\n const hooksDir = path.join(kiroDir, 'hooks');\n ensureDir(hooksDir);\n\n const format = opts?.kiroHookFormat ?? 'v2';\n\n // Remove obsolete hook files from earlier versions\n const obsoleteFiles = [\n 'kirograph-sync-on-save.json', 'kirograph-sync-on-create.json',\n 'kirograph-mark-dirty-on-save.json', 'kirograph-mark-dirty-on-create.json',\n 'kirograph-sync-on-delete.json',\n 'kirograph-mark-dirty-on-save.kiro.hook',\n 'kirograph-mark-dirty-on-create.kiro.hook',\n 'kirograph-sync-on-delete.kiro.hook',\n ];\n for (const old of obsoleteFiles) {\n const p = path.join(hooksDir, old);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n\n for (const def of HOOKS) {\n // Skip compression hook if compression is disabled\n if (def.id === 'kirograph-compress-hint' && opts?.enableCompression === false) {\n removeHookDual(hooksDir, def.id);\n continue;\n }\n // Skip memory hook if memory is disabled\n if (def.id === 'kirograph-mem-capture' && !opts?.enableMemory) {\n removeHookDual(hooksDir, def.id);\n continue;\n }\n writeHookForFormat(hooksDir, def, format);\n }\n\n // Watchmen hook \u2014 built dynamically based on synthesis mode\n if (opts?.enableWatchmen) {\n const mode = opts.watchmenSynthesisMode ?? 'local';\n writeHookForFormat(hooksDir, buildWatchmenHook(mode), format);\n } else {\n removeHookDual(hooksDir, 'kirograph-watchmen');\n }\n\n // Wiki hooks \u2014 ingest trigger + periodic lint\n if (opts?.enableWiki) {\n const lintFreq = opts.wikiLintFrequency ?? 10;\n const wikiMode = opts.wikiSynthesisMode ?? 'agent';\n\n const wikiIngestPrompt = `If this session produced durable knowledge (design decisions, architecture insights, API contracts, process steps, domain facts), consider updating the wiki:\n1. Call kirograph_wiki_ingest with the key findings as source text.\n2. The tool returns a structured prompt. Pass it to yourself to generate a WIKI_DIFF.\n3. Call kirograph_wiki_apply_diff with your generated diff.\nSkip if the session was trivial (simple bug fix, no new knowledge).`;\n\n if (wikiMode === 'local') {\n writeHookForFormat(hooksDir, {\n id: 'kirograph-wiki-ingest',\n description: 'After each session, run local-model wiki synthesis over queued sources.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Wiki Synthesize',\n trigger: 'Stop',\n action: { type: 'command', command: 'kirograph wiki synthesize --quiet 2>&1 || true' },\n }],\n },\n v1: {\n name: 'KiroGraph Wiki Synthesize',\n version: '1.0.0',\n description: 'After each session, run local-model wiki synthesis over queued sources.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph wiki synthesize --quiet 2>&1 || true' },\n },\n }, format);\n } else {\n writeHookForFormat(hooksDir, {\n id: 'kirograph-wiki-ingest',\n description: 'At the end of each session, prompt the agent to ingest any relevant knowledge into the wiki.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Wiki Ingest',\n trigger: 'Stop',\n action: { type: 'agent', prompt: wikiIngestPrompt },\n }],\n },\n v1: {\n name: 'KiroGraph Wiki Ingest',\n version: '1.0.0',\n description: 'At the end of each session, prompt the agent to ingest any relevant knowledge into the wiki.',\n when: { type: 'agentStop' },\n then: { type: 'askAgent', prompt: wikiIngestPrompt },\n },\n }, format);\n }\n\n writeHookForFormat(hooksDir, {\n id: 'kirograph-wiki-lint',\n description: `Run wiki health check every ${lintFreq} sessions to catch broken links, orphan pages, and contradictions.`,\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Wiki Lint',\n trigger: 'Stop',\n action: { type: 'command', command: 'kirograph wiki lint 2>&1 || true' },\n }],\n },\n v1: {\n name: 'KiroGraph Wiki Lint',\n version: '1.0.0',\n description: `Run wiki health check every ${lintFreq} sessions to catch broken links, orphan pages, and contradictions.`,\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: 'kirograph wiki lint 2>&1 || true' },\n },\n }, format);\n } else {\n removeHookDual(hooksDir, 'kirograph-wiki-ingest');\n removeHookDual(hooksDir, 'kirograph-wiki-lint');\n }\n\n console.log(` \u2713 Auto-sync hooks written to ${hooksDir}`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,SAAoB;AACpB,WAAsB;
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Installer \u2014 Kiro hook file management\n *\n * Generates hooks in BOTH formats for compatibility:\n *\n * v2 (new Kiro IDE): `.kiro/hooks/<id>.json`\n * { \"version\": \"v1\", \"hooks\": [{ \"name\", \"trigger\", \"matcher?\", \"action\": { type, command|prompt } }] }\n *\n * v1 (legacy Kiro IDE): `.kiro/hooks/<id>.kiro.hook`\n * { \"name\", \"version\", \"description\", \"when\": { type, toolTypes? }, \"then\": { type, command|prompt } }\n *\n * Old Kiro ignores .json files; new Kiro ignores .kiro.hook files.\n * Writing both ensures KiroGraph works regardless of which IDE version the user runs.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { silentCommand } from './common';\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst V2_EXT = '.json';\nconst V1_EXT = '.kiro.hook';\n\n// Cross-platform hook commands (see issue #40 \u2014 bash syntax breaks on Windows cmd.exe).\nconst SYNC_CMD = silentCommand('kirograph sync --quiet');\nconst WATCHMEN_SYNTH_CMD = silentCommand('kirograph mem watchmen synthesize --quiet');\nconst WIKI_SYNTH_CMD = silentCommand('kirograph wiki synthesize --quiet');\nconst WIKI_LINT_CMD = silentCommand('kirograph wiki lint');\n\n// \u2500\u2500 Hook builders \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\ninterface HookDef {\n id: string;\n description: string;\n v2: object; // new Kiro IDE format\n v1: object; // legacy Kiro IDE format\n}\n\nfunction buildWatchmenHook(synthesisMode: 'local' | 'agent'): HookDef {\n if (synthesisMode === 'local') {\n return {\n id: 'kirograph-watchmen',\n description: 'After memory capture, run local model synthesis if enough observations have accumulated.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Watchmen',\n trigger: 'Stop',\n action: { type: 'command', command: WATCHMEN_SYNTH_CMD },\n }],\n },\n v1: {\n name: 'KiroGraph Watchmen',\n version: '1.0.0',\n description: 'After memory capture, run local model synthesis if enough observations have accumulated.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: WATCHMEN_SYNTH_CMD },\n },\n };\n }\n\n const watchmenPrompt = `Check if KiroGraph Watchmen synthesis should run: call kirograph_mem_store with kind='note' and content='watchmen check'. If the response does not include watchmenReady: true, do nothing and stop.\n\nIf watchmenReady: true:\n1. Call kirograph_mem_search for each kind (decision, error, pattern, architecture, note) with limit 20.\n2. Write or update the workspace brief: upsert the ## KiroGraph Watchmen section in each file listed in targetFiles. For .kiro/steering/kirograph-watchmen.md use inclusion: always frontmatter with sections for Decisions, Known Errors & Fixes, Recurring Patterns, and Architecture Notes. For all other files write a compact ## KiroGraph Watchmen block.\n3. Generate skill files: if skillTargetDir is present in the response, identify recurring procedures (any procedure appearing in 3+ observations). For each, write a .kiro/steering/watchmen-<slug>.md file with inclusion: manual frontmatter, a short title, a \"When to use\" line with trigger phrases, and numbered steps. Prefix all generated files with watchmen- so they are distinguishable from hand-written steering files. Remove any .kiro/steering/watchmen-*.md files from previous runs that no longer match current patterns. If skillTargetDir is absent, embed a ## Recurring Procedures section in each targetFile instead, listing each procedure with trigger context and steps.\n4. Store a kind='summary' observation briefly describing what was synthesized (e.g. \"Synthesized 8 observations: updated kirograph-watchmen.md, wrote watchmen-auth-flow.md and watchmen-test-pattern.md\").`;\n\n return {\n id: 'kirograph-watchmen',\n description: 'After memory capture, check if enough observations have accumulated. If so, synthesize them into workspace brief files.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Watchmen',\n trigger: 'Stop',\n action: { type: 'agent', prompt: watchmenPrompt },\n }],\n },\n v1: {\n name: 'KiroGraph Watchmen',\n version: '1.0.0',\n description: 'After memory capture, check if enough observations have accumulated. If so, synthesize them into workspace brief files.',\n when: { type: 'agentStop' },\n then: { type: 'askAgent', prompt: watchmenPrompt },\n },\n };\n}\n\nconst HOOKS: HookDef[] = [\n {\n id: 'kirograph-sync-if-dirty',\n description: 'Sync the KiroGraph index when the agent stops, picking up any file edits, creates, or deletes from the session.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Sync on Agent Stop',\n trigger: 'Stop',\n action: { type: 'command', command: SYNC_CMD },\n }],\n },\n v1: {\n name: 'KiroGraph Sync on Agent Stop',\n version: '1.0.0',\n description: 'Sync the KiroGraph index when the agent stops, picking up any file edits, creates, or deletes from the session.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: SYNC_CMD },\n },\n },\n {\n id: 'kirograph-compress-hint',\n description: 'Remind the agent to use kirograph_exec for shell commands that benefit from token compression.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Compression Hint',\n trigger: 'PreToolUse',\n matcher: 'execute_bash',\n action: {\n type: 'agent',\n prompt: 'If this shell command is a git operation, GitHub CLI, test runner, linter, build tool, file listing, grep/rg, docker/kubectl, AWS CLI, or package manager command, consider using the kirograph_exec MCP tool instead for 60-90% token savings. The tool compresses output automatically while preserving error details.',\n },\n }],\n },\n v1: {\n name: 'KiroGraph Compression Hint',\n version: '1.0.0',\n description: 'Remind the agent to use kirograph_exec for shell commands that benefit from token compression.',\n when: { type: 'preToolUse', toolTypes: ['shell'] },\n then: {\n type: 'askAgent',\n prompt: 'If this shell command is a git operation, GitHub CLI, test runner, linter, build tool, file listing, grep/rg, docker/kubectl, AWS CLI, or package manager command, consider using the kirograph_exec MCP tool instead for 60-90% token savings. The tool compresses output automatically while preserving error details.',\n },\n },\n },\n {\n id: 'kirograph-mem-capture',\n description: 'Prompt the agent to store important observations in memory at the end of each session.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Memory Capture',\n trigger: 'Stop',\n action: {\n type: 'agent',\n prompt: 'Before ending, review what happened in this session. If there were any important decisions, bug root causes, architecture insights, error patterns, or lessons learned, store them using kirograph_mem_store with the appropriate kind (decision, error, pattern, architecture, note). Keep observations concise \u2014 one fact per observation. Skip if nothing noteworthy happened.',\n },\n }],\n },\n v1: {\n name: 'KiroGraph Memory Capture',\n version: '1.0.0',\n description: 'Prompt the agent to store important observations in memory at the end of each session.',\n when: { type: 'agentStop' },\n then: {\n type: 'askAgent',\n prompt: 'Before ending, review what happened in this session. If there were any important decisions, bug root causes, architecture insights, error patterns, or lessons learned, store them using kirograph_mem_store with the appropriate kind (decision, error, pattern, architecture, note). Keep observations concise \u2014 one fact per observation. Skip if nothing noteworthy happened.',\n },\n },\n },\n];\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nfunction ensureDir(p: string): void {\n fs.mkdirSync(p, { recursive: true });\n}\n\nfunction writeJson(p: string, data: unknown): void {\n fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\\n');\n}\n\n/** Write a hook in both v2 (.json) and v1 (.kiro.hook) formats */\nfunction writeHookDual(hooksDir: string, def: HookDef): void {\n writeJson(path.join(hooksDir, `${def.id}${V2_EXT}`), def.v2);\n writeJson(path.join(hooksDir, `${def.id}${V1_EXT}`), def.v1);\n}\n\n/** Write a hook in the specified format only, removing the other */\nfunction writeHookForFormat(hooksDir: string, def: HookDef, format: KiroHookFormat): void {\n if (format === 'v2') {\n writeJson(path.join(hooksDir, `${def.id}${V2_EXT}`), def.v2);\n // Remove legacy file if it exists\n const legacyPath = path.join(hooksDir, `${def.id}${V1_EXT}`);\n if (fs.existsSync(legacyPath)) fs.unlinkSync(legacyPath);\n } else {\n writeJson(path.join(hooksDir, `${def.id}${V1_EXT}`), def.v1);\n // Remove v2 file if it exists\n const v2Path = path.join(hooksDir, `${def.id}${V2_EXT}`);\n if (fs.existsSync(v2Path)) fs.unlinkSync(v2Path);\n }\n}\n\n/** Remove both format files for a given hook id */\nfunction removeHookDual(hooksDir: string, id: string): void {\n for (const ext of [V2_EXT, V1_EXT]) {\n const p = path.join(hooksDir, `${id}${ext}`);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n}\n\n// \u2500\u2500 Public \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport type KiroHookFormat = 'v1-legacy' | 'v2';\n\nexport function writeHooks(kiroDir: string, opts?: { enableCompression?: boolean; enableMemory?: boolean; enableWatchmen?: boolean; watchmenSynthesisMode?: 'local' | 'agent'; enableWiki?: boolean; wikiSynthesisMode?: 'local' | 'agent'; wikiLintFrequency?: number; kiroHookFormat?: KiroHookFormat }): void {\n const hooksDir = path.join(kiroDir, 'hooks');\n ensureDir(hooksDir);\n\n const format = opts?.kiroHookFormat ?? 'v2';\n\n // Remove obsolete hook files from earlier versions\n const obsoleteFiles = [\n 'kirograph-sync-on-save.json', 'kirograph-sync-on-create.json',\n 'kirograph-mark-dirty-on-save.json', 'kirograph-mark-dirty-on-create.json',\n 'kirograph-sync-on-delete.json',\n 'kirograph-mark-dirty-on-save.kiro.hook',\n 'kirograph-mark-dirty-on-create.kiro.hook',\n 'kirograph-sync-on-delete.kiro.hook',\n ];\n for (const old of obsoleteFiles) {\n const p = path.join(hooksDir, old);\n if (fs.existsSync(p)) fs.unlinkSync(p);\n }\n\n for (const def of HOOKS) {\n // Skip compression hook if compression is disabled\n if (def.id === 'kirograph-compress-hint' && opts?.enableCompression === false) {\n removeHookDual(hooksDir, def.id);\n continue;\n }\n // Skip memory hook if memory is disabled\n if (def.id === 'kirograph-mem-capture' && !opts?.enableMemory) {\n removeHookDual(hooksDir, def.id);\n continue;\n }\n writeHookForFormat(hooksDir, def, format);\n }\n\n // Watchmen hook \u2014 built dynamically based on synthesis mode\n if (opts?.enableWatchmen) {\n const mode = opts.watchmenSynthesisMode ?? 'local';\n writeHookForFormat(hooksDir, buildWatchmenHook(mode), format);\n } else {\n removeHookDual(hooksDir, 'kirograph-watchmen');\n }\n\n // Wiki hooks \u2014 ingest trigger + periodic lint\n if (opts?.enableWiki) {\n const lintFreq = opts.wikiLintFrequency ?? 10;\n const wikiMode = opts.wikiSynthesisMode ?? 'agent';\n\n const wikiIngestPrompt = `If this session produced durable knowledge (design decisions, architecture insights, API contracts, process steps, domain facts), consider updating the wiki:\n1. Call kirograph_wiki_ingest with the key findings as source text.\n2. The tool returns a structured prompt. Pass it to yourself to generate a WIKI_DIFF.\n3. Call kirograph_wiki_apply_diff with your generated diff.\nSkip if the session was trivial (simple bug fix, no new knowledge).`;\n\n if (wikiMode === 'local') {\n writeHookForFormat(hooksDir, {\n id: 'kirograph-wiki-ingest',\n description: 'After each session, run local-model wiki synthesis over queued sources.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Wiki Synthesize',\n trigger: 'Stop',\n action: { type: 'command', command: WIKI_SYNTH_CMD },\n }],\n },\n v1: {\n name: 'KiroGraph Wiki Synthesize',\n version: '1.0.0',\n description: 'After each session, run local-model wiki synthesis over queued sources.',\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: WIKI_SYNTH_CMD },\n },\n }, format);\n } else {\n writeHookForFormat(hooksDir, {\n id: 'kirograph-wiki-ingest',\n description: 'At the end of each session, prompt the agent to ingest any relevant knowledge into the wiki.',\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Wiki Ingest',\n trigger: 'Stop',\n action: { type: 'agent', prompt: wikiIngestPrompt },\n }],\n },\n v1: {\n name: 'KiroGraph Wiki Ingest',\n version: '1.0.0',\n description: 'At the end of each session, prompt the agent to ingest any relevant knowledge into the wiki.',\n when: { type: 'agentStop' },\n then: { type: 'askAgent', prompt: wikiIngestPrompt },\n },\n }, format);\n }\n\n writeHookForFormat(hooksDir, {\n id: 'kirograph-wiki-lint',\n description: `Run wiki health check every ${lintFreq} sessions to catch broken links, orphan pages, and contradictions.`,\n v2: {\n version: 'v1',\n hooks: [{\n name: 'KiroGraph Wiki Lint',\n trigger: 'Stop',\n action: { type: 'command', command: WIKI_LINT_CMD },\n }],\n },\n v1: {\n name: 'KiroGraph Wiki Lint',\n version: '1.0.0',\n description: `Run wiki health check every ${lintFreq} sessions to catch broken links, orphan pages, and contradictions.`,\n when: { type: 'agentStop' },\n then: { type: 'runCommand', command: WIKI_LINT_CMD },\n },\n }, format);\n } else {\n removeHookDual(hooksDir, 'kirograph-wiki-ingest');\n removeHookDual(hooksDir, 'kirograph-wiki-lint');\n }\n\n console.log(` \u2713 Auto-sync hooks written to ${hooksDir}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,SAAoB;AACpB,WAAsB;AACtB,oBAA8B;AAI9B,MAAM,SAAS;AACf,MAAM,SAAS;AAGf,MAAM,eAAW,6BAAc,wBAAwB;AACvD,MAAM,yBAAqB,6BAAc,2CAA2C;AACpF,MAAM,qBAAiB,6BAAc,mCAAmC;AACxE,MAAM,oBAAgB,6BAAc,qBAAqB;AAWzD,SAAS,kBAAkB,eAA2C;AACpE,MAAI,kBAAkB,SAAS;AAC7B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,IAAI;AAAA,QACF,SAAS;AAAA,QACT,OAAO,CAAC;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,UACT,QAAQ,EAAE,MAAM,WAAW,SAAS,mBAAmB;AAAA,QACzD,CAAC;AAAA,MACH;AAAA,MACA,IAAI;AAAA,QACF,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,QACb,MAAM,EAAE,MAAM,YAAY;AAAA,QAC1B,MAAM,EAAE,MAAM,cA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