You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
artifacts, and optional GitHub artifact attestations. See
247
+
`docs/update-standard.md` for the full policy and required tests.
248
+
218
249
## Reference
219
250
220
251
See the `example/` directory in this repo for a working implementation of the core patterns and the entry point, error type, and output helpers. Config loading, secret handling, XDG paths, doctor, duplicate guard, and HTTP retry are documented as code patterns in the README's Reusable Modules section.
Copy file name to clipboardExpand all lines: README.md
+20-12Lines changed: 20 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,7 +82,7 @@ If `inbox list` works, `account list` works. If `--json` forces JSON in one CLI,
82
82
83
83
### 8. Self-contained and portable
84
84
85
-
The binary carries its own skill file as an embedded constant (via `const` or `include_str!`). `skill install` deploys it. `update`replaces the binary from GitHub Releases. One artifact. The self-update mechanism is opt-in -- CLIs distributed via package managers or in managed environments should disable it.
85
+
The binary carries its own skill file as an embedded constant (via `const` or `include_str!`). `skill install` deploys it. `update`is one command with distribution-aware behavior: standalone installer binaries may self-replace from GitHub Releases, but Homebrew, Cargo, npm, pipx, winget, apt, and managed installs must defer to the package manager or return the exact tested upgrade command. Self-update is opt-in and must be disableable in managed environments.
86
86
87
87
### 9. Speed is a feature
88
88
@@ -129,7 +129,7 @@ The binary describes itself. One command returns a JSON manifest of everything t
129
129
"config set <key> <value>": "Set a configuration value.",
130
130
"agent-info | info": "This manifest.",
131
131
"skill install": "Install skill file to agent platforms.",
132
-
"update [--check]": "Self-update from GitHub Releases."
"--json": "Force JSON output (auto-enabled when piped)",
@@ -290,23 +290,31 @@ mycli deploy # "Operation already running. Use --force to overr
290
290
mycli deploy --force # Bypasses guard
291
291
```
292
292
293
-
### Pattern 5: Self-Update
293
+
### Pattern 5: Update
294
294
295
-
Three install paths, one update mechanism:
295
+
One command, distribution-aware update paths:
296
296
297
297
```bash
298
298
# Install (pick any):
299
299
brew tap your-org/tap && brew install your-cli
300
300
cargo install your-cli
301
301
curl -fsSL https://your-cli.dev/install.sh | sh
302
302
303
-
#Self-update (built into the binary):
304
-
your-cli update --check # check for new version
305
-
your-cli update #pull latest from GitHub Releases
303
+
#Agent-facing update command:
304
+
your-cli update --check #safe check, no mutation
305
+
your-cli update #update via the owning channel, or return exact instructions
306
306
your-cli skill install # re-deploy updated skill
307
307
```
308
308
309
-
Self-update should be disableable via config (`update.enabled = false`) for managed environments.
309
+
Rules:
310
+
311
+
- Standalone installer install: may self-replace from GitHub Releases after asset selection, checksum/provenance verification, temp-file staging, version check, and atomic replacement.
312
+
- Homebrew install: never self-replace; use `brew upgrade <formula>`.
313
+
- Cargo install: never self-replace; use `cargo install --locked --force <crate>` or `cargo binstall --no-confirm <crate>` when supported.
314
+
- npm, Bun package-manager, uv tool, pipx, winget, scoop, apt, and enterprise installs: defer to the owning package manager.
315
+
- Managed environment: support `update.enabled = false` and return `status: "disabled"` with the internal upgrade instruction.
316
+
317
+
`update --check --json` returns a normal success envelope whose `data` includes `current_version`, `latest_version`, `status`, `install_source`, `update_mode`, `upgrade_command`, `release_url`, and `requires_skill_reinstall`. See [docs/update-standard.md](docs/update-standard.md) for the full standard, release pipeline, and required tests.
310
318
311
319
---
312
320
@@ -978,7 +986,7 @@ src/
978
986
your_command.rs # Your domain logic
979
987
skill.rs # Skill content auto-derived from CARGO_PKG_NAME
980
988
config.rs # config show/path (works out of the box)
981
-
update.rs # Self-update (just change repo owner/name in config)
The `example/` directory contains a modular `greeter` CLI demonstrating all core patterns: agent-info with argument schemas, JSON envelope, semantic exit codes (0-4), `--json` pre-scan, `--quiet` flag, config loading via Figment, skill self-install, and self-update. It includes 40 integration tests that verify every contract.
1016
+
The `example/` directory contains a modular `greeter` CLI demonstrating all core patterns: agent-info with argument schemas, JSON envelope, semantic exit codes (0-4), `--json` pre-scan, `--quiet` flag, config loading via Figment, skill self-install, and distribution-aware update output. It includes integration tests that verify the contracts.
1009
1017
1010
1018
```
1011
1019
example/
@@ -1021,7 +1029,7 @@ example/
1021
1029
agent_info.rs # Enriched capability manifest with arg schemas
1022
1030
config.rs # config show / config path
1023
1031
skill.rs # Skill install + status
1024
-
update.rs # Self-update
1032
+
update.rs # Distribution-aware update
1025
1033
contract.rs # Hidden: deterministic exit-code trigger for tests
1026
1034
tests/
1027
1035
exit_code_contracts.rs # All 5 exit codes verified
@@ -1135,7 +1143,7 @@ libc = "0.2"
1135
1143
# HTTP (if making network calls)
1136
1144
reqwest = { version = "0.12", features = ["json", "rustls-tls"] }
1137
1145
1138
-
#Self-update (optional)
1146
+
#Update (optional standalone self-replace)
1139
1147
self_update = { version = "0.42", features = ["archive-tar", "compression-flate2"] }
0 commit comments