refactor: 项目结构与命名规范化(重写前的最后一次常规提交)

## 改名
`scripts/run-temp.cmd` → `scripts/run-portable.cmd`
理由:它是**正式功能**(免安装、免管理员的便携启动方案),"temp" 易被误认成临时文件。
程序内文案同步:TEMPORARY launcher → PORTABLE launcher;
打包产物 README 的"【临时试用,不装也行】" → "【免安装试用,不装也行】"。

## 移动
`PRD.md` → `docs/PRD.md`
理由:文档统一放 docs/(README/CHANGELOG 按惯例留在根)。

## 同步的引用(共 11 处)
- scripts/pack.mjs:产物文件名校验 + 生成 README 的 3 处指引文案
- scripts/run-portable.cmd:自身用法注释 6 处
- README.md:目录树 + 文档链接
- docs/DEVELOPMENT.md:配套文档链接(`../PRD.md` → `PRD.md`,现已同目录)+ 目录树

## 验证
- 全仓 `run-temp` 残留 **0**;`./PRD.md`/`../PRD.md` 旧路径残留 **0**
- 7 包构建通过;单测 273 全绿;ps1-encoding 24 全绿
- `pack.mjs` 实跑通过,`run-portable.cmd` 已正确进入 Windows 产物
- `.cmd` 保持 ASCII + CRLF(94 行);PRD.md 无内部相对链接需调整
This commit is contained in:
jkooe committed 2026-10-10 13:39:42 +08:00
1 parent 11127b1a89
commit 5b69d6cec9
5 files changed
+16 -16

No files matched your search

