93 lines
6.9 KiB
Python
93 lines
6.9 KiB
Python
|
|
# -*- coding: utf-8 -*-
|
||
|
|
"""
|
||
|
|
阶段3:将 39 个 C 类孤立文件逐文件归类到新结构对应类目。
|
||
|
|
映射基于文件名主题推断(PRD→产品文档子系统 / 架构设计→技术文档/01-架构设计 /
|
||
|
|
时序·类图→技术文档/技术架构 / 原型HTML·PNG→产品文档/01-02产品设计 /
|
||
|
|
测试用例→测试文档/03-功能测试用例 / 历史→历史归档)。
|
||
|
|
仅移动、不删除;目标已存在则跳过(绝不覆盖新结构内容)。
|
||
|
|
"""
|
||
|
|
import os, shutil, sys
|
||
|
|
|
||
|
|
ROOT = "docs"
|
||
|
|
DRY = "--go" not in sys.argv
|
||
|
|
|
||
|
|
M = {
|
||
|
|
"01-产品设计/知识库迭代-未实现功能原型设计-20260711.md": "01-产品文档/07-知识库/知识库迭代-未实现功能原型设计-20260711.md",
|
||
|
|
"02-产品需求/IT智能服务台-产品需求文档PRD-v2.md": "01-产品文档/IT智能服务台-产品需求文档PRD-v2.md",
|
||
|
|
"02-产品需求/IT智能服务台-全套改造建议与推广方案.md": "01-产品文档/IT智能服务台-全套改造建议与推广方案.md",
|
||
|
|
"02-产品需求/IT智能服务台-前端评价与推广方案-v2.md": "01-产品文档/IT智能服务台-前端评价与推广方案-v2.md",
|
||
|
|
"02-产品需求/prd_todo_integration.md": "01-产品文档/06-审批与待办/prd_todo_integration.md",
|
||
|
|
"02-产品需求/业务路由推荐-PRD.md": "01-产品文档/03-AI服务/业务路由推荐-PRD.md",
|
||
|
|
"02-产品需求/会议室预定-小鱼易联终端-PRD.md": "01-产品文档/08-集成生态/会议室预定-小鱼易联终端-PRD.md",
|
||
|
|
"02-产品需求/坐席端AI辅助消息框-PRD.md": "01-产品文档/04-坐席工作台/坐席端AI辅助消息框-PRD.md",
|
||
|
|
"02-产品需求/坐席端截图拍照功能-PRD.md": "01-产品文档/04-坐席工作台/坐席端截图拍照功能-PRD.md",
|
||
|
|
"02-产品需求/复杂场景重构第一阶段-增量PRD.md": "01-产品文档/复杂场景重构第一阶段-增量PRD.md",
|
||
|
|
"02-产品需求/复杂场景重构第二阶段-增量PRD.md": "01-产品文档/复杂场景重构第二阶段-增量PRD.md",
|
||
|
|
"02-产品需求/群聊参与者展开缩略双模式-PRD.md": "01-产品文档/02-会话管理/群聊参与者展开缩略双模式-PRD.md",
|
||
|
|
"02-产品需求/generated-videos/A_sleek_motion_graphics_animat_2026-07-10T16-56-31.mp4": "01-产品文档/generated-videos/A_sleek_motion_graphics_animat_2026-07-10T16-56-31.mp4",
|
||
|
|
"02-产品需求/generated-videos/A_sleek_motion_graphics_animat_2026-07-10T20-00-55.mp4": "01-产品文档/generated-videos/A_sleek_motion_graphics_animat_2026-07-10T20-00-55.mp4",
|
||
|
|
"02-产品需求/外来资料/IT审批与运维流程清单.xlsx": "01-产品文档/外来资料-IT审批与运维流程清单.xlsx",
|
||
|
|
"03-技术架构/voice-stt-system-design.md": "02-技术文档/01-架构设计/voice-stt-system-design.md",
|
||
|
|
"03-技术架构/业务路由推荐-时序图.mermaid": "02-技术文档/技术架构/业务路由推荐-时序图.mermaid",
|
||
|
|
"03-技术架构/业务路由推荐-架构设计.md": "02-技术文档/01-架构设计/业务路由推荐-架构设计.md",
|
||
|
|
"03-技术架构/业务路由推荐-类图.mermaid": "02-技术文档/技术架构/业务路由推荐-类图.mermaid",
|
||
|
|
"03-技术架构/会议室预定-小鱼易联终端-架构设计.md": "02-技术文档/01-架构设计/会议室预定-小鱼易联终端-架构设计.md",
|
||
|
|
"03-技术架构/坐席端AI辅助消息框与布局优化-架构设计.md": "02-技术文档/01-架构设计/坐席端AI辅助消息框与布局优化-架构设计.md",
|
||
|
|
"03-技术架构/坐席端截图拍照功能-架构设计.md": "02-技术文档/01-架构设计/坐席端截图拍照功能-架构设计.md",
|
||
|
|
"03-技术架构/复杂场景重构第一阶段-架构设计.md": "02-技术文档/01-架构设计/复杂场景重构第一阶段-架构设计.md",
|
||
|
|
"03-技术架构/复杂场景重构第二阶段-架构设计.md": "02-技术文档/01-架构设计/复杂场景重构第二阶段-架构设计.md",
|
||
|
|
"03-技术架构/群聊参与者展开缩略双模式-架构设计.md": "02-技术文档/01-架构设计/群聊参与者展开缩略双模式-架构设计.md",
|
||
|
|
"04-原型设计/prototypes-原型图/admin-dashboard-v1.html": "01-产品文档/01-02产品设计/admin-dashboard-v1.html",
|
||
|
|
"04-原型设计/prototypes-原型图/agent-workspace-v5_4.html": "01-产品文档/01-02产品设计/agent-workspace-v5_4.html",
|
||
|
|
"04-原型设计/prototypes-原型图/h5-user-v1_8.html": "01-产品文档/01-02产品设计/h5-user-v1_8.html",
|
||
|
|
"04-原型设计/prototypes-原型图/H5用户端原型图实现概览.md": "01-产品文档/01-02产品设计/H5用户端原型图实现概览.md",
|
||
|
|
"04-原型设计/screenshots/agent-participant-expanded.png": "01-产品文档/01-02产品设计/screenshots/agent-participant-expanded.png",
|
||
|
|
"04-原型设计/screenshots/h5-participant-strip.png": "01-产品文档/01-02产品设计/screenshots/h5-participant-strip.png",
|
||
|
|
"04-原型设计/screenshots/invite-org-selected.png": "01-产品文档/01-02产品设计/screenshots/invite-org-selected.png",
|
||
|
|
"04-原型设计/screenshots/invite-org-tree.png": "01-产品文档/01-02产品设计/screenshots/invite-org-tree.png",
|
||
|
|
"04-原型设计/screenshots/invite-search-results.png": "01-产品文档/01-02产品设计/screenshots/invite-search-results.png",
|
||
|
|
"06-测试质量/testing-测试/登录功能测试用例-20260706.md": "03-测试文档/03-功能测试用例/登录功能测试用例-20260706.md",
|
||
|
|
"11-历史归档/PRD-v53-incremental.md": "08-历史归档/PRD-v53-incremental.md",
|
||
|
|
"11-历史归档/PRD.md": "08-历史归档/PRD.md",
|
||
|
|
"11-历史归档/重构方案-复杂场景技术方案.md": "08-历史归档/重构方案-复杂场景技术方案.md",
|
||
|
|
"11-历史归档/deploy-nas-archived-20260704/nginx/nginx-nas.conf": "08-历史归档/deploy-nas-archived-20260704/nginx/nginx-nas.conf",
|
||
|
|
}
|
||
|
|
|
||
|
|
print("映射条目:", len(M), "(期望 39)")
|
||
|
|
problems = []
|
||
|
|
for s, d in M.items():
|
||
|
|
sp = os.path.normpath(os.path.join(ROOT, s))
|
||
|
|
dp = os.path.normpath(os.path.join(ROOT, d))
|
||
|
|
if not os.path.isfile(sp):
|
||
|
|
problems.append(("SRC_MISSING", s))
|
||
|
|
if os.path.exists(dp):
|
||
|
|
problems.append(("DST_EXISTS", d))
|
||
|
|
if problems:
|
||
|
|
print("!! 发现问题:")
|
||
|
|
for k, v in problems:
|
||
|
|
print(" ", k, v)
|
||
|
|
else:
|
||
|
|
print("✓ 校验通过:所有源存在、所有目标无冲突")
|
||
|
|
|
||
|
|
if DRY:
|
||
|
|
print("\n[DRY-RUN] 不执行移动。预览前 12 条:")
|
||
|
|
for i, (s, d) in enumerate(M.items()):
|
||
|
|
if i >= 12: break
|
||
|
|
print(" %s\n -> %s" % (s, d))
|
||
|
|
print(" ... (共 %d 条)" % len(M))
|
||
|
|
else:
|
||
|
|
ok, skip = [], []
|
||
|
|
for s, d in M.items():
|
||
|
|
sp = os.path.normpath(os.path.join(ROOT, s))
|
||
|
|
dp = os.path.normpath(os.path.join(ROOT, d))
|
||
|
|
if not os.path.isfile(sp):
|
||
|
|
skip.append((s, "SRC_MISSING")); continue
|
||
|
|
if os.path.exists(dp):
|
||
|
|
skip.append((s, "DST_EXISTS")); continue
|
||
|
|
os.makedirs(os.path.dirname(dp), exist_ok=True)
|
||
|
|
shutil.move(sp, dp)
|
||
|
|
ok.append((s, d))
|
||
|
|
print("\nMOVED:", len(ok), "SKIPPED:", len(skip))
|
||
|
|
for s, r in skip:
|
||
|
|
print(" SKIP", s, "::", r)
|