one-code-extension 0.3.0 → 0.4.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 (119) hide show
  1. package/README.md +189 -94
  2. package/docs/guide/README.md +3 -2
  3. package/docs/guide/bring-your-claude-code-setup.md +7 -5
  4. package/docs/guide/configuration.md +7 -5
  5. package/docs/guide/differences-from-claude-code.md +25 -14
  6. package/docs/guide/doctor.md +5 -3
  7. package/docs/guide/hooks.md +20 -6
  8. package/docs/guide/installation.md +62 -12
  9. package/docs/guide/permissions-modes-and-auto-mode.md +46 -28
  10. package/docs/guide/providers-and-models.md +12 -10
  11. package/docs/guide/reference.md +9 -4
  12. package/docs/guide/sessions-and-context.md +23 -3
  13. package/docs/guide/skills-plugins-and-mcp.md +7 -5
  14. package/docs/guide/subagents-and-workflows.md +13 -11
  15. package/docs/guide/tasks-and-background-work.md +10 -8
  16. package/docs/guide/terminal-interface.md +7 -5
  17. package/docs/guide/tools.md +29 -5
  18. package/docs/guide/troubleshooting.md +26 -14
  19. package/docs/guide/windows.md +184 -0
  20. package/extensions/auto-mode/actions.ts +3 -1
  21. package/extensions/auto-mode/paths.ts +21 -23
  22. package/extensions/auto-mode/safety-floor.ts +44 -6
  23. package/extensions/auto-mode/shell-analysis.ts +25 -10
  24. package/extensions/auto-mode/transcript.ts +15 -5
  25. package/extensions/background/index.ts +83 -34
  26. package/extensions/background/monitor-batch.ts +7 -5
  27. package/extensions/background/wakeup.ts +18 -24
  28. package/extensions/bash/background.ts +19 -10
  29. package/extensions/bash/guards.ts +36 -16
  30. package/extensions/bash/index.ts +36 -166
  31. package/extensions/branding/index.ts +35 -4
  32. package/extensions/btw/index.ts +207 -0
  33. package/extensions/btw/panel.ts +179 -0
  34. package/extensions/btw/prompt.ts +45 -0
  35. package/extensions/clear/index.ts +15 -0
  36. package/extensions/compaction/fit.ts +9 -6
  37. package/extensions/doctor/build.ts +22 -2
  38. package/extensions/doctor/dependencies.ts +63 -31
  39. package/extensions/doctor/fix-prompt.ts +12 -4
  40. package/extensions/doctor/index.ts +1 -0
  41. package/extensions/doctor/models.ts +2 -1
  42. package/extensions/doctor/report.ts +2 -3
  43. package/extensions/doctor/update-lookup.ts +19 -11
  44. package/extensions/effort/index.ts +2 -1
  45. package/extensions/footer/footer-line.ts +19 -0
  46. package/extensions/footer/index.ts +25 -5
  47. package/extensions/hooks/executor.ts +84 -18
  48. package/extensions/hooks/index.ts +1 -0
  49. package/extensions/hooks/matcher.ts +23 -9
  50. package/extensions/hooks/settings.ts +15 -0
  51. package/extensions/lib/branch-restore.ts +12 -0
  52. package/extensions/lib/claude-context.ts +2 -3
  53. package/extensions/lib/claude-settings.ts +19 -0
  54. package/extensions/lib/command-launch.ts +71 -0
  55. package/extensions/lib/deferred.ts +173 -33
  56. package/extensions/lib/git.ts +16 -0
  57. package/extensions/lib/keys.ts +38 -0
  58. package/extensions/lib/local-command.ts +112 -0
  59. package/extensions/lib/model-facts.generated.json +263 -68
  60. package/extensions/lib/model-policy.ts +13 -0
  61. package/extensions/lib/model-tier.ts +16 -5
  62. package/extensions/lib/notifications.ts +547 -53
  63. package/extensions/lib/paths.ts +130 -2
  64. package/extensions/lib/pi-ai-estimate.ts +57 -26
  65. package/extensions/lib/pi-version.ts +1 -1
  66. package/extensions/lib/process-tree.ts +131 -5
  67. package/extensions/lib/reminders.ts +80 -27
  68. package/extensions/lib/scratchpad.ts +11 -10
  69. package/extensions/lib/shell-spawn.ts +298 -0
  70. package/extensions/lib/shell-tool.ts +252 -0
  71. package/extensions/lib/shell-tools.ts +13 -0
  72. package/extensions/lib/side-call.ts +76 -0
  73. package/extensions/lib/tui-render.ts +62 -11
  74. package/extensions/lib/update-check.mjs +155 -0
  75. package/extensions/lib/usage-bus.ts +1 -1
  76. package/extensions/lib/which.ts +62 -0
  77. package/extensions/lib/worktree-channel.ts +18 -0
  78. package/extensions/lib/worktree-isolation.ts +2 -1
  79. package/extensions/lsp/client.ts +14 -3
  80. package/extensions/lsp/index.ts +12 -5
  81. package/extensions/lsp/install-hints.ts +33 -3
  82. package/extensions/lsp/plugin-servers.ts +2 -2
  83. package/extensions/lsp/servers.ts +29 -7
  84. package/extensions/mcp/index.ts +3 -2
  85. package/extensions/memory/entries.ts +9 -6
  86. package/extensions/memory/index.ts +3 -2
  87. package/extensions/memory/open-external.ts +4 -1
  88. package/extensions/model-default/index.ts +21 -2
  89. package/extensions/permissions/index.ts +57 -28
  90. package/extensions/permissions/matcher.ts +120 -33
  91. package/extensions/permissions/modes.ts +14 -6
  92. package/extensions/permissions/powershell-rules.ts +549 -0
  93. package/extensions/permissions/session-grant.ts +9 -9
  94. package/extensions/plugins/index.ts +3 -2
  95. package/extensions/plugins/install/install.ts +1 -1
  96. package/extensions/powershell/description.ts +139 -0
  97. package/extensions/powershell/guards.ts +91 -0
  98. package/extensions/powershell/index.ts +89 -0
  99. package/extensions/powershell/policy.ts +91 -0
  100. package/extensions/recap/index.ts +10 -24
  101. package/extensions/recap/prompt.ts +3 -3
  102. package/extensions/session-title/index.ts +120 -0
  103. package/extensions/session-title/title.ts +111 -0
  104. package/extensions/skill/index.ts +40 -18
  105. package/extensions/skill/invoke.ts +1 -0
  106. package/extensions/subagents/hand-back-review.ts +10 -12
  107. package/extensions/subagents/index.ts +221 -78
  108. package/extensions/subagents/model-select.ts +75 -7
  109. package/extensions/system-prompt/environment.ts +14 -1
  110. package/extensions/system-reminder/index.ts +9 -0
  111. package/extensions/tasks/index.ts +2 -1
  112. package/extensions/tool-search/index.ts +41 -20
  113. package/extensions/workflow/agent-session.ts +6 -4
  114. package/extensions/workflow/index.ts +28 -5
  115. package/extensions/worktree/guards.ts +5 -4
  116. package/extensions/worktree/index.ts +15 -2
  117. package/extensions/worktree/rewrite.ts +17 -0
  118. package/package.json +7 -4
  119. package/types/app.d.ts +18 -2
@@ -1,5 +1,7 @@
1
1
  # Skills, plugins, and MCP
2
2
 
3
+ [← One Code user guide](README.md)
4
+
3
5
  One Code runs Agent Skills, Claude Code plugins, and MCP servers from your
4
6
  existing configuration. This page covers using each and the panels that
5
7
  manage them.
@@ -23,7 +25,7 @@ command, as in Claude Code: `/simplify`, `/code-review`, or any skill from
23
25
  arguments. Plugin skills keep their plugin prefix and are run as
24
26
  `/skill:<plugin>:<name>`. pi's `/skill:<name>` form works for every skill.
25
27
 
26
- A skill's slash command is not created when the name is already taken by a
28
+ A skill's slash command isn't created when the name is already taken by a
27
29
  built-in command, a `.claude/commands/` template, or another skill.
28
30
 
29
31
  ### Manage skills
@@ -57,7 +59,7 @@ A skill of the same name in your own `.claude/skills/` takes precedence.
57
59
  ### Skills not bundled
58
60
 
59
61
  The bundle omits the Claude Code skills that depend on services One Code
60
- does not have:
62
+ doesn't have:
61
63
 
62
64
  | Group | Skills omitted |
63
65
  |---|---|
@@ -113,7 +115,7 @@ servers, agents, and hooks load on the next session, and the panel says so
113
115
  when you close it.
114
116
 
115
117
  Marketplace sources are git repositories and local paths. Version pinning,
116
- npm or pip sources, and dependency resolution are not implemented.
118
+ npm or pip sources, and dependency resolution aren't implemented.
117
119
 
118
120
  ## MCP servers
119
121
 
@@ -144,7 +146,7 @@ appears as disabled in `/mcp`; choosing Enable there approves it.
144
146
  Claude Code's `enabledMcpjsonServers`, `disabledMcpjsonServers`, and
145
147
  `enableAllProjectMcpServers` settings are honored from
146
148
  `~/.claude/settings.json`, and from `.claude/settings.local.json` when that
147
- file is not tracked by git. They are never honored from a checked-in
149
+ file isn't tracked by git. They are never honored from a checked-in
148
150
  `.claude/settings.json`, which would let a repository approve its own
149
151
  servers.
150
152
 
@@ -154,7 +156,7 @@ stderr.
154
156
  ### Use MCP tools
155
157
 
156
158
  Each server's tools appear to the model as `mcp__<server>__<tool>` and load
157
- on demand, so a server with many tools does not bloat the prompt. Servers
159
+ on demand, so a server with many tools doesn't bloat the prompt. Servers
158
160
  also expose resources, which the model can list and read.
159
161
 
160
162
  A permission rule naming `mcp__<server>` covers every tool of that server.
@@ -1,5 +1,7 @@
1
1
  # Subagents and workflows
2
2
 
3
+ [← One Code user guide](README.md)
4
+
3
5
  One Code delegates work in two ways: subagents for tasks that deserve their
4
6
  own context window, and `ultracode` workflows for fanning a large job out
5
7
  across many agents at once.
@@ -33,7 +35,7 @@ the `explore` agent". What happens next:
33
35
  - **The run starts in the background.** The model receives a task id at
34
36
  once and keeps working. The subagent's report arrives as a notification
35
37
  when it finishes, mid-turn if the model is still busy, or as a new turn
36
- if it is idle. In a `-p` or `--mode json` run, the subagent runs to
38
+ if it's idle. In a `-p` or `--mode json` run, the subagent runs to
37
39
  completion instead and the report is returned inline.
