@aigne/doc-smith 0.9.8-alpha.2 → 0.9.8-alpha.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.
- package/CLAUDE.md +43 -0
- package/README.md +94 -250
- package/aigne.yaml +2 -149
- package/doc-smith/SKILL.md +117 -0
- package/doc-smith/references/changeset_schema.md +118 -0
- package/doc-smith/references/document_structure_schema.md +139 -0
- package/doc-smith/references/document_update_guide.md +193 -0
- package/doc-smith/references/structure_confirmation_guide.md +133 -0
- package/doc-smith/references/structure_planning_guide.md +146 -0
- package/doc-smith/references/user_intent_guide.md +172 -0
- package/doc-smith.yaml +114 -0
- package/main-system-prompt.md +56 -0
- package/package.json +3 -69
- package/scripts/README.md +90 -0
- package/scripts/install.sh +86 -0
- package/scripts/uninstall.sh +52 -0
- package/CHANGELOG.md +0 -994
- package/LICENSE +0 -93
- package/agentic-agents/common/base-info.md +0 -53
- package/agentic-agents/common/planner.md +0 -168
- package/agentic-agents/common/worker.md +0 -93
- package/agentic-agents/create/index.yaml +0 -118
- package/agentic-agents/create/objective.md +0 -44
- package/agentic-agents/create/set-custom-prompt.mjs +0 -27
- package/agentic-agents/detail/index.yaml +0 -95
- package/agentic-agents/detail/objective.md +0 -9
- package/agentic-agents/detail/set-custom-prompt.mjs +0 -88
- package/agentic-agents/predict-resources/index.yaml +0 -44
- package/agentic-agents/predict-resources/instructions.md +0 -61
- package/agentic-agents/structure/design-rules.md +0 -39
- package/agentic-agents/structure/index.yaml +0 -86
- package/agentic-agents/structure/objective.md +0 -14
- package/agentic-agents/structure/review-criteria.md +0 -55
- package/agentic-agents/structure/set-custom-prompt.mjs +0 -78
- package/agentic-agents/utils/init-workspace-cache.mjs +0 -171
- package/agentic-agents/utils/load-base-sources.mjs +0 -20
- package/agentic-agents/workspace-cache-sharing-design.md +0 -671
- package/agents/chat/chat-system.md +0 -38
- package/agents/chat/index.mjs +0 -59
- package/agents/chat/skills/generate-document.yaml +0 -15
- package/agents/chat/skills/list-documents.mjs +0 -15
- package/agents/chat/skills/update-document.yaml +0 -24
- package/agents/clear/choose-contents.mjs +0 -192
- package/agents/clear/clear-auth-tokens.mjs +0 -88
- package/agents/clear/clear-deployment-config.mjs +0 -49
- package/agents/clear/clear-document-config.mjs +0 -36
- package/agents/clear/clear-document-structure.mjs +0 -102
- package/agents/clear/clear-generated-docs.mjs +0 -142
- package/agents/clear/clear-media-description.mjs +0 -129
- package/agents/clear/index.yaml +0 -26
- package/agents/create/analyze-diagram-type-llm.yaml +0 -160
- package/agents/create/analyze-diagram-type.mjs +0 -297
- package/agents/create/check-document-structure.yaml +0 -30
- package/agents/create/check-need-generate-structure.mjs +0 -105
- package/agents/create/document-structure-tools/add-document.mjs +0 -85
- package/agents/create/document-structure-tools/delete-document.mjs +0 -116
- package/agents/create/document-structure-tools/move-document.mjs +0 -109
- package/agents/create/document-structure-tools/update-document.mjs +0 -84
- package/agents/create/generate-diagram-image.yaml +0 -60
- package/agents/create/generate-structure.yaml +0 -117
- package/agents/create/index.yaml +0 -49
- package/agents/create/refine-document-structure.yaml +0 -12
- package/agents/create/replace-d2-with-image.mjs +0 -625
- package/agents/create/update-document-structure.yaml +0 -54
- package/agents/create/user-add-document/add-documents-to-structure.mjs +0 -90
- package/agents/create/user-add-document/find-documents-to-add-links.yaml +0 -47
- package/agents/create/user-add-document/index.yaml +0 -46
- package/agents/create/user-add-document/prepare-documents-to-translate.mjs +0 -22
- package/agents/create/user-add-document/print-add-document-summary.mjs +0 -63
- package/agents/create/user-add-document/review-documents-with-new-links.mjs +0 -110
- package/agents/create/user-remove-document/find-documents-with-invalid-links.mjs +0 -78
- package/agents/create/user-remove-document/index.yaml +0 -40
- package/agents/create/user-remove-document/prepare-documents-to-translate.mjs +0 -22
- package/agents/create/user-remove-document/print-remove-document-summary.mjs +0 -53
- package/agents/create/user-remove-document/remove-documents-from-structure.mjs +0 -99
- package/agents/create/user-remove-document/review-documents-with-invalid-links.mjs +0 -115
- package/agents/create/user-review-document-structure.mjs +0 -140
- package/agents/create/utils/init-current-content.mjs +0 -34
- package/agents/create/utils/merge-document-structures.mjs +0 -30
- package/agents/evaluate/code-snippet.mjs +0 -97
- package/agents/evaluate/document-structure.yaml +0 -67
- package/agents/evaluate/document.yaml +0 -82
- package/agents/evaluate/generate-report.mjs +0 -85
- package/agents/evaluate/index.yaml +0 -46
- package/agents/history/index.yaml +0 -6
- package/agents/history/view.mjs +0 -78
- package/agents/init/check.mjs +0 -16
- package/agents/init/index.mjs +0 -275
- package/agents/init/validate.mjs +0 -16
- package/agents/localize/choose-language.mjs +0 -107
- package/agents/localize/index.yaml +0 -58
- package/agents/localize/record-translation-history.mjs +0 -23
- package/agents/localize/translate-document.yaml +0 -24
- package/agents/localize/translate-multilingual.yaml +0 -51
- package/agents/media/batch-generate-media-description.yaml +0 -46
- package/agents/media/generate-media-description.yaml +0 -50
- package/agents/media/load-media-description.mjs +0 -256
- package/agents/prefs/index.mjs +0 -203
- package/agents/publish/index.yaml +0 -26
- package/agents/publish/publish-docs.mjs +0 -356
- package/agents/publish/translate-meta.mjs +0 -103
- package/agents/schema/document-structure-item.yaml +0 -26
- package/agents/schema/document-structure-refine-item.yaml +0 -23
- package/agents/schema/document-structure.yaml +0 -29
- package/agents/update/batch-generate-document.yaml +0 -27
- package/agents/update/batch-update-document.yaml +0 -7
- package/agents/update/check-diagram-flag.mjs +0 -116
- package/agents/update/check-document.mjs +0 -162
- package/agents/update/check-generate-diagram.mjs +0 -106
- package/agents/update/check-sync-image-flag.mjs +0 -55
- package/agents/update/check-update-is-single.mjs +0 -53
- package/agents/update/document-tools/update-document-content.mjs +0 -303
- package/agents/update/generate-diagram.yaml +0 -63
- package/agents/update/generate-document.yaml +0 -70
- package/agents/update/handle-document-update.yaml +0 -103
- package/agents/update/index.yaml +0 -79
- package/agents/update/pre-check-generate-diagram.yaml +0 -44
- package/agents/update/save-and-translate-document.mjs +0 -76
- package/agents/update/sync-images-and-exit.mjs +0 -148
- package/agents/update/update-document-detail.yaml +0 -71
- package/agents/update/update-single/update-single-document-detail.mjs +0 -280
- package/agents/update/update-single-document.yaml +0 -7
- package/agents/update/user-review-document.mjs +0 -272
- package/agents/utils/action-success.mjs +0 -16
- package/agents/utils/analyze-document-feedback-intent.yaml +0 -32
- package/agents/utils/analyze-feedback-intent.mjs +0 -136
- package/agents/utils/analyze-structure-feedback-intent.yaml +0 -29
- package/agents/utils/check-detail-result.mjs +0 -38
- package/agents/utils/check-feedback-refiner.mjs +0 -81
- package/agents/utils/choose-docs.mjs +0 -293
- package/agents/utils/document-icon-generate.yaml +0 -52
- package/agents/utils/document-title-streamline.yaml +0 -48
- package/agents/utils/ensure-document-icons.mjs +0 -129
- package/agents/utils/exit.mjs +0 -6
- package/agents/utils/feedback-refiner.yaml +0 -50
- package/agents/utils/find-item-by-path.mjs +0 -114
- package/agents/utils/find-user-preferences-by-path.mjs +0 -37
- package/agents/utils/format-document-structure.mjs +0 -35
- package/agents/utils/generate-document-or-skip.mjs +0 -41
- package/agents/utils/handle-diagram-operations.mjs +0 -263
- package/agents/utils/load-all-document-content.mjs +0 -30
- package/agents/utils/load-document-all-content.mjs +0 -84
- package/agents/utils/load-sources.mjs +0 -405
- package/agents/utils/map-reasoning-effort-level.mjs +0 -15
- package/agents/utils/post-generate.mjs +0 -144
- package/agents/utils/read-current-document-content.mjs +0 -46
- package/agents/utils/save-doc-translation.mjs +0 -61
- package/agents/utils/save-doc.mjs +0 -88
- package/agents/utils/save-output.mjs +0 -26
- package/agents/utils/save-sidebar.mjs +0 -51
- package/agents/utils/skip-if-content-exists.mjs +0 -27
- package/agents/utils/streamline-document-titles-if-needed.mjs +0 -88
- package/agents/utils/transform-detail-data-sources.mjs +0 -45
- package/agents/utils/update-branding.mjs +0 -84
- package/assets/report-template/report.html +0 -198
- package/docs-mcp/analyze-content-relevance.yaml +0 -50
- package/docs-mcp/analyze-docs-relevance.yaml +0 -59
- package/docs-mcp/docs-search.yaml +0 -42
- package/docs-mcp/get-docs-detail.mjs +0 -41
- package/docs-mcp/get-docs-structure.mjs +0 -16
- package/docs-mcp/read-doc-content.mjs +0 -119
- package/prompts/common/document/content-rules-core.md +0 -20
- package/prompts/common/document/markdown-syntax-rules.md +0 -65
- package/prompts/common/document/media-file-list-usage-rules.md +0 -18
- package/prompts/common/document/openapi-usage-rules.md +0 -189
- package/prompts/common/document/role-and-personality.md +0 -16
- package/prompts/common/document/user-preferences.md +0 -9
- package/prompts/common/document-structure/conflict-resolution-guidance.md +0 -16
- package/prompts/common/document-structure/document-icon-generate.md +0 -116
- package/prompts/common/document-structure/document-structure-rules.md +0 -43
- package/prompts/common/document-structure/document-title-streamline.md +0 -86
- package/prompts/common/document-structure/glossary.md +0 -7
- package/prompts/common/document-structure/intj-traits.md +0 -5
- package/prompts/common/document-structure/openapi-usage-rules.md +0 -28
- package/prompts/common/document-structure/output-constraints.md +0 -18
- package/prompts/common/document-structure/user-locale-rules.md +0 -10
- package/prompts/common/document-structure/user-preferences.md +0 -9
- package/prompts/detail/custom/admonition-usage-rules.md +0 -94
- package/prompts/detail/custom/code-block-usage-rules.md +0 -163
- package/prompts/detail/custom/custom-components/x-card-usage-rules.md +0 -63
- package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +0 -83
- package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +0 -120
- package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +0 -80
- package/prompts/detail/custom/custom-components/x-field-usage-rules.md +0 -189
- package/prompts/detail/custom/custom-components-usage-rules.md +0 -18
- package/prompts/detail/diagram/generate-image-system.md +0 -135
- package/prompts/detail/diagram/generate-image-user.md +0 -32
- package/prompts/detail/diagram/guide.md +0 -29
- package/prompts/detail/diagram/official-examples.md +0 -712
- package/prompts/detail/diagram/pre-check.md +0 -23
- package/prompts/detail/diagram/role-and-personality.md +0 -2
- package/prompts/detail/diagram/rules.md +0 -46
- package/prompts/detail/diagram/system-prompt.md +0 -1139
- package/prompts/detail/diagram/user-prompt.md +0 -43
- package/prompts/detail/generate/detail-example.md +0 -457
- package/prompts/detail/generate/document-rules.md +0 -45
- package/prompts/detail/generate/system-prompt.md +0 -61
- package/prompts/detail/generate/user-prompt.md +0 -99
- package/prompts/detail/jsx/rules.md +0 -6
- package/prompts/detail/update/system-prompt.md +0 -121
- package/prompts/detail/update/user-prompt.md +0 -41
- package/prompts/evaluate/document-structure.md +0 -93
- package/prompts/evaluate/document.md +0 -149
- package/prompts/media/media-description/system-prompt.md +0 -43
- package/prompts/media/media-description/user-prompt.md +0 -17
- package/prompts/structure/check-document-structure.md +0 -93
- package/prompts/structure/document-rules.md +0 -21
- package/prompts/structure/find-documents-to-add-links.md +0 -52
- package/prompts/structure/generate/system-prompt.md +0 -13
- package/prompts/structure/generate/user-prompt.md +0 -137
- package/prompts/structure/review/structure-review-system.md +0 -81
- package/prompts/structure/structure-example.md +0 -89
- package/prompts/structure/structure-getting-started.md +0 -10
- package/prompts/structure/update/system-prompt.md +0 -93
- package/prompts/structure/update/user-prompt.md +0 -43
- package/prompts/translate/admonition.md +0 -20
- package/prompts/translate/code-block.md +0 -33
- package/prompts/translate/glossary.md +0 -6
- package/prompts/translate/translate-document.md +0 -305
- package/prompts/utils/analyze-document-feedback-intent.md +0 -54
- package/prompts/utils/analyze-structure-feedback-intent.md +0 -43
- package/prompts/utils/feedback-refiner.md +0 -105
- package/types/document-schema.mjs +0 -55
- package/types/document-structure-schema.mjs +0 -261
- package/utils/auth-utils.mjs +0 -275
- package/utils/blocklet.mjs +0 -104
- package/utils/check-document-has-diagram.mjs +0 -95
- package/utils/conflict-detector.mjs +0 -149
- package/utils/constants/index.mjs +0 -620
- package/utils/constants/linter.mjs +0 -102
- package/utils/d2-utils.mjs +0 -198
- package/utils/debug.mjs +0 -3
- package/utils/delete-diagram-images.mjs +0 -99
- package/utils/deploy.mjs +0 -86
- package/utils/docs-finder-utils.mjs +0 -623
- package/utils/evaluate/report-utils.mjs +0 -132
- package/utils/extract-api.mjs +0 -32
- package/utils/file-utils.mjs +0 -960
- package/utils/history-utils.mjs +0 -203
- package/utils/icon-map.mjs +0 -26
- package/utils/image-compress.mjs +0 -75
- package/utils/kroki-utils.mjs +0 -173
- package/utils/linter/index.mjs +0 -50
- package/utils/load-config.mjs +0 -107
- package/utils/markdown/index.mjs +0 -26
- package/utils/markdown-checker.mjs +0 -694
- package/utils/mermaid-validator.mjs +0 -140
- package/utils/mermaid-worker-pool.mjs +0 -250
- package/utils/mermaid-worker.mjs +0 -233
- package/utils/openapi/index.mjs +0 -28
- package/utils/preferences-utils.mjs +0 -175
- package/utils/request.mjs +0 -10
- package/utils/store/index.mjs +0 -45
- package/utils/sync-diagram-to-translations.mjs +0 -262
- package/utils/upload-files.mjs +0 -231
- package/utils/utils.mjs +0 -1354
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
<role_and_goal>
|
|
2
|
-
|
|
3
|
-
You are an **Elite Polyglot Localization and Translation Specialist** with extensive professional experience across multiple domains. Your core mission is to produce translations that are not only **100% accurate** to the source meaning but are also **natively fluent, highly readable, and culturally appropriate** in the target language.
|
|
4
|
-
|
|
5
|
-
Core Mandates:
|
|
6
|
-
|
|
7
|
-
1. Semantic Fidelity (Accuracy): The translation must perfectly and comprehensively convey the **entire meaning, tone, and nuance** of the source text. **No omission, addition, or distortion of the original content** is permitted.
|
|
8
|
-
2. Native Fluency and Style: The resulting text must adhere strictly to the target language's **grammar, syntax, and idiomatic expressions**. The translation must **sound like it was originally written by a native speaker**, completely **free of grammatical errors**, avoid "translationese" (literal, stiff, or unnatural phrasing).
|
|
9
|
-
3. Readability and Flow: The final output must be **smooth, logical, and highly readable**. Sentences must flow naturally, ensuring a pleasant and coherent reading experience for the target audience.
|
|
10
|
-
4. Localization and Clarity: Where a **literal (word-for-word) translation** of a term, phrase, or idiom would be **uncommon, confusing, or ambiguous** in the target language, you must apply **localization best practices**. This means translating the **concept** into the most **idiomatic, common, and easily understandable expression** in the target language.
|
|
11
|
-
5. Versatility and Scope: You are proficient in handling **any pair of requested languages** (e.g., Chinese <--> English, English <--> Japanese) and are adept at translating diverse **document types**, including but not limited to: **Technical Manuals, Business Reports, Marketing Copy/Ads, Legal Documents, Academic Papers, and General Correspondence.**
|
|
12
|
-
|
|
13
|
-
</role_and_goal>
|
|
14
|
-
|
|
15
|
-
<translation_rules>
|
|
16
|
-
Translation Requirements:
|
|
17
|
-
|
|
18
|
-
- Avoid Exaggeration: Avoid using emotionally charged or subjective words (for example, "excited" or "shocked").
|
|
19
|
-
- Preserve Original Structure: Translate only the content portions without modifying tags or introducing any extra content or punctuation. Do not add markdown syntax at the outermost level. Ensure the translated structure matches the original, preserving line breaks and blank lines from the source.
|
|
20
|
-
- Strictly Protect Markdown Syntax: All Markdown syntax characters, including but not limited to `|` and `-` in tables, `*` and `-` in lists, `#` in headings, `` ` `` in code blocks, etc., must be **copied exactly**, with no modification, addition, deletion, or merging. Table separators (e.g., `|---|---|---|`) must match the original column count and format exactly, with separator columns matching table data columns.
|
|
21
|
-
- Use Terminology Reference: Ensure accuracy and consistency of professional terminology.
|
|
22
|
-
- Preserve Terms: Retain specific terms in their original form, avoiding translation.
|
|
23
|
-
- Maintain tone consistency: use a neutral tone for developer/DevOps docs, a polite tone for end-user/client docs, and do not mix address styles (e.g., **"you"** vs **"您"**).
|
|
24
|
-
- Translate Descriptions Only in <x-field>: All `<x-field>` component attributes must maintain the original format. Only translate the description content within `data-desc` attribute or `<x-field-desc>` elements.
|
|
25
|
-
|
|
26
|
-
{% include "./code-block.md" %}
|
|
27
|
-
|
|
28
|
-
{% include "./admonition.md" %}
|
|
29
|
-
</translation_rules>
|
|
30
|
-
|
|
31
|
-
{% if feedback %}
|
|
32
|
-
<translation_user_feedback>
|
|
33
|
-
{{ feedback }}
|
|
34
|
-
</translation_user_feedback>
|
|
35
|
-
{% endif %}
|
|
36
|
-
|
|
37
|
-
{% if detailFeedback %}
|
|
38
|
-
<translation_review_feedback>
|
|
39
|
-
{{ detailFeedback }}
|
|
40
|
-
</translation_review_feedback>
|
|
41
|
-
{% endif %}
|
|
42
|
-
|
|
43
|
-
{% if userPreferences %}
|
|
44
|
-
<user_preferences>
|
|
45
|
-
{{userPreferences}}
|
|
46
|
-
|
|
47
|
-
User preference guidelines:
|
|
48
|
-
|
|
49
|
-
- User preferences are derived from feedback provided in previous user interactions. When generating translations, consider user preferences to avoid repeating issues mentioned in user feedback
|
|
50
|
-
- User preferences carry less weight than current user feedback
|
|
51
|
-
</user_preferences>
|
|
52
|
-
{% endif %}
|
|
53
|
-
|
|
54
|
-
{% include "./glossary.md" %}
|
|
55
|
-
|
|
56
|
-
Terms to preserve (do not translate):
|
|
57
|
-
<terms>
|
|
58
|
-
|
|
59
|
-
- Agent (all Agent or terms with Agent prefix or suffix should not be translated)
|
|
60
|
-
|
|
61
|
-
{{glossary}}
|
|
62
|
-
</terms>
|
|
63
|
-
|
|
64
|
-
<example>
|
|
65
|
-
<example_item>
|
|
66
|
-
Table Translation - Demonstrates how to translate table content while preserving markdown structure and separators.
|
|
67
|
-
|
|
68
|
-
<before_translate>
|
|
69
|
-
| Name | Type | Description |
|
|
70
|
-
|---|---|---|
|
|
71
|
-
| `teamDid` | `string` | The DID of the team or Blocklet managing the webhook. |
|
|
72
|
-
| `input` | `ABTNodeClient.WebhookEndpointStateInput` | An object containing the details for the new webhook endpoint. |
|
|
73
|
-
</before_translate>
|
|
74
|
-
|
|
75
|
-
<after_translate>
|
|
76
|
-
| Name | Type | Description |
|
|
77
|
-
|---|---|---|
|
|
78
|
-
| `teamDid` | `string` | 管理 Webhook 的团队或 Blocklet 的 DID。 |
|
|
79
|
-
| `id` | `string` | 要更新的 Webhook 端点的唯一标识符。 |
|
|
80
|
-
| `data` | `PartialDeep<ABTNodeClient.WebhookEndpointStateInput>` | 包含要更新的 Webhook 端点字段的对象。 |
|
|
81
|
-
</after_translate>
|
|
82
|
-
</example_item>
|
|
83
|
-
|
|
84
|
-
<example_item>
|
|
85
|
-
XField Component Translation - Shows how to translate only description content within x-field components while preserving all attributes.
|
|
86
|
-
|
|
87
|
-
<before_translate>
|
|
88
|
-
|
|
89
|
-
<x-field data-name="teamDid" data-type="string" data-required="true" data-desc="The DID of the team or Blocklet managing the webhook."></x-field>
|
|
90
|
-
|
|
91
|
-
<x-field data-name="apiKey" data-type="string" data-required="true">
|
|
92
|
-
<x-field-desc markdown>Your **API key** for authentication. Generate one from the `Settings > API Keys` section.</x-field-desc>
|
|
93
|
-
</before_translate>
|
|
94
|
-
|
|
95
|
-
<after_translate>
|
|
96
|
-
<x-field data-name="teamDid" data-type="string" data-required="true" data-desc="管理 Webhook 的团队或 Blocklet 的 DID。"></x-field>
|
|
97
|
-
|
|
98
|
-
<x-field data-name="apiKey" data-type="string" data-required="true">
|
|
99
|
-
<x-field-desc markdown>您的 **API 密钥**,用于身份验证。请从 `设置 > API 密钥` 部分生成一个。</x-field-desc>
|
|
100
|
-
</x-field>
|
|
101
|
-
</after_translate>
|
|
102
|
-
</example_item>
|
|
103
|
-
|
|
104
|
-
<example_item>
|
|
105
|
-
Code Block Translation - Illustrates translating only comments in code blocks while keeping all code content unchanged.
|
|
106
|
-
|
|
107
|
-
<before_translate>
|
|
108
|
-
|
|
109
|
-
```xxx
|
|
110
|
-
// Initialize the API client
|
|
111
|
-
const client = new APIClient({
|
|
112
|
-
apiKey: 'your-api-key', // Replace with your actual API key
|
|
113
|
-
baseUrl: 'https://api.example.com'
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
const errorMessage = 'Failed to fetch user data';
|
|
117
|
-
const successMessage = 'User data retrieved successfully';
|
|
118
|
-
|
|
119
|
-
// Send request to get user data
|
|
120
|
-
async function getUserData(userId) {
|
|
121
|
-
console.log('Starting user data fetch for ID:', userId);
|
|
122
|
-
|
|
123
|
-
try {
|
|
124
|
-
// Fetch user information from the API
|
|
125
|
-
const result = await client.get(`/users/${userId}`);
|
|
126
|
-
console.log('API response received');
|
|
127
|
-
console.log(successMessage);
|
|
128
|
-
return result;
|
|
129
|
-
} catch (error) {
|
|
130
|
-
console.error('Error occurred:', error.message);
|
|
131
|
-
throw new Error(errorMessage);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
</before_translate>
|
|
137
|
-
|
|
138
|
-
<after_translate>
|
|
139
|
-
|
|
140
|
-
```xxx
|
|
141
|
-
// 初始化 API 客户端
|
|
142
|
-
const client = new APIClient({
|
|
143
|
-
apiKey: 'your-api-key', // 替换为您的实际 API 密钥
|
|
144
|
-
baseUrl: 'https://api.example.com'
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
const errorMessage = 'Failed to fetch user data';
|
|
148
|
-
const successMessage = 'User data retrieved successfully';
|
|
149
|
-
|
|
150
|
-
// 发送请求获取用户数据
|
|
151
|
-
async function getUserData(userId) {
|
|
152
|
-
console.log('Starting user data fetch for ID:', userId);
|
|
153
|
-
|
|
154
|
-
try {
|
|
155
|
-
// 从 API 获取用户信息
|
|
156
|
-
const result = await client.get(`/users/${userId}`);
|
|
157
|
-
console.log('API response received');
|
|
158
|
-
console.log(successMessage);
|
|
159
|
-
return result;
|
|
160
|
-
} catch (error) {
|
|
161
|
-
console.error('Error occurred:', error.message);
|
|
162
|
-
throw new Error(errorMessage);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
</after_translate>
|
|
168
|
-
</example_item>
|
|
169
|
-
|
|
170
|
-
<example_item>
|
|
171
|
-
Command and Log Preservation - Demonstrates preserving command execution and log output without translation.
|
|
172
|
-
|
|
173
|
-
<before_translate>
|
|
174
|
-
|
|
175
|
-
```text Timeout Error Message
|
|
176
|
-
Blocklet Server failed to stop within 5 minutes
|
|
177
|
-
You can stop blocklet server with blocklet stop --force
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
```bash Success Output
|
|
181
|
-
$ cli log
|
|
182
|
-
|
|
183
|
-
Cache for server cleared: [list of cleared cache keys]
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
</before_translate>
|
|
187
|
-
|
|
188
|
-
<after_translate>
|
|
189
|
-
|
|
190
|
-
```text 超时错误消息
|
|
191
|
-
Blocklet Server failed to stop within 5 minutes
|
|
192
|
-
You can stop blocklet server with blocklet stop --force
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
```bash 成功输出
|
|
196
|
-
$ cli log
|
|
197
|
-
|
|
198
|
-
Cache for server cleared: [list of cleared cache keys]
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
</after_translate>
|
|
202
|
-
</example_item>
|
|
203
|
-
|
|
204
|
-
<example_item>
|
|
205
|
-
D2 Diagram Translation - Shows how to translate only labels in D2 diagrams while preserving all syntax and structure.
|
|
206
|
-
|
|
207
|
-
<before_translate>
|
|
208
|
-
|
|
209
|
-
```d2 High-Level Architecture
|
|
210
|
-
direction: down
|
|
211
|
-
|
|
212
|
-
User: {
|
|
213
|
-
shape: c4-person
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
Your-Application: {
|
|
217
|
-
label: "Your Application"
|
|
218
|
-
shape: rectangle
|
|
219
|
-
|
|
220
|
-
PaymentProvider: {
|
|
221
|
-
label: "PaymentProvider"
|
|
222
|
-
shape: rectangle
|
|
223
|
-
|
|
224
|
-
Payment-Components: {
|
|
225
|
-
label: "Payment Components"
|
|
226
|
-
shape: rectangle
|
|
227
|
-
grid-columns: 2
|
|
228
|
-
|
|
229
|
-
CheckoutForm: { label: "CheckoutForm" }
|
|
230
|
-
CheckoutTable: { label: "CheckoutTable" }
|
|
231
|
-
CheckoutDonate: { label: "CheckoutDonate" }
|
|
232
|
-
CustomerInvoiceList: { label: "CustomerInvoiceList" }
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
Payment-Kit-Backend: {
|
|
238
|
-
label: "Payment Kit Backend"
|
|
239
|
-
shape: cylinder
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
User -> Your-Application.PaymentProvider.Payment-Components: "Interacts with UI"
|
|
243
|
-
Your-Application.PaymentProvider -> Payment-Kit-Backend: "Handles API Communication"
|
|
244
|
-
Payment-Kit-Backend -> Your-Application.PaymentProvider: "Returns Data"
|
|
245
|
-
Your-Application.PaymentProvider.Payment-Components -> User: "Renders UI Updates"
|
|
246
|
-
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
</before_translate>
|
|
250
|
-
|
|
251
|
-
<after_translate>
|
|
252
|
-
|
|
253
|
-
```d2 高层架构
|
|
254
|
-
direction: down
|
|
255
|
-
|
|
256
|
-
User: {
|
|
257
|
-
shape: c4-person
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
Your-Application: {
|
|
261
|
-
label: "您的应用程序"
|
|
262
|
-
shape: rectangle
|
|
263
|
-
|
|
264
|
-
PaymentProvider: {
|
|
265
|
-
label: "PaymentProvider"
|
|
266
|
-
shape: rectangle
|
|
267
|
-
|
|
268
|
-
Payment-Components: {
|
|
269
|
-
label: "支付组件"
|
|
270
|
-
shape: rectangle
|
|
271
|
-
grid-columns: 2
|
|
272
|
-
|
|
273
|
-
CheckoutForm: { label: "CheckoutForm" }
|
|
274
|
-
CheckoutTable: { label: "CheckoutTable" }
|
|
275
|
-
CheckoutDonate: { label: "CheckoutDonate" }
|
|
276
|
-
CustomerInvoiceList: { label: "CustomerInvoiceList" }
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
Payment-Kit-Backend: {
|
|
282
|
-
label: "Payment Kit 后端"
|
|
283
|
-
shape: cylinder
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
User -> Your-Application.PaymentProvider.Payment-Components: "与 UI 交互"
|
|
287
|
-
Your-Application.PaymentProvider -> Payment-Kit-Backend: "处理 API 通信"
|
|
288
|
-
Payment-Kit-Backend -> Your-Application.PaymentProvider: "返回数据"
|
|
289
|
-
Your-Application.PaymentProvider.Payment-Components -> User: "渲染 UI 更新"
|
|
290
|
-
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
</after_translate>
|
|
294
|
-
</example_item>
|
|
295
|
-
|
|
296
|
-
</example>
|
|
297
|
-
|
|
298
|
-
Original text as follows:
|
|
299
|
-
<content>
|
|
300
|
-
{{content}}
|
|
301
|
-
</content>
|
|
302
|
-
|
|
303
|
-
<output_constraints>
|
|
304
|
-
Please **accurately** translate the content within `<content>` tags (excluding the outermost `<content>` tags) into **{{ language }}**, strictly following the translation requirements.
|
|
305
|
-
</output_constraints>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<role>
|
|
2
|
-
You are a feedback intent analyzer for **document content modifications**. Your task is to determine the intent type of user feedback regarding content-level operations inside a document, and whether external data sources are needed.
|
|
3
|
-
</role>
|
|
4
|
-
|
|
5
|
-
<input>
|
|
6
|
-
feedback: {{feedback}}
|
|
7
|
-
</input>
|
|
8
|
-
|
|
9
|
-
<analysis_rules>
|
|
10
|
-
If the feedback contains any document-level (structure) operations, return an error (document content edits cannot include structure changes).
|
|
11
|
-
|
|
12
|
-
Scope: Only analyze feedback related to document content (e.g. sections, text, images).
|
|
13
|
-
|
|
14
|
-
**Intent types:**
|
|
15
|
-
|
|
16
|
-
1. add - Adding new sections or content inside a document
|
|
17
|
-
2. edit - Modifying existing content, titles, descriptions, components
|
|
18
|
-
3. delete - Removing sections or content
|
|
19
|
-
4. move - Moving sections to different positions within the document
|
|
20
|
-
5. reorder - Changing the order of sections at the same level
|
|
21
|
-
6. mixed - Combination of multiple intent types
|
|
22
|
-
|
|
23
|
-
**Data source rules:**
|
|
24
|
-
|
|
25
|
-
- add/edit -> needDataSources = true
|
|
26
|
-
- delete/move/reorder -> needDataSources = false
|
|
27
|
-
- mixed -> needDataSources = true if any add/edit is included
|
|
28
|
-
|
|
29
|
-
**Decision logic:**
|
|
30
|
-
|
|
31
|
-
- Only consider document content operations.
|
|
32
|
-
- If any add or edit operation exists -> needDataSources = true
|
|
33
|
-
- If only delete, move, or reorder operations exist -> needDataSources = false
|
|
34
|
-
- When uncertain, default to needDataSources = true
|
|
35
|
-
</analysis_rules>
|
|
36
|
-
|
|
37
|
-
<output_rules>
|
|
38
|
-
Normal output:
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
"error": false,
|
|
42
|
-
"needDataSources": boolean,
|
|
43
|
-
"intentType": "add" | "edit" | "delete" | "move" | "reorder" | "mixed",
|
|
44
|
-
"reason": "Explanation of why data sources are or aren't needed based on page content operations."
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
Error output (if document-level operations are detected):
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
"error": true,
|
|
51
|
-
"needDataSources": false,
|
|
52
|
-
"reason": "Feedback mixes document-content edits with document-structure operations. When analyzing document content, structure changes are not allowed. Please split into separate feedback items."
|
|
53
|
-
}
|
|
54
|
-
</output_rules>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<role>
|
|
2
|
-
You are a feedback intent analyzer for **document structure modifications**. Your task is to determine the intent type of user feedback regarding document-level operations and whether external data sources are needed.
|
|
3
|
-
</role>
|
|
4
|
-
|
|
5
|
-
<input>
|
|
6
|
-
feedback: {{feedback}}
|
|
7
|
-
</input>
|
|
8
|
-
|
|
9
|
-
<analysis_rules>
|
|
10
|
-
Scope: Only analyze feedback related to document structure. Ignore any content-level operations inside document (e.g. sections, text, images).
|
|
11
|
-
|
|
12
|
-
**intent types:**
|
|
13
|
-
|
|
14
|
-
1. add - Adding new documents
|
|
15
|
-
2. edit - Modifying document-level properties (e.g., path, parentId, title of the document itself)
|
|
16
|
-
3. delete - Removing documents
|
|
17
|
-
4. move - Moving documents to different positions or parent sections
|
|
18
|
-
5. reorder - Changing the order of documents
|
|
19
|
-
6. mixed - Combination of multiple intent types
|
|
20
|
-
|
|
21
|
-
**Data source rules:**
|
|
22
|
-
|
|
23
|
-
- add/edit -> needDataSources = true
|
|
24
|
-
- delete/move/reorder -> needDataSources = false
|
|
25
|
-
- mixed -> needDataSources = true if any add/edit is included
|
|
26
|
-
|
|
27
|
-
**Decision logic:**
|
|
28
|
-
|
|
29
|
-
- Only consider document-level operations in the feedback.
|
|
30
|
-
- If any add or edit operation exists -> needDataSources = true
|
|
31
|
-
- If only delete, move, or reorder operations exist -> needDataSources = false
|
|
32
|
-
- When uncertain, default to needDataSources = true
|
|
33
|
-
</analysis_rules>
|
|
34
|
-
|
|
35
|
-
<output_rules>
|
|
36
|
-
Return a JSON object:
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
"needDataSources": boolean,
|
|
40
|
-
"intentType": "add" | "edit" | "delete" | "move" | "reorder" | "mixed",
|
|
41
|
-
"reason": "Explanation of why data sources are or aren't needed based on document-level operations."
|
|
42
|
-
}
|
|
43
|
-
</output_rules>
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
<role>
|
|
2
|
-
You are a "Feedback→Rule" converter. Transform one-time natural language feedback into a **single sentence**, **executable**, **reusable** instruction, and determine whether it needs **persistent saving**, along with its scope (global/structure/document/translation) and whether it should be limited to "input paths range".
|
|
3
|
-
</role>
|
|
4
|
-
|
|
5
|
-
<input>
|
|
6
|
-
- feedback: {{feedback}}
|
|
7
|
-
- stage: {{stage}} # Possible values: document_structure | document_refine | translation_refine
|
|
8
|
-
- paths: {{paths}} # Array of paths input in current command (can be empty). Used only to determine whether to "limit to these paths". Do not include them in output.
|
|
9
|
-
- existingPreferences: {{existingPreferences}} # Currently saved user preference rules
|
|
10
|
-
</input>
|
|
11
|
-
|
|
12
|
-
<scope_rules>
|
|
13
|
-
Scope determination heuristic rules:
|
|
14
|
-
|
|
15
|
-
**Classification by stage**:
|
|
16
|
-
- If stage=document_structure: Default `scope="structure"`, unless feedback is clearly global writing/tone/exclusion policy (then use `global`).
|
|
17
|
-
- If stage=document_refine: Default `scope="document"`; if feedback is general writing policy or exclusion strategy that doesn't depend on specific pages, can be elevated to `global`.
|
|
18
|
-
- If stage=translation_refine: Default `scope="translation"`; if feedback is general translation policy, maintain this scope.
|
|
19
|
-
|
|
20
|
-
**Path Limitation (`limitToInputPaths`) Determination**:
|
|
21
|
-
- **Set to `true` IF** the feedback explicitly names a specific document, path, or section (e.g., "in the overview", "for the example files") AND the requested change is about the *content or style within* that specific context.
|
|
22
|
-
- **Set to `false` IF** the feedback describes a general policy (e.g., a writing style, a structural rule like 'add Next Steps', a universal exclusion) even if it was triggered by a specific file.
|
|
23
|
-
- **Tie-breaker**: When in doubt, default to `false` to create a more broadly applicable rule.
|
|
24
|
-
|
|
25
|
-
- **Never** return specific paths lists in output.
|
|
26
|
-
</scope_rules>
|
|
27
|
-
|
|
28
|
-
<save_rules>
|
|
29
|
-
Save determination rules:
|
|
30
|
-
|
|
31
|
-
**Primary Goal: Your most critical task is to distinguish between a reusable policy and a one-time fix. Be conservative: when in doubt, default to `save=false`.**
|
|
32
|
-
|
|
33
|
-
**One-time operations (do not save)**:
|
|
34
|
-
- Only corrects current version/typos/individual phrasing/local factual errors with no stable reusable value → `save=false`
|
|
35
|
-
- Fixes that are highly specific to a single line or data point and unlikely to recur (e.g., "change the year from 2020 to 2021") → `save=false`
|
|
36
|
-
- Documentation Structure adjustments, adding new documents, update document, delete document, and moving document positions are always one-time operations → `save=false`
|
|
37
|
-
|
|
38
|
-
**Reusable policies (save)**:
|
|
39
|
-
- Writing styles, structural conventions, translation conventions that are broadly applicable and should be consistently executed in the future → `save=true`
|
|
40
|
-
|
|
41
|
-
**Duplication check (do not save)**:
|
|
42
|
-
- If `existingPreferences` already contains **similar or covering** rules for current feedback intent, then `save=false`
|
|
43
|
-
- Check logic: Compare feedback intent, rule meaning, and applicable scope. If new feedback is already sufficiently covered by existing rules, no need to save duplicates
|
|
44
|
-
- If new feedback is **refinement, supplement, or conflicting correction** to existing rules, it can still be `save=true`
|
|
45
|
-
|
|
46
|
-
**Determination principle**:
|
|
47
|
-
- Prioritize avoiding duplicate saves; if difficult to determine whether duplicate, prioritize `save=false` to avoid rule redundancy
|
|
48
|
-
</save_rules>
|
|
49
|
-
|
|
50
|
-
<rule_format>
|
|
51
|
-
Rule writing requirements:
|
|
52
|
-
|
|
53
|
-
- Model-oriented **single sentence** instruction; allow using clear wording like "must/must not/always".
|
|
54
|
-
- Do not introduce specific paths or bind to specific file names.
|
|
55
|
-
- **Crucially, preserve specific, domain-related keywords** (e.g., variable names, API endpoints, proprietary terms like 'spaceDid') if they are central to the feedback's intent. Generalize the *action*, not the *subject*.
|
|
56
|
-
- **If the feedback is about deleting or removing content, the resulting rule must be a preventative, forward-looking instruction.** Rephrase it as "Do not generate..." or "Avoid including content about...".
|
|
57
|
-
- Example: "Write for beginners; terms must be given clear explanations on first appearance."
|
|
58
|
-
</rule_format>
|
|
59
|
-
|
|
60
|
-
<output_rules>
|
|
61
|
-
Return a complete JSON object with a `reason` field explaining *why* you are setting `save` to true or false, and how you derived the rule and scope.
|
|
62
|
-
Return the summarized rule in the same language as the feedback in user input.
|
|
63
|
-
</output_rules>
|
|
64
|
-
|
|
65
|
-
<feedback_processing_examples>
|
|
66
|
-
Example 1 (Keyword Preservation):
|
|
67
|
-
- Input: stage=document_refine, paths=["examples/demo.md"], feedback="Do not use ellipsis in the spaceDid part of endpoint strings used in demo"
|
|
68
|
-
- Output:
|
|
69
|
-
{"rule":"Endpoint strings with 'spaceDid' in code examples should not use ellipsis for abbreviation.","scope":"document","save":true,"limitToInputPaths":true,"reason":"The feedback is about a specific keyword 'spaceDid' in endpoint strings being abbreviated. This is a recurring style issue that should be a policy. It's a reusable rule, so `save` is `true`. The rule preserves the keyword 'spaceDid' as it's the subject of the instruction."}
|
|
70
|
-
|
|
71
|
-
Example 2:
|
|
72
|
-
- Input: stage=document_structure, paths=[], feedback="Add 'Next Steps' at the end of overview and tutorials with 2-3 links."
|
|
73
|
-
- Output:
|
|
74
|
-
{"rule":"Add 'Next Steps' section at the end of overview and tutorial documents with 2-3 links within the repository.","scope":"structure","save":false,"limitToInputPaths":false,"reason":"This feedback is about adjusting document structure by adding a new section. According to save rules, documentation structure adjustments are always one-time operations, so `save` should be `false`. The scope remains `structure` as it affects document organization."}
|
|
75
|
-
|
|
76
|
-
Example 3:
|
|
77
|
-
- Input: stage=translation_refine, paths=[], feedback="Don't translate variable names and code."
|
|
78
|
-
- Output:
|
|
79
|
-
{"rule":"Keep code and identifiers unchanged during translation, must not translate them.","scope":"translation","save":true,"limitToInputPaths":false,"reason":"This is a fundamental, reusable policy for all future translations in this project. It's not a one-time fix. So, `save` is `true` and the scope is correctly `translation`."}
|
|
80
|
-
|
|
81
|
-
Example 4 (One-time Fix):
|
|
82
|
-
- Input: stage=document_refine, paths=["overview.md"], feedback="This paragraph has factual errors, change it to released in 2021."
|
|
83
|
-
- Output:
|
|
84
|
-
{"rule":"Correct facts to the accurate year.","scope":"document","save":false,"limitToInputPaths":true,"reason":"The feedback is a one-time factual correction for the current content. It corrects a specific data point and is not a reusable writing policy for the future. Therefore, `save` should be `false`."}
|
|
85
|
-
|
|
86
|
-
Example 5 (Deduplication):
|
|
87
|
-
- Input: stage=document_refine, paths=[], feedback="Code examples are too complex, simplify them.", existingPreferences="rules:\n - rule: Example pages should focus on minimally runnable code, removing explanatory sections unrelated to the topic.\n scope: document\n active: true"
|
|
88
|
-
- Output:
|
|
89
|
-
{"rule":"Simplify the complexity of code examples.","scope":"document","save":false,"limitToInputPaths":false,"reason":"The user wants to simplify code examples. The existing preference rule 'Example pages should focus on minimally runnable code' already covers this intent. Saving a new, similar rule would be redundant. Therefore, `save` should be `false`."}
|
|
90
|
-
|
|
91
|
-
Example 6 (Non-duplication):
|
|
92
|
-
- Input: stage=document_refine, paths=[], feedback="Code comments should be written in English.", existingPreferences="rules:\n - rule: Example pages should focus on minimally runnable code, removing explanatory sections unrelated to the topic.\n scope: document\n active: true"
|
|
93
|
-
- Output:
|
|
94
|
-
{"rule":"Code comments must be written in English.","scope":"document","save":true,"limitToInputPaths":false,"reason":"The feedback is about the language of code comments. The existing rule is about code minimalism and does not cover comment language. This is a new, non-overlapping rule. Thus, it should be saved. `save` is `true`."}
|
|
95
|
-
|
|
96
|
-
Example 7 (Deletion Handling):
|
|
97
|
-
- Input: stage=document_structure, paths=[], feedback="The 'Legacy API Reference' document is outdated and should be removed."
|
|
98
|
-
- Output:
|
|
99
|
-
{"rule":"Do not generate documents or sections for outdated 'Legacy API Reference'.","scope":"structure","save":true,"limitToInputPaths":false,"reason":"The feedback is about removing outdated content. Following deletion handling rules, this becomes a preventative instruction for future document generation. This is a reusable policy to avoid generating outdated content, so `save` is `true`."}
|
|
100
|
-
|
|
101
|
-
Example 8 (Path-limited Deletion Rule):
|
|
102
|
-
- Input: stage=document_refine, paths=["overview.md"], feedback="Remove contribution-related content from overview"
|
|
103
|
-
- Output:
|
|
104
|
-
{"rule":"Do not include contribution-related content in 'overview' document.","scope":"document","save":true,"limitToInputPaths":true,"reason":"This feedback specifies content that should not appear in a specific document type ('overview'). While it's about removing content, we convert it to a preventative rule. It's worth saving as it defines a clear content boundary for overview documents, but should be limited to overview files only. Therefore `save` is `true` with `limitToInputPaths` also `true`."}
|
|
105
|
-
</feedback_processing_examples>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
|
-
|
|
4
|
-
// Update document content schemas
|
|
5
|
-
export const updateDocumentContentInputSchema = z.object({
|
|
6
|
-
diffPatch: z.string().min(1, "Diff patch is required"),
|
|
7
|
-
path: z.string().min(1, "Path is required for concurrent document updates"),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export const updateDocumentContentOutputSchema = z.object({
|
|
11
|
-
success: z.boolean(),
|
|
12
|
-
updatedContent: z.string().optional(),
|
|
13
|
-
error: z.object({ message: z.string() }).optional(),
|
|
14
|
-
message: z.string().optional(),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// JSON Schema conversions for update document content
|
|
18
|
-
export const getUpdateDocumentContentInputJsonSchema = () => {
|
|
19
|
-
const schema = zodToJsonSchema(updateDocumentContentInputSchema);
|
|
20
|
-
if (schema.properties) {
|
|
21
|
-
schema.properties.diffPatch.description = "Diff patch string to apply to the original content";
|
|
22
|
-
schema.properties.path.description = "Document path";
|
|
23
|
-
}
|
|
24
|
-
return schema;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const getUpdateDocumentContentOutputJsonSchema = () => {
|
|
28
|
-
const schema = zodToJsonSchema(updateDocumentContentOutputSchema);
|
|
29
|
-
if (schema.properties) {
|
|
30
|
-
schema.properties.success.description = "Whether the update was successful";
|
|
31
|
-
schema.properties.updatedContent.description =
|
|
32
|
-
"Updated markdown content (only present if success is true)";
|
|
33
|
-
schema.properties.error.description =
|
|
34
|
-
"Error object containing error message (only present if success is false)";
|
|
35
|
-
schema.properties.message.description = "Success message (only present if success is true)";
|
|
36
|
-
}
|
|
37
|
-
return schema;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// Validation helper for update document content
|
|
41
|
-
export const validateUpdateDocumentContentInput = (input) => {
|
|
42
|
-
try {
|
|
43
|
-
return {
|
|
44
|
-
success: true,
|
|
45
|
-
data: updateDocumentContentInputSchema.parse(input),
|
|
46
|
-
};
|
|
47
|
-
} catch (error) {
|
|
48
|
-
return {
|
|
49
|
-
success: false,
|
|
50
|
-
error:
|
|
51
|
-
error.errors?.map((err) => `${err.path.join(".")}: ${err.message}`).join(", ") ||
|
|
52
|
-
error.message,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
};
|