Skip to content

Commit 7f3af11

Browse files
committed
Merge remote-tracking branch 'origin/main' into HEAD
2 parents a72c93e + 4facdb3 commit 7f3af11

50 files changed

Lines changed: 3908 additions & 382 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/rust-ci.yml‎

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ jobs:
229229
windows-foreground:
230230
name: Windows foreground command cleanup
231231
runs-on: windows-latest
232-
timeout-minutes: 20
232+
timeout-minutes: 30
233233
steps:
234234
- uses: actions/checkout@v5
235235
with:
@@ -268,6 +268,19 @@ jobs:
268268
cargo test -p claurst --locked --test workspace_policy_unavailable | tee "$RUNNER_TEMP/workspace-policy-unavailable-tests.txt"
269269
grep -E 'test result: ok\. [1-9][0-9]* passed' "$RUNNER_TEMP/workspace-policy-unavailable-tests.txt"
270270
271+
# coven-code must exit when its run is complete while a process that a
272+
# background command started still holds the command's output pipes
273+
# (#535). On Windows the runtime reads those pipes on its blocking pool.
274+
# This step runs even if an earlier step failed, and requires both
275+
# tests to pass; a test added to the file needs the count raised.
276+
- name: Test that coven-code exits while a background command's descendant runs
277+
if: ${{ !cancelled() }}
278+
working-directory: src-rust
279+
shell: bash
280+
run: |
281+
cargo test -p claurst --locked --test exit_with_background_task | tee "$RUNNER_TEMP/exit-with-background-task-tests.txt"
282+
grep -E 'test result: ok\. 2 passed' "$RUNNER_TEMP/exit-with-background-task-tests.txt"
283+
271284
# The Job Object module is Windows-only, so its unit tests run only here.
272285
# A filter that matches nothing passes, so require at least one test.
273286
- name: Test the Job Object resume decision
@@ -294,17 +307,30 @@ jobs:
294307
done
295308
296309
# cmd.exe must get a command's double quotes exactly as written (#517).
297-
# Each of these five crates hands a command line to cmd.exe and has a
298-
# test file for it. This step runs even if an earlier step failed, tries
299-
# every crate, and requires tests from each.
310+
# Each of these six crates hands a command line to cmd.exe and has a
311+
# test file for it; claurst-mcp's opens a URL with `start`. This step
312+
# runs even if an earlier step failed, tries every crate, and requires
313+
# tests from each.
300314
- name: Test that cmd.exe gets a command's quotes as written
301315
if: ${{ !cancelled() }}
302316
working-directory: src-rust
303317
shell: bash
304318
run: |
305319
failed=0
306-
for package in claurst-core claurst-plugins claurst-tools claurst-query claurst-commands; do
320+
for package in claurst-core claurst-plugins claurst-tools claurst-query claurst-commands claurst-mcp; do
307321
cargo test -p "$package" --locked --test windows_cmd_quotes | tee "$RUNNER_TEMP/$package-cmd-quotes.txt" || failed=1
308322
grep -E 'test result: ok\. [1-9][0-9]* passed' "$RUNNER_TEMP/$package-cmd-quotes.txt" || failed=1
309323
done
310324
exit "$failed"
325+
326+
# The terminal opens the keybindings file with `cmd.exe /C start`, which
327+
# must get the file's path whole (#517). The test is in the terminal
328+
# crate's unit tests, so it runs here by module. This step runs even if
329+
# an earlier step failed, and requires at least one passed test.
330+
- name: Test that the terminal opens a file by its whole path
331+
if: ${{ !cancelled() }}
332+
working-directory: src-rust
333+
shell: bash
334+
run: |
335+
cargo test -p claurst-tui --locked --lib app::windows_open_tests | tee "$RUNNER_TEMP/tui-windows-open-tests.txt"
336+
grep -E 'test result: ok\. [1-9][0-9]* passed' "$RUNNER_TEMP/tui-windows-open-tests.txt"

