pocketshell 0.3.22__tar.gz → 0.3.24__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 (30) hide show
  1. {pocketshell-0.3.22 → pocketshell-0.3.24}/PKG-INFO +4 -3
  2. {pocketshell-0.3.22 → pocketshell-0.3.24}/README.md +3 -2
  3. {pocketshell-0.3.22 → pocketshell-0.3.24}/pyproject.toml +5 -5
  4. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/__init__.py +4 -4
  5. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/cli.py +4 -4
  6. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/env.py +13 -16
  7. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/jobs.py +3 -3
  8. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/repos.py +0 -7
  9. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/sessions.py +0 -26
  10. {pocketshell-0.3.22 → pocketshell-0.3.24}/uv.lock +2 -2
  11. {pocketshell-0.3.22 → pocketshell-0.3.24}/.gitignore +0 -0
  12. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/__main__.py +0 -0
  13. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/agent_log.py +0 -0
  14. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/daemon.py +0 -0
  15. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/hooks.py +0 -0
  16. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/logs.py +0 -0
  17. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/qr_share.py +0 -0
  18. {pocketshell-0.3.22 → pocketshell-0.3.24}/src/pocketshell/usage.py +0 -0
  19. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/__init__.py +0 -0
  20. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_agent_log.py +0 -0
  21. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_cli.py +0 -0
  22. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_daemon.py +0 -0
  23. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_env.py +0 -0
  24. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_hooks.py +0 -0
  25. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_jobs.py +0 -0
  26. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_logs.py +0 -0
  27. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_qr_share.py +0 -0
  28. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_repos.py +0 -0
  29. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_sessions.py +0 -0
  30. {pocketshell-0.3.22 → pocketshell-0.3.24}/tests/test_usage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pocketshell
3
- Version: 0.3.22
3
+ Version: 0.3.24
4
4
  Summary: Unified server-side Python utility for the PocketShell Android client.
5
5
  Project-URL: Homepage, https://github.com/alexeygrigorev/pocketshell
6
6
  Project-URL: Issues, https://github.com/alexeygrigorev/pocketshell/issues
@@ -274,8 +274,9 @@ uv sync --group dev
274
274
  uv run pytest
275
275
  ```
276
276
 
277
- The tests stub `quse.usage.collect_usage` so they run in seconds without
278
- hitting any provider API.
277
+ The tests stub `pocketshell.usage.subprocess.run` (and the `quse`/`tmuxctl`
278
+ binary resolvers) so they run in seconds without invoking any real binary or
279
+ hitting a provider API.
279
280
 
280
281
  ## Release flow
281
282
 
@@ -246,8 +246,9 @@ uv sync --group dev
246
246
  uv run pytest
247
247
  ```
248
248
 
249
- The tests stub `quse.usage.collect_usage` so they run in seconds without
250
- hitting any provider API.
249
+ The tests stub `pocketshell.usage.subprocess.run` (and the `quse`/`tmuxctl`
250
+ binary resolvers) so they run in seconds without invoking any real binary or
251
+ hitting a provider API.
251
252
 
252
253
  ## Release flow
253
254
 
@@ -8,7 +8,7 @@ name = "pocketshell"
8
8
  # scripts/check-pypi-version.sh enforces this; .github/workflows/build.yml
9
9
  # runs that check before publishing to PyPI. See
10
10
  # tools/pocketshell/README.md ("Release flow") for the bump procedure.
11
- version = "0.3.22"
11
+ version = "0.3.24"
12
12
  description = "Unified server-side Python utility for the PocketShell Android client."
13
13
  readme = "README.md"
14
14
  requires-python = ">=3.11"
@@ -27,10 +27,10 @@ classifiers = [
27
27
  "Topic :: Software Development",
28
28
  "Topic :: System :: Monitoring",
29
29
  ]
30
- # First PR delegates `pocketshell usage` to the existing `quse` CLI via
31
- # subprocess (see `pocketshell/usage.py`) so the new utility does not need
32
- # `quse` published on PyPI. Later PRs will fold the provider-detection
33
- # implementation in directly. Pin lower-bound only.
30
+ # `pocketshell usage` delegates to the existing `quse` CLI via subprocess
31
+ # (see `pocketshell/usage.py`) so this utility does not need `quse`
32
+ # published on PyPI; the provider-detection implementation may be folded
33
+ # in directly later. Pin lower-bound only.
34
34
  dependencies = [
35
35
  "click>=8.2.0",
36
36
  ]
