@aigne/doc-smith 0.6.0 → 0.7.1

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 (80) hide show
  1. package/.aigne/doc-smith/config.yaml +70 -0
  2. package/.aigne/doc-smith/output/structure-plan.json +152 -0
  3. package/.aigne/doc-smith/preferences.yml +31 -0
  4. package/.aigne/doc-smith/upload-cache.yaml +288 -0
  5. package/.github/workflows/ci.yml +46 -0
  6. package/.github/workflows/reviewer.yml +2 -1
  7. package/CHANGELOG.md +17 -0
  8. package/README.md +33 -15
  9. package/agents/chat.yaml +30 -0
  10. package/agents/check-structure-plan.mjs +1 -1
  11. package/agents/docs-fs.yaml +25 -0
  12. package/agents/exit.mjs +6 -0
  13. package/agents/feedback-refiner.yaml +5 -1
  14. package/agents/find-items-by-paths.mjs +10 -4
  15. package/agents/fs.mjs +60 -0
  16. package/agents/input-generator.mjs +150 -91
  17. package/agents/load-config.mjs +0 -5
  18. package/agents/load-sources.mjs +61 -8
  19. package/agents/publish-docs.mjs +27 -12
  20. package/agents/retranslate.yaml +1 -1
  21. package/agents/team-publish-docs.yaml +2 -2
  22. package/aigne.yaml +1 -0
  23. package/docs/_sidebar.md +17 -0
  24. package/docs/advanced-how-it-works.md +104 -0
  25. package/docs/advanced-how-it-works.zh.md +104 -0
  26. package/docs/advanced-quality-assurance.md +64 -0
  27. package/docs/advanced-quality-assurance.zh.md +64 -0
  28. package/docs/advanced.md +28 -0
  29. package/docs/advanced.zh.md +28 -0
  30. package/docs/changelog.md +272 -0
  31. package/docs/changelog.zh.md +272 -0
  32. package/docs/cli-reference.md +185 -0
  33. package/docs/cli-reference.zh.md +185 -0
  34. package/docs/configuration-interactive-setup.md +82 -0
  35. package/docs/configuration-interactive-setup.zh.md +82 -0
  36. package/docs/configuration-language-support.md +64 -0
  37. package/docs/configuration-language-support.zh.md +64 -0
  38. package/docs/configuration-llm-setup.md +90 -0
  39. package/docs/configuration-llm-setup.zh.md +90 -0
  40. package/docs/configuration-preferences.md +122 -0
  41. package/docs/configuration-preferences.zh.md +123 -0
  42. package/docs/configuration.md +173 -0
  43. package/docs/configuration.zh.md +173 -0
  44. package/docs/features-generate-documentation.md +82 -0
  45. package/docs/features-generate-documentation.zh.md +82 -0
  46. package/docs/features-publish-your-docs.md +98 -0
  47. package/docs/features-publish-your-docs.zh.md +98 -0
  48. package/docs/features-translate-documentation.md +83 -0
  49. package/docs/features-translate-documentation.zh.md +83 -0
  50. package/docs/features-update-and-refine.md +86 -0
  51. package/docs/features-update-and-refine.zh.md +86 -0
  52. package/docs/features.md +56 -0
  53. package/docs/features.zh.md +56 -0
  54. package/docs/getting-started.md +74 -0
  55. package/docs/getting-started.zh.md +74 -0
  56. package/docs/overview.md +48 -0
  57. package/docs/overview.zh.md +48 -0
  58. package/media.md +19 -0
  59. package/package.json +13 -10
  60. package/prompts/content-detail-generator.md +7 -3
  61. package/prompts/document/custom-components.md +80 -0
  62. package/prompts/document/d2-chart/diy-examples.md +44 -0
  63. package/prompts/document/d2-chart/official-examples.md +708 -0
  64. package/prompts/document/d2-chart/rules.md +48 -0
  65. package/prompts/document/detail-generator.md +12 -15
  66. package/prompts/document/structure-planning.md +1 -3
  67. package/prompts/feedback-refiner.md +81 -60
  68. package/prompts/structure-planning.md +20 -3
  69. package/tests/check-detail-result.test.mjs +3 -4
  70. package/tests/conflict-resolution.test.mjs +237 -0
  71. package/tests/input-generator.test.mjs +940 -0
  72. package/tests/load-sources.test.mjs +627 -3
  73. package/tests/preferences-utils.test.mjs +94 -0
  74. package/tests/save-value-to-config.test.mjs +182 -5
  75. package/tests/utils.test.mjs +49 -0
  76. package/utils/conflict-detector.mjs +72 -1
  77. package/utils/constants.mjs +125 -124
  78. package/utils/kroki-utils.mjs +162 -0
  79. package/utils/markdown-checker.mjs +98 -70
  80. package/utils/utils.mjs +96 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/doc-smith",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -12,19 +12,21 @@
12
12
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@aigne/aigne-hub": "^0.6.10",
16
- "@aigne/anthropic": "^0.11.10",
17
- "@aigne/cli": "^1.41.1",
18
- "@aigne/core": "^1.55.1",
19
- "@aigne/gemini": "^0.9.10",
20
- "@aigne/openai": "^0.12.4",
21
- "@aigne/publish-docs": "^0.6.0",
15
+ "@aigne/aigne-hub": "^0.8.1",
16
+ "@aigne/anthropic": "^0.11.12",
17
+ "@aigne/cli": "^1.42.0",
18
+ "@aigne/core": "^1.57.0",
19
+ "@aigne/gemini": "^0.11.1",
20
+ "@aigne/openai": "^0.13.2",
21
+ "@aigne/publish-docs": "^0.8.0",
22
22
  "chalk": "^5.5.0",
23
23
  "dompurify": "^3.2.6",
24
+ "fs-extra": "^11.3.1",
24
25
  "glob": "^11.0.3",
25
26
  "jsdom": "^26.1.0",
26
27
  "mermaid": "^11.9.0",
27
28
  "open": "^10.2.0",
29
+ "p-map": "^7.0.3",
28
30
  "remark-gfm": "^4.0.1",
29
31
  "remark-lint": "^10.0.1",
30
32
  "remark-parse": "^11.0.0",
@@ -40,10 +42,11 @@
40
42
  },
41
43
  "scripts": {
42
44
  "test": "bun test",
45
+ "test:coverage": "bun test --coverage --coverage-reporter=lcov --coverage-reporter=text",
43
46
  "test:watch": "bun test --watch",
44
- "lint": "biome check && pnpm -r run lint",
47
+ "lint": "biome check",
45
48
  "update:deps": "npx -y taze major -r -w -f -n '/@abtnode|@aigne|@arcblock|@blocklet|@did-connect|@did-pay|@did-space|@nft-store|@nft-studio|@ocap/' && pnpm install && pnpm run deduplicate",
46
49
  "deduplicate": "pnpm dedupe",
47
- "lint:fix": "biome check --write && pnpm -r run lint"
50
+ "lint:fix": "biome check --write"
48
51
  }
49
52
  }
@@ -101,14 +101,18 @@ parentId: {{parentId}}
101
101
 
102
102
  </media_rules>
103
103
 
104
- {% include "../prompts/document/detail-generator.md" %}
104
+ {% include "document/detail-generator.md" %}
105
+
106
+ {% include "document/custom-components.md" %}
107
+
105
108
  </rules>
106
109
 
107
- {% include "../prompts/document/detail-example.md" %}
110
+ {% include "document/detail-example.md" %}
108
111
 
109
112
  <output_schema>
110
113
 
111
114
  1. 输内容为{{nodeName}}的详细文本。
112
115
  2. 直接输出{{nodeName}}内容,不要包含其他信息.
113
116
  3. 仅参考示例中的风格,**以语言 {{locale}} 输出内容 **
