@jevitate/cli 0.1.0 → 0.3.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/README.md +23 -0
- package/dist/ai-cli.d.ts +31 -11
- package/dist/ai-cli.js +131 -88
- package/dist/ai-cli.js.map +1 -1
- package/dist/author-journey-cli.d.ts +4 -0
- package/dist/author-journey-cli.js +111 -0
- package/dist/author-journey-cli.js.map +1 -0
- package/dist/bin.js +60349 -16477
- package/dist/bin.js.map +1 -1
- package/dist/browser-run-options.d.ts +89 -0
- package/dist/browser-run-options.js +175 -0
- package/dist/browser-run-options.js.map +1 -0
- package/dist/build-info.generated.d.ts +2 -0
- package/dist/build-info.generated.js +10 -0
- package/dist/build-info.generated.js.map +1 -0
- package/dist/campaign-api.d.ts +151 -0
- package/dist/campaign-api.js +446 -0
- package/dist/campaign-api.js.map +1 -0
- package/dist/campaign-cli.d.ts +6 -0
- package/dist/campaign-cli.js +66 -0
- package/dist/campaign-cli.js.map +1 -0
- package/dist/check-api.d.ts +5 -0
- package/dist/check-api.js +234 -0
- package/dist/check-api.js.map +1 -0
- package/dist/check-budget.d.ts +26 -0
- package/dist/check-budget.js +90 -0
- package/dist/check-budget.js.map +1 -0
- package/dist/check-cli.d.ts +31 -0
- package/dist/check-cli.js +109 -0
- package/dist/check-cli.js.map +1 -0
- package/dist/check-execute.d.ts +29 -0
- package/dist/check-execute.js +420 -0
- package/dist/check-execute.js.map +1 -0
- package/dist/check-plan.d.ts +118 -0
- package/dist/check-plan.js +516 -0
- package/dist/check-plan.js.map +1 -0
- package/dist/check-suite.d.ts +184 -0
- package/dist/check-suite.js +540 -0
- package/dist/check-suite.js.map +1 -0
- package/dist/check-types.d.ts +181 -0
- package/dist/check-types.js +35 -0
- package/dist/check-types.js.map +1 -0
- package/dist/cli-args.d.ts +26 -0
- package/dist/cli-args.js +50 -0
- package/dist/cli-args.js.map +1 -0
- package/dist/cli-output.d.ts +106 -0
- package/dist/cli-output.js +563 -0
- package/dist/cli-output.js.map +1 -0
- package/dist/cli-reference.d.ts +3 -0
- package/dist/cli-reference.js +81 -0
- package/dist/cli-reference.js.map +1 -0
- package/dist/cli-refusal.d.ts +12 -0
- package/dist/cli-refusal.js +52 -0
- package/dist/cli-refusal.js.map +1 -0
- package/dist/cli-shared.d.ts +340 -0
- package/dist/cli-shared.js +537 -0
- package/dist/cli-shared.js.map +1 -0
- package/dist/cli-surface.d.ts +33 -0
- package/dist/cli-surface.js +48 -0
- package/dist/cli-surface.js.map +1 -0
- package/dist/conversation-options.d.ts +15 -0
- package/dist/conversation-options.js +10 -0
- package/dist/conversation-options.js.map +1 -0
- package/dist/credentials-file.d.ts +15 -0
- package/dist/credentials-file.js +56 -0
- package/dist/credentials-file.js.map +1 -0
- package/dist/data-dir.d.ts +1 -1
- package/dist/data-dir.js +1 -1
- package/dist/defect-evidence.d.ts +141 -0
- package/dist/defect-evidence.js +505 -0
- package/dist/defect-evidence.js.map +1 -0
- package/dist/demo-aspect-api.d.ts +209 -0
- package/dist/demo-aspect-api.js +398 -0
- package/dist/demo-aspect-api.js.map +1 -0
- package/dist/demo-aspect-cli.d.ts +3 -0
- package/dist/demo-aspect-cli.js +243 -0
- package/dist/demo-aspect-cli.js.map +1 -0
- package/dist/demo-capture.d.ts +142 -0
- package/dist/demo-capture.js +537 -0
- package/dist/demo-capture.js.map +1 -0
- package/dist/engine.d.ts +35 -0
- package/dist/engine.js +25 -0
- package/dist/engine.js.map +1 -0
- package/dist/environments.d.ts +155 -0
- package/dist/environments.js +364 -0
- package/dist/environments.js.map +1 -0
- package/dist/exit-codes.d.ts +46 -0
- package/dist/exit-codes.js +91 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/explore-adversarial.d.ts +144 -0
- package/dist/explore-adversarial.js +227 -0
- package/dist/explore-adversarial.js.map +1 -0
- package/dist/explore-api.d.ts +7 -187
- package/dist/explore-api.js +7 -301
- package/dist/explore-api.js.map +1 -1
- package/dist/explore-author.d.ts +79 -0
- package/dist/explore-author.js +86 -0
- package/dist/explore-author.js.map +1 -0
- package/dist/explore-cli.d.ts +7 -0
- package/dist/explore-cli.js +1199 -0
- package/dist/explore-cli.js.map +1 -0
- package/dist/explore-coverage.d.ts +173 -0
- package/dist/explore-coverage.js +246 -0
- package/dist/explore-coverage.js.map +1 -0
- package/dist/explore-feature.d.ts +125 -0
- package/dist/explore-feature.js +218 -0
- package/dist/explore-feature.js.map +1 -0
- package/dist/explore-goal.d.ts +271 -0
- package/dist/explore-goal.js +417 -0
- package/dist/explore-goal.js.map +1 -0
- package/dist/explore-shared.d.ts +177 -0
- package/dist/explore-shared.js +149 -0
- package/dist/explore-shared.js.map +1 -0
- package/dist/explore-specs.d.ts +53 -0
- package/dist/explore-specs.js +333 -0
- package/dist/explore-specs.js.map +1 -0
- package/dist/findings-filing.d.ts +64 -0
- package/dist/findings-filing.js +108 -0
- package/dist/findings-filing.js.map +1 -0
- package/dist/fixture-auth.d.ts +63 -0
- package/dist/fixture-auth.js +95 -0
- package/dist/fixture-auth.js.map +1 -0
- package/dist/fixture-cli.d.ts +99 -0
- package/dist/fixture-cli.js +292 -0
- package/dist/fixture-cli.js.map +1 -0
- package/dist/github-issue-filer.d.ts +62 -0
- package/dist/github-issue-filer.js +189 -0
- package/dist/github-issue-filer.js.map +1 -0
- package/dist/host-health-run.d.ts +25 -0
- package/dist/host-health-run.js +33 -0
- package/dist/host-health-run.js.map +1 -0
- package/dist/http-5xx-outcome.d.ts +6 -0
- package/dist/http-5xx-outcome.js +39 -0
- package/dist/http-5xx-outcome.js.map +1 -0
- package/dist/inbox-cli.d.ts +7 -0
- package/dist/inbox-cli.js +197 -0
- package/dist/inbox-cli.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/init-cli.d.ts +4 -0
- package/dist/init-cli.js +156 -0
- package/dist/init-cli.js.map +1 -0
- package/dist/init-keys.d.ts +30 -2
- package/dist/init-keys.js +19 -5
- package/dist/init-keys.js.map +1 -1
- package/dist/init-next-steps.d.ts +35 -0
- package/dist/init-next-steps.js +79 -0
- package/dist/init-next-steps.js.map +1 -0
- package/dist/invariants-file.d.ts +34 -0
- package/dist/invariants-file.js +68 -0
- package/dist/invariants-file.js.map +1 -0
- package/dist/invariants-validate.d.ts +30 -0
- package/dist/invariants-validate.js +105 -0
- package/dist/invariants-validate.js.map +1 -0
- package/dist/journey-annotate-api.d.ts +76 -0
- package/dist/journey-annotate-api.js +269 -0
- package/dist/journey-annotate-api.js.map +1 -0
- package/dist/journey-annotate-cli.d.ts +9 -0
- package/dist/journey-annotate-cli.js +181 -0
- package/dist/journey-annotate-cli.js.map +1 -0
- package/dist/journey-api.d.ts +104 -2
- package/dist/journey-api.js +163 -20
- package/dist/journey-api.js.map +1 -1
- package/dist/journey-cli.d.ts +4 -0
- package/dist/journey-cli.js +411 -0
- package/dist/journey-cli.js.map +1 -0
- package/dist/journey-demo-api.d.ts +114 -0
- package/dist/journey-demo-api.js +405 -0
- package/dist/journey-demo-api.js.map +1 -0
- package/dist/journey-demo-cli.d.ts +10 -0
- package/dist/journey-demo-cli.js +158 -0
- package/dist/journey-demo-cli.js.map +1 -0
- package/dist/journey-prefix.d.ts +194 -0
- package/dist/journey-prefix.js +279 -0
- package/dist/journey-prefix.js.map +1 -0
- package/dist/key-report.d.ts +49 -0
- package/dist/key-report.js +101 -0
- package/dist/key-report.js.map +1 -0
- package/dist/kill-signal.d.ts +193 -0
- package/dist/kill-signal.js +283 -0
- package/dist/kill-signal.js.map +1 -0
- package/dist/launch-armed.d.ts +37 -0
- package/dist/launch-armed.js +31 -0
- package/dist/launch-armed.js.map +1 -0
- package/dist/ledger-api.d.ts +106 -0
- package/dist/ledger-api.js +239 -0
- package/dist/ledger-api.js.map +1 -0
- package/dist/ledger-cli.d.ts +18 -0
- package/dist/ledger-cli.js +107 -0
- package/dist/ledger-cli.js.map +1 -0
- package/dist/load-api.d.ts +29 -11
- package/dist/load-api.js +23 -15
- package/dist/load-api.js.map +1 -1
- package/dist/load-cli.d.ts +4 -0
- package/dist/load-cli.js +97 -0
- package/dist/load-cli.js.map +1 -0
- package/dist/log-correlation.d.ts +200 -0
- package/dist/log-correlation.js +394 -0
- package/dist/log-correlation.js.map +1 -0
- package/dist/log-lines.d.ts +131 -0
- package/dist/log-lines.js +389 -0
- package/dist/log-lines.js.map +1 -0
- package/dist/log-sources.d.ts +71 -0
- package/dist/log-sources.js +236 -0
- package/dist/log-sources.js.map +1 -0
- package/dist/log-trace.d.ts +80 -0
- package/dist/log-trace.js +210 -0
- package/dist/log-trace.js.map +1 -0
- package/dist/logs-cli.d.ts +3 -0
- package/dist/logs-cli.js +51 -0
- package/dist/logs-cli.js.map +1 -0
- package/dist/logs-retention.d.ts +28 -0
- package/dist/logs-retention.js +85 -0
- package/dist/logs-retention.js.map +1 -0
- package/dist/masked-input.d.ts +22 -0
- package/dist/masked-input.js +99 -0
- package/dist/masked-input.js.map +1 -0
- package/dist/mcp-api.d.ts +91 -1
- package/dist/mcp-api.js +514 -18
- package/dist/mcp-api.js.map +1 -1
- package/dist/mcp-args.d.ts +50 -0
- package/dist/mcp-args.js +164 -0
- package/dist/mcp-args.js.map +1 -0
- package/dist/mcp-cli-bridge.d.ts +34 -0
- package/dist/mcp-cli-bridge.js +62 -0
- package/dist/mcp-cli-bridge.js.map +1 -0
- package/dist/mcp-cli-runner.d.ts +29 -0
- package/dist/mcp-cli-runner.js +44 -0
- package/dist/mcp-cli-runner.js.map +1 -0
- package/dist/mcp-cli-tools.d.ts +129 -0
- package/dist/mcp-cli-tools.js +737 -0
- package/dist/mcp-cli-tools.js.map +1 -0
- package/dist/mcp-paths.d.ts +28 -0
- package/dist/mcp-paths.js +76 -0
- package/dist/mcp-paths.js.map +1 -0
- package/dist/mission-actors.d.ts +40 -0
- package/dist/mission-actors.js +72 -0
- package/dist/mission-actors.js.map +1 -0
- package/dist/mission-api.d.ts +35 -0
- package/dist/mission-api.js +60 -3
- package/dist/mission-api.js.map +1 -1
- package/dist/mission-cli.d.ts +4 -0
- package/dist/mission-cli.js +248 -0
- package/dist/mission-cli.js.map +1 -0
- package/dist/mission-exit.d.ts +22 -0
- package/dist/mission-exit.js +26 -0
- package/dist/mission-exit.js.map +1 -0
- package/dist/mission-fixtures.d.ts +234 -0
- package/dist/mission-fixtures.js +862 -0
- package/dist/mission-fixtures.js.map +1 -0
- package/dist/mission-journal.d.ts +60 -0
- package/dist/mission-journal.js +115 -0
- package/dist/mission-journal.js.map +1 -0
- package/dist/mission-queue-cli.d.ts +10 -0
- package/dist/mission-queue-cli.js +198 -0
- package/dist/mission-queue-cli.js.map +1 -0
- package/dist/mission-queue-runner.d.ts +126 -0
- package/dist/mission-queue-runner.js +406 -0
- package/dist/mission-queue-runner.js.map +1 -0
- package/dist/multi-run-cli.d.ts +37 -0
- package/dist/multi-run-cli.js +116 -0
- package/dist/multi-run-cli.js.map +1 -0
- package/dist/multi-run.d.ts +339 -0
- package/dist/multi-run.js +619 -0
- package/dist/multi-run.js.map +1 -0
- package/dist/openrouter-call.d.ts +22 -0
- package/dist/openrouter-call.js +64 -0
- package/dist/openrouter-call.js.map +1 -0
- package/dist/profile-cli.d.ts +4 -0
- package/dist/profile-cli.js +57 -0
- package/dist/profile-cli.js.map +1 -0
- package/dist/program.d.ts +3 -75
- package/dist/program.js +123 -1921
- package/dist/program.js.map +1 -1
- package/dist/project-dir.d.ts +96 -0
- package/dist/project-dir.js +221 -0
- package/dist/project-dir.js.map +1 -0
- package/dist/record-api.d.ts +13 -7
- package/dist/record-api.js +44 -30
- package/dist/record-api.js.map +1 -1
- package/dist/record-cli.d.ts +4 -0
- package/dist/record-cli.js +76 -0
- package/dist/record-cli.js.map +1 -0
- package/dist/recording-cli.d.ts +4 -0
- package/dist/recording-cli.js +248 -0
- package/dist/recording-cli.js.map +1 -0
- package/dist/regression-api.d.ts +107 -0
- package/dist/regression-api.js +387 -6
- package/dist/regression-api.js.map +1 -1
- package/dist/regression-cli.d.ts +4 -0
- package/dist/regression-cli.js +284 -0
- package/dist/regression-cli.js.map +1 -0
- package/dist/report-api.d.ts +146 -0
- package/dist/report-api.js +431 -0
- package/dist/report-api.js.map +1 -0
- package/dist/report-cli.d.ts +12 -0
- package/dist/report-cli.js +147 -0
- package/dist/report-cli.js.map +1 -0
- package/dist/resource-preflight.d.ts +87 -0
- package/dist/resource-preflight.js +160 -0
- package/dist/resource-preflight.js.map +1 -0
- package/dist/result-schema.d.ts +22 -0
- package/dist/result-schema.js +28 -0
- package/dist/result-schema.js.map +1 -0
- package/dist/run-index.d.ts +29 -0
- package/dist/run-index.js +70 -0
- package/dist/run-index.js.map +1 -0
- package/dist/run-key-preflight.d.ts +42 -0
- package/dist/run-key-preflight.js +82 -0
- package/dist/run-key-preflight.js.map +1 -0
- package/dist/run-screenshots.d.ts +123 -0
- package/dist/run-screenshots.js +235 -0
- package/dist/run-screenshots.js.map +1 -0
- package/dist/runtime-env.d.ts +8 -0
- package/dist/runtime-env.js +23 -0
- package/dist/runtime-env.js.map +1 -0
- package/dist/secret-args.d.ts +23 -0
- package/dist/secret-args.js +45 -0
- package/dist/secret-args.js.map +1 -0
- package/dist/serve-cli.d.ts +4 -0
- package/dist/serve-cli.js +95 -0
- package/dist/serve-cli.js.map +1 -0
- package/dist/server-log-verify.d.ts +36 -0
- package/dist/server-log-verify.js +120 -0
- package/dist/server-log-verify.js.map +1 -0
- package/dist/session-check.d.ts +14 -0
- package/dist/session-check.js +44 -0
- package/dist/session-check.js.map +1 -0
- package/dist/site-cli.d.ts +4 -0
- package/dist/site-cli.js +127 -0
- package/dist/site-cli.js.map +1 -0
- package/dist/site-gate-cli.d.ts +28 -0
- package/dist/site-gate-cli.js +59 -0
- package/dist/site-gate-cli.js.map +1 -0
- package/dist/source-api.js +20 -4
- package/dist/source-api.js.map +1 -1
- package/dist/source-cli.d.ts +4 -0
- package/dist/source-cli.js +284 -0
- package/dist/source-cli.js.map +1 -0
- package/dist/source-run-api.d.ts +27 -1
- package/dist/source-run-api.js +22 -11
- package/dist/source-run-api.js.map +1 -1
- package/dist/storage-state-snapshot.d.ts +50 -0
- package/dist/storage-state-snapshot.js +87 -0
- package/dist/storage-state-snapshot.js.map +1 -0
- package/dist/suite-explore-options.d.ts +321 -0
- package/dist/suite-explore-options.js +162 -0
- package/dist/suite-explore-options.js.map +1 -0
- package/dist/target-config.d.ts +115 -0
- package/dist/target-config.js +225 -0
- package/dist/target-config.js.map +1 -0
- package/dist/transcript-file.d.ts +12 -0
- package/dist/transcript-file.js +23 -0
- package/dist/transcript-file.js.map +1 -0
- package/dist/type-fixture-file.d.ts +9 -0
- package/dist/type-fixture-file.js +48 -0
- package/dist/type-fixture-file.js.map +1 -0
- package/dist/ui-api.d.ts +3 -0
- package/dist/ui-api.js +11 -4
- package/dist/ui-api.js.map +1 -1
- package/dist/usability-capture.d.ts +43 -0
- package/dist/usability-capture.js +327 -0
- package/dist/usability-capture.js.map +1 -0
- package/dist/usage-config.d.ts +36 -0
- package/dist/usage-config.js +114 -0
- package/dist/usage-config.js.map +1 -0
- package/dist/ux-api.d.ts +3 -75
- package/dist/ux-api.js +3 -220
- package/dist/ux-api.js.map +1 -1
- package/dist/ux-claim-probe.d.ts +45 -0
- package/dist/ux-claim-probe.js +386 -0
- package/dist/ux-claim-probe.js.map +1 -0
- package/dist/ux-cli.d.ts +4 -0
- package/dist/ux-cli.js +109 -0
- package/dist/ux-cli.js.map +1 -0
- package/dist/ux-config.d.ts +29 -0
- package/dist/ux-config.js +103 -0
- package/dist/ux-config.js.map +1 -0
- package/dist/ux-evidence.d.ts +54 -0
- package/dist/ux-evidence.js +197 -0
- package/dist/ux-evidence.js.map +1 -0
- package/dist/ux-product.d.ts +14 -0
- package/dist/ux-product.js +39 -0
- package/dist/ux-product.js.map +1 -0
- package/dist/ux-review.d.ts +116 -0
- package/dist/ux-review.js +171 -0
- package/dist/ux-review.js.map +1 -0
- package/dist/ux-usability.d.ts +263 -0
- package/dist/ux-usability.js +580 -0
- package/dist/ux-usability.js.map +1 -0
- package/dist/verify-fix-api.d.ts +194 -0
- package/dist/verify-fix-api.js +506 -0
- package/dist/verify-fix-api.js.map +1 -0
- package/dist/verify-fix-cli.d.ts +4 -0
- package/dist/verify-fix-cli.js +115 -0
- package/dist/verify-fix-cli.js.map +1 -0
- package/package.json +23 -18
- package/skills/jevitate-ci-check/SKILL.md +77 -0
- package/skills/jevitate-demo/SKILL.md +61 -0
- package/skills/jevitate-explore/SKILL.md +96 -87
- package/skills/jevitate-getting-started/SKILL.md +89 -0
- package/skills/jevitate-load-test/SKILL.md +11 -2
- package/skills/jevitate-mission-scope/SKILL.md +19 -11
- package/skills/jevitate-record/SKILL.md +23 -5
- package/skills/jevitate-run-journey/SKILL.md +61 -17
- package/skills/jevitate-sources/SKILL.md +57 -14
- package/skills/jevitate-test-campaign/SKILL.md +203 -0
- package/skills/jevitate-ux-review/SKILL.md +106 -16
- package/skills/jevitate-verify-fix/SKILL.md +76 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { readFileSync, readdirSync, rmSync, rmdirSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { resolveDataDir } from "./data-dir.js";
|
|
4
|
+
import { clock } from "@jevitate/domain";
|
|
5
|
+
export const DEFAULT_LOGS_RETENTION = { ttlDays: 14, keepLatest: 50 };
|
|
6
|
+
export class LogsConfigError extends Error {
|
|
7
|
+
code = "E_LOGS_CONFIG";
|
|
8
|
+
}
|
|
9
|
+
/** The `logs` section of the config file; the defaults when the file or section is absent. A malformed value fails closed. */
|
|
10
|
+
export function loadLogsRetention(path = resolveDataDir(["config.json"])) {
|
|
11
|
+
let raw;
|
|
12
|
+
try {
|
|
13
|
+
raw = readFileSync(path, "utf8");
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
if (typeof e === "object" && e !== null && "code" in e && e.code === "ENOENT")
|
|
17
|
+
return DEFAULT_LOGS_RETENTION;
|
|
18
|
+
throw new LogsConfigError(`cannot read ${path}: ${e instanceof Error ? e.message : String(e)}`);
|
|
19
|
+
}
|
|
20
|
+
let parsed;
|
|
21
|
+
try {
|
|
22
|
+
parsed = JSON.parse(raw);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
throw new LogsConfigError(`${path} is not valid JSON`);
|
|
26
|
+
}
|
|
27
|
+
const logs = parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed.logs : undefined;
|
|
28
|
+
if (logs === undefined)
|
|
29
|
+
return DEFAULT_LOGS_RETENTION;
|
|
30
|
+
if (logs === null || typeof logs !== "object" || Array.isArray(logs))
|
|
31
|
+
throw new LogsConfigError(`${path}: "logs" must be an object`);
|
|
32
|
+
const o = logs;
|
|
33
|
+
const int = (k) => {
|
|
34
|
+
const v = o[k];
|
|
35
|
+
if (v === undefined)
|
|
36
|
+
return DEFAULT_LOGS_RETENTION[k];
|
|
37
|
+
if (typeof v !== "number" || !Number.isInteger(v) || v < 0)
|
|
38
|
+
throw new LogsConfigError(`${path}: logs.${k} must be a non-negative integer, got ${JSON.stringify(v)}`);
|
|
39
|
+
return v;
|
|
40
|
+
};
|
|
41
|
+
return { ttlDays: int("ttlDays"), keepLatest: int("keepLatest") };
|
|
42
|
+
}
|
|
43
|
+
const RUN_KEY = /^([a-z][a-z-]*-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z)/;
|
|
44
|
+
function runsIn(root) {
|
|
45
|
+
let dates;
|
|
46
|
+
try {
|
|
47
|
+
dates = readdirSync(root).filter((d) => /^\d{4}-\d{2}-\d{2}$/.test(d));
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
if (typeof e === "object" && e !== null && "code" in e && e.code === "ENOENT")
|
|
51
|
+
return { runs: [], dateDirs: [] };
|
|
52
|
+
throw e;
|
|
53
|
+
}
|
|
54
|
+
const byKey = new Map();
|
|
55
|
+
for (const date of dates) {
|
|
56
|
+
for (const name of readdirSync(join(root, date))) {
|
|
57
|
+
const path = join(root, date, name);
|
|
58
|
+
const key = `${date}/${RUN_KEY.exec(name)?.[1] ?? name}`;
|
|
59
|
+
const run = byKey.get(key) ?? { paths: [], mtimeMs: 0 };
|
|
60
|
+
run.paths.push(path);
|
|
61
|
+
run.mtimeMs = Math.max(run.mtimeMs, statSync(path).mtimeMs);
|
|
62
|
+
byKey.set(key, run);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { runs: [...byKey].map(([key, r]) => ({ key, ...r })), dateDirs: dates.map((d) => join(root, d)) };
|
|
66
|
+
}
|
|
67
|
+
/** Applies `retention` to the logs under `root`. `dryRun` reports what would go, deleting nothing. */
|
|
68
|
+
export function pruneLogs(root, retention, opts = {}) {
|
|
69
|
+
const nowMs = opts.nowMs ?? clock.now();
|
|
70
|
+
const { runs, dateDirs } = runsIn(root);
|
|
71
|
+
const newestFirst = [...runs].sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
72
|
+
const cutoff = nowMs - retention.ttlDays * 86_400_000;
|
|
73
|
+
const doomed = newestFirst.slice(retention.keepLatest).filter((r) => r.mtimeMs < cutoff);
|
|
74
|
+
if (opts.dryRun !== true) {
|
|
75
|
+
for (const r of doomed)
|
|
76
|
+
for (const p of r.paths)
|
|
77
|
+
rmSync(p, { recursive: true, force: true });
|
|
78
|
+
for (const d of dateDirs) {
|
|
79
|
+
if (readdirSync(d).length === 0)
|
|
80
|
+
rmdirSync(d);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { root, removed: doomed.map((r) => r.key).sort(), keptRuns: runs.length - doomed.length };
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=logs-retention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs-retention.js","sourceRoot":"","sources":["../src/logs-retention.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,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AI,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #269 — masked key entry. The previous prompt muted readline's echo by hooking its private
|
|
3
|
+
* `_writeToOutput`, but readline's line refresh still moved the cursor and cleared the screen below
|
|
4
|
+
* it on every keystroke: the instructions printed before the prompt vanished as soon as the user
|
|
5
|
+
* typed ("flash off too fast to read"), and nothing showed that input was being received.
|
|
6
|
+
*
|
|
7
|
+
* This reader never clears anything: the instructions stay on their own line, and each typed (or
|
|
8
|
+
* pasted) character is echoed as `•` — never the character itself. Backspace erases one mark,
|
|
9
|
+
* Ctrl-U erases all, Enter finishes, Ctrl-C / Ctrl-D (on an empty entry) cancel. Without a TTY
|
|
10
|
+
* (piped input) it reads one line and echoes nothing. The value is only ever returned to the
|
|
11
|
+
* caller; it is never written to `output`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MASK_CHAR = "\u2022";
|
|
14
|
+
export interface MaskedInput extends NodeJS.ReadableStream {
|
|
15
|
+
readonly isTTY?: boolean;
|
|
16
|
+
setRawMode?(mode: boolean): unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Key entry was cancelled (Ctrl-C, Ctrl-D, or the input ended): nothing was entered. */
|
|
19
|
+
export declare class KeyEntryCancelledError extends Error {
|
|
20
|
+
constructor();
|
|
21
|
+
}
|
|
22
|
+
export declare function readMaskedLine(input: MaskedInput, output: NodeJS.WritableStream, message: string): Promise<string>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #269 — masked key entry. The previous prompt muted readline's echo by hooking its private
|
|
3
|
+
* `_writeToOutput`, but readline's line refresh still moved the cursor and cleared the screen below
|
|
4
|
+
* it on every keystroke: the instructions printed before the prompt vanished as soon as the user
|
|
5
|
+
* typed ("flash off too fast to read"), and nothing showed that input was being received.
|
|
6
|
+
*
|
|
7
|
+
* This reader never clears anything: the instructions stay on their own line, and each typed (or
|
|
8
|
+
* pasted) character is echoed as `•` — never the character itself. Backspace erases one mark,
|
|
9
|
+
* Ctrl-U erases all, Enter finishes, Ctrl-C / Ctrl-D (on an empty entry) cancel. Without a TTY
|
|
10
|
+
* (piped input) it reads one line and echoes nothing. The value is only ever returned to the
|
|
11
|
+
* caller; it is never written to `output`.
|
|
12
|
+
*/
|
|
13
|
+
export const MASK_CHAR = "•";
|
|
14
|
+
/** Key entry was cancelled (Ctrl-C, Ctrl-D, or the input ended): nothing was entered. */
|
|
15
|
+
export class KeyEntryCancelledError extends Error {
|
|
16
|
+
constructor() {
|
|
17
|
+
super("key entry cancelled — nothing was stored");
|
|
18
|
+
this.name = "KeyEntryCancelledError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function readMaskedLine(input, output, message) {
|
|
22
|
+
const raw = input.isTTY === true && typeof input.setRawMode === "function";
|
|
23
|
+
output.write(`${message}\n> `);
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
let value = "";
|
|
26
|
+
let done = false;
|
|
27
|
+
const finish = (err) => {
|
|
28
|
+
if (done)
|
|
29
|
+
return;
|
|
30
|
+
done = true;
|
|
31
|
+
input.removeListener("data", onData);
|
|
32
|
+
input.removeListener("end", onEnd);
|
|
33
|
+
if (raw)
|
|
34
|
+
input.setRawMode?.(false);
|
|
35
|
+
input.pause();
|
|
36
|
+
output.write("\n");
|
|
37
|
+
if (err === null)
|
|
38
|
+
resolve(value);
|
|
39
|
+
else
|
|
40
|
+
reject(err);
|
|
41
|
+
};
|
|
42
|
+
const onEnd = () => {
|
|
43
|
+
// Piped input that ends without a newline still delivers what it held; an empty one is a cancel.
|
|
44
|
+
if (value.length > 0)
|
|
45
|
+
finish(null);
|
|
46
|
+
else
|
|
47
|
+
finish(new KeyEntryCancelledError());
|
|
48
|
+
};
|
|
49
|
+
const onData = (chunk) => {
|
|
50
|
+
const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
|
|
51
|
+
// An escape sequence (arrow keys, function keys) is navigation, never part of a key.
|
|
52
|
+
if (raw && text.startsWith("\u001b"))
|
|
53
|
+
return;
|
|
54
|
+
for (const ch of text) {
|
|
55
|
+
if (ch === "\r" || ch === "\n") {
|
|
56
|
+
finish(null);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!raw) {
|
|
60
|
+
value += ch;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (ch === "\u0003") {
|
|
64
|
+
finish(new KeyEntryCancelledError());
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (ch === "\u0004") {
|
|
68
|
+
if (value.length === 0)
|
|
69
|
+
finish(new KeyEntryCancelledError());
|
|
70
|
+
else
|
|
71
|
+
finish(null);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (ch === "\u007f" || ch === "\b") {
|
|
75
|
+
if (value.length > 0) {
|
|
76
|
+
value = [...value].slice(0, -1).join("");
|
|
77
|
+
output.write("\b \b");
|
|
78
|
+
}
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (ch === "\u0015") {
|
|
82
|
+
output.write("\b \b".repeat([...value].length));
|
|
83
|
+
value = "";
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (ch < " ")
|
|
87
|
+
continue; // other control characters
|
|
88
|
+
value += ch;
|
|
89
|
+
output.write(MASK_CHAR);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
if (raw)
|
|
93
|
+
input.setRawMode?.(true);
|
|
94
|
+
input.on("data", onData);
|
|
95
|
+
input.on("end", onEnd);
|
|
96
|
+
input.resume();
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=masked-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masked-input.js","sourceRoot":"","sources":["../src/masked-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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;oBACxB,CAAC;oBACD,SAAS;gBACX,CAAC;gBACD,IAAI,EAAE,KAAK,QAAQ,EAAE,CAAC;oBACpB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChD,KAAK,GAAG,EAAE,CAAC;oBACX,SAAS;gBACX,CAAC;gBACD,IAAI,EAAE,GAAG,GAAG;oBAAE,SAAS,CAAC,2BAA2B;gBACnD,KAAK,IAAI,EAAE,CAAC;gBACZ,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,CAAC;QACF,IAAI,GAAG;YAAE,KAAK,CAAC,UAAU,EAAE,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QACvB,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/mcp-api.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
2
|
import { type AiGenerateTextArgs, type AiGenerateTextResult } from "@jevitate/mcp-facade";
|
|
3
3
|
import { type CredentialStore, type GenerationPort, type SetupRequiredResult } from "@jevitate/ai-core";
|
|
4
|
+
import type { JudgmentPort, UsageTracker } from "@jevitate/ai-core";
|
|
5
|
+
import type { SelfHealer } from "@jevitate/runtime";
|
|
6
|
+
import type { EmulationSpec } from "@jevitate/playwright";
|
|
7
|
+
import { type RunPolicy } from "@jevitate/domain";
|
|
8
|
+
import { type RunVerifyFixOptions, type VerifyFixReport } from "./verify-fix-api.js";
|
|
9
|
+
import { type BrowserRunOptions } from "./browser-run-options.js";
|
|
10
|
+
import { type ResolvedJourneyEnvironment } from "./environments.js";
|
|
11
|
+
import { type MissionFixtures } from "./mission-fixtures.js";
|
|
12
|
+
import { type ScreenshotsSpec } from "./run-screenshots.js";
|
|
13
|
+
import type { McpCliRunner } from "./mcp-cli-runner.js";
|
|
14
|
+
import { type EngineInfo } from "./engine.js";
|
|
4
15
|
/**
|
|
5
16
|
* The MCP stdio server behind `jevitate mcp`. It exposes ONLY the tools in
|
|
6
17
|
* `@jevitate/mcp-facade`'s `ALLOWED_TOOLS` and structurally CANNOT serve any
|
|
@@ -27,12 +38,36 @@ export interface McpTool {
|
|
|
27
38
|
type: "object";
|
|
28
39
|
properties: Record<string, unknown>;
|
|
29
40
|
required?: string[];
|
|
41
|
+
additionalProperties?: boolean;
|
|
30
42
|
};
|
|
31
43
|
handler: (args: Record<string, unknown>) => Promise<McpToolResult>;
|
|
32
44
|
}
|
|
45
|
+
/** #255: what an extended `run_journey` call adds — every field resolved and validated by the handler. */
|
|
46
|
+
export interface McpJourneyRunOptions {
|
|
47
|
+
readonly policy?: RunPolicy;
|
|
48
|
+
readonly selfHealer?: SelfHealer;
|
|
49
|
+
readonly environment?: ResolvedJourneyEnvironment;
|
|
50
|
+
readonly browser?: BrowserRunOptions;
|
|
51
|
+
readonly emulation?: EmulationSpec;
|
|
52
|
+
readonly screenshots?: ScreenshotsSpec;
|
|
53
|
+
readonly fixtures?: (site: string) => MissionFixtures | undefined;
|
|
54
|
+
/** #303: record and compare each replayed step's action delta (`--action-deltas`). */
|
|
55
|
+
readonly actionDeltas?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* #255: what `verify_fix` hands the runner — the finding (resolved result path + fingerprint) and
|
|
59
|
+
* the CLI-parity replay options. Operator-only settings (shell hooks, `cmd:` log sources, re-sending
|
|
60
|
+
* paid/destructive hang writes, redaction literals) are never MCP arguments: targets.json decides.
|
|
61
|
+
*/
|
|
62
|
+
export type McpVerifyFixArgs = Pick<RunVerifyFixOptions, "resultPath" | "fingerprint"> & Partial<Pick<RunVerifyFixOptions, "storageState" | "browser" | "replays" | "invariantFiles" | "fixtureFlags" | "emulation" | "allowEmulationOverride" | "screenshots" | "actionDeltas">>;
|
|
33
63
|
export interface McpApiDeps {
|
|
34
64
|
/** Journeys store directory (`~/.jevitate/journeys` in production). */
|
|
35
65
|
journeysDir: string;
|
|
66
|
+
/**
|
|
67
|
+
* The site-policy database (`jevitate site policy set`): `run_journey` is paced, throttled,
|
|
68
|
+
* budgeted and kept out of quiet hours per the Journey's origin. Absent file = no policy.
|
|
69
|
+
*/
|
|
70
|
+
sitePolicyDbPath?: string;
|
|
36
71
|
/**
|
|
37
72
|
* Test seam. Defaults to the real promoted-only projection over the
|
|
38
73
|
* journeys store (`@jevitate/mcp-facade`'s `findCapabilities`).
|
|
@@ -41,8 +76,37 @@ export interface McpApiDeps {
|
|
|
41
76
|
/**
|
|
42
77
|
* Test seam. Defaults to `runJourneyProgrammatically` with a fail-closed
|
|
43
78
|
* `safeRunPolicy()` (invariant #5: PUBLISHED-id-only, never inline steps).
|
|
79
|
+
* `storageState` (#118) is a PATH to a Playwright storageState JSON file — the file is
|
|
80
|
+
* read only by the server's own browser launch; its contents never enter this handler,
|
|
81
|
+
* an MCP result, or a log.
|
|
82
|
+
*/
|
|
83
|
+
runJourney?: (id: string, params: Record<string, string>, storageState?: string, options?: McpJourneyRunOptions) => Promise<unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* #255: the directories MCP path arguments (storage states, fixtures, invariants, output dirs)
|
|
86
|
+
* must resolve inside — default: the project and `~/.jevitate` (mcp-paths.ts).
|
|
87
|
+
*/
|
|
88
|
+
pathRoots?: readonly string[];
|
|
89
|
+
/** #255 (`run_journey {env}`): the environments file (default: the repo's `.jevitate/environments.json`). */
|
|
90
|
+
environmentsFile?: string;
|
|
91
|
+
/** `~/.jevitate/targets.json` override (environment sessions, verify_fix target config). */
|
|
92
|
+
targetsConfigPath?: string;
|
|
93
|
+
/**
|
|
94
|
+
* #255 (`run_journey {selfHeal: hybrid|full}`): builds the self-heal gateways exactly as the CLI's
|
|
95
|
+
* `--real`/`--fake-ai` do (`buildExploreGateways`). Absent: a heal mode is refused (setup_required).
|
|
96
|
+
*/
|
|
97
|
+
selfHealGateways?: (sel: {
|
|
98
|
+
real: boolean;
|
|
99
|
+
fakeAi: boolean;
|
|
100
|
+
}) => Promise<{
|
|
101
|
+
judge: JudgmentPort;
|
|
102
|
+
gen: GenerationPort;
|
|
103
|
+
usage: UsageTracker;
|
|
104
|
+
}>;
|
|
105
|
+
/**
|
|
106
|
+
* #255: the CLI in-process (mcp-cli-runner.ts) — backs every MCP tool that mirrors a CLI command
|
|
107
|
+
* (mcp-cli-tools.ts). Absent: those tools refuse with `not_configured`.
|
|
44
108
|
*/
|
|
45
|
-
|
|
109
|
+
runCli?: McpCliRunner;
|
|
46
110
|
/**
|
|
47
111
|
* Promoted mission-target store directory (`~/.jevitate/missions/targets` in
|
|
48
112
|
* production — the SAME store `jevitate mission target` writes). Required for
|
|
@@ -89,6 +153,32 @@ export interface McpApiDeps {
|
|
|
89
153
|
* returns a typed `setup_required` result instead of calling the model.
|
|
90
154
|
*/
|
|
91
155
|
aiGenerateText?: (args: AiGenerateTextArgs) => Promise<AiGenerateTextResult | SetupRequiredResult>;
|
|
156
|
+
/**
|
|
157
|
+
* Directory holding mission artifacts (the logs root in production): the typed
|
|
158
|
+
* `<id>.result.json` files `get_mission_result` reads. A missing dir is a config refusal.
|
|
159
|
+
*/
|
|
160
|
+
recordingsDir?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Where usability reviews write their artifacts (0.1.0: `~/.jevitate/ux-reports`): a
|
|
163
|
+
* `usability-<stamp>` result is looked up here after `recordingsDir`.
|
|
164
|
+
*/
|
|
165
|
+
uxReportsDir?: string;
|
|
166
|
+
/**
|
|
167
|
+
* The directories a result id's files may be in, most likely first (production: its dated
|
|
168
|
+
* `.jevitate/logs/<date>` dir in the project, then `~/.jevitate`, then the 0.1.0 locations).
|
|
169
|
+
* Replaces `recordingsDir`/`uxReportsDir` for the lookup when given.
|
|
170
|
+
*/
|
|
171
|
+
resultDirsFor?: (resultId: string) => string[];
|
|
172
|
+
/**
|
|
173
|
+
* Test seam. Defaults to `runVerifyFix` over `<recordingsDir>/<id>.result.json`: replays the
|
|
174
|
+
* finding's repro in a fresh browser (authorized against the mission's own allowlist).
|
|
175
|
+
*/
|
|
176
|
+
verifyFix?: (args: McpVerifyFixArgs) => Promise<VerifyFixReport>;
|
|
177
|
+
/**
|
|
178
|
+
* The serving build's identity (#112) — reported by `initialize` (`serverInfo.version`) and by
|
|
179
|
+
* `get_site_health`. Defaults to this build's `currentEngineInfo()`.
|
|
180
|
+
*/
|
|
181
|
+
engine?: EngineInfo;
|
|
92
182
|
}
|
|
93
183
|
/**
|
|
94
184
|
* Builds the served tool descriptors — EXACTLY one per `ALLOWED_TOOLS` entry.
|