@prestyj/cli 5.35.0 → 5.36.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.
Files changed (103) hide show
  1. package/dist/cli/command-routing.d.ts +1 -1
  2. package/dist/cli/command-routing.js +2 -1
  3. package/dist/cli/command-routing.js.map +1 -1
  4. package/dist/cli/validate.d.ts +4 -0
  5. package/dist/cli/validate.js +243 -0
  6. package/dist/cli/validate.js.map +1 -0
  7. package/dist/cli.js +3 -0
  8. package/dist/cli.js.map +1 -1
  9. package/dist/core/agent-notifications.d.ts +1 -1
  10. package/dist/core/agent-session.d.ts +2 -0
  11. package/dist/core/agent-session.js +7 -0
  12. package/dist/core/agent-session.js.map +1 -1
  13. package/dist/core/validation/backends.d.ts +20 -0
  14. package/dist/core/validation/backends.js +54 -0
  15. package/dist/core/validation/backends.js.map +1 -0
  16. package/dist/core/validation/config.d.ts +22 -0
  17. package/dist/core/validation/config.js +220 -0
  18. package/dist/core/validation/config.js.map +1 -0
  19. package/dist/core/validation/exec.d.ts +3 -0
  20. package/dist/core/validation/exec.js +17 -0
  21. package/dist/core/validation/exec.js.map +1 -0
  22. package/dist/core/validation/github-actions-backend.d.ts +35 -0
  23. package/dist/core/validation/github-actions-backend.js +181 -0
  24. package/dist/core/validation/github-actions-backend.js.map +1 -0
  25. package/dist/core/validation/local-backend.d.ts +18 -0
  26. package/dist/core/validation/local-backend.js +101 -0
  27. package/dist/core/validation/local-backend.js.map +1 -0
  28. package/dist/core/validation/service.d.ts +125 -0
  29. package/dist/core/validation/service.js +689 -0
  30. package/dist/core/validation/service.js.map +1 -0
  31. package/dist/core/validation/session-hook.d.ts +3 -0
  32. package/dist/core/validation/session-hook.js +25 -0
  33. package/dist/core/validation/session-hook.js.map +1 -0
  34. package/dist/core/validation/store.d.ts +10 -0
  35. package/dist/core/validation/store.js +48 -0
  36. package/dist/core/validation/store.js.map +1 -0
  37. package/dist/core/validation/types.d.ts +127 -0
  38. package/dist/core/validation/types.js +14 -0
  39. package/dist/core/validation/types.js.map +1 -0
  40. package/dist/tools/index.js +2 -0
  41. package/dist/tools/index.js.map +1 -1
  42. package/dist/tools/prompt-hints.js +2 -0
  43. package/dist/tools/prompt-hints.js.map +1 -1
  44. package/dist/tools/tool-tiers.js +1 -0
  45. package/dist/tools/tool-tiers.js.map +1 -1
  46. package/dist/tools/validate.d.ts +21 -0
  47. package/dist/tools/validate.js +107 -0
  48. package/dist/tools/validate.js.map +1 -0
  49. package/dist/ui/App.d.ts +1 -2
  50. package/dist/ui/components/ActivityIndicator.d.ts +1 -1
  51. package/dist/ui/components/AnimationContext.d.ts +1 -1
  52. package/dist/ui/components/AssistantMessage.d.ts +1 -1
  53. package/dist/ui/components/BackgroundTasksBar.d.ts +1 -2
  54. package/dist/ui/components/Banner.d.ts +1 -2
  55. package/dist/ui/components/ChatFooterPane.d.ts +1 -2
  56. package/dist/ui/components/ChatInputStack.d.ts +1 -1
  57. package/dist/ui/components/ChatLayout.d.ts +4 -4
  58. package/dist/ui/components/ChatLivePane.d.ts +1 -1
  59. package/dist/ui/components/ChatScreen.d.ts +1 -1
  60. package/dist/ui/components/ChatStatusRow.d.ts +1 -1
  61. package/dist/ui/components/CompactionNotice.d.ts +2 -3
  62. package/dist/ui/components/DiffFrame.d.ts +1 -1
  63. package/dist/ui/components/DiffView.d.ts +1 -2
  64. package/dist/ui/components/Footer.d.ts +1 -2
  65. package/dist/ui/components/FooterStatusRow.d.ts +1 -2
  66. package/dist/ui/components/FullScreenOverlayRouter.d.ts +1 -2
  67. package/dist/ui/components/GoalOverlay.d.ts +1 -2
  68. package/dist/ui/components/GoalStatusBar.d.ts +1 -2
  69. package/dist/ui/components/IdealHookMessage.d.ts +1 -1
  70. package/dist/ui/components/InputArea.d.ts +1 -1
  71. package/dist/ui/components/LiveToolPanel.d.ts +1 -2
  72. package/dist/ui/components/Markdown.d.ts +2 -2
  73. package/dist/ui/components/ModelSelector.d.ts +1 -2
  74. package/dist/ui/components/Overlay.d.ts +1 -1
  75. package/dist/ui/components/PixelOverlay.d.ts +1 -2
  76. package/dist/ui/components/PlanModeLogo.d.ts +1 -2
  77. package/dist/ui/components/PlanOverlay.d.ts +2 -3
  78. package/dist/ui/components/QueueIndicator.d.ts +1 -2
  79. package/dist/ui/components/RewindOverlay.d.ts +1 -2
  80. package/dist/ui/components/SelectList.d.ts +1 -2
  81. package/dist/ui/components/ServerToolExecution.d.ts +1 -2
  82. package/dist/ui/components/SessionSelector.d.ts +1 -2
  83. package/dist/ui/components/SessionSummary.d.ts +1 -2
  84. package/dist/ui/components/SettingsSelector.d.ts +1 -2
  85. package/dist/ui/components/SkillsOverlay.d.ts +1 -2
  86. package/dist/ui/components/SlashCommandMenu.d.ts +1 -2
  87. package/dist/ui/components/SlashStyledSelectList.d.ts +1 -2
  88. package/dist/ui/components/Spinner.d.ts +1 -2
  89. package/dist/ui/components/StreamingArea.d.ts +1 -1
  90. package/dist/ui/components/SubAgentPanel.d.ts +1 -2
  91. package/dist/ui/components/TaskOverlay.d.ts +1 -2
  92. package/dist/ui/components/TaskPickerMenu.d.ts +1 -2
  93. package/dist/ui/components/ThemeSelector.d.ts +1 -2
  94. package/dist/ui/components/ThinkingBlock.d.ts +1 -1
  95. package/dist/ui/components/ToolExecution.d.ts +1 -2
  96. package/dist/ui/components/ToolGroupExecution.d.ts +1 -2
  97. package/dist/ui/components/TranscriptViewport.d.ts +1 -1
  98. package/dist/ui/components/UserMessage.d.ts +1 -2
  99. package/dist/ui/transcript/MiscRows.d.ts +7 -8
  100. package/dist/ui/transcript/StatusRow.d.ts +1 -1
  101. package/dist/ui/transcript/ToolRows.d.ts +6 -7
  102. package/dist/ui/transcript/TranscriptItemFrame.d.ts +1 -1
  103. package/package.json +5 -5
