devstuff 2.7.0__py3-none-any.whl → 2.9.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.
@@ -21,7 +21,7 @@ def _write_file_preview(args: dict[str, Any], ws: Workspace) -> Panel:
21
21
  except SandboxError:
22
22
  # The sandbox will reject this before it runs; show the raw request rather
23
23
  # than crashing the prompt.
24
- return Panel(str(args.get("path", "")), title="write_file", border_style="yellow")
24
+ return Panel(str(args.get("path", "")), title="write_file", border_style=ui.AMBER)
25
25
 
26
26
  new = args.get("content", "")
27
27
  old = path.read_text(encoding="utf-8", errors="replace") if path.exists() else ""
@@ -29,7 +29,7 @@ def _write_file_preview(args: dict[str, Any], ws: Workspace) -> Panel:
29
29
 
30
30
  if not path.exists():
31
31
  body = Syntax(new, "text", theme="monokai", line_numbers=False, word_wrap=True)
32
- return Panel(body, title=f"create {label}", border_style="green")
32
+ return Panel(body, title=f"create {label}", border_style=ui.GREEN)
33
33
 
34
34
  diff = "".join(
35
35
  difflib.unified_diff(
@@ -41,11 +41,11 @@ def _write_file_preview(args: dict[str, Any], ws: Workspace) -> Panel:
41
41
  )
42
42
  )
43
43
  if not diff:
44
- return Panel("(no change)", title=f"write {label}", border_style="dim")
44
+ return Panel("(no change)", title=f"write {label}", border_style=ui.BORDER)
45
45
  return Panel(
46
46
  Syntax(diff, "diff", theme="monokai", line_numbers=False),
47
47
  title=f"edit {label}",
48
- border_style="yellow",
48
+ border_style=ui.AMBER,
49
49
  )
50
50
 
51
51
 
@@ -59,11 +59,11 @@ def preview(tool: AgentTool, args: dict[str, Any], ws: Workspace) -> Panel:
59
59
  return Panel(
60
60
  Syntax(str(args.get("command", "")), "bash", theme="monokai", line_numbers=False),
61
61
  title=f"run in {ws.display(ws.cwd)}",
62
- border_style="yellow",
62
+ border_style=ui.AMBER,
63
63
  )
64
64
 
65
65
  rendered = "\n".join(f"{k}: {v}" for k, v in args.items()) or "(no arguments)"
66
- return Panel(rendered, title=tool.key, border_style="yellow")
66
+ return Panel(rendered, title=tool.key, border_style=ui.AMBER)
67
67
 
68
68
 
69
69
  class ApprovalPolicy:
dev_setup/agent/loop.py CHANGED
@@ -67,7 +67,8 @@ def execute(session, call: ToolCall) -> ToolOutcome:
67
67
  call.name, False, "the user declined this action. Ask what they would prefer."
68
68
  )
69
69
  else:
70
- ui.dim(f"↳ {call.name}({', '.join(f'{k}={v!r}' for k, v in args.items())[:120]})")
70
+ preview = ", ".join(f"{k}={v!r}" for k, v in args.items())[:120]
71
+ ui.console.print(f" [{ui.CYAN}]▸[/] [{ui.GRAY}]{call.name}({preview})[/]")
71
72
 
72
73
  try:
73
74
  output = _dispatch(session, tool, args)
@@ -122,7 +123,9 @@ def run_turn(session, user_text: str) -> Message | None:
122
123
  }
123
124
  )
124
125
  if not outcome.ok:
125
- ui.dim(f" {outcome.content.splitlines()[0][:120]}")
126
+ ui.console.print(
127
+ f" [{ui.AMBER}]▸[/] [{ui.GRAY}]{outcome.content.splitlines()[0][:120]}[/]"
128
+ )
126
129
 
127
130
  ui.warn(f"Stopped after {session.config.max_iterations} tool calls without a final answer.")
128
131
  ui.dim("Ask again with a narrower request, or /reset to start over.")
@@ -91,16 +91,19 @@ def render(reply: Message | None) -> None:
91
91
  return
92
92
  if reply.content.strip():
93
93
  ui.console.print()
