@percher/core 1.6.0 → 2.0.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.
- package/dist/commands/account.d.ts.map +1 -1
- package/dist/commands/account.js +3 -0
- package/dist/commands/account.js.map +1 -1
- package/dist/commands/billing.d.ts.map +1 -1
- package/dist/commands/billing.js +3 -0
- package/dist/commands/billing.js.map +1 -1
- package/dist/commands/claim.d.ts.map +1 -1
- package/dist/commands/claim.js +5 -8
- package/dist/commands/claim.js.map +1 -1
- package/dist/commands/deploy-repo.d.ts.map +1 -1
- package/dist/commands/deploy-repo.js +10 -12
- package/dist/commands/deploy-repo.js.map +1 -1
- package/dist/commands/diagnose.d.ts +7 -6
- package/dist/commands/diagnose.d.ts.map +1 -1
- package/dist/commands/diagnose.js +5 -4
- package/dist/commands/diagnose.js.map +1 -1
- package/dist/commands/doctor-access.d.ts +4 -0
- package/dist/commands/doctor-access.d.ts.map +1 -0
- package/dist/commands/doctor-access.js +32 -0
- package/dist/commands/doctor-access.js.map +1 -0
- package/dist/commands/doctor-auth.d.ts +19 -0
- package/dist/commands/doctor-auth.d.ts.map +1 -0
- package/dist/commands/doctor-auth.js +116 -0
- package/dist/commands/doctor-auth.js.map +1 -0
- package/dist/commands/doctor-build.d.ts +60 -0
- package/dist/commands/doctor-build.d.ts.map +1 -0
- package/dist/commands/doctor-build.js +470 -0
- package/dist/commands/doctor-build.js.map +1 -0
- package/dist/commands/doctor-evidence.d.ts +67 -0
- package/dist/commands/doctor-evidence.d.ts.map +1 -0
- package/dist/commands/doctor-evidence.js +102 -0
- package/dist/commands/doctor-evidence.js.map +1 -0
- package/dist/commands/doctor-observations.d.ts +19 -0
- package/dist/commands/doctor-observations.d.ts.map +1 -0
- package/dist/commands/doctor-observations.js +166 -0
- package/dist/commands/doctor-observations.js.map +1 -0
- package/dist/commands/doctor-route.d.ts +10 -0
- package/dist/commands/doctor-route.d.ts.map +1 -0
- package/dist/commands/doctor-route.js +104 -0
- package/dist/commands/doctor-route.js.map +1 -0
- package/dist/commands/doctor-runtime.d.ts +41 -0
- package/dist/commands/doctor-runtime.d.ts.map +1 -0
- package/dist/commands/doctor-runtime.js +276 -0
- package/dist/commands/doctor-runtime.js.map +1 -0
- package/dist/commands/doctor-state.d.ts +36 -0
- package/dist/commands/doctor-state.d.ts.map +1 -0
- package/dist/commands/doctor-state.js +671 -0
- package/dist/commands/doctor-state.js.map +1 -0
- package/dist/commands/doctor.d.ts +102 -13
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +238 -419
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env-scan.d.ts +1 -1
- package/dist/commands/env-scan.js +2 -2
- package/dist/commands/env-scan.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +17 -3
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/preview-branch.d.ts +2 -0
- package/dist/commands/preview-branch.d.ts.map +1 -1
- package/dist/commands/preview-branch.js +1 -0
- package/dist/commands/preview-branch.js.map +1 -1
- package/dist/commands/publish-anonymous.d.ts +3 -0
- package/dist/commands/publish-anonymous.d.ts.map +1 -1
- package/dist/commands/publish-anonymous.js +6 -3
- package/dist/commands/publish-anonymous.js.map +1 -1
- package/dist/commands/publish-api-error.d.ts.map +1 -1
- package/dist/commands/publish-api-error.js +10 -3
- package/dist/commands/publish-api-error.js.map +1 -1
- package/dist/commands/publish-failure.d.ts +17 -0
- package/dist/commands/publish-failure.d.ts.map +1 -1
- package/dist/commands/publish-failure.js +33 -9
- package/dist/commands/publish-failure.js.map +1 -1
- package/dist/commands/publish-from-repo.d.ts.map +1 -1
- package/dist/commands/publish-from-repo.js +12 -13
- package/dist/commands/publish-from-repo.js.map +1 -1
- package/dist/commands/publish-needs-login.d.ts +13 -0
- package/dist/commands/publish-needs-login.d.ts.map +1 -0
- package/dist/commands/publish-needs-login.js +53 -0
- package/dist/commands/publish-needs-login.js.map +1 -0
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +38 -70
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +20 -3
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/redeploy.d.ts.map +1 -1
- package/dist/commands/redeploy.js +12 -14
- package/dist/commands/redeploy.js.map +1 -1
- package/dist/commands/reproduce.d.ts +3 -0
- package/dist/commands/reproduce.d.ts.map +1 -1
- package/dist/commands/reproduce.js +12 -0
- package/dist/commands/reproduce.js.map +1 -1
- package/dist/commands/restore.d.ts.map +1 -1
- package/dist/commands/restore.js +29 -2
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +2 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/wait-deploy.d.ts +1 -1
- package/dist/commands/wait-deploy.d.ts.map +1 -1
- package/dist/commands/wait-deploy.js +3 -1
- package/dist/commands/wait-deploy.js.map +1 -1
- package/dist/credential-reset.d.ts +38 -0
- package/dist/credential-reset.d.ts.map +1 -0
- package/dist/credential-reset.js +77 -0
- package/dist/credential-reset.js.map +1 -0
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +2 -0
- package/dist/doctor.js.map +1 -0
- package/dist/error-classifier.d.ts +1 -1
- package/dist/error-classifier.d.ts.map +1 -1
- package/dist/error-classifier.js +42 -21
- package/dist/error-classifier.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/log-excerpt.d.ts +12 -0
- package/dist/log-excerpt.d.ts.map +1 -0
- package/dist/log-excerpt.js +88 -0
- package/dist/log-excerpt.js.map +1 -0
- package/dist/network-budget-recovery.d.ts +16 -0
- package/dist/network-budget-recovery.d.ts.map +1 -0
- package/dist/network-budget-recovery.js +32 -0
- package/dist/network-budget-recovery.js.map +1 -0
- package/dist/plans.d.ts +35 -0
- package/dist/plans.d.ts.map +1 -1
- package/dist/plans.js +20 -0
- package/dist/plans.js.map +1 -1
- package/dist/recovery.d.ts +12 -1
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +42 -16
- package/dist/recovery.js.map +1 -1
- package/dist/security-deployment-failure.d.ts.map +1 -1
- package/dist/security-deployment-failure.js +2 -1
- package/dist/security-deployment-failure.js.map +1 -1
- package/dist/static-docker.d.ts +1 -1
- package/dist/static-docker.js +13 -13
- package/dist/structured-error-codes.d.ts +6 -1
- package/dist/structured-error-codes.d.ts.map +1 -1
- package/dist/structured-error-codes.js +51 -0
- package/dist/structured-error-codes.js.map +1 -1
- package/dist/templates/ai-files/claude-md.d.ts.map +1 -1
- package/dist/templates/ai-files/claude-md.js +8 -1
- package/dist/templates/ai-files/claude-md.js.map +1 -1
- package/dist/templates/ai-files/cursor-percher-mdc.d.ts.map +1 -1
- package/dist/templates/ai-files/cursor-percher-mdc.js +5 -1
- package/dist/templates/ai-files/cursor-percher-mdc.js.map +1 -1
- package/dist/untrusted.d.ts +10 -0
- package/dist/untrusted.d.ts.map +1 -1
- package/dist/untrusted.js +23 -0
- package/dist/untrusted.js.map +1 -1
- package/dist/validation/blocked-names.d.ts +2 -0
- package/dist/validation/blocked-names.d.ts.map +1 -1
- package/dist/validation/blocked-names.js +30 -1
- package/dist/validation/blocked-names.js.map +1 -1
- package/package.json +10 -5
- package/templates/astro/Dockerfile +12 -12
- package/templates/capsule/Dockerfile +12 -15
- package/templates/eleventy/Dockerfile +12 -12
- package/templates/hugo/Dockerfile +12 -12
- package/templates/preact/Dockerfile +12 -12
- package/templates/solid/Dockerfile +12 -12
- package/templates/vite-react/Dockerfile +12 -12
- package/templates/vite-vue/Dockerfile +12 -12
- package/dist/commands/admin-legacy-audit.d.ts +0 -40
- package/dist/commands/admin-legacy-audit.d.ts.map +0 -1
- package/dist/commands/admin-legacy-audit.js +0 -57
- package/dist/commands/admin-legacy-audit.js.map +0 -1
- package/dist/commands/admin-legacy-inventory.d.ts +0 -27
- package/dist/commands/admin-legacy-inventory.d.ts.map +0 -1
- package/dist/commands/admin-legacy-inventory.js +0 -37
- package/dist/commands/admin-legacy-inventory.js.map +0 -1
- package/dist/commands/admin-migrate-networks.d.ts +0 -15
- package/dist/commands/admin-migrate-networks.d.ts.map +0 -1
- package/dist/commands/admin-migrate-networks.js +0 -15
- package/dist/commands/admin-migrate-networks.js.map +0 -1
- package/dist/commands/admin-reconcile-routes.d.ts +0 -18
- package/dist/commands/admin-reconcile-routes.d.ts.map +0 -1
- package/dist/commands/admin-reconcile-routes.js +0 -22
- package/dist/commands/admin-reconcile-routes.js.map +0 -1
- package/templates/capsule/src/lib/ai-client.ts +0 -193
- package/templates/capsule/src/lib/ai.ts +0 -15
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
import { capDiagnosticText } from "../log-excerpt.js";
|
|
2
|
+
import { buildProblemToRecoveryProblem, isFixableBuildProblem, recoveryAsk, recoveryEnv, recoveryFixProblems, recoveryInspectBuildLog, } from "../recovery.js";
|
|
3
|
+
import { envKeyList, isSafeRelativePath } from "../untrusted.js";
|
|
4
|
+
import { stagePhase, stageSentence } from "./doctor-evidence.js";
|
|
5
|
+
const BUILD_PROBLEM_CODE = /^[a-z][a-z0-9-]{0,63}$/;
|
|
6
|
+
const MAX_EVIDENCE_PROBLEMS = 10;
|
|
7
|
+
/**
|
|
8
|
+
* Build errors a `fix_problems` list cannot carry because they name no file an
|
|
9
|
+
* agent can open (`missing-module` by bare name, `missing-build-env`). Their
|
|
10
|
+
* own words and hint are the actionable part, so they ride in the evidence;
|
|
11
|
+
* the text is parsed out of a build log, so it is diagnostic only.
|
|
12
|
+
*/
|
|
13
|
+
function unfixableBuildErrors(problems) {
|
|
14
|
+
const entries = (problems ?? [])
|
|
15
|
+
.filter((p) => p.severity !== "warning" && !isFixableBuildProblem(p))
|
|
16
|
+
.slice(0, MAX_EVIDENCE_PROBLEMS)
|
|
17
|
+
.map((p) => ({
|
|
18
|
+
code: BUILD_PROBLEM_CODE.test(p.code) ? p.code : "build",
|
|
19
|
+
detail: buildProblemToRecoveryProblem(p).detail ?? "",
|
|
20
|
+
}));
|
|
21
|
+
return entries.length > 0 ? { buildProblems: entries } : {};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Everything deploy mode knows about a failed build, as evidence: the matched
|
|
25
|
+
* class's own advice, file-less build errors and the masked log excerpt. The
|
|
26
|
+
* advice is Percher-authored but chosen by matching build output, and the
|
|
27
|
+
* classifier quotes a module name from the log into it, so it is diagnostic.
|
|
28
|
+
*/
|
|
29
|
+
export function deployEvidence(vctx, advice) {
|
|
30
|
+
const files = (advice?.relevantFiles ?? []).filter((f) => isSafeRelativePath(f));
|
|
31
|
+
const evidence = {
|
|
32
|
+
...(advice ? { buildCause: advice.cause } : {}),
|
|
33
|
+
...(advice?.suggestion ? { buildSuggestion: capDiagnosticText(advice.suggestion) } : {}),
|
|
34
|
+
...(files.length > 0 ? { relevantFiles: files } : {}),
|
|
35
|
+
...unfixableBuildErrors(vctx.buildProblems),
|
|
36
|
+
...(vctx.buildLogExcerpt?.length ? { buildLogExcerpt: vctx.buildLogExcerpt } : {}),
|
|
37
|
+
};
|
|
38
|
+
return Object.keys(evidence).length > 0 ? { evidence } : {};
|
|
39
|
+
}
|
|
40
|
+
/** A class the log names as the platform's, which no platform code confirmed. */
|
|
41
|
+
const UNCONFIRMED_PLATFORM = {
|
|
42
|
+
question: "The build log points at a temporary problem on Percher's side, but that is not confirmed, and repeated failed publishes can suspend the app. Should I wait a few minutes, check https://status.percher.app, and then publish once more?",
|
|
43
|
+
options: ["wait, then publish once more", "cancel"],
|
|
44
|
+
reasonCode: "unknown",
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* One fixed question per failure type: the 27 regex classifier causes and the
|
|
48
|
+
* causes of the build codes that hand deploy mode back to the log
|
|
49
|
+
* (BUILD_FAILED, BUILD_TIMEOUT, CANARY_FAILED). The cause is a literal from
|
|
50
|
+
* Percher's own tables, so it only picks which text is shown; nothing from
|
|
51
|
+
* the log is copied in. A test pins the set against the classifier source.
|
|
52
|
+
*/
|
|
53
|
+
export const BUILD_CAUSE_QUESTIONS = {
|
|
54
|
+
pb_provision_failed: UNCONFIRMED_PLATFORM,
|
|
55
|
+
deploy_stalled: UNCONFIRMED_PLATFORM,
|
|
56
|
+
upstream_unreachable: UNCONFIRMED_PLATFORM,
|
|
57
|
+
bad_gateway: UNCONFIRMED_PLATFORM,
|
|
58
|
+
box_admission_rejected: UNCONFIRMED_PLATFORM,
|
|
59
|
+
cert_issuance_pending: {
|
|
60
|
+
question: "Percher recorded a failed post-deploy check. The output mentions a connection problem, which does not establish its cause. Should I re-run diagnostics and try the public URL, then contact support if the problem persists?",
|
|
61
|
+
options: ["re-run diagnostics and check the URL", "contact support"],
|
|
62
|
+
reasonCode: "unknown",
|
|
63
|
+
requires: { stages: ["canary"], message: true },
|
|
64
|
+
title: "Post-deploy check failed",
|
|
65
|
+
explanation: "Percher recorded a failed post-deploy check. The output mentions a connection problem; the probe's cause is not confirmed.",
|
|
66
|
+
},
|
|
67
|
+
app_data_mount_conflict: {
|
|
68
|
+
question: "The container did not start, and the error says the image has a file (or a link to one) at /app or /app/data, where Percher mounts the app's persistent data. Retrying unchanged fails the same way. Should I move the binary out of /app (for example to /usr/local/bin/app, updating ENTRYPOINT/CMD) or rename a root-level file named `data`, then publish again?",
|
|
69
|
+
options: ["move the file and publish again", "cancel"],
|
|
70
|
+
reasonCode: "app_data_mount_conflict",
|
|
71
|
+
requires: { stages: ["start"] },
|
|
72
|
+
},
|
|
73
|
+
container_spec_rejected: {
|
|
74
|
+
question: "The output mentions a rejected container configuration. Should I check ENTRYPOINT/CMD in the Dockerfile, or [web].command and [resources] in percher.toml, against the error before publishing again?",
|
|
75
|
+
options: ["check the start command and [resources], then publish again", "cancel"],
|
|
76
|
+
title: "Output mentions a container configuration problem",
|
|
77
|
+
explanation: "The output mentions a rejected container configuration; it does not establish who rejected it or which step failed.",
|
|
78
|
+
},
|
|
79
|
+
plan_pool_exceeded: {
|
|
80
|
+
question: "This deploy needs more RAM, vCPU or disk than the account's plan allows across all its apps. Retrying unchanged fails the same way. Should I reduce [resources] in percher.toml, put another app to sleep, or upgrade the plan at https://percher.app/account/billing?",
|
|
81
|
+
options: ["reduce [resources]", "sleep another app", "upgrade", "cancel"],
|
|
82
|
+
reasonCode: "quota_exceeded",
|
|
83
|
+
requires: { code: "PLAN_POOL_EXCEEDED" },
|
|
84
|
+
},
|
|
85
|
+
missing_start_command: {
|
|
86
|
+
question: 'The output says no start command was found. Should I add a "start" script to package.json (for example "node index.js") or set [web].command in percher.toml, then publish again?',
|
|
87
|
+
options: ["add a start command and publish again", "cancel"],
|
|
88
|
+
},
|
|
89
|
+
build_timeout: {
|
|
90
|
+
question: "The build ran past the platform's time limit. Should I find the slow step in the log excerpt in this result's diagnosis.evidence (a slow postinstall hook, a very large dependency tree or a large base image), make it faster, then publish again?",
|
|
91
|
+
questionWithoutExcerpt: "The build ran past the platform's time limit. No build log was available. Should I find the slow step by running the build locally (a slow postinstall hook, a very large dependency tree or a large base image), make it faster, then publish again?",
|
|
92
|
+
options: ["find the slow step and publish again", "cancel"],
|
|
93
|
+
requires: { code: "BUILD_TIMEOUT" },
|
|
94
|
+
},
|
|
95
|
+
command_not_found: {
|
|
96
|
+
question: 'The output shows a command (such as bun or node) that was not found; it can come from the build script or the start script. Should I check that runtime in percher.toml matches what the scripts in package.json use (runtime = "bun" if they use bun), then publish again?',
|
|
97
|
+
options: ["fix the runtime or the scripts and publish again", "cancel"],
|
|
98
|
+
},
|
|
99
|
+
privileged_port: {
|
|
100
|
+
question: "The output shows an attempt to listen on port 80 or 443, which a non-root container cannot use. Should I change the server to listen on process.env.PORT, which Percher sets, then publish again?",
|
|
101
|
+
options: ["listen on process.env.PORT and publish again", "cancel"],
|
|
102
|
+
},
|
|
103
|
+
port_in_use: {
|
|
104
|
+
question: "The output shows a port that was already in use. Should I make the app start one web server only, listening on process.env.PORT, which Percher sets, then publish again?",
|
|
105
|
+
options: ["listen on process.env.PORT and publish again", "cancel"],
|
|
106
|
+
},
|
|
107
|
+
rootless_fs_write: {
|
|
108
|
+
question: "The output shows a write to a path that is read-only in Percher's non-root container (for example nginx writing /var/log, or a chown in a script). Should I redirect those writes to /tmp, drop the chown step, or switch to a base image built for non-root use, then publish again?",
|
|
109
|
+
options: ["move the writes and publish again", "cancel"],
|
|
110
|
+
},
|
|
111
|
+
missing_npm_script: {
|
|
112
|
+
question: "The output says an npm script that package.json does not define was run; it can be the build script or the start script, and the name the output gives is in this result's diagnosis.explanation. Should I check which scripts the build and start commands run, add or rename the missing one in package.json's \"scripts\", then publish again?",
|
|
113
|
+
options: ["fix the script and publish again", "cancel"],
|
|
114
|
+
},
|
|
115
|
+
module_not_found: {
|
|
116
|
+
question: "A module the app imports could not be found. It can be a package or a local file, and the log does not say which file to change. Should I check that the package is a runtime dependency (not only a dev dependency) and that the import path exists with the same upper and lower case, then publish again?",
|
|
117
|
+
options: ["check the imports and publish again", "cancel"],
|
|
118
|
+
},
|
|
119
|
+
// A kill in the output of a deploy that failed after its build step.
|
|
120
|
+
out_of_memory: {
|
|
121
|
+
question: "The deploy failed after the build step, and the output shows a process killed for memory; [resources].memory sets the running app's limit. Should I raise [resources].memory in percher.toml and publish again, look for what uses the memory, or upgrade the plan for more memory?",
|
|
122
|
+
options: ["raise [resources].memory", "look for a memory leak", "upgrade plan"],
|
|
123
|
+
requires: { stages: ["start", "health", "canary"] },
|
|
124
|
+
},
|
|
125
|
+
// A kill in the output of a failed build step. [resources].memory sets the
|
|
126
|
+
// running app's limit, not the build's, so it is not offered here.
|
|
127
|
+
out_of_memory_build: {
|
|
128
|
+
question: "The build step failed, and its output shows a process killed for memory. The app's [resources].memory setting applies to the running app, not to the build. Should I make the build need less memory (for example fewer parallel steps, a lighter bundler configuration, or moving heavy work out of the build), then publish again?",
|
|
129
|
+
options: ["reduce the build's memory use and publish again", "cancel"],
|
|
130
|
+
requires: { stages: ["build"] },
|
|
131
|
+
},
|
|
132
|
+
// A kill with no recorded step: the phase is not known.
|
|
133
|
+
out_of_memory_unknown_phase: {
|
|
134
|
+
question: "The log shows a process killed for memory, but not whether it was the build or the running app. The app's [resources].memory setting applies only to the running app. Should I check the log excerpt in this result's diagnosis.evidence to see which step was killed before changing anything?",
|
|
135
|
+
questionWithoutExcerpt: "A process was killed for memory, but not whether it was the build or the running app. The app's [resources].memory setting applies only to the running app. Should I run the build locally to see whether it runs out of memory before changing anything?",
|
|
136
|
+
options: ["check which step was killed", "cancel"],
|
|
137
|
+
},
|
|
138
|
+
pocketbase_failure: {
|
|
139
|
+
title: "Output mentions a database connection problem",
|
|
140
|
+
explanation: "The output mentions PocketBase starting or connecting; it does not establish a managed-database failure.",
|
|
141
|
+
question: "The output mentions a PocketBase connection problem. If this app uses managed PocketBase, should I check its configured data mode and use of POCKETBASE_URL? Otherwise, should I investigate why its output mentions PocketBase before changing anything?",
|
|
142
|
+
options: ["investigate the database reference and configuration", "cancel"],
|
|
143
|
+
},
|
|
144
|
+
env_not_set: {
|
|
145
|
+
question: "The log matches a required environment variable that is not set. The log's own words are in this result's diagnosis.evidence. Which variable should I set with percher_env_set before publishing again?",
|
|
146
|
+
questionWithoutExcerpt: "The log matches a required environment variable that is not set. Which variable should I set with percher_env_set before publishing again?",
|
|
147
|
+
options: ["name the variable to set", "cancel"],
|
|
148
|
+
reasonCode: "missing_env",
|
|
149
|
+
},
|
|
150
|
+
connection_refused: {
|
|
151
|
+
question: "The output shows a connection to a service that was refused. Should I check the database and API URLs it uses (Percher provides POCKETBASE_URL for the managed database), then publish again?",
|
|
152
|
+
options: ["check the connection settings and publish again", "cancel"],
|
|
153
|
+
},
|
|
154
|
+
syntax_error: {
|
|
155
|
+
question: "The log matches a syntax error in the app's code. Running the build locally usually shows the same error. Should I find and fix it, then publish again?",
|
|
156
|
+
options: ["fix the syntax error and publish again", "cancel"],
|
|
157
|
+
},
|
|
158
|
+
dependency_resolution: {
|
|
159
|
+
question: "A dependency could not be resolved. Should I check package.json for a misspelled package name or a version that does not exist, run the install locally, then publish again?",
|
|
160
|
+
options: ["fix the dependency and publish again", "cancel"],
|
|
161
|
+
},
|
|
162
|
+
build_command_failed: {
|
|
163
|
+
question: "The build command failed. Should I run the build locally to reproduce the error, fix it, then publish again?",
|
|
164
|
+
options: ["reproduce locally and publish again", "cancel"],
|
|
165
|
+
requires: { stages: ["build"] },
|
|
166
|
+
},
|
|
167
|
+
build_nonzero_exit: {
|
|
168
|
+
requires: { stages: ["build"] },
|
|
169
|
+
question: "The build exited with an error. Should I run the build locally (for example bun install && bun run build) to reproduce it, using the log excerpt in this result's diagnosis.evidence, fix it, then publish again?",
|
|
170
|
+
questionWithoutExcerpt: "The build exited with an error. No build log was available. Should I run the build locally (for example bun install && bun run build) to reproduce it, fix it, then publish again?",
|
|
171
|
+
options: ["reproduce locally and publish again", "cancel"],
|
|
172
|
+
},
|
|
173
|
+
typescript_error: {
|
|
174
|
+
question: "TypeScript compilation failed. Should I run npx tsc --noEmit locally to list the errors, fix them, then publish again?",
|
|
175
|
+
options: ["fix the type errors and publish again", "cancel"],
|
|
176
|
+
},
|
|
177
|
+
file_permission: {
|
|
178
|
+
question: "The app was denied access to a file or resource. Should I check the file permissions and, in a Dockerfile, make sure the app runs as a non-root user that owns the files it writes, then publish again?",
|
|
179
|
+
options: ["fix the permissions and publish again", "cancel"],
|
|
180
|
+
},
|
|
181
|
+
timeout: {
|
|
182
|
+
question: "The app started but did not answer its health check in time. Should I make sure it listens on process.env.PORT and that its health path ([web].health in percher.toml, default /) returns HTTP 200, then publish again?",
|
|
183
|
+
options: ["fix the port or health path and publish again", "cancel"],
|
|
184
|
+
requires: { stages: ["health"] },
|
|
185
|
+
},
|
|
186
|
+
canary_failed: {
|
|
187
|
+
requires: { stages: ["canary"] },
|
|
188
|
+
title: "Post-deploy check failed",
|
|
189
|
+
explanation: "Percher recorded a failed post-deploy check; this alone does not establish the responder or the cause.",
|
|
190
|
+
question: "Percher recorded a failed post-deploy check. Should I compare the public URL's response with the log excerpt in this result's diagnosis.evidence to investigate the cause before changing or publishing anything?",
|
|
191
|
+
questionWithoutExcerpt: "Percher recorded a failed post-deploy check. No build log was available. Should I re-run diagnostics and check the public URL to investigate the cause before changing or publishing anything?",
|
|
192
|
+
options: ["investigate the response", "cancel"],
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
/** Failure types a file-less build error names by its own (closed) code. */
|
|
196
|
+
const PROBLEM_CODE_CAUSES = {
|
|
197
|
+
"missing-module": "module_not_found",
|
|
198
|
+
"missing-build-env": "env_not_set",
|
|
199
|
+
"syntax-error": "syntax_error",
|
|
200
|
+
"ts-error": "typescript_error",
|
|
201
|
+
};
|
|
202
|
+
/** Causes the log calls the platform's; a platform code outranks that claim. */
|
|
203
|
+
const PLATFORM_CLAIM_CAUSES = new Set([
|
|
204
|
+
"pb_provision_failed",
|
|
205
|
+
"deploy_stalled",
|
|
206
|
+
"upstream_unreachable",
|
|
207
|
+
"bad_gateway",
|
|
208
|
+
"box_admission_rejected",
|
|
209
|
+
]);
|
|
210
|
+
/**
|
|
211
|
+
* What a log-only platform class may say. The classifier's own text asserts
|
|
212
|
+
* a platform fault ("not your app", "a platform incident"); the log is
|
|
213
|
+
* tenant output and no platform code confirmed it, so doctor shows this
|
|
214
|
+
* instead, consistent with UNCONFIRMED_PLATFORM's question.
|
|
215
|
+
*/
|
|
216
|
+
const UNCONFIRMED_PLATFORM_TEXT = {
|
|
217
|
+
title: "Deploy failed, possibly on Percher's side",
|
|
218
|
+
explanation: "The build log mentions a problem that may be on Percher's side. That is not confirmed.",
|
|
219
|
+
suggestion: "Wait a few minutes and publish once more. If it fails again, check https://status.percher.app or contact support.",
|
|
220
|
+
};
|
|
221
|
+
const questionFor = (cause) => Object.hasOwn(BUILD_CAUSE_QUESTIONS, cause) ? BUILD_CAUSE_QUESTIONS[cause] : undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Whether the structured evidence a question's words need is there. The only
|
|
224
|
+
* place a question's assertions are checked; a question without `requires`
|
|
225
|
+
* asserts nothing that needs it.
|
|
226
|
+
*/
|
|
227
|
+
function questionBacked(cause, vctx) {
|
|
228
|
+
const q = questionFor(cause);
|
|
229
|
+
if (!q)
|
|
230
|
+
return false;
|
|
231
|
+
const r = q.requires;
|
|
232
|
+
if (!r)
|
|
233
|
+
return true;
|
|
234
|
+
const stage = vctx.failedStage;
|
|
235
|
+
if (!stage || (r.stages && !r.stages.includes(stage)))
|
|
236
|
+
return false;
|
|
237
|
+
if (r.code && vctx.codedDeployFailure?.errorCode !== r.code)
|
|
238
|
+
return false;
|
|
239
|
+
return !r.message || vctx.messageCause === cause;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* The log's class, only where its question's assertions are backed. The
|
|
243
|
+
* class is chosen by matching tenant output (and a message the API may have
|
|
244
|
+
* derived from it), so it describes what the output shows; the step comes
|
|
245
|
+
* from `failedStage` alone.
|
|
246
|
+
*/
|
|
247
|
+
function trustedBuildClass(vctx) {
|
|
248
|
+
const cls = vctx.buildLogClassification;
|
|
249
|
+
if (!cls)
|
|
250
|
+
return null;
|
|
251
|
+
if (PLATFORM_CLAIM_CAUSES.has(cls.cause)) {
|
|
252
|
+
if (vctx.codedDeployFailure)
|
|
253
|
+
return null;
|
|
254
|
+
return { ...cls, ...UNCONFIRMED_PLATFORM_TEXT };
|
|
255
|
+
}
|
|
256
|
+
const phased = withMemoryPhase(vctx, cls);
|
|
257
|
+
if (!questionBacked(phased.cause, vctx))
|
|
258
|
+
return null;
|
|
259
|
+
const q = questionFor(phased.cause);
|
|
260
|
+
return {
|
|
261
|
+
...phased,
|
|
262
|
+
...(q?.title ? { title: q.title } : {}),
|
|
263
|
+
...(q?.explanation ? { explanation: q.explanation } : {}),
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* The advice deploy mode acts on: the log's class first (where it may choose),
|
|
268
|
+
* then a file-less build error's code, then the build code's own type, each
|
|
269
|
+
* only when its question is backed.
|
|
270
|
+
*/
|
|
271
|
+
function failureAdvice(vctx) {
|
|
272
|
+
const cls = trustedBuildClass(vctx);
|
|
273
|
+
if (cls)
|
|
274
|
+
return cls;
|
|
275
|
+
const coded = vctx.codedDeployFailure;
|
|
276
|
+
const problemCause = (vctx.buildProblems ?? [])
|
|
277
|
+
.filter((p) => p.severity !== "warning" && !isFixableBuildProblem(p))
|
|
278
|
+
.map((p) => (Object.hasOwn(PROBLEM_CODE_CAUSES, p.code) ? PROBLEM_CODE_CAUSES[p.code] : null))
|
|
279
|
+
.find((c) => !!c);
|
|
280
|
+
if (problemCause) {
|
|
281
|
+
return {
|
|
282
|
+
// The code's title names its step: only when the recorded step agrees.
|
|
283
|
+
title: coded && questionBacked(coded.cause, vctx) ? coded.title : "Last deploy failed",
|
|
284
|
+
cause: problemCause,
|
|
285
|
+
suggestion: coded?.suggestion ?? "",
|
|
286
|
+
relevantFiles: [],
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
if (!coded || !questionBacked(coded.cause, vctx))
|
|
290
|
+
return null;
|
|
291
|
+
const q = questionFor(coded.cause);
|
|
292
|
+
return {
|
|
293
|
+
...coded,
|
|
294
|
+
title: q?.title ?? coded.title,
|
|
295
|
+
explanation: q?.explanation ?? coded.explanation,
|
|
296
|
+
relevantFiles: [],
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* An out-of-memory kill is advised by the step that failed, as the platform
|
|
301
|
+
* recorded it: the build, a step after it (the running app), or unknown.
|
|
302
|
+
*/
|
|
303
|
+
function withMemoryPhase(vctx, advice) {
|
|
304
|
+
if (advice.cause !== "out_of_memory")
|
|
305
|
+
return advice;
|
|
306
|
+
const stage = vctx.failedStage;
|
|
307
|
+
if (stage === "build")
|
|
308
|
+
return { ...advice, cause: "out_of_memory_build" };
|
|
309
|
+
if (stage === "start" || stage === "health" || stage === "canary")
|
|
310
|
+
return advice;
|
|
311
|
+
return { ...advice, cause: "out_of_memory_unknown_phase" };
|
|
312
|
+
}
|
|
313
|
+
/** A script or command name the output gives, as an observation (closed shapes only). */
|
|
314
|
+
function namedInOutput(cause, excerpt) {
|
|
315
|
+
const text = (excerpt ?? []).join("\n");
|
|
316
|
+
if (cause === "missing_npm_script") {
|
|
317
|
+
const name = text.match(/missing script:?\s*["']?([A-Za-z0-9:._@/-]{1,64})["']?/i)?.[1];
|
|
318
|
+
return name ? ` The output names the npm script "${name}".` : "";
|
|
319
|
+
}
|
|
320
|
+
if (cause === "command_not_found") {
|
|
321
|
+
const name = text.match(/\b(bun|node|npm|yarn|pnpm)(?:\.exe)?: (?:command )?not found/i)?.[1];
|
|
322
|
+
return name ? ` The output names the command "${name.toLowerCase()}".` : "";
|
|
323
|
+
}
|
|
324
|
+
return "";
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* The fixed question for a known failure type, with the whole build log still
|
|
328
|
+
* one call away as an alternative. Null for a cause without a question, or
|
|
329
|
+
* one whose assertions the evidence does not back.
|
|
330
|
+
*/
|
|
331
|
+
function causeRecovery(vctx, cause) {
|
|
332
|
+
const q = questionFor(cause);
|
|
333
|
+
if (!q || !questionBacked(cause, vctx))
|
|
334
|
+
return null;
|
|
335
|
+
const hasExcerpt = (vctx.buildLogExcerpt?.length ?? 0) > 0;
|
|
336
|
+
const ask = recoveryAsk({
|
|
337
|
+
prompt: hasExcerpt ? q.question : (q.questionWithoutExcerpt ?? q.question),
|
|
338
|
+
options: q.options,
|
|
339
|
+
reasonCode: q.reasonCode ?? "build_failed",
|
|
340
|
+
});
|
|
341
|
+
const inspect = recoveryInspectBuildLog({ app: vctx.appName, deployId: vctx.lastDeployId });
|
|
342
|
+
if (inspect.nextAction !== "inspect_build_log")
|
|
343
|
+
return ask;
|
|
344
|
+
return {
|
|
345
|
+
...ask,
|
|
346
|
+
alternativeActions: [
|
|
347
|
+
{
|
|
348
|
+
action: "inspect_build_log",
|
|
349
|
+
suggestedTool: inspect.suggestedTool,
|
|
350
|
+
args: inspect.args,
|
|
351
|
+
when: hasExcerpt
|
|
352
|
+
? "the log excerpt in diagnosis.evidence is not enough and you want the whole build log"
|
|
353
|
+
: "you want to try reading the whole build log",
|
|
354
|
+
},
|
|
355
|
+
],
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
const failedInDeployMode = (vctx) => vctx.lastDeployStatus === "failed" && vctx.inputMode === "deploy";
|
|
359
|
+
/** A diagnostic explanation, capped, followed by the step Percher recorded (or that it recorded none). */
|
|
360
|
+
const withStage = (vctx, text) => `${capDiagnosticText(text)} ${stageSentence(vctx.failedStage)}`;
|
|
361
|
+
/**
|
|
362
|
+
* The mode='deploy' rules after the coded one, most- to least-actionable. The
|
|
363
|
+
* build log and the deployment were fetched in doctor(); these only read them.
|
|
364
|
+
* The step named in titles, explanations and `phase` is the recorded one
|
|
365
|
+
* (doctor-evidence.ts); the log only says what the output shows.
|
|
366
|
+
*/
|
|
367
|
+
export const DEPLOY_BUILD_RULES = [
|
|
368
|
+
// (a) Missing env keys named by the log. The names are shown, never passed
|
|
369
|
+
// as tool args: only a platform code may name the keys.
|
|
370
|
+
{
|
|
371
|
+
id: "deploy-failed-missing-env",
|
|
372
|
+
when: ({ vctx }) => {
|
|
373
|
+
const cls = vctx.buildLogClassification;
|
|
374
|
+
return (failedInDeployMode(vctx) &&
|
|
375
|
+
!!cls &&
|
|
376
|
+
cls.errorClass === "missing_env" &&
|
|
377
|
+
cls.missingEnvVars.length > 0);
|
|
378
|
+
},
|
|
379
|
+
verdict: ({ vctx }) => {
|
|
380
|
+
const cls = vctx.buildLogClassification;
|
|
381
|
+
const names = envKeyList(cls.missingEnvVars).join(", ");
|
|
382
|
+
return {
|
|
383
|
+
status: "needs_action",
|
|
384
|
+
diagnosis: {
|
|
385
|
+
title: cls.title,
|
|
386
|
+
explanation: withStage(vctx, cls.explanation),
|
|
387
|
+
reasonCode: "missing_env",
|
|
388
|
+
phase: stagePhase(vctx.failedStage),
|
|
389
|
+
...deployEvidence(vctx, cls),
|
|
390
|
+
},
|
|
391
|
+
recovery: recoveryEnv({ app: vctx.appName, keys: [] }),
|
|
392
|
+
summary: vctx.appName
|
|
393
|
+
? `Deploy failed — the log mentions missing env vars on ${vctx.appName}: ${names}.`
|
|
394
|
+
: `Deploy failed — the log mentions missing env vars: ${names}.`,
|
|
395
|
+
};
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
// (b) Build errors with a file to open → fix_problems. Warnings never count
|
|
399
|
+
// (isFixableBuildProblem); `buildProblemToRecoveryProblem` folds each hint
|
|
400
|
+
// into `detail`.
|
|
401
|
+
{
|
|
402
|
+
id: "deploy-failed-file-problems",
|
|
403
|
+
when: ({ vctx }) => failedInDeployMode(vctx) && (vctx.buildProblems ?? []).some(isFixableBuildProblem),
|
|
404
|
+
verdict: ({ vctx }) => {
|
|
405
|
+
const cls = trustedBuildClass(vctx);
|
|
406
|
+
const fileProblems = (vctx.buildProblems ?? [])
|
|
407
|
+
.filter(isFixableBuildProblem)
|
|
408
|
+
.map(buildProblemToRecoveryProblem);
|
|
409
|
+
const plural = fileProblems.length === 1 ? "" : "s";
|
|
410
|
+
return {
|
|
411
|
+
status: "needs_action",
|
|
412
|
+
diagnosis: {
|
|
413
|
+
title: cls?.title ?? "Deploy failed with file-located problems",
|
|
414
|
+
explanation: withStage(vctx, cls?.explanation ??
|
|
415
|
+
`Percher found ${fileProblems.length} problem${plural} with file locations. Patch the files directly.`),
|
|
416
|
+
reasonCode: "build_failed",
|
|
417
|
+
phase: stagePhase(vctx.failedStage),
|
|
418
|
+
...deployEvidence(vctx, cls),
|
|
419
|
+
},
|
|
420
|
+
recovery: recoveryFixProblems({ problems: fileProblems, reasonCode: "build_failed" }),
|
|
421
|
+
summary: vctx.lastDeployId
|
|
422
|
+
? `Deploy ${vctx.lastDeployId} failed — ${fileProblems.length} structured problem${plural} to patch.`
|
|
423
|
+
: `Deploy failed — ${fileProblems.length} structured problem${plural} to patch.`,
|
|
424
|
+
};
|
|
425
|
+
},
|
|
426
|
+
},
|
|
427
|
+
// (c) Anything else. A known failure type gets its fixed question and
|
|
428
|
+
// Percher's own advice as evidence; an unknown one, or one whose question
|
|
429
|
+
// the evidence does not back, is handed to the build log. Both carry the
|
|
430
|
+
// masked log excerpt.
|
|
431
|
+
{
|
|
432
|
+
id: "deploy-failed-inspect-log",
|
|
433
|
+
when: ({ vctx }) => failedInDeployMode(vctx),
|
|
434
|
+
verdict: ({ vctx }) => {
|
|
435
|
+
const advice = failureAdvice(vctx);
|
|
436
|
+
const asked = advice ? causeRecovery(vctx, advice.cause) : null;
|
|
437
|
+
const deploy = vctx.lastDeployId ? `Deploy ${vctx.lastDeployId}` : "The last deploy";
|
|
438
|
+
const hasExcerpt = (vctx.buildLogExcerpt?.length ?? 0) > 0;
|
|
439
|
+
const said = advice?.explanation;
|
|
440
|
+
const named = advice ? namedInOutput(advice.cause, vctx.buildLogExcerpt) : "";
|
|
441
|
+
const recovery = asked ??
|
|
442
|
+
recoveryInspectBuildLog({
|
|
443
|
+
deployId: vctx.lastDeployId,
|
|
444
|
+
app: vctx.appName,
|
|
445
|
+
reasonCode: "build_failed",
|
|
446
|
+
});
|
|
447
|
+
return {
|
|
448
|
+
status: "needs_action",
|
|
449
|
+
diagnosis: {
|
|
450
|
+
title: advice?.title ?? "Last deploy failed",
|
|
451
|
+
explanation: said
|
|
452
|
+
? `${withStage(vctx, said)}${named} ${hasExcerpt
|
|
453
|
+
? "Percher's advice for this failure and a log excerpt are in diagnosis.evidence."
|
|
454
|
+
: "No build log was available."}`
|
|
455
|
+
: hasExcerpt
|
|
456
|
+
? `${deploy} terminated in failed state. ${stageSentence(vctx.failedStage)} Doctor couldn't classify the cause from the build log; the excerpt in diagnosis.evidence is the deploy's own output.`
|
|
457
|
+
: `${deploy} terminated in failed state. ${stageSentence(vctx.failedStage)} Doctor couldn't classify the cause, and no build log was available.`,
|
|
458
|
+
reasonCode: recovery.reasonCode,
|
|
459
|
+
phase: stagePhase(vctx.failedStage),
|
|
460
|
+
...deployEvidence(vctx, advice),
|
|
461
|
+
},
|
|
462
|
+
recovery,
|
|
463
|
+
summary: asked
|
|
464
|
+
? `${deploy} failed: ${advice?.title ?? "deploy failed"}.`
|
|
465
|
+
: `${deploy} failed — inspect the build log.`,
|
|
466
|
+
};
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
];
|
|
470
|
+
//# sourceMappingURL=doctor-build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-build.js","sourceRoot":"","sources":["../../src/commands/doctor-build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EAGrB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAoB,UAAU,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKhF,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AACpD,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,QAAoC;IAChE,MAAM,OAAO,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;SAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;SACpE,KAAK,CAAC,CAAC,EAAE,qBAAqB,CAAC;SAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAA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AAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9E,MAAM,QAAQ,GACZ,KAAK;gBACL,uBAAuB,CAAC;oBACtB,QAAQ,EAAE,IAAI,CAAC,YAAY;oBAC3B,GAAG,EAAE,IAAI,CAAC,OAAO;oBACjB,UAAU,EAAE,cAAc;iBAC3B,CAAC,CAAC;YACL,OAAO;gBACL,MAAM,EAAE,cAAc;gBACtB,SAAS,EAAE;oBACT,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,oBAAoB;oBAC5C,WAAW,EAAE,IAAI;wBACf,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,KAAK,IAC9B,UAAU;4BACR,CAAC,CAAC,gFAAgF;4BAClF,CAAC,CAAC,6BACN,EAAE;wBACJ,CAAC,CAAC,UAAU;4BACV,CAAC,CAAC,GAAG,MAAM,gCAAgC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,uHAAuH;4BACjM,CAAC,CAAC,GAAG,MAAM,gCAAgC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,sEAAsE;oBACpJ,UAAU,EAAE,QAAQ,CAAC,UAAU;oBAC/B,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC;oBACnC,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC;iBAChC;gBACD,QAAQ;gBACR,OAAO,EAAE,KAAK;oBACZ,CAAC,CAAC,GAAG,MAAM,YAAY,MAAM,EAAE,KAAK,IAAI,eAAe,GAAG;oBAC1D,CAAC,CAAC,GAAG,MAAM,kCAAkC;aAChD,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Deployment } from "@percher/client";
|
|
2
|
+
import type { DoctorPhase } from "./doctor.js";
|
|
3
|
+
/**
|
|
4
|
+
* What the doctor may ASSERT, and from what.
|
|
5
|
+
*
|
|
6
|
+
* A verdict, title, explanation or fixed question may say that a deploy step
|
|
7
|
+
* was reached or failed, who produced a response, or whether the app is
|
|
8
|
+
* served, only from structured platform evidence: a platform error code together
|
|
9
|
+
* with a compatible failed stage, or a probe field platform code sets.
|
|
10
|
+
* Text a tenant's build or app can print, including text the API derived from
|
|
11
|
+
* it into `errorMessage`, is never such evidence. Without it the doctor states
|
|
12
|
+
* what it observed and asks a question that names no step.
|
|
13
|
+
*/
|
|
14
|
+
/** The deploy step a failed deployment failed in. */
|
|
15
|
+
export type FailedStage = "build" | "start" | "health" | "canary";
|
|
16
|
+
export declare const hasStepCode: (code: string) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The failed step, from the deployment's platform code and the stage timeline
|
|
19
|
+
* the deploy GET returns (`events`, written by the pipeline when the step
|
|
20
|
+
* fails; its free-text message is not read). Both must agree. Missing or
|
|
21
|
+
* conflicting evidence is unknown, never a step.
|
|
22
|
+
*/
|
|
23
|
+
export declare function failedStageOf(deployment: Pick<Deployment, "errorCode" | "events">): FailedStage | null;
|
|
24
|
+
/** One sentence naming the verified step, or saying it could not be verified. */
|
|
25
|
+
export declare function stageSentence(stage: FailedStage | null | undefined): string;
|
|
26
|
+
/** The diagnosis phase a failed deploy may claim: `build` only when the build step failed. */
|
|
27
|
+
export declare function stagePhase(stage: FailedStage | null | undefined): DoctorPhase;
|
|
28
|
+
/**
|
|
29
|
+
* What the public probe observed. `restricted` records the configured access,
|
|
30
|
+
* not who answered this unauthenticated probe. `unfinished`: a response arrived without a final
|
|
31
|
+
* status. `unknown`: an older API that cannot tell no response from one.
|
|
32
|
+
*/
|
|
33
|
+
export type RouteObservation = {
|
|
34
|
+
kind: "not_probed";
|
|
35
|
+
} | {
|
|
36
|
+
kind: "restricted";
|
|
37
|
+
status: number | null;
|
|
38
|
+
responded: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "ok";
|
|
41
|
+
} | {
|
|
42
|
+
kind: "status";
|
|
43
|
+
status: number;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "unfinished";
|
|
46
|
+
} | {
|
|
47
|
+
kind: "no_response";
|
|
48
|
+
} | {
|
|
49
|
+
kind: "unknown";
|
|
50
|
+
};
|
|
51
|
+
export interface RouteFacts {
|
|
52
|
+
publicRouteHealthy?: boolean;
|
|
53
|
+
/** Validated 100-599, or null. */
|
|
54
|
+
publicRouteStatus?: number | null;
|
|
55
|
+
publicRouteResponded?: boolean;
|
|
56
|
+
publicRouteAccess?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare function routeObservation(v: RouteFacts): RouteObservation;
|
|
59
|
+
/** True when an HTTP response arrived: the address is reachable, whoever answered. */
|
|
60
|
+
export declare function responseArrived(o: RouteObservation): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* One sentence (with a leading space) stating what the public probe observed,
|
|
63
|
+
* or "" when it did not run. It never identifies the responder or infers
|
|
64
|
+
* that nothing serves the app.
|
|
65
|
+
*/
|
|
66
|
+
export declare function routeSentence(o: RouteObservation): string;
|
|
67
|
+
//# sourceMappingURL=doctor-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-evidence.d.ts","sourceRoot":"","sources":["../../src/commands/doctor-evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;;;;;;GAUG;AAEH,qDAAqD;AACrD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAWlE,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,OAA2C,CAAC;AAUvF;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,QAAQ,CAAC,GACnD,WAAW,GAAG,IAAI,CAapB;AASD,iFAAiF;AACjF,wBAA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