waw is a minimal Node.js (>= v24) module loader and runtime bootstrapper where a project is composed of independent modules discovered locally under the project’s modules directory (usually `/server/<moduleName>`, configurable via merged configuration) and optionally augmented by global modules fetched into the globally installed waw package. On startup, waw merges configuration in a deterministic order, reading global configuration from the globally installed waw package (`config.json` and `server.json`) and then project configuration from the current working directory (`config.json` and `server.json`), with later values overriding earlier ones, and resolves the project modules directory from `config.server` if provided or defaults to `server` when such a directory exists. Local modules are discovered as directories containing a `module.json` file within the resolved modules path, while global modules are resolved from `config.modules` using supported organization keys (`waw` mapping to `https://github.com/WebArtWork/waw-{NAME}.git` and `itkp` mapping to `git@github.com:IT-Kamianets/waw-{NAME}.git`), and any missing global module directory is created by performing a destructive force-sync from its repository into the global waw installation under `waw/server/<name>`. If no modules are discovered, waw automatically force-syncs and loads a global module named `core` from the `waw` organization template, and if the project root contains any of the marker files `angular.json`, `react.json`, `vue.json`, or `wjst.json`, waw ensures and loads a corresponding global module of the same name from the `waw` organization template. Each module is defined by `module.json` and may declare npm dependencies, ordering constraints, and an optional priority, and during module loading waw installs declared dependencies synchronously into the module’s own directory using `npm i --prefix` without creating a lockfile or saving metadata, validating installed versions using a lightweight semver matcher supporting exact versions, caret and tilde ranges, greater-than-or-equal ranges, and wildcard or latest semantics. Modules are ordered for execution using declarative `before` and `after` constraints, including support for the `"*"` wildcard meaning all modules except those explicitly constrained in the opposite direction, with ordering performed via a stable topological sort that preserves discovery order and falls back to sorting by descending priority if constraints form a cycle. CLI commands are provided exclusively by files named exactly `cli.js` within modules, and when a command is executed waw scans modules from last to first so later modules override earlier ones, reads the raw command from `process.argv[2]`, attempts direct and lowercased key matches followed by a case-insensitive scan of exported keys, and supports `cli.js` exports that are either objects of command functions or a function of the form `(cmdRaw, waw)` that is considered handled unless it explicitly returns `false`. If no CLI command is handled, waw starts the runtime under nodemon by executing `util.runtime.js`, watches both project and global waw files for changes, and sequentially loads each module’s `index.js`, awaiting it when it exports a function and logging errors without stopping subsequent module execution. All CLI commands and runtime entry points receive a shared execution context object named `waw` that exposes resolved project and global paths, merged configuration, detected project type, filesystem helper utilities, an interactive terminal helper, git workflow utilities, and an event bus with `emit`, `on`, `once`, and `off`, and when executing CLI commands the context is additionally augmented with the ordered module list, the current module object, the current module’s root path, and the current module’s configuration, with the core intentionally defining no application behavior so that all functionality must be provided by modules.
