AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
feat(setup): restore the v3.0.0 first-run NUX wizard (#661)
Matt Van Hornaecab67c81c3
diff --git a/AGENTS.md b/AGENTS.mdindex 229f97c3..af27dbb2 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -42,7 +42,7 @@ Python 3.12+ required. Use `uv` for the env; the venv lives at `.venv/`.- Git remote: origin = public (`mvanhorn/last30days-skill`)- Every `lib/*.py` call to `log.source_log(...)` must pass `tty_only=False`. The default is `True`, which silently drops every line when stderr isn't a TTY (Claude Code, Codex, CI, captured output) — turning source observability into invisible failure. Enforced by `tests/test_source_log_visibility.py`.- **CLI-gated optional sources** (Digg via `digg-pp-cli`, YouTube via `yt-dlp`) activate only when `shutil.which` resolves the binary on the **agent subprocess PATH** — not merely when the file exists on disk. First-run setup installs Digg through `@mvanhorn/printing-press-library` (default `$HOME/.local/bin`); Hermes/OpenClaw gateways often need that directory on PATH. Setup must distinguish PATH-visible installs from off-PATH binaries and must not claim "now active" unless the engine gate would pass. See `docs/solutions/integration-issues/digg-cli-agent-path-setup-wizard.md`.-- **First-run onboarding is consent-driven and model-led.** The setup subprocess does only mechanical work (cookie reads, tool installs, GitHub device-auth) — it cannot prompt, so consent lives in `SKILL.md` Step 0: the model asks before reading cookies, surfaces the macOS Full Disk Access fix on permission-denied, and offers the ScrapeCreators GitHub signup on every first run. A successful `setup --github` persists `SCRAPECREATORS_API_KEY` automatically (via `setup_wizard.write_api_key`, 0o600) and masks the key in stdout. Do not collapse Step 0 back into a bare silent `setup` call — the consent prompts are the feature.+- **First-run onboarding is consent-driven, model-led, and host-split.** The setup subprocess does only mechanical work (cookie reads, tool installs, GitHub device-auth) — it cannot prompt, so consent lives in `SKILL.md` Step 0. Step 0 has TWO branches: a **Claude Code Modal Flow** (the restored v3.0.0 `AskUserQuestion`-driven NUX — welcome, Auto/Manual/Skip, cookie consent, ScrapeCreators offer, `INCLUDE_SOURCES` opt-in, first-topic picker) for hosts with modals, and a **Non-Modal Prose Flow** for hosts without (OpenClaw, Codex, Cursor, Gemini CLI). Both ask before reading cookies, surface the macOS Full Disk Access fix on permission-denied, and offer the ScrapeCreators GitHub signup (10,000 free calls) on every first run. A successful `setup --github` persists `SCRAPECREATORS_API_KEY` automatically (via `setup_wizard.write_api_key`, 0o600) and masks the key in stdout. Do NOT collapse the modal flow back into a bare silent `setup` call or flatten it to prose-only — the guided modals are the feature (they eroded once and were restored). The onboarding contract is locked by `tests/test_onboarding_contract.py`. Threads/Pinterest are intentionally not surfaced in onboarding (power-user `INCLUDE_SOURCES` only).## Security hygiene- Never commit real API keys, browser cookies, auth tokens, app passwords, access tokens, or `.env` contents.diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2cb4f75c..6b6f28cd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]### Added+- **Restored the v3.0.0 first-run NUX wizard (Claude Code Modal Flow).** Step 0 now restores the original guided, `AskUserQuestion`-driven onboarding that eroded over time: a welcome message, an Auto/Manual/Skip setup modal, a cookie-consent modal, the ScrapeCreators signup offer, a TikTok/Instagram `INCLUDE_SOURCES` opt-in, and a first-topic picker. It is gated to hosts with modals; hosts without (OpenClaw, Codex, Cursor, Gemini CLI) get the equivalent **Non-Modal Prose Flow**. Digg is threaded into the install messaging alongside yt-dlp everywhere it appears, the ScrapeCreators credit count is `10,000 free calls`, and the flow is locked against re-erosion by `tests/test_onboarding_contract.py`. Builds on the consent-driven foundation from #659/#660. Original wizard captured at `docs/reference/old-nux-wizard-v3.0.0.md`.- **Consent-driven first-run onboarding.** Step 0 now drives an in-chat consent flow instead of a silent `setup` run: the model asks before reading browser cookies (decline runs with `FROM_BROWSER=off` — still installs yt-dlp + Digg), surfaces the macOS Full Disk Access fix when a cookie read is permission-denied, and offers the ScrapeCreators GitHub signup on every first run. A successful `setup --github` now **persists `SCRAPECREATORS_API_KEY` automatically** (`setup_wizard.write_api_key`, 0o600) and masks the key in stdout so the secret never lands in the host model's captured output. Follows the first-run gate fix (#659).### Fixeddiff --git a/CONFIGURATION.md b/CONFIGURATION.mdindex 562b1e7c..bb5887b9 100644--- a/CONFIGURATION.md+++ b/CONFIGURATION.md@@ -51,13 +51,18 @@ The footer line `📎 Raw results saved to ${LAST30DAYS_MEMORY_DIR:-$HOME/Docume## First-run onboarding-On the very first `/last30days` run (no `~/.config/last30days/.env`, or `SETUP_COMPLETE` not set), the skill runs a consent-driven onboarding the model drives in chat. It has three consent points:+On the very first `/last30days` run (no `~/.config/last30days/.env`, or `SETUP_COMPLETE` not set), the skill runs a consent-driven onboarding the model drives in chat. It takes one of two forms depending on the host:++- **Claude Code Modal Flow** - the restored v3.0.0 guided NUX, used on hosts with `AskUserQuestion` (Claude Code). A welcome message, then modals for Auto/Manual/Skip setup, cookie consent, the ScrapeCreators signup offer, a TikTok/Instagram `INCLUDE_SOURCES` opt-in, and a first-topic picker.+- **Non-Modal Prose Flow** - the same work done conversationally on hosts without modals (OpenClaw, Codex, Cursor, Gemini CLI, raw CLI).++Both share the same consent points:1. **Browser cookies** - the model asks before reading anything. On yes it extracts Firefox/Safari cookies (never Chrome, to avoid a macOS Keychain prompt) to unlock X/Twitter and other logged-in sources, and installs yt-dlp + the keyless Digg CLI. On no it runs setup with `FROM_BROWSER=off` (skips all cookie reads, still installs the tools).2. **Full Disk Access (macOS)** - if a cookie read is permission-denied, the model surfaces the System Settings > Privacy & Security > Full Disk Access fix and offers one retry.-3. **ScrapeCreators GitHub signup** - offered on every first run. On consent it runs `setup --github`, which opens a browser for GitHub device-auth and, on success, **persists `SCRAPECREATORS_API_KEY` automatically** (0o600, masked in output) so TikTok, Instagram, Threads, Pinterest, X, and YouTube comments/transcripts activate on the next run. Decline anytime; you can run it later by asking to set up ScrapeCreators.+3. **ScrapeCreators GitHub signup** - offered on every first run (10,000 free calls). On consent it runs `setup --github`, which opens a browser for GitHub device-auth (or registers instantly via the `gh` CLI when installed) and, on success, **persists `SCRAPECREATORS_API_KEY` automatically** (0o600, masked in output) so TikTok, Instagram, X, YouTube comments, and the SC Reddit/YouTube backups activate on the next run. Decline anytime; you can run it later by asking to set up ScrapeCreators. (Threads and Pinterest are not surfaced in onboarding but remain available via `INCLUDE_SOURCES`.)-Re-run onboarding by deleting `~/.config/last30days/.env`. The mechanical work lives in `scripts/lib/setup_wizard.py`; the consent conversation is specified in `skills/last30days/SKILL.md` Step 0.+Re-run onboarding by deleting `~/.config/last30days/.env`. The mechanical work lives in `scripts/lib/setup_wizard.py`; the consent conversation and both host flows are specified in `skills/last30days/SKILL.md` Step 0. The original v3.0.0 wizard is captured at `docs/reference/old-nux-wizard-v3.0.0.md`.---diff --git a/docs/reference/old-nux-wizard-v3.0.0.md b/docs/reference/old-nux-wizard-v3.0.0.mdnew file mode 100644index 00000000..c33ff8cb--- /dev/null+++ b/docs/reference/old-nux-wizard-v3.0.0.md@@ -0,0 +1,205 @@+# Original v3.0.0 First-Run NUX Wizard (reference capture)++Captured verbatim from `SKILL.md` at git commit `0a9ff16` (v3.0.0, 2026-04-08),+the first-run setup wizard Matt built. Preserved here for provenance and as the+source for the restored modal NUX (see docs/plans/2026-06-22-001-feat-restore-nux-wizard-plan.md).+This is a historical snapshot - the live wizard in SKILL.md Step 0 uses the CURRENT+source inventory (Digg, youtube_comments, SC backups) and omits Threads/Pinterest.++```markdown+## Step 0: First-Run Setup Wizard++**CRITICAL: ALWAYS execute Step 0 BEFORE Step 1, even if the user provided a topic.** If the user typed `/last30days Mercer Island`, you MUST check for FIRST_RUN and present the wizard BEFORE running research. The topic "Mercer Island" is preserved — research runs immediately after the wizard completes. Do NOT skip the wizard because a topic was provided. The wizard takes 10 seconds and only runs once ever.++To detect first run: check if `~/.config/last30days/.env` exists. If it does NOT exist, this is a first run. **Do NOT run any Bash commands or show any command output to detect this — just check the file existence silently.** If the file exists and contains `SETUP_COMPLETE=true`, skip this section **silently** and proceed to Step 1. **Do NOT say "Setup is complete" or any other status message — just move on.** The user doesn't need to be told setup is done every time they run the skill.++**When first run is detected, detect your platform first:**++**If you do NOT have WebSearch capability (OpenClaw, Codex, raw CLI):** Run the OpenClaw setup flow below.+**If you DO have WebSearch (Claude Code):** Run the standard setup flow below.++---++### OpenClaw / Non-WebSearch Setup Flow++Run environment detection first:+```bash+python3 "${SKILL_ROOT}/scripts/last30days.py" setup --openclaw+```++Read the JSON output. It tells you what's already configured. Display a status summary:++```+👋 Welcome to /last30days!++Detected:+{✅ or ❌} yt-dlp (YouTube search)+{✅ or ❌} X/Twitter ({method} configured)+{✅ or ❌} ScrapeCreators (TikTok, Instagram, Reddit backup)+{✅ or ❌} Web search ({backend} configured)+```++Then for each missing item, offer setup in priority order:++1. **ScrapeCreators** (if not configured): "ScrapeCreators adds TikTok and Instagram search (plus a Reddit backup if public Reddit gets rate-limited). 10,000 free calls, no credit card. (No referrals, no kickbacks - we don't get a cut.)"+ - Option A: "ScrapeCreators via GitHub (recommended)" -- Check if `gh` CLI was detected in the environment detection output above. If gh IS detected: description should say "Registers directly via GitHub CLI in ~2 seconds - no browser needed". Before running the command, display: "Registering via GitHub CLI..." If gh is NOT detected: description should say "Copies a one-time code to your clipboard and opens GitHub to authorize". Before running the command, display: "I'll copy a one-time code to your clipboard and open GitHub. When GitHub asks for a device code, just paste (Cmd+V / Ctrl+V)." Then run `python3 "${SKILL_ROOT}/scripts/last30days.py" setup --github`, parse JSON output. Tries PAT first (if `gh` is installed), falls back to device flow which copies a one-time code to your clipboard and opens your browser. If `status` is `success`, write `SCRAPECREATORS_API_KEY={api_key}` to .env.+ - Option B: "I have a key" -- accept paste, write to .env+ - Option C: "Skip for now"++2. **X/Twitter** (if not configured): "X search finds tweets and conversations. To unlock X: add FROM_BROWSER=auto (reads browser cookies, free), XAI_API_KEY (no browser access, api.x.ai), or AUTH_TOKEN+CT0 (manual cookies)."+ - Option A: "I have an xAI API key" (recommended for servers -- persistent, no expiry). Write XAI_API_KEY to .env.+ - Option B: "I have AUTH_TOKEN + CT0 from my browser" -- accept both, write to .env+ - Option C: "Skip for now"++3. **YouTube** (if yt-dlp not found): "YouTube search needs yt-dlp. Run: `pip install yt-dlp`"++4. **Web search** (if no Brave/Exa/Serper key): "A web search key enables smarter results. Brave Search is free for 2,000 queries/month at brave.com/search/api"++After setup, write `SETUP_COMPLETE=true` to .env and proceed to research.++**Skip to "END OF FIRST-RUN WIZARD" below after completing the OpenClaw flow.**++---++### Claude Code Setup Flow (Standard)++**You MUST follow these steps IN ORDER. Do NOT skip ahead to the topic picker or research. The sequence is: (1) welcome text -> (2) setup modal -> (3) run setup if chosen -> (4) optional ScrapeCreators modal -> (5) topic picker. You MUST start at step 1.**++**Step 1: Display the following welcome text ONCE as a normal message (not blockquoted). Then IMMEDIATELY call AskUserQuestion - do NOT repeat any of the welcome text inside the AskUserQuestion call.**++Welcome to /last30days!++I research any topic across Reddit, X, YouTube, and other sources - synthesizing what people are actually saying right now.++Auto setup gives you 5 core sources for free in 30 seconds:+- X/Twitter - reads your x.com browser cookies to authenticate (not saved to disk). Chrome on macOS will prompt for Keychain access.+- Reddit with comments - public JSON, no API key needed+- YouTube search + transcripts - installs yt-dlp (open source, 190K+ GitHub stars)+- Hacker News + Polymarket + GitHub (if `gh` CLI installed) - always on, zero config++Want TikTok and Instagram too? ScrapeCreators adds those (10,000 free calls, scrapecreators.com). No kickbacks, no affiliation.++**Then call AskUserQuestion with ONLY this question and these options - no additional text:**++Question: "How would you like to set up?"+Options:+- "Auto setup (~30 seconds) - scans browser cookies for X + installs yt-dlp for YouTube"+- "Manual setup - show me what to configure"+- "Skip for now - Reddit (with comments), HN, Polymarket, GitHub (if gh installed), Web"++**If the user picks 1 (Auto setup):**++**Before running the setup command, get cookie consent:**++Check if `BROWSER_CONSENT=true` already exists in `~/.config/last30days/.env`. If it does, skip the consent prompt and run setup directly.++If `BROWSER_CONSENT=true` is NOT present, **call AskUserQuestion:**+Question: "Auto setup will scan your browser for x.com cookies to authenticate X search. Cookies are read live, not saved to disk. Chrome on macOS will prompt for Keychain access. OK to proceed?"+Options:+- "Yes, scan my cookies for X" - Run setup as normal. Append `BROWSER_CONSENT=true` to .env after setup completes.+- "Skip X, just set up YouTube" - Run setup with YouTube only (install yt-dlp). Do not scan cookies.+- "I have an xAI API key instead" - Ask them to paste it, write XAI_API_KEY to .env. Then install yt-dlp.++Run the setup subcommand:+```bash+cd {SKILL_DIR} && python3 scripts/last30days.py setup+```+Show the user the results (what cookies were found, whether yt-dlp was installed).++**Then show the optional ScrapeCreators offer (plain text, then modal):**++Want TikTok and Instagram too? ScrapeCreators adds those platforms - 10,000 free calls, no credit card. It also serves as a Reddit backup if public Reddit ever gets rate-limited.++**Before showing the ScrapeCreators modal, check for `gh` CLI:** Run `which gh` via Bash silently. Store the result as gh_available (true if found, false if not).++**Call AskUserQuestion:**+Question: "Want to add TikTok, Instagram, and Reddit backup via ScrapeCreators? (We don't get a cut.)"+Options:+- "ScrapeCreators via GitHub (fastest, recommended)" - If gh_available: description should say "Registers directly via GitHub CLI in ~2 seconds - no browser needed". If NOT gh_available: description should say "Copies a one-time code to your clipboard and opens GitHub to authorize". After the user selects this option: If gh_available, display "Registering via GitHub CLI..." before running the command. If NOT gh_available, display "I'll copy a one-time code to your clipboard and open GitHub. When GitHub asks for a device code, just paste (Cmd+V on Mac, Ctrl+V on Windows/Linux)." Then run `cd {SKILL_DIR} && python3 scripts/last30days.py setup --github` via Bash with a 5-minute timeout. This tries PAT auth first (if `gh` CLI is installed, zero browser needed), then falls back to GitHub device flow which copies a one-time code to your clipboard and opens GitHub in your browser. Parse the JSON stdout. If `status` is `success`, write `SCRAPECREATORS_API_KEY={api_key}` to `~/.config/last30days/.env`. If `method` is `pat`, show: "You're in! Registered via GitHub CLI - zero browser needed. 10,000 free calls. TikTok, Instagram, and Reddit backup are now active." If `method` is `device` and `clipboard_ok` is true, show: "You're in! (The authorization code was copied to your clipboard automatically.) 10,000 free calls. TikTok, Instagram, and Reddit backup are now active." If `method` is `device` and `clipboard_ok` is false, show: "You're in! 10,000 free calls. TikTok, Instagram, and Reddit backup are now active." If `status` is `timeout` or `error`, show: "GitHub auth didn't complete. No worries - you can sign up at scrapecreators.com instead or try again later." Then offer the web signup option.+- "Open scrapecreators.com (Google sign-in)" - run `open https://scrapecreators.com` via Bash to open in the user's browser. Then ask them to paste the API key they get. When they paste it, write SCRAPECREATORS_API_KEY={key} to ~/.config/last30days/.env+- "I have a key" - accept the key, write to .env+- "Skip for now" - proceed without ScrapeCreators++**After SC key is saved (not if skipped), show the TikTok/Instagram opt-in:**++Your ScrapeCreators key powers TikTok, Instagram, Threads, Pinterest, and YouTube comments. Want those on for every research run? (Each additional source uses a ScrapeCreators call per search.)++**Call AskUserQuestion:**+Question: "Which ScrapeCreators sources do you want on?"+Options:+- "TikTok + Instagram (recommended)" - append `INCLUDE_SOURCES=tiktok,instagram` to ~/.config/last30days/.env. Confirm: "TikTok and Instagram are on, plus Reddit backup if public Reddit has issues. You can add threads, pinterest, youtube_comments to INCLUDE_SOURCES anytime."+- "Everything - TikTok, Instagram, Threads, Pinterest, YouTube comments" - append `INCLUDE_SOURCES=tiktok,instagram,threads,pinterest,youtube_comments` to ~/.config/last30days/.env. Confirm: "All ScrapeCreators sources are on."+- "Just the basics - let's run our first search" - don't write the flag. Confirm: "Got it. ScrapeCreators will serve as Reddit backup. You can add sources to INCLUDE_SOURCES in your .env anytime."++**After TikTok/Instagram opt-in (or SC skip), show the first research topic modal:**++**Call AskUserQuestion:**+Question: "What do you want to research first?"+Options:+- "Claude Code vs Codex" - tech comparison+- "Sam Altman" - person in the news+- "Warriors Basketball" - sports+- "AI Legal Prompting Techniques" - niche/professional+- "Type my own topic"++If user picks an example, run research with that topic. If they pick "Type my own", ask them what they want to research. If the user originally provided a topic with the command (e.g., `/last30days Mercer Island`), skip this modal and use their topic directly.++**END OF FIRST-RUN WIZARD. Everything above in Step 0 ONLY runs on first run. If SETUP_COMPLETE=true exists in .env, skip ALL of Step 0 — no welcome, no setup, no ScrapeCreators modal, no topic picker. Go directly to Step 1 (Parse User Intent). The topic picker is ONLY for first-time users who haven't run /last30days before.**++**If the user picks 2 (Manual setup):**+Show them this guide (present as plain text, not blockquoted):++The magic of /last30days is Reddit comments + X posts together - and both are free. Here's how to unlock each source.++Add these to `~/.config/last30days/.env`:++X/Twitter (pick one - this is the most important):+- `FROM_BROWSER=auto` - free. Reads your x.com login cookies at search time to authenticate. Cookies are read live each run, not saved to disk. Chrome on macOS will prompt for Keychain access the first time. Firefox and Safari don't.+- `XAI_API_KEY=xxx` - no browser access needed. Get a key at api.x.ai. Best for servers or if you don't want cookie scanning.+- `AUTH_TOKEN=xxx` + `CT0=xxx` - paste your X cookies manually (x.com -> F12 -> Application -> Cookies)++Reddit (free, works out of the box):+- Public JSON gives you threads + top comments with upvote counts. No setup required.+- `SCRAPECREATORS_API_KEY=xxx` - optional backup source if public Reddit gets rate-limited.+- `OPENAI_API_KEY=xxx` - optional fallback if public Reddit search has trouble finding threads.++YouTube (free, open source):+- Run `brew install yt-dlp` - free, open source, 190K+ GitHub stars. Enables YouTube search and transcripts.++Bonus: TikTok, Instagram, Threads, Pinterest, YouTube comments (ScrapeCreators):+- `SCRAPECREATORS_API_KEY=xxx` - 10,000 free calls at scrapecreators.com.+- After adding your key, set `INCLUDE_SOURCES=tiktok,instagram` to turn on the most popular ones. Add threads, pinterest, youtube_comments for more.++GitHub Issues/PRs (free, no key needed):+- If you have the `gh` CLI installed (`brew install gh`), GitHub search is automatic. No API key required.++Perplexity Sonar Pro (AI-synthesized research via OpenRouter):+- `OPENROUTER_API_KEY=xxx` - adds AI-synthesized research with citations as an additive source alongside Reddit/X/YouTube. Returns structured narratives with specific dates, names, and numbers that social sources miss. ~$0.02/run.+- After adding your key, set `INCLUDE_SOURCES=perplexity` (or append to existing, e.g. `INCLUDE_SOURCES=tiktok,instagram,perplexity`).+- Use `--deep-research` flag for exhaustive 50+ citation reports (~$0.90/query) on topics that need serious investigation.+- Bonus: also powers the planning and reranking engine if you don't have a Gemini/OpenAI/xAI key.++Other bonus sources (add anytime):+- `EXA_API_KEY=xxx` - semantic web search, 1K free/month (exa.ai)+- `BSKY_HANDLE=you.bsky.social` + `BSKY_APP_PASSWORD=xxx` - Bluesky (free app password)+- `BRAVE_API_KEY=xxx` - Brave web search++Always add this last line: `SETUP_COMPLETE=true`++**CRITICAL: NEVER overwrite an existing .env file.** Before writing ANY key to `~/.config/last30days/.env`:+1. Check if the file exists: `test -f ~/.config/last30days/.env`+2. If it exists, READ it first, then APPEND only missing keys using `>>` (double redirect)+3. NEVER use `>` (single redirect) which destroys existing content+4. If it doesn't exist, create it: `mkdir -p ~/.config/last30days && touch ~/.config/last30days/.env`++**Then call AskUserQuestion:**+Question: "How do you want to add your keys?"+Options:+- "Open .env in my editor" - Creates the file with a commented template and opens it. You edit, save, and come back.+- "Paste keys here" - Paste your API keys and I'll write the file for you.+- "I'll do it myself" - I'll tell you the file path and you handle it.++**If the user picks "Open .env in editor":**+Create `~/.config/last30days/.env` if it doesn't exist (check first!), pre-populated with this template:+```+```diff --git a/skills/last30days/SKILL.md b/skills/last30days/SKILL.mdindex 858281be..a5b7c563 100644--- a/skills/last30days/SKILL.md+++ b/skills/last30days/SKILL.md@@ -366,33 +366,175 @@ The engine reads `LAST30DAYS_MEMORY_DIR` from either the process env or `~/.conf## Step 0: First-Run Setup Wizard-Before proceeding to Step 1, handle first-run setup. **You are the conversational driver.** The Python setup script does only mechanical work (cookie reads, tool installs, the GitHub device-auth flow) - it CANNOT prompt the user, because it runs as a non-interactive subprocess. So consent happens HERE, in chat: you ask, the user answers, and you gate each subprocess call on the answer. Do NOT just run `setup` and report the result - that is the silent-onboarding regression this section exists to prevent.+**CRITICAL: ALWAYS execute Step 0 BEFORE Step 1, even when the user provided a topic.** If the user typed `/last30days Mercer Island`, you MUST run the wizard BEFORE any research. The topic is preserved - research runs immediately after the wizard completes. Do NOT skip the wizard because a topic was provided. It takes about 30 seconds and only runs once, ever.++**You are the conversational driver.** The Python setup script does only mechanical work (cookie reads, tool installs, the GitHub device-auth flow) - it CANNOT prompt the user, because it runs as a non-interactive subprocess. So consent happens HERE, in chat: you ask, the user answers, and you gate each subprocess call on the answer. Do NOT just run `setup` and report the result - that is the silent-onboarding regression this section exists to prevent.**First-run detection (silent, no commands, no output to user):**- If `~/.config/last30days/.env` does NOT exist, this is a first run.- If the file exists and contains `SETUP_COMPLETE=true`, skip Step 0 entirely and go to Step 1 (CRITICAL: Parse User Intent below). Do NOT announce that setup is complete. The user does not need a status message on every run.-**Named onboarding contract (2026-06-22, silent-wizard regression - Fredy Montero run):** the prior version of this step said "Run `setup` ... follow the wizard's prompts end-to-end." But `run_auto_setup()` has NO prompts - it extracts cookies, installs yt-dlp + Digg, and writes `SETUP_COMPLETE` with zero interaction. So the model ran the silent path, never asked consent before reading browser cookies, never surfaced the macOS Full Disk Access fix, and never offered the ScrapeCreators GitHub signup that unlocks TikTok/Instagram/X/Threads. The fix is the ordered, consent-first sequence below. Do not "simplify" it back to a bare `setup` call - the consent prompts are the feature.+**Named onboarding contracts:**+- *(2026-06-22, silent-wizard regression - Fredy Montero run):* a prior version said "Run `setup` ... follow the wizard's prompts end-to-end." But `run_auto_setup()` has NO prompts - it extracts cookies, installs yt-dlp + Digg, and writes `SETUP_COMPLETE` with zero interaction. The model ran the silent path, never asked cookie consent, never surfaced the macOS Full Disk Access fix, and never offered the ScrapeCreators signup. Consent must be conversational.+- *(2026-06-22, NUX restoration):* the original v3.0.0 Claude Code wizard was a guided, modal-driven flow (welcome → Auto/Manual/Skip → cookie consent → ScrapeCreators offer → source opt-in → first-topic picker) that eroded over time. It is restored below as the **Claude Code Modal Flow**. Do NOT collapse it back into a bare prose call - the guided modals are the feature. Reference capture: `docs/reference/old-nux-wizard-v3.0.0.md`.++**Platform split - run exactly ONE branch:**+- **If you HAVE WebSearch and AskUserQuestion (Claude Code):** run the **Claude Code Modal Flow** immediately below.+- **If you do NOT (OpenClaw, Codex, Cursor, Gemini CLI, raw CLI):** run the **Non-Modal Prose Flow** further down. It does the same work conversationally, without modals.++---++### Claude Code Modal Flow++**Follow these steps IN ORDER. Do NOT skip ahead to research. The sequence is: (1) welcome text → (2) setup modal → (3) run setup if chosen → (4) ScrapeCreators offer modal → (5) source opt-in modal → (6) first-topic picker. Start at step 1.**++**Step 1 - Welcome.** Display this welcome text ONCE as a normal message (not blockquoted).++Welcome to /last30days!++I research any topic across Reddit, X, YouTube, and more - synthesizing what people are actually saying right now.++Auto setup gives you the core sources free in about 30 seconds:+- X/Twitter - reads your browser cookies to authenticate (read live each run, never saved to disk).+- Reddit with comments - public JSON, no API key needed.+- YouTube search + transcripts - installs yt-dlp (open source, 190K+ GitHub stars).+- Digg - trending news, GitHub stars, and pipeline feeds - installs the free, keyless Digg CLI.+- Hacker News + Polymarket + GitHub (auto-on if the `gh` CLI is installed) - always on, zero config.++Want TikTok and Instagram too? ScrapeCreators adds those (10,000 free calls, scrapecreators.com). No kickbacks, no affiliation.++**Step 2 - Setup choice.** Then IMMEDIATELY call AskUserQuestion with ONLY this question and these options (do not repeat the welcome text inside the modal):++Question: "How would you like to set up?"+Options:+- "Auto setup (~30 seconds) - scans browser cookies for X + installs yt-dlp (YouTube) and the Digg CLI"+- "Manual setup - show me what to configure"+- "Skip for now - Reddit (with comments), HN, Polymarket, GitHub (if `gh` installed), Web"++**Step 3 - Run setup based on the choice.**++**If the user picks Skip for now:** write `SETUP_COMPLETE=true` to `~/.config/last30days/.env` (append-only; run `mkdir -p ~/.config/last30days && touch ~/.config/last30days/.env` first if the file does not exist) so the wizard does NOT re-fire on every subsequent run, then skip straight to Step 6 (the topic picker). Do not run any `setup` command - the always-on sources (Reddit, HN, Polymarket, GitHub, Web) need no setup.++**If the user picks Auto setup:**++Get cookie consent first. Check if `BROWSER_CONSENT=true` already exists in `~/.config/last30days/.env`; if so, skip the consent prompt and run setup directly. Otherwise **call AskUserQuestion:**+Question: "Auto setup will scan your browser (Firefox/Safari) for x.com cookies to authenticate X search. Cookies are read live, not saved to disk. OK to proceed?"+Options:+- "Yes, scan my cookies for X" - run `python3 skills/last30days/scripts/last30days.py setup` (relative to the skill root). Append `BROWSER_CONSENT=true` to `.env` after setup completes.+- "Skip X, just set up YouTube + Digg" - run `FROM_BROWSER=off python3 skills/last30days/scripts/last30days.py setup`. Skips all cookie reads; still installs yt-dlp and Digg.+- "I have an xAI API key instead" - ask them to paste it, write `XAI_API_KEY` to `.env`, then run `FROM_BROWSER=off python3 skills/last30days/scripts/last30days.py setup` (installs yt-dlp + Digg, no cookie read).++The `setup` run extracts cookies (Firefox/Safari by default - never Chrome, to avoid a macOS Keychain prompt) and best-effort installs yt-dlp (YouTube) and the free, keyless Digg CLI (`digg-pp-cli` via `@mvanhorn/printing-press-library install digg --cli-only`; Digg activates only when the binary is on the **agent subprocess PATH**, typically `$HOME/.local/bin`; setup reports honestly if installed off-PATH; recommend-only if `npx` is unavailable). Show the user what was found and installed - including whether Digg landed on PATH (active) or off-PATH (installed but not yet active).++**macOS Full Disk Access remediation.** After the `setup` run, inspect its stderr. If it contains `Permission denied reading Cookies.binarycookies` and the platform is macOS, the OS blocked the read - surface the fix instead of swallowing it: `macOS blocked the cookie read. To enable X/Twitter: System Settings > Privacy & Security > Full Disk Access > enable your terminal (or the Claude app), then I can retry.` Offer ONE retry of the `setup` command. If the user skips, continue.++**Step 4: ScrapeCreators offer (every first run).** Show this as plain text, then a modal:++ScrapeCreators adds TikTok and Instagram - 10,000 free calls, no credit card. Your key also powers YouTube comments, a YouTube transcript fallback (used only when yt-dlp gets rate-limited), and a Reddit backup (if public Reddit gets rate-limited). (We don't get a cut.)++Before the modal, run `which gh` via Bash silently; store as gh_available.++**Call AskUserQuestion:**+Question: "Want to add TikTok, Instagram, and the ScrapeCreators backups? (We don't get a cut.)"+Options:+- "ScrapeCreators via GitHub (fastest, recommended)" - If gh_available, description: "Registers via GitHub CLI in ~2 seconds - no browser." If NOT gh_available, description: "Copies a one-time code to your clipboard and opens GitHub to authorize." After selection: if gh_available, display "Registering via GitHub CLI..."; if not, display "I'll copy a one-time code to your clipboard and open GitHub. When prompted for a device code, just paste (Cmd+V / Ctrl+V)." Then run `python3 skills/last30days/scripts/last30days.py setup --github` with a 5-minute timeout. Parse the JSON. On `status == "success"` the engine persists the key automatically and returns `"persisted": true` with a MASKED `api_key` (the raw key never appears - do not ask for or echo it); confirm "You're in! 10,000 free calls. TikTok, Instagram, YouTube comments, and the Reddit/YouTube backups are now active." On `status == "success"` but `"persisted": false` (key write failed, e.g. a permissions error), do NOT claim sources are active - tell the user the signup worked but saving the key failed, and have them add `SCRAPECREATORS_API_KEY=<key>` to `~/.config/last30days/.env` manually (the raw key is masked in output, so re-run `setup --github` or retrieve it from scrapecreators.com to get the value). On `status` `timeout`/`error`, show "GitHub auth didn't complete - no worries, sign up at scrapecreators.com or try again later," then offer the web option.+- "Open scrapecreators.com (Google sign-in)" - run `open https://scrapecreators.com` via Bash, then ask them to paste the API key. Write `SCRAPECREATORS_API_KEY={key}` to `~/.config/last30days/.env`.+- "I have a key" - accept the key, write to `.env`.+- "Skip for now" - proceed without ScrapeCreators.++**Step 5: Source opt-in (only if a ScrapeCreators key was saved, not if skipped).** Plain text then modal:++Your ScrapeCreators key powers TikTok, Instagram, and YouTube comments. Want TikTok and Instagram on for every run? (Each adds one ScrapeCreators call per search.)++**Call AskUserQuestion:**+Question: "Which ScrapeCreators sources do you want on?"+Options:+- "TikTok + Instagram (recommended)" - append `INCLUDE_SOURCES=tiktok,instagram` to `~/.config/last30days/.env`. Confirm: "TikTok and Instagram are on, plus the Reddit/YouTube backups if the free sources get rate-limited."+- "Just the basics - let's run my first search" - don't write the flag. Confirm: "Got it. ScrapeCreators will still serve as the Reddit and YouTube backups. You can add sources to `INCLUDE_SOURCES` in your `.env` anytime."++**Step 6: First-topic picker.** Once `SETUP_COMPLETE=true` is written, **call AskUserQuestion:**+Question: "What do you want to research first?"+Options:+- "Claude Code vs Codex" - tech comparison+- "Sam Altman" - person in the news+- "Warriors Basketball" - sports+- "AI Legal Prompting Techniques" - niche/professional+- "Type my own topic"++If the user picks an example, run research with it. If "Type my own", ask what they want. **If the user already supplied a topic with the command (e.g. `/last30days Mercer Island`), SKIP this picker and use their topic directly.**++**END OF FIRST-RUN WIZARD.** Everything in the Modal Flow ONLY runs on first run. If `SETUP_COMPLETE=true` exists, skip ALL of it - no welcome, no modals, no topic picker - and go straight to research (Parse User Intent).-**If this IS a first run, run this onboarding sequence in order. Each numbered step is a turn: present it, then wait for the user where it says to wait.**+**If the user picked Manual setup** at Step 2, follow the **Manual Setup Guide** below instead of the Auto branch (the guide writes `SETUP_COMPLETE=true` itself), then continue to Step 6.++---++### Non-Modal Prose Flow++For hosts without interactive modal prompts (OpenClaw, Codex, Cursor, Gemini CLI, raw CLI). Same work, done conversationally. Run in order; wait where it says to wait.**1. Welcome.** One short branded line, e.g.: `Welcome to /last30days - let me get you set up (about 30 seconds).`-**2. Cookie consent (ask BEFORE reading anything).** Tell the user you'd like to read their browser cookies and what it unlocks, then ask. Example: `I can read your browser cookies (Firefox/Safari) to unlock X/Twitter and other logged-in sources. Want me to? (yes / no)` **Wait for the answer.**- - On **yes** → run `python3 skills/last30days/scripts/last30days.py setup` (relative to the skill root). This extracts cookies (Firefox/Safari by default - never Chrome, to avoid a Keychain prompt) and best-effort installs yt-dlp (YouTube) and the free, keyless Digg CLI (`digg-pp-cli` via `@mvanhorn/printing-press-library install digg --cli-only`; Digg activates only when the binary is on the **agent subprocess PATH**, typically `$HOME/.local/bin`; setup reports honestly if installed off-PATH; recommend-only if `npx` is unavailable).- - On **no** → run the same command with cookie reads disabled for that invocation: `FROM_BROWSER=off python3 skills/last30days/scripts/last30days.py setup`. This skips all cookie extraction but STILL installs yt-dlp and Digg, and still writes `SETUP_COMPLETE`. Do not attempt any cookie read after a no.+**2. Cookie consent (ask BEFORE reading anything).** First check if `BROWSER_CONSENT=true` already exists in `~/.config/last30days/.env` (e.g. granted in a prior Claude Code session); if so, skip this prompt and run `setup` directly. Otherwise ask. Example: `I can read your browser cookies (Firefox/Safari) to unlock X/Twitter and other logged-in sources. Want me to? (yes / no)` **Wait for the answer.**+ - On **yes** → run `python3 skills/last30days/scripts/last30days.py setup` (and append `BROWSER_CONSENT=true` to `.env` after it completes). Extracts cookies (Firefox/Safari, never Chrome) and best-effort installs yt-dlp (YouTube) and the free, keyless Digg CLI (`digg-pp-cli` via `@mvanhorn/printing-press-library install digg --cli-only`; activates only when on the agent subprocess PATH, typically `$HOME/.local/bin`; reports honestly if off-PATH; recommend-only if `npx` is unavailable).+ - On **no** → run `FROM_BROWSER=off python3 skills/last30days/scripts/last30days.py setup`. Skips all cookie reads; still installs yt-dlp and Digg, still writes `SETUP_COMPLETE`.-**3. Full Disk Access remediation (macOS only).** After the `setup` run, inspect its stderr. If it contains `Permission denied reading Cookies.binarycookies` and the platform is macOS, the OS blocked the read - surface the fix instead of swallowing it: `macOS blocked the cookie read. To enable X/Twitter: System Settings > Privacy & Security > Full Disk Access > enable your terminal (or the Claude app), then I can retry.` Offer ONE retry of step 2's `setup` command. If the user skips, continue.+**3. Full Disk Access remediation (macOS only).** After `setup`, inspect stderr. If it contains `Permission denied reading Cookies.binarycookies` on macOS, surface: `macOS blocked the cookie read. To enable X/Twitter: System Settings > Privacy & Security > Full Disk Access > enable your terminal (or the Claude app), then I can retry.` Offer ONE retry. If skipped, continue.-**4. ScrapeCreators signup offer (every first run, consent BEFORE launching the browser).** Always offer this. Explain it grants free credits that unlock TikTok, Instagram, Threads, Pinterest, X, and YouTube comments/transcripts, and that it opens a GitHub authorization page in the browser. Do NOT hard-code a specific credit count - say "free credits" (the exact grant is set server-side). Ask, e.g.: `Want to unlock TikTok, Instagram, X and more? I can sign you up for ScrapeCreators with GitHub (free credits) - it opens a browser to authorize. (yes / no)` **Wait for the answer.**- - On **yes** → run `python3 skills/last30days/scripts/last30days.py setup --github`. Tell the user a browser window will open and to authorize with the code shown. On success the engine persists the key automatically and returns JSON with `"persisted": true` and a MASKED `api_key` (the raw key never appears - do not ask for or echo it). Confirm the paid sources are now active.- - On **success but `"persisted": false`** (auth completed yet the key write failed - e.g. a permissions error on `~/.config/last30days/.env`) → do NOT claim the paid sources are active. Tell the user the signup worked but saving the key failed, and have them add `SCRAPECREATORS_API_KEY=<key>` to `~/.config/last30days/.env` manually (the raw key is masked in output, so re-run `setup --github` or retrieve it from scrapecreators.com).+**4. ScrapeCreators signup offer (every first run, consent BEFORE launching the browser).** Explain it grants 10,000 free calls that unlock TikTok, Instagram, YouTube comments, plus a Reddit backup and a YouTube transcript fallback, and that it opens a GitHub authorization page. Ask, e.g.: `Want to unlock TikTok, Instagram, and more? I can sign you up for ScrapeCreators with GitHub (10,000 free calls) - it opens a browser to authorize. (yes / no)` **Wait for the answer.**+ - On **yes** → run `python3 skills/last30days/scripts/last30days.py setup --github`. A browser window opens; the user authorizes with the code shown. On success the engine persists the key automatically and returns `"persisted": true` with a MASKED `api_key` (never ask for or echo the raw key). Confirm the paid sources are active.+ - On **success but `"persisted": false`** (auth completed yet the key write failed) → do NOT claim sources are active. Tell the user signup worked but saving failed, and have them add `SCRAPECREATORS_API_KEY=<key>` to `~/.config/last30days/.env` manually (the raw key is masked in output, so re-run `setup --github` or retrieve it from scrapecreators.com to get the value).- On **timeout / denied** → tell the user it didn't complete and offer to retry or skip.- - On **no** → note they can run it anytime later by asking to set up ScrapeCreators, then continue.+ - On **no** → note they can run it later by asking to set up ScrapeCreators, then continue.**5. Complete.** Once `SETUP_COMPLETE=true` is written, briefly confirm which sources are now active (read the `setup --github` JSON `persisted` field, or re-run `--diagnose`) and proceed to research.-The setup wizard lives as a Python module so its mechanical work runs across all hosts (Claude Code, Codex, Cursor, etc.) while you drive the consent conversation above. The common-case (already set up) path through this file stays short.+---++### Manual Setup Guide++Shown when a Claude Code user picks "Manual setup", or for anyone who wants to configure by hand. Present as plain text (not blockquoted).++The magic of /last30days is Reddit comments + X posts together - and both are free. Add these to `~/.config/last30days/.env`:++**X/Twitter (pick one - the most important source):**+- `FROM_BROWSER=auto` - free. Reads your x.com login cookies live at search time (Firefox/Safari, never saved to disk).+- `XAI_API_KEY=xxx` - no browser access needed. Get a key at api.x.ai. Best for servers.+- `XQUIK_API_KEY=xxx` - keyless-style X via Xquik.+- `AUTH_TOKEN=xxx` + `CT0=xxx` - paste your X cookies manually (x.com → F12 → Application → Cookies).++**Reddit (free, works out of the box):**+- Public JSON gives threads + top comments with upvote counts. No setup required.+- `SCRAPECREATORS_API_KEY=xxx` - optional backup if public Reddit gets rate-limited.++**YouTube (free, open source):**+- Run `brew install yt-dlp` (or `pip install yt-dlp`) - enables YouTube search + transcripts.+- `SCRAPECREATORS_API_KEY=xxx` - optional server-side transcript fallback, used only when yt-dlp is rate-limited/bot-gated.++**Digg (free, keyless):**+- Run `npx @mvanhorn/printing-press-library install digg --cli-only` - installs the Digg CLI for trending news, GitHub stars, and pipeline feeds. Activates when `digg-pp-cli` is on your PATH (typically `$HOME/.local/bin`).++**GitHub Issues/PRs (free, no key needed):**+- If the `gh` CLI is installed and authed (`brew install gh && gh auth login`), GitHub search is automatic. No API key required.++**Bonus: TikTok, Instagram, YouTube comments (ScrapeCreators):**+- `SCRAPECREATORS_API_KEY=xxx` - 10,000 free calls at scrapecreators.com.+- After adding your key, set `INCLUDE_SOURCES=tiktok,instagram` to turn on the popular ones. (Threads and Pinterest are also available via `INCLUDE_SOURCES=threads,pinterest` for power users.)++**Other optional sources (add anytime):**+- `PERPLEXITY_API_KEY=xxx` (or `OPENROUTER_API_KEY=xxx`) - AI-synthesized research with citations; set `INCLUDE_SOURCES=perplexity`.+- `BSKY_HANDLE=you.bsky.social` + `BSKY_APP_PASSWORD=xxx` - Bluesky (free app password).+- `BRAVE_API_KEY=xxx` or `EXA_API_KEY=xxx` - web search backends.++**CRITICAL: NEVER overwrite an existing `.env`.** Before writing ANY key:+1. Check if the file exists: `test -f ~/.config/last30days/.env`+2. If it exists, READ it, then APPEND only missing keys with `>>` (double redirect).+3. NEVER use `>` (single redirect) - it destroys existing content.+4. If it doesn't exist: `mkdir -p ~/.config/last30days && touch ~/.config/last30days/.env`++Always add this last line: `SETUP_COMPLETE=true`. Then proceed to research.++The setup wizard's mechanical work lives in a Python module so it runs across all hosts (Claude Code, Codex, Cursor, etc.) while you drive the consent conversation above. The common-case (already set up) path through this file stays short.---diff --git a/tests/test_onboarding_contract.py b/tests/test_onboarding_contract.pyindex 0dd302c1..81f042be 100644--- a/tests/test_onboarding_contract.py+++ b/tests/test_onboarding_contract.py@@ -1,10 +1,16 @@-"""Contract tests for the consent-driven first-run onboarding in SKILL.md.+"""Contract tests for the restored first-run NUX wizard in SKILL.md.-These assert the structural guarantees of Step 0: consent is requested before-any cookie read, the decline and Full Disk Access branches are documented, the-ScrapeCreators signup is gated on a consent question, and the old silent-wizard-instruction is gone. They read SKILL.md as text (the model's runtime contract),-matching tests/test_runtime_preflight_contract.py.+Step 0 has two branches: a **Claude Code Modal Flow** (AskUserQuestion-driven,+the restored v3.0.0 NUX) and a **Non-Modal Prose Flow** for hosts without modals+(OpenClaw, Codex, Cursor, Gemini CLI). These tests assert the structural+guarantees of both branches, plus the cross-cutting copy rules: the hard+"Step 0 before Step 1" gate, Digg threaded alongside yt-dlp, the 10,000-free-calls+credit count, and Threads/Pinterest kept out of the onboarding offers. They read+SKILL.md as text - the model's runtime contract - matching+tests/test_runtime_preflight_contract.py.++These lock the flow against silent re-erosion (the failure mode that orphaned the+wizard in PR #659 and flattened it before this restoration)."""import unittest@@ -17,54 +23,136 @@ SKILL_MD = ROOT / "skills" / "last30days" / "SKILL.md"class TestOnboardingContract(unittest.TestCase):def setUp(self):self.text = SKILL_MD.read_text(encoding="utf-8")- # Scope assertions to the Step 0 section so generic substrings (e.g.- # "setup") elsewhere in the file do not satisfy ordering checks.+ # Scope assertions to Step 0 so generic substrings elsewhere in the file+ # do not satisfy ordering/presence checks.start = self.text.index("## Step 0: First-Run Setup Wizard")end = self.text.index("## CRITICAL: Parse User Intent", start)self.step0 = self.text[start:end]+ # Branch slices.+ modal_start = self.step0.index("### Claude Code Modal Flow")+ prose_start = self.step0.index("### Non-Modal Prose Flow")+ manual_start = self.step0.index("### Manual Setup Guide")+ self.modal = self.step0[modal_start:prose_start]+ self.prose = self.step0[prose_start:manual_start]+ self.manual = self.step0[manual_start:]++ # --- Platform split + hard gate ---++ def test_platform_split_present(self):+ """Step 0 routes modal-capable hosts and prose hosts to distinct flows."""+ self.assertIn("Platform split", self.step0)+ self.assertIn("### Claude Code Modal Flow", self.step0)+ self.assertIn("### Non-Modal Prose Flow", self.step0)++ def test_hard_gate_step0_before_step1(self):+ """The erosion-resistant gate that orphaned the wizard in #659 is restored."""+ self.assertIn("ALWAYS execute Step 0 BEFORE Step 1", self.step0)++ # --- Modal flow: the restored NUX, stages in order ---++ def test_modal_flow_stage_order(self):+ """Welcome -> setup modal -> cookie consent -> SC offer -> opt-in -> picker."""+ anchors = [+ "Welcome to /last30days!",+ "How would you like to set up?",+ "scan your browser", # cookie-consent modal+ "Want to add TikTok, Instagram, and the ScrapeCreators backups?", # SC offer+ "Which ScrapeCreators sources do you want on?", # source opt-in+ "What do you want to research first?", # topic picker+ ]+ idxs = [self.modal.find(a) for a in anchors]+ for a, i in zip(anchors, idxs):+ self.assertGreater(i, -1, f"modal flow missing stage anchor: {a!r}")+ self.assertEqual(idxs, sorted(idxs), "modal flow stages are out of order")++ def test_modal_uses_askuserquestion(self):+ self.assertIn("AskUserQuestion", self.modal)++ def test_modal_cookie_consent_before_setup(self):+ consent = self.modal.find("scan your browser")+ setup = self.modal.find("last30days.py setup")+ self.assertGreater(consent, -1, "no cookie-consent modal in modal flow")+ self.assertGreater(setup, -1, "no setup invocation in modal flow")+ self.assertLess(consent, setup, "cookie consent must precede setup in modal flow")++ def test_topic_picker_skips_when_topic_supplied(self):+ """The picker documents skipping when the user already gave a topic."""+ self.assertIn("What do you want to research first?", self.modal)+ self.assertIn("SKIP this picker", self.modal)++ # --- Prose flow: same work, modal-free ---++ def test_prose_flow_has_no_modals(self):+ self.assertNotIn("AskUserQuestion", self.prose)++ def test_prose_cookie_consent_before_setup(self):+ consent = self.prose.find("Cookie consent")+ setup = self.prose.find("last30days.py setup")+ self.assertGreater(consent, -1, "no cookie-consent step in prose flow")+ self.assertGreater(setup, -1, "no setup invocation in prose flow")+ self.assertLess(consent, setup, "cookie consent must precede setup in prose flow")- def test_cookie_consent_requested_before_setup_invocation(self):- """The cookie-consent question must appear before the first `setup` run."""- consent_idx = self.step0.find("Cookie consent")- setup_idx = self.step0.find("last30days.py setup")- self.assertGreater(consent_idx, -1, "no Cookie consent step found")- self.assertGreater(setup_idx, -1, "no setup invocation found")- self.assertLess(- consent_idx, setup_idx,- "cookie consent must be requested before the setup command",- )-- def test_decline_branch_uses_from_browser_off(self):- """Declining cookies must route to FROM_BROWSER=off (skip reads, keep installs)."""- self.assertIn("FROM_BROWSER=off", self.step0)+ def test_prose_decline_uses_from_browser_off(self):+ self.assertIn("FROM_BROWSER=off", self.prose)++ # --- Full Disk Access remediation (both branches) ---def test_full_disk_access_remediation_present(self):- """The macOS permission-denied remediation must be documented."""- self.assertIn("Permission denied reading Cookies.binarycookies", self.step0)- self.assertIn("Full Disk Access", self.step0)-- def test_scrapecreators_signup_gated_on_consent(self):- """The signup runs `setup --github` and is offered after a consent question."""- self.assertIn("setup --github", self.step0)- offer_idx = self.step0.find("ScrapeCreators signup offer")- github_idx = self.step0.find("setup --github")- self.assertGreater(offer_idx, -1, "no ScrapeCreators signup offer step")- self.assertLess(- offer_idx, github_idx,- "the signup offer/consent must precede the --github invocation",- )-- def test_signup_does_not_hardcode_credit_count(self):- """Onboarding copy must not assert an unverified credit number."""+ self.assertIn("Permission denied reading Cookies.binarycookies", self.modal)+ self.assertIn("Full Disk Access", self.modal)+ self.assertIn("Permission denied reading Cookies.binarycookies", self.prose)+ self.assertIn("Full Disk Access", self.prose)++ def test_skip_path_writes_setup_complete(self):+ """The 'Skip for now' setup choice must write SETUP_COMPLETE or the wizard loops."""+ skip_idx = self.modal.find("If the user picks Skip for now")+ self.assertGreater(skip_idx, -1, "no Skip-for-now handling in modal flow")+ # The skip branch must persist the completion flag in its own paragraph.+ skip_para = self.modal[skip_idx:skip_idx + 400]+ self.assertIn("SETUP_COMPLETE=true", skip_para)++ # --- ScrapeCreators signup + persisted edge case ---++ def test_scrapecreators_signup_present_both_branches(self):+ self.assertIn("setup --github", self.modal)+ self.assertIn("setup --github", self.prose)++ def test_persisted_false_edge_case_documented(self):+ self.assertIn('"persisted": false', self.step0)++ # --- Digg threaded alongside yt-dlp everywhere it appears ---++ def test_digg_threaded_with_ytdlp(self):+ self.assertIn("Digg", self.modal)+ self.assertIn("Digg", self.prose)+ self.assertIn("Digg", self.manual)+ # The Auto-setup modal option names both tools together.+ self.assertIn("yt-dlp (YouTube) and the Digg CLI", self.modal)++ # --- Credit count = 10,000, no conflicting numbers in onboarding ---++ def test_credit_count_is_10000(self):+ self.assertIn("10,000 free calls", self.step0)+ self.assertNotIn("1,000 free", self.step0)self.assertNotIn("1000 free credit", self.step0)self.assertNotIn("1000 credits", self.step0)+ self.assertNotIn("100 free call", self.step0)++ # --- Threads/Pinterest kept out of the onboarding offers ---++ def test_threads_pinterest_absent_from_modal_and_prose(self):+ """They stay a power-user INCLUDE_SOURCES note in the manual guide only."""+ self.assertNotIn("Threads", self.modal)+ self.assertNotIn("Pinterest", self.modal)+ self.assertNotIn("Threads", self.prose)+ self.assertNotIn("Pinterest", self.prose)++ # --- Legacy guarantees retained ---def test_old_silent_wizard_instruction_removed(self):- """The misleading 'follow the wizard's prompts' line must be gone."""self.assertNotIn("Follow the wizard's prompts end-to-end", self.text)def test_consent_is_conversational_contract_documented(self):- """The named onboarding contract explains why consent is in-chat."""self.assertIn("Named onboarding contract", self.step0)self.assertIn("non-interactive subprocess", self.step0)