@jx-grxf/patchpilot 0.2.1 → 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.
Files changed (63) hide show
  1. package/README.md +67 -10
  2. package/SECURITY.md +20 -0
  3. package/dist/cli.js +52 -3
  4. package/dist/cli.js.map +1 -1
  5. package/dist/core/agent.d.ts +5 -2
  6. package/dist/core/agent.js +167 -24
  7. package/dist/core/agent.js.map +1 -1
  8. package/dist/core/codex.js +1 -1
  9. package/dist/core/codex.js.map +1 -1
  10. package/dist/core/gemini.js +8 -21
  11. package/dist/core/gemini.js.map +1 -1
  12. package/dist/core/http.d.ts +6 -0
  13. package/dist/core/http.js +45 -0
  14. package/dist/core/http.js.map +1 -0
  15. package/dist/core/json.js +9 -0
  16. package/dist/core/json.js.map +1 -1
  17. package/dist/core/nvidia.js +9 -2
  18. package/dist/core/nvidia.js.map +1 -1
  19. package/dist/core/ollama.js +8 -1
  20. package/dist/core/ollama.js.map +1 -1
  21. package/dist/core/openrouter.js +13 -8
  22. package/dist/core/openrouter.js.map +1 -1
  23. package/dist/core/reasoning.d.ts +12 -0
  24. package/dist/core/reasoning.js +108 -0
  25. package/dist/core/reasoning.js.map +1 -0
  26. package/dist/core/session.d.ts +31 -0
  27. package/dist/core/session.js +154 -0
  28. package/dist/core/session.js.map +1 -0
  29. package/dist/core/types.d.ts +103 -2
  30. package/dist/core/workspace.d.ts +17 -1
  31. package/dist/core/workspace.js +495 -13
  32. package/dist/core/workspace.js.map +1 -1
  33. package/dist/tui/App.js +291 -88
  34. package/dist/tui/App.js.map +1 -1
  35. package/dist/tui/commands.js +37 -2
  36. package/dist/tui/commands.js.map +1 -1
  37. package/dist/tui/components/Header.d.ts +2 -2
  38. package/dist/tui/components/Header.js +17 -54
  39. package/dist/tui/components/Header.js.map +1 -1
  40. package/dist/tui/components/OnboardingPanel.d.ts +5 -0
  41. package/dist/tui/components/OnboardingPanel.js +11 -13
  42. package/dist/tui/components/OnboardingPanel.js.map +1 -1
  43. package/dist/tui/components/Sidebar.d.ts +6 -1
  44. package/dist/tui/components/Sidebar.js +15 -6
  45. package/dist/tui/components/Sidebar.js.map +1 -1
  46. package/dist/tui/components/Transcript.js +57 -8
  47. package/dist/tui/components/Transcript.js.map +1 -1
  48. package/dist/tui/hosts.js +7 -1
  49. package/dist/tui/hosts.js.map +1 -1
  50. package/dist/tui/modelSelection.d.ts +1 -0
  51. package/dist/tui/modelSelection.js +29 -0
  52. package/dist/tui/modelSelection.js.map +1 -0
  53. package/dist/tui/types.d.ts +12 -2
  54. package/dist/tui/types.js.map +1 -1
  55. package/docs/releases/v0.1.0.md +26 -0
  56. package/docs/releases/v0.2.0.md +21 -0
  57. package/docs/releases/v0.2.1.md +26 -0
  58. package/docs/releases/v0.3.0.md +26 -0
  59. package/docs/showcase/patchpilot-showcase.svg +83 -38
  60. package/package.json +5 -2
  61. package/dist/tui/inputRouting.d.ts +0 -8
  62. package/dist/tui/inputRouting.js +0 -94
  63. package/dist/tui/inputRouting.js.map +0 -1
package/README.md CHANGED
@@ -34,6 +34,7 @@ PatchPilot is a terminal interface for running coding-agent tasks inside a repos
34
34
 
