@wpmoo/toolkit 0.9.31 → 0.9.32
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 +10 -1
- package/dist/doctor.js +17 -3
- package/dist/help.js +1 -0
- package/docs/command-reference.md +6 -0
- package/docs/handoff.md +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -181,6 +181,9 @@ npx @wpmoo/toolkit doctor --json --postgres
|
|
|
181
181
|
```
|
|
182
182
|
|
|
183
183
|
JSON output is optional; human-readable output remains the default.
|
|
184
|
+
`doctor --json --fix` is intentionally unsupported because `doctor --fix` may
|
|
185
|
+
write safe file-level repairs. Run `doctor --fix` first, then `doctor --json`
|
|
186
|
+
to inspect the post-fix state.
|
|
184
187
|
Human `doctor` output is grouped into stable sections (`Generated files`,
|
|
185
188
|
`Compose`, `Source repositories`, `PostgreSQL`, and `Host tools`) so terminal
|
|
186
189
|
operators can see which lifecycle layer needs attention first.
|
|
@@ -212,6 +215,10 @@ JSON variant exposes a versioned PostgreSQL diagnostics contract.
|
|
|
212
215
|
`doctor --json --postgres` keeps the JSON contract stable by versioning the
|
|
213
216
|
`postgres` payload; individual fields are optional so automation can safely handle
|
|
214
217
|
environments where PostgreSQL does not expose a metric.
|
|
218
|
+
Optional PostgreSQL probe permission failures appear under
|
|
219
|
+
`postgres.optionalProbeFailures` when available; they do not make
|
|
220
|
+
`postgres.available` false and can be ignored by automation that only needs core
|
|
221
|
+
diagnostics.
|
|
215
222
|
All `doctor --json` reports also include optional `sections` entries that group
|
|
216
223
|
checks, warnings, and errors without changing the legacy flat arrays.
|
|
217
224
|
|
|
@@ -244,7 +251,9 @@ warning while keeping the scoped package release valid.
|
|
|
244
251
|
rejects it, the release still succeeds as long as the three required scoped
|
|
245
252
|
packages are valid.
|
|
246
253
|
- **Smoke expectation**: run `npm run smoke:published -- "$VERSION"` after the
|
|
247
|
-
release tag workflow completes.
|
|
254
|
+
release tag workflow completes. The script prints `Smoke step:` progress lines
|
|
255
|
+
before each published CLI check so slow registry-backed `npx` resolution is
|
|
256
|
+
visible.
|
|
248
257
|
- **Deterministic smoke target**: pin the target package explicitly so smoke checks
|
|
249
258
|
are reproducible across reruns:
|
|
250
259
|
|
package/dist/doctor.js
CHANGED
|
@@ -115,6 +115,13 @@ function postgresDiagnosticsTimeoutMs(options) {
|
|
|
115
115
|
? options.postgresTimeoutMs
|
|
116
116
|
: defaultPostgresDiagnosticsTimeoutMs;
|
|
117
117
|
}
|
|
118
|
+
function optionalPostgresProbeFailureWarning(error) {
|
|
119
|
+
const message = commandErrorText(error).trim();
|
|
120
|
+
if (!/(?:permission denied|insufficient privilege|must be superuser|not permitted|not allowed)/iu.test(message)) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
return message.split(/\r?\n/u).find((line) => line.trim())?.trim();
|
|
124
|
+
}
|
|
118
125
|
async function readPostgresDiagnosticQuery(target, runner, query, timeoutMs) {
|
|
119
126
|
const queryLiteral = JSON.stringify(query);
|
|
120
127
|
const command = [
|
|
@@ -127,16 +134,21 @@ async function readPostgresDiagnosticQuery(target, runner, query, timeoutMs) {
|
|
|
127
134
|
}
|
|
128
135
|
async function readPostgresDiagnostics(target, runner, timeoutMs) {
|
|
129
136
|
const diagnostics = await readPostgresDiagnosticQuery(target, runner, POSTGRES_DIAGNOSTICS_QUERY, timeoutMs);
|
|
137
|
+
const optionalProbeFailures = [];
|
|
130
138
|
for (const probe of POSTGRES_DIAGNOSTICS_OPTIONAL_QUERIES) {
|
|
131
139
|
try {
|
|
132
140
|
Object.assign(diagnostics, await readPostgresDiagnosticQuery(target, runner, probe.query, timeoutMs));
|
|
133
141
|
}
|
|
134
|
-
catch {
|
|
142
|
+
catch (error) {
|
|
143
|
+
const warning = optionalPostgresProbeFailureWarning(error);
|
|
144
|
+
if (warning) {
|
|
145
|
+
optionalProbeFailures.push({ id: probe.id, warning });
|
|
146
|
+
}
|
|
135
147
|
// Optional probes use PostgreSQL functions that can require elevated roles.
|
|
136
148
|
// Their failure must not hide the core read-only health report.
|
|
137
149
|
}
|
|
138
150
|
}
|
|
139
|
-
return diagnostics;
|
|
151
|
+
return { diagnostics, optionalProbeFailures };
|
|
140
152
|
}
|
|
141
153
|
function stripInlineComment(line) {
|
|
142
154
|
const hashIndex = line.indexOf('#');
|
|
@@ -628,7 +640,7 @@ export async function getDoctorReport(target = process.cwd(), runnerOrOptions =
|
|
|
628
640
|
}
|
|
629
641
|
if (actualOptions.postgres) {
|
|
630
642
|
try {
|
|
631
|
-
const postgresDiagnostics = await readPostgresDiagnostics(target, actualRunner, postgresDiagnosticsTimeoutMs(actualOptions));
|
|
643
|
+
const { diagnostics: postgresDiagnostics, optionalProbeFailures } = await readPostgresDiagnostics(target, actualRunner, postgresDiagnosticsTimeoutMs(actualOptions));
|
|
632
644
|
const missingKeys = missingPostgresDiagnosticKeys(postgresDiagnostics);
|
|
633
645
|
const malformedKeys = malformedPostgresDiagnosticKeys(postgresDiagnostics);
|
|
634
646
|
if (missingKeys.length === 0 && malformedKeys.length === 0) {
|
|
@@ -641,6 +653,7 @@ export async function getDoctorReport(target = process.cwd(), runnerOrOptions =
|
|
|
641
653
|
contractVersion: POSTGRES_DIAGNOSTICS_CONTRACT_VERSION,
|
|
642
654
|
available: true,
|
|
643
655
|
diagnostics: structuredPostgresDiagnostics(postgresDiagnostics),
|
|
656
|
+
...(optionalProbeFailures.length > 0 ? { optionalProbeFailures } : {}),
|
|
644
657
|
};
|
|
645
658
|
warnings.push(...postgresPostgresWarnings(postgresDiagnostics));
|
|
646
659
|
}
|
|
@@ -654,6 +667,7 @@ export async function getDoctorReport(target = process.cwd(), runnerOrOptions =
|
|
|
654
667
|
contractVersion: POSTGRES_DIAGNOSTICS_CONTRACT_VERSION,
|
|
655
668
|
available: false,
|
|
656
669
|
diagnostics: structuredPostgresDiagnostics(postgresDiagnostics),
|
|
670
|
+
...(optionalProbeFailures.length > 0 ? { optionalProbeFailures } : {}),
|
|
657
671
|
warning,
|
|
658
672
|
};
|
|
659
673
|
}
|
package/dist/help.js
CHANGED
|
@@ -161,6 +161,7 @@ Machine-readable JSON output:
|
|
|
161
161
|
npx @wpmoo/toolkit source sync --json
|
|
162
162
|
npx @wpmoo/toolkit doctor --json
|
|
163
163
|
doctor --json --postgres includes a structured postgres object for automation.
|
|
164
|
+
doctor --json is read-only; run doctor --fix first, then doctor --json for post-fix state.
|
|
164
165
|
Incomplete or malformed PostgreSQL metric rows are reported as unavailable diagnostics.
|
|
165
166
|
|
|
166
167
|
JSON compatibility policy:
|
|
@@ -66,9 +66,15 @@ Current JSON contract notes:
|
|
|
66
66
|
- `status --json` uses `schemaVersion: 1`.
|
|
67
67
|
- `source list --json` and `source sync --json` use `schemaVersion: 1`.
|
|
68
68
|
- `doctor --json` uses `schemaVersion: 1`.
|
|
69
|
+
- `doctor --json --fix` is intentionally unsupported because `doctor --fix`
|
|
70
|
+
may mutate files. Run `doctor --fix` first, then `doctor --json` to inspect
|
|
71
|
+
post-fix state.
|
|
69
72
|
- `doctor --json --postgres` adds `postgres.contractVersion` and a PostgreSQL
|
|
70
73
|
diagnostics object with its own `schemaVersion`.
|
|
71
74
|
- PostgreSQL fields are optional when a metric is unavailable.
|
|
75
|
+
- Optional privileged PostgreSQL probe failures may appear under
|
|
76
|
+
`postgres.optionalProbeFailures`; core diagnostics remain available when those
|
|
77
|
+
optional probes fail with permission errors.
|
|
72
78
|
- Automation should ignore unknown JSON fields.
|
|
73
79
|
- Minor and patch releases may add optional fields without a breaking release.
|
|
74
80
|
- Removing, renaming, or changing the meaning of a documented field requires a
|
package/docs/handoff.md
CHANGED
|
@@ -70,6 +70,9 @@ pre-existing global `NPM_CONFIG_CACHE` state unless you intentionally reuse it.
|
|
|
70
70
|
|
|
71
71
|
The smoke script checks `--version`, top-level `--help`, and critical command
|
|
72
72
|
help output before optional generated-environment acceptance smoke.
|
|
73
|
+
Long registry-backed smoke runs print `Smoke step:` progress lines before each
|
|
74
|
+
published CLI check, so a slow `npx` or `npm exec` resolution is visible in the
|
|
75
|
+
terminal instead of appearing stuck.
|
|
73
76
|
|
|
74
77
|
For a 1.0.0 tag, run generated-environment acceptance smoke with
|
|
75
78
|
WPMOO_SMOKE_ENVIRONMENT=1. Treat the release as final only after that smoke
|