devstuff 2.23.0__py3-none-any.whl → 2.25.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/catalog.py CHANGED
@@ -40,6 +40,7 @@ SUPPORTED_FIELDS = {
40
40
  "sha256",
41
41
  "install_script",
42
42
  "remove_script",
43
+ "managed_by",
43
44
  }
44
45
 
45
46
 
@@ -122,6 +123,13 @@ def validate_catalog(raw: Any, *, source: Path | str = "<catalog>") -> dict[str,
122
123
  elif not isinstance(requires, list) or not all(isinstance(v, str) for v in requires):
123
124
  raise CatalogError(f"{source}: tool {key!r} requires must be a list of strings")
124
125
 
126
+ managed_by = item.get("managed_by")
127
+ if managed_by is not None:
128
+ if not isinstance(managed_by, str) or not VALID_KEY.match(managed_by):
129
+ raise CatalogError(f"{source}: tool {key!r} managed_by must be a tool key")
130
+ if managed_by == key:
131
+ raise CatalogError(f"{source}: tool {key!r} cannot be managed_by itself")
132
+
125
133
  validated[key] = item
126
134
 
127
135
  return validated
@@ -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 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
 
@@ -163,10 +163,16 @@ def _install_interactive(*, yes: bool) -> None:
163
163
  ui.print_banner()
164
164
  tools = registry.all_tools()
165
165
 
166
- # Probe installed status concurrently — each check shells out.
166
+ # Probe installed status concurrently — each check shells out. The manager
167
+ # note rides along so its probes share this pass rather than a second one.
168
+ def _probe_one(t: Tool) -> tuple[bool, managers.ManagerNote | None]:
169
+ inst = t.is_installed()
170
+ return inst, managers.note_for(t, inst)
171
+
167
172
  with ui.spinner("Checking installed packages..."), ThreadPoolExecutor(max_workers=8) as pool:
168
- statuses = pool.map(lambda t: t.is_installed(), tools)
169
- installed = dict(zip((t.key for t in tools), statuses, strict=True))
173
+ probed = dict(zip((t.key for t in tools), pool.map(_probe_one, tools), strict=True))
174
+ installed = {k: v[0] for k, v in probed.items()}
175
+ notes = {k: v[1] for k, v in probed.items()}
170
176
 
171
177
  by_cat: dict[str, list[Tool]] = {}
172
178
  for t in tools:
@@ -186,11 +192,16 @@ def _install_interactive(*, yes: bool) -> None:
186
192
  for t in entries:
187
193
  is_inst = installed[t.key]
188
194
  missing = [] if is_inst else registry.missing_requires(t)
195
+ note = notes[t.key]
196
+ suffix, disabled_override = (
197
+ managers.picker_hint(note, t) if note is not None else ("", None)
198
+ )
189
199
  desc = t.description
190
- if len(desc) > desc_width:
191
- desc = desc[: desc_width - 1] + "…"
200
+ room = max(10, desc_width - len(suffix))
201
+ if len(desc) > room:
202
+ desc = desc[: room - 1] + "…"
192
203
  if is_inst:
193
- disabled = "installed"
204
+ disabled = disabled_override or "installed"
194
205
  elif missing:
195
206
  disabled = f"requires {', '.join(missing)}"
196
207
  else:
@@ -201,10 +212,10 @@ def _install_interactive(*, yes: bool) -> None:
201
212
  title: str | list[tuple[str, str]] = (
202
213
  [
203
214
  ("class:check", "● " if is_inst else " "),
204
- ("class:text", f"{t.key:<{key_width}}{desc}"),
215
+ ("class:text", f"{t.key:<{key_width}}{desc}{suffix}"),
205
216
  ]
206
217
  if disabled
207
- else f" {t.key:<{key_width}}{desc}"
218
+ else f" {t.key:<{key_width}}{desc}{suffix}"
208
219
  )
209
220
  choices.append(questionary.Choice(
210
221
  title=title,
@@ -4,17 +4,17 @@ from concurrent.futures import ThreadPoolExecutor
4
4
 
5
5
  import click
6
6
 
7
- from dev_setup import registry, ui
7
+ from dev_setup import managers, registry, ui
8
8
  from dev_setup.base import Tool
9
9
 
10
10
  _MAX_WORKERS = 8
11
11
 
12
12
 
13
- def _probe(tool: Tool) -> tuple[Tool, bool, str]:
13
+ def _probe(tool: Tool) -> tuple[Tool, bool, str, managers.ManagerNote | None]:
14
14
  """Gather subprocess-heavy status for one tool (runs in a worker thread)."""
15
15
  is_inst = tool.is_installed()
16
16
  version = tool.get_version() if is_inst else ""
17
- return tool, is_inst, version
17
+ return tool, is_inst, version, managers.note_for(tool, is_inst)
18
18
 
19
19
 
20
20
  @click.command("list")
@@ -35,12 +35,12 @@ def list_cmd(show_filter: str, category: str) -> None:
35
35
  probed = list(pool.map(_probe, tools))
36
36
 
37
37
  by_cat: dict = {}
38
- for tool, is_inst, version in probed:
38
+ for tool, is_inst, version, note in probed:
39
39
  if show_filter == "installed" and not is_inst:
40
40
  continue
41
41
  if show_filter == "available" and is_inst:
42
42
  continue
43
- by_cat.setdefault(tool.category, []).append((tool, is_inst, version))
43
+ by_cat.setdefault(tool.category, []).append((tool, is_inst, version, note))
44
44
 
45
45
  if not by_cat:
46
46
  ui.warn("No packages match the given filters.")
@@ -52,7 +52,7 @@ def list_cmd(show_filter: str, category: str) -> None:
52
52
  if not entries:
53
53
  continue
54
54
 
55
- n_inst = sum(1 for _, is_inst, _ in entries if is_inst)
55
+ n_inst = sum(1 for _, is_inst, _, _ in entries if is_inst)
56
56
  tbl = ui.table(
57
57
  title=f"[bold]{cat}[/] [{ui.GRAY}]{n_inst}/{len(entries)} installed[/]"
58
58
  )
@@ -62,7 +62,7 @@ def list_cmd(show_filter: str, category: str) -> None:
62
62
  tbl.add_column("Type", style=ui.CYAN, no_wrap=True)
63
63
  tbl.add_column("Version", style=ui.GRAY, no_wrap=True, max_width=28, overflow="ellipsis")
64
64
 
65
- for tool, is_inst, version in entries:
65
+ for tool, is_inst, version, note in entries:
66
66
  icon = f"[{ui.GREEN}]●[/]" if is_inst else f"[{ui.GRAY}]○[/]"
67
67
  desc = tool.description
68
68
  if tool.help_cmd:
@@ -71,6 +71,10 @@ def list_cmd(show_filter: str, category: str) -> None:
71
71
  missing = registry.missing_requires(tool)
72
72
  if missing:
73
73
  desc += f"\n[{ui.AMBER}] ⚠ requires: {', '.join(missing)}[/]"
74
+ if note is not None:
75
+ line = managers.list_line(note, tool)
76
+ if line:
77
+ desc += f"\n{line}"
74
78
  tbl.add_row(icon, tool.key, desc, tool.install_type, version)
75
79
 
76
80
  ui.console.print(tbl)
@@ -38,6 +38,41 @@ def _select(prompt: str, choices: list, current: object) -> str:
38
38
  return ui.select(prompt, choices, default=default) or str(current)
39
39
 
40
40
 
41
+ class _DeltaGate:
42
+ """At most one install offer per wizard run (same reasoning as starship's _FontGate).
43
+
44
+ The pager question and the presets can be revisited from the review menu; a
45
+ declined offer should not come back every time, and a second look at a missing
46
+ delta gets the install hint without the prompt.
47
+ """
48
+
49
+ def __init__(self) -> None:
50
+ self._offered = False
51
+
52
+ def check(self, cfg: LazygitConfig) -> None:
53
+ if not cfg.pager or cfg.pager.split()[0] != "delta" or shutil.which("delta"):
54
+ return
55
+ ui.console.print()
56
+ ui.warn("delta is not on your PATH — diffs would fail to render until it is.")
57
+ if self._offered:
58
+ ui.dim(" Install it with: devstuff install delta")
59
+ return
60
+ self._offered = True
61
+
62
+ from dev_setup import registry
63
+ from dev_setup.commands.install_cmd import install_by_key
64
+
65
+ if registry.get("delta") is None: # pragma: no cover — the key is built in
66
+ ui.dim(" Install it with: devstuff install delta")
67
+ return
68
+ if not ui.confirm("Install delta now?", default=True):
69
+ ui.dim(" You can install it later: devstuff install delta")
70
+ return
71
+ if not install_by_key("delta", yes=True) or shutil.which("delta") is None:
72
+ ui.warn("delta still is not on your PATH.")
73
+ ui.dim(" You can install it later: devstuff install delta")
74
+
75
+
41
76
  def _ask_preset(cfg: LazygitConfig, found: detect.Lazygit) -> None:
42
77
  choices = [
43
78
  questionary.Choice(title=preset.label, value=preset.key, description=preset.description)
@@ -83,8 +118,8 @@ def _ask_icons(cfg: LazygitConfig, found: detect.Lazygit) -> None:
83
118
 
84
119
  def _ask_pager(cfg: LazygitConfig) -> None:
85
120
  ui.console.print()
86
- ui.dim(" An external pager renders diffs. delta is the usual choice; it must be")
87
- ui.dim(" installed separately and needs --paging=never so it does not open its own.")
121
+ ui.dim(" An external pager renders diffs. delta is the usual choice (the wizard offers")
122
+ ui.dim(" to install it if it is missing) and needs --paging=never so it does not open its own.")
88
123
  choices = [
89
124
  questionary.Choice(title=label, value=command) for command, label in PAGERS.items()
90
125
  ]
@@ -94,7 +129,7 @@ def _ask_pager(cfg: LazygitConfig) -> None:
94
129
  cfg.pager = chosen
95
130
  if cfg.pager:
96
131
  tool = cfg.pager.split()[0]
97
- if shutil.which(tool) is None:
132
+ if tool != "delta" and shutil.which(tool) is None:
98
133
  ui.warn(f"{tool} is not on your PATH — diffs would fail to render until it is.")
99
134
  cfg.color_arg = "always"
100
135
 
@@ -347,8 +382,10 @@ def run(*, target: Path | None = None) -> LazygitConfig | None:
347
382
  _report(found)
348
383
 
349
384
  ui.console.print()
385
+ delta = _DeltaGate()
350
386
  _ask_preset(cfg, found)
351
387
  _ask_icons(cfg, found)
388
+ delta.check(cfg)
352
389
 
353
390
  while True:
354
391
  _show_preview(cfg, found)
@@ -374,10 +411,12 @@ def run(*, target: Path | None = None) -> LazygitConfig | None:
374
411
  if action == "preset":
375
412
  _ask_preset(cfg, found)
376
413
  _ask_icons(cfg, found)
414
+ delta.check(cfg)
377
415
  elif action == "icons":
378
416
  _ask_icons(cfg, found)
379
417
  elif action == "pager":
380
418
  _ask_pager(cfg)
419
+ delta.check(cfg)
381
420
  elif action == "appearance":
382
421
  _ask_appearance(cfg)
383
422
  elif action == "git":
dev_setup/generic.py CHANGED
@@ -156,6 +156,9 @@ class GenericTool(Tool):
156
156
  remove_script: str = ""
157
157
  help_cmd: str = ""
158
158
  docs_url: str = ""
159
+ # Catalog key of the tool that manages this one's installs (uv, nvm, …) when
160
+ # the install type doesn't imply one — see managers.py for what it drives.
161
+ managed_by: str = ""
159
162
  requires: list | None = None
160
163
  builtin: bool = False
161
164
 
dev_setup/links.yaml CHANGED
@@ -79,6 +79,12 @@ links:
79
79
  category: shell
80
80
  url: https://github.com/tmux/tmux/wiki
81
81
 
82
+ explainshell:
83
+ name: explainshell
84
+ description: Paste a shell command to see what each part and flag does
85
+ category: shell
86
+ url: https://explainshell.com/
87
+
82
88
  conventional-commits:
83
89
  name: Conventional Commits
84
90
  description: The commit message specification used by commitizen
@@ -109,6 +115,18 @@ links:
109
115
  category: reference
110
116
  url: https://devhints.io/
111
117
 
118
+ devdocs:
119
+ name: DevDocs
120
+ description: API documentation for hundreds of languages and libraries in one searchable, offline-capable site
121
+ category: reference
122
+ url: https://devdocs.io/
123
+
124
+ archwiki:
125
+ name: ArchWiki
126
+ description: In-depth Linux reference for system configuration and tools, useful well beyond Arch
127
+ category: reference
128
+ url: https://wiki.archlinux.org/
129
+
112
130
  awesome-open-source:
113
131
  name: Awesome Open Source
114
132
  description: Curated open source projects browsable by topic and language
@@ -121,6 +139,12 @@ links:
121
139
  category: discovery
122
140
  url: https://fmhy.net/developer-tools
123
141
 
142
+ awesome-selfhosted:
143
+ name: Awesome Selfhosted
144
+ description: Curated index of free self-hostable software
145
+ category: discovery
146
+ url: https://awesome-selfhosted.net/
147
+
124
148
  crontab-guru:
125
149
  name: crontab guru
126
150
  description: Editor for cron schedule expressions that explains in plain English when a schedule runs
@@ -210,3 +234,9 @@ links:
210
234
  description: Free and open platform for network and host visibility, honeypots, and log and case management, with a Pro edition
211
235
  category: security
212
236
  url: https://securityonionsolutions.com/software
237
+
238
+ deps-dev:
239
+ name: deps.dev
240
+ description: Open-source package explorer — versions, dependency graphs, advisories and supply-chain signals
241
+ category: security
242
+ url: https://deps.dev/
dev_setup/managers.py ADDED
@@ -0,0 +1,281 @@
1
+ """Notes about which catalog tool manages — or could manage — another's installs.
2
+
3
+ `list` and the `install` picker annotate a tool with the manager that owns its
4
+ installs: derived from the install type for uvx/pip (uv) and npm (nvm) tools,
5
+ explicit via the `managed_by` field for anything else (python, pi).
6
+
7
+ "Actually managed" is answered two ways, matching how each manager records
8
+ ownership. The *type signal* reuses the probes `outdated` already trusts
9
+ (`uv tool list`, `npm ls -g` inside nvm), so list and outdated agree. The *path
10
+ signal* resolves the tool's executable and asks whether it lives under a root
11
+ the manager reports for itself (`uv tool dir` / `uv python dir`, `$NVM_DIR`) —
12
+ containment via `Path.is_relative_to` on resolved paths, never `startswith`,
13
+ so `uv/python-other` does not read as inside `uv/python`. A probe that cannot
14
+ answer is `unknown`, never silently `managed`: claiming management we did not
15
+ verify is the failure this module exists to prevent.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import json
21
+ import os
22
+ import shlex
23
+ import shutil
24
+ from dataclasses import dataclass
25
+ from pathlib import Path
26
+ from typing import NamedTuple
27
+
28
+ from rich.markup import escape
29
+
30
+ from dev_setup import generic, registry, ui
31
+ from dev_setup.base import Tool
32
+
33
+ # Install types whose tool records are owned by a catalog manager outright —
34
+ # no managed_by field needed.
35
+ AUTO_MANAGER = {"uvx": "uv", "pip": "uv", "npm": "nvm"}
36
+
37
+
38
+ @dataclass(frozen=True)
39
+ class ManagerNote:
40
+ manager: str # catalog key, e.g. "uv"
41
+ state: str # "managed" | "outside" | "can-manage" | "system-copy" | "unknown"
42
+ path: str = "" # resolved path, for outside / system-copy (when known)
43
+ executable: str = "" # for system-copy, e.g. "python3"
44
+ why: str = "" # for unknown: the probe's reason
45
+
46
+
47
+ class _Verdict(NamedTuple):
48
+ managed: bool | None
49
+ why: str = ""
50
+
51
+
52
+ def manager_of(tool: Tool) -> str | None:
53
+ """The catalog key managing this tool's installs, or None if none applies.
54
+
55
+ A managed_by typo or a key not in the registry produces no note at all —
56
+ a wrong note is worse than none.
57
+ """
58
+ mgr = getattr(tool, "managed_by", "") or AUTO_MANAGER.get(tool.install_type, "")
59
+ if not mgr or mgr == tool.key or not registry.exists(mgr):
60
+ return None
61
+ return mgr
62
+
63
+
64
+ def note_for(tool: Tool, installed: bool) -> ManagerNote | None:
65
+ """Best-effort probe of who manages this tool's copy. Never raises."""
66
+ try:
67
+ mgr = manager_of(tool)
68
+ if mgr is None:
69
+ return None
70
+ if installed:
71
+ verdict = _is_managed(tool, mgr)
72
+ if verdict.managed is True:
73
+ return ManagerNote(mgr, "managed")
74
+ if verdict.managed is False:
75
+ found = _resolve_executable(tool, mgr)
76
+ return ManagerNote(
77
+ mgr, "outside", path=os.path.realpath(found) if found else ""
78
+ )
79
+ return ManagerNote(mgr, "unknown", why=verdict.why)
80
+ exe = _executable(tool)
81
+ found = shutil.which(exe) if exe else None
82
+ if exe and found:
83
+ return ManagerNote(
84
+ mgr, "system-copy", executable=exe, path=os.path.realpath(found)
85
+ )
86
+ return ManagerNote(mgr, "can-manage")
87
+ except Exception:
88
+ return None
89
+
90
+
91
+ def _is_managed(tool: Tool, mgr: str) -> _Verdict:
92
+ """True/False when a probe answered, None plus `why` when it could not."""
93
+ if AUTO_MANAGER.get(tool.install_type) == mgr:
94
+ return _managed_by_type(tool, mgr)
95
+ return _managed_by_path(tool, mgr)
96
+
97
+
98
+ def _executable(tool: Tool) -> str:
99
+ """The binary PATH would name for this tool, or "" when no field provides one."""
100
+ for cand in (getattr(tool, "version_cmd", ""), getattr(tool, "check_cmd", "")):
101
+ if generic._is_simple_command(cand or ""):
102
+ return cand
103
+ return ""
104
+
105
+
106
+ # -- Type signal ---------------------------------------------------------------
107
+ # The same records `outdated` trusts: uv tools appear in `uv tool list`, nvm's
108
+ # npm packages in `npm ls -g` after sourcing nvm.sh. Membership means managed.
109
+
110
+
111
+ def _managed_by_type(tool: Tool, mgr: str) -> _Verdict:
112
+ if mgr == "uv":
113
+ answer = generic._uv_tool_versions()
114
+ name = tool.pip_name
115
+ elif mgr == "nvm":
116
+ answer = _nvm_npm_globals()
117
+ name = tool.npm_name
118
+ else:
119
+ return _Verdict(None, f"no way to check what {mgr} manages")
120
+ if answer.data is None:
121
+ if answer.why == f"{mgr} is not installed":
122
+ return _Verdict(False, answer.why)
123
+ return _Verdict(None, answer.why)
124
+ return _Verdict(bool(name) and name in answer.data)
125
+
126
+
127
+ @generic._once
128
+ def _nvm_npm_globals() -> generic._Answer:
129
+ """Package name -> version for nvm's global npm installs. One call per process.
130
+
131
+ `npm ls -g` can exit non-zero yet print a valid JSON tree (extraneous or
132
+ problem packages), so stdout is parsed whatever the return code; only
133
+ unparseable output is a failed probe.
134
+ """
135
+ nvm_dir = _nvm_dir()
136
+ if not (nvm_dir / "nvm.sh").exists():
137
+ return generic._Answer(None, "nvm is not installed")
138
+ try:
139
+ r = generic._probe(
140
+ ["bash", "-c", f'. "{nvm_dir}/nvm.sh" >/dev/null 2>&1 && npm ls -g --depth=0 --json'],
141
+ capture_output=True, text=True, timeout=15,
142
+ )
143
+ except Exception:
144
+ return generic._Answer(None, "couldn't list nvm's global npm packages")
145
+ try:
146
+ deps = json.loads(r.stdout or "{}").get("dependencies", {})
147
+ except (json.JSONDecodeError, AttributeError):
148
+ return generic._Answer(None, "couldn't list nvm's global npm packages")
149
+ return generic._Answer(
150
+ {name: (info.get("version", "") if isinstance(info, dict) else "") for name, info in deps.items()}
151
+ )
152
+
153
+
154
+ # -- Path signal ---------------------------------------------------------------
155
+ # For explicit managed_by (python, pi): where the resolved executable sits.
156
+
157
+
158
+ def _managed_by_path(tool: Tool, mgr: str) -> _Verdict:
159
+ exe = _executable(tool)
160
+ if not exe:
161
+ return _Verdict(None, "no executable to check")
162
+ probe = _ROOT_PROBES.get(mgr)
163
+ if probe is None:
164
+ return _Verdict(None, f"no way to check what {mgr} manages")
165
+ answer = probe()
166
+ if answer.data is None:
167
+ return _Verdict(None, answer.why)
168
+ if not answer.data:
169
+ return _Verdict(False) # the manager itself is absent, so it manages nothing
170
+ path = _resolve_executable(tool, mgr)
171
+ if not path:
172
+ return _Verdict(None, f"couldn't find {exe} on PATH")
173
+ real = Path(os.path.realpath(path))
174
+ return _Verdict(any(real.is_relative_to(root) for root in answer.data))
175
+
176
+
177
+ def _resolve_executable(tool: Tool, mgr: str) -> str:
178
+ """Where `tool`'s binary resolves, or "". For nvm a direct `which` miss gets a
179
+ second chance through an nvm-sourced shell — the binary may only exist once
180
+ nvm has put its node bin dir on PATH."""
181
+ exe = _executable(tool)
182
+ if not exe:
183
+ return ""
184
+ path = shutil.which(exe)
185
+ if path is None and mgr == "nvm":
186
+ try:
187
+ r = generic._probe(
188
+ ["bash", "-c", f'. "{_nvm_dir()}/nvm.sh" 2>/dev/null; command -v {shlex.quote(exe)}'],
189
+ capture_output=True, text=True, timeout=10,
190
+ )
191
+ if r.returncode == 0 and r.stdout.strip():
192
+ path = r.stdout.strip().splitlines()[-1]
193
+ except Exception:
194
+ pass
195
+ return path or ""
196
+
197
+
198
+ @generic._once
199
+ def _uv_roots() -> generic._Answer:
200
+ """Directories uv owns (tool envs, managed pythons), as resolved paths.
201
+
202
+ Empty means "uv is not installed" — a definitive *outside*, distinct from
203
+ a failed probe (None) which is *unknown*.
204
+ """
205
+ uv = shutil.which("uv")
206
+ if not uv:
207
+ return generic._Answer({})
208
+ roots: dict[str, str] = {}
209
+ for sub in ("tool", "python"):
210
+ try:
211
+ r = generic._probe(
212
+ [uv, sub, "dir"], capture_output=True, text=True, timeout=10
213
+ )
214
+ except Exception:
215
+ return generic._Answer(None, f"couldn't run `uv {sub} dir`")
216
+ if r.returncode != 0 or not r.stdout.strip():
217
+ return generic._Answer(None, f"`uv {sub} dir` failed")
218
+ roots[os.path.realpath(r.stdout.strip().splitlines()[0])] = ""
219
+ return generic._Answer(roots)
220
+
221
+
222
+ @generic._once
223
+ def _nvm_roots() -> generic._Answer:
224
+ nvm_dir = _nvm_dir()
225
+ if nvm_dir.is_dir():
226
+ return generic._Answer({os.path.realpath(nvm_dir): ""})
227
+ return generic._Answer({})
228
+
229
+
230
+ def _nvm_dir() -> Path:
231
+ return Path(os.environ.get("NVM_DIR") or Path.home() / ".nvm")
232
+
233
+
234
+ _ROOT_PROBES = {"uv": _uv_roots, "nvm": _nvm_roots}
235
+
236
+
237
+ # -- Rendering -----------------------------------------------------------------
238
+
239
+
240
+ def list_line(note: ManagerNote, tool: Tool) -> str:
241
+ """A second description-cell line for `devstuff list`; "" for an unknown state.
242
+
243
+ `outside` carries no `devstuff install` remedy on purpose: install_cmd
244
+ returns early on is_installed(), so that advice would be false. `system-copy`
245
+ can carry it because the tool reads not-installed, so install actually runs.
246
+ """
247
+ mgr = escape(note.manager)
248
+ if note.state == "managed":
249
+ return f"[{ui.GRAY}] ✓ managed by {mgr}[/]"
250
+ if note.state == "outside":
251
+ path = f" ({escape(note.path)})" if note.path else ""
252
+ return f"[{ui.AMBER}] ⇢ installed outside {mgr}{path}; {mgr} can manage it[/]"
253
+ if note.state == "can-manage":
254
+ return f"[{ui.GRAY}] ⇢ {mgr} can manage this[/]"
255
+ if note.state == "system-copy":
256
+ return (
257
+ f"[{ui.AMBER}] ⇢ {escape(note.executable)} at {escape(note.path)} isn't "
258
+ f"managed by {mgr}; `devstuff install {escape(tool.key)}` lets {mgr} manage it[/]"
259
+ )
260
+ if note.state == "unknown":
261
+ why = f" ({escape(note.why)})" if note.why else ""
262
+ return f"[{ui.GRAY}] ? {mgr}-managed tool; couldn't confirm{why}[/]"
263
+ return ""
264
+
265
+
266
+ def picker_hint(note: ManagerNote, tool: Tool) -> tuple[str, str | None]:
267
+ """(title suffix, disabled-text override) for the install picker.
268
+
269
+ Plain text only — picker titles aren't Rich markup, so nothing is escaped.
270
+ `unknown` returns no override: the default "installed" is the honest row.
271
+ """
272
+ mgr = note.manager
273
+ if note.state == "managed":
274
+ return "", f"installed · managed by {mgr}"
275
+ if note.state == "outside":
276
+ return "", f"installed outside {mgr}"
277
+ if note.state == "can-manage":
278
+ return f" (via {mgr})", None
279
+ if note.state == "system-copy":
280
+ return f" ({note.executable} found outside {mgr})", None
281
+ return "", None
dev_setup/tools.yaml CHANGED
@@ -207,6 +207,16 @@ tools:
207
207
  requires:
208
208
  - uv
209
209
 
210
+ delta:
211
+ name: delta
212
+ description: Syntax-highlighting pager for git diffs
213
+ category: tools
214
+ type: apt
215
+ apt_packages: git-delta
216
+ check_cmd: delta
217
+ help_cmd: delta --help
218
+ docs_url: https://dandavison.github.io/delta/
219
+
210
220
  devin:
211
221
  name: Devin CLI
212
222
  description: Cognition's AI software engineer, in the terminal
@@ -285,6 +295,59 @@ tools:
285
295
  || sudo yum remove -y docker-ce docker-ce-cli containerd.io docker-compose-plugin 2>/dev/null \
286
296
  || true
287
297
 
298
+ fzf:
299
+ name: fzf
300
+ description: Command-line fuzzy finder, with Ctrl-R/Ctrl-T/Alt-C key bindings in bash
301
+ category: tools
302
+ type: bash
303
+ # The block is half of what this entry installs: an fzf that arrived by other
304
+ # means (apt, a manual build) must not count as installed, or install_cmd
305
+ # would early-return and the key bindings would never reach ~/.bashrc.
306
+ check_cmd: command -v fzf >/dev/null 2>&1 && grep -Fxq '# fzf key bindings' "$HOME/.bashrc" 2>/dev/null
307
+ version_cmd: fzf
308
+ help_cmd: fzf --help
309
+ docs_url: https://junegunn.github.io/fzf/
310
+ install_script: |
311
+ set -euo pipefail
312
+ sudo apt-get update -q
313
+ sudo apt-get install -y fzf
314
+ marker="# fzf key bindings"
315
+ # `fzf --bash` only exists on fzf >= 0.48; Ubuntu 24.04 ships 0.44, whose
316
+ # package carries the bindings as an example file instead. Try the new
317
+ # flag first, fall back to the file, and never let either failure reach
318
+ # the interactive shell that sources this block.
319
+ block='if command -v fzf >/dev/null 2>&1; then
320
+ if _fzf_init="$(fzf --bash 2>/dev/null)"; then eval "$_fzf_init"
321
+ elif [ -r /usr/share/doc/fzf/examples/key-bindings.bash ]; then . /usr/share/doc/fzf/examples/key-bindings.bash
322
+ fi
323
+ unset _fzf_init
324
+ fi'
325
+ touch "$HOME/.bashrc"
326
+ if ! grep -Fxq "$marker" "$HOME/.bashrc"; then
327
+ printf '\n%s\n%s\n' "$marker" "$block" >> "$HOME/.bashrc"
328
+ fi
329
+ remove_script: |
330
+ set -euo pipefail
331
+ if [ -f "$HOME/.bashrc" ]; then
332
+ python3 - "$HOME/.bashrc" <<'PY'
333
+ import sys
334
+ path = sys.argv[1]
335
+ lines = open(path).read().splitlines()
336
+ out = []
337
+ skip = 0
338
+ for line in lines:
339
+ if skip:
340
+ skip -= 1
341
+ continue
342
+ if line == "# fzf key bindings":
343
+ skip = 6
344
+ continue
345
+ out.append(line)
346
+ open(path, "w").write("\n".join(out) + ("\n" if out else ""))
347
+ PY
348
+ fi
349
+ sudo apt-get remove -y fzf
350
+
288
351
  gh:
289
352
  name: GitHub CLI
290
353
  description: GitHub's official CLI - PRs, issues, Actions, and more
@@ -687,6 +750,18 @@ tools:
687
750
  sudo systemctl daemon-reload 2>/dev/null || true
688
751
  echo "Downloaded models in ~/.ollama were left intact."
689
752
 
753
+ opencode:
754
+ name: OpenCode
755
+ description: Open-source AI coding agent for the terminal
756
+ category: ai-tools
757
+ type: npm
758
+ npm_name: opencode-ai
759
+ check_cmd: opencode
760
+ help_cmd: opencode --help
761
+ docs_url: https://opencode.ai/docs
762
+ requires:
763
+ - nvm
764
+
690
765
  php:
691
766
  name: PHP 8.4
692
767
  description: PHP 8.4 + common extensions via ondrej/php PPA
@@ -727,6 +802,11 @@ tools:
727
802
  docs_url: https://docs.astral.sh/uv/guides/install-python/
728
803
  requires:
729
804
  - uv
805
+ managed_by: uv
806
+ # The check is a shell expression and the managed executable is python3, not
807
+ # the key — version_cmd gives get_version (and managers' path signal) a real
808
+ # binary to resolve.
809
+ version_cmd: python3
730
810
  install_script: |
731
811
  set -euo pipefail
732
812
  uv python install --default
@@ -783,6 +863,18 @@ tools:
783
863
  npm uninstall -g @earendil-works/pi-coding-agent
784
864
  requires:
785
865
  - nvm
866
+ managed_by: nvm
867
+ version_cmd: pi
868
+
869
+ ripgrep:
870
+ name: ripgrep
871
+ description: Fast recursive code search (rg)
872
+ category: tools
873
+ type: apt
874
+ apt_packages: ripgrep
875
+ check_cmd: rg
876
+ help_cmd: rg --help
877
+ docs_url: https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md
786
878
 
787
879
  ruby:
788
880
  name: Ruby (rbenv)
@@ -867,6 +959,16 @@ tools:
867
959
  set -euo pipefail
868
960
  sudo rm -f /usr/local/bin/saml2aws
869
961
 
962
+ shellcheck:
963
+ name: ShellCheck
964
+ description: Static analysis and linting for shell scripts
965
+ category: tools
966
+ type: apt
967
+ apt_packages: shellcheck
968
+ check_cmd: shellcheck
969
+ help_cmd: shellcheck --help
970
+ docs_url: https://www.shellcheck.net/wiki/Home
971
+
870
972
  starship:
871
973
  name: Starship
872
974
  description: Fast, cross-shell customizable prompt
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devstuff
3
- Version: 2.23.0
3
+ Version: 2.25.0
4
4
  Summary: Development environment setup CLI for Linux
5
5
  Project-URL: Repository, https://github.com/thesawdawg/dev-setup-py
6
6
  Author-email: Sawyer <sawyerksu@gmail.com>
@@ -238,6 +238,7 @@ devstuff list --available # only packages not yet installed
238
238
  ```
239
239
 
240
240
  Output columns: status (✔/✘), package key, description, install type, version (if installed), help command.
241
+ Tools another catalog tool manages or could manage get a second line — `✓ managed by uv`, `installed outside nvm`, `uv can manage this`, or a warning that a system copy (e.g. `/usr/bin/python3`) exists outside the manager — probed against the machine, not inferred from the catalog.
241
242
 
242
243
  ---
243
244
 
@@ -1648,6 +1649,8 @@ links:
1648
1649
  | `bat` | bat | cat replacement with syntax highlighting and git integration (`devstuff configure bat`) | `bat --help` |
1649
1650
  | `bubblewrap` | bubblewrap + socat | Unprivileged sandbox (bwrap) and network relay (socat) — what Claude Code's /sandbox needs on Linux | `bwrap --help` |
1650
1651
  | `commitizen` | Commitizen | Conventional-commit prompt, semantic version bumping, and changelog generation (`devstuff configure commitizen`) | `cz --help` |
1652
+ | `delta` | delta | Syntax-highlighting pager for git diffs — the `devstuff configure lazygit` wizard can install it for you | `delta --help` |
1653
+ | `fzf` | fzf | Command-line fuzzy finder — installs the apt package and adds Ctrl-R/Ctrl-T/Alt-C key bindings to `~/.bashrc` | `fzf --help` |
1651
1654
  | `gh` | GitHub CLI | GitHub's official CLI | `gh --help` |
1652
1655
  | `ghgrab` | ghgrab | TUI and CLI for downloading files, folders, and release assets from GitHub and other git forges without cloning | `ghgrab --help` |
1653
1656
  | `git-lfs` | Git LFS | Git extension for versioning large files | `git lfs --help` |
@@ -1657,6 +1660,7 @@ links:
1657
1660
  | `ipython` | IPython | Enhanced interactive Python shell with rich tab completion and magic commands | `ipython --help` |
1658
1661
  | `lazygit` | lazygit | TUI git client for fast, keyboard-driven git workflows (`devstuff configure lazygit`) | `lazygit --help` |
1659
1662
  | `reptyr` | reptyr | Move a running process to another terminal (`devstuff configure reptyr` for permissions) | `reptyr -h` |
1663
+ | `ripgrep` | ripgrep | Fast recursive code search (`rg`) | `rg --help` |
1660
1664
  | `llamactl` | llamactl | CLI for managing LlamaDeploy projects and deployments (LlamaIndex) | `llamactl --help` |
1661
1665
  | `llm-checker` | llm-checker | Check LLM compatibility with your hardware | `llm-checker --help` |
1662
1666
  | `lmstudio` | LM Studio | Run large language models locally with a GUI | `lms --help` |
@@ -1669,8 +1673,10 @@ links:
1669
1673
  | `codex` | Codex CLI | OpenAI coding agent for the terminal | `codex --help` |
1670
1674
  | `devin` | Devin CLI | Cognition's AI software engineer, in the terminal | `devin --help` |
1671
1675
  | `hey-dave` | hey-dave | Terminal coding-agent harness that runs D.A.V.E. natively | `dave --help` |
1676
+ | `opencode` | OpenCode | Open-source AI coding agent for the terminal | `opencode --help` |
1672
1677
  | `pre-commit` | pre-commit | Git hook manager for automated code quality checks (`devstuff configure pre-commit`) | `pre-commit --help` |
1673
1678
  | `saml2aws` | saml2aws | SAML → AWS STS credentials CLI (Versent) | `saml2aws --help` |
1679
+ | `shellcheck` | ShellCheck | Static analysis and linting for shell scripts | `shellcheck --help` |
1674
1680
  | `starship` | Starship | Fast, cross-shell customizable prompt (`devstuff configure starship`) | `starship --help` |
1675
1681
  | `syncthing` | Syncthing | Peer-to-peer file sync daemon (`devstuff configure syncthing` to pair devices) | `syncthing --help` |
1676
1682
  | `tmux` | tmux | Terminal multiplexer — persistent sessions, windows and panes | `tmux -h` |
@@ -1724,6 +1730,7 @@ tools:
1724
1730
  | `help_cmd` | no | Command shown in `list` under the package entry |
1725
1731
  | `docs_url` | no | URL opened by `devstuff docs <key>` |
1726
1732
  | `requires` | no | List of package keys that must already be installed |
1733
+ | `managed_by` | no | Catalog key of the tool that manages this one's installs (e.g. `uv`, `nvm`). Implied for `npm` → `nvm` and `pip`/`uvx` → `uv`; set it only when the type doesn't imply one |
1727
1734
  | `npm_name` | npm | npm package name |
1728
1735
  | `pip_name` | pip | PyPI package name. Extras work as-is: `pip_name: "ansible-lint[lock]"` |
1729
1736
  | `uv_with` | no (pip/uvx) | Extra packages installed into the tool's environment (`uv tool install --with`) |
@@ -6,7 +6,7 @@ dev_setup/apply_exec.py,sha256=czzQxxYHWCAmAsgd9BvMPYlG2b63g0b3RHbbO5UyPRA,6364
6
6
  dev_setup/apply_plan.py,sha256=L_ZmSGnjM7T1hKT7RLXSvCZgjbRpX_AaTKg5N9fp1zs,8474
7
7
  dev_setup/base.py,sha256=j2EQ5gzeGgtveWQN_BgbLcZianMENJ7PQy8EQ9J9MPE,1946
8
8
  dev_setup/bundles.py,sha256=h-WdjwNI82SQCgXiJ-EoiwuI81umb09Q0NNUYyzH1FI,2285
9
- dev_setup/catalog.py,sha256=PrimTBUYoh8cW9QYhXUxP8qSMeK51kzQjUoPEGD9EBw,6530
9
+ dev_setup/catalog.py,sha256=FzSPmKbqJlYarg3KGH5FNOc6mOW-6ADl9Ydg2kmedmQ,6927
10
10
  dev_setup/cli.py,sha256=KHdraEvcUf1IqSLkGjXyChSccBduPPvxvNefWfL4qzg,3407
11
11
  dev_setup/doctor.py,sha256=1shwNLT5wFxiGT5oBVqbF478B7lcHVwT_e50aFb2I20,16962
12
12
  dev_setup/function_runner.py,sha256=08F6jvB9-oOyE5ivYtRjnL16JTGsfRnkpvkjSVrJhsM,6957
@@ -14,15 +14,16 @@ 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=Lg0c41TVT4Vj6yT1H9qH1zWYmZN4c_JtA9wtM6bdopc,43921
17
+ dev_setup/generic.py,sha256=AUGc3FzFFI3d4A_8Hg1nd9r5Q7wnFolSWqjr9i4T2zA,44110
18
18
  dev_setup/links.schema.json,sha256=V9_1UA8Ejfu0j6-VczH0blW1mlGupXx56NhApLtHHKc,1938
19
- dev_setup/links.yaml,sha256=jFxG3lzATHh-PLNh6cH71UGkMjuVo-gIfS66gTyGwks,6957
19
+ dev_setup/links.yaml,sha256=nBwgCDljLbqY75ebQ9JuZao0-zJEwtJO6GNRV_eG7IM,7896
20
20
  dev_setup/links_catalog.py,sha256=Xe7s9oqiCrfQPUwE-X9o6p5VkU7mH9PjY9NMyn6VbHg,4610
21
21
  dev_setup/links_registry.py,sha256=xyq49oH1u_CX85UcizKSuxuy_pzurNoDwSRg3YftUMY,2439
22
+ dev_setup/managers.py,sha256=mW_MI9OfZsuxy8--PCHom-_CG3sFb9nPqJ26wQQVAIc,10665
22
23
  dev_setup/profile.py,sha256=NiSOXXwEPX6IIT8FagnAC-tcg49HWijFDSm2jn3hjts,13632
23
24
  dev_setup/registry.py,sha256=eHEuo4p0O0CHDWatFuOlSFiSAz5L6YFYmv9tAGHYMt4,2510
24
25
  dev_setup/snapshot.py,sha256=A2G_6pHSaGhDT1PJAZ6eW83GdSdCGs2r79yH8FCa0Qs,5330
25
- dev_setup/tools.yaml,sha256=vHrujWSeHw1aQX03gecLIRxmdmnZa82cZTQuGNlabZA,39864
26
+ dev_setup/tools.yaml,sha256=jWW5JC_xkyQtVyA79d9FJdjC5F_-_6rYKTKv0C-1Fu0,43210
26
27
  dev_setup/ui.py,sha256=B0t4hYlZ7jIMIdldMCImLNBJT1NQgZ4ff8ItjfHRNl0,23879
27
28
  dev_setup/updates.py,sha256=p9_nbfaX_73hE71kr5ZDZA5o85T9XTR0mjbo15f950I,6046
28
29
  dev_setup/verbose.py,sha256=N3U9JAYOvFwdd8DT6W7Pqq6RCIUfbcQnPsm0O1TnvQY,5003
@@ -58,9 +59,9 @@ dev_setup/commands/docs_cmd.py,sha256=JXhusKUl4dD-U5jG-PLTon_2NCpAWWnaBqsmlFk7vL
58
59
  dev_setup/commands/doctor_cmd.py,sha256=sPhxLMVxy1JOxdFklRQHIwCoJeB-nmGWzVs5yeza9a8,3568
59
60
  dev_setup/commands/functions_cmd.py,sha256=4HvdLXle9JGk70A1EDVZrlgTo-N-FyAO7ApaL8mcJYI,3023
60
61
  dev_setup/commands/help_cmd.py,sha256=O2dnhqsMZx5tVHdJVixixCJwc9TYlKdlZ2vYYPApl0o,4566
61
- dev_setup/commands/install_cmd.py,sha256=YgVm8r2RevoSrfBBAvZpDmL0NOQFdOGTFp3aIx-9xwo,8519
62
+ dev_setup/commands/install_cmd.py,sha256=6h5KY2uReJt9nIlbrgOysmeIYgG7X767bPnUleGuHu8,9077
62
63
  dev_setup/commands/links_cmd.py,sha256=kvnoBXdM9QWRZRIwWgnmWqVkOYE7AZxywFTQD5_Uwv4,4924
63
- dev_setup/commands/list_cmd.py,sha256=Env6bwAmREDek4L-ZB2CIfvLT4PgaKcz5sQKJ1GhL8g,2913
64
+ dev_setup/commands/list_cmd.py,sha256=Koi46SqFBnC-w2HypIaXI7E5eCtYg5q9fod5_rQ3k1o,3159
64
65
  dev_setup/commands/mcp_cmd.py,sha256=UkScDupval0pHZhV1Mex6I8s9pnE7OS2Qf6zQhcQaxM,10261
65
66
  dev_setup/commands/outdated_cmd.py,sha256=afwYyq0M-tWVOk2qyXQqsdWSTK6yuFbVpbrOmMPKS_w,4757
66
67
  dev_setup/commands/profile_cmd.py,sha256=jo7al_nBwuWtzOLYKjcqEGmHp4eQrzM5s7ahv6iiGaw,18299
@@ -98,7 +99,7 @@ dev_setup/configure/lazygit/detect.py,sha256=DJ0U9QU0Qc-O8jwpllqhcPLB1FPTX7mICDb
98
99
  dev_setup/configure/lazygit/model.py,sha256=8XwQnwuBZVYC3LdqguUG2HJG0Cla9FqZSiMkTT2DVZ8,17697
99
100
  dev_setup/configure/lazygit/render.py,sha256=h5yx4JAaKXuR21jVFW5Y34rXPK1KKnOs7VDmPsaDSA4,8277
100
101
  dev_setup/configure/lazygit/validate.py,sha256=eeiaCUnRZwGQavsFkhuY_VWMtw606qeBX-ALGh5Ek0Q,7454
101
- dev_setup/configure/lazygit/wizard.py,sha256=AgN6WLO7zV408lrhUh1IYPfGiboa2VGa4eMPeMQ3jQs,15328
102
+ dev_setup/configure/lazygit/wizard.py,sha256=EUb4wc09PefKzl9IT8njWBPsJ_KTGOV5k10Vw5uOg-E,16923
102
103
  dev_setup/configure/precommit/__init__.py,sha256=o6gUaCMebR3cQv1dpyVvFKMn7R6A1snopIzpVZlvrIc,216
103
104
  dev_setup/configure/precommit/detect.py,sha256=PynfbhWZfCnN9HN5YGPnIVPMI-vV8HKhiT-dIT-N5NY,9121
104
105
  dev_setup/configure/precommit/model.py,sha256=j-sz0jzbmy66d_l_Glzo0kO5ybuwMY8tx4vJYz0ri4I,28563
@@ -127,7 +128,7 @@ dev_setup/mcp/printconfig.py,sha256=3u_b4UpDwJ95u0_AfZuZuch1_-bOojdAg-08c5l6g28,
127
128
  dev_setup/mcp/process.py,sha256=IV203HLaCelWb89IhV73_8NWNAGglXRtXpwpHk39dD4,4752
128
129
  dev_setup/mcp/stdio.py,sha256=k-s2722_N2j92umkKo_Bq6KijfQGKFRudYVsh2H4xAk,6121
129
130
  dev_setup/mcp/token.py,sha256=Pr7MCY6FtY8g2oQWB291mMooiZY0eu659Qk3mh9auWE,3397
130
- devstuff-2.23.0.dist-info/METADATA,sha256=jfN4q2ohbkmoqHIdbkI9RRNgXctQKmDOwTD7dD8szyo,99564
131
- devstuff-2.23.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
132
- devstuff-2.23.0.dist-info/entry_points.txt,sha256=48ITy9ENdXDFrTHwAyVPUpq1MDmgFqcOisOo5mAR6OQ,53
133
- devstuff-2.23.0.dist-info/RECORD,,
131
+ devstuff-2.25.0.dist-info/METADATA,sha256=SyxiXelUGdD8e9aRRki8P-idNFfFI__aEY5A_2c2LiU,100610
132
+ devstuff-2.25.0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
133
+ devstuff-2.25.0.dist-info/entry_points.txt,sha256=48ITy9ENdXDFrTHwAyVPUpq1MDmgFqcOisOo5mAR6OQ,53
134
+ devstuff-2.25.0.dist-info/RECORD,,