@waitcher/cli 0.2.16 → 0.2.18
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 +1 -1
- package/dist/cli.mjs +325 -57
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ To watch how a page looks, add a visual entry: Waitcher screenshots the page on
|
|
|
40
40
|
waitcher skill install
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
installs the Waitcher skill where Claude Code and other agents look for it. `waitcher doctor` checks the setup, `waitcher explain CODE` explains any issue code, and `waitcher help TOPIC` prints exact syntax for this version.
|
|
43
|
+
installs the Waitcher skill where Claude Code and other agents look for it. `waitcher doctor` checks the setup, `waitcher explain CODE` explains any issue code, and `waitcher help TOPIC` prints exact syntax for this version. The skill and example monitors are also public at https://github.com/waitcher/skills.
|
|
44
44
|
|
|
45
45
|
## More
|
|
46
46
|
|
package/dist/cli.mjs
CHANGED
|
@@ -4976,8 +4976,8 @@ var require_util2 = __commonJS({
|
|
|
4976
4976
|
}
|
|
4977
4977
|
return values;
|
|
4978
4978
|
}
|
|
4979
|
-
function getDecodeSplit(name5,
|
|
4980
|
-
const value2 =
|
|
4979
|
+
function getDecodeSplit(name5, list2) {
|
|
4980
|
+
const value2 = list2.get(name5, true);
|
|
4981
4981
|
if (value2 === null) {
|
|
4982
4982
|
return null;
|
|
4983
4983
|
}
|
|
@@ -25013,9 +25013,9 @@ var require_headers = __commonJS({
|
|
|
25013
25013
|
// https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
|
|
25014
25014
|
getSetCookie() {
|
|
25015
25015
|
webidl.brandCheck(this, webidl.is.Headers);
|
|
25016
|
-
const
|
|
25017
|
-
if (
|
|
25018
|
-
return [...
|
|
25016
|
+
const list2 = this.#headersList.cookies;
|
|
25017
|
+
if (list2) {
|
|
25018
|
+
return [...list2];
|
|
25019
25019
|
}
|
|
25020
25020
|
return [];
|
|
25021
25021
|
}
|
|
@@ -25029,8 +25029,8 @@ var require_headers = __commonJS({
|
|
|
25029
25029
|
headers.#guard = guard;
|
|
25030
25030
|
};
|
|
25031
25031
|
getHeadersList = (headers) => headers.#headersList;
|
|
25032
|
-
setHeadersList = (target,
|
|
25033
|
-
target.#headersList =
|
|
25032
|
+
setHeadersList = (target, list2) => {
|
|
25033
|
+
target.#headersList = list2;
|
|
25034
25034
|
};
|
|
25035
25035
|
webidl.is.Headers = (arg) => {
|
|
25036
25036
|
return arg != null && typeof arg === "object" && #guard in arg;
|
|
@@ -25985,13 +25985,13 @@ var require_request2 = __commonJS({
|
|
|
25985
25985
|
if (this.signal.aborted) {
|
|
25986
25986
|
ac.abort(this.signal.reason);
|
|
25987
25987
|
} else {
|
|
25988
|
-
let
|
|
25989
|
-
if (
|
|
25990
|
-
|
|
25991
|
-
dependentControllerMap.set(this.signal,
|
|
25988
|
+
let list2 = dependentControllerMap.get(this.signal);
|
|
25989
|
+
if (list2 === void 0) {
|
|
25990
|
+
list2 = /* @__PURE__ */ new Set();
|
|
25991
|
+
dependentControllerMap.set(this.signal, list2);
|
|
25992
25992
|
}
|
|
25993
25993
|
const acRef = new WeakRef(ac);
|
|
25994
|
-
|
|
25994
|
+
list2.add(acRef);
|
|
25995
25995
|
util.addAbortListener(
|
|
25996
25996
|
ac.signal,
|
|
25997
25997
|
buildAbort(acRef)
|
|
@@ -33262,8 +33262,8 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
33262
33262
|
}
|
|
33263
33263
|
return false;
|
|
33264
33264
|
}
|
|
33265
|
-
function prefixIssues(path2,
|
|
33266
|
-
return
|
|
33265
|
+
function prefixIssues(path2, issues2) {
|
|
33266
|
+
return issues2.map((iss) => {
|
|
33267
33267
|
var _a3;
|
|
33268
33268
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
33269
33269
|
iss.path.unshift(path2);
|
|
@@ -33285,10 +33285,10 @@ function sizeCaps(defChecks) {
|
|
|
33285
33285
|
}
|
|
33286
33286
|
return caps;
|
|
33287
33287
|
}
|
|
33288
|
-
function attachSchema(
|
|
33288
|
+
function attachSchema(issues2, start, inst) {
|
|
33289
33289
|
var _a3;
|
|
33290
|
-
for (let i = start; i <
|
|
33291
|
-
(_a3 =
|
|
33290
|
+
for (let i = start; i < issues2.length; i++) {
|
|
33291
|
+
(_a3 = issues2[i]).schema ?? (_a3.schema = inst);
|
|
33292
33292
|
}
|
|
33293
33293
|
}
|
|
33294
33294
|
function finalizeIssue(iss, ctx, config2) {
|
|
@@ -33731,7 +33731,7 @@ function formatError(error62, mapper = (issue3) => issue3.message) {
|
|
|
33731
33731
|
const processError = (error63, path2 = []) => {
|
|
33732
33732
|
for (const issue3 of error63.issues) {
|
|
33733
33733
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
33734
|
-
issue3.errors.map((
|
|
33734
|
+
issue3.errors.map((issues2) => processError({ issues: issues2 }, [...path2, ...issue3.path]));
|
|
33735
33735
|
} else if (issue3.code === "invalid_key") {
|
|
33736
33736
|
processError({ issues: issue3.issues }, [...path2, ...issue3.path]);
|
|
33737
33737
|
} else if (issue3.code === "invalid_element") {
|
|
@@ -33780,7 +33780,7 @@ function treeifyError(error62, mapper = (issue3) => issue3.message) {
|
|
|
33780
33780
|
var _a3;
|
|
33781
33781
|
for (const issue3 of error63.issues) {
|
|
33782
33782
|
if (issue3.code === "invalid_union" && issue3.errors.length) {
|
|
33783
|
-
issue3.errors.map((
|
|
33783
|
+
issue3.errors.map((issues2) => processError({ issues: issues2 }, [...path2, ...issue3.path]));
|
|
33784
33784
|
} else if (issue3.code === "invalid_key") {
|
|
33785
33785
|
processError({ issues: issue3.issues }, [...path2, ...issue3.path]);
|
|
33786
33786
|
} else if (issue3.code === "invalid_element") {
|
|
@@ -33843,8 +33843,8 @@ function toDotPath(_path) {
|
|
|
33843
33843
|
}
|
|
33844
33844
|
function prettifyError(error62) {
|
|
33845
33845
|
const lines = [];
|
|
33846
|
-
const
|
|
33847
|
-
for (const issue3 of
|
|
33846
|
+
const issues2 = [...error62.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
|
|
33847
|
+
for (const issue3 of issues2) {
|
|
33848
33848
|
lines.push(`\u2716 ${issue3.message}`);
|
|
33849
33849
|
if (issue3.path?.length)
|
|
33850
33850
|
lines.push(` \u2192 at ${toDotPath(issue3.path)}`);
|
|
@@ -33898,21 +33898,21 @@ var _safeParse = (_Err) => (schema, value2, _ctx) => {
|
|
|
33898
33898
|
return result2.issues.length ? failure(_Err, result2.issues, ctx) : { success: true, data: result2.value };
|
|
33899
33899
|
};
|
|
33900
33900
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
33901
|
-
function failure(Err,
|
|
33901
|
+
function failure(Err, issues2, ctx) {
|
|
33902
33902
|
let error62;
|
|
33903
33903
|
return {
|
|
33904
33904
|
success: false,
|
|
33905
33905
|
get error() {
|
|
33906
33906
|
if (!error62) {
|
|
33907
|
-
error62 = new Err(
|
|
33908
|
-
|
|
33907
|
+
error62 = new Err(issues2.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
33908
|
+
issues2 = void 0;
|
|
33909
33909
|
ctx = void 0;
|
|
33910
33910
|
}
|
|
33911
33911
|
return error62;
|
|
33912
33912
|
},
|
|
33913
33913
|
set error(e) {
|
|
33914
33914
|
error62 = e;
|
|
33915
|
-
|
|
33915
|
+
issues2 = void 0;
|
|
33916
33916
|
ctx = void 0;
|
|
33917
33917
|
}
|
|
33918
33918
|
};
|
|
@@ -37162,8 +37162,8 @@ var NO_ISSUES = [];
|
|
|
37162
37162
|
function isRef(value2) {
|
|
37163
37163
|
return value2 !== null && typeof value2 === "object";
|
|
37164
37164
|
}
|
|
37165
|
-
function cloneIssues(
|
|
37166
|
-
return
|
|
37165
|
+
function cloneIssues(issues2) {
|
|
37166
|
+
return issues2.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
37167
37167
|
}
|
|
37168
37168
|
var recursive = /* @__PURE__ */ new WeakMap();
|
|
37169
37169
|
var NONE = 0;
|
|
@@ -48307,8 +48307,8 @@ var contributors = {
|
|
|
48307
48307
|
function aggregateChecks(schema) {
|
|
48308
48308
|
const agg = {};
|
|
48309
48309
|
const def = schema._zod.def;
|
|
48310
|
-
const
|
|
48311
|
-
for (const ch of
|
|
48310
|
+
const list2 = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
48311
|
+
for (const ch of list2)
|
|
48312
48312
|
contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
48313
48313
|
const bag = schema._zod.bag;
|
|
48314
48314
|
if (bag.minimum !== void 0)
|
|
@@ -49304,8 +49304,8 @@ function _lazyMethod(proto, key, make) {
|
|
|
49304
49304
|
}
|
|
49305
49305
|
});
|
|
49306
49306
|
}
|
|
49307
|
-
var initializer2 = (inst,
|
|
49308
|
-
$ZodError.init(inst,
|
|
49307
|
+
var initializer2 = (inst, issues2) => {
|
|
49308
|
+
$ZodError.init(inst, issues2);
|
|
49309
49309
|
inst.name = "ZodError";
|
|
49310
49310
|
const proto = Object.getPrototypeOf(inst);
|
|
49311
49311
|
if (_installedErrorProtos.has(proto))
|
|
@@ -49317,8 +49317,8 @@ var initializer2 = (inst, issues) => {
|
|
|
49317
49317
|
self.issues.push(issue3);
|
|
49318
49318
|
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
49319
49319
|
});
|
|
49320
|
-
_lazyMethod(proto, "addIssues", (self) => (
|
|
49321
|
-
self.issues.push(...
|
|
49320
|
+
_lazyMethod(proto, "addIssues", (self) => (issues3) => {
|
|
49321
|
+
self.issues.push(...issues3);
|
|
49322
49322
|
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
49323
49323
|
});
|
|
49324
49324
|
Object.defineProperty(proto, "isEmpty", {
|
|
@@ -55970,6 +55970,8 @@ var ACCOUNT_PLANS = Object.freeze({
|
|
|
55970
55970
|
scriptDailyRuns: 12,
|
|
55971
55971
|
// Agent checks (docs/AGENT-CHECKS.md), each a script monitor too.
|
|
55972
55972
|
agentChecks: 0,
|
|
55973
|
+
// Public status pages (docs/STATUS-PAGES.md).
|
|
55974
|
+
statusPages: 1,
|
|
55973
55975
|
// Days evidence files and run history are kept (docs/STORAGE.md).
|
|
55974
55976
|
artifactDays: 7,
|
|
55975
55977
|
historyDays: 14
|
|
@@ -55982,6 +55984,7 @@ var ACCOUNT_PLANS = Object.freeze({
|
|
|
55982
55984
|
scriptMinInterval: 300,
|
|
55983
55985
|
scriptDailyRuns: 480,
|
|
55984
55986
|
agentChecks: 1,
|
|
55987
|
+
statusPages: 3,
|
|
55985
55988
|
artifactDays: 30,
|
|
55986
55989
|
historyDays: 30
|
|
55987
55990
|
}),
|
|
@@ -55996,6 +55999,7 @@ var ACCOUNT_PLANS = Object.freeze({
|
|
|
55996
55999
|
scriptMinInterval: 300,
|
|
55997
56000
|
scriptDailyRuns: 480,
|
|
55998
56001
|
agentChecks: 1,
|
|
56002
|
+
statusPages: 3,
|
|
55999
56003
|
artifactDays: 30,
|
|
56000
56004
|
historyDays: 30
|
|
56001
56005
|
}),
|
|
@@ -56008,6 +56012,7 @@ var ACCOUNT_PLANS = Object.freeze({
|
|
|
56008
56012
|
scriptMinInterval: 120,
|
|
56009
56013
|
scriptDailyRuns: 2500,
|
|
56010
56014
|
agentChecks: 5,
|
|
56015
|
+
statusPages: 10,
|
|
56011
56016
|
artifactDays: 30,
|
|
56012
56017
|
historyDays: 30
|
|
56013
56018
|
})
|
|
@@ -58008,6 +58013,13 @@ function visualTest(input2, timeoutSeconds) {
|
|
|
58008
58013
|
);
|
|
58009
58014
|
const script = `import { test, expect } from 'e2e';
|
|
58010
58015
|
test(${s(name5)}, async ({ app, browser, screen }) => {
|
|
58016
|
+
// Open the page twice. Each run starts with an empty cache, and a site
|
|
58017
|
+
// whose fonts use font-display: optional keeps the fallback font for the
|
|
58018
|
+
// whole visit when a font takes longer than about 100 ms. The first visit
|
|
58019
|
+
// fills the cache, so the captured second one renders like a returning
|
|
58020
|
+
// visitor's, every time.
|
|
58021
|
+
await app.open('');
|
|
58022
|
+
await browser.evaluate(() => document.fonts.ready.then(() => true));
|
|
58011
58023
|
await app.open('');
|
|
58012
58024
|
await expect(browser.locator(${s(config2.ready.selector)})).toBeVisible({ timeout: ${config2.ready.timeoutMs} });
|
|
58013
58025
|
await browser.evaluate(() => document.fonts.ready.then(() => true));
|
|
@@ -61181,8 +61193,8 @@ async function buildEntries(path2, config2) {
|
|
|
61181
61193
|
const entries2 = scriptEntries(config2);
|
|
61182
61194
|
const scripts = {};
|
|
61183
61195
|
const builds = [];
|
|
61184
|
-
const
|
|
61185
|
-
if (!entries2.length) return { scripts, builds, issues };
|
|
61196
|
+
const issues2 = [];
|
|
61197
|
+
if (!entries2.length) return { scripts, builds, issues: issues2 };
|
|
61186
61198
|
const project = await realpath3(dirname12(path2));
|
|
61187
61199
|
const browser = entries2.some((e) => e.type === "browser");
|
|
61188
61200
|
for (const name5 of runtimePackages(browser)) {
|
|
@@ -61190,7 +61202,7 @@ async function buildEntries(path2, config2) {
|
|
|
61190
61202
|
const found = await installedVersion(project, name5);
|
|
61191
61203
|
const status2 = runtimePinStatus(name5, found);
|
|
61192
61204
|
if (status2 === "previous")
|
|
61193
|
-
|
|
61205
|
+
issues2.push({
|
|
61194
61206
|
...problem({
|
|
61195
61207
|
code: "RUNTIME_VERSION_OUTDATED",
|
|
61196
61208
|
path: "(project)",
|
|
@@ -61199,7 +61211,7 @@ async function buildEntries(path2, config2) {
|
|
|
61199
61211
|
severity: "warning"
|
|
61200
61212
|
});
|
|
61201
61213
|
else if (status2 === "mismatch")
|
|
61202
|
-
|
|
61214
|
+
issues2.push(
|
|
61203
61215
|
problem({
|
|
61204
61216
|
code: "RUNTIME_VERSION_MISMATCH",
|
|
61205
61217
|
path: "(project)",
|
|
@@ -61217,7 +61229,7 @@ async function buildEntries(path2, config2) {
|
|
|
61217
61229
|
project
|
|
61218
61230
|
});
|
|
61219
61231
|
if (built.script.length > CONFIG_LIMITS.scriptChars) {
|
|
61220
|
-
|
|
61232
|
+
issues2.push(
|
|
61221
61233
|
problem({
|
|
61222
61234
|
code: "SCRIPT_TOO_LARGE",
|
|
61223
61235
|
monitor: key,
|
|
@@ -61236,7 +61248,7 @@ async function buildEntries(path2, config2) {
|
|
|
61236
61248
|
inputs: built.inputs.length
|
|
61237
61249
|
});
|
|
61238
61250
|
} catch (cause) {
|
|
61239
|
-
|
|
61251
|
+
issues2.push(
|
|
61240
61252
|
problem({
|
|
61241
61253
|
code: "BUILD_FAILED",
|
|
61242
61254
|
monitor: key,
|
|
@@ -61246,7 +61258,7 @@ async function buildEntries(path2, config2) {
|
|
|
61246
61258
|
);
|
|
61247
61259
|
}
|
|
61248
61260
|
}
|
|
61249
|
-
return { scripts, builds, issues };
|
|
61261
|
+
return { scripts, builds, issues: issues2 };
|
|
61250
61262
|
}
|
|
61251
61263
|
async function verifyLocally(options) {
|
|
61252
61264
|
const project = await realpath3(dirname12(options.path));
|
|
@@ -61299,14 +61311,14 @@ async function verifyLocally(options) {
|
|
|
61299
61311
|
} finally {
|
|
61300
61312
|
await rm5(scratch, { recursive: true, force: true });
|
|
61301
61313
|
}
|
|
61302
|
-
const
|
|
61314
|
+
const issues2 = runs.filter((r) => r.status !== "passed").map(
|
|
61303
61315
|
(r) => problem({
|
|
61304
61316
|
code: "VERIFY_FAILED",
|
|
61305
61317
|
monitor: r.key,
|
|
61306
61318
|
message: `Local ${r.status}: ${r.message ?? "no message"}${r.directory ? ` (read ${join12(r.directory, ".e2e", "summary.md")} and .e2e/results/*/trace.md there)` : ""}`
|
|
61307
61319
|
})
|
|
61308
61320
|
);
|
|
61309
|
-
return { runs, issues };
|
|
61321
|
+
return { runs, issues: issues2 };
|
|
61310
61322
|
}
|
|
61311
61323
|
var configPath = (file2) => resolve13(file2 ?? CONFIG_FILE);
|
|
61312
61324
|
async function readProjectConfig(file2) {
|
|
@@ -61403,7 +61415,7 @@ function deployNextSteps(result2, {
|
|
|
61403
61415
|
}
|
|
61404
61416
|
|
|
61405
61417
|
// ../../skills/waitcher/SKILL.md
|
|
61406
|
-
var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, heartbeat, API, browser or visual monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time. Commands print JSON on stdout (`run diagnose` and `run scenarios` need `--json` for it); failures print `{error:{code,message}}` on stderr. Read the exit code, every `issues` entry and every `next` step.\n\nThis skill says what to do and in which order. For exact syntax use the installed CLI, never memory: `waitcher help TOPIC` (for example `help deploy`, `help secret`, `help run`) prints only that part of the help for this CLI version, and `waitcher explain CODE` explains an issue or error code. The user guide at https://waitcher.dev/docs/ explains the same product for people; link the user to a page (CLI install and updates, alerts, access tokens, account) instead of retelling it.\n\n## Rules\n\n- Never put secrets in files, arguments or output. Pipe values to `--value-stdin`.\n- Keep new monitors paused. Pass `--activate-new`, `--prune`, `--adopt` or `--smoke` only when the user agreed to that effect.\n- Show the user the plan's `changes` before `deploy apply`, and apply with `--based-on` from that plan.\n- A local pass is not hosted permission. If capabilities or limits refuse something, report it; never switch accounts, raise limits or remove assertions to get a green result.\n- An agent's own success claim is not evidence. Verify outcomes through the product's state or real run evidence.\n- Do not turn a whole regression suite into monitors. Pick two to five journeys whose failure the user would act on.\n\n## Workflow\n\n1. **Check the setup.** Run `waitcher doctor` in the repository. Fix `error` checks first; its `next` lists exact commands. Without a session, ask the user to run `waitcher auth login` (CI uses a token).\n2. **Understand the product.** Read the repository: base URLs per environment, existing E2E tests, critical journeys, test accounts and jobs. Ask the user which failures should alert them.\n3. **Start the file.** `waitcher config init --project-name NAME --target https://BASE` when there is no `waitcher.json`. Give each monitor a stable lowercase `key`; changing a key later replaces the monitor and its history.\n4. **Choose types.** `http` for status and content, `certificate` for TLS expiry, `heartbeat` for jobs that report in, `api` for a multi-request invariant, `browser` for a user journey. `waitcher monitor init --type TYPE --file x.json` prints a complete example of any type. Script monitors name their test with `entry`; read [authoring](references/authoring.md) before writing one. They need the pinned runtime next to `waitcher.json`: run `waitcher runtime install`, show the user the steps it lists (npm install runs package install scripts; browser projects download Chromium), and after they agree rerun it with `--yes`. It writes exact pins into `package.json`, updates `.gitignore` and is safe to repeat. The same command upgrades the project after a CLI update (`RUNTIME_VERSION_OUTDATED`).\n5. **Validate offline.** `waitcher config validate` resolves every environment and builds every entry. Fix each issue at its `path`. Add `--env NAME --verify` (optionally `--key KEY`) to run the api/browser entries locally without an account; read the run directory it names when one fails.\n6. **Plan.** `waitcher deploy plan --env NAME --verify` runs script monitors locally against that environment, then asks the server. Resolve errors (`SECRET_MISSING`: ask the user for the value and run `waitcher secret set`; `ADOPTION_CANDIDATE`: ask whether the existing monitor is the same check).\n7. **Apply.** After the user accepts the plan: `waitcher deploy apply --env NAME --based-on BASED_ON`, where BASED_ON is the plan's `basedOn` or `none` when it is null (first deploy); the plan's `next` prints the exact command. Add `--smoke` for one hosted run per changed monitor. New monitors stay paused.\n8. **Report.** Give the user the monitor IDs, what each checks, local and hosted results, evidence paths and anything still pending (paused schedules, heartbeat credentials, secrets for other environments). If `waitcher alert policy list` shows no routing, failures will alert nobody: point the user to https://waitcher.dev/docs/alerts.\n\nFor CI, `waitcher ci init` writes a workflow that plans on pull requests and applies on the main branch. Details of secrets, adoption, rollback and CI are in [deploy](references/deploy.md).\n\n## When something fails\n\n- `waitcher --help` prints a short overview of topics; `waitcher help TOPIC` (or `waitcher GROUP --help`) prints one part with the exit codes; `waitcher help all` is long, avoid it.\n- Exit 2: fix the file or input; exit 3: sign in; exit 4: a check failed (inspect evidence); exit 6: quota, rate or queue limit; exit 7: not permitted; exit 8: conflict or managed by `waitcher.json`; exit 9: not found; exit 10: service unavailable.\n- For a failed run, read [diagnosis](references/diagnosis.md): `waitcher run diagnose --id RUN_ID`, then reproduce locally before changing the test.\n- Never retry a write automatically after an uncertain result; read the current state first.\n\n## References\n\n- [authoring](references/authoring.md): choosing a type, writing API and browser tests, local runs and evidence, single-monitor apply.\n- [deploy](references/deploy.md): waitcher.json details, secrets, adoption, rollback, CI.\n- [diagnosis](references/diagnosis.md): run diagnosis and reproduction.\n- [optional capabilities](references/optional-capabilities.md): visual baselines, browser identities, verified HTTP credentials, invocation budgets.\n- [AI and agents](references/ai-and-agents.md): agent outcome checks, scenario evidence, AI endpoints and suites, calibration, AI steps in scripts, protected requests.\n- Read the last two only when `waitcher system capabilities` reports the feature and the user needs it.\n";
|
|
61418
|
+
var SKILL_default = "---\nname: waitcher\ndescription: Set up and maintain Waitcher monitoring from a repository with the waitcher CLI. Use to turn a product's critical journeys into HTTP, certificate, heartbeat, API, browser or visual monitors in waitcher.json, verify them locally, deploy them through a reviewed plan, and diagnose failures from real evidence.\n---\n\n# Waitcher\n\nYou operate the waitcher CLI for the user. The repository is the source of truth: `waitcher.json` declares the monitors of one project per environment, test files hold the scripts, and `waitcher deploy` reconciles one environment at a time. Commands print JSON on stdout (`run diagnose` and `run scenarios` need `--json` for it); failures print `{error:{code,message}}` on stderr. Read the exit code, every `issues` entry and every `next` step.\n\nThis skill says what to do and in which order. For exact syntax use the installed CLI, never memory: `waitcher help TOPIC` (for example `help deploy`, `help secret`, `help run`) prints only that part of the help for this CLI version, and `waitcher explain CODE` explains an issue or error code. The user guide at https://waitcher.dev/docs/ explains the same product for people; link the user to a page (CLI install and updates, alerts, access tokens, account) instead of retelling it.\n\n## Rules\n\n- Never put secrets in files, arguments or output. Pipe values to `--value-stdin`.\n- Keep new monitors paused. Pass `--activate-new`, `--prune`, `--adopt` or `--smoke` only when the user agreed to that effect.\n- Show the user the plan's `changes` before `deploy apply`, and apply with `--based-on` from that plan.\n- A local pass is not hosted permission. If capabilities or limits refuse something, report it; never switch accounts, raise limits or remove assertions to get a green result.\n- An agent's own success claim is not evidence. Verify outcomes through the product's state or real run evidence.\n- Do not turn a whole regression suite into monitors. Pick two to five journeys whose failure the user would act on.\n\n## Workflow\n\n1. **Check the setup.** Run `waitcher doctor` in the repository. Fix `error` checks first; its `next` lists exact commands. Without a session, ask the user to run `waitcher auth login` (CI uses a token).\n2. **Understand the product.** Read the repository: base URLs per environment, existing E2E tests, critical journeys, test accounts and jobs. Ask the user which failures should alert them.\n3. **Start the file.** `waitcher config init --project-name NAME --target https://BASE` when there is no `waitcher.json`. Give each monitor a stable lowercase `key`; changing a key later replaces the monitor and its history.\n4. **Choose types.** `http` for status and content, `certificate` for TLS expiry, `heartbeat` for jobs that report in, `api` for a multi-request invariant, `browser` for a user journey. `waitcher monitor init --type TYPE --file x.json` prints a complete example of any type. Script monitors name their test with `entry`; read [authoring](references/authoring.md) before writing one. They need the pinned runtime next to `waitcher.json`: run `waitcher runtime install`, show the user the steps it lists (npm install runs package install scripts; browser projects download Chromium), and after they agree rerun it with `--yes`. It writes exact pins into `package.json`, updates `.gitignore` and is safe to repeat. The same command upgrades the project after a CLI update (`RUNTIME_VERSION_OUTDATED`).\n5. **Validate offline.** `waitcher config validate` resolves every environment and builds every entry. Fix each issue at its `path`. Add `--env NAME --verify` (optionally `--key KEY`) to run the api/browser entries locally without an account; read the run directory it names when one fails.\n6. **Plan.** `waitcher deploy plan --env NAME --verify` runs script monitors locally against that environment, then asks the server. Resolve errors (`SECRET_MISSING`: ask the user for the value and run `waitcher secret set`; `ADOPTION_CANDIDATE`: ask whether the existing monitor is the same check).\n7. **Apply.** After the user accepts the plan: `waitcher deploy apply --env NAME --based-on BASED_ON`, where BASED_ON is the plan's `basedOn` or `none` when it is null (first deploy); the plan's `next` prints the exact command. Add `--smoke` for one hosted run per changed monitor. New monitors stay paused.\n8. **Report.** Give the user the monitor IDs, what each checks, local and hosted results, evidence paths and anything still pending (paused schedules, heartbeat credentials, secrets for other environments). If `waitcher alert policy list` shows no routing, failures will alert nobody: point the user to https://waitcher.dev/docs/alerts.\n\nFor CI, `waitcher ci init` writes a workflow that plans on pull requests and applies on the main branch. Details of secrets, adoption, rollback and CI are in [deploy](references/deploy.md).\n\n## When something fails\n\n- `waitcher --help` prints a short overview of topics; `waitcher help TOPIC` (or `waitcher GROUP --help`) prints one part with the exit codes; `waitcher help all` is long, avoid it.\n- Exit 2: fix the file or input; exit 3: sign in; exit 4: a check failed (inspect evidence); exit 6: quota, rate or queue limit; exit 7: not permitted; exit 8: conflict or managed by `waitcher.json`; exit 9: not found; exit 10: service unavailable.\n- For a failed run, read [diagnosis](references/diagnosis.md): `waitcher run diagnose --id RUN_ID`, then reproduce locally before changing the test.\n- Never retry a write automatically after an uncertain result; read the current state first.\n\n## References\n\n- [authoring](references/authoring.md): choosing a type, writing API and browser tests, local runs and evidence, single-monitor apply.\n- [deploy](references/deploy.md): waitcher.json details, secrets, adoption, rollback, CI.\n- [diagnosis](references/diagnosis.md): run diagnosis and reproduction.\n- [optional capabilities](references/optional-capabilities.md): visual baselines, browser identities, verified HTTP credentials, invocation budgets, agent checks, public status pages.\n- [AI and agents](references/ai-and-agents.md): agent outcome checks, scenario evidence, AI endpoints and suites, calibration, AI steps in scripts, protected requests.\n- Read the last two only when `waitcher system capabilities` reports the feature and the user needs it.\n";
|
|
61407
61419
|
|
|
61408
61420
|
// ../../skills/waitcher/references/authoring.md
|
|
61409
61421
|
var authoring_default = '# Authoring and running monitors\n\nRead when writing or changing a test, choosing a monitor type, or running it locally. For exact syntax run `waitcher help monitor` or `waitcher help run`. AI endpoints, agent outcome checks and model steps are in [ai-and-agents](ai-and-agents.md).\n\n## Choose the type\n\n- `http`: status, body text, a JSON value or latency of one request. No script.\n- `certificate`: TLS expiry and chain. No script.\n- `heartbeat`: a job reports start and success; Waitcher alerts when it does not.\n- `api`: a script with several requests and an invariant between them.\n- `browser`: a script that walks a user journey in Chromium.\n- `visual`: a screenshot of one public page or element compared with a baseline the user approved. No script; see [optional capabilities](optional-capabilities.md#optional-visual-checks).\n\n`waitcher monitor init --type TYPE --file x.json` writes a paused example of every type; `api` and `browser` also write `x.e2e.ts`. Keep scripts focused on the requested behavior and use controlled test identities for actions that change state.\n\n## Scripts in waitcher.json\n\nIn a repository, a script monitor is an entry with `entry` pointing at its test file; one test serves every environment because it reads the base URL at run time.\n\n```json\n{ "key": "checkout", "type": "browser", "entry": "monitoring/checkout.e2e.ts", "timeout": 45 }\n```\n\nRun the entries of one environment locally, without an account:\n\n```sh\nwaitcher config validate --env production --verify\nwaitcher config validate --env production --verify --key checkout\n```\n\nExit 4 with `VERIFY_FAILED` names the failing assertion and the run directory to read. `run local --file` takes a single monitor manifest, not `waitcher.json`.\n\n## Browser journey\n\n```ts\nimport { test } from "@e2e-dev/web";\nimport { expect } from "e2e";\n\ntest("visitor can start a game", async ({ app, browser, screen }) => {\n await app.open("/games/klondike/");\n await expect(browser.locator("main h1")).toContainText("Solitaire");\n await expect(screen.getByRole("button", "New game")).toBeVisible();\n await app.screenshot("game");\n});\n```\n\n- `app.open(path)` resolves against the environment\'s base URL. Browser base URLs have no query or fragment; navigate to those URLs inside the script.\n- Find elements the way a visitor does with the `screen` fixture: `screen.getByRole("button", "New game")`, `screen.getByLabel("Email")`, `screen.getByText("Welcome")`, `screen.getByPlaceholder(...)`, `screen.getByTestId(...)`. Prefer these over CSS selectors.\n- The `browser` fixture navigates and offers CSS `browser.locator("main h1")` plus `expect(browser).toHaveURL(...)`; it has no `getBy*` methods.\n- Assertions come from `e2e`: `toBeVisible()`, `toContainText(...)`, `toHaveText(...)`.\n\n## API script\n\n```ts\nimport { test, expect } from "e2e";\n\ntest("orders API keeps totals consistent", async () => {\n const target = new URL(process.env.TARGET_URL!);\n const response = await fetch(new URL("/api/orders?limit=1", target));\n expect(response.status).toBe(200);\n});\n```\n\nAPI scripts import `test, expect` from `e2e` and read `process.env.TARGET_URL`. Secrets reach them only as `CHECK_*` names listed in `settings.envNames` (see [deploy](deploy.md)). The test runs as trusted local code, not in a sandbox.\n\n## Standalone manifest\n\nWithout `waitcher.json`, a monitor is one JSON file. `monitor init --type browser --file monitor.json` writes it with `scriptFile` next to the test:\n\n```json\n{\n "schemaVersion": 1,\n "name": "Product / key journey",\n "type": "browser",\n "target": "https://example.com/",\n "enabled": false,\n "interval": 1800,\n "timeout": 30,\n "scriptFile": "journey.e2e.ts"\n}\n```\n\n`scriptFile` resolves relative to the manifest; `monitor validate --file monitor.json` checks the actual contract. The platform receives one script per monitor, not the project directory. When the test imports shared helpers, run `monitor build --file monitors/checkout.json --project . --output build/checkout`: it needs installed `esbuild@0.28.2`, bundles code and JSON helpers, keeps only supported framework and Node imports, and writes `monitor.js`, `monitor.json` and `build.json` into a new directory. Unsupported dependencies and module-relative file access fail the build. Verify and apply the built `monitor.json`. The script limit is 50,000 characters and hosted dependencies are fixed.\n\n## Run locally and inspect evidence\n\nThe runtime project needs `e2e@0.21.1` and, for browser tests, `@e2e-dev/web@0.15.1` and Chromium. `waitcher runtime install --file DIR/waitcher.json [--browser]` lists the npm install and Chromium download; run it with `--yes` once the user agrees. Chromium goes to the Playwright browser cache (`PLAYWRIGHT_BROWSERS_PATH` when set), not the runtime directory.\n\n```sh\nwaitcher run local --file monitor.json --runtime /path/to/runtime\nwaitcher run local --file monitor.json --runtime /path/to/runtime --video\nwaitcher run local --project /path/to/e2e-project --timeout 60\n```\n\n- `--project` runs an existing E2E project with its own config and imports; its `--output` must stay inside that project.\n- Runs are serial, never retried or replayed, and get a fresh directory under `.waitcher/runs/` (`--output DIR` chooses the parent). Traces are always requested; video is opt-in, and tests can override recording, so inspect the returned files.\n- On failure read `.e2e/summary.md` and `.e2e/results/*/trace.md` in the run directory first, then `execution.log` and `report.json`. The `waitcher-*.mjs` files there are runtime support, not your test. Traces are Markdown, not Playwright ZIPs; there is no HAR option, and app logs hold selected console and request failures only.\n- Exit codes: 0 passed, 4 failed or error, 130 interrupted. After an interruption, inspect partial evidence before repeating a possibly completed action.\n- Fix test mistakes while preserving the user\'s assertions; never weaken an assertion just to get green.\n- Evidence can contain private content: keep `.waitcher/`, `.e2e/`, keys and reports out of Git. Local results are not uploaded and are not hosted health evidence.\n\n## Apply one monitor through the API\n\nWhen hosted scripts are allowed and applying configuration is in scope:\n\n```sh\nwaitcher monitor apply --file monitor.json --dry-run\nwaitcher monitor apply --file monitor.json\nwaitcher monitor get --id MONITOR_ID\n```\n\nKeep the monitor paused unless the user requested scheduled execution; applying does not run it. For an authorized single hosted run use `run start --id MONITOR_ID --wait`, then `run status`, `run trace --id RUN_ID` (steps, failed assertion, screenshots, fetch calls) and `artifact get` for evidence. Hosted scripts run under the server\'s execution policy and can differ from a local run.\n\nEdits are complete replacements: `monitor export`, change the file, then `monitor apply --file FILE --id ID --expected-revision N` with the revision from get or export. Use a stable `--request-key` to recover one uncertain create or run; never change the payload under that key or repeat a possibly executed action. Report the exact monitor and run IDs, local evidence path, observed outcome and any difference between local and hosted results.\n';
|
|
@@ -61418,7 +61430,7 @@ var deploy_default = '# Repository deploys\n\nRead when the user keeps monitors
|
|
|
61418
61430
|
var diagnosis_default = "# Diagnosing failures\n\nRead when a local, smoke or scheduled run failed or errored.\n\n## Diagnose and reproduce a retained run\n\nConfirm `features.runDiagnosis` for hosted support. Use `run diagnose --id RUN_ID` for a readable hosted packet, or add `--json` for the shared structured report. Use `run diagnose --directory PRIVATE_RUN_DIRECTORY` without an account to inspect indexed local evidence. Hosted request states come from the controller ledger; local helper observations are explicitly local and do not attest hosted accounting. A known response does not prove task success, and an unknown action may have taken effect. Do not automatically repeat a mutation because its result is unknown.\n\nA historical pass is useful only when the frozen verification policy matches. Changed scripts, targets, deadlines or protected-operation policies cannot supply a matching reference. History searches are bounded; unavailable or truncated history is not proof that the product never passed. Stored artifact checksums are metadata; inspect the actual artifact when needed. Scenario evidence is checked against its recorded checksum before display.\n\nFor a completed supported hosted script, `run reproduce --id RUN_ID --output NEW_DIRECTORY` prepares its frozen configuration in a new private folder. It never executes the test or retrieves the current edited monitor. Inspect `monitor.json` and `provenance.json`, then deliberately run `run local --file NEW_DIRECTORY/monitor.json --output FRESH_RUN_DIRECTORY` with the matching installed runtime, optionally `--runtime PROJECT`. Reproduction is a fresh run with separate provenance and does not replace the original evidence.\n\nManaged product credentials, AI keys and browser sessions are not exported. Supply existing private local mappings with `--http-credentials-file`, `--connections-file` and `--browser-identities-file` where required. Authored scripts and literal configuration can themselves be sensitive, so keep the reproduction private. Operator-injected headers, bodies or environment state make this initial portable preparation unavailable rather than silently changing the test. Older local runs without an indexed frozen manifest remain inspectable but cannot establish a captured reproduction policy.\n";
|
|
61419
61431
|
|
|
61420
61432
|
// ../../skills/waitcher/references/optional-capabilities.md
|
|
61421
|
-
var optional_capabilities_default = '# Optional capabilities\n\nRead only when capabilities report the feature and the user needs it: visual baselines, signed-in browser identities, verified HTTP credentials and invocation budgets. AI endpoints, agent outcome checks, model steps and protected requests are in [ai-and-agents](ai-and-agents.md).\n\n## Optional visual checks\n\nDiscover `features.visual` for authoring and `features.visualReview` for baseline inspection; `features.isolatedVisual` says personal captures run in the hosted runner. A visual monitor counts as one of the plan\'s script monitors and each capture as a script run; `limits.visual.minInterval` is the shortest interval (2 hours on the free plan, 30 minutes otherwise). In a repository, add a `waitcher.json` entry such as `{ "key": "home-look", "type": "visual", "path": "/" }` with an optional `visual` block (page/element checkpoint, viewport, readiness, masks, thresholds) and deploy it like any other monitor; with `--smoke` the first capture is reported as `baseline_review` with the commands that show and approve it. For one monitor outside a repository, start with `monitor init --type visual --target https://product.example --file visual.json`, then `monitor validate --file visual.json` and `monitor apply --file visual.json --dry-run`. Apply paused; an authorized `run start --id ID --wait` is a separate action. User guide: https://waitcher.dev/docs/visual.md.\n\nFor a screen behind a sign-in or a few clicks, assert it inside a `browser` test instead: `await expect(screen).toHaveScreenshot(\'dashboard.png\')` (options `threshold`, `maxDiffPixels`, `maxDiffPixelRatio`, `mask`). Do not commit snapshot PNGs or pass `--update-snapshots`: Waitcher keeps the baselines. The first hosted run of each screenshot ends as `error` "First capture of NAME: approve it as the baseline"; inspect it with `visual list --monitor-id ID` and `visual image`, then `visual approve --id COMPARISON_ID --expected-revision 0`, one screenshot per run. Later runs fail with a comparison when a screenshot differs. Local runs (`run local`, `--verify`) compare against a capture from the same run, so a local pass says nothing about the look. Visual monitors accept no script, model binding, session identity or custom request credential. Fixed visual baseline execution is not supported by `run local`; local API/browser script evidence does not establish a visual baseline.\n\nA scheduled run never creates a baseline. Set the first one, or accept an intended change, with one run: `run start --id MONITOR_ID --update-baselines --wait` captures and approves it (write access); then inspect it with `visual list` and `visual image`. The alternative is to run normally and approve the capture. Until a baseline exists a run ends as `error` "First capture of NAME"; that is missing coverage, not a product failure. Every later run of a visual monitor keeps its comparison, passing runs included. Inspect `visual list`, `visual get --id COMPARISON_ID`, `visual heads --id MONITOR_ID`, `visual artifacts --id COMPARISON_ID` and `visual image --id COMPARISON_ID --role candidate|original|diff --file NEW_PRIVATE_PATH`. Review actual images and metrics before an authorized `visual approve --id COMPARISON_ID --expected-revision SELECTED_REVISION`; an initial selection uses 0. Restore only a reviewed retained baseline with `visual restore --id HEAD_ID --baseline-id BASELINE_ID --expected-revision CURRENT_HEAD_REVISION`. Stale decisions conflict: reload instead of retrying or changing revisions blindly. Approval preserves the historical result. Changed capture fingerprints need their own baseline. Foreign-owner/read-only refusals are boundaries, not reasons to switch credentials. Screenshots are private evidence; masks cover selected pixels only. Use actual `visual` and `run` help for current flags and capabilities.\n\n## Optional browser test-account identity\n\nFor a signed-in browser journey, discover hosted `features.browserIdentities` before configuring `identity create/rotate/enable/disable/delete`. Supply bounded cookies/localStorage through a private `--state-file`; metadata is scoped to one verified exact origin, project/environment and explicit expiry. State is write-only and cannot be exported. New identities default disabled; enable explicitly and bind the resulting current `{identityId, revision}` under `browserIdentity` in a version-2 browser manifest with explicit context. Rename, state replacement and enable/disable advance revisions; inspect current metadata and deliberately rebind rather than silently upgrading. After an uncertain write inspect metadata before retrying. No running Chrome profile is imported.\n\nRun the same manifest account-free with `run local --file MONITOR --runtime RUNTIME --browser-identities-file PRIVATE_MAP`. The map is `{schemaVersion:1,identities:[{identityId,revision,projectId,environmentId,origin,expiresAt,stateFile}]}`; state paths resolve relative to the map. Both map/state are private regular JSON files (chmod 600), no symlinks/hard links or inline state. Exact IDs/revision/scope/origin and bounded future expiry must match. Local mappings do not attest hosted target verification or revocation. The optional model map remains separate. Hosted identity-backed runs use the isolated lane for all owners; local code remains trusted. The selected script receives its own session and signed-in page content can reach private evidence or optional AI providers. Never promise pixel/encoded-secret masking. Use dedicated test accounts and inspect coverage errors after expiry/revocation before repeating a possibly completed action.\n\n## Verified HTTP credentials\n\nFor an authenticated HTTP or AI endpoint, use the user\'s owned verified HTTPS origin and an `httpAuth` reference (`targetId`, `credentialId`, `credentialRevision`). Check `features.httpTargets` before hosted configuration. Create/renew a target challenge with `target create` or `target challenge`, writing it to a new private `--output`; never print the token. The user publishes the supplied proof at `/.well-known/waitcher-verification.txt`, then `target verify` checks it without credentials. Verification expires after 24 hours and must be renewed. An origin excludes paths, query and fragments and is immutable.\n\nUse `target credential create/rotate` with non-secret metadata JSON plus `--credential-file` (mode 600) or `--credential-stdin`. Headers are limited to `Authorization` or `X-Api-Key`; values are complete single-line ASCII header values up to 4096 bytes. For Bearer auth, include the `Bearer ` prefix in the private value. Keys are write-only and encrypted on the server. The monitor and export retain references only. Rotation advances the credential revision; update the monitor binding explicitly. Disabled, expired, foreign or stale bindings fail without forwarding a request. Authenticated redirects are never followed.\n\nFor local execution without the app or account, pass `run local --file monitor.json --http-credentials-file private/http-map.json`. The private map is `{schemaVersion:1,credentials:[{targetId,credentialId,credentialRevision,origin,header,credentialFile}]}` and the referenced private file contains the raw header value. Paths resolve relative to the map. Never inline a key or reuse the CLI\'s own account cookie/token as a target credential. The local resolver requires exactly matching IDs, revision and canonical origin, and the shared runner enforces the single supported header and redirect policy. Local mapping does not prove that the hosted target is still verified or its key current. Keep the same manifest as the hosted monitor; only local key resolution differs. HTTP local checks need no E2E runtime. Use explicit user authorization for POST fixtures that change state.\n\n## Hosted endpoint invocation budgets\n\nBefore running dedicated AI endpoints or HTTP checks with `httpAuth`, read `account invocations` for the account/monitor UTC-day counters and limits. The manifest accepts `requestBudget: {dailyInvocations: N}` (default 50, maximum 1,000). Configure the owner cap with `account budget --daily-invocations N --expected-revision CURRENT_REVISION` only when authorized; personal accounts cap at 200, administrators at 5,000, and the controller also has a global 5,000 cap. Validate/apply/export do not charge calls.\n\n`INVOCATION_BUDGET_EXHAUSTED` is a coverage error: no request was dispatched and no product incident is created. Do not automatically retry or raise a limit to bypass it. Completed and uncertain dispatched calls consume budget, independent of product success or worker-reported usage. Local execution needs no account, preserves the setting and makes at most one endpoint call per fixture case, but does not enforce or consume the hosted daily ledger. After backup restore, `window.restoreHeld` blocks these checks until the next UTC reset because snapshot counters may be stale; do not bypass the hold by raising caps. These are request counts, separate from model-broker token/call caps and downstream provider spending. Inspect `account invocations` and the current `account` help for the hosted accounting contract.\n\n## Agent checks\n\nWhen `features.agentChecks` is true, an `api` entry may carry an `agent` block: Claude Code works on `task` in a sandbox, then the entry\'s script verifies the product\'s state ([guide](https://waitcher.dev/docs/agent-checks.md)). It needs a model connection in the entry\'s project environment (`connection create`, OpenRouter, the key from a private file) and fields `connectionId`, `configurationRevision`, `model`, `task`, optionally `seconds`, `turns`, `tokens`, `hosts` and `envNames` (a subset of `settings.envNames`). Read `limits.agentChecks` for the plan\'s count and bounds; the interval is at least 6 hours. Write the task as a user would say it and never put a secret in it. The verifier must reset the test account it checks. Ask before creating a connection: it stores the user\'s key and every run is billed to it.\n';
|
|
61433
|
+
var optional_capabilities_default = '# Optional capabilities\n\nRead only when capabilities report the feature and the user needs it: visual baselines, signed-in browser identities, verified HTTP credentials and invocation budgets. AI endpoints, agent outcome checks, model steps and protected requests are in [ai-and-agents](ai-and-agents.md).\n\n## Optional visual checks\n\nDiscover `features.visual` for authoring and `features.visualReview` for baseline inspection; `features.isolatedVisual` says personal captures run in the hosted runner. A visual monitor counts as one of the plan\'s script monitors and each capture as a script run; `limits.visual.minInterval` is the shortest interval (2 hours on the free plan, 30 minutes otherwise). In a repository, add a `waitcher.json` entry such as `{ "key": "home-look", "type": "visual", "path": "/" }` with an optional `visual` block (page/element checkpoint, viewport, readiness, masks, thresholds) and deploy it like any other monitor; with `--smoke` the first capture is reported as `baseline_review` with the commands that show and approve it. For one monitor outside a repository, start with `monitor init --type visual --target https://product.example --file visual.json`, then `monitor validate --file visual.json` and `monitor apply --file visual.json --dry-run`. Apply paused; an authorized `run start --id ID --wait` is a separate action. User guide: https://waitcher.dev/docs/visual.md.\n\nFor a screen behind a sign-in or a few clicks, assert it inside a `browser` test instead: `await expect(screen).toHaveScreenshot(\'dashboard.png\')` (options `threshold`, `maxDiffPixels`, `maxDiffPixelRatio`, `mask`). Do not commit snapshot PNGs or pass `--update-snapshots`: Waitcher keeps the baselines. The first hosted run of each screenshot ends as `error` "First capture of NAME: approve it as the baseline"; inspect it with `visual list --monitor-id ID` and `visual image`, then `visual approve --id COMPARISON_ID --expected-revision 0`, one screenshot per run. Later runs fail with a comparison when a screenshot differs. Local runs (`run local`, `--verify`) compare against a capture from the same run, so a local pass says nothing about the look. Visual monitors accept no script, model binding, session identity or custom request credential. Fixed visual baseline execution is not supported by `run local`; local API/browser script evidence does not establish a visual baseline.\n\nA scheduled run never creates a baseline. Set the first one, or accept an intended change, with one run: `run start --id MONITOR_ID --update-baselines --wait` captures and approves it (write access); then inspect it with `visual list` and `visual image`. The alternative is to run normally and approve the capture. Until a baseline exists a run ends as `error` "First capture of NAME"; that is missing coverage, not a product failure. Every later run of a visual monitor keeps its comparison, passing runs included. Inspect `visual list`, `visual get --id COMPARISON_ID`, `visual heads --id MONITOR_ID`, `visual artifacts --id COMPARISON_ID` and `visual image --id COMPARISON_ID --role candidate|original|diff --file NEW_PRIVATE_PATH`. Review actual images and metrics before an authorized `visual approve --id COMPARISON_ID --expected-revision SELECTED_REVISION`; an initial selection uses 0. Restore only a reviewed retained baseline with `visual restore --id HEAD_ID --baseline-id BASELINE_ID --expected-revision CURRENT_HEAD_REVISION`. Stale decisions conflict: reload instead of retrying or changing revisions blindly. Approval preserves the historical result. Changed capture fingerprints need their own baseline. Foreign-owner/read-only refusals are boundaries, not reasons to switch credentials. Screenshots are private evidence; masks cover selected pixels only. Use actual `visual` and `run` help for current flags and capabilities.\n\n## Optional browser test-account identity\n\nFor a signed-in browser journey, discover hosted `features.browserIdentities` before configuring `identity create/rotate/enable/disable/delete`. Supply bounded cookies/localStorage through a private `--state-file`; metadata is scoped to one verified exact origin, project/environment and explicit expiry. State is write-only and cannot be exported. New identities default disabled; enable explicitly and bind the resulting current `{identityId, revision}` under `browserIdentity` in a version-2 browser manifest with explicit context. Rename, state replacement and enable/disable advance revisions; inspect current metadata and deliberately rebind rather than silently upgrading. After an uncertain write inspect metadata before retrying. No running Chrome profile is imported.\n\nRun the same manifest account-free with `run local --file MONITOR --runtime RUNTIME --browser-identities-file PRIVATE_MAP`. The map is `{schemaVersion:1,identities:[{identityId,revision,projectId,environmentId,origin,expiresAt,stateFile}]}`; state paths resolve relative to the map. Both map/state are private regular JSON files (chmod 600), no symlinks/hard links or inline state. Exact IDs/revision/scope/origin and bounded future expiry must match. Local mappings do not attest hosted target verification or revocation. The optional model map remains separate. Hosted identity-backed runs use the isolated lane for all owners; local code remains trusted. The selected script receives its own session and signed-in page content can reach private evidence or optional AI providers. Never promise pixel/encoded-secret masking. Use dedicated test accounts and inspect coverage errors after expiry/revocation before repeating a possibly completed action.\n\n## Verified HTTP credentials\n\nFor an authenticated HTTP or AI endpoint, use the user\'s owned verified HTTPS origin and an `httpAuth` reference (`targetId`, `credentialId`, `credentialRevision`). Check `features.httpTargets` before hosted configuration. Create/renew a target challenge with `target create` or `target challenge`, writing it to a new private `--output`; never print the token. The user publishes the supplied proof at `/.well-known/waitcher-verification.txt`, then `target verify` checks it without credentials. Verification expires after 24 hours and must be renewed. An origin excludes paths, query and fragments and is immutable.\n\nUse `target credential create/rotate` with non-secret metadata JSON plus `--credential-file` (mode 600) or `--credential-stdin`. Headers are limited to `Authorization` or `X-Api-Key`; values are complete single-line ASCII header values up to 4096 bytes. For Bearer auth, include the `Bearer ` prefix in the private value. Keys are write-only and encrypted on the server. The monitor and export retain references only. Rotation advances the credential revision; update the monitor binding explicitly. Disabled, expired, foreign or stale bindings fail without forwarding a request. Authenticated redirects are never followed.\n\nFor local execution without the app or account, pass `run local --file monitor.json --http-credentials-file private/http-map.json`. The private map is `{schemaVersion:1,credentials:[{targetId,credentialId,credentialRevision,origin,header,credentialFile}]}` and the referenced private file contains the raw header value. Paths resolve relative to the map. Never inline a key or reuse the CLI\'s own account cookie/token as a target credential. The local resolver requires exactly matching IDs, revision and canonical origin, and the shared runner enforces the single supported header and redirect policy. Local mapping does not prove that the hosted target is still verified or its key current. Keep the same manifest as the hosted monitor; only local key resolution differs. HTTP local checks need no E2E runtime. Use explicit user authorization for POST fixtures that change state.\n\n## Hosted endpoint invocation budgets\n\nBefore running dedicated AI endpoints or HTTP checks with `httpAuth`, read `account invocations` for the account/monitor UTC-day counters and limits. The manifest accepts `requestBudget: {dailyInvocations: N}` (default 50, maximum 1,000). Configure the owner cap with `account budget --daily-invocations N --expected-revision CURRENT_REVISION` only when authorized; personal accounts cap at 200, administrators at 5,000, and the controller also has a global 5,000 cap. Validate/apply/export do not charge calls.\n\n`INVOCATION_BUDGET_EXHAUSTED` is a coverage error: no request was dispatched and no product incident is created. Do not automatically retry or raise a limit to bypass it. Completed and uncertain dispatched calls consume budget, independent of product success or worker-reported usage. Local execution needs no account, preserves the setting and makes at most one endpoint call per fixture case, but does not enforce or consume the hosted daily ledger. After backup restore, `window.restoreHeld` blocks these checks until the next UTC reset because snapshot counters may be stale; do not bypass the hold by raising caps. These are request counts, separate from model-broker token/call caps and downstream provider spending. Inspect `account invocations` and the current `account` help for the hosted accounting contract.\n\n## Agent checks\n\nWhen `features.agentChecks` is true, an `api` entry may carry an `agent` block: Claude Code works on `task` in a sandbox, then the entry\'s script verifies the product\'s state ([guide](https://waitcher.dev/docs/agent-checks.md)). It needs a model connection in the entry\'s project environment (`connection create`, OpenRouter, the key from a private file) and fields `connectionId`, `configurationRevision`, `model`, `task`, optionally `seconds`, `turns`, `tokens`, `hosts` and `envNames` (a subset of `settings.envNames`). Read `limits.agentChecks` for the plan\'s count and bounds; the interval is at least 6 hours. Write the task as a user would say it and never put a secret in it. The verifier must reset the test account it checks. Ask before creating a connection: it stores the user\'s key and every run is billed to it.\n\n## Status pages\n\nWhen `features.statusPages` is true, the account can publish public pages at `https://waitcher.dev/status/SLUG` ([guide](https://waitcher.dev/docs/status-pages.md)); `limits.statusPages` is the plan\'s count. `waitcher status-page save --file page.json` takes `slug`, `title` and `components` (`monitorId`, a public `name`, optional `group`); `waitcher help status` has the full shape. A page is private until `"published": true` and asks search engines not to index it unless `"indexable": true`. Write public names the user\'s customers would recognise, never a target URL or an internal monitor name; ask before publishing, because the address is public. During an incident, `waitcher incident update --id INCIDENT_ID --kind identified --message TEXT` posts a note to every page that shows it. People can also open an incident no monitor has seen (`incident open --page-id ID --title TEXT --message TEXT [--impact down|degraded|none] [--services "A,B"]`), and change any incident with `incident edit` (title, impact, open or resolved, hidden; `--expected-revision` from `status-page incidents --id PAGE_ID`). On a monitor\'s incident those values win over the monitor until reset (`--state auto`). A page with `"automaticIncidents": false` shows only incidents people open. Everything on these pages is public: only post, open, resolve or hide what the user wrote or approved.\n';
|
|
61422
61434
|
|
|
61423
61435
|
// ../../skills/waitcher/agents/openai.yaml
|
|
61424
61436
|
var openai_default = 'interface:\n display_name: "Waitcher"\n short_description: "Deploy monitoring from a repository and inspect evidence"\n default_prompt: "Use $waitcher to set up monitoring for this repository: pick the critical journeys, verify them locally and deploy them paused through a reviewed plan."\n';
|
|
@@ -61911,6 +61923,86 @@ var maintenanceSchema = external_exports.object({
|
|
|
61911
61923
|
// src/main.ts
|
|
61912
61924
|
import { parseArgs } from "node:util";
|
|
61913
61925
|
|
|
61926
|
+
// ../../src/contracts/status-pages.ts
|
|
61927
|
+
var STATUS_PAGE_LIMITS = Object.freeze({
|
|
61928
|
+
components: 25,
|
|
61929
|
+
// Incidents and daily bars are kept this long for monitors on a page,
|
|
61930
|
+
// whatever the plan's run history.
|
|
61931
|
+
historyDays: 90,
|
|
61932
|
+
adminPages: 10,
|
|
61933
|
+
updates: 20,
|
|
61934
|
+
// Incidents a person opened, kept per page (open and recent).
|
|
61935
|
+
manualIncidents: 200
|
|
61936
|
+
});
|
|
61937
|
+
var plain = (max) => external_exports.string().trim().max(max).refine((v) => !/[\u0000-\u001f\u007f<>]/.test(v), {
|
|
61938
|
+
message: "Use plain text without line breaks or angle brackets"
|
|
61939
|
+
});
|
|
61940
|
+
var statusSlugSchema = external_exports.string().regex(
|
|
61941
|
+
/^[a-z0-9](?:[a-z0-9-]{1,38}[a-z0-9])$/,
|
|
61942
|
+
"Use 3 to 40 lower-case letters, digits or hyphens, starting and ending with a letter or digit"
|
|
61943
|
+
);
|
|
61944
|
+
var statusPageSchema = external_exports.object({
|
|
61945
|
+
slug: statusSlugSchema,
|
|
61946
|
+
title: plain(80).pipe(external_exports.string().min(1)),
|
|
61947
|
+
website: external_exports.string().trim().max(200).url().refine((v) => v.startsWith("https://"), "Use an https:// address").nullable().default(null),
|
|
61948
|
+
historyDays: external_exports.union([external_exports.literal(30), external_exports.literal(90)]).default(90),
|
|
61949
|
+
published: external_exports.boolean().default(false),
|
|
61950
|
+
indexable: external_exports.boolean().default(false),
|
|
61951
|
+
showMaintenance: external_exports.boolean().default(true),
|
|
61952
|
+
// Off: only people open incidents on this page; monitors still alert.
|
|
61953
|
+
automaticIncidents: external_exports.boolean().default(true),
|
|
61954
|
+
components: external_exports.array(
|
|
61955
|
+
external_exports.object({
|
|
61956
|
+
monitorId: external_exports.string().min(1).max(100),
|
|
61957
|
+
name: plain(60).pipe(external_exports.string().min(1)),
|
|
61958
|
+
group: plain(40).default("")
|
|
61959
|
+
}).strict()
|
|
61960
|
+
).max(STATUS_PAGE_LIMITS.components).default([]),
|
|
61961
|
+
expectedRevision: external_exports.number().int().nonnegative().default(0)
|
|
61962
|
+
}).strict().superRefine((v, ctx) => {
|
|
61963
|
+
const seen = /* @__PURE__ */ new Set();
|
|
61964
|
+
v.components.forEach((c, i) => {
|
|
61965
|
+
if (seen.has(c.monitorId))
|
|
61966
|
+
ctx.addIssue({
|
|
61967
|
+
code: "custom",
|
|
61968
|
+
path: ["components", i, "monitorId"],
|
|
61969
|
+
message: "Each monitor can appear once on a page"
|
|
61970
|
+
});
|
|
61971
|
+
seen.add(c.monitorId);
|
|
61972
|
+
});
|
|
61973
|
+
});
|
|
61974
|
+
var INCIDENT_UPDATE_KINDS = [
|
|
61975
|
+
"investigating",
|
|
61976
|
+
"identified",
|
|
61977
|
+
"monitoring",
|
|
61978
|
+
"update"
|
|
61979
|
+
];
|
|
61980
|
+
var incidentUpdateSchema = external_exports.object({
|
|
61981
|
+
kind: external_exports.enum(INCIDENT_UPDATE_KINDS).default("update"),
|
|
61982
|
+
message: external_exports.string().trim().min(1).max(500).refine((v) => !/[\u0000-\u0009\u000b-\u001f\u007f]/.test(v), {
|
|
61983
|
+
message: "Use plain text"
|
|
61984
|
+
})
|
|
61985
|
+
}).strict();
|
|
61986
|
+
var INCIDENT_IMPACTS = ["down", "degraded", "none"];
|
|
61987
|
+
var incidentTitle = plain(120);
|
|
61988
|
+
var serviceNames = external_exports.array(plain(60).pipe(external_exports.string().min(1))).max(25);
|
|
61989
|
+
var incidentOpenSchema = external_exports.object({
|
|
61990
|
+
title: incidentTitle.pipe(external_exports.string().min(1)),
|
|
61991
|
+
impact: external_exports.enum(INCIDENT_IMPACTS).default("down"),
|
|
61992
|
+
// Public service names on the page; empty means the whole page.
|
|
61993
|
+
services: serviceNames.default([]),
|
|
61994
|
+
kind: external_exports.enum(INCIDENT_UPDATE_KINDS).default("investigating"),
|
|
61995
|
+
message: incidentUpdateSchema.shape.message
|
|
61996
|
+
}).strict();
|
|
61997
|
+
var incidentEditSchema = external_exports.object({
|
|
61998
|
+
title: incidentTitle.pipe(external_exports.string().min(1)).nullable().optional(),
|
|
61999
|
+
impact: external_exports.enum(INCIDENT_IMPACTS).nullable().optional(),
|
|
62000
|
+
services: serviceNames.optional(),
|
|
62001
|
+
state: external_exports.enum(["open", "resolved", "auto"]).optional(),
|
|
62002
|
+
hidden: external_exports.boolean().optional(),
|
|
62003
|
+
expectedRevision: external_exports.number().int().nonnegative()
|
|
62004
|
+
}).strict();
|
|
62005
|
+
|
|
61914
62006
|
// src/access.ts
|
|
61915
62007
|
import { lstat as lstat10, open as open16, unlink as unlink3 } from "node:fs/promises";
|
|
61916
62008
|
import { dirname as dirname15, resolve as resolve16 } from "node:path";
|
|
@@ -62658,6 +62750,33 @@ AI connections (when connection settings are enabled; AI execution is separate)
|
|
|
62658
62750
|
Credential writes cannot be replayed. After an uncertain response, inspect
|
|
62659
62751
|
connection list/get and revisions before submitting another write.
|
|
62660
62752
|
|
|
62753
|
+
Status pages
|
|
62754
|
+
status-page list
|
|
62755
|
+
status-page get --id ID
|
|
62756
|
+
status-page save --file PATH [--id ID]
|
|
62757
|
+
status-page delete --id ID --yes
|
|
62758
|
+
status-page incidents --id ID Monitors' and your incidents, with revisions
|
|
62759
|
+
incident update --id ID --message TEXT [--kind investigating|identified|monitoring|update]
|
|
62760
|
+
Posts a public note to every status page that shows the incident
|
|
62761
|
+
incident update-edit --id ID --update-id UPDATE_ID --message TEXT [--kind KIND]
|
|
62762
|
+
incident update-delete --id ID --update-id UPDATE_ID --yes
|
|
62763
|
+
incident open --page-id PAGE_ID --title TEXT --message TEXT
|
|
62764
|
+
[--impact down|degraded|none] [--services "Checkout,API"] [--kind KIND]
|
|
62765
|
+
Opens an incident without a failing monitor; no --services means the whole page
|
|
62766
|
+
incident edit --id ID --expected-revision N [--title TEXT] [--impact down|degraded|none]
|
|
62767
|
+
[--state open|resolved|auto] [--hidden true|false] [--services "A,B"]
|
|
62768
|
+
On a monitor's incident your values win until reset: --state auto,
|
|
62769
|
+
--title "" and --impact "" follow the monitor again; --hidden true
|
|
62770
|
+
removes a false alarm from your pages
|
|
62771
|
+
incident delete --id ID --yes Only incidents you opened
|
|
62772
|
+
JSON: {"slug":"acme","title":"Acme","published":true,"components":
|
|
62773
|
+
[{"monitorId":"UUID","name":"Checkout","group":"Website"}]}
|
|
62774
|
+
Optional: "website":"https://...", "historyDays":30|90, "indexable":false,
|
|
62775
|
+
"showMaintenance":true, "automaticIncidents":true (false: only people open
|
|
62776
|
+
incidents on the page). Updates add "expectedRevision":N (from list).
|
|
62777
|
+
The page lives at https://waitcher.dev/status/SLUG, with .json and .atom.
|
|
62778
|
+
It shows the names you give, never targets, scripts or error messages.
|
|
62779
|
+
|
|
62661
62780
|
Alerts
|
|
62662
62781
|
alert channel list
|
|
62663
62782
|
alert channel save --file PATH [--id ID]
|
|
@@ -62804,12 +62923,12 @@ var commands = (section) => {
|
|
|
62804
62923
|
for (const line of section.split("\n")) {
|
|
62805
62924
|
const m = /^ {2}([a-z]+)(?: ([a-z][a-z|-]*))?/.exec(line);
|
|
62806
62925
|
if (!m || !GROUPS.has(m[1])) continue;
|
|
62807
|
-
const
|
|
62808
|
-
if (m[2])
|
|
62809
|
-
byGroup.set(m[1],
|
|
62926
|
+
const list2 = byGroup.get(m[1]) ?? /* @__PURE__ */ new Set();
|
|
62927
|
+
if (m[2]) list2.add(m[2]);
|
|
62928
|
+
byGroup.set(m[1], list2);
|
|
62810
62929
|
}
|
|
62811
62930
|
return [...byGroup].map(
|
|
62812
|
-
([group,
|
|
62931
|
+
([group, list2]) => list2.size ? `${group}: ${[...list2].join(", ")}` : group
|
|
62813
62932
|
);
|
|
62814
62933
|
};
|
|
62815
62934
|
function helpTopic(topic) {
|
|
@@ -62829,9 +62948,9 @@ ${overview()}`;
|
|
|
62829
62948
|
}
|
|
62830
62949
|
function overview() {
|
|
62831
62950
|
const index = sections.map((section) => {
|
|
62832
|
-
const
|
|
62833
|
-
return
|
|
62834
|
-
${
|
|
62951
|
+
const list2 = commands(section);
|
|
62952
|
+
return list2.length ? `${section.split("\n")[0]}
|
|
62953
|
+
${list2.join("\n ")}` : "";
|
|
62835
62954
|
}).filter(Boolean).join("\n");
|
|
62836
62955
|
return `${intro}
|
|
62837
62956
|
|
|
@@ -62857,7 +62976,7 @@ ${exitCodes}
|
|
|
62857
62976
|
// package.json
|
|
62858
62977
|
var package_default = {
|
|
62859
62978
|
name: "@waitcher/cli",
|
|
62860
|
-
version: "0.2.
|
|
62979
|
+
version: "0.2.18",
|
|
62861
62980
|
description: "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API, browser and visual monitors from waitcher.json.",
|
|
62862
62981
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
62863
62982
|
author: "S\u0142awomir Radzymi\u0144ski",
|
|
@@ -62902,6 +63021,8 @@ var package_default = {
|
|
|
62902
63021
|
};
|
|
62903
63022
|
|
|
62904
63023
|
// src/main.ts
|
|
63024
|
+
var list = (text2) => (text2 ?? "").split(",").map((x) => x.trim()).filter(Boolean);
|
|
63025
|
+
var issues = (all) => all.map((i) => `${i.path.join(".")}: ${i.message}`).join("\n");
|
|
62905
63026
|
var controller = new AbortController();
|
|
62906
63027
|
process.once("SIGINT", () => controller.abort());
|
|
62907
63028
|
process.once("SIGTERM", () => controller.abort());
|
|
@@ -63013,6 +63134,15 @@ async function main() {
|
|
|
63013
63134
|
"calibration-id": { type: "string" },
|
|
63014
63135
|
role: { type: "string" },
|
|
63015
63136
|
note: { type: "string" },
|
|
63137
|
+
kind: { type: "string" },
|
|
63138
|
+
message: { type: "string" },
|
|
63139
|
+
title: { type: "string" },
|
|
63140
|
+
impact: { type: "string" },
|
|
63141
|
+
services: { type: "string" },
|
|
63142
|
+
state: { type: "string" },
|
|
63143
|
+
hidden: { type: "string" },
|
|
63144
|
+
"page-id": { type: "string" },
|
|
63145
|
+
"update-id": { type: "string" },
|
|
63016
63146
|
"request-key": { type: "string" },
|
|
63017
63147
|
"expected-revision": { type: "string" },
|
|
63018
63148
|
"project-id": { type: "string" },
|
|
@@ -63318,6 +63448,32 @@ async function main() {
|
|
|
63318
63448
|
"run wait": ["id", "timeout", "brief"],
|
|
63319
63449
|
"report get": ["days", "demo"],
|
|
63320
63450
|
"incident list": ["demo"],
|
|
63451
|
+
"incident update": ["id", "kind", "message"],
|
|
63452
|
+
"incident open": [
|
|
63453
|
+
"page-id",
|
|
63454
|
+
"title",
|
|
63455
|
+
"message",
|
|
63456
|
+
"impact",
|
|
63457
|
+
"services",
|
|
63458
|
+
"kind"
|
|
63459
|
+
],
|
|
63460
|
+
"incident edit": [
|
|
63461
|
+
"id",
|
|
63462
|
+
"title",
|
|
63463
|
+
"impact",
|
|
63464
|
+
"services",
|
|
63465
|
+
"state",
|
|
63466
|
+
"hidden",
|
|
63467
|
+
"expected-revision"
|
|
63468
|
+
],
|
|
63469
|
+
"incident delete": ["id", "yes"],
|
|
63470
|
+
"incident update-edit": ["id", "update-id", "kind", "message"],
|
|
63471
|
+
"incident update-delete": ["id", "update-id", "yes"],
|
|
63472
|
+
"status-page incidents": ["id"],
|
|
63473
|
+
"status-page list": [],
|
|
63474
|
+
"status-page get": ["id"],
|
|
63475
|
+
"status-page save": ["file", "id"],
|
|
63476
|
+
"status-page delete": ["id", "yes"],
|
|
63321
63477
|
"alert channel list": [],
|
|
63322
63478
|
"alert channel save": [
|
|
63323
63479
|
"file",
|
|
@@ -63439,7 +63595,7 @@ async function main() {
|
|
|
63439
63595
|
issues: r.issues
|
|
63440
63596
|
};
|
|
63441
63597
|
});
|
|
63442
|
-
const
|
|
63598
|
+
const issues2 = [
|
|
63443
63599
|
...built.issues,
|
|
63444
63600
|
...names.length ? environments.flatMap(
|
|
63445
63601
|
(e) => e.issues.map((i) => ({ ...i, environment: e.name }))
|
|
@@ -63463,8 +63619,8 @@ async function main() {
|
|
|
63463
63619
|
keys: v.key,
|
|
63464
63620
|
signal: controller.signal
|
|
63465
63621
|
}) : null;
|
|
63466
|
-
if (local)
|
|
63467
|
-
const ok = !
|
|
63622
|
+
if (local) issues2.push(...local.issues);
|
|
63623
|
+
const ok = !issues2.some((i) => i.severity === "error");
|
|
63468
63624
|
process.stdout.write(
|
|
63469
63625
|
JSON.stringify({
|
|
63470
63626
|
event: "validated",
|
|
@@ -63475,13 +63631,13 @@ async function main() {
|
|
|
63475
63631
|
environments: environments.map(({ issues: _, ...e }) => e),
|
|
63476
63632
|
builds: built.builds,
|
|
63477
63633
|
...local ? { verify: local.runs } : {},
|
|
63478
|
-
issues,
|
|
63634
|
+
issues: issues2,
|
|
63479
63635
|
next: ok ? [
|
|
63480
63636
|
`waitcher deploy plan --file ${path2} --env ${names[0]} checks account permissions, quotas and changes`
|
|
63481
63637
|
] : [`Fix the error issues in ${path2} and validate again`]
|
|
63482
63638
|
}) + "\n"
|
|
63483
63639
|
);
|
|
63484
|
-
process.exitCode = ok ? 0 :
|
|
63640
|
+
process.exitCode = ok ? 0 : issues2.some((i) => i.severity === "error" && i.code !== "VERIFY_FAILED") ? 2 : 4;
|
|
63485
63641
|
return;
|
|
63486
63642
|
}
|
|
63487
63643
|
if (command === "ci init") {
|
|
@@ -65285,6 +65441,118 @@ async function main() {
|
|
|
65285
65441
|
const days = integer2(v.days ?? "1", "days", 1, 14);
|
|
65286
65442
|
if (![1, 7, 14].includes(days)) usage2("days must be 1, 7 or 14.");
|
|
65287
65443
|
result2 = await api(`reports?days=${days}&demo=${Boolean(v.demo)}`);
|
|
65444
|
+
} else if (command === "incident update") {
|
|
65445
|
+
if (!v.message)
|
|
65446
|
+
usage2("Provide --message TEXT, shown on your status pages.");
|
|
65447
|
+
const parsed2 = incidentUpdateSchema.safeParse({
|
|
65448
|
+
kind: v.kind ?? "update",
|
|
65449
|
+
message: v.message
|
|
65450
|
+
});
|
|
65451
|
+
if (!parsed2.success)
|
|
65452
|
+
usage2(
|
|
65453
|
+
parsed2.error.issues.map((issue3) => `${issue3.path.join(".")}: ${issue3.message}`).join("\n")
|
|
65454
|
+
);
|
|
65455
|
+
result2 = await api(`incidents/${id3(v.id)}/updates`, {
|
|
65456
|
+
method: "POST",
|
|
65457
|
+
body: parsed2.data
|
|
65458
|
+
});
|
|
65459
|
+
} else if (command === "incident open") {
|
|
65460
|
+
const parsed2 = incidentOpenSchema.safeParse({
|
|
65461
|
+
title: v.title,
|
|
65462
|
+
message: v.message,
|
|
65463
|
+
...v.impact ? { impact: v.impact } : {},
|
|
65464
|
+
...v.kind ? { kind: v.kind } : {},
|
|
65465
|
+
services: list(v.services)
|
|
65466
|
+
});
|
|
65467
|
+
if (!parsed2.success) usage2(issues(parsed2.error.issues));
|
|
65468
|
+
result2 = await api(`status-pages/${id3(v["page-id"])}/incidents`, {
|
|
65469
|
+
method: "POST",
|
|
65470
|
+
body: parsed2.data
|
|
65471
|
+
});
|
|
65472
|
+
} else if (command === "incident edit") {
|
|
65473
|
+
if (v["expected-revision"] === void 0)
|
|
65474
|
+
usage2(
|
|
65475
|
+
"Provide --expected-revision N from status-page incidents (0 for a monitor's incident you have not changed)."
|
|
65476
|
+
);
|
|
65477
|
+
if (v.hidden !== void 0 && !["true", "false"].includes(v.hidden))
|
|
65478
|
+
usage2("--hidden takes true or false.");
|
|
65479
|
+
const parsed2 = incidentEditSchema.safeParse({
|
|
65480
|
+
...v.title !== void 0 ? { title: v.title === "" ? null : v.title } : {},
|
|
65481
|
+
...v.impact !== void 0 ? { impact: v.impact === "" ? null : v.impact } : {},
|
|
65482
|
+
...v.services !== void 0 ? { services: list(v.services) } : {},
|
|
65483
|
+
...v.state !== void 0 ? { state: v.state } : {},
|
|
65484
|
+
...v.hidden !== void 0 ? { hidden: v.hidden === "true" } : {},
|
|
65485
|
+
expectedRevision: integer2(
|
|
65486
|
+
v["expected-revision"],
|
|
65487
|
+
"expected-revision",
|
|
65488
|
+
0,
|
|
65489
|
+
1e6
|
|
65490
|
+
)
|
|
65491
|
+
});
|
|
65492
|
+
if (!parsed2.success) usage2(issues(parsed2.error.issues));
|
|
65493
|
+
result2 = await api(`incidents/${id3(v.id)}/public`, {
|
|
65494
|
+
method: "PUT",
|
|
65495
|
+
body: parsed2.data
|
|
65496
|
+
});
|
|
65497
|
+
} else if (command === "incident delete") {
|
|
65498
|
+
if (!v.yes)
|
|
65499
|
+
usage2(
|
|
65500
|
+
"This removes the incident and its updates from your page. Pass --yes to confirm."
|
|
65501
|
+
);
|
|
65502
|
+
result2 = await api(`incidents/${id3(v.id)}/public`, {
|
|
65503
|
+
method: "DELETE",
|
|
65504
|
+
body: {}
|
|
65505
|
+
});
|
|
65506
|
+
} else if (command === "incident update-edit") {
|
|
65507
|
+
const parsed2 = incidentUpdateSchema.safeParse({
|
|
65508
|
+
kind: v.kind ?? "update",
|
|
65509
|
+
message: v.message
|
|
65510
|
+
});
|
|
65511
|
+
if (!parsed2.success) usage2(issues(parsed2.error.issues));
|
|
65512
|
+
result2 = await api(
|
|
65513
|
+
`incidents/${id3(v.id)}/updates/${id3(v["update-id"])}`,
|
|
65514
|
+
{ method: "PUT", body: parsed2.data }
|
|
65515
|
+
);
|
|
65516
|
+
} else if (command === "incident update-delete") {
|
|
65517
|
+
if (!v.yes) usage2("Pass --yes to delete the update from your pages.");
|
|
65518
|
+
result2 = await api(
|
|
65519
|
+
`incidents/${id3(v.id)}/updates/${id3(v["update-id"])}`,
|
|
65520
|
+
{ method: "DELETE", body: {} }
|
|
65521
|
+
);
|
|
65522
|
+
} else if (command === "status-page incidents")
|
|
65523
|
+
result2 = await api(`status-pages/${id3(v.id)}/incidents`);
|
|
65524
|
+
else if (command === "status-page list") result2 = await api("status-pages");
|
|
65525
|
+
else if (command === "status-page get")
|
|
65526
|
+
result2 = await api(`status-pages/${id3(v.id)}`);
|
|
65527
|
+
else if (command === "status-page save") {
|
|
65528
|
+
if (!v.file) usage2("Provide --file PATH for the status page.");
|
|
65529
|
+
let input2;
|
|
65530
|
+
try {
|
|
65531
|
+
const text2 = await readFile11(v.file, "utf8");
|
|
65532
|
+
if (Buffer.byteLength(text2) > 96e3)
|
|
65533
|
+
usage2("Configuration exceeds 96 KB.");
|
|
65534
|
+
input2 = JSON.parse(text2);
|
|
65535
|
+
} catch {
|
|
65536
|
+
usage2("Could not read valid JSON configuration.");
|
|
65537
|
+
}
|
|
65538
|
+
const parsed2 = statusPageSchema.safeParse(input2);
|
|
65539
|
+
if (!parsed2.success)
|
|
65540
|
+
usage2(
|
|
65541
|
+
parsed2.error.issues.map((issue3) => `${issue3.path.join(".")}: ${issue3.message}`).join("\n")
|
|
65542
|
+
);
|
|
65543
|
+
result2 = await api(`status-pages${v.id ? "/" + id3(v.id) : ""}`, {
|
|
65544
|
+
method: v.id ? "PUT" : "POST",
|
|
65545
|
+
body: parsed2.data
|
|
65546
|
+
});
|
|
65547
|
+
} else if (command === "status-page delete") {
|
|
65548
|
+
if (!v.yes)
|
|
65549
|
+
usage2(
|
|
65550
|
+
"The page's address stops working within a minute. Pass --yes to confirm."
|
|
65551
|
+
);
|
|
65552
|
+
result2 = await api(`status-pages/${id3(v.id)}`, {
|
|
65553
|
+
method: "DELETE",
|
|
65554
|
+
body: {}
|
|
65555
|
+
});
|
|
65288
65556
|
} else if (command === "incident list") {
|
|
65289
65557
|
const monitors = (await api("monitors")).filter(
|
|
65290
65558
|
(m) => Boolean(m.demo) === Boolean(v.demo)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waitcher/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"description": "Synthetic monitoring from your repository: deploy HTTP, certificate, heartbeat, API, browser and visual monitors from waitcher.json.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Sławomir Radzymiński",
|