@aigne/doc-smith 0.8.11-beta.4 → 0.8.11-beta.6

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 (118) hide show
  1. package/.aigne/doc-smith/config.yaml +2 -4
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +17 -2
  4. package/README.md +1 -1
  5. package/agents/clear/choose-contents.mjs +2 -2
  6. package/agents/clear/clear-document-structure.mjs +8 -8
  7. package/agents/clear/index.yaml +1 -1
  8. package/agents/evaluate/document-structure.yaml +1 -1
  9. package/agents/generate/check-d2-diagram-valid.mjs +26 -0
  10. package/agents/generate/check-document-structure.yaml +3 -3
  11. package/agents/generate/check-need-generate-structure.mjs +8 -8
  12. package/agents/generate/document-structure-tools/add-document.mjs +3 -3
  13. package/agents/generate/document-structure-tools/delete-document.mjs +2 -2
  14. package/agents/generate/document-structure-tools/move-document.mjs +3 -2
  15. package/agents/generate/document-structure-tools/update-document.mjs +2 -2
  16. package/agents/generate/generate-d2-diagram.yaml +23 -0
  17. package/agents/generate/generate-structure.yaml +1 -1
  18. package/agents/generate/merge-d2-diagram.yaml +39 -0
  19. package/agents/generate/update-document-structure.yaml +3 -3
  20. package/agents/generate/user-review-document-structure.mjs +10 -10
  21. package/agents/init/index.mjs +18 -10
  22. package/agents/publish/publish-docs.mjs +17 -20
  23. package/agents/update/batch-generate-document.yaml +1 -1
  24. package/agents/update/check-document.mjs +2 -2
  25. package/agents/update/generate-document.yaml +25 -0
  26. package/agents/utils/check-feedback-refiner.mjs +1 -1
  27. package/agents/utils/choose-docs.mjs +1 -1
  28. package/agents/utils/load-document-all-content.mjs +3 -3
  29. package/agents/utils/load-sources.mjs +1 -1
  30. package/agents/utils/save-docs.mjs +7 -28
  31. package/aigne.yaml +2 -2
  32. package/docs/_sidebar.md +1 -1
  33. package/docs/advanced-how-it-works.md +3 -3
  34. package/docs/advanced-quality-assurance.md +1 -1
  35. package/docs/cli-reference.ja.md +151 -80
  36. package/docs/cli-reference.md +126 -55
  37. package/docs/cli-reference.zh-TW.md +133 -62
  38. package/docs/cli-reference.zh.md +143 -72
  39. package/docs/configuration-interactive-setup.md +1 -1
  40. package/docs/configuration-language-support.md +1 -1
  41. package/docs/configuration-preferences.md +1 -1
  42. package/docs/configuration.ja.md +104 -48
  43. package/docs/configuration.md +58 -2
  44. package/docs/configuration.zh-TW.md +99 -42
  45. package/docs/configuration.zh.md +78 -21
  46. package/docs/features-generate-documentation.ja.md +63 -44
  47. package/docs/features-generate-documentation.md +54 -35
  48. package/docs/features-generate-documentation.zh-TW.md +67 -48
  49. package/docs/features-generate-documentation.zh.md +61 -41
  50. package/docs/features-publish-your-docs.ja.md +69 -46
  51. package/docs/features-publish-your-docs.md +65 -42
  52. package/docs/features-publish-your-docs.zh-TW.md +73 -50
  53. package/docs/features-publish-your-docs.zh.md +67 -44
  54. package/docs/features-translate-documentation.ja.md +35 -33
  55. package/docs/features-translate-documentation.md +24 -22
  56. package/docs/features-translate-documentation.zh-TW.md +32 -30
  57. package/docs/features-translate-documentation.zh.md +29 -27
  58. package/docs/features-update-and-refine.ja.md +120 -66
  59. package/docs/features-update-and-refine.md +110 -56
  60. package/docs/features-update-and-refine.zh-TW.md +116 -62
  61. package/docs/features-update-and-refine.zh.md +118 -64
  62. package/docs/getting-started.ja.md +22 -22
  63. package/docs/getting-started.md +1 -1
  64. package/docs/getting-started.zh-TW.md +16 -16
  65. package/docs/getting-started.zh.md +28 -28
  66. package/docs/overview.md +3 -3
  67. package/docs-mcp/analyze-docs-relevance.yaml +6 -6
  68. package/docs-mcp/docs-search.yaml +1 -1
  69. package/package.json +3 -3
  70. package/prompts/common/document-structure/conflict-resolution-guidance.md +3 -3
  71. package/prompts/common/document-structure/document-structure-rules.md +2 -2
  72. package/prompts/detail/{d2-chart/rules.md → d2-diagram/rules-system.md} +41 -5
  73. package/prompts/detail/d2-diagram/rules-user.md +4 -0
  74. package/prompts/detail/document-rules.md +3 -4
  75. package/prompts/detail/generate-document.md +8 -2
  76. package/prompts/detail/update-document.md +0 -2
  77. package/prompts/evaluate/document-structure.md +6 -6
  78. package/prompts/structure/check-document-structure.md +10 -10
  79. package/prompts/structure/document-rules.md +2 -2
  80. package/prompts/structure/generate-structure-system.md +3 -3
  81. package/prompts/structure/structure-example.md +1 -1
  82. package/prompts/structure/structure-getting-started.md +1 -1
  83. package/prompts/structure/update-document-structure.md +9 -9
  84. package/prompts/utils/feedback-refiner.md +1 -1
  85. package/tests/agents/clear/choose-contents.test.mjs +1 -1
  86. package/tests/agents/clear/clear-document-structure.test.mjs +36 -30
  87. package/tests/agents/evaluate/generate-report.test.mjs +1 -1
  88. package/tests/agents/generate/check-need-generate-structure.test.mjs +1 -1
  89. package/tests/agents/generate/document-structure-tools/add-document.test.mjs +2 -2
  90. package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +4 -4
  91. package/tests/agents/generate/document-structure-tools/move-document.test.mjs +3 -3
  92. package/tests/agents/generate/document-structure-tools/update-document.test.mjs +3 -3
  93. package/tests/agents/generate/user-review-document-structure.test.mjs +7 -5
  94. package/tests/agents/init/init.test.mjs +25 -19
  95. package/tests/agents/publish/publish-docs.test.mjs +99 -0
  96. package/tests/agents/update/check-document.test.mjs +1 -1
  97. package/tests/agents/utils/check-detail-result.test.mjs +2 -15
  98. package/tests/agents/utils/format-document-structure.test.mjs +5 -5
  99. package/tests/agents/utils/load-sources.test.mjs +4 -4
  100. package/tests/agents/utils/save-docs.test.mjs +1 -1
  101. package/tests/utils/auth-utils.test.mjs +1 -1
  102. package/tests/utils/conflict-detector.test.mjs +1 -1
  103. package/tests/utils/d2-utils.test.mjs +4 -4
  104. package/tests/utils/deploy.test.mjs +3 -10
  105. package/tests/utils/docs-finder-utils.test.mjs +8 -8
  106. package/tests/utils/kroki-utils.test.mjs +5 -5
  107. package/tests/utils/preferences-utils.test.mjs +5 -3
  108. package/tests/utils/save-value-to-config.test.mjs +3 -1
  109. package/types/document-structure-schema.mjs +9 -9
  110. package/utils/auth-utils.mjs +4 -0
  111. package/utils/conflict-detector.mjs +1 -1
  112. package/utils/constants/index.mjs +7 -4
  113. package/utils/d2-utils.mjs +11 -6
  114. package/utils/deploy.mjs +4 -20
  115. package/utils/docs-finder-utils.mjs +11 -11
  116. package/utils/kroki-utils.mjs +5 -4
  117. package/utils/markdown-checker.mjs +1 -21
  118. /package/prompts/detail/{d2-chart → d2-diagram}/official-examples.md +0 -0
