main
md 54 lines 2.82 KB
Rendered Raw
1 # cli_tunnel.py DOX
2
3 ## Purpose
4
5 - Own the `cli_tunnel.py` helper module.
6 - This module provides shared download and install mechanics for CLI-based tunnel providers.
7 - Keep this file-level DOX profile synchronized with `cli_tunnel.py` because this directory is intentionally flat.
8
9 ## Ownership
10
11 - `cli_tunnel.py` owns the runtime implementation.
12 - `cli_tunnel.py.dox.md` owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.
13 - Classes:
14 - `CliTunnelHelper` (`TunnelHelper`)
15 - `start(self)`
16 - `stop(self)`
17 - Top-level functions:
18 - `executable_name(name)`
19 - `chmod_executable(path)`
20 - `notify_download(notify, message, data=...)`
21 - `notify_download_complete(notify, message, data=...)`
22 - `download_file(url, destination, notify=...)`
23 - `platform_parts()`
24 - `extract_named_members_from_tar(archive_path, destination_dir, member_names)`
25 - `extract_named_members_from_zip(archive_path, destination_dir, member_names)`
26 - Notable constants/configuration names: `RUNTIME_BIN_DIR`.
27
28 ## Runtime Contracts
29
30 - Helper modules own reusable framework APIs and must preserve public callers unless all callers, tests, and docs are updated together.
31 - Update this file whenever public functions, classes, persistence behavior, path/security assumptions, side effects, or cross-module contracts change.
32 - Observed side-effect areas: filesystem reads, filesystem writes, filesystem deletion, network calls, subprocess/runtime control, tunnel state.
33 - Imported dependency areas include: `collections`, `flaredantic`, `helpers`, `helpers.tunnel_common`, `os`, `pathlib`, `platform`, `queue`, `shutil`, `subprocess`, `tarfile`, `tempfile`, `threading`, `time`, `urllib.request`, `zipfile`.
34
35 ## Key Concepts
36
37 - Important called helpers/classes observed in the source: `Path`, `files.get_abs_path`, `callable`, `destination.parent.mkdir`, `notify_download`, `tempfile.mkstemp`, `os.close`, `platform.system.lower`, `platform.machine.lower`, `destination_dir.mkdir`, `path.chmod`, `notify`, `temp_path.replace`, `notify_download_complete`, `RuntimeError`, `archive.getmembers`, `zipfile.ZipFile`, `archive.infolist`, `super.__init__`, `self.url_pattern.search`.
38 - Keep request/response, tool, or helper semantics documented here at the same time as source changes.
39
40 ## Work Guidance
41
42 - Preserve public helper APIs used by core code and plugins unless every caller is updated.
43 - Keep path, auth, secret, persistence, network, and subprocess behavior explicit and bounded.
44 - Prefer adding cohesive helper functions here only when behavior is reused across modules.
45
46 ## Verification
47
48 - Run targeted tests for changed helper behavior; run security regressions for auth, filesystem, WebSocket, tunnel, upload, or secret-handling helpers.
49 - Related tests observed by source search:
50 - `tests/test_tunnel_remote_link.py`
51
52 ## Child DOX Index
53
54 No child DOX files.