Skip to content

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.

fix(bench): correct unsupported outcomes and add sample report

KumamuKuma48b4fe474b0b
diff --git a/docs/benchmarks/large-monorepo.md b/docs/benchmarks/large-monorepo.md
index 4da2a4aa..1c792bdf 100644
--- a/docs/benchmarks/large-monorepo.md
+++ b/docs/benchmarks/large-monorepo.md
@@ -76,7 +76,10 @@ Structure diagnostics are bounded across the whole run, rather than once per
batch. The report retains deterministic samples and aggregate success, failure,
and skip counts, but discards raw per-worker stdout and stderr after those
summaries are formed. Structural coverage counts successful structure analyses;
-failed analyses remain failures instead of being reported as skipped work.
+files without a registered structural parser are accounted in `filesSkipped`
+and produce a degraded report. Missing optional call-graph capability is also
+skipped. After a parser advertises a capability, an exception or invalid result
+remains an integrity failure instead of being reported as skipped work.
`--keep-artifacts` preserves intermediate files and prints their location.
Those private files contain absolute paths and detailed structural data; do not
diff --git a/docs/benchmarks/samples/understand-anything-pr587-full-sample.json b/docs/benchmarks/samples/understand-anything-pr587-full-sample.json
new file mode 100644
index 00000000..69d58d78
--- /dev/null
+++ b/docs/benchmarks/samples/understand-anything-pr587-full-sample.json
@@ -0,0 +1,218 @@
+{
+ "schemaUrl": "https://raw.githubusercontent.com/Egonex-AI/Understand-Anything/main/docs/benchmarks/large-repo-report-1.0.0.schema.json",
+ "schemaVersion": "1.0.0",
+ "pairId": "d7a047c6-9c05-41b2-9923-43a1e71e9634",
+ "status": "degraded",
+ "mode": "deterministic",
+ "run": {
+ "startedAt": "2026-07-17T11:45:14.919Z",
+ "finishedAt": "2026-07-17T11:45:26.653Z",
+ "durationMs": 11734.69
+ },
+ "tool": {
+ "commit": "851ca14ebab22c81fde136986263d550daa38ee3",
+ "dirty": false,
+ "packageVersion": "2.9.3"
+ },
+ "subject": {
+ "label": "understand-anything-pr587-full-sample",
+ "commit": "851ca14ebab22c81fde136986263d550daa38ee3",
+ "dirty": false
+ },
+ "environment": {
+ "platform": "win32",
+ "release": "10.0.26200",
+ "arch": "x64",
+ "nodeVersion": "v22.18.0",
+ "cpuModel": "13th Gen Intel(R) Core(TM) i9-13900HX",
+ "logicalCores": 32,
+ "totalMemoryBytes": 16907100160
+ },
+ "configuration": {
+ "concurrency": 5,
+ "stages": [
+ "scan",
+ "imports",
+ "batching",
+ "structure"
+ ]
+ },
+ "scale": {
+ "files": 459,
+ "lines": 127155,
+ "bytes": 8918520,
+ "missingFiles": 0,
+ "filteredByUserIgnore": 0,
+ "byCategory": {
+ "config": 33,
+ "docs": 117,
+ "infra": 3,
+ "code": 301,
+ "markup": 3,
+ "script": 2
+ },
+ "byLanguage": {
+ "json": 27,
+ "yaml": 8,
+ "markdown": 117,
+ "unknown": 3,
+ "javascript": 31,
+ "astro": 10,
+ "css": 2,
+ "powershell": 1,
+ "shell": 1,
+ "python": 8,
+ "typescript": 247,
+ "html": 1,
+ "wasm": 2,
+ "swift": 1
+ }
+ },
+ "stages": {
+ "scan": {
+ "status": "ok",
+ "durationMs": 783.46,
+ "peakRssBytes": 80211968,
+ "userCpuTimeMicros": 281000,
+ "systemCpuTimeMicros": 407000,
+ "warningCount": 0,
+ "warningMessages": [],
+ "warningMessagesTruncated": false,
+ "stdoutTruncated": false,
+ "stderrTruncated": false,
+ "outputBytes": 82572,
+ "files": 459,
+ "lines": 127155,
+ "bytes": 8918520,
+ "filteredByUserIgnore": 0
+ },
+ "imports": {
+ "status": "ok",
+ "durationMs": 1172.55,
+ "peakRssBytes": 190054400,
+ "userCpuTimeMicros": 906000,
+ "systemCpuTimeMicros": 562000,
+ "warningCount": 0,
+ "warningMessages": [],
+ "warningMessagesTruncated": false,
+ "stdoutTruncated": false,
+ "stderrTruncated": false,
+ "outputBytes": 71809,
+ "filesScanned": 459,
+ "filesWithImports": 212,
+ "edges": 462
+ },
+ "batching": {
+ "status": "ok",
+ "durationMs": 1169.17,
+ "peakRssBytes": 191143936,
+ "userCpuTimeMicros": 875000,
+ "systemCpuTimeMicros": 578000,
+ "warningCount": 5,
+ "warningMessages": [
+ "Warning: compute-batches: community size 46 > max 35 — splitting via alphabetical chunking — modularity may decrease",
+ "Warning: compute-batches: community size 61 > max 35 — splitting via alphabetical chunking — modularity may decrease",
+ "Warning: compute-batches: community size 52 > max 35 — splitting via alphabetical chunking — modularity may decrease",
+ "Warning: compute-batches: neighborMap for understand-anything-plugin/packages/core/src/languages/types.ts has high 1-hop degree 59 — exceeds soft cap of 50 — keeping top 31 cross-batch entries (0 dropped by degree sort)",
+ "Warning: compute-batches: neighborMap for understand-anything-plugin/packages/core/src/types.ts has high 1-hop degree 58 — exceeds soft cap of 50 — keeping top 38 cross-batch entries (0 dropped by degree sort)"
+ ],
+ "warningMessagesTruncated": false,
+ "stdoutTruncated": false,
+ "stderrTruncated": false,
+ "outputBytes": 354328,
+ "algorithm": "louvain",
+ "totalBatches": 37,
+ "batchSizes": {
+ "min": 1,
+ "p50": 7,
+ "p95": 31,
+ "max": 31,
+ "mean": 12.41
+ },
+ "estimatedAgentInputBytes": 212711
+ },
+ "structure": {
+ "status": "ok",
+ "durationMs": 8070.21,
+ "maxWorkerPeakRssBytes": 193888256,
+ "userCpuTimeMicros": 18300000,
+ "systemCpuTimeMicros": 21344000,
+ "warningCount": 0,
+ "warningMessages": [],
+ "warningMessagesTruncated": false,
+ "failureSamples": [],
+ "failureSamplesTruncated": false,
+ "outputBytes": 1636826,
+ "batchesSucceeded": 37,
+ "batchesFailed": 0,
+ "filesAnalyzed": 439,
+ "filesSkipped": 20,
+ "structureSucceeded": 439,
+ "structureFailed": 0,
+ "callGraphSucceeded": 285,
+ "callGraphFailed": 0,
+ "callGraphSkipped": 154,
+ "entities": {
+ "functions": 654,
+ "classes": 55,
+ "exports": 628,
+ "callGraph": 8026,
+ "definitions": 0,
+ "services": 0,
+ "endpoints": 0,
+ "steps": 0,
+ "resources": 0
+ },
+ "batchDurationMs": {
+ "min": 800.05,
+ "p50": 991.31,
+ "p95": 1224.87,
+ "max": 1337.28,
+ "mean": 1027.58
+ }
+ }
+ },
+ "integrity": {
+ "allScannedFilesBatched": true,
+ "missingBatchFiles": 0,
+ "duplicateBatchFiles": 0,
+ "unexpectedBatchFiles": 0,
+ "missingImportTargets": 0,
+ "structureCoverage": 1,
+ "structureFailures": 0,
+ "callGraphFailures": 0,
+ "filesSkipped": 20,
+ "failedBatches": 0,
+ "missingStructurePaths": 0,
+ "duplicateStructurePaths": 0,
+ "unexpectedStructurePaths": 0,
+ "malformedStructureBatches": 0
+ },
+ "determinism": {
+ "algorithm": "sha256",
+ "inputDigest": "ff0ab0d785f92f6324bc36c389a50abdbfa86ddb6a892a0439be1162a4da6a6f",
+ "outputDigest": "69f6cee48ef7e3febf0c5bb7dd04528010fc5764386b9982a44865813d9ec24a"
+ },
+ "llm": {
+ "invoked": false,
+ "inputTokens": null,
+ "outputTokens": null,
+ "costUsd": null
+ },
+ "warnings": [
+ {
+ "stage": "batching",
+ "count": 5,
+ "messages": [
+ "Warning: compute-batches: community size 46 > max 35 — splitting via alphabetical chunking — modularity may decrease",
+ "Warning: compute-batches: community size 61 > max 35 — splitting via alphabetical chunking — modularity may decrease",
+ "Warning: compute-batches: community size 52 > max 35 — splitting via alphabetical chunking — modularity may decrease",
+ "Warning: compute-batches: neighborMap for understand-anything-plugin/packages/core/src/languages/types.ts has high 1-hop degree 59 — exceeds soft cap of 50 — keeping top 31 cross-batch entries (0 dropped by degree sort)",
+ "Warning: compute-batches: neighborMap for understand-anything-plugin/packages/core/src/types.ts has high 1-hop degree 58 — exceeds soft cap of 50 — keeping top 38 cross-batch entries (0 dropped by degree sort)"
+ ],
+ "truncated": false
+ }
+ ],
+ "secondaryErrors": [],
+ "error": null
+}
diff --git a/docs/benchmarks/samples/understand-anything-pr587-full-sample.md b/docs/benchmarks/samples/understand-anything-pr587-full-sample.md
new file mode 100644
index 00000000..df9f6cea
--- /dev/null
+++ b/docs/benchmarks/samples/understand-anything-pr587-full-sample.md
@@ -0,0 +1,71 @@
+# Large Repository Benchmark Report
+
+This report covers deterministic static-analysis stages only. It does not include LLM inference or dashboard generation.
+
+## Run
+
+| Metric | Value |
+| --- | --- |
+| Status | degraded |
+| Pair ID | d7a047c6-9c05-41b2-9923-43a1e71e9634 |
+| Subject | understand-anything-pr587-full-sample |
+| Subject commit | 851ca14ebab22c81fde136986263d550daa38ee3 |
+| Subject dirty | false |
+| Tool commit | 851ca14ebab22c81fde136986263d550daa38ee3 |
+| Tool dirty | false |
+| Tool version | 2.9.3 |
+| Started (UTC) | 2026-07-17T11:45:14.919Z |
+| Total duration | 11734.69 ms |
+| Concurrency | 5 |
+| LLM invoked | No |
+
+## Scale
+
+| Metric | Value |
+| --- | --- |
+| Files | 459 |
+| Lines | 127155 |
+| Source bytes | 8918520 |
+| Filtered by user ignore | 0 |
+| Missing during measurement | 0 |
+
+## Stages
+
+| Stage | Status | Duration | Peak / max worker RSS (bytes) | User CPU (micros) | System CPU (micros) | Output (bytes) |
+| --- | --- | ---: | ---: | ---: | ---: | ---: |
+| scan | ok | 783.46 ms | 80,211,968 | 281,000 | 407,000 | 82,572 |
+| imports | ok | 1172.55 ms | 190,054,400 | 906,000 | 562,000 | 71,809 |
+| batching | ok | 1169.17 ms | 191,143,936 | 875,000 | 578,000 | 354,328 |
+| structure | ok | 8070.21 ms | 193,888,256 | 18,300,000 | 21,344,000 | 1,636,826 |
+
+## Integrity and reproducibility
+
+| Metric | Value |
+| --- | --- |
+| All scanned files batched | true |
+| Structure coverage | 1 |
+| Files skipped | 20 |
+| Failed batches | 0 |
+| Missing structure paths | 0 |
+| Duplicate structure paths | 0 |
+| Unexpected structure paths | 0 |
+| Malformed structure batches | 0 |
+| Input digest (SHA-256) | ff0ab0d785f92f6324bc36c389a50abdbfa86ddb6a892a0439be1162a4da6a6f |
+| Output digest (SHA-256) | 69f6cee48ef7e3febf0c5bb7dd04528010fc5764386b9982a44865813d9ec24a |
+| Schema version | 1.0.0 |
+
+## Environment
+
+| Metric | Value |
+| --- | --- |
+| Platform | win32 |
+| OS release | 10.0.26200 |
+| Architecture | x64 |
+| Node.js | v22.18.0 |
+| CPU | 13th Gen Intel(R) Core(TM) i9-13900HX |
+| Logical cores | 32 |
+| Memory (bytes) | 16907100160 |
+
+## Warnings
+
+- batching: 5
diff --git a/docs/superpowers/plans/2026-07-17-benchmark-unsupported-outcomes.md b/docs/superpowers/plans/2026-07-17-benchmark-unsupported-outcomes.md
new file mode 100644
index 00000000..8b8fe1ed
--- /dev/null
+++ b/docs/superpowers/plans/2026-07-17-benchmark-unsupported-outcomes.md
@@ -0,0 +1,78 @@
+# Benchmark Unsupported Outcomes Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Make the large-repository benchmark distinguish unsupported or unavailable analysis capabilities from real execution failures.
+
+**Architecture:** Reuse the existing `filesSkipped` and call-graph `skipped` paths rather than changing report schema 1.0.0. Capability detection happens before interpreting parser results; only a selected, advertised capability that fails remains fatal.
+
+**Tech Stack:** Node.js ESM, `PluginRegistry`, Vitest, JSON Schema 2020-12, pnpm.
+
+## Global Constraints
+
+- Preserve `large-repo-report-1.0.0.schema.json` and paired Markdown/JSON compatibility.
+- Unsupported structure files must be accounted for, produce `degraded` rather than `failed`, and exit 0.
+- Missing optional call-graph capability must be skipped, not failed.
+- Exceptions or invalid values after a capability is selected must remain failed.
+- Do not weaken path, digest, privacy, cleanup, or malformed-output integrity checks.
+- Do not write benchmark output inside the subject repository.
+
+---
+
+### Task 1: Classify unsupported capabilities without false failures
+
+**Files:**
+- Modify: `tests/skill/understand/test_extract_structure_outcomes.test.mjs`
+- Modify: `understand-anything-plugin/skills/understand/extract-structure-result.mjs`
+- Modify: `understand-anything-plugin/skills/understand/extract-structure.mjs`
+- Modify: `docs/benchmarks/large-monorepo.md`
+
+**Interfaces:**
+- Consumes: `PluginRegistry.getPluginForFile()`, optional `AnalyzerPlugin.extractCallGraph`, existing `filesSkipped`, and existing analysis outcome counters.
+- Produces: capability-aware `analyzeFileWithOutcomes()` results and schema-compatible degraded reports for unsupported files.
+
+- [ ] **Step 1: Add failing outcome tests**
+
+ Add one test whose registry exposes `getPluginForFile()` returning `null` and expects both outcomes to be `skipped`. Add one test whose selected parser supports structure but has neither `analyzeFileFull` nor `extractCallGraph`; expect structure `succeeded` and call graph `skipped`.
+
+- [ ] **Step 2: Run the focused test and verify RED**
+
+ Run:
+
+ ```powershell
+ & .\node_modules\.bin\vitest.CMD run tests\skill\understand\test_extract_structure_outcomes.test.mjs
+ ```
+
+ Expected: the new unsupported/capability tests fail because the current mapper returns `failed`.
+
+- [ ] **Step 3: Implement minimal capability-aware classification**
+
+ Update `analyzeFileWithOutcomes()` to distinguish a known missing plugin from a selected plugin that fails. Return skipped outcomes for a known unsupported file. For code/script files, attempt call-graph analysis only when the selected plugin advertises `analyzeFileFull` or `extractCallGraph`; otherwise return `skipped`.
+
+ In `extract-structure.mjs`, account a skipped structure path in `filesSkipped` and do not append a result or outcome count for it. Preserve existing counts for analyzed results so the benchmark's shape validation remains valid.
+
+- [ ] **Step 4: Run focused and benchmark tests and verify GREEN**
+
+ Run:
+
+ ```powershell
+ & .\node_modules\.bin\vitest.CMD run tests\skill\understand\test_extract_structure_outcomes.test.mjs tests\benchmark\test_large_repo_report_schema.test.mjs tests\benchmark\test_large_repo_benchmark.test.mjs
+ ```
+
+ Expected: all tests pass, with only existing documented skips.
+
+- [ ] **Step 5: Document the semantics**
+
+ Clarify in `docs/benchmarks/large-monorepo.md` that unsupported structural files are accounted as skipped and produce degraded reports, while a parser failure after capability selection remains fatal.
+
+- [ ] **Step 6: Run full verification**
+
+ Run the root test suite serially, build the core package, and run the benchmark against the clean repository with output outside the subject worktree. Validate the JSON against schema 1.0.0 and confirm the paired report IDs match.
+
+- [ ] **Step 7: Commit**
+
+ Commit as KumamuKuma with:
+
+ ```text
+ fix(bench): distinguish unsupported analysis from failures
+ ```
diff --git a/docs/superpowers/specs/2026-07-17-benchmark-unsupported-outcomes-design.md b/docs/superpowers/specs/2026-07-17-benchmark-unsupported-outcomes-design.md
new file mode 100644
index 00000000..2a53df35
--- /dev/null
+++ b/docs/superpowers/specs/2026-07-17-benchmark-unsupported-outcomes-design.md
@@ -0,0 +1,70 @@
+# Benchmark Unsupported-Outcome Semantics
+
+## Context
+
+The large-repository benchmark currently reports the Understand Anything
+repository as failed even though every reported analysis failure is an
+unsupported file or an unavailable optional call-graph capability. The
+current mapper collapses `PluginRegistry`'s contractual `null` return into a
+runtime failure, and the benchmark correctly treats that mislabeled outcome
+as an integrity failure.
+
+The reproduced full-repository run scanned 457 files and 126,169 lines. All
+20 structure failures had no registered analyzer. All 18 call-graph failures
+had no call-graph capability. No registered parser failed.
+
+## Approaches considered
+
+### 1. Capability-aware use of the existing skipped path (selected)
+
+Check registry support before analysis. Files with no registered analyzer are
+accounted for through the existing `filesSkipped` field, so the report is
+`degraded` with exit code 0. A code or script parser without an optional
+call-graph API records a skipped call graph. A selected parser that throws,
+returns an invalid final value, or produces damaged output remains failed.
+
+This preserves report schema 1.0.0, keeps repository scale totals intact, and
+uses an already tested degraded-report path.
+
+### 2. Add explicit unsupported counters to a new schema version
+
+Add `structureUnsupported` and capability-level counters. This is more
+expressive, but it expands the patch into schema versioning and migration when
+the existing skipped fields already model the required behavior.
+
+### 3. Exclude unsupported extensions during scanning
+
+Teach the scanner to ignore every unsupported extension. This hides useful
+repository scale information, requires a brittle duplicate allowlist, and
+does not solve optional capability detection for supported parsers.
+
+## Selected behavior
+
+- Scanner totals continue to include every discovered file.
+- If `PluginRegistry.getPluginForFile(path)` returns `null`, structural
+ extraction accounts for the path in `filesSkipped` and emits no structural
+ result for that path.
+- If a selected parser supports structure but not call-graph extraction, its
+ structure result succeeds and its call graph is skipped.
+- Once a parser advertises a capability, an exception, missing final value,
+ or malformed output is a real failure.
+- A run containing only unsupported structure skips is `degraded`, not
+ `failed`, and exits 0.
+- The Markdown and JSON reports retain the same schema version and pair
+ integrity rules.
+
+## Verification
+
+Tests must prove the red/green transition for an unsupported file and a
+structure-only parser. Existing exception tests must continue to prove that
+real parser errors are failures. The full benchmark must then run against the
+clean Understand Anything worktree and produce paired schema-valid reports
+with zero structure failures, zero call-graph failures, zero failed batches,
+and a non-failed status.
+
+## Publication
+
+After the fix is committed and pushed, share the generated Markdown and JSON
+reports on PR #587. The comment must state that TensorFlow was not run locally
+because its repository size and resource requirements exceed the practical
+scope of this local validation.
diff --git a/tests/skill/understand/test_extract_structure_outcomes.test.mjs b/tests/skill/understand/test_extract_structure_outcomes.test.mjs
index e1bc0a9c..749552e7 100644
--- a/tests/skill/understand/test_extract_structure_outcomes.test.mjs
+++ b/tests/skill/understand/test_extract_structure_outcomes.test.mjs
@@ -2,8 +2,682 @@ import { describe, expect, it } from 'vitest';
import * as extractStructure from '../../../understand-anything-plugin/skills/understand/extract-structure-result.mjs';
+const REQUIRED_STRUCTURE_ARRAY_FIELDS = [
+ 'functions',
+ 'classes',
+ 'imports',
+ 'exports',
+];
+const OPTIONAL_STRUCTURE_ARRAY_FIELDS = [
+ 'sections',
+ 'definitions',
+ 'services',
+ 'endpoints',
+ 'steps',
+ 'resources',
+];
+
+function validAnalysis() {
+ return {
+ functions: [],
+ classes: [],
+ imports: [],
+ exports: [],
+ };
+}
+
+function validCallGraph() {
+ return [{ caller: 'entry', callee: 'target', lineNumber: 1 }];
+}
+
+const VALID_STRUCTURE_ENTRIES = {
+ functions: {
+ name: 'run',
+ lineRange: [1, 2],
+ params: ['value'],
+ returnType: 'string',
+ },
+ classes: {
+ name: 'Runner',
+ lineRange: [1, 3],
+ methods: ['run'],
+ properties: ['value'],
+ },
+ imports: {
+ source: './dependency.js',
+ specifiers: ['dependency'],
+ lineNumber: 1,
+ },
+ exports: {
+ name: 'run',
+ lineNumber: 2,
+ isDefault: false,
+ },
+ sections: {
+ name: 'Overview',
+ level: 1,
+ lineRange: [1, 2],
+ },
+ definitions: {
+ name: 'users',
+ kind: 'table',
+ lineRange: [1, 2],
+ fields: ['id'],
+ },
+ services: {
+ name: 'api',
+ image: 'example/api',
+ ports: [8080],
+ lineRange: [1, 2],
+ },
+ endpoints: {
+ method: 'GET',
+ path: '/health',
+ lineRange: [1, 2],
+ },
+ steps: {
+ name: 'build',
+ lineRange: [1, 2],
+ },
+ resources: {
+ name: 'bucket',
+ kind: 'storage',
+ lineRange: [1, 2],
+ },
+};
+
+const MALFORMED_STRUCTURE_ENTRIES = [
+ ['a null function entry', 'functions', null],
+ ['an array function entry', 'functions', []],
+ ['a function with a non-string name', 'functions', {
+ ...VALID_STRUCTURE_ENTRIES.functions,
+ name: 1,
+ }],
+ ['a function with a non-pair line range', 'functions', {
+ ...VALID_STRUCTURE_ENTRIES.functions,
+ lineRange: [1],
+ }],
+ ['a function with non-string params', 'functions', {
+ ...VALID_STRUCTURE_ENTRIES.functions,
+ params: ['value', 2],
+ }],
+ ['a function with a non-string return type', 'functions', {
+ ...VALID_STRUCTURE_ENTRIES.functions,
+ returnType: false,
+ }],
+ ['a class with a non-string name', 'classes', {
+ ...VALID_STRUCTURE_ENTRIES.classes,
+ name: false,
+ }],
+ ['a class with an overlong line range', 'classes', {
+ ...VALID_STRUCTURE_ENTRIES.classes,
+ lineRange: [1, 2, 3],
+ }],
+ ['a class with a non-array methods field', 'classes', {
+ ...VALID_STRUCTURE_ENTRIES.classes,
+ methods: 'run',
+ }],
+ ['a class with non-string properties', 'classes', {
+ ...VALID_STRUCTURE_ENTRIES.classes,
+ properties: ['value', null],
+ }],
+ ['an import with a non-string source', 'imports', {
+ ...VALID_STRUCTURE_ENTRIES.imports,
+ source: null,
+ }],
+ ['an import with non-string specifiers', 'imports', {
+ ...VALID_STRUCTURE_ENTRIES.imports,
+ specifiers: ['dependency', 1],
+ }],
+ ['an import with a non-number line', 'imports', {
+ ...VALID_STRUCTURE_ENTRIES.imports,
+ lineNumber: '1',
+ }],
+ ['an export with a non-string name', 'exports', {
+ ...VALID_STRUCTURE_ENTRIES.exports,
+ name: {},
+ }],
+ ['an export with a fractional line', 'exports', {
+ ...VALID_STRUCTURE_ENTRIES.exports,
+ lineNumber: 1.5,
+ }],
+ ['an export with a non-boolean default flag', 'exports', {
+ ...VALID_STRUCTURE_ENTRIES.exports,
+ isDefault: 'false',
+ }],
+ ['a section with a non-string name', 'sections', {
+ ...VALID_STRUCTURE_ENTRIES.sections,
+ name: 0,
+ }],
+ ['a section with an infinite level', 'sections', {
+ ...VALID_STRUCTURE_ENTRIES.sections,
+ level: Infinity,
+ }],
+ ['a section with a fractional line range', 'sections', {
+ ...VALID_STRUCTURE_ENTRIES.sections,
+ lineRange: [1, 2.5],
+ }],
+ ['a definition with a non-string name', 'definitions', {
+ ...VALID_STRUCTURE_ENTRIES.definitions,
+ name: undefined,
+ }],
+ ['a definition with a non-string kind', 'definitions', {
+ ...VALID_STRUCTURE_ENTRIES.definitions,
+ kind: 1,
+ }],
+ ['a definition with a non-finite line range', 'definitions', {
+ ...VALID_STRUCTURE_ENTRIES.definitions,
+ lineRange: [1, Infinity],
+ }],
+ ['a definition with a non-array fields field', 'definitions', {
+ ...VALID_STRUCTURE_ENTRIES.definitions,
+ fields: 'id',
+ }],
+ ['a service with a non-string name', 'services', {
+ ...VALID_STRUCTURE_ENTRIES.services,
+ name: false,
+ }],
+ ['a service with a non-string image', 'services', {
+ ...VALID_STRUCTURE_ENTRIES.services,
+ image: 7,
+ }],
+ ['a service with fractional ports', 'services', {
+ ...VALID_STRUCTURE_ENTRIES.services,
+ ports: [80.5],
+ }],
+ ['a service with a non-array optional line range', 'services', {
+ ...VALID_STRUCTURE_ENTRIES.services,
+ lineRange: '1-2',
+ }],
+ ['an endpoint with a non-string method', 'endpoints', {
+ ...VALID_STRUCTURE_ENTRIES.endpoints,
+ method: 7,
+ }],
+ ['an endpoint with a non-string path', 'endpoints', {
+ ...VALID_STRUCTURE_ENTRIES.endpoints,
+ path: null,
+ }],
+ ['an endpoint with a non-number line range', 'endpoints', {
+ ...VALID_STRUCTURE_ENTRIES.endpoints,
+ lineRange: [1, '2'],
+ }],
+ ['a step with a non-string name', 'steps', {
+ ...VALID_STRUCTURE_ENTRIES.steps,
+ name: [],
+ }],
+ ['a step with a NaN line range', 'steps', {
+ ...VALID_STRUCTURE_ENTRIES.steps,
+ lineRange: [1, NaN],
+ }],
+ ['a resource with a non-string name', 'resources', {
+ ...VALID_STRUCTURE_ENTRIES.resources,
+ name: 1,
+ }],
+ ['a resource with a non-string kind', 'resources', {
+ ...VALID_STRUCTURE_ENTRIES.resources,
+ kind: null,
+ }],
+ ['a resource with a null line range', 'resources', {
+ ...VALID_STRUCTURE_ENTRIES.resources,
+ lineRange: null,
+ }],
+];
+
+const VALID_BOUNDARY_ANALYSES = [
+ ['required collections with optional fields and arrays absent', {
+ functions: [{
+ name: 'run',
+ lineRange: [-1, 0],
+ params: [],
+ extraFunctionProperty: true,
+ }],
+ classes: [{
+ name: 'Runner',
+ lineRange: [-2, 0],
+ methods: [],
+ properties: [],
+ extraClassProperty: true,
+ }],
+ imports: [{
+ source: './dependency.js',
+ specifiers: [],
+ lineNumber: 0,
+ extraImportProperty: true,
+ }],
+ exports: [{
+ name: 'run',
+ lineNumber: -1,
+ extraExportProperty: true,
+ }],
+ extraAnalysisProperty: true,
+ }],
+ ['optional collections with nested optional fields absent', {
+ ...validAnalysis(),
+ sections: [{
+ name: 'Overview',
+ level: 0,
+ lineRange: [-1, 0],
+ extraSectionProperty: true,
+ }],
+ definitions: [{
+ name: 'users',
+ kind: 'table',
+ lineRange: [-1, 0],
+ fields: [],
+ extraDefinitionProperty: true,
+ }],
+ services: [{
+ name: 'api',
+ ports: [0, -1],
+ extraServiceProperty: true,
+ }],
+ endpoints: [{
+ path: '/health',
+ lineRange: [-1, 0],
+ extraEndpointProperty: true,
+ }],
+ steps: [{
+ name: 'build',
+ lineRange: [-1, 0],
+ extraStepProperty: true,
+ }],
+ resources: [{
+ name: 'bucket',
+ kind: 'storage',
+ lineRange: [-1, 0],
+ extraResourceProperty: true,
+ }],
+ extraAnalysisProperty: true,
+ }],
+];
+
+function analysisWithEntry(collection, entry) {
+ return {
+ ...validAnalysis(),
+ [collection]: [entry],
+ };
+}
+
+function analyzeStructuralOutput(mode, analysis) {
+ const parser = mode === 'full'
+ ? {
+ analyzeFileFull() {
+ return { structure: analysis, callGraph: validCallGraph() };
+ },
+ }
+ : {
+ analyzeFile() {
+ return analysis;
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFileFull(path, content) {
+ return parser.analyzeFileFull(path, content);
+ },
+ analyzeFile(path, content) {
+ return parser.analyzeFile(path, content);
+ },
+ };
+
+ return extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: `src/${mode}-structure.ts`, fileCategory: 'code' },
+ 'export const value = 1;\n',
+ );
+}
+
describe('extract-structure analysis outcomes', () => {
- it('records final structure and call-graph exceptions after full-analysis fallback', () => {
+ it('skips structure and call-graph analysis when no parser supports the file', () => {
+ const registry = {
+ getPluginForFile() {
+ return null;
+ },
+ };
+
+ expect(
+ extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'src/unsupported.xyz', fileCategory: 'code' },
+ 'unsupported content\n',
+ ),
+ ).toEqual({
+ analysis: null,
+ callGraph: null,
+ structureOutcome: 'skipped',
+ callGraphOutcome: 'skipped',
+ });
+ });
+
+ it('skips call-graph analysis when the selected parser only supports structure', () => {
+ const analysis = validAnalysis();
+ const parser = {
+ analyzeFile() {
+ return analysis;
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFile(path, content) {
+ return parser.analyzeFile(path, content);
+ },
+ };
+
+ expect(
+ extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'src/structure-only.ts', fileCategory: 'code' },
+ 'export const value = 1;\n',
+ ),
+ ).toEqual({
+ analysis,
+ callGraph: null,
+ structureOutcome: 'succeeded',
+ callGraphOutcome: 'skipped',
+ });
+ });
+
+ it('uses separate structure analysis for non-code files even when full analysis is advertised', () => {
+ const analysis = validAnalysis();
+ let fullCalls = 0;
+ let separateCalls = 0;
+ const parser = {
+ analyzeFileFull() {
+ fullCalls += 1;
+ throw new Error('full analysis must not run for non-code files');
+ },
+ analyzeFile() {
+ separateCalls += 1;
+ return analysis;
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFileFull(path, content) {
+ return parser.analyzeFileFull(path, content);
+ },
+ analyzeFile(path, content) {
+ return parser.analyzeFile(path, content);
+ },
+ };
+
+ const result = extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'README.md', fileCategory: 'docs' },
+ '# Documentation\n',
+ );
+
+ expect({ result, fullCalls, separateCalls }).toEqual({
+ result: {
+ analysis,
+ callGraph: null,
+ structureOutcome: 'succeeded',
+ callGraphOutcome: 'skipped',
+ },
+ fullCalls: 0,
+ separateCalls: 1,
+ });
+ });
+
+ it.each([
+ [
+ 'throws',
+ () => {
+ throw new Error('combined parser failed');
+ },
+ ],
+ ['returns null', () => null],
+ ['returns undefined', () => undefined],
+ ])(
+ 'does not hide advertised full analysis that %s behind successful separate calls',
+ (_behavior, analyzeFileFull) => {
+ const fallbackAnalysis = validAnalysis();
+ const fallbackCallGraph = validCallGraph();
+ const parser = {
+ analyzeFileFull,
+ analyzeFile() {
+ return fallbackAnalysis;
+ },
+ extractCallGraph() {
+ return fallbackCallGraph;
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFileFull(path, content) {
+ return parser.analyzeFileFull(path, content);
+ },
+ analyzeFile(path, content) {
+ return parser.analyzeFile(path, content);
+ },
+ extractCallGraph(path, content) {
+ return parser.extractCallGraph(path, content);
+ },
+ };
+
+ expect(
+ extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'src/full-failing.ts', fileCategory: 'code' },
+ 'export const value = 1;\n',
+ ),
+ ).toEqual({
+ analysis: null,
+ callGraph: null,
+ structureOutcome: 'failed',
+ callGraphOutcome: 'failed',
+ });
+ },
+ );
+
+ it('validates structure independently in a full-analysis result', () => {
+ const callGraph = validCallGraph();
+ const parser = {
+ analyzeFileFull() {
+ return { structure: {}, callGraph };
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFileFull(path, content) {
+ return parser.analyzeFileFull(path, content);
+ },
+ };
+
+ expect(
+ extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'src/full-structure-invalid.ts', fileCategory: 'code' },
+ 'export const value = 1;\n',
+ ),
+ ).toEqual({
+ analysis: null,
+ callGraph,
+ structureOutcome: 'failed',
+ callGraphOutcome: 'succeeded',
+ });
+ });
+
+ it('validates call-graph entries independently in a full-analysis result', () => {
+ const analysis = validAnalysis();
+ const parser = {
+ analyzeFileFull() {
+ return {
+ structure: analysis,
+ callGraph: [{ caller: 'entry', callee: 'target', lineNumber: 1.5 }],
+ };
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFileFull(path, content) {
+ return parser.analyzeFileFull(path, content);
+ },
+ };
+
+ expect(
+ extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'src/full-call-graph-invalid.ts', fileCategory: 'code' },
+ 'export const value = 1;\n',
+ ),
+ ).toEqual({
+ analysis,
+ callGraph: null,
+ structureOutcome: 'succeeded',
+ callGraphOutcome: 'failed',
+ });
+ });
+
+ it.each([
+ ['a number', 42],
+ ['an array', []],
+ ['an object without required arrays', {}],
+ ...REQUIRED_STRUCTURE_ARRAY_FIELDS.map(field => [
+ `a non-array ${field} field`,
+ { ...validAnalysis(), [field]: null },
+ ]),
+ ...OPTIONAL_STRUCTURE_ARRAY_FIELDS.map(field => [
+ `a non-array optional ${field} field`,
+ { ...validAnalysis(), [field]: {} },
+ ]),
+ ])('rejects separate structural output containing %s', (_description, malformed) => {
+ const parser = {
+ analyzeFile() {
+ return malformed;
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFile(path, content) {
+ return parser.analyzeFile(path, content);
+ },
+ };
+
+ expect(
+ extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'src/malformed-structure.ts', fileCategory: 'code' },
+ 'export const value = 1;\n',
+ ),
+ ).toEqual({
+ analysis: null,
+ callGraph: null,
+ structureOutcome: 'failed',
+ callGraphOutcome: 'skipped',
+ });
+ });
+
+ it.each(MALFORMED_STRUCTURE_ENTRIES)(
+ 'rejects %s through separate and full structural analysis',
+ (_description, collection, malformedEntry) => {
+ const malformed = analysisWithEntry(collection, malformedEntry);
+ const callGraph = validCallGraph();
+ const results = {
+ separate: analyzeStructuralOutput('separate', malformed),
+ full: analyzeStructuralOutput('full', malformed),
+ };
+
+ expect(results).toEqual({
+ separate: {
+ analysis: null,
+ callGraph: null,
+ structureOutcome: 'failed',
+ callGraphOutcome: 'skipped',
+ },
+ full: {
+ analysis: null,
+ callGraph,
+ structureOutcome: 'failed',
+ callGraphOutcome: 'succeeded',
+ },
+ });
+ },
+ );
+
+ it.each(VALID_BOUNDARY_ANALYSES)(
+ 'accepts %s through separate and full structural analysis',
+ (_description, analysis) => {
+ const callGraph = validCallGraph();
+
+ expect({
+ separate: analyzeStructuralOutput('separate', analysis),
+ full: analyzeStructuralOutput('full', analysis),
+ }).toEqual({
+ separate: {
+ analysis,
+ callGraph: null,
+ structureOutcome: 'succeeded',
+ callGraphOutcome: 'skipped',
+ },
+ full: {
+ analysis,
+ callGraph,
+ structureOutcome: 'succeeded',
+ callGraphOutcome: 'succeeded',
+ },
+ });
+ },
+ );
+
+ it.each([
+ ['a non-string caller', { caller: 1, callee: 'target', lineNumber: 1 }],
+ ['a non-string callee', { caller: 'entry', callee: null, lineNumber: 1 }],
+ ['a non-number line', { caller: 'entry', callee: 'target', lineNumber: '1' }],
+ ['an infinite line', { caller: 'entry', callee: 'target', lineNumber: Infinity }],
+ ['a NaN line', { caller: 'entry', callee: 'target', lineNumber: NaN }],
+ ['a fractional line', { caller: 'entry', callee: 'target', lineNumber: 1.5 }],
+ ])('rejects a separate call graph containing %s', (_description, malformedEntry) => {
+ const analysis = validAnalysis();
+ const parser = {
+ analyzeFile() {
+ return analysis;
+ },
+ extractCallGraph() {
+ return [malformedEntry];
+ },
+ };
+ const registry = {
+ getPluginForFile() {
+ return parser;
+ },
+ analyzeFile(path, content) {
+ return parser.analyzeFile(path, content);
+ },
+ extractCallGraph(path, content) {
+ return parser.extractCallGraph(path, content);
+ },
+ };
+
+ expect(
+ extractStructure.analyzeFileWithOutcomes(
+ registry,
+ { path: 'src/malformed-call-graph.ts', fileCategory: 'code' },
+ 'export const value = 1;\n',
+ ),
+ ).toEqual({
+ analysis,
+ callGraph: null,
+ structureOutcome: 'succeeded',
+ callGraphOutcome: 'failed',
+ });
+ });
+
+ it('records advertised full-analysis exceptions as failures', () => {
expect(extractStructure.analyzeFileWithOutcomes).toBeTypeOf('function');
const registry = {
analyzeFileFull() {
diff --git a/understand-anything-plugin/skills/understand/extract-structure-result.mjs b/understand-anything-plugin/skills/understand/extract-structure-result.mjs
index 6bfb30c0..f24d1891 100644
--- a/understand-anything-plugin/skills/understand/extract-structure-result.mjs
+++ b/understand-anything-plugin/skills/understand/extract-structure-result.mjs
@@ -1,5 +1,124 @@
// Pure result mapping for extract-structure.mjs.
// Kept separate from the CLI entrypoint so unit tests do not import a shebang script.
+const REQUIRED_STRUCTURE_ARRAY_FIELDS = [
+ 'functions',
+ 'classes',
+ 'imports',
+ 'exports',
+];
+const OPTIONAL_STRUCTURE_ARRAY_FIELDS = [
+ 'sections',
+ 'definitions',
+ 'services',
+ 'endpoints',
+ 'steps',
+ 'resources',
+];
+
+function isPlainObject(value) {
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
+ return false;
+ }
+
+ const prototype = Object.getPrototypeOf(value);
+ return prototype === Object.prototype || prototype === null;
+}
+
+function isStringArray(value) {
+ return Array.isArray(value) && value.every(item => typeof item === 'string');
+}
+
+function isFiniteInteger(value) {
+ return typeof value === 'number' &&
+ Number.isFinite(value) &&
+ Number.isInteger(value);
+}
+
+function isLineRange(value) {
+ return Array.isArray(value) &&
+ value.length === 2 &&
+ value.every(isFiniteInteger);
+}
+
+function hasValidOptionalField(value, field, validator) {
+ return value[field] === undefined || validator(value[field]);
+}
+
+function isValidEntryArray(value, validator) {
+ return Array.isArray(value) &&
+ value.every(entry => isPlainObject(entry) && validator(entry));
+}
+
+const STRUCTURE_ENTRY_VALIDATORS = {
+ functions: entry =>
+ typeof entry.name === 'string' &&
+ isLineRange(entry.lineRange) &&
+ isStringArray(entry.params) &&
+ hasValidOptionalField(entry, 'returnType', value => typeof value === 'string'),
+ classes: entry =>
+ typeof entry.name === 'string' &&
+ isLineRange(entry.lineRange) &&
+ isStringArray(entry.methods) &&
+ isStringArray(entry.properties),
+ imports: entry =>
+ typeof entry.source === 'string' &&
+ isStringArray(entry.specifiers) &&
+ isFiniteInteger(entry.lineNumber),
+ exports: entry =>
+ typeof entry.name === 'string' &&
+ isFiniteInteger(entry.lineNumber) &&
+ hasValidOptionalField(entry, 'isDefault', value => typeof value === 'boolean'),
+ sections: entry =>
+ typeof entry.name === 'string' &&
+ isFiniteInteger(entry.level) &&
+ isLineRange(entry.lineRange),
+ definitions: entry =>
+ typeof entry.name === 'string' &&
+ typeof entry.kind === 'string' &&
+ isLineRange(entry.lineRange) &&
+ isStringArray(entry.fields),
+ services: entry =>
+ typeof entry.name === 'string' &&
+ hasValidOptionalField(entry, 'image', value => typeof value === 'string') &&
+ Array.isArray(entry.ports) &&
+ entry.ports.every(isFiniteInteger) &&
+ hasValidOptionalField(entry, 'lineRange', isLineRange),
+ endpoints: entry =>
+ hasValidOptionalField(entry, 'method', value => typeof value === 'string') &&
+ typeof entry.path === 'string' &&
+ isLineRange(entry.lineRange),
+ steps: entry =>
+ typeof entry.name === 'string' &&
+ isLineRange(entry.lineRange),
+ resources: entry =>
+ typeof entry.name === 'string' &&
+ typeof entry.kind === 'string' &&
+ isLineRange(entry.lineRange),
+};
+
+function isValidStructuralAnalysis(analysis) {
+ if (!isPlainObject(analysis)) {
+ return false;
+ }
+
+ return REQUIRED_STRUCTURE_ARRAY_FIELDS.every(field =>
+ isValidEntryArray(analysis[field], STRUCTURE_ENTRY_VALIDATORS[field])) &&
+ OPTIONAL_STRUCTURE_ARRAY_FIELDS.every(field =>
+ hasValidOptionalField(
+ analysis,
+ field,
+ value => isValidEntryArray(value, STRUCTURE_ENTRY_VALIDATORS[field]),
+ ));
+}
+
+function isValidCallGraph(callGraph) {
+ return Array.isArray(callGraph) && callGraph.every(entry =>
+ isPlainObject(entry) &&
+ typeof entry.caller === 'string' &&
+ typeof entry.callee === 'string' &&
+ isFiniteInteger(entry.lineNumber));
+}
+
function mapCallGraph(callGraph) {
return callGraph && callGraph.length > 0
? callGraph.map(entry => ({
@@ -13,45 +132,81 @@ function mapCallGraph(callGraph) {
export function analyzeFileWithOutcomes(registry, file, content) {
const wantsCallGraph =
file.fileCategory === 'code' || file.fileCategory === 'script';
- let analysis = null;
- let callGraph = null;
- let structureOutcome = 'failed';
- let callGraphOutcome = wantsCallGraph ? 'failed' : 'skipped';
+ const selectedPlugin = typeof registry.getPluginForFile === 'function'
+ ? registry.getPluginForFile(file.path)
+ : registry;
- let full = null;
- if (wantsCallGraph && typeof registry.analyzeFileFull === 'function') {
+ if (selectedPlugin === null) {
+ return {
+ analysis: null,
+ callGraph: null,
+ structureOutcome: 'skipped',
+ callGraphOutcome: 'skipped',
+ };
+ }
+
+ const supportsFullAnalysis =
+ typeof selectedPlugin?.analyzeFileFull === 'function';
+ const supportsSeparateCallGraph =
+ typeof selectedPlugin?.extractCallGraph === 'function';
+
+ if (wantsCallGraph && supportsFullAnalysis) {
+ let full;
try {
full = registry.analyzeFileFull(file.path, content);
} catch {
- full = null;
+ return {
+ analysis: null,
+ callGraph: null,
+ structureOutcome: 'failed',
+ callGraphOutcome: wantsCallGraph ? 'failed' : 'skipped',
+ };
}
+
+ const analysis = isValidStructuralAnalysis(full?.structure)
+ ? full.structure
+ : null;
+ const hasValidCallGraph = wantsCallGraph && isValidCallGraph(full?.callGraph);
+ const callGraph = hasValidCallGraph ? mapCallGraph(full.callGraph) : null;
+
+ return {
+ analysis,
+ callGraph,
+ structureOutcome: analysis === null ? 'failed' : 'succeeded',
+ callGraphOutcome: wantsCallGraph
+ ? hasValidCallGraph ? 'succeeded' : 'failed'
+ : 'skipped',
+ };
}
- if (full) {
- analysis = full.structure ?? null;
- callGraph = mapCallGraph(full.callGraph);
- structureOutcome = analysis === null ? 'failed' : 'succeeded';
- callGraphOutcome = Array.isArray(full.callGraph) ? 'succeeded' : 'failed';
- } else {
- try {
- analysis = registry.analyzeFile(file.path, content) ?? null;
- structureOutcome = analysis === null ? 'failed' : 'succeeded';
- } catch {
- analysis = null;
- structureOutcome = 'failed';
+ let analysis = null;
+ let callGraph = null;
+ let structureOutcome = 'failed';
+ let callGraphOutcome = wantsCallGraph && supportsSeparateCallGraph
+ ? 'failed'
+ : 'skipped';
+
+ try {
+ const extractedAnalysis = registry.analyzeFile(file.path, content);
+ if (isValidStructuralAnalysis(extractedAnalysis)) {
+ analysis = extractedAnalysis;
+ structureOutcome = 'succeeded';
}
+ } catch {
+ analysis = null;
+ structureOutcome = 'failed';
+ }
- if (wantsCallGraph) {
- try {
- const extractedCallGraph = registry.extractCallGraph(file.path, content);
+ if (wantsCallGraph && supportsSeparateCallGraph) {
+ try {
+ const extractedCallGraph = registry.extractCallGraph(file.path, content);
+ if (isValidCallGraph(extractedCallGraph)) {
callGraph = mapCallGraph(extractedCallGraph);
- callGraphOutcome = Array.isArray(extractedCallGraph)
- ? 'succeeded'
- : 'failed';
- } catch {
- callGraph = null;
- callGraphOutcome = 'failed';
+ callGraphOutcome = 'succeeded';
}
+ } catch {
+ callGraph = null;
+ callGraphOutcome = 'failed';
}
}
diff --git a/understand-anything-plugin/skills/understand/extract-structure.mjs b/understand-anything-plugin/skills/understand/extract-structure.mjs
index 50e2c9f4..32cbf29b 100644
--- a/understand-anything-plugin/skills/understand/extract-structure.mjs
+++ b/understand-anything-plugin/skills/understand/extract-structure.mjs
@@ -109,6 +109,12 @@ async function main() {
const { analysis, callGraph, structureOutcome, callGraphOutcome } =
analyzeFileWithOutcomes(registry, file, content);
+
+ if (structureOutcome === 'skipped') {
+ filesSkipped.push(file.path);
+ continue;
+ }
+
analysisOutcomes.structure[structureOutcome] += 1;
analysisOutcomes.callGraph[callGraphOutcome] += 1;