repowiki-cli 0.5.0__py3-none-any.whl

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.
Files changed (57) hide show
  1. repowiki/__init__.py +18 -0
  2. repowiki/catalog.py +193 -0
  3. repowiki/cli.py +164 -0
  4. repowiki/coverage.py +96 -0
  5. repowiki/dispatch.py +419 -0
  6. repowiki/errors.py +21 -0
  7. repowiki/gitutil.py +19 -0
  8. repowiki/i18n.py +161 -0
  9. repowiki/knowledge.py +226 -0
  10. repowiki/llms.py +52 -0
  11. repowiki/metadata.py +176 -0
  12. repowiki/output.py +34 -0
  13. repowiki/paths.py +176 -0
  14. repowiki/plan.py +140 -0
  15. repowiki/scanner.py +170 -0
  16. repowiki/site.py +384 -0
  17. repowiki/state.py +437 -0
  18. repowiki/tasks.py +354 -0
  19. repowiki/templates/en/STYLE.md +49 -0
  20. repowiki/templates/en/catalog_task.md +69 -0
  21. repowiki/templates/en/flow_template.md +87 -0
  22. repowiki/templates/en/knowledge_card_task.md +65 -0
  23. repowiki/templates/en/knowledge_card_update_task.md +49 -0
  24. repowiki/templates/en/knowledge_module_task.md +33 -0
  25. repowiki/templates/en/knowledge_module_update_task.md +36 -0
  26. repowiki/templates/en/knowledge_task.md +65 -0
  27. repowiki/templates/en/overview_task.md +35 -0
  28. repowiki/templates/en/overview_update_task.md +50 -0
  29. repowiki/templates/en/page_task.md +45 -0
  30. repowiki/templates/en/page_template.md +113 -0
  31. repowiki/templates/en/update_task.md +49 -0
  32. repowiki/templates/site/app.js +378 -0
  33. repowiki/templates/site.html +373 -0
  34. repowiki/templates/zh/STYLE.md +50 -0
  35. repowiki/templates/zh/catalog_task.md +66 -0
  36. repowiki/templates/zh/flow_template.md +87 -0
  37. repowiki/templates/zh/knowledge_card_task.md +65 -0
  38. repowiki/templates/zh/knowledge_card_update_task.md +46 -0
  39. repowiki/templates/zh/knowledge_module_task.md +33 -0
  40. repowiki/templates/zh/knowledge_module_update_task.md +35 -0
  41. repowiki/templates/zh/knowledge_task.md +62 -0
  42. repowiki/templates/zh/overview_task.md +35 -0
  43. repowiki/templates/zh/overview_update_task.md +44 -0
  44. repowiki/templates/zh/page_task.md +45 -0
  45. repowiki/templates/zh/page_template.md +113 -0
  46. repowiki/templates/zh/update_task.md +49 -0
  47. repowiki/templates.py +38 -0
  48. repowiki/updater.py +322 -0
  49. repowiki/validate.py +356 -0
  50. repowiki/vendor/marked.min.js +69 -0
  51. repowiki/vendor/mermaid.min.js +3636 -0
  52. repowiki_cli-0.5.0.dist-info/METADATA +349 -0
  53. repowiki_cli-0.5.0.dist-info/RECORD +57 -0
  54. repowiki_cli-0.5.0.dist-info/WHEEL +5 -0
  55. repowiki_cli-0.5.0.dist-info/entry_points.txt +2 -0
  56. repowiki_cli-0.5.0.dist-info/licenses/LICENSE +21 -0
  57. repowiki_cli-0.5.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,33 @@
