Here's a review of `ticalc.py`. Overall it's a solid, readable CLI tool, but there are a few bugs and some housekeeping issues worth addressing. --- **๐Ÿ› Bugs** **URL construction is broken** โ€” this is the most critical issue. `BASE_URL` is `"https://ticalc.org/pub/"` but `filepath` already contains `/pub/...`, so every download URL becomes `https://ticalc.org/pub//pub/73/.../file.zip`. Fix: change `BASE_URL` to `"https://ticalc.org"` since the filepath already carries the full path. **Docstring mismatch in `parse_index`** โ€” the docstring says it returns `(filepath, description)` tuples, but the function actually returns 3-tuples `(filepath, filename, description)`. Minor, but misleading. --- **๐Ÿ—‘๏ธ Dead code** `import ssl`, `import urllib.request`, and `SSL_CONTEXT` are all defined but never used anywhere. The code exclusively uses `subprocess`/curl for all HTTP operations. These should be removed to avoid confusion, especially since `SSL_CONTEXT` has `CERT_NONE` which could alarm a reader into thinking SSL verification is actually being skipped (it isn't, since curl uses its own defaults). --- **๐Ÿงน Style / structure** The directory-header matching logic inside `parse_index` is a bit awkward โ€” it has a regex check buried inside a `continue` block. Separating the `Index of` case from the general skip condition would make it clearer: ```python if not line: continue dir_match = re.match(r'Index of (/pub/\S+)', line) if dir_match: current_dir = dir_match.group(1) continue if line.startswith(('README', 'master.index', 'SECURITY')): continue ``` `DOWNLOAD_DIR` is hardcoded. Even a simple `--output-dir` CLI argument or an env variable fallback would make the tool more flexible. `direct_download_mode` still prompts for confirmation, which undercuts the "direct" in the name. Consider a `--yes`/`-y` flag. --- **โš ๏ธ Robustness** `curl` is assumed to be available with no graceful fallback or informative error. Worth adding a check early in `main()`: ```python if subprocess.run(['which', 'curl'], capture_output=True).returncode != 0: print("Error: curl is required but not found in PATH") sys.exit(1) ``` `sys.exit(1)` inside `fetch_index` makes unit testing awkward. Raising a custom exception and catching it in `main` would be cleaner. --- **โœ… What's working well** The overall structure is clean and easy to follow, the `parse_index` regex handles the `master.index` format correctly (paths don't contain spaces), the 20-result display cap in interactive mode is a sensible UX choice, and the timeout handling on both fetch and download is good practice. The URL construction bug is worth fixing first โ€” everything else will fail silently until that's resolved.