Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
ae52238
docs(readme): document /new, zero upgrade, and add Discord link
PierrunoYT Jul 4, 2026
4448ff7
docs(update): escape pipe in --endpoint table cell
PierrunoYT Jul 4, 2026
1eccdb9
docs(readme-zh): bring /new and zero upgrade in line with README.md
PierrunoYT Jul 4, 2026
169c7c2
cli: add upgrade to root help output
PierrunoYT Jul 5, 2026
852ff18
Potential fix for pull request finding
PierrunoYT Jul 5, 2026
8c29600
docs: make required update flag explicit in common commands
PierrunoYT Jul 5, 2026
f475e22
docs: use a permanent (non-expiring) Discord invite in the READMEs
Vasanthdev2004 Jul 5, 2026
da69e2a
Merge remote-tracking branch 'upstream/main' into docs/readme-updates
PierrunoYT Jul 6, 2026
4b3f160
docs(cli): match upgrade help summary to download/verify/install wording
PierrunoYT Jul 6, 2026
66ccae0
docs: use discord.gg short link for the community invite
PierrunoYT Jul 6, 2026
54bb455
Merge remote-tracking branch 'upstream/main' into docs/readme-updates
PierrunoYT Jul 25, 2026
e63cc0a
fix(update,readme-zh): keep npm --json stdout clean, add ZH Discussio…
PierrunoYT Jul 26, 2026
e1371b7
Merge remote-tracking branch 'upstream/main' into docs/readme-updates
ampagent Jul 27, 2026
7013f91
docs(update): qualify npm-managed JSON output
ampagent Jul 27, 2026
7f23a7a
docs(update): align upgrade guidance
ampagent Jul 28, 2026
3b9aba5
fix(update): keep the upgrade recommendation about this machine
PierrunoYT Jul 28, 2026
649bc0f
fix(update): do not send a custom-source check to the default source
PierrunoYT Jul 29, 2026
023227f
fix(update): keep source guidance accurate
ampagent Jul 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-blue"></a>
<img alt="Go 1.26.5+" src="https://img.shields.io/badge/Go-1.26.5+-00ADD8?logo=go&logoColor=white">
<img alt="25+ providers" src="https://img.shields.io/badge/providers-25+-34E2EA">
<a href="https://discord.gg/CaQDS6wdFn"><img alt="Discord" src="https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white"></a>
<br>
<strong>English</strong> | <a href="README_ZH.md">中文</a>
</p>
Expand Down Expand Up @@ -205,6 +206,7 @@ Common slash commands:
| `/spec`, `/plan` | draft and review a plan before building |
| `/image` | attach an image for vision-capable models |
| `/resume`, `/rewind` | continue or roll back local sessions |
| `/new` | start a fresh session in place (previous session stays on disk) |
| `/btw [question]` | ask in an isolated fork without adding the side conversation to the main session |
| `/loop` | repeat a prompt or custom `/command` on an interval (`/loop 5m /babysit-prs`) or self-paced |
| `/compact`, `/context` | manage context usage |
Expand Down Expand Up @@ -301,7 +303,8 @@ zero verify detect and run local verification checks
zero changes inspect and commit local git changes
zero usage token usage and estimated cost
zero cron scheduled agent jobs
zero update check for newer releases
zero update --check check for newer releases
zero upgrade download, verify, and install the latest release
```

## Extending Zero
Expand Down Expand Up @@ -408,6 +411,8 @@ go run ./cmd/zero-release build --goos windows --goarch amd64 --output dist/zero

## Community

Real-time chat happens on the [Discord server](https://discord.gg/CaQDS6wdFn).

Questions, setup help, ideas, and sharing all live in
[GitHub Discussions](https://github.com/Gitlawb/zero/discussions):

Expand Down
19 changes: 18 additions & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-blue"></a>
<img alt="Go 1.26.5+" src="https://img.shields.io/badge/Go-1.26.5+-00ADD8?logo=go&logoColor=white">
<img alt="25+ providers" src="https://img.shields.io/badge/providers-25+-34E2EA">
<a href="https://discord.gg/CaQDS6wdFn"><img alt="Discord" src="https://img.shields.io/badge/Discord-join-5865F2?logo=discord&logoColor=white"></a>
<br>
<a href="README.md">English</a> | <strong>中文</strong>
</p>
Expand Down Expand Up @@ -141,6 +142,7 @@ zero
| `/spec`、`/plan` | 在构建之前起草和审查计划 |
| `/image` | 为视觉模型附加图片 |
| `/resume`、`/rewind` | 继续或回滚本地会话 |
| `/new` | 原地开始一个新会话(之前的会话仍保留在磁盘上) |
| `/compact`、`/context` | 管理上下文使用 |
| `/permissions`、`/tools` | 检查可用工具和策略 |
| `/add-dir` | 为此会话授予额外的写入目录 |
Expand Down Expand Up @@ -226,7 +228,8 @@ zero verify 检测和运行本地验证检查
zero changes 检查和提交本地 Git 变更
zero usage Token 使用量和估算成本
zero cron 定时智能体任务
zero update 检查更新版本
zero update --check 检查更新版本
zero upgrade 下载、验证并安装最新版本
```

