getbased-agent-stack 0.5.0__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {getbased_agent_stack-0.5.0/src/getbased_agent_stack.egg-info → getbased_agent_stack-0.5.1}/PKG-INFO +1 -1
  2. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/pyproject.toml +1 -1
  3. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack/cli.py +6 -0
  4. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack/units.py +19 -1
  5. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1/src/getbased_agent_stack.egg-info}/PKG-INFO +1 -1
  6. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/tests/test_cli.py +19 -0
  7. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/tests/test_units.py +34 -0
  8. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/LICENSE +0 -0
  9. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/README.md +0 -0
  10. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/setup.cfg +0 -0
  11. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack/__init__.py +0 -0
  12. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack/env_file.py +0 -0
  13. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack/mcp_configs.py +0 -0
  14. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack/systemd/getbased-dashboard.service +0 -0
  15. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack/systemd/getbased-rag.service +0 -0
  16. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack.egg-info/SOURCES.txt +0 -0
  17. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack.egg-info/dependency_links.txt +0 -0
  18. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack.egg-info/entry_points.txt +0 -0
  19. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack.egg-info/requires.txt +0 -0
  20. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/src/getbased_agent_stack.egg-info/top_level.txt +0 -0
  21. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/tests/test_env_file.py +0 -0
  22. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/tests/test_integration.py +0 -0
  23. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/tests/test_mcp_configs.py +0 -0
  24. {getbased_agent_stack-0.5.0 → getbased_agent_stack-0.5.1}/tests/test_systemd_units.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: getbased-agent-stack
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: One-command install of the full getbased agent stack — getbased-mcp + getbased-rag + getbased-dashboard
5
5
  License-Expression: GPL-3.0-only
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "getbased-agent-stack"
7
- version = "0.5.0"
7
+ version = "0.5.1"
8
8
  description = "One-command install of the full getbased agent stack — getbased-mcp + getbased-rag + getbased-dashboard"
9
9
  readme = "README.md"
10
10
  license = "GPL-3.0-only"
@@ -161,6 +161,12 @@ def cmd_init(args: argparse.Namespace) -> int:
161
161
 
162
162
 
163
163
  def _print_linger_hint(strict: bool) -> None:
164
+ # If systemctl isn't even available, the linger question is moot —
165
+ # we've already printed a clearer "systemd not available, unit files
166
+ # written but not activated" message above. Adding "services will
167
+ # stop on logout" here would mislead (there aren't any services).
168
+ if shutil.which("systemctl") is None:
169
+ return
164
170
  user = os.environ.get("USER", "")
165
171
  if not user:
166
172
  return
@@ -44,7 +44,14 @@ class CommandResult:
44
44
 
45
45
 
46
46
  def _real_shell(cmd: "list[str]") -> CommandResult:
47
- proc = subprocess.run(cmd, capture_output=True, text=True)
47
+ # FileNotFoundError when the binary isn't on PATH — happens on systems
48
+ # without systemd (Docker containers, macOS, WSL1). Return a shell-like
49
+ # 127 instead of propagating so callers can handle "not available" the
50
+ # same way they handle "failed" without an unhandled traceback.
51
+ try:
52
+ proc = subprocess.run(cmd, capture_output=True, text=True)
53
+ except FileNotFoundError:
54
+ return CommandResult(127, "", f"command not found: {cmd[0]}")
48
55
  return CommandResult(proc.returncode, proc.stdout, proc.stderr)
49
56
 
50
57
 
@@ -125,6 +132,17 @@ class UnitManager:
125
132
  written = self.install_files()
126
133
  for p in written:
127
134
  log.append(f"wrote {p}")
135
+ # Unit files are written above regardless — they're a prerequisite
136
+ # for any system that CAN run systemd. But if systemctl is absent
137
+ # (Docker container, macOS, WSL1), skip the daemon-reload/enable
138
+ # phase with a clear message rather than stacking cryptic "command
139
+ # not found" errors on top of each other.
140
+ if shutil.which("systemctl") is None:
141
+ log.append(
142
+ "systemctl not available — unit files written but not activated. "
143
+ "On a systemd-enabled host, re-run `getbased-stack install` to enable + start."
144
+ )
145
+ return log
128
146
  r = self.daemon_reload()
