@aigne/doc-smith 0.8.12-beta.2 → 0.8.12-beta.4

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 (170) hide show
  1. package/.aigne/doc-smith/config.yaml +9 -6
  2. package/.aigne/doc-smith/output/structure-plan.json +123 -109
  3. package/.aigne/doc-smith/upload-cache.yaml +48 -0
  4. package/.github/workflows/publish-docs.yml +4 -7
  5. package/.release-please-manifest.json +1 -1
  6. package/CHANGELOG.md +20 -0
  7. package/agents/clear/choose-contents.mjs +22 -5
  8. package/agents/clear/clear-auth-tokens.mjs +2 -4
  9. package/agents/clear/clear-deployment-config.mjs +49 -0
  10. package/agents/clear/clear-document-config.mjs +2 -5
  11. package/agents/clear/clear-document-structure.mjs +2 -6
  12. package/agents/clear/clear-generated-docs.mjs +0 -1
  13. package/agents/generate/check-need-generate-structure.mjs +15 -60
  14. package/agents/generate/document-structure-tools/generate-sub-structure.mjs +131 -0
  15. package/agents/generate/generate-structure-without-tools.yaml +65 -0
  16. package/agents/generate/generate-structure.yaml +7 -1
  17. package/agents/generate/index.yaml +0 -3
  18. package/agents/generate/update-document-structure.yaml +3 -0
  19. package/agents/generate/user-review-document-structure.mjs +7 -5
  20. package/agents/init/index.mjs +15 -15
  21. package/agents/publish/publish-docs.mjs +132 -113
  22. package/agents/translate/index.yaml +1 -1
  23. package/agents/update/batch-generate-document.yaml +1 -1
  24. package/agents/update/batch-update-document.yaml +1 -1
  25. package/agents/update/check-document.mjs +3 -19
  26. package/agents/update/user-review-document.mjs +4 -3
  27. package/agents/utils/load-sources.mjs +54 -151
  28. package/agents/utils/transform-detail-datasources.mjs +14 -18
  29. package/aigne.yaml +2 -0
  30. package/biome.json +1 -1
  31. package/docs/_sidebar.md +13 -15
  32. package/docs/configuration-initial-setup.ja.md +179 -0
  33. package/docs/configuration-initial-setup.md +179 -0
  34. package/docs/configuration-initial-setup.zh-TW.md +179 -0
  35. package/docs/configuration-initial-setup.zh.md +179 -0
  36. package/docs/configuration-managing-preferences.ja.md +100 -0
  37. package/docs/configuration-managing-preferences.md +100 -0
  38. package/docs/configuration-managing-preferences.zh-TW.md +100 -0
  39. package/docs/configuration-managing-preferences.zh.md +100 -0
  40. package/docs/configuration.ja.md +68 -184
  41. package/docs/configuration.md +62 -178
  42. package/docs/configuration.zh-TW.md +70 -186
  43. package/docs/configuration.zh.md +67 -183
  44. package/docs/getting-started.ja.md +46 -78
  45. package/docs/getting-started.md +46 -78
  46. package/docs/getting-started.zh-TW.md +47 -79
  47. package/docs/getting-started.zh.md +47 -79
  48. package/docs/guides-cleaning-up.ja.md +50 -0
  49. package/docs/guides-cleaning-up.md +50 -0
  50. package/docs/guides-cleaning-up.zh-TW.md +50 -0
  51. package/docs/guides-cleaning-up.zh.md +50 -0
  52. package/docs/guides-evaluating-documents.ja.md +66 -0
  53. package/docs/guides-evaluating-documents.md +66 -0
  54. package/docs/guides-evaluating-documents.zh-TW.md +66 -0
  55. package/docs/guides-evaluating-documents.zh.md +66 -0
  56. package/docs/guides-generating-documentation.ja.md +149 -0
  57. package/docs/guides-generating-documentation.md +149 -0
  58. package/docs/guides-generating-documentation.zh-TW.md +149 -0
  59. package/docs/guides-generating-documentation.zh.md +149 -0
  60. package/docs/guides-interactive-chat.ja.md +85 -0
  61. package/docs/guides-interactive-chat.md +85 -0
  62. package/docs/guides-interactive-chat.zh-TW.md +85 -0
  63. package/docs/guides-interactive-chat.zh.md +85 -0
  64. package/docs/guides-managing-history.ja.md +51 -0
  65. package/docs/guides-managing-history.md +51 -0
  66. package/docs/guides-managing-history.zh-TW.md +51 -0
  67. package/docs/guides-managing-history.zh.md +51 -0
  68. package/docs/guides-publishing-your-docs.ja.md +78 -0
  69. package/docs/guides-publishing-your-docs.md +78 -0
  70. package/docs/guides-publishing-your-docs.zh-TW.md +78 -0
  71. package/docs/guides-publishing-your-docs.zh.md +78 -0
  72. package/docs/guides-translating-documentation.ja.md +95 -0
  73. package/docs/guides-translating-documentation.md +95 -0
  74. package/docs/guides-translating-documentation.zh-TW.md +95 -0
  75. package/docs/guides-translating-documentation.zh.md +95 -0
  76. package/docs/guides-updating-documentation.ja.md +77 -0
  77. package/docs/guides-updating-documentation.md +77 -0
  78. package/docs/guides-updating-documentation.zh-TW.md +77 -0
  79. package/docs/guides-updating-documentation.zh.md +77 -0
  80. package/docs/guides.ja.md +32 -0
  81. package/docs/guides.md +32 -0
  82. package/docs/guides.zh-TW.md +32 -0
  83. package/docs/guides.zh.md +32 -0
  84. package/docs/overview.ja.md +39 -60
  85. package/docs/overview.md +39 -60
  86. package/docs/overview.zh-TW.md +39 -60
  87. package/docs/overview.zh.md +39 -60
  88. package/docs/release-notes.ja.md +255 -0
  89. package/docs/release-notes.md +255 -0
  90. package/docs/release-notes.zh-TW.md +255 -0
  91. package/docs/release-notes.zh.md +255 -0
  92. package/package.json +4 -2
  93. package/prompts/common/document/content-rules-core.md +1 -0
  94. package/prompts/common/document-structure/document-structure-rules.md +8 -9
  95. package/prompts/common/document-structure/output-constraints.md +1 -1
  96. package/prompts/structure/document-rules.md +8 -2
  97. package/prompts/structure/generate/system-prompt.md +27 -2
  98. package/prompts/structure/generate/user-prompt.md +18 -0
  99. package/prompts/structure/update/system-prompt.md +12 -0
  100. package/prompts/structure/update/user-prompt.md +3 -0
  101. package/tests/agents/clear/choose-contents.test.mjs +8 -4
  102. package/tests/agents/generate/check-need-generate-structure.test.mjs +53 -63
  103. package/tests/agents/generate/document-structure-tools/generate-sub-structure.test.mjs +277 -0
  104. package/tests/agents/init/init.test.mjs +18 -18
  105. package/tests/agents/publish/publish-docs.test.mjs +79 -0
  106. package/tests/agents/update/check-document.test.mjs +7 -67
  107. package/tests/agents/utils/load-sources.test.mjs +90 -90
  108. package/tests/agents/utils/transform-detail-datasources.test.mjs +153 -196
  109. package/tests/utils/file-utils.test.mjs +309 -1
  110. package/utils/auth-utils.mjs +12 -5
  111. package/utils/constants/index.mjs +5 -2
  112. package/utils/deploy.mjs +2 -2
  113. package/utils/file-utils.mjs +315 -0
  114. package/utils/utils.mjs +89 -50
  115. package/docs/advanced-how-it-works.ja.md +0 -101
  116. package/docs/advanced-how-it-works.md +0 -101
  117. package/docs/advanced-how-it-works.zh-TW.md +0 -101
  118. package/docs/advanced-how-it-works.zh.md +0 -101
  119. package/docs/advanced-quality-assurance.ja.md +0 -92
  120. package/docs/advanced-quality-assurance.md +0 -92
  121. package/docs/advanced-quality-assurance.zh-TW.md +0 -92
  122. package/docs/advanced-quality-assurance.zh.md +0 -92
  123. package/docs/advanced.ja.md +0 -20
  124. package/docs/advanced.md +0 -20
  125. package/docs/advanced.zh-TW.md +0 -20
  126. package/docs/advanced.zh.md +0 -20
  127. package/docs/changelog.ja.md +0 -486
  128. package/docs/changelog.md +0 -486
  129. package/docs/changelog.zh-TW.md +0 -486
  130. package/docs/changelog.zh.md +0 -486
  131. package/docs/cli-reference.ja.md +0 -311
  132. package/docs/cli-reference.md +0 -311
  133. package/docs/cli-reference.zh-TW.md +0 -311
  134. package/docs/cli-reference.zh.md +0 -311
  135. package/docs/configuration-interactive-setup.ja.md +0 -138
  136. package/docs/configuration-interactive-setup.md +0 -138
  137. package/docs/configuration-interactive-setup.zh-TW.md +0 -138
  138. package/docs/configuration-interactive-setup.zh.md +0 -138
  139. package/docs/configuration-language-support.ja.md +0 -64
  140. package/docs/configuration-language-support.md +0 -64
  141. package/docs/configuration-language-support.zh-TW.md +0 -64
  142. package/docs/configuration-language-support.zh.md +0 -64
  143. package/docs/configuration-llm-setup.ja.md +0 -56
  144. package/docs/configuration-llm-setup.md +0 -56
  145. package/docs/configuration-llm-setup.zh-TW.md +0 -56
  146. package/docs/configuration-llm-setup.zh.md +0 -56
  147. package/docs/configuration-preferences.ja.md +0 -144
  148. package/docs/configuration-preferences.md +0 -144
  149. package/docs/configuration-preferences.zh-TW.md +0 -144
  150. package/docs/configuration-preferences.zh.md +0 -144
  151. package/docs/features-generate-documentation.ja.md +0 -95
  152. package/docs/features-generate-documentation.md +0 -95
  153. package/docs/features-generate-documentation.zh-TW.md +0 -95
  154. package/docs/features-generate-documentation.zh.md +0 -95
  155. package/docs/features-publish-your-docs.ja.md +0 -130
  156. package/docs/features-publish-your-docs.md +0 -130
  157. package/docs/features-publish-your-docs.zh-TW.md +0 -130
  158. package/docs/features-publish-your-docs.zh.md +0 -130
  159. package/docs/features-translate-documentation.ja.md +0 -90
  160. package/docs/features-translate-documentation.md +0 -90
  161. package/docs/features-translate-documentation.zh-TW.md +0 -90
  162. package/docs/features-translate-documentation.zh.md +0 -90
  163. package/docs/features-update-and-refine.ja.md +0 -142
  164. package/docs/features-update-and-refine.md +0 -142
  165. package/docs/features-update-and-refine.zh-TW.md +0 -143
  166. package/docs/features-update-and-refine.zh.md +0 -142
  167. package/docs/features.ja.md +0 -62
  168. package/docs/features.md +0 -62
  169. package/docs/features.zh-TW.md +0 -62
  170. package/docs/features.zh.md +0 -62
