Skip to content

Developing waygraph ​

Developing this package ​

bash
git clone git@github.com:deviate-dv8/waygraph.git
cd waygraph
npm install
npm run build && npm run examples:link   # the specs scan examples/; this links the build in as their `waygraph`
npm run typecheck   # waygraph typecheck . (tsc --noEmit + practice warnings)
npm run test        # node --test tests/unit + playwright test
npm run test:ui     # playwright test --ui
npm run test:offscreen   # Linux: the Playwright suite on a hidden display (xvfb-run), headed tests included; needs xvfb
npm run build       # tsc -p tsconfig.build.json, emits dist/ (+ the overlay's stylesheet, scripts/build-ui-css.mjs)
npm run storybook   # every overlay piece in light and dark, painted by the real builders (stories/), on :6006
npm run icons       # regenerate src/demo/overlay/ui/icons.ts after adding a Phosphor icon to scripts/gen-icons.mjs

The overlay's look ​

The overlay follows macOS: translucent materials, system colours, the system font, hairline edges, light and dark (a project pins one with demo.appearance). Its stylesheet is src/demo/overlay/ui/css/ through Tailwind; an element's look is utilities where it is built, its states are the component CSS there, and colours are tokens only (src/demo/overlay/ui/css/README.md). Icons are Phosphor (__wgIcon). Change a piece, then look at it in Storybook in both appearances; check:structure rejects written colours, stock palette classes and glyphs used as icons.

Blind-agent overlay gate (anti-blank) ​

Every live modal (#wg-panel, #wg-banner, #wg-auto-panel, #wg-todo-dock) stamps data-wg-ui / data-wg-modal / data-wg-ready="1". Do not claim the stepper works unless one of these passes:

bash
# Playwright helper (exported from waygraph)
import { assertWgOverlayReady } from "waygraph";
await assertWgOverlayReady(page); // throws on blank / opacity-0 / missing stamp

# Live demo prove (exit 0 = painted, exit 2 = blank)
WAYGRAPH_PROVE_EXIT=1 WAYGRAPH_PROVE_SHOT=/tmp/wg.png \
  waygraph demo --blocks loginFlow --data '...'
# stderr: WAYGRAPH_PROVE {"ok":true,"beacons":[...],"readyAttr":"1"}

Tests: tests/cli/overlay-beacon.spec.ts. Helpers: src/demo/overlay/beacon.ts. Rules for touching the stepper/overlay chrome itself: src/ARCHITECTURE.md ("By convention").

Layout ​

package.json              the "waygraph" npm package itself
src/                      layers and import rules: src/ARCHITECTURE.md
  engine/                 the engine - start at engine.ts: checkpoint/, block/ (+ kinds/), flow/ (map()), run/ (runGraph), mem/, trait/
  runner/                 `waygraph run/demo` - start at runner.ts: plan/ -> session -> play-steps.ts with a mode (modes/: run, demo, report, branches)
  demo/                   stepper/ (the UI around each demo step), overlay/ (rings, banner, todos, device; ui/ = shadow root + CSS), narration/
  live/                   live browser sessions: auto, pilot, traverse
  manifest/               the one project scanner + `waygraph manifest` + map packages
  analysis/               graph, map check, practices check, validate / check, coverage gap
  runtime/                config, env, browser launch, extensions, webServer, video dir, playwright config, run log
  cli/                    cli.ts (the dispatcher) + commands/ (one file per subcommand)
  index.ts                public API
examples/saucedemo/         live Sauce Demo (Page + methods/ + Sel)
templates/quickstart/       try demo / init template (mirrors sauce)
templates/scaffold/         offline waygraph init scaffold template
templates/agents/           waygraph agent-dive coding-agent definitions
docs/                       this site (VitePress); npm run docs:dev / docs:build / docs:preview
openspec/                   spec-driven planning: specs/ (current), changes/ (in-flight),
                            changes/archive/ (shipped)
tests/                      runtime unit + integration tests (@playwright/test)
tsconfig.json                base config
tsconfig.build.json          emits to dist/

In-package Sauce Demo: examples/saucedemo. Other consumer experiments may still live in a sibling workspace folder and depend on this package via "waygraph": "file:../waygraph" during local dev (see that project's own .npmrc - install-links=true is required there, or npm will symlink instead of copy and pull this package's own node_modules in through the symlink, causing a duplicate-Playwright-installation error).

Adding a feature ​

One feature is one change: the code in the files its kind of feature lives in, a test, and the docs, skills, example and ROADMAP with it. AGENTS.md ("Development cycle") has the steps in order and src/ARCHITECTURE.md ("What a feature touches") lists, per kind of feature (a Block kind, a flow setting, a CLI command, a check, a Studio page, …), which files to edit, which test to write and which pages to update. Nothing is moved to make room for a feature.

Releasing ​

A version is bumped in package.json (patch bumps) at the start of its changes. When they are all on main:

bash
git push origin main
npm run release      # build, npm publish, tag the commit vX.Y.Z, create its GitHub Release

The release's notes are the commits since the previous version's tag; every version since 0.0.1 is tagged on the commit it was published from (git tag, or the repository's Releases page). It needs gh signed in and an npm login.

These docs ​

npm run docs:dev serves the site with hot reload, npm run docs:build builds it (and fails on a dead link), npm run docs:preview serves the build. A push to main touching docs/ deploys it to GitHub Pages (.github/workflows/pages.yml).

The Waygraph Studio guide's screenshots (docs/public/studio/) come from npm run docs:studio-shots (after npm run build): it copies examples/saucedemo, plays a few flows into a clean run log, then shoots each page of the UI. Run it after a change to what the UI shows; it needs the network, and leaves no server or browser running.

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed