- Node.js 22 or later
- npm
git clone --recursive https://github.com/uhop/console-toolkit
cd console-toolkit
npm installThe --recursive flag is needed to clone the wiki submodule under wiki/.
See ARCHITECTURE.md for a detailed module map and dependency graph.
src/— all source code (shipped to npm)tests/— automated tests (test-*.js) and manual visual tests (manual/)scripts/— example/demo scriptswiki/— GitHub wiki (git submodule)
npm test # Run all automated tests
node tests/test-<name>.js # Run a single test file directly
npm test -- test-foo.js test-bar.js # Run selected files (workers)
npm run test:seq -- test-foo.js test-bar.js # Run selected files (sequential)
npm run test:proc -- test-foo.js test-bar.js # Run selected files (subprocesses)
npm run test:bun # Run with Bun
npm run test:deno # Run with Denonpm run ts-check # tsc --noEmitnpm run lint # Check formatting (Prettier)
npm run lint:fix # Auto-formatnode tests/manual/test-<name>.js- ESM-only: use
import/exportwith.jsextensions in all import paths. - No build step: source JS is shipped directly.
- No runtime dependencies: do not add any.
- Formatting: Prettier — 120 char width, single quotes, no bracket spacing, no trailing commas.
- Indentation: 2 spaces.
- Every public
.jsmodule has a hand-written.d.tsfile alongside it. .d.tsfiles are NOT generated — edit them manually.- No JSDoc in
.jsfiles — the.d.tssidecar is the sole source of types and docs. - Each
.jscarries// @ts-self-types="./<file>.d.ts"at the top so IDE hover defers to the.d.ts. - When changing a public API, always update both the
.jsand its.d.ts.
- Box is immutable — methods return new
Boxinstances. - Panel is mutable — methods mutate
thisand returnthisfor chaining. - Method aliases are created via
addAlias/addAliasesfrommeta.js. pad(t, r, b, l)follows CSS shorthand order on both Box and Panel.
- Add implementation to
src/<module>.js(types go in the.d.ts, not JSDoc). - Add type signature to
src/<module>.d.tswith matching JSDoc. - Add tests to
tests/test-<module>.js. - Run
npm testandnpm run ts-check.
- Create
src/themes/<category>/<name>.jsexporting the theme object. - Create matching
.d.tswith JSDoc. - Optionally add a visual test in
tests/manual/.
- Create
src/<name>.jsandsrc/<name>.d.ts. - If it's a sub-package, create
src/<name>/index.jsandsrc/<name>/index.d.ts. - Add an export entry in
package.json"exports"if it should be a named entry point. - Add tests and update documentation.
By contributing, you agree that your contributions will be licensed under the project's BSD-3-Clause license. No external contributions are accepted under licenses fundamentally incompatible with the BSD-3-Clause license this library is distributed under.