Skip to content

feat: search + open convenience commands#64

Merged
askalf merged 2 commits into
masterfrom
feat/convenience-commands
Jun 9, 2026
Merged

feat: search + open convenience commands#64
askalf merged 2 commits into
masterfrom
feat/convenience-commands

Conversation

@askalf

@askalf askalf commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Two small, high-utility commands.

deepdive search "<query>"

Run just the search adapter and print the raw candidate list — no LLM, no fetch, no browser. Honors --search and --json; --results-per-query sets the count (default 10). Cheap way to preview a backend or debug an adapter.

deepdive search "rust async runtime" --search=hackernews
deepdive search "nginx 502" --search=stackexchange --json

deepdive open <id>

Render a saved session to a self-contained HTML file (temp dir, or --out=<path>) and open it in the default browser. The file path is always printed, so it works on a headless box even when the opener isn't available. The browser spawn is best-effort (child.on('error') swallows a missing opener).

Design

  • src/open.tsbrowserOpenCommand(platform, target) is a pure, tested selector (open / xdg-open / cmd /c start "" …). The target is the final argv entry passed straight to spawn (no shell → no injection); Windows gets the empty "" title arg so a spaced path isn't read as the window title.

Tests

4 new (browserOpenCommand per platform). 572/572 green, tsc --strict clean. Both commands smoke-tested end-to-end: search against the live HN/SO APIs, open writing a valid HTML report + printing the path.

- deepdive search "<query>": run just the search adapter, print raw
  results (no LLM/fetch). Honors --search/--json; --results-per-query
  sets the count (default 10). For previewing a backend or debugging
  an adapter.
- deepdive open <id>: render a session to a self-contained HTML file
  (temp dir or --out) and open it in the default browser; the path is
  always printed so it works headless. Cross-platform opener selected
  by a pure, tested browserOpenCommand (target passed as a single argv
  entry — no shell).

New src/open.ts; exported from the library. 4 new tests (572 total green).
Comment thread src/cli.ts Fixed
… shell)

Eliminates the cmd.exe shell from the Windows opener so the file path can
never be interpreted as a command — clears CodeQL js/shell-command-
injection-from-environment. open()/xdg-open were already shell-free.
@askalf askalf merged commit e2b04d3 into master Jun 9, 2026
5 checks passed
@askalf askalf deleted the feat/convenience-commands branch June 9, 2026 18:21
@askalf askalf mentioned this pull request Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants