CLI Installation and Login
Installation methods and login configuration for the GEO Wiki Pro CLI
# CLI Installation and Login
GEO Wiki Pro provides a command-line tool `geo` for managing knowledge base documents, categories, tags, users, and more.
## Installation
### Requirements
- Node.js >= 18
- npm >= 9
### Check Version
Before installing, check whether it is already installed and get the version info:
```bash
geo --version
```
- If it shows `command not found`: it is not installed — skip to the installation steps below
- If it shows a version number: compare with the latest version to decide whether an update is needed
> Agent tip: "Currently installed version is X.X.X, latest version is X.X.X. Would you like to update?" Only proceed after user confirmation.
### Update Version
To update from an older version, uninstall first, then reinstall (`npm uninstall -g` only removes `geowiki-cli` and does not affect other global packages):
```bash
npm uninstall -g geowiki-cli
```
Verify the uninstall:
```bash
geo --version
# Should show "command not found", indicating clean uninstall
```
> Note: If you encounter permission errors, use `sudo npm uninstall -g geowiki-cli`.
### Install Node.js (if not installed)
GEO Wiki CLI depends on Node.js. If your system does not have the `node` and `npm` commands, install them as follows:
| Platform | Install Command | Notes |
|:--------:|----------------|-------|
| macOS | `brew install node` | Recommended; or download the `.pkg` from nodejs.org |
| Ubuntu/Debian | `sudo apt install nodejs npm` | |
| Fedora | `sudo dnf install nodejs npm` | |
| Windows | `winget install OpenJS.NodeJS.LTS` | Recommended; or download the `.msi` from nodejs.org |
```bash
# Verify after installation
node --version
npm --version
```
### Global Install
```bash
npm install -g geowiki-cli
```
Verify installation:
```bash
geo --version
# Expected output: geowiki-cli v1.0.7+
geo --help
```
### Permission Issues
If you encounter permission errors:
```bash
# Option 1: Use sudo
sudo npm install -g geowiki-cli
# Option 2: Change npm global directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
npm install -g geowiki-cli
```
## Login
### Token Login (Recommended)
```bash
geo login --url https://geowiki.pro --token geo_xxxxx
```
| Parameter | Short | Description | Required |
|-----------|-------|-------------|----------|
| `--url` | `-u` | Server address | Yes |
| `--token` | `-t` | API Token | Yes |
Token login does not require CAPTCHA and is valid for 90 days. Generate tokens in the admin panel under Settings -> API Token.
## Login Status
```bash
geo status # View current connection status
geo logout # Clear local credentials and log out
```
After a successful login, the token is automatically saved to `~/.geowiki/config.json`. Subsequent commands will carry authentication information automatically.
## FAQ
**Q: The `geo` command is not found after installation?**
Make sure the npm global bin directory is in your system PATH. Run `npm config get prefix` to find the global directory path.
**Q: The old version conflicts with the new version?**
First run `npm uninstall -g geowiki-cli` to remove the old version, then reinstall the latest version.
**Q: What if the token expires?**
Generate a new token in the admin panel under Settings -> API Token, then run `geo login --url ... --token <new-token>` to log in again.
**Q: How do I confirm the currently logged-in user?**
Run `geo status` to view the current server connection and user information.
## Next Steps
- [CLI Quick Reference](/docs/cli-quick-reference) -- Quickly master common commands
- [CLI Command Reference](/docs/cli-reference) -- Full command parameter details
- [GEO Wiki Agent Skill Guide](/docs/agent-skill) -- AI Agent integration patterns and workflows