openclaw 0.0.2__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openclaw-2.0.1/.gitignore +26 -0
- openclaw-2.0.1/PKG-INFO +134 -0
- openclaw-2.0.1/README.md +104 -0
- openclaw-2.0.1/pyproject.toml +76 -0
- openclaw-2.0.1/src/openclaw/__init__.py +61 -0
- openclaw-2.0.1/src/openclaw/cli.py +182 -0
- openclaw-2.0.1/src/openclaw/installer.py +190 -0
- openclaw-2.0.1/src/openclaw/platform.py +87 -0
- openclaw-2.0.1/tests/test_openclaw.py +463 -0
- openclaw-0.0.2/.gitignore +0 -26
- openclaw-0.0.2/PKG-INFO +0 -53
- openclaw-0.0.2/README.md +0 -30
- openclaw-0.0.2/pyproject.toml +0 -36
- openclaw-0.0.2/src/openclaw/__init__.py +0 -12
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Secrets — never commit, even to a private repo.
|
|
2
|
+
# Git history is permanent, and private repos get shared or opened later.
|
|
3
|
+
.env
|
|
4
|
+
.env.*
|
|
5
|
+
!.env.example
|
|
6
|
+
*.pem
|
|
7
|
+
*.key
|
|
8
|
+
|
|
9
|
+
# Python build output
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
*.egg-info/
|
|
13
|
+
__pycache__/
|
|
14
|
+
*.py[cod]
|
|
15
|
+
.pytest_cache/
|
|
16
|
+
.venv/
|
|
17
|
+
venv/
|
|
18
|
+
|
|
19
|
+
# Node
|
|
20
|
+
node_modules/
|
|
21
|
+
|
|
22
|
+
# Generated imagery is committed deliberately (see @docs/assets.md), but the
|
|
23
|
+
# raw model output used for review is not.
|
|
24
|
+
*.raw.png
|
|
25
|
+
|
|
26
|
+
.DS_Store
|
openclaw-2.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: openclaw
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: Installer for the cmdop CLI — one binary that runs an AI agent on your machine
|
|
5
|
+
Project-URL: Homepage, https://cmdop.com
|
|
6
|
+
Project-URL: Documentation, https://docs.cmdop.com
|
|
7
|
+
Project-URL: Download, https://cmdop.com/download
|
|
8
|
+
Project-URL: Source (organization), https://github.com/commandoperator
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: agent-runtime,ai-agent,cli,cmdop,installer,remote-execution,self-hosted
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
26
|
+
Classifier: Topic :: System :: Installation/Setup
|
|
27
|
+
Classifier: Topic :: System :: Systems Administration
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# openclaw
|
|
32
|
+
|
|
33
|
+

