Skip to content

feat: make setup wizard the first-use front door - #296

Merged
mohanagy merged 2 commits into
developmentfrom
feat/204-first-run-wizard-front-door
Jul 28, 2026
Merged

feat: make setup wizard the first-use front door#296
mohanagy merged 2 commits into
developmentfrom
feat/204-first-run-wizard-front-door

Conversation

@mohanagy

@mohanagy mohanagy commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • make miftah setup visibly present a numbered terminal wizard with explicit Step 1 and Step 2 states
  • accept numbers, established names, and displayed labels while preserving compatibility with existing scripted aliases
  • let users go back before connection details, cancel before writes, and recover invalid input on the current step
  • place both miftah setup and the miftah dashboard browser Console before the optional scripted init example in the README
  • distinguish the browser UI from the lower-level miftah console API command and update CLI/setup reference docs

Security and compatibility

The change does not alter setup planners, config writers, imports, credential handling, OAuth ownership, provider adapters, subprocess execution, no-shell behavior, non-overwrite publication, redaction, audit, containment, timeouts, or public configuration/API contracts. Existing source aliases remain accepted.

TDD evidence

The new setup and README contracts failed first against the previous unnumbered prompt and scripted-first quick start. After the implementation, the focused setup/README/0.5 guide/CLI contracts pass (125 tests), including numeric selection, safe back, cancel-before-write, and current-step invalid-input recovery. A direct built-CLI TTY dogfood also confirmed number -> Back -> cancel with no output file.

Validation

Run on Node 22.22.3:

  • npm test — 1,783 passed, 33 expected skips
  • npm run test:core — 425 passed, 26 expected skips
  • npm run test:coverage — 1,783 passed, 33 expected skips; 95.65% statements, 91.89% branches, 98.66% functions
  • npm run lint
  • npm run typecheck
  • npm run build
  • npm run smoke:cli
  • npm run check:pack — 48 files verified
  • npm run test:package — 26 passed

One earlier aggregate npm test attempt exposed the existing OAuth registry host-contention timeout; the exact test passed alone in 58 ms, passed under full coverage, and passed in the clean full-suite rerun. No timeout or test setting was changed.

Tracks #204. This PR does not close #204 or claim its external evaluator acceptance; #25/#88 evidence remains open.

Summary by CodeRabbit

  • New Features

    • Added a numbered, guided setup wizard with clearer starting-point choices.
    • Users can review selections, go back, cancel safely, and retry invalid choices.
    • Improved handling for existing client entries and no-secret imports.
  • Documentation

    • Updated quick-start guidance to prioritize the terminal wizard and browser Console.
    • Clarified the distinction between the browser UI, Console API, and optional scripted initialization.
    • Expanded setup instructions, validation steps, supported choices, and import restrictions.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR changes guided setup into a numbered, confirmation-based terminal wizard with back/cancel handling and invalid-choice recovery. README and CLI documentation now prioritize the wizard and Browser Console, while tests validate the revised prompts, flow, and onboarding content.

Changes

Guided setup experience

Layer / File(s) Summary
Numbered setup wizard flow
src/cli/setup.ts, src/cli/parse.ts
Starting points are displayed and parsed by number or name, then confirmed with support for back, cancel, and repeated invalid input.
Setup onboarding documentation
README.md, docs/cli.md, docs/presets-and-clients.md, docs/whats-new-in-0.5.md, CHANGELOG.md
Documentation describes the revised wizard, Browser Console, optional scripted initialization, import flow, and cancellation behavior.
Wizard and documentation contract tests
tests/setup-command.test.ts, tests/readme-product-contract.test.ts
Tests cover the new prompts, confirmation flow, numbered choices, recovery behavior, and README ordering and wording.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant TerminalWizard
  participant SetupFlow
  User->>TerminalWizard: Choose a numbered or named starting point
  TerminalWizard->>TerminalWizard: Validate and display the selected path
  User->>TerminalWizard: Confirm, go back, or cancel
  TerminalWizard->>SetupFlow: Continue with the confirmed setup path
Loading

Possibly related issues

  • mohanagy/miftah#290 — Both changes restructure first-time onboarding around the setup wizard, Browser Console, and progressively disclosed scripted paths.

Possibly related PRs

  • mohanagy/miftah#235 — Overlaps in the guided setup starting-point selection and related documentation and tests.
  • mohanagy/miftah#252 — Overlaps in the initial guided setup branching and step handling.
  • mohanagy/miftah#291 — Overlaps in first-use setup documentation and README contract tests.

Poem

A bunny hops through choices bright,
Five numbered paths come into sight.
“Back” hops safely, “cancel” stays clear,
The setup trail is fresh this year.
miftah setup leads the way!


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (2 errors)

Check name Status Explanation Resolution
Linked Issues check ❌ Error Issue #204 also requires the shared Console/CLI engine, profiles, secure publication, recovery, and broader handoff flows that this PR doesn't implement. Either implement the remaining #204 scope (shared Console/CLI engine, profiles, handoffs, recovery, security) or narrow the linked issue to this front-door/docs subset.
Docstring Coverage ❌ Error Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely matches the main change: promoting the setup wizard as the first-use entry point.
Description check ✅ Passed The PR description covers summary, security/compatibility, validation, and test evidence, with only minor template drift.
Out of Scope Changes check ✅ Passed The code changes stay focused on the setup wizard UX, docs, and tests, with no clear unrelated additions.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/204-first-run-wizard-front-door

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously requested changes Jul 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 51: Update the README setup-path sentence to avoid claiming that the
Browser Console supports local executable and existing client-entry imports;
list only the Console paths documented in docs/cli.md, while preserving the
broader terminal wizard capabilities.

In `@tests/readme-product-contract.test.ts`:
- Around line 95-98: Update the quickStart extraction in the readme contract
test to assert that both section headings are present and that the end heading
index follows the start heading index before calling slice. Preserve the
existing section-boundary strings and only slice after these validations
succeed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8a137d41-7da3-4588-b03f-fb762c7c312c

📥 Commits

Reviewing files that changed from the base of the PR and between b30c4bf and 2b1c9fe.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • README.md
  • docs/cli.md
  • docs/presets-and-clients.md
  • docs/whats-new-in-0.5.md
  • src/cli/parse.ts
  • src/cli/setup.ts
  • tests/readme-product-contract.test.ts
  • tests/setup-command.test.ts

Comment thread README.md Outdated
Comment thread tests/readme-product-contract.test.ts Outdated
@mohanagy

Copy link
Copy Markdown
Owner Author

CI follow-up: macOS Node 24 timed out in the unchanged records an unconfigured verifier as unsupported for its OAuth connection test at the fixed 5-second harness limit. The follow-up commit changes only README text and its contract; the same suite passed on macOS 20/22 and Linux 20/22/24, and the exact test passed locally on Node 24.18.0 in 59 ms. Rerunning only failed jobs; no timeout, coverage, skip, or containment changes.

@mohanagy
mohanagy dismissed coderabbitai[bot]’s stale review July 28, 2026 21:03

All actionable findings were fixed in bd8da38; CodeRabbit rechecked and explicitly confirmed both resolved threads on the current head.

@mohanagy
mohanagy merged commit 7a2cc73 into development Jul 28, 2026
21 of 23 checks passed
@mohanagy
mohanagy deleted the feat/204-first-run-wizard-front-door branch July 28, 2026 21:03
@coderabbitai coderabbitai Bot mentioned this pull request Jul 29, 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.

[Onboarding] Build a shared CLI and Console MCP setup wizard

1 participant