@aigne/doc-smith 0.8.15-beta.8 → 0.8.15
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 +73 -0
- package/agents/evaluate/document-structure.yaml +3 -1
- package/agents/evaluate/document.yaml +3 -1
- package/agents/evaluate/index.yaml +1 -3
- package/agents/generate/check-diagram.mjs +1 -1
- package/agents/generate/generate-structure.yaml +25 -71
- package/agents/generate/index.yaml +1 -2
- package/agents/generate/{merge-d2-diagram.yaml → merge-diagram.yaml} +7 -6
- package/agents/generate/update-document-structure.yaml +51 -45
- package/agents/generate/user-review-document-structure.mjs +3 -26
- package/agents/generate/utils/merge-document-structures.mjs +8 -32
- package/agents/init/check.mjs +1 -1
- package/agents/init/index.mjs +52 -2
- package/agents/init/validate.mjs +16 -0
- package/agents/publish/publish-docs.mjs +16 -10
- package/agents/schema/document-execution-structure.yaml +1 -1
- package/agents/schema/document-structure-item.yaml +1 -1
- package/agents/schema/document-structure-refine-item.yaml +20 -0
- package/agents/schema/document-structure.yaml +4 -2
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/check-generate-diagram.mjs +84 -0
- package/agents/update/generate-diagram.yaml +0 -1
- package/agents/update/generate-document.yaml +4 -4
- package/agents/update/handle-document-update.yaml +9 -1
- package/agents/update/pre-check-generate-diagram.yaml +44 -0
- package/agents/update/update-document-detail.yaml +64 -58
- package/agents/update/update-single-document.yaml +1 -2
- package/agents/update/user-review-document.mjs +8 -6
- package/agents/utils/analyze-feedback-intent.yaml +29 -0
- package/agents/utils/choose-docs.mjs +16 -6
- package/agents/utils/find-item-by-path.mjs +4 -2
- package/agents/utils/load-sources.mjs +6 -6
- package/agents/utils/map-reasoning-effort-level.mjs +15 -0
- package/agents/utils/save-sidebar.mjs +12 -33
- package/agents/utils/{transform-detail-datasources.mjs → transform-detail-data-sources.mjs} +3 -3
- package/aigne.yaml +14 -3
- package/package.json +10 -9
- package/prompts/common/document/content-rules-core.md +6 -6
- package/prompts/common/document/openapi-usage-rules.md +36 -0
- package/prompts/common/document/role-and-personality.md +1 -2
- package/prompts/common/document-structure/conflict-resolution-guidance.md +2 -2
- package/prompts/common/document-structure/document-structure-rules.md +8 -8
- package/prompts/common/document-structure/output-constraints.md +3 -3
- package/prompts/detail/custom/custom-code-block.md +36 -1
- package/prompts/detail/custom/{custom-components.md → custom-components-usage-rules.md} +29 -7
- package/prompts/detail/d2-diagram/pre-check.md +23 -0
- package/prompts/detail/d2-diagram/rules.md +44 -29
- package/prompts/detail/d2-diagram/system-prompt.md +0 -14
- package/prompts/detail/d2-diagram/user-prompt.md +10 -1
- package/prompts/detail/generate/document-rules.md +3 -3
- package/prompts/detail/generate/system-prompt.md +2 -8
- package/prompts/detail/generate/user-prompt.md +13 -60
- package/prompts/detail/update/system-prompt.md +3 -8
- package/prompts/detail/update/user-prompt.md +9 -5
- package/prompts/evaluate/document.md +0 -4
- package/prompts/structure/check-document-structure.md +4 -4
- package/prompts/structure/generate/system-prompt.md +0 -1
- package/prompts/structure/generate/user-prompt.md +21 -18
- package/prompts/structure/review/structure-review-system.md +24 -16
- package/prompts/structure/update/system-prompt.md +0 -13
- package/prompts/structure/update/user-prompt.md +6 -5
- package/prompts/translate/translate-document.md +3 -3
- package/prompts/utils/analyze-feedback-intent.md +55 -0
- package/utils/constants/index.mjs +38 -0
- package/utils/deploy.mjs +3 -1
- package/utils/docs-finder-utils.mjs +37 -3
- package/utils/file-utils.mjs +97 -0
- package/utils/load-config.mjs +19 -0
|
@@ -37,19 +37,13 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
|
|
|
37
37
|
Documentation content generation rules:
|
|
38
38
|
{% include "./document-rules.md" %}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
{% include "../custom/custom-components.md" %}
|
|
40
|
+
{% include "../custom/custom-components-usage-rules.md" %}
|
|
42
41
|
|
|
43
42
|
Custom code block generation rules:
|
|
44
43
|
{% include "../custom/custom-code-block.md" %}
|
|
45
44
|
|
|
46
|
-
{% include "../d2-diagram/guide.md" %}
|
|
47
|
-
|
|
48
45
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
49
46
|
|
|
50
|
-
Tool result usage rules:
|
|
51
|
-
- Only use the `"role": "tool"` result as the datasource for document enhancement.
|
|
52
|
-
- Do not include `"role": "agent"` content in the final output.
|
|
53
47
|
|
|
54
48
|
</content_generation_rules>
|
|
55
49
|
|
|
@@ -58,7 +52,7 @@ Tool result usage rules:
|
|
|
58
52
|
<output_constraints>
|
|
59
53
|
|
|
60
54
|
1. Output the complete Markdown content for {{nodeName}}, only the content itself—no explanations or extra information.
|
|
61
|
-
2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to
|
|
55
|
+
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>`.
|
|
62
56
|
3. Output in {{locale}} language, ensuring clarity, conciseness, and well-organized structure.
|
|
63
57
|
4. Do not include any self-introduction or conversational text. Output only the documentation content itself.
|
|
64
58
|
|
|
@@ -2,87 +2,47 @@
|
|
|
2
2
|
{{ locale }}
|
|
3
3
|
</user_locale>
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
<user_rules>
|
|
7
6
|
{{ rules }}
|
|
8
7
|
|
|
9
|
-
** Output content in {{ locale }} language **
|
|
10
|
-
</user_rules>
|
|
8
|
+
** Output content in {{ locale }} language. **
|
|
11
9
|
|
|
12
10
|
|
|
11
|
+
</user_rules>
|
|
12
|
+
|
|
13
13
|
{% set operation_type = "generating" %}
|
|
14
14
|
{% include "../../common/document/user-preferences.md" %}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{{ detailDataSources }}
|
|
16
|
+
<detail_data_source>
|
|
17
|
+
{{ detailDataSource }}
|
|
19
18
|
|
|
20
19
|
{{ additionalInformation }}
|
|
21
20
|
|
|
21
|
+
{% if assetsContent %}
|
|
22
22
|
<media_file_list>
|
|
23
23
|
{{ assetsContent }}
|
|
24
24
|
</media_file_list>
|
|
25
|
+
{% endif %}
|
|
25
26
|
|
|
27
|
+
</detail_data_source>
|
|
26
28
|
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{% if openAPISpec %}
|
|
31
|
-
<openapi>
|
|
32
|
-
|
|
33
|
-
**Goal:** Use the provided OpenAPI (Swagger) specification, align it with the current page objective, and leverage it to refine this document.
|
|
34
|
-
|
|
35
|
-
**OpenAPI File Content:**
|
|
36
|
-
<openapi_doc>
|
|
37
|
-
|
|
38
|
-
{{ openAPISpec }}
|
|
39
|
-
|
|
40
|
-
</openapi_doc>
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
### **Documentation Requirements and Constraints**
|
|
45
|
-
|
|
46
|
-
1. **Extract the core content:**
|
|
47
|
-
* Organize the document by functional modules.
|
|
48
|
-
* For each path item, include the following elements:
|
|
49
|
-
* HTTP method and path.
|
|
50
|
-
* Concise summary.
|
|
51
|
-
* Detailed description.
|
|
52
|
-
* Request parameters: name, location (`in`), type, required flag, description.
|
|
53
|
-
* Request body: describe its structure when present.
|
|
54
|
-
* Responses: at least the key status codes (e.g., 200, 201, 400, 500) and their schemas.
|
|
55
|
-
|
|
56
|
-
2. **Mandatory API description constraints (deduplication rule):**
|
|
57
|
-
* **Ensure that throughout the document (including preface, overview, etc.), any introduction to the project APIs appears only within this OpenAPI-generated "API reference" section.**
|
|
58
|
-
* **Never** repeat or expand the interface list elsewhere in the document (for example, "Quick Start" or "Architecture Overview" sections).
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
**Expected output format:** A concise, clear, and easy-to-scan Markdown document.
|
|
63
|
-
|
|
64
|
-
</openapi>
|
|
65
|
-
{% endif %}
|
|
66
|
-
|
|
30
|
+
{% include "../../common/document/openapi-usage-rules.md" %}
|
|
67
31
|
|
|
68
32
|
{% include "./detail-example.md" %}
|
|
69
33
|
|
|
70
|
-
|
|
71
34
|
{% if content %}
|
|
72
|
-
|
|
73
|
-
<last_content>
|
|
35
|
+
<previous_generation_content>
|
|
74
36
|
{{content}}
|
|
75
|
-
</
|
|
37
|
+
</previous_generation_content>
|
|
76
38
|
{% endif %}
|
|
77
39
|
|
|
78
|
-
|
|
79
40
|
{% if detailFeedback %}
|
|
80
41
|
<content_review_feedback>
|
|
81
42
|
{{ detailFeedback }}
|
|
82
43
|
</content_review_feedback>
|
|
83
44
|
{% endif %}
|
|
84
45
|
|
|
85
|
-
|
|
86
46
|
{% if feedback %}
|
|
87
47
|
User feedback on previous generation:
|
|
88
48
|
<feedback>
|
|
@@ -90,19 +50,12 @@ User feedback on previous generation:
|
|
|
90
50
|
</feedback>
|
|
91
51
|
{% endif %}
|
|
92
52
|
|
|
93
|
-
|
|
94
53
|
<instructions>
|
|
95
|
-
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path),
|
|
96
|
-
|
|
97
|
-
YOU SHOULD:
|
|
98
|
-
- Use AFS tools `afs_list` `afs_search` or `afs_read` to gather relevant and accurate information to enhance the content.
|
|
99
|
-
- Follow rules in `<diagram_generation_guide>`: use `generateDiagram` tool to create and embed a diagram when appropriate, following the diagram generation guidelines.
|
|
100
|
-
- If the `generateDiagram` tool is not called, do not attempt to add any diagrams.
|
|
54
|
+
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path), `<detail_data_source>`, `<document_structure>` (overall structural planning), and other relevant information.
|
|
101
55
|
|
|
102
56
|
<steps>
|
|
103
57
|
1. Analyze the provided document structure and user requirements to plan the content.
|
|
104
58
|
2. Use AFS tools (`afs_list`/`afs_search`/`afs_read`) to search and gather relevant and accurate information to enhance the content.
|
|
105
|
-
3.
|
|
106
|
-
4. Write clear, concise, and well-structured content for each section based on the planned structure and gathered information.
|
|
59
|
+
3. Write clear, concise, and well-structured content for each section based on the planned structure and gathered information.
|
|
107
60
|
</steps>
|
|
108
61
|
</instructions>
|
|
@@ -32,19 +32,14 @@ Glossary of specialized terms. Please ensure correct spelling when using these t
|
|
|
32
32
|
Documentation content optimization rules:
|
|
33
33
|
{% include "../generate/document-rules.md" %}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
{% include "../custom/custom-components.md" %}
|
|
35
|
+
{% include "../custom/custom-components-usage-rules.md" %}
|
|
37
36
|
|
|
38
37
|
Custom code block optimization rules:
|
|
39
38
|
{% include "../custom/custom-code-block.md" %}
|
|
40
39
|
|
|
41
40
|
{% include "../../common/document/media-file-list-usage-rules.md" %}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
{% include "../d2-diagram/guide.md" %}
|
|
45
|
-
<diagram_generation_rules>
|
|
46
|
-
{% include "../d2-diagram/system-prompt.md" %}
|
|
47
|
-
</diagram_generation_rules>
|
|
42
|
+
{% include "../d2-diagram/rules.md" %}
|
|
48
43
|
|
|
49
44
|
</content_optimization_rules>
|
|
50
45
|
|
|
@@ -97,7 +92,7 @@ Tool usage guidelines:
|
|
|
97
92
|
**updateDocumentContent**: Use this tool to apply changes to the document content
|
|
98
93
|
- Generate a precise unified diff patch based on the user feedback
|
|
99
94
|
- The diff should include context lines for accurate application
|
|
100
|
-
- Only consider content within
|
|
95
|
+
- Only consider content within `<page_content>` tag when calculating line numbers, ensure line number calculation is accurate
|
|
101
96
|
- Test the patch application to ensure it works correctly
|
|
102
97
|
|
|
103
98
|
Error handling:
|
|
@@ -11,21 +11,25 @@
|
|
|
11
11
|
{% set operation_type = "optimizing" %}
|
|
12
12
|
{% include "../../common/document/user-preferences.md" %}
|
|
13
13
|
|
|
14
|
-
<
|
|
14
|
+
<original_document_content>
|
|
15
15
|
{{originalContent}}
|
|
16
|
-
</
|
|
16
|
+
</original_document_content>
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
{% if needDataSources %}
|
|
19
|
+
<detail_data_source>
|
|
19
20
|
|
|
20
|
-
{{
|
|
21
|
+
{{ detailDataSource }}
|
|
21
22
|
|
|
22
23
|
{{ additionalInformation }}
|
|
23
24
|
|
|
25
|
+
{% if assetsContent %}
|
|
24
26
|
<media_file_list>
|
|
25
27
|
{{ assetsContent }}
|
|
26
28
|
</media_file_list>
|
|
29
|
+
{% endif %}
|
|
27
30
|
|
|
28
|
-
</
|
|
31
|
+
</detail_data_source>
|
|
32
|
+
{% endif %}
|
|
29
33
|
|
|
30
34
|
<user_feedback>
|
|
31
35
|
{{feedback}}
|
|
@@ -21,10 +21,6 @@ Please **strictly adhere** to the evaluation standards defined in `<standards>`
|
|
|
21
21
|
{{ content }}
|
|
22
22
|
</document_content>
|
|
23
23
|
|
|
24
|
-
<document_translation>
|
|
25
|
-
{{ translationsString }}
|
|
26
|
-
</document_translation>
|
|
27
|
-
|
|
28
24
|
<document_content_plan>
|
|
29
25
|
{{ description }}
|
|
30
26
|
</document_content_plan>
|
|
@@ -38,9 +38,9 @@ This is the primary scenario. You must perform a detailed comparison.
|
|
|
38
38
|
|
|
39
39
|
**Step-by-step Analysis**:
|
|
40
40
|
1. **Analyze Feedback**: Carefully read and understand each change request in the user feedback. Identify which nodes need to be modified, added, or deleted.
|
|
41
|
-
2. **Verify Feedback Implementation**: Confirm that all requested changes have been executed in
|
|
42
|
-
3. **Verify Unrelated Node Stability**: This is the most critical check. Iterate through all nodes in
|
|
43
|
-
* **Critical**: Its `path` and `sourcesIds` attributes **must** be identical to those in
|
|
41
|
+
2. **Verify Feedback Implementation**: Confirm that all requested changes have been executed in `<document_structure>`. For example, if feedback requests "remove the 'Examples' section," you must verify that this section no longer exists in `<document_structure>`.
|
|
42
|
+
3. **Verify Unrelated Node Stability**: This is the most critical check. Iterate through all nodes in `<document_structure>`. For each node that exists in `<original_document_structure>` but was not mentioned in the feedback:
|
|
43
|
+
* **Critical**: Its `path` and `sourcesIds` attributes **must** be identical to those in `<original_document_structure>`.
|
|
44
44
|
* 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.
|
|
45
45
|
</quality_control_rules>
|
|
46
46
|
|
|
@@ -90,4 +90,4 @@ Your output must be a valid JSON object containing `isValid` and `reason`, retur
|
|
|
90
90
|
"reason": "Initial documentation structure generation with no previous version for comparison."
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
|
-
</output_constraints>
|
|
93
|
+
</output_constraints>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<
|
|
1
|
+
<data_sources>
|
|
2
2
|
Following are the partial or complete data sources provided by the user to help you design the document structure. Use these data sources to inform your structural planning.
|
|
3
3
|
|
|
4
|
-
{{
|
|
4
|
+
{{ dataSourceChunk }}
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
NOTICE: There are additional data source contents not displayed. When operating on the document structure, be sure to consider these undisplayed contents and do not easily delete any nodes unless users explicitly request deletion.
|
|
8
|
-
</
|
|
8
|
+
</data_sources>
|
|
9
9
|
|
|
10
10
|
{% if userContext.openAPISpec %}
|
|
11
11
|
<openapi>
|
|
@@ -41,15 +41,21 @@ NOTICE: There are additional data source contents not displayed. When operating
|
|
|
41
41
|
</openapi>
|
|
42
42
|
{% endif %}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
<last_document_structure>
|
|
44
|
+
<document_info>
|
|
46
45
|
projectName: |
|
|
47
46
|
{{projectName}}
|
|
47
|
+
{% if projectDesc %}
|
|
48
48
|
projectDesc: |
|
|
49
49
|
{{projectDesc}}
|
|
50
|
+
{% endif %}
|
|
51
|
+
</document_info>
|
|
52
|
+
|
|
53
|
+
<last_document_structure>
|
|
50
54
|
|
|
51
55
|
{% if originalDocumentStructure %}
|
|
52
56
|
{{ originalDocumentStructure | yaml.stringify }}
|
|
57
|
+
{% elseif userContext.originalDocumentStructure %}
|
|
58
|
+
{{ userContext.originalDocumentStructure | yaml.stringify }}
|
|
53
59
|
{% else %}
|
|
54
60
|
No previous document structure provided. generate a new structure based on the data sources!
|
|
55
61
|
{% endif %}
|
|
@@ -95,7 +101,7 @@ The current process is planning sub-structures for the following section:
|
|
|
95
101
|
{{parentDocument}}
|
|
96
102
|
|
|
97
103
|
Sub-structures must meet the following requirements:
|
|
98
|
-
- Sub-structures are planned based on
|
|
104
|
+
- Sub-structures are planned based on `<data_sources>` and the parent document's description
|
|
99
105
|
- The parent document provides an overview of the planned content, while sub-structures directly plan the specific content to be displayed
|
|
100
106
|
- Further break down and comprehensively display the content planned in the parent document
|
|
101
107
|
- All sub-structures must have their parentPath value set to {{parentDocument.path}}
|
|
@@ -106,7 +112,7 @@ Sub-structures must meet the following requirements:
|
|
|
106
112
|
Your task is to **analyze, refine, and adjust** the existing document structure (`last_document_structure`) based on the partial code repository content currently provided, generating a structural update plan.
|
|
107
113
|
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.
|
|
108
114
|
|
|
109
|
-
## When using
|
|
115
|
+
## When using `<data_sources>` data sources, please note the following:
|
|
110
116
|
|
|
111
117
|
- Fully respect the project descriptions and usage instructions in README files, as these typically summarize the project's core functionality and objectives.
|
|
112
118
|
- Pay attention to comments and docstrings in source code files, as these reveal the design intent and usage methods of the code.
|
|
@@ -117,19 +123,16 @@ You are not creating a structure from scratch, but rather **performing intellige
|
|
|
117
123
|
|
|
118
124
|
## Objective
|
|
119
125
|
|
|
120
|
-
Your output should
|
|
126
|
+
Your output should contain a `structures` array with document structure items that need to be added or updated:
|
|
127
|
+
|
|
128
|
+
- **structures**: Array of document structure items representing incremental changes to the existing document structure. Each item should include a `path` field - the system will automatically replace existing items with matching paths or add new items if the path doesn't exist.
|
|
121
129
|
|
|
122
|
-
|
|
123
|
-
- `index` (optional): Insertion position index, if not specified, append to the end;
|
|
124
|
-
- `item`: New structure definition
|
|
125
|
-
- **update**: Structure items that need modification (array), each item is an object containing:
|
|
126
|
-
- `path`: Path pointing to the node being updated;
|
|
127
|
-
- `update`: New structure definition
|
|
130
|
+
IMPORTANT: You should avoid duplicating existing structure items. Only include items that are genuinely new or need updates. The system will automatically merge these changes with the existing document structure based on the `path` field.
|
|
128
131
|
|
|
129
132
|
## Behavior Rules
|
|
130
133
|
|
|
131
134
|
1. **Understanding and Inheritance**
|
|
132
|
-
- Fully understand the hierarchical logic, section divisions, and naming style in
|
|
135
|
+
- Fully understand the hierarchical logic, section divisions, and naming style in `<last_document_structure>`.
|
|
133
136
|
- Perform incremental updates based on this foundation, not complete rewrites.
|
|
134
137
|
- Preserve existing reasonable structures, only modify or extend when there is clear justification.
|
|
135
138
|
|
|
@@ -138,8 +141,8 @@ Your output should be a structured change plan containing the following three se
|
|
|
138
141
|
- Identify which parts represent new concepts, APIs, modules, configurations, or features; determine if they require adding or modifying corresponding sections in the document structure.
|
|
139
142
|
|
|
140
143
|
3. **Structure Adjustment Strategy**
|
|
141
|
-
- If new content supplements details of existing sections,
|
|
142
|
-
- If new content introduces new topics, modules, or hierarchies,
|
|
144
|
+
- If new content supplements details of existing sections, include the updated item in the `structures` array with the same path.
|
|
145
|
+
- If new content introduces new topics, modules, or hierarchies, include new items in the `structures` array with new paths.
|
|
143
146
|
- Ensure the position, hierarchy, and naming of new nodes align with the overall document logic.
|
|
144
147
|
|
|
145
148
|
4. **Consistency and Clarity**
|
|
@@ -150,7 +153,7 @@ Your output should be a structured change plan containing the following three se
|
|
|
150
153
|
- Maintain clear hierarchy, avoid duplication, ensure logical coherence. Excellent documentation should allow users to quickly understand project structure and content distribution, organized by modules, functional features, and other dimensions.
|
|
151
154
|
|
|
152
155
|
5. **Requirements**
|
|
153
|
-
- Follow all rules and guidelines in
|
|
156
|
+
- Follow all rules and guidelines in `<document_structure_rules>`.
|
|
154
157
|
- Generate rich document structure where functional modules must have sub-documents, comprehensively covering the codebase's functionality and modules, ensuring users can easily get started, understand, and use various modules and main features of the project through documentation.
|
|
155
158
|
|
|
156
159
|
{% include "../../common/document-structure/intj-traits.md" %}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
<role_and_goal>
|
|
2
|
-
You are
|
|
3
|
-
|
|
2
|
+
You are a **Documentation Structure Refiner** with the analytical mindset of an **INTJ (The Architect)**. You combine expert knowledge in technical documentation architecture and information design with strategic thinking, systematic analysis, and perfectionist attention to detail. Your core strengths are understanding complex systems, creating logically sound blueprints, and anticipating future documentation challenges.
|
|
4
3
|
</role_and_goal>
|
|
5
4
|
|
|
6
|
-
<
|
|
5
|
+
<document_info>
|
|
7
6
|
projectName: |
|
|
8
7
|
{{projectName}}
|
|
8
|
+
{% if projectDesc %}
|
|
9
9
|
projectDesc: |
|
|
10
10
|
{{projectDesc}}
|
|
11
|
+
{% endif %}
|
|
12
|
+
</document_info>
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
<document_structure>
|
|
13
15
|
{{ documentStructure | yaml.stringify }}
|
|
14
16
|
</document_structure>
|
|
15
17
|
|
|
16
18
|
<instructions>
|
|
17
|
-
You are a Documentation Structure Refiner — an expert in technical documentation architecture and information design.
|
|
18
19
|
|
|
19
20
|
Your task:
|
|
20
21
|
Given an existing document structure (a JSON array or tree of sections), refine and optimize its **hierarchy and order** to improve clarity, usability, and conventional organization.
|
|
21
|
-
️ You must not add
|
|
22
|
+
️ You must not add or rename any nodes. You may delete nodes when necessary for better organization and adjust the **order** and **nesting levels** of existing nodes.
|
|
22
23
|
|
|
23
24
|
---
|
|
24
25
|
|
|
@@ -35,11 +36,11 @@ Given an existing document structure (a JSON array or tree of sections), refine
|
|
|
35
36
|
- “Overview” and “Quick Start” should have **1–2 levels max**.
|
|
36
37
|
- Remove deeply nested technical details from “Overview” or “Quick Start”.
|
|
37
38
|
- Relocate such details under “Architecture”, “API Reference”, or “Modules”.
|
|
38
|
-
-
|
|
39
|
+
- Keep beneficial nodes — you may delete duplicated, redundant, or harmful nodes when needed for clarity.
|
|
39
40
|
|
|
40
41
|
3. **Grouping and Alignment**
|
|
41
42
|
- Align similar nodes logically (e.g., group “Usage”, “Examples”, “Tutorials” together).
|
|
42
|
-
- Avoid duplication or overlap by reordering
|
|
43
|
+
- Avoid duplication or overlap by reordering or strategic deletion when necessary.
|
|
43
44
|
|
|
44
45
|
4. **Naming and Identity**
|
|
45
46
|
- You are **not allowed to rename or reword** any section titles or descriptions.
|
|
@@ -55,19 +56,26 @@ Given an existing document structure (a JSON array or tree of sections), refine
|
|
|
55
56
|
## Behavior Rules
|
|
56
57
|
|
|
57
58
|
- Do **not** add new nodes.
|
|
58
|
-
-
|
|
59
|
+
- You **may** delete nodes when they are redundant, duplicated, or detrimental to documentation clarity.
|
|
59
60
|
- Do **not** rename or rewrite content.
|
|
60
61
|
- You **may** move nodes to different parents or reorder siblings to achieve better logical flow.
|
|
61
|
-
- You **must** maintain
|
|
62
|
-
- The
|
|
62
|
+
- You **must** maintain structural integrity for all remaining nodes.
|
|
63
|
+
- The output must be a complete, valid document structure array matching the expected schema.
|
|
63
64
|
|
|
64
65
|
---
|
|
65
66
|
|
|
66
67
|
## Objective
|
|
67
68
|
|
|
68
|
-
Output a
|
|
69
|
-
1.
|
|
70
|
-
2.
|
|
71
|
-
3.
|
|
72
|
-
4.
|
|
69
|
+
Output a complete `structures` array containing the optimized document structure:
|
|
70
|
+
1. Include ALL nodes from the input structure (whether modified or not)
|
|
71
|
+
2. Each item must include: `id`, `title`, `description`, `path`, `parentPath` (if not top-level)
|
|
72
|
+
3. Apply your optimizations through proper ordering, hierarchy changes, and selective deletion
|
|
73
|
+
4. Maintain all required fields and ensure paths are valid (start with /, no spaces/special chars)
|
|
74
|
+
5. **Important**: Only modify structural aspects (`id`, `title`, `description`, `path`, `parentPath`). Do NOT modify `sourceIds` or other data fields
|
|
75
|
+
|
|
76
|
+
**Optimization Approach:**
|
|
77
|
+
- Reorder nodes by adjusting their position in the array
|
|
78
|
+
- Change hierarchy by modifying `parentPath` values (use the path of the new parent node)
|
|
79
|
+
- Delete problematic nodes by simply omitting them from the output array
|
|
80
|
+
- Keep beneficial nodes with their original content intact
|
|
73
81
|
</instructions>
|
|
@@ -90,17 +90,4 @@ Analyze the user feedback to determine the intended operation:
|
|
|
90
90
|
</operation_output_constraints>
|
|
91
91
|
</operation_execution_rules>
|
|
92
92
|
|
|
93
|
-
<file_tool_usage>
|
|
94
|
-
1. glob: Find files matching specific patterns with advanced filtering and sorting.
|
|
95
|
-
|
|
96
|
-
2. grep: Search file contents using regular expressions with multiple strategies (git grep → system grep → JavaScript fallback).
|
|
97
|
-
|
|
98
|
-
3. readFile: Read file contents with intelligent binary detection, pagination, and metadata extraction.
|
|
99
|
-
|
|
100
|
-
When to use Tools:
|
|
101
|
-
- During document structure update, if the given context is missing or lacks referenced content, use glob/grep/readFile to obtain more context
|
|
102
|
-
- When sourceIds or file content from <file_list> is needed but not provided in DataSources, use readFile to read the file content
|
|
103
|
-
</file_tool_usage>
|
|
104
|
-
|
|
105
|
-
|
|
106
93
|
{% include "../../common/document-structure/output-constraints.md" %}
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
{{allFilesPaths}}
|
|
7
7
|
</file_list>
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
{% if needDataSources %}
|
|
10
|
+
<data_sources>
|
|
11
|
+
{{ dataSourceChunk }}
|
|
12
|
+
</data_sources>
|
|
13
|
+
{% endif %}
|
|
13
14
|
|
|
14
15
|
Initial Documentation Structure:
|
|
15
16
|
<initial_document_structure>
|
|
@@ -38,5 +39,5 @@ Processing workflow:
|
|
|
38
39
|
|
|
39
40
|
Rules:
|
|
40
41
|
** All changes must be made using Tools. **
|
|
41
|
-
** Carefully check if the latest version of
|
|
42
|
+
** Carefully check if the latest version of `<document_structure>` data meets user requirements, must avoid duplicate Tool calls. **
|
|
42
43
|
</instructions>
|
|
@@ -5,10 +5,10 @@ You are an **Elite Polyglot Localization and Translation Specialist** with exten
|
|
|
5
5
|
Core Mandates:
|
|
6
6
|
|
|
7
7
|
1. Semantic Fidelity (Accuracy): The translation must perfectly and comprehensively convey the **entire meaning, tone, and nuance** of the source text. **No omission, addition, or distortion of the original content** is permitted.
|
|
8
|
-
2. Native Fluency and Style: The resulting text must adhere strictly to the target language's **grammar, syntax, and idiomatic expressions**. The translation must **sound like it was originally written by a native speaker**, completely **free of grammatical errors
|
|
8
|
+
2. Native Fluency and Style: The resulting text must adhere strictly to the target language's **grammar, syntax, and idiomatic expressions**. The translation must **sound like it was originally written by a native speaker**, completely **free of grammatical errors**, avoid "translationese" (literal, stiff, or unnatural phrasing).
|
|
9
9
|
3. Readability and Flow: The final output must be **smooth, logical, and highly readable**. Sentences must flow naturally, ensuring a pleasant and coherent reading experience for the target audience.
|
|
10
10
|
4. Localization and Clarity: Where a **literal (word-for-word) translation** of a term, phrase, or idiom would be **uncommon, confusing, or ambiguous** in the target language, you must apply **localization best practices**. This means translating the **concept** into the most **idiomatic, common, and easily understandable expression** in the target language.
|
|
11
|
-
5. Versatility and Scope: You are proficient in handling **any pair of requested languages** (e.g., Chinese
|
|
11
|
+
5. Versatility and Scope: You are proficient in handling **any pair of requested languages** (e.g., Chinese <--> English, English <--> Japanese) and are adept at translating diverse **document types**, including but not limited to: **Technical Manuals, Business Reports, Marketing Copy/Ads, Legal Documents, Academic Papers, and General Correspondence.**
|
|
12
12
|
|
|
13
13
|
</role_and_goal>
|
|
14
14
|
|
|
@@ -299,5 +299,5 @@ Original text as follows:
|
|
|
299
299
|
</content>
|
|
300
300
|
|
|
301
301
|
<output_constraints>
|
|
302
|
-
Please **accurately** translate the content within
|
|
302
|
+
Please **accurately** translate the content within `<content>` tags (excluding the outermost `<content>` tags) into **{{ language }}**, strictly following the translation requirements.
|
|
303
303
|
</output_constraints>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a feedback intent analyzer. Your task is to determine whether data sources are needed to fulfill the user's feedback about content modifications.
|
|
3
|
+
</role>
|
|
4
|
+
|
|
5
|
+
<input>
|
|
6
|
+
- feedback: {{feedback}}
|
|
7
|
+
</input>
|
|
8
|
+
|
|
9
|
+
<analysis_rules>
|
|
10
|
+
**Determining Data Source Necessity:**
|
|
11
|
+
|
|
12
|
+
You need to analyze the user's feedback and categorize it into different intent types. Based on the intent type, determine if data sources are required.
|
|
13
|
+
|
|
14
|
+
This analyzer is generic and can be used for any content modification scenarios (documentation structure, document content, translations, etc.).
|
|
15
|
+
|
|
16
|
+
**Intent Types:**
|
|
17
|
+
|
|
18
|
+
1. **add** - Adding new items, sections, or content
|
|
19
|
+
- Requires data sources: **YES**
|
|
20
|
+
- Reason: Need sufficient context from codebase or related materials to generate accurate new content
|
|
21
|
+
|
|
22
|
+
2. **edit** - Modifying existing content, descriptions, titles, or properties
|
|
23
|
+
- Requires data sources: **YES**
|
|
24
|
+
- Reason: Need context to ensure modifications are accurate and contextually appropriate
|
|
25
|
+
|
|
26
|
+
3. **delete** - Removing items, sections, or content
|
|
27
|
+
- Requires data sources: **NO**
|
|
28
|
+
- Reason: Deletion only needs to identify what to remove, no new content generation needed
|
|
29
|
+
|
|
30
|
+
4. **move** - Moving items to different positions or parent sections
|
|
31
|
+
- Requires data sources: **NO**
|
|
32
|
+
- Reason: Only changing item location in the structure, no content changes needed
|
|
33
|
+
|
|
34
|
+
5. **reorder** - Changing the order of items at the same level
|
|
35
|
+
- Requires data sources: **NO**
|
|
36
|
+
- Reason: Only rearranging sequence, no content generation needed
|
|
37
|
+
|
|
38
|
+
6. **mixed** - Combination of multiple intent types
|
|
39
|
+
- Requires data sources: **Depends on whether add/edit operations are included**
|
|
40
|
+
- Reason: If the feedback includes any add or edit operations, data sources are needed
|
|
41
|
+
|
|
42
|
+
**Decision Logic:**
|
|
43
|
+
- If the feedback contains ANY add or edit operations → `needDataSources = true`
|
|
44
|
+
- If the feedback ONLY contains delete, move, or reorder operations → `needDataSources = false`
|
|
45
|
+
- When in doubt, default to `needDataSources = true` to ensure sufficient context
|
|
46
|
+
</analysis_rules>
|
|
47
|
+
|
|
48
|
+
<output_rules>
|
|
49
|
+
Return a JSON object with:
|
|
50
|
+
- `needDataSources`: boolean indicating if data sources are required
|
|
51
|
+
- `intentType`: the primary intent type (add, edit, delete, move, reorder, or mixed)
|
|
52
|
+
- `reason`: clear explanation of why data sources are or aren't needed
|
|
53
|
+
|
|
54
|
+
Analyze the feedback carefully and be conservative - when uncertain, prefer `needDataSources: true` to ensure sufficient context is available.
|
|
55
|
+
</output_rules>
|
|
@@ -549,3 +549,41 @@ export const DOC_SMITH_DIR = ".aigne/doc-smith";
|
|
|
549
549
|
export const TMP_DIR = ".tmp";
|
|
550
550
|
export const TMP_DOCS_DIR = "docs";
|
|
551
551
|
export const TMP_ASSETS_DIR = "assets";
|
|
552
|
+
|
|
553
|
+
export const DOC_ACTION = {
|
|
554
|
+
translate: "translate",
|
|
555
|
+
update: "update",
|
|
556
|
+
clear: "clear",
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
// Default thinking effort level, available options: 'lite', 'standard', 'pro'
|
|
560
|
+
// This level can be defined by the user in the config file to influence reasoning effort mapping
|
|
561
|
+
export const DEFAULT_THINKING_EFFORT_LEVEL = "standard";
|
|
562
|
+
|
|
563
|
+
// Default reasoning effort level, available options: 'minimal', 'low', 'medium', 'high'
|
|
564
|
+
export const DEFAULT_REASONING_EFFORT_LEVEL = "low";
|
|
565
|
+
|
|
566
|
+
export const DEFAULT_REASONING_EFFORT_VALUE = 500;
|
|
567
|
+
|
|
568
|
+
export const REASONING_EFFORT_LEVELS = {
|
|
569
|
+
minimal: {
|
|
570
|
+
lite: 100,
|
|
571
|
+
standard: 300,
|
|
572
|
+
pro: 500,
|
|
573
|
+
},
|
|
574
|
+
low: {
|
|
575
|
+
lite: 200,
|
|
576
|
+
standard: 500,
|
|
577
|
+
pro: 1000,
|
|
578
|
+
},
|
|
579
|
+
medium: {
|
|
580
|
+
lite: 300,
|
|
581
|
+
standard: 800,
|
|
582
|
+
pro: 1500,
|
|
583
|
+
},
|
|
584
|
+
high: {
|
|
585
|
+
lite: 500,
|
|
586
|
+
standard: 1000,
|
|
587
|
+
pro: 2000,
|
|
588
|
+
},
|
|
589
|
+
};
|
package/utils/deploy.mjs
CHANGED
|
@@ -31,6 +31,7 @@ export async function deploy(id, cachedUrl) {
|
|
|
31
31
|
const result = await client.deploy({
|
|
32
32
|
cachedCheckoutId: id,
|
|
33
33
|
cachedPaymentUrl: cachedUrl,
|
|
34
|
+
needShortUrl: true,
|
|
34
35
|
pageInfo: { successMessage: SUCCESS_MESSAGE },
|
|
35
36
|
hooks: {
|
|
36
37
|
[STEPS.PAYMENT_PENDING]: async ({ sessionId, paymentUrl, isResuming }) => {
|
|
@@ -71,7 +72,7 @@ export async function deploy(id, cachedUrl) {
|
|
|
71
72
|
},
|
|
72
73
|
});
|
|
73
74
|
|
|
74
|
-
const { appUrl, homeUrl, subscriptionUrl, dashboardUrl, vendors } = result;
|
|
75
|
+
const { appUrl, homeUrl, subscriptionUrl, dashboardUrl, vendors, sessionId } = result;
|
|
75
76
|
const token = vendors?.[0]?.token;
|
|
76
77
|
|
|
77
78
|
return {
|
|
@@ -80,5 +81,6 @@ export async function deploy(id, cachedUrl) {
|
|
|
80
81
|
dashboardUrl,
|
|
81
82
|
subscriptionUrl,
|
|
82
83
|
token,
|
|
84
|
+
sessionId,
|
|
83
85
|
};
|
|
84
86
|
}
|