@jx-grxf/patchpilot 0.4.0 → 1.2.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 (180) hide show
  1. package/.env.example +17 -1
  2. package/README.md +113 -23
  3. package/SECURITY.md +7 -1
  4. package/dist/cli.js +103 -14
  5. package/dist/cli.js.map +1 -1
  6. package/dist/core/agent.d.ts +47 -1
  7. package/dist/core/agent.js +667 -76
  8. package/dist/core/agent.js.map +1 -1
  9. package/dist/core/cleanup.d.ts +3 -0
  10. package/dist/core/cleanup.js +29 -0
  11. package/dist/core/cleanup.js.map +1 -0
  12. package/dist/core/clipboard.d.ts +14 -0
  13. package/dist/core/clipboard.js +134 -0
  14. package/dist/core/clipboard.js.map +1 -0
  15. package/dist/core/codex.d.ts +8 -0
  16. package/dist/core/codex.js +28 -2
  17. package/dist/core/codex.js.map +1 -1
  18. package/dist/core/compaction.d.ts +23 -0
  19. package/dist/core/compaction.js +145 -0
  20. package/dist/core/compaction.js.map +1 -0
  21. package/dist/core/contextFormat.d.ts +21 -0
  22. package/dist/core/contextFormat.js +87 -0
  23. package/dist/core/contextFormat.js.map +1 -0
  24. package/dist/core/contextItem.d.ts +41 -0
  25. package/dist/core/contextItem.js +93 -0
  26. package/dist/core/contextItem.js.map +1 -0
  27. package/dist/core/contextStore.d.ts +48 -0
  28. package/dist/core/contextStore.js +306 -0
  29. package/dist/core/contextStore.js.map +1 -0
  30. package/dist/core/doctor.d.ts +4 -1
  31. package/dist/core/doctor.js +122 -3
  32. package/dist/core/doctor.js.map +1 -1
  33. package/dist/core/gemini.js +10 -4
  34. package/dist/core/gemini.js.map +1 -1
  35. package/dist/core/geminiWrapper.d.ts +92 -0
  36. package/dist/core/geminiWrapper.js +1258 -0
  37. package/dist/core/geminiWrapper.js.map +1 -0
  38. package/dist/core/http.js +70 -6
  39. package/dist/core/http.js.map +1 -1
  40. package/dist/core/json.d.ts +1 -1
  41. package/dist/core/json.js +81 -19
  42. package/dist/core/json.js.map +1 -1
  43. package/dist/core/memory.d.ts +16 -0
  44. package/dist/core/memory.js +108 -0
  45. package/dist/core/memory.js.map +1 -0
  46. package/dist/core/modelClient.js +7 -0
  47. package/dist/core/modelClient.js.map +1 -1
  48. package/dist/core/nvidia.d.ts +1 -1
  49. package/dist/core/nvidia.js +13 -4
  50. package/dist/core/nvidia.js.map +1 -1
  51. package/dist/core/ollama.js +13 -3
  52. package/dist/core/ollama.js.map +1 -1
  53. package/dist/core/openrouter.js +15 -6
  54. package/dist/core/openrouter.js.map +1 -1
  55. package/dist/core/projectInit.d.ts +6 -0
  56. package/dist/core/projectInit.js +44 -0
  57. package/dist/core/projectInit.js.map +1 -0
  58. package/dist/core/reasoning.js +6 -0
  59. package/dist/core/reasoning.js.map +1 -1
  60. package/dist/core/session.d.ts +1 -0
  61. package/dist/core/session.js +55 -3
  62. package/dist/core/session.js.map +1 -1
  63. package/dist/core/tokenAccounting.d.ts +4 -0
  64. package/dist/core/tokenAccounting.js +75 -13
  65. package/dist/core/tokenAccounting.js.map +1 -1
  66. package/dist/core/types.d.ts +65 -5
  67. package/dist/core/types.js +30 -1
  68. package/dist/core/types.js.map +1 -1
  69. package/dist/core/updateCheck.d.ts +19 -0
  70. package/dist/core/updateCheck.js +103 -0
  71. package/dist/core/updateCheck.js.map +1 -0
  72. package/dist/core/workspace.d.ts +37 -0
  73. package/dist/core/workspace.js +1535 -84
  74. package/dist/core/workspace.js.map +1 -1
  75. package/dist/tui/App.d.ts +1 -0
  76. package/dist/tui/App.js +1841 -140
  77. package/dist/tui/App.js.map +1 -1
  78. package/dist/tui/commands.js +141 -9
  79. package/dist/tui/commands.js.map +1 -1
  80. package/dist/tui/components/ApprovalPanel.js +16 -1
  81. package/dist/tui/components/ApprovalPanel.js.map +1 -1
  82. package/dist/tui/components/CommandSuggestions.js +33 -5
  83. package/dist/tui/components/CommandSuggestions.js.map +1 -1
  84. package/dist/tui/components/Composer.d.ts +3 -0
  85. package/dist/tui/components/Composer.js +57 -5
  86. package/dist/tui/components/Composer.js.map +1 -1
  87. package/dist/tui/components/ExperimentalPanel.d.ts +10 -0
  88. package/dist/tui/components/ExperimentalPanel.js +38 -0
  89. package/dist/tui/components/ExperimentalPanel.js.map +1 -0
  90. package/dist/tui/components/Header.js +3 -3
  91. package/dist/tui/components/Header.js.map +1 -1
  92. package/dist/tui/components/OnboardingPanel.d.ts +25 -1
  93. package/dist/tui/components/OnboardingPanel.js +87 -25
  94. package/dist/tui/components/OnboardingPanel.js.map +1 -1
  95. package/dist/tui/components/Sidebar.js +17 -13
  96. package/dist/tui/components/Sidebar.js.map +1 -1
  97. package/dist/tui/components/StartupBanner.d.ts +4 -0
  98. package/dist/tui/components/StartupBanner.js +9 -0
  99. package/dist/tui/components/StartupBanner.js.map +1 -0
  100. package/dist/tui/components/Transcript.d.ts +7 -0
  101. package/dist/tui/components/Transcript.js +87 -17
  102. package/dist/tui/components/Transcript.js.map +1 -1
  103. package/dist/tui/contextCommands.d.ts +8 -0
  104. package/dist/tui/contextCommands.js +205 -0
  105. package/dist/tui/contextCommands.js.map +1 -0
  106. package/dist/tui/experimental/AnimatedText.d.ts +38 -0
  107. package/dist/tui/experimental/AnimatedText.js +55 -0
  108. package/dist/tui/experimental/AnimatedText.js.map +1 -0
  109. package/dist/tui/experimental/Banner.d.ts +10 -0
  110. package/dist/tui/experimental/Banner.js +33 -0
  111. package/dist/tui/experimental/Banner.js.map +1 -0
  112. package/dist/tui/experimental/CommandPalette.d.ts +11 -0
  113. package/dist/tui/experimental/CommandPalette.js +25 -0
  114. package/dist/tui/experimental/CommandPalette.js.map +1 -0
  115. package/dist/tui/experimental/ExperimentalShell.d.ts +58 -0
  116. package/dist/tui/experimental/ExperimentalShell.js +366 -0
  117. package/dist/tui/experimental/ExperimentalShell.js.map +1 -0
  118. package/dist/tui/experimental/ThemePicker.d.ts +13 -0
  119. package/dist/tui/experimental/ThemePicker.js +12 -0
  120. package/dist/tui/experimental/ThemePicker.js.map +1 -0
  121. package/dist/tui/experimental/attachments.d.ts +35 -0
  122. package/dist/tui/experimental/attachments.js +244 -0
  123. package/dist/tui/experimental/attachments.js.map +1 -0
  124. package/dist/tui/experimental/composer.d.ts +24 -0
  125. package/dist/tui/experimental/composer.js +84 -0
  126. package/dist/tui/experimental/composer.js.map +1 -0
  127. package/dist/tui/experimental/geminiPricing.d.ts +16 -0
  128. package/dist/tui/experimental/geminiPricing.js +39 -0
  129. package/dist/tui/experimental/geminiPricing.js.map +1 -0
  130. package/dist/tui/experimental/layout.d.ts +46 -0
  131. package/dist/tui/experimental/layout.js +112 -0
  132. package/dist/tui/experimental/layout.js.map +1 -0
  133. package/dist/tui/experimental/theme.d.ts +35 -0
  134. package/dist/tui/experimental/theme.js +86 -0
  135. package/dist/tui/experimental/theme.js.map +1 -0
  136. package/dist/tui/experimental/transcriptRows.d.ts +20 -0
  137. package/dist/tui/experimental/transcriptRows.js +169 -0
  138. package/dist/tui/experimental/transcriptRows.js.map +1 -0
  139. package/dist/tui/experimental/ultraModes.d.ts +46 -0
  140. package/dist/tui/experimental/ultraModes.js +95 -0
  141. package/dist/tui/experimental/ultraModes.js.map +1 -0
  142. package/dist/tui/experimental/ultramaxx.d.ts +19 -0
  143. package/dist/tui/experimental/ultramaxx.js +43 -0
  144. package/dist/tui/experimental/ultramaxx.js.map +1 -0
  145. package/dist/tui/format.d.ts +4 -2
  146. package/dist/tui/format.js +21 -7
  147. package/dist/tui/format.js.map +1 -1
  148. package/dist/tui/hosts.js +7 -1
  149. package/dist/tui/hosts.js.map +1 -1
  150. package/dist/tui/layout.d.ts +26 -0
  151. package/dist/tui/layout.js +66 -0
  152. package/dist/tui/layout.js.map +1 -0
  153. package/dist/tui/modelSelection.d.ts +1 -1
  154. package/dist/tui/modelSelection.js +8 -6
  155. package/dist/tui/modelSelection.js.map +1 -1
  156. package/dist/tui/modes.d.ts +8 -1
  157. package/dist/tui/modes.js +20 -2
  158. package/dist/tui/modes.js.map +1 -1
  159. package/dist/tui/onboardingPreferences.d.ts +37 -0
  160. package/dist/tui/onboardingPreferences.js +118 -0
  161. package/dist/tui/onboardingPreferences.js.map +1 -0
  162. package/dist/tui/runStatus.d.ts +50 -0
  163. package/dist/tui/runStatus.js +164 -0
  164. package/dist/tui/runStatus.js.map +1 -0
  165. package/dist/tui/types.d.ts +8 -0
  166. package/dist/tui/types.js.map +1 -1
  167. package/docs/architecture.md +115 -0
  168. package/docs/gemini-wrapper.md +110 -0
  169. package/docs/product-context.md +43 -0
  170. package/docs/releases/v0.1.1-beta.md +18 -0
  171. package/docs/releases/v0.2.1.md +1 -1
  172. package/docs/releases/v0.3.1-beta.md +4 -0
  173. package/docs/releases/v0.4.0.md +1 -1
  174. package/docs/releases/v1.0.0.md +28 -0
  175. package/docs/releases/v1.0.1.md +25 -0
  176. package/docs/releases/v1.1.0.md +30 -0
  177. package/docs/releases/v1.2.0.md +28 -0
  178. package/docs/showcase/patchpilot-banner.png +0 -0
  179. package/docs/showcase/patchpilot-logo.png +0 -0
  180. package/package.json +8 -3