## 外观和无障碍
Expand Down Expand Up @@ -269,6 +272,20 @@ go run ./cmd/zero-release build --goos windows --goarch amd64 --output dist/zero
- [性能](docs/PERFORMANCE.md)
- [智能体评估](docs/AGENT_EVALS.md)

## 社区

实时交流在 [Discord 服务器](https://discord.gg/CaQDS6wdFn) 进行。

提问、安装帮助、想法和分享都在
[GitHub Discussions](https://github.com/Gitlawb/zero/discussions):

| 分类 | 用途 |
|---|---|
| [Q&A](https://github.com/Gitlawb/zero/discussions/categories/q-a) | 安装帮助、提供商/模型配置、"如何做"类问题 |
| [Ideas](https://github.com/Gitlawb/zero/discussions/categories/ideas) | 功能提议和 PR 之前的设计讨论 |
| [Show and tell](https://github.com/Gitlawb/zero/discussions/categories/show-and-tell) | 你的技能、插件、MCP 配置、主题和工作流 |
| [Announcements](https://github.com/Gitlawb/zero/discussions/categories/announcements) | 维护者发布的版本和项目动态 |

## 贡献

欢迎贡献。阅读 [CONTRIBUTING.md](CONTRIBUTING.md),运行相关测试,然后提交一个聚焦的拉取请求。
Expand Down
5 changes: 3 additions & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,11 @@ directory.

## Updating

Check for a newer release:
Check for a newer release, then download, verify, and install it in place:

```bash
zero update --check
zero upgrade
```

Then reinstall with npm or rerun the install script for the version you want.
See the [update guide](UPDATE.md) for update modes, flags, and platform details.
42 changes: 35 additions & 7 deletions docs/UPDATE.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
# Update Flow

`zero update --check` checks the latest GitHub release and compares it with the
local CLI version.
local CLI version. `zero update --apply` (or its shorthand, `zero upgrade`)
downloads, verifies, and installs it.

```bash
zero update --check
zero update --check --json
zero update --check --repo Gitlawb/zero
zero update --check --target windows-x64

zero upgrade
zero update --apply
```

The command is intentionally check-only:
`--check` and `--apply` are mutually exclusive. `zero update` requires one of
them explicitly; `zero upgrade` is `zero update` with `--apply` implied.

`--check` is check-only:

- It does not replace the running binary.
- It exits with code `0` when the check succeeds, even when an update is
Expand All @@ -19,14 +26,35 @@ The command is intentionally check-only:
- `--json` prints the same result in a machine-readable format for scripts and
CI.

`--apply` installs the update in place:

- npm installs delegate to `npm install -g @gitlawb/zero@latest`.
- Standalone installs download the release archive, verify its checksum,
extract it, and atomically replace the running binary plus any installed
optional sandbox helpers.
- On Windows, the running executable is renamed aside and cleaned up on the
next `zero update --apply` or `zero upgrade`, since it can't be overwritten
while running.
- `--target` cannot be combined with `--apply`; it only applies to `--check`,
since applying always installs onto the current machine.
- `--repo` and `--endpoint` are ignored when applying to an npm-managed
install: that path delegates to `npm install -g @gitlawb/zero@latest` and
takes its release from the npm registry, not from GitHub. They still apply to
`--check` there.
- `--json` serializes Zero's final result. For npm-managed installs, npm may
also write progress output to stdout, so neither
`zero update --apply --json` nor `zero upgrade --json` is guaranteed to
produce a single parseable JSON document. Use `--check --json` for
machine-readable automation.

Useful flags:

| Flag | Purpose |
|---|---|
| `--repo <owner/repo>` | Check another GitHub repository. |
| `--endpoint <url|owner/repo>` | Check a specific release API URL or repository slug. |
| `--repo <owner/repo>` | Use another GitHub repository for `--check` and `--apply`/`upgrade`. Ignored by an npm-managed apply. |
| `--endpoint <url\|owner/repo>` | Use a specific release API URL or repository slug for `--check` and `--apply`/`upgrade`. Ignored by an npm-managed apply. |
| `--timeout <duration>` | Override the default release check timeout. |
| `--target <platform-arch>` | Validate release metadata for another supported target. |
| `--target <platform-arch>` | Validate release metadata for another supported target (`--check` only). |

Supported targets are `linux-x64`, `linux-arm64`, `macos-x64`, `macos-arm64`,
`windows-x64`, and `windows-arm64`. Without `--target`, Zero checks the current
Expand All @@ -40,5 +68,5 @@ Endpoint resolution order:
4. `https://api.github.com/repos/Gitlawb/zero/releases/latest`

Installer scripts download the matching release asset for the local platform and
verify its `.sha256` file. If Zero is already installed, run `zero update --check`
before reinstalling.
verify its `.sha256` file. If Zero is already installed, run `zero upgrade`
instead of reinstalling.
3 changes: 2 additions & 1 deletion internal/cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,8 @@ Commands:
mcp Manage MCP backend settings
auth Log in to model providers via OAuth
sandbox Inspect sandbox policy and persistent grants
update Check for Zero CLI updates
update Check or apply Zero CLI updates (requires --check or --apply)
upgrade Download, verify, and install available Zero CLI updates
worktrees Prepare isolated git worktrees
verify Detect and run local verification checks
eval Validate offline agent eval suites
Expand Down
15 changes: 15 additions & 0 deletions internal/cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,20 @@ func TestRunUpdateHelpDocumentsCheckFlag(t *testing.T) {
}
}

func TestTopLevelHelpDocumentsRequiredUpdateMode(t *testing.T) {
var stdout bytes.Buffer
var stderr bytes.Buffer

exitCode := runWithDeps([]string{"--help"}, &stdout, &stderr, appDeps{})

if exitCode != exitSuccess {
t.Fatalf("expected exit code %d, got %d: %s", exitSuccess, exitCode, stderr.String())
}
if got := stdout.String(); !strings.Contains(got, "update Check or apply Zero CLI updates (requires --check or --apply)") {
t.Fatalf("expected top-level help to document required update mode, got %q", got)
}
}

func TestRunUpdateReportsUpToDate(t *testing.T) {
var stdout bytes.Buffer
var stderr bytes.Buffer
Expand Down Expand Up @@ -1660,6 +1674,7 @@ func assertHelpOutput(t *testing.T, args []string) {
"mcp",
"sandbox",
"update",
"upgrade",
"worktrees",
"verify",
"serve",
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ Flags:
--check Check the latest GitHub release without installing
--apply Download, verify, and install the latest release
--json Print the update result as JSON
--repo <owner/repo> Repository to check when no endpoint is provided
--endpoint <url|repo> Release API URL or owner/repo slug to check
--repo <owner/repo> Repository to use when no endpoint is provided (--check and --apply; ignored for the install source by an npm-managed apply)
--endpoint <url|repo> Release API URL or owner/repo slug to use (--check and --apply; ignored for the install source by an npm-managed apply)
--timeout <duration> Release check timeout (default 5s)
--target <platform> Release target to verify with --check (for example windows-x64); not valid with --apply
-h, --help Show this help
Expand Down
11 changes: 9 additions & 2 deletions internal/update/installmethod.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@ func DetectInstallMethod(executablePath string) InstallMethod {
return InstallMethodStandalone
}
var pkg struct {
Name string `json:"name"`
Name string `json:"name"`
OS []string `json:"os"`
CPU []string `json:"cpu"`
Bin json.RawMessage `json:"bin"`
}
if err := json.Unmarshal(data, &pkg); err != nil {
return InstallMethodStandalone
}
if pkg.Name == npmPackageName {
// The native platform package is inert and constrained to one OS/CPU. The
// repository's wrapper package has the same name but carries a bin entry and
// broad platform lists, so name alone would misclassify `go build -o zero`
// from the repository root as an npm-managed install.
if pkg.Name == npmPackageName && len(pkg.OS) == 1 && len(pkg.CPU) == 1 && len(pkg.Bin) == 0 {
return InstallMethodNpm
}
return InstallMethodStandalone
Expand Down
17 changes: 16 additions & 1 deletion internal/update/installmethod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,29 @@ func TestDetectInstallMethodNpmViaPackageJSON(t *testing.T) {
if err := os.WriteFile(exePath, []byte("binary"), 0o755); err != nil {
t.Fatalf("WriteFile: %v", err)
}
if err := os.WriteFile(filepath.Join(dir, "package.json"), []byte(`{"name":"@gitlawb/zero"}`), 0o644); err != nil {
if err := os.WriteFile(filepath.Join(dir, "package.json"), []byte(`{"name":"@gitlawb/zero","version":"0.5.0-linux-x64","os":["linux"],"cpu":["x64"]}`), 0o644); err != nil {
t.Fatalf("WriteFile package.json: %v", err)
}
if method := DetectInstallMethod(exePath); method != InstallMethodNpm {
t.Fatalf("DetectInstallMethod = %q, want npm", method)
}
}

func TestDetectInstallMethodDoesNotTreatRepositoryManifestAsNpmBinary(t *testing.T) {
dir := t.TempDir()
exePath := filepath.Join(dir, "zero")
if err := os.WriteFile(exePath, []byte("binary"), 0o755); err != nil {
t.Fatal(err)
}
manifest := `{"name":"@gitlawb/zero","bin":{"zero":"bin/zero.js"},"os":["linux","darwin","win32","android"],"cpu":["x64","arm64"]}`
if err := os.WriteFile(filepath.Join(dir, "package.json"), []byte(manifest), 0o644); err != nil {
t.Fatal(err)
}
if method := DetectInstallMethod(exePath); method != InstallMethodStandalone {
t.Fatalf("DetectInstallMethod = %q, want standalone for repository wrapper manifest", method)
}
}

func TestDetectInstallMethodIgnoresUnrelatedPackageJSON(t *testing.T) {
dir := t.TempDir()
exePath := filepath.Join(dir, "zero")
Expand Down
Loading
Loading