@wpmoo/toolkit 0.9.26 → 0.9.28

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.
@@ -0,0 +1,129 @@
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
+ - Deprecated package aliases remain compatibility paths:
15
+ `npx @wpmoo/odoo` and `npx @wpmoo/odoo-dev`.
16
+
17
+ Remaining decision:
18
+
19
+ - Whether the optional unscoped `npx wpmoo` short alias should be promoted,
20
+ kept best-effort, or removed from public examples before `1.0.0`.
21
+
22
+ ## Stable JSON Contracts
23
+
24
+ Ready:
25
+
26
+ - `status --json` uses `schemaVersion: 1`.
27
+ - `source list --json` and `source sync --json` use `schemaVersion: 1`.
28
+ - `doctor --json` uses `schemaVersion: 1`.
29
+ - `doctor --json --postgres` exposes a versioned `postgres` payload with
30
+ `contractVersion` and diagnostics `schemaVersion`.
31
+ - PostgreSQL diagnostics treat unavailable optional metrics as optional fields.
32
+
33
+ Remaining decision:
34
+
35
+ - Document a compatibility policy for future JSON schema changes, including
36
+ whether minor additive fields are allowed without a major release.
37
+
38
+ ## Deprecated Alias Policy
39
+
40
+ Ready:
41
+
42
+ - `@wpmoo/toolkit` is the supported package.
43
+ - `@wpmoo/odoo` and `@wpmoo/odoo-dev` are required compatibility artifacts in
44
+ releases.
45
+ - The optional `wpmoo` short alias is warning-only and does not determine
46
+ release validity.
47
+
48
+ Remaining decision:
49
+
50
+ - Set an explicit deprecation horizon for compatibility aliases after `1.0.0`,
51
+ or commit to maintaining them indefinitely.
52
+
53
+ ## Generated File Compatibility
54
+
55
+ Ready:
56
+
57
+ - Generated environments keep product source repositories under
58
+ `odoo/custom/src/private`, `odoo/custom/src/oca`, and
59
+ `odoo/custom/src/external`.
60
+ - `safe reset` refreshes generated files while preserving source repositories.
61
+ - PostgreSQL 18 mount compatibility is documented and doctor can apply safe
62
+ mount-target fixes.
63
+ - Generated `./moo` delegates daily commands and keeps local guard behavior.
64
+
65
+ Remaining decision:
66
+
67
+ - Define a generated-file migration policy for environments created by older
68
+ pre-1.0 releases.
69
+
70
+ ## Stage And Production Policy
71
+
72
+ Ready:
73
+
74
+ - Stage `install` and `update` require `WPMOO_ALLOW_STAGE_LIFECYCLE=1`.
75
+ - Production `install`, `update`, and `test` require
76
+ `WPMOO_ALLOW_PROD_LIFECYCLE=1`.
77
+ - Destructive database commands require `WPMOO_ALLOW_DESTRUCTIVE=1` in stage
78
+ and production.
79
+ - `restore-snapshot --dry-run`, `doctor`, and `doctor --postgres` remain safe
80
+ preview/read-only paths.
81
+ - Migration-risk lifecycle commands can require `WPMOO_ALLOW_MIGRATIONS=1`.
82
+
83
+ Remaining decision:
84
+
85
+ - Decide whether stage/prod approvals should gain a timestamped confirmation
86
+ file or continue to rely on environment variables only.
87
+
88
+ ## Release Artifact Policy
89
+
90
+ Ready:
91
+
92
+ - Required release artifacts are `@wpmoo/toolkit`, `@wpmoo/odoo`, and
93
+ `@wpmoo/odoo-dev`.
94
+ - Publishing is handled by GitHub Actions Trusted Publishing after a `v<version>`
95
+ tag is pushed.
96
+ - `npm run release:check` verifies package state and bumps patch versions when
97
+ the current version already exists.
98
+ - `npm run smoke:published -- "$VERSION"` is the preferred published package
99
+ smoke check.
100
+
101
+ Remaining decision:
102
+
103
+ - Decide whether release smoke should include a generated-environment acceptance
104
+ run by default for `1.0.0` tags.
105
+
106
+ ## Current Audit
107
+
108
+ Last updated: 2026-05-21.
109
+
110
+ Completed checks:
111
+
112
+ - Full local gate for Train 8 passed on 2026-05-21:
113
+ `npm run typecheck`, `npm test`, `npm run build`, and `git diff --check`.
114
+ - Coverage passed on 2026-05-21: 72 test files, 682 tests, 92.32%
115
+ statements, 87.56% branches, 96.74% functions, and 92.32% lines.
116
+ - Published CLI smoke passed against `@wpmoo/toolkit@0.9.27` with `npm exec`
117
+ for `wpmoo --version`, `wpmoo --help`, and `wpmoo doctor --help`.
118
+ - Placeholder review found no `TODO`, `FIXME`, `TBD`, or `coming soon`
119
+ markers in `README.md`, `docs`, or `src`.
120
+ - Local markdown link review passed across `README.md` and `docs/*.md`.
121
+
122
+ Final gap list:
123
+
124
+ - Define JSON compatibility rules for post-1.0 additive fields.
125
+ - Decide the long-term compatibility alias policy.
126
+ - Decide generated-environment migration support for older pre-1.0 outputs.
127
+ - Decide whether stage/prod approvals need timestamped confirmation files.
128
+ - Decide whether generated-environment published smoke should be mandatory for
129
+ `1.0.0` tags.
@@ -0,0 +1,110 @@
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`.
7
+
8
+ ## Package Commands
9
+
10
+ | Command | Cockpit Equivalent | JSON | Notes |
11
+ | --- | --- | --- | --- |
12
+ | `npx @wpmoo/toolkit` | Open cockpit or create wizard | No | Opens the create wizard outside an environment and the cockpit inside one. |
13
+ | `npx @wpmoo/toolkit create ...` | Create wizard | No | Creates a generated environment. Use `--target <path>` for a custom folder. |
14
+ | `npx @wpmoo/toolkit status` | Diagnostics -> Environment status | Yes, `--json` | Fast local metadata and file check. |
15
+ | `npx @wpmoo/toolkit doctor [--fix] [--postgres]` | Diagnostics -> Run doctor | Yes, `--json` | Deeper health checks. `--postgres` is read-only and advisory. |
16
+ | `npx @wpmoo/toolkit source list` | Repositories | Yes, `--json` | Lists known source repositories. |
17
+ | `npx @wpmoo/toolkit source sync` | Repositories | Yes, `--json` | Refreshes source manifest data. |
18
+ | `npx @wpmoo/toolkit add-repo --repo-url <url>` | Repositories -> Add source repo | No | Adds a source repository category entry. |
19
+ | `npx @wpmoo/toolkit remove-repo --repo <name>` | Repositories -> Remove source repo | No | Removes a source repository from the environment. |
20
+ | `npx @wpmoo/toolkit add-module --repo <repo> --module <name>` | Modules -> Add module | No | Creates an Odoo module skeleton in a source repository. |
21
+ | `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. |
22
+ | `npx @wpmoo/toolkit reset [--dry-run]` | Maintenance -> Safe reset environment | No | Refreshes generated files while preserving source repositories. |
23
+
24
+ ## Generated Environment Commands
25
+
26
+ Run these from the generated environment root:
27
+
28
+ | Command | Cockpit Equivalent | Guarded In Stage/Prod | Notes |
29
+ | --- | --- | --- | --- |
30
+ | `./moo start` | Services -> Start services | No | Starts local Odoo services. Disabled in cockpit when already running. |
31
+ | `./moo stop` | Services -> Stop services | No | Stops local services. Disabled in cockpit when services are stopped. |
32
+ | `./moo restart` | Services -> Restart services | No | Restarts services. |
33
+ | `./moo logs [service] [tail-lines]` | Services -> View logs | No | Streams or tails service logs. |
34
+ | `./moo shell` | Services -> Open shell | No | Opens a shell in the Odoo service container. |
35
+ | `./moo psql [db]` | Database -> Open psql | No | Opens a PostgreSQL prompt. |
36
+ | `./moo install <module[,module]> [db]` | Modules -> Install module | Yes | Installs one or more modules. |
37
+ | `./moo update <module[,module]> [db]` | Modules -> Update module | Yes | Updates one or more modules. |
38
+ | `./moo test <module[,module]> --db <db>` | Modules -> Run tests | Yes in prod | Runs Odoo tests for modules. |
39
+ | `./moo lint` | Modules -> Run environment lint | No | Runs configured environment lint checks. |
40
+ | `./moo pot <module[,module]> [db] [output]` | Modules -> Generate POT | No | Generates translation template files. |
41
+ | `./moo snapshot [db] [name]` | Database -> Create snapshot | No | Creates a database and filestore snapshot. |
42
+ | `./moo restore-snapshot --dry-run <name> [db]` | Database -> Restore snapshot | Preview only | Prints a restore preview without changing data. |
43
+ | `./moo restore-snapshot <name> [db]` | Database -> Restore snapshot | Yes | Restores database and filestore from a snapshot. |
44
+ | `./moo resetdb [db] [module[,module]]` | Database -> Reset database | Yes | Destructive database reset. |
45
+ | `./moo doctor [--fix] [--postgres]` | Diagnostics -> Run doctor | No | Local health checks. |
46
+ | `./moo status` | Diagnostics -> Environment status | No | Local environment status. |
47
+
48
+ ## JSON Output
49
+
50
+ Machine-readable output is available for automation:
51
+
52
+ ```bash
53
+ npx @wpmoo/toolkit status --json
54
+ npx @wpmoo/toolkit source list --json
55
+ npx @wpmoo/toolkit source sync --json
56
+ npx @wpmoo/toolkit doctor --json
57
+ npx @wpmoo/toolkit doctor --json --postgres
58
+ ```
59
+
60
+ Current JSON contract notes:
61
+
62
+ - `status --json` uses `schemaVersion: 1`.
63
+ - `source list --json` and `source sync --json` use `schemaVersion: 1`.
64
+ - `doctor --json` uses `schemaVersion: 1`.
65
+ - `doctor --json --postgres` adds `postgres.contractVersion` and a PostgreSQL
66
+ diagnostics object with its own `schemaVersion`.
67
+ - PostgreSQL fields are optional when a metric is unavailable.
68
+
69
+ ## Environment Variables
70
+
71
+ | Variable | Purpose |
72
+ | --- | --- |
73
+ | `WPMOO_ENV=dev|stage|prod` | Selects environment safety policy. Missing value behaves like development for local workflows. |
74
+ | `WPMOO_ALLOW_STAGE_LIFECYCLE=1` | Allows `install` and `update` in stage. |
75
+ | `WPMOO_ALLOW_PROD_LIFECYCLE=1` | Allows `install`, `update`, and `test` in production. |
76
+ | `WPMOO_ALLOW_DESTRUCTIVE=1` | Allows destructive database commands in stage/prod. |
77
+ | `WPMOO_ALLOW_NO_RECENT_SNAPSHOT=1` | Allows destructive commands without a recent snapshot when that extra guard applies. |
78
+ | `WPMOO_ALLOW_MIGRATIONS=1` | Allows lifecycle commands when migration scripts are detected. |
79
+ | `WPMOO_NODE_BIN`, `WPMOO_NPX_BIN`, `WPMOO_GIT_BIN` | Override binaries used by release smoke scripts. |
80
+
81
+ Process environment values take precedence over `.env` values for safety flags.
82
+
83
+ ## Exit Behavior
84
+
85
+ - Successful commands exit `0`.
86
+ - Invalid arguments, missing environment metadata, refused guard checks, dirty
87
+ deletion, and failed subprocesses exit non-zero.
88
+ - `--json` commands still use process exit codes; automation should check both
89
+ the exit status and the `ok` field when present.
90
+ - Guard failures are intentional failures. Do not silence them unless the named
91
+ `WPMOO_ALLOW_*` flag has been reviewed.
92
+
93
+ ## Stage And Production Restrictions
94
+
95
+ | Command Family | Stage | Production |
96
+ | --- | --- | --- |
97
+ | `install`, `update` | Requires `WPMOO_ALLOW_STAGE_LIFECYCLE=1` | Requires `WPMOO_ALLOW_PROD_LIFECYCLE=1` |
98
+ | `test` | Allowed | Requires `WPMOO_ALLOW_PROD_LIFECYCLE=1` |
99
+ | `resetdb`, real `restore-snapshot` | Requires `WPMOO_ALLOW_DESTRUCTIVE=1` | Requires `WPMOO_ALLOW_DESTRUCTIVE=1` |
100
+ | `restore-snapshot --dry-run` | Allowed | Allowed |
101
+ | Commands with detected migration scripts | May require `WPMOO_ALLOW_MIGRATIONS=1` | May require `WPMOO_ALLOW_MIGRATIONS=1` |
102
+
103
+ Prefer read-only and dry-run commands first:
104
+
105
+ ```bash
106
+ ./moo doctor
107
+ ./moo doctor --postgres
108
+ ./moo restore-snapshot --dry-run before-change devel
109
+ ```
110
+
@@ -23,7 +23,7 @@ not validate staging or production deployments.
23
23
  | Doctor checks | Metadata, compose files, scripts, source repo paths, and local tooling checks behave as expected. | `npx @wpmoo/toolkit doctor` or `./moo doctor` |
