dsh-arch-doc 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/LICENSE +21 -0
- package/PUBLISHING.md +98 -0
- package/README.md +74 -0
- package/cordis.patch.yml +11 -0
- package/docs/architecture-template.md +45 -0
- package/docs/scanning-rules.md +95 -0
- package/examples/README.md +9 -0
- package/examples/input.json +15 -0
- package/examples/sample-output.json +78 -0
- package/examples/sample-output.md +60 -0
- package/package.json +59 -0
- package/plugin/index.js +41 -0
- package/scripts/arch-profile.mjs +893 -0
- package/skills/arch-doc/SKILL.md +47 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arch-doc
|
|
3
|
+
description: 架构文档生成:输入一个代码库路径,自动分析模块职责、依赖关系、入口点与运行方式,输出结构化 Markdown 架构文档与 JSON。需要读懂项目结构、生成架构文档、梳理模块依赖、整理启动/构建/测试命令时加载本技能。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# arch-doc Runbook
|
|
7
|
+
|
|
8
|
+
把代码库变成「模块职责 + 依赖关系 + 入口点 + 运行方式」的结构化架构文档。
|
|
9
|
+
|
|
10
|
+
## 执行原则
|
|
11
|
+
1. 区分事实与推断:目录/import/命令来自脚本事实,模块职责/项目描述/关键流程由 LLM 总结,并标注推断。
|
|
12
|
+
2. 不编造:读不到的信息写「未识别」,不猜测入口和依赖。
|
|
13
|
+
3. 可复现:附录记录扫描范围、排除目录、脚本命令与版本。
|
|
14
|
+
4. 大仓库保护:>2000 个源文件或目录深度 >5 时,先扫描顶层模块,禁止逐文件通读。
|
|
15
|
+
|
|
16
|
+
## 阶段 0:输入受理
|
|
17
|
+
- 识别用户输入:repo_path(必填);output_format(markdown/json/both,默认 markdown);output_path(默认 <repo>/docs);max_depth(默认 3);include_dirs;exclude_dirs;language。
|
|
18
|
+
- 缺少 repo_path 时用 ask_user_question 一次问清。
|
|
19
|
+
- 门槛:repo_path 存在且为目录,输出目录可写。
|
|
20
|
+
|
|
21
|
+
## 阶段 1:仓库探测
|
|
22
|
+
- 优先调用 `node scripts/arch-profile.mjs <repo> --probe`。
|
|
23
|
+
- 无 Node 时降级:用 shell 的 ls/find 手工探测。
|
|
24
|
+
- 输出:project.name、language、repo_type、tech_stack、description。
|
|
25
|
+
|
|
26
|
+
## 阶段 2:模块扫描
|
|
27
|
+
- 调用 `node scripts/arch-profile.mjs <repo> --scan --max-depth 3`。
|
|
28
|
+
- 脚本按语言规则划分模块并输出 modules[](name/path/key_files)。
|
|
29
|
+
- LLM 对每个模块补充 responsibility:读模块 README、文件头注释、类/函数名;信息不足时总结关键文件。
|
|
30
|
+
|
|
31
|
+
## 阶段 3:依赖分析
|
|
32
|
+
- 调用 `node scripts/arch-profile.mjs <repo> --deps`。
|
|
33
|
+
- 脚本输出 dependencies.internal[](source/target/kind/path)与 dependencies.external[](name/version/category)。
|
|
34
|
+
- LLM 只做环检测提醒与「待确认风险」标注。
|
|
35
|
+
|
|
36
|
+
## 阶段 4:入口点与运行方式
|
|
37
|
+
- 调用 `node scripts/arch-profile.mjs <repo> --entry`。
|
|
38
|
+
- 脚本输出 entry_points[] 与 run_methods[](来自 package.json scripts、pyproject [project.scripts]、Dockerfile、Makefile 等)。
|
|
39
|
+
- LLM 为每个入口补一句说明。
|
|
40
|
+
|
|
41
|
+
## 阶段 5:文档产出
|
|
42
|
+
- 严格按 docs/architecture-template.md 骨架生成。
|
|
43
|
+
- 默认输出:
|
|
44
|
+
- docs/ARCHITECTURE.md
|
|
45
|
+
- docs/architecture.json
|
|
46
|
+
- docs/diagrams/module-dependencies.mmd
|
|
47
|
+
- 门槛:每个模块有职责、每条依赖有来源、每个入口有路径/命令、每个 run_method 可复现。
|