Files
ccdi/docs/plans/2026-03-13-deploy-to-nas-frontend-implementation.md

1.8 KiB

Deploy To NAS Frontend Implementation Plan

For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: 新增一个 Windows 下可双击执行的 .bat 一键入口,默认触发前后端打包并部署到 NAS。

Architecture: 通过 deploy-to-nas.bat 作为薄封装入口,把默认参数与可选覆盖参数转交给现有 deploy.ps1。BAT 只负责入口体验,不承载核心部署逻辑。

Tech Stack: Windows CMD, PowerShell, pytest


Task 1: 新增 BAT 入口脚本

Files:

  • Create: deploy/deploy-to-nas.bat
  • Test: tests/deploy/test_deploy_to_nas.py

Step 1: 写失败测试

def test_bat_dry_run_uses_default_nas_target():
    ...

Step 2: 运行测试确认失败

Run: py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py::test_bat_dry_run_uses_default_nas_target -q Expected: 失败,因为 BAT 文件不存在

Step 3: 最小实现

  • 新建 BAT 文件
  • 默认调用 deploy.ps1
  • 支持 --dry-run

Step 4: 运行测试

Run: py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py::test_bat_dry_run_uses_default_nas_target -q Expected: 通过

Task 2: 支持参数覆盖

Files:

  • Modify: deploy/deploy-to-nas.bat
  • Test: tests/deploy/test_deploy_to_nas.py

Step 1: 写失败测试

def test_bat_dry_run_accepts_override_arguments():
    ...

Step 2: 运行测试确认失败

Run: py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py::test_bat_dry_run_accepts_override_arguments -q Expected: 失败,因为 BAT 未透传覆盖参数

Step 3: 最小实现

  • 按位置参数传递 host、port、username、password、remoteRoot
  • --dry-run 透传给 PowerShell

Step 4: 全量测试

Run: py -3.12 -m pytest tests/deploy/test_deploy_to_nas.py -q Expected: 通过