package/.env.example CHANGED
@@ -1,4 +1,4 @@
1
- # Provider options: ollama, gemini, openrouter, nvidia, codex.
1
+ # Provider options: ollama, gemini, gemini-wrapper, openrouter, nvidia, codex.
2
2
  # codex uses your Codex CLI ChatGPT login. Run: codex login
3
3
  PATCHPILOT_PROVIDER=codex
4
4
  PATCHPILOT_MODEL=gpt-5.5
@@ -8,6 +8,22 @@ GEMINI_API_KEY=your_gemini_api_key_here
8
8
  OPENROUTER_API_KEY=your_openrouter_api_key_here
9
9
  NVIDIA_API_KEY=your_nvidia_api_key_here
10
10
 
11
+ # Optional: Gemini-Wrapper provider.
12
+ # Default mode uses PatchPilot's managed Python venv for `gemini_webapi`.
13
+ # PatchPilot creates ~/.patchpilot/gemini-wrapper-venv automatically.
14
+ # Onboarding can create ~/.patchpilot/gemini-cookies.json from masked pasted values.
15
+ # PatchPilot never scans browser cookies or web login sessions.
16
+ PATCHPILOT_GEMINI_WRAPPER_MODE=python
17
+ PATCHPILOT_GEMINI_WRAPPER_BOOTSTRAP_PYTHON=python3
18
+ PATCHPILOT_GEMINI_WRAPPER_COOKIES_JSON=/Users/you/.patchpilot/gemini-cookies.json
19
+ PATCHPILOT_GEMINI_WRAPPER_MIN_INTERVAL_MS=1500
20
+ PATCHPILOT_GEMINI_WRAPPER_TIMEOUT_MS=180000
21
+ # Alternative HTTP mode for an explicit OpenAI-compatible wrapper endpoint.
22
+ PATCHPILOT_GEMINI_WRAPPER_BASE_URL=http://localhost:8787/v1
23
+ PATCHPILOT_GEMINI_WRAPPER_API_KEY=your_wrapper_api_key_here
24
+
11
25
  # Optional tuning shared by local and API providers.
12
26
  PATCHPILOT_NUM_PREDICT=1024
13
27
  PATCHPILOT_TEMPERATURE=0.1
28
+ PATCHPILOT_THINKING_MODE=adaptive
29
+ PATCHPILOT_SUBAGENTS=off
package/README.md CHANGED
@@ -1,34 +1,45 @@
1
1
  <div align="center">
2
2
 
3
+ <img src="https://raw.githubusercontent.com/jx-grxf/PatchPilot/main/docs/showcase/patchpilot-logo.png" alt="PatchPilot logo" width="112">
4
+
3
5
  # PatchPilot
4
6
 
5
7
  **A local-first coding-agent TUI that makes repo changes visible, permissioned, and easy to review across local, remote, and cloud model routes.**
6
8
 