1
+ ---
2
+ id: {{TASK_ID}}
3
+ kind: knowledge_module
4
+ phase: 2
5
+ title: 知识模块:{{TITLE}}
6
+ output: {{OUTPUT_DIR}}
7
+ ---
8
+
9
+ # Task: write the knowledge module docs "{{TITLE}}"
10
+
11
+ Write the following files into directory <b>{{OUTPUT_DIR_ABS}}</b>/ (repo-relative: {{OUTPUT_DIR}}/).
12
+ **Write only files inside this directory.** `_module.yaml` is generated by the tool — do not write it by hand.
13
+
14
+ ## Module info
15
+ - Title: {{TITLE}}
16
+ - Scope: {{SCOPE}}
17
+ - Child modules: {{CHILDREN}}
18
+
19
+ ## Files to write (each is a short doc, in English, keeping technical nouns verbatim)
20
+ 1. `overview.md` —— one or two sentences: what this module is and its role in the repository (example style: *graphiti_core is the shared Python kernel; docker-compose orchestrates the three runtime services — REST server, MCP server, and the Next.js web UI.*)
21
+ 2. `tech-stack.md` —— one paragraph listing the key languages/frameworks/build tools/storages.
22
+ 3. `architecture.md` —— 3~6 bullets on internal structure and external contracts (call chains, orchestration entry points, cross-process contracts).
23
+ 4. `configuration-and-commands.md` —— one paragraph with this module's specific run/build/debug commands (if none: "no special commands, see the root README").
24
+ 5. `coding-conventions.md` (optional) —— only if the module has clear, consistent coding conventions: 3~5 bullets.
25
+
26
+ ## Requirements
27
+ - Read the key files under scope before writing; content must match the real code.
28
+ - No heading levels (these are fragment docs — plain text/bullets only).
29
+ - Keep it tight: overview 1~2 sentences, tech stack 1~3 sentences, architecture 3~6 bullets.
30
+
31
+ While writing, run `repowiki touch <repo path> --task {{TASK_ID}}` every few minutes to renew your claim (long tasks are otherwise reclaimed).
32
+
33
+ When done run: `repowiki check <repo path> --task {{TASK_ID}}`
@@ -0,0 +1,36 @@
1
+ ---
2
+ id: {{TASK_ID}}
3
+ kind: knowledge_module
4
+ phase: 2
5
+ title: Knowledge module: {{TITLE}} (incremental update)
6
+ output: {{OUTPUT_DIR}}
7
+ ---
8
+
9
+ # Task: incrementally update the knowledge module docs "{{TITLE}}"
10
+
11
+ Module directory: <b>{{OUTPUT_DIR_ABS}}</b> (repo-relative: {{OUTPUT_DIR}}).
12
+ **Write only the three docs inside this directory; never touch repository sources or other knowledge outputs.**
13
+
14
+ ## Module info
15
+ - Scope: {{SCOPE}}
16
+
17
+ ## Files changed since last generation (only those falling inside the module scope; re-read their current content)
18
+ {{CHANGED_FILES}}
19
+
20
+ ## Files to rewrite (each is a short doc, in English)
21
+ 1. `overview.md` —— one or two sentences: what this module is and its role in the repository.
22
+ 2. `tech-stack.md` —— one paragraph listing the key languages/frameworks/build tools/storages.
23
+ 3. `architecture.md` —— 3~6 bullets on internal structure and external contracts (call chains, orchestration entry points, cross-process contracts).
24
+
25
+ ## Update rules
26
+ 1. Fix outdated descriptions against the changed files; docs unaffected by the changes may stay as-is (but must still exist and be non-empty).
27
+ 2. Keep it tight: overview 1~2 sentences, tech stack 1~3 sentences, architecture 3~6 bullets.
28
+ 3. Reference repository files by relative path; no emoji/tables.
29
+
30
+ ## Hard checks
31
+ All three files (`overview.md`/`tech-stack.md`/`architecture.md`) exist and are non-empty.
32
+
33
+ While writing, run `repowiki touch <repo> --task {{TASK_ID}}` every few minutes to renew
34
+ your claim (long tasks get reclaimed otherwise).
35
+
36
+ When done run: `repowiki check <repo> --task {{TASK_ID}}`
@@ -0,0 +1,65 @@
1
+ ---
2
+ id: knowledge-plan
3
+ kind: knowledge_plan
4
+ phase: 2
5
+ title: 知识库规划(modules + cards)
6
+ output: state/knowledge.json
7
+ ---
8
+
9
+ # Task: plan the repository knowledge base (module tree + mechanism card list)
10
+
11
+ Your only output is one JSON file: `.repowiki/state/knowledge.json`.
12
+ **Do not write any cards or module docs; do not modify any other repository files.**
13
+
14
+ ## Repository info
15
+ - Repo name: {{REPO_NAME}}
16
+ - Key files: {{KEY_FILES}}
17
+
18
+ ## File tree (truncated)
19
+ ```
20
+ {{TREE_SUMMARY}}
21
+ ```
22
+
23
+ ## Output language
24
+ Write every human-readable field (`title`) in **English**, keeping technical proper nouns verbatim.
25
+
26
+ ## JSON Schema
27
+ ```json
28
+ {
29
+ "modules": [
30
+ {
31
+ "id": "m01",
32
+ "title": "<module title (English, may contain technical proper nouns)>",
33
+ "scope": ["<repo path prefix this module covers, e.g. src/core/>"],
34
+ "children": ["<child module id>"],
35
+ "depends_on": ["<other module id this depends on>"],
36
+ "related_to": ["<related module id>"]
37
+ }
38
+ ],
39
+ "cards": [
40
+ {
41
+ "id": "k01",
42
+ "title": "<card title, e.g.: Configuration system — layered YAML + pydantic-settings loading>",
43
+ "category": "<one id from the category list above>",
44
+ "scope": ["**"],
45
+ "source_files": ["<repo-relative path>", "..."]
46
+ }
47
+ ]
48
+ }
49
+ ```
50
+
51
+ ## Planning rules
52
+ 1. Modules = clearly bounded subsystems/sub-packages of the repository (2~8 is a good range, 1~2 levels). The root module covers the whole repository; sub-modules divide by scope path. Root ids m01…, sub-ids m0101…; a sub-module appears both in its parent's `children` and in the top-level `modules` list.
53
+ 2. Mechanism cards capture cross-cutting mechanisms; `category` must come from the list below ({{CATEGORY_COUNT}} categories). Only create cards for mechanisms that really exist and are worth documenting (0~2 per category; prefer fewer, better ones):
54
+
55
+ {{CATEGORY_BLOCK}}
56
+ 3. Card titles are self-contained (mechanism + key technology) and globally unique; `source_files` are the core files implementing the mechanism (2~8, must really exist).
57
+ 4. Cards and modules are independent: cards describe "mechanisms", modules describe "structure".
58
+
59
+ ## Self-check
60
+ - [ ] JSON parses; module/card ids and titles unique
61
+ - [ ] every id referenced by children/depends_on/related_to exists
62
+ - [ ] scope and source_files paths really exist
63
+ - [ ] category uses only the enum values from the list above
64
+
65
+ When done run: `repowiki check <repo path> --task knowledge-plan`
@@ -0,0 +1,35 @@
1
+ ---
2
+ id: overview
3
+ kind: overview
4
+ phase: 3
5
+ title: Wiki 总览(wiki_overview)
6
+ output: {{OUTPUT}}
7
+ ---
8
+
9
+ # Task: write the repository wiki overview
10
+
11
+ Write the overview to: <b>{{OUTPUT_ABS}}</b> (repo-relative: {{OUTPUT}}).
12
+ **Write only this one file.** It is embedded verbatim as the `wiki_overview` field of `repowiki-metadata.json`.
13
+
14
+ ## Inputs
15
+ - Repository: {{REPO_NAME}}
16
+ - Chapter tree (each chapter's page titles and page_briefs):
17
+
18
+ ```
19
+ {{CATALOG_TREE}}
20
+ ```
21
+
22
+ - Skim a few representative pages (under `.repowiki/{{LOCALE}}/content/`) before writing.
23
+
24
+ ## Content requirements (plain markdown, no YAML front matter)
25
+ 1. The H1 is "{{REPO_NAME}} Wiki Overview".
26
+ 2. 2~4 paragraphs on the repository's positioning and core value (objective tone).
27
+ 3. A "Section Navigation" section: for each chapter in the tree, `chapter title —— one-sentence description` (bullet list, plain text, no links).
28
+ 4. A "How to Use This Wiki" section: suggested reading order (newcomer path vs contributor path).
29
+
30
+ ## Style
31
+ {{STYLE}}
32
+
33
+ While writing, run `repowiki touch <repo path> --task {{TASK_ID}}` every few minutes to renew your claim (long tasks are otherwise reclaimed).
34
+
35
+ When done run: `repowiki check <repo path> --task overview`
@@ -0,0 +1,50 @@
1
+ ---
2
+ id: {{TASK_ID}}
3
+ kind: overview
4
+ phase: 3
5
+ title: Wiki Overview (incremental update)
6
+ output: {{OUTPUT}}
7
+ ---
8
+
9
+ # Task: incrementally refresh the repository wiki overview
10
+
11
+ Code has changed and the overview must follow. Write the refreshed overview to:
12
+ <b>{{OUTPUT_ABS}}</b> (repo-relative: {{OUTPUT}}).
13
+ **Rewrite only this file** (current content under "Current overview" below), keeping the
14
+ existing structure and length — do not start from scratch.
15
+
16
+ ## Inputs
17
+ - Repository: {{REPO_NAME}}
18
+ - Files changed since the last generation:
19
+ ```
20
+ {{CHANGED_FILES}}
21
+ ```
22
+ - Current catalog tree (chapter/subpage titles with page_briefs; if sections were added
23
+ or removed, "Section Navigation" must reflect it):
24
+
25
+ ```
26
+ {{CATALOG_TREE}}
27
+ ```
28
+
29
+ ## Current overview (to refresh)
30
+ ```
31
+ {{OLD_OVERVIEW}}
32
+ ```
33
+
34
+ ## Content requirements (plain markdown, no YAML front matter)
35
+ 1. Keep the H1 as "{{REPO_NAME}} Wiki Overview".
36
+ 2. Keep the existing paragraph structure: repo positioning & core value, `Section
37
+ Navigation`, `How to Use This Wiki` — all three are required; modify only the parts
38
+ the changes touch — added/removed sections must be reflected in "Section Navigation",
39
+ major mechanism changes in the positioning paragraphs.
40
+ 3. Do not add "Update Summary" or similar sections; the overview is not a page — keep it
41
+ tight.
42
+ 4. No YAML front matter, no cross-page links.
43
+
44
+ ## Style
45
+ {{STYLE}}
46
+
47
+ While writing, run `repowiki touch <repo-path> --task {{TASK_ID}}` every few minutes to
48
+ renew your claim (prevents reclamation on long tasks).
49
+
50
+ When done run: `repowiki check <repo-path> --task {{TASK_ID}}`
@@ -0,0 +1,45 @@
1
+ ---
2
+ id: {{TASK_ID}}
3
+ kind: page
4
+ phase: 2
5
+ title: {{TITLE}}
6
+ output: {{OUTPUT}}
7
+ hint_files:
8
+ {{HINT_FILES_YAML}}
9
+ ---
10
+
11
+ # Task: write the wiki page "{{TITLE}}"
12
+
13
+ Write the finished page to: <b>{{OUTPUT_ABS}}</b> (repo-relative: {{OUTPUT}}).
14
+ **Write only this one file; never modify repository sources or other wiki pages.**
15
+
16
+ ## Page positioning
17
+ - Chapter path: {{CHAPTER_PATH}}
18
+ - Page summary: {{SUMMARY}}
19
+ - Points this page must cover (page_brief):
20
+ {{PAGE_BRIEF}}
21
+
22
+ ## Reference files (read them before writing; cited line numbers must come from their real content)
23
+ {{HINT_FILES}}
24
+
25
+ ## Sibling pages (other page titles under the same parent chapter — for orientation only; never link them)
26
+ {{SIBLINGS}}
27
+
28
+ ## Page template (follow this skeleton strictly; replace <> placeholders with real content, keep the section order)
29
+ {{PAGE_TEMPLATE}}
30
+
31
+ ## Style & diagram rules (mandatory)
32
+ {{STYLE}}
33
+
34
+ ## Hard checks (the validator enforces each one; violations fail the task)
35
+ 1. Exactly one H1, equal to "{{TITLE}}".
36
+ 2. The `<cite>` block lists the files this page actually references (`[file name](file://repo-relative path)` format, 3~15 files).
37
+ 3. The "Contents" anchors must match the real section headings (GitHub-style anchors: lowercase, punctuation dropped, spaces → `-`).
38
+ 4. After the Introduction, every section ends with "Section sources"; every mermaid diagram is followed by "Diagram sources"; link format `[path:Lx-Ly](file://path#Lx-Ly)` with line numbers within the file's real length.
39
+ 5. At least 2 mermaid diagrams (a structure diagram + a sequence/dependency diagram).
40
+ 6. Beyond the required sections above you may add "Appendix: <topic>" sections as needed.
41
+ 7. Never link any other page under `.repowiki/`.
42
+
43
+ While writing, run `repowiki touch <repo path> --task {{TASK_ID}}` every few minutes to renew your claim (long tasks are otherwise reclaimed).
44
+
45
+ When done run: `repowiki check <repo path> --task {{TASK_ID}}`
@@ -0,0 +1,113 @@
1
+ # {{TITLE}}
2
+
3
+ <cite>
4
+ **Files referenced by this page**
5
+ - [<file name>](file://<repo-relative path>)
6
+ - [<file name>](file://<repo-relative path>)
7
+ </cite>
8
+
9
+ ## Contents
10
+ 1. [Introduction](#introduction)
11
+ 2. [Project Structure](#project-structure)
12
+ 3. [Core Components](#core-components)
13
+ 4. [Architecture Overview](#architecture-overview)
14
+ 5. [Detailed Component Analysis](#detailed-component-analysis)
15
+ 6. [Dependency Analysis](#dependency-analysis)
16
+ 7. [Performance and Consistency Considerations](#performance-and-consistency-considerations)
17
+ 8. [Troubleshooting Guide](#troubleshooting-guide)
18
+ 9. [Conclusion](#conclusion)
19
+
20
+ ## Introduction
21
+ <One paragraph: what this page's topic is, what problem it solves, where it lives in the repository.>
22
+
23
+ ## Project Structure
24
+ <Repository directories/files relevant to this chapter (bullet list, plain-text paths).>
25
+
26
+ ```mermaid
27
+ graph TB
28
+ subgraph "Layer name"
29
+ A["Component<br/>file.py"]
30
+ B["Component<br/>file.py"]
31
+ end
32
+ A --> B
33
+ ```
34
+
35
+ Diagram sources
36
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
37
+
38
+ Section sources
39
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
40
+
41
+ ## Core Components
42
+ - <component/concept name>: <one-sentence responsibility>
43
+
44
+ Section sources
45
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
46
+
47
+ ## Architecture Overview
48
+ <One paragraph + a sequence diagram describing the runtime interaction or data flow of this topic.>
49
+
50
+ ```mermaid
51
+ sequenceDiagram
52
+ participant Client as "Caller"
53
+ participant API as "Entry layer"
54
+ participant Core as "Core layer"
55
+ Client->>API : "request"
56
+ API->>Core : "invoke"
57
+ Core-->>API : "result"
58
+ API-->>Client : "response"
59
+ ```
60
+
61
+ Diagram sources
62
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
63
+
64
+ Section sources
65
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
66
+
67
+ ## Detailed Component Analysis
68
+ ### <sub-component / sub-topic 1>
69
+ - Responsibility: <...>
70
+ - Key behaviors: <...>
71
+ - Implementation notes: <...>
72
+
73
+ Section sources
74
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
75
+
76
+ ### <sub-component / sub-topic 2>
77
+ - ...
78
+
79
+ Section sources
80
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
81
+
82
+ ## Dependency Analysis
83
+ - <upstream/downstream dependencies (bullet list).>
84
+
85
+ ```mermaid
86
+ graph LR
87
+ A["Module A"] --> B["Module B"]
88
+ B --> C["External dependency"]
89
+ ```
90
+
91
+ Diagram sources
92
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
93
+
94
+ Section sources
95
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
96
+
97
+ ## Performance and Consistency Considerations
98
+ - <performance characteristics, concurrency, caching, consistency trade-offs (bullet list).>
99
+
100
+ Section sources
101
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
102
+
103
+ ## Troubleshooting Guide
104
+ - <common error/symptom → cause → how to locate → relevant code location.>
105
+
106
+ Section sources
107
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
108
+
109
+ ## Conclusion
110
+ <One paragraph: the topic's positioning, correct usage, and caveats.>
111
+
112
+ Section sources
113
+ - [<path>:<start>-<end>](file://<path>#L<start>-L<end>)
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: {{TASK_ID}}
3
+ kind: page_update
4
+ phase: 2
5
+ title: {{TITLE}}(增量更新)
6
+ output: {{OUTPUT}}
7
+ hint_files:
8
+ {{HINT_FILES_YAML}}
9
+ ---
10
+
11
+ # Task: incrementally update the wiki page "{{TITLE}}"
12
+
13
+ Rewrite the full updated page to: <b>{{OUTPUT_ABS}}</b> (repo-relative: {{OUTPUT}}).
14
+ **Write only this one file; never modify repository sources or other wiki pages.**
15
+
16
+ ## Files changed since the last generation (the basis of this update; re-read their current content)
17
+ {{CHANGED_FILES}}
18
+
19
+ ## Points this page must cover (page_brief, still valid)
20
+ {{PAGE_BRIEF}}
21
+
22
+ ## Current page in full (update on top of it; keep whatever is still correct)
23
+ ```markdown
24
+ {{OLD_PAGE}}
25
+ ```
26
+
27
+ ## Update rules
28
+ 1. Right after the `<cite>` block and before the table of contents, insert one section:
29
+
30
+ ```markdown
31
+ ## Update Summary
32
+
33
+ **Changed content**
34
+ - <state concretely which part was updated because of which file change, e.g.: API endpoint path updated, migrated from /old to /new>
35
+ ```
36
+
37
+ 2. Fix outdated descriptions, line ranges, and diagrams against the changed files; keep unaffected sections as-is.
38
+ 3. Add an "Update Summary" entry to the "Contents" list (before "Introduction").
39
+ 4. If there was a major improvement, you may append an `**Updated**` marker to the relevant item in the "Conclusion" section.
40
+ 5. Everything else — structure, style, citation rules — is identical to first generation:
41
+
42
+ {{STYLE}}
43
+
44
+ ## Hard checks
45
+ Same as first generation (H1 = "{{TITLE}}", all required sections present, "Update Summary" present, section/diagram source links real with line numbers in range, ≥2 mermaid diagrams, zero page-to-page links).
46
+
47
+ While writing, run `repowiki touch <repo path> --task {{TASK_ID}}` every few minutes to renew your claim (long tasks are otherwise reclaimed).
48
+
49
+ When done run: `repowiki check <repo path> --task {{TASK_ID}}`