---
phase: 01-installer-and-setup-architecture-simplification
plan: 03
type: execute
wave: 3
depends_on:
  - 01
  - 02
files_modified:
  - ../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl
  - ../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl
  - ../auth_gateway_for_mcp/src/installers.ts
  - ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs
  - ../auth_gateway_for_mcp/tests/installers-renderer.test.mjs
autonomous: true
requirements:
  - INST-01
  - SETUP-03
  - VER-03
must_haves:
  truths:
    - "Hosted installer scripts are thin uv-based wrappers that install the package, invoke `reddit-mcp setup`, and pass through setup result codes."
    - "Installer scripts keep install-time prerequisite checks only and do not own auth/cookie/registration fallback logic."
    - "Installer scripts can no longer print final success after setup/bootstrap-style failure paths."
  artifacts:
    - path: "../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl"
      provides: "Windows installer wrapper aligned to the canonical CLI contract"
    - path: "../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl"
      provides: "POSIX/macOS installer wrapper aligned to the canonical CLI contract"
    - path: "../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs"
      provides: "Regression tests for installer output and failure semantics"
  key_links:
    - from: "../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl"
      to: "src/reddit_mcp/cli.py"
      via: "installer invokes canonical setup command"
      pattern: "reddit-mcp setup"
    - from: "../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl"
      to: "../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs"
      via: "rendered script assertions"
      pattern: "install complete|reddit-mcp setup"
---

<objective>
Rewrite the hosted installer wrappers so they become thin uv-based transport layers around the CLI contract instead of independent setup state machines.

Purpose: The architecture is not simplified until the shell/PowerShell templates stop doing their own fallback orchestration and success judgment. This plan removes false-success behavior and aligns installer prerequisites with the new uv-first install model.
Output: Simplified installer templates, aligned renderer logic, and regression coverage that catches any future fake-success or launcher/bootstrap fallback behavior.
</objective>

<execution_context>
@/Users/yimingwang/.codex/get-shit-done/workflows/execute-plan.md
@/Users/yimingwang/.codex/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/REQUIREMENTS.md
@.planning/phases/01-installer-and-setup-architecture-simplification/01-CONTEXT.md
@src/reddit_mcp/cli.py
@../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl
@../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl
@../auth_gateway_for_mcp/src/installers.ts
@../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs
@../auth_gateway_for_mcp/tests/installers-renderer.test.mjs
</context>

<tasks>

<task type="auto">
  <name>Task 1: Simplify installer prerequisites and package installation around uv</name>
  <read_first>.planning/phases/01-installer-and-setup-architecture-simplification/01-CONTEXT.md, ../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl, ../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl, src/reddit_mcp/cli.py</read_first>
  <files>../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl, ../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl, ../auth_gateway_for_mcp/src/installers.ts</files>
  <action>Rewrite both installer templates so their install-time responsibility is limited to ensuring `uv` is available, installing `5mghost-rover` with `uv tool install`, and invoking the canonical `reddit-mcp setup` command. Remove Python command probing for launcher/runtime selection, remove `bootstrap` calls, and remove any installer-owned auth/cookie/registration fallback logic. Keep only prerequisite checks that answer "can this machine install and invoke the package" rather than "can the whole product complete setup without further CLI logic."</action>
  <verify>
    <automated>node --test ../auth_gateway_for_mcp/tests/installers-renderer.test.mjs ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs</automated>
  </verify>
  <acceptance_criteria>
    - `../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl` contains `uv tool install` and `reddit-mcp setup`.
    - `../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl` contains `uv tool install` and `reddit-mcp setup`.
    - Neither installer template contains the exact string `bootstrap` in its execution path.
    - Neither installer template contains runtime-selection strings `python3` or `py -3` for launching reddit-mcp.
    - `node --test ../auth_gateway_for_mcp/tests/installers-renderer.test.mjs ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs` exits 0.
  </acceptance_criteria>
  <done>The hosted installers become thin package-install + setup-invocation wrappers instead of carrying their own runtime and fallback state machines.</done>
</task>

<task type="auto">
  <name>Task 2: Enforce pass-through failure semantics and remove fake success from installers</name>
  <read_first>.planning/phases/01-installer-and-setup-architecture-simplification/01-CONTEXT.md, ../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl, ../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl, ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs</read_first>
  <files>../auth_gateway_for_mcp/templates/reddit-mcp.ps1.tpl, ../auth_gateway_for_mcp/templates/reddit-mcp.sh.tpl, ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs, ../auth_gateway_for_mcp/tests/installers-renderer.test.mjs</files>
  <action>Change both installer templates so they propagate `reddit-mcp setup` success/failure directly. Remove code paths that swallow setup failure, skip to smoke tests, or print final completion when required phases are incomplete. Extend installer tests beyond script text snapshots to assert the absence of false-success fallback patterns and the presence of canonical setup invocation. Add at least one failure-semantics assertion per platform template so future changes cannot reintroduce `install complete` after a failed setup path.</action>
  <verify>
    <automated>node --test ../auth_gateway_for_mcp/tests/installers-renderer.test.mjs ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs</automated>
  </verify>
  <acceptance_criteria>
    - Neither installer template contains a code path that catches `reddit-mcp setup` failure and then continues to print `reddit-mcp install complete.`.
    - `../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs` or `installers-renderer.test.mjs` contains explicit assertions covering failed-setup semantics for both PowerShell and shell templates.
    - The success path in both templates is gated behind successful completion of the invoked setup command.
    - `node --test ../auth_gateway_for_mcp/tests/installers-renderer.test.mjs ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs` exits 0.
  </acceptance_criteria>
  <done>Installer success output is finally coupled to actual setup success instead of independent wrapper guesses.</done>
</task>

</tasks>

<threat_model>
## Trust Boundaries

| Boundary | Description |
|----------|-------------|
| hosted installer script -> local machine | Installer output is the user's source of truth for whether setup succeeded |
| installer wrapper -> `reddit-mcp setup` | Wrapper can accidentally reinterpret failures and create fake-green installs |

## STRIDE Threat Register

| Threat ID | Category | Component | Disposition | Mitigation Plan |
|-----------|----------|-----------|-------------|-----------------|
| T-01-07 | T | installer prerequisite logic | mitigate | Limit prerequisites to uv/package-install capability and remove runtime probing drift |
| T-01-08 | I | success output | mitigate | Only print final success after the setup command exits successfully |
| T-01-09 | D | wrapper fallback branches | mitigate | Delete bootstrap/fallback branches and assert their absence in tests |
</threat_model>

<verification>
Run `node --test ../auth_gateway_for_mcp/tests/installers-renderer.test.mjs ../auth_gateway_for_mcp/tests/installer-endpoints.test.mjs` and inspect the rendered installer scripts if needed to confirm they only install via uv and pass through setup outcomes.
</verification>

<success_criteria>
The hosted installers become transport wrappers around the canonical setup flow, and they can no longer report success when required setup phases failed.
</success_criteria>

<output>
After completion, create `.planning/phases/01-installer-and-setup-architecture-simplification/01-installer-and-setup-architecture-simplification-03-SUMMARY.md`
</output>