24
24
  | Doctor safe fixes | Safe file-level fixes are applied only with `--fix`, then doctor runs again and reports any remaining manual issues. | `npx @wpmoo/toolkit doctor --fix` |
25
25
  | Generated Postgres checks | For PostgreSQL 18 environments, doctor validates db mount targets avoid old PG image-specific paths and can normalize safe targets with `--fix`. | `npx @wpmoo/toolkit doctor`, `npx @wpmoo/toolkit doctor --fix` |
26
- | PostgreSQL diagnostics | Optional read-only database health/performance diagnostics report database count, sessions currently running queries with `pg_stat_activity.state = 'active'`, total database size, slow-query readiness, extension visibility, and selected settings without failing doctor when the database is unavailable. | `npx @wpmoo/toolkit doctor --postgres`, `npx @wpmoo/toolkit doctor --json --postgres` |
26
+ | PostgreSQL diagnostics | Optional read-only, advisory-only database health and performance diagnostics (no automatic tuning), covering active/idle-in-transaction sessions, table health signals, WAL/capacity context, unused-index hints, and slow-query readiness. JSON mode emits a versioned PostgreSQL contract with optional fields when a metric is unavailable. | `npx @wpmoo/toolkit doctor --postgres`, `npx @wpmoo/toolkit doctor --json --postgres` |
27
27
  | Source repo add/remove | Source repository registration and submodule lifecycle behave correctly. | `npx @wpmoo/toolkit add-repo ...`, `npx @wpmoo/toolkit remove-repo ...` |