94
- ui.console.print(Markdown(reply.content.strip()))
94
+ ui.console.print(ui.gutter(Markdown(reply.content.strip())))
95
95
  ui.console.print()
96
96
 
97
97
 
98
98
  def _print_banner(session: AgentSession) -> None:
99
99
  ui.section("devstuff agent")
100
- ui.dim(f"model {session.model}")
101
- ui.dim(f"host {session.client.host}")
102
- ui.dim(f"workspace {session.workspace.root}")
103
- ui.dim(f"tools {len(session.tools)} available")
100
+ for key, value in (
101
+ ("model", session.model),
102
+ ("host", session.client.host),
103
+ ("workspace", str(session.workspace.root)),
104
+ ("tools", f"{len(session.tools)} available"),
105
+ ):
106
+ ui.console.print(f" [{ui.PURPLE}]{key:<10}[/] [{ui.GRAY}]{value}[/]")
104
107
  if session.policy.yolo:
105
108
  ui.console.print()
106
109
  ui.warn("--yolo: mutating tools run without confirmation (the denylist still applies).")
@@ -121,7 +124,7 @@ def _print_slash_help() -> None:
121
124
 
122
125
  def _print_tools(session: AgentSession) -> None:
123
126
  for key, tool in sorted(session.tools.items()):
124
- marker = "[yellow]![/]" if tool.mutating else " "
127
+ marker = f"[{ui.AMBER}]![/]" if tool.mutating else " "
125
128
  ui.console.print(f" {marker} [bold cyan]{key:<18}[/] [dim]{tool.description[:70]}[/]")
126
129
  ui.console.print()
127
130
  ui.dim("! = mutating, asks for confirmation before running")
@@ -151,15 +154,15 @@ def _summarise(message: dict[str, Any]) -> str | None:
151
154
  if role == "system":
152
155
  return None
153
156
  if role == "user":
154
- return f"[bold]you[/] {str(message.get('content', ''))[:80]}"
157
+ return f"[{ui.PURPLE} bold]you[/] {str(message.get('content', ''))[:80]}"
155
158
  if role == "tool":
156
159
  first = str(message.get("content", "")).splitlines()[:1]
157
- return f"[dim]tool[/] {message.get('tool_name', '?')} → {(first[0] if first else '')[:60]}"
160
+ return f"[{ui.GRAY}]tool[/] {message.get('tool_name', '?')} → {(first[0] if first else '')[:60]}"
158
161
  calls = message.get("tool_calls") or []
159
162
  if calls:
160
163
  names = ", ".join(c["function"]["name"] for c in calls)
161
- return f"[cyan]agent[/] calls {names}"
162
- return f"[cyan]agent[/] {str(message.get('content', ''))[:80]}"
164
+ return f"[{ui.CYAN}]agent[/] calls {names}"
165
+ return f"[{ui.CYAN}]agent[/] {str(message.get('content', ''))[:80]}"
163
166
 
164
167
 
165
168
  def _print_history(session: AgentSession) -> None:
@@ -282,6 +285,22 @@ def _continuation(width: int, line_number: int, is_soft_wrap: bool) -> str:
282
285
  return " " * max(0, width - 2) + "› "
283
286
 
284
287
 
288
+ def _prompt_style():
289
+ """prompt_toolkit theme: violet prompt glyph, dark-violet completion menu."""
290
+ from prompt_toolkit.styles import Style as PTStyle
291
+
292
+ return PTStyle.from_dict({
293
+ "prompt": f"{ui.PURPLE} bold",
294
+ "completion-menu": "bg:#26223B #DDD6FE",
295
+ "completion-menu.completion": "bg:#26223B #DDD6FE",
296
+ "completion-menu.completion.current": f"bg:{ui.VIOLET} #FFFFFF bold",
297
+ "completion-menu.meta.completion": f"bg:#26223B {ui.GRAY}",
298
+ "completion-menu.meta.completion.current": "bg:#7C3AED #DDD6FE",
299
+ "scrollbar.background": "bg:#26223B",
300
+ "scrollbar.button": "bg:#4B4568",
301
+ })
302
+
303
+
285
304
  def build_prompt_session(session: AgentSession, **overrides):
