@aigne/doc-smith 0.8.11-beta → 0.8.11-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.aigne/doc-smith/config.yaml +2 -0
- package/.aigne/doc-smith/output/structure-plan.json +3 -3
- package/.aigne/doc-smith/upload-cache.yaml +252 -0
- package/.github/workflows/publish-docs.yml +67 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -0
- package/README.md +45 -115
- package/agents/clear/choose-contents.mjs +170 -0
- package/agents/clear/clear-auth-tokens.mjs +111 -0
- package/agents/clear/clear-document-config.mjs +39 -0
- package/agents/clear/clear-document-structure.mjs +106 -0
- package/agents/clear/clear-generated-docs.mjs +51 -0
- package/agents/clear/index.yaml +23 -0
- package/agents/evaluate/code-snippet.mjs +93 -0
- package/agents/evaluate/document-structure.yaml +70 -0
- package/agents/evaluate/document.yaml +79 -0
- package/agents/evaluate/generate-report.mjs +78 -0
- package/agents/evaluate/index.yaml +39 -0
- package/agents/generate/document-structure-tools/add-document.mjs +56 -0
- package/agents/generate/document-structure-tools/delete-document.mjs +49 -0
- package/agents/generate/document-structure-tools/move-document.mjs +82 -0
- package/agents/generate/document-structure-tools/update-document.mjs +50 -0
- package/agents/generate/generate-structure.yaml +1 -1
- package/agents/generate/update-document-structure.yaml +42 -0
- package/agents/generate/user-review-document-structure.mjs +6 -4
- package/agents/init/index.mjs +1 -1
- package/agents/publish/publish-docs.mjs +12 -3
- package/agents/translate/choose-language.mjs +1 -1
- package/agents/update/batch-update-document.yaml +7 -0
- package/agents/update/check-update-is-single.mjs +38 -0
- package/agents/update/document-tools/update-document-content.mjs +293 -0
- package/agents/update/index.yaml +4 -10
- package/agents/update/update-document-detail.yaml +52 -0
- package/agents/update/update-single-document.yaml +15 -0
- package/agents/update/user-review-document.mjs +248 -0
- package/agents/utils/choose-docs.mjs +4 -2
- package/agents/utils/format-document-structure.mjs +12 -2
- package/agents/utils/load-document-all-content.mjs +84 -0
- package/agents/utils/load-sources.mjs +4 -1
- package/aigne.yaml +59 -20
- package/assets/report-template/report.html +198 -0
- package/biome.json +14 -2
- package/docs/advanced-how-it-works.ja.md +101 -0
- package/docs/advanced-how-it-works.zh-TW.md +101 -0
- package/docs/advanced-how-it-works.zh.md +20 -20
- package/docs/advanced-quality-assurance.ja.md +96 -0
- package/docs/advanced-quality-assurance.zh-TW.md +96 -0
- package/docs/advanced-quality-assurance.zh.md +18 -18
- package/docs/advanced.ja.md +16 -0
- package/docs/advanced.zh-TW.md +16 -0
- package/docs/advanced.zh.md +4 -4
- package/docs/changelog.ja.md +309 -0
- package/docs/changelog.zh-TW.md +309 -0
- package/docs/changelog.zh.md +23 -23
- package/docs/cli-reference.ja.md +210 -0
- package/docs/cli-reference.zh-TW.md +210 -0
- package/docs/cli-reference.zh.md +21 -21
- package/docs/configuration-interactive-setup.ja.md +135 -0
- package/docs/configuration-interactive-setup.zh-TW.md +135 -0
- package/docs/configuration-interactive-setup.zh.md +29 -29
- package/docs/configuration-language-support.ja.md +94 -0
- package/docs/configuration-language-support.zh-TW.md +94 -0
- package/docs/configuration-language-support.zh.md +13 -13
- package/docs/configuration-llm-setup.ja.md +54 -0
- package/docs/configuration-llm-setup.zh-TW.md +54 -0
- package/docs/configuration-llm-setup.zh.md +12 -12
- package/docs/configuration-preferences.ja.md +129 -0
- package/docs/configuration-preferences.zh-TW.md +129 -0
- package/docs/configuration-preferences.zh.md +36 -36
- package/docs/configuration.ja.md +172 -0
- package/docs/configuration.zh-TW.md +172 -0
- package/docs/configuration.zh.md +49 -49
- package/docs/features-generate-documentation.ja.md +101 -0
- package/docs/features-generate-documentation.zh-TW.md +101 -0
- package/docs/features-generate-documentation.zh.md +17 -17
- package/docs/features-publish-your-docs.ja.md +107 -0
- package/docs/features-publish-your-docs.zh-TW.md +107 -0
- package/docs/features-publish-your-docs.zh.md +22 -22
- package/docs/features-translate-documentation.ja.md +79 -0
- package/docs/features-translate-documentation.zh-TW.md +79 -0
- package/docs/features-translate-documentation.zh.md +12 -12
- package/docs/features-update-and-refine.ja.md +138 -0
- package/docs/features-update-and-refine.zh-TW.md +138 -0
- package/docs/features-update-and-refine.zh.md +21 -21
- package/docs/features.ja.md +52 -0
- package/docs/features.zh-TW.md +52 -0
- package/docs/features.zh.md +8 -8
- package/docs/getting-started.ja.md +123 -0
- package/docs/getting-started.zh-TW.md +123 -0
- package/docs/getting-started.zh.md +24 -24
- package/docs/overview.ja.md +30 -0
- package/docs/overview.zh-TW.md +30 -0
- package/docs/overview.zh.md +8 -8
- package/package.json +19 -11
- package/prompts/common/document/content-rules-core.md +19 -0
- package/prompts/common/document/media-handling-rules.md +9 -0
- package/prompts/common/document/role-and-personality.md +15 -0
- package/prompts/common/document/user-preferences.md +9 -0
- package/prompts/common/document-structure/conflict-resolution-guidance.md +16 -0
- package/prompts/common/document-structure/document-structure-rules.md +45 -0
- package/prompts/common/document-structure/glossary.md +7 -0
- package/prompts/common/document-structure/intj-traits.md +5 -0
- package/prompts/common/document-structure/output-constraints.md +9 -0
- package/prompts/common/document-structure/user-locale-rules.md +10 -0
- package/prompts/common/document-structure/user-preferences.md +9 -0
- package/prompts/detail/custom/custom-components.md +9 -1
- package/prompts/detail/document-rules.md +6 -6
- package/prompts/detail/generate-document.md +5 -45
- package/prompts/detail/update-document.md +145 -0
- package/prompts/evaluate/document-structure.md +94 -0
- package/prompts/evaluate/document.md +149 -0
- package/prompts/structure/document-rules.md +1 -1
- package/prompts/structure/generate-structure-system.md +74 -0
- package/prompts/structure/generate-structure-user.md +41 -0
- package/prompts/structure/update-document-structure.md +118 -0
- package/prompts/translate/translate-document.md +1 -1
- package/prompts/utils/feedback-refiner.md +3 -3
- package/release-please-config.json +1 -7
- package/tests/agents/clear/choose-contents.test.mjs +280 -0
- package/tests/agents/clear/clear-auth-tokens.test.mjs +268 -0
- package/tests/agents/clear/clear-document-config.test.mjs +167 -0
- package/tests/agents/clear/clear-document-structure.test.mjs +374 -0
- package/tests/agents/clear/clear-generated-docs.test.mjs +222 -0
- package/tests/agents/evaluate/code-snippet.test.mjs +163 -0
- package/tests/agents/evaluate/fixtures/api-services.md +87 -0
- package/tests/agents/evaluate/fixtures/js-sdk.md +94 -0
- package/tests/agents/evaluate/generate-report.test.mjs +312 -0
- package/tests/agents/generate/check-document-structure.test.mjs +0 -6
- package/tests/agents/generate/document-structure-tools/add-document.test.mjs +449 -0
- package/tests/agents/generate/document-structure-tools/delete-document.test.mjs +410 -0
- package/tests/agents/generate/document-structure-tools/move-document.test.mjs +476 -0
- package/tests/agents/generate/document-structure-tools/update-document.test.mjs +548 -0
- package/tests/agents/generate/generate-structure.test.mjs +0 -6
- package/tests/agents/generate/user-review-document-structure.test.mjs +9 -9
- package/tests/agents/publish/publish-docs.test.mjs +2 -2
- package/tests/agents/update/check-update-is-single.test.mjs +300 -0
- package/tests/agents/update/document-tools/update-document-content.test.mjs +326 -0
- package/tests/agents/update/user-review-document.test.mjs +561 -0
- package/tests/agents/utils/format-document-structure.test.mjs +100 -0
- package/tests/utils/auth-utils.test.mjs +239 -1
- package/tests/utils/blocklet.test.mjs +9 -7
- package/tests/utils/constants.test.mjs +1 -1
- package/tests/utils/d2-utils.test.mjs +1 -1
- package/tests/utils/deploy.test.mjs +310 -366
- package/tests/utils/kroki-utils.test.mjs +2 -15
- package/tests/utils/linter/fixtures/css/keyword-error.css +1 -0
- package/tests/utils/linter/fixtures/css/missing-semicolon.css +1 -0
- package/tests/utils/linter/fixtures/css/syntax-error.css +1 -0
- package/tests/utils/linter/fixtures/css/undeclare-variable.css +1 -0
- package/tests/utils/linter/fixtures/css/unused-variable.css +2 -0
- package/tests/utils/linter/fixtures/css/valid-code.css +1 -0
- package/tests/utils/linter/fixtures/dockerfile/keyword-error.dockerfile +1 -0
- package/tests/utils/linter/fixtures/dockerfile/missing-semicolon.dockerfile +2 -0
- package/tests/utils/linter/fixtures/dockerfile/syntax-error.dockerfile +2 -0
- package/tests/utils/linter/fixtures/dockerfile/undeclare-variable.dockerfile +1 -0
- package/tests/utils/linter/fixtures/dockerfile/unused-variable.dockerfile +1 -0
- package/tests/utils/linter/fixtures/dockerfile/valid-code.dockerfile +2 -0
- package/tests/utils/linter/fixtures/go/keyword-error.go +5 -0
- package/tests/utils/linter/fixtures/go/missing-semicolon.go +5 -0
- package/tests/utils/linter/fixtures/go/syntax-error.go +6 -0
- package/tests/utils/linter/fixtures/go/undeclare-variable.go +5 -0
- package/tests/utils/linter/fixtures/go/unused-variable.go +5 -0
- package/tests/utils/linter/fixtures/go/valid-code.go +7 -0
- package/tests/utils/linter/fixtures/js/keyword-error.js +3 -0
- package/tests/utils/linter/fixtures/js/missing-semicolon.js +6 -0
- package/tests/utils/linter/fixtures/js/syntax-error.js +4 -0
- package/tests/utils/linter/fixtures/js/undeclare-variable.js +3 -0
- package/tests/utils/linter/fixtures/js/unused-variable.js +7 -0
- package/tests/utils/linter/fixtures/js/valid-code.js +15 -0
- package/tests/utils/linter/fixtures/json/keyword-error.json +1 -0
- package/tests/utils/linter/fixtures/json/missing-semicolon.json +1 -0
- package/tests/utils/linter/fixtures/json/syntax-error.json +1 -0
- package/tests/utils/linter/fixtures/json/undeclare-variable.json +1 -0
- package/tests/utils/linter/fixtures/json/unused-variable.json +1 -0
- package/tests/utils/linter/fixtures/json/valid-code.json +1 -0
- package/tests/utils/linter/fixtures/jsx/keyword-error.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/missing-semicolon.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/syntax-error.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/undeclare-variable.jsx +5 -0
- package/tests/utils/linter/fixtures/jsx/unused-variable.jsx +4 -0
- package/tests/utils/linter/fixtures/jsx/valid-code.jsx +5 -0
- package/tests/utils/linter/fixtures/python/keyword-error.py +3 -0
- package/tests/utils/linter/fixtures/python/missing-semicolon.py +2 -0
- package/tests/utils/linter/fixtures/python/syntax-error.py +3 -0
- package/tests/utils/linter/fixtures/python/undeclare-variable.py +3 -0
- package/tests/utils/linter/fixtures/python/unused-variable.py +6 -0
- package/tests/utils/linter/fixtures/python/valid-code.py +12 -0
- package/tests/utils/linter/fixtures/ruby/keyword-error.rb +2 -0
- package/tests/utils/linter/fixtures/ruby/missing-semicolon.rb +1 -0
- package/tests/utils/linter/fixtures/ruby/syntax-error.rb +2 -0
- package/tests/utils/linter/fixtures/ruby/undeclare-variable.rb +1 -0
- package/tests/utils/linter/fixtures/ruby/unused-variable.rb +2 -0
- package/tests/utils/linter/fixtures/ruby/valid-code.rb +1 -0
- package/tests/utils/linter/fixtures/sass/keyword-error.sass +2 -0
- package/tests/utils/linter/fixtures/sass/missing-semicolon.sass +3 -0
- package/tests/utils/linter/fixtures/sass/syntax-error.sass +3 -0
- package/tests/utils/linter/fixtures/sass/undeclare-variable.sass +2 -0
- package/tests/utils/linter/fixtures/sass/unused-variable.sass +4 -0
- package/tests/utils/linter/fixtures/sass/valid-code.sass +2 -0
- package/tests/utils/linter/fixtures/scss/keyword-error.scss +1 -0
- package/tests/utils/linter/fixtures/scss/missing-semicolon.scss +1 -0
- package/tests/utils/linter/fixtures/scss/syntax-error.scss +1 -0
- package/tests/utils/linter/fixtures/scss/undeclare-variable.scss +1 -0
- package/tests/utils/linter/fixtures/scss/unused-variable.scss +2 -0
- package/tests/utils/linter/fixtures/scss/valid-code.scss +1 -0
- package/tests/utils/linter/fixtures/shell/keyword-error.sh +5 -0
- package/tests/utils/linter/fixtures/shell/missing-semicolon.sh +3 -0
- package/tests/utils/linter/fixtures/shell/syntax-error.sh +4 -0
- package/tests/utils/linter/fixtures/shell/undeclare-variable.sh +3 -0
- package/tests/utils/linter/fixtures/shell/unused-variable.sh +4 -0
- package/tests/utils/linter/fixtures/shell/valid-code.sh +3 -0
- package/tests/utils/linter/fixtures/ts/keyword-error.ts +1 -0
- package/tests/utils/linter/fixtures/ts/missing-semicolon.ts +1 -0
- package/tests/utils/linter/fixtures/ts/syntax-error.ts +1 -0
- package/tests/utils/linter/fixtures/ts/undeclare-variable.ts +1 -0
- package/tests/utils/linter/fixtures/ts/unused-variable.ts +3 -0
- package/tests/utils/linter/fixtures/ts/valid-code.ts +3 -0
- package/tests/utils/linter/fixtures/tsx/keyword-error.tsx +5 -0
- package/tests/utils/linter/fixtures/tsx/missing-semicolon.tsx +5 -0
- package/tests/utils/linter/fixtures/tsx/syntax-error.tsx +5 -0
- package/tests/utils/linter/fixtures/tsx/undeclare-variable.tsx +6 -0
- package/tests/utils/linter/fixtures/tsx/unused-variable.tsx +6 -0
- package/tests/utils/linter/fixtures/tsx/valid-code.tsx +5 -0
- package/tests/utils/linter/fixtures/vue/keyword-error.vue +6 -0
- package/tests/utils/linter/fixtures/vue/missing-semicolon.vue +6 -0
- package/tests/utils/linter/fixtures/vue/syntax-error.vue +6 -0
- package/tests/utils/linter/fixtures/vue/undeclare-variable.vue +6 -0
- package/tests/utils/linter/fixtures/vue/unused-variable.vue +7 -0
- package/tests/utils/linter/fixtures/vue/valid-code.vue +6 -0
- package/tests/utils/linter/fixtures/yaml/keyword-error.yml +1 -0
- package/tests/utils/linter/fixtures/yaml/missing-semicolon.yml +2 -0
- package/tests/utils/linter/fixtures/yaml/syntax-error.yml +1 -0
- package/tests/utils/linter/fixtures/yaml/undeclare-variable.yml +1 -0
- package/tests/utils/linter/fixtures/yaml/unused-variable.yml +2 -0
- package/tests/utils/linter/fixtures/yaml/valid-code.yml +3 -0
- package/tests/utils/linter/index.test.mjs +440 -0
- package/tests/utils/linter/scan-results.mjs +42 -0
- package/tests/utils/markdown/index.test.mjs +478 -0
- package/tests/utils/mermaid-validator.test.mjs +2 -2
- package/tests/utils/utils.test.mjs +3 -1
- package/types/document-schema.mjs +54 -0
- package/types/document-structure-schema.mjs +244 -0
- package/utils/auth-utils.mjs +131 -6
- package/utils/conflict-detector.mjs +5 -1
- package/utils/{constants.mjs → constants/index.mjs} +109 -0
- package/utils/constants/linter.mjs +102 -0
- package/utils/d2-utils.mjs +2 -4
- package/utils/debug.mjs +3 -0
- package/utils/deploy.mjs +81 -385
- package/utils/evaluate/report-utils.mjs +131 -0
- package/utils/file-utils.mjs +36 -1
- package/utils/kroki-utils.mjs +1 -1
- package/utils/linter/index.mjs +50 -0
- package/utils/markdown/index.mjs +26 -0
- package/utils/markdown-checker.mjs +1 -1
- package/utils/utils.mjs +19 -7
- package/prompts/structure/generate-structure.md +0 -161
package/README.md
CHANGED
|
@@ -30,21 +30,25 @@ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https
|
|
|
30
30
|
## ✨ Features
|
|
31
31
|
|
|
32
32
|
### 🤖 AI-Powered Generation
|
|
33
|
+
|
|
33
34
|
- **Smart Structure Planning**: Automatically analyzes your codebase to create logical, comprehensive documentation structure
|
|
34
35
|
- **Intelligent Content Creation**: Generates detailed, contextual content that explains both "what" and "why"
|
|
35
36
|
- **Adaptive Writing Styles**: Supports multiple documentation styles (Technical, User-Friendly, Developer-Focused, etc.)
|
|
36
37
|
|
|
37
38
|
### 🌍 Multi-Language Excellence
|
|
39
|
+
|
|
38
40
|
- **12 Language Support**: English, Chinese (Simplified & Traditional), Japanese, Korean, Spanish, French, German, Portuguese, Russian, Italian, and Arabic
|
|
39
41
|
- **Professional Translation**: Context-aware translation that maintains technical accuracy
|
|
40
42
|
- **Glossary Integration**: Consistent terminology across all languages
|
|
41
43
|
|
|
42
44
|
### 🔗 Seamless Integration
|
|
45
|
+
|
|
43
46
|
- **AIGNE Hub Integration**: Use [AIGNE Hub](https://www.aigne.io/en/hub) without API keys, switch between Google Gemini, OpenAI GPT, Claude, and more
|
|
44
47
|
- **Multiple LLM Support**: Bring your own API keys for OpenAI, Anthropic, Google, and other providers
|
|
45
|
-
- **Discuss Kit Publishing**: Deploy to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.
|
|
48
|
+
- **Discuss Kit Publishing**: Deploy to [docsmith.aigne.io](https://docsmith.aigne.io/app/) or your own [Discuss Kit](https://www.web3kit.rocks/discuss-kit) instance
|
|
46
49
|
|
|
47
50
|
### 🔄 Smart Updates
|
|
51
|
+
|
|
48
52
|
- **Change Detection**: Automatically identifies code changes and updates relevant documentation
|
|
49
53
|
- **Targeted Regeneration**: Update specific sections with custom feedback and requirements
|
|
50
54
|
- **Version Awareness**: Maintains documentation history and tracks changes over time
|
|
@@ -53,80 +57,9 @@ As shown in the diagram, DocSmith integrates seamlessly with other [AIGNE](https
|
|
|
53
57
|
|
|
54
58
|
### Prerequisites
|
|
55
59
|
|
|
56
|
-
- Node.js
|
|
60
|
+
- Node.js 20+ and npm/pnpm
|
|
57
61
|
- No API keys required (uses AIGNE Hub by default)
|
|
58
62
|
|
|
59
|
-
### Node.js Installation
|
|
60
|
-
|
|
61
|
-
#### Windows
|
|
62
|
-
1. Download Node.js installer from [nodejs.org](https://nodejs.org/)
|
|
63
|
-
2. Run the installer (.msi file)
|
|
64
|
-
3. Follow installation wizard steps
|
|
65
|
-
4. Verify installation: `node --version`
|
|
66
|
-
|
|
67
|
-
#### macOS
|
|
68
|
-
**Option 1: Using Homebrew (Recommended)**
|
|
69
|
-
```bash
|
|
70
|
-
# Install Homebrew if not already installed
|
|
71
|
-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
72
|
-
|
|
73
|
-
# Install Node.js
|
|
74
|
-
brew install node
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Option 2: Using the Official Installer**
|
|
78
|
-
1. Download the macOS installer from [nodejs.org](https://nodejs.org/)
|
|
79
|
-
2. Double-click the .pkg file to run the installer
|
|
80
|
-
3. Follow the installation wizard
|
|
81
|
-
4. Verify installation: `node --version`
|
|
82
|
-
|
|
83
|
-
#### Linux
|
|
84
|
-
|
|
85
|
-
**Ubuntu/Debian:**
|
|
86
|
-
```bash
|
|
87
|
-
# Update package index
|
|
88
|
-
sudo apt update
|
|
89
|
-
|
|
90
|
-
# Install Node.js
|
|
91
|
-
sudo apt install nodejs npm
|
|
92
|
-
|
|
93
|
-
# Or install latest LTS version using NodeSource repository
|
|
94
|
-
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
|
95
|
-
sudo apt-get install -y nodejs
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**CentOS/RHEL/Fedora:**
|
|
99
|
-
```bash
|
|
100
|
-
# For CentOS/RHEL
|
|
101
|
-
sudo yum install nodejs npm
|
|
102
|
-
|
|
103
|
-
# For Fedora
|
|
104
|
-
sudo dnf install nodejs npm
|
|
105
|
-
|
|
106
|
-
# Or using NodeSource repository
|
|
107
|
-
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
|
|
108
|
-
sudo yum install nodejs
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
**Using Node Version Manager (nvm) - All Linux Distributions:**
|
|
112
|
-
```bash
|
|
113
|
-
# Install nvm
|
|
114
|
-
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
|
|
115
|
-
|
|
116
|
-
# Restart terminal or run:
|
|
117
|
-
source ~/.bashrc
|
|
118
|
-
|
|
119
|
-
# Install latest LTS Node.js
|
|
120
|
-
nvm install --lts
|
|
121
|
-
nvm use --lts
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
#### Verification
|
|
125
|
-
After installation on any platform, verify Node.js and npm are installed correctly:
|
|
126
|
-
```bash
|
|
127
|
-
node --version
|
|
128
|
-
npm --version
|
|
129
|
-
```
|
|
130
63
|
|
|
131
64
|
### 📦 Installation
|
|
132
65
|
|
|
@@ -152,6 +85,7 @@ aigne doc generate
|
|
|
152
85
|
```
|
|
153
86
|
|
|
154
87
|
DocSmith will:
|
|
88
|
+
|
|
155
89
|
1. 🔍 Auto-detect your project structure and tech stack
|
|
156
90
|
2. 🎯 Guide you through an interactive setup (first time only)
|
|
157
91
|
3. 📝 Generate comprehensive documentation
|
|
@@ -165,6 +99,7 @@ DocSmith will:
|
|
|
165
99
|
DocSmith supports multiple AI providers:
|
|
166
100
|
|
|
167
101
|
**🎯 AIGNE Hub (Recommended)**
|
|
102
|
+
|
|
168
103
|
- ✅ No API keys required
|
|
169
104
|
- ✅ Easy model switching
|
|
170
105
|
- ✅ Built-in rate limiting and optimization
|
|
@@ -178,6 +113,7 @@ aigne doc generate --model openai:gpt-4o
|
|
|
178
113
|
|
|
179
114
|
**🔑 Custom API Keys**
|
|
180
115
|
Configure your own API keys for direct provider access:
|
|
116
|
+
|
|
181
117
|
- OpenAI GPT models
|
|
182
118
|
- Anthropic Claude models
|
|
183
119
|
- Google Gemini models
|
|
@@ -188,6 +124,7 @@ Configure your own API keys for direct provider access:
|
|
|
188
124
|
### Core Commands
|
|
189
125
|
|
|
190
126
|
#### 📝 Generate Documentation
|
|
127
|
+
|
|
191
128
|
```bash
|
|
192
129
|
# Smart generation with auto-configuration
|
|
193
130
|
aigne doc generate
|
|
@@ -200,6 +137,7 @@ aigne doc generate --feedback "Add more API examples and troubleshooting section
|
|
|
200
137
|
```
|
|
201
138
|
|
|
202
139
|
#### 🔄 Update Existing Documents
|
|
140
|
+
|
|
203
141
|
```bash
|
|
204
142
|
# Interactive document selection and update
|
|
205
143
|
aigne doc update
|
|
@@ -209,6 +147,7 @@ aigne doc update --docs overview.md --feedback "Add comprehensive FAQ section"
|
|
|
209
147
|
```
|
|
210
148
|
|
|
211
149
|
#### 🌍 Multi-Language Translation
|
|
150
|
+
|
|
212
151
|
```bash
|
|
213
152
|
# Interactive translation with smart language selection
|
|
214
153
|
aigne doc translate
|
|
@@ -221,6 +160,7 @@ aigne doc translate --glossary @path/to/glossary.md --feedback "Use technical te
|
|
|
221
160
|
```
|
|
222
161
|
|
|
223
162
|
#### 🚀 Publishing & Deployment
|
|
163
|
+
|
|
224
164
|
```bash
|
|
225
165
|
# Interactive publishing with platform selection
|
|
226
166
|
aigne doc publish
|
|
@@ -230,6 +170,7 @@ aigne doc publish --appUrl https://your-discuss-kit-instance.com
|
|
|
230
170
|
```
|
|
231
171
|
|
|
232
172
|
#### ⚙️ Configuration Management
|
|
173
|
+
|
|
233
174
|
```bash
|
|
234
175
|
# Interactive configuration setup
|
|
235
176
|
aigne doc init
|
|
@@ -248,43 +189,43 @@ DocSmith automatically detects your project structure, but you can customize:
|
|
|
248
189
|
- **📁 Source Paths**: Customize which files and directories to analyze
|
|
249
190
|
- **📤 Output Settings**: Configure documentation structure and formatting
|
|
250
191
|
|
|
251
|
-
|
|
252
|
-
|
|
253
192
|
## 🌐 Supported Languages
|
|
254
193
|
|
|
255
194
|
DocSmith provides professional translation for 12 languages:
|
|
256
195
|
|
|
257
|
-
| Language
|
|
258
|
-
|
|
259
|
-
| English
|
|
260
|
-
| 简体中文
|
|
261
|
-
| 繁體中文
|
|
262
|
-
| 日本語
|
|
263
|
-
| 한국어
|
|
264
|
-
| Español
|
|
265
|
-
| Français
|
|
266
|
-
| Deutsch
|
|
267
|
-
| Português | `pt-BR` | ✅ Full
|
|
268
|
-
| Русский
|
|
269
|
-
| Italiano
|
|
270
|
-
| العربية
|
|
271
|
-
|
|
196
|
+
| Language | Code | Support Level |
|
|
197
|
+
| --------- | ------- | ------------- |
|
|
198
|
+
| English | `en` | ✅ Native |
|
|
199
|
+
| 简体中文 | `zh-CN` | ✅ Full |
|
|
200
|
+
| 繁體中文 | `zh-TW` | ✅ Full |
|
|
201
|
+
| 日本語 | `ja` | ✅ Full |
|
|
202
|
+
| 한국어 | `ko` | ✅ Full |
|
|
203
|
+
| Español | `es` | ✅ Full |
|
|
204
|
+
| Français | `fr` | ✅ Full |
|
|
205
|
+
| Deutsch | `de` | ✅ Full |
|
|
206
|
+
| Português | `pt-BR` | ✅ Full |
|
|
207
|
+
| Русский | `ru` | ✅ Full |
|
|
208
|
+
| Italiano | `it` | ✅ Full |
|
|
209
|
+
| العربية | `ar` | ✅ Full |
|
|
272
210
|
|
|
273
211
|
## 🤝 Contributing
|
|
274
212
|
|
|
275
213
|
We welcome contributions from the community! Here's how you can help:
|
|
276
214
|
|
|
277
215
|
### 🐛 Reporting Issues
|
|
216
|
+
|
|
278
217
|
- 🔍 [Search existing issues](https://github.com/AIGNE-io/aigne-doc-smith/issues) first
|
|
279
218
|
- 📝 Use our issue templates for bug reports and feature requests
|
|
280
219
|
- 🚨 Include clear reproduction steps and environment details
|
|
281
220
|
|
|
282
221
|
### 💡 Feature Requests
|
|
222
|
+
|
|
283
223
|
- 🌟 Share your ideas in [GitHub Discussions](https://github.com/AIGNE-io/aigne-doc-smith/discussions)
|
|
284
224
|
- 📋 Check our [roadmap](https://github.com/AIGNE-io/aigne-doc-smith/projects) for planned features
|
|
285
225
|
- 🗳️ Vote on existing feature requests
|
|
286
226
|
|
|
287
227
|
### 🔧 Development Setup
|
|
228
|
+
|
|
288
229
|
```bash
|
|
289
230
|
# Clone the repository
|
|
290
231
|
git clone https://github.com/AIGNE-io/aigne-doc-smith.git
|
|
@@ -304,23 +245,27 @@ pnpm run lint:fix
|
|
|
304
245
|
```
|
|
305
246
|
|
|
306
247
|
### 📜 Code of Conduct
|
|
307
|
-
|
|
248
|
+
|
|
249
|
+
Please follow our community guidelines and maintain respectful, constructive communication when contributing.
|
|
308
250
|
|
|
309
251
|
## 💼 Enterprise & Production Use
|
|
310
252
|
|
|
311
253
|
### 🏢 Enterprise Features
|
|
254
|
+
|
|
312
255
|
- **Team Collaboration**: Multi-user workflows with role-based access
|
|
313
256
|
- **Custom Branding**: White-label documentation with your brand identity
|
|
314
257
|
- **API Integration**: REST APIs for automated documentation pipelines
|
|
315
258
|
- **Analytics**: Track documentation usage and effectiveness
|
|
316
259
|
|
|
317
260
|
### 🔒 Security & Compliance
|
|
261
|
+
|
|
318
262
|
- **Private Cloud**: Deploy on your own infrastructure
|
|
319
263
|
- **SSO Integration**: Connect with your identity providers
|
|
320
264
|
- **Audit Logs**: Complete activity tracking and compliance reporting
|
|
321
265
|
- **Data Privacy**: Your code never leaves your environment in private deployments
|
|
322
266
|
|
|
323
267
|
### 📞 Support & Services
|
|
268
|
+
|
|
324
269
|
- **Priority Support**: Direct access to our engineering team
|
|
325
270
|
- **Custom Training**: Team onboarding and best practices workshops
|
|
326
271
|
- **Professional Services**: Custom integrations and deployment assistance
|
|
@@ -330,27 +275,26 @@ Please read our [Code of Conduct](https://github.com/AIGNE-io/aigne-doc-smith/bl
|
|
|
330
275
|
## 📊 Community & Resources
|
|
331
276
|
|
|
332
277
|
### 📚 Documentation & Tutorials
|
|
333
|
-
|
|
334
|
-
-
|
|
335
|
-
- 📝 [Best Practices Guide](https://docsmith.aigne.io/guides/best-practices)
|
|
336
|
-
- 🔧 [API Reference](https://docsmith.aigne.io/api/)
|
|
278
|
+
|
|
279
|
+
- 📖 [Documentation](https://docsmith.aigne.io/docs/)
|
|
337
280
|
|
|
338
281
|
### 💬 Community Support
|
|
339
|
-
|
|
340
|
-
- 🐦 [Twitter](https://twitter.com/
|
|
341
|
-
- 🎮 [
|
|
342
|
-
- 📧 [Newsletter](https://www.aigne.io/newsletter) - Monthly updates and tips
|
|
282
|
+
|
|
283
|
+
- 🐦 [Twitter](https://twitter.com/arcblock_io) - Updates and announcements
|
|
284
|
+
- 🎮 [Community](https://community.arcblock.io/discussions/boards/aigne) - Real-time community chat
|
|
343
285
|
|
|
344
286
|
### 🏆 Showcase
|
|
287
|
+
|
|
345
288
|
See DocSmith in action with real-world examples:
|
|
346
|
-
|
|
347
|
-
- [
|
|
289
|
+
|
|
290
|
+
- [Docs Repository](https://docsmith.aigne.io/app) - Generated with DocSmith
|
|
348
291
|
|
|
349
292
|
## 📄 License
|
|
350
293
|
|
|
351
294
|
This project is licensed under the **Elastic License 2.0** - see the [LICENSE](LICENSE) file for details.
|
|
352
295
|
|
|
353
296
|
### What does this mean?
|
|
297
|
+
|
|
354
298
|
- ✅ **Free for most use cases**: Personal projects, internal use, and most commercial applications
|
|
355
299
|
- ✅ **Open source**: Full source code available for review and contributions
|
|
356
300
|
- ✅ **Commercial friendly**: Use in your business applications and services
|
|
@@ -358,17 +302,3 @@ This project is licensed under the **Elastic License 2.0** - see the [LICENSE](L
|
|
|
358
302
|
|
|
359
303
|
[Learn more about Elastic License 2.0](https://www.elastic.co/licensing/elastic-license)
|
|
360
304
|
|
|
361
|
-
---
|
|
362
|
-
|
|
363
|
-
<div align="center">
|
|
364
|
-
|
|
365
|
-
**🚀 Start generating amazing documentation today!**
|
|
366
|
-
|
|
367
|
-
[](https://docsmith.aigne.io/get-started)
|
|
368
|
-
[](https://discord.gg/aigne)
|
|
369
|
-
[](https://github.com/AIGNE-io/aigne-doc-smith)
|
|
370
|
-
|
|
371
|
-
Made with ❤️ by the [AIGNE Team](https://www.aigne.io/team)
|
|
372
|
-
|
|
373
|
-
</div>
|
|
374
|
-
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
const TARGET_METADATA = {
|
|
2
|
+
generatedDocs: {
|
|
3
|
+
label: "generated documents",
|
|
4
|
+
description: "Delete all generated documents.",
|
|
5
|
+
agent: "clearGeneratedDocs",
|
|
6
|
+
},
|
|
7
|
+
documentStructure: {
|
|
8
|
+
label: "document structure",
|
|
9
|
+
description: "Delete the document structure and all generated documents.",
|
|
10
|
+
agent: "clearDocumentStructure",
|
|
11
|
+
},
|
|
12
|
+
documentConfig: {
|
|
13
|
+
label: "document configuration",
|
|
14
|
+
description: "Delete the document configuration.",
|
|
15
|
+
agent: "clearDocumentConfig",
|
|
16
|
+
},
|
|
17
|
+
authTokens: {
|
|
18
|
+
label: "authorizations",
|
|
19
|
+
description: "Clear published site authorizations.",
|
|
20
|
+
agent: "clearAuthTokens",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const TARGET_KEYS = Object.keys(TARGET_METADATA);
|
|
25
|
+
|
|
26
|
+
function normalizeTarget(value) {
|
|
27
|
+
if (!value) return null;
|
|
28
|
+
const trimmed = value.trim();
|
|
29
|
+
if (TARGET_METADATA[trimmed]) return trimmed;
|
|
30
|
+
|
|
31
|
+
const lowerMatched = TARGET_KEYS.find((key) => key.toLowerCase() === trimmed.toLowerCase());
|
|
32
|
+
return lowerMatched || null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default async function chooseContents(input = {}, options = {}) {
|
|
36
|
+
const { targets: rawTargets, ...rest } = input;
|
|
37
|
+
|
|
38
|
+
const normalizedTargets = Array.isArray(rawTargets)
|
|
39
|
+
? rawTargets.map(normalizeTarget).filter(Boolean)
|
|
40
|
+
: [];
|
|
41
|
+
|
|
42
|
+
let selectedTargets = [...new Set(normalizedTargets)];
|
|
43
|
+
|
|
44
|
+
if (selectedTargets.length === 0) {
|
|
45
|
+
if (options?.prompts?.checkbox) {
|
|
46
|
+
const choices = Object.entries(TARGET_METADATA).map(([value, def]) => ({
|
|
47
|
+
name: def.label,
|
|
48
|
+
value,
|
|
49
|
+
description: def.description,
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
selectedTargets = await options.prompts.checkbox({
|
|
53
|
+
message: "Select items to clear:",
|
|
54
|
+
choices,
|
|
55
|
+
validate: (answer) => (answer.length > 0 ? true : "Please select at least one item."),
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
// If no prompts available, show available options
|
|
59
|
+
return {
|
|
60
|
+
message: `Available options to clear: ${TARGET_KEYS.join(", ")}`,
|
|
61
|
+
availableTargets: TARGET_KEYS,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (selectedTargets.length === 0) {
|
|
67
|
+
return {
|
|
68
|
+
message: "No items selected to clear.",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const results = [];
|
|
73
|
+
let hasError = false;
|
|
74
|
+
let configCleared = false;
|
|
75
|
+
|
|
76
|
+
// Process each target using its dedicated agent
|
|
77
|
+
for (const target of selectedTargets) {
|
|
78
|
+
const metadata = TARGET_METADATA[target];
|
|
79
|
+
if (!metadata) {
|
|
80
|
+
results.push({
|
|
81
|
+
status: "error",
|
|
82
|
+
message: `Unknown target: ${target}`,
|
|
83
|
+
});
|
|
84
|
+
hasError = true;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
// Get and invoke the specific agent using context
|
|
90
|
+
const clearAgent = options.context?.agents?.[metadata.agent];
|
|
91
|
+
if (!clearAgent) {
|
|
92
|
+
throw new Error(`Clear agent '${metadata.agent}' not found in context`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const result = await options.context.invoke(clearAgent, rest);
|
|
96
|
+
|
|
97
|
+
if (result.error) {
|
|
98
|
+
hasError = true;
|
|
99
|
+
results.push({
|
|
100
|
+
status: "error",
|
|
101
|
+
message: result.message,
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
const status = result.cleared ? "removed" : "noop";
|
|
105
|
+
results.push({
|
|
106
|
+
status,
|
|
107
|
+
message: result.message,
|
|
108
|
+
path: result.path,
|
|
109
|
+
suggestions: result.suggestions,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Track if document config was cleared
|
|
113
|
+
if (target === "documentConfig" && result.cleared) {
|
|
114
|
+
configCleared = true;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch (error) {
|
|
118
|
+
hasError = true;
|
|
119
|
+
results.push({
|
|
120
|
+
status: "error",
|
|
121
|
+
message: `Failed to clear ${metadata.label}: ${error.message}`,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Prepare response message
|
|
127
|
+
const header = hasError
|
|
128
|
+
? "Cleanup finished with some issues."
|
|
129
|
+
: "Cleanup completed successfully!";
|
|
130
|
+
const detailLines = results.map((item) => `- ${item.message}`).join("\n");
|
|
131
|
+
|
|
132
|
+
// Collect suggestions
|
|
133
|
+
const suggestions = [];
|
|
134
|
+
results.forEach((result) => {
|
|
135
|
+
if (result.suggestions) {
|
|
136
|
+
suggestions.push(...result.suggestions);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Add default suggestion if config was cleared
|
|
141
|
+
if (configCleared && !suggestions.some((s) => s.includes("aigne doc init"))) {
|
|
142
|
+
suggestions.push("Run `aigne doc init` to generate a fresh configuration file.");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const message = [header, "", detailLines, suggestions.length ? "" : null, suggestions.join("\n")]
|
|
146
|
+
.filter(Boolean)
|
|
147
|
+
.join("\n");
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
message,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
chooseContents.input_schema = {
|
|
155
|
+
type: "object",
|
|
156
|
+
properties: {
|
|
157
|
+
targets: {
|
|
158
|
+
type: "array",
|
|
159
|
+
description: "Items to clear without confirmation",
|
|
160
|
+
items: {
|
|
161
|
+
type: "string",
|
|
162
|
+
enum: TARGET_KEYS,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
chooseContents.taskTitle = "Choose contents to clear";
|
|
169
|
+
chooseContents.description =
|
|
170
|
+
"Choose contents to clear and execute the appropriate clearing operations";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import { parse, stringify } from "yaml";
|
|
7
|
+
|
|
8
|
+
export default async function clearAuthTokens(_input = {}, options = {}) {
|
|
9
|
+
const DOC_SMITH_ENV_FILE = join(homedir(), ".aigne", "doc-smith-connected.yaml");
|
|
10
|
+
|
|
11
|
+
// Check if the file exists
|
|
12
|
+
if (!existsSync(DOC_SMITH_ENV_FILE)) {
|
|
13
|
+
return {
|
|
14
|
+
message: "No site authorizations found to clear",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
// Read existing configuration
|
|
20
|
+
const data = await readFile(DOC_SMITH_ENV_FILE, "utf8");
|
|
21
|
+
const envs = parse(data) || {};
|
|
22
|
+
|
|
23
|
+
// Get all available sites
|
|
24
|
+
const siteHostnames = Object.keys(envs);
|
|
25
|
+
|
|
26
|
+
if (siteHostnames.length === 0) {
|
|
27
|
+
return {
|
|
28
|
+
message: "No site authorizations found to clear",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Display all sites with their URLs for user selection
|
|
33
|
+
const choices = siteHostnames.map((hostname) => {
|
|
34
|
+
return {
|
|
35
|
+
name: `${chalk.cyan(hostname)}`,
|
|
36
|
+
value: hostname,
|
|
37
|
+
checked: false, // Allow multiple selection
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Add an option to clear all site authorizations
|
|
42
|
+
choices.push({
|
|
43
|
+
name: chalk.red("🗑️ Clear ALL site authorizations"),
|
|
44
|
+
value: "__ALL__",
|
|
45
|
+
checked: false,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
let selectedSites = [];
|
|
49
|
+
|
|
50
|
+
if (options?.prompts?.checkbox) {
|
|
51
|
+
selectedSites = await options.prompts.checkbox({
|
|
52
|
+
message: "Select sites to clear authorization from:",
|
|
53
|
+
choices,
|
|
54
|
+
validate: (answer) => (answer.length > 0 ? true : "Please select at least one site."),
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
// If no prompts available, clear all site authorizations
|
|
58
|
+
selectedSites = ["__ALL__"];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (selectedSites.length === 0) {
|
|
62
|
+
return {
|
|
63
|
+
message: "No sites selected for clearing authorization",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const results = [];
|
|
68
|
+
let clearedCount = 0;
|
|
69
|
+
|
|
70
|
+
if (selectedSites.includes("__ALL__")) {
|
|
71
|
+
// Clear all site authorizations
|
|
72
|
+
await writeFile(DOC_SMITH_ENV_FILE, stringify({}));
|
|
73
|
+
results.push(`Cleared site authorization for all sites (${siteHostnames.length} sites)`);
|
|
74
|
+
clearedCount = siteHostnames.length;
|
|
75
|
+
} else {
|
|
76
|
+
// Clear site authorizations for selected sites
|
|
77
|
+
const updatedEnvs = { ...envs };
|
|
78
|
+
|
|
79
|
+
for (const hostname of selectedSites) {
|
|
80
|
+
if (updatedEnvs[hostname]) {
|
|
81
|
+
// Remove the entire site object
|
|
82
|
+
delete updatedEnvs[hostname];
|
|
83
|
+
|
|
84
|
+
results.push(`Cleared site authorization for ${chalk.cyan(hostname)}`);
|
|
85
|
+
clearedCount++;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
await writeFile(DOC_SMITH_ENV_FILE, stringify(updatedEnvs));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const header = `Successfully cleared site authorizations!`;
|
|
93
|
+
const detailLines = results.join("\n");
|
|
94
|
+
|
|
95
|
+
const message = [header, "", detailLines, ""].filter(Boolean).join("\n");
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
message,
|
|
99
|
+
clearedCount,
|
|
100
|
+
clearedSites: selectedSites.includes("__ALL__") ? siteHostnames : selectedSites,
|
|
101
|
+
};
|
|
102
|
+
} catch (error) {
|
|
103
|
+
return {
|
|
104
|
+
message: `Failed to clear site authorizations: ${error.message}`,
|
|
105
|
+
error: true,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
clearAuthTokens.taskTitle = "Clear site authorizations";
|
|
111
|
+
clearAuthTokens.description = "Clear site authorizations for document publishing sites";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { rm } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { pathExists, toDisplayPath } from "../../utils/file-utils.mjs";
|
|
4
|
+
|
|
5
|
+
export default async function clearDocumentConfig({ workDir }) {
|
|
6
|
+
// Fixed path where config.yaml is saved by init command
|
|
7
|
+
const cwd = workDir || process.cwd();
|
|
8
|
+
const documentConfigPath = join(cwd, ".aigne", "doc-smith", "config.yaml");
|
|
9
|
+
const displayPath = toDisplayPath(documentConfigPath);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
const existed = await pathExists(documentConfigPath);
|
|
13
|
+
await rm(documentConfigPath, { recursive: true, force: true });
|
|
14
|
+
|
|
15
|
+
const message = existed
|
|
16
|
+
? `Cleared document configuration (${displayPath})`
|
|
17
|
+
: `Document configuration already empty (${displayPath})`;
|
|
18
|
+
|
|
19
|
+
const suggestions = existed
|
|
20
|
+
? ["Run `aigne doc init` to generate a fresh configuration file."]
|
|
21
|
+
: [];
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
message,
|
|
25
|
+
cleared: existed,
|
|
26
|
+
path: displayPath,
|
|
27
|
+
suggestions,
|
|
28
|
+
};
|
|
29
|
+
} catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
message: `Failed to clear document configuration: ${error.message}`,
|
|
32
|
+
error: true,
|
|
33
|
+
path: displayPath,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
clearDocumentConfig.taskTitle = "Clear document configuration";
|
|
39
|
+
clearDocumentConfig.description = "Clear the document configuration file";
|