28
28
  | Source manifest sync | Source repo metadata, `.gitmodules`, and `odoo/custom/manifests/sources.yaml` stay aligned. | `npx @wpmoo/toolkit source list`, `npx @wpmoo/toolkit source sync` |
29
29
  | Module add/remove | Module skeleton files include manifest, model, access CSV, explicit view XML, action/menu XML, post-install test scaffold, and selected source repo registration. Existing scaffold files are not overwritten. | `npx @wpmoo/toolkit add-module ...`, `npx @wpmoo/toolkit remove-module ...` |
@@ -76,16 +76,16 @@ is involved, use PostgreSQL upgrade tooling first.
76
76
 
77
77
  Use `doctor --postgres` when the database container is running and you want
78
78
  read-only PostgreSQL diagnostics. The check uses fixed diagnostic queries for
79
- database count, sessions currently running queries where
80
- `pg_stat_activity.state` is `active`, aggregate database size, slow-query
81
- logging readiness,
82
- `pg_stat_statements` availability, and `shared_buffers`. If the database is
83
- unavailable, doctor reports a warning instead of failing the whole environment
84
- check.
85
- JSON output preserves `checks` and `warnings` while adding a structured
86
- `postgres` object when `--postgres` is requested.
87
- Incomplete or malformed PostgreSQL metric rows are reported as unavailable
88
- diagnostics.
79
+ database count, sessions currently running queries where `pg_stat_activity.state`
80
+ is `active`, long transactions / idle-in-transaction sessions, table health
81
+ signals, unused index advisor signals, WAL and capacity visibility, and
82
+ slow-query logging readiness (`log_min_duration_statement` and
83
+ `pg_stat_statements` visibility). If the database is unavailable, doctor reports
84
+ a warning instead of failing the whole environment check.
85
+
86
+ `doctor --json --postgres` keeps output stable by exposing a versioned PostgreSQL
87
+ diagnostics contract. The contract is intentionally permissive: fields are optional
88
+ and omitted or marked unavailable when a running database does not expose them.
89
89
 
90
90
  ## Safe reset policy
91
91
 
package/docs/handoff.md CHANGED
@@ -64,3 +64,14 @@ Current command standard:
64
64
 
65
65
  - Use `npx @wpmoo/toolkit ...` for package/operator commands.
66
66
  - Use generated environment `./moo ...` for local compose daily commands.
67
+
68
+ 1.0 readiness references:
69
+
70
+ - [Command Reference](command-reference.md)
71
+ - [Lifecycle Recipes](lifecycle-recipes.md)
72
+ - [Troubleshooting](troubleshooting.md)
73
+ - [1.0 Readiness](1-0-readiness.md)
74
+
75
+ Before a `1.0.0` tag, review the readiness gap list and decide whether the next
76
+ milestone is "ship 1.0" or "finish named gaps." Do not treat the gap list as an
77
+ 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
+