@@ -0,0 +1,101 @@
1
+ // Local backend: runs a stage on this machine in a detached shell, so it keeps
2
+ // going (and its result is still collected) if EZCODER restarts meanwhile.
3
+ import { spawn } from "node:child_process";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ const WRAPPER = `
7
+ set -m
8
+ cd "$EZV_CWD" || { echo 127 > "$EZV_DIR/exit"; exit; }
9
+ ( eval "$EZV_CMD" ) > "$EZV_DIR/output.log" 2>&1 &
10
+ p=$!
11
+ echo $p > "$EZV_DIR/pid"
12
+ ( sleep "$EZV_TIMEOUT"; echo timeout > "$EZV_DIR/timeout"; kill -TERM -- -$p 2>/dev/null ) &
13
+ w=$!
14
+ wait $p; c=$?
15
+ kill $w 2>/dev/null
16
+ echo $c > "$EZV_DIR/exit"
17
+ `;
18
+ function alive(pid) {
19
+ try {
20
+ process.kill(pid, 0);
21
+ return true;
22
+ }
23
+ catch (e) {
24
+ return e.code === "EPERM";
25
+ }
26
+ }
27
+ function readText(file) {
28
+ try {
29
+ return fs.readFileSync(file, "utf8").trim();
30
+ }
31
+ catch {
32
+ return undefined;
33
+ }
34
+ }
35
+ export class LocalBackend {
36
+ logsDir;
37
+ maxConcurrent;
38
+ id = "local";
39
+ kind = "local";
40
+ runs = "local";
41
+ constructor(logsDir, maxConcurrent = 2) {
42
+ this.logsDir = logsDir;
43
+ this.maxConcurrent = maxConcurrent;
44
+ }
45
+ dir(job) {
46
+ return path.join(this.logsDir, job.id);
47
+ }
48
+ async dispatch(job) {
49
+ const dir = this.dir(job);
50
+ fs.mkdirSync(dir, { recursive: true });
51
+ const child = spawn("bash", ["-c", WRAPPER], {
52
+ detached: true,
53
+ stdio: "ignore",
54
+ env: {
55
+ ...process.env,
56
+ EZV_CWD: job.project,
57
+ EZV_CMD: job.command,
58
+ EZV_DIR: dir,
59
+ EZV_TIMEOUT: String(job.timeoutMinutes * 60),
60
+ CI: "1",
61
+ },
62
+ });
63
+ child.unref();
64
+ return { runId: String(child.pid ?? ""), url: path.join(dir, "output.log") };
65
+ }
66
+ async poll(job) {
67
+ const dir = this.dir(job);
68
+ const exit = readText(path.join(dir, "exit"));
69
+ if (exit !== undefined) {
70
+ if (readText(path.join(dir, "timeout"))) {
71
+ return { state: "failed", summary: `timed out after ${job.timeoutMinutes} min` };
72
+ }
73
+ return exit === "0" ? { state: "passed" } : { state: "failed", summary: `exited ${exit}` };
74
+ }
75
+ const pid = Number(job.runId);
76
+ if (pid && alive(pid))
77
+ return { state: "running" };
78
+ return { state: "error", summary: "the local run stopped without a result" };
79
+ }
80
+ async logs(job) {
81
+ const text = readText(path.join(this.dir(job), "output.log"));
82
+ if (text === undefined)
83
+ return "No output yet.";
84
+ return text.length > 24_000 ? `…\n${text.slice(-24_000)}` : text || "(no output)";
85
+ }
86
+ async cancel(job) {
87
+ const pid = Number(readText(path.join(this.dir(job), "pid")));
88
+ if (pid) {
89
+ try {
90
+ process.kill(-pid, "SIGTERM");
91
+ }
92
+ catch {
93
+ // already gone
94
+ }
95
+ }
96
+ }
97
+ async health() {
98
+ return { online: true, detail: "this machine" };
99
+ }
100
+ }
101
+ //# sourceMappingURL=local-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local-backend.js","sourceRoot":"","sources":["../../../src/core/validation/local-backend.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,2EAA2E;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B,MAAM,OAAO,GAAG;;;;;;;;;;;CAWf,CAAC;AAEF,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAQ,CAA2B,CAAC,IAAI,KAAK,OAAO,CAAC;IACvD,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAA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,CAAC,IAAI,IAAI,aAAa,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAkB;QAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9D,IAAI,GAAG,EAAE,CAAC;YACR,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAChC,CAAC;YAAC,MAAM,CAAC;gBACP,eAAe;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IAClD,CAAC;CACF"}
@@ -0,0 +1,125 @@
1
+ import { JobStore } from "./store.js";
2
+ import { type BackendHealth, type Exec, type JobState, type ProjectValidationConfig, type ValidationBackend, type ValidationJob } from "./types.js";
3
+ export interface ValidationServiceOptions {
4
+ dir?: string;
5
+ exec?: Exec;
6
+ pollMs?: number;
7
+ /** Inject backends (tests); otherwise read from backends.json. */
8
+ backends?: ValidationBackend[];
9
+ maxConcurrent?: number;
10
+ /** Minutes a job may wait on an offline worker before we say so. */
11
+ offlineWarnMinutes?: number;
12
+ /** Start the poll loop when work is queued (off for short-lived CLI commands). */
13
+ autoStart?: boolean;
14
+ }
15
+ export interface EnqueueOptions {
16
+ stages?: string[];
17
+ ref?: string;
18
+ /** Run again even if this commit already passed the stage. */
19
+ force?: boolean;
20
+ }
21
+ export interface EnqueueResult {
22
+ sha: string;
23
+ branch?: string;
24
+ dirty: boolean;
25
+ jobs: ValidationJob[];
26
+ reused: ValidationJob[];
27
+ messages: string[];
28
+ }
29
+ export interface GateRow {
30
+ stage: string;
31
+ state: JobState | "missing";
32
+ jobId?: string;
33
+ url?: string;
34
+ note?: string;
35
+ }
36
+ export interface GateResult {
37
+ sha: string;
38
+ ok: boolean;
39
+ rows: GateRow[];
40
+ }
41
+ export interface WorkerInfo {
42
+ id: string;
43
+ kind: string;
44
+ maxConcurrent: number;
45
+ active: number;
46
+ queued: number;
47
+ health: BackendHealth;
48
+ recentFailures: number;
49
+ }
50
+ export type JobListener = (job: ValidationJob, previous: JobState | undefined) => void;
51
+ export declare function short(sha: string): string;
52
+ export declare class ValidationService {
53
+ readonly dir: string;
54
+ readonly store: JobStore;
55
+ private readonly exec;
56
+ private readonly pollMs;
57
+ private readonly offlineWarnMs;
58
+ private backends;
59
+ private maxConcurrent;
60
+ private readonly injected;
61
+ private readonly events;
62
+ private seen;
63
+ private seeded;
64
+ private timer;
65
+ private ticking;
66
+ private keepAlive;
67
+ /** Backend problems found while loading the registry. */
68
+ problems: string[];
69
+ /** Start the poll loop when work is queued; short-lived commands turn this off. */
70
+ autoStart: boolean;
71
+ constructor(opts?: ValidationServiceOptions);
72
+ /** One service per process. */
73
+ static shared(): ValidationService;
74
+ reloadBackends(): void;
75
+ getBackends(): readonly ValidationBackend[];
76
+ private backend;
77
+ onJob(listener: JobListener): () => void;
78
+ private observe;
79
+ private git;
80
+ private gitState;
81
+ config(cwd: string): ProjectValidationConfig | {
82
+ error: string;
83
+ };
84
+ enqueue(cwdIn: string, opts?: EnqueueOptions): Promise<EnqueueResult>;
85
+ list(cwd?: string): Promise<ValidationJob[]>;
86
+ get(id: string): Promise<ValidationJob | undefined>;
87
+ /** Required stages for an exact commit: ok only when every one passed at that SHA. */
88
+ gate(cwdIn: string, ref?: string): Promise<GateResult>;
89
+ cancel(id: string): Promise<ValidationJob | undefined>;
90
+ /** Run a finished job again at the same commit. */
91
+ retry(id: string): Promise<ValidationJob>;
92
+ logs(id: string, failedOnly?: boolean): Promise<string>;
93
+ workers(): Promise<WorkerInfo[]>;
94
+ /** Start (or keep) the poll loop. Cheap when idle: it stops itself. */
95
+ start(opts?: {
96
+ keepAlive?: boolean;
97
+ }): void;
98
+ stop(): void;
99
+ get running(): boolean;
100
+ /** One pass: observe, and if we lead, poll/dispatch. Returns whether work remains. */
101
+ tick(): Promise<boolean>;
102
+ private lastActive;
103
+ private hasActive;
104
+ private tickInner;
105
+ private chooseBackend;
106
+ private movedSince;
107
+ private failureSummary;
108
+ private commitOnGitHub;
109
+ private postFinal;
110
+ private postStatus;
111
+ /** Merge a patch into one stored job. With `onlyIf`, only when it's still in that state. */
112
+ private patch;
113
+ private emitAndMark;
114
+ private lead;
115
+ /** Is some live process leading? (Used to decide whether to start a daemon.) */
116
+ leaderAlive(): Promise<boolean>;
117
+ }
118
+ /** Plain-words one-liner for a job, used by notifications, the tool and the CLI. */
119
+ export declare function describeJob(j: ValidationJob): string;
120
+ /** The notification a session gets for a job change, or undefined for routine ones. */
121
+ export declare function notificationFor(j: ValidationJob): {
122
+ text: string;
123
+ terminal: boolean;
124
+ urgent: boolean;
125
+ } | undefined;