@kitsy/cnos-docs 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,3 +54,16 @@ runtime.registerRuntimeProvider('request', (key) => {
54
54
 
55
55
  const origin = runtime.value('app.origin');
56
56
  ```
57
+
58
+ Workspace selection can come from three places:
59
+
60
+ 1. explicit `workspace` in `createCnos({ ... })`
61
+ 2. a package-local `.cnosrc.yml`
62
+ 3. the manifest default workspace
63
+
64
+ Typical monorepo package anchor:
65
+
66
+ ```yaml
67
+ root: ../../.cnos
68
+ workspace: api
69
+ ```
package/docs/cli/init.mdx CHANGED
@@ -7,5 +7,5 @@ description: Scaffold a CNOS project structure in the current repo.
7
7
 
8
8
  ```bash
9
9
  cnos init
10
- cnos init --workspace api
10
+ cnos workspace add api --package-root apps/api --extends base
11
11
  ```
@@ -0,0 +1,70 @@
1
+ ---
2
+ title: cnos workspace
3
+ description: Add, list, remove, scaffold, attach, and detach workspaces.
4
+ ---
5
+
6
+ # cnos workspace
7
+
8
+ Use `cnos workspace` when a repo has more than one app or package consuming the same CNOS root.
9
+
10
+ ## Add a workspace
11
+
12
+ ```bash
13
+ cnos workspace add travel --package-root apps/travel --extends base
14
+ ```
15
+
16
+ This updates `cnos.yml`, creates `.cnos/workspaces/travel`, and writes:
17
+
18
+ ```yaml
19
+ # apps/travel/.cnosrc.yml
20
+ root: ../../.cnos
21
+ workspace: travel
22
+ ```
23
+
24
+ ## Onboard an older single-root project into workspace mode
25
+
26
+ If a repo already has a flat `.cnos/values`, `.cnos/secrets`, `.cnos/env`, and `.cnos/profiles` tree, migrate it like this:
27
+
28
+ ```bash
29
+ cnos workspace add main --onboard-current
30
+ ```
31
+
32
+ CNOS will:
33
+
34
+ 1. move the existing flat config folders into `.cnos/workspaces/main`
35
+ 2. rewrite the root anchor to `workspace: main`
36
+ 3. keep the repo in one authoritative `.cnos` root
37
+
38
+ ## List workspaces
39
+
40
+ ```bash
41
+ cnos workspace list
42
+ cnos workspace list --json
43
+ ```
44
+
45
+ ## Remove a workspace
46
+
47
+ ```bash
48
+ cnos workspace remove gallery
49
+ ```
50
+
51
+ CNOS removes the manifest entry and deletes `.cnos/workspaces/gallery`. It refuses to remove the current default workspace until you change `workspaces.default`.
52
+
53
+ ## Scaffold wording
54
+
55
+ If your team prefers scaffold wording:
56
+
57
+ ```bash
58
+ cnos workspace scaffold insights --package-root apps/insights --extends base
59
+ ```
60
+
61
+ This follows the same creation path as `workspace add`.
62
+
63
+ ## Detach and attach
64
+
65
+ ```bash
66
+ cnos workspace detach --package-root apps/travel
67
+ cnos workspace attach --package-root apps/travel
68
+ ```
69
+
70
+ Detach makes a child package independent. Attach imports it back into the parent workspace model.
@@ -34,6 +34,14 @@ console.log(runtime.value('app.name'));
34
34
  console.log(runtime.read<string[]>('value.api.default_query_params'));
35
35
  ```
36
36
 
37
+ If your repo grows into multiple apps or packages, switch to workspace mode instead of duplicating `.cnos` trees:
38
+
39
+ ```bash
40
+ cnos workspace add main --package-root apps/main --extends base
41
+ cnos workspace add insights --package-root apps/insights --extends base
42
+ cnos workspace list
43
+ ```
44
+
37
45
  If your repo still expects env files, keep `.cnos` as the source of truth and generate them:
38
46
 
39
47
  ```bash
@@ -26,6 +26,13 @@ cnos profile create stage
26
26
  cnos use --profile stage
27
27
  ```
28
28
 
29
+ If this later becomes a monorepo, do not create a second `.cnos`. Add workspaces instead:
30
+
31
+ ```bash
32
+ cnos workspace add api --package-root apps/api --extends base
33
+ cnos workspace add admin --package-root apps/admin --extends base
34
+ ```
35
+
29
36
  Create a local vault and authenticate it:
30
37
 
31
38
  ```bash
@@ -46,6 +46,43 @@ workspaces:
46
46
 
47
47
  This lets you keep shared values in `root` and override only what each app needs in `travel`, `food`, or other child workspaces.
48
48
 
49
+ ## Day-to-day workspace management
50
+
51
+ Add a new app workspace:
52
+
53
+ ```bash
54
+ cnos workspace add insights --package-root apps/insights --extends root
55
+ cnos workspace add gallery --package-root apps/gallery --extends root
56
+ ```
57
+
58
+ List what exists:
59
+
60
+ ```bash
61
+ cnos workspace list
62
+ ```
63
+
64
+ Remove one later:
65
+
66
+ ```bash
67
+ cnos workspace remove gallery
68
+ ```
69
+
70
+ ## Migrating an older single-root repo into workspace mode
71
+
72
+ If a repo was initialized earlier with:
73
+
74
+ ```bash
75
+ cnos init
76
+ ```
77
+
78
+ and the current config still lives directly under `.cnos/values`, `.cnos/secrets`, `.cnos/env`, and `.cnos/profiles`, move that existing config into a real workspace with:
79
+
80
+ ```bash
81
+ cnos workspace add main --onboard-current
82
+ ```
83
+
84
+ CNOS will move the physical folders into `.cnos/workspaces/main` and rewrite the local anchor so the repo now behaves as a workspace-aware project.
85
+
49
86
  Read from an app package without passing a root manually:
50
87
 
51
88
  ```ts
package/manifest.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  product: cnos
2
2
  title: CNOS Documentation
3
3
  tagline: Configuration orchestration for apps, monorepos, and deployment pipelines
4
- version: "1.7"
4
+ version: "1.8"
5
5
 
6
6
  sidebar:
7
7
  - group: Getting Started
@@ -53,6 +53,8 @@ sidebar:
53
53
  label: Overview
54
54
  - path: cli/init
55
55
  label: cnos init
56
+ - path: cli/workspace
57
+ label: cnos workspace
56
58
  - path: cli/value
57
59
  label: cnos value
58
60
  - path: cli/secret
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitsy/cnos-docs",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Source-of-truth CNOS documentation content for Astro Starlight and other static docs consumers.",
5
5
  "type": "module",
6
6
  "exports": {