Files
Nexus/.cursor/rules/nexus-posix-paths.mdc
2026-07-08 22:31:31 +08:00

21 lines
801 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: 远程 Linux 路径必须用 POSIX,禁止 os.path 拼接
globs: server/**/*.py
alwaysApply: false
---
# 远程路径 = POSIX only
## 规则
- **SSH / SFTP / rsync 目标路径**(含 `target_path`、`remote_path`、命令里的文件路径):
- 使用 `server.utils.posix_paths``normalize_remote_abs_path`、`remote_join`、`posix_join` 等)
- **禁止** `os.path.join` / `dirname` / `basename` / `normpath` 处理这类字符串
- **Nexus 本机真实 I/O**`open`、`os.walk`、`os.scandir`):可用 `os.path`,逻辑拼接仍优先 `posix_join`
- **仓库本地路径**`Path(__file__)`、MCP `DEPLOY_DIR`):可用 `os.path` / `pathlib`
## 参考
- 实现:`server/utils/posix_paths.py`
- 审计:`docs/audit/2026-06-01-posix-path-batch-review.md`