@@ -1,9 +1,9 @@
1
1
  """Unified server-side Python utility for the PocketShell Android client.
2
2
 
3
- This package is intended to replace the separately-installed `quse` and
4
- `tmuxctl` utilities the PocketShell app currently probes for. The first PR
5
- ships the skeleton plus the `pocketshell usage` subcommand only; later PRs
6
- will add `jobs`, `agent-log`, `sessions`, `repos`, and daemon mode.
3
+ This package replaces the separately-installed `quse` and `tmuxctl`
4
+ utilities the PocketShell app used to probe for. The app now probes a
5
+ single `pocketshell` binary, which exposes the `usage`, `jobs`,
6
+ `agent-log`, `sessions`, `repos`, and daemon subcommands.
7
7
 
8
8
  See https://github.com/alexeygrigorev/pocketshell/issues/170.
9
9
  """
@@ -6,10 +6,10 @@ PRs add subgroups: `jobs` (#170 second PR), `sessions` (#218),
6
6
  `agent-log` (#217), `daemon` (#219), and `repos` (#220).
7
7
 
8
8
  Per the D22 locked principle (no backwards compatibility, hard cuts only)
9
- the eventual goal is for the PocketShell Android app to probe for this
10
- single binary instead of `quse` / `tmuxctl`. The first PR keeps the
11
- existing probes in place parallel detection, not legacy detection — so
12
- the app keeps working while we ramp up `pocketshell`'s feature parity.
9
+ the PocketShell Android app probes for this single binary instead of
10
+ `quse` / `tmuxctl`: usage runs `pocketshell usage --json` (#231) and jobs
11
+ run `pocketshell jobs ...` (a direct namespace swap from `tmuxctl jobs`).
12
+ The cutover is complete; the app no longer probes the old binaries.
13
13
  """
14
14
 
15
15
  from __future__ import annotations
@@ -465,18 +465,15 @@ def render_export(directory: Path) -> str:
465
465
  # ---------------------------------------------------------------------------
466
466
 
467
467
 
468
- def _resolve_dir(ctx: click.Context, directory: str, *, must_exist: bool) -> Path:
469
- """Expand ``directory`` and validate it as needed.
468
+ def _resolve_dir(ctx: click.Context, directory: str) -> Path:
469
+ """Expand ``directory`` and require it to be an existing folder.
470
470
 
471
- ``must_exist`` enforces that the folder is present (read paths);
472
- write paths only require the *parent* to exist so a fresh ``.env``
473
- can be created in an existing folder.
471
+ Exits with code 2 if the folder is missing. A fresh ``.env`` / ``.envrc``
472
+ is created inside an already-existing folder, so the directory itself must
473
+ be present for both read and write paths.
474
474
  """
475
475
  path = Path(os.path.expanduser(directory))
476
- if must_exist and not path.is_dir():
477
- click.echo(f"pocketshell env: directory does not exist: {path}", err=True)
478
- ctx.exit(2)
479
- if not must_exist and not path.is_dir():
476
+ if not path.is_dir():
480
477
  click.echo(f"pocketshell env: directory does not exist: {path}", err=True)
481
478
  ctx.exit(2)
482
479
  return path
@@ -514,7 +511,7 @@ def env_list(ctx: click.Context, directory: str, json_output: bool) -> None:
514
511
 
515
512
  Never prints values (write-only default, D24).
516
513
  """
517
- path = _resolve_dir(ctx, directory, must_exist=True)
514
+ path = _resolve_dir(ctx, directory)
518
515
  keys = list_keys(path)
519
516
  if json_output:
520
517
  payload = [
@@ -558,7 +555,7 @@ def env_get(
558
555
  Missing keys are simply absent from the output; only a hard error
559
556
  (e.g. missing directory) is non-zero.
560
557
  """
561
- path = _resolve_dir(ctx, directory, must_exist=True)
558
+ path = _resolve_dir(ctx, directory)
562
559
  values = get_values(path, list(keys))
563
560
  if json_output:
564
561
  click.echo(json.dumps(values, indent=2, sort_keys=True))
@@ -589,7 +586,7 @@ def env_set(ctx: click.Context, directory: str, file_name: str) -> None:
589
586
  `ps`/scrollback. Comments, ordering, and untouched keys are
590
587
  preserved (surgical rewrite).
591
588
  """
592
- path = _resolve_dir(ctx, directory, must_exist=True)
589
+ path = _resolve_dir(ctx, directory)
593
590
  raw = sys.stdin.read()
594
591
  if not raw.strip():
595
592
  click.echo("pocketshell env set: no JSON on stdin", err=True)
@@ -627,7 +624,7 @@ def env_set(ctx: click.Context, directory: str, file_name: str) -> None:
627
624
  @click.pass_context
628
625
  def env_unset(ctx: click.Context, directory: str, keys: tuple[str, ...]) -> None:
629
626
  """Delete the named key(s) from both files, leaving the rest intact."""
630
- path = _resolve_dir(ctx, directory, must_exist=True)
627
+ path = _resolve_dir(ctx, directory)
631
628
  unset_keys(path, list(keys))
632
629
 
633
630
 
@@ -662,8 +659,8 @@ def env_copy(
662
659
  file_name: str,
663
660
  ) -> None:
664
661
  """Copy named keys' values from source folder into the destination."""
665
- src = _resolve_dir(ctx, src_dir, must_exist=True)
666
- dst = _resolve_dir(ctx, dst_dir, must_exist=True)
662
+ src = _resolve_dir(ctx, src_dir)
663
+ dst = _resolve_dir(ctx, dst_dir)
667
664
  copy_keys(src, dst, list(keys), dst_file=file_name)
668
665
 
669
666
 
@@ -675,7 +672,7 @@ def env_copy(
675
672
  @click.pass_context
676
673
  def env_export(ctx: click.Context, directory: str) -> None:
677
674
  """Emit an `eval`-safe `export KEY=value` block merging both files."""
678
- path = _resolve_dir(ctx, directory, must_exist=True)
675
+ path = _resolve_dir(ctx, directory)
679
676
  rendered = render_export(path)
680
677
  if rendered:
681
678
  sys.stdout.write(rendered)
@@ -645,9 +645,9 @@ def daemon_start(
645
645
  """Run the scheduler loop in the foreground.
646
646
 
647
647
  This is the canonical `ExecStart=` shape: the process stays alive
648
- until SIGTERM (matching the existing `tmuxctl-jobs.service` unit
649
- file generated by `HostBootstrapper`). The IPC daemon planned in
650
- the daemon-mode spike will eventually replace this entrypoint; that
648
+ until SIGTERM (matching the `pocketshell-jobs.service` unit file
649
+ generated by `HostBootstrapper`). The IPC daemon planned in the
650
+ daemon-mode spike will eventually replace this entrypoint; that
651
651
  refactor is explicitly out of scope here.
652
652
  """
653
653
  args: list[str] = ["jobs", "daemon"]
@@ -1533,10 +1533,3 @@ def daemon_handler_open(params: dict[str, Any]) -> dict[str, Any]:
1533
1533
  "path": repo.local.path,
1534
1534
  "full_name": repo.full_name,
1535
1535
  }
1536
-
1537
-
1538
- # Back-compat re-export so any in-tree caller that imports
1539
- # ``daemon_handler`` (the original single-handler name) keeps working
1540
- # until the next refactor moves them over. The daemon module itself
1541
- # uses the explicit ``daemon_handler_local`` name.
1542
- daemon_handler = daemon_handler_local
@@ -72,32 +72,6 @@ def _tmuxctl_missing_message() -> str:
72
72
  )
73
73
 
74
74
 
75
- def _run_tmuxctl(args: Sequence[str]) -> int:
76
- """Invoke `tmuxctl` with [args]; proxy stdout/stderr and exit code.
77
-
78
- Identical contract to `pocketshell.jobs._run_tmuxctl` /
79
- `pocketshell.usage._run_quse` so a consumer that already parses
80
- `tmuxctl` output sees a byte-identical payload when routed through
81
- `pocketshell sessions ...`.
82
- """
83
- tmuxctl_path = _resolve_tmuxctl_binary()
84
- if tmuxctl_path is None:
85
- click.echo(_tmuxctl_missing_message(), err=True)
86
- return 127
87
-
88
- completed = subprocess.run(
89
- [tmuxctl_path, *args],
90
- check=False,
91
- capture_output=True,
92
- text=True,
93
- )
94
- if completed.stdout:
95
- sys.stdout.write(completed.stdout)
96
- if completed.stderr:
97
- sys.stderr.write(completed.stderr)
98
- return completed.returncode
99
-
100
-
101
75
  def _run_tmuxctl_capture(args: Sequence[str]) -> dict[str, Any]:
102
76
  """Invoke ``tmuxctl`` and return a daemon-friendly raw envelope."""
103
77
  tmuxctl_path = _resolve_tmuxctl_binary()
@@ -3,7 +3,7 @@ revision = 3
3
3
  requires-python = ">=3.11"
4
4
 
5
5
  [options]
6
- exclude-newer = "2026-05-22T22:04:41.504843187Z"
6
+ exclude-newer = "2026-05-29T16:43:17.406243682Z"
7
7
  exclude-newer-span = "P7D"
8
8
 
9
9
  [[package]]
@@ -143,7 +143,7 @@ wheels = [
143
143
 
144
144
  [[package]]
145
145
  name = "pocketshell"
146
- version = "0.3.15"
146
+ version = "0.3.24"
147
147
  source = { editable = "." }
148
148
  dependencies = [
149
149
  { name = "click" },
File without changes