286
305
  """Split out from run_repl so the input behaviour can be driven by tests with a
287
306
  pipe input rather than only exercised by hand."""
@@ -297,6 +316,7 @@ def build_prompt_session(session: AgentSession, **overrides):
297
316
  "multiline": True,
298
317
  "key_bindings": _key_bindings(),
299
318
  "prompt_continuation": _continuation,
319
+ "style": _prompt_style(),
300
320
  }
301
321
  kwargs.update(overrides)
302
322
  return PromptSession(**kwargs)
@@ -308,9 +328,11 @@ def run_repl(session: AgentSession) -> None:
308
328
 
309
329
  _print_banner(session)
310
330
 
331
+ from prompt_toolkit.formatted_text import HTML
332
+
311
333
  while True:
312
334
  try:
313
- line = prompt_session.prompt("you ❯ ").strip()
335
+ line = prompt_session.prompt(HTML("<prompt>you ❯</prompt> ")).strip()
314
336
  except KeyboardInterrupt:
315
337
  continue # Ctrl-C clears the current line, like a shell
316
338
  except EOFError:
dev_setup/cli.py CHANGED
@@ -31,6 +31,7 @@ def _register_commands() -> None:
31
31
  from dev_setup.commands.doctor_cmd import doctor_cmd
32
32
  from dev_setup.commands.functions_cmd import functions_cmd
33
33
  from dev_setup.commands.install_cmd import install_cmd
34
+ from dev_setup.commands.links_cmd import links_cmd
34
35
  from dev_setup.commands.list_cmd import list_cmd
35
36
  from dev_setup.commands.remove_cmd import remove_cmd
36
37
  from dev_setup.commands.run_cmd import run_cmd
@@ -52,6 +53,8 @@ def _register_commands() -> None:
52
53
  cli.add_command(catalog_cmd, "catalog")
53
54
  cli.add_command(run_cmd, "run")
54
55
  cli.add_command(functions_cmd, "functions")
56
+ cli.add_command(links_cmd, "links")
57
+ cli.add_command(links_cmd, "link")
55
58
  cli.add_command(skills_cmd, "skills")
56
59
  cli.add_command(agent_cmd, "agent")
57
60
 
@@ -124,11 +124,11 @@ def add_cmd() -> None:
124
124
  )
125
125
 
126
126
  ui.console.print()
127
- ui.console.print("[bold]Summary[/]")
127
+ ui.heading("Summary")
128
128
  for k, v in kwargs.items():
129
129
  if v:
130
130
  display = _truncate_script(v) if k.endswith("_script") else v
131
- ui.console.print(f" [dim]{k:<18}[/] {display}")
131
+ ui.console.print(f" [{ui.PURPLE}]{k:<18}[/] {display}")
132
132
  ui.console.print()
133
133
 
134
134
  if not ui.confirm("Save this package?"):
@@ -101,11 +101,14 @@ def _is_installed(key: str) -> bool:
101
101
 
102
102
  def _print_list() -> None:
103
103
  ui.console.print()
104
- ui.console.print(" [bold]CONFIGURABLE TOOLS[/]")
105
- width = max(len(s.key) for s in configure.CONFIGURATORS.values()) + 2
104
+ tbl = ui.table(title="[bold]configurable tools[/]")
105
+ tbl.add_column("", width=2, justify="center")
106
+ tbl.add_column("Tool", style="bold cyan", no_wrap=True)
107
+ tbl.add_column("Description", ratio=1)
106
108
  for spec in configure.CONFIGURATORS.values():
107
- mark = "[green]✔[/]" if _is_installed(spec.key) else "[dim]·[/]"
108
- ui.console.print(f" {mark} [bold cyan]{spec.key:<{width}}[/] {spec.description}")
109
+ mark = f"[{ui.GREEN}]●[/]" if _is_installed(spec.key) else f"[{ui.GRAY}]○[/]"
110
+ tbl.add_row(mark, spec.key, spec.description)
111
+ ui.console.print(tbl)
109
112
  ui.console.print()
110
113
  ui.dim(" devstuff configure <tool>")
111
114
  ui.console.print()
@@ -25,7 +25,7 @@ def docs_cmd(package: str) -> None:
25
25
  sys.exit(1)
26
26
 
27
27
  ui.console.print(f"\n [bold]{tool.name}[/] docs")
28
- ui.console.print(f" [cyan]{tool.docs_url}[/]\n")
28
+ ui.console.print(f" [cyan underline link={tool.docs_url}]{tool.docs_url}[/]\n")
29
29
 
30
30
  opened = webbrowser.open(tool.docs_url)
31
31
  if opened:
@@ -7,11 +7,12 @@ import click
7
7
  from dev_setup import doctor, ui
8
8
 
9
9
  _STATUS_ICON = {
10
- doctor.PASS: "[green bold]✔[/]",
11
- doctor.WARN: "[yellow bold]⚠[/]",
12
- doctor.FAIL: "[red bold]✖[/]",
10
+ doctor.PASS: f"[{ui.GREEN} bold]✔[/]",
11
+ doctor.WARN: f"[{ui.AMBER} bold]⚠[/]",
12
+ doctor.FAIL: f"[{ui.RED} bold]✖[/]",
13
13
  }
14
- _STATUS_LABEL = {doctor.PASS: "pass", doctor.WARN: "warn", doctor.FAIL: "FAIL"}
14
+ # pass needs no text label — the icon carries it. warn/fail get one for scanability.
15
+ _STATUS_LABEL = {doctor.WARN: ui.AMBER, doctor.FAIL: ui.RED}
15
16
 
16
17
 
17
18
  @click.command("doctor")
@@ -32,8 +33,11 @@ def doctor_cmd(auto_fix: bool, check_only: bool) -> None:
32
33
  fixable: list[doctor.CheckResult] = []
33
34
  for r in results:
34
35
  icon = _STATUS_ICON.get(r.status, "[dim]?[/]")
35
- label = _STATUS_LABEL.get(r.status, r.status)
36
- ui.console.print(f" {icon} [bold]{r.name}[/] [dim]({label})[/] {r.message}")
36
+ line = f" {icon} [bold]{r.name}[/] {r.message}"
37
+ color = _STATUS_LABEL.get(r.status)
38
+ if color:
39
+ line += f" [{color} bold]{r.status.upper()}[/]"
40
+ ui.console.print(line)
37
41
  if r.detail:
38
42
  ui.dim(f" {r.detail}")
39
43
  if r.status != doctor.PASS and r.fix is not None:
@@ -42,9 +46,19 @@ def doctor_cmd(auto_fix: bool, check_only: bool) -> None:
42
46
  passed = sum(1 for r in results if r.status == doctor.PASS)
43
47
  warned = sum(1 for r in results if r.status == doctor.WARN)
44
48
  failed = sum(1 for r in results if r.status == doctor.FAIL)
49
+
50
+ def _count(n: int, color: str, word: str) -> str:
51
+ style = color if n else ui.GRAY
52
+ return f"[{style}]{n} {word}[/]"
53
+
45
54
  ui.console.print()
46
55
  ui.console.print(
47
- f" [dim]{passed} passed, {warned} warning(s), {failed} failure(s)[/]"
56
+ " "
57
+ + " · ".join([
58
+ _count(passed, ui.GREEN, "passed"),
59
+ _count(warned, ui.AMBER, "warnings"),
60
+ _count(failed, ui.RED, "failed"),
61
+ ])
48
62
  )
49
63
 
50
64
  if check_only or not fixable:
@@ -26,17 +26,21 @@ def list_cmd() -> None:
26
26
  for f in fns:
27
27
  by_cat.setdefault(f.category, []).append(f)
28
28
 
29
- key_width = max((len(f.key) for f in fns), default=12) + 2
30
29
  for cat in sorted(by_cat, key=lambda c: (c == "custom", c)):
