@aigne/doc-smith 0.9.10 → 0.9.11-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +189 -219
- package/README.zh.md +270 -0
- package/agents/bash-executor/index.mjs +347 -0
- package/agents/clear/ai/intent.md +142 -0
- package/agents/clear/choose-contents.mjs +13 -65
- package/agents/clear/clear-auth-tokens.mjs +17 -21
- package/agents/clear/clear-deployment-config.mjs +33 -24
- package/agents/clear/index.yaml +1 -9
- package/agents/content-checker/ai/intent.md +209 -0
- package/agents/content-checker/clean-invalid-docs.mjs +254 -0
- package/agents/content-checker/index.mjs +191 -0
- package/agents/content-checker/validate-content.mjs +983 -0
- package/agents/generate-images/generate-image.yaml +75 -0
- package/agents/generate-images/generate-summary.mjs +213 -0
- package/agents/generate-images/index.yaml +39 -0
- package/agents/generate-images/prepare-generation.mjs +286 -0
- package/agents/generate-images/prepare-image-generation.mjs +130 -0
- package/{prompts/detail/diagram/generate-image-system.md → agents/generate-images/prompts/system.md} +22 -56
- package/agents/generate-images/prompts/user.md +85 -0
- package/agents/generate-images/save-image-result.mjs +247 -0
- package/agents/generate-images/scan-image-slots.mjs +247 -0
- package/agents/localize/index.yaml +19 -42
- package/{prompts/translate → agents/localize/prompts}/translate-document.md +0 -139
- package/agents/localize/translate-documents/generate-summary.mjs +163 -0
- package/agents/localize/translate-documents/load-glossary.mjs +52 -0
- package/agents/localize/translate-documents/prepare-translation.mjs +249 -0
- package/agents/localize/translate-documents/save-translation.mjs +171 -0
- package/agents/localize/translate-documents/translate-document-to-language.mjs +209 -0
- package/agents/localize/translate-documents/translate-document.yaml +23 -0
- package/agents/localize/translate-documents/translate-to-languages.yaml +10 -0
- package/agents/localize/translate-images/check-image-translation.mjs +225 -0
- package/agents/localize/translate-images/detect-text/detect-and-update-shared.mjs +148 -0
- package/agents/localize/translate-images/detect-text/detect-image-text.yaml +44 -0
- package/agents/localize/translate-images/detect-text/detect-images-text.yaml +21 -0
- package/agents/localize/translate-images/detect-text/prompts/detect-image-text-system.md +43 -0
- package/agents/localize/translate-images/detect-text/prompts/detect-image-text-user.md +14 -0
- package/agents/localize/translate-images/detect-text/save-text-detection.mjs +105 -0
- package/agents/localize/translate-images/prepare-image-input.mjs +124 -0
- package/agents/localize/translate-images/save-image-translation.mjs +172 -0
- package/agents/localize/translate-images/scan-doc-images.mjs +165 -0
- package/agents/localize/translate-images/translate-doc-images.yaml +24 -0
- package/agents/localize/{translate-diagram.yaml → translate-images/translate-image.yaml} +25 -14
- package/agents/publish/ai/intent.md +182 -0
- package/agents/publish/check.mjs +107 -0
- package/agents/publish/index.yaml +9 -14
- package/agents/publish/publish-docs.mjs +81 -61
- package/agents/publish/translate-meta.mjs +79 -58
- package/agents/save-document/index.mjs +260 -0
- package/agents/structure-checker/index.mjs +307 -0
- package/agents/structure-checker/validate-structure.mjs +477 -0
- package/agents/update-image/analyze-feedback.yaml +37 -0
- package/agents/update-image/index.yaml +78 -0
- package/agents/update-image/load-existing-image.mjs +211 -0
- package/agents/update-image/prompts/analyze-feedback-system.md +43 -0
- package/agents/update-image/prompts/analyze-feedback-user.md +15 -0
- package/aigne.yaml +26 -139
- package/package.json +16 -48
- package/scripts/README.md +90 -0
- package/scripts/install.sh +86 -0
- package/scripts/uninstall.sh +52 -0
- package/skills/doc-smith/SKILL.md +285 -0
- package/skills/doc-smith/ai/intent/sources-improve.md +290 -0
- package/skills/doc-smith/references/changeset-guide.md +171 -0
- package/skills/doc-smith/references/document-content-guide.md +214 -0
- package/skills/doc-smith/references/document-structure-schema.md +138 -0
- package/skills/doc-smith/references/patch-guide.md +96 -0
- package/skills/doc-smith/references/structure-confirmation-guide.md +133 -0
- package/skills/doc-smith/references/structure-planning-guide.md +149 -0
- package/skills/doc-smith/references/update-workflow.md +108 -0
- package/skills/doc-smith/references/user-intent-guide.md +175 -0
- package/skills/doc-smith/references/workspace-initialization.md +376 -0
- package/skills/doc-smith-docs-detail/SKILL.md +356 -0
- package/skills/doc-smith-docs-detail/ai/intent.md +271 -0
- package/skills-entry/doc-smith/ai/intent.md +260 -0
- package/skills-entry/doc-smith/index.mjs +66 -0
- package/skills-entry/doc-smith/prompt.md +57 -0
- package/skills-entry/doc-smith/utils.mjs +27 -0
- package/skills-entry/doc-smith-docs-detail/batch.yaml +56 -0
- package/skills-entry/doc-smith-docs-detail/index.mjs +95 -0
- package/skills-entry/doc-smith-docs-detail/prompt.md +64 -0
- package/utils/afs-factory.mjs +183 -0
- package/utils/agent-constants.mjs +97 -0
- package/utils/{auth-utils.mjs → auth.mjs} +6 -9
- package/{agents/utils/update-branding.mjs → utils/branding.mjs} +3 -4
- package/utils/config.mjs +261 -0
- package/utils/constants.mjs +32 -0
- package/utils/deploy.mjs +3 -3
- package/utils/docs-converter.mjs +454 -0
- package/utils/docs.mjs +212 -0
- package/utils/document-paths.mjs +172 -0
- package/utils/files.mjs +74 -0
- package/utils/git.mjs +65 -0
- package/utils/{blocklet.mjs → http.mjs} +18 -0
- package/utils/image-slots.mjs +57 -0
- package/utils/image-utils.mjs +114 -0
- package/utils/project.mjs +95 -0
- package/utils/sources-path-resolver.mjs +76 -0
- package/utils/{upload-files.mjs → upload.mjs} +3 -3
- package/utils/workspace.mjs +371 -0
- 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/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/create/aggregate-document-structure.mjs +0 -21
- package/agents/create/analyze-diagram-type-llm.yaml +0 -159
- package/agents/create/analyze-diagram-type.mjs +0 -455
- package/agents/create/check-document-structure.yaml +0 -30
- package/agents/create/check-need-generate-structure.mjs +0 -138
- 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 -91
- package/agents/create/generate-structure.yaml +0 -106
- package/agents/create/index.yaml +0 -45
- package/agents/create/refine-document-structure.yaml +0 -12
- package/agents/create/replace-d2-with-image.mjs +0 -610
- 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 -139
- package/agents/create/utils/init-current-content.mjs +0 -34
- package/agents/create/utils/merge-document-structures.mjs +0 -36
- 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 -643
- package/agents/init/validate.mjs +0 -16
- package/agents/localize/choose-language.mjs +0 -107
- package/agents/localize/record-translation-history.mjs +0 -23
- package/agents/localize/save-doc-translation-or-skip.mjs +0 -18
- package/agents/localize/set-review-content.mjs +0 -58
- package/agents/localize/translate-document-wrapper.mjs +0 -34
- package/agents/localize/translate-document.yaml +0 -24
- package/agents/localize/translate-multilingual.yaml +0 -57
- package/agents/localize/translate-or-skip-diagram.mjs +0 -52
- 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 -454
- package/agents/prefs/index.mjs +0 -203
- 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-update-is-single.mjs +0 -53
- package/agents/update/document-tools/update-document-content.mjs +0 -303
- package/agents/update/generate-diagram.yaml +0 -80
- package/agents/update/generate-document.yaml +0 -70
- package/agents/update/handle-document-update.yaml +0 -103
- package/agents/update/index.yaml +0 -69
- package/agents/update/pre-check-generate-diagram.yaml +0 -44
- package/agents/update/save-and-translate-document.mjs +0 -80
- package/agents/update/update-document-detail.yaml +0 -71
- package/agents/update/update-single/update-single-document-detail.mjs +0 -322
- 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 -253
- package/agents/utils/analyze-structure-feedback-intent.yaml +0 -29
- package/agents/utils/check-detail-result.mjs +0 -51
- package/agents/utils/check-feedback-refiner.mjs +0 -81
- package/agents/utils/choose-docs.mjs +0 -251
- 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 -96
- 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 -133
- package/agents/utils/read-current-document-content.mjs +0 -46
- package/agents/utils/save-doc-translation.mjs +0 -30
- package/agents/utils/save-doc.mjs +0 -54
- package/agents/utils/save-output.mjs +0 -26
- package/agents/utils/save-sidebar.mjs +0 -38
- 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/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-user.md +0 -81
- 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/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/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 -205
- package/utils/debug.mjs +0 -3
- package/utils/delete-diagram-images.mjs +0 -99
- package/utils/diagram-version-utils.mjs +0 -14
- package/utils/docs-finder-utils.mjs +0 -548
- 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 -154
- package/utils/kroki-utils.mjs +0 -173
- package/utils/linter/index.mjs +0 -50
- package/utils/load-config.mjs +0 -78
- 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/sync-diagram-to-translations.mjs +0 -272
- package/utils/translate-diagram-images.mjs +0 -807
- package/utils/utils.mjs +0 -1354
- /package/{prompts/translate → agents/localize/prompts}/glossary.md +0 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Doc-Smith Agent 功能意图
|
|
2
|
+
|
|
3
|
+
## 功能概述
|
|
4
|
+
|
|
5
|
+
Doc-Smith 主入口 Agent,在启动时自动检测并初始化工作空间,然后进入文档生成对话模式。整个流程通过单一 index.mjs 文件实现,导出一个 JS 配置对象。启动阶段不做任何用户询问,所有交互在对话流程中处理。
|
|
6
|
+
|
|
7
|
+
## 功能意图
|
|
8
|
+
|
|
9
|
+
DocSmith 需要在启动时自动检测工作空间状态,根据不同场景完成初始化,然后进入文档生成对话。由于 AIGNE 框架的实现限制,初始化逻辑和主 agent 配置需要合并在同一个 index.mjs 文件中。
|
|
10
|
+
|
|
11
|
+
## 工作流程
|
|
12
|
+
|
|
13
|
+
### 整体流程
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
doc-smith 启动
|
|
17
|
+
↓
|
|
18
|
+
加载 index.mjs(使用 top-level await)
|
|
19
|
+
↓
|
|
20
|
+
检测当前目录状态
|
|
21
|
+
↓
|
|
22
|
+
├─ config.yaml 已存在 → 读取配置,生成 AFS modules
|
|
23
|
+
├─ 是 git 仓库(无 config.yaml)→ 执行项目内初始化,生成 AFS modules
|
|
24
|
+
├─ 是空目录或非 git 目录 → 执行独立初始化,生成 AFS modules
|
|
25
|
+
└─ 其他情况 → 报错退出
|
|
26
|
+
↓
|
|
27
|
+
导出配置对象(含动态生成的 AFS modules)
|
|
28
|
+
↓
|
|
29
|
+
进入文档生成对话模式
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 流程 A:项目内启动
|
|
33
|
+
|
|
34
|
+
**触发条件**:当前目录是 git 仓库,且 `.aigne/doc-smith/config.yaml` 不存在
|
|
35
|
+
|
|
36
|
+
**步骤**:
|
|
37
|
+
1. 创建 `.aigne/doc-smith/` 目录
|
|
38
|
+
2. 在 `.aigne/doc-smith/` 中执行 `git init`
|
|
39
|
+
3. 创建目录结构(intent/、planning/、docs/)
|
|
40
|
+
4. 创建 `.gitignore` 文件(忽略 sources/ 目录)
|
|
41
|
+
5. 获取项目 git 信息(远程仓库 URL、当前分支、当前 commit)
|
|
42
|
+
6. 生成 config.yaml(mode: project,sources 配置为 local-path 类型,同时记录 git 信息)
|
|
43
|
+
7. 生成 AFS modules 配置
|
|
44
|
+
|
|
45
|
+
### 流程 B:独立启动
|
|
46
|
+
|
|
47
|
+
**触发条件**:当前目录是空目录或非 git 目录
|
|
48
|
+
|
|
49
|
+
**步骤**:
|
|
50
|
+
1. 执行 `git init` 初始化当前目录
|
|
51
|
+
2. 创建 `.gitignore`,添加 `sources/` 到忽略列表
|
|
52
|
+
3. 创建目录结构(intent/、planning/、docs/、sources/)
|
|
53
|
+
4. 生成 config.yaml(mode: standalone,sources 配置为空数组,后续对话中添加)
|
|
54
|
+
5. 生成 AFS modules 配置
|
|
55
|
+
|
|
56
|
+
**注意**:独立启动时不询问仓库地址,源仓库的添加在后续对话流程中处理。
|
|
57
|
+
|
|
58
|
+
### 流程 C:已初始化
|
|
59
|
+
|
|
60
|
+
**触发条件**:`config.yaml` 已存在(通过检测 `.aigne/doc-smith/config.yaml` 或 `./config.yaml`)
|
|
61
|
+
|
|
62
|
+
**步骤**:
|
|
63
|
+
1. 读取现有配置
|
|
64
|
+
2. 根据 config.yaml 中的 mode 字段生成 AFS modules 配置
|
|
65
|
+
|
|
66
|
+
## 核心能力
|
|
67
|
+
|
|
68
|
+
### 1. 目录状态检测
|
|
69
|
+
|
|
70
|
+
- 检测 workspace 是否已初始化(`.aigne/doc-smith/config.yaml` 或 `./config.yaml` 存在)
|
|
71
|
+
- 检测当前目录是否为 git 仓库(`.git/` 目录存在)
|
|
72
|
+
- 检测当前目录是否为空目录
|
|
73
|
+
- 获取 git 仓库信息(远程 URL、当前分支、当前 commit)用于记录生成文档时的仓库状态
|
|
74
|
+
|
|
75
|
+
### 2. 用户交互
|
|
76
|
+
|
|
77
|
+
启动阶段不做任何用户询问。所有配置(如源仓库地址、语言等)在对话流程中处理。
|
|
78
|
+
|
|
79
|
+
### 3. 目录结构创建
|
|
80
|
+
|
|
81
|
+
**项目内启动创建的结构**:
|
|
82
|
+
```
|
|
83
|
+
.aigne/
|
|
84
|
+
└── doc-smith/
|
|
85
|
+
├── .git/ # 独立 git 仓库
|
|
86
|
+
├── .gitignore # 忽略 sources/ 目录
|
|
87
|
+
├── config.yaml # 工作空间配置
|
|
88
|
+
├── intent/ # 意图文件目录
|
|
89
|
+
├── planning/ # 规划文件目录
|
|
90
|
+
└── docs/ # 生成的文档目录
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**独立启动创建的结构**:
|
|
94
|
+
```
|
|
95
|
+
./ # 当前目录
|
|
96
|
+
├── .git/
|
|
97
|
+
├── .gitignore # 包含 sources/
|
|
98
|
+
├── config.yaml # 工作空间配置
|
|
99
|
+
├── sources/ # 源仓库目录(后续添加)
|
|
100
|
+
├── intent/
|
|
101
|
+
├── planning/
|
|
102
|
+
└── docs/
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 4. 配置文件内容
|
|
106
|
+
|
|
107
|
+
config.yaml 包含:
|
|
108
|
+
- `mode`:工作模式标识
|
|
109
|
+
- `project`:项目内启动
|
|
110
|
+
- `standalone`:独立启动
|
|
111
|
+
- `sources`:数据源配置数组
|
|
112
|
+
- 项目内启动:`local-path` 类型,包含相对路径和 git 信息
|
|
113
|
+
- 独立启动:`[]`(空数组,后续对话中添加)
|
|
114
|
+
|
|
115
|
+
**config.yaml 示例(项目内模式)**:
|
|
116
|
+
```yaml
|
|
117
|
+
mode: project
|
|
118
|
+
sources:
|
|
119
|
+
- type: local-path
|
|
120
|
+
path: "../../" # 相对路径(用于 AFS 挂载)
|
|
121
|
+
url: "git@github.com:user/project.git" # 远程仓库 URL(origin)
|
|
122
|
+
branch: "main" # 当前分支
|
|
123
|
+
commit: "a1b2c3d" # 当前 commit hash(短格式)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**config.yaml 示例(独立模式)**:
|
|
127
|
+
```yaml
|
|
128
|
+
mode: standalone
|
|
129
|
+
sources: []
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**字段说明**(与 git-clone 格式一致):
|
|
133
|
+
- `type`:数据源类型(`local-path`、`git-clone` 等)
|
|
134
|
+
- `path`:本地相对路径,用于 AFS 挂载(local-path 专用)
|
|
135
|
+
- `url`:远程仓库 URL(优先获取 origin,无远程时为空)
|
|
136
|
+
- `branch`:当前分支名
|
|
137
|
+
- `commit`:当前 commit hash(短格式,7 位)
|
|
138
|
+
|
|
139
|
+
### 5. 动态 AFS Modules 生成
|
|
140
|
+
|
|
141
|
+
根据工作空间模式动态生成 AFS modules,两种模式保持一致的 AFS 结构:
|
|
142
|
+
|
|
143
|
+
**项目内模式**:
|
|
144
|
+
- workspace:`${CWD}/.aigne/doc-smith`(工作空间目录)
|
|
145
|
+
- sources:`${CWD}`(源代码目录,即产品仓库根目录)
|
|
146
|
+
|
|
147
|
+
**独立模式**:
|
|
148
|
+
- workspace:`${CWD}`(工作空间目录)
|
|
149
|
+
- sources:`${CWD}/sources`(源代码目录)
|
|
150
|
+
|
|
151
|
+
**始终包含**:
|
|
152
|
+
- history:历史记录存储
|
|
153
|
+
- doc-smith skill:技能文件目录
|
|
154
|
+
|
|
155
|
+
这样两种模式对内部执行是一致的,都有 workspace 和 sources 两个 AFS 模块。
|
|
156
|
+
|
|
157
|
+
### 6. Git 操作
|
|
158
|
+
|
|
159
|
+
- `git init`:初始化仓库
|
|
160
|
+
- `git remote get-url origin`:获取远程仓库 URL
|
|
161
|
+
- `git branch --show-current`:获取当前分支名
|
|
162
|
+
- `git rev-parse --short HEAD`:获取当前 commit hash(短格式)
|
|
163
|
+
|
|
164
|
+
**获取 git 信息的策略**:
|
|
165
|
+
- 优先获取 origin 远程仓库 URL
|
|
166
|
+
- 如果 origin 不存在,尝试获取第一个可用的远程仓库
|
|
167
|
+
- 如果没有远程仓库,url 字段为空字符串
|
|
168
|
+
- 分支名、commit hash 获取失败时,默认使用空字符串
|
|
169
|
+
|
|
170
|
+
## 输入输出
|
|
171
|
+
|
|
172
|
+
### 输入
|
|
173
|
+
|
|
174
|
+
- 模块加载时自动执行初始化检测
|
|
175
|
+
- 启动阶段不接受用户输入
|
|
176
|
+
|
|
177
|
+
### 输出
|
|
178
|
+
|
|
179
|
+
导出一个 JS 配置对象,包含:
|
|
180
|
+
- `type`:agent 类型
|
|
181
|
+
- `name`:agent 名称
|
|
182
|
+
- `instructions`:指令文件路径
|
|
183
|
+
- `skills`:可用技能列表
|
|
184
|
+
- `afs.modules`:动态生成的 AFS 模块配置
|
|
185
|
+
|
|
186
|
+
## 约束条件
|
|
187
|
+
|
|
188
|
+
### 必须遵循的规范
|
|
189
|
+
|
|
190
|
+
1. **单文件实现**:所有逻辑在 index.mjs 中实现
|
|
191
|
+
2. **导出 JS 对象**:默认导出必须是配置对象,不能是函数
|
|
192
|
+
3. **top-level await**:使用 top-level await 在模块加载时执行异步初始化
|
|
193
|
+
4. **目录结构**:严格遵循定义的目录结构
|
|
194
|
+
5. **配置格式**:config.yaml 遵循统一的 schema,必须包含 mode 字段
|
|
195
|
+
6. **无启动询问**:启动阶段不做任何用户询问
|
|
196
|
+
7. **AFS 一致性**:两种模式都提供 workspace 和 sources 两个 AFS 模块
|
|
197
|
+
|
|
198
|
+
### 职责边界
|
|
199
|
+
|
|
200
|
+
- **必须执行**:
|
|
201
|
+
- 检测当前目录状态
|
|
202
|
+
- 获取 git 仓库信息(项目内模式)
|
|
203
|
+
- 创建目录结构和配置文件(首次启动)
|
|
204
|
+
- 执行必要的 git 操作
|
|
205
|
+
- 动态生成 AFS modules 配置
|
|
206
|
+
|
|
207
|
+
- **不应执行**:
|
|
208
|
+
- 不在启动阶段询问用户
|
|
209
|
+
- 不在启动阶段克隆仓库
|
|
210
|
+
- 不生成文档内容(由对话模式处理)
|
|
211
|
+
- 不创建远程仓库
|
|
212
|
+
- 不推送到远程
|
|
213
|
+
|
|
214
|
+
## 预期结果
|
|
215
|
+
|
|
216
|
+
### 成功标准
|
|
217
|
+
|
|
218
|
+
1. 正确检测目录状态并选择对应流程
|
|
219
|
+
2. 目录结构和配置文件正确创建
|
|
220
|
+
3. Git 操作正确执行
|
|
221
|
+
4. 项目内模式正确获取并记录 git 仓库状态(url、branch、commit)
|
|
222
|
+
5. AFS modules 根据模式正确生成(workspace + sources)
|
|
223
|
+
6. 成功导出配置对象进入对话模式
|
|
224
|
+
7. 启动过程无用户交互
|
|
225
|
+
|
|
226
|
+
## 错误处理
|
|
227
|
+
|
|
228
|
+
### 常见错误
|
|
229
|
+
|
|
230
|
+
1. **权限问题**:无法创建目录或文件
|
|
231
|
+
2. **git 命令不可用**:系统未安装 git
|
|
232
|
+
3. **无远程仓库**:项目未配置 origin 远程仓库
|
|
233
|
+
|
|
234
|
+
### 处理策略
|
|
235
|
+
|
|
236
|
+
1. **权限问题**:输出错误信息,提示检查目录权限
|
|
237
|
+
2. **git 不可用**:输出错误信息,提示安装 git
|
|
238
|
+
3. **无远程仓库**:正常继续,url 字段设为空字符串(不阻断流程)
|
|
239
|
+
|
|
240
|
+
## 实现方式
|
|
241
|
+
|
|
242
|
+
### 文件结构
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
skills-entry/doc-smith/
|
|
246
|
+
├── index.mjs # 主入口(含初始化逻辑和配置导出)
|
|
247
|
+
├── utils.mjs # 共享工具函数
|
|
248
|
+
├── prompt.md # agent 指令文件
|
|
249
|
+
└── ai/
|
|
250
|
+
└── intent/
|
|
251
|
+
└── doc-smith.md # 本文档
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 注册到 aigne.yaml
|
|
255
|
+
|
|
256
|
+
在 `aigne.yaml` 的 cli.agents 配置中,将 index.mjs 设置为 doc-smith 的入口。
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
**注意**:本文档描述功能意图,不包含具体实现代码。
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { detectAndInitialize, DOC_SMITH_DIR, WORKSPACE_MODES } from "../../utils/workspace.mjs";
|
|
2
|
+
import { generateDocSmithAfsModules } from "../../utils/afs-factory.mjs";
|
|
3
|
+
|
|
4
|
+
// Initialize workspace and generate config at module load time
|
|
5
|
+
console.log("\n🚀 Welcome to DocSmith!");
|
|
6
|
+
|
|
7
|
+
const workspace = await detectAndInitialize();
|
|
8
|
+
const afsModules = await generateDocSmithAfsModules(workspace);
|
|
9
|
+
|
|
10
|
+
// Print workspace info
|
|
11
|
+
console.log(`Project: ${process.cwd()}`);
|
|
12
|
+
if (workspace.mode === WORKSPACE_MODES.PROJECT) {
|
|
13
|
+
console.log(`DocSmith workspace: ${DOC_SMITH_DIR}`);
|
|
14
|
+
console.log(`Docs output: ${DOC_SMITH_DIR}/docs`);
|
|
15
|
+
} else {
|
|
16
|
+
console.log(`DocSmith workspace: .`);
|
|
17
|
+
console.log(`Docs output: ./docs`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log("\n🎯 Ready for documentation generation...\n");
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Main agent configuration
|
|
24
|
+
*/
|
|
25
|
+
export default {
|
|
26
|
+
type: "@aigne/agent-library/agent-skill-manager",
|
|
27
|
+
name: "docsmith",
|
|
28
|
+
task_render_mode: "collapse",
|
|
29
|
+
instructions: {
|
|
30
|
+
url: "./prompt.md",
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
model: {
|
|
34
|
+
cache_config: {
|
|
35
|
+
autoBreakpoints: {
|
|
36
|
+
lastMessage: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
session: {
|
|
42
|
+
compact: {
|
|
43
|
+
max_tokens: 150000,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
history_config: {
|
|
48
|
+
enabled: true,
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
input_key: "message",
|
|
52
|
+
skills: [
|
|
53
|
+
{ type: "@aigne/agent-library/ask-user-question" },
|
|
54
|
+
"../../agents/publish/index.yaml",
|
|
55
|
+
"../../agents/localize/index.yaml",
|
|
56
|
+
"../../agents/generate-images/index.yaml",
|
|
57
|
+
"../../agents/bash-executor/index.mjs",
|
|
58
|
+
"../../agents/structure-checker/index.mjs",
|
|
59
|
+
"../../agents/content-checker/index.mjs",
|
|
60
|
+
"../../agents/update-image/index.yaml",
|
|
61
|
+
"../../skills-entry/doc-smith-docs-detail/batch.yaml",
|
|
62
|
+
],
|
|
63
|
+
afs: {
|
|
64
|
+
modules: afsModules,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
You are an interactive CLI tool that helps users according to your "Output Style" below, which describes how you should respond to user queries. Use the instructions below and the tools available to you to assist the user.
|
|
2
|
+
|
|
3
|
+
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
|
|
4
|
+
|
|
5
|
+
# Tone and style
|
|
6
|
+
- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
|
|
7
|
+
- Your output will be displayed on a command line interface. Your responses should be short and concise. You can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
|
|
8
|
+
- Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
|
|
9
|
+
- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one. This includes markdown files.
|
|
10
|
+
- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.
|
|
11
|
+
|
|
12
|
+
{% if $afs.enabled %}
|
|
13
|
+
# AFS Context
|
|
14
|
+
|
|
15
|
+
{{ $afs.description }}
|
|
16
|
+
|
|
17
|
+
${"```"}yaml alt="AFS Modules"
|
|
18
|
+
{{ $afs.modules | yaml.stringify }}
|
|
19
|
+
${"```"}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
# Asking questions as you work
|
|
23
|
+
|
|
24
|
+
You have access to the askUserQuestion tool to ask the user questions when you need clarification, want to validate assumptions, or need to make a decision you're unsure about. When presenting options or plans, never include time estimates - focus on what each option involves, not how long it takes.
|
|
25
|
+
|
|
26
|
+
# Skill usage
|
|
27
|
+
|
|
28
|
+
When the user requests you to perform tasks, check if any of the available skills can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
|
29
|
+
|
|
30
|
+
## Loading skill resources on demand
|
|
31
|
+
|
|
32
|
+
Skills may include reference documents (guides, schemas, examples) in a \`references/\` directory. To optimize performance and context usage:
|
|
33
|
+
|
|
34
|
+
1. **Start with the main skill file** (e.g., \`SKILL.md\`) - it contains the workflow overview and references to detailed guides
|
|
35
|
+
2. **Load reference documents only when needed** - read specific guides only when you reach the step that requires them
|
|
36
|
+
3. **Don't preload all resources** - avoid reading all reference files at the start of a task
|
|
37
|
+
|
|
38
|
+
# Default Loading of `doc-smith` Skill use `Skill` tool
|
|
39
|
+
|
|
40
|
+
All user requests are related to documentation generation. The `doc-smith` skill should be loading by default, and you must process user requests according to `doc-smith` requirements. For each step, make sure to read the relevant reference files.
|
|
41
|
+
|
|
42
|
+
When the user provides a source code repository address, first load the `doc-smith` skill and handle the repository according to its requirements.
|
|
43
|
+
|
|
44
|
+
**You must loading the `doc-smith` Skill use `Skill` before performing any operations.**
|
|
45
|
+
|
|
46
|
+
# Doing tasks
|
|
47
|
+
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
|
|
48
|
+
- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.
|
|
49
|
+
- Use the askUserQuestion tool to ask questions, clarify and gather information as needed.
|
|
50
|
+
- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.
|
|
51
|
+
- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.
|
|
52
|
+
- Don't add features, refactor code, or make "improvements" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.
|
|
53
|
+
- Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.
|
|
54
|
+
- Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task—three similar lines of code is better than a premature abstraction.
|
|
55
|
+
- Avoid backwards-compatibility hacks like renaming unused \`_vars\`, re-exporting types, adding \`// removed\` comments for removed code, etc. If something is unused, delete it completely.
|
|
56
|
+
|
|
57
|
+
IMPORTANT: Complete tasks fully. Do not stop mid-task or leave work incomplete. Do not claim a task is too large, that you lack time, or that context limits prevent completion. You have unlimited context through summarization. Continue working until the task is done or the user stops you.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is kept for backward compatibility, all implementations have been migrated to utils/workspace.mjs
|
|
3
|
+
* Please use exports from utils/workspace.mjs directly
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Re-export all utility functions and constants
|
|
7
|
+
export {
|
|
8
|
+
// Constants
|
|
9
|
+
WORKSPACE_MODES,
|
|
10
|
+
AIGNE_DIR,
|
|
11
|
+
DOC_SMITH_DIR,
|
|
12
|
+
SOURCES_DIR,
|
|
13
|
+
WORKSPACE_SUBDIRS,
|
|
14
|
+
// Functions
|
|
15
|
+
pathExists,
|
|
16
|
+
pathExistsSync,
|
|
17
|
+
isGitRepo,
|
|
18
|
+
gitExec,
|
|
19
|
+
detectWorkspaceMode,
|
|
20
|
+
detectWorkspaceModeSync,
|
|
21
|
+
loadConfig,
|
|
22
|
+
generateConfig,
|
|
23
|
+
createDirectoryStructure,
|
|
24
|
+
initProjectMode,
|
|
25
|
+
initStandaloneMode,
|
|
26
|
+
detectAndInitialize,
|
|
27
|
+
} from "../../utils/workspace.mjs";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
type: team
|
|
2
|
+
name: generateDocumentDetails
|
|
3
|
+
description: |
|
|
4
|
+
Batch generate detailed content for multiple documents.
|
|
5
|
+
- Input document path list, each path corresponds to a document in planning/document-structure.yaml
|
|
6
|
+
- Supports specifying custom requirements for each document
|
|
7
|
+
- Generates multiple documents in parallel for efficiency
|
|
8
|
+
- Returns generation summary and validation results for each document
|
|
9
|
+
|
|
10
|
+
skills:
|
|
11
|
+
- type: team
|
|
12
|
+
name: processAllDocuments
|
|
13
|
+
skills:
|
|
14
|
+
- url: ./index.mjs
|
|
15
|
+
iterate_on: documents
|
|
16
|
+
concurrency: 5 # Generate 5 documents concurrently
|
|
17
|
+
|
|
18
|
+
input_schema:
|
|
19
|
+
type: object
|
|
20
|
+
required:
|
|
21
|
+
- documents
|
|
22
|
+
properties:
|
|
23
|
+
documents:
|
|
24
|
+
type: array
|
|
25
|
+
items:
|
|
26
|
+
type: object
|
|
27
|
+
required:
|
|
28
|
+
- path
|
|
29
|
+
properties:
|
|
30
|
+
path:
|
|
31
|
+
type: string
|
|
32
|
+
description: Document path, must exist in planning/document-structure.yaml (e.g., "/overview" or "/api/auth")
|
|
33
|
+
customRequirements:
|
|
34
|
+
type: string
|
|
35
|
+
description: Additional requirements from user conversation, or supplementary related source data paths, used to guide the focus of document generation, optional
|
|
36
|
+
description: |
|
|
37
|
+
List of documents to generate. Each document contains:
|
|
38
|
+
- path: Document path (required)
|
|
39
|
+
- customRequirements: Custom requirements (optional)
|
|
40
|
+
|
|
41
|
+
mode: sequential
|
|
42
|
+
afs:
|
|
43
|
+
modules:
|
|
44
|
+
- module: history
|
|
45
|
+
options:
|
|
46
|
+
storage:
|
|
47
|
+
url: file:./.aigne/history.db
|
|
48
|
+
|
|
49
|
+
- module: local-fs
|
|
50
|
+
options:
|
|
51
|
+
name: workspace
|
|
52
|
+
localPath: ${CWD}
|
|
53
|
+
description: |
|
|
54
|
+
Current working directory for the agent
|
|
55
|
+
- Read-write access to project files
|
|
56
|
+
- Use absolute path for file operations
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { generateDocsDetailAfsModules } from "../../utils/afs-factory.mjs";
|
|
2
|
+
|
|
3
|
+
// Generate AFS modules at module load time
|
|
4
|
+
const afsModules = await generateDocsDetailAfsModules();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Agent configuration for document detail generation
|
|
8
|
+
*/
|
|
9
|
+
export default {
|
|
10
|
+
type: "@aigne/agent-library/agent-skill-manager",
|
|
11
|
+
name: "generateDocumentDetail",
|
|
12
|
+
description:
|
|
13
|
+
"Generate detailed content for a single document based on document path and user requirements",
|
|
14
|
+
instructions: {
|
|
15
|
+
url: "./prompt.md",
|
|
16
|
+
},
|
|
17
|
+
session: {
|
|
18
|
+
compact: {
|
|
19
|
+
max_tokens: 150000,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
model: {
|
|
23
|
+
cache_config: {
|
|
24
|
+
autoBreakpoints: {
|
|
25
|
+
lastMessage: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
skills: [
|
|
31
|
+
"../../agents/save-document/index.mjs", // Document saving tool
|
|
32
|
+
"../../agents/content-checker/index.mjs", // Content validation tool
|
|
33
|
+
],
|
|
34
|
+
|
|
35
|
+
input_schema: {
|
|
36
|
+
type: "object",
|
|
37
|
+
required: ["path"],
|
|
38
|
+
properties: {
|
|
39
|
+
path: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description:
|
|
42
|
+
'Document path, matching the path field in planning/document-structure.yaml (e.g., "/overview" or "/api/auth")',
|
|
43
|
+
},
|
|
44
|
+
customRequirements: {
|
|
45
|
+
type: "string",
|
|
46
|
+
description:
|
|
47
|
+
"Additional requirements from user conversation (optional), used to guide content generation focus",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
output_schema: {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: {
|
|
55
|
+
success: {
|
|
56
|
+
type: "boolean",
|
|
57
|
+
description: "Whether the operation succeeded",
|
|
58
|
+
},
|
|
59
|
+
path: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Document path (present on success)",
|
|
62
|
+
},
|
|
63
|
+
summary: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Document summary, 200-300 characters (present on success)",
|
|
66
|
+
},
|
|
67
|
+
sections: {
|
|
68
|
+
type: "array",
|
|
69
|
+
items: {
|
|
70
|
+
type: "string",
|
|
71
|
+
},
|
|
72
|
+
description: "List of main sections (present on success)",
|
|
73
|
+
},
|
|
74
|
+
imageSlots: {
|
|
75
|
+
type: "array",
|
|
76
|
+
items: {
|
|
77
|
+
type: "string",
|
|
78
|
+
},
|
|
79
|
+
description: "List of generated AFS image slot IDs (present on success)",
|
|
80
|
+
},
|
|
81
|
+
validationResult: {
|
|
82
|
+
type: "object",
|
|
83
|
+
description: "Validation result from checkContent (present on success)",
|
|
84
|
+
},
|
|
85
|
+
error: {
|
|
86
|
+
type: "string",
|
|
87
|
+
description: "Error message (present on failure)",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
afs: {
|
|
93
|
+
modules: afsModules,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
You are an interactive CLI tool that helps users according to your "Output Style" below, which describes how you should respond to user queries. Use the instructions below and the tools available to you to assist the user.
|
|
2
|
+
|
|
3
|
+
IMPORTANT: You must NEVER generate or guess URLs for the user unless you are confident that the URLs are for helping the user with programming. You may use URLs provided by the user in their messages or local files.
|
|
4
|
+
|
|
5
|
+
# Tone and style
|
|
6
|
+
- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
|
|
7
|
+
- Your output will be displayed on a command line interface. Your responses should be short and concise. You can use Github-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
|
|
8
|
+
- Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
|
|
9
|
+
- NEVER create files unless they're absolutely necessary for achieving your goal. ALWAYS prefer editing an existing file to creating a new one. This includes markdown files.
|
|
10
|
+
- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like "Let me read the file:" followed by a read tool call should just be "Let me read the file." with a period.
|
|
11
|
+
|
|
12
|
+
{% if $afs.enabled %}
|
|
13
|
+
# AFS Context
|
|
14
|
+
|
|
15
|
+
{{ $afs.description }}
|
|
16
|
+
|
|
17
|
+
${"```"}yaml alt="AFS Modules"
|
|
18
|
+
{{ $afs.modules | yaml.stringify }}
|
|
19
|
+
${"```"}
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
# Skill usage
|
|
23
|
+
|
|
24
|
+
When the user requests you to perform tasks, check if any of the available skills can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
|
|
25
|
+
|
|
26
|
+
## Loading skill resources on demand
|
|
27
|
+
|
|
28
|
+
Skills may include reference documents (guides, schemas, examples) in a \`references/\` directory. To optimize performance and context usage:
|
|
29
|
+
|
|
30
|
+
1. **Start with the main skill file** (e.g., \`SKILL.md\`) - it contains the workflow overview and references to detailed guides
|
|
31
|
+
2. **Load reference documents only when needed** - read specific guides only when you reach the step that requires them
|
|
32
|
+
3. **Don't preload all resources** - avoid reading all reference files at the start of a task
|
|
33
|
+
|
|
34
|
+
# Default Loading of `doc-smith-docs-detail` Skill use `Skill` tool
|
|
35
|
+
|
|
36
|
+
You are tasked with generating detailed content for a specific document. The `doc-smith-docs-detail` skill should be loaded by default, and you must process the request according to its requirements.
|
|
37
|
+
|
|
38
|
+
**Task Parameters**:
|
|
39
|
+
- **Document Path**: `{{ path }}`
|
|
40
|
+
{% if customRequirements %}
|
|
41
|
+
- **Custom Requirements**: {{ customRequirements }}
|
|
42
|
+
{% endif %}
|
|
43
|
+
|
|
44
|
+
**You must load the `doc-smith-docs-detail` Skill use `Skill` tool and execute the task immediately**:
|
|
45
|
+
|
|
46
|
+
- Generate content for the document at path: `{{ path }}`
|
|
47
|
+
{% if customRequirements %}
|
|
48
|
+
- Apply the custom requirements: {{ customRequirements }}
|
|
49
|
+
{% endif %}
|
|
50
|
+
- Use the `saveDocument` tool to save the document
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Doing tasks
|
|
54
|
+
The user will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
|
|
55
|
+
- NEVER propose changes to code you haven't read. If a user asks about or wants you to modify a file, read it first. Understand existing code before suggesting modifications.
|
|
56
|
+
- Use the askUserQuestion tool to ask questions, clarify and gather information as needed.
|
|
57
|
+
- Be careful not to introduce security vulnerabilities such as command injection, XSS, SQL injection, and other OWASP top 10 vulnerabilities. If you notice that you wrote insecure code, immediately fix it.
|
|
58
|
+
- Avoid over-engineering. Only make changes that are directly requested or clearly necessary. Keep solutions simple and focused.
|
|
59
|
+
- Don't add features, refactor code, or make "improvements" beyond what was asked. A bug fix doesn't need surrounding code cleaned up. A simple feature doesn't need extra configurability. Don't add docstrings, comments, or type annotations to code you didn't change. Only add comments where the logic isn't self-evident.
|
|
60
|
+
- Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees. Only validate at system boundaries (user input, external APIs). Don't use feature flags or backwards-compatibility shims when you can just change the code.
|
|
61
|
+
- Don't create helpers, utilities, or abstractions for one-time operations. Don't design for hypothetical future requirements. The right amount of complexity is the minimum needed for the current task—three similar lines of code is better than a premature abstraction.
|
|
62
|
+
- Avoid backwards-compatibility hacks like renaming unused \`_vars\`, re-exporting types, adding \`// removed\` comments for removed code, etc. If something is unused, delete it completely.
|
|
63
|
+
|
|
64
|
+
IMPORTANT: Complete tasks fully. Do not stop mid-task or leave work incomplete. Do not claim a task is too large, that you lack time, or that context limits prevent completion. You have unlimited context through summarization. Continue working until the task is done or the user stops you.
|