Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
TypeScript antigravity-skillsbusiness-knowledgeclaude-codeclaude-skillscodebase-analysiscodexcodex-skillsdeveloper-tools-ai-agentgemini-cli-skillskarpathy-llm-wikiknowledge-baseknowledge-graphmemoryopencode-skillspi-agentunderstandcodevibe-coding
merge: integrate latest main into benchmark branch
KumamuKumac6fa9bc791dd
diff --cc tests/skill/understand/test_scan_project.test.mjsindex ace61e94,1409daac..7618ae7e--- a/tests/skill/understand/test_scan_project.test.mjs+++ b/tests/skill/understand/test_scan_project.test.mjs@@@ -519,19 -517,6 +519,40 @@@ describe('scan-project.mjs — data-diexpect(byPath(r.output, 'fixtures/snap2.json')).toBeUndefined();expect(r.output.filteredByIgnore).toBe(2);});++ it('can exclude persistent analysis data for isolated benchmark scans', () => {+ projectRoot = setupTree({+ '.ua/knowledge-graph.json': '{ "nodes": [] }\n',+ '.understand-anything/meta.json': '{ "version": 1 }\n',+ 'src/index.ts': 'export const x = 1;\n',+ });++ const r = runScript(projectRoot, ['--exclude-analysis-data']);++ expect(r.status).toBe(0);+ expect(r.output.files.map(file => file.path)).toEqual(['src/index.ts']);+ });++++ it('composes CLI exclusions for benchmark scans regardless of flag order', () => {++ projectRoot = setupTree({++ '.ua/knowledge-graph.json': '{ "nodes": [] }\n',++ '.understand-anything/meta.json': '{ "version": 1 }\n',++ 'generated/client.ts': 'export const generated = true;\n',++ 'src/index.ts': 'export const x = 1;\n',++ });++++ for (const args of [++ ['--exclude', 'generated/', '--exclude-analysis-data'],++ ['--exclude-analysis-data', '--exclude', 'generated/'],++ ]) {++ const r = runScript(projectRoot, args);++++ expect(r.status, r.stderr).toBe(0);++ expect(r.output.files.map(file => file.path)).toEqual(['src/index.ts']);++ expect(r.output.filteredByIgnore).toBe(1);++ expect(r.output.contentDigest).toMatch(/^[0-9a-f]{64}$/);++ }++ });});describe('scan-project.mjs — special-file recognition', () => {diff --cc understand-anything-plugin/skills/understand/SKILL.mdindex 99bede1a,168479a7..f13012e0--- a/understand-anything-plugin/skills/understand/SKILL.md+++ b/understand-anything-plugin/skills/understand/SKILL.md@@@ -261,7 -271,7 +271,7 @@@ Store the file list as `$FILE_LIST` wit**Gate check:** If >100 files, inform the user and suggest scoping with a subdirectory argument. Proceed only if user confirms or add guidance that this may take a while.If the scan result includes `filteredByIgnore > 0`, report:--> Excluded {filteredByIgnore} files via `.understandignore`.++> Excluded {filteredByIgnore} files via `.understandignore` and/or `--exclude` rules.---diff --cc understand-anything-plugin/skills/understand/scan-project.mjsindex 1a59ca01,cc446c82..c6e3d677--- a/understand-anything-plugin/skills/understand/scan-project.mjs+++ b/understand-anything-plugin/skills/understand/scan-project.mjs@@@ -16,9 -16,9 +16,9 @@@** What this script owns:* - File enumeration (git ls-files preferred, recursive walk fallback)-- * - `.understandignore` filtering (delegated to core's createIgnoreFilter,-- * which reads the resolved data dir — `.ua/`, or legacy-- * `.understand-anything/` when that directory already exists)++ * - `.understandignore` and CLI exclusion filtering (delegated to core's++ * createIgnoreFilter, which reads the resolved data dir — `.ua/`, or++ * legacy `.understand-anything/` when that directory already exists)* - Per-file language detection (extension + filename table)* - Per-file category assignment (priority-ordered rules from* project-scanner.md Step 4)@@@ -26,7 -26,11 +26,13 @@@* - Complexity estimation (project-scanner.md Step 7 thresholds)** Usage:- * node scan-project.mjs <projectRoot> <outputPath> [--exclude-analysis-data]- * node scan-project.mjs <projectRoot> <outputPath> [--exclude <patterns>]++ * node scan-project.mjs <projectRoot> <outputPath>++ * [--exclude <patterns>] [--exclude-analysis-data]+ *- * --exclude <patterns> Comma-separated glob patterns to additionally exclude.- * These take highest priority over built-in defaults and- * .understandignore rules. Supports gitignore syntax.++ * --exclude <patterns> Comma-separated gitignore-style patterns to++ * additionally exclude from the scan.++ * --exclude-analysis-data Always exclude persistent `.ua/` and legacy++ * `.understand-anything/` analysis data.** Output JSON (subset of what project-scanner.md Phase 1 expects — the LLM* agent merges this with Step A's narrative fields and Step C's importMap to@@@ -582,9 -572,9 +588,9 @@@ function enumerateFiles(projectRoot)// Filter accounting//// The project-scanner.md contract requires `filteredByIgnore` to count files--// dropped *specifically* by user `.understandignore` patterns (the delta--// beyond what the hardcoded defaults would have removed). We accomplish this--// by building TWO filters:++// dropped specifically by user `.understandignore` or CLI `--exclude`++// patterns (the delta beyond what the hardcoded defaults would have removed).++// We accomplish this by building TWO filters:// - `defaultOnly`: defaults only, no user patterns// - `combined`: defaults + user patterns (createIgnoreFilter)// and counting paths that the combined filter excludes but the defaults-only@@@ -686,11 -657,25 +692,53 @@@ function updateContentDigest(hash, posi// ---------------------------------------------------------------------------async function main() {- const [, , projectRoot, outputPath, ...options] = process.argv;- // Parse CLI arguments: <projectRoot> <outputPath> [--exclude <patterns>]- let projectRoot, outputPath, excludePatterns = [];- for (let i = 2; i < process.argv.length; i++) {- const arg = process.argv[i];- if (arg === '--exclude' && i + 1 < process.argv.length) {- excludePatterns = process.argv[++i]- .split(',')- .map(p => p.trim())- .filter(Boolean);- } else if (!projectRoot) {++ const args = process.argv.slice(2);++ let projectRoot;++ let outputPath;++ let excludeAnalysisData = false;++ const excludePatterns = [];++++ for (let i = 0; i < args.length; i++) {++ const arg = args[i];++ if (arg === '--exclude-analysis-data') {++ excludeAnalysisData = true;++ continue;++ }++ if (arg === '--exclude') {++ const value = args[i + 1];++ if (!value || value.startsWith('--')) {++ process.stderr.write('scan-project.mjs failed: --exclude requires patterns\n');++ process.exit(1);++ }++ excludePatterns.push(++ ...value++ .split(',')++ .map(pattern => pattern.trim())++ .filter(Boolean),++ );++ i++;++ continue;++ }++ if (arg.startsWith('--')) {++ process.stderr.write(`scan-project.mjs failed: unknown option: ${arg}\n`);++ process.exit(1);++ }++ if (!projectRoot) {+ projectRoot = arg;- } else if (!outputPath) {++ continue;++ }++ if (!outputPath) {+ outputPath = arg;++ continue;+ }++ process.stderr.write(`scan-project.mjs failed: unexpected argument: ${arg}\n`);++ process.exit(1);+ }+if (!projectRoot || !outputPath) {process.stderr.write(- 'Usage: node scan-project.mjs <projectRoot> <outputPath> [--exclude <patterns>]\n',+ 'Usage: node scan-project.mjs <projectRoot> <outputPath> ' +- '[--exclude-analysis-data]\n',++ '[--exclude <patterns>] [--exclude-analysis-data]\n',);process.exit(1);}@@@ -716,16 -695,12 +758,16 @@@}// 1. Enumerate. Either git ls-files or recursive walk.- const candidates = enumerateFiles(projectRoot);+ const candidates = enumerateFiles(projectRoot).filter(+ rel =>+ !excludeAnalysisData ||+ (!rel.startsWith('.ua/') && !rel.startsWith('.understand-anything/')),+ );- // 2. Filter via createIgnoreFilter (defaults + user .understandignore).- // 2. Filter via createIgnoreFilter (defaults + user .understandignore + CLI --exclude).++ // 2. Filter via createIgnoreFilter (defaults + .understandignore + CLI excludes).// Build a defaults-only filter in parallel to count user-driven drops.- const combined = createIgnoreFilter(projectRoot);- const userIgnoresPresent = hasUserIgnoreFile(projectRoot);+ const combined = createIgnoreFilter(projectRoot, excludePatterns);+ const userIgnoresPresent = hasUserIgnoreFile(projectRoot) || excludePatterns.length > 0;const defaultsOnly = userIgnoresPresent ? buildDefaultsOnlyFilter() : combined;let filteredByIgnore = 0;@@@ -739,7 -714,7 +781,7 @@@// Dropped by combined filter. If defaults-only would have ALSO dropped// it, this is a baseline default drop — not counted. If defaults-only// would have KEPT it, this drop is attributable to the user's-- // .understandignore content.++ // .understandignore content or CLI --exclude patterns.if (userIgnoresPresent && !defaultsOnly.isIgnored(rel)) {filteredByIgnore++;}