@aigne/doc-smith 0.9.8-alpha.3 → 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.
Files changed (257) hide show
  1. package/CLAUDE.md +43 -0
  2. package/README.md +94 -250
  3. package/aigne.yaml +2 -149
  4. package/doc-smith/SKILL.md +117 -0
  5. package/doc-smith/references/changeset_schema.md +118 -0
  6. package/doc-smith/references/document_structure_schema.md +139 -0
  7. package/doc-smith/references/document_update_guide.md +193 -0
  8. package/doc-smith/references/structure_confirmation_guide.md +133 -0
  9. package/doc-smith/references/structure_planning_guide.md +146 -0
  10. package/doc-smith/references/user_intent_guide.md +172 -0
  11. package/doc-smith.yaml +114 -0
  12. package/main-system-prompt.md +56 -0
  13. package/package.json +3 -69
  14. package/scripts/README.md +90 -0
  15. package/scripts/install.sh +86 -0
  16. package/scripts/uninstall.sh +52 -0
  17. package/CHANGELOG.md +0 -994
  18. package/LICENSE +0 -93
  19. package/agentic-agents/common/base-info.md +0 -53
  20. package/agentic-agents/common/completer.md +0 -54
  21. package/agentic-agents/common/planner.md +0 -168
  22. package/agentic-agents/common/worker.md +0 -93
  23. package/agentic-agents/create/index.yaml +0 -129
  24. package/agentic-agents/create/objective.md +0 -44
  25. package/agentic-agents/create/set-custom-prompt.mjs +0 -27
  26. package/agentic-agents/detail/index.yaml +0 -95
  27. package/agentic-agents/detail/objective.md +0 -9
  28. package/agentic-agents/detail/set-custom-prompt.mjs +0 -88
  29. package/agentic-agents/predict-resources/index.yaml +0 -44
  30. package/agentic-agents/predict-resources/instructions.md +0 -61
  31. package/agentic-agents/structure/design-rules.md +0 -39
  32. package/agentic-agents/structure/index.yaml +0 -86
  33. package/agentic-agents/structure/objective.md +0 -14
  34. package/agentic-agents/structure/review-criteria.md +0 -55
  35. package/agentic-agents/structure/set-custom-prompt.mjs +0 -78
  36. package/agentic-agents/utils/init-workspace-cache.mjs +0 -171
  37. package/agentic-agents/utils/load-base-sources.mjs +0 -20
  38. package/agentic-agents/workspace-cache-sharing-design.md +0 -671
  39. package/agents/chat/chat-system.md +0 -38
  40. package/agents/chat/index.mjs +0 -59
  41. package/agents/chat/skills/generate-document.yaml +0 -15
  42. package/agents/chat/skills/list-documents.mjs +0 -15
  43. package/agents/chat/skills/update-document.yaml +0 -24
  44. package/agents/clear/choose-contents.mjs +0 -192
  45. package/agents/clear/clear-auth-tokens.mjs +0 -88
  46. package/agents/clear/clear-deployment-config.mjs +0 -49
  47. package/agents/clear/clear-document-config.mjs +0 -36
  48. package/agents/clear/clear-document-structure.mjs +0 -102
  49. package/agents/clear/clear-generated-docs.mjs +0 -142
  50. package/agents/clear/clear-media-description.mjs +0 -129
  51. package/agents/clear/index.yaml +0 -26
  52. package/agents/create/analyze-diagram-type-llm.yaml +0 -160
  53. package/agents/create/analyze-diagram-type.mjs +0 -297
  54. package/agents/create/check-document-structure.yaml +0 -30
  55. package/agents/create/check-need-generate-structure.mjs +0 -105
  56. package/agents/create/document-structure-tools/add-document.mjs +0 -85
  57. package/agents/create/document-structure-tools/delete-document.mjs +0 -116
  58. package/agents/create/document-structure-tools/move-document.mjs +0 -109
  59. package/agents/create/document-structure-tools/update-document.mjs +0 -84
  60. package/agents/create/generate-diagram-image.yaml +0 -60
  61. package/agents/create/generate-structure.yaml +0 -117
  62. package/agents/create/index.yaml +0 -49
  63. package/agents/create/refine-document-structure.yaml +0 -12
  64. package/agents/create/replace-d2-with-image.mjs +0 -625
  65. package/agents/create/update-document-structure.yaml +0 -54
  66. package/agents/create/user-add-document/add-documents-to-structure.mjs +0 -90
  67. package/agents/create/user-add-document/find-documents-to-add-links.yaml +0 -47
  68. package/agents/create/user-add-document/index.yaml +0 -46
  69. package/agents/create/user-add-document/prepare-documents-to-translate.mjs +0 -22
  70. package/agents/create/user-add-document/print-add-document-summary.mjs +0 -63
  71. package/agents/create/user-add-document/review-documents-with-new-links.mjs +0 -110
  72. package/agents/create/user-remove-document/find-documents-with-invalid-links.mjs +0 -78
  73. package/agents/create/user-remove-document/index.yaml +0 -40
  74. package/agents/create/user-remove-document/prepare-documents-to-translate.mjs +0 -22
  75. package/agents/create/user-remove-document/print-remove-document-summary.mjs +0 -53
  76. package/agents/create/user-remove-document/remove-documents-from-structure.mjs +0 -99
  77. package/agents/create/user-remove-document/review-documents-with-invalid-links.mjs +0 -115
  78. package/agents/create/user-review-document-structure.mjs +0 -140
  79. package/agents/create/utils/init-current-content.mjs +0 -34
  80. package/agents/create/utils/merge-document-structures.mjs +0 -30
  81. package/agents/evaluate/code-snippet.mjs +0 -97
  82. package/agents/evaluate/document-structure.yaml +0 -67
  83. package/agents/evaluate/document.yaml +0 -82
  84. package/agents/evaluate/generate-report.mjs +0 -85
  85. package/agents/evaluate/index.yaml +0 -46
  86. package/agents/history/index.yaml +0 -6
  87. package/agents/history/view.mjs +0 -78
  88. package/agents/init/check.mjs +0 -16
  89. package/agents/init/index.mjs +0 -275
  90. package/agents/init/validate.mjs +0 -16
  91. package/agents/localize/choose-language.mjs +0 -107
  92. package/agents/localize/index.yaml +0 -58
  93. package/agents/localize/record-translation-history.mjs +0 -23
  94. package/agents/localize/translate-document.yaml +0 -24
  95. package/agents/localize/translate-multilingual.yaml +0 -51
  96. package/agents/media/batch-generate-media-description.yaml +0 -46
  97. package/agents/media/generate-media-description.yaml +0 -50
  98. package/agents/media/load-media-description.mjs +0 -256
  99. package/agents/prefs/index.mjs +0 -203
  100. package/agents/publish/index.yaml +0 -26
  101. package/agents/publish/publish-docs.mjs +0 -356
  102. package/agents/publish/translate-meta.mjs +0 -103
  103. package/agents/schema/document-structure-item.yaml +0 -26
  104. package/agents/schema/document-structure-refine-item.yaml +0 -23
  105. package/agents/schema/document-structure.yaml +0 -29
  106. package/agents/update/batch-generate-document.yaml +0 -27
  107. package/agents/update/batch-update-document.yaml +0 -7
  108. package/agents/update/check-diagram-flag.mjs +0 -116
  109. package/agents/update/check-document.mjs +0 -162
  110. package/agents/update/check-generate-diagram.mjs +0 -106
  111. package/agents/update/check-sync-image-flag.mjs +0 -55
  112. package/agents/update/check-update-is-single.mjs +0 -53
  113. package/agents/update/document-tools/update-document-content.mjs +0 -303
  114. package/agents/update/generate-diagram.yaml +0 -63
  115. package/agents/update/generate-document.yaml +0 -70
  116. package/agents/update/handle-document-update.yaml +0 -103
  117. package/agents/update/index.yaml +0 -79
  118. package/agents/update/pre-check-generate-diagram.yaml +0 -44
  119. package/agents/update/save-and-translate-document.mjs +0 -76
  120. package/agents/update/sync-images-and-exit.mjs +0 -148
  121. package/agents/update/update-document-detail.yaml +0 -71
  122. package/agents/update/update-single/update-single-document-detail.mjs +0 -280
  123. package/agents/update/update-single-document.yaml +0 -7
  124. package/agents/update/user-review-document.mjs +0 -272
  125. package/agents/utils/action-success.mjs +0 -16
  126. package/agents/utils/analyze-document-feedback-intent.yaml +0 -32
  127. package/agents/utils/analyze-feedback-intent.mjs +0 -136
  128. package/agents/utils/analyze-structure-feedback-intent.yaml +0 -29
  129. package/agents/utils/check-detail-result.mjs +0 -38
  130. package/agents/utils/check-feedback-refiner.mjs +0 -81
  131. package/agents/utils/choose-docs.mjs +0 -293
  132. package/agents/utils/document-icon-generate.yaml +0 -52
  133. package/agents/utils/document-title-streamline.yaml +0 -48
  134. package/agents/utils/ensure-document-icons.mjs +0 -129
  135. package/agents/utils/exit.mjs +0 -6
  136. package/agents/utils/feedback-refiner.yaml +0 -50
  137. package/agents/utils/find-item-by-path.mjs +0 -114
  138. package/agents/utils/find-user-preferences-by-path.mjs +0 -37
  139. package/agents/utils/format-document-structure.mjs +0 -35
  140. package/agents/utils/generate-document-or-skip.mjs +0 -41
  141. package/agents/utils/handle-diagram-operations.mjs +0 -263
  142. package/agents/utils/load-all-document-content.mjs +0 -30
  143. package/agents/utils/load-document-all-content.mjs +0 -84
  144. package/agents/utils/load-sources.mjs +0 -405
  145. package/agents/utils/map-reasoning-effort-level.mjs +0 -15
  146. package/agents/utils/post-generate.mjs +0 -144
  147. package/agents/utils/read-current-document-content.mjs +0 -46
  148. package/agents/utils/save-doc-translation.mjs +0 -61
  149. package/agents/utils/save-doc.mjs +0 -88
  150. package/agents/utils/save-output.mjs +0 -26
  151. package/agents/utils/save-sidebar.mjs +0 -51
  152. package/agents/utils/skip-if-content-exists.mjs +0 -27
  153. package/agents/utils/streamline-document-titles-if-needed.mjs +0 -88
  154. package/agents/utils/transform-detail-data-sources.mjs +0 -45
  155. package/agents/utils/update-branding.mjs +0 -84
  156. package/assets/report-template/report.html +0 -198
  157. package/docs-mcp/analyze-content-relevance.yaml +0 -50
  158. package/docs-mcp/analyze-docs-relevance.yaml +0 -59
  159. package/docs-mcp/docs-search.yaml +0 -42
  160. package/docs-mcp/get-docs-detail.mjs +0 -41
  161. package/docs-mcp/get-docs-structure.mjs +0 -16
  162. package/docs-mcp/read-doc-content.mjs +0 -119
  163. package/prompts/common/document/content-rules-core.md +0 -20
  164. package/prompts/common/document/markdown-syntax-rules.md +0 -65
  165. package/prompts/common/document/media-file-list-usage-rules.md +0 -18
  166. package/prompts/common/document/openapi-usage-rules.md +0 -189
  167. package/prompts/common/document/role-and-personality.md +0 -16
  168. package/prompts/common/document/user-preferences.md +0 -9
  169. package/prompts/common/document-structure/conflict-resolution-guidance.md +0 -16
  170. package/prompts/common/document-structure/document-icon-generate.md +0 -116
  171. package/prompts/common/document-structure/document-structure-rules.md +0 -43
  172. package/prompts/common/document-structure/document-title-streamline.md +0 -86
  173. package/prompts/common/document-structure/glossary.md +0 -7
  174. package/prompts/common/document-structure/intj-traits.md +0 -5
  175. package/prompts/common/document-structure/openapi-usage-rules.md +0 -28
  176. package/prompts/common/document-structure/output-constraints.md +0 -18
  177. package/prompts/common/document-structure/user-locale-rules.md +0 -10
  178. package/prompts/common/document-structure/user-preferences.md +0 -9
  179. package/prompts/detail/custom/admonition-usage-rules.md +0 -94
  180. package/prompts/detail/custom/code-block-usage-rules.md +0 -163
  181. package/prompts/detail/custom/custom-components/x-card-usage-rules.md +0 -63
  182. package/prompts/detail/custom/custom-components/x-cards-usage-rules.md +0 -83
  183. package/prompts/detail/custom/custom-components/x-field-desc-usage-rules.md +0 -120
  184. package/prompts/detail/custom/custom-components/x-field-group-usage-rules.md +0 -80
  185. package/prompts/detail/custom/custom-components/x-field-usage-rules.md +0 -189
  186. package/prompts/detail/custom/custom-components-usage-rules.md +0 -18
  187. package/prompts/detail/diagram/generate-image-system.md +0 -135
  188. package/prompts/detail/diagram/generate-image-user.md +0 -32
  189. package/prompts/detail/diagram/guide.md +0 -29
  190. package/prompts/detail/diagram/official-examples.md +0 -712
  191. package/prompts/detail/diagram/pre-check.md +0 -23
  192. package/prompts/detail/diagram/role-and-personality.md +0 -2
  193. package/prompts/detail/diagram/rules.md +0 -46
  194. package/prompts/detail/diagram/system-prompt.md +0 -1139
  195. package/prompts/detail/diagram/user-prompt.md +0 -43
  196. package/prompts/detail/generate/detail-example.md +0 -457
  197. package/prompts/detail/generate/document-rules.md +0 -45
  198. package/prompts/detail/generate/system-prompt.md +0 -61
  199. package/prompts/detail/generate/user-prompt.md +0 -99
  200. package/prompts/detail/jsx/rules.md +0 -6
  201. package/prompts/detail/update/system-prompt.md +0 -121
  202. package/prompts/detail/update/user-prompt.md +0 -41
  203. package/prompts/evaluate/document-structure.md +0 -93
  204. package/prompts/evaluate/document.md +0 -149
  205. package/prompts/media/media-description/system-prompt.md +0 -43
  206. package/prompts/media/media-description/user-prompt.md +0 -17
  207. package/prompts/structure/check-document-structure.md +0 -93
  208. package/prompts/structure/document-rules.md +0 -21
  209. package/prompts/structure/find-documents-to-add-links.md +0 -52
  210. package/prompts/structure/generate/system-prompt.md +0 -13
  211. package/prompts/structure/generate/user-prompt.md +0 -137
  212. package/prompts/structure/review/structure-review-system.md +0 -81
  213. package/prompts/structure/structure-example.md +0 -89
  214. package/prompts/structure/structure-getting-started.md +0 -10
  215. package/prompts/structure/update/system-prompt.md +0 -93
  216. package/prompts/structure/update/user-prompt.md +0 -43
  217. package/prompts/translate/admonition.md +0 -20
  218. package/prompts/translate/code-block.md +0 -33
  219. package/prompts/translate/glossary.md +0 -6
  220. package/prompts/translate/translate-document.md +0 -305
  221. package/prompts/utils/analyze-document-feedback-intent.md +0 -54
  222. package/prompts/utils/analyze-structure-feedback-intent.md +0 -43
  223. package/prompts/utils/feedback-refiner.md +0 -105
  224. package/types/document-schema.mjs +0 -55
  225. package/types/document-structure-schema.mjs +0 -261
  226. package/utils/auth-utils.mjs +0 -275
  227. package/utils/blocklet.mjs +0 -104
  228. package/utils/check-document-has-diagram.mjs +0 -95
  229. package/utils/conflict-detector.mjs +0 -149
  230. package/utils/constants/index.mjs +0 -620
  231. package/utils/constants/linter.mjs +0 -102
  232. package/utils/d2-utils.mjs +0 -198
  233. package/utils/debug.mjs +0 -3
  234. package/utils/delete-diagram-images.mjs +0 -99
  235. package/utils/deploy.mjs +0 -86
  236. package/utils/docs-finder-utils.mjs +0 -623
  237. package/utils/evaluate/report-utils.mjs +0 -132
  238. package/utils/extract-api.mjs +0 -32
  239. package/utils/file-utils.mjs +0 -960
  240. package/utils/history-utils.mjs +0 -203
  241. package/utils/icon-map.mjs +0 -26
  242. package/utils/image-compress.mjs +0 -75
  243. package/utils/kroki-utils.mjs +0 -173
  244. package/utils/linter/index.mjs +0 -50
  245. package/utils/load-config.mjs +0 -107
  246. package/utils/markdown/index.mjs +0 -26
  247. package/utils/markdown-checker.mjs +0 -694
  248. package/utils/mermaid-validator.mjs +0 -140
  249. package/utils/mermaid-worker-pool.mjs +0 -250
  250. package/utils/mermaid-worker.mjs +0 -233
  251. package/utils/openapi/index.mjs +0 -28
  252. package/utils/preferences-utils.mjs +0 -175
  253. package/utils/request.mjs +0 -10
  254. package/utils/store/index.mjs +0 -45
  255. package/utils/sync-diagram-to-translations.mjs +0 -262
  256. package/utils/upload-files.mjs +0 -231
  257. package/utils/utils.mjs +0 -1354