129
147
  if r.returncode != 0:
130
148
  log.append(f"daemon-reload FAILED: {r.stderr.strip()}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: getbased-agent-stack
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: One-command install of the full getbased agent stack — getbased-mcp + getbased-rag + getbased-dashboard
5
5
  License-Expression: GPL-3.0-only
6
6
  Requires-Python: >=3.10
@@ -331,6 +331,25 @@ def test_init_yes_installs_units_without_asking(stack_home, fake_shell, monkeypa
331
331
  assert (stack_home / "config" / "systemd" / "user" / "getbased-dashboard.service").exists()
332
332
 
333
333
 
334
+ def test_init_yes_survives_missing_systemctl(stack_home, fake_shell, monkeypatch):
335
+ """--yes on a host without systemctl (Docker, macOS, WSL1) must NOT
336
+ crash with an unhandled FileNotFoundError. Unit files still land;
337
+ systemd ops are skipped with a clear message."""
338
+ import shutil as _shutil
339
+ monkeypatch.setattr(_shutil, "which", lambda name: None)
340
+ # Prompts still stubbed defensively — --yes shouldn't call them.
341
+ monkeypatch.setattr("builtins.input", lambda *a, **kw: "")
342
+ monkeypatch.setattr("getpass.getpass", lambda *a, **kw: "")
343
+
344
+ rc, out, _ = _run(["init", "--yes"])
345
+ assert rc == 0
346
+ # Unit files still written (for re-run on a systemd-enabled host)
347
+ assert (stack_home / "config" / "systemd" / "user" / "getbased-rag.service").exists()
348
+ # Graceful message, not a traceback
349
+ assert "systemctl not available" in out
350
+ assert "Traceback" not in out
351
+
352
+
334
353
  def test_init_yes_preserves_existing_token(stack_home, fake_shell, monkeypatch):
335
354
  """Non-interactive mode must not nuke a previously-saved token —
336
355
  it takes the 'keep current' default, same as pressing Enter."""
@@ -164,6 +164,40 @@ def test_install_daemon_reload_failure_short_circuits(tmp_path):
164
164
  assert any("daemon-reload FAILED" in line for line in log)
165
165
 
166
166
 
167
+ def test_real_shell_handles_missing_binary(monkeypatch):
168
+ """_real_shell must not raise FileNotFoundError when systemctl is
169
+ absent (Docker, macOS, WSL1). Before 0.5.1 this crashed `init` with
170
+ an unhandled traceback — check it returns a shell-like 127 instead."""
171
+ import subprocess as sp
172
+
173
+ def boom(*a, **kw):
174
+ raise FileNotFoundError(2, "No such file or directory", "systemctl")
175
+
176
+ monkeypatch.setattr(sp, "run", boom)
177
+ r = units._real_shell(["systemctl", "--user", "daemon-reload"])
178
+ assert r.returncode == 127
179
+ assert "command not found" in r.stderr
180
+ assert "systemctl" in r.stderr
181
+
182
+
183
+ def test_install_skips_when_systemctl_absent(tmp_path, monkeypatch):
184
+ """On a host without systemctl, `install()` must write unit files
185
+ (harmless, enables later re-run) but skip daemon-reload/enable with
186
+ a clear message — not stack FAILED errors on top of each other."""
187
+ monkeypatch.setattr(units.shutil, "which", lambda name: None)
188
+ shell = FakeShell()
189
+ mgr = UnitManager(unit_dir=tmp_path, shell=shell)
190
+ log = mgr.install()
191
+
192
+ # Files written (prereq for future systemd-enabled reinstall)
193
+ for name in SERVICE_NAMES:
194
+ assert (tmp_path / name).exists()
195
+ # No systemctl calls attempted
196
+ assert not any(c[:1] == ["systemctl"] for c in shell.calls)
197
+ # User-visible message present
198
+ assert any("systemctl not available" in line for line in log)
199
+
200
+
167
201
  def test_install_enable_failure_reported(tmp_path):
168
202
  shell = FakeShell(
169
203
  {