@aigne/doc-smith 0.8.12-beta.7 → 0.8.12-beta.9
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 +25 -0
- package/agents/clear/choose-contents.mjs +14 -1
- package/agents/clear/clear-media-description.mjs +129 -0
- package/agents/clear/index.yaml +3 -1
- package/agents/evaluate/code-snippet.mjs +28 -24
- package/agents/evaluate/document-structure.yaml +0 -4
- package/agents/evaluate/document.yaml +1 -5
- package/agents/generate/index.yaml +1 -0
- package/agents/init/index.mjs +10 -0
- package/agents/media/batch-generate-media-description.yaml +44 -0
- package/agents/media/generate-media-description.yaml +47 -0
- package/agents/media/load-media-description.mjs +238 -0
- package/agents/publish/index.yaml +4 -0
- package/agents/publish/publish-docs.mjs +77 -5
- package/agents/publish/translate-meta.mjs +103 -0
- package/agents/update/generate-document.yaml +30 -28
- package/agents/update/index.yaml +1 -0
- package/agents/update/update-document-detail.yaml +3 -1
- package/agents/utils/load-sources.mjs +103 -53
- package/agents/utils/update-branding.mjs +69 -0
- package/aigne.yaml +6 -0
- package/assets/report-template/report.html +34 -34
- package/package.json +17 -2
- package/prompts/common/document/role-and-personality.md +3 -1
- package/prompts/detail/d2-diagram/guide.md +7 -1
- package/prompts/detail/d2-diagram/user-prompt.md +3 -0
- package/prompts/detail/generate/system-prompt.md +6 -7
- package/prompts/detail/generate/user-prompt.md +12 -3
- package/prompts/detail/update/user-prompt.md +0 -2
- package/prompts/evaluate/document-structure.md +6 -7
- package/prompts/evaluate/document.md +16 -25
- package/prompts/media/media-description/system-prompt.md +35 -0
- package/prompts/media/media-description/user-prompt.md +8 -0
- package/prompts/structure/update/user-prompt.md +0 -4
- package/utils/constants/index.mjs +0 -107
- package/utils/file-utils.mjs +86 -0
- package/utils/markdown-checker.mjs +0 -20
- package/utils/request.mjs +7 -0
- package/utils/upload-files.mjs +231 -0
- package/utils/utils.mjs +11 -1
- package/.aigne/doc-smith/config.yaml +0 -77
- package/.aigne/doc-smith/history.yaml +0 -37
- package/.aigne/doc-smith/output/structure-plan.json +0 -162
- package/.aigne/doc-smith/preferences.yml +0 -97
- package/.aigne/doc-smith/upload-cache.yaml +0 -1893
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -28
- package/.github/workflows/ci.yml +0 -54
- package/.github/workflows/create-release-pr.yaml +0 -21
- package/.github/workflows/publish-docs.yml +0 -65
- package/.github/workflows/release.yml +0 -49
- package/.github/workflows/reviewer.yml +0 -54
- package/.release-please-manifest.json +0 -3
- package/RELEASE.md +0 -9
- package/assets/screenshots/doc-complete-setup.png +0 -0
- package/assets/screenshots/doc-generate-docs.png +0 -0
- package/assets/screenshots/doc-generate.png +0 -0
- package/assets/screenshots/doc-generated-successfully.png +0 -0
- package/assets/screenshots/doc-publish.png +0 -0
- package/assets/screenshots/doc-regenerate.png +0 -0
- package/assets/screenshots/doc-translate-langs.png +0 -0
- package/assets/screenshots/doc-translate.png +0 -0
- package/assets/screenshots/doc-update.png +0 -0
- package/biome.json +0 -73
- package/codecov.yml +0 -15
- package/docs/_sidebar.md +0 -15
- package/docs/configuration-initial-setup.ja.md +0 -179
- package/docs/configuration-initial-setup.md +0 -179
- package/docs/configuration-initial-setup.zh-TW.md +0 -179
- package/docs/configuration-initial-setup.zh.md +0 -179
- package/docs/configuration-managing-preferences.ja.md +0 -100
- package/docs/configuration-managing-preferences.md +0 -100
- package/docs/configuration-managing-preferences.zh-TW.md +0 -100
- package/docs/configuration-managing-preferences.zh.md +0 -100
- package/docs/configuration.ja.md +0 -96
- package/docs/configuration.md +0 -96
- package/docs/configuration.zh-TW.md +0 -96
- package/docs/configuration.zh.md +0 -96
- package/docs/getting-started.ja.md +0 -88
- package/docs/getting-started.md +0 -88
- package/docs/getting-started.zh-TW.md +0 -88
- package/docs/getting-started.zh.md +0 -88
- package/docs/guides-cleaning-up.ja.md +0 -51
- package/docs/guides-cleaning-up.md +0 -51
- package/docs/guides-cleaning-up.zh-TW.md +0 -51
- package/docs/guides-cleaning-up.zh.md +0 -51
- package/docs/guides-evaluating-documents.ja.md +0 -66
- package/docs/guides-evaluating-documents.md +0 -66
- package/docs/guides-evaluating-documents.zh-TW.md +0 -66
- package/docs/guides-evaluating-documents.zh.md +0 -66
- package/docs/guides-generating-documentation.ja.md +0 -151
- package/docs/guides-generating-documentation.md +0 -151
- package/docs/guides-generating-documentation.zh-TW.md +0 -151
- package/docs/guides-generating-documentation.zh.md +0 -151
- package/docs/guides-interactive-chat.ja.md +0 -85
- package/docs/guides-interactive-chat.md +0 -85
- package/docs/guides-interactive-chat.zh-TW.md +0 -85
- package/docs/guides-interactive-chat.zh.md +0 -85
- package/docs/guides-managing-history.ja.md +0 -48
- package/docs/guides-managing-history.md +0 -48
- package/docs/guides-managing-history.zh-TW.md +0 -48
- package/docs/guides-managing-history.zh.md +0 -48
- package/docs/guides-publishing-your-docs.ja.md +0 -78
- package/docs/guides-publishing-your-docs.md +0 -78
- package/docs/guides-publishing-your-docs.zh-TW.md +0 -78
- package/docs/guides-publishing-your-docs.zh.md +0 -78
- package/docs/guides-translating-documentation.ja.md +0 -95
- package/docs/guides-translating-documentation.md +0 -95
- package/docs/guides-translating-documentation.zh-TW.md +0 -95
- package/docs/guides-translating-documentation.zh.md +0 -95
- package/docs/guides-updating-documentation.ja.md +0 -77
- package/docs/guides-updating-documentation.md +0 -77
- package/docs/guides-updating-documentation.zh-TW.md +0 -77
- package/docs/guides-updating-documentation.zh.md +0 -77
- package/docs/guides.ja.md +0 -32
- package/docs/guides.md +0 -32
- package/docs/guides.zh-TW.md +0 -32
- package/docs/guides.zh.md +0 -32
- package/docs/overview.ja.md +0 -61
- package/docs/overview.md +0 -61
- package/docs/overview.zh-TW.md +0 -61
- package/docs/overview.zh.md +0 -61
- package/docs/release-notes.ja.md +0 -255
- package/docs/release-notes.md +0 -255
- package/docs/release-notes.zh-TW.md +0 -255
- package/docs/release-notes.zh.md +0 -255
- package/media.md +0 -19
- package/prompts/common/afs/afs-tools-usage.md +0 -5
- package/prompts/common/afs/use-afs-instruction.md +0 -1
- package/release-please-config.json +0 -14
- package/tests/agents/chat/chat.test.mjs +0 -46
- package/tests/agents/clear/choose-contents.test.mjs +0 -284
- package/tests/agents/clear/clear-auth-tokens.test.mjs +0 -268
- package/tests/agents/clear/clear-document-config.test.mjs +0 -167
- package/tests/agents/clear/clear-document-structure.test.mjs +0 -380
- package/tests/agents/clear/clear-generated-docs.test.mjs +0 -222
- package/tests/agents/evaluate/code-snippet.test.mjs +0 -163
- package/tests/agents/evaluate/fixtures/api-services.md +0 -87
- package/tests/agents/evaluate/fixtures/js-sdk.md +0 -94
- package/tests/agents/evaluate/generate-report.test.mjs +0 -312
- package/tests/agents/generate/check-document-structure.test.mjs +0 -45
- package/tests/agents/generate/check-need-generate-structure.test.mjs +0 -279
- package/tests/agents/generate/document-structure-tools/add-document.test.mjs +0 -449
- package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +0 -410
- package/tests/agents/generate/document-structure-tools/generate-sub-structure.test.mjs +0 -277
- package/tests/agents/generate/document-structure-tools/move-document.test.mjs +0 -476
- package/tests/agents/generate/document-structure-tools/update-document.test.mjs +0 -548
- package/tests/agents/generate/generate-structure.test.mjs +0 -45
- package/tests/agents/generate/user-review-document-structure.test.mjs +0 -319
- package/tests/agents/history/view.test.mjs +0 -97
- package/tests/agents/init/init.test.mjs +0 -1657
- package/tests/agents/prefs/prefs.test.mjs +0 -431
- package/tests/agents/publish/publish-docs.test.mjs +0 -787
- package/tests/agents/translate/choose-language.test.mjs +0 -311
- package/tests/agents/translate/translate-document.test.mjs +0 -51
- package/tests/agents/update/check-document.test.mjs +0 -463
- package/tests/agents/update/check-update-is-single.test.mjs +0 -300
- package/tests/agents/update/document-tools/update-document-content.test.mjs +0 -329
- package/tests/agents/update/generate-document.test.mjs +0 -51
- package/tests/agents/update/save-and-translate-document.test.mjs +0 -369
- package/tests/agents/update/user-review-document.test.mjs +0 -582
- package/tests/agents/utils/action-success.test.mjs +0 -54
- package/tests/agents/utils/check-detail-result.test.mjs +0 -743
- package/tests/agents/utils/check-feedback-refiner.test.mjs +0 -478
- package/tests/agents/utils/choose-docs.test.mjs +0 -406
- package/tests/agents/utils/exit.test.mjs +0 -70
- package/tests/agents/utils/feedback-refiner.test.mjs +0 -51
- package/tests/agents/utils/find-item-by-path.test.mjs +0 -517
- package/tests/agents/utils/find-user-preferences-by-path.test.mjs +0 -382
- package/tests/agents/utils/format-document-structure.test.mjs +0 -364
- package/tests/agents/utils/fs.test.mjs +0 -267
- package/tests/agents/utils/load-sources.test.mjs +0 -1470
- package/tests/agents/utils/save-docs.test.mjs +0 -109
- package/tests/agents/utils/save-output.test.mjs +0 -315
- package/tests/agents/utils/save-single-doc.test.mjs +0 -364
- package/tests/agents/utils/transform-detail-datasources.test.mjs +0 -320
- package/tests/utils/auth-utils.test.mjs +0 -596
- package/tests/utils/blocklet.test.mjs +0 -336
- package/tests/utils/conflict-detector.test.mjs +0 -355
- package/tests/utils/constants.test.mjs +0 -295
- package/tests/utils/d2-utils.test.mjs +0 -437
- package/tests/utils/deploy.test.mjs +0 -399
- package/tests/utils/docs-finder-utils.test.mjs +0 -650
- package/tests/utils/file-utils.test.mjs +0 -521
- package/tests/utils/history-utils.test.mjs +0 -206
- package/tests/utils/kroki-utils.test.mjs +0 -646
- package/tests/utils/linter/fixtures/css/keyword-error.css +0 -1
- package/tests/utils/linter/fixtures/css/missing-semicolon.css +0 -1
- package/tests/utils/linter/fixtures/css/syntax-error.css +0 -1
- package/tests/utils/linter/fixtures/css/undeclare-variable.css +0 -1
- package/tests/utils/linter/fixtures/css/unused-variable.css +0 -2
- package/tests/utils/linter/fixtures/css/valid-code.css +0 -1
- package/tests/utils/linter/fixtures/dockerfile/keyword-error.dockerfile +0 -1
- package/tests/utils/linter/fixtures/dockerfile/missing-semicolon.dockerfile +0 -2
- package/tests/utils/linter/fixtures/dockerfile/syntax-error.dockerfile +0 -2
- package/tests/utils/linter/fixtures/dockerfile/undeclare-variable.dockerfile +0 -1
- package/tests/utils/linter/fixtures/dockerfile/unused-variable.dockerfile +0 -1
- package/tests/utils/linter/fixtures/dockerfile/valid-code.dockerfile +0 -2
- package/tests/utils/linter/fixtures/go/keyword-error.go +0 -5
- package/tests/utils/linter/fixtures/go/missing-semicolon.go +0 -5
- package/tests/utils/linter/fixtures/go/syntax-error.go +0 -6
- package/tests/utils/linter/fixtures/go/undeclare-variable.go +0 -5
- package/tests/utils/linter/fixtures/go/unused-variable.go +0 -5
- package/tests/utils/linter/fixtures/go/valid-code.go +0 -7
- package/tests/utils/linter/fixtures/js/keyword-error.js +0 -3
- package/tests/utils/linter/fixtures/js/missing-semicolon.js +0 -6
- package/tests/utils/linter/fixtures/js/syntax-error.js +0 -4
- package/tests/utils/linter/fixtures/js/undeclare-variable.js +0 -3
- package/tests/utils/linter/fixtures/js/unused-variable.js +0 -7
- package/tests/utils/linter/fixtures/js/valid-code.js +0 -15
- package/tests/utils/linter/fixtures/json/keyword-error.json +0 -1
- package/tests/utils/linter/fixtures/json/missing-semicolon.json +0 -1
- package/tests/utils/linter/fixtures/json/syntax-error.json +0 -1
- package/tests/utils/linter/fixtures/json/undeclare-variable.json +0 -1
- package/tests/utils/linter/fixtures/json/unused-variable.json +0 -1
- package/tests/utils/linter/fixtures/json/valid-code.json +0 -1
- package/tests/utils/linter/fixtures/jsx/keyword-error.jsx +0 -5
- package/tests/utils/linter/fixtures/jsx/missing-semicolon.jsx +0 -5
- package/tests/utils/linter/fixtures/jsx/syntax-error.jsx +0 -5
- package/tests/utils/linter/fixtures/jsx/undeclare-variable.jsx +0 -5
- package/tests/utils/linter/fixtures/jsx/unused-variable.jsx +0 -4
- package/tests/utils/linter/fixtures/jsx/valid-code.jsx +0 -5
- package/tests/utils/linter/fixtures/python/keyword-error.py +0 -3
- package/tests/utils/linter/fixtures/python/missing-semicolon.py +0 -2
- package/tests/utils/linter/fixtures/python/syntax-error.py +0 -3
- package/tests/utils/linter/fixtures/python/undeclare-variable.py +0 -3
- package/tests/utils/linter/fixtures/python/unused-variable.py +0 -6
- package/tests/utils/linter/fixtures/python/valid-code.py +0 -12
- package/tests/utils/linter/fixtures/ruby/keyword-error.rb +0 -2
- package/tests/utils/linter/fixtures/ruby/missing-semicolon.rb +0 -1
- package/tests/utils/linter/fixtures/ruby/syntax-error.rb +0 -2
- package/tests/utils/linter/fixtures/ruby/undeclare-variable.rb +0 -1
- package/tests/utils/linter/fixtures/ruby/unused-variable.rb +0 -2
- package/tests/utils/linter/fixtures/ruby/valid-code.rb +0 -1
- package/tests/utils/linter/fixtures/sass/keyword-error.sass +0 -2
- package/tests/utils/linter/fixtures/sass/missing-semicolon.sass +0 -3
- package/tests/utils/linter/fixtures/sass/syntax-error.sass +0 -3
- package/tests/utils/linter/fixtures/sass/undeclare-variable.sass +0 -2
- package/tests/utils/linter/fixtures/sass/unused-variable.sass +0 -4
- package/tests/utils/linter/fixtures/sass/valid-code.sass +0 -2
- package/tests/utils/linter/fixtures/scss/keyword-error.scss +0 -1
- package/tests/utils/linter/fixtures/scss/missing-semicolon.scss +0 -1
- package/tests/utils/linter/fixtures/scss/syntax-error.scss +0 -1
- package/tests/utils/linter/fixtures/scss/undeclare-variable.scss +0 -1
- package/tests/utils/linter/fixtures/scss/unused-variable.scss +0 -2
- package/tests/utils/linter/fixtures/scss/valid-code.scss +0 -1
- package/tests/utils/linter/fixtures/shell/keyword-error.sh +0 -5
- package/tests/utils/linter/fixtures/shell/missing-semicolon.sh +0 -3
- package/tests/utils/linter/fixtures/shell/syntax-error.sh +0 -4
- package/tests/utils/linter/fixtures/shell/undeclare-variable.sh +0 -3
- package/tests/utils/linter/fixtures/shell/unused-variable.sh +0 -4
- package/tests/utils/linter/fixtures/shell/valid-code.sh +0 -3
- package/tests/utils/linter/fixtures/ts/keyword-error.ts +0 -1
- package/tests/utils/linter/fixtures/ts/missing-semicolon.ts +0 -1
- package/tests/utils/linter/fixtures/ts/syntax-error.ts +0 -1
- package/tests/utils/linter/fixtures/ts/undeclare-variable.ts +0 -1
- package/tests/utils/linter/fixtures/ts/unused-variable.ts +0 -3
- package/tests/utils/linter/fixtures/ts/valid-code.ts +0 -3
- package/tests/utils/linter/fixtures/tsx/keyword-error.tsx +0 -5
- package/tests/utils/linter/fixtures/tsx/missing-semicolon.tsx +0 -5
- package/tests/utils/linter/fixtures/tsx/syntax-error.tsx +0 -5
- package/tests/utils/linter/fixtures/tsx/undeclare-variable.tsx +0 -6
- package/tests/utils/linter/fixtures/tsx/unused-variable.tsx +0 -6
- package/tests/utils/linter/fixtures/tsx/valid-code.tsx +0 -5
- package/tests/utils/linter/fixtures/vue/keyword-error.vue +0 -6
- package/tests/utils/linter/fixtures/vue/missing-semicolon.vue +0 -6
- package/tests/utils/linter/fixtures/vue/syntax-error.vue +0 -6
- package/tests/utils/linter/fixtures/vue/undeclare-variable.vue +0 -6
- package/tests/utils/linter/fixtures/vue/unused-variable.vue +0 -7
- package/tests/utils/linter/fixtures/vue/valid-code.vue +0 -6
- package/tests/utils/linter/fixtures/yaml/keyword-error.yml +0 -1
- package/tests/utils/linter/fixtures/yaml/missing-semicolon.yml +0 -2
- package/tests/utils/linter/fixtures/yaml/syntax-error.yml +0 -1
- package/tests/utils/linter/fixtures/yaml/undeclare-variable.yml +0 -1
- package/tests/utils/linter/fixtures/yaml/unused-variable.yml +0 -2
- package/tests/utils/linter/fixtures/yaml/valid-code.yml +0 -3
- package/tests/utils/linter/index.test.mjs +0 -440
- package/tests/utils/linter/scan-results.mjs +0 -42
- package/tests/utils/load-config.test.mjs +0 -141
- package/tests/utils/markdown/index.test.mjs +0 -478
- package/tests/utils/mermaid-validator.test.mjs +0 -541
- package/tests/utils/mock-chat-model.mjs +0 -12
- package/tests/utils/preferences-utils.test.mjs +0 -465
- package/tests/utils/save-value-to-config.test.mjs +0 -483
- package/tests/utils/utils.test.mjs +0 -941
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/doc-smith",
|
|
3
|
-
"version": "0.8.12-beta.
|
|
3
|
+
"version": "0.8.12-beta.9",
|
|
4
4
|
"description": "AI-driven documentation generation tool built on the AIGNE Framework",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
+
"files": [
|
|
9
|
+
"agents",
|
|
10
|
+
"assets/report-template",
|
|
11
|
+
"docs-mcp",
|
|
12
|
+
"prompts",
|
|
13
|
+
"types",
|
|
14
|
+
"utils",
|
|
15
|
+
"aigne.yaml",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"README.md",
|
|
18
|
+
"CHANGELOG.md"
|
|
19
|
+
],
|
|
8
20
|
"main": "index.js",
|
|
9
21
|
"type": "module",
|
|
10
22
|
"bin": "aigne.yaml",
|
|
@@ -18,7 +30,7 @@
|
|
|
18
30
|
"@aigne/core": "^1.61.0",
|
|
19
31
|
"@aigne/gemini": "^0.14.0",
|
|
20
32
|
"@aigne/openai": "^0.16.0",
|
|
21
|
-
"@aigne/publish-docs": "^0.
|
|
33
|
+
"@aigne/publish-docs": "^0.12.0",
|
|
22
34
|
"@blocklet/payment-broker-client": "^1.21.10",
|
|
23
35
|
"@terrastruct/d2": "^0.1.33",
|
|
24
36
|
"chalk": "^5.5.0",
|
|
@@ -29,17 +41,20 @@
|
|
|
29
41
|
"fs-extra": "^11.3.1",
|
|
30
42
|
"glob": "^11.0.3",
|
|
31
43
|
"gpt-tokenizer": "^3.2.0",
|
|
44
|
+
"image-size": "^2.0.2",
|
|
32
45
|
"isbinaryfile": "^5.0.6",
|
|
33
46
|
"jsdom": "^26.1.0",
|
|
34
47
|
"marked": "^15.0.12",
|
|
35
48
|
"marked-terminal": "^7.3.0",
|
|
36
49
|
"mermaid": "^11.9.0",
|
|
37
50
|
"open": "^10.2.0",
|
|
51
|
+
"p-limit": "^7.1.1",
|
|
38
52
|
"p-map": "^7.0.3",
|
|
39
53
|
"p-retry": "^7.0.0",
|
|
40
54
|
"remark-gfm": "^4.0.1",
|
|
41
55
|
"remark-lint": "^10.0.1",
|
|
42
56
|
"remark-parse": "^11.0.0",
|
|
57
|
+
"slugify": "^1.6.6",
|
|
43
58
|
"terminal-link": "^4.0.0",
|
|
44
59
|
"ufo": "^1.6.1",
|
|
45
60
|
"unified": "^11.0.5",
|
|
@@ -6,10 +6,12 @@ Your key strengths include:
|
|
|
6
6
|
- Versatile Writing Style: You're not confined to specific technical domains and can adapt your language style to meet diverse documentation needs—whether technical specifications, user guides, product descriptions, or business process documentation.
|
|
7
7
|
- Quality-Driven Approach: You consistently pursue top-tier documentation quality, ensuring accuracy, completeness, consistency, readability, and practicality. You pay attention to detail and strive for precision in every expression.
|
|
8
8
|
- User-Centric Perspective: You think from the target reader's viewpoint, anticipating their potential questions and confusion, addressing them proactively in the documentation to enhance user experience and value.
|
|
9
|
+
- Tool Usage Capability: You can call available tools as needed based on context to query information, gather data, or generate visuals, ensuring the documentation is accurate, complete, and visually clear.
|
|
9
10
|
|
|
10
11
|
**Your process must reflect ISTJ traits:**
|
|
11
12
|
|
|
12
13
|
1. **Fact-Driven:** Adhere strictly to the provided technical specifications. Do not infer or embellish information.
|
|
13
14
|
2. **Structured and Orderly:** Organize the content logically with clear headings, subheadings, lists, and tables. Present information sequentially where appropriate (e.g., installation steps).
|
|
14
15
|
3. **Clarity and Precision:** Use precise, unambiguous language. Define technical terms clearly. Avoid marketing jargon or emotionally charged words.
|
|
15
|
-
4. **Practical and Helpful:** Focus on providing practical examples, code snippets, and clear instructions that a user can directly apply.
|
|
16
|
+
4. **Practical and Helpful:** Focus on providing practical examples, code snippets, and clear instructions that a user can directly apply.
|
|
17
|
+
5. **Tool Utilization:** Actively call tools as needed, potentially multiple times, to obtain complete information from AFS (AIGNE File System) or generate Diagrams. Do not embed Mermaid or other diagram markup directly; include diagrams only via generateDiagram tool responses.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<diagram_generation_guide>
|
|
2
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.
|
|
3
6
|
- Architecture Diagram (High-Level)
|
|
4
7
|
- Trigger: When generating a document that serves as a high-level overview of a system, project, or the entire documentation set.
|
|
5
8
|
- Action: Create a system architecture diagram.
|
|
@@ -13,7 +16,10 @@
|
|
|
13
16
|
- Action: Create the most appropriate diagram type:
|
|
14
17
|
- Flowchart: Use for step-by-step processes, algorithms, or decision-making logic.
|
|
15
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
|
+
|
|
16
21
|
2. Constraints and Best Practices
|
|
17
22
|
- Quantity: Generate a maximum of three (3) diagrams per document to ensure the content remains focused and readable.
|
|
18
|
-
- Relevance: Ensure every diagram directly illustrates a concept explained in the surrounding text. Avoid generating diagrams for
|
|
23
|
+
- Relevance: Ensure every diagram directly illustrates a concept explained in the surrounding text. Avoid generating diagrams for concepts that are easily understood via text alone.
|
|
24
|
+
- Priority: For complex modules, workflows, or interactions, generate diagrams for each critical part.
|
|
19
25
|
</diagram_generation_guide>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<role_and_goal>
|
|
2
2
|
{% include "../../common/document/role-and-personality.md" %}
|
|
3
3
|
|
|
4
|
+
|
|
5
|
+
**Fact Verification Rule:**
|
|
6
|
+
Do not assume or infer any facts on your own. Treat all information as unknown until verified. Whenever possible, actively search and retrieve relevant, real-time information from **AFS (AIGNE File System)** or other available tools. Base your content strictly on the verified results from these searches or tool calls, rather than relying on memory or assumptions.
|
|
4
7
|
</role_and_goal>
|
|
5
8
|
|
|
6
9
|
|
|
@@ -40,11 +43,7 @@ Custom component generation rules:
|
|
|
40
43
|
Custom code block generation rules:
|
|
41
44
|
{% include "../custom/custom-code-block.md" %}
|
|
42
45
|
|
|
43
|
-
Diagram generation rules:
|
|
44
46
|
{% include "../d2-diagram/guide.md" %}
|
|
45
|
-
<diagram_generation_rules>
|
|
46
|
-
{% include "../d2-diagram/system-prompt.md" %}
|
|
47
|
-
</diagram_generation_rules>
|
|
48
47
|
|
|
49
48
|
</content_generation_rules>
|
|
50
49
|
|
|
@@ -52,8 +51,8 @@ Diagram generation rules:
|
|
|
52
51
|
|
|
53
52
|
<output_constraints>
|
|
54
53
|
|
|
55
|
-
1. Output
|
|
56
|
-
2.
|
|
57
|
-
3.
|
|
54
|
+
1. Output the complete Markdown content for {{nodeName}}, only the content itself—no explanations or extra information.
|
|
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>.
|
|
56
|
+
3. Output in {{locale}} language, ensuring clarity, conciseness, and well-organized structure.
|
|
58
57
|
|
|
59
58
|
</output_constraints>
|
|
@@ -53,9 +53,18 @@ User feedback on previous generation:
|
|
|
53
53
|
</feedback>
|
|
54
54
|
{% endif %}
|
|
55
55
|
|
|
56
|
-
{% include "../../common/afs/afs-tools-usage.md" %}
|
|
57
56
|
|
|
58
57
|
<instructions>
|
|
59
|
-
Generate detailed document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path), DataSources, documentStructure (overall structural planning), and other relevant information.
|
|
60
|
-
|
|
58
|
+
Generate detailed and well-structured document for the current {{nodeName}} based on user-provided information: current {{nodeName}} details (including title, description, path), DataSources, documentStructure (overall structural planning), and other relevant information.
|
|
59
|
+
|
|
60
|
+
YOU SHOULD:
|
|
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 <diagram_generation_guide>: use `generateDiagram` to create and embed a diagram when appropriate, following the diagram generation guidelines.
|
|
63
|
+
|
|
64
|
+
<steps>
|
|
65
|
+
1. Analyze the provided document structure and user requirements to plan the content.
|
|
66
|
+
2. Use AFS tools (`afs_list`/`afs_search`/`afs_read`) to search and gather relevant and accurate information to enhance the content.
|
|
67
|
+
3. Use `generateDiagram` to create and embed a diagram when appropriate, following the diagram generation guidelines.
|
|
68
|
+
4. Write clear, concise, and well-structured content for each section based on the planned structure and gathered information.
|
|
69
|
+
</steps>
|
|
61
70
|
</instructions>
|
|
@@ -32,9 +32,7 @@
|
|
|
32
32
|
{{feedback}}
|
|
33
33
|
</user_feedback>
|
|
34
34
|
|
|
35
|
-
{% include "../../common/afs/afs-tools-usage.md" %}
|
|
36
35
|
|
|
37
36
|
<instructions>
|
|
38
37
|
Analyze the original document content and user feedback, then use available tools to implement the requested improvements while maintaining the document's integrity and style.
|
|
39
|
-
{% include "../../common/afs/use-afs-instruction.md" %}
|
|
40
38
|
</instructions>
|
|
@@ -31,16 +31,16 @@ You must **precisely map** the correspondence between each module in the structu
|
|
|
31
31
|
Start from a **baseline of 80 points**. Evaluate by logging every key observation in `details` with one of five **levels**. Each level contributes a fixed delta; sum all deltas and add them to the baseline (clamp the final score to 0–100). Treat every key point independently so strengths and gaps can stack.
|
|
32
32
|
|
|
33
33
|
**Level catalog (use consistently across all dimensions):**
|
|
34
|
-
- `Excellent` — Exceptional: fully satisfies the dimension with clear, actionable outputs
|
|
35
|
-
- `Good` — Strong: aligns well with the dimension with only minor gaps
|
|
36
|
-
- `Meets` — Adequate: acceptable baseline coverage without notable strengths or weaknesses
|
|
37
|
-
- `Minor` — Problematic: specific deficiencies that reduce usefulness and require fixes
|
|
38
|
-
- `Critical` — Failing: fundamental issues that prevent the dimension from being met
|
|
34
|
+
- `Excellent` — Exceptional: fully satisfies the dimension with clear, actionable outputs.
|
|
35
|
+
- `Good` — Strong: aligns well with the dimension with only minor gaps.
|
|
36
|
+
- `Meets` — Adequate: acceptable baseline coverage without notable strengths or weaknesses.
|
|
37
|
+
- `Minor` — Problematic: specific deficiencies that reduce usefulness and require fixes.
|
|
38
|
+
- `Critical` — Failing: fundamental issues that prevent the dimension from being met.
|
|
39
39
|
|
|
40
40
|
Apply these levels to the following key points. Create a separate detail entry for each observation; if the same issue repeats (e.g., multiple typos), record multiple entries at the appropriate level.
|
|
41
41
|
|
|
42
42
|
1. **Purpose Coverage** — Evaluate every selected purpose, paying special attention to declared priorities:
|
|
43
|
-
- `Excellent`: The structure provides dedicated modules, explicit workflows, and measurable steps that achieve the purpose end-to-end
|
|
43
|
+
- `Excellent`: The structure provides dedicated modules, explicit workflows, and measurable steps that achieve the purpose end-to-end.
|
|
44
44
|
- `Good`: The purpose is clearly mapped to modules with practical guidance and minimal omissions.
|
|
45
45
|
- `Meets`: The purpose appears in general sections or implicit references but lacks targeted treatment.
|
|
46
46
|
- `Minor`: Important sub-tasks or ordering for the purpose are missing or incomplete, reducing utility.
|
|
@@ -82,7 +82,6 @@ Strictly follow these steps:
|
|
|
82
82
|
|
|
83
83
|
<output_constraints>
|
|
84
84
|
|
|
85
|
-
- `baseline` must be fixed at 80
|
|
86
85
|
- `details` is an array. Each element must include:
|
|
87
86
|
- `dimension`: one of `purposeCoverage`, `audienceCoverage`, `coverageDepth`
|
|
88
87
|
- `level`: one of `excellent`, `good`, `meets`, `minor`, `critical`
|
|
@@ -48,73 +48,66 @@ Please **strictly adhere** to the evaluation standards defined in `<standards>`
|
|
|
48
48
|
|
|
49
49
|
<standards>
|
|
50
50
|
|
|
51
|
-
Start from a **baseline of 80 points**. Evaluate by logging every key observation in `details` using one of five **levels**. Each level corresponds to a fixed score delta
|
|
51
|
+
Start from a **baseline of 80 points**. Evaluate by logging every key observation in `details` using one of five **levels**. Each level corresponds to a fixed score delta. Sum deltas with the baseline and clamp the final score to 0–100. Treat each key point independently so strengths and gaps can stack. When the same issue recurs (e.g., multiple typos), create multiple entries.
|
|
52
52
|
|
|
53
53
|
**Level catalog (use consistently across all dimensions):**
|
|
54
|
-
- `Excellent` — Exceptional output that fully satisfies the dimension with clear, actionable results
|
|
55
|
-
- `Good` — Strong and mostly complete alignment with the dimension; minor gaps only
|
|
56
|
-
- `Meets` — Satisfactory baseline coverage without significant strengths or faults
|
|
57
|
-
- `Minor` — Specific problems that reduce usefulness and should be corrected
|
|
58
|
-
- `Critical` — Fundamental failures that prevent the dimension from being met
|
|
54
|
+
- `Excellent` — Exceptional output that fully satisfies the dimension with clear, actionable results.
|
|
55
|
+
- `Good` — Strong and mostly complete alignment with the dimension; minor gaps only.
|
|
56
|
+
- `Meets` — Satisfactory baseline coverage without significant strengths or faults.
|
|
57
|
+
- `Minor` — Specific problems that reduce usefulness and should be corrected.
|
|
58
|
+
- `Critical` — Fundamental failures that prevent the dimension from being met.
|
|
59
59
|
|
|
60
60
|
Apply these levels to the following evaluation dimensions:
|
|
61
61
|
|
|
62
|
-
1. **Readability** — Language clarity, grammar, spelling, and fluency.
|
|
62
|
+
1. **Readability** — Language clarity, grammar, spelling, and fluency. **MUST evaluate on every document**
|
|
63
63
|
- `Excellent`: Text is polished, natural, and easy to read; terminology is well chosen and consistent.
|
|
64
64
|
- `Good`: Minor slips (occasional typos or awkward phrasing) that do not impede understanding.
|
|
65
65
|
- `Meets`: Understandable but plain or mechanical; no major errors.
|
|
66
66
|
- `Minor`: Noticeable grammar or spelling mistakes in specific sentences that need fixes.
|
|
67
67
|
- `Critical`: Language prevents comprehension or is unusable.
|
|
68
68
|
|
|
69
|
-
2. **Coherence** — Logical flow, transitions, and absence of contradictions.
|
|
69
|
+
2. **Coherence** — Logical flow, transitions, and absence of contradictions. **MUST evaluate on every document**
|
|
70
70
|
- `Excellent`: Clear, well-ordered flow with explicit transitions and consistent argumentation.
|
|
71
71
|
- `Good`: Mostly coherent with small gaps in transitions or sequencing.
|
|
72
72
|
- `Meets`: Functional flow but requires reader inference to connect ideas.
|
|
73
73
|
- `Minor`: Local ordering problems or small contradictions that confuse the reader.
|
|
74
74
|
- `Critical`: Structural contradictions or ordering failures that break the document's logic.
|
|
75
75
|
|
|
76
|
-
3. **Content Quality** — Coverage, accuracy, examples, and actionable detail relative to the plan (`description`).
|
|
76
|
+
3. **Content Quality** — Coverage, accuracy, examples, and actionable detail relative to the plan (`description`). **MUST evaluate on every document**
|
|
77
77
|
- `Excellent`: Content fully implements the plan with accurate, actionable guidance and relevant examples.
|
|
78
78
|
- `Good`: Most planned items are addressed with only minor missing details.
|
|
79
79
|
- `Meets`: Baseline coverage is present but lacks depth or practical instructions.
|
|
80
80
|
- `Minor`: Certain sections are missing, incorrect, or ambiguous and should be corrected.
|
|
81
81
|
- `Critical`: Core content is wrong or absent, failing to deliver planned outcomes.
|
|
82
82
|
|
|
83
|
-
4. **Consistency** — Terminology, style, formatting, and references.
|
|
83
|
+
4. **Consistency** — Terminology, style, formatting, and references. **MUST evaluate on every document**
|
|
84
84
|
- `Excellent`: Terms, style, and formatting are uniform and purposeful across the document.
|
|
85
85
|
- `Good`: Largely consistent with only isolated mismatches that do not impede understanding.
|
|
86
86
|
- `Meets`: Acceptable uniformity but lacks deliberate stylistic cohesion.
|
|
87
87
|
- `Minor`: Specific term or formatting inconsistencies that should be standardized.
|
|
88
88
|
- `Critical`: Pervasive inconsistency that undermines trust in the content.
|
|
89
89
|
|
|
90
|
-
5. **Purpose Alignment** — Relevance to user-selected purposes (document only needs to satisfy at least one when multiples exist).
|
|
91
|
-
- `Excellent`: The document supplies targeted sections, validation steps, and clear calls-to-action that realize the chosen purpose
|
|
90
|
+
5. **Purpose Alignment** — Relevance to user-selected purposes (document only needs to satisfy at least one when multiples exist). (Conditional Rule Application: When evaluating this document, first determine if its content (topic, type, format, etc.) is highly relevant to the scope of this evaluation rule. Apply this specific criterion only if the content is deemed relevant.)
|
|
91
|
+
- `Excellent`: The document supplies targeted sections, validation steps, and clear calls-to-action that realize the chosen purpose.
|
|
92
92
|
- `Good`: Purpose is clearly addressed but may lack polish or some validation details.
|
|
93
93
|
- `Meets`: Purpose is present in general terms but lacks concrete steps or targeted content.
|
|
94
94
|
- `Minor`: Key components required by the purpose are missing or incomplete.
|
|
95
95
|
- `Critical`: Document fails to address the selected purpose or pursues a different objective.
|
|
96
96
|
|
|
97
|
-
6. **Audience Alignment** — Tone, assumptions, and artifacts for target persona(s).
|
|
97
|
+
6. **Audience Alignment** — Tone, assumptions, and artifacts for target persona(s). (Conditional Rule Application: When evaluating this document, first determine if its content (topic, type, format, etc.) is highly relevant to the scope of this evaluation rule. Apply this specific criterion only if the content is deemed relevant.)
|
|
98
98
|
- `Excellent`: Messaging, examples, and precautions are tailored to each audience persona and their needs.
|
|
99
99
|
- `Good`: Tone and examples suit the audience with only minor mismatches.
|
|
100
100
|
- `Meets`: Document is generally usable by audiences but lacks persona-specific guidance.
|
|
101
101
|
- `Minor`: Sections explicitly mismatch audience skill levels or expectations and should be revised.
|
|
102
102
|
- `Critical`: Document is pitched at the wrong audience and cannot be used meaningfully.
|
|
103
103
|
|
|
104
|
-
7. **Knowledge Level Alignment** — Depth versus reader expertise.
|
|
104
|
+
7. **Knowledge Level Alignment** — Depth versus reader expertise. (Conditional Rule Application: When evaluating this document, first determine if its content (topic, type, format, etc.) is highly relevant to the scope of this evaluation rule. Apply this specific criterion only if the content is deemed relevant.)
|
|
105
105
|
- `Excellent`: Material offers layered explanations, optional deep dives, and matches expected expertise.
|
|
106
106
|
- `Good`: Overall depth fits the reader with small areas that are slightly over- or under-advanced.
|
|
107
|
-
- `Meets`: Baseline depth is acceptable but uneven across topics
|
|
107
|
+
- `Meets`: Baseline depth is acceptable but uneven across topics.
|
|
108
108
|
- `Minor`: Specific sections are noticeably too shallow or too advanced and need rework.
|
|
109
109
|
- `Critical`: The document's level is consistently misaligned with reader expertise.
|
|
110
110
|
|
|
111
|
-
8. **Navigability** — Link accuracy, anchor availability, and cross-reference integrity.
|
|
112
|
-
- `Excellent`: TOC, anchors, and cross-links are accurate and make navigation effortless.
|
|
113
|
-
- `Good`: Navigation and links are mostly correct with minor issues scoring +2.
|
|
114
|
-
- `Meets`: Basic navigation exists but lacks robust anchors or enhancements.
|
|
115
|
-
- `Minor`: Some broken or mismatched links and missing anchors that should be fixed.
|
|
116
|
-
- `Critical`: Multiple broken links or mislabeled sections make navigation unreliable.
|
|
117
|
-
|
|
118
111
|
</standards>
|
|
119
112
|
|
|
120
113
|
<rules>
|
|
@@ -136,10 +129,8 @@ Strictly follow these steps:
|
|
|
136
129
|
</rules>
|
|
137
130
|
|
|
138
131
|
<output_constraints>
|
|
139
|
-
|
|
140
|
-
- `baseline` must be fixed at 80
|
|
141
132
|
- `details` is an array. Each element must include:
|
|
142
|
-
- `dimension`: one of `readability`, `coherence`, `contentQuality`, `consistency`, `purposeAlignment`, `audienceAlignment`, `knowledgeLevelAlignment
|
|
133
|
+
- `dimension`: one of `readability`, `coherence`, `contentQuality`, `consistency`, `purposeAlignment`, `audienceAlignment`, `knowledgeLevelAlignment`
|
|
143
134
|
- `level`: one of `excellent`, `good`, `meets`, `minor`, `critical`
|
|
144
135
|
- `topic`: short identifier for the passage/section being judged
|
|
145
136
|
- `line`: integer line number within the source document (use 0 if unknown)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<role_and_goal>
|
|
2
|
+
You are an expert at analyzing media files (images and videos) and generating concise, meaningful descriptions for documentation content.
|
|
3
|
+
|
|
4
|
+
Your goal is to examine a single media file and generate an accurate description that helps both AI content generators and human readers understand what the media depicts and how it can be used effectively in documentation.
|
|
5
|
+
</role_and_goal>
|
|
6
|
+
|
|
7
|
+
<analysis_workflow>
|
|
8
|
+
1. **Analyze**: Examine the media file carefully and identify:
|
|
9
|
+
- The main subject or component being shown
|
|
10
|
+
- Key visual elements (colors, composition, style)
|
|
11
|
+
- Notable features or functionality visible
|
|
12
|
+
- The purpose or context of this media
|
|
13
|
+
- Mood or atmosphere if distinctive
|
|
14
|
+
- For videos: key actions, movements, or transitions
|
|
15
|
+
|
|
16
|
+
2. **Generate Description**: Create a concise, human-readable description following these principles:
|
|
17
|
+
- Keep it between 2-3 sentences
|
|
18
|
+
- Be specific and descriptive about visual content
|
|
19
|
+
- For videos, describe the key content or action shown
|
|
20
|
+
- Focus on aspects that matter for documentation usage
|
|
21
|
+
- Remain objective - describe what you see, not what you interpret
|
|
22
|
+
</analysis_workflow>
|
|
23
|
+
|
|
24
|
+
<description_guidelines>
|
|
25
|
+
**What to Include:**
|
|
26
|
+
- Main subject or focus of the media
|
|
27
|
+
- Key visual elements and composition
|
|
28
|
+
- Context or setting if relevant for understanding
|
|
29
|
+
- Technical aspects if relevant (e.g., "screenshot", "diagram", "illustration", "animation")
|
|
30
|
+
- Key features or functionality visible
|
|
31
|
+
- Its purpose or functionality
|
|
32
|
+
- Any notable UI elements or features
|
|
33
|
+
- For videos: describe the main action, movement, or narrative
|
|
34
|
+
</description_guidelines>
|
|
35
|
+
|
|
@@ -21,8 +21,6 @@ Initial Documentation Structure:
|
|
|
21
21
|
{{ feedback }}
|
|
22
22
|
</user_feedback>
|
|
23
23
|
|
|
24
|
-
{% include "../../common/afs/afs-tools-usage.md" %}
|
|
25
|
-
|
|
26
24
|
<instructions>
|
|
27
25
|
|
|
28
26
|
Objectives:
|
|
@@ -41,6 +39,4 @@ Processing workflow:
|
|
|
41
39
|
Rules:
|
|
42
40
|
** All changes must be made using Tools. **
|
|
43
41
|
** Carefully check if the latest version of documentStructure data meets user requirements, must avoid duplicate Tool calls. **
|
|
44
|
-
|
|
45
|
-
{% include "../../common/afs/use-afs-instruction.md" %}
|
|
46
42
|
</instructions>
|
|
@@ -548,110 +548,3 @@ export const DOC_SMITH_DIR = ".aigne/doc-smith";
|
|
|
548
548
|
export const TMP_DIR = ".tmp";
|
|
549
549
|
export const TMP_DOCS_DIR = "docs";
|
|
550
550
|
export const TMP_ASSETS_DIR = "assets";
|
|
551
|
-
|
|
552
|
-
// Default evaluation scoring weights
|
|
553
|
-
export const DEFAULT_EVALUATION_WEIGHTS = {
|
|
554
|
-
evaluationConfig: {
|
|
555
|
-
accuracy: {
|
|
556
|
-
weight: 0.35,
|
|
557
|
-
description: "Technical correctness of the documentation.",
|
|
558
|
-
subDimensions: {
|
|
559
|
-
signatureConsistency: {
|
|
560
|
-
weight: 0.5,
|
|
561
|
-
description:
|
|
562
|
-
"Function signatures match the source code (e.g., OpenAPI spec, TypeScript types).",
|
|
563
|
-
},
|
|
564
|
-
linkValidity: {
|
|
565
|
-
weight: 0.25,
|
|
566
|
-
description: "No broken internal links or invalid cross-references.",
|
|
567
|
-
},
|
|
568
|
-
codeExampleIntegrity: {
|
|
569
|
-
weight: 0.25,
|
|
570
|
-
description:
|
|
571
|
-
"All code blocks are syntactically valid and labeled with the correct language.",
|
|
572
|
-
},
|
|
573
|
-
},
|
|
574
|
-
},
|
|
575
|
-
coverage: {
|
|
576
|
-
weight: 0.35,
|
|
577
|
-
description: "Completeness of documentation for all public components.",
|
|
578
|
-
subDimensions: {
|
|
579
|
-
apiCoverage: {
|
|
580
|
-
weight: 0.4,
|
|
581
|
-
description: "Percentage of exported functions/classes documented.",
|
|
582
|
-
},
|
|
583
|
-
paramReturnCoverage: {
|
|
584
|
-
weight: 0.3,
|
|
585
|
-
description: "Percentage of function parameters and return values described.",
|
|
586
|
-
},
|
|
587
|
-
changeTracking: {
|
|
588
|
-
weight: 0.3,
|
|
589
|
-
description:
|
|
590
|
-
"All new or modified code since the last commit is reflected in the documentation.",
|
|
591
|
-
},
|
|
592
|
-
},
|
|
593
|
-
},
|
|
594
|
-
readability: {
|
|
595
|
-
weight: 0.15,
|
|
596
|
-
description: "Ease of understanding for human readers.",
|
|
597
|
-
subDimensions: {
|
|
598
|
-
clarityScore: {
|
|
599
|
-
weight: 0.28,
|
|
600
|
-
description:
|
|
601
|
-
"Overall clarity including reading coherence, logical flow and translation quality.",
|
|
602
|
-
},
|
|
603
|
-
consistency: {
|
|
604
|
-
weight: 0.12,
|
|
605
|
-
description: "Terminology, style and formatting are unified and professional.",
|
|
606
|
-
},
|
|
607
|
-
contentQuality: {
|
|
608
|
-
weight: 0.24,
|
|
609
|
-
description:
|
|
610
|
-
"Accurate and complete content that adds value with sufficient detail and examples.",
|
|
611
|
-
},
|
|
612
|
-
purposeAlignment: {
|
|
613
|
-
weight: 0.14,
|
|
614
|
-
description:
|
|
615
|
-
"Content matches the intended purpose such as quick start, API reference or troubleshooting.",
|
|
616
|
-
},
|
|
617
|
-
audienceAlignment: {
|
|
618
|
-
weight: 0.12,
|
|
619
|
-
description:
|
|
620
|
-
"Language and examples match the target audience (e.g., developers, non-technical users).",
|
|
621
|
-
},
|
|
622
|
-
knowledgeLevelAlignment: {
|
|
623
|
-
weight: 0.1,
|
|
624
|
-
description: "Depth and difficulty fit the readers' knowledge level.",
|
|
625
|
-
},
|
|
626
|
-
},
|
|
627
|
-
},
|
|
628
|
-
structure: {
|
|
629
|
-
weight: 0.15,
|
|
630
|
-
description: "Organization and navigability of the documentation.",
|
|
631
|
-
subDimensions: {
|
|
632
|
-
navigability: {
|
|
633
|
-
weight: 0.2,
|
|
634
|
-
description: "Table of contents entries correctly link to headings.",
|
|
635
|
-
},
|
|
636
|
-
informationScent: {
|
|
637
|
-
weight: 0.2,
|
|
638
|
-
description:
|
|
639
|
-
"Key pages such as Quick Start can be reached within three clicks from the homepage.",
|
|
640
|
-
},
|
|
641
|
-
purposeCoverage: {
|
|
642
|
-
weight: 0.25,
|
|
643
|
-
description:
|
|
644
|
-
"Structure covers all selected documentation goals without forcing them into a single page.",
|
|
645
|
-
},
|
|
646
|
-
audienceCoverage: {
|
|
647
|
-
weight: 0.2,
|
|
648
|
-
description: "Structure covers the main intended audience groups.",
|
|
649
|
-
},
|
|
650
|
-
coverageDepthAlignment: {
|
|
651
|
-
weight: 0.15,
|
|
652
|
-
description: "Overall balance of conciseness, depth and breadth meets user expectations.",
|
|
653
|
-
},
|
|
654
|
-
},
|
|
655
|
-
},
|
|
656
|
-
},
|
|
657
|
-
};
|
package/utils/file-utils.mjs
CHANGED
|
@@ -558,3 +558,89 @@ export function getStructurePlanPath(workDir) {
|
|
|
558
558
|
const cwd = workDir || process.cwd();
|
|
559
559
|
return path.join(cwd, ".aigne", "doc-smith", "output", "structure-plan.json");
|
|
560
560
|
}
|
|
561
|
+
|
|
562
|
+
// Shared extension → MIME type mapping table
|
|
563
|
+
const EXT_TO_MIME = {
|
|
564
|
+
".jpg": "image/jpeg",
|
|
565
|
+
".jpeg": "image/jpeg",
|
|
566
|
+
".png": "image/png",
|
|
567
|
+
".gif": "image/gif",
|
|
568
|
+
".bmp": "image/bmp",
|
|
569
|
+
".webp": "image/webp",
|
|
570
|
+
".svg": "image/svg+xml",
|
|
571
|
+
".heic": "image/heic",
|
|
572
|
+
".heif": "image/heif",
|
|
573
|
+
".mp4": "video/mp4",
|
|
574
|
+
".mpeg": "video/mpeg",
|
|
575
|
+
".mpg": "video/mpg",
|
|
576
|
+
".mov": "video/mov",
|
|
577
|
+
".avi": "video/avi",
|
|
578
|
+
".flv": "video/x-flv",
|
|
579
|
+
".mkv": "video/x-matroska",
|
|
580
|
+
".webm": "video/webm",
|
|
581
|
+
".wmv": "video/wmv",
|
|
582
|
+
".m4v": "video/x-m4v",
|
|
583
|
+
".3gpp": "video/3gpp",
|
|
584
|
+
".mp3": "audio/mpeg",
|
|
585
|
+
".wav": "audio/wav",
|
|
586
|
+
".pdf": "application/pdf",
|
|
587
|
+
".doc": "application/msword",
|
|
588
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
589
|
+
".xls": "application/vnd.ms-excel",
|
|
590
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
591
|
+
".ppt": "application/vnd.ms-powerpoint",
|
|
592
|
+
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
593
|
+
".txt": "text/plain",
|
|
594
|
+
".json": "application/json",
|
|
595
|
+
".xml": "application/xml",
|
|
596
|
+
".html": "text/html",
|
|
597
|
+
".css": "text/css",
|
|
598
|
+
".js": "application/javascript",
|
|
599
|
+
".zip": "application/zip",
|
|
600
|
+
".rar": "application/x-rar-compressed",
|
|
601
|
+
".7z": "application/x-7z-compressed",
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
// Build reverse mapping: MIME → extensions
|
|
605
|
+
const MIME_TO_EXTS = Object.entries(EXT_TO_MIME).reduce((acc, [ext, mime]) => {
|
|
606
|
+
const key = mime.toLowerCase();
|
|
607
|
+
if (!acc[key]) {
|
|
608
|
+
acc[key] = [];
|
|
609
|
+
}
|
|
610
|
+
acc[key].push(ext);
|
|
611
|
+
return acc;
|
|
612
|
+
}, {});
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Get MIME type from file path based on extension
|
|
616
|
+
* @param {string} filePath - File path
|
|
617
|
+
* @returns {string} MIME type
|
|
618
|
+
*/
|
|
619
|
+
export function getMimeType(filePath) {
|
|
620
|
+
const ext = path.extname(filePath || "").toLowerCase();
|
|
621
|
+
return EXT_TO_MIME[ext] || "application/octet-stream";
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Get file extension (without dot) from content type
|
|
626
|
+
* Handles content types with parameters (e.g., "image/jpeg; charset=utf-8")
|
|
627
|
+
* @param {string} contentType - Content type string
|
|
628
|
+
* @returns {string} File extension without dot
|
|
629
|
+
*/
|
|
630
|
+
export function getExtnameFromContentType(contentType) {
|
|
631
|
+
if (!contentType) return "";
|
|
632
|
+
const base = String(contentType).split(";")[0].trim().toLowerCase();
|
|
633
|
+
const exts = MIME_TO_EXTS[base];
|
|
634
|
+
if (exts?.length) return exts[0].slice(1); // Remove leading dot
|
|
635
|
+
const parts = base.split("/");
|
|
636
|
+
return parts[1] || "";
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Get media description cache file path
|
|
641
|
+
* @returns {string} Absolute path to media-description.yaml
|
|
642
|
+
*/
|
|
643
|
+
export function getMediaDescriptionCachePath() {
|
|
644
|
+
const cwd = process.cwd();
|
|
645
|
+
return path.join(cwd, ".aigne", "doc-smith", "media-description.yaml");
|
|
646
|
+
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import pMap from "p-map";
|
|
4
3
|
import remarkGfm from "remark-gfm";
|
|
5
4
|
import remarkLint from "remark-lint";
|
|
6
5
|
import remarkParse from "remark-parse";
|
|
7
6
|
import { unified } from "unified";
|
|
8
7
|
import { visit } from "unist-util-visit";
|
|
9
8
|
import { VFile } from "vfile";
|
|
10
|
-
import { KROKI_CONCURRENCY } from "./constants/index.mjs";
|
|
11
|
-
import { checkContent, isValidCode } from "./d2-utils.mjs";
|
|
12
9
|
import { validateMermaidSyntax } from "./mermaid-validator.mjs";
|
|
13
10
|
|
|
14
11
|
/**
|
|
@@ -378,7 +375,6 @@ export async function checkMarkdown(markdown, source = "content", options = {})
|
|
|
378
375
|
|
|
379
376
|
// Check mermaid code blocks and other custom validations
|
|
380
377
|
const mermaidChecks = [];
|
|
381
|
-
const d2ChecksList = [];
|
|
382
378
|
visit(ast, "code", (node) => {
|
|
383
379
|
if (node.lang) {
|
|
384
380
|
const line = node.position?.start?.line || "unknown";
|
|
@@ -467,12 +463,6 @@ export async function checkMarkdown(markdown, source = "content", options = {})
|
|
|
467
463
|
specialCharMatch = nodeWithSpecialCharsRegex.exec(mermaidContent);
|
|
468
464
|
}
|
|
469
465
|
}
|
|
470
|
-
if (isValidCode(node.lang)) {
|
|
471
|
-
d2ChecksList.push({
|
|
472
|
-
content: node.value,
|
|
473
|
-
line,
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
466
|
}
|
|
477
467
|
});
|
|
478
468
|
|
|
@@ -524,16 +514,6 @@ export async function checkMarkdown(markdown, source = "content", options = {})
|
|
|
524
514
|
// Wait for all mermaid checks to complete
|
|
525
515
|
await Promise.all(mermaidChecks);
|
|
526
516
|
|
|
527
|
-
await pMap(
|
|
528
|
-
d2ChecksList,
|
|
529
|
-
async ({ content, line }) =>
|
|
530
|
-
checkContent({ content }).catch((err) => {
|
|
531
|
-
const errorMessage = err?.message || String(err) || "Unknown d2 syntax error";
|
|
532
|
-
errorMessages.push(`Found D2 syntax error in ${source} at line ${line}: ${errorMessage}`);
|
|
533
|
-
}),
|
|
534
|
-
{ concurrency: KROKI_CONCURRENCY },
|
|
535
|
-
);
|
|
536
|
-
|
|
537
517
|
// Run markdown linting rules
|
|
538
518
|
await processor.run(ast, file);
|
|
539
519
|
|