---
phase: 48-textual-tui-removal
plan: 002
type: execute
wave: 1
depends_on: []
files_modified:
  - docs/setup-guide.md
  - docs/INSTALLATION.md
autonomous: true
requirements:
  - DEPR-02
user_setup: []

must_haves:
  truths:
    - "docs/setup-guide.md references only `paperforge setup --headless` — no bare `paperforge setup` without --headless flag"
    - "docs/INSTALLATION.md references only `paperforge setup --headless` — no bare `paperforge setup` without --headless flag"
    - "Section 3 of setup-guide.md describes headless-only setup workflow (no TUI wizard, no 5-step interactive walkthrough)"
    - "Headless completion message and post-install instructions reflect headless-only workflow"
  artifacts:
    - path: docs/setup-guide.md
      provides: "Updated installation guide with headless-only setup instructions"
      must_not_contain: "`paperforge setup`\n"
    - path: docs/INSTALLATION.md
      provides: "Updated quick-install guide with headless-only setup command"
      must_not_contain: "`paperforge setup`\n"
  key_links:
    - from: docs/setup-guide.md
      to: CLI
      pattern: "paperforge setup --headless"
    - from: docs/INSTALLATION.md
      to: CLI
      pattern: "paperforge setup --headless"
---

<objective>
Update all documentation to reflect the headless-only setup workflow. No documentation references the removed Textual TUI or bare `paperforge setup` without the `--headless` flag.

Purpose: Users reading documentation should never encounter a reference to the broken/deleted TUI wizard. All commands and descriptions use `--headless`.
Output: Updated setup-guide.md and INSTALLATION.md with headless-only setup commands and descriptions.
</objective>

<execution_context>
@C:/Users/Lin/.opencode/get-shit-done/workflows/execute-plan.md
@C:/Users/Lin/.opencode/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/REQUIREMENTS.md
@.planning/phases/48-textual-tui-removal/48-CONTEXT.md
@docs/setup-guide.md
@docs/INSTALLATION.md
</context>

<interfaces>
<!-- No code interfaces needed — pure documentation changes -->
</interfaces>

<tasks>

