@wpmoo/toolkit 0.9.32 → 0.9.33
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 +3 -0
- package/dist/cockpit/menu.js +23 -5
- package/docs/command-reference.md +6 -0
- package/docs/troubleshooting.md +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -143,6 +143,9 @@ Every cockpit action maps to a direct command, so the same workflow can be used
|
|
|
143
143
|
|
|
144
144
|
When an environment has many module candidates, module selection switches to
|
|
145
145
|
search so names, repositories, and source categories can be filtered quickly.
|
|
146
|
+
Runtime actions that need running services or a ready database are disabled in
|
|
147
|
+
the cockpit until the environment is ready; file-only actions such as module
|
|
148
|
+
scaffolding, source repository changes, and safe reset remain available.
|
|
146
149
|
|
|
147
150
|
```bash
|
|
148
151
|
./moo start
|
package/dist/cockpit/menu.js
CHANGED
|
@@ -21,6 +21,16 @@ const topLevelCategoryOrder = [
|
|
|
21
21
|
const topLevelCommands = topLevelCategoryOrder.flatMap((category) => cockpitCommands.filter((command) => command.category === category && command.id !== 'exit'));
|
|
22
22
|
const topLevelCommandLabelWidth = Math.max(...topLevelCommands.map((command) => command.label.length));
|
|
23
23
|
const moduleDependentCommandIds = new Set(['list-modules', 'install', 'update', 'test', 'pot', 'remove-module']);
|
|
24
|
+
const runningServicesRequiredCommandIds = new Set([
|
|
25
|
+
'install',
|
|
26
|
+
'update',
|
|
27
|
+
'test',
|
|
28
|
+
'pot',
|
|
29
|
+
'psql',
|
|
30
|
+
'snapshot',
|
|
31
|
+
'restore-snapshot',
|
|
32
|
+
'resetdb',
|
|
33
|
+
]);
|
|
24
34
|
function rgb(red, green, blue, value) {
|
|
25
35
|
return `\u001B[38;2;${red};${green};${blue}m${value}\u001B[39m`;
|
|
26
36
|
}
|
|
@@ -39,6 +49,7 @@ const disabledReasonNextStep = {
|
|
|
39
49
|
'Services stopped.': 'Next: choose "Start services" first.',
|
|
40
50
|
'Already running.': 'Next: choose "Stop services" or "Restart services".',
|
|
41
51
|
'Docker not running.': 'Next: start Docker, then choose "Start services".',
|
|
52
|
+
'Database not ready.': 'Next: wait for the database or choose "Restart services".',
|
|
42
53
|
'No source repos found.': 'Next: choose "Add source repo" first.',
|
|
43
54
|
};
|
|
44
55
|
function disabledError(reason) {
|
|
@@ -50,15 +61,22 @@ function disabledError(reason) {
|
|
|
50
61
|
return nextStep ? `${base}\nReason: ${reason}\n${nextStep}` : `${base}\nReason: ${reason}`;
|
|
51
62
|
}
|
|
52
63
|
function serviceDisabledReason(command, serviceStatus) {
|
|
53
|
-
if (
|
|
64
|
+
if (!serviceStatus)
|
|
65
|
+
return undefined;
|
|
66
|
+
const requiresRunningServices = command.category === 'services' || runningServicesRequiredCommandIds.has(command.id);
|
|
67
|
+
if (!requiresRunningServices)
|
|
54
68
|
return undefined;
|
|
55
69
|
if (serviceStatus.kind === 'docker-not-running')
|
|
56
70
|
return 'Docker not running.';
|
|
57
71
|
if (serviceStatus.kind === 'running' && command.id === 'start')
|
|
58
72
|
return 'Already running.';
|
|
59
|
-
if (serviceStatus.kind === 'stopped' &&
|
|
73
|
+
if (serviceStatus.kind === 'stopped' &&
|
|
74
|
+
(['stop', 'restart', 'logs', 'shell'].includes(command.id) || runningServicesRequiredCommandIds.has(command.id))) {
|
|
60
75
|
return 'Services stopped.';
|
|
61
76
|
}
|
|
77
|
+
if (serviceStatus.kind === 'services-running' && runningServicesRequiredCommandIds.has(command.id)) {
|
|
78
|
+
return 'Database not ready.';
|
|
79
|
+
}
|
|
62
80
|
return undefined;
|
|
63
81
|
}
|
|
64
82
|
function moduleDisabledReason(command, moduleCount) {
|
|
@@ -71,10 +89,10 @@ function snapshotDisabledReason(command, snapshotCount) {
|
|
|
71
89
|
return snapshotCount === 0 && command.id === 'restore-snapshot' ? 'No snapshots found.' : undefined;
|
|
72
90
|
}
|
|
73
91
|
function disabledReason(command, serviceStatus, moduleCount, sourceRepoCount, snapshotCount) {
|
|
74
|
-
return (
|
|
75
|
-
moduleDisabledReason(command, moduleCount) ??
|
|
92
|
+
return (moduleDisabledReason(command, moduleCount) ??
|
|
76
93
|
sourceRepoDisabledReason(command, sourceRepoCount) ??
|
|
77
|
-
snapshotDisabledReason(command, snapshotCount)
|
|
94
|
+
snapshotDisabledReason(command, snapshotCount) ??
|
|
95
|
+
serviceDisabledReason(command, serviceStatus));
|
|
78
96
|
}
|
|
79
97
|
function commandDisabledValue(reason) {
|
|
80
98
|
if (!reason) {
|
|
@@ -29,6 +29,12 @@ unscoped `npx wpmoo` short alias is optional and best-effort; scripts should use
|
|
|
29
29
|
|
|
30
30
|
Run these from the generated environment root:
|
|
31
31
|
|
|
32
|
+
The cockpit disables runtime actions such as `psql`, `snapshot`, `resetdb`,
|
|
33
|
+
`restore-snapshot`, `install`, `update`, `test`, and `pot` while services are
|
|
34
|
+
stopped or the database is not ready. File-only cockpit actions remain
|
|
35
|
+
selectable so source repositories, module scaffolds, and safe reset can still be
|
|
36
|
+
managed.
|
|
37
|
+
|
|
32
38
|
| Command | Cockpit Equivalent | Guarded In Stage/Prod | Notes |
|
|
33
39
|
| --- | --- | --- | --- |
|
|
34
40
|
| `./moo start` | Services -> Start services | No | Starts local Odoo services. Disabled in cockpit when already running. |
|
package/docs/troubleshooting.md
CHANGED
|
@@ -11,6 +11,8 @@ Symptoms:
|
|
|
11
11
|
- The create wizard stops before writing files.
|
|
12
12
|
- `./moo start`, `./moo status`, or `./moo doctor` reports Docker or Docker
|
|
13
13
|
Compose as unavailable.
|
|
14
|
+
- The cockpit disables database or module runtime actions because Docker,
|
|
15
|
+
services, or the database are not ready.
|
|
14
16
|
|
|
15
17
|
Check:
|
|
16
18
|
|
|
@@ -30,6 +32,9 @@ The create wizard intentionally stops before setup questions when required
|
|
|
30
32
|
runtime tools are missing. That protects the workspace from half-created
|
|
31
33
|
environments.
|
|
32
34
|
|
|
35
|
+
If Docker is running but the cockpit says the database is not ready, wait for
|
|
36
|
+
PostgreSQL readiness or choose `Restart services`.
|
|
37
|
+
|
|
33
38
|
## No Modules Found
|
|
34
39
|
|
|
35
40
|
Symptoms:
|