31
- ui.console.print(f"\n [bold]{cat.upper()}[/]")
32
- for f in sorted(by_cat[cat], key=lambda f: f.key):
30
+ entries = sorted(by_cat[cat], key=lambda f: f.key)
31
+ tbl = ui.table(
32
+ title=f"[bold]{cat}[/] [{ui.GRAY}]{len(entries)} function(s)[/]"
33
+ )
34
+ tbl.add_column("Function", style="bold cyan", no_wrap=True)
35
+ tbl.add_column("Type", style=ui.CYAN, no_wrap=True)
36
+ tbl.add_column("Args", style=ui.GRAY, no_wrap=True)
37
+ tbl.add_column("Description", ratio=1)
38
+ for f in entries:
33
39
  mode = f.type if f.type == "script" else f"{f.type} ({f.register})"
34
- ui.console.print(
35
- f" [bold cyan]{f.key:<{key_width}}[/] [dim]{mode:<22}[/] {f.description}"
36
- )
37
40
  params = " ".join(f"<{p.name}>" for p in f.params)
38
- if params:
39
- ui.dim(f" args: {params}")
41
+ tbl.add_row(f.key, mode, params, f.description)
42
+ ui.console.print(tbl)
43
+ ui.console.print()
40
44
 
41
45
 
42
46
  @functions_cmd.command("enable")
@@ -1,6 +1,18 @@
1
+ from rich.columns import Columns
2
+ from rich.text import Text
3
+
1
4
  from dev_setup import ui
2
5
  from dev_setup.catalog import USER_CATALOG_PATH
3
6
 
7
+ _CATEGORY_DESC = {
8
+ "core": "Always-installed tools (Docker, NVM, uv)",
9
+ "tools": "Optional utilities (lazygit, htop, bat)",
10
+ "ai-tools": "AI coding agents and assistants",
11
+ "customization": "Prompt and shell customization",
12
+ "languages": "Programming language runtimes",
13
+ "custom": "User-added packages",
14
+ }
15
+
4
16
 
5
17
  def print_help() -> None:
6
18
  ui.print_banner()
@@ -21,14 +33,20 @@ def print_help() -> None:
21
33
  ("docs", "<package>", "Open documentation in browser"),
22
34
  ("run", "<function> [args...]", "Run a function/script"),
23
35
  ("functions", "<list|enable|disable|path>", "Manage functions/scripts"),
36
+ ("links", "[list|search|open|path]", "Browse, search, and open tool links"),
24
37
  ("skills", "add", "Append GitHub skills to claude/codex/pi"),
25
38
  ("agent", "[--setup] [--dir] [--model]", "Chat with a local tool-using model"),
26
39
  ("version", "", "Show version"),
27
40
  ]
41
+ tbl = ui.table(bordered=False, show_header=False)
42
+ tbl.add_column("cmd", style="bold cyan", no_wrap=True)
43
+ tbl.add_column("args", style=ui.GRAY, no_wrap=True)
44
+ tbl.add_column("desc", ratio=1)
28
45
  for cmd, args, desc in rows:
29
- ui.console.print(
30
- f" [bold cyan]{cmd:<10}[/] [dim]{args:<40}[/] {desc}"
31
- )
46
+ # args goes in as Text: strings like "[category]" are valid Rich markup
47
+ # tags and would be silently swallowed from a plain str cell.
48
+ tbl.add_row(f" {cmd}", Text(args), desc)
49
+ ui.console.print(tbl)
32
50
 
33
51
  ui.console.print()
34
52
  ui.console.print("[bold]EXAMPLES[/]")
@@ -50,20 +68,31 @@ def print_help() -> None:
50
68
  "devstuff catalog export",
51
69
  "devstuff functions list",
52
70
  "devstuff functions enable ssh-agent-key",
71
+ "devstuff links search docker",
72
+ "devstuff links open uv-docs",
53
73
  "devstuff agent",
54
74
  "devstuff agent --setup",
55
75
  'devstuff agent --print "what node tools are available?"',
56
76
  "ssh-agent-key ~/.ssh/id_ed25519",
57
77
  ]
58
- for ex in examples:
59
- ui.console.print(f" [dim]$[/] [green]{ex}[/]")
78
+ items = [
79
+ Text.assemble((" $ ", ui.GRAY), (ex, "green")) for ex in examples
80
+ ]
81
+ ui.console.print(Columns(items, column_first=True, padding=(0, 3)))
82
+
83
+ from dev_setup import registry
60
84
 
61
85
  ui.console.print()
