The repository, directory by directory
Where things live and why, for a change that has to be put in the
right place. Moved out of AGENTS.md verbatim in round 108.1 — that file
routes, these files explain.
The v3/v4 split
- Round 42 split the repo in two. v4 is the package and lives at the
repo root (
src/,test/,benchmark/,debug/,playwright-tests/,scripts/). v3 is kept whole, self-contained and buildable inv3/— its ownpackage.json, build, tests and documentation site — because the comparison benchmarks and the v3-vs-v4 pixel-parity harness run against it. Nothing undersrc/imports outsidesrc/, and a spec enforces that (test/modules/import-graph.test.mjs). Everything in these notes describes the v4 project unless it says otherwise.
src/ — v4's source
src/: v4's source — the columnar core and WebGPU renderer (issue #3486).src/README.mdis the maintained scope and design-decisions doc;PLAN.md(repo root) records each development round and the standing process rules (docs travel with every commit; a closing docs sweep ends every round).src/core.mts,src/collection.mts: the core facade and the collection API. Since round 130 each keeps the class — every signature and doc — and delegates its bodies tosrc/core/(batching, elements, query, events, viewport, export, graph-data, serialize, lifecycle, patch, clone, load) andsrc/collection/(see below).src/store/: the columnar model — tables, indexes, sidecars, dirty tracking.graph-store.mtsis the facade; its curve reads, scans, compound hierarchy, compaction, mutation, layer/channel/image/label/position/flag writers are functions over the store insrc/store/graph-store/(round 130), andconsumers.mtsthere is the store half of the dirty stream's consumer cursors (round 106: the renderer'stakeDelta()is the primary cursor; any other reader registers its own withregisterConsumer()).src/render/: the WebGPU frame graph, pipelines, shaders, culling, picking.renderer.mtsis the facade; the frame, scene, pick, export, force, targets, pipelines and lifecycle bodies are functions over the renderer insrc/render/renderer/(round 130).src/interact/: pointer, wheel and touch gestures.pointer.mtsholds the handler's fields and listener wiring; the DOM entry points, the press gesture, the touch gestures, box selection and hover/cursor are flatpointer-*siblings (round 130).- A file that outgrew ~1,000 lines keeps its path as the facade and its implementation in a sibling directory of the same name (round 130), the way
collection.mtsdelegates tosrc/algorithms/:src/render/shaders/(one shader per file),src/curve-geometry/(bezier,route,taxi,route-quads),src/style/(the parsers, tables, defaults,applyProp,MAPPABLE, the compile, sheet and reader modules, andStyleEngine's apply/refresh/read/write/txn/bypass/sheet sides as functions over the engine) ,src/animation/(handle,animation,manager— one class each, listed inPUBLIC_API— pluschannels,capture,apply),src/collection/(shared, then one module per section banner:iteration,filtering,identity,position,animation,data,style,bounds,edge-geometry,state,manipulation,traversal,hierarchy,layout,degree) — each facade re-exports what it exported before, and a class facade keeps every signature and doc. - Three entries (round 131):
src/index.mts(the full build),src/headless.mts(cytoscape/headless: no renderer, no WebGPU code) andsrc/headless-gpu.mts(cytoscape/headless-gpu: the GPU executors, no renderer). Each callscreateCoreinsrc/factory.mts(@internal, the capability seam) with the capabilities it carries, and assigns its own statics (the docs generator reads the full entry's). Type re-exports live once, insrc/public-exports.mts. A slim entry must not reach a higher tier —test/modules/import-graph.test.mjswalks every import, type imports included, so a type a lower tier needs lives in that tier. src/gpu/: the WebGPU device tier the renderer and cytoscape/headless-gpu share — the force integrator (gpu-force.mts), thewgsltag, the WebGPU constants, and the headless force host (round 131.1 moved the first three out ofsrc/render/). The algorithm kernels (src/algorithms/algo-gpu-*) are reached only throughsrc/algorithms/gpu-registry.mts, which an entry populates fromgpu-lanes.mts.src/layout/,src/algorithms/: built-in layouts (incl. the GPU force) and the graph algorithms. The force family is flat siblings:force.mts(the layout object),force-options,force-separate,force-run(one run's preparation and dispatch),force-executors(live, worker, GPU), besideforce-sim,force-init,force-constraints,force-remote,force-worker(round 130).src/style.mts,src/style-scales.mts,src/style-schemes.mts: the sheet compiler and the mapper DSL.src/style-props.mtsis the property vocabulary —PROP.BACKGROUND_COLOR— the one place a property name is spelled (round 127).src/contract.mts: the co-signed model↔renderer column/flag layout — change it first when the layout changes. Column ids areCOL.NODE_POSITION, never the literal, the reserved data keys areDATA_ID/DATA_PARENT/DATA_SOURCE/DATA_TARGET, and the groups areGROUP_NODES/GROUP_EDGES(GroupNamederives from them);test/modules/string-keys.test.mjsrejects a literal anywhere else undersrc/(round 127).src/math.mts,src/types.mts,src/util/: v4's own copies of the generic helpers it used to import from v3 (round 42).src/math.mtsis deliberately lean — the functions v4 calls, not v3's 1500-line geometry module.- The
gpu-prefix survives only where it names the device half against a CPU counterpart:gpu-context.mts,src/gpu/gpu-force.mts,src/render/gpu-tween.mts,src/render/gpu-timer.mts. (gpu-types.mtswas not such a case — it holds the public option surface — and becamepublic-types.mtsin round 42.6.)
schemas/ — the shipped JSON schemas
schemas/: the official JSON Schema (draft 2020-12) documents (round 79, #3487) — element, elements, stylesheet, layout options and the options envelope — shipped in the package and exported ascytoscape/schemas/*.json. Hand-written, not generated:test/modules/schemas.test.mjsholds them to the running library (the stylesheet both ways againstPROPand the compiler, every schema's names againstsrc/public-types.mtsthrough the TypeScript checker, paired probes where the library is strict), andscripts/schemas.mjsis the shared harness — the placeholder$idbase (SCHEMA_BASE, finalized by round 46), the ajv loader (a devDependency; there is no runtimevalidate()) and the fixture run the status site's schemas page shows. A round that adds a style property, a layout option or a factory option adds it to the schema, or that spec is red.
test/
test/:node:testsuites (Mocha-shaped, see above). Add regression coverage here for API and logic changes;test/modules/holds internal-only and tooling coverage;test/soak/holds the round-48 robustness tier (leaks, churn, wire fuzzing, multi-instance isolation), run bynpm run test:soakunder Node--expose-gcor Bun's realBun.gc().test/lib/holds test preloads that are not themselves discovered as specs.test/runtimes/holds the round-98 Node/Bun bundle smoke plus the isolate and workerd checks; seedocs/agents/testing.md.playwright-tests/goldens/holds approved reference PNGs;playwright-tests/golden-current/holds the latest tested PNG and timestamp for each scene, including failures.scripts/golden-images.mjsshares the comparison and capture code with the status gallery, which derives its neon diff images from those stored pairs.
documentation/ — v4-authored prose
documentation/: Markdown prose written for v4 and API-parity audit sources. This is separate from frozenv3/documentation/; the status site links to repository sources, and.npmignorekeeps the tree out of the runtime package.
typescript/
typescript/: TypeScript-related tests and fixtures (the compile-only consumer test).
scripts/ — the repo tooling
scripts/: Repo tooling run by hand or by a spec — the v4 audits (jsdoc-coverage.mjs,throw-coverage.mjs,bench-coverage.mjs, and round 135'sgolden-coverage.mjs— which style properties no visual golden sets, counted from the records underplaywright-tests/golden-coverage/and gated bytest/modules/golden-coverage.test.mjs; it importssrc/, so run it withnode --import tsx), the Node/Bun test-tier adapter (runtime-test-tier.mjs, with event and JUnit normalization inruntime-test-results.mjs), the algorithm reference generators (algorithm-references.pyand, since round 150,algorithm-references.R, run by hand in the locked pixi environment ofscripts/references/: NetworkX, SciPy, scikit-learn, scikit-fuzzy andmarkov_clusteringvalues fortest/algorithms-reference.test.mjs, written totest/fixtures/algorithm-references.json, and igraph,stats,cluster,e1071andMCLvalues fortest/algorithms-reference-r.test.mjs, written totest/fixtures/algorithm-references-r.json), the docs generator (docs-generate.mjs, round 45:npm run docs:api, gated bytest/docs-generate.test.mjsagainst the shipped declaration), and round 46.5's status site.oxlint src scriptscovers this directory since 46.5; it did not before.scripts/status-build.mjs+scripts/status/:npm run statusbuilds the gitignoredstatus/— a deployable preview of the branch (the debug harness, the benchmark archive, the API reference, the repo documents, the golden gallery). Split into a purebuildPlan()and a writingexecutePlan()sotest/modules/status-site.test.mjscan check the intended output without copying 30 MiB of fixtures. Serve it withnpm run status:serve(port 3335 — 3333 is v4's harness, 3334 is v3's).scripts/machine-info.mjs:npm run machine— CPU/cores/clock, RAM, OS, and a GPU inventory with VRAM, for benchmark provenance. Parsers are pure and exported; probes are separate and never throw.scripts/gpu-info.mjs:npm run gpu— whether the harness-flagged Chromium reaches a real WebGPU adapter, with a one-line HARDWARE / SOFTWARE-ONLY / UNKNOWN verdict. The card being present and the browser reaching it are different facts; twice a session has read SwiftShader and wrongly concluded "no GPU". A failed probe reports UNKNOWN (exit 1), never "no GPU".scripts/benchmark-publish.mjs:npm run benchmark:publish— promotes a local run into the trackedbenchmark/published/.scripts/quiet-run.mjs: the round-101 capture wrapper behind the:quietscripts for tools with no quiet mode (rolldown, oxlint, tsc, playwright install) — green prints nothing, red replays the captured output byte-for-byte and preserves the exit code. Itsnode:testtwin istest/quiet-reporter.mjs(failures-only reporter; note in its header why it replays the failing file's output, not the failing test's) and its Playwright twin isplaywright-tests/quiet-reporter.mjs.scripts/theme.mjs: the design tokens andesc, shared by the benchmark report and the status site so the two read as one system.scripts/wgsl-minify.mjs: the round-52 build transform behind the WGSL note indocs/agents/rendering.md—minifyWgslTemplate/transformWgslTagsare pure and spec'd (test/modules/wgsl-minify.test.mjs);wgslMinifyPlugin()is whatrolldown.config.mjswires into every bundle. Round 126 added float-literal shortening and theglsltag.scripts/const-inline.mjs: the round-126 build transform that runs before it, on the AST —COL.X/PROP.X/TWEEN_COL.Xbecome their string literals (PLAN.md item 63: the tables no longer ship), and a module-level number interpolated into awgsl/glslliteral is spliced into its text. Spec'd bytest/modules/const-inline.test.mjs, which evaluates every inlined shader module against the original.
.github/workflows/
.github/workflows/: CI and release workflows.tests.ymlruns both projects — v4's Node tier, Bun latest and therenderer/renderer-webkitprojects on Linux, Windows and macOS (round 151), everything else on Linux only; the three release workflows are still v3's and are marked as not yet adapted (round 50 owns them) — they stay at the root only because GitHub reads workflows nowhere else.
v3/ — frozen (see v3/AGENTS.md)
v3/: Cytoscape.js v3, whole and self-contained —v3/src/,v3/test/,v3/benchmark/,v3/debug/,v3/documentation/,v3/playwright-tests/(port 3334, so a stray server cannot be mistaken for v4's on 3333), and its own build/tsconfig/package.json.