<task type="auto">
  <name>Task 1: Update docs/setup-guide.md — replace TUI wizard references with headless-only workflow</name>
  <files>docs/setup-guide.md</files>
  <action>
    Update section 3 ("运行安装向导") and the command reference table to reflect headless-only setup. There are 4 changes:

    CHANGE 1 — Line ~76 (Section 2, Install Method B description):
    From: `脚本会自动检查 Python、安装 PaperForge，然后提示运行 \`paperforge setup\`。`
    To:   `脚本会自动检查 Python、安装 PaperForge，然后提示运行 \`paperforge setup --headless\`。`

    CHANGE 2 — Lines ~88-136 (Section 3: "运行安装向导" — the entire section):
    Replace the current subsection 3.1 "启动向导" and 3.2 "向导步骤详解" with headless-only content:

    From:
    ```
    ## 3. 运行安装向导

    ### 3.1 启动向导

    \`\`\`powershell
    paperforge setup
    \`\`\`

    你会看到一个图形化界面（终端内的交互式界面）。
    ...
    ```

    To:
    ```
    ## 3. 运行安装向导

    ### 3.1 启动安装

    PaperForge 安装向导以非交互模式（headless）运行，无需手动交互：

    \`\`\`powershell
    paperforge setup --headless --agent opencode --paddleocr-key <your-key>
    \`\`\`

    向导会自动完成以下步骤：
    1. 环境检测（Python 版本、依赖包）
    2. 创建目录结构（PaperForge 数据库目录、插件目录、文献笔记目录）
    3. 部署 Worker 脚本和 Agent 技能文件
    4. 写入配置文件（paperforge.json、.env）
    5. 注册 paperforge CLI
    6. 验证安装完整性

    如果已有配置文件，安装只做增量补充，不会覆盖已有内容。

    > 提示：如果通过 Obsidian 插件安装，打开设置页 → 填写配置 → 点击"安装"，
    > 插件会自动调用上述 headless 命令，无需在终端中手动执行。
    ```

    ### 3.2 安装后文件结构

    (Keep the existing section 3.3 unchanged — the file structure is the same.)

    Renumber: The old section "3.3 安装后文件结构" (line ~136) becomes section "3.2 安装后文件结构".

    CHANGE 3 — Line ~370 (Section 7.1 command reference table):
    From: `| \`paperforge setup\` | 重新运行安装向导 | 修改配置时使用 |`
    To:   `| \`paperforge setup --headless\` | 重新运行安装向导（headless 模式） | 修改配置时使用 |`

    CHANGE 4 — Line ~1360 in DoneStep class (this text exists in setup_wizard.py's DoneStep, which is being removed by Plan 48-001). No change needed here since the entire DoneStep class is being removed.
  </action>
  <verify>
    <automated>
      # Verify no bare `paperforge setup` (without --headless flag, but not in a code fence context with --headless)
      $bare_refs = 0
      $lines = Get-Content docs/setup-guide.md
      foreach ($line in $lines) {
        if ($line -match '`paperforge setup`' -and $line -notmatch '--headless') {
          $bare_refs++
          Write-Host "Found bare ref: $line"
        }
      }
      if ($bare_refs -gt 0) { Write-Host "FAIL: $bare_refs bare paperforge setup refs remain" }
      else { Write-Host "PASS: all setup refs use --headless" }
    </automated>
  </verify>
  <done>
    - All occurrences of `paperforge setup` (bare, without --headless) in setup-guide.md are replaced with `paperforge setup --headless`
    - Section 3 describes headless-only workflow — no TUI graphical interface or 5-step wizard instructions remain
    - Obsidian plugin settings tab is described as the alternative to CLI
  </done>
</task>

<task type="auto">
  <name>Task 2: Update docs/INSTALLATION.md — headless-only setup command</name>
  <files>docs/INSTALLATION.md</files>
  <action>
    Update the quick-install guide to use --headless. Two changes:

    CHANGE 1 — Lines ~24-28 (setup command and description):
    From:
    ```
    # 2. 运行安装向导（会把插件文件部署到当前 Vault）
    paperforge setup

    向导会引导你完成 Vault 配置、Zotero 链接、API Key 设置，并把插件文件部署到 `.obsidian/plugins/paperforge/`。
    ```
    To:
    ```
    # 2. 运行安装向导（headless 模式，会把插件文件部署到当前 Vault）
    paperforge setup --headless --agent opencode --paddleocr-key <your-key>

    向导会自动完成环境检测、目录创建、文件部署和配置写入。如果已有配置文件，安装只做增量补充。
    ```

    CHANGE 2 — Line ~36 (Better BibTeX section):
    From: `这一步在 \`paperforge setup\` 完成之后再做，因为导出目录要先由安装向导创建。`
    To:   `这一步在 \`paperforge setup --headless\` 完成之后再做，因为导出目录要先由安装向导创建。`
  </action>
  <verify>
    <automated>
      # Verify no bare paperforge setup refs
      if (Select-String -Path docs/INSTALLATION.md -Pattern '`paperforge setup`' -Quiet) { Write-Host "FAIL: bare ref remains" } else { Write-Host "PASS: all refs use --headless" }
    </automated>
  </verify>
  <done>
    - INSTALLATION.md command uses `paperforge setup --headless`
    - INSTALLATION.md description reflects headless-only workflow
    - Better BibTeX section references `--headless` variant
  </done>
</task>

</tasks>

<verification>
1. Verify setup-guide.md has zero bare `paperforge setup` refs: `Select-String -Path docs/setup-guide.md -Pattern '`paperforge setup`'` returns no hits (or only hits that include `--headless`)
2. Verify INSTALLATION.md has zero bare `paperforge setup` refs: same check
3. Verify section 3 of setup-guide.md no longer references TUI graphical interface
4. Verify command table in setup-guide.md section 7.1 uses `--headless`
</verification>

<success_criteria>
- All documentation references to `paperforge setup` (bare, no --headless) are updated
- `docs/setup-guide.md` section 3 describes headless-only setup flow
- `docs/INSTALLATION.md` setup command includes `--headless` flag
- README.md already correct (line 71 uses `--headless`)
</success_criteria>

<output>
After completion, create `.planning/phases/48-textual-tui-removal/48-002-SUMMARY.md`
</output>