62
86
  ui.console.print("[bold]CATEGORIES[/]")
63
- ui.console.print(" [cyan]core[/] Always-installed tools (Docker, NVM, uv)")
64
- ui.console.print(" [cyan]tools[/] Optional utilities (PHP, Starship, htop)")
65
- ui.console.print(" [cyan]languages[/] Programming language runtimes")
66
- ui.console.print(" [cyan]custom[/] User-added packages\n")
87
+ _ORDER = {"core": 0, "tools": 1, "custom": 999}
88
+ cats = sorted(
89
+ {t.category for t in registry.all_tools()},
90
+ key=lambda c: (_ORDER.get(c, 500), c),
91
+ )
92
+ for cat in cats:
93
+ desc = _CATEGORY_DESC.get(cat, "")
94
+ ui.console.print(f" [cyan]{cat:<14}[/] [{ui.GRAY}]{desc}[/]")
67
95
 
96
+ ui.console.print()
68
97
  ui.console.print("[bold]CONFIG[/]")
69
- ui.console.print(f" User catalog: [dim]{USER_CATALOG_PATH}[/]\n")
98
+ ui.console.print(f" User catalog: [{ui.GRAY}]{USER_CATALOG_PATH}[/]\n")
@@ -106,7 +106,7 @@ def _install_interactive() -> None:
106
106
  else:
107
107
  disabled = None
108
108
  title = [
109
- ("class:check", "✔ " if is_inst else " "),
109
+ ("class:check", "● " if is_inst else " "),
110
110
  ("class:text", f"{t.key:<{key_width}}{desc}"),
111
111
  ]