38
40
  - **You can keep talking to the model** while agents run.
39
41
  - **Subagents go through your permission gate.** A subagent's tool calls
@@ -47,14 +49,14 @@ the `explore` agent". What happens next:
47
49
  Two options change how a subagent runs:
48
50
 
49
51
  - **Fork.** A forked subagent inherits the whole conversation so far, for a
50
- task that needs everything you have built up. Forks run on the main
52
+ task that needs everything you've built up. Forks run on the main
51
53
  model and can only be started from the main conversation. Depth is
52
54
  limited: the main conversation can start a subagent, and that subagent
53
55
  one more, but no further.
54
56
  - **Worktree isolation.** The subagent gets its own git worktree, branched
55
57
  from `HEAD`, so it can edit files without colliding with your working
56
58
  tree or other agents. A worktree the agent left unchanged is removed;
57
- otherwise it is kept and its path reported.
59
+ otherwise it's kept and its path reported.
58
60
 
59
61
  ### Choose the subagent model
60
62
 
@@ -90,7 +92,7 @@ agent.
90
92
  ### Follow agents live
91
93
 
92
94
  While agents run, the panel below the editor shows a tree: `main` first,
93
- then each agent with its type, what it is doing right now ("Reading
95
+ then each agent with its type, what it's doing right now ("Reading
94
96
  src/index.ts", "Running a command"), its elapsed time, and its token count.
95
97
  Nested agents appear under their parent. A finished agent stays for a few
96
98
  seconds.
@@ -125,23 +127,23 @@ JavaScript script that fans the work out across many agents in parallel,
125
127
  then runs it with the `workflow` tool.
126
128
 
127
129
  The keyword arms the turn it appears in. A message you queue while the
128
- model is still working does not arm the next turn. For a longer stretch of
130
+ model is still working doesn't arm the next turn. For a longer stretch of
129
131
  this kind of work, turn the mode on with `/effort ultracode`: it sets the
130
132
  reasoning effort to `xhigh` and keeps workflow orchestration armed until
131
- you change the effort again. The footer shows `✦ ultracode` while it is
133
+ you change the effort again. The footer shows `✦ ultracode` while it's
132
134
  armed.
133
135
 
134
136
  ### How a workflow runs
135
137
 
136
- - The script runs in a separate thread, so a runaway script cannot freeze
138
+ - The script runs in a separate thread, so a runaway script can't freeze
137
139
  the interface. A script that stops making progress is stopped after a
138
140
  few seconds; a run is capped at 30 minutes.
139
141
  - The run goes to the background and the model gets a run id. Progress
140
142
  shows in a strip below the editor (**↓** to focus it, **Enter** to open,
141
143
  **x** to stop) and in `/workflows`.
142
144
  - Every completed agent call is journaled. Re-running a workflow with
143
- `resumeFromRunId` replays the calls whose inputs did not change at no
144
- cost and runs only what differs. A background run does not survive the
145
+ `resumeFromRunId` replays the calls whose inputs didn't change at no
146
+ cost and runs only what differs. A background run doesn't survive the
145
147
  end of a session, but its journal does.
146
148
  - A script can carry an output-token target. Once the target is reached,
147
149
  new and queued agent calls stop; agents already running finish and can
@@ -183,11 +185,11 @@ the current run's script there.
183
185
  `/effort` sets how much reasoning the model spends: `off`, `minimal`,
184
186
  `low`, `medium`, `high`, `xhigh`, `max`, or `ultracode`. A bare `/effort`
185
187
  opens a slider (**←** and **→** or **h** and **l** move, **Enter** confirms).
186
- Levels the current model does not support are skipped. **shift+tab** cycles
188
+ Levels the current model doesn't support are skipped. **shift+tab** cycles
187
189
  the plain levels; cycling away from `xhigh` while ultracode is armed turns
188
190
  ultracode off.
189
191
 
190
192
  Changing the effort re-caches the conversation, so the next request costs
191
- more than usual. `/effort` does not save the level across restarts; to
193
+ more than usual. `/effort` doesn't save the level across restarts; to
192
194
  save one, open pi's `/thinking` picker and press **ctrl+s**, or pass
193
195
  `--thinking <level>` at launch.
@@ -1,5 +1,7 @@
1
1
  # Tasks and background work
2
2
 
3
+ [← One Code user guide](README.md)
4
+
3
5
  One Code keeps long-running work out of the model's way. This page covers
4
6
  the structured task list, background shells, monitors, scheduled
5
7
  wake-ups, and how the results of background work reach the model.
@@ -22,8 +24,8 @@ summary line and up to 12 tasks: `✔` for completed, `◼` for in progress,
22
24
  | `/tasks show` | Shows it again. |
23
25
 
24
26
  The list is stored inside the session, so it survives a resume and follows
25
- the branch you are on in `/tree`. If the model has not touched the list for
26
- a while during a long task, it is reminded that the list exists.
27
+ the branch you're on in `/tree`. If the model hasn't touched the list for
28
+ a while during a long task, it's reminded that the list exists.
27
29
 
28
30
  ## Background shells
29
31
 
@@ -55,14 +57,14 @@ session is told which ones.
55
57
  The `monitor` tool watches a long-running command, or a WebSocket URL, and
56
58
  turns each line of output (or each message) into an event. Events are
57
59
  batched and delivered to the model as notifications: at most once a second
58
- while the model is idle, once every ten seconds while it is working, so a
59
- noisy process does not flood the conversation.
60
+ while the model is idle, once every ten seconds while it's working, so a
61
+ noisy process doesn't flood the conversation.
60
62
 
61
63
  A monitor runs until its command exits or its timeout passes (five minutes
62
64
  by default, one hour at most), or for the whole session when started as
63
65
  persistent. The model can stop it with `task_stop`.
64
66
 
65
- A monitor is not auto-approved, because it runs a shell command; the
67
+ A monitor isn't auto-approved, because it runs a shell command; the
66
68
  permission gate treats it like `bash`.
67
69
 
68
70
  ## Scheduled wake-ups and loops
@@ -77,7 +79,7 @@ permission gate treats it like `bash`.
77
79
  - **Self-paced.** `/loop watch the CI run` with no interval lets the model
78
80
  choose when to check next. It uses the `schedule_wakeup` tool, which
79
81
  schedules one wake-up at a time between one minute and one hour ahead.
80
- The model is told to pick a delay that matches what it is waiting for,
82
+ The model is told to pick a delay that matches what it's waiting for,
81
83
  and to stop the loop when the task is done.
82
84
 
83
85
  `/loop status` (or a bare `/loop`) reports the current loop. `/loop stop`
@@ -100,7 +102,7 @@ Background work reports back through notifications:
100
102
  merged into one message.
101
103
  - After you interrupt a turn, notifications are held and attached to your
102
104
  next prompt instead of starting a turn on their own.
103
- - Each notification is framed as an automated event, so the model does not
105
+ - Each notification is framed as an automated event, so the model doesn't
104
106
  mistake it for something you said or approved.
105
107
 
106
108
  ## Non-interactive runs
@@ -108,4 +110,4 @@ Background work reports back through notifications:
108
110
  In `-p` and `--mode json` runs nothing can run in the background, because
109
111
  the process exits when the turn settles. Background shells, monitors,
110
112
  subagents, and workflows run to completion and return their output
111
- directly. `/loop` and `schedule_wakeup` do not fire.
113
+ directly. `/loop` and `schedule_wakeup` don't fire.
@@ -1,5 +1,7 @@
1
1
  # The terminal interface
2
2
 
3
+ [← One Code user guide](README.md)
4
+
3
5
  This page describes what you see on screen and how to move around it: the
4
6
  banner, the status line, the working indicator, the panels below the
5
7
  editor, the dialogs, and the themes.
@@ -14,7 +16,7 @@ hint line lists the keys worth knowing:
14
16
  |---|---|
15
17
  | `/hotkeys` | pi's full key list. |
16
18
  | `shift+tab` | Cycle reasoning effort. |
17
- | `ctrl+q` | Cycle the permission mode. |
19
+ | `ctrl+q` (`alt+m` on Windows and WSL) | Cycle the permission mode. |
18
20
  | `ctrl+t` | Show or hide thinking blocks. |
19
21
  | `ctrl+o` | Expand a collapsed tool output. |
20
22
  | `/` | List commands. |
@@ -70,8 +72,8 @@ Set `CC_FOOTER=0` to keep pi's footer.
70
72
  ## The panel below the editor
71
73
 
72
74
  One panel below the editor holds the background-shell manager and the
73
- live subagent tree. It appears when there is something to show and hides
74
- when there is not.
75
+ live subagent tree. It appears when there's something to show and hides
76
+ when there isn't.
75
77
 
76
78
  - Press **↓** from an empty editor to focus it. If background shells exist,
77
79
  the first **↓** lands on the shells chip; a second **↓** moves to the
@@ -85,7 +87,7 @@ when there is not.
85
87
  **Enter** closes the view.
86
88
 
87
89
  The panel's own footer names the keys that apply at each stage. Mouse-wheel
88
- scrolling is deliberately not enabled in the transcript view, because
90
+ scrolling deliberately isn't enabled in the transcript view, because
89
91
  turning on mouse reporting would take over the terminal's native scrolling
90
92
  and text selection for the whole session.
91
93
 
@@ -132,7 +134,7 @@ and [Plan mode](permissions-modes-and-auto-mode.md#plan-mode).
132
134
 
133
135
  **ctrl+c** closes any panel.
134
136
 
135
- PgUp and PgDn do not reach these panels in full-screen mode, because pi uses
137
+ PgUp and PgDn don't reach these panels in full-screen mode, because pi uses
136
138
  them for its own scrollback; use the keys the panel's footer names.
137
139
 
138
140
  ## Full-screen mode
@@ -1,6 +1,8 @@
1
1
  # Tools
2
2
 
3
- The model works by calling tools. You do not type tool names; you describe
3
+ [← One Code user guide](README.md)
4
+
5
+ The model works by calling tools. You don't type tool names; you describe
4
6
  the task and the model chooses. This page lists every tool One Code gives
5
7
  the model, what each does, what you see when it runs, and how Claude Code's
6
8
  tool names map onto them.
@@ -51,11 +53,20 @@ notification. A background shell shows up in the shells section of the
51
53
  panel below the editor. See
52
54
  [Tasks and background work](tasks-and-background-work.md).
53
55
 
56
+ `powershell` is Claude Code's PowerShell tool: on by default on Windows,
57
+ where it becomes the primary shell and `bash` (Git Bash) stays alongside
58
+ when Git for Windows is installed; off elsewhere unless
59
+ `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` and a `pwsh` is on your PATH. It has the
60
+ same `run_in_background`, the same background panel, and its description is
61
+ Claude Code's own, with the edition section (PowerShell 7 or Windows
62
+ PowerShell 5.1) picked from the executable found. Permission rules use
63
+ Claude Code's `PowerShell(...)` form. See [Windows](windows.md).
64
+
54
65
  Some command shapes are refused before they run, with a message that steers
55
66
  the model to a better route:
56
67
 
57
68
  - A foreground command that starts with `sleep`, or a polling loop that
58
- sleeps, when the wait is not provably short. The model is told to use
69
+ sleeps, when the wait isn't provably short. The model is told to use
59
70
  `run_in_background` or `monitor` instead.
60
71
  - A command that would orphan a process (`nohup`, `setsid`, or a trailing
61
72
  `&` with no `wait`).
@@ -131,17 +142,29 @@ deferred until needed. `list_mcp_resources`, `read_mcp_resource`, and
131
142
 
132
143
  `tool_search` loads deferred tools. The model passes exact names
133
144
  (`select:monitor,task_output`), a required term (`+notebook`), or free
134
- keywords. If the model calls a tool it has not loaded yet, the call fails
145
+ keywords. If the model calls a tool it hasn't loaded yet, the call fails
135
146
  and the model is steered to `tool_search`.
136
147
 
137
148
  ## Behavior in non-interactive runs
138
149
 
139
150
  In `-p` and `--mode json` runs the process exits when the turn settles, so
140
151
  nothing can run in the background. Tools that would detach work run to
141
- completion instead and return the output in their result: `bash` with
142
- `run_in_background`, `Agent`, `monitor`, and `workflow`. Timers such as
152
+ completion instead and return the output in their result: `bash` and
153
+ `powershell` with `run_in_background`, `Agent`, `monitor`, and `workflow`. Timers such as
143
154
  `schedule_wakeup` and `/loop` never fire in these modes.
144
155
 
156
+ Give a scripted run its own deadline. One Code has no idle timeout on a
157
+ provider response, so a stream that stalls mid-reply keeps the process
158
+ waiting indefinitely. Wrap the call in your script:
159
+
160
+ ```bash
161
+ timeout 180 onecode --mode json -p "…" </dev/null
162
+ ```
163
+
164
+ The `</dev/null` matters too: in `-p` mode piped standard input is read as
165
+ part of the prompt, so a run inside a shell script that reads its own body
166
+ from stdin would hand the rest of the script to the model.
167
+
145
168
  ## Claude Code tool names
146
169
 
147
170
  Claude Code's tool names are accepted in permission rules and hook
@@ -150,6 +173,7 @@ matchers, and mapped to One Code's names. Case is ignored.
150
173
  | Claude Code | One Code |
151
174
  |---|---|
152
175
  | `Bash` | `bash` |
176
+ | `PowerShell` | `powershell` |
153
177
  | `Read`, `Write`, `Edit` | `read`, `write`, `edit` |
154
178
  | `Grep`, `Glob`, `LS` | `grep`, `find`, `ls` |
155
179
  | `NotebookEdit` | `notebook_edit` |
@@ -1,5 +1,7 @@
1
1
  # Troubleshooting
2
2
 
3
+ [← One Code user guide](README.md)
4
+
3
5
  Symptoms you might hit, what causes them, and what to do.
4
6
 
5
7
  ## Start with the doctor
@@ -38,18 +40,18 @@ pins pi itself.
38
40
  pi it runs on are out of step. On the bundled app, reinstall it. On your own
39
41
  pi, run `pi update --extensions`.
40
42
 
41
- **The stock pi first-run wizard did not appear.** The bundled app seeds
43
+ **The stock pi first-run wizard didn't appear.** The bundled app seeds
42
44
  pi's settings with the One Code theme, quiet startup, and full-screen mode
43
- on first run, so there is nothing to ask.
45
+ on first run, so there's nothing to ask.
44
46
 
45
47
  ## Permissions
46
48
 
47
- **Auto mode is missing from the ctrl+q cycle.** Auto mode needs a model to
49
+ **Auto mode is missing from the mode cycle.** Auto mode needs a model to
48
50
  run its classifier. Connect a provider.
49
51
 
50
- **ctrl+q does something else.** On Windows and WSL, pi's default
51
- keybindings also bind ctrl+q, to queue a follow-up message. Rebind one of
52
- them in pi's keybindings file.
52
+ **ctrl+q queues a follow-up instead of changing the mode.** On Windows and
53
+ WSL that is pi's own binding for ctrl+q. The mode key there is alt+m; the
54
+ footer badge names it.
53
55
 
54
56
  **Everything prompts, even in auto mode.** Auto mode pauses after several
55
57
  blocked actions in a row and prompts you once; approving resumes it. Also
@@ -57,7 +59,7 @@ check `/permissions`: an `ask` rule prompts in every mode.
57
59
 
58
60
  **An allow rule I wrote has no effect in auto mode.** Broad execution rules
59
61
  (`Bash(*)`, wildcarded interpreters, delegation rules) are suspended in
60
- auto mode so they cannot bypass the classifier. Session grants from the
62
+ auto mode so they can't bypass the classifier. Session grants from the
61
63
  approval prompt are also ignored there. Narrow the rule or switch to
62
64
  accept-edits or manual mode.
63
65
 
@@ -66,7 +68,7 @@ may not select auto or bypass mode. Set it in `~/.claude/settings.json`
66
68
  or pass `--permission-mode auto`.
67
69
 
68
70
  **`defaultMode` in `~/.onecode/settings.json` does nothing.** The
69
- permission loader does not read that key from One Code's file. Use a Claude
71
+ permission loader doesn't read that key from One Code's file. Use a Claude
70
72
  Code settings file or the flag.
71
73
 
72
74
  **The model is denied a write to `.claude/settings.json`.** The auto-mode
@@ -80,12 +82,12 @@ allow rules, or use auto mode with a provider that can run the classifier.
80
82
  ## Auto-mode classifier
81
83
 
82
84
  **Actions are blocked with a message about the classifier being
83
- unavailable.** The classifier model could not be reached or returned
85
+ unavailable.** The classifier model couldn't be reached or returned
84
86
  nothing usable; the gate fails closed. Check `/auto-mode config` for the
85
87
  model in use, and `/doctor report` for provider credentials. Set
86
88
  `CC_AUTO_MODE_DEBUG=1` to see each verdict on stderr.
87
89
 
88
- **The classifier approves or blocks something it should not.** Choose a
90
+ **The classifier approves or blocks something it shouldn't.** Choose a
89
91
  stronger classifier with `/auto-mode model <provider/model-id>`. A
90
92
  Haiku-class classifier is a measurably weaker boundary than a Sonnet-class
91
93
  one.
@@ -122,7 +124,7 @@ to a rate-limited endpoint. Set `BRAVE_SEARCH_API_KEY` or
122
124
  `/doctor report` for install hints.
123
125
 
124
126
  **TypeScript diagnostics fail with a message about `lib/tsserver.js`.**
125
- TypeScript 7's native compiler does not ship that file, and
127
+ TypeScript 7's native compiler doesn't ship that file, and
126
128
  `typescript-language-server` needs it. Install a TypeScript 5.x development
127
129
  dependency in the project.
128
130
 
@@ -139,7 +141,7 @@ Authenticate. Tokens are stored under `~/.onecode/mcp-auth/`.
139
141
 
140
142
  ## Hooks
141
143
 
142
- **A project's hooks do not run.** They need one-time approval at startup.
144
+ **A project's hooks don't run.** They need one-time approval at startup.
143
145
  Restart the session and accept, or check
144
146
  `~/.onecode/hooks/project-approvals.json`.
145
147
 
@@ -152,10 +154,10 @@ Restart the session and accept, or check
152
154
  **My background shells are gone after `/clear`.** Background work ends
153
155
  with the session. The new session lists what was stopped.
154
156
 
155
- **A resumed session is in a different permission mode.** Modes are not
157
+ **A resumed session is in a different permission mode.** Modes aren't
156
158
  saved with the session. Pass `--permission-mode` or set a default.
157
159
 
158
- **The `/effort` level reset after a restart.** `/effort` does not save the
160
+ **The `/effort` level reset after a restart.** `/effort` doesn't save the
159
161
  level. Open pi's `/thinking` picker and press **ctrl+s** to save a startup
160
162
  default, or pass `--thinking <level>` at launch.
161
163
 
@@ -169,6 +171,16 @@ for its scrollback. Use the keys the panel's footer names (**Space** and
169
171
  `CC_FOOTER=0`, or the other toggles listed in
170
172
  [Environment variables](reference.md#environment-variables).
171
173
 
174
+ **On Windows the model has no shell tool, or the wrong one.** With Git for
175
+ Windows installed you get `bash` plus `powershell`; without it, `powershell`
176
+ alone. Set `CLAUDE_CODE_USE_POWERSHELL_TOOL=0` to hide the PowerShell tool
177
+ or `=1` to force it on (it also works on macOS and Linux with a `pwsh` on
178
+ PATH). A startup warning names a `CLAUDE_CODE_GIT_BASH_PATH` that was
179
+ ignored and why. If you report a Windows problem, include the shells on your
180
+ PATH (`where bash`, `where pwsh`, `where powershell`), the value of those two
181
+ variables, and whether the command came through `bash` or `powershell`.
182
+ See [Windows](windows.md).
183
+
172
184
  ## Getting help
173
185
 
174
186
  Report problems at the project's GitHub repository. Include the output of
@@ -0,0 +1,184 @@
1
+ # Windows
2
+
3
+ [← One Code user guide](README.md)
4
+
5
+ One Code on native Windows works the way Claude Code does today: Git for
6
+ Windows is optional, PowerShell is the primary shell tool when it is
7
+ enabled, and the Windows-specific pieces of your Claude Code configuration
8
+ keep working. This page says what that means in practice and what has and
9
+ hasn't been verified.
10
+
11
+ ## Install
12
+
13
+ ```powershell
14
+ powershell -c "irm https://raw.githubusercontent.com/IsuruMaduranga/one-code/master/install.ps1 | iex"
15
+ ```
16
+
17
+ This fetches Node.js when the machine has none and installs the app; with
18
+ Node.js 22.19 or later already present, `npm install -g @one-ai/one-code`
19
+ does the same. Details, and the script's knobs, are in
20
+ [Install on Windows](installation.md#install-on-windows). Git for Windows is
21
+ optional; the section below says what it adds.
22
+
23
+ ## Two shell tools
24
+
25
+ | Tool | When it is active | What runs it |
26
+ |---|---|---|
27
+ | `powershell` | On by default on Windows. Off elsewhere unless `CLAUDE_CODE_USE_POWERSHELL_TOOL=1`. | `pwsh.exe`, else `powershell.exe`, from your PATH. On macOS and Linux, a `pwsh` on PATH. |
28
+ | `bash` | Whenever a bash exists. | Git Bash (`Program Files\Git\bin\bash.exe`, then `bash.exe` on PATH), or the bash named by `CLAUDE_CODE_GIT_BASH_PATH`. |
29
+
30
+ When both are active, PowerShell is the primary shell: the system prompt says
31
+ so and the model reaches for it first, with bash alongside for POSIX scripts.
32
+ `CLAUDE_CODE_USE_POWERSHELL_TOOL=0` turns the PowerShell tool off and makes
33
+ bash primary again, which is the shape Claude Code had before 2.1.126.
34
+
35
+ A Windows machine with neither Git for Windows nor PowerShell has no shell
36
+ tool. One Code says so at startup, in Claude Code's words, and the fix is to
37
+ install one of them.
38
+
39
+ `CLAUDE_CODE_GIT_BASH_PATH` is read from your environment or from the `env`
40
+ block of `~/.claude/settings.json`. A value that isn't a `bash` or `sh`
41
+ binary is ignored with a warning, as Claude Code does since 2.1.219.
42
+
43
+ ## The PowerShell tool
44
+
45
+ The tool the model sees is Claude Code's PowerShell tool: same parameters
46
+ (`command`, `timeout` in milliseconds, `description`, `run_in_background`)
47
+ and Claude Code's own description text, including the edition section. One
48
+ Code picks that section from the executable it found: PowerShell 7 guidance
49
+ for `pwsh`, Windows PowerShell 5.1 guidance for `powershell.exe`. Under the
50
+ hood it is pi's `powershell` tool, run with `-NoProfile -NonInteractive
51
+ -ExecutionPolicy Bypass -Command`, output forced to UTF-8.
52
+
53
+ `run_in_background` works like bash's: a task id comes back at once, output
54
+ spools to the session directory, completion arrives as a notification, and
55
+ the shell shows up in the panel below the editor. A foreground command that
56
+ starts with `Start-Sleep` is refused with a pointer to background runs and
57
+ the monitor tool, and `Read-Host`, `Get-Credential`, `Out-GridView`, `pause`
58
+ and interactive git are refused because the shell has no console to prompt
59
+ on.
60
+
61
+ Inside a worktree session, every PowerShell command is prefixed with a
62
+ `Set-Location` into the worktree, the way bash commands get a `cd`.
63
+
64
+ ## Permission rules
65
+
66
+ `PowerShell(...)` rules use the same shape as `Bash(...)` rules and follow
67
+ Claude Code's PowerShell matching:
68
+
69
+ - Aliases are canonicalized on both sides, so `PowerShell(Remove-Item:*)`
70
+ catches `rm -Recurse build`, `del x`, and `ri y`, and
71
+ `PowerShell(Get-ChildItem:*)` allows `ls` and `dir`. Cmdlet names are
72
+ case-insensitive.
73
+ - A command line is split on `|`, `;`, `&&`, `||`, and newlines, outside
74
+ quotes and here-strings. An `allow` rule has to cover every statement; a
75
+ `deny` or `ask` rule fires on any statement, including inside a nested
76
+ `pwsh -Command '…'`.
77
+ - A line with a `$(…)` subexpression, a backtick escape, a script block, the
78
+ `&` or `.` call operators, `Invoke-Expression`, or an encoded command is
79
+ never covered by a wildcard or prefix allow rule. An exact rule for the
80
+ literal line still is.
81
+ - Unbalanced quoting is a parse failure: no allow rule applies and you are
82
+ asked.
83
+
84
+ Blanket rules (`PowerShell`, `PowerShell(*)`, `PowerShell(iex *)`,
85
+ `PowerShell(Start-Process *)`) are suspended in auto mode like their bash
86
+ counterparts. Hook matchers accept `PowerShell`, `Bash|PowerShell`, and
87
+ `Bash,PowerShell`.
88
+
89
+ ## Auto mode and plan mode
90
+
91
+ Claude Code's read-only cmdlets run without a prompt or a classifier call:
92
+ `Get-ChildItem`, `Get-Content`, `Get-Item`, `Test-Path`, `Resolve-Path`,
93
+ `Select-String`, `Get-Location`, `Get-Process`, `Get-Service`,
94
+ `Get-FileHash`, `Get-Acl`, `Format-Hex`, `findstr`, `where.exe`, plus
95
+ `Write-Output` and `Write-Host`. One Code adds the pure pipeline cmdlets
96
+ those are usually piped through, `Select-Object`, `Sort-Object`,
97
+ `Measure-Object`, `Group-Object`, `ConvertFrom-Json`, `Out-String` and the
98
+ `Format-*` family, so `Select-String … | Measure-Object` counts as read-only
99
+ too; `Where-Object` and `ForEach-Object` do not, because they take script
100
+ blocks. The check is textual and strict: no
101
+ redirection, no variables, no script blocks, and every path inside the
102
+ project or one of the harness's own session directories (auto-memory, the
103
+ scratchpad, persisted tool output, this project's transcripts). A relative
104
+ path is inside by construction; an absolute or drive-lettered path is
105
+ resolved and checked, so `Select-String -Path C:\src\app\notes.md` runs
106
+ unprompted while `Get-Content C:\Users\you\.ssh\id_rsa` does not. A UNC
107
+ path, `~`, a registry or environment drive, or `..` always takes the
108
+ ordinary route.
109
+
110
+ Everything else goes to the auto-mode classifier. One Code has no PowerShell
111
+ command parser yet, so unlike bash there is no deterministic shortcut for
112
+ in-project deletes: a `Remove-Item` inside the repository is classified, not
113
+ auto-approved. The safety floor still applies. Any PowerShell line that
114
+ names a permission settings file (`.claude/settings.json`,
115
+ `~/.onecode/settings.json`, `.claude.json`, managed settings) stops for you,
116
+ whether it reads or writes.
117
+
118
+ Plan mode allows the read-only cmdlets above and refuses the rest, as it
119
+ does for bash.
120
+
121
+ ## Hooks
122
+
123
+ Hooks run in bash where one exists and in PowerShell on a Windows machine
124
+ without Git for Windows. A hook can pick its interpreter with Claude Code's
125
+ `shell` field: `"shell": "powershell"` or `"shell": "bash"`. Timeouts kill
126
+ the whole process tree through `taskkill /T` on Windows. See
127
+ [Hooks](hooks.md#which-shell-runs-a-hook).
128
+
129
+ ## Keys
130
+
131
+ pi binds a few of its own shortcuts differently on Windows and WSL, where
132
+ alt+enter and ctrl+shift+letter do not reach the terminal reliably: queue a
133
+ follow-up is ctrl+q instead of alt+enter, fork is ctrl+f, paste is alt+v,
134
+ model selection is alt+p. Because ctrl+q is taken there, One Code cycles
135
+ permission modes with **alt+m** on Windows and WSL (ctrl+q everywhere
136
+ else). The footer badge, the startup hints, and `/doctor` name the key that
137
+ applies on your machine. Everything else in the [terminal reference](reference.md)
138
+ is the same.
139
+
140
+ ## Paths and state
141
+
142
+ - One Code's state lives in `%USERPROFILE%\.onecode`; Claude Code's
143
+ configuration is read from `%USERPROFILE%\.claude` (or
144
+ `CLAUDE_CONFIG_DIR`).
145
+ - The scratchpad directory is under `%TEMP%`.
146
+ - The `Shell:` line in the system prompt is the basename of `SHELL`, else
147
+ `COMSPEC`, with `.exe` stripped, the value Claude Code prints.
148
+ - Language servers installed with npm are `.cmd` shims on Windows
149
+ (`typescript-language-server.cmd`). One Code finds them on `PATH` and
150
+ starts them through `cmd.exe`, so a plugin's `.lsp.json` can name the
151
+ command the way it does elsewhere.
152
+ - Auto mode's shell pre-gate and the worktree guards understand Git Bash's
153
+ path spellings inside a command line: `/c/Users/…` is `C:\Users\…`, and
154
+ `/tmp/…` is your temp directory, which Git for Windows mounts there. A
155
+ path rule with a wildcard is spelled with forward slashes
156
+ (`Read(C:/notes/**)` or `Read(//c/notes/**)`), because a backslash before
157
+ `*` is the escape character.
158
+
159
+ ## What is verified
160
+
161
+ - The unit suite, including live PowerShell runs, passes on the
162
+ `windows-latest`, `macos-latest`, and `ubuntu-latest` GitHub runners.
163
+ - A real model drives both shell tools on the `windows-latest` runner: the
164
+ bash tool under Git Bash and the PowerShell tool under PowerShell 7, each
165
+ running a command whose output has to come back in the tool result. This
166
+ runs as its own workflow whenever the shell-facing code changes.
167
+ - Drive-letter, backslash, `C:/` and `~` paths in `Read(...)`/`Edit(...)`
168
+ rules, Windows PowerShell 5.1 (edition text, UTF-8 output, no `&&`),
169
+ stopping background PowerShell commands and timed-out hooks, and
170
+ npm-installed language servers all have Windows-only unit tests that run
171
+ on that runner.
172
+ - The PowerShell tool has also been driven through a real model with a
173
+ `pwsh` on macOS, the same way Claude Code's own PowerShell tool was
174
+ captured for reference.
175
+ - An interactive session on a Windows desktop (Windows Terminal, permission
176
+ prompts, plan mode) has not been checked by hand yet. If you hit something
177
+ there, [Troubleshooting](troubleshooting.md) says what to collect.
178
+
179
+ ## Not provided
180
+
181
+ - No PowerShell command parser or pre-gate beyond the read-only list.
182
+ - No sandbox on Windows. Claude Code has none there either.
183
+ - `defaultShell` for the user's own `!` prefix is pi's to handle; One Code
184
+ does not read it.
@@ -17,6 +17,8 @@
17
17
  * path auto mode exists to close.
18
18
  */
19
19
 
20
+ import type { HandBackVerdict } from "../lib/notifications.ts";
21
+
20
22
  export const SUBAGENT_ACTIONS_CHANNEL = "one-code:subagent-actions";
21
23
 
22
24
  export interface ChildAction {
@@ -45,7 +47,7 @@ export interface SubagentActionsPayload {
45
47
  * synchronously when no review will run, so the emitter never waits for
46
48
  * nothing.
47
49
  */
48
- onReview?: (flag: string | undefined) => void;
50
+ onReview?: (verdict: HandBackVerdict | undefined) => void;
49
51
  }
50
52
 
51
53
  /** Per-action and total caps: a long-running child must not blow up the prompt. */