devstuff 2.26.0__py3-none-any.whl → 2.27.0__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.
- dev_setup/commands/install_cmd.py +15 -1
- dev_setup/commands/list_cmd.py +6 -2
- dev_setup/commands/remove_cmd.py +6 -2
- dev_setup/commands/update_cmd.py +4 -1
- dev_setup/generic.py +302 -24
- dev_setup/tools.yaml +160 -93
- dev_setup/ui.py +18 -2
- {devstuff-2.26.0.dist-info → devstuff-2.27.0.dist-info}/METADATA +1 -1
- {devstuff-2.26.0.dist-info → devstuff-2.27.0.dist-info}/RECORD +11 -11
- {devstuff-2.26.0.dist-info → devstuff-2.27.0.dist-info}/WHEEL +1 -1
- {devstuff-2.26.0.dist-info → devstuff-2.27.0.dist-info}/entry_points.txt +0 -0
|
@@ -7,7 +7,7 @@ import click
|
|
|
7
7
|
import questionary
|
|
8
8
|
from rich.markup import escape
|
|
9
9
|
|
|
10
|
-
from dev_setup import managers, registry, ui
|
|
10
|
+
from dev_setup import generic, managers, registry, ui
|
|
11
11
|
from dev_setup.base import Tool
|
|
12
12
|
from dev_setup.commands._plan import plan_for, plan_summary
|
|
13
13
|
|
|
@@ -112,6 +112,13 @@ def _install_one(
|
|
|
112
112
|
status, detail = _install_one(dep, yes=yes) if dep else ("fail", "")
|
|
113
113
|
if status == "fail":
|
|
114
114
|
return "fail", f"required tool {dep_key} failed"
|
|
115
|
+
# A required tool's install can already provide this tool
|
|
116
|
+
# (ansible-vault is bundled with ansible) — re-check before doing
|
|
117
|
+
# the work a second time.
|
|
118
|
+
if tool.is_installed():
|
|
119
|
+
version = tool.get_version()
|
|
120
|
+
ui.success(f"{tool.name} is already installed: {version}")
|
|
121
|
+
return "skip", f"already installed{': ' + version if version else ''}"
|
|
115
122
|
else:
|
|
116
123
|
ui.error(f"Cannot install {tool.name} — missing: {', '.join(missing)}")
|
|
117
124
|
return "fail", "declined required tools"
|
|
@@ -128,7 +135,12 @@ def _install_one(
|
|
|
128
135
|
ui.success(msg)
|
|
129
136
|
except Exception as exc:
|
|
130
137
|
ui.error(f"Failed to install {tool.name}: {escape(str(exc))}")
|
|
138
|
+
ui.dim(f" full output: {generic.run_log_path()}")
|
|
131
139
|
return "fail", str(exc).splitlines()[-1][:120]
|
|
140
|
+
finally:
|
|
141
|
+
# An installer — even a failed one — may have changed the machine (added
|
|
142
|
+
# an apt repo, dropped a binary); the next tool's probes must re-read it.
|
|
143
|
+
generic.forget_probes()
|
|
132
144
|
|
|
133
145
|
# A freshly installed tool with a setup wizard is the moment to mention it.
|
|
134
146
|
from dev_setup.commands.configure_cmd import offer_after_install
|
|
@@ -196,6 +208,8 @@ def _install_interactive(*, yes: bool) -> None:
|
|
|
196
208
|
suffix, disabled_override = (
|
|
197
209
|
managers.picker_hint(note, t) if note is not None else ("", None)
|
|
198
210
|
)
|
|
211
|
+
if not is_inst:
|
|
212
|
+
suffix += " · sudo" if generic.needs_sudo(t) else " · user"
|
|
199
213
|
desc = t.description
|
|
200
214
|
room = max(10, desc_width - len(suffix))
|
|
201
215
|
if len(desc) > room:
|
dev_setup/commands/list_cmd.py
CHANGED
|
@@ -4,7 +4,7 @@ from concurrent.futures import ThreadPoolExecutor
|
|
|
4
4
|
|
|
5
5
|
import click
|
|
6
6
|
|
|
7
|
-
from dev_setup import managers, registry, ui
|
|
7
|
+
from dev_setup import generic, managers, registry, ui
|
|
8
8
|
from dev_setup.base import Tool
|
|
9
9
|
|
|
10
10
|
_MAX_WORKERS = 8
|
|
@@ -75,7 +75,11 @@ def list_cmd(show_filter: str, category: str) -> None:
|
|
|
75
75
|
line = managers.list_line(note, tool)
|
|
76
76
|
if line:
|
|
77
77
|
desc += f"\n{line}"
|
|
78
|
-
|
|
78
|
+
sudo_tag = "sudo" if generic.needs_sudo(tool) else "user"
|
|
79
|
+
tbl.add_row(
|
|
80
|
+
icon, tool.key, desc,
|
|
81
|
+
f"{tool.install_type} [{ui.GRAY}]· {sudo_tag}[/]", version,
|
|
82
|
+
)
|
|
79
83
|
|
|
80
84
|
ui.console.print(tbl)
|
|
81
85
|
ui.console.print()
|
dev_setup/commands/remove_cmd.py
CHANGED
|
@@ -7,7 +7,7 @@ import click
|
|
|
7
7
|
import questionary
|
|
8
8
|
from rich.markup import escape
|
|
9
9
|
|
|
10
|
-
from dev_setup import registry, ui
|
|
10
|
+
from dev_setup import generic, registry, ui
|
|
11
11
|
from dev_setup.base import Tool
|
|
12
12
|
from dev_setup.commands._plan import plan_for, plan_summary
|
|
13
13
|
|
|
@@ -87,7 +87,10 @@ def _remove_one(
|
|
|
87
87
|
return "ok", "removed"
|
|
88
88
|
except Exception as exc:
|
|
89
89
|
ui.error(f"Failed to remove {tool.name}: {escape(str(exc))}")
|
|
90
|
+
ui.dim(f" full output: {generic.run_log_path()}")
|
|
90
91
|
return "fail", str(exc).splitlines()[-1][:120]
|
|
92
|
+
finally:
|
|
93
|
+
generic.forget_probes()
|
|
91
94
|
|
|
92
95
|
|
|
93
96
|
def _confirm_plan(tool: Tool) -> bool:
|
|
@@ -127,9 +130,10 @@ def _remove_interactive(*, yes: bool) -> None:
|
|
|
127
130
|
for t in sorted(installed, key=lambda t: t.key):
|
|
128
131
|
deps = registry.dependents(t.key)
|
|
129
132
|
annotation = f" ⚠ required by: {', '.join(deps)}" if deps else ""
|
|
133
|
+
sudo_tag = " · sudo" if generic.needs_sudo(t, "remove") else " · user"
|
|
130
134
|
# Plain-string title: a token list would render verbatim and never pick
|
|
131
135
|
# up the `highlighted` style, leaving the cursor invisible.
|
|
132
|
-
title = f"{t.key:<{key_width}}{t.description}{annotation}"
|
|
136
|
+
title = f"{t.key:<{key_width}}{t.description}{annotation}{sudo_tag}"
|
|
133
137
|
choices.append(questionary.Choice(title=title, value=t.key, checked=False))
|
|
134
138
|
|
|
135
139
|
selected = ui.checkbox(
|
dev_setup/commands/update_cmd.py
CHANGED
|
@@ -6,7 +6,7 @@ import click
|
|
|
6
6
|
import questionary
|
|
7
7
|
from rich.markup import escape
|
|
8
8
|
|
|
9
|
-
from dev_setup import registry, ui
|
|
9
|
+
from dev_setup import generic, registry, ui
|
|
10
10
|
from dev_setup.base import Tool
|
|
11
11
|
from dev_setup.commands._plan import plan_for, plan_summary
|
|
12
12
|
from dev_setup.updates import collect_candidates
|
|
@@ -113,7 +113,10 @@ def _update_one(
|
|
|
113
113
|
return "ok", "updated"
|
|
114
114
|
except Exception as exc:
|
|
115
115
|
ui.error(f"Failed to update {tool.name}: {escape(str(exc))}")
|
|
116
|
+
ui.dim(f" full output: {generic.run_log_path()}")
|
|
116
117
|
return "fail", str(exc).splitlines()[-1][:120]
|
|
118
|
+
finally:
|
|
119
|
+
generic.forget_probes()
|
|
117
120
|
|
|
118
121
|
|
|
119
122
|
def _confirm_plan(tool: Tool, version: str | None) -> bool:
|
dev_setup/generic.py
CHANGED
|
@@ -5,11 +5,15 @@ import functools
|
|
|
5
5
|
import hashlib
|
|
6
6
|
import os
|
|
7
7
|
import re
|
|
8
|
+
import select
|
|
8
9
|
import shlex
|
|
9
10
|
import shutil
|
|
10
11
|
import subprocess
|
|
12
|
+
import sys
|
|
11
13
|
import threading
|
|
12
|
-
|
|
14
|
+
import time
|
|
15
|
+
from collections.abc import Callable, Generator
|
|
16
|
+
from contextlib import contextmanager
|
|
13
17
|
from dataclasses import dataclass, fields
|
|
14
18
|
from pathlib import Path
|
|
15
19
|
from typing import NamedTuple, TypeVar
|
|
@@ -49,13 +53,53 @@ class UpdateStatus:
|
|
|
49
53
|
note: str = ""
|
|
50
54
|
|
|
51
55
|
|
|
56
|
+
def run_log_path() -> Path:
|
|
57
|
+
"""The append-only log of state-changing subprocess output."""
|
|
58
|
+
state = os.environ.get("XDG_STATE_HOME") or str(Path.home() / ".local" / "state")
|
|
59
|
+
return Path(state) / "devstuff" / "install.log"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _open_run_log(cmd: list, cwd: Path | None):
|
|
63
|
+
"""Open the run log and write a header for this command. Never raises —
|
|
64
|
+
logging must not be able to break an install."""
|
|
65
|
+
try:
|
|
66
|
+
path = run_log_path()
|
|
67
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
68
|
+
f = path.open("a", encoding="utf-8", errors="replace")
|
|
69
|
+
stamp = time.strftime("%Y-%m-%d %H:%M:%S")
|
|
70
|
+
where = f" (in {cwd})" if cwd else ""
|
|
71
|
+
f.write(f"\n=== {stamp} $ {shlex.join(str(c) for c in cmd)}{where} ===\n")
|
|
72
|
+
f.flush()
|
|
73
|
+
return f
|
|
74
|
+
except OSError:
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _run_env() -> dict[str, str]:
|
|
79
|
+
"""Child env for state-changing commands. `DEBIAN_FRONTEND=noninteractive`
|
|
80
|
+
keeps debconf frontends — a dpkg conffile question, needrestart — from
|
|
81
|
+
opening a prompt on the tty mid-install, which nothing could see under the
|
|
82
|
+
live view and which reads as a hang."""
|
|
83
|
+
return {**os.environ, "DEBIAN_FRONTEND": "noninteractive"}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Poll cadence for the piped read, and the drain window after the main process
|
|
87
|
+
# exits. A detached grandchild that inherits stdout (a `foo &` or a daemonized
|
|
88
|
+
# installer) would otherwise hold EOF — and the read — open forever after the
|
|
89
|
+
# script itself has exited. The window is fixed, not idle-reset: a daemon that
|
|
90
|
+
# keeps writing must not keep the install running either.
|
|
91
|
+
_PIPE_POLL_S = 0.2
|
|
92
|
+
_ORPHAN_PIPE_GRACE_S = 2.0
|
|
93
|
+
|
|
94
|
+
|
|
52
95
|
def _run(cmd: list, *, cwd: Path | None = None) -> None:
|
|
53
96
|
"""Run a state-changing command (install/remove/update). Raises RuntimeError on failure.
|
|
54
97
|
|
|
55
98
|
Three output modes: streams raw when verbose; feeds the live tail of the
|
|
56
99
|
active task view when there is one; otherwise captures — discarded on success
|
|
57
100
|
and surfaced as the exception message on failure, which is the only reason
|
|
58
|
-
quiet mode can say anything useful about what went wrong.
|
|
101
|
+
quiet mode can say anything useful about what went wrong. All modes write
|
|
102
|
+
the captured output to `run_log_path()`.
|
|
59
103
|
"""
|
|
60
104
|
from dev_setup import ui
|
|
61
105
|
|
|
@@ -68,8 +112,11 @@ def _run(cmd: list, *, cwd: Path | None = None) -> None:
|
|
|
68
112
|
cwd=cwd,
|
|
69
113
|
stdout=subprocess.PIPE,
|
|
70
114
|
stderr=subprocess.STDOUT,
|
|
71
|
-
|
|
72
|
-
#
|
|
115
|
+
env=_run_env(),
|
|
116
|
+
# stdin stays inherited: a `read`-style prompt inside an
|
|
117
|
+
# installer shows in the tail (a partial line) and can be
|
|
118
|
+
# answered on the terminal. sudo never reaches here prompting —
|
|
119
|
+
# _sudo_session validates credentials before the view opens.
|
|
73
120
|
)
|
|
74
121
|
except OSError as e:
|
|
75
122
|
raise RuntimeError(str(e)) from e
|
|
@@ -80,33 +127,208 @@ def _run(cmd: list, *, cwd: Path | None = None) -> None:
|
|
|
80
127
|
# the terminal looks hung. \r counts as a display boundary too, and
|
|
81
128
|
# the trailing partial line is pushed to the tail so the prompt is
|
|
82
129
|
# visible while the process is still waiting.
|
|
130
|
+
#
|
|
131
|
+
# The read is select()-polled so EOF is not required for exit: once the
|
|
132
|
+
# main process is dead the pipe gets a short drain window, then remaining
|
|
133
|
+
# writers are detached grandchildren we must not wait on — whether the
|
|
134
|
+
# pipe is quiet or a daemon is still streaming into it.
|
|
83
135
|
decoder = codecs.getincrementaldecoder("utf-8")(errors="replace")
|
|
84
136
|
buf = ""
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
137
|
+
log = _open_run_log(cmd, cwd)
|
|
138
|
+
try:
|
|
139
|
+
drain_until: float | None = None
|
|
140
|
+
while True:
|
|
141
|
+
ready = select.select([proc.stdout], [], [], _PIPE_POLL_S)[0]
|
|
142
|
+
if proc.poll() is not None:
|
|
143
|
+
# Main process dead — the drain deadline is checked every
|
|
144
|
+
# pass, not only on a quiet pipe, so a detached writer that
|
|
145
|
+
# keeps select() ready still can't hold the loop open.
|
|
146
|
+
if drain_until is None:
|
|
147
|
+
drain_until = time.monotonic() + _ORPHAN_PIPE_GRACE_S
|
|
148
|
+
elif time.monotonic() > drain_until:
|
|
149
|
+
break
|
|
150
|
+
if not ready:
|
|
151
|
+
continue
|
|
152
|
+
chunk = proc.stdout.read1(65536)
|
|
153
|
+
if not chunk:
|
|
154
|
+
break # EOF — every writer closed the pipe
|
|
155
|
+
text = decoder.decode(chunk)
|
|
156
|
+
if log is not None:
|
|
157
|
+
try:
|
|
158
|
+
log.write(text)
|
|
159
|
+
log.flush()
|
|
160
|
+
except OSError:
|
|
161
|
+
# logging must never break the install
|
|
162
|
+
try:
|
|
163
|
+
log.close()
|
|
164
|
+
except OSError:
|
|
165
|
+
pass
|
|
166
|
+
log = None
|
|
167
|
+
buf += text
|
|
168
|
+
*done, buf = re.split(r"\r\n|\r|\n", buf)
|
|
169
|
+
for line in done:
|
|
170
|
+
view.feed(line)
|
|
171
|
+
if buf:
|
|
172
|
+
view.feed(buf, partial=True)
|
|
90
173
|
if buf:
|
|
91
|
-
view.feed(buf
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
174
|
+
view.feed(buf)
|
|
175
|
+
rc = proc.wait()
|
|
176
|
+
except BaseException:
|
|
177
|
+
# Ctrl+C or a render error must not leave the installer running
|
|
178
|
+
# detached with a pipe nobody reads.
|
|
179
|
+
proc.kill()
|
|
180
|
+
proc.wait()
|
|
181
|
+
raise
|
|
182
|
+
finally:
|
|
183
|
+
if log is not None:
|
|
184
|
+
try:
|
|
185
|
+
log.close()
|
|
186
|
+
except OSError:
|
|
187
|
+
pass
|
|
95
188
|
if rc != 0:
|
|
96
189
|
raise RuntimeError(view.error_output() or f"exit code {rc}")
|
|
97
190
|
elif verbose.enabled():
|
|
98
191
|
try:
|
|
99
|
-
subprocess.run(cmd, check=True, cwd=cwd)
|
|
192
|
+
subprocess.run(cmd, check=True, cwd=cwd, env=_run_env())
|
|
100
193
|
except subprocess.CalledProcessError as e:
|
|
101
194
|
# The output already streamed past; repeating the whole argv in the error
|
|
102
195
|
# adds nothing the user can't see directly above it.
|
|
103
196
|
raise RuntimeError(f"exit code {e.returncode}") from e
|
|
104
197
|
else:
|
|
198
|
+
log = _open_run_log(cmd, cwd)
|
|
105
199
|
try:
|
|
106
|
-
subprocess.run(
|
|
200
|
+
done = subprocess.run(
|
|
201
|
+
cmd,
|
|
202
|
+
check=True,
|
|
203
|
+
capture_output=True,
|
|
204
|
+
text=True,
|
|
205
|
+
cwd=cwd,
|
|
206
|
+
# No view means no way to surface a prompt — a child that
|
|
207
|
+
# reads stdin gets EOF and fails fast instead of hanging.
|
|
208
|
+
stdin=subprocess.DEVNULL,
|
|
209
|
+
env=_run_env(),
|
|
210
|
+
)
|
|
211
|
+
if log is not None:
|
|
212
|
+
try:
|
|
213
|
+
log.write(done.stdout or "")
|
|
214
|
+
log.write(done.stderr or "")
|
|
215
|
+
except OSError:
|
|
216
|
+
pass
|
|
107
217
|
except subprocess.CalledProcessError as e:
|
|
218
|
+
if log is not None:
|
|
219
|
+
try:
|
|
220
|
+
log.write(e.stdout or "")
|
|
221
|
+
log.write(e.stderr or "")
|
|
222
|
+
except OSError:
|
|
223
|
+
pass
|
|
108
224
|
msg = e.stderr.strip() if e.stderr else f"exit code {e.returncode}"
|
|
109
225
|
raise RuntimeError(msg) from e
|
|
226
|
+
finally:
|
|
227
|
+
if log is not None:
|
|
228
|
+
try:
|
|
229
|
+
log.close()
|
|
230
|
+
except OSError:
|
|
231
|
+
pass
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
# How long a single sudo timestamp is kept alive between refreshes. Well under
|
|
235
|
+
# sudo's default 15-minute timestamp_timeout so a long `sudo sh installer.sh`
|
|
236
|
+
# can't expire it before the script's next sudo call.
|
|
237
|
+
_SUDO_KEEPALIVE_S = 60.0
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def _may_need_sudo(tool: GenericTool, action: str) -> bool:
|
|
241
|
+
"""Best-effort: will this action reach sudo? The same guess `profile apply`'s
|
|
242
|
+
plan warning makes — apt always does, script bodies are grepped. A `script`
|
|
243
|
+
tool's install/update body isn't known until after the download — inside
|
|
244
|
+
the view, too late — so it's assumed to elevate; its remove runs the
|
|
245
|
+
greppable `remove_script` like everyone else's."""
|
|
246
|
+
if tool.install_type == "apt":
|
|
247
|
+
return True
|
|
248
|
+
if tool.install_type == "script" and action != "remove":
|
|
249
|
+
return True
|
|
250
|
+
# getattr: needs_sudo is Tool-typed for callers; non-script Tool
|
|
251
|
+
# implementations have no script fields to grep.
|
|
252
|
+
scripts = {
|
|
253
|
+
"install": (
|
|
254
|
+
getattr(tool, "install_script", ""),
|
|
255
|
+
getattr(tool, "git_install_cmd", ""),
|
|
256
|
+
),
|
|
257
|
+
"remove": (
|
|
258
|
+
getattr(tool, "remove_script", ""),
|
|
259
|
+
getattr(tool, "git_remove_cmd", ""),
|
|
260
|
+
),
|
|
261
|
+
# update for script/bash is a reinstall of the install path
|
|
262
|
+
"update": (
|
|
263
|
+
getattr(tool, "install_script", ""),
|
|
264
|
+
getattr(tool, "git_install_cmd", ""),
|
|
265
|
+
),
|
|
266
|
+
}.get(action, ())
|
|
267
|
+
return any("sudo" in s for s in scripts if s)
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def needs_sudo(tool: Tool, action: str = "install") -> bool:
|
|
271
|
+
"""Public read of _may_need_sudo for UI tags (`list`, the install picker).
|
|
272
|
+
|
|
273
|
+
Same best-effort guess: it tags what installing *would* do, so a bash tool
|
|
274
|
+
whose script greps clean reads "user" even on a host that has sudo."""
|
|
275
|
+
return _may_need_sudo(tool, action)
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
@contextmanager
|
|
279
|
+
def _sudo_session(tool: GenericTool, action: str) -> Generator[None, None, None]:
|
|
280
|
+
"""Cache sudo credentials before the live task view owns the terminal, then
|
|
281
|
+
keep the timestamp fresh for the run.
|
|
282
|
+
|
|
283
|
+
sudo writes its password prompt to /dev/tty, not the subprocess pipe — under
|
|
284
|
+
the live view the prompt is invisible and overwritten by repaints, so a
|
|
285
|
+
mid-install sudo reads exactly like a hang. Validating first moves the one
|
|
286
|
+
prompt to the plain terminal where it can be answered; the keepalive thread
|
|
287
|
+
stops the timestamp expiring during a long install. Passwordless or
|
|
288
|
+
already-cached sudo needs no prompt at all.
|
|
289
|
+
"""
|
|
290
|
+
if not _may_need_sudo(tool, action) or not shutil.which("sudo"):
|
|
291
|
+
yield
|
|
292
|
+
return
|
|
293
|
+
cached = (
|
|
294
|
+
subprocess.run(["sudo", "-n", "-v"], capture_output=True).returncode == 0
|
|
295
|
+
)
|
|
296
|
+
if not cached:
|
|
297
|
+
if not sys.stdin.isatty():
|
|
298
|
+
# Nowhere to ask — a child sudo either is passwordless (already
|
|
299
|
+
# answered above) or fails fast with "a password is required".
|
|
300
|
+
yield
|
|
301
|
+
return
|
|
302
|
+
# stderr, not ui.dim on the stdout console: `profile apply --json` can
|
|
303
|
+
# reach this with stdout piped, and a chatter line there breaks the
|
|
304
|
+
# data contract. The sudo prompt itself is on /dev/tty either way.
|
|
305
|
+
from rich.console import Console
|
|
306
|
+
err = Console(stderr=True, highlight=False)
|
|
307
|
+
err.print(
|
|
308
|
+
f" {tool.name} needs sudo — the password prompt comes before "
|
|
309
|
+
"the progress view:",
|
|
310
|
+
style="dim",
|
|
311
|
+
)
|
|
312
|
+
if subprocess.run(["sudo", "-v"]).returncode != 0:
|
|
313
|
+
err.print(
|
|
314
|
+
" sudo credentials not cached — if the installer asks, the "
|
|
315
|
+
"prompt appears directly on the terminal.",
|
|
316
|
+
style="bold yellow",
|
|
317
|
+
)
|
|
318
|
+
yield
|
|
319
|
+
return
|
|
320
|
+
stop = threading.Event()
|
|
321
|
+
|
|
322
|
+
def _keepalive() -> None:
|
|
323
|
+
while not stop.wait(_SUDO_KEEPALIVE_S):
|
|
324
|
+
subprocess.run(["sudo", "-n", "-v"], capture_output=True)
|
|
325
|
+
|
|
326
|
+
ticker = threading.Thread(target=_keepalive, daemon=True, name="sudo-keepalive")
|
|
327
|
+
ticker.start()
|
|
328
|
+
try:
|
|
329
|
+
yield
|
|
330
|
+
finally:
|
|
331
|
+
stop.set()
|
|
110
332
|
|
|
111
333
|
|
|
112
334
|
def _probe(cmd: list, *, log_at: int = verbose.TRACE, **kwargs) -> subprocess.CompletedProcess:
|
|
@@ -226,7 +448,7 @@ class GenericTool(Tool):
|
|
|
226
448
|
if installer is None:
|
|
227
449
|
raise RuntimeError(f"Unsupported install type: {self.install_type!r}")
|
|
228
450
|
from dev_setup import ui
|
|
229
|
-
with ui.task_view(
|
|
451
|
+
with _sudo_session(self, "install"), ui.task_view(
|
|
230
452
|
f"Installing {self.name}", total=len(self.plan_items("install")) + 1
|
|
231
453
|
):
|
|
232
454
|
installer(self)
|
|
@@ -239,7 +461,9 @@ class GenericTool(Tool):
|
|
|
239
461
|
if remover is None:
|
|
240
462
|
raise RuntimeError(f"Unsupported remove type: {self.install_type!r}")
|
|
241
463
|
from dev_setup import ui
|
|
242
|
-
with
|
|
464
|
+
with _sudo_session(self, "remove"), ui.task_view(
|
|
465
|
+
f"Removing {self.name}", total=len(self.plan_items("remove"))
|
|
466
|
+
):
|
|
243
467
|
remover(self)
|
|
244
468
|
|
|
245
469
|
def update(self, version: str | None = None) -> str | None:
|
|
@@ -248,7 +472,7 @@ class GenericTool(Tool):
|
|
|
248
472
|
if updater is None:
|
|
249
473
|
raise RuntimeError(f"Unsupported update type: {self.install_type!r}")
|
|
250
474
|
from dev_setup import ui
|
|
251
|
-
with ui.task_view(
|
|
475
|
+
with _sudo_session(self, "update"), ui.task_view(
|
|
252
476
|
f"Updating {self.name}", total=len(self.plan_items("update", version)) + 1
|
|
253
477
|
):
|
|
254
478
|
updater(self, version)
|
|
@@ -272,8 +496,24 @@ class GenericTool(Tool):
|
|
|
272
496
|
self.check_cmd if _is_simple_command(self.check_cmd or "") else ""
|
|
273
497
|
) or _type_cmd(self)
|
|
274
498
|
|
|
499
|
+
# A version_cmd with arguments is the whole probe, run verbatim
|
|
500
|
+
# (`version_cmd: /usr/local/go/bin/go version` — go's version printer
|
|
501
|
+
# is a subcommand).
|
|
502
|
+
if cmd and not _is_simple_command(cmd):
|
|
503
|
+
try:
|
|
504
|
+
r = _probe(shlex.split(cmd), capture_output=True, text=True, timeout=5)
|
|
505
|
+
if r.returncode == 0 and r.stdout.strip():
|
|
506
|
+
return r.stdout.strip().splitlines()[0]
|
|
507
|
+
except Exception:
|
|
508
|
+
pass
|
|
509
|
+
return "installed"
|
|
510
|
+
|
|
275
511
|
if cmd and shutil.which(cmd):
|
|
276
|
-
|
|
512
|
+
# No bare `version` positional here: a binary that treats it as
|
|
513
|
+
# input has side effects — `mkcert version` parses it as a
|
|
514
|
+
# hostname and generates cert files in the CWD. Subcommand-style
|
|
515
|
+
# version printers must use an argumented version_cmd instead.
|
|
516
|
+
for flag in ["--version", "-v"]:
|
|
277
517
|
try:
|
|
278
518
|
r = _probe([cmd, flag], capture_output=True, text=True, timeout=5)
|
|
279
519
|
if r.returncode == 0 and r.stdout.strip():
|
|
@@ -565,8 +805,11 @@ def forget_probes() -> None:
|
|
|
565
805
|
"""Drop every memoised probe, so the next read of the machine is a fresh one.
|
|
566
806
|
|
|
567
807
|
Call it after anything that installs, updates or removes a tool and before reading state
|
|
568
|
-
that the change could have affected.
|
|
808
|
+
that the change could have affected. Also drops the apt-lists freshness memo — a script
|
|
809
|
+
may have added a repo, which the next apt install can only see after a real update.
|
|
569
810
|
"""
|
|
811
|
+
global _apt_refreshed_at
|
|
812
|
+
_apt_refreshed_at = 0.0
|
|
570
813
|
for memo in _MEMOS:
|
|
571
814
|
memo.cache_clear() # type: ignore[attr-defined]
|
|
572
815
|
|
|
@@ -1042,23 +1285,49 @@ def _npm_global_installed(pkg: str) -> bool:
|
|
|
1042
1285
|
["bash", "-lc", f"{_npm_init()} && npm list -g --depth=0 {shlex.quote(pkg)}"],
|
|
1043
1286
|
capture_output=True,
|
|
1044
1287
|
text=True,
|
|
1288
|
+
timeout=30,
|
|
1045
1289
|
)
|
|
1046
1290
|
return pkg in r.stdout
|
|
1047
1291
|
except Exception:
|
|
1048
1292
|
return False
|
|
1049
1293
|
|
|
1050
1294
|
|
|
1295
|
+
# Last successful `apt-get update` this process. Batch installs used to refresh
|
|
1296
|
+
# the lists once per apt tool — N packages cost N updates at 5-30s each. Lists
|
|
1297
|
+
# younger than this are fresh enough for anything the same command run installs.
|
|
1298
|
+
_APT_REFRESH_MIN_S = 600.0
|
|
1299
|
+
_apt_refreshed_at: float = 0.0
|
|
1300
|
+
|
|
1301
|
+
|
|
1051
1302
|
def _run_apt_update() -> None:
|
|
1052
1303
|
"""Refresh apt's package lists. Deliberately non-fatal: a failing mirror shouldn't
|
|
1053
|
-
stop an install of a package that may already be cached.
|
|
1304
|
+
stop an install of a package that may already be cached. Skipped if the lists
|
|
1305
|
+
were refreshed within this process in the last few minutes."""
|
|
1306
|
+
global _apt_refreshed_at
|
|
1054
1307
|
from dev_setup import ui
|
|
1308
|
+
if time.monotonic() - _apt_refreshed_at < _APT_REFRESH_MIN_S:
|
|
1309
|
+
verbose.log("apt-get update skipped — lists refreshed moments ago")
|
|
1310
|
+
view = ui.current_view()
|
|
1311
|
+
if view is not None:
|
|
1312
|
+
view.feed("package lists already fresh — skipping update")
|
|
1313
|
+
return
|
|
1055
1314
|
if ui.current_view() is not None:
|
|
1056
1315
|
try:
|
|
1057
1316
|
_run(["sudo", "apt-get", "update", "-q"])
|
|
1317
|
+
_apt_refreshed_at = time.monotonic()
|
|
1058
1318
|
except RuntimeError:
|
|
1059
1319
|
pass
|
|
1060
1320
|
else:
|
|
1061
|
-
|
|
1321
|
+
try:
|
|
1322
|
+
r = _probe(
|
|
1323
|
+
["sudo", "apt-get", "update", "-q"],
|
|
1324
|
+
log_at=verbose.VERBOSE,
|
|
1325
|
+
timeout=180,
|
|
1326
|
+
)
|
|
1327
|
+
if r.returncode == 0:
|
|
1328
|
+
_apt_refreshed_at = time.monotonic()
|
|
1329
|
+
except Exception:
|
|
1330
|
+
pass
|
|
1062
1331
|
|
|
1063
1332
|
|
|
1064
1333
|
def _npm_init() -> str:
|
|
@@ -1131,7 +1400,9 @@ def _is_simple_command(cmd: str) -> bool:
|
|
|
1131
1400
|
|
|
1132
1401
|
|
|
1133
1402
|
def _bash_version(key: str) -> str:
|
|
1134
|
-
|
|
1403
|
+
# See get_version: no bare `version` positional — `mkcert version` would
|
|
1404
|
+
# generate cert files.
|
|
1405
|
+
for flag in ["--version", "-v"]:
|
|
1135
1406
|
try:
|
|
1136
1407
|
r = _probe(
|
|
1137
1408
|
[
|
|
@@ -1148,6 +1419,10 @@ def _bash_version(key: str) -> str:
|
|
|
1148
1419
|
|
|
1149
1420
|
|
|
1150
1421
|
def _check_cmd_installed(cmd: str, *, install_type: str = "") -> bool:
|
|
1422
|
+
# `bash -lc` sources ~/.profile — an interactive command there (ssh-add,
|
|
1423
|
+
# keychain, read) would hang the CLI with no output and no task view yet.
|
|
1424
|
+
# The timeout bounds that at 15s; a `command -v` never legitimately takes
|
|
1425
|
+
# that long, and a timeout reads as "not installed", not a crash.
|
|
1151
1426
|
if _is_simple_command(cmd):
|
|
1152
1427
|
if shutil.which(cmd) is not None:
|
|
1153
1428
|
return True
|
|
@@ -1157,6 +1432,7 @@ def _check_cmd_installed(cmd: str, *, install_type: str = "") -> bool:
|
|
|
1157
1432
|
return _probe(
|
|
1158
1433
|
["bash", "-lc", f"{prefix}command -v {cmd} >/dev/null 2>&1"],
|
|
1159
1434
|
capture_output=True,
|
|
1435
|
+
timeout=15,
|
|
1160
1436
|
).returncode == 0
|
|
1161
1437
|
except Exception:
|
|
1162
1438
|
return False
|
|
@@ -1167,6 +1443,8 @@ def _check_cmd_installed(cmd: str, *, install_type: str = "") -> bool:
|
|
|
1167
1443
|
# immediately after installing successfully.
|
|
1168
1444
|
prefix = f"{_npm_init()} && " if install_type == "npm" else ""
|
|
1169
1445
|
try:
|
|
1170
|
-
return _probe(
|
|
1446
|
+
return _probe(
|
|
1447
|
+
["bash", "-lc", f"{prefix}{cmd}"], capture_output=True, timeout=15
|
|
1448
|
+
).returncode == 0
|
|
1171
1449
|
except Exception:
|
|
1172
1450
|
return False
|
dev_setup/tools.yaml
CHANGED
|
@@ -63,7 +63,7 @@ tools:
|
|
|
63
63
|
esac
|
|
64
64
|
tmpdir="$(mktemp -d)"
|
|
65
65
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
66
|
-
curl -fsSL -o "$tmpdir/arcane-cli.tar.gz" "https://github.com/getarcaneapp/arcane/releases/latest/download/arcane-cli_linux_${arch}.tar.gz"
|
|
66
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/arcane-cli.tar.gz" "https://github.com/getarcaneapp/arcane/releases/latest/download/arcane-cli_linux_${arch}.tar.gz"
|
|
67
67
|
tar -C "$tmpdir" -xzf "$tmpdir/arcane-cli.tar.gz" arcane-cli
|
|
68
68
|
sudo mv "$tmpdir/arcane-cli" /usr/local/bin/arcane-cli
|
|
69
69
|
sudo chmod +x /usr/local/bin/arcane-cli
|
|
@@ -81,15 +81,14 @@ tools:
|
|
|
81
81
|
docs_url: https://docs.aws.amazon.com/cli/latest/userguide/
|
|
82
82
|
install_script: |
|
|
83
83
|
set -euo pipefail
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
aws_arch="aarch64"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
fi
|
|
84
|
+
case "$(uname -m)" in
|
|
85
|
+
x86_64) aws_arch="x86_64" ;;
|
|
86
|
+
aarch64) aws_arch="aarch64" ;;
|
|
87
|
+
*) echo "aws: no release build for $(uname -m)" >&2; exit 1 ;;
|
|
88
|
+
esac
|
|
90
89
|
tmpdir="$(mktemp -d)"
|
|
91
90
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
92
|
-
curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-${aws_arch}.zip" -o "$tmpdir/awscliv2.zip"
|
|
91
|
+
curl --connect-timeout 15 --max-time 300 -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-${aws_arch}.zip" -o "$tmpdir/awscliv2.zip"
|
|
93
92
|
python3 - "$tmpdir/awscliv2.zip" "$tmpdir" <<'PY'
|
|
94
93
|
import os
|
|
95
94
|
import stat
|
|
@@ -116,6 +115,7 @@ tools:
|
|
|
116
115
|
set -euo pipefail
|
|
117
116
|
sudo rm -rf /usr/local/aws-cli
|
|
118
117
|
sudo rm -f /usr/local/bin/aws /usr/local/bin/aws_completer
|
|
118
|
+
echo "Config and credentials under ~/.aws were left in place."
|
|
119
119
|
|
|
120
120
|
bat:
|
|
121
121
|
name: bat
|
|
@@ -127,17 +127,16 @@ tools:
|
|
|
127
127
|
docs_url: https://github.com/sharkdp/bat
|
|
128
128
|
install_script: |
|
|
129
129
|
set -euo pipefail
|
|
130
|
-
version="$(curl -fsSL https://api.github.com/repos/sharkdp/bat/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 0.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
arch="aarch64"
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
fi
|
|
130
|
+
version="$(curl --connect-timeout 15 --max-time 300 -fsSL https://api.github.com/repos/sharkdp/bat/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 0.26.1)"
|
|
131
|
+
case "$(uname -m)" in
|
|
132
|
+
x86_64) arch="x86_64" ;;
|
|
133
|
+
aarch64) arch="aarch64" ;;
|
|
134
|
+
*) echo "bat: no release binary for $(uname -m)" >&2; exit 1 ;;
|
|
135
|
+
esac
|
|
137
136
|
filename="bat-v${version}-${arch}-unknown-linux-gnu.tar.gz"
|
|
138
137
|
tmpdir="$(mktemp -d)"
|
|
139
138
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
140
|
-
curl -fsSL -o "$tmpdir/$filename" "https://github.com/sharkdp/bat/releases/download/v${version}/${filename}"
|
|
139
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/$filename" "https://github.com/sharkdp/bat/releases/download/v${version}/${filename}"
|
|
141
140
|
tar -C "$tmpdir" -xzf "$tmpdir/$filename"
|
|
142
141
|
sudo mv "$tmpdir/bat-v${version}-${arch}-unknown-linux-gnu/bat" /usr/local/bin/bat
|
|
143
142
|
sudo chmod +x /usr/local/bin/bat
|
|
@@ -239,7 +238,7 @@ tools:
|
|
|
239
238
|
set -euo pipefail
|
|
240
239
|
tmp="$(mktemp --suffix=.sh)"
|
|
241
240
|
trap 'rm -f "$tmp"' EXIT
|
|
242
|
-
curl -fsSL https://cli.devin.ai/install.sh -o "$tmp"
|
|
241
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://cli.devin.ai/install.sh -o "$tmp"
|
|
243
242
|
# The installer's last step runs `devin setup`, an interactive auth/MCP
|
|
244
243
|
# wizard with no flag to skip it. Strip the line (best-effort — if
|
|
245
244
|
# upstream renames it, stdin is /dev/null anyway so the wizard reads EOF
|
|
@@ -275,14 +274,17 @@ tools:
|
|
|
275
274
|
description: Container runtime + docker compose plugin
|
|
276
275
|
category: tools
|
|
277
276
|
type: bash
|
|
278
|
-
|
|
277
|
+
# The entry also promises the compose plugin (installed below), so a docker
|
|
278
|
+
# without it must read as not-installed — same reasoning as bubblewrap's
|
|
279
|
+
# both-binaries check.
|
|
280
|
+
check_cmd: command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1
|
|
279
281
|
help_cmd: docker --help
|
|
280
282
|
docs_url: https://docs.docker.com
|
|
281
283
|
install_script: |
|
|
282
284
|
set -euo pipefail
|
|
283
285
|
tmp="$(mktemp --suffix=.sh)"
|
|
284
286
|
trap 'rm -f "$tmp"' EXIT
|
|
285
|
-
curl -fsSL https://get.docker.com -o "$tmp"
|
|
287
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://get.docker.com -o "$tmp"
|
|
286
288
|
sudo sh "$tmp"
|
|
287
289
|
user="${USER:-}"
|
|
288
290
|
if [ -n "$user" ] && groups "$user" | grep -qv '\bdocker\b'; then
|
|
@@ -304,6 +306,7 @@ tools:
|
|
|
304
306
|
sudo apt-get remove -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras 2>/dev/null \
|
|
305
307
|
|| sudo yum remove -y docker-ce docker-ce-cli containerd.io docker-compose-plugin 2>/dev/null \
|
|
306
308
|
|| true
|
|
309
|
+
echo "The apt/yum source, keyring, and your docker group membership were left in place."
|
|
307
310
|
|
|
308
311
|
fzf:
|
|
309
312
|
name: fzf
|
|
@@ -338,6 +341,9 @@ tools:
|
|
|
338
341
|
fi
|
|
339
342
|
remove_script: |
|
|
340
343
|
set -euo pipefail
|
|
344
|
+
# Remove the package first: if apt fails, the marker must stay or
|
|
345
|
+
# check_cmd would claim not-installed while fzf is still present.
|
|
346
|
+
sudo apt-get remove -y fzf
|
|
341
347
|
if [ -f "$HOME/.bashrc" ]; then
|
|
342
348
|
python3 - "$HOME/.bashrc" <<'PY'
|
|
343
349
|
import sys
|
|
@@ -356,7 +362,6 @@ tools:
|
|
|
356
362
|
open(path, "w").write("\n".join(out) + ("\n" if out else ""))
|
|
357
363
|
PY
|
|
358
364
|
fi
|
|
359
|
-
sudo apt-get remove -y fzf
|
|
360
365
|
|
|
361
366
|
gh:
|
|
362
367
|
name: GitHub CLI
|
|
@@ -368,7 +373,7 @@ tools:
|
|
|
368
373
|
docs_url: https://cli.github.com/manual/
|
|
369
374
|
install_script: |
|
|
370
375
|
set -euo pipefail
|
|
371
|
-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
|
376
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
|
372
377
|
| sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
373
378
|
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
374
379
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
|
|
@@ -378,6 +383,7 @@ tools:
|
|
|
378
383
|
remove_script: |
|
|
379
384
|
set -euo pipefail
|
|
380
385
|
sudo apt-get remove -y gh
|
|
386
|
+
echo "The apt source and keyring were left in place — they may predate this install."
|
|
381
387
|
|
|
382
388
|
ghgrab:
|
|
383
389
|
name: ghgrab
|
|
@@ -399,17 +405,16 @@ tools:
|
|
|
399
405
|
docs_url: https://git-lfs.com/
|
|
400
406
|
install_script: |
|
|
401
407
|
set -euo pipefail
|
|
402
|
-
version="$(curl -fsSL https://api.github.com/repos/git-lfs/git-lfs/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 3.
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
arch="arm64"
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
fi
|
|
408
|
+
version="$(curl --connect-timeout 15 --max-time 300 -fsSL https://api.github.com/repos/git-lfs/git-lfs/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 3.8.1)"
|
|
409
|
+
case "$(uname -m)" in
|
|
410
|
+
x86_64) arch="amd64" ;;
|
|
411
|
+
aarch64) arch="arm64" ;;
|
|
412
|
+
*) echo "git-lfs: no release binary for $(uname -m)" >&2; exit 1 ;;
|
|
413
|
+
esac
|
|
409
414
|
filename="git-lfs-linux-${arch}-v${version}.tar.gz"
|
|
410
415
|
tmpdir="$(mktemp -d)"
|
|
411
416
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
412
|
-
curl -fsSL -o "$tmpdir/$filename" "https://github.com/git-lfs/git-lfs/releases/download/v${version}/${filename}"
|
|
417
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/$filename" "https://github.com/git-lfs/git-lfs/releases/download/v${version}/${filename}"
|
|
413
418
|
tar -C "$tmpdir" -xzf "$tmpdir/$filename"
|
|
414
419
|
sudo bash "$tmpdir/git-lfs-${version}/install.sh"
|
|
415
420
|
git lfs install
|
|
@@ -427,28 +432,32 @@ tools:
|
|
|
427
432
|
category: languages
|
|
428
433
|
type: bash
|
|
429
434
|
check_cmd: command -v go >/dev/null 2>&1 || test -x /usr/local/go/bin/go
|
|
435
|
+
# go's version printer is a subcommand, not a flag — version_cmd carries it
|
|
436
|
+
# verbatim (get_version never appends a bare `version` on its own: mkcert
|
|
437
|
+
# would treat it as a hostname and write cert files).
|
|
438
|
+
version_cmd: /usr/local/go/bin/go version
|
|
430
439
|
help_cmd: go help
|
|
431
440
|
docs_url: https://go.dev/doc/
|
|
432
441
|
install_script: |
|
|
433
442
|
set -euo pipefail
|
|
434
|
-
version="$(curl -fsSL https://go.dev/dl/?mode=json | python3 -c 'import json,sys; data=json.load(sys.stdin); print(next((r["version"].removeprefix("go") for r in data if r.get("stable")), "1.
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
arch="arm64"
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
fi
|
|
443
|
+
version="$(curl --connect-timeout 15 --max-time 300 -fsSL https://go.dev/dl/?mode=json | python3 -c 'import json,sys; data=json.load(sys.stdin); print(next((r["version"].removeprefix("go") for r in data if r.get("stable")), "1.27.4"))' 2>/dev/null || echo 1.27.4)"
|
|
444
|
+
case "$(uname -m)" in
|
|
445
|
+
x86_64) arch="amd64" ;;
|
|
446
|
+
aarch64) arch="arm64" ;;
|
|
447
|
+
*) echo "go: no release tarball for $(uname -m)" >&2; exit 1 ;;
|
|
448
|
+
esac
|
|
441
449
|
filename="go${version}.linux-${arch}.tar.gz"
|
|
442
450
|
tmpdir="$(mktemp -d)"
|
|
443
451
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
444
|
-
curl -fsSL -o "$tmpdir/$filename" "https://go.dev/dl/$filename"
|
|
452
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/$filename" "https://go.dev/dl/$filename"
|
|
445
453
|
sudo rm -rf /usr/local/go
|
|
446
454
|
sudo tar -C /usr/local -xzf "$tmpdir/$filename"
|
|
447
455
|
marker="# Go"
|
|
448
|
-
|
|
456
|
+
block='export PATH=$PATH:/usr/local/go/bin
|
|
457
|
+
export PATH="$HOME/go/bin:$PATH"'
|
|
449
458
|
touch "$HOME/.bashrc"
|
|
450
459
|
if ! grep -Fxq "$marker" "$HOME/.bashrc"; then
|
|
451
|
-
printf '\n%s\n%s\n' "$marker" "$
|
|
460
|
+
printf '\n%s\n%s\n' "$marker" "$block" >> "$HOME/.bashrc"
|
|
452
461
|
fi
|
|
453
462
|
remove_script: |
|
|
454
463
|
set -euo pipefail
|
|
@@ -465,7 +474,7 @@ tools:
|
|
|
465
474
|
skip -= 1
|
|
466
475
|
continue
|
|
467
476
|
if line == "# Go":
|
|
468
|
-
skip =
|
|
477
|
+
skip = 2
|
|
469
478
|
continue
|
|
470
479
|
out.append(line)
|
|
471
480
|
open(path, "w").write("\n".join(out) + ("\n" if out else ""))
|
|
@@ -485,7 +494,7 @@ tools:
|
|
|
485
494
|
# Charm's apt repo, not the Ubuntu archive: the archive ships gum 0.17, upstream is 2.x.
|
|
486
495
|
# The key is ASCII-armoured and apt reads it as-is from a .asc path, so no gpg is needed.
|
|
487
496
|
sudo install -d -m 0755 /etc/apt/keyrings
|
|
488
|
-
sudo curl -fsSL -o /etc/apt/keyrings/charm.asc https://repo.charm.sh/apt/gpg.key
|
|
497
|
+
sudo curl --connect-timeout 15 --max-time 300 -fsSL -o /etc/apt/keyrings/charm.asc https://repo.charm.sh/apt/gpg.key
|
|
489
498
|
echo "deb [signed-by=/etc/apt/keyrings/charm.asc] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list >/dev/null
|
|
490
499
|
sudo apt-get update -q
|
|
491
500
|
sudo apt-get install -y gum
|
|
@@ -500,13 +509,21 @@ tools:
|
|
|
500
509
|
category: tools
|
|
501
510
|
type: bash
|
|
502
511
|
check_cmd: command -v brew >/dev/null 2>&1 || test -x /home/linuxbrew/.linuxbrew/bin/brew
|
|
512
|
+
version_cmd: brew
|
|
503
513
|
help_cmd: brew --help
|
|
504
514
|
docs_url: https://docs.brew.sh/Homebrew-on-Linux
|
|
505
515
|
install_script: |
|
|
506
516
|
set -euo pipefail
|
|
507
517
|
sudo apt-get update -q
|
|
508
|
-
|
|
509
|
-
|
|
518
|
+
# build-essential procps curl file git are brew's documented Linux
|
|
519
|
+
# requirements; bubblewrap is deliberate here (Claude's /sandbox).
|
|
520
|
+
sudo apt-get install -y build-essential procps curl file git bubblewrap
|
|
521
|
+
tmp="$(mktemp --suffix=.sh)"
|
|
522
|
+
trap 'rm -f "$tmp"' EXIT
|
|
523
|
+
# Download to a file, not "$(curl …)" — a failed download inside $()
|
|
524
|
+
# substitutes empty text and `bash -c ""` exits 0, a phantom success.
|
|
525
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o "$tmp"
|
|
526
|
+
NONINTERACTIVE=1 /bin/bash "$tmp"
|
|
510
527
|
marker="# Homebrew"
|
|
511
528
|
line='eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"'
|
|
512
529
|
touch "$HOME/.bashrc"
|
|
@@ -515,7 +532,10 @@ tools:
|
|
|
515
532
|
fi
|
|
516
533
|
remove_script: |
|
|
517
534
|
set -euo pipefail
|
|
518
|
-
|
|
535
|
+
tmp="$(mktemp --suffix=.sh)"
|
|
536
|
+
trap 'rm -f "$tmp"' EXIT
|
|
537
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh -o "$tmp"
|
|
538
|
+
NONINTERACTIVE=1 /bin/bash "$tmp"
|
|
519
539
|
if [ -f "$HOME/.bashrc" ]; then
|
|
520
540
|
python3 - "$HOME/.bashrc" <<'PY'
|
|
521
541
|
import sys
|
|
@@ -558,7 +578,7 @@ tools:
|
|
|
558
578
|
category: tools
|
|
559
579
|
type: bash
|
|
560
580
|
check_cmd: htop
|
|
561
|
-
help_cmd:
|
|
581
|
+
help_cmd: htop --help
|
|
562
582
|
docs_url: https://htop.dev/
|
|
563
583
|
install_script: |
|
|
564
584
|
set -euo pipefail
|
|
@@ -596,7 +616,8 @@ tools:
|
|
|
596
616
|
remove_script: |
|
|
597
617
|
set -euo pipefail
|
|
598
618
|
sudo apt-get remove -y openjdk-21-jdk openjdk-21-jre
|
|
599
|
-
|
|
619
|
+
# No `apt-get autoremove -y`: it purges every orphan on the system, not
|
|
620
|
+
# just Java's deps. Left dependencies are harmless.
|
|
600
621
|
|
|
601
622
|
lazygit:
|
|
602
623
|
name: lazygit
|
|
@@ -608,17 +629,16 @@ tools:
|
|
|
608
629
|
docs_url: https://github.com/jesseduffield/lazygit
|
|
609
630
|
install_script: |
|
|
610
631
|
set -euo pipefail
|
|
611
|
-
version="$(curl -fsSL https://api.github.com/repos/jesseduffield/lazygit/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 0.
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
arch="arm64"
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
fi
|
|
632
|
+
version="$(curl --connect-timeout 15 --max-time 300 -fsSL https://api.github.com/repos/jesseduffield/lazygit/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 0.66.3)"
|
|
633
|
+
case "$(uname -m)" in
|
|
634
|
+
x86_64) arch="x86_64" ;;
|
|
635
|
+
aarch64) arch="arm64" ;;
|
|
636
|
+
*) echo "lazygit: no release binary for $(uname -m)" >&2; exit 1 ;;
|
|
637
|
+
esac
|
|
618
638
|
filename="lazygit_${version}_Linux_${arch}.tar.gz"
|
|
619
639
|
tmpdir="$(mktemp -d)"
|
|
620
640
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
621
|
-
curl -fsSL -o "$tmpdir/$filename" "https://github.com/jesseduffield/lazygit/releases/download/v${version}/${filename}"
|
|
641
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/$filename" "https://github.com/jesseduffield/lazygit/releases/download/v${version}/${filename}"
|
|
622
642
|
tar -C "$tmpdir" -xzf "$tmpdir/$filename" lazygit
|
|
623
643
|
sudo mv "$tmpdir/lazygit" /usr/local/bin/lazygit
|
|
624
644
|
sudo chmod +x /usr/local/bin/lazygit
|
|
@@ -636,18 +656,24 @@ tools:
|
|
|
636
656
|
docs_url: https://github.com/FiloSottile/mkcert
|
|
637
657
|
install_script: |
|
|
638
658
|
set -euo pipefail
|
|
639
|
-
version="$(curl -fsSL https://api.github.com/repos/FiloSottile/mkcert/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 1.4.4)"
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
arch="arm64"
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
sudo curl -fsSL -o /usr/local/bin/mkcert "https://github.com/FiloSottile/mkcert/releases/download/v${version}/mkcert-v${version}-linux-${arch}"
|
|
659
|
+
version="$(curl --connect-timeout 15 --max-time 300 -fsSL https://api.github.com/repos/FiloSottile/mkcert/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 1.4.4)"
|
|
660
|
+
case "$(uname -m)" in
|
|
661
|
+
x86_64) arch="amd64" ;;
|
|
662
|
+
aarch64) arch="arm64" ;;
|
|
663
|
+
*) echo "mkcert: no release binary for $(uname -m)" >&2; exit 1 ;;
|
|
664
|
+
esac
|
|
665
|
+
sudo curl --connect-timeout 15 --max-time 300 -fsSL -o /usr/local/bin/mkcert "https://github.com/FiloSottile/mkcert/releases/download/v${version}/mkcert-v${version}-linux-${arch}"
|
|
647
666
|
sudo chmod +x /usr/local/bin/mkcert
|
|
667
|
+
# Without -install no CA is trusted, so every cert mkcert generates is
|
|
668
|
+
# untrusted — the binary alone is only half the tool. libnss3-tools
|
|
669
|
+
# provides certutil for the Firefox/Chrome NSS stores; non-fatal since
|
|
670
|
+
# the system trust store works without it.
|
|
671
|
+
sudo apt-get install -y libnss3-tools 2>/dev/null || true
|
|
672
|
+
mkcert -install 2>/dev/null || echo "CA trust setup skipped — run 'mkcert -install' when ready."
|
|
648
673
|
remove_script: |
|
|
649
674
|
set -euo pipefail
|
|
650
675
|
sudo rm -f /usr/local/bin/mkcert
|
|
676
|
+
echo "The local CA under $(mkcert -CAROOT 2>/dev/null || echo '~/.local/share/mkcert') and any system trust additions were left in place."
|
|
651
677
|
|
|
652
678
|
nerd-font:
|
|
653
679
|
name: JetBrainsMono Nerd Font
|
|
@@ -664,7 +690,7 @@ tools:
|
|
|
664
690
|
dest="$HOME/.local/share/fonts/JetBrainsMonoNerdFont"
|
|
665
691
|
tmpdir="$(mktemp -d)"
|
|
666
692
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
667
|
-
curl -fsSL -o "$tmpdir/font.zip" \
|
|
693
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/font.zip" \
|
|
668
694
|
"https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.zip"
|
|
669
695
|
mkdir -p "$dest"
|
|
670
696
|
# python3 rather than unzip: it is already a hard requirement of this repo, and
|
|
@@ -707,8 +733,8 @@ tools:
|
|
|
707
733
|
docs_url: https://github.com/nvm-sh/nvm
|
|
708
734
|
install_script: |
|
|
709
735
|
set -euo pipefail
|
|
710
|
-
tag="$(curl -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"])' 2>/dev/null || echo v0.40.3)"
|
|
711
|
-
curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${tag}/install.sh" | bash
|
|
736
|
+
tag="$(curl --connect-timeout 15 --max-time 300 -fsSL https://api.github.com/repos/nvm-sh/nvm/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"])' 2>/dev/null || echo v0.40.3)"
|
|
737
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o- "https://raw.githubusercontent.com/nvm-sh/nvm/${tag}/install.sh" | bash
|
|
712
738
|
marker="# nvm"
|
|
713
739
|
block='export NVM_DIR="$HOME/.nvm"
|
|
714
740
|
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
@@ -751,7 +777,12 @@ tools:
|
|
|
751
777
|
docs_url: https://ollama.com/docs
|
|
752
778
|
install_script: |
|
|
753
779
|
set -euo pipefail
|
|
754
|
-
|
|
780
|
+
# Upstream's installer elevates internally (sudo to /usr/local, systemd
|
|
781
|
+
# unit, ollama user) — the sudo -v below exists so _may_need_sudo sees
|
|
782
|
+
# the token and primes credentials before the live view opens. Without
|
|
783
|
+
# it the prompt lands on /dev/tty behind the view and reads as a hang.
|
|
784
|
+
sudo -v
|
|
785
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://ollama.com/install.sh | sh
|
|
755
786
|
remove_script: |
|
|
756
787
|
set -euo pipefail
|
|
757
788
|
sudo systemctl stop ollama 2>/dev/null || true
|
|
@@ -759,6 +790,7 @@ tools:
|
|
|
759
790
|
sudo rm -f /usr/local/bin/ollama /etc/systemd/system/ollama.service
|
|
760
791
|
sudo systemctl daemon-reload 2>/dev/null || true
|
|
761
792
|
echo "Downloaded models in ~/.ollama were left intact."
|
|
793
|
+
echo "The 'ollama' system user/group and /usr/share/ollama were left in place."
|
|
762
794
|
|
|
763
795
|
opencode:
|
|
764
796
|
name: OpenCode
|
|
@@ -792,7 +824,9 @@ tools:
|
|
|
792
824
|
remove_script: |
|
|
793
825
|
set -euo pipefail
|
|
794
826
|
sudo apt-get remove -y 'php8.4*'
|
|
795
|
-
|
|
827
|
+
# No `apt-get autoremove -y`: it purges every orphan on the system, not
|
|
828
|
+
# just PHP's deps. The PPA and software-properties-common are left too.
|
|
829
|
+
echo "The ppa:ondrej/php apt source was left in place."
|
|
796
830
|
|
|
797
831
|
python:
|
|
798
832
|
name: Python (uv-managed)
|
|
@@ -892,6 +926,10 @@ tools:
|
|
|
892
926
|
category: languages
|
|
893
927
|
type: bash
|
|
894
928
|
check_cmd: test -x "$HOME/.rbenv/bin/rbenv"
|
|
929
|
+
# check_cmd is a shell expression, so without this get_version falls back to
|
|
930
|
+
# probing `ruby --version` in a non-login shell where the rbenv PATH block
|
|
931
|
+
# never ran. `which` sees the user's interactive-shell PATH instead.
|
|
932
|
+
version_cmd: ruby
|
|
895
933
|
help_cmd: ruby --version
|
|
896
934
|
docs_url: https://www.ruby-lang.org/en/documentation/
|
|
897
935
|
install_script: |
|
|
@@ -915,7 +953,7 @@ tools:
|
|
|
915
953
|
if ! grep -Fxq "$marker" "$HOME/.bashrc"; then
|
|
916
954
|
printf '\n%s\n%s\n' "$marker" "$block" >> "$HOME/.bashrc"
|
|
917
955
|
fi
|
|
918
|
-
latest="$("$HOME/.rbenv/bin/rbenv" install -l | awk '/^[[:space:]]*[0-9]/ && $1 !~ /-/ { v=$1 } END { print v ? v : "3.
|
|
956
|
+
latest="$("$HOME/.rbenv/bin/rbenv" install -l | awk '/^[[:space:]]*[0-9]/ && $1 !~ /-/ { v=$1 } END { print v ? v : "3.4.7" }')"
|
|
919
957
|
"$HOME/.rbenv/bin/rbenv" install -s "$latest"
|
|
920
958
|
"$HOME/.rbenv/bin/rbenv" global "$latest"
|
|
921
959
|
remove_script: |
|
|
@@ -950,17 +988,16 @@ tools:
|
|
|
950
988
|
docs_url: https://github.com/Versent/saml2aws
|
|
951
989
|
install_script: |
|
|
952
990
|
set -euo pipefail
|
|
953
|
-
version="$(curl -fsSL https://api.github.com/repos/Versent/saml2aws/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 2.36.
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
arch="arm64"
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
fi
|
|
991
|
+
version="$(curl --connect-timeout 15 --max-time 300 -fsSL https://api.github.com/repos/Versent/saml2aws/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"].lstrip("v"))' 2>/dev/null || echo 2.36.19)"
|
|
992
|
+
case "$(uname -m)" in
|
|
993
|
+
x86_64) arch="amd64" ;;
|
|
994
|
+
aarch64) arch="arm64" ;;
|
|
995
|
+
*) echo "saml2aws: no release binary for $(uname -m)" >&2; exit 1 ;;
|
|
996
|
+
esac
|
|
960
997
|
filename="saml2aws_${version}_linux_${arch}.tar.gz"
|
|
961
998
|
tmpdir="$(mktemp -d)"
|
|
962
999
|
trap 'rm -rf "$tmpdir"' EXIT
|
|
963
|
-
curl -fsSL -o "$tmpdir/$filename" "https://github.com/Versent/saml2aws/releases/download/v${version}/${filename}"
|
|
1000
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/$filename" "https://github.com/Versent/saml2aws/releases/download/v${version}/${filename}"
|
|
964
1001
|
tar -C "$tmpdir" -xzf "$tmpdir/$filename"
|
|
965
1002
|
test -f "$tmpdir/saml2aws"
|
|
966
1003
|
sudo mv "$tmpdir/saml2aws" /usr/local/bin/saml2aws
|
|
@@ -989,7 +1026,12 @@ tools:
|
|
|
989
1026
|
docs_url: https://starship.rs/guide/
|
|
990
1027
|
install_script: |
|
|
991
1028
|
set -euo pipefail
|
|
992
|
-
|
|
1029
|
+
# Upstream's installer elevates internally (sudo install to
|
|
1030
|
+
# /usr/local/bin) — the sudo -v below exists so _may_need_sudo sees the
|
|
1031
|
+
# token and primes credentials before the live view opens. Without it
|
|
1032
|
+
# the prompt lands on /dev/tty behind the view and reads as a hang.
|
|
1033
|
+
sudo -v
|
|
1034
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://starship.rs/install.sh | sh -s -- --yes
|
|
993
1035
|
marker="# Starship prompt"
|
|
994
1036
|
line='eval "$(starship init bash)"'
|
|
995
1037
|
touch "$HOME/.bashrc"
|
|
@@ -1031,7 +1073,7 @@ tools:
|
|
|
1031
1073
|
set -euo pipefail
|
|
1032
1074
|
# The official apt repo (v2), not the Ubuntu archive (which ships 1.29).
|
|
1033
1075
|
sudo install -d -m 0755 /etc/apt/keyrings
|
|
1034
|
-
sudo curl -fsSL -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
|
|
1076
|
+
sudo curl --connect-timeout 15 --max-time 300 -fsSL -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg
|
|
1035
1077
|
echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable-v2" | sudo tee /etc/apt/sources.list.d/syncthing.list >/dev/null
|
|
1036
1078
|
sudo apt-get update -q
|
|
1037
1079
|
sudo apt-get install -y syncthing
|
|
@@ -1057,7 +1099,7 @@ tools:
|
|
|
1057
1099
|
type: apt
|
|
1058
1100
|
apt_packages: tmux
|
|
1059
1101
|
check_cmd: tmux
|
|
1060
|
-
help_cmd: tmux
|
|
1102
|
+
help_cmd: man tmux
|
|
1061
1103
|
docs_url: https://github.com/tmux/tmux/wiki
|
|
1062
1104
|
|
|
1063
1105
|
uv:
|
|
@@ -1065,12 +1107,12 @@ tools:
|
|
|
1065
1107
|
description: Astral Python package and project manager
|
|
1066
1108
|
category: core
|
|
1067
1109
|
type: bash
|
|
1068
|
-
check_cmd: command -v uv >/dev/null 2>&1 && command -v uvx >/dev/null 2>&1 || { test -x "$HOME/.local/bin/uv" && test -x "$HOME/.local/bin/uvx"; }
|
|
1110
|
+
check_cmd: command -v uv >/dev/null 2>&1 && command -v uvx >/dev/null 2>&1 || { test -x "$HOME/.local/bin/uv" && test -x "$HOME/.local/bin/uvx"; } || { test -x "$HOME/.cargo/bin/uv" && test -x "$HOME/.cargo/bin/uvx"; }
|
|
1069
1111
|
help_cmd: uv --help
|
|
1070
1112
|
docs_url: https://docs.astral.sh/uv/
|
|
1071
1113
|
install_script: |
|
|
1072
1114
|
set -euo pipefail
|
|
1073
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
1115
|
+
curl --connect-timeout 15 --max-time 300 -LsSf https://astral.sh/uv/install.sh | sh
|
|
1074
1116
|
marker="# uv (and other ~/.local/bin tools)"
|
|
1075
1117
|
line='export PATH="$HOME/.local/bin:$PATH"'
|
|
1076
1118
|
touch "$HOME/.bashrc"
|
|
@@ -1079,7 +1121,31 @@ tools:
|
|
|
1079
1121
|
fi
|
|
1080
1122
|
remove_script: |
|
|
1081
1123
|
set -euo pipefail
|
|
1124
|
+
tools_dir="$HOME/.local/share/uv/tools"
|
|
1082
1125
|
rm -f "$HOME/.local/bin/uv" "$HOME/.local/bin/uvx" "$HOME/.cargo/bin/uv" "$HOME/.cargo/bin/uvx"
|
|
1126
|
+
if [ -d "$tools_dir" ] && [ -n "$(ls -A "$tools_dir" 2>/dev/null)" ]; then
|
|
1127
|
+
echo "uv tool envs remain in $tools_dir — uvx tools still run, but can no"
|
|
1128
|
+
echo "longer be updated or removed through devstuff until uv is reinstalled."
|
|
1129
|
+
fi
|
|
1130
|
+
echo "~/.local/share/uv (tool envs + managed Pythons) and ~/.cache/uv were left in place."
|
|
1131
|
+
if [ -f "$HOME/.bashrc" ]; then
|
|
1132
|
+
python3 - "$HOME/.bashrc" <<'PY'
|
|
1133
|
+
import sys
|
|
1134
|
+
path = sys.argv[1]
|
|
1135
|
+
lines = open(path).read().splitlines()
|
|
1136
|
+
out = []
|
|
1137
|
+
skip = 0
|
|
1138
|
+
for line in lines:
|
|
1139
|
+
if skip:
|
|
1140
|
+
skip -= 1
|
|
1141
|
+
continue
|
|
1142
|
+
if line == "# uv (and other ~/.local/bin tools)":
|
|
1143
|
+
skip = 1
|
|
1144
|
+
continue
|
|
1145
|
+
out.append(line)
|
|
1146
|
+
open(path, "w").write("\n".join(out) + ("\n" if out else ""))
|
|
1147
|
+
PY
|
|
1148
|
+
fi
|
|
1083
1149
|
|
|
1084
1150
|
llamactl:
|
|
1085
1151
|
name: llamactl
|
|
@@ -1089,7 +1155,7 @@ tools:
|
|
|
1089
1155
|
pip_name: llamactl
|
|
1090
1156
|
check_cmd: llamactl
|
|
1091
1157
|
help_cmd: llamactl --help
|
|
1092
|
-
docs_url: https://github.com/run-llama/
|
|
1158
|
+
docs_url: https://github.com/run-llama/llama-agents
|
|
1093
1159
|
requires:
|
|
1094
1160
|
- uv
|
|
1095
1161
|
|
|
@@ -1111,7 +1177,7 @@ tools:
|
|
|
1111
1177
|
|
|
1112
1178
|
lmstudio:
|
|
1113
1179
|
name: LM Studio
|
|
1114
|
-
description: Run large language models locally
|
|
1180
|
+
description: Run large language models locally (headless llmster daemon + lms CLI)
|
|
1115
1181
|
category: ai-tools
|
|
1116
1182
|
type: bash
|
|
1117
1183
|
check_cmd: command -v lms >/dev/null 2>&1 || test -x "$HOME/.lmstudio/bin/lms"
|
|
@@ -1127,7 +1193,7 @@ tools:
|
|
|
1127
1193
|
sudo apt-get update -q
|
|
1128
1194
|
sudo apt-get install -y libatomic1
|
|
1129
1195
|
fi
|
|
1130
|
-
curl -fsSL https://lmstudio.ai/install.sh | bash
|
|
1196
|
+
curl --connect-timeout 15 --max-time 300 -fsSL https://lmstudio.ai/install.sh | bash
|
|
1131
1197
|
remove_script: |
|
|
1132
1198
|
set -euo pipefail
|
|
1133
1199
|
rm -rf "$HOME/.lmstudio"
|
|
@@ -1145,15 +1211,16 @@ tools:
|
|
|
1145
1211
|
docs_url: https://mikefarah.gitbook.io/yq
|
|
1146
1212
|
install_script: |
|
|
1147
1213
|
set -euo pipefail
|
|
1148
|
-
version="$(curl -fsSL https://api.github.com/repos/mikefarah/yq/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"])' 2>/dev/null || echo v4.
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
arch="arm64"
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1214
|
+
version="$(curl --connect-timeout 15 --max-time 300 -fsSL https://api.github.com/repos/mikefarah/yq/releases/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["tag_name"])' 2>/dev/null || echo v4.54.3)"
|
|
1215
|
+
case "$(uname -m)" in
|
|
1216
|
+
x86_64) arch="amd64" ;;
|
|
1217
|
+
aarch64) arch="arm64" ;;
|
|
1218
|
+
*) echo "yq: no release binary for $(uname -m)" >&2; exit 1 ;;
|
|
1219
|
+
esac
|
|
1220
|
+
tmpdir="$(mktemp -d)"
|
|
1221
|
+
trap 'rm -rf "$tmpdir"' EXIT
|
|
1222
|
+
curl --connect-timeout 15 --max-time 300 -fsSL -o "$tmpdir/yq" "https://github.com/mikefarah/yq/releases/download/${version}/yq_linux_${arch}"
|
|
1223
|
+
sudo mv "$tmpdir/yq" /usr/local/bin/yq
|
|
1157
1224
|
sudo chmod +x /usr/local/bin/yq
|
|
1158
1225
|
remove_script: |
|
|
1159
1226
|
set -euo pipefail
|
dev_setup/ui.py
CHANGED
|
@@ -296,6 +296,8 @@ class TaskView:
|
|
|
296
296
|
self._errors: deque[str] = deque(maxlen=_ERROR_TAIL_LINES)
|
|
297
297
|
self._partial = False # last tail entry is an unfinished line
|
|
298
298
|
self._live: Live | None = None
|
|
299
|
+
self._phase_started = time.monotonic()
|
|
300
|
+
self._last_feed = time.monotonic()
|
|
299
301
|
|
|
300
302
|
# -- driving the view -----------------------------------------------------
|
|
301
303
|
|
|
@@ -305,6 +307,7 @@ class TaskView:
|
|
|
305
307
|
if p[1] == "current":
|
|
306
308
|
p[1] = "done"
|
|
307
309
|
self._phases.append([label, "current"])
|
|
310
|
+
self._phase_started = time.monotonic()
|
|
308
311
|
self._repaint()
|
|
309
312
|
try:
|
|
310
313
|
yield
|
|
@@ -331,6 +334,7 @@ class TaskView:
|
|
|
331
334
|
self._partial = partial
|
|
332
335
|
if not partial and line.strip():
|
|
333
336
|
self._errors.append(line)
|
|
337
|
+
self._last_feed = time.monotonic()
|
|
334
338
|
self._repaint()
|
|
335
339
|
|
|
336
340
|
def error_output(self) -> str:
|
|
@@ -352,7 +356,8 @@ class TaskView:
|
|
|
352
356
|
complete_style=bar_style,
|
|
353
357
|
finished_style=bar_style,
|
|
354
358
|
)
|
|
355
|
-
|
|
359
|
+
now = time.monotonic()
|
|
360
|
+
frame = _PHASE_SPINNER[int(now * 6) % len(_PHASE_SPINNER)]
|
|
356
361
|
|
|
357
362
|
lines: list[RenderableType] = [
|
|
358
363
|
Columns(
|
|
@@ -371,7 +376,18 @@ class TaskView:
|
|
|
371
376
|
elif state == "failed":
|
|
372
377
|
lines.append(Text(f" ✖ {label}", style=f"{RED} bold"))
|
|
373
378
|
else:
|
|
374
|
-
|
|
379
|
+
# Elapsed time on the live phase is the heartbeat: a long quiet
|
|
380
|
+
# phase (an apt download) visibly ticks instead of reading as
|
|
381
|
+
# hung, and the idle counter says when output last arrived.
|
|
382
|
+
elapsed = int(now - self._phase_started)
|
|
383
|
+
note = f" ({elapsed // 60}m{elapsed % 60:02d}s"
|
|
384
|
+
idle = int(now - self._last_feed)
|
|
385
|
+
if idle >= 10:
|
|
386
|
+
note += f", output idle {idle}s"
|
|
387
|
+
note += ")"
|
|
388
|
+
lines.append(
|
|
389
|
+
Text.assemble((f" {frame} ", PURPLE), (f"{label}{note}", ""))
|
|
390
|
+
)
|
|
375
391
|
remaining = self.total - len(self._phases)
|
|
376
392
|
for _ in range(max(remaining, 0)):
|
|
377
393
|
lines.append(Text(" ○", style=GRAY))
|
|
@@ -14,7 +14,7 @@ dev_setup/functions.schema.json,sha256=VVdpH3xWsdbtqw47S1QqpBcs4O9wd3XZ_s0Q3sGwv
|
|
|
14
14
|
dev_setup/functions.yaml,sha256=n3yn8N9FN9TzMRMMgYREmDACUAsO1XmGDuNB-aOVl8U,13477
|
|
15
15
|
dev_setup/functions_catalog.py,sha256=YgR2hY9HM1iol1AZcF-_j02EXCP9U4P3e_5eWes9KH0,7116
|
|
16
16
|
dev_setup/functions_registry.py,sha256=YSl-VgNXPf0hj4WgReg-pZUj4fAjFlwvC165dgon_BE,3682
|
|
17
|
-
dev_setup/generic.py,sha256=
|
|
17
|
+
dev_setup/generic.py,sha256=Cl0daH8hSmR4StMSPxkawVfA36K32KDNSuCqnLdHCpU,55717
|
|
18
18
|
dev_setup/links.schema.json,sha256=V9_1UA8Ejfu0j6-VczH0blW1mlGupXx56NhApLtHHKc,1938
|
|
19
19
|
dev_setup/links.yaml,sha256=nBwgCDljLbqY75ebQ9JuZao0-zJEwtJO6GNRV_eG7IM,7896
|
|
20
20
|
dev_setup/links_catalog.py,sha256=Xe7s9oqiCrfQPUwE-X9o6p5VkU7mH9PjY9NMyn6VbHg,4610
|
|
@@ -23,8 +23,8 @@ dev_setup/managers.py,sha256=mW_MI9OfZsuxy8--PCHom-_CG3sFb9nPqJ26wQQVAIc,10665
|
|
|
23
23
|
dev_setup/profile.py,sha256=NiSOXXwEPX6IIT8FagnAC-tcg49HWijFDSm2jn3hjts,13632
|
|
24
24
|
dev_setup/registry.py,sha256=eHEuo4p0O0CHDWatFuOlSFiSAz5L6YFYmv9tAGHYMt4,2510
|
|
25
25
|
dev_setup/snapshot.py,sha256=A2G_6pHSaGhDT1PJAZ6eW83GdSdCGs2r79yH8FCa0Qs,5330
|
|
26
|
-
dev_setup/tools.yaml,sha256
|
|
27
|
-
dev_setup/ui.py,sha256=
|
|
26
|
+
dev_setup/tools.yaml,sha256=-evMj3AOHAnu3wGmvEPntRhz16FuAabuwUocKqtOB1g,49348
|
|
27
|
+
dev_setup/ui.py,sha256=2oSDQB_68Ie2A4Y016LFa26VCe2gT65y0-35GHrAW7g,24644
|
|
28
28
|
dev_setup/updates.py,sha256=p9_nbfaX_73hE71kr5ZDZA5o85T9XTR0mjbo15f950I,6046
|
|
29
29
|
dev_setup/verbose.py,sha256=N3U9JAYOvFwdd8DT6W7Pqq6RCIUfbcQnPsm0O1TnvQY,5003
|
|
30
30
|
dev_setup/agent/__init__.py,sha256=znrgxUCr_y0Qp-f41S6EaTv-hoTYwoZ9mOMLVge-IJg,226
|
|
@@ -59,16 +59,16 @@ dev_setup/commands/docs_cmd.py,sha256=JXhusKUl4dD-U5jG-PLTon_2NCpAWWnaBqsmlFk7vL
|
|
|
59
59
|
dev_setup/commands/doctor_cmd.py,sha256=sPhxLMVxy1JOxdFklRQHIwCoJeB-nmGWzVs5yeza9a8,3568
|
|
60
60
|
dev_setup/commands/functions_cmd.py,sha256=4HvdLXle9JGk70A1EDVZrlgTo-N-FyAO7ApaL8mcJYI,3023
|
|
61
61
|
dev_setup/commands/help_cmd.py,sha256=O2dnhqsMZx5tVHdJVixixCJwc9TYlKdlZ2vYYPApl0o,4566
|
|
62
|
-
dev_setup/commands/install_cmd.py,sha256=
|
|
62
|
+
dev_setup/commands/install_cmd.py,sha256=BNpZUnqgnJD9xGWRN6nOnwAc00HqdaR0d2_EkqctWxA,9896
|
|
63
63
|
dev_setup/commands/links_cmd.py,sha256=kvnoBXdM9QWRZRIwWgnmWqVkOYE7AZxywFTQD5_Uwv4,4924
|
|
64
|
-
dev_setup/commands/list_cmd.py,sha256=
|
|
64
|
+
dev_setup/commands/list_cmd.py,sha256=ZXWWQ84_CzOJIzk9EKqDPeRifQWT2_bsKXn67XF1GwM,3318
|
|
65
65
|
dev_setup/commands/mcp_cmd.py,sha256=UkScDupval0pHZhV1Mex6I8s9pnE7OS2Qf6zQhcQaxM,10261
|
|
66
66
|
dev_setup/commands/outdated_cmd.py,sha256=afwYyq0M-tWVOk2qyXQqsdWSTK6yuFbVpbrOmMPKS_w,4757
|
|
67
67
|
dev_setup/commands/profile_cmd.py,sha256=jo7al_nBwuWtzOLYKjcqEGmHp4eQrzM5s7ahv6iiGaw,18299
|
|
68
|
-
dev_setup/commands/remove_cmd.py,sha256=
|
|
68
|
+
dev_setup/commands/remove_cmd.py,sha256=g2pbFIrzPe7JbOPrxkP5aeilaFzgOnjJo-GbtSBfLsw,5180
|
|
69
69
|
dev_setup/commands/run_cmd.py,sha256=e1xfWt09UALiAe03AxzdvZyYpj0V7WKk2-E_nbk9hIw,2933
|
|
70
70
|
dev_setup/commands/skills_cmd.py,sha256=j4rleYEW4lt-O2ssDwGyhwmk2Wiip64C4Z7iPT6c3y0,7482
|
|
71
|
-
dev_setup/commands/update_cmd.py,sha256=
|
|
71
|
+
dev_setup/commands/update_cmd.py,sha256=thL68Nvj5vgc4YqrGfuqkaskgqfTdlU1oGeT4GY9TEc,6452
|
|
72
72
|
dev_setup/configure/__init__.py,sha256=7T_5a8gKoaNHWZebSvTCllSNTxItjHKvKmwWhf86u0Y,3945
|
|
73
73
|
dev_setup/configure/ansible/__init__.py,sha256=huQL_tfiU1l0WI6nzjTnGZlxCQX2aH7E9n9TrfwmIpU,407
|
|
74
74
|
dev_setup/configure/ansible/detect.py,sha256=5LkdbJg5BU2lrIU4CZm_Lhr6Sm4TJMCh1sMrsRK6rgc,9531
|
|
@@ -135,7 +135,7 @@ dev_setup/mcp/printconfig.py,sha256=3u_b4UpDwJ95u0_AfZuZuch1_-bOojdAg-08c5l6g28,
|
|
|
135
135
|
dev_setup/mcp/process.py,sha256=IV203HLaCelWb89IhV73_8NWNAGglXRtXpwpHk39dD4,4752
|
|
136
136
|
dev_setup/mcp/stdio.py,sha256=k-s2722_N2j92umkKo_Bq6KijfQGKFRudYVsh2H4xAk,6121
|
|
137
137
|
dev_setup/mcp/token.py,sha256=Pr7MCY6FtY8g2oQWB291mMooiZY0eu659Qk3mh9auWE,3397
|
|
138
|
-
devstuff-2.
|
|
139
|
-
devstuff-2.
|
|
140
|
-
devstuff-2.
|
|
141
|
-
devstuff-2.
|
|
138
|
+
devstuff-2.27.0.dist-info/METADATA,sha256=NO_w9Z4UIiXyiphlZmizJey-CBl1VNMApC0sN70yBp0,103226
|
|
139
|
+
devstuff-2.27.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
140
|
+
devstuff-2.27.0.dist-info/entry_points.txt,sha256=48ITy9ENdXDFrTHwAyVPUpq1MDmgFqcOisOo5mAR6OQ,53
|
|
141
|
+
devstuff-2.27.0.dist-info/RECORD,,
|
|
File without changes
|