shellscripts 0.24.1__py3-none-any.whl → 0.25.1__py3-none-any.whl
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.
- shell_scripts/__init__.py +1 -1
- shell_scripts/commands/__init__.py +1 -1
- shell_scripts/commands/agy.py +81 -0
- shell_scripts/config.py +2 -2
- shell_scripts/core.py +38 -13
- shell_scripts/utils.py +1 -1
- {shellscripts-0.24.1.dist-info → shellscripts-0.25.1.dist-info}/METADATA +22 -23
- {shellscripts-0.24.1.dist-info → shellscripts-0.25.1.dist-info}/RECORD +12 -12
- shell_scripts/commands/ai_install.py +0 -453
- {shellscripts-0.24.1.dist-info → shellscripts-0.25.1.dist-info}/WHEEL +0 -0
- {shellscripts-0.24.1.dist-info → shellscripts-0.25.1.dist-info}/entry_points.txt +0 -0
- {shellscripts-0.24.1.dist-info → shellscripts-0.25.1.dist-info}/licenses/LICENSE +0 -0
- {shellscripts-0.24.1.dist-info → shellscripts-0.25.1.dist-info}/top_level.txt +0 -0
shell_scripts/__init__.py
CHANGED
|
@@ -15,7 +15,7 @@ from types import ModuleType
|
|
|
15
15
|
# Removing an entry removes command discoverability and dispatch reachability.
|
|
16
16
|
# @satisfies PRJ-003, DES-001
|
|
17
17
|
_COMMAND_MODULES = {
|
|
18
|
-
"
|
|
18
|
+
"agy": "shell_scripts.commands.agy",
|
|
19
19
|
"clean": "shell_scripts.commands.clean",
|
|
20
20
|
"claude": "shell_scripts.commands.claude",
|
|
21
21
|
"codex": "shell_scripts.commands.codex",
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""@brief Antigravity CLI launcher in project context.
|
|
3
|
+
|
|
4
|
+
@details Ensures project-root prerequisite and executable availability before
|
|
5
|
+
blocking subprocess invocation of `agy` in YOLO mode
|
|
6
|
+
(`--dangerously-skip-permissions`); inline help lists the registered AI CLI
|
|
7
|
+
launch commands in alphabetical order.
|
|
8
|
+
@satisfies REQ-085, REQ-086, REQ-055, REQ-056, REQ-064
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import subprocess
|
|
12
|
+
|
|
13
|
+
from shell_scripts.utils import require_project_root, require_commands
|
|
14
|
+
|
|
15
|
+
## @var PROGRAM
|
|
16
|
+
# @brief Base CLI program name used in help output.
|
|
17
|
+
# @details Constant identifier for usage-line rendering in command help.
|
|
18
|
+
PROGRAM = "shellscripts"
|
|
19
|
+
## @var DESCRIPTION
|
|
20
|
+
# @brief One-line command description for dispatcher help surfaces.
|
|
21
|
+
# @details Exposed by command registry introspection (`get_all_commands`).
|
|
22
|
+
DESCRIPTION = "Launch Antigravity CLI in the project context."
|
|
23
|
+
## @var AI_CLI_COMMANDS
|
|
24
|
+
# @brief Alphabetically sorted AI CLI launch command tokens rendered in inline help.
|
|
25
|
+
# @details Derived through `sorted()` at import time so token-set edits preserve
|
|
26
|
+
# the REQ-086 alphabetical rendering contract; contains launcher commands only
|
|
27
|
+
# and excludes installer command tokens.
|
|
28
|
+
# @satisfies REQ-086
|
|
29
|
+
AI_CLI_COMMANDS = tuple(sorted((
|
|
30
|
+
"agy",
|
|
31
|
+
"claude",
|
|
32
|
+
"codex",
|
|
33
|
+
"copilot",
|
|
34
|
+
"gemini",
|
|
35
|
+
"kiro",
|
|
36
|
+
"opencode",
|
|
37
|
+
"pi",
|
|
38
|
+
)))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def print_help(version):
|
|
42
|
+
"""@brief Print command-specific help for `agy`.
|
|
43
|
+
|
|
44
|
+
@details Emits usage and pass-through argument behavior, then renders the
|
|
45
|
+
AI CLI launch command tokens from `AI_CLI_COMMANDS`, one per line, in
|
|
46
|
+
ascending alphabetical order; does not mutate process state.
|
|
47
|
+
Time complexity O(n) over registered AI CLI token count.
|
|
48
|
+
@param version {str} CLI version string propagated by dispatcher.
|
|
49
|
+
@return {None} Writes help text to stdout.
|
|
50
|
+
@satisfies DES-008, REQ-086
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
print(f"Usage: {PROGRAM} agy [args...] ({version})")
|
|
54
|
+
print()
|
|
55
|
+
print("agy options:")
|
|
56
|
+
print(" All arguments are passed through to the Antigravity CLI.")
|
|
57
|
+
print(" --help - Show this help message.")
|
|
58
|
+
print()
|
|
59
|
+
print("Available AI CLIs (alphabetical order):")
|
|
60
|
+
for command_token in AI_CLI_COMMANDS:
|
|
61
|
+
print(f" {command_token}")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def run(args):
|
|
65
|
+
"""@brief Launch Antigravity CLI in YOLO mode after executable validation.
|
|
66
|
+
|
|
67
|
+
@details Resolves project root, builds the fixed command vector
|
|
68
|
+
`[agy, --dangerously-skip-permissions] + args`, resolves the executable
|
|
69
|
+
path via `require_commands`, then executes it through blocking
|
|
70
|
+
`subprocess.run` with inherited stdio. Time complexity O(n) over forwarded
|
|
71
|
+
argument count.
|
|
72
|
+
@param args {list[str]} Additional CLI args forwarded to Antigravity.
|
|
73
|
+
@return {int} Child process return code.
|
|
74
|
+
@satisfies REQ-085, REQ-055, REQ-056, REQ-064
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
require_project_root()
|
|
78
|
+
cmd = ["agy", "--dangerously-skip-permissions"] + args
|
|
79
|
+
cmd[0] = require_commands(cmd[0])
|
|
80
|
+
result = subprocess.run(cmd)
|
|
81
|
+
return result.returncode
|
shell_scripts/config.py
CHANGED
|
@@ -25,9 +25,9 @@ from shell_scripts.utils import print_warn
|
|
|
25
25
|
# @satisfies DES-011, DES-012
|
|
26
26
|
DEFAULT_RUNTIME_CONFIG: dict[str, Any] = {
|
|
27
27
|
"management": {
|
|
28
|
-
"upgrade": "uv tool install shellscripts
|
|
28
|
+
"upgrade": "uv tool install shellscripts",
|
|
29
29
|
"upgrade_develop": (
|
|
30
|
-
"uv tool install shellscripts
|
|
30
|
+
"uv tool install shellscripts "
|
|
31
31
|
"--from git+https://github.com/Ogekuri/shellScripts.git@{tag}"
|
|
32
32
|
),
|
|
33
33
|
"uninstall": "uv tool uninstall shellscripts",
|
shell_scripts/core.py
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
@details Provides global help rendering, management command execution
|
|
5
5
|
(`--version`, `--ver`, `--upgrade`, `--uninstall`, `--write-config`,
|
|
6
|
-
`--develop`/`--dev` upgrade selector),
|
|
7
|
-
configuration bootstrap, and subcommand delegation to lazily imported
|
|
8
|
-
|
|
6
|
+
`--develop`/`--dev` upgrade selector, `--force` forced-reinstall selector),
|
|
7
|
+
runtime configuration bootstrap, and subcommand delegation to lazily imported
|
|
8
|
+
modules.
|
|
9
|
+
@satisfies PRJ-001, PRJ-002, PRJ-003, REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-045, REQ-046, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052, REQ-053, REQ-054, REQ-056, REQ-064, REQ-065, REQ-066, REQ-068, REQ-069, REQ-075, REQ-076, REQ-077, REQ-078, REQ-087, REQ-088, REQ-089, REQ-090
|
|
9
10
|
"""
|
|
10
11
|
|
|
11
12
|
import sys
|
|
@@ -37,6 +38,14 @@ PROGRAM = "shellscripts"
|
|
|
37
38
|
# @satisfies REQ-066
|
|
38
39
|
HELP_COMMAND_COLUMN_WIDTH = 16
|
|
39
40
|
|
|
41
|
+
## @var FORCED_REINSTALL_OPTIONS
|
|
42
|
+
# @brief Option suffix appended to upgrade commands when `--force` is active.
|
|
43
|
+
# @details Standard forced-reinstall options for `uv tool install`: replace
|
|
44
|
+
# the installed tool entry, reinstall the package, and refresh cached remote
|
|
45
|
+
# metadata so the upgrade performs a full re-download and reinstallation.
|
|
46
|
+
# @satisfies REQ-088, REQ-089
|
|
47
|
+
FORCED_REINSTALL_OPTIONS = "--force --reinstall --refresh"
|
|
48
|
+
|
|
40
49
|
## @var HELP_SECTION_COMMANDS
|
|
41
50
|
# @brief Ordered command groups for global help rendering.
|
|
42
51
|
# @details Defines deterministic section order and command-token order used by
|
|
@@ -67,7 +76,7 @@ HELP_SECTION_COMMANDS = (
|
|
|
67
76
|
(
|
|
68
77
|
"AI Commands",
|
|
69
78
|
(
|
|
70
|
-
"
|
|
79
|
+
"agy",
|
|
71
80
|
"claude",
|
|
72
81
|
"codex",
|
|
73
82
|
"copilot",
|
|
@@ -142,6 +151,10 @@ def print_help(command_name=None):
|
|
|
142
151
|
" --dev - With --upgrade: upgrade from the latest GitHub release tag"
|
|
143
152
|
)
|
|
144
153
|
print(" instead of PyPI (alias: --develop).")
|
|
154
|
+
print(
|
|
155
|
+
" --force - With --upgrade: force download and complete reinstallation"
|
|
156
|
+
)
|
|
157
|
+
print(" (appends --force --reinstall --refresh).")
|
|
145
158
|
print(
|
|
146
159
|
f" --uninstall - Uninstall {PROGRAM} on Linux; print manual command elsewhere."
|
|
147
160
|
)
|
|
@@ -181,18 +194,21 @@ def _build_develop_upgrade_command(latest_tag: str) -> str:
|
|
|
181
194
|
return template.replace("{tag}", latest_tag)
|
|
182
195
|
|
|
183
196
|
|
|
184
|
-
def do_upgrade(develop: bool = False) -> int:
|
|
197
|
+
def do_upgrade(develop: bool = False, force: bool = False) -> int:
|
|
185
198
|
"""@brief Execute Linux-only upgrade command resolved from runtime config.
|
|
186
199
|
|
|
187
200
|
@details Reads management command string from runtime config key
|
|
188
201
|
`management.upgrade` (PyPI default) or, when `develop` is set, resolves
|
|
189
202
|
the latest GitHub release tag and composes the tag-pinned upgrade command;
|
|
190
|
-
|
|
191
|
-
command on
|
|
192
|
-
|
|
203
|
+
appends ` --force --reinstall --refresh` to the resolved command when
|
|
204
|
+
`force` is set; executes the composed command on Linux via shell
|
|
205
|
+
invocation and prints the manual fallback command on non-Linux systems.
|
|
206
|
+
Complexity O(n) over the composed command string length.
|
|
207
|
+
@param develop {bool} Select upgrade from the latest GitHub release tag.
|
|
208
|
+
@param force {bool} Append forced-reinstall options to the upgrade command.
|
|
193
209
|
@return {int} `1` when develop tag resolution fails; subprocess return code
|
|
194
210
|
on Linux; `0` on non-Linux fallback.
|
|
195
|
-
@satisfies REQ-004, REQ-076, REQ-078, REQ-045, REQ-056
|
|
211
|
+
@satisfies REQ-004, REQ-076, REQ-078, REQ-087, REQ-088, REQ-089, REQ-045, REQ-056
|
|
196
212
|
"""
|
|
197
213
|
|
|
198
214
|
if develop:
|
|
@@ -204,6 +220,8 @@ def do_upgrade(develop: bool = False) -> int:
|
|
|
204
220
|
install_cmd = _build_develop_upgrade_command(latest_tag)
|
|
205
221
|
else:
|
|
206
222
|
install_cmd = get_management_command("upgrade")
|
|
223
|
+
if force:
|
|
224
|
+
install_cmd = f"{install_cmd} {FORCED_REINSTALL_OPTIONS}"
|
|
207
225
|
if is_linux():
|
|
208
226
|
require_shell_command_executables(install_cmd)
|
|
209
227
|
print(f"Upgrading {PROGRAM}...")
|
|
@@ -261,12 +279,14 @@ def main():
|
|
|
261
279
|
@details Performs runtime OS detection, update check, runtime configuration
|
|
262
280
|
load, and argument dispatch through management flags (`--version` prints
|
|
263
281
|
installed plus PyPI/GitHub latest versions; `--upgrade` upgrades from PyPI
|
|
264
|
-
or, with `--develop`/`--dev`, from the latest GitHub release tag
|
|
265
|
-
|
|
282
|
+
or, with `--develop`/`--dev`, from the latest GitHub release tag; `--force`
|
|
283
|
+
appends forced-reinstall options to the selected upgrade command; bare
|
|
284
|
+
`--develop`/`--dev`/`--force` selectors are rejected) and subcommands,
|
|
285
|
+
then restores terminal raw/cbreak and disables legacy+xterm
|
|
266
286
|
mouse-tracking modes (`?9l`, `?1000l`, `?1001l`, `?1002l`, `?1003l`,
|
|
267
287
|
`?1004l`, `?1005l`, `?1006l`, `?1007l`, `?1015l`, `?1016l`) before exit.
|
|
268
288
|
@return {int} Process-compatible return code for caller (`sys.exit`).
|
|
269
|
-
@satisfies PRJ-001, REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-045, REQ-046, REQ-047, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052, REQ-053, REQ-054, REQ-064, REQ-065, REQ-066, REQ-068, REQ-069, REQ-075, REQ-076, REQ-077, REQ-078
|
|
289
|
+
@satisfies PRJ-001, REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-045, REQ-046, REQ-047, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052, REQ-053, REQ-054, REQ-064, REQ-065, REQ-066, REQ-068, REQ-069, REQ-075, REQ-076, REQ-077, REQ-078, REQ-087, REQ-088, REQ-089, REQ-090
|
|
270
290
|
"""
|
|
271
291
|
saved_tty = capture_terminal_state()
|
|
272
292
|
try:
|
|
@@ -289,12 +309,17 @@ def main():
|
|
|
289
309
|
|
|
290
310
|
if first_arg == "--upgrade":
|
|
291
311
|
develop = any(arg in ("--develop", "--dev") for arg in args[1:])
|
|
292
|
-
|
|
312
|
+
force = "--force" in args[1:]
|
|
313
|
+
return do_upgrade(develop=develop, force=force)
|
|
293
314
|
|
|
294
315
|
if first_arg in ("--develop", "--dev"):
|
|
295
316
|
print_error("--develop/--dev must be used together with --upgrade.")
|
|
296
317
|
return 1
|
|
297
318
|
|
|
319
|
+
if first_arg == "--force":
|
|
320
|
+
print_error("--force must be used together with --upgrade.")
|
|
321
|
+
return 1
|
|
322
|
+
|
|
298
323
|
if first_arg == "--uninstall":
|
|
299
324
|
return do_uninstall()
|
|
300
325
|
|
shell_scripts/utils.py
CHANGED
|
@@ -155,7 +155,7 @@ def is_windows():
|
|
|
155
155
|
|
|
156
156
|
@details Evaluates cached runtime token from `get_runtime_os`.
|
|
157
157
|
@return {bool} `True` when runtime OS is Windows; otherwise `False`.
|
|
158
|
-
@satisfies
|
|
158
|
+
@satisfies REQ-047
|
|
159
159
|
"""
|
|
160
160
|
|
|
161
161
|
return get_runtime_os() == "windows"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shellscripts
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.1
|
|
4
4
|
Summary: Execute useful shell scripts via an uvx-compatible CLI interface.
|
|
5
5
|
Author: Francesco Rolando
|
|
6
6
|
License-Expression: GPL-3.0-only
|
|
@@ -31,7 +31,7 @@ Dynamic: license-file
|
|
|
31
31
|
> * **No Support or Feature Requests:** Please **do not** open issues, bug reports, or feature requests. They will not be addressed or accepted at this stage of development.
|
|
32
32
|
> * **No Warranty:** This software is provided **"AS IS"**, without warranty of any kind, express or implied. You may use it strictly for **testing and evaluation purposes** at your own sole risk.
|
|
33
33
|
|
|
34
|
-
# s/shellScripts (0.
|
|
34
|
+
# s/shellScripts (0.25.1)
|
|
35
35
|
|
|
36
36
|
<p align="center">
|
|
37
37
|
<img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
|
|
@@ -65,8 +65,7 @@ PDF/DICOM utilities, development helpers, and editor integrations, exposed throu
|
|
|
65
65
|
|
|
66
66
|
## Feature Highlights
|
|
67
67
|
- Single CLI entrypoint with command dispatch and grouped built-in help (`shellscripts` and alias `s`).
|
|
68
|
-
-
|
|
69
|
-
- Project-context launchers for AI CLIs (`claude`, `codex`, `copilot`, `gemini`, `kiro`, `opencode`, `pi`) and IDEs (`vscode`, `vsinsider`).
|
|
68
|
+
- Project-context launchers for AI CLIs (`agy`, `claude`, `codex`, `copilot`, `gemini`, `kiro`, `opencode`, `pi`) and IDEs (`vscode`, `vsinsider`).
|
|
70
69
|
- PDF workflow commands for crop, merge, split, TOC cleanup, and tiling.
|
|
71
70
|
- DICOM helpers (`dicom2jpg`, `dicomviewer`) and video transcoders (`video2h264`, `video2h265`).
|
|
72
71
|
- Project maintenance and automation commands (`req`, `clean`, `venv`, `tests`, `doxygen`, `ubuntu-dark-theme`).
|
|
@@ -77,9 +76,8 @@ PDF/DICOM utilities, development helpers, and editor integrations, exposed throu
|
|
|
77
76
|
|
|
78
77
|
- Python `>=3.11`.
|
|
79
78
|
- Astral `uv` is required for install and runtime flows (`uv tool install`, `uvx`, `uv run`).
|
|
80
|
-
- Git is required for commands that enforce repository-root execution (`claude`, `codex`, `copilot`, `gemini`, `kiro`, `opencode`, `pi`, `clean`, `venv`, `tests`, `doxygen`, `vscode`, `vsinsider`).
|
|
79
|
+
- Git is required for commands that enforce repository-root execution (`agy`, `claude`, `codex`, `copilot`, `gemini`, `kiro`, `opencode`, `pi`, `clean`, `venv`, `tests`, `doxygen`, `vscode`, `vsinsider`).
|
|
81
80
|
- Command-specific external tools are required only for related commands:
|
|
82
|
-
- `npm` (and `sudo` on non-Windows) for npm-based `ai-install` targets.
|
|
83
81
|
- `req` for the `req` command.
|
|
84
82
|
- `doxygen` (plus optional `make` and `pdflatex`) for `doxygen`.
|
|
85
83
|
- `gs`, `pdfinfo`, `qpdf`, `pdftk`, `plakativ` for PDF commands.
|
|
@@ -108,6 +106,12 @@ Upgrade to the latest published PyPI release:
|
|
|
108
106
|
s --upgrade
|
|
109
107
|
```
|
|
110
108
|
|
|
109
|
+
Force a complete re-download and reinstallation by appending the forced-reinstall options (`--force --reinstall --refresh`) to the configured upgrade command:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
s --upgrade --force
|
|
113
|
+
```
|
|
114
|
+
|
|
111
115
|
|
|
112
116
|
### Run Without Installing (uvx)
|
|
113
117
|
|
|
@@ -147,6 +151,12 @@ s --upgrade --dev
|
|
|
147
151
|
s --upgrade --develop
|
|
148
152
|
```
|
|
149
153
|
|
|
154
|
+
Add `--force` to force a complete re-download and reinstallation of the tagged release:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
s --upgrade --develop --force
|
|
158
|
+
```
|
|
159
|
+
|
|
150
160
|
|
|
151
161
|
## Management Commands
|
|
152
162
|
|
|
@@ -163,6 +173,7 @@ Built-in management flags:
|
|
|
163
173
|
- `--help` : show full help or command help (`shellscripts --help <command>`).
|
|
164
174
|
- `--version` / `--ver` : print the installed version plus the latest versions available on PyPI and GitHub.
|
|
165
175
|
- `--upgrade` : run the configured upgrade command automatically on Linux (installs the latest PyPI release by default), otherwise print the manual command.
|
|
176
|
+
- `--upgrade --force` : force download and complete reinstallation by appending `--force --reinstall --refresh` to the `--upgrade` or `--upgrade --dev`/`--upgrade --develop` command.
|
|
166
177
|
- `--upgrade --dev` / `--upgrade --develop` : upgrade from the latest tagged GitHub release instead of PyPI, regardless of its source branch.
|
|
167
178
|
- `--uninstall` : run configured uninstall command automatically on Linux, otherwise print the manual command.
|
|
168
179
|
- `--write-config` : write the default runtime configuration file.
|
|
@@ -200,14 +211,14 @@ Top-level configuration keys:
|
|
|
200
211
|
|
|
201
212
|
| Command | Purpose |
|
|
202
213
|
|---|---|
|
|
203
|
-
| `
|
|
214
|
+
| `agy` | Launch Antigravity CLI in project context (YOLO mode, pass-through args). |
|
|
204
215
|
| `claude` | Launch Claude CLI in project context. |
|
|
205
216
|
| `codex` | Launch Codex CLI in project context with auth sync and `CODEX_HOME`. |
|
|
206
217
|
| `copilot` | Launch Copilot CLI in project context. |
|
|
207
218
|
| `gemini` | Launch Gemini CLI in project context. |
|
|
208
219
|
| `kiro` | Launch Kiro CLI in project context. |
|
|
209
220
|
| `opencode` | Launch OpenCode CLI in project context. |
|
|
210
|
-
| `pi` | Launch pi.dev CLI in project context (
|
|
221
|
+
| `pi` | Launch pi.dev CLI in project context (forwards all arguments unchanged). |
|
|
211
222
|
| `clean` | Find and delete cache directories under the project root (or a passed directory). |
|
|
212
223
|
| `req` | Run useReq bootstrap on current directory, first-level dirs, or recursively. |
|
|
213
224
|
| `venv` | Recreate `.venv` and install `requirements.txt` if present. |
|
|
@@ -233,25 +244,13 @@ Top-level configuration keys:
|
|
|
233
244
|
|
|
234
245
|
### Selected Usage Examples
|
|
235
246
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
s ai-install
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
Install only selected AI tools:
|
|
243
|
-
|
|
244
|
-
```bash
|
|
245
|
-
s ai-install --codex --gemini --claude
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
Run pi.dev with default tools injected automatically:
|
|
247
|
+
Launch Antigravity CLI in YOLO mode (command help lists the available AI CLIs in alphabetical order):
|
|
249
248
|
|
|
250
249
|
```bash
|
|
251
|
-
s
|
|
250
|
+
s agy
|
|
252
251
|
```
|
|
253
252
|
|
|
254
|
-
|
|
253
|
+
Run pi.dev CLI forwarding all arguments unchanged (no implicit option injection):
|
|
255
254
|
|
|
256
255
|
```bash
|
|
257
256
|
s pi --tools read,bash,grep,find
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
shell_scripts/__init__.py,sha256=
|
|
1
|
+
shell_scripts/__init__.py,sha256=XWnbBP7_a1CX7d2RbumNzRbD9edw5GSlnaqo-JXSLZs,96
|
|
2
2
|
shell_scripts/__main__.py,sha256=-wEmwKTfeY5TphAH82E38XRPoB4KT5QDLDgRZz84PTs,83
|
|
3
|
-
shell_scripts/config.py,sha256=
|
|
4
|
-
shell_scripts/core.py,sha256=
|
|
5
|
-
shell_scripts/utils.py,sha256=
|
|
3
|
+
shell_scripts/config.py,sha256=bOFq3UxuTHPOqPc7lXLqri7f6NTaF19Mx1Q0i4rY3Dg,12624
|
|
4
|
+
shell_scripts/core.py,sha256=_xMg7u-g774Z-BpR00JbUHuRevz-CziutS9SnNlpEXw,12619
|
|
5
|
+
shell_scripts/utils.py,sha256=ckIJRJ_F7XTu_SqpFu_vI_70xNOmVM3S48YiTzxpO7o,14115
|
|
6
6
|
shell_scripts/version_check.py,sha256=KVXVksy-T5V6rAYAnWACzv5MHi2dnrsYiNYg_yW0Eks,13184
|
|
7
|
-
shell_scripts/commands/__init__.py,sha256=
|
|
7
|
+
shell_scripts/commands/__init__.py,sha256=VoB5ucIdlUmcVdYV1JNgPvGBJU3aKPZMMMmY20Kjf5E,3682
|
|
8
8
|
shell_scripts/commands/_dc_common.py,sha256=kfUn92r6n8F1w27jy5QDJE_6Kvpvzhq6dUGNs0_GO0U,4695
|
|
9
|
-
shell_scripts/commands/
|
|
9
|
+
shell_scripts/commands/agy.py,sha256=L2BFopbNEI40BDrEAs3P6sAJw78U50ZH1SbylkA79hc,2997
|
|
10
10
|
shell_scripts/commands/bin_links.py,sha256=7chuWbk1FdnxH9ak_fATdmUSOyzIbg4WmfRPCOw10-U,2425
|
|
11
11
|
shell_scripts/commands/claude.py,sha256=_X76ygt0jnxZyyNoZ8qVhn6r2C0B9mcNIaKd_hLthl4,2049
|
|
12
12
|
shell_scripts/commands/clean.py,sha256=LOK7bVzqpWDvFBMInlu9COtODVmjwOtwCHyMriq7wIk,2552
|
|
@@ -37,9 +37,9 @@ shell_scripts/commands/video2h265.py,sha256=Sr_UWGz_V77x4anmuy8kiWZv5I_AOFlV0WDn
|
|
|
37
37
|
shell_scripts/commands/view_cmd.py,sha256=qHEivQHZpZCTE3VSFP1ay2SuqgancQlEKxJcKtyeqNA,1827
|
|
38
38
|
shell_scripts/commands/vscode_cmd.py,sha256=Rkcjt5A1HMzqJoh2Yz9VRGoLP-L3qpRO5hkcSrzOmvA,1461
|
|
39
39
|
shell_scripts/commands/vsinsider_cmd.py,sha256=KTTv1cVpJO-u1ktxOE0W_o4AAmz20pAvkDtyhpU9XBg,1548
|
|
40
|
-
shellscripts-0.
|
|
41
|
-
shellscripts-0.
|
|
42
|
-
shellscripts-0.
|
|
43
|
-
shellscripts-0.
|
|
44
|
-
shellscripts-0.
|
|
45
|
-
shellscripts-0.
|
|
40
|
+
shellscripts-0.25.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
41
|
+
shellscripts-0.25.1.dist-info/METADATA,sha256=9W8Pw-maYRhZbciK6cQeITC95ocy6QZDsS_aQzI_08E,11279
|
|
42
|
+
shellscripts-0.25.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
43
|
+
shellscripts-0.25.1.dist-info/entry_points.txt,sha256=9ICAgH87fxHBzi3f6JXIVcsPWzAKsCh4_1xS8JThQ0M,85
|
|
44
|
+
shellscripts-0.25.1.dist-info/top_level.txt,sha256=7bDVqjcR5CfCCArCP4X4e9gYJ-ua8z-GfQeHbAo8rCY,14
|
|
45
|
+
shellscripts-0.25.1.dist-info/RECORD,,
|
|
@@ -1,453 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""@brief AI CLI installers dispatcher with OS-aware package resolution.
|
|
3
|
-
|
|
4
|
-
@details Provides selector-based installation flows for npm-distributed tools
|
|
5
|
-
and direct-download installers. Npm command prefix and installer payload
|
|
6
|
-
sources are resolved from detected runtime OS. Kiro package resolution is
|
|
7
|
-
manifest-driven on Linux and explicitly unsupported on Windows/macOS. pi.dev
|
|
8
|
-
installation always runs npm global installation first and then installs the
|
|
9
|
-
configured pi package list without any `--extra` selector gate.
|
|
10
|
-
@satisfies PRJ-003, DES-013, REQ-006, REQ-007, REQ-008, REQ-009, REQ-010, REQ-047, REQ-056, REQ-067, REQ-072, REQ-073, REQ-074
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
import json
|
|
14
|
-
import os
|
|
15
|
-
import platform
|
|
16
|
-
import subprocess
|
|
17
|
-
import shutil
|
|
18
|
-
import zipfile
|
|
19
|
-
import tempfile
|
|
20
|
-
from pathlib import Path
|
|
21
|
-
|
|
22
|
-
from shell_scripts.utils import (
|
|
23
|
-
get_runtime_os,
|
|
24
|
-
print_info,
|
|
25
|
-
print_error,
|
|
26
|
-
print_success,
|
|
27
|
-
require_commands,
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
## @var PROGRAM
|
|
31
|
-
# @brief Base CLI program name used in help output.
|
|
32
|
-
# @details Constant identifier for usage-line rendering in command help.
|
|
33
|
-
PROGRAM = "shellscripts"
|
|
34
|
-
|
|
35
|
-
## @var DESCRIPTION
|
|
36
|
-
# @brief One-line command description for dispatcher help surfaces.
|
|
37
|
-
# @details Exposed by command registry introspection (`get_all_commands`).
|
|
38
|
-
DESCRIPTION = "Install AI CLI tools (Codex, Copilot, Gemini, OpenCode, pi.dev, Claude, Kiro)."
|
|
39
|
-
|
|
40
|
-
## @var TOOLS
|
|
41
|
-
# @brief Static npm-installer registry for supported AI CLIs.
|
|
42
|
-
# @details Maps selector tokens to user-facing installer names and exact npm
|
|
43
|
-
# command vectors consumed by `_install_npm_tool(...)`.
|
|
44
|
-
TOOLS = {
|
|
45
|
-
"codex": {
|
|
46
|
-
"name": "OpenAI Codex CLI",
|
|
47
|
-
"install": ["npm", "install", "-g", "@openai/codex"],
|
|
48
|
-
},
|
|
49
|
-
"copilot": {
|
|
50
|
-
"name": "GitHub Copilot CLI",
|
|
51
|
-
"install": ["npm", "install", "-g", "@github/copilot"],
|
|
52
|
-
},
|
|
53
|
-
"gemini": {
|
|
54
|
-
"name": "Google Gemini CLI",
|
|
55
|
-
"install": ["npm", "install", "-g", "@google/gemini-cli"],
|
|
56
|
-
},
|
|
57
|
-
"opencode": {
|
|
58
|
-
"name": "OpenCode CLI",
|
|
59
|
-
"install": ["npm", "install", "-g", "opencode-ai"],
|
|
60
|
-
},
|
|
61
|
-
"pi": {
|
|
62
|
-
"name": "pi.dev CLI",
|
|
63
|
-
"install": ["npm", "install", "-g", "@mariozechner/pi-coding-agent"],
|
|
64
|
-
},
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
## @var PI_PACKAGES
|
|
68
|
-
# @brief Post-install pi package registry executed after pi.dev CLI install.
|
|
69
|
-
# @details Ordered tuple of package specifiers passed to `pi install` after
|
|
70
|
-
# successful npm-based pi.dev CLI installation.
|
|
71
|
-
PI_PACKAGES = ("git:github.com/ferologics/pi-notify",)
|
|
72
|
-
|
|
73
|
-
CLAUDE_BUCKET = (
|
|
74
|
-
"https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819"
|
|
75
|
-
"/claude-code-releases"
|
|
76
|
-
)
|
|
77
|
-
CLAUDE_ARTIFACT_CANDIDATES = {
|
|
78
|
-
"linux": ("linux-x64/claude",),
|
|
79
|
-
"windows": ("windows-x64/claude.exe", "win32-x64/claude.exe"),
|
|
80
|
-
"darwin": ("darwin-arm64/claude", "darwin-x64/claude"),
|
|
81
|
-
}
|
|
82
|
-
KIRO_CHANNEL_BASE_URL = "https://prod.download.cli.kiro.dev/stable"
|
|
83
|
-
KIRO_MANIFEST_URL = f"{KIRO_CHANNEL_BASE_URL}/latest/manifest.json"
|
|
84
|
-
KIRO_LINUX_VARIANT = "headless"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def print_help(version: str) -> None:
|
|
88
|
-
"""@brief Render command help for `ai-install`.
|
|
89
|
-
|
|
90
|
-
@details Prints supported selectors and execution contract for installer
|
|
91
|
-
dispatch. The selector surface excludes any `--extra` compatibility flag.
|
|
92
|
-
@param version {str} CLI version string appended in usage output.
|
|
93
|
-
@return {None} Writes help text to stdout.
|
|
94
|
-
@satisfies DES-008
|
|
95
|
-
"""
|
|
96
|
-
|
|
97
|
-
print(f"Usage: {PROGRAM} ai-install [options] ({version})")
|
|
98
|
-
print()
|
|
99
|
-
print("ai-install options:")
|
|
100
|
-
print(" --all - Install all AI CLI tools (default).")
|
|
101
|
-
print(" --codex - Install OpenAI Codex CLI only.")
|
|
102
|
-
print(" --copilot - Install GitHub Copilot CLI only.")
|
|
103
|
-
print(" --gemini - Install Google Gemini CLI only.")
|
|
104
|
-
print(" --opencode - Install OpenCode CLI only.")
|
|
105
|
-
print(" --pi - Install pi.dev CLI only.")
|
|
106
|
-
print(" --claude - Install Claude CLI only.")
|
|
107
|
-
print(" --kiro - Install Kiro CLI only.")
|
|
108
|
-
print(" --help - Show this help message.")
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
def _install_npm_tool(tool_key):
|
|
112
|
-
"""@brief Execute npm-based installer command for selected tool.
|
|
113
|
-
|
|
114
|
-
@details Resolves base npm command from static tool mapping, omits `sudo`
|
|
115
|
-
on Linux and Windows, prepends `sudo` on other runtimes, and uses resolved
|
|
116
|
-
`npm.cmd` path on Windows when available to avoid process-launch failures.
|
|
117
|
-
For Windows Copilot installs, retries once after a non-zero first attempt
|
|
118
|
-
to mitigate transient file-lock failures during binary replacement.
|
|
119
|
-
@param tool_key {str} Tool identifier key from `TOOLS`.
|
|
120
|
-
@return {bool} `True` when installation succeeds; `False` otherwise.
|
|
121
|
-
@satisfies DES-013, REQ-008, REQ-047, REQ-056, REQ-072
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
info = TOOLS[tool_key]
|
|
125
|
-
command = list(info["install"])
|
|
126
|
-
runtime_os = get_runtime_os()
|
|
127
|
-
windows_runtime = runtime_os == "windows"
|
|
128
|
-
if windows_runtime:
|
|
129
|
-
npm_cmd_path = shutil.which("npm.cmd")
|
|
130
|
-
if npm_cmd_path:
|
|
131
|
-
command[0] = npm_cmd_path
|
|
132
|
-
elif runtime_os != "linux":
|
|
133
|
-
require_commands("sudo")
|
|
134
|
-
command = ["sudo"] + command
|
|
135
|
-
require_commands(command[0])
|
|
136
|
-
print_info(f"Installing {info['name']}...")
|
|
137
|
-
max_attempts = 2 if windows_runtime and tool_key == "copilot" else 1
|
|
138
|
-
result = None
|
|
139
|
-
for attempt_idx in range(max_attempts):
|
|
140
|
-
result = subprocess.run(command)
|
|
141
|
-
if result.returncode == 0:
|
|
142
|
-
break
|
|
143
|
-
if attempt_idx + 1 < max_attempts:
|
|
144
|
-
print_info(
|
|
145
|
-
"Retrying GitHub Copilot CLI installation after transient Windows file lock..."
|
|
146
|
-
)
|
|
147
|
-
assert result is not None
|
|
148
|
-
if result.returncode != 0:
|
|
149
|
-
print_error(f"Failed to install {info['name']}.")
|
|
150
|
-
print()
|
|
151
|
-
return False
|
|
152
|
-
|
|
153
|
-
print_success(f"{info['name']} installed.")
|
|
154
|
-
print()
|
|
155
|
-
return True
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
def _normalize_kiro_linux_arch(machine_token):
|
|
159
|
-
"""@brief Normalize machine architecture token for Kiro Linux packages.
|
|
160
|
-
|
|
161
|
-
@details Maps runtime machine names into manifest architecture keys accepted
|
|
162
|
-
by Kiro headless Linux ZIP entries. Raises explicit error for unknown
|
|
163
|
-
architecture to avoid ambiguous package selection.
|
|
164
|
-
@param machine_token {str} Raw `platform.machine()` token.
|
|
165
|
-
@return {str} Normalized architecture token (`x86_64` or `aarch64`).
|
|
166
|
-
@throws {RuntimeError} When architecture is not supported by Kiro installer.
|
|
167
|
-
@satisfies REQ-010, REQ-067
|
|
168
|
-
"""
|
|
169
|
-
|
|
170
|
-
normalized = machine_token.strip().lower()
|
|
171
|
-
if normalized in ("x86_64", "amd64"):
|
|
172
|
-
return "x86_64"
|
|
173
|
-
if normalized in ("aarch64", "arm64"):
|
|
174
|
-
return "aarch64"
|
|
175
|
-
raise RuntimeError(
|
|
176
|
-
f"Unsupported Linux architecture for Kiro installer: {machine_token}"
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
def _detect_kiro_linux_libc():
|
|
181
|
-
"""@brief Detect Linux libc class token for Kiro package selection.
|
|
182
|
-
|
|
183
|
-
@details Uses `platform.libc_ver()` to classify runtime libc as `musl` or
|
|
184
|
-
`gnu`. Unknown or empty values default to `gnu` to keep deterministic
|
|
185
|
-
package selection for glibc environments.
|
|
186
|
-
@return {str} libc class token (`musl` or `gnu`).
|
|
187
|
-
@satisfies REQ-010
|
|
188
|
-
"""
|
|
189
|
-
|
|
190
|
-
libc_name, _ = platform.libc_ver()
|
|
191
|
-
if "musl" in libc_name.lower():
|
|
192
|
-
return "musl"
|
|
193
|
-
return "gnu"
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
def _resolve_kiro_linux_download_path(manifest, arch_token, libc_token):
|
|
197
|
-
"""@brief Resolve Kiro Linux ZIP download path from manifest metadata.
|
|
198
|
-
|
|
199
|
-
@details Filters manifest packages by Linux OS, headless ZIP variant,
|
|
200
|
-
runtime architecture, and runtime libc class reflected in target triple.
|
|
201
|
-
Returns first matching `download` path and fails explicitly when no match
|
|
202
|
-
exists.
|
|
203
|
-
@param manifest {dict[str, object]} Parsed Kiro manifest JSON payload.
|
|
204
|
-
@param arch_token {str} Normalized architecture token (`x86_64|aarch64`).
|
|
205
|
-
@param libc_token {str} Normalized libc token (`gnu|musl`).
|
|
206
|
-
@return {str} Relative download path from manifest `packages[].download`.
|
|
207
|
-
@throws {RuntimeError} When no manifest package matches runtime filters.
|
|
208
|
-
@satisfies DES-013, REQ-010
|
|
209
|
-
"""
|
|
210
|
-
|
|
211
|
-
if libc_token not in ("gnu", "musl"):
|
|
212
|
-
raise RuntimeError(f"Unsupported Linux libc class for Kiro installer: {libc_token}")
|
|
213
|
-
|
|
214
|
-
target_suffix = "linux-musl" if libc_token == "musl" else "linux-gnu"
|
|
215
|
-
packages = manifest.get("packages")
|
|
216
|
-
if not isinstance(packages, list):
|
|
217
|
-
raise RuntimeError("Invalid Kiro manifest format: missing packages list")
|
|
218
|
-
|
|
219
|
-
for package in packages:
|
|
220
|
-
if not isinstance(package, dict):
|
|
221
|
-
continue
|
|
222
|
-
if package.get("os") != "linux":
|
|
223
|
-
continue
|
|
224
|
-
if package.get("fileType") != "zip":
|
|
225
|
-
continue
|
|
226
|
-
if package.get("variant") != KIRO_LINUX_VARIANT:
|
|
227
|
-
continue
|
|
228
|
-
if package.get("architecture") != arch_token:
|
|
229
|
-
continue
|
|
230
|
-
target_triple = str(package.get("targetTriple", ""))
|
|
231
|
-
if target_suffix not in target_triple:
|
|
232
|
-
continue
|
|
233
|
-
download_path = package.get("download")
|
|
234
|
-
if isinstance(download_path, str) and download_path:
|
|
235
|
-
return download_path
|
|
236
|
-
|
|
237
|
-
raise RuntimeError(
|
|
238
|
-
"No Kiro Linux package matched runtime architecture/libc in manifest"
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
def _install_claude():
|
|
243
|
-
"""@brief Install Claude CLI by direct binary download.
|
|
244
|
-
|
|
245
|
-
@details Downloads latest version metadata from configured bucket, resolves
|
|
246
|
-
OS-specific Claude artifact candidates from runtime OS token, downloads the
|
|
247
|
-
first available artifact, writes executable into `~/.claude/bin/claude`,
|
|
248
|
-
and sets execute permissions on non-Windows runtimes.
|
|
249
|
-
@return {None} Executes side effects and prints result messages.
|
|
250
|
-
@throws {RuntimeError} When runtime OS has no configured package candidates.
|
|
251
|
-
@throws {urllib.error.URLError} When metadata or artifact download fails.
|
|
252
|
-
@throws {OSError} When destination write or permission update fails.
|
|
253
|
-
@satisfies DES-013, REQ-009
|
|
254
|
-
"""
|
|
255
|
-
|
|
256
|
-
import urllib.error
|
|
257
|
-
import urllib.request
|
|
258
|
-
|
|
259
|
-
print_info("Installing Claude CLI...")
|
|
260
|
-
install_dir = Path.home() / ".claude" / "bin"
|
|
261
|
-
install_dir.mkdir(parents=True, exist_ok=True)
|
|
262
|
-
|
|
263
|
-
try:
|
|
264
|
-
runtime_os = get_runtime_os()
|
|
265
|
-
artifact_candidates = CLAUDE_ARTIFACT_CANDIDATES.get(runtime_os)
|
|
266
|
-
if not artifact_candidates:
|
|
267
|
-
raise RuntimeError(f"Unsupported runtime OS for Claude installer: {runtime_os}")
|
|
268
|
-
|
|
269
|
-
version_url = f"{CLAUDE_BUCKET}/latest"
|
|
270
|
-
with urllib.request.urlopen(version_url, timeout=15) as resp:
|
|
271
|
-
version = resp.read().decode().strip()
|
|
272
|
-
|
|
273
|
-
print_info(f"Downloading Claude CLI version {version}...")
|
|
274
|
-
download_error = None
|
|
275
|
-
dest = install_dir / "claude"
|
|
276
|
-
for artifact_path in artifact_candidates:
|
|
277
|
-
binary_url = f"{CLAUDE_BUCKET}/{version}/{artifact_path}"
|
|
278
|
-
try:
|
|
279
|
-
urllib.request.urlretrieve(binary_url, str(dest))
|
|
280
|
-
break
|
|
281
|
-
except (urllib.error.HTTPError, urllib.error.URLError) as error:
|
|
282
|
-
download_error = error
|
|
283
|
-
else:
|
|
284
|
-
raise RuntimeError(
|
|
285
|
-
f"No Claude artifact candidate was downloadable for OS {runtime_os}"
|
|
286
|
-
) from download_error
|
|
287
|
-
|
|
288
|
-
if runtime_os != "windows":
|
|
289
|
-
dest.chmod(0o755)
|
|
290
|
-
print_success(f"Claude CLI installed to {dest}")
|
|
291
|
-
except (OSError, RuntimeError, urllib.error.HTTPError, urllib.error.URLError) as e:
|
|
292
|
-
print_error(f"Failed to install Claude CLI: {e}")
|
|
293
|
-
print()
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
def _install_pi() -> None:
|
|
297
|
-
"""@brief Install pi.dev CLI and required post-install pi packages.
|
|
298
|
-
|
|
299
|
-
@details Executes npm-based pi.dev CLI installation first. When npm
|
|
300
|
-
installation succeeds, the function resolves the `pi` executable and
|
|
301
|
-
installs each package from `PI_PACKAGES` using `pi install <package>` in
|
|
302
|
-
tuple order. Package installation is skipped only when CLI installation
|
|
303
|
-
fails.
|
|
304
|
-
@return {None} Executes side effects and prints result messages.
|
|
305
|
-
@satisfies DES-013, REQ-072, REQ-073, REQ-074
|
|
306
|
-
"""
|
|
307
|
-
|
|
308
|
-
if not _install_npm_tool("pi"):
|
|
309
|
-
return
|
|
310
|
-
|
|
311
|
-
pi_executable = require_commands("pi")
|
|
312
|
-
print_info("Installing pi.dev packages...")
|
|
313
|
-
for package in PI_PACKAGES:
|
|
314
|
-
result = subprocess.run([pi_executable, "install", package])
|
|
315
|
-
if result.returncode != 0:
|
|
316
|
-
print_error(f"Failed to install pi.dev package: {package}.")
|
|
317
|
-
print()
|
|
318
|
-
return
|
|
319
|
-
|
|
320
|
-
print_success("pi.dev packages installed.")
|
|
321
|
-
print()
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
def _install_kiro():
|
|
325
|
-
"""@brief Install Kiro CLI binaries by ZIP extraction flow.
|
|
326
|
-
|
|
327
|
-
@details Rejects unsupported runtime OS values (`windows`, `darwin`) with
|
|
328
|
-
explicit errors. On Linux, resolves runtime architecture/libc package from
|
|
329
|
-
official stable manifest, downloads selected ZIP archive, extracts
|
|
330
|
-
`kiro-cli*` binaries, and installs them into `~/.local/bin`.
|
|
331
|
-
@return {None} Executes side effects and prints result messages.
|
|
332
|
-
@throws {RuntimeError} When runtime OS is unsupported or manifest has no
|
|
333
|
-
matching package.
|
|
334
|
-
@throws {urllib.error.URLError} When archive download fails.
|
|
335
|
-
@throws {json.JSONDecodeError} When manifest payload is malformed.
|
|
336
|
-
@throws {zipfile.BadZipFile} When downloaded archive is invalid.
|
|
337
|
-
@throws {OSError} When extraction/copy/permission updates fail.
|
|
338
|
-
@satisfies DES-013, REQ-010, REQ-067
|
|
339
|
-
"""
|
|
340
|
-
|
|
341
|
-
import urllib.error
|
|
342
|
-
import urllib.request
|
|
343
|
-
|
|
344
|
-
print_info("Installing Kiro CLI...")
|
|
345
|
-
runtime_os = get_runtime_os()
|
|
346
|
-
if runtime_os == "windows":
|
|
347
|
-
print_error("Failed to install Kiro CLI: unsupported runtime OS windows.")
|
|
348
|
-
print()
|
|
349
|
-
return
|
|
350
|
-
if runtime_os == "darwin":
|
|
351
|
-
print_error("Failed to install Kiro CLI: unsupported runtime OS darwin.")
|
|
352
|
-
print()
|
|
353
|
-
return
|
|
354
|
-
if runtime_os != "linux":
|
|
355
|
-
print_error(f"Failed to install Kiro CLI: unsupported runtime OS {runtime_os}.")
|
|
356
|
-
print()
|
|
357
|
-
return
|
|
358
|
-
|
|
359
|
-
install_dir = Path.home() / ".local" / "bin"
|
|
360
|
-
install_dir.mkdir(parents=True, exist_ok=True)
|
|
361
|
-
|
|
362
|
-
try:
|
|
363
|
-
machine_arch = _normalize_kiro_linux_arch(platform.machine())
|
|
364
|
-
libc_token = _detect_kiro_linux_libc()
|
|
365
|
-
with urllib.request.urlopen(KIRO_MANIFEST_URL, timeout=15) as response:
|
|
366
|
-
manifest_payload = json.loads(response.read().decode())
|
|
367
|
-
download_path = _resolve_kiro_linux_download_path(
|
|
368
|
-
manifest_payload,
|
|
369
|
-
machine_arch,
|
|
370
|
-
libc_token,
|
|
371
|
-
)
|
|
372
|
-
archive_url = f"{KIRO_CHANNEL_BASE_URL}/{download_path}"
|
|
373
|
-
|
|
374
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
375
|
-
zip_path = os.path.join(tmpdir, "kiro.zip")
|
|
376
|
-
print_info("Downloading Kiro CLI...")
|
|
377
|
-
urllib.request.urlretrieve(archive_url, zip_path)
|
|
378
|
-
|
|
379
|
-
with zipfile.ZipFile(zip_path, "r") as zf:
|
|
380
|
-
zf.extractall(tmpdir)
|
|
381
|
-
|
|
382
|
-
copied_binaries = []
|
|
383
|
-
for src in Path(tmpdir).rglob("kiro-cli*"):
|
|
384
|
-
if src.is_file():
|
|
385
|
-
dest = install_dir / src.name
|
|
386
|
-
shutil.copy2(src, str(dest))
|
|
387
|
-
dest.chmod(0o755)
|
|
388
|
-
copied_binaries.append(dest.name)
|
|
389
|
-
|
|
390
|
-
if not copied_binaries:
|
|
391
|
-
raise RuntimeError("No kiro-cli* binaries found in extracted archive")
|
|
392
|
-
|
|
393
|
-
print_success(f"Kiro CLI installed to {install_dir}")
|
|
394
|
-
except (
|
|
395
|
-
OSError,
|
|
396
|
-
RuntimeError,
|
|
397
|
-
urllib.error.HTTPError,
|
|
398
|
-
urllib.error.URLError,
|
|
399
|
-
zipfile.BadZipFile,
|
|
400
|
-
) as e:
|
|
401
|
-
print_error(f"Failed to install Kiro CLI: {e}")
|
|
402
|
-
print()
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
ALL_INSTALLERS = {
|
|
406
|
-
"codex": lambda: _install_npm_tool("codex"),
|
|
407
|
-
"copilot": lambda: _install_npm_tool("copilot"),
|
|
408
|
-
"gemini": lambda: _install_npm_tool("gemini"),
|
|
409
|
-
"opencode": lambda: _install_npm_tool("opencode"),
|
|
410
|
-
"pi": _install_pi,
|
|
411
|
-
"claude": _install_claude,
|
|
412
|
-
"kiro": _install_kiro,
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
def run(args: list[str]) -> int:
|
|
417
|
-
"""@brief Parse selectors and execute selected AI installer routines.
|
|
418
|
-
|
|
419
|
-
@details Accepts explicit selectors or defaults to the full installer set
|
|
420
|
-
when omitted. Unknown selectors are rejected with return code `1`; no
|
|
421
|
-
compatibility parsing exists for removed `--extra` behavior.
|
|
422
|
-
@param args {list[str]} CLI selector tokens for installer filtering.
|
|
423
|
-
@return {int} `0` on successful dispatch; `1` on unknown selector.
|
|
424
|
-
@satisfies REQ-006, REQ-007, REQ-073, REQ-074
|
|
425
|
-
"""
|
|
426
|
-
|
|
427
|
-
selected = []
|
|
428
|
-
include_all = False
|
|
429
|
-
for arg in args:
|
|
430
|
-
key = arg.lstrip("-")
|
|
431
|
-
if key == "all":
|
|
432
|
-
include_all = True
|
|
433
|
-
continue
|
|
434
|
-
if key in ALL_INSTALLERS:
|
|
435
|
-
selected.append(key)
|
|
436
|
-
continue
|
|
437
|
-
print_error(f"Unknown option: {arg}")
|
|
438
|
-
return 1
|
|
439
|
-
|
|
440
|
-
if include_all or not selected:
|
|
441
|
-
selected = list(ALL_INSTALLERS.keys())
|
|
442
|
-
else:
|
|
443
|
-
selected = list(dict.fromkeys(selected))
|
|
444
|
-
|
|
445
|
-
print_info(f"Starting AI CLI tools installation ({len(selected)} tools)...")
|
|
446
|
-
print()
|
|
447
|
-
|
|
448
|
-
for key in selected:
|
|
449
|
-
installer = ALL_INSTALLERS[key]
|
|
450
|
-
installer()
|
|
451
|
-
|
|
452
|
-
print_success("AI CLI tools installation complete.")
|
|
453
|
-
return 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|