@@ -66,9 +66,7 @@ translateLanguages:
66
66
  docsDir: ./docs # Directory to save generated documentation
67
67
  sourcesPath: # Source code paths to analyze
68
68
  - ./
69
- lastGitHead: f3f14b93e6b2e6beb42b2f368c2560ab050dfd03
70
- appUrl: https://docsmith.aigne.io
69
+ lastGitHead: 6fc5d715e778663896ae179975ec72d9e5ff97ed
71
70
  # āš ļø Warning: boardId is auto-generated by system, please do not edit manually
72
71
  boardId: "docsmith"
73
- # Checkout ID for document deployment service
74
- checkoutId: ""
72
+ appUrl: https://docsmith.aigne.io
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.8.11-beta.4"
2
+ ".": "0.8.11-beta.6"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.11-beta.6](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.11-beta.5...v0.8.11-beta.6) (2025-10-02)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * release 0.8.11-beta.6 ([ecc8f5c](https://github.com/AIGNE-io/aigne-doc-smith/commit/ecc8f5c4ff9cc813e5cf7e35cbfdb915826cd183))
9
+
10
+ ## [0.8.11-beta.5](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.11-beta.4...v0.8.11-beta.5) (2025-10-01)
11
+
12
+
13
+ ### Features
14
+
15
+ * add user role requirement for publish and custom rule support ([#151](https://github.com/AIGNE-io/aigne-doc-smith/issues/151)) ([95866f9](https://github.com/AIGNE-io/aigne-doc-smith/commit/95866f9fcb2ca697da42e950e9011b29913726d4))
16
+ * split d2 diagram generate as independent tool ([#152](https://github.com/AIGNE-io/aigne-doc-smith/issues/152)) ([8e9b811](https://github.com/AIGNE-io/aigne-doc-smith/commit/8e9b811dc6108bb19ab8a1853afb4cab92af1d62))
17
+
3
18
  ## [0.8.11-beta.4](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.11-beta.3...v0.8.11-beta.4) (2025-09-30)
4
19
 
5
20
 
@@ -71,7 +86,7 @@
71
86
  ### Bug Fixes
72
87
 
73
88
  * polish code test ([#122](https://github.com/AIGNE-io/aigne-doc-smith/issues/122)) ([0629705](https://github.com/AIGNE-io/aigne-doc-smith/commit/0629705ebd271282411d507421c1ba5dd01473b9))
74
- * update document structure review prompts and display ([#119](https://github.com/AIGNE-io/aigne-doc-smith/issues/119)) ([e2d99db](https://github.com/AIGNE-io/aigne-doc-smith/commit/e2d99db83ff3a6266b32dd450a79b6e000aff09e))
89
+ * update documentation structure review prompts and display ([#119](https://github.com/AIGNE-io/aigne-doc-smith/issues/119)) ([e2d99db](https://github.com/AIGNE-io/aigne-doc-smith/commit/e2d99db83ff3a6266b32dd450a79b6e000aff09e))
75
90
  * update usage rules for field elements ([#120](https://github.com/AIGNE-io/aigne-doc-smith/issues/120)) ([434f161](https://github.com/AIGNE-io/aigne-doc-smith/commit/434f161ab7dd989d57ca670f36d0828c09abe38a))
76
91
 
77
92
  ## [0.8.10-beta.1](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.10-beta...v0.8.10-beta.1) (2025-09-18)
@@ -79,7 +94,7 @@
79
94
 
80
95
  ### Features
81
96
 
82
- * support document structure review workflow ([#117](https://github.com/AIGNE-io/aigne-doc-smith/issues/117)) ([ec7ae80](https://github.com/AIGNE-io/aigne-doc-smith/commit/ec7ae80b26a1b66928bddef7ac401f633a0f5a2b))
97
+ * support documentation structure review workflow ([#117](https://github.com/AIGNE-io/aigne-doc-smith/issues/117)) ([ec7ae80](https://github.com/AIGNE-io/aigne-doc-smith/commit/ec7ae80b26a1b66928bddef7ac401f633a0f5a2b))
83
98
 
84
99
 
85
100
  ### Bug Fixes
package/README.md CHANGED
@@ -45,7 +45,7 @@ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https
45
45
 
46
46
  - **AIGNE Hub Integration**: Use [AIGNE Hub](https://www.aigne.io/en/hub) without API keys, switch between Google Gemini, OpenAI GPT, Claude, and more
47
47
  - **Multiple LLM Support**: Bring your own API keys for OpenAI, Anthropic, Google, and other providers
48
- - **Discuss Kit Publishing**: Deploy to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.web3kit.rocks/discuss-kit) instance
48
+ - **One-Click Publishing**: Make your docs live and generate shareable links for your team - publish to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.web3kit.rocks/discuss-kit) instance
49
49
 
50
50
  ### šŸ”„ Smart Updates
51
51
 
@@ -5,8 +5,8 @@ const TARGET_METADATA = {
5
5
  agent: "clearGeneratedDocs",
6
6
  },
7
7
  documentStructure: {
8
- label: "document structure",
9
- description: "Delete the document structure and all generated documents.",
8
+ label: "documentation structure",
9
+ description: "Delete the documentation structure and all generated documents.",
10
10
  agent: "clearDocumentStructure",
11
11
  },
12
12
  documentConfig: {
@@ -20,8 +20,8 @@ export default async function clearDocumentStructure(input = {}, _options = {})
20
20
 
21
21
  const structureDisplayPath = toDisplayPath(structurePlanPath);
22
22
  const structureMessage = structureExists
23
- ? `Cleared document structure plan (${structureDisplayPath})`
24
- : `Document structure plan already empty (${structureDisplayPath})`;
23
+ ? `Cleared documentation structure (${structureDisplayPath})`
24
+ : `Documentation structure already empty (${structureDisplayPath})`;
25
25
 
26
26
  results.push({
27
27
  type: "structure",
@@ -33,7 +33,7 @@ export default async function clearDocumentStructure(input = {}, _options = {})
33
33
  results.push({
34
34
  type: "structure",
35
35
  error: true,
36
- message: `Failed to clear document structure plan: ${error.message}`,
36
+ message: `Failed to clear documentation structure: ${error.message}`,
37
37
  });
38
38
  }
39
39
 
@@ -69,11 +69,11 @@ export default async function clearDocumentStructure(input = {}, _options = {})
69
69
 
70
70
  let header;
71
71
  if (errorItems > 0) {
72
- header = "Document structure cleanup finished with some issues.";
72
+ header = "Documentation Structure cleanup finished with some issues.";
73
73
  } else if (clearedItems > 0) {
74
- header = "Document structure cleared successfully!";
74
+ header = "Documentation Structure cleared successfully!";
75
75
  } else {
76
- header = "Document structure already empty.";
76
+ header = "Documentation Structure already empty.";
77
77
  }
78
78
 
79
79
  const detailLines = results.map((item) => `- ${item.message}`).join("\n");
@@ -101,6 +101,6 @@ clearDocumentStructure.input_schema = {
101
101
  },
102
102
  };
103
103
 
104
- clearDocumentStructure.taskTitle = "Clear document structure and all generated documents";
104
+ clearDocumentStructure.taskTitle = "Clear documentation structure and all generated documents";
105
105
  clearDocumentStructure.description =
106
- "Clear the document structure plan (structure-plan.json) and optionally the documents directory";
106
+ "Clear the documentation structure (structure-plan.json) and optionally the documents directory";
@@ -2,7 +2,7 @@ type: team
2
2
  name: clear
3
3
  alias:
4
4
  - clear
5
- description: Clear various types of data including document structure, generated documents, configuration, and authorization tokens
5
+ description: Clear various types of data including documentation structure, generated documents, configuration, and authorization tokens
6
6
  skills:
7
7
  - url: ../init/index.mjs
8
8
  default_input:
@@ -11,7 +11,7 @@ input_schema:
11
11
  properties:
12
12
  documentStructureYaml:
13
13
  type: string
14
- description: Document structure planning
14
+ description: Documentation structure data
15
15
  purposes:
16
16
  type: string
17
17
  description: User-selected document goals
@@ -0,0 +1,26 @@
1
+ import { checkContent } from "../../utils/d2-utils.mjs";
2
+
3
+ export default async function checkD2DiagramIsValid({ d2DiagramSourceCode }) {
4
+ try {
5
+ await checkContent({ content: d2DiagramSourceCode });
6
+ return {
7
+ isValid: true,
8
+ };
9
+ } catch (err) {
10
+ return {
11
+ isValid: false,
12
+ error: err.message,
13
+ };
14
+ }
15
+ }
16
+
17
+ checkD2DiagramIsValid.input_schema = {
18
+ type: "object",
19
+ properties: {
20
+ d2DiagramSourceCode: {
21
+ type: "string",
22
+ description: "Source code of d2 diagram",
23
+ },
24
+ },
25
+ required: ["d2DiagramSourceCode"],
26
+ };
@@ -1,5 +1,5 @@
1
1
  name: checkDocumentStructure
2
- description: Check the Document Structure to ensure it meets expectations, especially in scenarios with previous generation results and user feedback.
2
+ description: Check the Documentation Structure to ensure it meets expectations, especially in scenarios with previous generation results and user feedback.
3
3
  instructions:
4
4
  url: ../../prompts/structure/check-document-structure.md
5
5
  input_schema:
@@ -7,10 +7,10 @@ input_schema:
7
7
  properties:
8
8
  documentStructure:
9
9
  $ref: ../schema/document-structure.yaml
10
- description: Newly generated document structure.
10
+ description: Newly generated documentation structure.
11
11
  originalDocumentStructure:
12
12
  $ref: ../schema/document-structure.yaml
13
- description: Previous generation's document structure for comparison. If it doesn't exist, the check passes by default.
13
+ description: Previous generation's documentation structure for comparison. If it doesn't exist, the check passes by default.
14
14
  feedback:
15
15
  type: string
16
16
  description: User feedback provided for the previous generation's results.
@@ -18,10 +18,10 @@ export default async function checkNeedGenerateStructure(
18
18
  if (!originalDocumentStructure) {
19
19
  const choice = await options.prompts.select({
20
20
  message:
21
- "Your project configuration is complete. Would you like to generate the document structure now?",
21
+ "Your project configuration is complete. Would you like to generate the documentation structure now?",
22
22
  choices: [
23
23
  {
24
- name: "Generate now - Start generating the document structure",
24
+ name: "Generate now - Start generating the documentation structure",
25
25
  value: "generate",
26
26
  },
27
27
  {
@@ -49,7 +49,7 @@ export default async function checkNeedGenerateStructure(
49
49
  }
50
50
  }
51
51
 
52
- // Check if we need to regenerate document structure
52
+ // Check if we need to regenerate documentation structure
53
53
  let shouldRegenerate = false;
54
54
  let finalFeedback = feedback;
55
55
 
@@ -82,7 +82,7 @@ export default async function checkNeedGenerateStructure(
82
82
  finalFeedback = `
83
83
  ${finalFeedback || ""}
84
84
 
85
- Update document structure based on the latest DataSources:
85
+ Update documentation structure based on the latest DataSources:
86
86
  1. For new content, add new sections as needed or supplement existing section displays
87
87
  2. Be cautious when deleting sections, unless all associated sourceIds have been removed
88
88
  3. Do not modify the path of existing sections
@@ -97,11 +97,11 @@ export default async function checkNeedGenerateStructure(
97
97
  finalFeedback = `
98
98
  ${finalFeedback || ""}
99
99
 
100
- User requested forced regeneration of document structure. Please regenerate based on the latest Data Sources and user requirements, **allowing any modifications**.
100
+ User requested forced regeneration of documentation structure. Please regenerate based on the latest Data Sources and user requirements, **allowing any modifications**.
101
101
  `;
102
102
  }
103
103
 
104
- // If no regeneration needed, return original document structure
104
+ // If no regeneration needed, return original documentation structure
105
105
  if (originalDocumentStructure && !finalFeedback && !shouldRegenerate) {
106
106
  return {
107
107
  documentStructure: originalDocumentStructure,
@@ -110,7 +110,7 @@ export default async function checkNeedGenerateStructure(
110
110
 
111
111
  const planningAgent = options.context.agents["refineDocumentStructure"];
112
112
 
113
- // Get user preferences for document structure and global scope
113
+ // Get user preferences for documentation structure and global scope
114
114
  const structureRules = getActiveRulesForScope("structure", []);
115
115
  const globalRules = getActiveRulesForScope("global", []);
116
116
 
@@ -185,4 +185,4 @@ export default async function checkNeedGenerateStructure(
185
185
  };
186
186
  }
187
187
 
188
- checkNeedGenerateStructure.taskTitle = "Check if document structure needs generate or update";
188
+ checkNeedGenerateStructure.taskTitle = "Check if documentation structure needs generate or update";
@@ -41,7 +41,7 @@ export default async function addDocument(input) {
41
41
  sourceIds: [...sourceIds], // Create a copy of the array
42
42
  };
43
43
 
44
- // Add the new document to the document structure
44
+ // Add the document to the structure
45
45
  const updatedStructure = [...documentStructure, newDocument];
46
46
 
47
47
  return {
@@ -50,7 +50,7 @@ export default async function addDocument(input) {
50
50
  };
51
51
  }
52
52
 
53
- addDocument.taskTitle = "Add new document";
54
- addDocument.description = "Add a new document to the document structure";
53
+ addDocument.taskTitle = "Add document";
54
+ addDocument.description = "Add a document to the documentation structure";
55
55
  addDocument.inputSchema = getAddDocumentInputJsonSchema();
56
56
  addDocument.outputSchema = getAddDocumentOutputJsonSchema();
@@ -34,7 +34,7 @@ export default async function deleteDocument(input) {
34
34
  return { documentStructure };
35
35
  }
36
36
 
37
- // Remove the document from the document structure
37
+ // Remove the document from the structure
38
38
  const updatedStructure = documentStructure.filter((_, index) => index !== documentIndex);
39
39
 
40
40
  return {
@@ -44,6 +44,6 @@ export default async function deleteDocument(input) {
44
44
  }
45
45
 
46
46
  deleteDocument.taskTitle = "Delete document";
47
- deleteDocument.description = "Delete a document from the document structure";
47
+ deleteDocument.description = "Remove a document from the documentation structure";
48
48
  deleteDocument.inputSchema = getDeleteDocumentInputJsonSchema();
49
49
  deleteDocument.outputSchema = getDeleteDocumentOutputJsonSchema();
@@ -65,7 +65,7 @@ export default async function moveDocument(input) {
65
65
  parentId: newParentId || null,
66
66
  };
67
67
 
68
- // Update the document structure
68
+ // Update the document's position in the structure
69
69
  const updatedStructure = [...documentStructure];
70
70
  updatedStructure[documentIndex] = updatedDocument;
71
71
 
@@ -77,6 +77,7 @@ export default async function moveDocument(input) {
77
77
  }
78
78
 
79
79
  moveDocument.taskTitle = "Move document";
80
- moveDocument.description = "Move a document to a different parent in the document structure";
80
+ moveDocument.description =
81
+ "Relocate a document to a different parent in the documentation structure";
81
82
  moveDocument.inputSchema = getMoveDocumentInputJsonSchema();
82
83
  moveDocument.outputSchema = getMoveDocumentOutputJsonSchema();
@@ -33,7 +33,7 @@ export default async function updateDocument(input) {
33
33
  ...(sourceIds !== undefined && { sourceIds: [...sourceIds] }), // Create a copy of the array
34
34
  };
35
35
 
36
- // Update the document structure
36
+ // Update the document in the structure
37
37
  const updatedStructure = [...documentStructure];
38
38
  updatedStructure[documentIndex] = updatedDocument;
39
39
 
@@ -45,6 +45,6 @@ export default async function updateDocument(input) {
45
45
  }
46
46
 
47
47
  updateDocument.taskTitle = "Update document";
48
- updateDocument.description = "Update properties of an existing document in the document structure";
48
+ updateDocument.description = "Modify properties of a document in the documentation structure";
49
49
  updateDocument.inputSchema = getUpdateDocumentInputJsonSchema();
50
50
  updateDocument.outputSchema = getUpdateDocumentOutputJsonSchema();
@@ -0,0 +1,23 @@
1
+ name: drawD2Diagram
2
+ description: Generate a D2 diagram from document content.
3
+ instructions:
4
+ - role: system
5
+ url: ../../prompts/detail/d2-diagram/rules-system.md
6
+ - role: user
7
+ url: ../../prompts/detail/d2-diagram/rules-user.md
8
+ input_schema:
9
+ type: object
10
+ properties:
11
+ documentContent:
12
+ type: string
13
+ description: Source code of current document (without the D2 diagram)
14
+ required:
15
+ - documentContent
16
+ output_schema:
17
+ type: object
18
+ properties:
19
+ d2DiagramSourceCode:
20
+ type: string
21
+ description: Source code to draw D2 diagram
22
+ required:
23
+ - d2DiagramSourceCode
@@ -13,7 +13,7 @@ input_schema:
13
13
  description: Primary language for documentation (e.g., zh, en, ja)
14
14
  datasources:
15
15
  type: string
16
- description: Project content and context to help generate document structure
16
+ description: Project content and context to help generate documentation structure
17
17
  targetAudience:
18
18
  type: string
19
19
  description: Target audience for the documentation
@@ -0,0 +1,39 @@
1
+ name: mergeD2DiagramToDocument
2
+ description: Merge D2 Diagram source code into document
3
+ instructions: |
4
+ You are an AI assistant that helps to merge d2 diagram into document.
5
+
6
+ <datasources>
7
+ {{ content }}
8
+ </datasources>
9
+ <datasources>
10
+ {{ d2DiagramSourceCode }}
11
+ </datasources>
12
+
13
+ Given the source content of a document and the D2 diagram source code, your task is to:
14
+ - **Keep the original content as soon as possible.**
15
+ - D2 diagram source code should wrap by ```d2 and ``` in markdown format.
16
+ - Should find proper position to insert the D2 diagram in the document, usually after the first paragraph or after the section that describes the diagram.
17
+ - If there is no suitable position, append it to the end of the document.
18
+ - If there is no D2 diagram source code, return the original document content without any changes.
19
+ input_schema:
20
+ type: object
21
+ properties:
22
+ content:
23
+ type: string
24
+ description: Source content of the document
25
+ d2DiagramSourceCode:
26
+ type: string
27
+ description: Source content of D2 Diagram
28
+ required:
29
+ - content
30
+ - d2DiagramSourceCode
31
+ output_schema:
32
+ type: object
33
+ properties:
34
+ content:
35
+ type: string
36
+ description: Merged content of the document with D2 diagram
37
+ required:
38
+ - content
39
+
@@ -1,6 +1,6 @@
1
1
  type: ai
2
2
  name: updateDocumentStructure
3
- description: Update document structure based on user feedback and intentions using structure modification tools
3
+ description: Update documentation structure based on user feedback and intentions using structure modification tools
4
4
  instructions:
5
5
  url: ../../prompts/structure/update-document-structure.md
6
6
  input_schema:
@@ -15,7 +15,7 @@ input_schema:
15
15
  description: User language, e.g. zh, en
16
16
  datasources:
17
17
  type: string
18
- description: Context for document structure
18
+ description: Context for documentation structure
19
19
  glossary:
20
20
  type: string
21
21
  description: Glossary of terms
@@ -34,7 +34,7 @@ output_schema:
34
34
  documentStructure: ../schema/document-structure.yaml
35
35
  operationSummary:
36
36
  type: string
37
- description: Summary of the operations performed on the document structure
37
+ description: Summary of the operations performed on the documentation structure
38
38
  skills:
39
39
  - ./document-structure-tools/add-document.mjs
40
40
  - ./document-structure-tools/delete-document.mjs
@@ -48,13 +48,13 @@ function formatDocumentStructure(structure) {
48
48
 
49
49
  function printDocumentStructure(structure) {
50
50
  console.log(`\n ${"-".repeat(50)}`);
51
- console.log(" Current Document Structure");
51
+ console.log(" Current Documentation Structure");
52
52
  console.log(` ${"-".repeat(50)}`);
53
53
 
54
54
  const { rootNodes, printNode } = formatDocumentStructure(structure);
55
55
 
56
56
  if (rootNodes.length === 0) {
57
- console.log(" No document structure found.");
57
+ console.log(" No documentation structure found.");
58
58
  } else {
59
59
  rootNodes.forEach((node) => {
60
60
  printNode(node);
@@ -64,19 +64,19 @@ function printDocumentStructure(structure) {
64
64
  }
65
65
 
66
66
  export default async function userReviewDocumentStructure({ documentStructure, ...rest }, options) {
67
- // Check if document structure exists
67
+ // Check if documentation structure exists
68
68
  if (!documentStructure || !Array.isArray(documentStructure) || documentStructure.length === 0) {
69
- console.log("No document structure was generated to review.");
69
+ console.log("No documentation structure was generated to review.");
70
70
  return { documentStructure };
71
71
  }
72
72
 
73
- // Print current document structure in a user-friendly format
73
+ // Print current documentation structure in a user-friendly format
74
74
  printDocumentStructure(documentStructure);
75
75
 
76
- // Ask user if they want to review the document structure
76
+ // Ask user if they want to review the documentation structure
77
77
  const needReview = await options.prompts.select({
78
78
  message:
79
- "Would you like to optimize the document structure?\n You can edit titles, reorganize sections.",
79
+ "Would you like to optimize the documentation structure?\n You can edit titles, reorganize sections.",
80
80
  choices: [
81
81
  {
82
82
  name: "Looks good - proceed with current structure",
@@ -117,7 +117,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
117
117
  const refineAgent = options.context.agents["updateDocumentStructure"];
118
118
  if (!refineAgent) {
119
119
  console.log(
120
- "Unable to process your feedback - the document structure update feature is unavailable.",
120
+ "Unable to process your feedback - the documentation structure update feature is unavailable.",
121
121
  );
122
122
  console.log("Please try again later or contact support if this continues.");
123
123
  break;
@@ -157,7 +157,7 @@ export default async function userReviewDocumentStructure({ documentStructure, .
157
157
  }
158
158
  }
159
159
 
160
- // Print current document structure in a user-friendly format
160
+ // Print current documentation structure in a user-friendly format
161
161
  printDocumentStructure(currentStructure);
162
162
  } catch (error) {
163
163
  console.error("Error processing your feedback:");
@@ -172,4 +172,4 @@ export default async function userReviewDocumentStructure({ documentStructure, .
172
172
  return { documentStructure: currentStructure };
173
173
  }
174
174
 
175
- userReviewDocumentStructure.taskTitle = "User review and modify document structure";
175
+ userReviewDocumentStructure.taskTitle = "User review and modify documentation structure";
@@ -76,7 +76,7 @@ export default async function init(
76
76
 
77
77
  // 1. Primary purpose - what's the main outcome you want readers to achieve?
78
78
  const purposeChoices = await options.prompts.checkbox({
79
- message: "šŸ“ [1/8]: What should your documentation help readers achieve?",
79
+ message: "šŸ“ [1/9]: What should your documentation help readers achieve?",
80
80
  choices: Object.entries(DOCUMENT_STYLES)
81
81
  .filter(([key]) => key !== "custom") // Remove custom option for multiselect
82
82
  .map(([key, style]) => ({
@@ -124,7 +124,7 @@ export default async function init(
124
124
 
125
125
  // 2. Target audience - who will be reading this most often?
126
126
  const audienceChoices = await options.prompts.checkbox({
127
- message: "šŸ‘„ [2/8]: Who will be reading your documentation?",
127
+ message: "šŸ‘„ [2/9]: Who will be reading your documentation?",
128
128
  choices: Object.entries(TARGET_AUDIENCES)
129
129
  .filter(([key]) => key !== "custom") // Remove custom option for multiselect
130
130
  .map(([key, audience]) => ({
@@ -143,7 +143,15 @@ export default async function init(
143
143
  // Save target audience choices as keys
144
144
  input.targetAudienceTypes = audienceChoices;
145
145
 
146
- // 3. Reader knowledge level - what do readers typically know when they arrive?
146
+ // 3. Custom rules - any specific requirements for the documentation?
147
+ const rulesInput = await options.prompts.input({
148
+ message:
149
+ "šŸ“‹ [3/9]: Any custom rules or requirements for your documentation? (Optional, press Enter to skip)",
150
+ default: "",
151
+ });
152
+ input.rules = rulesInput.trim();
153
+
154
+ // 4. Reader knowledge level - what do readers typically know when they arrive?
147
155
  // Determine default based on selected purposes using mapping
148
156
  const mappedPurpose = prioritizedPurposes.find(
149
157
  (purpose) => PURPOSE_TO_KNOWLEDGE_MAPPING[purpose],
@@ -158,7 +166,7 @@ export default async function init(
158
166
  );
159
167
 
160
168
  const knowledgeChoice = await options.prompts.select({
161
- message: "🧠 [3/8]: How much do readers already know about your project?",
169
+ message: "🧠 [4/9]: How much do readers already know about your project?",
162
170
  choices: Object.entries(filteredKnowledgeOptions).map(([key, level]) => ({
163
171
  name: `${level.name}`,
164
172
  description: level.description,
@@ -203,7 +211,7 @@ export default async function init(
203
211
  );
204
212
 
205
213
  const depthChoice = await options.prompts.select({
206
- message: "šŸ“Š [4/8]: How detailed should your documentation be?",
214
+ message: "šŸ“Š [5/9]: How detailed should your documentation be?",
207
215
  choices: Object.entries(filteredDepthOptions).map(([key, depth]) => ({
208
216
  name: `${depth.name}`,
209
217
  description: depth.description,
@@ -221,7 +229,7 @@ export default async function init(
221
229
 
222
230
  // Let user select primary language from supported list
223
231
  const primaryLanguageChoice = await options.prompts.select({
224
- message: "🌐 [5/8]: What's your main documentation language?",
232
+ message: "🌐 [6/9]: What's your main documentation language?",
225
233
  choices: SUPPORTED_LANGUAGES.map((lang) => ({
226
234
  name: `${lang.label} - ${lang.sample}`,
227
235
  value: lang.code,
@@ -238,7 +246,7 @@ export default async function init(
238
246
  );
239
247
 
240
248
  const translateLanguageChoices = await options.prompts.checkbox({
241
- message: "šŸ”„ [6/8]: Which languages should we translate to?",
249
+ message: "šŸ”„ [7/9]: Which languages should we translate to?",
242
250
  choices: availableTranslationLanguages.map((lang) => ({
243
251
  name: `${lang.label} - ${lang.sample}`,
244
252
  value: lang.code,
@@ -249,13 +257,13 @@ export default async function init(
249
257
 
250
258
  // 7. Documentation directory
251
259
  const docsDirInput = await options.prompts.input({
252
- message: `šŸ“ [7/8]: Where should we save your documentation?`,
260
+ message: `šŸ“ [8/9]: Where should we save your documentation?`,
253
261
  default: `${outputPath}/docs`,
254
262
  });
255
263
  input.docsDir = docsDirInput.trim() || `${outputPath}/docs`;
256
264
 
257
265
  // 8. Content sources
258
- console.log("\nšŸ” [8/8]: Content Sources");
266
+ console.log("\nšŸ” [9/9]: Content Sources");
259
267
  console.log(
260
268
  "What folders/files should we analyze for documentation? (e.g., ./src, ./docs, ./README.md)",
261
269
  );
@@ -400,7 +408,7 @@ export function generateYAML(input) {
400
408
  documentationDepth: input.documentationDepth || "",
401
409
 
402
410
  // Custom rules and target audience (empty for user to fill)
403
- rules: "",
411
+ rules: input.rules || "",
404
412
  targetAudience: "",
405
413
 
406
414
  // Language settings