Workspaces and Monorepos
Workspaces and Monorepos
For monorepos, keep one authoritative .cnos/ tree at the repo root and put a .cnosrc.yml anchor in each consuming app or package.
Repo root as both author and consumer:
root: ./.cnosChild app:
root: ../../.cnosworkspace: travel.cnosrc.yml is the only discovery anchor. CNOS does not walk upward looking for .cnos directories. It looks for .cnosrc.yml within a bounded package-root search window, then resolves the real .cnos root from there.
Typical manifest shape:
workspaces: default: root items: root: {} travel: extends: [root] food: extends: [root]This lets you keep shared values in root and override only what each app needs in travel, food, or other child workspaces.
Read from an app package without passing a root manually:
import cnos from '@kitsy/cnos';
await cnos.ready();console.log(cnos('value.app.name'));Override per command when needed:
cnos list values --workspace travelcnos build server --workspace travel --profile prod --to apps/travel/.cnos-server.jsonRuntime Projection
The authoring tree stays at repo root. Runtime consumers do not need the full .cnos/ layout.
For server packaging:
cnos build server --workspace api-gateway --profile prod --to apps/api-gateway/.cnos-server.json@kitsy/cnos then auto-loads in this order:
__CNOS_PROJECTION__.cnos-server.json- full authoring resolution through
.cnosrc.yml
Browser packages keep using public projection through Vite, Next, webpack, or @kitsy/cnos/build.
Detach and Reattach
Detach a child package into a standalone CNOS root:
cnos workspace detach --package-root apps/travelThis materializes the effective config into apps/travel/.cnos, rewrites apps/travel/.cnosrc.yml to point to that local root, and stops inheriting from the parent repo.
Reattach it later:
cnos workspace attach --package-root apps/travelThis imports the standalone child config back into the parent workspace model, archives the detached .cnos, and restores the package anchor.