Skip to content

Latest commit

 

History

History
155 lines (116 loc) · 5.07 KB

install.md

File metadata and controls

155 lines (116 loc) · 5.07 KB

Install and update

Install script (macOS, Linux)

curl -fsSL https://docs.ac/install-cli | bash

On Windows, in PowerShell:

irm https://docs.ac/install-cli.ps1 | iex

The script downloads the release archive for your platform, checks it against the published checksums.txt, and hands over to docsgpt-cli install, which puts the binary on your PATH: /usr/local/bin when it is writable, else ~/.local/bin (%USERPROFILE%\bin on Windows). Run it again to upgrade.

On Windows the directory goes on your user PATH, and the PowerShell window that ran the script can use docsgpt-cli at once. Other windows that were already open keep their old PATH: open a new one. A terminal inside an editor (VS Code, for one) gets its environment from the editor, so restart the editor.

Installers up to v1.10.1 could join the directory onto the last entry of a user PATH that held a single entry (…\WindowsAppsC:\Users\you\bin), which breaks both: docsgpt-cli and the Store apps' commands (winget) are not found in new windows. Running the install command again repairs the entry.

To read the script first, download it: curl -fsSL https://docs.ac/install-cli -o install.sh, then bash install.sh.

Variable Effect
DOCSGPT_CLI_VERSION Install this release instead of the latest (e.g. v1.5.1)
DOCSGPT_NO_MODIFY_PATH=1 Install the binary, leave shell profiles (or the Windows PATH) alone

Homebrew (macOS)

brew tap arc53/docsgpt-cli
brew install --cask docsgpt-cli

Upgrade with brew upgrade --cask docsgpt-cli. Homebrew-managed copies never update themselves; docsgpt-cli update points you back at brew.

Installed before 1.6.0? Those came from a formula, which is no longer updated. Move across once:

brew uninstall --formula --force docsgpt-cli && brew install --cask docsgpt-cli

Homebrew on Linux is not supported (casks are macOS-only). Use the install script.

Release archive

Download the archive for your platform from Releases. Run the binary as is, or let it copy itself onto your PATH:

./docsgpt-cli install

go install

go install github.com/arc53/DocsGPT-cli/cmd/docsgpt-cli@latest

Needs v1.6.0 or newer (earlier releases predate the module rename). The binary lands in $(go env GOBIN) (or $(go env GOPATH)/bin), knows which release it came from, and updates itself like any other, so there is no need to re-run go install.

The path ends in /cmd/docsgpt-cli on purpose: go install names the binary after the last element of the path, and the module root would give you one called DocsGPT-cli.

From source

git clone https://github.com/arc53/DocsGPT-cli
cd DocsGPT-cli
make build
./docsgpt-cli install

Source builds report version dev and do not update themselves; update them with git pull && make build.

Shell completion

docsgpt-cli completion <shell> prints a completion script. It completes the commands and flags, and from your config the names of your stored keys (--key, logout), the settings of config get / config set and their values. It never goes over the network.

# bash (needs the bash-completion package)
echo 'source <(docsgpt-cli completion bash)' >> ~/.bashrc

# zsh (compinit must be on; oh-my-zsh and most setups do it)
echo 'source <(docsgpt-cli completion zsh)' >> ~/.zshrc

# fish
docsgpt-cli completion fish > ~/.config/fish/completions/docsgpt-cli.fish
# PowerShell
docsgpt-cli completion powershell | Out-String | Invoke-Expression
# to keep it, add that line to $PROFILE

macOS ships bash 3.2, where source <(…) does nothing: use eval "$(docsgpt-cli completion bash)" there, or a newer bash.

Updating

docsgpt-cli checks GitHub for a new release in the background, at most once a day. It downloads the new binary, verifies its checksum, and swaps it in the next time you run a command. The previous binary is kept for a rollback.

docsgpt-cli config set auto_update on       # download and install (default)
docsgpt-cli config set auto_update notify   # only print a notice
docsgpt-cli config set auto_update off      # never check

Manual controls:

docsgpt-cli update              # check, confirm, install now
docsgpt-cli update --check      # only check
docsgpt-cli update --yes        # no confirmation (needed without a terminal)
docsgpt-cli update --rollback   # restore the binary from before the last update

A rollback also tells auto-update to skip the version you rolled back from, until you run docsgpt-cli update yourself.

  • DOCSGPT_NO_UPDATE_CHECK=1 turns off everything update-related (set it in CI).
  • Homebrew installs, and binaries in a directory you cannot write to, only get a notice; update those with brew or the install script.
  • A host checks about every 12 hours while idle, installs the new release and restarts itself into it.
  • update only works on release builds: source builds and prereleases are told how to update instead.