Contributing#
This document is for people changing this repository. Package behavior and user-facing CLI/library contracts stay in the README.
Local Setup#
npm install
npm run build
npm test
npm run build syncs Console Kit assets, compiles the TypeScript runtime, compiles the local console UI, and writes package output under dist/.
npm test runs the full local lane: build, Node contract checks, local console smoke, and Playwright browser tests. CI and npm publication pin browser-installing jobs to Ubuntu 24.04: the pinned Playwright 1.65.0 does not support Ubuntu 26.04. Keep the runner and browser dependency support aligned when upgrading either.
Optional Git Hooks#
Flow includes optional repo-local Git hooks for contributors:
npm run setup:repo-hooks
npm run validate:repo-hooks
Setup is idempotent and writes only this repository's local Git config: core.hooksPath=.githooks. The tracked pre-push hook runs the bounded local lane, npm test and npm run check:schemas.
These hooks are contributor tooling. They are not Flow Definition semantics, not Flow Run state, not gate evaluation, not Flow Console behavior, and not CI or merge authority.
Source Layout#
Flow core runtime sources live under domain folders in src/: contracts, runtime storage, shared helpers, config, definitions, gates, transitions, reports, release checks, console implementation, and console UI. The root src/index.ts is the package public API surface, and src/cli.ts is the flow CLI entrypoint.
npm run typecheck validates runtime sources without writing output, and npm run build emits the package runtime to dist/ with .d.ts declarations. Package consumers use the package root, root declarations, and the dist/cli.js bin; prepack runs the typecheck and local tests so the published package is built from the TypeScript sources.
Node test suites live under domain files in tests/node/, shared Node test helpers live under tests/node/helpers/, and browser tests live under tests/browser/. The remaining JavaScript/MJS files in scripts/ are operational repository tools, .githooks/pre-push is shell contributor tooling, and schemas, examples, and scenarios remain JSON/data assets rather than TypeScript modules.
For placement rules and generated artifact policy, see repo-structure.md.
Root .kontourai/ is the common ignored boundary for generated Kontour product state; each product owns its namespace beneath it, including .kontourai/flow/, .kontourai/surface/, and .kontourai/veritas/. Authored .flow/config.json and .flow/definitions/ are durable and Git-visible. Older .flow/runs/ state is also visible so operators can migrate it explicitly; current runtime commands do not read it. The console projection source fixture lives under examples/scenarios/console-projection/runtime-fixture/ and is materialized into the ignored canonical root for runtime checks.
Docs Site#
The GitHub Pages site at https://kontourai.github.io/flow/ and its docs-bundle.json (served to agents by the Kontour docs MCP) are built by the shared docs-kit from corpus.json. That manifest lists the published documents in navigation order, the curated agent topics, and the unpublished exclude globs.
npm run docs:check # the docs gate: links, anchors, reachability, topics, covers
npm run docs:build # renders the site into dist-pages/ (ignored)
The Docs GitHub workflow runs the gate on every pull request and deploys the site on pushes to main. When adding, renaming, or retiring a guide, update both docs/README.md and corpus.json. When you change code that a document covers in corpus.json, update that document in the same pull request.
Demo Recording#
docs/assets/flow-demo.gif is recorded from the committed tape with VHS. Regenerate it after CLI output changes:
sh scripts/docs-site/record-demo.sh
Releases#
Releases are automated with release-please: merges to main accumulate into a release PR, and merging that PR tags the version and dispatches the npm publish workflow. For the automation to infer versions, use conventional commit prefixes on main-bound changes: feat: (minor), fix: (patch), feat!:/BREAKING CHANGE (major), and docs:/chore:/refactor: for no-release changes.
Release Prep#
Before a release PR, update package.json, package-lock.json, and CHANGELOG.md, then run:
npm run typecheck
npm run build
npm test
npm pack --dry-run --cache /private/tmp/flow-npm-cache
Publishing is handled by the repository's tag-triggered GitHub workflow after the release PR is merged.
Dependency updates use weekly Dependabot jobs for npm and GitHub Actions. The local Corpus commands and shared docs gate use the same pinned Corpus revision; update them together. The toolchain currently uses pnpm 12.18.0 and TypeScript 7.0.2, with Node 22 and 24 checked by CI.
Dependabot's third-party npm updates use a one-day cooldown, matching the
24-hour pnpm release-age floor. @kontourai/* is exempt from both pnpm's floor
and Dependabot's cooldown, so first-party packages remain available immediately.
Automatic semver-major updates for @kontourai/surface and
hachure are ignored so changes to trust semantics receive deliberate migration
review. Other dependency updates keep the weekly schedule.