@wpmoo/toolkit 0.9.27 → 0.9.29

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.
package/README.md CHANGED
@@ -64,6 +64,9 @@ Short alias:
64
64
  npx wpmoo
65
65
  ```
66
66
 
67
+ Optional short alias: `npx wpmoo`. Use `npx @wpmoo/toolkit` for documentation,
68
+ scripts, and automation.
69
+
67
70
  Deprecated compatibility aliases:
68
71
 
69
72
  ```bash
@@ -71,7 +74,10 @@ npx @wpmoo/odoo
71
74
  npx @wpmoo/odoo-dev
72
75
  ```
73
76
 
74
- Deprecated package paths `npx @wpmoo/odoo` and `npx @wpmoo/odoo-dev` remain available as compatibility aliases that redirect to `@wpmoo/toolkit`.
77
+ Deprecated package paths `npx @wpmoo/odoo` and `npx @wpmoo/odoo-dev` remain
78
+ available through the 1.x line as compatibility aliases that redirect to
79
+ `@wpmoo/toolkit`. Removing either compatibility alias requires a future major
80
+ release and prior notice.
75
81
 
76
82
  When the current directory is not already a WPMoo environment, the CLI opens the create flow. It asks for a product slug, Odoo version, and environment folder. The default environment folder is `./<product>_dev`.
77
83
 
@@ -196,6 +202,13 @@ JSON variant exposes a versioned PostgreSQL diagnostics contract.
196
202
  `postgres` payload; individual fields are optional so automation can safely handle
197
203
  environments where PostgreSQL does not expose a metric.
198
204
 
205
+ JSON compatibility policy:
206
+
207
+ - Automation should ignore unknown JSON fields.
208
+ - Minor and patch releases may add optional fields without a breaking release.
209
+ - Removing, renaming, or changing the meaning of a documented field requires a
210
+ major release or a `schemaVersion` bump.
211
+
199
212
  ## Release Artifacts
200
213
 
201
214
  WPMoo Toolkit releases are valid when the required npm artifacts publish
@@ -219,11 +232,17 @@ warning while keeping the scoped package release valid.
219
232
  packages are valid.
220
233
  - **Smoke expectation**: run `npm run smoke:published -- "$VERSION"` after the
221
234
  release tag workflow completes.
235
+ - **1.0 release smoke**: For `1.0.0`, generated-environment acceptance smoke is
236
+ required before the release is considered final.
222
237
 
223
238
  ## Documentation
224
239
 
240
+ - [Command Reference](docs/command-reference.md)
225
241
  - [External Resources](docs/external-resources.md)
226
242
  - [Generated Environment Verification](docs/generated-environment-verification.md)
243
+ - [Lifecycle Recipes](docs/lifecycle-recipes.md)
244
+ - [Troubleshooting](docs/troubleshooting.md)
245
+ - [1.0 Readiness](docs/1-0-readiness.md)
227
246
  - Public documentation site: <https://wpmoo.org>
228
247
 
229
248
  ## License
package/dist/help.js CHANGED
@@ -76,8 +76,9 @@ Options:
76
76
 
77
77
  Package aliases:
78
78
  npx @wpmoo/toolkit is the official package path.
79
- npx wpmoo is the short alias.
80
- npx @wpmoo/odoo and npx @wpmoo/odoo-dev remain deprecated compatibility aliases.
79
+ npx wpmoo is an optional best-effort short alias; use @wpmoo/toolkit for automation.
80
+ npx @wpmoo/odoo and npx @wpmoo/odoo-dev remain deprecated compatibility aliases through 1.x.
81
+ Removing a compatibility alias requires a future major release and prior notice.
81
82
 
82
83
  Daily actions:
83
84
  Daily actions must be run from a generated environment root containing .wpmoo/odoo.json.
@@ -160,6 +161,11 @@ Machine-readable JSON output:
160
161
  doctor --json --postgres includes a structured postgres object for automation.
161
162
  Incomplete or malformed PostgreSQL metric rows are reported as unavailable diagnostics.
162
163
 
164
+ JSON compatibility policy:
165
+ Automation should ignore unknown fields.
166
+ Minor and patch releases may add optional fields.
167
+ Removing, renaming, or changing the meaning of a documented field requires a major release or schemaVersion bump.
168
+
163
169
  Example:
164
170
  npx @wpmoo/toolkit create \\
165
171
  --product odoo_sample_module \\
@@ -0,0 +1,123 @@
1
+ # 1.0 Readiness
2
+
3
+ This checklist tracks what must stay stable before WPMoo Toolkit can be
4
+ released as `1.0.0`.
5
+
6
+ ## Stable Command Names
7
+
8
+ Ready:
9
+
10
+ - `npx @wpmoo/toolkit` is the official package entrypoint.
11
+ - Generated environments use local `./moo` for daily commands.
12
+ - Direct commands cover create, status, doctor, source, repository, module,
13
+ service, database, snapshot, restore, lint, and POT workflows.
14
+ - Compatibility aliases remain available through the 1.x line:
15
+ `npx @wpmoo/odoo` and `npx @wpmoo/odoo-dev`.
16
+ - The optional unscoped `npx wpmoo` short alias remains best-effort and
17
+ warning-only. User-facing examples may mention it as optional, but
18
+ documentation, scripts, and automation should use `npx @wpmoo/toolkit`.
19
+
20
+ ## Stable JSON Contracts
21
+
22
+ Ready:
23
+
24
+ - `status --json` uses `schemaVersion: 1`.
25
+ - `source list --json` and `source sync --json` use `schemaVersion: 1`.
26
+ - `doctor --json` uses `schemaVersion: 1`.
27
+ - `doctor --json --postgres` exposes a versioned `postgres` payload with
28
+ `contractVersion` and diagnostics `schemaVersion`.
29
+ - PostgreSQL diagnostics treat unavailable optional metrics as optional fields.
30
+ - Post-1.0 JSON contracts allow additive optional fields in minor and patch
31
+ releases.
32
+ - Automation should ignore unknown JSON fields.
33
+ - Breaking JSON changes require a major release or a schemaVersion bump.
34
+
35
+ ## Deprecated Alias Policy
36
+
37
+ Ready:
38
+
39
+ - `@wpmoo/toolkit` is the supported package.
40
+ - `@wpmoo/odoo` and `@wpmoo/odoo-dev` are required compatibility artifacts in
41
+ releases.
42
+ - The optional `wpmoo` short alias is warning-only and does not determine
43
+ release validity.
44
+ - Compatibility aliases remain available through the 1.x line.
45
+ - Removing a compatibility alias requires a future major release and prior
46
+ notice.
47
+
48
+ ## Generated File Compatibility
49
+
50
+ Ready:
51
+
52
+ - Generated environments keep product source repositories under
53
+ `odoo/custom/src/private`, `odoo/custom/src/oca`, and
54
+ `odoo/custom/src/external`.
55
+ - `safe reset` refreshes generated files while preserving source repositories.
56
+ - PostgreSQL 18 mount compatibility is documented and doctor can apply safe
57
+ mount-target fixes.
58
+ - Generated `./moo` delegates daily commands and keeps local guard behavior.
59
+ - Generated environments created by pre-1.0 releases are supported through safe
60
+ reset and doctor-guided generated-file migration checks.
61
+ - Generated-file migration support must preserve product source repositories,
62
+ `.env` files, database dumps, and Docker volumes.
63
+
64
+ ## Stage And Production Policy
65
+
66
+ Ready:
67
+
68
+ - Stage `install` and `update` require `WPMOO_ALLOW_STAGE_LIFECYCLE=1`.
69
+ - Production `install`, `update`, and `test` require
70
+ `WPMOO_ALLOW_PROD_LIFECYCLE=1`.
71
+ - Destructive database commands require `WPMOO_ALLOW_DESTRUCTIVE=1` in stage
72
+ and production.
73
+ - `restore-snapshot --dry-run`, `doctor`, and `doctor --postgres` remain safe
74
+ preview/read-only paths.
75
+ - Migration-risk lifecycle commands can require `WPMOO_ALLOW_MIGRATIONS=1`.
76
+ - Environment-variable approvals remain supported through 1.x.
77
+ - Timestamped approval files may be added as an additive safety layer, not as a
78
+ replacement for env flags in 1.x.
79
+
80
+ ## Release Artifact Policy
81
+
82
+ Ready:
83
+
84
+ - Required release artifacts are `@wpmoo/toolkit`, `@wpmoo/odoo`, and
85
+ `@wpmoo/odoo-dev`.
86
+ - Publishing is handled by GitHub Actions Trusted Publishing after a `v<version>`
87
+ tag is pushed.
88
+ - `npm run release:check` verifies package state and bumps patch versions when
89
+ the current version already exists.
90
+ - `npm run smoke:published -- "$VERSION"` is the preferred published package
91
+ smoke check.
92
+ - Generated-environment acceptance smoke is mandatory for a 1.0.0 release
93
+ candidate.
94
+
95
+ ## Current Audit
96
+
97
+ Last updated: 2026-05-21.
98
+
99
+ Completed checks:
100
+
101
+ - Full local gate for Train 8 passed on 2026-05-21:
102
+ `npm run typecheck`, `npm test`, `npm run build`, and `git diff --check`.
103
+ - Coverage passed on 2026-05-21: 72 test files, 682 tests, 92.32%
104
+ statements, 87.56% branches, 96.74% functions, and 92.32% lines.
105
+ - Published CLI smoke passed against `@wpmoo/toolkit@0.9.27` with `npm exec`
106
+ for `wpmoo --version`, `wpmoo --help`, and `wpmoo doctor --help`.
107
+ - Placeholder review found no `TODO`, `FIXME`, `TBD`, or `coming soon`
108
+ markers in `README.md`, `docs`, or `src`.
109
+ - Local markdown link review passed across `README.md` and `docs/*.md`.
110
+
111
+ Final policy decisions:
112
+
113
+ - JSON compatibility permits additive optional fields in minor and patch
114
+ releases; breaking changes require a major release or schemaVersion bump.
115
+ - Compatibility aliases remain available through the 1.x line; removal requires
116
+ a future major release and prior notice.
117
+ - Pre-1.0 generated environments are supported through safe reset and
118
+ doctor-guided generated-file migration checks that preserve source code and
119
+ local runtime data.
120
+ - Environment-variable approvals remain supported through 1.x; timestamped
121
+ approval files may be added only as an additive safety layer.
122
+ - Generated-environment acceptance smoke is mandatory for a `1.0.0` release
123
+ candidate.
@@ -0,0 +1,117 @@
1
+ # Command Reference
2
+
3
+ Use `npx @wpmoo/toolkit ...` for package/operator commands. Use `./moo ...`
4
+ inside a generated environment for daily local commands. The deprecated
5
+ compatibility aliases `npx @wpmoo/odoo` and `npx @wpmoo/odoo-dev` redirect to
6
+ the toolkit package; new automation should use `@wpmoo/toolkit`. Deprecated
7
+ compatibility aliases remain available through the 1.x line. Removing a
8
+ compatibility alias requires a future major release and prior notice. The
9
+ unscoped `npx wpmoo` short alias is optional and best-effort; scripts should use
10
+ `npx @wpmoo/toolkit`.
11
+
12
+ ## Package Commands
13
+
14
+ | Command | Cockpit Equivalent | JSON | Notes |
15
+ | --- | --- | --- | --- |
16
+ | `npx @wpmoo/toolkit` | Open cockpit or create wizard | No | Opens the create wizard outside an environment and the cockpit inside one. |
17
+ | `npx @wpmoo/toolkit create ...` | Create wizard | No | Creates a generated environment. Use `--target <path>` for a custom folder. |
18
+ | `npx @wpmoo/toolkit status` | Diagnostics -> Environment status | Yes, `--json` | Fast local metadata and file check. |
19
+ | `npx @wpmoo/toolkit doctor [--fix] [--postgres]` | Diagnostics -> Run doctor | Yes, `--json` | Deeper health checks. `--postgres` is read-only and advisory. |
20
+ | `npx @wpmoo/toolkit source list` | Repositories | Yes, `--json` | Lists known source repositories. |
21
+ | `npx @wpmoo/toolkit source sync` | Repositories | Yes, `--json` | Refreshes source manifest data. |
22
+ | `npx @wpmoo/toolkit add-repo --repo-url <url>` | Repositories -> Add source repo | No | Adds a source repository category entry. |
23
+ | `npx @wpmoo/toolkit remove-repo --repo <name>` | Repositories -> Remove source repo | No | Removes a source repository from the environment. |
24
+ | `npx @wpmoo/toolkit add-module --repo <repo> --module <name>` | Modules -> Add module | No | Creates an Odoo module skeleton in a source repository. |
25
+ | `npx @wpmoo/toolkit remove-module --repo <repo> --module <name>` | Modules -> Remove module | No | Removes module metadata; pass `--delete-files` to delete module files after dirty checks. |
26
+ | `npx @wpmoo/toolkit reset [--dry-run]` | Maintenance -> Safe reset environment | No | Refreshes generated files while preserving source repositories. |
27
+
28
+ ## Generated Environment Commands
29
+
30
+ Run these from the generated environment root:
31
+
32
+ | Command | Cockpit Equivalent | Guarded In Stage/Prod | Notes |
33
+ | --- | --- | --- | --- |
34
+ | `./moo start` | Services -> Start services | No | Starts local Odoo services. Disabled in cockpit when already running. |
35
+ | `./moo stop` | Services -> Stop services | No | Stops local services. Disabled in cockpit when services are stopped. |
36
+ | `./moo restart` | Services -> Restart services | No | Restarts services. |
37
+ | `./moo logs [service] [tail-lines]` | Services -> View logs | No | Streams or tails service logs. |
38
+ | `./moo shell` | Services -> Open shell | No | Opens a shell in the Odoo service container. |
39
+ | `./moo psql [db]` | Database -> Open psql | No | Opens a PostgreSQL prompt. |
40
+ | `./moo install <module[,module]> [db]` | Modules -> Install module | Yes | Installs one or more modules. |
41
+ | `./moo update <module[,module]> [db]` | Modules -> Update module | Yes | Updates one or more modules. |
42
+ | `./moo test <module[,module]> --db <db>` | Modules -> Run tests | Yes in prod | Runs Odoo tests for modules. |
43
+ | `./moo lint` | Modules -> Run environment lint | No | Runs configured environment lint checks. |
44
+ | `./moo pot <module[,module]> [db] [output]` | Modules -> Generate POT | No | Generates translation template files. |
45
+ | `./moo snapshot [db] [name]` | Database -> Create snapshot | No | Creates a database and filestore snapshot. |
46
+ | `./moo restore-snapshot --dry-run <name> [db]` | Database -> Restore snapshot | Preview only | Prints a restore preview without changing data. |
47
+ | `./moo restore-snapshot <name> [db]` | Database -> Restore snapshot | Yes | Restores database and filestore from a snapshot. |
48
+ | `./moo resetdb [db] [module[,module]]` | Database -> Reset database | Yes | Destructive database reset. |
49
+ | `./moo doctor [--fix] [--postgres]` | Diagnostics -> Run doctor | No | Local health checks. |
50
+ | `./moo status` | Diagnostics -> Environment status | No | Local environment status. |
51
+
52
+ ## JSON Output
53
+
54
+ Machine-readable output is available for automation:
55
+
56
+ ```bash
57
+ npx @wpmoo/toolkit status --json
58
+ npx @wpmoo/toolkit source list --json
59
+ npx @wpmoo/toolkit source sync --json
60
+ npx @wpmoo/toolkit doctor --json
61
+ npx @wpmoo/toolkit doctor --json --postgres
62
+ ```
63
+
64
+ Current JSON contract notes:
65
+
66
+ - `status --json` uses `schemaVersion: 1`.
67
+ - `source list --json` and `source sync --json` use `schemaVersion: 1`.
68
+ - `doctor --json` uses `schemaVersion: 1`.
69
+ - `doctor --json --postgres` adds `postgres.contractVersion` and a PostgreSQL
70
+ diagnostics object with its own `schemaVersion`.
71
+ - PostgreSQL fields are optional when a metric is unavailable.
72
+ - Automation should ignore unknown JSON fields.
73
+ - Minor and patch releases may add optional fields without a breaking release.
74
+ - Removing, renaming, or changing the meaning of a documented field requires a
75
+ major release or a `schemaVersion` bump.
76
+
77
+ ## Environment Variables
78
+
79
+ | Variable | Purpose |
80
+ | --- | --- |
81
+ | `WPMOO_ENV=dev|stage|prod` | Selects environment safety policy. Missing value behaves like development for local workflows. |
82
+ | `WPMOO_ALLOW_STAGE_LIFECYCLE=1` | Allows `install` and `update` in stage. |
83
+ | `WPMOO_ALLOW_PROD_LIFECYCLE=1` | Allows `install`, `update`, and `test` in production. |
84
+ | `WPMOO_ALLOW_DESTRUCTIVE=1` | Allows destructive database commands in stage/prod. |
85
+ | `WPMOO_ALLOW_NO_RECENT_SNAPSHOT=1` | Allows destructive commands without a recent snapshot when that extra guard applies. |
86
+ | `WPMOO_ALLOW_MIGRATIONS=1` | Allows lifecycle commands when migration scripts are detected. |
87
+ | `WPMOO_NODE_BIN`, `WPMOO_NPX_BIN`, `WPMOO_GIT_BIN` | Override binaries used by release smoke scripts. |
88
+
89
+ Process environment values take precedence over `.env` values for safety flags.
90
+
91
+ ## Exit Behavior
92
+
93
+ - Successful commands exit `0`.
94
+ - Invalid arguments, missing environment metadata, refused guard checks, dirty
95
+ deletion, and failed subprocesses exit non-zero.
96
+ - `--json` commands still use process exit codes; automation should check both
97
+ the exit status and the `ok` field when present.
98
+ - Guard failures are intentional failures. Do not silence them unless the named
99
+ `WPMOO_ALLOW_*` flag has been reviewed.
100
+
101
+ ## Stage And Production Restrictions
102
+
103
+ | Command Family | Stage | Production |
104
+ | --- | --- | --- |
105
+ | `install`, `update` | Requires `WPMOO_ALLOW_STAGE_LIFECYCLE=1` | Requires `WPMOO_ALLOW_PROD_LIFECYCLE=1` |
106
+ | `test` | Allowed | Requires `WPMOO_ALLOW_PROD_LIFECYCLE=1` |
107
+ | `resetdb`, real `restore-snapshot` | Requires `WPMOO_ALLOW_DESTRUCTIVE=1` | Requires `WPMOO_ALLOW_DESTRUCTIVE=1` |
108
+ | `restore-snapshot --dry-run` | Allowed | Allowed |
109
+ | Commands with detected migration scripts | May require `WPMOO_ALLOW_MIGRATIONS=1` | May require `WPMOO_ALLOW_MIGRATIONS=1` |
110
+
111
+ Prefer read-only and dry-run commands first:
112
+
113
+ ```bash
114
+ ./moo doctor
115
+ ./moo doctor --postgres
116
+ ./moo restore-snapshot --dry-run before-change devel
117
+ ```
package/docs/handoff.md CHANGED
@@ -60,7 +60,26 @@ Suggested smoke check:
60
60
  npm run smoke:published -- "$VERSION"
61
61
  ```
62
62
 
63
+ For a 1.0.0 tag, run generated-environment acceptance smoke with
64
+ WPMOO_SMOKE_ENVIRONMENT=1. Treat the release as final only after that smoke
65
+ passes:
66
+
67
+ ```bash
68
+ WPMOO_SMOKE_ENVIRONMENT=1 npm run smoke:published -- "$VERSION"
69
+ ```
70
+
63
71
  Current command standard:
64
72
 
65
73
  - Use `npx @wpmoo/toolkit ...` for package/operator commands.
66
74
  - Use generated environment `./moo ...` for local compose daily commands.
75
+
76
+ 1.0 readiness references:
77
+
78
+ - [Command Reference](command-reference.md)
79
+ - [Lifecycle Recipes](lifecycle-recipes.md)
80
+ - [Troubleshooting](troubleshooting.md)
81
+ - [1.0 Readiness](1-0-readiness.md)
82
+
83
+ Before a `1.0.0` tag, review the readiness gap list and decide whether the next
84
+ milestone is "ship 1.0" or "finish named gaps." Do not treat the gap list as an
85
+ open-ended cleanup queue.
@@ -0,0 +1,190 @@
1
+ # Lifecycle Recipes
2
+
3
+ These recipes show WPMoo Toolkit as a sequence of Dev, Stage, and Production
4
+ workflows. Replace repository names, module names, and database names with your
5
+ project values.
6
+
7
+ ## Local Development Setup
8
+
9
+ Create a generated environment from a workspace directory:
10
+
11
+ ```bash
12
+ npx @wpmoo/toolkit create \
13
+ --product odoo_sample_module \
14
+ --odoo-version 19.0 \
15
+ --target ./odoo_sample_module_dev \
16
+ --dev-repo-url https://github.com/example-org/odoo_sample_module_dev.git \
17
+ --source-repo-url https://github.com/example-org/odoo_sample_module.git
18
+ ```
19
+
20
+ Enter the environment and start daily work:
21
+
22
+ ```bash
23
+ cd odoo_sample_module_dev
24
+ ./moo start
25
+ ./moo status
26
+ ./moo doctor
27
+ ```
28
+
29
+ Use the cockpit for interactive workflows:
30
+
31
+ ```bash
32
+ ./moo
33
+ ```
34
+
35
+ ## Add A Source Repository
36
+
37
+ Add a private source repository:
38
+
39
+ ```bash
40
+ npx @wpmoo/toolkit add-repo \
41
+ --repo-url https://github.com/example-org/odoo-addons.git \
42
+ --source-type private
43
+ ```
44
+
45
+ Refresh the source manifest:
46
+
47
+ ```bash
48
+ npx @wpmoo/toolkit source sync
49
+ npx @wpmoo/toolkit source list
50
+ ```
51
+
52
+ Use `--source-type oca` for OCA repositories and `--source-type external` for
53
+ third-party repositories.
54
+
55
+ ## Add A Module
56
+
57
+ Create a module skeleton:
58
+
59
+ ```bash
60
+ npx @wpmoo/toolkit add-module \
61
+ --repo odoo-addons \
62
+ --module moo_test \
63
+ --source-type private
64
+ ```
65
+
66
+ Verify the generated module:
67
+
68
+ ```bash
69
+ ./moo status
70
+ ./moo lint
71
+ ```
72
+
73
+ Expected module files include `__manifest__.py`, model imports, security access
74
+ CSV, views, menus, and a post-install TransactionCase smoke test.
75
+
76
+ ## Install And Update A Module
77
+
78
+ Start services and install the module into the development database:
79
+
80
+ ```bash
81
+ ./moo start
82
+ ./moo install moo_test devel
83
+ ```
84
+
85
+ After code changes, update the module:
86
+
87
+ ```bash
88
+ ./moo update moo_test devel
89
+ ```
90
+
91
+ If the cockpit shows module actions as disabled, run:
92
+
93
+ ```bash
94
+ ./moo status
95
+ npx @wpmoo/toolkit source list
96
+ ```
97
+
98
+ Then add or sync source repositories until installable modules are detected.
99
+
100
+ ## Run Tests
101
+
102
+ Run module tests in development:
103
+
104
+ ```bash
105
+ ./moo test moo_test --db devel
106
+ ```
107
+
108
+ Use explicit test mode when needed:
109
+
110
+ ```bash
111
+ ./moo test moo_test --db devel --mode update --tags /moo_test
112
+ ```
113
+
114
+ For production, test execution is guarded:
115
+
116
+ ```bash
117
+ WPMOO_ENV=prod WPMOO_ALLOW_PROD_LIFECYCLE=1 ./moo test moo_test --db devel
118
+ ```
119
+
120
+ ## Snapshot And Restore
121
+
122
+ Take a snapshot before risky changes:
123
+
124
+ ```bash
125
+ ./moo snapshot devel before-moo-test-update
126
+ ```
127
+
128
+ Preview a restore:
129
+
130
+ ```bash
131
+ ./moo restore-snapshot --dry-run before-moo-test-update devel
132
+ ```
133
+
134
+ Restore intentionally:
135
+
136
+ ```bash
137
+ WPMOO_ENV=stage WPMOO_ALLOW_DESTRUCTIVE=1 ./moo restore-snapshot before-moo-test-update devel
138
+ ```
139
+
140
+ When the no-recent-snapshot guard applies to a destructive command, either make
141
+ a fresh snapshot or set `WPMOO_ALLOW_NO_RECENT_SNAPSHOT=1` after review.
142
+
143
+ ## Stage Dry-Run Validation
144
+
145
+ Use stage for preview-first validation:
146
+
147
+ ```bash
148
+ WPMOO_ENV=stage ./moo doctor
149
+ WPMOO_ENV=stage ./moo doctor --postgres
150
+ WPMOO_ENV=stage ./moo restore-snapshot --dry-run before-moo-test-update devel
151
+ ```
152
+
153
+ Run lifecycle commands only after review:
154
+
155
+ ```bash
156
+ WPMOO_ENV=stage WPMOO_ALLOW_STAGE_LIFECYCLE=1 ./moo update moo_test devel
157
+ ```
158
+
159
+ If migration scripts are detected, WPMoo may also require:
160
+
161
+ ```bash
162
+ WPMOO_ENV=stage WPMOO_ALLOW_STAGE_LIFECYCLE=1 WPMOO_ALLOW_MIGRATIONS=1 ./moo update moo_test devel
163
+ ```
164
+
165
+ ## Production-Safe Preview
166
+
167
+ Production workflows should start with read-only checks:
168
+
169
+ ```bash
170
+ WPMOO_ENV=prod ./moo status
171
+ WPMOO_ENV=prod ./moo doctor
172
+ WPMOO_ENV=prod ./moo doctor --postgres
173
+ WPMOO_ENV=prod ./moo restore-snapshot --dry-run before-change devel
174
+ ```
175
+
176
+ Production lifecycle commands require explicit approval flags:
177
+
178
+ ```bash
179
+ WPMOO_ENV=prod WPMOO_ALLOW_PROD_LIFECYCLE=1 ./moo update moo_test devel
180
+ ```
181
+
182
+ Destructive production commands require a separate flag and a rollback plan:
183
+
184
+ ```bash
185
+ WPMOO_ENV=prod WPMOO_ALLOW_DESTRUCTIVE=1 ./moo restore-snapshot before-change devel
186
+ ```
187
+
188
+ Do not set production flags globally in a shell profile. Prefer one-command
189
+ environment variable prefixes so intent is visible in shell history.
190
+
@@ -0,0 +1,225 @@
1
+ # Troubleshooting
2
+
3
+ This cookbook lists common WPMoo Toolkit failure states and the safest next
4
+ step for each one. Run commands from the generated environment root unless the
5
+ example explicitly starts with `npx @wpmoo/toolkit`.
6
+
7
+ ## Docker Is Missing Or Stopped
8
+
9
+ Symptoms:
10
+
11
+ - The create wizard stops before writing files.
12
+ - `./moo start`, `./moo status`, or `./moo doctor` reports Docker or Docker
13
+ Compose as unavailable.
14
+
15
+ Check:
16
+
17
+ ```bash
18
+ docker version
19
+ docker compose version
20
+ ```
21
+
22
+ Next steps:
23
+
24
+ 1. Install Docker Desktop or another Docker Engine distribution.
25
+ 2. Start Docker Desktop and wait until the engine is ready.
26
+ 3. Open a new terminal if Docker was added to `PATH`.
27
+ 4. Run the WPMoo command again.
28
+
29
+ The create wizard intentionally stops before setup questions when required
30
+ runtime tools are missing. That protects the workspace from half-created
31
+ environments.
32
+
33
+ ## No Modules Found
34
+
35
+ Symptoms:
36
+
37
+ - The cockpit disables module actions.
38
+ - `List modules`, `Install module`, `Update module`, `Run tests`, `Run
39
+ environment lint`, `Generate POT`, or `Remove module` says no modules are
40
+ available.
41
+
42
+ Check the source inventory:
43
+
44
+ ```bash
45
+ ./moo status
46
+ npx @wpmoo/toolkit source list
47
+ ```
48
+
49
+ Next steps:
50
+
51
+ 1. Add or sync a source repository.
52
+
53
+ ```bash
54
+ npx @wpmoo/toolkit add-repo --repo-url https://github.com/example-org/odoo-addons.git --source-type private
55
+ npx @wpmoo/toolkit source sync
56
+ ```
57
+
58
+ 2. Add a new module skeleton if the repository exists but has no installable
59
+ module yet.
60
+
61
+ ```bash
62
+ npx @wpmoo/toolkit add-module --repo odoo-addons --module moo_test --source-type private
63
+ ```
64
+
65
+ 3. Reopen the cockpit or run `./moo status` again.
66
+
67
+ Expected result:
68
+
69
+ - Module actions become selectable once at least one installable module is
70
+ detected.
71
+ - If a module has no actionable Odoo menu, `status` reports it so you can fix
72
+ the generated menu/action metadata.
73
+
74
+ ## No Source Repositories
75
+
76
+ Symptoms:
77
+
78
+ - `source list` is empty.
79
+ - Module actions cannot find a target repository.
80
+ - The generated environment exists but `odoo/custom/src/private`,
81
+ `odoo/custom/src/oca`, and `odoo/custom/src/external` contain no usable
82
+ source checkout.
83
+
84
+ Check:
85
+
86
+ ```bash
87
+ npx @wpmoo/toolkit source list --json
88
+ ```
89
+
90
+ Next steps:
91
+
92
+ ```bash
93
+ npx @wpmoo/toolkit add-repo --repo-url https://github.com/example-org/odoo-addons.git --source-type private
94
+ npx @wpmoo/toolkit source sync
95
+ ```
96
+
97
+ Use `--source-type oca` or `--source-type external` when the repository belongs
98
+ outside the private source category.
99
+
100
+ ## Dirty Module Deletion Is Refused
101
+
102
+ Symptoms:
103
+
104
+ - `remove-module` refuses to delete module files.
105
+ - The command reports local changes or an unsafe module worktree.
106
+
107
+ Check the source repository directly:
108
+
109
+ ```bash
110
+ git -C odoo/custom/src/private/<repo> status --short
111
+ ```
112
+
113
+ Next steps:
114
+
115
+ 1. Commit, stash, or intentionally discard the local module changes from inside
116
+ the source repository.
117
+ 2. Re-run the removal.
118
+
119
+ ```bash
120
+ npx @wpmoo/toolkit remove-module --repo <repo> --module <module> --source-type private --delete-files
121
+ ```
122
+
123
+ WPMoo refuses dirty deletion because module repositories are product source
124
+ code, not disposable generated files.
125
+
126
+ ## Optional `wpmoo` Alias Reports E404
127
+
128
+ Symptoms:
129
+
130
+ - Release checks or manual npm checks report `wpmoo@<version>` as missing.
131
+ - Scoped packages are available.
132
+
133
+ Required packages:
134
+
135
+ ```bash
136
+ npm view @wpmoo/toolkit@<version> version
137
+ npm view @wpmoo/odoo@<version> version
138
+ npm view @wpmoo/odoo-dev@<version> version
139
+ ```
140
+
141
+ Interpretation:
142
+
143
+ - `@wpmoo/toolkit`, `@wpmoo/odoo`, and `@wpmoo/odoo-dev` are the supported
144
+ release artifacts.
145
+ - The unscoped `wpmoo` short alias is best-effort. An E404 for `wpmoo` does not
146
+ invalidate a release when the three scoped packages verify.
147
+
148
+ Use the supported package path in automation:
149
+
150
+ ```bash
151
+ npx @wpmoo/toolkit --version
152
+ ```
153
+
154
+ ## PostgreSQL Diagnostics Are Unavailable
155
+
156
+ Symptoms:
157
+
158
+ - `./moo doctor --postgres` prints an advisory warning.
159
+ - `./moo doctor --json --postgres` includes `postgres.available: false`.
160
+
161
+ Check that services are running:
162
+
163
+ ```bash
164
+ ./moo status
165
+ ./moo start
166
+ ./moo doctor --postgres
167
+ ```
168
+
169
+ Next steps:
170
+
171
+ 1. Confirm the database service is running and reachable.
172
+ 2. Run the JSON form to inspect the structured reason.
173
+
174
+ ```bash
175
+ ./moo doctor --json --postgres
176
+ ```
177
+
178
+ 3. Treat PostgreSQL diagnostics as advisory. WPMoo only runs read-only checks
179
+ and does not tune PostgreSQL automatically.
180
+
181
+ Expected result when available:
182
+
183
+ - The JSON payload includes `postgres.contractVersion`.
184
+ - The diagnostics object includes `schemaVersion`.
185
+ - Missing or malformed metric rows are reported as unavailable diagnostics
186
+ instead of being treated as success.
187
+
188
+ ## Stage Or Production Guard Failure
189
+
190
+ Symptoms:
191
+
192
+ - `install`, `update`, `test`, `resetdb`, or `restore-snapshot` is refused in
193
+ `WPMOO_ENV=stage` or `WPMOO_ENV=prod`.
194
+ - The message names a required `WPMOO_ALLOW_*` flag.
195
+
196
+ Safe preview commands:
197
+
198
+ ```bash
199
+ ./moo restore-snapshot --dry-run <snapshot-name> devel
200
+ ./moo doctor
201
+ ./moo doctor --postgres
202
+ ```
203
+
204
+ Intentional stage lifecycle command:
205
+
206
+ ```bash
207
+ WPMOO_ENV=stage WPMOO_ALLOW_STAGE_LIFECYCLE=1 ./moo update <module> devel
208
+ ```
209
+
210
+ Intentional production lifecycle command:
211
+
212
+ ```bash
213
+ WPMOO_ENV=prod WPMOO_ALLOW_PROD_LIFECYCLE=1 ./moo test <module> --db devel
214
+ ```
215
+
216
+ Intentional destructive command:
217
+
218
+ ```bash
219
+ WPMOO_ENV=stage WPMOO_ALLOW_DESTRUCTIVE=1 WPMOO_ALLOW_NO_RECENT_SNAPSHOT=1 ./moo resetdb devel
220
+ ```
221
+
222
+ Use the guard flag only when the command is intentional, reviewed, and has an
223
+ appropriate rollback path. Migration-risk lifecycle commands may also require
224
+ `WPMOO_ALLOW_MIGRATIONS=1`.
225
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wpmoo/toolkit",
3
- "version": "0.9.27",
3
+ "version": "0.9.29",
4
4
  "description": "WPMoo Toolkit for development, staging, and production lifecycle workflows.",
5
5
  "type": "module",
6
6
  "repository": {