7
9
  [![CI](https://github.com/jx-grxf/PatchPilot/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/jx-grxf/PatchPilot/actions/workflows/ci.yml)
8
- ![Status](https://img.shields.io/badge/status-preview%20agent-0ea5e9)
9
- ![TypeScript](https://img.shields.io/badge/TypeScript-5.9-3178C6?logo=typescript&logoColor=white)
10
+ [![npm](https://img.shields.io/npm/v/@jx-grxf/patchpilot?logo=npm&color=cb3837)](https://www.npmjs.com/package/@jx-grxf/patchpilot)
11
+ [![npm downloads](https://img.shields.io/npm/dm/@jx-grxf/patchpilot?logo=npm&color=0ea5e9)](https://www.npmjs.com/package/@jx-grxf/patchpilot)
12
+ ![Status](https://img.shields.io/badge/status-v1.2.0-0ea5e9)
13
+ ![TypeScript](https://img.shields.io/badge/TypeScript-6.0-3178C6?logo=typescript&logoColor=white)
10
14
  ![Node](https://img.shields.io/badge/Node.js-22%2B-339933?logo=node.js&logoColor=white)
11
15
  ![Ink](https://img.shields.io/badge/TUI-Ink-111827)
12
16
  ![Ollama](https://img.shields.io/badge/LLM-Ollama-000000)
13
17
  [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
14
18
 
15
19
  <p>
16
- <strong>Visible tools.</strong> Explicit permissions. Local Ollama. Remote Ollama. Gemini. OpenRouter. NVIDIA. Codex.
20
+ <strong>Visible tools.</strong> Explicit permissions. Local Ollama. Remote Ollama. Gemini. Gemini-Wrapper. OpenRouter. NVIDIA. Codex.
17
21
  </p>
18
22
 
19
23
  </div>
20
24
 
21
25
  ---
22
26
 
23
- ## Showcase
27
+ ## Product Visual
28
+
29
+ <p align="center">
30
+ <img src="https://raw.githubusercontent.com/jx-grxf/PatchPilot/main/docs/showcase/patchpilot-banner.png" alt="PatchPilot product visual" width="920">
31
+ </p>
32
+
33
+ ## Current TUI Screenshot
24
34
 
25
35
  <p align="center">
26
36
  <img src="docs/showcase/patchpilot-showcase.svg" alt="PatchPilot terminal interface overview" width="920">
27
37
  </p>
28
38
 
29
- PatchPilot is a terminal interface for running coding-agent tasks inside a repository. It shows what the agent is doing, keeps risky actions behind explicit permissions, and supports local Ollama, remote Ollama, Google Gemini, OpenRouter, NVIDIA NIM-compatible endpoints, and Codex CLI OAuth.
39
+ PatchPilot is a terminal interface for running coding-agent tasks inside a repository. It shows what the agent is doing, keeps risky actions behind explicit permissions, and supports local Ollama, remote Ollama, Google Gemini, experimental Gemini Web wrapper routing, OpenRouter, NVIDIA NIM-compatible endpoints, and Codex CLI OAuth.
30
40
 
31
- PatchPilot is still preview software. The v0.4 line focuses on making the TUI, approvals, and provider selection reliable enough for real project use; it is not a finished autonomous PR bot or a v1 desktop product.
41
+ > [!IMPORTANT]
42
+ > PatchPilot v1.2.0 is the large agent-hardening release: default fullscreen shell, context compaction, composable ultra modes, safer shell approvals, first-run risk acceptance, Windows fixes, and refreshed npm dependencies.
32
43
 
33
44
  ---
34
45
 
@@ -36,6 +47,7 @@ PatchPilot is still preview software. The v0.4 line focuses on making the TUI, a
36
47
 
37
48
  - [Highlights](#highlights)
38
49
  - [Why This Exists](#why-this-exists)
50
+ - [Current Workflow](#current-workflow)
39
51
  - [Requirements](#requirements)
40
52
  - [Quick Start](#quick-start)
41
53
  - [Usage](#usage)
@@ -54,21 +66,42 @@ PatchPilot is still preview software. The v0.4 line focuses on making the TUI, a
54
66
  | Feature | What it means |
55
67
  |---|---|
56
68
  | Local-first by default | Uses Ollama on your own machine unless you choose another route. |
69
+ | Fullscreen shell | A Claude-Code / Codex-CLI-style TUI: compact header, scrolling transcript, command palette, animated run status, artifacts, and a bottom-pinned composer. `/theme` switches between the new shell and the legacy layout. |
57
70
  | Remote GPU workflow | Connect your laptop TUI to an Ollama host on a desktop, LAN, or Tailscale machine. |
58
- | Cloud provider routes | Gemini, OpenRouter, NVIDIA, and Codex CLI OAuth are available from one TUI. |
59
- | Guided onboarding | First-run setup walks through local/remote mode, provider auth, host discovery, and model choice. |
71
+ | Cloud provider routes | Gemini, Gemini-Wrapper, OpenRouter, NVIDIA, and Codex CLI OAuth are available from one TUI. |
72
+ | Guided onboarding | First-run setup walks through local/remote mode, provider auth, host discovery, model choice, defaults, and risk acceptance. |
60
73
  | Observable agent loop | Transcript, tool calls, telemetry, token counts, provider cache hits, latency, and cost estimates are visible. |
61
- | Explicit permissions | Risky tools show a sticky approval box unless trusted bypass is explicitly accepted. |
74
+ | Document attachments | Paste a path to an image, PDF, or DOCX and it becomes an attachment chip; an artifacts bar lists what you attached and what PatchPilot created. |
75
+ | Composable ultra modes | Type `ultramaxx`, `ultrafast`, `ultracheap`, `ultrafocus:<path>`, or `ultraloop` in a prompt to tune effort, speed, scope, and self-review. |
76
+ | Context compaction | `/context` and `/compact` keep long sessions usable by storing and summarizing workspace context. |
77
+ | Saved-cost counter | The gemini-wrapper route is free; the header shows what the same tokens would have cost on the paid Gemini API. |
78
+ | Explicit permissions | Risky tools show a sticky approval box unless trusted bypass is explicitly accepted; high-risk shell syntax still asks in bypass. |
62
79
  | Workspace boundary | File tools are constrained to the selected project root and block common secret files. |
63
80
  | Slash-command palette | Type `/` for browsable commands, provider switching, modes, models, diagnostics, and host selection. |
64
81
  | Advisor subagents | Explorer, planner, and reviewer advisor calls can brief the main agent before it edits. |
82
+ | Windows-ready paths | Clipboard paste, attachments, Codex CLI resolution, and Gemini-Wrapper bootstrap paths handle Windows launchers and separators. |
65
83
  | Ollama eject | `/eject` unloads the active Ollama model; `/eject all` clears models PatchPilot used in the session. |
66
84
  | CI-ready TypeScript | Strict TypeScript, Vitest, GitHub Actions, and package verification are included. |
67
85
 
86
+ ## Interface
87
+
88
+ PatchPilot ships two interfaces. The **experimental shell** is the default: a
89
+ fullscreen layout with a compact header, a real scrolling transcript, a
90
+ bottom-pinned multiline composer, a categorized command palette, and animated
91
+ run status. The **legacy** layout keeps the original sidebar split-pane TUI.
92
+ Switch any time with `/theme` (or `/theme new` / `/theme legacy`) — the choice
93
+ is remembered.
94
+
95
+ Useful keys: `tab` cycles plan → build → build+bypass, `/` opens the command
96
+ palette, `←/→` move the cursor inside the composer, `shift+enter` inserts a
97
+ newline, and `esc` stops a running task.
98
+
68
99
  ## Why This Exists
69
100
 
70
101
  Most local coding-agent experiments fall into one of two traps: they are either raw scripts that feel painful to use, or polished tools that hide too much of what is happening. PatchPilot aims for the middle: a practical TUI where every file read, search, proposed write, command, model route, and token/cost signal stays visible.
71
102
 
103
+ ## Current Workflow
104
+
72
105
  The core workflow is intentionally simple:
73
106
 
74
107
  1. Open a repository.
@@ -86,7 +119,7 @@ Mode behavior is intentionally explicit: `plan` is read-only, `build` keeps writ
86
119
  | Node.js 22 or newer | Required for the published CLI and source builds. |
87
120
  | Git | Required for repository context and normal development workflows. |
88
121
  | Ollama | Optional, only needed for local or remote Ollama inference. |
89
- | Provider API key | Optional, only needed for Gemini, OpenRouter, or NVIDIA routes. |
122
+ | Provider API key | Optional, only needed for Gemini, Gemini-Wrapper remote URLs, OpenRouter, or NVIDIA routes. |
90
123
  | Codex CLI login | Optional, only needed for the Codex provider route. |
91
124
 
92
125
  ## Quick Start
@@ -109,8 +142,12 @@ For source development, clone it, install dependencies, build it, and link the l
109
142
  ```bash
110
143
  git clone https://github.com/jx-grxf/PatchPilot.git
111
144
  cd PatchPilot
112
- npm install
145
+ npm ci
146
+ npm run typecheck
147
+ npm test
113
148
  npm run build
149
+ node dist/cli.js --version
150
+ npm pack --dry-run
114
151
  npm link
115
152
  ```
116
153
 
@@ -136,13 +173,16 @@ patchpilot "find likely test gaps in this repo"
136
173
 
137
174
  Use bypass permissions only when you intentionally want PatchPilot to modify files or run commands without per-tool approval:
138
175
 
176
+ > [!WARNING]
177
+ > `--apply --allow-shell` bypasses per-tool approval. Use it only in trusted workspaces and review `/diff` before committing.
178
+
139
179
  ```bash
140
180
  patchpilot "add tests for the parser" --apply --allow-shell
141
181
  ```
142
182
 
143
183
  API keys are stored by onboarding in `~/.patchpilot/.env`.
144
184
 
145
- 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.
185
+ On first launch, PatchPilot opens guided setup for provider choice, API-key storage, host discovery, and model selection. Setup includes a discreet use-at-your-own-risk acceptance step. Press Escape to leave setup, or run `/onboarding` later to reopen it.
146
186
 
147
187
  ## Usage
148
188
 
@@ -156,15 +196,16 @@ patchpilot resume [session-id] [--workspace <path>]
156
196
  | Option | Description |
157
197
  |---|---|
158
198
  | `--workspace <path>` | Project root the agent may inspect. Defaults to the current directory. |
159
- | `--provider <name>` | Model provider route. Supports `ollama`, `gemini`/`google`, `openrouter`/`open-router`, `nvidia`/`nim`, and `codex`/`openai`/`openai-codex`. |
199
+ | `--provider <name>` | Model provider route. Supports `ollama`, `gemini`/`google`, `gemini-wrapper`/`geminiwrapper`, `openrouter`/`open-router`, `nvidia`/`nim`, and `codex`/`openai`/`openai-codex`. |
160
200
  | `--model <name>` | Model name for the selected provider. |
161
201
  | `--ollama-url <url>` | Ollama base URL. Defaults to `http://127.0.0.1:11434`. |
162
202
  | `--steps <count>` | Maximum agent loop steps before stopping. |
163
- | `--thinking <mode>` | Step-budget mode: `fixed` or `adaptive`. |
203
+ | `--thinking <mode>` | Step-budget mode: `fixed` or `adaptive`. Defaults to `adaptive`. |
164
204
  | `--reasoning <effort>` | Provider reasoning effort: `none`, `low`, `medium`, `high`, `xhigh`, or `adaptive`. Unsupported provider/model combinations fall back to provider defaults. |
165
205
  | `--apply` | Allows file writes inside the workspace. |
166
206
  | `--allow-shell` | Allows shell commands inside the workspace. |
167
- | `--no-subagents` | Disables explorer/planner/reviewer advisor calls for faster runs. |
207
+ | `--subagents` | Enables explorer/planner/reviewer advisor calls. Defaults to off. |
208
+ | `--no-subagents` | Disables explorer/planner/reviewer advisor calls. |
168
209
 
169
210
  Useful slash commands inside the TUI:
170
211
 
@@ -172,7 +213,7 @@ Useful slash commands inside the TUI:
172
213
  |---|---|
173
214
  | `/help` | Show available commands. |
174
215
  | `/help <command>` | Explain one command, for example `/help think` or `/help model`. |
175
- | `/onboarding` | Open guided provider/auth/model setup. |
216
+ | `/onboarding` | Open guided local/remote provider, auth, and model setup. |
176
217
  | `/mode plan` | Read-only planning mode. |
177
218
  | `/mode build` | Implementation mode; writes, scripts, tests, and shell require per-tool approval. |
178
219
  | `/think fixed\|adaptive` | Switch between fixed and adaptive step budgets. |
@@ -180,7 +221,7 @@ Useful slash commands inside the TUI:
180
221
  | `/write on\|off` | Requests trusted bypass for direct writes, or returns to approval-gated build mode. |
181
222
  | `/shell on\|off` | Requests trusted bypass for direct shell commands, or returns to approval-gated build mode. |
182
223
  | `/agents on\|off` | Enable or disable advisor subagents. |
183
- | `/provider ollama\|gemini\|openrouter\|nvidia\|codex` | Switch inference provider. |
224
+ | `/provider ollama\|gemini\|gemini-wrapper\|openrouter\|nvidia\|codex` | Switch inference provider. |
184
225
  | `/model <query>` | Search and switch the model for the current provider. |
185
226
  | `/models [query\|number]` | Refresh, search, browse, or select provider models. |
186
227
  | `/connect` | Scan LAN/Tailscale for reachable Ollama hosts. |
@@ -188,8 +229,13 @@ Useful slash commands inside the TUI:
188
229
  | `/eject [model\|all]` | Unload Ollama model(s) from the active host. |
189
230
  | `/hosts` | Re-scan reachable Ollama hosts. |
190
231
  | `/doctor` | Run provider diagnostics from inside the TUI. |
232
+ | `/doctor fix` | Apply safe doctor repairs, such as installing the managed Gemini-API bridge. |
233
+ | `/cleanup cache\|sessions\|temp\|all` | Clean PatchPilot workspace state. |
234
+ | `/experimental` | Open the experimental checkbox menu; use Space to toggle file-analysis, memory, subagents, and shell-metacharacters. |
235
+ | `/init` | Ask the selected model to inspect the repository and create or update `PATCHPILOT.md`. |
236
+ | `/new` | Start a fresh session and clear current context. |
191
237
  | `/sessions` | List recent sessions for the current workspace. |
192
- | `/resume [session-id]` | Load a previous session summary. |
238
+ | `/resume [session-id]` | Resume a previous session and inject its compact summary into the next run. |
193
239
  | `/diff` | Show the current Git diff. |
194
240
  | `/approve once\|session` | Approve a pending risky tool request. |
195
241
  | `/deny` | Deny a pending risky tool request. |
@@ -198,6 +244,10 @@ Useful slash commands inside the TUI:
198
244
 
199
245
  The transcript and sidebar have internal scroll areas. With an empty prompt, use left/right to choose the sidebar or transcript, then Page Up/Page Down and Home/End to navigate long sessions.
200
246
 
247
+ The TUI also keeps a live todo panel in the lower transcript area. Providers can update it through the provider-neutral `update_todo` tool, so longer runs show the current task, pending work, and completed checkpoints without hiding the chat transcript.
248
+
249
+ Experimental file analysis allows `inspect_document` to read supported files outside the workspace after per-path approval when the user provides an absolute path. With Gemini-Wrapper's managed Python bridge, PatchPilot sends PNG/JPEG/WebP/GIF/HEIC images to Gemini Web as file inputs for visual analysis and text extraction. PDFs and DOCX files use local text extraction first, then fall back to Gemini-Wrapper only when local extraction cannot produce useful text. Image OCR remains explicit through `mode:"ocr"`/`mode:"local"`. Experimental memory stores durable workspace notes in `~/.patchpilot/memory.sqlite`; `memory_remember` requires write approval and `memory_search` is read-only. Experimental shell-metacharacters allow `run_shell` to use pipes, `&&`, and `;`; redirects, shell expansion, background jobs, OR chains, and multiline commands still require explicit approval even in build+bypass.
250
+
201
251
  ## Providers
202
252
 
203
253
  | Provider route | Accepted values | Default model | Best for | Setup |
@@ -205,6 +255,7 @@ The transcript and sidebar have internal scroll areas. With an empty prompt, use
205
255
  | Ollama local | `ollama` | `qwen2.5-coder:7b` | Private local coding work and offline experiments. | Install Ollama, pull a model, run `patchpilot`. |
206
256
  | Ollama remote | `ollama` with `--ollama-url` or `/connect` | Host model inventory | Laptop editing with a stronger desktop/server GPU. | Expose Ollama on the host, then use `/connect` or `--ollama-url`. |
207
257
  | Google Gemini | `gemini`, `google` | `gemini-2.5-flash` | Fast cloud inference through a Gemini API key. | Store `GEMINI_API_KEY` in `~/.patchpilot/.env` or use onboarding. |
258
+ | Gemini-Wrapper | `gemini-wrapper`, `geminiwrapper` | `auto` | Advanced, unofficial opt-in bridge to the pinned `gemini_webapi` Python wrapper, with optional HTTP-wrapper mode. | Read [docs/gemini-wrapper.md](docs/gemini-wrapper.md), use onboarding to paste `__Secure-1PSID`, then run `/doctor fix` to approve the pinned managed bridge install. PatchPilot creates `~/.patchpilot/gemini-cookies.json`, exposes `auto`, `flash-lite`, `flash`, and `pro` shortcuts, asks the WebAPI for real available model descriptors, and never scans browser cookies. |
208
259
  | OpenRouter | `openrouter`, `open-router` | `openrouter/auto` | Broad model routing, auto model selection, and free variants. | Store `OPENROUTER_API_KEY` in `~/.patchpilot/.env` or use onboarding. |
209
260
  | NVIDIA | `nvidia`, `nim` | `meta/llama-3.1-70b-instruct` | NVIDIA NIM OpenAI-compatible endpoints. | Store `NVIDIA_API_KEY` in `~/.patchpilot/.env` or use onboarding. |
210
261
  | Codex CLI | `codex`, `openai`, `openai-codex` | `gpt-5.5` | Using an existing Codex CLI OAuth login. | Run `codex login`, then `patchpilot --provider codex`. |
@@ -214,6 +265,10 @@ Examples:
214
265
  ```bash
215
266
  patchpilot --provider ollama --model qwen2.5-coder:7b
216
267
  patchpilot --provider gemini --model gemini-2.5-flash
268
+ patchpilot --provider gemini-wrapper --model auto
269
+ patchpilot --provider gemini-wrapper --model flash-lite
270
+ patchpilot --provider gemini-wrapper --model flash
271
+ patchpilot --provider gemini-wrapper --model pro
217
272
  patchpilot --provider openrouter --model openrouter/auto
218
273
  patchpilot --provider nvidia --model meta/llama-3.1-70b-instruct
219
274
  patchpilot --provider codex --model gpt-5.5
@@ -227,6 +282,7 @@ Provider diagnostics:
227
282
  ```bash
228
283
  patchpilot doctor --provider ollama
229
284
  patchpilot doctor --provider gemini
285
+ patchpilot doctor --provider gemini-wrapper
230
286
  patchpilot doctor --provider openrouter
231
287
  patchpilot doctor --provider nvidia
232
288
  patchpilot doctor --provider codex
@@ -236,7 +292,33 @@ PatchPilot caches model discovery for a short TTL inside the running TUI, so nor
236
292
 
237
293
  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`.
238
294
 
239
- Reasoning support is provider and model dependent. Codex accepts fixed reasoning levels. OpenRouter receives `reasoning.effort` only for models whose metadata advertises reasoning support. 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.
295
+ Reasoning support is provider and model dependent. Codex accepts fixed reasoning levels. OpenRouter receives `reasoning.effort` only for models whose metadata advertises reasoning support. Gemini uses Thinking configuration where the selected model exposes it; some Gemini models cannot disable thinking. Gemini-Wrapper exposes Gemini Web model shortcuts through live `gemini_webapi` discovery: `flash-lite`, `flash`, and `pro` resolve to the currently listed Web model IDs, while `thinking` remains a legacy compatibility alias only. The wrapper does not expose Gemini Web Denkaufwand as a stable `/reasoning` control yet. Ollama only receives native `think` values for known thinking model families. NVIDIA reasoning effort is limited to supported GPT-OSS NIM routes.
296
+
297
+ Gemini-Wrapper is intentionally explicit and unofficial. In default `python` bridge mode, PatchPilot creates a managed Python venv and installs the pinned wrapper there only after `/doctor fix` or `patchpilot doctor --fix` approval:
298
+
299
+ > [!CAUTION]
300
+ > `__Secure-1PSID` acts like a Google session token. Never paste it into issues, logs, chats, or commits.
301
+
302
+ ```sh
303
+ ~/.patchpilot/gemini-wrapper-venv
304
+ ```
305
+
306
+ This avoids Homebrew Python's externally-managed-environment / PEP 668 block. Then PatchPilot runs the bridge command itself for model discovery and chat requests. Use `/onboarding`, choose Gemini-Wrapper, paste `__Secure-1PSID`, and optionally paste `__Secure-1PSIDTS`. PatchPilot writes `~/.patchpilot/gemini-cookies.json` with owner-only permissions and stores the file path in `~/.patchpilot/.env`.
307
+
308
+ ```sh
309
+ PATCHPILOT_PROVIDER=gemini-wrapper
310
+ PATCHPILOT_MODEL=auto
311
+ PATCHPILOT_GEMINI_WRAPPER_MODE=python
312
+ PATCHPILOT_GEMINI_WRAPPER_COOKIES_JSON=/Users/you/.patchpilot/gemini-cookies.json
313
+ PATCHPILOT_GEMINI_WRAPPER_MIN_INTERVAL_MS=1500
314
+ PATCHPILOT_GEMINI_WRAPPER_TIMEOUT_MS=180000
315
+ ```
316
+
317
+ The cookie JSON must contain `__Secure-1PSID`; `__Secure-1PSIDTS` is optional for some accounts. If the optional timestamp expires, PatchPilot retries once without it. Transient WebAPI network timeouts are retried inside the bridge. `auto` lets Gemini Web pick its default model and avoids relying on brittle Web model headers. `flash-lite`, `flash`, and `pro` are PatchPilot shortcuts resolved from live Gemini Web model descriptors; `thinking` is kept only for legacy sessions. In Python bridge mode, `inspect_document` passes supported files through `gemini_webapi` so Gemini Web can analyze screenshots, images, PDFs, and DOCX files directly. Env alternatives are `GEMINI_SECURE_1PSID` and `GEMINI_SECURE_1PSIDTS`. See [docs/gemini-wrapper.md](docs/gemini-wrapper.md) for the exact setup steps.
318
+
319
+ PatchPilot also sets `GEMINI_COOKIE_PATH` to `~/.patchpilot/gemini-webapi-cache` for the Python process so refreshed wrapper cookies stay in a local owner-only cache instead of a temporary directory.
320
+
321
+ PatchPilot does not inspect Chrome, Safari, Firefox, Arc, Edge, Brave, Keychain, or browser cookie stores, and it does not reuse Google web-login sessions automatically. Advanced users can still set `PATCHPILOT_GEMINI_WRAPPER_MODE=http` plus `PATCHPILOT_GEMINI_WRAPPER_BASE_URL` for an explicit OpenAI-compatible `/v1` endpoint.
240
322
 
241
323
  OpenRouter `:free` models are rate-limited by OpenRouter. PatchPilot warns when a selected model ID ends in `:free`, and OpenRouter credit or rate-limit failures are surfaced as explicit provider errors.
242
324
 
@@ -244,6 +326,8 @@ OpenRouter `:free` models are rate-limited by OpenRouter. PatchPilot warns when
244
326
 
245
327
  PatchPilot can run the TUI and workspace tools on one machine while sending model requests to Ollama on another machine. This is useful when your desktop has the GPU and your laptop is where you edit code.
246
328
 
329
+ The guided setup can choose between `This Device` and `Remote Host`. Remote host setup checks LAN and Tailscale candidates first, then fetches the selected host's models before prompting for a model.
330
+
247
331
  Inside PatchPilot:
248
332
 
249
333
  ```text
@@ -253,6 +337,8 @@ Inside PatchPilot:
253
337
  /connect local
254
338
  ```
255
339
 
340
+ If both machines are on the same Tailscale tailnet, PatchPilot also checks Tailscale peers and MagicDNS names during `/connect` and the startup host flow. A host can be selected by Tailscale IP, MagicDNS name, or full URL.
341
+
256
342
  From the shell:
257
343
 
258
344
  ```bash
@@ -266,7 +352,7 @@ On a Windows desktop or remote host, expose Ollama on your private network:
266
352
  3. Start Ollama again.
267
353
  4. Allow inbound TCP traffic on port `11434` only on trusted private networks.
268
354
 
269
- PatchPilot verifies candidates with Ollama's `/api/version` endpoint before listing them. It does not move file reads, writes, Git, or test commands to the remote host; only model requests are routed there.
355
+ PatchPilot verifies candidates with Ollama's `/api/version` endpoint before listing them. When connected, the header/sidebar switch to the selected host's device name, route, version, and model inventory instead of showing the client machine as the compute target. It does not move file reads, writes, Git, or test commands to the remote host; only model requests are routed there.
270
356
 
271
357
  For smaller local machines, reduce the request budget before starting PatchPilot:
272
358
 
@@ -282,7 +368,7 @@ PatchPilot is designed to keep powerful actions boring and reviewable:
282
368
  - Secret-like files such as `.env`, `.envrc`, `.npmrc`, `.netrc`, SSH keys, PEM/key/cert bundles, and credential files are blocked from normal file tools.
283
369
  - Writes are blocked by default; in the TUI, risky write tools request approval, and `--apply` keeps the legacy always-allow write path.
284
370
  - Shell commands are blocked by default; dedicated script/test tools request approval and show the package script body before running. `--allow-shell` keeps the legacy always-allow shell path.
285
- - Shell execution uses a restricted single-command runner.
371
+ - Shell execution uses a restricted runner. Pipes are supported; `&&` and `;` require `/experimental shell-metacharacters`, and higher-risk shell syntax remains approval-gated even in build+bypass.
286
372
  - Provider config is stored in `~/.patchpilot/.env`, not in the current repository by default.
287
373
  - 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`.
288
374
  - Tool output is shown in the transcript and fed back into the agent in clipped form.
@@ -313,7 +399,7 @@ PatchPilot now has sticky approval prompts and a Git diff command, but it still
313
399
  | TUI | Ink, React, ink-text-input |
314
400
  | Agent protocol | JSON command envelope validated with Zod |
315
401
  | Sessions | Append-only JSONL in `.patchpilot/sessions` plus global index in `~/.patchpilot` |
316
- | Providers | Ollama chat API, Gemini generateContent API, OpenRouter OpenAI-compatible API, NVIDIA OpenAI-compatible API, Codex CLI OAuth backend |
402
+ | Providers | Ollama chat API, Gemini generateContent API, Gemini-Wrapper OpenAI-compatible API, OpenRouter OpenAI-compatible API, NVIDIA OpenAI-compatible API, Codex CLI OAuth backend |
317
403
  | Tests | Vitest |
318
404
  | CI | GitHub Actions |
319
405
 
@@ -355,6 +441,10 @@ Release notes are kept in [docs/releases](docs/releases).
355
441
 
356
442
  | Version | Notes |
357
443
  |---|---|
444
+ | `v1.2.0` | [Release notes](docs/releases/v1.2.0.md) |
445
+ | `v1.1.0` | [Release notes](docs/releases/v1.1.0.md) |
446
+ | `v1.0.1` | [Release notes](docs/releases/v1.0.1.md) |
447
+ | `v1.0.0` | [Release notes](docs/releases/v1.0.0.md) |
358
448
  | `v0.4.0` | [Release notes](docs/releases/v0.4.0.md) |
359
449
  | `v0.3.1-beta` | [Release notes](docs/releases/v0.3.1-beta.md) |
360
450
  | `v0.3.0` | [Release notes](docs/releases/v0.3.0.md) |
@@ -364,7 +454,7 @@ Release notes are kept in [docs/releases](docs/releases).
364
454
 
365
455
  ## Security and Legal
366
456
 
367
- PatchPilot can read files, write files, and run shell commands when you enable those capabilities. Use it only in repositories and environments you trust.
457
+ PatchPilot can read files, write files, and run shell commands when you enable those capabilities. Use it only in repositories and environments you trust. You use PatchPilot at your own risk; the maintainer accepts no liability for actions you approve, bypass, or run from generated output.
368
458
 
369
459
  - Security policy: see [SECURITY.md](SECURITY.md).
370
460
  - Security reports: please use GitHub Security Advisories or contact the maintainer privately with reproduction steps and impact.
package/SECURITY.md CHANGED
@@ -6,7 +6,11 @@ PatchPilot is public preview software. Security fixes target the latest publishe
6
6
 
7
7
  ## Reporting a Vulnerability
8
8
 
9
- Please report security issues through GitHub Security Advisories when available, or contact the maintainer privately with:
9
+ Please report security issues through GitHub Security Advisories:
10
+
11
+ https://github.com/jx-grxf/PatchPilot/security/advisories/new
12
+
13
+ Include:
10
14
 
11
15
  - affected version or commit
12
16
  - reproduction steps
@@ -20,3 +24,5 @@ Do not open a public issue for a vulnerability before the maintainer has had tim
20
24
  PatchPilot keeps file tools inside one workspace root, blocks common secret files and credential-like extensions, and requires approval or explicit trusted bypass for writes and shell commands. Package-script approvals include the resolved script body because scripts can hide publish, push, or destructive commands.
21
25
 
22
26
  Session logs are stored in `.patchpilot/sessions/` under the workspace and summarized in `~/.patchpilot/session-index.json`. Treat those logs as local project metadata: they may contain prompts, tool names, summaries, and clipped command output. Do not use cloud providers or trusted bypass in repositories containing secrets you do not want processed by external model providers.
27
+
28
+ Gemini-Wrapper support runs either the installed `gemini_webapi` Python package with an explicit cookie source or an explicit OpenAI-compatible URL from `PATCHPILOT_GEMINI_WRAPPER_BASE_URL`. PatchPilot must not scan browser profiles, cookies, Keychain items, or Google web-login sessions for provider auth.
package/dist/cli.js CHANGED
@@ -5,11 +5,14 @@ import { readFileSync } from "node:fs";
5
5
  import { render } from "ink";
6
6
  import { Command } from "commander";
7
7
  import { defaultCodexModel } from "./core/codex.js";
8
- import { loadPatchPilotEnv } from "./core/env.js";
8
+ import { cleanupPatchPilot, readCleanupTarget } from "./core/cleanup.js";
9
+ import { loadPatchPilotEnv, savePatchPilotEnvValues } from "./core/env.js";
9
10
  import { defaultGeminiModel } from "./core/gemini.js";
11
+ import { defaultGeminiWrapperModel, importGeminiWrapperBrowserCookies } from "./core/geminiWrapper.js";
10
12
  import { normalizeModelProvider, readModelProvider } from "./core/modelClient.js";
11
13
  import { defaultNvidiaModel } from "./core/nvidia.js";
12
14
  import { runDoctor } from "./core/doctor.js";
15
+ import { ensurePatchPilotInstructions } from "./core/projectInit.js";
13
16
  import { defaultOllamaModel, resolveOllamaBaseUrl } from "./core/ollama.js";
14
17
  import { defaultOpenRouterModel } from "./core/openrouter.js";
15
18
  import { listIndexedSessions, listWorkspaceSessions, loadSessionSummary } from "./core/session.js";
@@ -20,35 +23,97 @@ const defaultProvider = readModelProvider();
20
23
  const defaultModel = process.env.PATCHPILOT_MODEL ??
21
24
  (defaultProvider === "gemini"
22
25
  ? defaultGeminiModel
23
- : defaultProvider === "openrouter"
24
- ? defaultOpenRouterModel
25
- : defaultProvider === "nvidia"
26
- ? defaultNvidiaModel
27
- : defaultProvider === "codex"
28
- ? defaultCodexModel
29
- : defaultOllamaModel);
26
+ : defaultProvider === "gemini-wrapper"
27
+ ? defaultGeminiWrapperModel
28
+ : defaultProvider === "openrouter"
29
+ ? defaultOpenRouterModel
30
+ : defaultProvider === "nvidia"
31
+ ? defaultNvidiaModel
32
+ : defaultProvider === "codex"
33
+ ? defaultCodexModel
34
+ : defaultOllamaModel);
35
+ // Onboarding persists the chosen first-run agent mode; bypass implies the
36
+ // always-allow write/shell defaults so the next launch starts where the user
37
+ // left off. plan and build keep the per-action approval flow.
38
+ const defaultMode = process.env.PATCHPILOT_DEFAULT_MODE?.trim().toLowerCase();
39
+ const defaultBypass = defaultMode === "bypass";
30
40
  const program = new Command();
31
41
  program.enablePositionalOptions();
32
42
  program
33
43
  .name("patchpilot")
34
44
  .description("Local-first coding agent TUI powered by Ollama and OpenAI-compatible providers.")
35
45
  .version(readPackageVersion());
46
+ program
47
+ .command("init")
48
+ .description("Create PATCHPILOT.md workspace instructions.")
49
+ .option("--workspace <path>", "Workspace root", process.cwd())
50
+ .action(async (options) => {
51
+ const result = await ensurePatchPilotInstructions(path.resolve(options.workspace));
52
+ console.log(`${result.created ? "created" : "exists"} ${result.path}`);
53
+ });
54
+ program
55
+ .command("cleanup")
56
+ .description("Clean PatchPilot workspace cache, sessions, temp files, or all.")
57
+ .argument("[target]", "cache, sessions, temp, or all", "cache")
58
+ .option("--workspace <path>", "Workspace root", process.cwd())
59
+ .action(async (target, options) => {
60
+ const cleanupTarget = readCleanupTarget(target);
61
+ if (!cleanupTarget) {
62
+ console.error("Use one of: cache, sessions, temp, all");
63
+ process.exitCode = 1;
64
+ return;
65
+ }
66
+ const removed = await cleanupPatchPilot(path.resolve(options.workspace), cleanupTarget);
67
+ console.log(`cleaned ${removed.join(", ") || cleanupTarget}`);
68
+ });
36
69
  program
37
70
  .command("doctor")
38
71
  .description("Check local PatchPilot requirements.")
39
- .option("--provider <name>", "Model provider: ollama, gemini, openrouter, nvidia, or codex.", defaultProvider)
72
+ .option("--provider <name>", "Model provider: ollama, gemini, gemini-wrapper, openrouter, nvidia, or codex.", defaultProvider)
40
73
  .option("--check-url <url>", "Ollama base URL to verify", defaultOllamaUrl)
41
74
  .option("--ollama-url <url>", "Alias for --check-url.")
42
75
  .option("--check-model <name>", "Model name to verify", defaultModel)
43
76
  .option("--model <name>", "Alias for --check-model.")
77
+ .option("--fix", "Apply safe doctor fixes, such as installing the managed Gemini-API bridge.", false)
44
78
  .action(async (options) => {
45
- const results = await runDoctor(normalizeModelProvider(options.provider), options.ollamaUrl ?? options.checkUrl, options.model ?? options.checkModel);
79
+ const results = await runDoctor(normalizeModelProvider(options.provider), options.ollamaUrl ?? options.checkUrl, options.model ?? options.checkModel, {
80
+ fix: Boolean(options.fix)
81
+ });
46
82
  for (const result of results) {
47
83
  const marker = result.ok ? "ok" : "fail";
48
- console.log(`${marker.padEnd(5)} ${result.name}: ${result.details}`);
84
+ const action = result.action ? ` ${result.action}` : "";
85
+ console.log(`${marker.padEnd(5)} ${result.name}${action}: ${result.details}`);
49
86
  }
50
87
  process.exitCode = results.every((result) => result.ok) ? 0 : 1;
51
88
  });
89
+ const geminiWrapperCommand = program
90
+ .command("gemini-wrapper")
91
+ .description("Manage the local Gemini-Wrapper Python bridge.");
92
+ geminiWrapperCommand
93
+ .command("import-cookies")
94
+ .description("Explicitly import Gemini Web cookies from a local supported browser.")
95
+ .action(async () => {
96
+ try {
97
+ const result = await importGeminiWrapperBrowserCookies();
98
+ process.env.PATCHPILOT_PROVIDER = "gemini-wrapper";
99
+ process.env.PATCHPILOT_MODEL = defaultGeminiWrapperModel;
100
+ process.env.PATCHPILOT_GEMINI_WRAPPER_MODE = "python";
101
+ process.env.PATCHPILOT_GEMINI_WRAPPER_COOKIES_JSON = result.cookiesPath;
102
+ savePatchPilotEnvValues({
103
+ PATCHPILOT_PROVIDER: "gemini-wrapper",
104
+ PATCHPILOT_MODEL: defaultGeminiWrapperModel,
105
+ PATCHPILOT_GEMINI_WRAPPER_MODE: "python",
106
+ PATCHPILOT_GEMINI_WRAPPER_COOKIES_JSON: result.cookiesPath
107
+ });
108
+ console.log(`imported ${result.cookieCount} Gemini browser cookies from ${result.source}`);
109
+ console.log(`saved ${result.cookiesPath}`);
110
+ console.log(`__Secure-1PSIDTS ${result.hasSecure1psidts ? "present" : "missing; bridge will try refresh fallback"}`);
111
+ }
112
+ catch (error) {
113
+ console.error(error instanceof Error ? error.message : String(error));
114
+ process.exitCode = 1;
115
+ }
116
+ });
52
117
  program
53
118
  .command("sessions")
54
119
  .description("List recent PatchPilot sessions.")
@@ -86,19 +151,30 @@ program
86
151
  program
87
152
  .argument("[task...]", "Task for the local coding agent.")
88
153
  .option("--workspace <path>", "Workspace root", process.cwd())
89
- .option("--provider <name>", "Model provider: ollama, gemini, openrouter, nvidia, or codex.", defaultProvider)
154
+ .option("--provider <name>", "Model provider: ollama, gemini, gemini-wrapper, openrouter, nvidia, or codex.", defaultProvider)
90
155
  .option("--model <name>", "Model name", defaultModel)
91
156
  .option("--ollama-url <url>", "Ollama base URL", defaultOllamaUrl)
92
157
  .option("--steps <count>", "Maximum agent steps", "8")
93
- .option("--thinking <mode>", "Thinking budget mode: fixed or adaptive.", process.env.PATCHPILOT_THINKING_MODE ?? "fixed")
158
+ .option("--thinking <mode>", "Thinking budget mode: fixed or adaptive.", process.env.PATCHPILOT_THINKING_MODE ?? "adaptive")
94
159
  .option("--reasoning <effort>", "Provider reasoning effort: none, low, medium, high, xhigh, or adaptive.", process.env.PATCHPILOT_REASONING_EFFORT ?? "medium")
95
160
  .option("--apply", "Allow file writes inside the workspace.", false)
96
161
  .option("--allow-shell", "Allow shell commands inside the workspace.", false)
162
+ .option("--subagents", "Enable planner and reviewer subagents.", readBooleanEnv(process.env.PATCHPILOT_SUBAGENTS, false))
97
163
  .option("--no-subagents", "Disable planner and reviewer subagents for faster local runs.")
164
+ .addHelpText("after", [
165
+ "",
166
+ "Examples:",
167
+ " $ patchpilot",
168
+ " $ patchpilot \"summarize this repo and list the safest next fixes\"",
169
+ " $ patchpilot --provider codex --model gpt-5.5 --workspace .",
170
+ " $ patchpilot --provider gemini-wrapper --model auto",
171
+ "",
172
+ "First-run setup opens automatically. Reopen it anytime with /onboarding."
173
+ ].join("\n"))
98
174
  .action((taskParts, options) => {
99
175
  const workspace = path.resolve(String(options.workspace));
100
176
  const maxSteps = Number.parseInt(String(options.steps), 10);
101
- render(_jsx(App, { initialTask: taskParts.join(" ").trim() || undefined, provider: readModelProvider({ PATCHPILOT_PROVIDER: String(options.provider) }), model: String(options.model), ollamaUrl: String(options.ollamaUrl), workspace: workspace, allowWrite: Boolean(options.apply), allowShell: Boolean(options.allowShell), maxSteps: Number.isFinite(maxSteps) ? maxSteps : 8, thinkingMode: String(options.thinking) === "adaptive" ? "adaptive" : "fixed", reasoningEffort: readReasoningEffort(String(options.reasoning)), subagents: options.subagents !== false }));
177
+ render(_jsx(App, { initialTask: taskParts.join(" ").trim() || undefined, provider: readModelProvider({ PATCHPILOT_PROVIDER: String(options.provider) }), model: String(options.model), ollamaUrl: String(options.ollamaUrl), workspace: workspace, packageVersion: readPackageVersion(), allowWrite: Boolean(options.apply), allowShell: Boolean(options.allowShell), maxSteps: Number.isFinite(maxSteps) ? maxSteps : 8, thinkingMode: String(options.thinking) === "adaptive" ? "adaptive" : "fixed", reasoningEffort: readReasoningEffort(String(options.reasoning)), subagents: Boolean(options.subagents) }));
102
178
  });
103
179
  await program.parseAsync(process.argv);
104
180
  function readReasoningEffort(value) {
@@ -108,6 +184,19 @@ function readReasoningEffort(value) {
108
184
  ? value
109
185
  : "medium";
110
186
  }
187
+ function readBooleanEnv(value, fallback) {
188
+ if (!value) {
189
+ return fallback;
190
+ }
191
+ const normalized = value.trim().toLowerCase();
192
+ if (["1", "true", "yes", "on"].includes(normalized)) {
193
+ return true;
194
+ }
195
+ if (["0", "false", "no", "off"].includes(normalized)) {
196
+ return false;
197
+ }
198
+ return fallback;
199
+ }
111
200
  function readPackageVersion() {
112
201
  try {
113
202
  const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.tsx"],"names":[],"mappings":";;AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YA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