112
112
  choices.append(questionary.Choice(
@@ -0,0 +1,141 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ import webbrowser
5
+
6
+ import click
7
+ import questionary
8
+ from rich.markup import escape
9
+
10
+ from dev_setup import links_registry, ui
11
+ from dev_setup.links_catalog import USER_CATALOG_PATH
12
+ from dev_setup.links_registry import LinkDef
13
+
14
+
15
+ @click.group("links", invoke_without_command=True)
16
+ @click.pass_context
17
+ def links_cmd(ctx: click.Context) -> None:
18
+ """Browse, search, and open links to other tools' sites and docs."""
19
+ if ctx.invoked_subcommand is not None:
20
+ return
21
+ # A bare `devstuff links` is the "access the section" entry point: a type-to-filter
22
+ # picker when there is a terminal to drive it, the plain listing otherwise.
23
+ if sys.stdin.isatty() and sys.stdout.isatty():
24
+ _pick_and_open()
25
+ else:
26
+ ctx.invoke(list_cmd)
27
+
28
+
29
+ def _print_groups(links: list[LinkDef]) -> None:
30
+ by_cat: dict[str, list[LinkDef]] = {}
31
+ for link in links:
32
+ by_cat.setdefault(link.category, []).append(link)
33
+
34
+ key_width = max(len(link.key) for link in links) + 2
35
+ for cat in sorted(by_cat, key=lambda c: (c == "custom", c)):
36
+ ui.console.print(f"\n [bold]{cat.upper()}[/]")
37
+ for link in sorted(by_cat[cat], key=lambda link: link.key):
38
+ _print_row(link, key_width)
39
+ ui.console.print()
40
+
41
+
42
+ def _print_row(link: LinkDef, key_width: int, *, show_category: bool = False) -> None:
43
+ ui.console.print(f" [bold cyan]{link.key:<{key_width}}[/] {link.name}")
44
+ detail = link.description
45
+ if show_category:
46
+ detail = f"{detail} [{link.category}]" if detail else f"[{link.category}]"
47
+ if detail:
48
+ # escape(): "[category]" and any bracketed description text are valid Rich markup
49
+ ui.console.print(f" {'':<{key_width}} [dim]{escape(detail)}[/]")
50
+
51
+
52
+ @links_cmd.command("list")
53
+ @click.argument("category", required=False)
54
+ def list_cmd(category: str | None) -> None:
55
+ """List links, grouped by category."""
56
+ links = links_registry.all_links()
57
+ if category:
58
+ links = [link for link in links if link.category == category]
59
+ if not links:
60
+ ui.info("No links match." if category else "No links defined.")
61
+ return
62
+ _print_groups(links)
63
+ ui.dim("Open one with: devstuff links open <key>")
64
+
65
+
66
+ @links_cmd.command("search")
67
+ @click.argument("query", nargs=-1, required=True)
68
+ def search_cmd(query: tuple[str, ...]) -> None:
69
+ """Search links by title and description. Every word must match."""
70
+ text = " ".join(query)
71
+ matches = links_registry.search(text)
72
+ # "Found nothing" is a correct answer, so it exits 0 — non-zero is for failures.
73
+ if not matches:
74
+ ui.info(f"No links match '{text}'.")
75
+ return
76
+ ui.console.print(f"\n [bold]{len(matches)} match(es)[/] [dim]for '{escape(text)}'[/]")
77
+ key_width = max(len(link.key) for link in matches) + 2
78
+ for link in matches: # keep search rank order rather than re-sorting by key
79
+ _print_row(link, key_width, show_category=True)
80
+ ui.console.print()
81
+ ui.dim("Open one with: devstuff links open <key>")
82
+
83
+
84
+ @links_cmd.command("open")
85
+ @click.argument("key")
86
+ def open_cmd(key: str) -> None:
87
+ """Open a link in your browser."""
88
+ link = links_registry.get(key)
89
+ if link is None:
90
+ ui.error(f"Unknown link: '{key}'")
91
+ suggestions = [m.key for m in links_registry.search(key)][:5]
92
+ if suggestions:
93
+ ui.dim(f"Did you mean: {', '.join(suggestions)}")
94
+ ui.dim("See all links with: devstuff links list")
95
+ sys.exit(1)
96
+ _open(link)
97
+
98
+
99
+ @links_cmd.command("path")
100
+ def path_cmd() -> None:
101
+ """Print the path to the user links catalog."""
102
+ click.echo(str(USER_CATALOG_PATH))
103
+
104
+
105
+ def _open(link: LinkDef) -> None:
106
+ ui.console.print(f"\n [bold]{link.name}[/]")
107
+ if link.description:
108
+ ui.console.print(f" [dim]{escape(link.description)}[/]")
109
+ ui.console.print(f" [cyan underline link={link.url}]{link.url}[/]\n")
110
+
111
+ # webbrowser.open acts on the machine devstuff runs on: over SSH there is no browser
112
+ # to find, so the URL above is the fallback (terminals make it clickable).
113
+ if webbrowser.open(link.url):
114
+ ui.success("Opened in browser.")
115
+ else:
116
+ ui.warn("Could not open a browser — copy the URL above to open it manually.")
117
+ sys.exit(1)
118
+
119
+
120
+ def _pick_and_open() -> None:
121
+ links = sorted(
122
+ links_registry.all_links(),
123
+ key=lambda link: (link.category == "custom", link.category, link.key),
124
+ )
125
+ if not links:
126
+ ui.info("No links defined.")
127
+ return
128
+
129
+ ui.section("Links")
130
+ ui.dim("Type to filter, Enter to open.")
131
+ choices = [
132
+ questionary.Choice(
133
+ title=f"{link.name} · {link.category} · {link.description}",
134
+ value=link.key,
135
+ )
136
+ for link in links
137
+ ]
138
+ key = ui.select("Open which link?", choices, searchable=True)
139
+ link = links_registry.get(key)
140
+ if link is not None:
141
+ _open(link)
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  from concurrent.futures import ThreadPoolExecutor
4
4
 
5
5
  import click
6
- from rich.table import Table
7
6
 
8
7
  from dev_setup import registry, ui
9
8
  from dev_setup.base import Tool
@@ -53,24 +52,26 @@ def list_cmd(show_filter: str, category: str) -> None:
53
52
  if not entries:
54
53
  continue
55
54
 
56
- ui.console.print(f" [bold magenta]{cat.upper()}[/]")
57
- ui.divider()
58
-
59
- tbl = Table(box=None, padding=(0, 1), show_header=True, header_style="dim")
60
- tbl.add_column("", width=2)
61
- tbl.add_column("Package", style="bold", min_width=12)
62
- tbl.add_column("Description", min_width=36)
63
- tbl.add_column("Type", style="dim", min_width=8)
64
- tbl.add_column("Version", style="dim")
55
+ n_inst = sum(1 for _, is_inst, _ in entries if is_inst)
56
+ tbl = ui.table(
57
+ title=f"[bold]{cat}[/] [{ui.GRAY}]{n_inst}/{len(entries)} installed[/]"
58
+ )
59
+ tbl.add_column("", width=2, justify="center")
60
+ tbl.add_column("Package", style="bold", no_wrap=True)
61
+ tbl.add_column("Description", ratio=1)
62
+ tbl.add_column("Type", style=ui.CYAN, no_wrap=True)
63
+ tbl.add_column("Version", style=ui.GRAY, no_wrap=True, max_width=28, overflow="ellipsis")
65
64
 
66
65
  for tool, is_inst, version in entries:
67
- missing = registry.missing_requires(tool) if not is_inst else []
68
- icon = "[green bold]✔[/]" if is_inst else "[red bold]✘[/]"
69
- tbl.add_row(icon, tool.key, tool.description, tool.install_type, version)
66
+ icon = f"[{ui.GREEN}]●[/]" if is_inst else f"[{ui.GRAY}]○[/]"
67
+ desc = tool.description
70
68
  if tool.help_cmd:
71
- tbl.add_row("", "", f"[dim cyan] ? {tool.help_cmd}[/]", "", "")
72
- if missing:
73
- tbl.add_row("", "", f"[yellow] ⚠ requires: {', '.join(missing)}[/]", "", "")
69
+ desc += f"\n[{ui.GRAY}] ↳ {tool.help_cmd}[/]"
70
+ if not is_inst:
71
+ missing = registry.missing_requires(tool)
72
+ if missing:
73
+ desc += f"\n[{ui.AMBER}] ⚠ requires: {', '.join(missing)}[/]"
74
+ tbl.add_row(icon, tool.key, desc, tool.install_type, version)
74
75
 
75
76
  ui.console.print(tbl)
76
77
  ui.console.print()
dev_setup/doctor.py CHANGED
@@ -150,6 +150,30 @@ def check_user_functions_catalog() -> CheckResult:
150
150
  )
151
151
 
152
152
 
153
+ def check_bundled_links_catalog() -> CheckResult:
154
+ """Bundled links.yaml loads and validates."""
155
+ from dev_setup import links_catalog as lc
156
+
157
+ try:
158
+ links = lc.load_bundled_catalog()
159
+ except lc.CatalogError as exc:
160
+ return CheckResult("bundled-links-catalog", FAIL, f"Bundled links.yaml invalid: {exc}")
161
+ return CheckResult("bundled-links-catalog", PASS, f"Bundled links.yaml valid ({len(links)} links)")
162
+
163
+
164
+ def check_user_links_catalog() -> CheckResult:
165
+ """User links.yaml (if present) loads and validates."""
166
+ from dev_setup import links_catalog as lc
167
+
168
+ if not lc.USER_CATALOG_PATH.exists():
169
+ return CheckResult("user-links-catalog", PASS, "No user links.yaml")
170
+ try:
171
+ links = lc.read_user_catalog()
172
+ except lc.CatalogError as exc:
173
+ return CheckResult("user-links-catalog", FAIL, f"User links.yaml invalid: {exc}")
174
+ return CheckResult("user-links-catalog", PASS, f"User links.yaml valid ({len(links)} links)")
175
+
176
+
153
177
  def check_bundled_agent_catalog() -> CheckResult:
154
178
  """Bundled agent_tools.yaml loads and validates."""
155
179
  from dev_setup.agent import catalog as ac
@@ -284,6 +308,8 @@ ALL_CHECKS: list[Callable[[], CheckResult]] = [
284
308
  check_user_tools_catalog,
285
309
  check_bundled_functions_catalog,
286
310
  check_user_functions_catalog,
311
+ check_bundled_links_catalog,
312
+ check_user_links_catalog,
287
313
  check_bundled_agent_catalog,
288
314
  check_user_agent_catalog,
289
315
  check_registry_loads,