@@ -1,43 +0,0 @@
1
- Follow the given rules and ISTJ style from your system instructions.
2
-
3
- Generate a d2 diagram that represents the following document content:
4
-
5
- <user_locale>
6
- {{ locale }}
7
- </user_locale>
8
-
9
- <user_rules>
10
-
11
- - Output only the diagram labels and text in the {{ locale }} language — keep all variable names, component names, and syntax unchanged.
12
- {% if previousDiagramContent %}
13
- - Update the diagram based on `<feedback>` and `<previous_diagram_content>`.
14
- {% endif %}
15
-
16
- </user_rules>
17
-
18
- <document_content>
19
- {{documentContent}}
20
- </document_content>
21
-
22
- {% if diagramError %}
23
- <diagram_check_feedback>
24
-
25
- **Diagram generation error**
26
- {{ diagramError }}
27
-
28
- </diagram_check_feedback>
29
- {% endif %}
30
-
31
- {% if previousDiagramContent %}
32
- <previous_diagram_content>
33
- {{ previousDiagramContent }}
34
- </previous_diagram_content>
35
-
36
- {% if feedback %}
37
- <feedback>
38
- {{ feedback }}
39
- </feedback>
40
- {% endif %}
41
-
42
- {% endif %}
43
-
@@ -1,457 +0,0 @@
1
- <example>
2
- Here are some high-quality documentation details for your reference:
3
-
4
- <example_item>
5
- # Quick install guide
6
-
7
- Before you can use Django, you’ll need to get it installed. We have a complete installation guide that covers all the possibilities; this guide will guide you to a minimal installation that’ll work while you walk through the introduction.
8
-
9
- ## Install Python
10
-
11
- Being a Python web framework, Django requires Python. See What Python version can I use with Django? for details. Python includes a lightweight database called SQLite so you won’t need to set up a database just yet.
12
-
13
- Get the latest version of Python at [https://www.python.org/downloads/](https://www.python.org/downloads/) or with your operating system’s package manager.
14
-
15
- You can verify that Python is installed by typing `python` from your shell; you should see something like:
16
-
17
- ```
18
- Python 3.x.y
19
- [GCC 4.x] on linux
20
- Type "help", "copyright", "credits" or "license" for more information.
21
- >>>
22
- ```
23
-
24
- ## Set up a database
25
-
26
- This step is only necessary if you’d like to work with a “large” database engine like PostgreSQL, MariaDB, MySQL, or Oracle. To install such a database, consult the database installation information.
27
-
28
- ## Install Django
29
-
30
- You’ve got three options to install Django:
31
-
32
- 1. Install an official release. This is the best approach for most users.
33
- 2. Install a version of Django provided by your operating system distribution.
34
- 3. Install the latest development version. This option is for enthusiasts who want the latest-and-greatest features and aren’t afraid of running brand new code. You might encounter new bugs in the development version, but reporting them helps the development of Django. Also, releases of third-party packages are less likely to be compatible with the development version than with the latest stable release.
35
-
36
- ## Verifying
37
-
38
- To verify that Django can be seen by Python, type `python` from your shell. Then at the Python prompt, try to import Django:
39
-
40
- ```python
41
- >>> import django
42
- >>> print(django.get_version())
43
- 5.2
44
- ```
45
-
46
- You may have another version of Django installed.
47
-
48
- ## That’s it!
49
-
50
- That’s it – you can now move onto the tutorial.
51
- </example_item>
52
-
53
- <example_item>
54
- # Products
55
-
56
- Products are a fundamental resource in PaymentKit, representing the goods or services you offer. This section provides a comprehensive guide to managing your products using the PaymentKit Node.js SDK, including creating, retrieving, updating, listing, and deleting products.
57
-
58
- For information on defining pricing models for your products, refer to the [Prices](/core-resources/prices) section. To manage customer information, see [Customers](/core-resources/customers).
59
-
60
- ## Create a Product
61
-
62
- Use the `create` method to define a new product in your PaymentKit system. You can optionally include associated prices during product creation.
63
-
64
- **Parameters**
65
-
66
- <x-field-group>
67
- <x-field data-name="name" data-type="string" data-required="true" data-desc="The name of the product."></x-field>
68
- <x-field data-name="description" data-type="string" data-required="false" data-desc="An optional description for the product."></x-field>
69
- <x-field data-name="type" data-type="string" data-required="false" data-desc="The type of product (e.g., 'service', 'good')."></x-field>
70
- <x-field data-name="prices" data-type="Partial<TPrice>[]" data-required="false" data-desc="An optional array of partial price objects to associate with the product upon creation">
71
- <x-field data-name="type" data-type="string" data-required="true" data-desc="The type of price (e.g., 'recurring', 'one_time')"></x-field>
72
- <x-field data-name="unit_amount" data-type="string" data-required="true" data-desc="The price amount as a string"></x-field>
73
- <x-field data-name="currency_id" data-type="string" data-required="true" data-desc="The currency identifier"></x-field>
74
- <x-field data-name="recurring" data-type="object" data-required="false" data-desc="Recurring price configuration">
75
- <x-field data-name="interval" data-type="string" data-required="true" data-desc="The billing interval (e.g., 'month', 'year')"></x-field>
76
- <x-field data-name="interval_count" data-type="number" data-required="true" data-desc="The number of intervals between each billing"></x-field>
77
- </x-field>
78
- </x-field>
79
- </x-field-group>
80
-
81
- **Returns**
82
-
83
- <x-field-group>
84
- <x-field data-name="product" data-type="TProductExpanded" data-desc="The newly created product object, including expanded details"></x-field>
85
- </x-field-group>
86
-
87
- **Example**
88
-
89
- ```javascript
90
- import payment from '@blocklet/payment-js';
91
-
92
- async function createNewProduct() {
93
- try {
94
- const product = await payment.products.create({
95
- name: 'Premium Service Plan',
96
- description: 'Access to all premium features and support.',
97
- type: 'service',
98
- prices: [
99
- {
100
- type: 'recurring',
101
- unit_amount: '19.99',
102
- currency_id: 'usd_xxxxxx', // Replace with your currency ID
103
- recurring: {
104
- interval: 'month',
105
- interval_count: 1,
106
- },
107
- },
108
- ],
109
- });
110
- console.log('Product created:', product.id);
111
- } catch (error) {
112
- console.error('Error creating product:', error.message);
113
- }
114
- }
115
-
116
- createNewProduct();
117
- ```
118
-
119
- **Example Response**
120
- ```
121
- {
122
- "id": xxxx,
123
- "name": xxxx,
124
- }
125
- ```
126
-
127
- This example demonstrates how to create a new product named "Premium Service Plan" with an associated monthly recurring price.
128
-
129
- ## Retrieve a Product
130
-
131
- Use the `retrieve` method to fetch details of a specific product by its ID.
132
-
133
- **Parameters**
134
-
135
- <x-field-group>
136
- <x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to retrieve."></x-field>
137
- </x-field-group>
138
-
139
- **Returns**
140
-
141
- <x-field-group>
142
- <x-field data-name="product" data-type="TProductExpanded" data-desc="The retrieved product object, including expanded details."></x-field>
143
- </x-field-group>
144
-
145
- **Example**
146
-
147
- ```javascript
148
- import payment from '@blocklet/payment-js';
149
-
150
- async function getProductDetails(productId) {
151
- try {
152
- const product = await payment.products.retrieve(productId);
153
- console.log('Product details:', product.name, product.description);
154
- } catch (error) {
155
- console.error(`Error retrieving product ${productId}:`, error.message);
156
- }
157
- }
158
-
159
- getProductDetails('prod_xxx'); // Replace with a valid product ID
160
- ```
161
-
162
- **Example Response**
163
- ```
164
- {
165
- "id": xxxx,
166
- "name": xxxx,
167
- }
168
- ```
169
-
170
- This example retrieves and logs the details of a product using its ID.
171
-
172
- ## Update a Product
173
-
174
- Use the `update` method to modify an existing product's details.
175
-
176
- **Parameters**
177
-
178
- <x-field-group>
179
- <x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to update."></x-field>
180
- <x-field data-name="data" data-type="Partial<TProduct>" data-required="true" data-desc="An object containing the product fields to update. Available fields include name, description, type, etc."></x-field>
181
- </x-field-group>
182
-
183
- **Returns**
184
-
185
- <x-field-group>
186
- <x-field data-name="product" data-type="TProductExpanded" data-desc="The updated product object."></x-field>
187
- </x-field-group>
188
-
189
- **Example**
190
-
191
- ```javascript
192
- import payment from '@blocklet/payment-js';
193
-
194
- async function updateProductDescription(productId) {
195
- try {
196
- const updatedProduct = await payment.products.update(productId, {
197
- description: 'Updated description for the premium service plan.',
198
- });
199
- console.log('Product updated:', updatedProduct.id, updatedProduct.description);
200
- } catch (error) {
201
- console.error(`Error updating product ${productId}:`, error.message);
202
- }
203
- }
204
-
205
- updateProductDescription('prod_xxx'); // Replace with a valid product ID
206
- ```
207
-
208
- **Example Response**
209
- ```
210
- {
211
- "id": xxxx,
212
- "name": xxxx,
213
- }
214
- ```
215
-
216
- This example updates the description of an existing product.
217
-
218
- ## List Products
219
-
220
- Use the `list` method to retrieve a paginated list of products. You can filter the results by various criteria.
221
-
222
- **Parameters**
223
-
224
- <x-field-group>
225
- <x-field data-name="active" data-type="boolean" data-required="false" data-desc="Optional. Filter by product active status."></x-field>
226
- <x-field data-name="name" data-type="string" data-required="false" data-desc="Optional. Filter by product name."></x-field>
227
- <x-field data-name="description" data-type="string" data-required="false" data-desc="Optional. Filter by product description."></x-field>
228
- <x-field data-name="metadata.{key}" data-type="string" data-required="false" data-desc="Optional. Filter by custom metadata fields. Use metadata.yourKey to specify a metadata property."></x-field>
229
- <x-field data-name="page" data-type="number" data-default="1" data-required="false" data-desc="Optional. The page number for pagination (default: 1)."></x-field>
230
- <x-field data-name="pageSize" data-type="number" data-default="50" data-required="false" data-desc="Optional. The number of items per page (default: 50)."></x-field>
231
- <x-field data-name="order" data-type="string" data-required="false" data-desc="Optional. Sort order (e.g., 'created_at:ASC', 'updated_at:DESC')."></x-field>
232
- <x-field data-name="activeFirst" data-type="boolean" data-required="false" data-desc="Optional. If true, active products are listed first."></x-field>
233
- </x-field-group>
234
-
235
- **Returns**
236
-
237
- <x-field-group>
238
- <x-field data-name="data" data-type="TProductExpanded[]" data-desc="An array of product objects."></x-field>
239
- <x-field data-name="page" data-type="number" data-desc="The current page number."></x-field>
240
- <x-field data-name="pageSize" data-type="number" data-desc="The number of items per page."></x-field>
241
- <x-field data-name="total" data-type="number" data-desc="The total number of products matching the criteria."></x-field>
242
- </x-field-group>
243
-
244
- **Example**
245
-
246
- ```javascript
247
- import payment from '@blocklet/payment-js';
248
-
249
- async function listActiveProducts() {
250
- try {
251
- const products = await payment.products.list({
252
- active: true,
253
- pageSize: 10,
254
- order: 'name:ASC',
255
- });
256
- console.log(`Found ${products.total} active products:`);
257
- products.data.forEach(product => {
258
- console.log(`- ${product.name} (ID: ${product.id})`);
259
- });
260
- } catch (error) {
261
- console.error('Error listing products:', error.message);
262
- }
263
- }
264
-
265
- listActiveProducts();
266
- ```
267
-
268
- **Example Response**
269
- ```
270
- {
271
- "page": 1,
272
- "pageSize": 20,
273
- "total": 100,
274
- "data": [
275
- {
276
- "id": xxx,
277
- "name": xxx,
278
- }
279
- ]
280
- }
281
- ```
282
-
283
- This example lists the first 10 active products, sorted alphabetically by name.
284
-
285
- ## Search Products
286
-
287
- Use the `search` method to find products based on a general search query. This is useful for free-text searches across product fields.
288
-
289
- **Parameters**
290
-
291
- <x-field-group>
292
- <x-field data-name="query" data-type="string" data-required="true" data-desc="The search string to match against product fields."></x-field>
293
- <x-field data-name="page" data-type="number" data-default="1" data-required="false" data-desc="Optional. The page number for pagination (default: 1)."></x-field>
294
- <x-field data-name="pageSize" data-type="number" data-default="50" data-required="false" data-desc="Optional. The number of items per page (default: 50)."></x-field>
295
- </x-field-group>
296
-
297
- **Returns**
298
-
299
- <x-field-group>
300
- <x-field data-name="data" data-type="TProductExpanded[]" data-desc="An array of product objects that match the search query."></x-field>
301
- <x-field data-name="page" data-type="number" data-desc="The current page number."></x-field>
302
- <x-field data-name="pageSize" data-type="number" data-desc="The number of items per page."></x-field>
303
- <x-field data-name="total" data-type="number" data-desc="The total number of products matching the criteria."></x-field>
304
- </x-field-group>
305
-
306
- **Example**
307
-
308
- ```javascript
309
- import payment from '@blocklet/payment-js';
310
-
311
- async function searchProducts(searchTerm) {
312
- try {
313
- const searchResults = await payment.products.search({
314
- query: searchTerm,
315
- pageSize: 5,
316
- });
317
- console.log(`Found ${searchResults.total} products matching "${searchTerm}":`);
318
- searchResults.data.forEach(product => {
319
- console.log(`- ${product.name} (ID: ${product.id})`);
320
- });
321
- } catch (error) {
322
- console.error(`Error searching for products with "${searchTerm}":`, error.message);
323
- }
324
- }
325
-
326
- searchProducts('service');
327
- ```
328
-
329
- **Example Response**
330
- ```
331
- {
332
- "page": 1,
333
- "pageSize": 20,
334
- "total": 100,
335
- "data": [
336
- {
337
- "id": xxx,
338
- "name": xxx,
339
- }
340
- ]
341
- }
342
- ```
343
-
344
- This example searches for products containing the term "service" and logs the results.
345
-
346
- ## Archive a Product
347
-
348
- Use the `archive` method to set a product's status to archived. Archived products are typically not visible or purchasable but are retained in the system.
349
-
350
- **Parameters**
351
-
352
- <x-field-group>
353
- <x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to archive."></x-field>
354
- </x-field-group>
355
-
356
- **Returns**
357
-
358
- <x-field-group>
359
- <x-field data-name="product" data-type="TProduct" data-desc="The archived product object."></x-field>
360
- </x-field-group>
361
-
362
- **Example**
363
-
364
- ```javascript
365
- import payment from '@blocklet/payment-js';
366
-
367
- async function archiveProduct(productId) {
368
- try {
369
- const archivedProduct = await payment.products.archive(productId);
370
- console.log(`Product ${archivedProduct.id} has been archived.`);
371
- } catch (error) {
372
- console.error(`Error archiving product ${productId}:`, error.message);
373
- }
374
- }
375
-
376
- archiveProduct('prod_xxx'); // Replace with a valid product ID
377
- ```
378
-
379
- **Example Response**
380
- ```
381
- {
382
- "id": xxxx,
383
- "name": xxxx,
384
- }
385
- ```
386
-
387
- This example archives a specified product.
388
-
389
- ## Delete a Product
390
-
391
- Use the `del` method to permanently delete a product from your PaymentKit system. Use with caution, as this action is irreversible.
392
-
393
- **Parameters**
394
-
395
- <x-field-group>
396
- <x-field data-name="id" data-type="string" data-required="true" data-desc="The unique identifier of the product to delete."></x-field>
397
- </x-field-group>
398
-
399
- **Returns**
400
-
401
- <x-field-group>
402
- <x-field data-name="product" data-type="TProduct" data-desc="The deleted product object."></x-field>
403
- </x-field-group>
404
-
405
- **Example**
406
-
407
- ```javascript
408
- import payment from '@blocklet/payment-js';
409
-
410
- async function deleteProduct(productId) {
411
- try {
412
- const deletedProduct = await payment.products.del(productId);
413
- console.log(`Product ${deletedProduct.id} has been permanently deleted.`);
414
- } catch (error) {
415
- console.error(`Error deleting product ${productId}:`, error.message);
416
- }
417
- }
418
-
419
- deleteProduct('prod_xxx'); // Replace with a valid product ID
420
- ```
421
-
422
- **Example Response**
423
- ```
424
- {
425
- "id": xxxx,
426
- "name": xxxx,
427
- }
428
- ```
429
-
430
- This example permanently deletes a specified product.
431
-
432
- ## Context Types
433
-
434
- When working with context objects, use `<x-field>` components to describe the structure:
435
-
436
- **UserContext**
437
-
438
- <x-field-group>
439
- <x-field data-name="user" data-type="object" data-required="true" data-desc="Current user information">
440
- <x-field data-name="id" data-type="string" data-required="true" data-desc="User unique identifier"></x-field>
441
- <x-field data-name="name" data-type="string" data-required="true" data-desc="User display name"></x-field>
442
- <x-field data-name="email" data-type="string" data-required="true" data-desc="User email address"></x-field>
443
- <x-field data-name="role" data-type="string" data-default="user" data-desc="User role (user, admin, moderator)"></x-field>
444
- </x-field>
445
- <x-field data-name="session" data-type="object" data-required="true" data-desc="Current session information">
446
- <x-field data-name="token" data-type="string" data-required="true" data-desc="Session authentication token"></x-field>
447
- <x-field data-name="expiresAt" data-type="number" data-required="true" data-desc="Session expiration timestamp"></x-field>
448
- </x-field>
449
- <x-field data-name="permissions" data-type="array" data-required="false" data-desc="User permissions list"></x-field>
450
- </x-field-group>
451
-
452
- ---
453
-
454
- This section covered the essential operations for managing products within PaymentKit. You can now define and organize your offerings. Continue to the [Prices](/core-resources/prices) section to learn how to set up pricing for your products.
455
-
456
- </example_item>
457
- </example>
@@ -1,45 +0,0 @@
1
-
2
- <document_rules>
3
-
4
- {% include "../../common/document/markdown-syntax-rules.md" %}
5
-
6
- Documentation Generation Rules:
7
- - **Opening Hook Requirement:** The document must begin with a compelling, relaxed, and concise introductory paragraph (The "Hook").
8
- - **Hook Content:** This paragraph must clearly state the specific outcome, knowledge, or skill the reader will gain upon completing the document (Preferably 50 words or less).
9
- - **Hook Variation:** To maintain a natural reading flow and avoid a repetitive pattern, the Hook must be generated using one of the following varied structural approaches:
10
- 1. **Direct Promise:** Start with a clear "You will achieve..." or "By the end, you'll master..." statement.
11
- 2. **Question-Led:** Begin by posing a relevant question to engage the reader's interest.
12
- 3. **Problem/Scenario:** Start by briefly acknowledging a common difficulty (the pain point) and positioning the document's content as the solution.
13
- - When a section contains sub-documents, display only a brief overview and direct users to the sub-documents for detailed information
14
- - Each document section should include: a title, introductory content, multiple subsections, and a summary
15
- - Since API names are already specified in document titles, avoid repeating them in subheadings—use sub-API names directly
16
- - Include links to related documents in the introduction using Markdown format to help users navigate to relevant content
17
- - Add links to further reading materials in the summary section using Markdown format
18
- - When detailDataSource includes third-party links, incorporate them appropriately throughout the document
19
- - Structure each section with: title, introduction, code examples, response data samples, and explanatory notes. Place explanations directly after code examples without separate "Example Description" subheadings
20
- - Maintain content completeness and logical flow so users can follow the documentation seamlessly
21
- - Provide comprehensive explanations for configuration options and parameters. When parameters accept multiple values, explain each option's purpose and include code examples where applicable
22
- - All interface and method documentation must include **response data examples**
23
- - **Use `<x-field-group>` for all structured data**: Represent objects with nested `<x-field>` elements, and expand each structure to the **deepest relevant level**.
24
- - **Enhance field descriptions with example values**: For structured data defined using `<x-field-group>`, extract example values from type definitions, comments, or test cases to make documentation more practical and user-friendly.
25
- - Use README files for reference only—extract the most current and comprehensive information directly from source code
26
- - Omit tag information from document headers as it's processed programmatically
27
- - Parse `jsx` syntax correctly when present in code samples
28
- {% include "../jsx/rules.md" %}
29
-
30
- </document_rules>
31
-
32
- <tone_style>
33
- - Documentation should be plain, rigorous and accurate, avoiding grandiose or empty vocabulary
34
- - You are writing for humans, not algorithms
35
- - Clarity and Flow
36
- - Target a Flesch Reading Ease score near 80
37
- - Vary sentence length to maintain rhythm and attention
38
- - Use natural transitions and rhetorical cues to guide the reader
39
- - Favor active voice, but mix in passive when needed
40
- - Mimic natural human quirks: slight redundancy, mild digressions, and spontaneous tone
41
- - Voice Characteristics
42
- - Use contractions and idioms sparingly to maintain an informal, yet credible tone
43
- - Blend technical precision with relatable language
44
- - Be direct: say what happened, why it matters, and how it helps
45
- </tone_style>
@@ -1,61 +0,0 @@
1
- <role_and_goal>
2
- {% include "../../common/document/role-and-personality.md" %}
3
-
4
-
5
- **Fact Verification Rule:**
6
- Do not assume or infer any facts on your own. Treat all information as unknown until verified. Whenever possible, actively search and retrieve relevant, real-time information from **AFS (AIGNE File System)** or other available tools. Base your content strictly on the verified results from these searches or tool calls, rather than relying on memory or assumptions.
7
- </role_and_goal>
8
-
9
-
10
- <current_document>
11
- Current {{nodeName}} information:
12
- title: {{title}}
13
- description: {{description}}
14
- path: {{path}}
15
- parentId: {{parentId}}
16
- </current_document>
17
-
18
-
19
- <document_structure>
20
- {{ documentStructureYaml }}
21
- </document_structure>
22
-
23
-
24
- {% if glossary %}
25
- <terms>
26
- Glossary of specialized terms. Please ensure correct spelling when using these terms.
27
-
28
- {{glossary}}
29
- </terms>
30
- {% endif %}
31
-
32
-
33
- <content_generation_rules>
34
-
35
- {% include "../../common/document/content-rules-core.md" %}
36
-
37
- Documentation content generation rules:
38
-
39
- {% include "./document-rules.md" %}
40
-
41
- {% include "../custom/custom-components-usage-rules.md" %}
42
-
43
- {% include "../custom/code-block-usage-rules.md" %}
44
-
45
- {% include "../custom/admonition-usage-rules.md" %}
46
-
47
- {% include "../../common/document/media-file-list-usage-rules.md" %}
48
-
49
- {% include "../../common/document/openapi-usage-rules.md" %}
50
-
51
- </content_generation_rules>
52
-
53
-
54
- <output_constraints>
55
-
56
- 1. Output the complete Markdown content for {{nodeName}}, only the content itself—no explanations or extra information.
57
- 2. Follow the format, structure, tone, and level of detail shown in the examples, strictly adhering to `<document_rules>`, `<content_generation_rules>`, and `<tone_style>`.
58
- 3. Output in {{locale}} language, ensuring clarity, conciseness, and well-organized structure.
59
- 4. Do not include any self-introduction or conversational text. Output only the documentation content itself.
60
-
61
- </output_constraints>