35
35
  - [Highlights](#highlights)
36
36
  - [Why This Exists](#why-this-exists)
37
+ - [Requirements](#requirements)
37
38
  - [Quick Start](#quick-start)
38
39
  - [Usage](#usage)
39
40
  - [Providers](#providers)
@@ -42,6 +43,7 @@ PatchPilot is a terminal interface for running coding-agent tasks inside a repos
42
43
  - [Tech Stack](#tech-stack)
43
44
  - [Development](#development)
44
45
  - [Roadmap](#roadmap)
46
+ - [Release Notes](#release-notes)
45
47
  - [Security and Legal](#security-and-legal)
46
48
  - [License](#license)
47
49
 
@@ -54,7 +56,7 @@ PatchPilot is a terminal interface for running coding-agent tasks inside a repos
54
56
  | Cloud provider routes | Gemini, OpenRouter, NVIDIA, and Codex CLI OAuth are available from one TUI. |
55
57
  | Guided onboarding | First-run setup walks through local/remote mode, provider auth, host discovery, and model choice. |
56
58
  | Observable agent loop | Transcript, tool calls, telemetry, token counts, provider cache hits, latency, and cost estimates are visible. |
57
- | Explicit permissions | File writes require `--apply`; shell commands require `--allow-shell`. |
59
+ | Explicit permissions | Risky tools request approval unless writes or shell commands are explicitly enabled. |
58
60
  | Workspace boundary | File tools are constrained to the selected project root and block common secret files. |
59
61
  | Slash-command palette | Type `/` for browsable commands, provider switching, modes, models, diagnostics, and host selection. |
60
62
  | Advisor subagents | Explorer, planner, and reviewer advisor calls can brief the main agent before it edits. |
@@ -70,8 +72,18 @@ The core workflow is intentionally simple:
70
72
  1. Open a repository.
71
73
  2. Pick local, remote, or cloud inference.
72
74
  3. Ask for a patch, review, summary, or refactor plan.
73
- 4. Enable writes or shell commands only when the current task needs them.
74
- 5. Review the diff before committing.
75
+ 4. Approve writes or shell commands only when the current task needs them.
76
+ 5. Review `/diff`, run tests, then commit manually.
77
+
78
+ ## Requirements
79
+
80
+ | Requirement | Notes |
81
+ |---|---|
82
+ | Node.js 22 or newer | Required for the published CLI and source builds. |
83
+ | Git | Required for repository context and normal development workflows. |
84
+ | Ollama | Optional, only needed for local or remote Ollama inference. |
85
+ | Provider API key | Optional, only needed for Gemini, OpenRouter, or NVIDIA routes. |
86
+ | Codex CLI login | Optional, only needed for the Codex provider route. |
75
87
 
76
88
  ## Quick Start
77
89
 
@@ -81,6 +93,13 @@ Install the public CLI globally:
81
93
  npm install -g @jx-grxf/patchpilot
82
94
  ```
83
95
 
96
+ Verify the installed CLI:
97
+
98
+ ```bash
99
+ patchpilot --version
100
+ patchpilot doctor --provider ollama
101
+ ```
102
+
84
103
  For source development, clone it, install dependencies, build it, and link the local CLI:
85
104
 
86
105
  ```bash
@@ -95,7 +114,6 @@ For local Ollama inference:
95
114
 
96
115
  ```bash
97
116
  ollama pull qwen2.5-coder:7b
98
- patchpilot doctor
99
117
  patchpilot
100
118
  ```
101
119
 
@@ -120,11 +138,15 @@ patchpilot "add tests for the parser" --apply --allow-shell
120
138
 
121
139
  API keys are stored by onboarding in `~/.patchpilot/.env`.
122
140
 
141
+ On first launch, PatchPilot opens guided setup for provider choice, API-key storage, host discovery, and model selection. Press Escape to leave setup, or run `/onboarding` later to reopen it.
142
+
123
143
  ## Usage
124
144
 
125
145
  ```bash
126
146
  patchpilot [task] [options]
127
147
  patchpilot doctor [options]
148
+ patchpilot sessions [--workspace <path>]
149
+ patchpilot resume [session-id] [--workspace <path>]
128
150
  ```
129
151
 
130
152
  | Option | Description |
@@ -135,7 +157,7 @@ patchpilot doctor [options]
135
157
  | `--ollama-url <url>` | Ollama base URL. Defaults to `http://127.0.0.1:11434`. |
136
158
  | `--steps <count>` | Maximum agent loop steps before stopping. |
137
159
  | `--thinking <mode>` | Step-budget mode: `fixed` or `adaptive`. |
138
- | `--reasoning <effort>` | Provider reasoning effort: `low`, `medium`, `high`, `xhigh`, or `adaptive`. |
160
+ | `--reasoning <effort>` | Provider reasoning effort: `none`, `low`, `medium`, `high`, `xhigh`, or `adaptive`. Unsupported provider/model combinations fall back to provider defaults. |
139
161
  | `--apply` | Allows file writes inside the workspace. |
140
162
  | `--allow-shell` | Allows shell commands inside the workspace. |
141
163
  | `--no-subagents` | Disables explorer/planner/reviewer advisor calls for faster runs. |
@@ -150,7 +172,7 @@ Useful slash commands inside the TUI:
150
172
  | `/mode plan` | Read-only planning mode. |
151
173
  | `/mode build` | Implementation mode; writes and shell can still be toggled separately. |
152
174
  | `/think fixed\|adaptive` | Switch between fixed and adaptive step budgets. |
153
- | `/reasoning low\|medium\|high\|xhigh\|adaptive` | Set provider reasoning effort where supported. |
175
+ | `/reasoning none\|low\|medium\|high\|xhigh\|adaptive` | Set provider reasoning effort where supported. |
154
176
  | `/write on\|off` | Enable or disable workspace writes. |
155
177
  | `/shell on\|off` | Enable or disable shell commands. |
156
178
  | `/agents on\|off` | Enable or disable advisor subagents. |
@@ -162,6 +184,11 @@ Useful slash commands inside the TUI:
162
184
  | `/eject [model\|all]` | Unload Ollama model(s) from the active host. |
163
185
  | `/hosts` | Re-scan reachable Ollama hosts. |
164
186
  | `/doctor` | Run provider diagnostics from inside the TUI. |
187
+ | `/sessions` | List recent sessions for the current workspace. |
188
+ | `/resume [session-id]` | Load a previous session summary. |
189
+ | `/diff` | Show the current Git diff. |
190
+ | `/approve once\|session` | Approve a pending risky tool request. |
191
+ | `/deny` | Deny a pending risky tool request. |
165
192
  | `/clear` | Clear the current transcript. |
166
193
  | `/exit` | Quit PatchPilot. |
167
194
 
@@ -205,6 +232,8 @@ PatchPilot caches model discovery for a short TTL inside the running TUI, so nor
205
232
 
206
233
  PatchPilot reads provider cache telemetry when the provider reports it, for example Codex cached input tokens or OpenRouter `prompt_tokens_details.cached_tokens`, then displays cache hit rate as `cached / input`.
207
234
 
235
+ Reasoning support is provider and model dependent. Codex accepts fixed reasoning levels. OpenRouter receives normalized `reasoning.effort` for compatible models. Gemini uses Thinking configuration where the selected model exposes it; some Gemini models cannot disable thinking. Ollama only receives native `think` values for known thinking model families. NVIDIA reasoning effort is limited to supported GPT-OSS NIM routes.
236
+
208
237
  OpenRouter `:free` models are rate-limited by OpenRouter. PatchPilot warns when a selected model ID ends in `:free`.
209
238
 
210
239
  ## Remote Ollama
@@ -247,15 +276,30 @@ PatchPilot is designed to keep powerful actions boring and reviewable:
247
276
 
248
277
  - File access is constrained to one workspace root.
249
278
  - Secret-like files such as `.env`, `.npmrc`, SSH keys, and `.netrc` are blocked from normal file tools.
250
- - Writes are disabled unless `--apply` is set.
251
- - Shell commands are disabled unless `--allow-shell` is set.
279
+ - Writes are blocked by default; in the TUI, risky write tools request approval, and `--apply` keeps the legacy always-allow write path.
280
+ - Shell commands are blocked by default; dedicated script/test tools request approval, and `--allow-shell` keeps the legacy always-allow shell path.
252
281
  - Shell execution uses a restricted single-command runner.
253
282
  - Provider config is stored in `~/.patchpilot/.env`, not in the current repository by default.
283
+ - Session logs are stored as append-only JSONL in `.patchpilot/sessions/`; that folder is gitignored. A global index in `~/.patchpilot/session-index.json` powers `patchpilot sessions` and `/resume`.
254
284
  - Tool output is shown in the transcript and fed back into the agent in clipped form.
255
285
  - Cloud providers may process prompts and context remotely under their own terms.
256
286
 
257
287
  This is still experimental agent tooling. Review diffs, avoid sensitive repositories when using cloud providers, and do not enable write or shell permissions casually.
258
288
 
289
+ Safe patch workflow:
290
+
291
+ ```text
292
+ /mode plan
293
+ ask PatchPilot to inspect and propose the change
294
+ /mode build
295
+ approve only the specific write/test requests you expect
296
+ /diff
297
+ run tests
298
+ commit manually with git
299
+ ```
300
+
301
+ PatchPilot now has approval prompts and a Git diff command, but it still does not replace human review. Inline rich diff review and commit/PR automation remain future work.
302
+
259
303
  ## Tech Stack
260
304
 
261
305
  | Layer | Technologies |
@@ -264,6 +308,7 @@ This is still experimental agent tooling. Review diffs, avoid sensitive reposito
264
308
  | Runtime | Node.js 22+ |
265
309
  | TUI | Ink, React, ink-text-input |
266
310
  | Agent protocol | JSON command envelope validated with Zod |
311
+ | Sessions | Append-only JSONL in `.patchpilot/sessions` plus global index in `~/.patchpilot` |
267
312
  | Providers | Ollama chat API, Gemini generateContent API, OpenRouter OpenAI-compatible API, NVIDIA OpenAI-compatible API, Codex CLI OAuth backend |
268
313
  | Tests | Vitest |
269
314
  | CI | GitHub Actions |
@@ -293,17 +338,29 @@ If Vitest fails because a native optional dependency was installed incorrectly,
293
338
  | Area | Planned work |
294
339
  |---|---|
295
340
  | Patch review | Rich diff preview before writes. |
296
- | Permissions | Interactive approve/deny prompts per risky tool call. |
341
+ | Permissions | Per-tool approval exists; richer previews and persisted policies are next. |
297
342
  | Agents | Dedicated editor and test-runner roles with hard tool boundaries. |
298
- | Memory | Repository summaries and local task state. |
343
+ | Memory | Deeper resume that restores full transcript context, not just session summaries. |
299
344
  | Model support | Native Ollama tool calling when model support is reliable. |
300
345
  | Distribution | Signed macOS and Windows desktop shell with the CLI as a sidecar. |
301
346
  | Efficiency | More token-cache-aware prompts and provider-specific cost reporting. |
302
347
 
348
+ ## Release Notes
349
+
350
+ Release notes are kept in [docs/releases](docs/releases).
351
+
352
+ | Version | Notes |
353
+ |---|---|
354
+ | `v0.3.0` | [Release notes](docs/releases/v0.3.0.md) |
355
+ | `v0.2.1` | [Release notes](docs/releases/v0.2.1.md) |
356
+ | `v0.2.0` | [Release notes](docs/releases/v0.2.0.md) |
357
+ | `v0.1.0` | [Release notes](docs/releases/v0.1.0.md) |
358
+
303
359
  ## Security and Legal
304
360
 
305
361
  PatchPilot can read files, write files, and run shell commands when you enable those capabilities. Use it only in repositories and environments you trust.
306
362
 
363
+ - Security policy: see [SECURITY.md](SECURITY.md).
307
364
  - Security reports: please use GitHub Security Advisories or contact the maintainer privately with reproduction steps and impact.
308
365
  - License: this project is provided under the [MIT License](LICENSE).
309
366
  - Warranty: the software is provided "AS IS", without warranties of any kind.
package/SECURITY.md ADDED
@@ -0,0 +1,20 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ PatchPilot is public preview software. Security fixes target the latest published npm version and the `main` branch.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ Please report security issues through GitHub Security Advisories when available, or contact the maintainer privately with:
10
+
11
+ - affected version or commit
12
+ - reproduction steps
13
+ - expected impact
14
+ - whether provider credentials, local files, or shell permissions are involved
15
+
16
+ Do not open a public issue for a vulnerability before the maintainer has had time to triage it.
17
+
18
+ ## Security Model
19
+
20
+ PatchPilot keeps file tools inside one workspace root, blocks common secret files, and requires explicit flags for writes and shell commands. Cloud providers may receive prompt and repository context under their own terms. Review diffs before committing generated changes.
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import path from "node:path";
4
+ import { readFileSync } from "node:fs";
4
5
  import { render } from "ink";
5
6
  import { Command } from "commander";
6
7
  import { defaultCodexModel } from "./core/codex.js";
@@ -11,6 +12,7 @@ import { defaultNvidiaModel } from "./core/nvidia.js";
11
12
  import { runDoctor } from "./core/doctor.js";
12
13
  import { defaultOllamaModel, resolveOllamaBaseUrl } from "./core/ollama.js";
13
14
  import { defaultOpenRouterModel } from "./core/openrouter.js";
15
+ import { listIndexedSessions, listWorkspaceSessions, loadSessionSummary } from "./core/session.js";
14
16
  import { App } from "./tui/App.js";
15
17
  loadPatchPilotEnv();
16
18
  const defaultOllamaUrl = resolveOllamaBaseUrl();
@@ -30,7 +32,7 @@ program.enablePositionalOptions();
30
32
  program
31
33
  .name("patchpilot")
32
34
  .description("Local-first coding agent TUI powered by Ollama and OpenAI-compatible providers.")
33
- .version("0.2.0");
35
+ .version(readPackageVersion());
34
36
  program
35
37
  .command("doctor")
36
38
  .description("Check local PatchPilot requirements.")
@@ -47,6 +49,40 @@ program
47
49
  }
48
50
  process.exitCode = results.every((result) => result.ok) ? 0 : 1;
49
51
  });
52
+ program
53
+ .command("sessions")
54
+ .description("List recent PatchPilot sessions.")
55
+ .option("--workspace <path>", "Workspace root. Defaults to the current directory.")
56
+ .action(async (options) => {
57
+ const sessions = options.workspace ? await listWorkspaceSessions(path.resolve(options.workspace)) : await listIndexedSessions();
58
+ if (sessions.length === 0) {
59
+ console.log("No PatchPilot sessions found.");
60
+ return;
61
+ }
62
+ for (const session of sessions.slice(0, 20)) {
63
+ console.log(`${session.sessionId} ${session.updatedAt} ${session.workspace} ${session.lastTask ?? ""}`);
64
+ }
65
+ });
66
+ program
67
+ .command("resume")
68
+ .description("Show a previous PatchPilot session summary.")
69
+ .argument("[session-id]", "Session id to inspect. Defaults to the latest workspace session.")
70
+ .option("--workspace <path>", "Workspace root", process.cwd())
71
+ .action(async (sessionId, options) => {
72
+ const workspace = path.resolve(options.workspace);
73
+ const latest = sessionId ? null : (await listWorkspaceSessions(workspace))[0] ?? null;
74
+ const summary = sessionId ? await loadSessionSummary(workspace, sessionId) : latest;
75
+ if (!summary) {
76
+ console.log("No PatchPilot session found for this workspace.");
77
+ process.exitCode = 1;
78
+ return;
79
+ }
80
+ console.log(`session: ${summary.sessionId}`);
81
+ console.log(`workspace: ${summary.workspace}`);
82
+ console.log(`updated: ${summary.updatedAt}`);
83
+ console.log(`model: ${summary.provider ?? "-"} ${summary.model ?? "-"}`);
84
+ console.log(`last task: ${summary.lastTask ?? "-"}`);
85
+ });
50
86
  program
51
87
  .argument("[task...]", "Task for the local coding agent.")
52
88
  .option("--workspace <path>", "Workspace root", process.cwd())
@@ -55,7 +91,7 @@ program
55
91
  .option("--ollama-url <url>", "Ollama base URL", defaultOllamaUrl)
56
92
  .option("--steps <count>", "Maximum agent steps", "8")
57
93
  .option("--thinking <mode>", "Thinking budget mode: fixed or adaptive.", process.env.PATCHPILOT_THINKING_MODE ?? "fixed")
58
- .option("--reasoning <effort>", "Provider reasoning effort: low, medium, high, xhigh, or adaptive.", process.env.PATCHPILOT_REASONING_EFFORT ?? "medium")
94
+ .option("--reasoning <effort>", "Provider reasoning effort: none, low, medium, high, xhigh, or adaptive.", process.env.PATCHPILOT_REASONING_EFFORT ?? "medium")
59
95
  .option("--apply", "Allow file writes inside the workspace.", false)
60
96
  .option("--allow-shell", "Allow shell commands inside the workspace.", false)
61
97
  .option("--no-subagents", "Disable planner and reviewer subagents for faster local runs.")
@@ -66,6 +102,19 @@ program
66
102
  });
67
103
  await program.parseAsync(process.argv);
68
104
  function readReasoningEffort(value) {
69
- return value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "adaptive" ? value : "medium";
105
+ return value === "none" || value === "off" || value === "false"
106
+ ? "none"
107
+ : value === "low" || value === "medium" || value === "high" || value === "xhigh" || value === "adaptive"
108
+ ? value
109
+ : "medium";
110
+ }
111
+ function readPackageVersion() {
112
+ try {
113
+ const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
114
+ return typeof packageJson.version === "string" ? packageJson.version : "0.0.0";
115
+ }
116
+ catch {
117
+ return "0.0.0";
118
+ }
70
119
  }
71
120
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx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K,MAAM,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,OAAO;QAC7D,CAAC,CAAC,MAAM;QACR,CAAC,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,UAAU;YACtG,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,QAAQ,CAAC;AACjB,CAAC;AAED,SAAS,kBAAkB;IACzB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAA0B,CAAC;QAC3H,OAAO,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACjF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
- import type { AgentEvent, ModelProvider, ReasoningEffort } from "./types.js";
1
+ import type { SessionStore } from "./session.js";
2
+ import type { AgentEvent, ApprovalRequest, ModelProvider, PermissionDecision, ProviderReasoningEffort } from "./types.js";
2
3
  export type AgentRunnerOptions = {
3
4
  provider: ModelProvider;
4
5
  model: string;
@@ -8,9 +9,11 @@ export type AgentRunnerOptions = {
8
9
  allowShell: boolean;
9
10
  maxSteps: number;
10
11
  thinkingMode: "fixed" | "adaptive";
11
- reasoningEffort: ReasoningEffort | "adaptive";
12
+ reasoningEffort: ProviderReasoningEffort | "adaptive";
12
13
  subagents: boolean;
13
14
  signal?: AbortSignal;
15
+ sessionStore?: SessionStore;
16
+ approvalHandler?: (request: ApprovalRequest) => Promise<PermissionDecision>;
14
17
  };
15
18
  export declare class AgentRunner {
16
19
  private readonly client;