@percher/core 0.4.2 → 0.4.3
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/cache.d.ts +23 -0
- package/dist/commands/cache.d.ts.map +1 -0
- package/dist/commands/cache.js +24 -0
- package/dist/commands/cache.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +1 -1
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +12 -1
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/doctor.d.ts +126 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +445 -313
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/preview-branch.d.ts +31 -0
- package/dist/commands/preview-branch.d.ts.map +1 -0
- package/dist/commands/preview-branch.js +55 -0
- package/dist/commands/preview-branch.js.map +1 -0
- package/dist/commands/publish-api-error.d.ts +15 -0
- package/dist/commands/publish-api-error.d.ts.map +1 -1
- package/dist/commands/publish-api-error.js +155 -6
- package/dist/commands/publish-api-error.js.map +1 -1
- package/dist/commands/publish-failure.d.ts +3 -1
- package/dist/commands/publish-failure.d.ts.map +1 -1
- package/dist/commands/publish-failure.js +11 -7
- package/dist/commands/publish-failure.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +62 -328
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +4 -4
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/redeploy.js +3 -3
- package/dist/commands/redeploy.js.map +1 -1
- package/dist/commands/rename.d.ts +7 -0
- package/dist/commands/rename.d.ts.map +1 -1
- package/dist/commands/rename.js +32 -1
- package/dist/commands/rename.js.map +1 -1
- package/dist/commands/wait-deploy.d.ts +12 -2
- package/dist/commands/wait-deploy.d.ts.map +1 -1
- package/dist/commands/wait-deploy.js +115 -46
- package/dist/commands/wait-deploy.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 +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/poll-deployment.d.ts +3 -3
- package/dist/poll-deployment.d.ts.map +1 -1
- package/dist/poll-deployment.js +5 -4
- package/dist/poll-deployment.js.map +1 -1
- package/dist/publish-retry.d.ts.map +1 -1
- package/dist/publish-retry.js +2 -3
- package/dist/publish-retry.js.map +1 -1
- package/package.json +4 -4
- package/dist/commands/continue.d.ts +0 -48
- package/dist/commands/continue.d.ts.map +0 -1
- package/dist/commands/continue.js +0 -121
- package/dist/commands/continue.js.map +0 -1
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v3";
|
|
2
|
-
import { classifyDeploymentFailure } from "./publish-failure";
|
|
3
|
-
export const continueInputSchema = z.object({
|
|
4
|
-
app: z.string().describe("App name (the value of [app].name in percher.toml)"),
|
|
5
|
-
deployId: z
|
|
6
|
-
.string()
|
|
7
|
-
.optional()
|
|
8
|
-
.describe("Specific deploy id to inspect. If omitted, the most recent deploy on the app is used."),
|
|
9
|
-
});
|
|
10
|
-
/**
|
|
11
|
-
* FUTURE11 Phase 3 — read-only "what do I do next?" tool. Looks up the
|
|
12
|
-
* latest (or specified) deploy and returns a single primary action with
|
|
13
|
-
* pre-filled args. Never starts a new deploy. Never deletes data. The
|
|
14
|
-
* point is to collapse the multi-tool decision tree (publish vs push vs
|
|
15
|
-
* logs vs doctor vs deploys_inspect) into one question for the agent.
|
|
16
|
-
*/
|
|
17
|
-
export async function percherContinue(ctx, input) {
|
|
18
|
-
const app = await ctx.client.apps.get(input.app);
|
|
19
|
-
let deployment;
|
|
20
|
-
if (input.deployId) {
|
|
21
|
-
deployment = await ctx.client.apps.getDeployment(input.app, input.deployId);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
const deploys = await ctx.client.apps.listDeploys(input.app, { limit: 1 });
|
|
25
|
-
deployment = deploys[0];
|
|
26
|
-
}
|
|
27
|
-
if (!deployment) {
|
|
28
|
-
return {
|
|
29
|
-
state: "no_deploys",
|
|
30
|
-
app: { id: app.id, name: app.name, url: app.url },
|
|
31
|
-
nextAction: "ask_user",
|
|
32
|
-
reason: "This app has no deploys yet. Ask the user to confirm they want to publish.",
|
|
33
|
-
recovery: { retryable: false, nextAction: "ask_user" },
|
|
34
|
-
summary: `${app.name} has no deploys yet — ask the user before publishing.`,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
// Already live — short-circuit. No tool to call; the agent should
|
|
38
|
-
// just echo the URL.
|
|
39
|
-
if (deployment.status === "live") {
|
|
40
|
-
const url = deployment.previewUrl ?? deployment.url ?? app.url;
|
|
41
|
-
return {
|
|
42
|
-
state: "live",
|
|
43
|
-
app: { id: app.id, name: app.name, url: app.url },
|
|
44
|
-
deployment,
|
|
45
|
-
url,
|
|
46
|
-
nextAction: "none",
|
|
47
|
-
reason: "Latest deploy is already live.",
|
|
48
|
-
recovery: { retryable: false, nextAction: "none" },
|
|
49
|
-
summary: `${app.name} is live at ${url}.`,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
// Superseded by a newer live deploy — distinct from `failed`. Don't
|
|
53
|
-
// route the agent into the build-log inspector for a row that didn't
|
|
54
|
-
// actually break. If the caller passed an explicit `deployId`, point
|
|
55
|
-
// them at percher_continue without one so they resolve the current
|
|
56
|
-
// live state. If they didn't pass one (we got `replaced` from
|
|
57
|
-
// listDeploys, meaning there's no more recent terminal row), surface
|
|
58
|
-
// the situation as ask_user — something is off.
|
|
59
|
-
if (deployment.status === "replaced") {
|
|
60
|
-
return {
|
|
61
|
-
state: "replaced",
|
|
62
|
-
app: { id: app.id, name: app.name, url: app.url },
|
|
63
|
-
deployment,
|
|
64
|
-
nextAction: "ask_user",
|
|
65
|
-
reason: `Deploy ${deployment.id} was replaced by a newer deploy — it is no longer live.`,
|
|
66
|
-
suggestedTool: "percher_continue",
|
|
67
|
-
args: input.deployId ? { app: app.name } : undefined,
|
|
68
|
-
recovery: {
|
|
69
|
-
retryable: false,
|
|
70
|
-
nextAction: "ask_user",
|
|
71
|
-
suggestedTool: "percher_continue",
|
|
72
|
-
args: input.deployId ? { app: app.name } : undefined,
|
|
73
|
-
},
|
|
74
|
-
summary: input.deployId
|
|
75
|
-
? `${app.name} deploy ${deployment.id} was replaced — call percher_continue (no deployId) to find the current live state.`
|
|
76
|
-
: `${app.name}'s most recent deploy was replaced — surface this to the user.`,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
// In flight — point at the wait tool with pre-filled args.
|
|
80
|
-
if (deployment.status === "queued" ||
|
|
81
|
-
deployment.status === "building" ||
|
|
82
|
-
deployment.status === "deploying") {
|
|
83
|
-
const args = { app: app.name, deployId: deployment.id, timeoutSeconds: 30 };
|
|
84
|
-
return {
|
|
85
|
-
state: "in_progress",
|
|
86
|
-
app: { id: app.id, name: app.name, url: app.url },
|
|
87
|
-
deployment,
|
|
88
|
-
nextAction: "wait_deploy",
|
|
89
|
-
reason: `Deploy ${deployment.id} is still ${deployment.status} — wait, don't start a new deploy.`,
|
|
90
|
-
suggestedTool: "percher_wait_for_deploy",
|
|
91
|
-
args,
|
|
92
|
-
recovery: {
|
|
93
|
-
retryable: false,
|
|
94
|
-
nextAction: "wait_deploy",
|
|
95
|
-
suggestedTool: "percher_wait_for_deploy",
|
|
96
|
-
args,
|
|
97
|
-
},
|
|
98
|
-
summary: `${app.name} deploy ${deployment.id} is ${deployment.status} — call percher_wait_for_deploy.`,
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
// Failed — reuse classifier so the agent gets the same nextAction it
|
|
102
|
-
// would have gotten from a sync publish failure (set_env_vars,
|
|
103
|
-
// inspect_build_log, fix_problems, etc.).
|
|
104
|
-
const { error, recovery, summary } = await classifyDeploymentFailure({
|
|
105
|
-
ctx,
|
|
106
|
-
app,
|
|
107
|
-
deployment,
|
|
108
|
-
});
|
|
109
|
-
return {
|
|
110
|
-
state: "failed",
|
|
111
|
-
app: { id: app.id, name: app.name, url: app.url },
|
|
112
|
-
deployment,
|
|
113
|
-
nextAction: recovery.nextAction,
|
|
114
|
-
reason: error.title,
|
|
115
|
-
suggestedTool: recovery.suggestedTool,
|
|
116
|
-
args: recovery.args,
|
|
117
|
-
recovery,
|
|
118
|
-
summary,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
//# sourceMappingURL=continue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"continue.js","sourceRoot":"","sources":["../../src/commands/continue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;IAC9E,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,uFAAuF,CACxF;CACJ,CAAC,CAAC;AAwBH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAY,EAAE,KAAoB;IACtE,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjD,IAAI,UAAkC,CAAC;IACvC,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,UAAU,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9E,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG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