70 lines
1.9 KiB
Markdown
70 lines
1.9 KiB
Markdown
# Deploy To NAS Backend Implementation Plan
|
|
|
|
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
|
|
|
**Goal:** 为现有后端打包与远端部署链路增加一个可被 `.bat` 入口复用的 `DryRun` 模式。
|
|
|
|
**Architecture:** 保持 `deploy.ps1` 作为真实执行器不变,仅增加参数解析和轻量分支,让 BAT 可以先走快速验证,再走真实部署。底层上传与远端部署逻辑继续复用现有 Python 脚本。
|
|
|
|
**Tech Stack:** PowerShell, Python, Docker Compose, Windows CMD
|
|
|
|
---
|
|
|
|
### Task 1: 为 `deploy.ps1` 增加 DryRun 模式
|
|
|
|
**Files:**
|
|
- Modify: `deploy/deploy.ps1`
|
|
- Test: `tests/deploy/test_deploy_to_nas.py`
|
|
|
|
**Step 1: 写失败测试**
|
|
|
|
```python
|
|
def test_deploy_ps1_dry_run_prints_target():
|
|
...
|
|
```
|
|
|
|
**Step 2: 运行测试确认失败**
|
|
|
|
Run: `py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py::test_deploy_ps1_dry_run_prints_target -q`
|
|
Expected: 失败,因为 `deploy.ps1` 还不支持 `-DryRun`
|
|
|
|
**Step 3: 最小实现**
|
|
|
|
- 新增 `-DryRun` 开关
|
|
- 打印 `Host/Port/Username/RemoteRoot`
|
|
- 直接返回成功
|
|
|
|
**Step 4: 重新运行测试**
|
|
|
|
Run: `py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py::test_deploy_ps1_dry_run_prints_target -q`
|
|
Expected: 通过
|
|
|
|
### Task 2: 保持真实部署行为不变
|
|
|
|
**Files:**
|
|
- Modify: `deploy/deploy.ps1`
|
|
- Modify: `deploy/remote-deploy.py`
|
|
- Test: `tests/deploy/test_deploy_to_nas.py`
|
|
|
|
**Step 1: 写失败测试**
|
|
|
|
```python
|
|
def test_deploy_ps1_still_accepts_default_parameters():
|
|
...
|
|
```
|
|
|
|
**Step 2: 运行测试确认失败**
|
|
|
|
Run: `py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py::test_deploy_ps1_still_accepts_default_parameters -q`
|
|
Expected: 因缺少对应输出或参数处理失败而不通过
|
|
|
|
**Step 3: 最小实现**
|
|
|
|
- 保持默认 NAS 参数
|
|
- 保持真实执行路径不变
|
|
|
|
**Step 4: 运行测试**
|
|
|
|
Run: `py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py -q`
|
|
Expected: 通过
|