@aigne/doc-smith 0.8.16-beta → 0.9.0-beta
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 +20 -0
- package/agents/evaluate/generate-report.mjs +7 -0
- package/agents/evaluate/index.yaml +6 -0
- package/agents/generate/check-need-generate-structure.mjs +8 -4
- package/agents/generate/document-structure-tools/add-document.mjs +4 -0
- package/agents/generate/document-structure-tools/update-document.mjs +11 -0
- package/agents/generate/draw-diagram.yaml +2 -2
- package/agents/generate/generate-structure.yaml +3 -2
- package/agents/init/index.mjs +6 -4
- package/agents/media/load-media-description.mjs +2 -1
- package/agents/schema/document-structure-item.yaml +3 -0
- package/agents/schema/document-structure-refine-item.yaml +3 -0
- package/agents/schema/document-structure.yaml +3 -0
- package/agents/update/pre-check-generate-diagram.yaml +1 -1
- package/agents/utils/document-icon-generate.yaml +52 -0
- package/agents/utils/generate-document-icon-if-needed.mjs +93 -0
- package/aigne.yaml +2 -0
- package/package.json +3 -7
- package/prompts/common/document/media-file-list-usage-rules.md +8 -2
- package/prompts/common/document/openapi-usage-rules.md +174 -21
- package/prompts/common/document-structure/document-icon-generate.md +116 -0
- package/prompts/common/document-structure/document-structure-rules.md +8 -3
- package/prompts/common/document-structure/openapi-usage-rules.md +28 -0
- package/prompts/common/document-structure/output-constraints.md +9 -0
- package/prompts/detail/custom/{custom-code-block.md → code-block-usage-rules.md} +43 -16
- package/prompts/detail/custom/custom-components/x-card-usage-rules.md +62 -0
- package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +75 -0
- package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +86 -0
- package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +95 -0
- package/prompts/detail/custom/custom-components/x-field-usage-rules.md +189 -0
- package/prompts/detail/custom/custom-components-usage-rules.md +10 -534
- package/prompts/detail/{d2-diagram → diagram}/rules.md +5 -3
- package/prompts/detail/generate/document-rules.md +6 -0
- package/prompts/detail/generate/system-prompt.md +3 -2
- package/prompts/detail/generate/user-prompt.md +7 -1
- package/prompts/detail/update/system-prompt.md +3 -3
- package/prompts/structure/generate/system-prompt.md +2 -5
- package/prompts/structure/generate/user-prompt.md +14 -39
- package/types/document-structure-schema.mjs +1 -0
- package/utils/evaluate/report-utils.mjs +7 -3
- /package/prompts/detail/{d2-diagram → diagram}/guide.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/official-examples.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/pre-check.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/role-and-personality.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/system-prompt.md +0 -0
- /package/prompts/detail/{d2-diagram → diagram}/user-prompt.md +0 -0
|
@@ -8,37 +8,12 @@ NOTICE: There are additional data source contents not displayed. When operating
|
|
|
8
8
|
</data_sources>
|
|
9
9
|
|
|
10
10
|
{% if userContext.openAPISpec %}
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
**Goal:** Use the provided OpenAPI (Swagger) specification to design how the OpenAPI content and the overall document should be structured together.
|
|
14
|
-
|
|
15
|
-
**OpenAPI File Content:**
|
|
16
|
-
<openapi_doc>
|
|
11
|
+
<openapi_spec_content>
|
|
12
|
+
## OpenAPI Spec Content
|
|
17
13
|
|
|
18
14
|
{{ userContext.openAPISpec }}
|
|
19
15
|
|
|
20
|
-
</
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
### **Documentation Requirements and Constraints**
|
|
25
|
-
|
|
26
|
-
1. **Section structure and titles:**
|
|
27
|
-
* Create a dedicated top-level section for the OpenAPI content.
|
|
28
|
-
* The section title must be professional and user friendly; **never** include terms such as OpenAPI, Swagger, or file formats. Recommended titles include **"API Interface Reference"** or **"Interface Reference"**.
|
|
29
|
-
|
|
30
|
-
2. **Content hierarchy and presentation:**
|
|
31
|
-
* **Ideal state (single-level page):** Prefer to present all API endpoints within **one Markdown file (one page)**.
|
|
32
|
-
* **Split criteria (two-level pages):** Only when the number of endpoints is too large for a single file should you split by OpenAPI tags or logical modules, creating individual Markdown files per module.
|
|
33
|
-
* **Forced file hierarchy constraint:** Whether using one or two levels, the generated API reference files (Markdown) may contain **no more than two levels.**
|
|
34
|
-
* **Example (two-level structure):** `/api-reference.md` (index) -> `/api/user.md`, `/api/order.md` (module pages)
|
|
35
|
-
* **Disallow any third level or deeper structure:** for example, `/api/v1/user/get.md`.
|
|
36
|
-
|
|
37
|
-
3. **Mandatory API description constraints (deduplication rule):**
|
|
38
|
-
* **Ensure that for the entire document (including preface, overview, etc.), any introduction to the project APIs appears only within this OpenAPI-generated "API reference" section.**
|
|
39
|
-
* **Never** repeat or extend the API list elsewhere in the document (for example, "Quick Start" or "Architecture Overview" sections).
|
|
40
|
-
|
|
41
|
-
</openapi>
|
|
16
|
+
</openapi_spec_content>
|
|
42
17
|
{% endif %}
|
|
43
18
|
|
|
44
19
|
<document_info>
|
|
@@ -50,7 +25,7 @@ projectDesc: |
|
|
|
50
25
|
{% endif %}
|
|
51
26
|
</document_info>
|
|
52
27
|
|
|
53
|
-
<
|
|
28
|
+
<previous_document_structure>
|
|
54
29
|
|
|
55
30
|
{% if originalDocumentStructure %}
|
|
56
31
|
{{ originalDocumentStructure | yaml.stringify }}
|
|
@@ -60,19 +35,18 @@ projectDesc: |
|
|
|
60
35
|
No previous document structure provided. generate a new structure based on the data sources!
|
|
61
36
|
{% endif %}
|
|
62
37
|
|
|
63
|
-
</
|
|
64
|
-
|
|
38
|
+
</previous_document_structure>
|
|
65
39
|
|
|
66
40
|
{% include "../../common/document-structure/user-locale-rules.md" %}
|
|
67
41
|
|
|
68
42
|
{% include "../../common/document-structure/user-preferences.md" %}
|
|
69
43
|
|
|
70
|
-
<
|
|
71
|
-
If a previous structural plan (
|
|
72
|
-
1.
|
|
73
|
-
2.
|
|
74
|
-
|
|
75
|
-
</
|
|
44
|
+
<previous_document_structure_rule>
|
|
45
|
+
If a previous structural plan (`<previous_document_structure>`) is provided, follow these rules:
|
|
46
|
+
1. **Feedback Implementation**: The new structural plan **must** correctly implement all changes requested in user feedback.
|
|
47
|
+
2. **Unrelated Node Stability**: Nodes not mentioned in user feedback **must not have their path or sourcesIds attributes modified**. `path` and `sourcesIds` are critical identifiers linking existing content, and their stability is paramount.
|
|
48
|
+
- Ideally, other attributes (such as `title`, `description`) should also remain stable, unless these changes are directly caused by a requested modification or result from DataSource updates.
|
|
49
|
+
</previous_document_structure_rule>
|
|
76
50
|
|
|
77
51
|
{% if documentStructure %}
|
|
78
52
|
<review_document_structure>
|
|
@@ -109,7 +83,8 @@ Sub-structures must meet the following requirements:
|
|
|
109
83
|
{% endif %}
|
|
110
84
|
|
|
111
85
|
<instructions>
|
|
112
|
-
|
|
86
|
+
|
|
87
|
+
Your task is to **analyze, refine, and adjust** the existing document structure (`<previous_document_structure>`) based on the partial code repository content currently provided, generating a structural update plan.
|
|
113
88
|
You are not creating a structure from scratch, but rather **performing intelligent updates based on understanding the existing structure** to make the document structure more accurately reflect the latest code content, architectural changes, and logical relationships.
|
|
114
89
|
|
|
115
90
|
## When using `<data_sources>` data sources, please note the following:
|
|
@@ -132,7 +107,7 @@ IMPORTANT: You should avoid duplicating existing structure items. Only include i
|
|
|
132
107
|
## Behavior Rules
|
|
133
108
|
|
|
134
109
|
1. **Understanding and Inheritance**
|
|
135
|
-
- Fully understand the hierarchical logic, section divisions, and naming style in `<
|
|
110
|
+
- Fully understand the hierarchical logic, section divisions, and naming style in `<previous_document_structure>`.
|
|
136
111
|
- Perform incremental updates based on this foundation, not complete rewrites.
|
|
137
112
|
- Preserve existing reasonable structures, only modify or extend when there is clear justification.
|
|
138
113
|
|
|
@@ -8,6 +8,7 @@ export const documentItemSchema = z.object({
|
|
|
8
8
|
path: z.string().startsWith("/", 'Path must start with "/"'),
|
|
9
9
|
parentId: z.string().nullish(),
|
|
10
10
|
sourceIds: z.array(z.string()).min(1, "At least one source ID is required"),
|
|
11
|
+
icon: z.string().optional(), // Lucide icon name (e.g., lucide:book) for root-level documents
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
// Documentation structure schema - represents the entire documentation structure array
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
import terminalLink from "terminal-link";
|
|
6
|
+
|
|
5
7
|
import { toRelativePath } from "../utils.mjs";
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -115,6 +117,8 @@ export async function copyHtmlReportTemplate(targetDir, data) {
|
|
|
115
117
|
* @returns {string} Success message with links
|
|
116
118
|
*/
|
|
117
119
|
export function generateReportSuccessMessage(jsonReportPath, htmlReportPath) {
|
|
120
|
+
const openHtmlPath = resolve(htmlReportPath);
|
|
121
|
+
const openUrl = pathToFileURL(openHtmlPath);
|
|
118
122
|
return `# ✅ Documentation Evaluation Report Generated Successfully!
|
|
119
123
|
|
|
120
124
|
Generated evaluation report and saved to:
|
|
@@ -125,7 +129,7 @@ Generated evaluation report and saved to:
|
|
|
125
129
|
|
|
126
130
|
Open in your browser to view detailed analysis:
|
|
127
131
|
|
|
128
|
-
\`${
|
|
132
|
+
\`${terminalLink(openUrl, openUrl)}\`
|
|
129
133
|
|
|
130
134
|
`;
|
|
131
135
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|