@aigne/doc-smith 0.8.11-beta.5 → 0.8.11-beta.7
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/.aigne/doc-smith/config.yaml +3 -1
- package/.aigne/doc-smith/output/structure-plan.json +2 -2
- package/.aigne/doc-smith/preferences.yml +28 -20
- package/.aigne/doc-smith/upload-cache.yaml +702 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -2
- package/README.md +2 -2
- package/agents/clear/choose-contents.mjs +2 -2
- package/agents/clear/clear-document-structure.mjs +8 -8
- package/agents/clear/index.yaml +1 -1
- package/agents/evaluate/document-structure.yaml +1 -1
- package/agents/generate/check-document-structure.yaml +3 -3
- package/agents/generate/check-need-generate-structure.mjs +8 -8
- package/agents/generate/document-structure-tools/add-document.mjs +38 -13
- package/agents/generate/document-structure-tools/delete-document.mjs +37 -14
- package/agents/generate/document-structure-tools/move-document.mjs +46 -19
- package/agents/generate/document-structure-tools/update-document.mjs +39 -12
- package/agents/generate/generate-structure.yaml +1 -1
- package/agents/generate/update-document-structure.yaml +3 -9
- package/agents/generate/user-review-document-structure.mjs +15 -14
- package/agents/translate/translate-document.yaml +1 -9
- package/agents/update/batch-generate-document.yaml +1 -1
- package/agents/update/check-document.mjs +2 -2
- package/agents/update/check-update-is-single.mjs +2 -1
- package/agents/update/document-tools/update-document-content.mjs +24 -14
- package/agents/update/fs-tools/glob.mjs +184 -0
- package/agents/update/fs-tools/grep.mjs +317 -0
- package/agents/update/fs-tools/read-file.mjs +307 -0
- package/agents/update/generate-document.yaml +4 -7
- package/agents/update/update-document-detail.yaml +6 -10
- package/agents/update/user-review-document.mjs +13 -13
- package/agents/utils/check-feedback-refiner.mjs +1 -1
- package/agents/utils/choose-docs.mjs +1 -1
- package/agents/utils/load-document-all-content.mjs +3 -3
- package/agents/utils/load-sources.mjs +1 -1
- package/agents/utils/save-docs.mjs +7 -28
- package/aigne.yaml +2 -2
- 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/docs/_sidebar.md +1 -1
- package/docs/advanced-how-it-works.ja.md +31 -31
- package/docs/advanced-how-it-works.md +10 -10
- package/docs/advanced-how-it-works.zh-TW.md +24 -24
- package/docs/advanced-how-it-works.zh.md +20 -20
- package/docs/advanced-quality-assurance.ja.md +57 -61
- package/docs/advanced-quality-assurance.md +57 -61
- package/docs/advanced-quality-assurance.zh-TW.md +57 -61
- package/docs/advanced-quality-assurance.zh.md +57 -61
- package/docs/advanced.ja.md +8 -4
- package/docs/advanced.md +7 -3
- package/docs/advanced.zh-TW.md +9 -5
- package/docs/advanced.zh.md +9 -5
- package/docs/changelog.ja.md +206 -29
- package/docs/changelog.md +177 -0
- package/docs/changelog.zh-TW.md +229 -52
- package/docs/changelog.zh.md +204 -27
- package/docs/cli-reference.ja.md +181 -80
- package/docs/cli-reference.md +168 -67
- package/docs/cli-reference.zh-TW.md +177 -76
- package/docs/cli-reference.zh.md +172 -71
- package/docs/configuration-interactive-setup.ja.md +45 -42
- package/docs/configuration-interactive-setup.md +9 -6
- package/docs/configuration-interactive-setup.zh-TW.md +26 -23
- package/docs/configuration-interactive-setup.zh.md +25 -22
- package/docs/configuration-language-support.ja.md +33 -63
- package/docs/configuration-language-support.md +32 -62
- package/docs/configuration-language-support.zh-TW.md +35 -65
- package/docs/configuration-language-support.zh.md +32 -62
- package/docs/configuration-llm-setup.ja.md +25 -23
- package/docs/configuration-llm-setup.md +20 -18
- package/docs/configuration-llm-setup.zh-TW.md +21 -19
- package/docs/configuration-llm-setup.zh.md +20 -18
- package/docs/configuration-preferences.ja.md +67 -52
- package/docs/configuration-preferences.md +55 -40
- package/docs/configuration-preferences.zh-TW.md +69 -54
- package/docs/configuration-preferences.zh.md +68 -53
- package/docs/configuration.ja.md +98 -58
- package/docs/configuration.md +42 -2
- package/docs/configuration.zh-TW.md +86 -46
- package/docs/configuration.zh.md +76 -36
- package/docs/features-generate-documentation.ja.md +49 -55
- package/docs/features-generate-documentation.md +49 -55
- package/docs/features-generate-documentation.zh-TW.md +54 -60
- package/docs/features-generate-documentation.zh.md +48 -54
- package/docs/features-publish-your-docs.ja.md +68 -45
- package/docs/features-publish-your-docs.md +65 -42
- package/docs/features-publish-your-docs.zh-TW.md +74 -51
- package/docs/features-publish-your-docs.zh.md +67 -44
- package/docs/features-translate-documentation.ja.md +46 -35
- package/docs/features-translate-documentation.md +39 -28
- package/docs/features-translate-documentation.zh-TW.md +45 -34
- package/docs/features-translate-documentation.zh.md +39 -28
- package/docs/features-update-and-refine.ja.md +75 -71
- package/docs/features-update-and-refine.md +67 -63
- package/docs/features-update-and-refine.zh-TW.md +72 -67
- package/docs/features-update-and-refine.zh.md +71 -67
- package/docs/features.ja.md +29 -19
- package/docs/features.md +25 -15
- package/docs/features.zh-TW.md +28 -18
- package/docs/features.zh.md +31 -21
- package/docs/getting-started.ja.md +43 -46
- package/docs/getting-started.md +36 -39
- package/docs/getting-started.zh-TW.md +41 -44
- package/docs/getting-started.zh.md +39 -42
- package/docs/overview.ja.md +63 -11
- package/docs/overview.md +62 -10
- package/docs/overview.zh-TW.md +67 -15
- package/docs/overview.zh.md +62 -10
- package/docs-mcp/analyze-docs-relevance.yaml +6 -6
- package/docs-mcp/docs-search.yaml +1 -1
- package/media.md +9 -9
- package/package.json +2 -2
- package/prompts/common/document-structure/conflict-resolution-guidance.md +3 -3
- package/prompts/common/document-structure/document-structure-rules.md +2 -2
- package/prompts/detail/custom/custom-components.md +304 -188
- package/prompts/detail/document-rules.md +5 -5
- package/prompts/detail/generate-document.md +21 -8
- package/prompts/detail/update-document.md +8 -12
- package/prompts/evaluate/document-structure.md +6 -6
- package/prompts/structure/check-document-structure.md +10 -10
- package/prompts/structure/document-rules.md +2 -2
- package/prompts/structure/generate-structure-system.md +3 -3
- package/prompts/structure/structure-example.md +1 -1
- package/prompts/structure/structure-getting-started.md +1 -1
- package/prompts/structure/update-document-structure.md +18 -14
- package/prompts/utils/feedback-refiner.md +3 -3
- package/tests/agents/clear/choose-contents.test.mjs +1 -1
- package/tests/agents/clear/clear-document-structure.test.mjs +36 -30
- package/tests/agents/evaluate/generate-report.test.mjs +1 -1
- package/tests/agents/generate/check-need-generate-structure.test.mjs +1 -1
- package/tests/agents/generate/document-structure-tools/add-document.test.mjs +2 -2
- package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +4 -4
- package/tests/agents/generate/document-structure-tools/move-document.test.mjs +12 -12
- package/tests/agents/generate/document-structure-tools/update-document.test.mjs +3 -3
- package/tests/agents/generate/user-review-document-structure.test.mjs +36 -13
- package/tests/agents/update/check-document.test.mjs +1 -1
- package/tests/agents/update/document-tools/update-document-content.test.mjs +115 -112
- package/tests/agents/update/fs-tools/glob.test.mjs +438 -0
- package/tests/agents/update/fs-tools/grep.test.mjs +279 -0
- package/tests/agents/update/fs-tools/read-file.test.mjs +553 -0
- package/tests/agents/update/user-review-document.test.mjs +48 -27
- package/tests/agents/utils/format-document-structure.test.mjs +5 -5
- package/tests/agents/utils/load-sources.test.mjs +4 -4
- package/tests/agents/utils/save-docs.test.mjs +1 -1
- package/tests/utils/conflict-detector.test.mjs +1 -1
- package/tests/utils/docs-finder-utils.test.mjs +8 -8
- package/types/document-schema.mjs +5 -6
- package/types/document-structure-schema.mjs +25 -13
- package/utils/conflict-detector.mjs +1 -1
- package/utils/constants/index.mjs +4 -4
- package/utils/docs-finder-utils.mjs +11 -11
- package/utils/markdown-checker.mjs +1 -1
|
@@ -9,60 +9,75 @@ The following diagram illustrates how your feedback becomes a reusable rule that
|
|
|
9
9
|
```d2 The Preference Lifecycle
|
|
10
10
|
direction: down
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
label: "
|
|
14
|
-
shape:
|
|
12
|
+
developer: {
|
|
13
|
+
label: "Developer"
|
|
14
|
+
shape: person
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
label: "
|
|
17
|
+
docsmith_system: {
|
|
18
|
+
label: "AIGNE DocSmith System"
|
|
19
19
|
shape: rectangle
|
|
20
|
-
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
label: "
|
|
42
|
+
preferences_file: {
|
|
43
|
+
label: ".aigne/doc-smith/preferences.yml"
|
|
29
44
|
shape: cylinder
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
label: "
|
|
34
|
-
shape:
|
|
47
|
+
one_time_fix: {
|
|
48
|
+
label: "Apply as a one-time fix"
|
|
49
|
+
shape: oval
|
|
35
50
|
}
|
|
36
51
|
|
|
37
|
-
cli:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
refiner -> decision: "Analyzes"
|
|
44
|
-
decision -> pref_file: "Yes"
|
|
45
|
-
decision -> "Discard (One-time fix)": "No"
|
|
46
|
-
pref_file -> future_tasks: "Applies to"
|
|
47
|
-
cli <-> pref_file: "Manages"
|
|
48
|
-
|
|
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"
|
|
49
58
|
```
|
|
50
59
|
|
|
51
60
|
### How Preferences are Created
|
|
52
61
|
|
|
53
|
-
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.
|
|
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.
|
|
54
63
|
|
|
55
64
|
### Rule Properties
|
|
56
65
|
|
|
57
66
|
Each rule saved in `preferences.yml` has the following structure:
|
|
58
67
|
|
|
59
|
-
<x-field
|
|
60
|
-
<x-field data-name="
|
|
61
|
-
<x-field data-name="
|
|
62
|
-
<x-field data-name="
|
|
63
|
-
<x-field
|
|
64
|
-
|
|
65
|
-
<x-field data-name="
|
|
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>
|
|
66
81
|
|
|
67
82
|
## Managing Preferences with the CLI
|
|
68
83
|
|
|
@@ -70,7 +85,7 @@ You can view and manage all your saved preferences using the `aigne doc prefs` c
|
|
|
70
85
|
|
|
71
86
|
### Listing All Preferences
|
|
72
87
|
|
|
73
|
-
To see all saved preferences, both active and inactive, use the `--list` flag.
|
|
88
|
+
To see a complete list of all saved preferences, both active and inactive, use the `--list` flag.
|
|
74
89
|
|
|
75
90
|
```bash List all preferences icon=lucide:terminal
|
|
76
91
|
aigne doc prefs --list
|
|
@@ -96,13 +111,13 @@ The command displays a formatted list showing the status, scope, ID, and any pat
|
|
|
96
111
|
|
|
97
112
|
### Deactivating and Reactivating Preferences
|
|
98
113
|
|
|
99
|
-
If you
|
|
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.
|
|
100
115
|
|
|
101
116
|
```bash Toggle preferences interactively icon=lucide:terminal
|
|
102
117
|
aigne doc prefs --toggle
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
To toggle a specific rule directly, provide its ID using the `--id` flag. This
|
|
120
|
+
To toggle a specific rule directly, provide its ID using the `--id` flag. This action changes the rule's `active` property.
|
|
106
121
|
|
|
107
122
|
```bash Toggle a specific preference icon=lucide:terminal
|
|
108
123
|
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
@@ -110,7 +125,7 @@ aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
|
110
125
|
|
|
111
126
|
### Removing Preferences
|
|
112
127
|
|
|
113
|
-
To permanently delete one or more preferences, use the `--remove` flag. This action
|
|
128
|
+
To permanently delete one or more preferences, use the `--remove` flag. This action cannot be undone.
|
|
114
129
|
|
|
115
130
|
For an interactive selection prompt, run the command without an ID.
|
|
116
131
|
|
|
@@ -118,7 +133,7 @@ For an interactive selection prompt, run the command without an ID.
|
|
|
118
133
|
aigne doc prefs --remove
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
To remove a specific rule directly
|
|
136
|
+
To remove a specific rule directly, provide its ID using the `--id` flag.
|
|
122
137
|
|
|
123
138
|
```bash Remove a specific preference icon=lucide:terminal
|
|
124
139
|
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
@@ -126,4 +141,4 @@ aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
|
126
141
|
|
|
127
142
|
## Next Steps
|
|
128
143
|
|
|
129
|
-
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).
|
|
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,90 +1,105 @@
|
|
|
1
1
|
# 管理偏好設定
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith
|
|
3
|
+
AIGNE DocSmith 的設計旨在從您的回饋中學習。當您優化或修正生成的內容時,DocSmith 可以將該回饋轉化為持久性規則,稱為偏好設定。這些規則確保您特定的風格、結構要求和內容策略在未來的文檔任務中得到一致應用。所有偏好設定都儲存在您專案根目錄下一個人類可讀的 YAML 檔案中,路徑為 `.aigne/doc-smith/preferences.yml`。
|
|
4
4
|
|
|
5
5
|
## 偏好設定的生命週期
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
下圖說明了您的回饋如何成為一個可重複使用的規則,該規則可應用於未來的任務,並可透過命令列進行管理。
|
|
8
8
|
|
|
9
|
-
```d2
|
|
9
|
+
```d2 偏好設定的生命週期
|
|
10
10
|
direction: down
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
label: "
|
|
14
|
-
shape:
|
|
12
|
+
developer: {
|
|
13
|
+
label: "開發者"
|
|
14
|
+
shape: person
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
label: "
|
|
17
|
+
docsmith_system: {
|
|
18
|
+
label: "AIGNE DocSmith 系統"
|
|
19
19
|
shape: rectangle
|
|
20
|
-
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
label: "
|
|
42
|
+
preferences_file: {
|
|
43
|
+
label: ".aigne/doc-smith/preferences.yml"
|
|
29
44
|
shape: cylinder
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
label: "
|
|
34
|
-
shape:
|
|
47
|
+
one_time_fix: {
|
|
48
|
+
label: "作為一次性修復應用"
|
|
49
|
+
shape: oval
|
|
35
50
|
}
|
|
36
51
|
|
|
37
|
-
cli:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
refiner -> decision: "分析"
|
|
44
|
-
decision -> pref_file: "是"
|
|
45
|
-
decision -> "捨棄(一次性修復)": "否"
|
|
46
|
-
pref_file -> future_tasks: "應用於"
|
|
47
|
-
cli <-> pref_file: "管理"
|
|
48
|
-
|
|
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: "否"
|
|
49
58
|
```
|
|
50
59
|
|
|
51
60
|
### 如何建立偏好設定
|
|
52
61
|
|
|
53
|
-
當您在 `refine` 或 `translate` 階段提供回饋時,一個內部
|
|
62
|
+
當您在 `refine` 或 `translate` 階段提供回饋時,一個內部 Agent 會分析您的輸入。它會判斷該回饋是一次性修復(例如,修正一個錯字)還是可重複使用的策略(例如,「程式碼註解必須以英文撰寫」)。如果它代表一個持久性的指令,它會建立一個新的偏好設定規則,並將其儲存到您專案的 `preferences.yml` 檔案中。
|
|
54
63
|
|
|
55
64
|
### 規則屬性
|
|
56
65
|
|
|
57
66
|
儲存在 `preferences.yml` 中的每個規則都具有以下結構:
|
|
58
67
|
|
|
59
|
-
<x-field
|
|
60
|
-
<x-field data-name="
|
|
61
|
-
<x-field data-name="
|
|
62
|
-
<x-field data-name="
|
|
63
|
-
<x-field
|
|
64
|
-
|
|
65
|
-
<x-field data-name="
|
|
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>
|
|
66
81
|
|
|
67
82
|
## 使用 CLI 管理偏好設定
|
|
68
83
|
|
|
69
|
-
您可以使用 `aigne doc prefs`
|
|
84
|
+
您可以使用 `aigne doc prefs` 指令來檢視和管理所有已儲存的偏好設定。這讓您可以列出、啟用、停用或永久移除規則。
|
|
70
85
|
|
|
71
86
|
### 列出所有偏好設定
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
要查看所有已儲存偏好設定的完整列表(包括啟用和未啟用的),請使用 `--list` 標記。
|
|
74
89
|
|
|
75
|
-
```bash
|
|
90
|
+
```bash 列出所有偏好設定 icon=lucide:terminal
|
|
76
91
|
aigne doc prefs --list
|
|
77
92
|
```
|
|
78
93
|
|
|
79
|
-
|
|
94
|
+
該指令會顯示一個格式化的列表,顯示每個規則的狀態、範圍、ID 以及任何路徑限制。
|
|
80
95
|
|
|
81
|
-
```text
|
|
96
|
+
```text 輸出範例 icon=lucide:clipboard-list
|
|
82
97
|
# 使用者偏好設定
|
|
83
98
|
|
|
84
99
|
**格式說明:**
|
|
85
100
|
- 🟢 = 啟用中的偏好設定,⚪ = 未啟用的偏好設定
|
|
86
101
|
- [scope] = 偏好設定範圍 (global, structure, document, translation)
|
|
87
|
-
- ID =
|
|
102
|
+
- ID = 唯一偏好設定識別碼
|
|
88
103
|
- Paths = 特定檔案路徑(如果適用)
|
|
89
104
|
|
|
90
105
|
🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
|
|
@@ -94,36 +109,36 @@ aigne doc prefs --list
|
|
|
94
109
|
程式碼註解必須以英文撰寫。
|
|
95
110
|
```
|
|
96
111
|
|
|
97
|
-
###
|
|
112
|
+
### 停用與重新啟用偏好設定
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
如果您需要暫時停用一個規則而不刪除它,您可以使用 `--toggle` 標記來切換其啟用狀態。若執行指令時不帶 ID,將會啟動互動模式,讓您選擇一個或多個偏好設定進行切換。
|
|
100
115
|
|
|
101
|
-
```bash
|
|
116
|
+
```bash 以互動模式切換偏好設定 icon=lucide:terminal
|
|
102
117
|
aigne doc prefs --toggle
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
|
|
120
|
+
要直接切換特定規則,請使用 `--id` 標記提供其 ID。此操作會更改規則的 `active` 屬性。
|
|
106
121
|
|
|
107
|
-
```bash
|
|
122
|
+
```bash 切換特定偏好設定 icon=lucide:terminal
|
|
108
123
|
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
109
124
|
```
|
|
110
125
|
|
|
111
126
|
### 移除偏好設定
|
|
112
127
|
|
|
113
|
-
|
|
128
|
+
要永久刪除一個或多個偏好設定,請使用 `--remove` 標記。此操作無法復原。
|
|
114
129
|
|
|
115
|
-
若要進入互動式選擇提示,請在不帶 ID
|
|
130
|
+
若要進入互動式選擇提示,請在不帶 ID 的情況下執行該指令。
|
|
116
131
|
|
|
117
|
-
```bash
|
|
132
|
+
```bash 以互動模式移除偏好設定 icon=lucide:terminal
|
|
118
133
|
aigne doc prefs --remove
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
要直接移除特定規則,請使用 `--id` 標記提供其 ID。
|
|
122
137
|
|
|
123
|
-
```bash
|
|
138
|
+
```bash 移除特定偏好設定 icon=lucide:terminal
|
|
124
139
|
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
125
140
|
```
|
|
126
141
|
|
|
127
142
|
## 後續步驟
|
|
128
143
|
|
|
129
|
-
|
|
144
|
+
管理偏好設定是根據您專案的特定需求量身打造 DocSmith 的關鍵部分。如需更多自訂選項,請探索主要的[設定指南](./configuration.md)。
|
|
@@ -1,68 +1,83 @@
|
|
|
1
1
|
# 管理偏好设置
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith
|
|
3
|
+
AIGNE DocSmith 旨在从您的反馈中学习。当您优化或纠正生成的内容时,DocSmith 可以将该反馈转换为持久性规则,称为偏好设置。这些规则确保您特定的风格、结构要求和内容策略在未来的文档任务中得到一致的应用。所有偏好设置都存储在位于您项目根目录下的一个人类可读的 YAML 文件中:`.aigne/doc-smith/preferences.yml`。
|
|
4
4
|
|
|
5
5
|
## 偏好设置的生命周期
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
下图说明了您的反馈如何成为一个可重用的规则,该规则可以应用于未来的任务并通过命令行进行管理。
|
|
8
8
|
|
|
9
9
|
```d2 偏好设置的生命周期
|
|
10
10
|
direction: down
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
label: "
|
|
14
|
-
shape:
|
|
12
|
+
developer: {
|
|
13
|
+
label: "开发者"
|
|
14
|
+
shape: person
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
label: "
|
|
17
|
+
docsmith_system: {
|
|
18
|
+
label: "AIGNE DocSmith 系统"
|
|
19
19
|
shape: rectangle
|
|
20
|
-
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
}
|
|
25
40
|
}
|
|
26
41
|
|
|
27
|
-
|
|
28
|
-
label: "
|
|
42
|
+
preferences_file: {
|
|
43
|
+
label: ".aigne/doc-smith/preferences.yml"
|
|
29
44
|
shape: cylinder
|
|
30
45
|
}
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
label: "
|
|
34
|
-
shape:
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
cli: {
|
|
38
|
-
label: "5. CLI 管理\n('aigne doc prefs')"
|
|
39
|
-
shape: rectangle
|
|
47
|
+
one_time_fix: {
|
|
48
|
+
label: "作为一次性修复应用"
|
|
49
|
+
shape: oval
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
decision ->
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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: "否"
|
|
49
58
|
```
|
|
50
59
|
|
|
51
60
|
### 如何创建偏好设置
|
|
52
61
|
|
|
53
|
-
当您在 `refine` 或 `translate` 阶段提供反馈时,一个内部 Agent
|
|
62
|
+
当您在 `refine` 或 `translate` 阶段提供反馈时,一个内部 Agent 会分析您的输入。它会判断该反馈是一次性修复(例如,纠正拼写错误)还是可重用策略(例如,“代码注释必须用英文编写”)。如果它代表一个持久性指令,Agent 就会创建一条新的偏好规则并将其保存到您项目的 `preferences.yml` 文件中。
|
|
54
63
|
|
|
55
64
|
### 规则属性
|
|
56
65
|
|
|
57
|
-
保存在 `preferences.yml`
|
|
58
|
-
|
|
59
|
-
<x-field
|
|
60
|
-
<x-field data-name="
|
|
61
|
-
<x-field data-name="
|
|
62
|
-
<x-field data-name="
|
|
63
|
-
<x-field
|
|
64
|
-
|
|
65
|
-
<x-field data-name="
|
|
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>
|
|
66
81
|
|
|
67
82
|
## 使用 CLI 管理偏好设置
|
|
68
83
|
|
|
@@ -70,39 +85,39 @@ cli <-> pref_file: "管理"
|
|
|
70
85
|
|
|
71
86
|
### 列出所有偏好设置
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
要查看所有已保存的偏好设置(包括激活和未激活的)的完整列表,请使用 `--list` 标志。
|
|
74
89
|
|
|
75
90
|
```bash 列出所有偏好设置 icon=lucide:terminal
|
|
76
91
|
aigne doc prefs --list
|
|
77
92
|
```
|
|
78
93
|
|
|
79
|
-
|
|
94
|
+
该命令会显示一个格式化的列表,其中显示了每条规则的状态、范围、ID 以及任何路径限制。
|
|
80
95
|
|
|
81
|
-
```text
|
|
96
|
+
```text 输出示例 icon=lucide:clipboard-list
|
|
82
97
|
# 用户偏好设置
|
|
83
98
|
|
|
84
99
|
**格式说明:**
|
|
85
|
-
- 🟢 =
|
|
86
|
-
- [scope] =
|
|
87
|
-
- ID =
|
|
88
|
-
- Paths =
|
|
100
|
+
- 🟢 = 激活的偏好设置, ⚪ = 未激活的偏好设置
|
|
101
|
+
- [scope] = 偏好范围 (global, structure, document, translation)
|
|
102
|
+
- ID = 唯一偏好标识符
|
|
103
|
+
- Paths = 特定文件路径 (如果适用)
|
|
89
104
|
|
|
90
105
|
🟢 [structure] pref_a1b2c3d4e5f6g7h8 | Paths: overview.md
|
|
91
|
-
|
|
106
|
+
在概览文档末尾添加一个“后续步骤”部分。
|
|
92
107
|
|
|
93
108
|
⚪ [document] pref_i9j0k1l2m3n4o5p6
|
|
94
|
-
|
|
109
|
+
代码注释必须用英文编写。
|
|
95
110
|
```
|
|
96
111
|
|
|
97
112
|
### 停用和重新激活偏好设置
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
如果您需要暂时禁用某条规则而不删除它,可以使用 `--toggle` 标志切换其激活状态。在不带 ID 的情况下运行该命令将启动交互模式,允许您选择一个或多个偏好设置进行切换。
|
|
100
115
|
|
|
101
116
|
```bash 以交互方式切换偏好设置 icon=lucide:terminal
|
|
102
117
|
aigne doc prefs --toggle
|
|
103
118
|
```
|
|
104
119
|
|
|
105
|
-
要直接切换特定规则,请使用 `--id` 标志提供其 ID
|
|
120
|
+
要直接切换特定规则,请使用 `--id` 标志提供其 ID。此操作会更改规则的 `active` 属性。
|
|
106
121
|
|
|
107
122
|
```bash 切换特定偏好设置 icon=lucide:terminal
|
|
108
123
|
aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
@@ -110,15 +125,15 @@ aigne doc prefs --toggle --id pref_i9j0k1l2m3n4o5p6
|
|
|
110
125
|
|
|
111
126
|
### 删除偏好设置
|
|
112
127
|
|
|
113
|
-
要永久删除一个或多个偏好设置,请使用 `--remove`
|
|
128
|
+
要永久删除一个或多个偏好设置,请使用 `--remove` 标志。此操作无法撤销。
|
|
114
129
|
|
|
115
|
-
|
|
130
|
+
要获得交互式选择提示,请在不带 ID 的情况下运行该命令。
|
|
116
131
|
|
|
117
132
|
```bash 以交互方式删除偏好设置 icon=lucide:terminal
|
|
118
133
|
aigne doc prefs --remove
|
|
119
134
|
```
|
|
120
135
|
|
|
121
|
-
|
|
136
|
+
要直接删除特定规则,请使用 `--id` 标志提供其 ID。
|
|
122
137
|
|
|
123
138
|
```bash 删除特定偏好设置 icon=lucide:terminal
|
|
124
139
|
aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
@@ -126,4 +141,4 @@ aigne doc prefs --remove --id pref_a1b2c3d4e5f6g7h8
|
|
|
126
141
|
|
|
127
142
|
## 后续步骤
|
|
128
143
|
|
|
129
|
-
管理偏好设置是根据项目特定需求定制 DocSmith
|
|
144
|
+
管理偏好设置是根据项目特定需求定制 DocSmith 的关键部分。有关更多自定义选项,请浏览主要的[配置指南](./configuration.md)。
|