|
|
34
|
+
|
|
35
|
+
**Installer for the [cmdop](https://cmdop.com) CLI** — one binary that runs an
|
|
36
|
+
AI agent on your machine and connects it to your fleet.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install openclaw
|
|
40
|
+
openclaw
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
That's it. `openclaw` detects your platform, downloads the `cmdop` binary,
|
|
44
|
+
verifies it against the published checksums, installs it, and hands over.
|
|
45
|
+
|
|
46
|
+
> **Not affiliated with the OpenClaw project.** If you are looking for
|
|
47
|
+
> [github.com/openclaw/openclaw](https://github.com/openclaw/openclaw), that is
|
|
48
|
+
> a different project — this package will not install it. This package is
|
|
49
|
+
> published by CMDOP and installs the `cmdop` CLI.
|
|
50
|
+
|
|
51
|
+
**How does CMDOP compare?**
|
|
52
|
+
[CMDOP Skills vs OpenClaw: two approaches to AI agent skills →](https://docs.cmdop.com/blog/cmdop-skills-vs-openclaw)
|
|
53
|
+
|
|
54
|
+
## What is cmdop
|
|
55
|
+
|
|
56
|
+
One executable that is the agent, the relay, the local server and the web
|
|
57
|
+
console at once. There is no gateway, backend, database server or broker to
|
|
58
|
+
stand up — you add one binary to a machine you already own.
|
|
59
|
+
|
|
60
|
+
- run an AI agent on your own machine, with your own tools
|
|
61
|
+
- reach it from anywhere: terminal, files, remote execution
|
|
62
|
+
- connect machines into a fleet
|
|
63
|
+
- works with Claude Code and other agent engines under the hood
|
|
64
|
+
|
|
65
|
+
Full documentation: **[docs.cmdop.com](https://docs.cmdop.com)**
|
|
66
|
+
|
|
67
|
+
## Usage
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
openclaw # install cmdop (if needed), then run it
|
|
71
|
+
openclaw --install-only # install, don't hand over
|
|
72
|
+
openclaw --prefix ~/bin # choose the install directory
|
|
73
|
+
openclaw --force # reinstall even if already present
|
|
74
|
+
openclaw --quiet # print only the installed path
|
|
75
|
+
openclaw -- --help # everything after `--` goes to cmdop
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Default install directory is `~/.local/bin` (`%LOCALAPPDATA%\cmdop\bin` on
|
|
79
|
+
Windows). No `sudo`, no system directories.
|
|
80
|
+
|
|
81
|
+
## What it does, precisely
|
|
82
|
+
|
|
83
|
+
1. Detects your OS and architecture.
|
|
84
|
+
2. Fetches `SHA256SUMS` from `install.cmdop.com`.
|
|
85
|
+
3. Downloads the matching binary to a temporary file.
|
|
86
|
+
4. **Verifies the SHA-256 against the published checksum.** On mismatch it
|
|
87
|
+
aborts and installs nothing.
|
|
88
|
+
5. Moves the verified binary into the install directory and marks it
|
|
89
|
+
executable.
|
|
90
|
+
6. Runs it.
|
|
91
|
+
|
|
92
|
+
Supported: macOS (Apple Silicon, Intel), Linux (x64, arm64), Windows (x64).
|
|
93
|
+
|
|
94
|
+
## What it does not do
|
|
95
|
+
|
|
96
|
+
- **No side effects at install time.** `pip install openclaw` only unpacks
|
|
97
|
+
files. Nothing is downloaded or executed until you run `openclaw`.
|
|
98
|
+
- **No network access on import.** `import openclaw` touches nothing.
|
|
99
|
+
- **No telemetry.** The package sends no analytics, ever.
|
|
100
|
+
- **No dependencies.** Standard library only, so there is nothing to conflict
|
|
101
|
+
with what you already have installed.
|
|
102
|
+
|
|
103
|
+
## Python API
|
|
104
|
+
|
|
105
|
+
The installer is importable if you would rather script it:
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
import openclaw
|
|
109
|
+
|
|
110
|
+
target = openclaw.detect()
|
|
111
|
+
print(target.label, target.asset)
|
|
112
|
+
|
|
113
|
+
result = openclaw.install()
|
|
114
|
+
print(result.path, result.sha256)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`openclaw.install()` raises `openclaw.InstallError` with a user-facing message
|
|
118
|
+
on any failure, and `openclaw.UnsupportedPlatform` when there is no published
|
|
119
|
+
binary for the current machine.
|
|
120
|
+
|
|
121
|
+
## Links
|
|
122
|
+
|
|
123
|
+
- Website — <https://cmdop.com>
|
|
124
|
+
- Documentation — <https://docs.cmdop.com>
|
|
125
|
+
- Downloads — <https://cmdop.com/download>
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
*OpenClaw is a trademark of its respective owners. This package is not
|
|
134
|
+
affiliated with, endorsed by, or connected to the OpenClaw project.*
|
openclaw-2.0.1/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# openclaw
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
**Installer for the [cmdop](https://cmdop.com) CLI** — one binary that runs an
|
|
6
|
+
AI agent on your machine and connects it to your fleet.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pip install openclaw
|
|
10
|
+
openclaw
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That's it. `openclaw` detects your platform, downloads the `cmdop` binary,
|
|
14
|
+
verifies it against the published checksums, installs it, and hands over.
|
|
15
|
+
|
|
16
|
+
> **Not affiliated with the OpenClaw project.** If you are looking for
|
|
17
|
+
> [github.com/openclaw/openclaw](https://github.com/openclaw/openclaw), that is
|
|
18
|
+
> a different project — this package will not install it. This package is
|
|
19
|
+
> published by CMDOP and installs the `cmdop` CLI.
|
|
20
|
+
|
|
21
|
+
**How does CMDOP compare?**
|
|
22
|
+
[CMDOP Skills vs OpenClaw: two approaches to AI agent skills →](https://docs.cmdop.com/blog/cmdop-skills-vs-openclaw)
|
|
23
|
+
|
|
24
|
+
## What is cmdop
|
|
25
|
+
|
|
26
|
+
One executable that is the agent, the relay, the local server and the web
|
|
27
|
+
console at once. There is no gateway, backend, database server or broker to
|
|
28
|
+
stand up — you add one binary to a machine you already own.
|
|
29
|
+
|
|
30
|
+
- run an AI agent on your own machine, with your own tools
|
|
31
|
+
- reach it from anywhere: terminal, files, remote execution
|
|
32
|
+
- connect machines into a fleet
|
|
33
|
+
- works with Claude Code and other agent engines under the hood
|
|
34
|
+
|
|
35
|
+
Full documentation: **[docs.cmdop.com](https://docs.cmdop.com)**
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
openclaw # install cmdop (if needed), then run it
|
|
41
|
+
openclaw --install-only # install, don't hand over
|
|
42
|
+
openclaw --prefix ~/bin # choose the install directory
|
|
43
|
+
openclaw --force # reinstall even if already present
|
|
44
|
+
openclaw --quiet # print only the installed path
|
|
45
|
+
openclaw -- --help # everything after `--` goes to cmdop
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Default install directory is `~/.local/bin` (`%LOCALAPPDATA%\cmdop\bin` on
|
|
49
|
+
Windows). No `sudo`, no system directories.
|
|
50
|
+
|
|
51
|
+
## What it does, precisely
|
|
52
|
+
|
|
53
|
+
1. Detects your OS and architecture.
|
|
54
|
+
2. Fetches `SHA256SUMS` from `install.cmdop.com`.
|
|
55
|
+
3. Downloads the matching binary to a temporary file.
|
|
56
|
+
4. **Verifies the SHA-256 against the published checksum.** On mismatch it
|
|
57
|
+
aborts and installs nothing.
|
|
58
|
+
5. Moves the verified binary into the install directory and marks it
|
|
59
|
+
executable.
|
|
60
|
+
6. Runs it.
|
|
61
|
+
|
|
62
|
+
Supported: macOS (Apple Silicon, Intel), Linux (x64, arm64), Windows (x64).
|
|
63
|
+
|
|
64
|
+
## What it does not do
|
|
65
|
+
|
|
66
|
+
- **No side effects at install time.** `pip install openclaw` only unpacks
|
|
67
|
+
files. Nothing is downloaded or executed until you run `openclaw`.
|
|
68
|
+
- **No network access on import.** `import openclaw` touches nothing.
|
|
69
|
+
- **No telemetry.** The package sends no analytics, ever.
|
|
70
|
+
- **No dependencies.** Standard library only, so there is nothing to conflict
|
|
71
|
+
with what you already have installed.
|
|
72
|
+
|
|
73
|
+
## Python API
|
|
74
|
+
|
|
75
|
+
The installer is importable if you would rather script it:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import openclaw
|
|
79
|
+
|
|
80
|
+
target = openclaw.detect()
|
|
81
|
+
print(target.label, target.asset)
|
|
82
|
+
|
|
83
|
+
result = openclaw.install()
|
|
84
|
+
print(result.path, result.sha256)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`openclaw.install()` raises `openclaw.InstallError` with a user-facing message
|
|
88
|
+
on any failure, and `openclaw.UnsupportedPlatform` when there is no published
|
|
89
|
+
binary for the current machine.
|
|
90
|
+
|
|
91
|
+
## Links
|
|
92
|
+
|
|
93
|
+
- Website — <https://cmdop.com>
|
|
94
|
+
- Documentation — <https://docs.cmdop.com>
|
|
95
|
+
- Downloads — <https://cmdop.com/download>
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
*OpenClaw is a trademark of its respective owners. This package is not
|
|
104
|
+
affiliated with, endorsed by, or connected to the OpenClaw project.*
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "openclaw"
|
|
7
|
+
version = "2.0.1"
|
|
8
|
+
description = "Installer for the cmdop CLI — one binary that runs an AI agent on your machine"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
keywords = [
|
|
13
|
+
"cmdop",
|
|
14
|
+
"installer",
|
|
15
|
+
"cli",
|
|
16
|
+
"ai-agent",
|
|
17
|
+
"agent-runtime",
|
|
18
|
+
"remote-execution",
|
|
19
|
+
"self-hosted",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 4 - Beta",
|
|
23
|
+
"Environment :: Console",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"Intended Audience :: System Administrators",
|
|
26
|
+
"License :: OSI Approved :: MIT License",
|
|
27
|
+
"Operating System :: MacOS :: MacOS X",
|
|
28
|
+
"Operating System :: Microsoft :: Windows",
|
|
29
|
+
"Operating System :: POSIX :: Linux",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.9",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Topic :: Software Development :: Build Tools",
|
|
37
|
+
"Topic :: System :: Installation/Setup",
|
|
38
|
+
"Topic :: System :: Systems Administration",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
# No runtime dependencies, deliberately.
|
|
42
|
+
#
|
|
43
|
+
# An installer must work on any machine that can run Python, and every
|
|
44
|
+
# dependency is a way for that to stop being true. The whole package is
|
|
45
|
+
# stdlib-only: urllib for the download, hashlib for verification.
|
|
46
|
+
#
|
|
47
|
+
# This is also the direct fix for what broke the previous fleet: a bare,
|
|
48
|
+
# unpinned `cmdop` dependency floated onto an SDK release that renamed its
|
|
49
|
+
# client class, and all 12 packages began failing at import. No dependency,
|
|
50
|
+
# no such failure mode.
|
|
51
|
+
dependencies = []
|
|
52
|
+
|
|
53
|
+
[project.scripts]
|
|
54
|
+
openclaw = "openclaw.cli:main"
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
# `Repository` is deliberately omitted until a real public repo exists for this
|
|
58
|
+
# package under github.com/commandoperator. A Repository link that 404s is
|
|
59
|
+
# worse than none — it is the first thing a cautious developer clicks, and the
|
|
60
|
+
# previous fleet pointed at cmdop-sdk, which was never where its source lived.
|
|
61
|
+
# Add it here the moment the repo is published.
|
|
62
|
+
Homepage = "https://cmdop.com"
|
|
63
|
+
Documentation = "https://docs.cmdop.com"
|
|
64
|
+
Download = "https://cmdop.com/download"
|
|
65
|
+
"Source (organization)" = "https://github.com/commandoperator"
|
|
66
|
+
|
|
67
|
+
[tool.hatch.build.targets.wheel]
|
|
68
|
+
packages = ["src/openclaw"]
|
|
69
|
+
|
|
70
|
+
[tool.hatch.build.targets.sdist]
|
|
71
|
+
include = ["src/openclaw", "README.md", "tests"]
|
|
72
|
+
|
|
73
|
+
[tool.pytest.ini_options]
|
|
74
|
+
testpaths = ["tests"]
|
|
75
|
+
markers = ["live: touches the real published manifest (opt-in: pytest -m live)"]
|
|
76
|
+
addopts = "-m 'not live'"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""openclaw — installer for the cmdop CLI.
|
|
2
|
+
|
|
3
|
+
Run `openclaw` to download, verify and launch cmdop on this machine.
|
|
4
|
+
|
|
5
|
+
Not affiliated with the OpenClaw project (github.com/openclaw/openclaw).
|
|
6
|
+
This package is published by CMDOP — https://cmdop.com
|
|
7
|
+
|
|
8
|
+
Importing this module performs no network access and has no side effects.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
if TYPE_CHECKING: # pragma: no cover — for type checkers and IDE completion only
|
|
16
|
+
from .cli import main
|
|
17
|
+
from .installer import (
|
|
18
|
+
InstallError,
|
|
19
|
+
InstallResult,
|
|
20
|
+
default_install_dir,
|
|
21
|
+
find_installed,
|
|
22
|
+
install,
|
|
23
|
+
)
|
|
24
|
+
from .platform import Platform, UnsupportedPlatform, detect
|
|
25
|
+
|
|
26
|
+
__version__ = "2.0.1"
|
|
27
|
+
|
|
28
|
+
__all__ = [
|
|
29
|
+
"__version__",
|
|
30
|
+
"InstallError",
|
|
31
|
+
"InstallResult",
|
|
32
|
+
"Platform",
|
|
33
|
+
"UnsupportedPlatform",
|
|
34
|
+
"default_install_dir",
|
|
35
|
+
"detect",
|
|
36
|
+
"find_installed",
|
|
37
|
+
"install",
|
|
38
|
+
"main",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def __getattr__(name: str):
|
|
43
|
+
"""Resolve the public API lazily.
|
|
44
|
+
|
|
45
|
+
Keeps `import openclaw` free of any work beyond binding a name — the
|
|
46
|
+
submodules import argparse, subprocess and urllib, none of which a caller
|
|
47
|
+
who only wants __version__ should pay for.
|
|
48
|
+
"""
|
|
49
|
+
if name in ("InstallError", "InstallResult", "default_install_dir", "find_installed", "install"):
|
|
50
|
+
from . import installer
|
|
51
|
+
|
|
52
|
+
return getattr(installer, name)
|
|
53
|
+
if name in ("Platform", "UnsupportedPlatform", "detect"):
|
|
54
|
+
from . import platform as _platform
|
|
55
|
+
|
|
56
|
+
return getattr(_platform, name)
|
|
57
|
+
if name == "main":
|
|
58
|
+
from .cli import main
|
|
59
|
+
|
|
60
|
+
return main
|
|
61
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"""The `openclaw` command.
|
|
2
|
+
|
|
3
|
+
Bare `openclaw` does the obvious thing: install cmdop if missing, then hand
|
|
4
|
+
over to it. No subcommand to learn, no flags required.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import os
|
|
11
|
+
import subprocess
|
|
12
|
+
import sys
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from . import __version__
|
|
16
|
+
from .installer import (
|
|
17
|
+
InstallError,
|
|
18
|
+
default_install_dir,
|
|
19
|
+
find_installed,
|
|
20
|
+
install,
|
|
21
|
+
)
|
|
22
|
+
from .platform import UnsupportedPlatform, detect, is_windows
|
|
23
|
+
|
|
24
|
+
DOCS_URL = "https://cmdop.com"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _tty() -> bool:
|
|
28
|
+
return sys.stdout.isatty()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _dim(text: str) -> str:
|
|
32
|
+
return f"\033[2m{text}\033[0m" if _tty() else text
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _bold(text: str) -> str:
|
|
36
|
+
return f"\033[1m{text}\033[0m" if _tty() else text
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _progress(seen: int, total: int) -> None:
|
|
40
|
+
if not _tty():
|
|
41
|
+
return
|
|
42
|
+
if total:
|
|
43
|
+
pct = seen * 100 // total
|
|
44
|
+
bar = "█" * (pct // 4) + "░" * (25 - pct // 4)
|
|
45
|
+
sys.stdout.write(f"\r {bar} {pct:3d}% {seen / 1048576:.0f}/{total / 1048576:.0f} MB")
|
|
46
|
+
else:
|
|
47
|
+
sys.stdout.write(f"\r {seen / 1048576:.0f} MB")
|
|
48
|
+
sys.stdout.flush()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _install(install_dir: Path | None, quiet: bool) -> int:
|
|
52
|
+
try:
|
|
53
|
+
target = detect()
|
|
54
|
+
except UnsupportedPlatform as exc:
|
|
55
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
56
|
+
return 2
|
|
57
|
+
|
|
58
|
+
if not quiet:
|
|
59
|
+
print(f"Installing {_bold('cmdop')} for {target.label}…")
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
result = install(install_dir=install_dir, target=target, on_progress=_progress)
|
|
63
|
+
except InstallError as exc:
|
|
64
|
+
if _tty():
|
|
65
|
+
sys.stdout.write("\r\033[K")
|
|
66
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
67
|
+
return 1
|
|
68
|
+
|
|
69
|
+
if _tty():
|
|
70
|
+
sys.stdout.write("\r\033[K")
|
|
71
|
+
|
|
72
|
+
if quiet:
|
|
73
|
+
print(result.path)
|
|
74
|
+
return 0
|
|
75
|
+
|
|
76
|
+
print(f" Installed {_bold(str(result.path))}")
|
|
77
|
+
print(_dim(f" sha256 {result.sha256}"))
|
|
78
|
+
|
|
79
|
+
if not result.on_path:
|
|
80
|
+
print()
|
|
81
|
+
print(f" {result.path.parent} is not on your PATH. Add it:")
|
|
82
|
+
if is_windows():
|
|
83
|
+
print(_dim(f' setx PATH "%PATH%;{result.path.parent}"'))
|
|
84
|
+
else:
|
|
85
|
+
shell = Path(os.environ.get("SHELL", "")).name or "bash"
|
|
86
|
+
rc = "~/.zshrc" if shell == "zsh" else "~/.bashrc"
|
|
87
|
+
print(_dim(f' echo \'export PATH="{result.path.parent}:$PATH"\' >> {rc}'))
|
|
88
|
+
return 0
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _run(binary: Path, argv: list[str]) -> int:
|
|
92
|
+
try:
|
|
93
|
+
return subprocess.call([str(binary), *argv])
|
|
94
|
+
except OSError as exc:
|
|
95
|
+
print(f"error: could not run {binary}: {exc}", file=sys.stderr)
|
|
96
|
+
return 1
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def main(argv: list[str] | None = None) -> int:
|
|
100
|
+
argv = list(sys.argv[1:] if argv is None else argv)
|
|
101
|
+
|
|
102
|
+
parser = argparse.ArgumentParser(
|
|
103
|
+
prog="openclaw",
|
|
104
|
+
description=(
|
|
105
|
+
"Installer for the cmdop CLI — one binary that runs an AI agent on "
|
|
106
|
+
"your machine and connects it to your fleet. Run `openclaw` to "
|
|
107
|
+
f"install it and get started. {DOCS_URL}"
|
|
108
|
+
),
|
|
109
|
+
epilog=(
|
|
110
|
+
"Not affiliated with the OpenClaw project (github.com/openclaw/openclaw). "
|
|
111
|
+
"This package is published by CMDOP."
|
|
112
|
+
),
|
|
113
|
+
)
|
|
114
|
+
parser.add_argument("--version", action="store_true", help="show version and exit")
|
|
115
|
+
parser.add_argument("--prefix", metavar="DIR", help="install directory")
|
|
116
|
+
parser.add_argument(
|
|
117
|
+
"--force", action="store_true", help="reinstall even if cmdop is present"
|
|
118
|
+
)
|
|
119
|
+
parser.add_argument(
|
|
120
|
+
"--quiet", action="store_true", help="print only the installed path"
|
|
121
|
+
)
|
|
122
|
+
parser.add_argument(
|
|
123
|
+
"--install-only",
|
|
124
|
+
action="store_true",
|
|
125
|
+
help="install without handing over to cmdop",
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# Everything after `--` goes to cmdop untouched.
|
|
129
|
+
passthrough: list[str] = []
|
|
130
|
+
if "--" in argv:
|
|
131
|
+
split = argv.index("--")
|
|
132
|
+
argv, passthrough = argv[:split], argv[split + 1 :]
|
|
133
|
+
|
|
134
|
+
args = parser.parse_args(argv)
|
|
135
|
+
|
|
136
|
+
if args.version:
|
|
137
|
+
print(f"openclaw {__version__}")
|
|
138
|
+
return 0
|
|
139
|
+
|
|
140
|
+
install_dir = Path(args.prefix).expanduser() if args.prefix else None
|
|
141
|
+
binary_name = "cmdop.exe" if is_windows() else "cmdop"
|
|
142
|
+
|
|
143
|
+
# An explicit --prefix names exactly where the binary belongs, so only that
|
|
144
|
+
# location counts as "already installed". Without it, any cmdop on PATH
|
|
145
|
+
# does. Checking PATH under --prefix would silently skip the install the
|
|
146
|
+
# user just asked for.
|
|
147
|
+
if install_dir is not None:
|
|
148
|
+
candidate = install_dir / binary_name
|
|
149
|
+
existing = candidate if candidate.exists() else None
|
|
150
|
+
else:
|
|
151
|
+
existing = find_installed()
|
|
152
|
+
|
|
153
|
+
if args.force:
|
|
154
|
+
existing = None
|
|
155
|
+
|
|
156
|
+
if existing is None:
|
|
157
|
+
code = _install(install_dir, args.quiet)
|
|
158
|
+
if code != 0:
|
|
159
|
+
return code
|
|
160
|
+
existing = (install_dir or default_install_dir()) / binary_name
|
|
161
|
+
if not existing.exists():
|
|
162
|
+
found = find_installed()
|
|
163
|
+
if found is None:
|
|
164
|
+
print("error: install reported success but no binary was found.",
|
|
165
|
+
file=sys.stderr)
|
|
166
|
+
return 1
|
|
167
|
+
existing = found
|
|
168
|
+
if not args.quiet and not args.install_only:
|
|
169
|
+
print()
|
|
170
|
+
elif not args.quiet:
|
|
171
|
+
# Say so even under --install-only: a command that does nothing must
|
|
172
|
+
# still tell the user why.
|
|
173
|
+
print(_dim(f"cmdop is already installed at {existing}"))
|
|
174
|
+
|
|
175
|
+
if args.install_only:
|
|
176
|
+
return 0
|
|
177
|
+
|
|
178
|
+
return _run(existing, passthrough)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
if __name__ == "__main__": # pragma: no cover
|
|
182
|
+
raise SystemExit(main())
|