@@ -1,144 +0,0 @@
1
- # Managing Preferences
2
-
3
- AIGNE DocSmith is designed to learn from your feedback. When you refine or correct generated content, DocSmith can convert that feedback into persistent rules, called preferences. These rules ensure that your specific style, structural requirements, and content policies are applied consistently in future documentation tasks. All preferences are stored in a human-readable YAML file located at `.aigne/doc-smith/preferences.yml` in your project root.
4
-
5
- ## The Preference Lifecycle
6
-
7
- The following diagram illustrates how your feedback becomes a reusable rule that can be applied to future tasks and managed from the command line.
8
-
9
- ```d2 The Preference Lifecycle
10
- direction: down
11
-
12
- developer: {
13
- label: "Developer"
14
- shape: person
15
- }
16
-
17
- docsmith_system: {
18
- label: "AIGNE DocSmith System"
19
- shape: rectangle
20
-
21
- cli: {
22
- label: "CLI Command\n(refine / translate)"
23
- shape: rectangle
24
- }
25
-
26
- agent: {
27
- label: "Internal Analysis Agent"
28
- shape: rectangle
29
- }
30
-
31
- decision: {
32
- label: "Is feedback a\nreusable policy?"
33
- shape: diamond
34
- }
35
-
36
- create_rule: {
37
- label: "Create New Preference Rule"
38
- shape: rectangle
39
- }
40
- }
41
-
42
- preferences_file: {
43
- label: ".aigne/doc-smith/preferences.yml"
44
- shape: cylinder
45
- }
46
-
47
- one_time_fix: {
48
- label: "Apply as a one-time fix"
49
- shape: oval
50
- }
51
-
52
- developer -> docsmith_system.cli: "1. Provides feedback"
53
- docsmith_system.cli -> docsmith_system.agent: "2. Captures feedback"
54
- docsmith_system.agent -> docsmith_system.decision: "3. Analyzes"
55
- docsmith_system.decision -> docsmith_system.create_rule: "Yes"
56
- docsmith_system.create_rule -> preferences_file: "4. Saves rule to file"
57
- docsmith_system.decision -> one_time_fix: "No"
58
- ```
59
-
60
- ### How Preferences are Created
61
-
62
- When you provide feedback during the `refine` or `translate` stages, an internal agent analyzes your input. It determines if the feedback is a one-time fix (e.g., correcting a typo) or a reusable policy (e.g., "always write code comments in English"). If it represents a lasting instruction, it creates a new preference rule and saves it to your project's `preferences.yml` file.
63
-
64
- ### Rule Properties
65
-
66
- Each rule saved in `preferences.yml` has the following structure:
67
-
68
- <x-field-group>
69
- <x-field data-name="id" data-type="string" data-desc="A unique, randomly generated identifier for the rule (e.g., pref_a1b2c3d4e5f6g7h8)."></x-field>
70
- <x-field data-name="active" data-type="boolean" data-desc="Indicates if the rule is currently enabled. Inactive rules are ignored during generation tasks."></x-field>
71
- <x-field data-name="scope" data-type="string">
72
- <x-field-desc markdown>Defines when the rule should be applied. Valid scopes are `global`, `structure`, `document`, or `translation`.</x-field-desc>
73
- </x-field>
74
- <x-field data-name="rule" data-type="string" data-desc="The specific, distilled instruction that will be passed to the AI in future tasks."></x-field>
75
- <x-field data-name="feedback" data-type="string" data-desc="The original, natural language feedback provided by the user, preserved for reference."></x-field>
76
- <x-field data-name="createdAt" data-type="string" data-desc="The ISO 8601 timestamp indicating when the rule was created."></x-field>
77
- <x-field data-name="paths" data-type="string[]" data-required="false">
78
- <x-field-desc markdown>An optional list of file paths. If present, the rule only applies to content generated for these specific source files.</x-field-desc>
79
- </x-field>
80
- </x-field-group>
81
-
82
- ## Managing Preferences with the CLI
83
-
84
- You can view and manage all your saved preferences using the `aigne doc prefs` command. This allows you to list, activate, deactivate, or permanently remove rules.
85
-
86
- ### Listing All Preferences
87
-
88
- To see a complete list of all saved preferences, both active and inactive, use the `--list` flag.
89
-
90
- ```bash List all preferences icon=lucide:terminal
91
- aigne doc prefs --list
92
- ```
93
-
94
- The command displays a formatted list showing the status, scope, ID, and any path limitations for each rule.
95
-
96
- ```text Example Output icon=lucide:clipboard-list
97
- # User Preferences
98
-
99
- **Format explanation:**
100
- - 🟢 = Active preference, ⚪ = Inactive preference
101
- - [scope] = Preference scope (global, structure, document, translation)
102
- - ID = Unique preference identifier
103
- - Paths = Specific file paths (if applicable)
104
-
105
- 🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
106
- Add a 'Next Steps' section at the end of overview documents.
107
-
108
- ⚪ [document] pref_i9j0k1l2m3n4o5p6
109
- Code comments must be written in English.
110
- ```
111
-
112
- ### Deactivating and Reactivating Preferences
113
-
114
- If you need to temporarily disable a rule without deleting it, you can toggle its active status with the `--toggle` flag. Running the command without an ID will launch an interactive mode, allowing you to select one or more preferences to toggle.
115
-
116
- ```bash Toggle preferences interactively icon=lucide:terminal
117
- aigne doc prefs --toggle
118
- ```
119
-
120
- To toggle a specific rule directly, provide its ID using the `--id` flag. This action changes the rule's `active` property.
121
-
122
- ```bash Toggle a specific preference icon=lucide:terminal
123
- aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
124
- ```
125
-
126
- ### Removing Preferences
127
-
128
- To permanently delete one or more preferences, use the `--remove` flag. This action cannot be undone.
129
-
130
- For an interactive selection prompt, run the command without an ID.
131
-
132
- ```bash Remove preferences interactively icon=lucide:terminal
133
- aigne doc prefs --remove
134
- ```
135
-
136
- To remove a specific rule directly, provide its ID using the `--id` flag.
137
-
138
- ```bash Remove a specific preference icon=lucide:terminal
139
- aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
140
- ```
141
-
142
- ## Next Steps
143
-
144
- Managing preferences is a key part of tailoring DocSmith to your project's specific needs. For more customization options, explore the main [Configuration Guide](./configuration.md).
@@ -1,144 +0,0 @@
1
- # 管理偏好設定
2
-
3
- AIGNE DocSmith 的設計旨在從您的回饋中學習。當您優化或修正生成的內容時,DocSmith 可以將該回饋轉化為持久性規則,稱為偏好設定。這些規則確保您特定的風格、結構要求和內容策略在未來的文檔任務中得到一致應用。所有偏好設定都儲存在您專案根目錄下一個人類可讀的 YAML 檔案中,路徑為 `.aigne/doc-smith/preferences.yml`。
4
-
5
- ## 偏好設定的生命週期
6
-
7
- 下圖說明了您的回饋如何成為一個可重複使用的規則,該規則可應用於未來的任務,並可透過命令列進行管理。
8
-
9
- ```d2 偏好設定的生命週期
10
- direction: down
11
-
12
- developer: {
13
- label: "開發者"
14
- shape: person
15
- }
16
-
17
- docsmith_system: {
18
- label: "AIGNE DocSmith 系統"
19
- shape: rectangle
20
-
21
- cli: {
22
- label: "CLI 指令\n(refine / translate)"
23
- shape: rectangle
24
- }
25
-
26
- agent: {
27
- label: "內部分析 Agent"
28
- shape: rectangle
29
- }
30
-
31
- decision: {
32
- label: "回饋是否為\n可重複使用的策略?"
33
- shape: diamond
34
- }
35
-
36
- create_rule: {
37
- label: "建立新的偏好設定規則"
38
- shape: rectangle
39
- }
40
- }
41
-
42
- preferences_file: {
43
- label: ".aigne/doc-smith/preferences.yml"
44
- shape: cylinder
45
- }
46
-
47
- one_time_fix: {
48
- label: "作為一次性修復應用"
49
- shape: oval
50
- }
51
-
52
- developer -> docsmith_system.cli: "1. 提供回饋"
53
- docsmith_system.cli -> docsmith_system.agent: "2. 捕捉回饋"
54
- docsmith_system.agent -> docsmith_system.decision: "3. 進行分析"
55
- docsmith_system.decision -> docsmith_system.create_rule: "是"
56
- docsmith_system.create_rule -> preferences_file: "4. 將規則儲存至檔案"
57
- docsmith_system.decision -> one_time_fix: "否"
58
- ```
59
-
60
- ### 如何建立偏好設定
61
-
62
- 當您在 `refine` 或 `translate` 階段提供回饋時,一個內部 Agent 會分析您的輸入。它會判斷該回饋是一次性修復(例如,修正一個錯字)還是可重複使用的策略(例如,「程式碼註解必須以英文撰寫」)。如果它代表一個持久性的指令,它會建立一個新的偏好設定規則,並將其儲存到您專案的 `preferences.yml` 檔案中。
63
-
64
- ### 規則屬性
65
-
66
- 儲存在 `preferences.yml` 中的每個規則都具有以下結構:
67
-
68
- <x-field-group>
69
- <x-field data-name="id" data-type="string" data-desc="規則的唯一隨機生成識別碼(例如:pref_a1b2c3d4e5f6g7h8)。"></x-field>
70
- <x-field data-name="active" data-type="boolean" data-desc="表示規則目前是否啟用。未啟用的規則在生成任務期間會被忽略。"></x-field>
71
- <x-field data-name="scope" data-type="string">
72
- <x-field-desc markdown>定義規則應在何時應用。有效的範圍為 `global`、`structure`、`document` 或 `translation`。</x-field-desc>
73
- </x-field>
74
- <x-field data-name="rule" data-type="string" data-desc="在未來任務中將傳遞給 AI 的具體、精煉的指令。"></x-field>
75
- <x-field data-name="feedback" data-type="string" data-desc="使用者提供的原始自然語言回饋,保留以供參考。"></x-field>
76
- <x-field data-name="createdAt" data-type="string" data-desc="表示規則建立時間的 ISO 8601 時間戳記。"></x-field>
77
- <x-field data-name="paths" data-type="string[]" data-required="false">
78
- <x-field-desc markdown>可選的檔案路徑列表。如果存在,此規則僅適用於為這些特定來源檔案生成的內容。</x-field-desc>
79
- </x-field>
80
- </x-field-group>
81
-
82
- ## 使用 CLI 管理偏好設定
83
-
84
- 您可以使用 `aigne doc prefs` 指令來檢視和管理所有已儲存的偏好設定。這讓您可以列出、啟用、停用或永久移除規則。
85
-
86
- ### 列出所有偏好設定
87
-
88
- 要查看所有已儲存偏好設定的完整列表(包括啟用和未啟用的),請使用 `--list` 標記。
89
-
90
- ```bash 列出所有偏好設定 icon=lucide:terminal
91
- aigne doc prefs --list
92
- ```
93
-
94
- 該指令會顯示一個格式化的列表,顯示每個規則的狀態、範圍、ID 以及任何路徑限制。
95
-
96
- ```text 輸出範例 icon=lucide:clipboard-list
97
- # 使用者偏好設定
98
-
99
- **格式說明:**
100
- - 🟢 = 啟用中的偏好設定,⚪ = 未啟用的偏好設定
101
- - [scope] = 偏好設定範圍 (global, structure, document, translation)
102
- - ID = 唯一偏好設定識別碼
103
- - Paths = 特定檔案路徑(如果適用)
104
-
105
- 🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
106
- 在概覽文件的末尾新增一個「後續步驟」部分。
107
-
108
- ⚪ [document] pref_i9j0k1l2m3n4o5p6
109
- 程式碼註解必須以英文撰寫。
110
- ```
111
-
112
- ### 停用與重新啟用偏好設定
113
-
114
- 如果您需要暫時停用一個規則而不刪除它,您可以使用 `--toggle` 標記來切換其啟用狀態。若執行指令時不帶 ID,將會啟動互動模式,讓您選擇一個或多個偏好設定進行切換。
115
-
116
- ```bash 以互動模式切換偏好設定 icon=lucide:terminal
117
- aigne doc prefs --toggle
118
- ```
119
-
120
- 要直接切換特定規則,請使用 `--id` 標記提供其 ID。此操作會更改規則的 `active` 屬性。
121
-
122
- ```bash 切換特定偏好設定 icon=lucide:terminal
123
- aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
124
- ```
125
-
126
- ### 移除偏好設定
127
-
128
- 要永久刪除一個或多個偏好設定,請使用 `--remove` 標記。此操作無法復原。
129
-
130
- 若要進入互動式選擇提示,請在不帶 ID 的情況下執行該指令。
131
-
132
- ```bash 以互動模式移除偏好設定 icon=lucide:terminal
133
- aigne doc prefs --remove
134
- ```
135
-
136
- 要直接移除特定規則,請使用 `--id` 標記提供其 ID。
137
-
138
- ```bash 移除特定偏好設定 icon=lucide:terminal
139
- aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
140
- ```
141
-
142
- ## 後續步驟
143
-
144
- 管理偏好設定是根據您專案的特定需求量身打造 DocSmith 的關鍵部分。如需更多自訂選項,請探索主要的[設定指南](./configuration.md)。
@@ -1,144 +0,0 @@
1
- # 管理偏好设置
2
-
3
- AIGNE DocSmith 旨在从您的反馈中学习。当您优化或纠正生成的内容时,DocSmith 可以将该反馈转换为持久性规则,称为偏好设置。这些规则确保您特定的风格、结构要求和内容策略在未来的文档任务中得到一致的应用。所有偏好设置都存储在位于您项目根目录下的一个人类可读的 YAML 文件中:`.aigne/doc-smith/preferences.yml`。
4
-
5
- ## 偏好设置的生命周期
6
-
7
- 下图说明了您的反馈如何成为一个可重用的规则,该规则可以应用于未来的任务并通过命令行进行管理。
8
-
9
- ```d2 偏好设置的生命周期
10
- direction: down
11
-
12
- developer: {
13
- label: "开发者"
14
- shape: person
15
- }
16
-
17
- docsmith_system: {
18
- label: "AIGNE DocSmith 系统"
19
- shape: rectangle
20
-
21
- cli: {
22
- label: "CLI 命令\n(refine / translate)"
23
- shape: rectangle
24
- }
25
-
26
- agent: {
27
- label: "内部分析 Agent"
28
- shape: rectangle
29
- }
30
-
31
- decision: {
32
- label: "反馈是否为\n可重用策略?"
33
- shape: diamond
34
- }
35
-
36
- create_rule: {
37
- label: "创建新偏好规则"
38
- shape: rectangle
39
- }
40
- }
41
-
42
- preferences_file: {
43
- label: ".aigne/doc-smith/preferences.yml"
44
- shape: cylinder
45
- }
46
-
47
- one_time_fix: {
48
- label: "作为一次性修复应用"
49
- shape: oval
50
- }
51
-
52
- developer -> docsmith_system.cli: "1. 提供反馈"
53
- docsmith_system.cli -> docsmith_system.agent: "2. 捕获反馈"
54
- docsmith_system.agent -> docsmith_system.decision: "3. 分析"
55
- docsmith_system.decision -> docsmith_system.create_rule: "是"
56
- docsmith_system.create_rule -> preferences_file: "4. 将规则保存到文件"
57
- docsmith_system.decision -> one_time_fix: "否"
58
- ```
59
-
60
- ### 如何创建偏好设置
61
-
62
- 当您在 `refine` 或 `translate` 阶段提供反馈时,一个内部 Agent 会分析您的输入。它会判断该反馈是一次性修复(例如,纠正拼写错误)还是可重用策略(例如,“代码注释必须用英文编写”)。如果它代表一个持久性指令,Agent 就会创建一条新的偏好规则并将其保存到您项目的 `preferences.yml` 文件中。
63
-
64
- ### 规则属性
65
-
66
- 保存在 `preferences.yml` 中的每条规则都具有以下结构:
67
-
68
- <x-field-group>
69
- <x-field data-name="id" data-type="string" data-desc="规则的唯一、随机生成的标识符(例如,pref_a1b2c3d4e5f6g7h8)。"></x-field>
70
- <x-field data-name="active" data-type="boolean" data-desc="指示规则当前是否已启用。未激活的规则在生成任务期间将被忽略。"></x-field>
71
- <x-field data-name="scope" data-type="string">
72
- <x-field-desc markdown>定义规则何时应用。有效范围是 `global`、`structure`、`document` 或 `translation`。</x-field-desc>
73
- </x-field>
74
- <x-field data-name="rule" data-type="string" data-desc="将在未来任务中传递给 AI 的具体、提炼后的指令。"></x-field>
75
- <x-field data-name="feedback" data-type="string" data-desc="用户提供的原始自然语言反馈,保留以供参考。"></x-field>
76
- <x-field data-name="createdAt" data-type="string" data-desc="指示规则创建时间的 ISO 8601 时间戳。"></x-field>
77
- <x-field data-name="paths" data-type="string[]" data-required="false">
78
- <x-field-desc markdown>一个可选的文件路径列表。如果存在,该规则仅适用于为这些特定源文件生成的内容。</x-field-desc>
79
- </x-field>
80
- </x-field-group>
81
-
82
- ## 使用 CLI 管理偏好设置
83
-
84
- 您可以使用 `aigne doc prefs` 命令查看和管理所有已保存的偏好设置。这允许您列出、激活、停用或永久删除规则。
85
-
86
- ### 列出所有偏好设置
87
-
88
- 要查看所有已保存的偏好设置(包括激活和未激活的)的完整列表,请使用 `--list` 标志。
89
-
90
- ```bash 列出所有偏好设置 icon=lucide:terminal
91
- aigne doc prefs --list
92
- ```
93
-
94
- 该命令会显示一个格式化的列表,其中显示了每条规则的状态、范围、ID 以及任何路径限制。
95
-
96
- ```text 输出示例 icon=lucide:clipboard-list
97
- # 用户偏好设置
98
-
99
- **格式说明:**
100
- - 🟢 = 激活的偏好设置, ⚪ = 未激活的偏好设置
101
- - [scope] = 偏好范围 (global, structure, document, translation)
102
- - ID = 唯一偏好标识符
103
- - Paths = 特定文件路径 (如果适用)
104
-
105
- 🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
106
- 在概览文档末尾添加一个“后续步骤”部分。
107
-
108
- ⚪ [document] pref_i9j0k1l2m3n4o5p6
109
- 代码注释必须用英文编写。
110
- ```
111
-
112
- ### 停用和重新激活偏好设置
113
-
114
- 如果您需要暂时禁用某条规则而不删除它,可以使用 `--toggle` 标志切换其激活状态。在不带 ID 的情况下运行该命令将启动交互模式,允许您选择一个或多个偏好设置进行切换。
115
-
116
- ```bash 以交互方式切换偏好设置 icon=lucide:terminal
117
- aigne doc prefs --toggle
118
- ```
119
-
120
- 要直接切换特定规则,请使用 `--id` 标志提供其 ID。此操作会更改规则的 `active` 属性。
121
-
122
- ```bash 切换特定偏好设置 icon=lucide:terminal
123
- aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
124
- ```
125
-
126
- ### 删除偏好设置
127
-
128
- 要永久删除一个或多个偏好设置,请使用 `--remove` 标志。此操作无法撤销。
129
-
130
- 要获得交互式选择提示,请在不带 ID 的情况下运行该命令。
131
-
132
- ```bash 以交互方式删除偏好设置 icon=lucide:terminal
133
- aigne doc prefs --remove
134
- ```
135
-
136
- 要直接删除特定规则,请使用 `--id` 标志提供其 ID。
137
-
138
- ```bash 删除特定偏好设置 icon=lucide:terminal
139
- aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
140
- ```
141
-
142
- ## 后续步骤
143
-
144
- 管理偏好设置是根据项目特定需求定制 DocSmith 的关键部分。有关更多自定义选项,请浏览主要的[配置指南](./configuration.md)。
@@ -1,95 +0,0 @@
1
- # ドキュメントの生成
2
-
3
- `aigne doc generate` コマンドは、ソースコードから完全なドキュメントセットを作成するための主要な機能です。このコマンドは、コードベースを分析し、論理的なドキュメント構造を計画し、各セクションのコンテンツを生成するプロセスを開始します。これは、初期状態からドキュメントを作成するための標準的な方法です。
4
-
5
- ## 最初の生成
6
-
7
- まず、プロジェクトのルートディレクトリに移動し、次のコマンドを実行します。
8
-
9
- ```bash aigne doc generate icon=lucide:play-circle
10
- aigne doc generate
11
- ```
12
-
13
- ### 自動設定
14
-
15
- プロジェクトでこのコマンドを初めて実行する場合、DocSmith は設定が存在しないことを検出します。その後、対話式のセットアップウィザードが自動的に起動し、必要な設定手順を案内します。このプロセスにより、生成が開始される前に有効な設定が確実に配置されます。
16
-
17
- ![generate コマンドの実行、初期化のスマートな実行](../assets/screenshots/doc-generate.png)
18
-
19
- ドキュメントの主要な側面を定義するための一連の質問に答えるよう求められます。これには以下が含まれます。
20
-
21
- * ドキュメント生成ルールとスタイル
22
- * 対象読者
23
- * 主要言語と追加の翻訳言語
24
- * ソースコードの入力パスとドキュメントの出力パス
25
-
26
- ![質問に答えてプロジェクトのセットアップを完了](../assets/screenshots/doc-complete-setup.png)
27
-
28
- 設定が完了すると、DocSmith はドキュメントの生成に進みます。
29
-
30
- ![構造計画の実行とドキュメントの生成](../assets/screenshots/doc-generate-docs.png)
31
-
32
- 正常に完了すると、新しく作成されたドキュメントは、セットアップ中に指定された出力ディレクトリで利用可能になります。
33
-
34
- ![ドキュメントが正常に生成されました](../assets/screenshots/doc-generated-successfully.png)
35
-
36
- ## 生成プロセス
37
-
38
- `generate` コマンドは、自動化されたマルチステップのワークフローを実行します。プロセスは以下の通りです。
39
-
40
- ```d2
41
- direction: down
42
-
43
- User: {
44
- shape: c4-person
45
- }
46
-
47
- AIGNE-CLI: {
48
- label: "AIGNE CLI"
49
-
50
- config-check: {
51
- label: "設定ファイルは存在しますか?"
52
- shape: diamond
53
- }
54
-
55
- interactive-setup: {
56
- label: "対話式セットアップウィザード"
57
- }
58
-
59
- generation-process: {
60
- label: "3. 生成プロセス"
61
-
62
- analyze-code: "コードの分析"
63
- plan-structure: "構造の計画"
64
- generate-content: "コンテンツの生成"
65
-
66
- analyze-code -> plan-structure -> generate-content
67
- }
68
-
69
- output: {
70
- label: "出力ディレクトリ"
71
- }
72
- }
73
-
74
- User -> AIGNE-CLI.config-check: "'aigne doc generate'"
75
- AIGNE-CLI.config-check -> AIGNE-CLI.interactive-setup: "[いいえ] 2. セットアップの開始"
76
- AIGNE-CLI.interactive-setup -> AIGNE-CLI.generation-process: "設定ファイルの作成"
77
- AIGNE-CLI.config-check -> AIGNE-CLI.generation-process: "[はい]"
78
- AIGNE-CLI.generation-process -> AIGNE-CLI.output: "4. ドキュメントの書き込み"
79
- ```
80
-
81
- ## コマンドオプション
82
-
83
- デフォルトの `generate` コマンドは、ほとんどのユースケースで十分です。しかし、その動作を変更するためのいくつかのオプションが利用可能で、完全な再生成を強制したり、ドキュメント構造を洗練させたりするのに役立ちます。
84
-
85
- | オプション | 説明 | 例 |
86
- | :------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------- |
87
- | `--forceRegenerate` | 既存のドキュメントをすべて削除し、最初から再生成します。ソースコードや設定に大幅な変更を加えた後に使用してください。 | `aigne doc generate --forceRegenerate` |
88
- | `--feedback` | セクションの追加、削除、再編成など、ドキュメント全体の構造を洗練させるための大まかなフィードバックを提供します。 | `aigne doc generate --feedback "APIリファレンスを追加"` |
89
- | `--model` | コンテンツ生成に使用するAIGNE Hubの特定の大規模言語モデルを指定し、異なるモデルを切り替えることができます。 | `aigne doc generate --model openai:gpt-4o` |
90
-
91
- ## 次のステップ
92
-
93
- 最初のドキュメントを生成した後も、プロジェクトは進化し続けます。ドキュメントをコードと同期させるためには、更新を行う必要があります。次のセクションでは、新しい要件やコードの変更に基づいて、対象を絞った変更を行い、特定のファイルを再生成する方法について説明します。
94
-
95
- <x-card data-title="更新と改良" data-icon="lucide:file-edit" data-href="/features/update-and-refine">コードが変更された際のドキュメントの更新方法や、フィードバックを用いた特定の改善方法について学びます。</x-card>
@@ -1,95 +0,0 @@
1
- # Generate Documentation
2
-
3
- The `aigne doc generate` command is the primary function for creating a complete documentation set from your source code. This command initiates a process that analyzes your codebase, plans a logical documentation structure, and then generates content for each section. It is the standard method for creating your documentation from an initial state.
4
-
5
- ## Your First Generation
6
-
7
- To begin, navigate to your project's root directory and run the following command:
8
-
9
- ```bash aigne doc generate icon=lucide:play-circle
10
- aigne doc generate
11
- ```
12
-
13
- ### Automatic Configuration
14
-
15
- If you are running this command for the first time in a project, DocSmith will detect that no configuration exists. It will then automatically launch an interactive setup wizard to guide you through the required setup steps. This process ensures a valid configuration is in place before generation begins.
16
-
17
- ![Running generate command, smart execution of initialization](../assets/screenshots/doc-generate.png)
18
-
19
- You will be prompted to answer a series of questions to define key aspects of your documentation, including:
20
-
21
- * Document generation rules and style
22
- * The target audience
23
- * Primary language and any additional translation languages
24
- * Source code input and documentation output paths
25
-
26
- ![Answer questions to complete project setup](../assets/screenshots/doc-complete-setup.png)
27
-
28
- After the configuration is complete, DocSmith proceeds with the documentation generation.
29
-
30
- ![Executing structure planning and generating documents](../assets/screenshots/doc-generate-docs.png)
31
-
32
- Upon successful completion, the newly created documentation will be available in the output directory specified during setup.
33
-
34
- ![Documentation generated successfully](../assets/screenshots/doc-generated-successfully.png)
35
-
36
- ## The Generation Process
37
-
38
- The `generate` command executes an automated, multi-step workflow. The process is outlined below:
39
-
40
- ```d2
41
- direction: down
42
-
43
- User: {
44
- shape: c4-person
45
- }
46
-
47
- AIGNE-CLI: {
48
- label: "AIGNE CLI"
49
-
50
- config-check: {
51
- label: "Config file exists?"
52
- shape: diamond
53
- }
54
-
55
- interactive-setup: {
56
- label: "Interactive Setup Wizard"
57
- }
58
-
59
- generation-process: {
60
- label: "3. Generation Process"
61
-
62
- analyze-code: "Analyze Code"
63
- plan-structure: "Plan Structure"
64
- generate-content: "Generate Content"
65
-
66
- analyze-code -> plan-structure -> generate-content
67
- }
68
-
69
- output: {
70
- label: "Output Directory"
71
- }
72
- }
73
-
74
- User -> AIGNE-CLI.config-check: "'aigne doc generate'"
75
- AIGNE-CLI.config-check -> AIGNE-CLI.interactive-setup: "[No] 2. Launch setup"
76
- AIGNE-CLI.interactive-setup -> AIGNE-CLI.generation-process: "Create config file"
77
- AIGNE-CLI.config-check -> AIGNE-CLI.generation-process: "[Yes]"
78
- AIGNE-CLI.generation-process -> AIGNE-CLI.output: "4. Write documentation"
79
- ```
80
-
81
- ## Command Options
82
-
83
- The default `generate` command is sufficient for most use cases. However, several options are available to modify its behavior, which can be useful for forcing a full regeneration or refining the documentation structure.
84
-
85
- | Option | Description | Example |
86
- | :------------------ | :--------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------- |
87
- | `--forceRegenerate` | Deletes all existing documents and regenerates them from scratch. Use this after making significant changes to your source code or configuration. | `aigne doc generate --forceRegenerate` |
88
- | `--feedback` | Provides high-level feedback to refine the overall documentation structure, such as adding, removing, or reorganizing sections. | `aigne doc generate --feedback "Add an API Reference"` |
89
- | `--model` | Specifies a particular Large Language Model from AIGNE Hub to use for content generation, allowing you to switch between different models. | `aigne doc generate --model openai:gpt-4o` |
90
-
91
- ## What's Next?
92
-
93
- After generating the initial documentation, your project will continue to evolve. To keep your documents synchronized with your code, you will need to perform updates. The next section explains how to make targeted changes and regenerate specific files based on new requirements or code modifications.
94
-
95
- <x-card data-title="Update and Refine" data-icon="lucide:file-edit" data-href="/features/update-and-refine">Learn how to update documents when your code changes or make specific improvements using feedback.</x-card>