+2 -2
View File
@@ -605,7 +605,7 @@ nodeagent/
├── scripts/ # install.cmd / control.cmd(一键入口)/ install.ps1 / control.ps1 / verify.mjs
├── tests/e2e/ # 端到端测试
├── docs/ # 开发文档
├── PRD.md # 产品需求文档
├── docs/ # 项目文档(含 PRD)
└── README.md
```
@@ -644,7 +644,7 @@ nodeagent/
- [`CHANGELOG.md`](CHANGELOG.md) —— **变更日志**(未发布版本的内容汇总 / 历史版本)
- [`docs/ROADMAP.md`](docs/ROADMAP.md) —— **当前进度盘点与下一步路线**(2026-10-07 基线:待办收尾 / 语义可断言 / 状态采样 / 安全残余)
- [产品需求文档(PRD)](./PRD.md)
- [产品需求文档(PRD)](./docs/PRD.md)
- [开发文档(DEVELOPMENT)](./docs/DEVELOPMENT.md) —— 协议细节、能力 schema、安全模型、各端实现指南
- [**跨机接管的边界与局限**](./docs/REMOTE-LIMITS.md) —— 哪些问题能远程修、哪些必须人工,附真实故障诊断案例
- [**实战复盘:短板与改进优先级**](./docs/RETROSPECTIVE.md) —— 基于真机使用的短板分析(GUI 语义 / 编码 / 自愈 / 可观测性)。**写于 2026-09-28(19 项能力时),多数 P0/P1 已解决 —— 最新状态见 [ROADMAP](./docs/ROADMAP.md) §3 对照表**
+2 -2
View File
@@ -10,7 +10,7 @@
| 日期 | 2026-09-27 |
| 状态 | 开发阶段 |
| 目标端 | macOS(控制端)/ Windows(被控端) |
| 配套文档 | [产品需求文档(PRD)](../PRD.md) |
| 配套文档 | [产品需求文档(PRD)](PRD.md) |
---
@@ -745,7 +745,7 @@ nodeagent/
│ └── install.ps1 # Windows 一键安装脚本
├── docs/ # 文档
├── README.md
└── PRD.md
└── PRD.md(已移入 docs/)
```
| 包 | 职责 | 关键文件 |
View File
File renamed without changes.
+5 -5
View File
@@ -131,7 +131,7 @@ async function main() {
// 一键入口:.cmd 必须**纯 ASCII**。CMD 的代码页(中文 Windows = 936/GBK)
// 无法可靠往返 UTF-8,中文提示一律交给带 BOM 的 .ps1 去输出。
for (const cmd of ['install.cmd', 'control.cmd', 'run-temp.cmd']) {
for (const cmd of ['install.cmd', 'control.cmd', 'run-portable.cmd']) {
copyFileSync(join(root, 'scripts', cmd), join(PKG_DIR, cmd));
}
@@ -150,7 +150,7 @@ async function main() {
log(' .ps1 BOM 检查通过(兼容 Windows PowerShell 5.1)');
// 防呆 B:.cmd 里出现非 ASCII 字节 = 中文乱码/命令截断的隐患。
for (const cmd of ['install.cmd', 'control.cmd', 'run-temp.cmd']) {
for (const cmd of ['install.cmd', 'control.cmd', 'run-portable.cmd']) {
const buf = readFileSync(join(PKG_DIR, cmd));
const bad = [...buf].findIndex((b) => b > 0x7f);
if (bad >= 0) {
@@ -190,17 +190,17 @@ async function main() {
'【日常管理】双击 control.cmd',
' 1 状态 / 2 启动 / 3 停止 / 4 重启 / 5 日志 / 6 卸载 / 7 彻底卸载',
'',
'【临时试用,不装也行】双击 run-temp.cmd',
'【免安装试用,不装也行】双击 run-portable.cmd',
' * 不需要管理员、不写计划任务、Ctrl+C 即停',
' * 首次运行自动生成配置与密钥(agent.json),并在控制台打印连接命令',
' * run-temp.cmd background = 最小化后台启动;stop = 结束;status = 看状态',
' * run-portable.cmd background = 最小化后台启动;stop = 结束;status = 看状态',
' * 适合临时测一下;长期用请走 install.cmd(有开机自启与进程守护)',
'',
'【密钥】本包**不含** PSK.txt(避免公开渠道泄露密钥)。密钥来源按序为:',
' 1) 若本目录已有 PSK.txt -> 直接用它',
' 2) 若本机已有 %USERPROFILE%\\.nodeagent\\agent.json -> 复用其中的 key',
' 3) 都没有 -> 自动生成一把随机密钥',
' 装完 / 临时启动后,密钥会打印在屏幕上;也可用 run-temp.cmd status 查看',
' 装完 / 免安装启动后,密钥会打印在屏幕上;也可用 run-portable.cmd status 查看',
' 这就是 Mac 端 --key 要填的值',
'',
'【注意】',
@@ -1,17 +1,17 @@
@echo off
REM ============================================================================
REM nodeagent - TEMPORARY launcher (no install, no admin, no scheduled task)
REM nodeagent - PORTABLE launcher (no install, no admin, no scheduled task)
REM
REM Purpose: bring the agent up for a quick test WITHOUT running install.cmd.
REM The agent is zero-config: on first run it creates %USERPROFILE%\.nodeagent\
REM (agent.json with a random PSK + self-signed cert) and starts listening.
REM
REM Usage:
REM run-temp.cmd start in foreground (Ctrl+C to stop)
REM run-temp.cmd start same as above
REM run-temp.cmd background start hidden, then print status
REM run-temp.cmd stop stop the background instance
REM run-temp.cmd status show whether it is running
REM run-portable.cmd start in foreground (Ctrl+C to stop)
REM run-portable.cmd start same as above
REM run-portable.cmd background start hidden, then print status
REM run-portable.cmd stop stop the background instance
REM run-portable.cmd status show whether it is running
REM
REM IMPORTANT: the agent takes NO command-line arguments (it does not parse
REM argv at all). The listen port comes from %USERPROFILE%\.nodeagent\
@@ -81,7 +81,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$cfg = Join-Path $env:USERPROFILE '.nodeagent\agent.json';" ^
"if (Test-Path $cfg) { Write-Host (' config : ' + $cfg); try { (Get-Content $cfg -Raw | ConvertFrom-Json) | ForEach-Object { Write-Host (' node_id : ' + $_.node_id); Write-Host (' key : ' + $_.key) } } catch {} } else { Write-Host ' config : (not yet created)' };"
echo.
echo If the connect line above is empty, run: run-temp.cmd status
echo If the connect line above is empty, run: run-portable.cmd status
pause
exit /b 0