114
- </output_schema>
117
+
118
+ </output_schema>
@@ -0,0 +1,80 @@
1
+ When generating document details, you can use the following custom components at appropriate locations based on their descriptions and functionality to enhance document presentation:
2
+ - `<x-card>`
3
+ - `<x-cards>`
4
+
5
+
6
+ ### 1. <x-card> Single Card Component
7
+ Suitable for displaying individual links with a richer and more visually appealing presentation format.
8
+
9
+ Example:
10
+
11
+ ```
12
+ <x-card data-title="Required Title" data-image="Image URL" data-icon="Icon identifier (e.g., lucide:rocket or material-symbols:rocket-outline)" data-href="Navigation link URL" data-horizontal="true/false" data-cta="Button text" >
13
+ Card body content
14
+ </x-card>
15
+ ```
16
+
17
+ Attribute Rules:
18
+
19
+ - data-title (required): Card title.
20
+ - data-icon / data-image (choose one, at least one must be provided):
21
+ - It's recommended to always provide data-icon.
22
+ - Icons should prioritize Lucide (lucide:icon-name). If not available in Lucide, use Iconify (collection:icon-name, e.g., material-symbols:rocket-outline).
23
+ - data-image (optional): Image URL, can coexist with icon.
24
+ - data-href (optional): Navigation link for clicking the card or button.
25
+ - data-horizontal (optional): Whether to use horizontal layout.
26
+ - data-cta (optional): Button text (call to action).
27
+ - Body content: Must be written within <x-card>...</x-card> children.
28
+
29
+
30
+ ### 2. `<x-cards>` Card List Component
31
+
32
+ Suitable for displaying multiple links using a card list format, providing a richer and more visually appealing presentation.
33
+
34
+ Syntax:
35
+
36
+ ```
37
+ <x-cards data-columns="Number of columns">
38
+ <x-card data-title="Title 1" data-icon="lucide:rocket">Content 1</x-card>
39
+ <x-card data-title="Title 2" data-icon="lucide:bolt">Content 2</x-card>
40
+ <x-card data-title="Title 3" data-icon="material-symbols:rocket-outline">Content 3</x-card>
41
+ </x-cards>
42
+ ```
43
+
44
+ Attribute Rules:
45
+ - data-columns (optional): Number of columns, integer (e.g., 2, 3). Default is 2.
46
+ - Must contain multiple <x-card> elements internally.
47
+ - Consistency requirement: All <x-card> elements within the same <x-cards> must maintain visual consistency:
48
+ - Recommended to always provide data-icon for each card.
49
+ - Or all cards should have data-image.
50
+ - Avoid mixing (some with icons, some with only images).
51
+
52
+
53
+ ### 3. Examples
54
+
55
+ Single card:
56
+
57
+ ```
58
+ <x-card data-title="Horizontal card" data-icon="lucide:atom" data-horizontal="true">
59
+ This is an example of a horizontal card.
60
+ </x-card>
61
+ ```
62
+
63
+ Card list (all using icons, recommended approach):
64
+
65
+ ```
66
+ <x-cards data-columns="3">
67
+ <x-card data-title="Feature 1" data-icon="lucide:rocket">Description of Feature 1.</x-card>
68
+ <x-card data-title="Feature 2" data-icon="lucide:bolt">Description of Feature 2.</x-card>
69
+ <x-card data-title="Feature 3" data-icon="material-symbols:rocket-outline">Description of Feature 3.</x-card>
70
+ </x-cards>
71
+ ```
72
+
73
+ Card list (all using images):
74
+
75
+ ```
76
+ <x-cards data-columns="2">
77
+ <x-card data-title="Card A" data-image="https://picsum.photos/id/10/300/300">Content A</x-card>
78
+ <x-card data-title="Card B" data-image="https://picsum.photos/id/11/300/300">Content B</x-card>
79
+ </x-cards>
80
+ ```
@@ -0,0 +1,44 @@
1
+ - 结构图示例:
2
+ ```d2
3
+ App: Application
4
+ API: API Server
5
+ DB: Database
6
+
7
+ App -> API: 调用
8
+ API -> DB: 读写数据
9
+ ```
10
+ - 流程图示例:
11
+ ```d2
12
+ start: 开始
13
+ input: 用户输入
14
+ process: 处理数据
15
+ output: 输出结果
16
+ end: 结束
17
+
18
+ start -> input -> process -> output -> end
19
+ ```
20
+ - 时序图示例:
21
+ ```d2
22
+ User: 用户
23
+ Service: 服务
24
+ DB: 数据库
25
+
26
+ User -> Service: 请求
27
+ Service -> DB: 查询
28
+ DB -> Service: 返回数据
29
+ Service -> User: 响应
30
+ ```
31
+ - 决策树示例:
32
+ ```d2
33
+ start: 开始
34
+ check: 是否有效?
35
+ yes: 是
36
+ no: 否
37
+ end: 结束
38
+
39
+ start -> check
40
+ check -> yes: 有效
41
+ check -> no: 无效
42
+ yes -> end
43
+ no -> end
44
+ ```