‎.github/workflows/windows-installer-tests.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- install.ps1
77
- scripts/test_install_powershell.py
88
- scripts/install-ps1-rollback.test.ps1
9+
- scripts/install-ps1-consent.test.ps1
910
- scripts/install-ps1-download.test.ps1
1011
- .github/workflows/windows-installer-tests.yml
1112
push:
@@ -14,8 +15,10 @@ on:
1415
- install.ps1
1516
- scripts/test_install_powershell.py
1617
- scripts/install-ps1-rollback.test.ps1
18+
- scripts/install-ps1-consent.test.ps1
1719
- scripts/install-ps1-download.test.ps1
1820
- .github/workflows/windows-installer-tests.yml
21+
workflow_dispatch:
1922

2023
permissions:
2124
contents: read

‎docs/configuration.md‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,26 @@ loaded. Changing the saved mode with the `Config` tool needs the same approval
386386
as any other write; a session in `bypassPermissions` gives it without asking.
387387
The settings screen never saves the session's mode.
388388

389-
Two limits to know about:
389+
`/config import` reloads your engine-global settings into the open session
390+
under the same rule. A mode chosen at launch (`--permission-mode` or
391+
`--dangerously-skip-permissions`) stays. Otherwise a saved `acceptEdits` or
392+
`plan` applies, as at a start, even over a mode chosen in the session (a
393+
saved `acceptEdits` replaces a session's `plan`). A saved `default` or
394+
`bypassPermissions` leaves the session's mode as it is, so the reload never
395+
moves it to `default` or to bypass. A notification says when the mode changed
396+
or a saved bypass was not restored.
397+
398+
`coven-code acp` takes no `--permission-mode` and reads no setting or variable
399+
that opts in to bypass. It loads the mode saved in engine-global settings: a
400+
saved `acceptEdits` applies, `plan` runs as `default` (ACP has no interactive
401+
plan approval), and a saved `bypassPermissions` is never restored. ACP then
402+
runs in `default` and logs `Saved bypass mode not restored` to stderr (at the
403+
default `COVEN_CODE_ACP_LOG` level); the protocol stream is unchanged. The
404+
mode decides which tool calls ask the connected client, and reaches the
405+
keyless `claude` transport and the PowerShell risk gate.
406+
407+
One limit to know about:
390408

391-
- `coven-code acp` takes no `--permission-mode` and is not covered by the list
392-
above: it loads the mode saved in engine-global settings, including a saved
393-
`bypassPermissions`, with `plan` treated as `default`. Its tool approvals
394-
still go to the connected client; the saved mode reaches the keyless
395-
`claude` transport and the PowerShell risk gate.
396409
- An engine-global `default` cannot be told apart from no saved mode, so it
397410
does not override an `acceptEdits`, `plan` or `bypassPermissions` in the
398411
shared file: `/config set permission-mode default` reports success and the
@@ -605,7 +618,8 @@ and `api_base` override the corresponding environment variables.
605618
| `COVEN_CODE_PROVIDER` | Active provider. Equivalent to `--provider`. |
606619
| `COVEN_CODE_API_BASE` | Override the API base URL for the active provider. Equivalent to `--api-base`. |
607620
| `COVEN_CODE_GOALS` | Set to `0` to disable the goal system (`/coven goal` command and `GoalCompleteTool`). |
608-
| `COVEN_CODE_DISABLE_UPDATE_CHECK` | Set to skip the release check an interactive session makes at startup: a request to GitHub's releases API unless a result from the last 24 hours is cached, and the update notice that follows. The variable only has to be present, so `0` or an empty value also disables the check; unset it to restore the default. `/update` and `coven-code upgrade` still contact GitHub when you run them. The model catalog refresh at startup is separate: see `COVEN_CODE_DISABLE_MODELS_FETCH` in [providers.md](providers.md). |
621+
| `COVEN_CODE_DISABLE_UPDATE_CHECK` | Set to skip the release check an interactive session makes at startup: a request to GitHub's releases API unless a result from the last 24 hours is cached, and the update notice that follows. The variable only has to be present, so `0` or an empty value also disables the check; unset it to restore the default. `/update` and `coven-code upgrade` still contact GitHub when you run them. The model catalog refresh at startup is separate: see `COVEN_CODE_DISABLE_MODELS_FETCH` in [providers.md](providers.md). `COVEN_CODE_DISABLE_NONESSENTIAL_TRAFFIC` turns off both. |
622+
| `COVEN_CODE_DISABLE_NONESSENTIAL_TRAFFIC` | Set to turn off the startup release check (as `COVEN_CODE_DISABLE_UPDATE_CHECK` does) and the model catalog refresh from models.dev (as `COVEN_CODE_DISABLE_MODELS_FETCH` does, so `coven-code models --refresh` fetches nothing either). These are the two requests this build makes without being asked. Like the other two variables, it only has to be present, so `0` or an empty value counts. Other requests still run: model turns, MCP servers you configured, web tools, `/update` and `coven-code upgrade`. It does not reach the `claude` program that Claude turns run through when no API key is set; that program has its own settings. |
609623
| `COVEN_CODE_BRIDGE_URL` | Enable the remote-control bridge by setting the server URL. |
610624
| `COVEN_CODE_BRIDGE_TOKEN` | Bearer token for the remote-control bridge. |
611625
| `RUST_LOG` | Tracing filter (e.g. `debug`, `claurst_core=trace`). |

‎docs/installation.md‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,31 @@ The shell installer does not remove macOS quarantine attributes automatically.
8080
| `--binary <path>` | `-Binary <path>` | Install an already verified local binary |
8181
| `--install-dir <path>` | `-InstallDir <path>` | Override the install directory |
8282
| Not supported | `-NoModifyPath` | Leave the Windows user PATH unchanged |
83+
| `--force` | `-Force` | Replace an existing engine that differs from this one without asking |
8384
| `--help` | `-Help` | Print usage |
8485

86+
An installer replaces an existing `coven-code` in the install directory only
87+
with consent. It installs without asking when the existing file has the same
88+
bytes as the new one, or when a download is for the version the existing engine
89+
reports as `coven-code <version>`. Otherwise it asks `Replace it? [y/N]` if its
90+
input is a terminal, and replaces the engine only on `y` or `yes`;
91+
`irm ... | iex` in a console asks, `curl ... | bash` never does. With no
92+
terminal, as under `curl ... | bash` or in CI, it leaves the existing engine and
93+
alias untouched and fails: the shell installer exits non-zero, and the
94+
PowerShell installer throws. Upgrading an older standalone install with a piped
95+
one-liner therefore needs consent without a prompt: `--force` (`-Force`), or
96+
`COVEN_CODE_INSTALL_FORCE=1` (exactly `1`) in the environment:
97+
98+
```bash
99+
curl -fsSL https://github.com/OpenCoven/coven-code/releases/latest/download/install.sh | bash -s -- --force
100+
```
101+
102+
```powershell
103+
$env:COVEN_CODE_INSTALL_FORCE = '1'; try { irm https://github.com/OpenCoven/coven-code/releases/latest/download/install.ps1 | iex } finally { Remove-Item Env:COVEN_CODE_INSTALL_FORCE }
104+
```
105+
106+
The check covers `coven-code`, not the `coven-cave` alias beside it.
107+
85108
The local-binary path does not authenticate the file for you. Verify its origin
86109
and digest before installing it. The shell installer may still resolve the
87110
latest release if no `--version` is supplied, even with `--binary`.

‎docs/providers.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ On startup the registry refreshes itself from [models.dev](https://models.dev) i
176176

177177
| Variable | Effect |
178178
|---|---|
179-
| `COVEN_CODE_DISABLE_MODELS_FETCH=1` | Skip the network refresh; use only the bundled snapshot + disk cache |
179+
| `COVEN_CODE_DISABLE_MODELS_FETCH=1` | Skip the network refresh; use only the bundled snapshot + disk cache. `COVEN_CODE_DISABLE_NONESSENTIAL_TRAFFIC` does the same, and also turns off the startup release check ([configuration.md](configuration.md#environment-variables)) |
180180
| `COVEN_CODE_MODELS_URL` / `MODELS_DEV_URL` | Override the models.dev catalog URL |
181181
| `COVEN_CODE_ENABLE_EXPERIMENTAL_MODELS=1` | Include experimental/preview models in the picker |
182182

‎index.html‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ <h1 class="hero-title fade-in d-1">Agentic coding for builders who ship.</h1>
602602
<button class="cmd-copy" id="cmd-copy-btn" title="Copy to clipboard">
603603
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
604604
</button>
605-
<span class="cmd-comment" id="cmd-comment-text"># macOS. One-liner installer.</span>
605+
<span class="cmd-comment" id="cmd-comment-text"># macOS. One-liner installer. To replace an existing install that differs, end it with: bash -s -- --force</span>
606606
<div class="cmd-line">
607607
<span class="cmd-prompt">$</span>
608608
<span class="cmd-code" id="cmd-code-text">curl -fsSL https://github.com/OpenCoven/coven-code/releases/latest/download/install.sh | bash</span>
@@ -636,23 +636,23 @@ <h1 class="hero-title fade-in d-1">Agentic coding for builders who ship.</h1>
636636
// x86_64 vs aarch64) so each OS only needs one one-liner.
637637
const commands = {
638638
'mac-arm': {
639-
comment: '# macOS. One-liner installer.',
639+
comment: '# macOS. One-liner installer. To replace an existing install that differs, end it with: bash -s -- --force',
640640
code: 'curl -fsSL https://github.com/OpenCoven/coven-code/releases/latest/download/install.sh | bash'
641641
},
642642
'mac-intel': {
643-
comment: '# macOS. One-liner installer.',
643+
comment: '# macOS. One-liner installer. To replace an existing install that differs, end it with: bash -s -- --force',
644644
code: 'curl -fsSL https://github.com/OpenCoven/coven-code/releases/latest/download/install.sh | bash'
645645
},
646646
'linux-x64': {
647-
comment: '# Linux. One-liner installer.',
647+
comment: '# Linux. One-liner installer. To replace an existing install that differs, end it with: bash -s -- --force',
648648
code: 'curl -fsSL https://github.com/OpenCoven/coven-code/releases/latest/download/install.sh | bash'
649649
},
650650
'linux-arm': {
651-
comment: '# Linux. One-liner installer.',
651+
comment: '# Linux. One-liner installer. To replace an existing install that differs, end it with: bash -s -- --force',
652652
code: 'curl -fsSL https://github.com/OpenCoven/coven-code/releases/latest/download/install.sh | bash'
653653
},
654654
'windows': {
655-
comment: '# Windows (PowerShell). One-liner installer.',
655+
comment: '# Windows (PowerShell). One-liner installer. To replace an existing install that differs, set COVEN_CODE_INSTALL_FORCE=1 first.',
656656
code: 'irm https://github.com/OpenCoven/coven-code/releases/latest/download/install.ps1 | iex'
657657
},
658658
'npm': {

‎install.ps1‎

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ param(
1313
[string]$Binary = "",
1414
[string]$InstallDir = "",
1515
[switch]$NoModifyPath,
16+
[switch]$Force,
1617
[switch]$Help
1718
)
1819

@@ -141,11 +142,14 @@ Options:
141142
-Binary <path> Install from a local binary instead of downloading
142143
-InstallDir <path> Override install location (default: %USERPROFILE%\.coven-code\bin)
143144
-NoModifyPath Don't add the install dir to user PATH
145+
-Force Replace an existing coven-code that differs from this one
146+
without asking (or set COVEN_CODE_INSTALL_FORCE=1)
144147
145148
Examples:
146149
irm https://github.com/OpenCoven/coven-code/releases/latest/download/install.ps1 | iex
147150
.\install.ps1 -Version 0.1.0
148151
.\install.ps1 -Binary C:\path\to\coven-code.exe
152+
$env:COVEN_CODE_INSTALL_FORCE = '1'; try { irm https://github.com/OpenCoven/coven-code/releases/latest/download/install.ps1 | iex } finally { Remove-Item Env:COVEN_CODE_INSTALL_FORCE }
149153
"@
150154
}
151155

@@ -186,21 +190,27 @@ function Resolve-Version {
186190
}
187191

188192
# ----- Already-installed check -----
189-
function Check-Existing($desiredVersion) {
190-
$existing = Get-Command coven-code -ErrorAction SilentlyContinue
191-
if ($null -eq $existing) { return }
193+
# The version an engine reports as 'coven-code <version>', or 'unknown'.
194+
function Get-EngineVersion([string]$Path) {
192195
try {
193-
$vline = (& coven-code --version) 2>&1 | Select-Object -First 1
194-
$installed = ($vline -split '\s+')[-1]
196+
$vline = [string]($null | & $Path --version 2>&1 | Select-Object -First 1)
195197
} catch {
196-
$installed = 'unknown'
198+
return 'unknown'
197199
}
200+
if ($vline.Trim() -cmatch '^coven-code\s+v?(\S+)$') { return $Matches[1] }
201+
return 'unknown'
202+
}
203+
204+
function Check-Existing($desiredVersion) {
205+
$existing = Get-Command coven-code -ErrorAction SilentlyContinue
206+
if ($null -eq $existing) { return }
207+
$installed = Get-EngineVersion 'coven-code'
198208
if ($installed -eq $desiredVersion) {
199209
Write-Muted "Version $desiredVersion already installed at $($existing.Source)"
200210
Write-Muted "Use -Version to install a different one."
201211
exit 0
202212
}
203-
Write-Muted "Found existing coven-code at $($existing.Source) (v$installed) - upgrading to v$desiredVersion"
213+
Write-Muted "Found existing coven-code at $($existing.Source) (v$installed) - installing v$desiredVersion"
204214
}
205215

206216
# ----- Download & extract -----
@@ -261,9 +271,9 @@ function Download-And-Install($desiredVersion, $arch, $Boundaries = $null) {
261271

262272
try {
263273
if ($null -eq $Boundaries) {
264-
Install-Binary $extractedExe
274+
Install-Binary $extractedExe $desiredVersion
265275
} else {
266-
& $Boundaries.Install $extractedExe
276+
& $Boundaries.Install $extractedExe $desiredVersion
267277
}
268278
} finally {
269279
Remove-Item -Recurse -Force $tmpRoot -ErrorAction SilentlyContinue
@@ -287,9 +297,33 @@ function Install-FromBinary {
287297
}
288298
}
289299

290-
function Install-Binary($source) {
300+
# Replacing an engine that differs from the one being installed needs the
301+
# user's consent (#369): -Force, COVEN_CODE_INSTALL_FORCE=1, or a yes at the
302+
# prompt. The same bytes, or a download of the version the existing engine
303+
# reports, need none.
304+
function Confirm-Replace([string]$Source, [string]$Target, [string]$DesiredVersion) {
305+
if ($Force -or $env:COVEN_CODE_INSTALL_FORCE -eq '1') { return }
306+
if (-not (Test-Path -LiteralPath $Target -PathType Leaf)) { return }
307+
$new = (Get-FileHash -LiteralPath $Source -Algorithm SHA256).Hash
308+
if ($new -eq (Get-FileHash -LiteralPath $Target -Algorithm SHA256).Hash) { return }
309+
$installed = Get-EngineVersion $Target
310+
if (-not [string]::IsNullOrEmpty($DesiredVersion) -and $installed -eq $DesiredVersion) { return }
311+
$incoming = if ([string]::IsNullOrEmpty($DesiredVersion)) { 'the local binary' } else { "v$DesiredVersion" }
312+
$found = if ($installed -eq 'unknown') { 'version unknown' } else { "v$installed" }
313+
Write-Warn "$Target is a different coven-code ($found) from the one being installed ($incoming)."
314+
if ([Environment]::UserInteractive -and -not [Console]::IsInputRedirected) {
315+
# Read-Host fails under -NonInteractive; that is a no.
316+
try { $reply = Read-Host 'Replace it? [y/N]' } catch { $reply = '' }
317+
if ($reply -match '^(y|yes)$') { return }
318+
}
319+
Write-Err "Left the existing coven-code in place. To replace it, rerun with -Force, or set COVEN_CODE_INSTALL_FORCE=1 (with irm: `$env:COVEN_CODE_INSTALL_FORCE = '1' first)."
320+
throw "Existing coven-code at $Target was not replaced"
321+
}
322+
323+
function Install-Binary($source, $desiredVersion = '') {
291324
$target = Join-Path $InstallDir 'coven-code.exe'
292325
$aliasTarget = Join-Path $InstallDir 'coven-cave.exe'
326+
Confirm-Replace $source $target $desiredVersion
293327
# `coven.exe` belongs to the Coven daemon CLI (@opencoven/cli); older
294328
# installers shipped it as an alias, so clean it up on upgrade.
295329
$staleShort = Join-Path $InstallDir 'coven.exe'

0 commit comments

Comments
 (0)