sima-cli 2.1.8__tar.gz → 2.1.10__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.
- sima_cli-2.1.10/PKG-INFO +197 -0
- sima_cli-2.1.10/README.md +163 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/pyproject.toml +2 -2
- {sima_cli-2.1.8 → sima_cli-2.1.10}/requirements.txt +1 -1
- {sima_cli-2.1.8 → sima_cli-2.1.10}/setup.py +1 -1
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/__version__.py +1 -1
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/auth/auth0.py +150 -4
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/auth/devportal.py +73 -40
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/cli.py +53 -8
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/metadata_installer.py +4 -4
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/commands.py +64 -5
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/install.py +94 -6
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/neat.py +34 -3
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/preinstall.py +215 -24
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/utils.py +337 -77
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/elxr.py +220 -36
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/updater.py +12 -2
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/upgrade/selfupdate.py +2 -1
- sima_cli-2.1.10/sima_cli/utils/docker.py +391 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/pkg_update_check.py +52 -10
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/vulcan/commands.py +1 -1
- sima_cli-2.1.10/sima_cli.egg-info/PKG-INFO +197 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli.egg-info/SOURCES.txt +4 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli.egg-info/requires.txt +1 -1
- sima_cli-2.1.10/tests/unit/test_auth.py +251 -0
- sima_cli-2.1.10/tests/unit/test_auth0.py +173 -0
- sima_cli-2.1.10/tests/unit/test_cli_update.py +25 -0
- sima_cli-2.1.10/tests/unit/test_cli_update_rerun.py +20 -0
- sima_cli-2.1.10/tests/unit/test_docker_utils.py +322 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_elxr_update.py +229 -0
- sima_cli-2.1.10/tests/unit/test_pkg_update_check.py +189 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_sdk_image_detection.py +562 -25
- sima_cli-2.1.10/tests/unit/test_sdk_preinstall.py +187 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_selfupdate.py +29 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_vulcan.py +7 -4
- sima_cli-2.1.8/PKG-INFO +0 -670
- sima_cli-2.1.8/README.md +0 -636
- sima_cli-2.1.8/sima_cli/utils/docker.py +0 -228
- sima_cli-2.1.8/sima_cli.egg-info/PKG-INFO +0 -670
- sima_cli-2.1.8/tests/unit/test_auth.py +0 -143
- sima_cli-2.1.8/tests/unit/test_pkg_update_check.py +0 -107
- sima_cli-2.1.8/tests/unit/test_sdk_preinstall.py +0 -73
- {sima_cli-2.1.8 → sima_cli-2.1.10}/LICENSE +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/MANIFEST.in +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/setup.cfg +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/__main__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/app_zoo/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/app_zoo/app.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/app_zoo/commands.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/auth/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/auth/login.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/auth/oauth.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/data/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/data/resources_internal.yaml +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/data/resources_public.yaml +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/deploy_only/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/deploy_only/device/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/deploy_only/device/commands.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/deploy_only/mpk/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/deploy_only/mpk/commands.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/discover/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/discover/discover.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/discover/linuxll.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/download/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/download/downloader.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/github_assets.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/hostdriver.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/metadata_info.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/metadata_validator.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/optiview.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/package_builder.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/palette.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/install/registry.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/mla/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/mla/meminfo.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/model_zoo/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/model_zoo/model.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/network/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/network/network.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/playbooks/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/playbooks/commands.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/playbooks/manager.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/cmdexec.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/config.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/linux_shared_network.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/requirements.json +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/script.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/stop.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/sdk/uninstall.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/serial/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/serial/serial.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/storage/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/storage/nvme.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/storage/sdcard.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/bmaptool.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/bootimg.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/cleanlog.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/local.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/netboot.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/query.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/update/remote.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/upgrade/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/api_common.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/artifactory.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/common.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/config.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/config_loader.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/container_registries.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/device_api.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/disk.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/env.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/errors.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/mpk_api.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/net.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/network.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/pcie.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/serializers.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/services.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/utils/tag.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/vulcan/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli/vulcan/artifacts.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli.egg-info/dependency_links.txt +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli.egg-info/entry_points.txt +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/sima_cli.egg-info/top_level.txt +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/e2e/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/__init__.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_app_zoo.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_cli.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_cli_stdio.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_download.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_firmware.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_install_stub.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_metadata_installer.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_model_zoo.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_netboot.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_package_builder.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_sdk_uninstall.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_skills_commands.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_skills_manager.py +0 -0
- {sima_cli-2.1.8 → sima_cli-2.1.10}/tests/unit/test_utils.py +0 -0
sima_cli-2.1.10/PKG-INFO
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sima-cli
|
|
3
|
+
Version: 2.1.10
|
|
4
|
+
Summary: CLI tool for SiMa Developer Portal to download models, firmware, and apps.
|
|
5
|
+
Home-page: https://developer.sima.ai/
|
|
6
|
+
Author: SiMa.ai
|
|
7
|
+
Author-email: "Sima.ai" <support@sima.ai>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://developer.sima.ai/
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Requires-Python: >=3.8
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: click>=8.0
|
|
20
|
+
Requires-Dist: requests<3.0,>=2.32.4
|
|
21
|
+
Requires-Dist: tqdm>=4.64
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Requires-Dist: paramiko>=3.5.1
|
|
24
|
+
Requires-Dist: plotext==5.3.2
|
|
25
|
+
Requires-Dist: rich==14.0.0
|
|
26
|
+
Requires-Dist: InquirerPy==0.3.4
|
|
27
|
+
Requires-Dist: tftpy==0.8.6
|
|
28
|
+
Requires-Dist: psutil==7.0.0
|
|
29
|
+
Requires-Dist: huggingface-hub<1.0,>=0.34.0
|
|
30
|
+
Requires-Dist: tabulate==0.9.0
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
Dynamic: requires-python
|
|
34
|
+
|
|
35
|
+
# sima-cli - SiMa Developer Portal CLI Tool
|
|
36
|
+
|
|
37
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
38
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
39
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
40
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
41
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
42
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
43
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
44
|
+
[&label=e2e%20macOS&logo=apple&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
45
|
+
[&label=e2e%20Windows&logo=windows&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
46
|
+
[&label=e2e%20Ubuntu%20x86&logo=ubuntu&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
47
|
+
[&label=e2e%20Ubuntu%20ARM64&logo=ubuntu&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
48
|
+
|
|
49
|
+
`sima-cli` is the command-line interface for SiMa developer workflows. It handles authentication, SDK container setup, DevKit updates, package installation, artifact downloads, Model Zoo/App Zoo access, and related development utilities.
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
The full command reference is generated as Markdown under [docs/sima-cli](docs/sima-cli/index.md).
|
|
54
|
+
|
|
55
|
+
Use the generated docs for detailed options, arguments, subcommands, and full help text:
|
|
56
|
+
|
|
57
|
+
- [Complete command reference](docs/sima-cli/index.md)
|
|
58
|
+
- [Top-level command help](docs/sima-cli/commands/sima-cli.md)
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
Install the latest `main` build:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl -fsSL https://artifacts.sima-neat.com/tools/sima-cli-install.py -o sima-cli-install.py
|
|
66
|
+
python3 sima-cli-install.py main latest
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Install interactively:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
python3 sima-cli-install.py
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Install a specific branch or release:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
python3 sima-cli-install.py feature/my-branch latest
|
|
79
|
+
python3 sima-cli-install.py v2.1.6 latest
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
On Windows PowerShell:
|
|
83
|
+
|
|
84
|
+
```powershell
|
|
85
|
+
Invoke-WebRequest https://artifacts.sima-neat.com/tools/sima-cli-install.py -OutFile sima-cli-install.py
|
|
86
|
+
python .\sima-cli-install.py main latest
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Public PyPI releases can also be installed directly:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install sima-cli
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Quick Start
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
sima-cli --help
|
|
99
|
+
sima-cli login
|
|
100
|
+
sima-cli version
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Use `--internal` or `SIMA_CLI_INTERNAL=1` when internal Artifactory resources are required:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
sima-cli --internal login
|
|
107
|
+
SIMA_CLI_INTERNAL=1 sima-cli install -v 2.1.1 sdk-extensions/model
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Common Workflows
|
|
111
|
+
|
|
112
|
+
Set up SDK containers:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
sima-cli sdk setup
|
|
116
|
+
sima-cli sdk neat
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Install a package from metadata:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
sima-cli install -v 2.1.1 sdk-extensions/model
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Download or install Neat artifacts:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
sima-cli neat download core main
|
|
129
|
+
sima-cli install --neat core main
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Update a DevKit:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
sima-cli update -v 2.1.1 -y
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Explore Model Zoo and App Zoo content:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
sima-cli modelzoo list
|
|
142
|
+
sima-cli appzoo list
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Top-Level Commands
|
|
146
|
+
|
|
147
|
+
| Command | Description | Docs |
|
|
148
|
+
| --- | --- | --- |
|
|
149
|
+
| `sima-cli appzoo` | Access sample apps from the App Zoo. | [docs](docs/sima-cli/commands/sima-cli-appzoo.md) |
|
|
150
|
+
| `sima-cli bootimg` | Prepare a bootable image for the SiMa DevKit. | [docs](docs/sima-cli/commands/sima-cli-bootimg.md) |
|
|
151
|
+
| `sima-cli device` | Discover nearby SiMa.ai devices on the local network. | [docs](docs/sima-cli/commands/sima-cli-device.md) |
|
|
152
|
+
| `sima-cli download` | Download a file or folder from a URL. | [docs](docs/sima-cli/commands/sima-cli-download.md) |
|
|
153
|
+
| `sima-cli install` | Install SiMa packages from metadata. | [docs](docs/sima-cli/commands/sima-cli-install.md) |
|
|
154
|
+
| `sima-cli login` | Authenticate with the SiMa Developer Portal. | [docs](docs/sima-cli/commands/sima-cli-login.md) |
|
|
155
|
+
| `sima-cli logout` | Remove cached credentials and config files. | [docs](docs/sima-cli/commands/sima-cli-logout.md) |
|
|
156
|
+
| `sima-cli mla` | Machine Learning Accelerator utilities. | [docs](docs/sima-cli/commands/sima-cli-mla.md) |
|
|
157
|
+
| `sima-cli modelzoo` | Access models from the Model Zoo. | [docs](docs/sima-cli/commands/sima-cli-modelzoo.md) |
|
|
158
|
+
| `sima-cli neat` | Discover, download, and install Neat build artifacts. | [docs](docs/sima-cli/commands/sima-cli-neat.md) |
|
|
159
|
+
| `sima-cli network` | Configure DevKit network settings. | [docs](docs/sima-cli/commands/sima-cli-network.md) |
|
|
160
|
+
| `sima-cli nvme` | Perform NVMe operations on the Modalix DevKit. | [docs](docs/sima-cli/commands/sima-cli-nvme.md) |
|
|
161
|
+
| `sima-cli packages` | Manage the local sima-cli package registry. | [docs](docs/sima-cli/commands/sima-cli-packages.md) |
|
|
162
|
+
| `sima-cli playbooks` | Install and manage coding-agent playbooks. | [docs](docs/sima-cli/commands/sima-cli-playbooks.md) |
|
|
163
|
+
| `sima-cli sdcard` | Prepare SD card storage. | [docs](docs/sima-cli/commands/sima-cli-sdcard.md) |
|
|
164
|
+
| `sima-cli sdk` | Manage and launch SDK container environments. | [docs](docs/sima-cli/commands/sima-cli-sdk.md) |
|
|
165
|
+
| `sima-cli selfupdate` | Update sima-cli manually. | [docs](docs/sima-cli/commands/sima-cli-selfupdate.md) |
|
|
166
|
+
| `sima-cli serial` | Connect to the UART serial console of a DevKit. | [docs](docs/sima-cli/commands/sima-cli-serial.md) |
|
|
167
|
+
| `sima-cli update` | Update a SiMa DevKit or remote device. | [docs](docs/sima-cli/commands/sima-cli-update.md) |
|
|
168
|
+
| `sima-cli version` | Show the installed CLI version. | [docs](docs/sima-cli/commands/sima-cli-version.md) |
|
|
169
|
+
|
|
170
|
+
## Development
|
|
171
|
+
|
|
172
|
+
Install development dependencies and run tests:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
pip install -e ".[dev]"
|
|
176
|
+
python -m pytest tests/unit
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Regenerate CLI documentation:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
python scripts/generate_cli_markdown_docs.py
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`build.sh` also regenerates the command docs before building the package.
|
|
186
|
+
|
|
187
|
+
## Requirements
|
|
188
|
+
|
|
189
|
+
- Python 3.8 or newer
|
|
190
|
+
- Docker for SDK container workflows
|
|
191
|
+
- DevKit connectivity for device update, serial, network, and boot-image workflows
|
|
192
|
+
|
|
193
|
+
For command-specific prerequisites, see the generated [command reference](docs/sima-cli/index.md).
|
|
194
|
+
|
|
195
|
+
## Support
|
|
196
|
+
|
|
197
|
+
For issues and feature requests, use the sima-cli GitHub repository or contact the SiMa.ai development team.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# sima-cli - SiMa Developer Portal CLI Tool
|
|
2
|
+
|
|
3
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
4
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
5
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
6
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
7
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
8
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
9
|
+
[](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
10
|
+
[&label=e2e%20macOS&logo=apple&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
11
|
+
[&label=e2e%20Windows&logo=windows&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
12
|
+
[&label=e2e%20Ubuntu%20x86&logo=ubuntu&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
13
|
+
[&label=e2e%20Ubuntu%20ARM64&logo=ubuntu&logoColor=white)](https://github.com/sima-neat/sima-cli/actions/workflows/vulcan-ci.yml)
|
|
14
|
+
|
|
15
|
+
`sima-cli` is the command-line interface for SiMa developer workflows. It handles authentication, SDK container setup, DevKit updates, package installation, artifact downloads, Model Zoo/App Zoo access, and related development utilities.
|
|
16
|
+
|
|
17
|
+
## Documentation
|
|
18
|
+
|
|
19
|
+
The full command reference is generated as Markdown under [docs/sima-cli](docs/sima-cli/index.md).
|
|
20
|
+
|
|
21
|
+
Use the generated docs for detailed options, arguments, subcommands, and full help text:
|
|
22
|
+
|
|
23
|
+
- [Complete command reference](docs/sima-cli/index.md)
|
|
24
|
+
- [Top-level command help](docs/sima-cli/commands/sima-cli.md)
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Install the latest `main` build:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
curl -fsSL https://artifacts.sima-neat.com/tools/sima-cli-install.py -o sima-cli-install.py
|
|
32
|
+
python3 sima-cli-install.py main latest
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Install interactively:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
python3 sima-cli-install.py
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Install a specific branch or release:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
python3 sima-cli-install.py feature/my-branch latest
|
|
45
|
+
python3 sima-cli-install.py v2.1.6 latest
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
On Windows PowerShell:
|
|
49
|
+
|
|
50
|
+
```powershell
|
|
51
|
+
Invoke-WebRequest https://artifacts.sima-neat.com/tools/sima-cli-install.py -OutFile sima-cli-install.py
|
|
52
|
+
python .\sima-cli-install.py main latest
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Public PyPI releases can also be installed directly:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install sima-cli
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
sima-cli --help
|
|
65
|
+
sima-cli login
|
|
66
|
+
sima-cli version
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use `--internal` or `SIMA_CLI_INTERNAL=1` when internal Artifactory resources are required:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
sima-cli --internal login
|
|
73
|
+
SIMA_CLI_INTERNAL=1 sima-cli install -v 2.1.1 sdk-extensions/model
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Common Workflows
|
|
77
|
+
|
|
78
|
+
Set up SDK containers:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
sima-cli sdk setup
|
|
82
|
+
sima-cli sdk neat
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Install a package from metadata:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
sima-cli install -v 2.1.1 sdk-extensions/model
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Download or install Neat artifacts:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
sima-cli neat download core main
|
|
95
|
+
sima-cli install --neat core main
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Update a DevKit:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
sima-cli update -v 2.1.1 -y
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Explore Model Zoo and App Zoo content:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
sima-cli modelzoo list
|
|
108
|
+
sima-cli appzoo list
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Top-Level Commands
|
|
112
|
+
|
|
113
|
+
| Command | Description | Docs |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| `sima-cli appzoo` | Access sample apps from the App Zoo. | [docs](docs/sima-cli/commands/sima-cli-appzoo.md) |
|
|
116
|
+
| `sima-cli bootimg` | Prepare a bootable image for the SiMa DevKit. | [docs](docs/sima-cli/commands/sima-cli-bootimg.md) |
|
|
117
|
+
| `sima-cli device` | Discover nearby SiMa.ai devices on the local network. | [docs](docs/sima-cli/commands/sima-cli-device.md) |
|
|
118
|
+
| `sima-cli download` | Download a file or folder from a URL. | [docs](docs/sima-cli/commands/sima-cli-download.md) |
|
|
119
|
+
| `sima-cli install` | Install SiMa packages from metadata. | [docs](docs/sima-cli/commands/sima-cli-install.md) |
|
|
120
|
+
| `sima-cli login` | Authenticate with the SiMa Developer Portal. | [docs](docs/sima-cli/commands/sima-cli-login.md) |
|
|
121
|
+
| `sima-cli logout` | Remove cached credentials and config files. | [docs](docs/sima-cli/commands/sima-cli-logout.md) |
|
|
122
|
+
| `sima-cli mla` | Machine Learning Accelerator utilities. | [docs](docs/sima-cli/commands/sima-cli-mla.md) |
|
|
123
|
+
| `sima-cli modelzoo` | Access models from the Model Zoo. | [docs](docs/sima-cli/commands/sima-cli-modelzoo.md) |
|
|
124
|
+
| `sima-cli neat` | Discover, download, and install Neat build artifacts. | [docs](docs/sima-cli/commands/sima-cli-neat.md) |
|
|
125
|
+
| `sima-cli network` | Configure DevKit network settings. | [docs](docs/sima-cli/commands/sima-cli-network.md) |
|
|
126
|
+
| `sima-cli nvme` | Perform NVMe operations on the Modalix DevKit. | [docs](docs/sima-cli/commands/sima-cli-nvme.md) |
|
|
127
|
+
| `sima-cli packages` | Manage the local sima-cli package registry. | [docs](docs/sima-cli/commands/sima-cli-packages.md) |
|
|
128
|
+
| `sima-cli playbooks` | Install and manage coding-agent playbooks. | [docs](docs/sima-cli/commands/sima-cli-playbooks.md) |
|
|
129
|
+
| `sima-cli sdcard` | Prepare SD card storage. | [docs](docs/sima-cli/commands/sima-cli-sdcard.md) |
|
|
130
|
+
| `sima-cli sdk` | Manage and launch SDK container environments. | [docs](docs/sima-cli/commands/sima-cli-sdk.md) |
|
|
131
|
+
| `sima-cli selfupdate` | Update sima-cli manually. | [docs](docs/sima-cli/commands/sima-cli-selfupdate.md) |
|
|
132
|
+
| `sima-cli serial` | Connect to the UART serial console of a DevKit. | [docs](docs/sima-cli/commands/sima-cli-serial.md) |
|
|
133
|
+
| `sima-cli update` | Update a SiMa DevKit or remote device. | [docs](docs/sima-cli/commands/sima-cli-update.md) |
|
|
134
|
+
| `sima-cli version` | Show the installed CLI version. | [docs](docs/sima-cli/commands/sima-cli-version.md) |
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
Install development dependencies and run tests:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pip install -e ".[dev]"
|
|
142
|
+
python -m pytest tests/unit
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Regenerate CLI documentation:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
python scripts/generate_cli_markdown_docs.py
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`build.sh` also regenerates the command docs before building the package.
|
|
152
|
+
|
|
153
|
+
## Requirements
|
|
154
|
+
|
|
155
|
+
- Python 3.8 or newer
|
|
156
|
+
- Docker for SDK container workflows
|
|
157
|
+
- DevKit connectivity for device update, serial, network, and boot-image workflows
|
|
158
|
+
|
|
159
|
+
For command-specific prerequisites, see the generated [command reference](docs/sima-cli/index.md).
|
|
160
|
+
|
|
161
|
+
## Support
|
|
162
|
+
|
|
163
|
+
For issues and feature requests, use the sima-cli GitHub repository or contact the SiMa.ai development team.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sima-cli"
|
|
7
|
-
version = "2.1.
|
|
7
|
+
version = "2.1.10"
|
|
8
8
|
description = "CLI tool for SiMa Developer Portal to download models, firmware, and apps."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -23,7 +23,7 @@ classifiers = [
|
|
|
23
23
|
|
|
24
24
|
dependencies = [
|
|
25
25
|
"click>=8.0",
|
|
26
|
-
"requests>=2.
|
|
26
|
+
"requests>=2.32.4,<3.0",
|
|
27
27
|
"tqdm>=4.64",
|
|
28
28
|
"pyyaml>=6.0",
|
|
29
29
|
"paramiko>=3.5.1",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# sima_cli/__version__.py
|
|
2
|
-
__version__ = "2.1.
|
|
2
|
+
__version__ = "2.1.10"
|
|
@@ -15,7 +15,7 @@ import base64
|
|
|
15
15
|
import requests
|
|
16
16
|
import webbrowser
|
|
17
17
|
import click
|
|
18
|
-
from typing import Dict, Optional
|
|
18
|
+
from typing import Dict, Iterable, Optional, Tuple
|
|
19
19
|
|
|
20
20
|
from sima_cli.utils.config_loader import load_resource_config
|
|
21
21
|
|
|
@@ -24,6 +24,16 @@ from sima_cli.utils.config_loader import load_resource_config
|
|
|
24
24
|
# ─────────────────────────────────────────────
|
|
25
25
|
HOME_DIR = os.path.expanduser("~/.sima-cli")
|
|
26
26
|
TOKEN_FILE = os.path.join(HOME_DIR, ".tokens.json")
|
|
27
|
+
COOKIE_FILE = os.path.join(HOME_DIR, ".sima-cli-cookies.txt")
|
|
28
|
+
CSRF_FILE = os.path.join(HOME_DIR, ".sima-cli-csrf.json")
|
|
29
|
+
PROD_USERINFO_AUDIENCE = "https://sima-ai.us.auth0.com/userinfo"
|
|
30
|
+
STAGING_USERINFO_AUDIENCE = "https://dev-d3sxf54xfkcifph2.us.auth0.com/userinfo"
|
|
31
|
+
USERINFO_AUDIENCE = PROD_USERINFO_AUDIENCE
|
|
32
|
+
LATEST_EULA_GRANT = "LatestEULA"
|
|
33
|
+
DOC_ACCESS_GRANT = "DocsAccess"
|
|
34
|
+
DOC_ACCESS_GRANT_ALIASES = (DOC_ACCESS_GRANT, "DocAccess")
|
|
35
|
+
PROD_DISCOURSE_URL = "https://developer.sima.ai/login"
|
|
36
|
+
STAGING_DISCOURSE_URL = "https://discourse-dev.sima.ai/login"
|
|
27
37
|
|
|
28
38
|
# ─────────────────────────────────────────────
|
|
29
39
|
# Configuration loader
|
|
@@ -81,6 +91,16 @@ def load_tokens() -> Optional[Dict]:
|
|
|
81
91
|
return None
|
|
82
92
|
|
|
83
93
|
|
|
94
|
+
def clear_external_login_state():
|
|
95
|
+
"""Remove cached external-auth state so the next login starts cleanly."""
|
|
96
|
+
for path in (TOKEN_FILE, COOKIE_FILE, CSRF_FILE):
|
|
97
|
+
if os.path.exists(path):
|
|
98
|
+
try:
|
|
99
|
+
os.remove(path)
|
|
100
|
+
except Exception as e:
|
|
101
|
+
print(f"⚠️ Failed to delete {path}: {e}")
|
|
102
|
+
|
|
103
|
+
|
|
84
104
|
def is_token_valid(tokens: dict) -> bool:
|
|
85
105
|
"""Check if access token still valid based on expires_in field."""
|
|
86
106
|
if not tokens:
|
|
@@ -131,6 +151,123 @@ def is_browser_available():
|
|
|
131
151
|
except webbrowser.Error:
|
|
132
152
|
return False
|
|
133
153
|
|
|
154
|
+
|
|
155
|
+
def _discourse_sign_in_url() -> str:
|
|
156
|
+
if os.getenv("USE_STAGING_DEV_PORTAL", "false").lower() in ("1", "true", "yes"):
|
|
157
|
+
return STAGING_DISCOURSE_URL
|
|
158
|
+
return PROD_DISCOURSE_URL
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _expected_userinfo_audience() -> str:
|
|
162
|
+
if os.getenv("USE_STAGING_DEV_PORTAL", "false").lower() in ("1", "true", "yes"):
|
|
163
|
+
return STAGING_USERINFO_AUDIENCE
|
|
164
|
+
return PROD_USERINFO_AUDIENCE
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _as_iterable(value) -> Iterable:
|
|
168
|
+
if value is None:
|
|
169
|
+
return []
|
|
170
|
+
if isinstance(value, (list, tuple, set)):
|
|
171
|
+
return value
|
|
172
|
+
return [value]
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def _access_token_claims(tokens: dict) -> dict:
|
|
176
|
+
return decode_jwt_payload(tokens.get("access_token", ""))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def _access_token_has_userinfo_audience(claims: dict) -> bool:
|
|
180
|
+
return _expected_userinfo_audience() in _as_iterable(claims.get("aud"))
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def _access_token_has_grant(claims: dict, grant: str) -> bool:
|
|
184
|
+
grant_names = DOC_ACCESS_GRANT_ALIASES if grant in DOC_ACCESS_GRANT_ALIASES else (grant,)
|
|
185
|
+
for claim_name, claim_value in claims.items():
|
|
186
|
+
if claim_name in ("permissions", "grants", "roles") or claim_name.endswith(("/permissions", "/grants", "/roles")):
|
|
187
|
+
if any(grant_name in _as_iterable(claim_value) for grant_name in grant_names):
|
|
188
|
+
return True
|
|
189
|
+
|
|
190
|
+
scope = claims.get("scope")
|
|
191
|
+
if isinstance(scope, str) and any(grant_name in scope.split() for grant_name in grant_names):
|
|
192
|
+
return True
|
|
193
|
+
|
|
194
|
+
return False
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def access_token_has_doc_access(tokens: dict) -> bool:
|
|
198
|
+
return _access_token_has_grant(_access_token_claims(tokens), DOC_ACCESS_GRANT)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def access_token_has_latest_eula(tokens: dict) -> bool:
|
|
202
|
+
return _access_token_has_grant(_access_token_claims(tokens), LATEST_EULA_GRANT)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _validate_access_token_requirements(tokens: dict) -> Tuple[bool, Dict[str, bool]]:
|
|
206
|
+
claims = _access_token_claims(tokens)
|
|
207
|
+
checks = {
|
|
208
|
+
"doc_access": _access_token_has_grant(claims, DOC_ACCESS_GRANT),
|
|
209
|
+
"latest_eula": _access_token_has_grant(claims, LATEST_EULA_GRANT),
|
|
210
|
+
"userinfo_audience": _access_token_has_userinfo_audience(claims),
|
|
211
|
+
}
|
|
212
|
+
return checks["doc_access"] and checks["latest_eula"] and checks["userinfo_audience"], checks
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def _prompt_for_discourse_sign_in(checks: Dict[str, bool]) -> bool:
|
|
216
|
+
discourse_url = _discourse_sign_in_url()
|
|
217
|
+
missing = []
|
|
218
|
+
if not checks.get("latest_eula"):
|
|
219
|
+
missing.append("LatestEULA grant")
|
|
220
|
+
if not checks.get("userinfo_audience"):
|
|
221
|
+
missing.append(f"{_expected_userinfo_audience()} audience")
|
|
222
|
+
|
|
223
|
+
click.echo("")
|
|
224
|
+
click.secho("Developer Portal sign-in is required before sima-cli can continue.", fg="yellow")
|
|
225
|
+
if missing:
|
|
226
|
+
click.echo(f"Missing from the access token: {', '.join(missing)}.")
|
|
227
|
+
click.echo("Please sign in to Discourse / Developer Portal and accept the EULA if prompted.")
|
|
228
|
+
|
|
229
|
+
if is_browser_available():
|
|
230
|
+
click.echo(f"Opening sign-in page: {click.style(discourse_url, fg='cyan', bold=True)}")
|
|
231
|
+
try:
|
|
232
|
+
webbrowser.open(discourse_url)
|
|
233
|
+
except Exception:
|
|
234
|
+
click.echo("Browser could not be opened automatically. Open this link manually:")
|
|
235
|
+
click.secho(discourse_url, fg="cyan", bold=True)
|
|
236
|
+
else:
|
|
237
|
+
click.echo("Browser not available. Open this link manually:")
|
|
238
|
+
click.secho(discourse_url, fg="cyan", bold=True)
|
|
239
|
+
|
|
240
|
+
return click.confirm("Have you signed in to Discourse / Developer Portal?", default=True)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def _ensure_access_token_requirements(tokens: dict, auth_cfg: dict) -> Optional[dict]:
|
|
244
|
+
while True:
|
|
245
|
+
valid, checks = _validate_access_token_requirements(tokens)
|
|
246
|
+
if valid:
|
|
247
|
+
return tokens
|
|
248
|
+
if not checks.get("doc_access"):
|
|
249
|
+
return tokens
|
|
250
|
+
|
|
251
|
+
if not _prompt_for_discourse_sign_in(checks):
|
|
252
|
+
clear_external_login_state()
|
|
253
|
+
click.echo("Logged out. Run `sima-cli login` again after signing in to Developer Portal.")
|
|
254
|
+
return None
|
|
255
|
+
|
|
256
|
+
refresh_token = tokens.get("refresh_token")
|
|
257
|
+
if not refresh_token:
|
|
258
|
+
click.echo("Unable to refresh your access token after Developer Portal sign-in.")
|
|
259
|
+
clear_external_login_state()
|
|
260
|
+
click.echo("Logged out. Run `sima-cli login` again.")
|
|
261
|
+
return None
|
|
262
|
+
|
|
263
|
+
refreshed = refresh_access_token(auth_cfg, refresh_token)
|
|
264
|
+
if not refreshed:
|
|
265
|
+
clear_external_login_state()
|
|
266
|
+
click.echo("Logged out. Run `sima-cli login` again.")
|
|
267
|
+
return None
|
|
268
|
+
|
|
269
|
+
tokens = refreshed
|
|
270
|
+
|
|
134
271
|
def request_device_code(auth_cfg):
|
|
135
272
|
"""Step 1: Request device code from Auth0."""
|
|
136
273
|
data = {
|
|
@@ -269,16 +406,25 @@ def get_or_refresh_tokens(force=False):
|
|
|
269
406
|
tokens = load_tokens()
|
|
270
407
|
|
|
271
408
|
if tokens and is_token_valid(tokens) and not force:
|
|
272
|
-
|
|
409
|
+
tokens = _ensure_access_token_requirements(tokens, auth_cfg)
|
|
410
|
+
if tokens:
|
|
411
|
+
return tokens
|
|
412
|
+
return None
|
|
273
413
|
|
|
274
414
|
if tokens and tokens.get("refresh_token"):
|
|
275
415
|
refreshed = refresh_access_token(auth_cfg, tokens["refresh_token"])
|
|
276
416
|
if refreshed:
|
|
277
|
-
|
|
278
|
-
|
|
417
|
+
refreshed = _ensure_access_token_requirements(refreshed, auth_cfg)
|
|
418
|
+
if refreshed:
|
|
419
|
+
print_welcome_message(refreshed)
|
|
420
|
+
return refreshed
|
|
421
|
+
return None
|
|
279
422
|
print("⚠️ Refresh failed, falling back to new login.")
|
|
280
423
|
|
|
281
424
|
new_tokens = login_auth0(auth_cfg)
|
|
425
|
+
new_tokens = _ensure_access_token_requirements(new_tokens, auth_cfg)
|
|
426
|
+
if not new_tokens:
|
|
427
|
+
return None
|
|
282
428
|
print_welcome_message(new_tokens)
|
|
283
429
|
return new_tokens
|
|
284
430
|
|