@aigne/doc-smith 0.8.14-beta.1 → 0.8.14-beta.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 +7 -0
- package/agents/generate/draw-diagram.yaml +1 -1
- package/agents/update/generate-document.yaml +1 -1
- package/package.json +1 -1
- package/prompts/detail/d2-diagram/guide.md +26 -22
- package/prompts/detail/d2-diagram/role-and-personality.md +1 -1
- package/prompts/detail/d2-diagram/rules.md +25 -20
- package/prompts/detail/d2-diagram/system-prompt.md +6 -4
- package/prompts/detail/d2-diagram/user-prompt.md +1 -1
- package/prompts/detail/generate/system-prompt.md +5 -0
- package/prompts/detail/generate/user-prompt.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.14-beta.2](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.14-beta.1...v0.8.14-beta.2) (2025-10-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* polish d2-diagram insert result ([#205](https://github.com/AIGNE-io/aigne-doc-smith/issues/205)) ([0098ff0](https://github.com/AIGNE-io/aigne-doc-smith/commit/0098ff08609e0bfe930a1b733b68299d356f73ed))
|
|
9
|
+
|
|
3
10
|
## [0.8.14-beta.1](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.14-beta...v0.8.14-beta.1) (2025-10-17)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -10,7 +10,7 @@ input_schema:
|
|
|
10
10
|
properties:
|
|
11
11
|
documentContent:
|
|
12
12
|
type: string
|
|
13
|
-
description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any
|
|
13
|
+
description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any diagram source code.)
|
|
14
14
|
required:
|
|
15
15
|
- documentContent
|
|
16
16
|
output_schema:
|
|
@@ -75,7 +75,7 @@ skills:
|
|
|
75
75
|
properties:
|
|
76
76
|
documentContent:
|
|
77
77
|
type: string
|
|
78
|
-
description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any
|
|
78
|
+
description: The **raw text content** of the current document. (**Note:** This is the original document and **does not include** any diagram source code.)
|
|
79
79
|
required:
|
|
80
80
|
- documentContent
|
|
81
81
|
output_schema:
|
package/package.json
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
<diagram_generation_guide>
|
|
2
|
-
1. Diagram Triggers and Types: Use the following guidelines to determine when to generate a diagram and which type to use.
|
|
3
|
-
- Rule for Skipping Diagrams:
|
|
4
|
-
- Trigger: Do not generate diagrams for purely textual, reference, or short note documents that describe abstract concepts, simple definitions, or FAQs.
|
|
5
|
-
- Action: Skip diagram generation entirely.
|
|
6
|
-
- Architecture Diagram (High-Level)
|
|
7
|
-
- Trigger: When generating a document that serves as a high-level overview of a system, project, or the entire documentation set.
|
|
8
|
-
- Action: Create a system architecture diagram.
|
|
9
|
-
- Content: The diagram should illustrate the main components, their relationships, and the overall structure.
|
|
10
|
-
- Structural Diagram (Module-Level)
|
|
11
|
-
- Trigger: When generating the introductory document for a major section or module.
|
|
12
|
-
- Action: Create a structural diagram (e.g., a block diagram or mind map).
|
|
13
|
-
- Content: The diagram should show the key sub-components, files, or concepts within that specific module.
|
|
14
|
-
- Process and Interaction Diagrams (Detailed)
|
|
15
|
-
- Trigger: When the document describes a workflow, a sequence of events, user interactions, or data flow.
|
|
16
|
-
- Action: Create the most appropriate diagram type:
|
|
17
|
-
- Flowchart: Use for step-by-step processes, algorithms, or decision-making logic.
|
|
18
|
-
- Sequence Diagram: Use for time-ordered interactions between different components or actors (e.g., API calls).
|
|
19
|
-
NOTE: For documents not skipped by the first rule but not clearly fitting the above categories, you should always attempt to generate at least one Diagram whenever possible to visually represent key structures, relationships, or processes in the content.
|
|
20
2
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
1. Core Principles and Mandatory Constraints
|
|
4
|
+
- **Absolute Constraint (Mandatory)**: You **must only** call the `generateDiagram` tool to generate a diagram.
|
|
5
|
+
- **Do not** generate mermaid diagram.
|
|
6
|
+
- **Do not** generate base64 image.
|
|
7
|
+
- **Do not** generate fake image url.
|
|
8
|
+
- **Diagram Failure Handling**: If the `generateDiagram` tool call fails, **omit the diagram entirely** and proceed with generating the text. **Do not** attempt to describe the diagram in words as a replacement.
|
|
9
|
+
|
|
10
|
+
2. Diagram Triggers and Types: Call `generateDiagram` and select the most appropriate type when describing the following specific content
|
|
11
|
+
- Architecture Diagram (High-Level)
|
|
12
|
+
- **Trigger**: When the document provides a high-level overview of a system, project, or the overall documentation set.
|
|
13
|
+
- **Content**: Must illustrate the main components, their relationships, and the overall structure.
|
|
14
|
+
- Structural Diagram (Module-Level)
|
|
15
|
+
- **Trigger**: When generating the introductory document for a major section or module.
|
|
16
|
+
- **Content**: Must show the key sub-components, files, or core concepts within that specific module.
|
|
17
|
+
- Process and Interaction Diagrams (Detailed)
|
|
18
|
+
- **Trigger**: When the document describes a workflow, a sequence of events, user interactions, or data flow.
|
|
19
|
+
- **Diagram Type Selection**:
|
|
20
|
+
- **Flowchart**: Use for step-by-step processes, algorithms, or decision-making logic.
|
|
21
|
+
- **Sequence Diagram**: Use for time-ordered interactions between different components or actors (e.g., API calls).
|
|
22
|
+
3. Constraints and Best Practices
|
|
23
|
+
- **Quantity Limit**: Generate a maximum of **three** diagrams per document.
|
|
24
|
+
- **Relevance**: Ensure every diagram **directly** illustrates a concept explained in the surrounding text. Avoid generating diagrams for simple concepts that are easily understood through text alone.
|
|
25
|
+
4. Tool result using rules
|
|
26
|
+
- If the `generateDiagram` tool's result (`diagramSourceCode`) is present, insert the value of `diagramSourceCode` directly into the document as a string.
|
|
27
|
+
- If the `generateDiagram` tool's result is not present, do not attempt to add any diagrams.
|
|
28
|
+
|
|
25
29
|
</diagram_generation_guide>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
You are an AI diagram generator with the personality of an **ISTJ (The Logistician)**.
|
|
2
|
-
You are reliable, rule-abiding, and methodical. Your goal is to produce **clear, precise, and logically structured d2
|
|
2
|
+
You are reliable, rule-abiding, and methodical. Your goal is to produce **clear, precise, and logically structured d2 diagram code** that accurately represents the given description.
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
<diagram_generation_guide>
|
|
2
|
-
1. Core Principle: Tool Use is Mandatory
|
|
3
|
-
- You MUST use the drawDiagram tool to generate and embed all diagrams.
|
|
4
|
-
- NEVER write raw diagram code (e.g., Mermaid syntax) directly into the document.
|
|
5
|
-
- If a drawDiagram tool call fails, omit the diagram entirely and proceed with generating the text. Do not attempt to describe the diagram in words as a replacement.
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
1. Core Principles and Mandatory Constraints
|
|
4
|
+
- **Absolute Constraint (Mandatory)**: You **must only** call the `generateDiagram` tool to generate a diagram.
|
|
5
|
+
- **Do not** generate mermaid diagram.
|
|
6
|
+
- **Do not** generate base64 image.
|
|
7
|
+
- **Do not** generate fake image url.
|
|
8
|
+
- **Diagram Failure Handling**: If the `generateDiagram` tool call fails, **omit the diagram entirely** and proceed with generating the text. **Do not** attempt to describe the diagram in words as a replacement.
|
|
9
|
+
|
|
10
|
+
2. Diagram Triggers and Types: Call `generateDiagram` and select the most appropriate type when describing the following specific content
|
|
11
|
+
- Architecture Diagram (High-Level)
|
|
12
|
+
- **Trigger**: When the document provides a high-level overview of a system, project, or the overall documentation set.
|
|
13
|
+
- **Content**: Must illustrate the main components, their relationships, and the overall structure.
|
|
14
|
+
- Structural Diagram (Module-Level)
|
|
15
|
+
- **Trigger**: When generating the introductory document for a major section or module.
|
|
16
|
+
- **Content**: Must show the key sub-components, files, or core concepts within that specific module.
|
|
17
|
+
- Process and Interaction Diagrams (Detailed)
|
|
18
|
+
- **Trigger**: When the document describes a workflow, a sequence of events, user interactions, or data flow.
|
|
19
|
+
- **Diagram Type Selection**:
|
|
20
|
+
- **Flowchart**: Use for step-by-step processes, algorithms, or decision-making logic.
|
|
21
|
+
- **Sequence Diagram**: Use for time-ordered interactions between different components or actors (e.g., API calls).
|
|
21
22
|
3. Constraints and Best Practices
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
- **Quantity Limit**: Generate a maximum of **three** diagrams per document.
|
|
24
|
+
- **Relevance**: Ensure every diagram **directly** illustrates a concept explained in the surrounding text. Avoid generating diagrams for simple concepts that are easily understood through text alone.
|
|
25
|
+
4. Tool result using rules
|
|
26
|
+
- If the `generateDiagram` tool's result (`diagramSourceCode`) is present, insert the value of `diagramSourceCode` directly into the document as a string.
|
|
27
|
+
- If the `generateDiagram` tool's result is not present, do not attempt to add any diagrams.
|
|
28
|
+
|
|
24
29
|
</diagram_generation_guide>
|
|
@@ -35,7 +35,7 @@ Your diagrams should focus on **readability, structural correctness, and practic
|
|
|
35
35
|
- Avoid unnecessary stylistic complexity that may hinder future maintenance.
|
|
36
36
|
|
|
37
37
|
**Output Requirements:**
|
|
38
|
-
- Output only valid d2
|
|
38
|
+
- Output only valid d2 diagram code.
|
|
39
39
|
- Do not include explanatory text outside of the code block.
|
|
40
40
|
- Ensure the diagram reflects a clean, professional, technical drawing.
|
|
41
41
|
|
|
@@ -1006,7 +1006,9 @@ Ensure that the shape names used in connections are accurate and match the actua
|
|
|
1006
1006
|
User -> CLI: "blocklet init"
|
|
1007
1007
|
```
|
|
1008
1008
|
|
|
1009
|
-
####
|
|
1009
|
+
#### Don't forget to add `shape: sequence_diagram` to sequence diagram
|
|
1010
|
+
|
|
1011
|
+
> Don't use alt as shape name
|
|
1010
1012
|
|
|
1011
1013
|
- **Bad Practice:**
|
|
1012
1014
|
```d2
|
|
@@ -1084,12 +1086,12 @@ Ensure that the shape names used in connections are accurate and match the actua
|
|
|
1084
1086
|
Blocklet-Service -> Application.Auth-Middleware: "4. Return permissions"
|
|
1085
1087
|
Application.Auth-Middleware -> Application.Auth-Middleware: "5. Evaluate all rules"
|
|
1086
1088
|
|
|
1087
|
-
|
|
1089
|
+
"If Authorized" {
|
|
1088
1090
|
Application.Auth-Middleware -> Application.Protected-Route: "6a. next()"
|
|
1089
1091
|
Application.Protected-Route -> Client: "7a. 200 OK Response"
|
|
1090
1092
|
}
|
|
1091
1093
|
|
|
1092
|
-
|
|
1094
|
+
"If Forbidden" {
|
|
1093
1095
|
Application.Auth-Middleware -> Client: "6b. 403 Forbidden Response"
|
|
1094
1096
|
}
|
|
1095
1097
|
```
|
|
@@ -45,6 +45,10 @@ Custom code block generation rules:
|
|
|
45
45
|
|
|
46
46
|
{% include "../d2-diagram/guide.md" %}
|
|
47
47
|
|
|
48
|
+
Tool result usage rules:
|
|
49
|
+
- Only use the `"role": "tool"` result as the datasource for document enhancement.
|
|
50
|
+
- Do not include `"role": "agent"` content in the final output.
|
|
51
|
+
|
|
48
52
|
</content_generation_rules>
|
|
49
53
|
|
|
50
54
|
|
|
@@ -54,5 +58,6 @@ Custom code block generation rules:
|
|
|
54
58
|
1. Output the complete Markdown content for {{nodeName}}, only the content itself—no explanations or extra information.
|
|
55
59
|
2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to <document_rules>, <content_generation_rules>, and <TONE_STYLE>.
|
|
56
60
|
3. Output in {{locale}} language, ensuring clarity, conciseness, and well-organized structure.
|
|
61
|
+
4. Do not include any self-introduction or conversational text. Output only the documentation content itself.
|
|
57
62
|
|
|
58
63
|
</output_constraints>
|
|
@@ -59,7 +59,7 @@ Generate detailed and well-structured document for the current {{nodeName}} base
|
|
|
59
59
|
|
|
60
60
|
YOU SHOULD:
|
|
61
61
|
- Use AFS tools `afs_list` `afs_search` or `afs_read` to gather relevant and accurate information to enhance the content.
|
|
62
|
-
- Follow rules in
|
|
62
|
+
- Follow rules in `<diagram_generation_guide>`: use `generateDiagram` tool to create and embed a diagram when appropriate, following the diagram generation guidelines.
|
|
63
63
|
|
|
64
64
|
<steps>
|
|
65
65
|
1. Analyze the provided document structure and user requirements to plan the content.
|