@aigne/doc-smith 0.8.4 → 0.8.6
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 +30 -0
- package/agents/action-success.mjs +1 -1
- package/agents/check-structure-plan.mjs +1 -1
- package/agents/detail-regenerator.yaml +6 -6
- package/agents/docs-generator.yaml +4 -4
- package/agents/feedback-refiner.yaml +10 -10
- package/agents/find-item-by-path.mjs +1 -1
- package/agents/find-items-by-paths.mjs +1 -1
- package/agents/input-generator.mjs +34 -28
- package/agents/manage-prefs.mjs +15 -15
- package/agents/publish-docs.mjs +52 -5
- package/agents/retranslate.yaml +6 -6
- package/agents/structure-planning.yaml +17 -17
- package/agents/team-publish-docs.yaml +2 -2
- package/agents/translate.yaml +7 -7
- package/docs/_sidebar.md +1 -1
- package/docs/cli-reference.md +1 -1
- package/docs/features-generate-documentation.md +1 -1
- package/docs/features-update-and-refine.md +2 -2
- package/package.json +1 -1
- package/tests/deploy.test.mjs +376 -0
- package/tests/input-generator.test.mjs +8 -6
- package/utils/auth-utils.mjs +10 -3
- package/utils/blocklet.mjs +25 -6
- package/utils/constants.mjs +2 -0
- package/utils/deploy.mjs +404 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.6](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.5...v0.8.6) (2025-09-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add deploy unit tests and improve publish workflow with better logging ([e33a94b](https://github.com/AIGNE-io/aigne-doc-smith/commit/e33a94bef5eda09398901fa1f953e662ae5fbd16))
|
|
9
|
+
* **publish:** display publish url for the default publish processing ([9d1d018](https://github.com/AIGNE-io/aigne-doc-smith/commit/9d1d0180dc9c8bb0a4393a893eed2395eec300ab))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **deploy:** ensure log is saved after await to prevent save failure ([793343f](https://github.com/AIGNE-io/aigne-doc-smith/commit/793343fc7f96ab962e70eb310cb07f4e7eaec9e0))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Miscellaneous Chores
|
|
18
|
+
|
|
19
|
+
* release 0.8.6 ([1e25cb4](https://github.com/AIGNE-io/aigne-doc-smith/commit/1e25cb49a26d8bcc3c83ec36120b6bad4042cadf))
|
|
20
|
+
|
|
21
|
+
## [0.8.5](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.4...v0.8.5) (2025-09-10)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* support publish docs to enterprise spaces ([#82](https://github.com/AIGNE-io/aigne-doc-smith/issues/82)) ([35b577a](https://github.com/AIGNE-io/aigne-doc-smith/commit/35b577ac0f2c1b860a23185054a55bada3742e8e))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Miscellaneous Chores
|
|
30
|
+
|
|
31
|
+
* release 0.8.5 ([7a60a03](https://github.com/AIGNE-io/aigne-doc-smith/commit/7a60a03f91a20f378e94b12dd32a6a8b0a4bede5))
|
|
32
|
+
|
|
3
33
|
## [0.8.4](https://github.com/AIGNE-io/aigne-doc-smith/compare/v0.8.3...v0.8.4) (2025-09-09)
|
|
4
34
|
|
|
5
35
|
|
|
@@ -21,7 +21,7 @@ export default async function checkStructurePlan(
|
|
|
21
21
|
// Prompt for feedback if originalStructurePlan exists and no feedback provided
|
|
22
22
|
if (originalStructurePlan && !feedback) {
|
|
23
23
|
const userFeedback = await options.prompts.input({
|
|
24
|
-
message: "
|
|
24
|
+
message: "How can we improve the documentation structure? (press Enter to skip):",
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
if (userFeedback?.trim()) {
|
|
@@ -2,7 +2,7 @@ type: team
|
|
|
2
2
|
name: update
|
|
3
3
|
alias:
|
|
4
4
|
- up
|
|
5
|
-
description:
|
|
5
|
+
description: Update specific documents and their translations
|
|
6
6
|
skills:
|
|
7
7
|
- url: ./input-generator.mjs
|
|
8
8
|
default_input:
|
|
@@ -39,24 +39,24 @@ skills:
|
|
|
39
39
|
stage: document_refine
|
|
40
40
|
- url: ./action-success.mjs
|
|
41
41
|
default_input:
|
|
42
|
-
action: "
|
|
42
|
+
action: "✅ Documents updated successfully"
|
|
43
43
|
input_schema:
|
|
44
44
|
type: object
|
|
45
45
|
properties:
|
|
46
46
|
glossary:
|
|
47
47
|
type: string
|
|
48
|
-
description: Glossary
|
|
48
|
+
description: Glossary file for consistent terminology (use @filename.md)
|
|
49
49
|
docs:
|
|
50
50
|
type: array
|
|
51
51
|
items:
|
|
52
52
|
type: string
|
|
53
|
-
description:
|
|
53
|
+
description: Documents to update
|
|
54
54
|
feedback:
|
|
55
55
|
type: string
|
|
56
|
-
description:
|
|
56
|
+
description: Tell us what to change in this content
|
|
57
57
|
reset:
|
|
58
58
|
type: boolean
|
|
59
|
-
description:
|
|
59
|
+
description: Start fresh - ignore previous versions
|
|
60
60
|
output_schema:
|
|
61
61
|
type: object
|
|
62
62
|
properties:
|
|
@@ -3,7 +3,7 @@ name: generate
|
|
|
3
3
|
alias:
|
|
4
4
|
- gen
|
|
5
5
|
- g
|
|
6
|
-
description:
|
|
6
|
+
description: Generate complete documentation for your project
|
|
7
7
|
skills:
|
|
8
8
|
- url: ./input-generator.mjs
|
|
9
9
|
default_input:
|
|
@@ -47,13 +47,13 @@ input_schema:
|
|
|
47
47
|
properties:
|
|
48
48
|
glossary:
|
|
49
49
|
type: string
|
|
50
|
-
description: Glossary
|
|
50
|
+
description: Glossary file for consistent terminology (use @filename.md)
|
|
51
51
|
feedback:
|
|
52
52
|
type: string
|
|
53
|
-
description:
|
|
53
|
+
description: Tell us how to improve the documentation structure
|
|
54
54
|
forceRegenerate:
|
|
55
55
|
type: boolean
|
|
56
|
-
description:
|
|
56
|
+
description: Rebuild all documentation from scratch
|
|
57
57
|
required:
|
|
58
58
|
- config
|
|
59
59
|
mode: sequential
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
name: feedbackRefiner
|
|
2
|
-
description:
|
|
2
|
+
description: Learn from your feedback to improve future documentation
|
|
3
3
|
|
|
4
4
|
# The instructions file contains the core logic (the prompt) for this Agent.
|
|
5
5
|
instructions:
|
|
@@ -10,18 +10,18 @@ input_schema:
|
|
|
10
10
|
properties:
|
|
11
11
|
feedback:
|
|
12
12
|
type: string
|
|
13
|
-
description:
|
|
13
|
+
description: Tell us what you think about the documentation
|
|
14
14
|
stage:
|
|
15
15
|
type: string
|
|
16
|
-
description:
|
|
16
|
+
description: Which part of the process this feedback is about (structure_planning, document_refine, translation_refine)
|
|
17
17
|
paths:
|
|
18
18
|
type: array
|
|
19
19
|
items:
|
|
20
20
|
type: string
|
|
21
|
-
description:
|
|
21
|
+
description: Specific documents this feedback applies to (optional)
|
|
22
22
|
existingPreferences:
|
|
23
23
|
type: string
|
|
24
|
-
description:
|
|
24
|
+
description: Your existing preferences to avoid duplicates (optional)
|
|
25
25
|
required:
|
|
26
26
|
- feedback
|
|
27
27
|
- stage
|
|
@@ -31,19 +31,19 @@ output_schema:
|
|
|
31
31
|
properties:
|
|
32
32
|
rule:
|
|
33
33
|
type: string
|
|
34
|
-
description:
|
|
34
|
+
description: General rule created from your feedback
|
|
35
35
|
scope:
|
|
36
36
|
type: string
|
|
37
|
-
description:
|
|
37
|
+
description: Where this rule applies (global, structure, document, translation)
|
|
38
38
|
save:
|
|
39
39
|
type: boolean
|
|
40
|
-
description:
|
|
40
|
+
description: Should we remember this preference for next time?
|
|
41
41
|
limitToInputPaths:
|
|
42
42
|
type: boolean
|
|
43
|
-
description:
|
|
43
|
+
description: Apply only to the specific documents mentioned?
|
|
44
44
|
reason:
|
|
45
45
|
type: string
|
|
46
|
-
description:
|
|
46
|
+
description: Why we made this decision and how the rule was created
|
|
47
47
|
required:
|
|
48
48
|
- rule
|
|
49
49
|
- scope
|
|
@@ -89,7 +89,7 @@ export default async function findItemByPath(
|
|
|
89
89
|
if (!userFeedback) {
|
|
90
90
|
const feedbackMessage = getActionText(
|
|
91
91
|
isTranslate,
|
|
92
|
-
"
|
|
92
|
+
"How should we improve this {action}? (press Enter to skip):",
|
|
93
93
|
);
|
|
94
94
|
|
|
95
95
|
userFeedback = await options.prompts.input({
|
|
@@ -90,7 +90,7 @@ export default async function selectedDocs(
|
|
|
90
90
|
if (!userFeedback) {
|
|
91
91
|
const feedbackMessage = getActionText(
|
|
92
92
|
isTranslate,
|
|
93
|
-
"
|
|
93
|
+
"How should we improve this {action}? (press Enter to skip):",
|
|
94
94
|
);
|
|
95
95
|
|
|
96
96
|
userFeedback = await options.prompts.input({
|
|
@@ -44,14 +44,14 @@ export default async function init(
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
console.log("🚀 Welcome to AIGNE DocSmith!");
|
|
47
|
-
console.log("Let's
|
|
47
|
+
console.log("Let's set up your documentation preferences.\n");
|
|
48
48
|
|
|
49
49
|
// Collect user information
|
|
50
50
|
const input = {};
|
|
51
51
|
|
|
52
52
|
// 1. Primary purpose - what's the main outcome you want readers to achieve?
|
|
53
53
|
const purposeChoices = await options.prompts.checkbox({
|
|
54
|
-
message: "📝 [1/8]: What
|
|
54
|
+
message: "📝 [1/8]: What should your documentation help readers achieve?",
|
|
55
55
|
choices: Object.entries(DOCUMENT_STYLES)
|
|
56
56
|
.filter(([key]) => key !== "custom") // Remove custom option for multiselect
|
|
57
57
|
.map(([key, style]) => ({
|
|
@@ -61,7 +61,7 @@ export default async function init(
|
|
|
61
61
|
})),
|
|
62
62
|
validate: (input) => {
|
|
63
63
|
if (input.length === 0) {
|
|
64
|
-
return "Please
|
|
64
|
+
return "Please choose at least one goal for your documentation.";
|
|
65
65
|
}
|
|
66
66
|
return true;
|
|
67
67
|
},
|
|
@@ -81,10 +81,10 @@ export default async function init(
|
|
|
81
81
|
})),
|
|
82
82
|
validate: (input) => {
|
|
83
83
|
if (input.length === 0) {
|
|
84
|
-
return "Please
|
|
84
|
+
return "Please choose at least one priority.";
|
|
85
85
|
}
|
|
86
86
|
if (input.length > 2) {
|
|
87
|
-
return "Please
|
|
87
|
+
return "Please choose maximum 2 priorities.";
|
|
88
88
|
}
|
|
89
89
|
return true;
|
|
90
90
|
},
|
|
@@ -99,7 +99,7 @@ export default async function init(
|
|
|
99
99
|
|
|
100
100
|
// 2. Target audience - who will be reading this most often?
|
|
101
101
|
const audienceChoices = await options.prompts.checkbox({
|
|
102
|
-
message: "👥 [2/8]: Who
|
|
102
|
+
message: "👥 [2/8]: Who will be reading your documentation?",
|
|
103
103
|
choices: Object.entries(TARGET_AUDIENCES)
|
|
104
104
|
.filter(([key]) => key !== "custom") // Remove custom option for multiselect
|
|
105
105
|
.map(([key, audience]) => ({
|
|
@@ -109,7 +109,7 @@ export default async function init(
|
|
|
109
109
|
})),
|
|
110
110
|
validate: (input) => {
|
|
111
111
|
if (input.length === 0) {
|
|
112
|
-
return "Please
|
|
112
|
+
return "Please choose at least one audience.";
|
|
113
113
|
}
|
|
114
114
|
return true;
|
|
115
115
|
},
|
|
@@ -133,7 +133,7 @@ export default async function init(
|
|
|
133
133
|
);
|
|
134
134
|
|
|
135
135
|
const knowledgeChoice = await options.prompts.select({
|
|
136
|
-
message: "🧠 [3/8]:
|
|
136
|
+
message: "🧠 [3/8]: How much do readers already know about your project?",
|
|
137
137
|
choices: Object.entries(filteredKnowledgeOptions).map(([key, level]) => ({
|
|
138
138
|
name: `${level.name}`,
|
|
139
139
|
description: level.description,
|
|
@@ -178,7 +178,7 @@ export default async function init(
|
|
|
178
178
|
);
|
|
179
179
|
|
|
180
180
|
const depthChoice = await options.prompts.select({
|
|
181
|
-
message: "📊 [4/8]: How
|
|
181
|
+
message: "📊 [4/8]: How detailed should your documentation be?",
|
|
182
182
|
choices: Object.entries(filteredDepthOptions).map(([key, depth]) => ({
|
|
183
183
|
name: `${depth.name}`,
|
|
184
184
|
description: depth.description,
|
|
@@ -196,7 +196,7 @@ export default async function init(
|
|
|
196
196
|
|
|
197
197
|
// Let user select primary language from supported list
|
|
198
198
|
const primaryLanguageChoice = await options.prompts.select({
|
|
199
|
-
message: "🌐 [5/8]:
|
|
199
|
+
message: "🌐 [5/8]: What's your main documentation language?",
|
|
200
200
|
choices: SUPPORTED_LANGUAGES.map((lang) => ({
|
|
201
201
|
name: `${lang.label} - ${lang.sample}`,
|
|
202
202
|
value: lang.code,
|
|
@@ -213,7 +213,7 @@ export default async function init(
|
|
|
213
213
|
);
|
|
214
214
|
|
|
215
215
|
const translateLanguageChoices = await options.prompts.checkbox({
|
|
216
|
-
message: "🔄 [6/8]:
|
|
216
|
+
message: "🔄 [6/8]: Which languages should we translate to?",
|
|
217
217
|
choices: availableTranslationLanguages.map((lang) => ({
|
|
218
218
|
name: `${lang.label} - ${lang.sample}`,
|
|
219
219
|
value: lang.code,
|
|
@@ -224,21 +224,23 @@ export default async function init(
|
|
|
224
224
|
|
|
225
225
|
// 7. Documentation directory
|
|
226
226
|
const docsDirInput = await options.prompts.input({
|
|
227
|
-
message: `📁 [7/8]: Where
|
|
227
|
+
message: `📁 [7/8]: Where should we save your documentation?`,
|
|
228
228
|
default: `${outputPath}/docs`,
|
|
229
229
|
});
|
|
230
230
|
input.docsDir = docsDirInput.trim() || `${outputPath}/docs`;
|
|
231
231
|
|
|
232
|
-
// 8.
|
|
233
|
-
console.log("\n🔍 [8/8]:
|
|
234
|
-
console.log(
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
// 8. Content sources
|
|
233
|
+
console.log("\n🔍 [8/8]: Content Sources");
|
|
234
|
+
console.log(
|
|
235
|
+
"What folders/files should we analyze for documentation? (e.g., ./src, ./docs, ./README.md)",
|
|
236
|
+
);
|
|
237
|
+
console.log("💡 Advanced: Use patterns like src/**/*.js or docs/**/*.md for specific files");
|
|
238
|
+
console.log("💡 Leave empty to scan everything");
|
|
237
239
|
|
|
238
240
|
const sourcePaths = [];
|
|
239
241
|
while (true) {
|
|
240
242
|
const selectedPath = await options.prompts.search({
|
|
241
|
-
message: "
|
|
243
|
+
message: "File/folder path or pattern:",
|
|
242
244
|
source: async (input) => {
|
|
243
245
|
if (!input || input.trim() === "") {
|
|
244
246
|
return [
|
|
@@ -330,15 +332,13 @@ export default async function init(
|
|
|
330
332
|
await mkdir(dirPath, { recursive: true });
|
|
331
333
|
|
|
332
334
|
await writeFile(filePath, yamlContent, "utf8");
|
|
333
|
-
console.log(`\n
|
|
335
|
+
console.log(`\n✅ Setup complete! Configuration saved to: ${chalk.cyan(filePath)}`);
|
|
334
336
|
// Print YAML content for user review
|
|
335
337
|
console.log(chalk.cyan("---"));
|
|
336
338
|
console.log(chalk.cyan(yamlContent));
|
|
337
339
|
console.log(chalk.cyan("---"));
|
|
338
340
|
console.log("💡 You can edit the configuration file anytime to modify settings.\n");
|
|
339
|
-
console.log(
|
|
340
|
-
`🚀 Run ${chalk.cyan("'aigne doc generate'")} to start documentation generation!\n`,
|
|
341
|
-
);
|
|
341
|
+
console.log(`🚀 Ready to generate docs? Run: ${chalk.cyan("aigne doc generate")}\n`);
|
|
342
342
|
|
|
343
343
|
return {};
|
|
344
344
|
} catch (error) {
|
|
@@ -385,12 +385,18 @@ export function generateYAML(input) {
|
|
|
385
385
|
// Generate comments and structure
|
|
386
386
|
let yaml = "# Project information for documentation publishing\n";
|
|
387
387
|
|
|
388
|
-
// Serialize the project info section safely
|
|
389
|
-
const projectSection = yamlStringify(
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
388
|
+
// Serialize the project info section safely with string quoting
|
|
389
|
+
const projectSection = yamlStringify(
|
|
390
|
+
{
|
|
391
|
+
projectName: config.projectName,
|
|
392
|
+
projectDesc: config.projectDesc,
|
|
393
|
+
projectLogo: config.projectLogo,
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
quotingType: '"',
|
|
397
|
+
defaultStringType: "QUOTE_DOUBLE",
|
|
398
|
+
},
|
|
399
|
+
).trim();
|
|
394
400
|
|
|
395
401
|
yaml += `${projectSection}\n\n`;
|
|
396
402
|
|
package/agents/manage-prefs.mjs
CHANGED
|
@@ -8,7 +8,7 @@ function listPreferences() {
|
|
|
8
8
|
const preferences = readPreferences();
|
|
9
9
|
|
|
10
10
|
if (preferences.rules.length === 0) {
|
|
11
|
-
return { message: "No preferences found." };
|
|
11
|
+
return { message: "No saved preferences found." };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
let message = "# User Preferences\n\n";
|
|
@@ -53,7 +53,7 @@ async function removePreferences(id, options) {
|
|
|
53
53
|
if (!targetIds || targetIds.length === 0) {
|
|
54
54
|
// Interactive selection
|
|
55
55
|
if (preferences.rules.length === 0) {
|
|
56
|
-
return { message: "No preferences
|
|
56
|
+
return { message: "No preferences available to remove." };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const choices = preferences.rules.map((rule) => ({
|
|
@@ -63,18 +63,18 @@ async function removePreferences(id, options) {
|
|
|
63
63
|
}));
|
|
64
64
|
|
|
65
65
|
targetIds = await options.prompts.checkbox({
|
|
66
|
-
message: "
|
|
66
|
+
message: "Choose preferences to delete:",
|
|
67
67
|
choices,
|
|
68
68
|
validate: (answer) => {
|
|
69
69
|
if (answer.length === 0) {
|
|
70
|
-
return "Please
|
|
70
|
+
return "Please choose at least one preference to delete";
|
|
71
71
|
}
|
|
72
72
|
return true;
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
if (!targetIds || targetIds.length === 0) {
|
|
77
|
-
return { message: "No preferences selected for
|
|
77
|
+
return { message: "No preferences selected for deletion." };
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -108,7 +108,7 @@ async function togglePreferences(id, options) {
|
|
|
108
108
|
if (!targetIds || targetIds.length === 0) {
|
|
109
109
|
// Interactive selection
|
|
110
110
|
if (preferences.rules.length === 0) {
|
|
111
|
-
return { message: "No preferences
|
|
111
|
+
return { message: "No preferences available to toggle." };
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
const choices = preferences.rules.map((rule) => ({
|
|
@@ -118,18 +118,18 @@ async function togglePreferences(id, options) {
|
|
|
118
118
|
}));
|
|
119
119
|
|
|
120
120
|
targetIds = await options.prompts.checkbox({
|
|
121
|
-
message: "
|
|
121
|
+
message: "Choose preferences to enable/disable:",
|
|
122
122
|
choices,
|
|
123
123
|
validate: (answer) => {
|
|
124
124
|
if (answer.length === 0) {
|
|
125
|
-
return "Please
|
|
125
|
+
return "Please choose at least one preference to toggle";
|
|
126
126
|
}
|
|
127
127
|
return true;
|
|
128
128
|
},
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
if (!targetIds || targetIds.length === 0) {
|
|
132
|
-
return { message: "No preferences selected
|
|
132
|
+
return { message: "No preferences selected to toggle." };
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
@@ -172,7 +172,7 @@ export default async function prefs({ list, remove, toggle, id }, options) {
|
|
|
172
172
|
return await togglePreferences(id, options);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
return { message: "Please
|
|
175
|
+
return { message: "Please choose an action: --list, --remove, or --toggle." };
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
prefs.input_schema = {
|
|
@@ -180,24 +180,24 @@ prefs.input_schema = {
|
|
|
180
180
|
properties: {
|
|
181
181
|
list: {
|
|
182
182
|
type: "boolean",
|
|
183
|
-
description: "
|
|
183
|
+
description: "Show all saved preferences",
|
|
184
184
|
},
|
|
185
185
|
remove: {
|
|
186
186
|
type: "boolean",
|
|
187
|
-
description: "
|
|
187
|
+
description: "Delete saved preferences",
|
|
188
188
|
},
|
|
189
189
|
toggle: {
|
|
190
190
|
type: "boolean",
|
|
191
|
-
description: "
|
|
191
|
+
description: "Enable/disable preferences",
|
|
192
192
|
},
|
|
193
193
|
id: {
|
|
194
194
|
type: "array",
|
|
195
195
|
items: {
|
|
196
196
|
type: "string",
|
|
197
197
|
},
|
|
198
|
-
description: "
|
|
198
|
+
description: "Specific preference IDs to work with",
|
|
199
199
|
},
|
|
200
200
|
},
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
prefs.description = "Manage
|
|
203
|
+
prefs.description = "Manage your saved documentation preferences";
|
package/agents/publish-docs.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import fs from "fs-extra";
|
|
|
5
5
|
|
|
6
6
|
import { getAccessToken } from "../utils/auth-utils.mjs";
|
|
7
7
|
import { DISCUSS_KIT_STORE_URL, TMP_DIR, TMP_DOCS_DIR } from "../utils/constants.mjs";
|
|
8
|
+
import { deploy } from "../utils/deploy.mjs";
|
|
8
9
|
import { beforePublishHook, ensureTmpDir } from "../utils/kroki-utils.mjs";
|
|
9
10
|
import { getGithubRepoUrl, loadConfigFromFile, saveValueToConfig } from "../utils/utils.mjs";
|
|
10
11
|
|
|
@@ -17,6 +18,8 @@ export default async function publishDocs(
|
|
|
17
18
|
// move work dir to tmp-dir
|
|
18
19
|
await ensureTmpDir();
|
|
19
20
|
|
|
21
|
+
const hasDocSmithBaseUrl = !!process.env.DOC_SMITH_BASE_URL;
|
|
22
|
+
|
|
20
23
|
const docsDir = join(".aigne", "doc-smith", TMP_DIR, TMP_DOCS_DIR);
|
|
21
24
|
await fs.rm(docsDir, { recursive: true, force: true });
|
|
22
25
|
await fs.mkdir(docsDir, {
|
|
@@ -42,18 +45,37 @@ export default async function publishDocs(
|
|
|
42
45
|
const isDefaultAppUrl = appUrl === DEFAULT_APP_URL;
|
|
43
46
|
const hasAppUrlInConfig = config?.appUrl;
|
|
44
47
|
|
|
48
|
+
let token = "";
|
|
49
|
+
|
|
45
50
|
if (!useEnvAppUrl && isDefaultAppUrl && !hasAppUrlInConfig) {
|
|
51
|
+
const hasCachedCheckoutId = !!config?.checkoutId;
|
|
46
52
|
const choice = await options.prompts.select({
|
|
47
53
|
message: "Select platform to publish your documents:",
|
|
48
54
|
choices: [
|
|
49
55
|
{
|
|
50
|
-
name: "
|
|
56
|
+
name: `${chalk.blue("DocSmith Cloud (docsmith.aigne.io)")} – ${chalk.green("Free")} hosting. Your documents will be publicly accessible. Best for open-source projects or community sharing.`,
|
|
51
57
|
value: "default",
|
|
52
58
|
},
|
|
53
59
|
{
|
|
54
|
-
name: "
|
|
60
|
+
name: `${chalk.blue("Your existing website")} - Integrate and publish directly on your current site (setup required)`,
|
|
55
61
|
value: "custom",
|
|
56
62
|
},
|
|
63
|
+
...(hasCachedCheckoutId && hasDocSmithBaseUrl
|
|
64
|
+
? [
|
|
65
|
+
{
|
|
66
|
+
name: `${chalk.yellow("Resume previous website setup")} - ${chalk.green("Already paid.")} Continue where you left off. Your payment is already processed.`,
|
|
67
|
+
value: "new-instance-continue",
|
|
68
|
+
},
|
|
69
|
+
]
|
|
70
|
+
: []),
|
|
71
|
+
...(hasDocSmithBaseUrl
|
|
72
|
+
? [
|
|
73
|
+
{
|
|
74
|
+
name: `${chalk.blue("New website")} - ${chalk.yellow("Paid service.")} We'll help you set up a brand-new website with custom domain and hosting. Great if you want a professional presence.`,
|
|
75
|
+
value: "new-instance",
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
: []),
|
|
57
79
|
],
|
|
58
80
|
});
|
|
59
81
|
|
|
@@ -63,7 +85,7 @@ export default async function publishDocs(
|
|
|
63
85
|
`Start here to run your own website:\n${chalk.cyan(DISCUSS_KIT_STORE_URL)}\n`,
|
|
64
86
|
);
|
|
65
87
|
const userInput = await options.prompts.input({
|
|
66
|
-
message: "Please enter your
|
|
88
|
+
message: "Please enter your website URL:",
|
|
67
89
|
validate: (input) => {
|
|
68
90
|
try {
|
|
69
91
|
// Check if input contains protocol, if not, prepend https://
|
|
@@ -77,10 +99,33 @@ export default async function publishDocs(
|
|
|
77
99
|
});
|
|
78
100
|
// Ensure appUrl has protocol
|
|
79
101
|
appUrl = userInput.includes("://") ? userInput : `https://${userInput}`;
|
|
102
|
+
} else if (hasDocSmithBaseUrl && ["new-instance", "new-instance-continue"].includes(choice)) {
|
|
103
|
+
// Deploy a new Discuss Kit service
|
|
104
|
+
try {
|
|
105
|
+
let id = "";
|
|
106
|
+
let paymentUrl = "";
|
|
107
|
+
if (choice === "new-instance-continue") {
|
|
108
|
+
id = config?.checkoutId;
|
|
109
|
+
paymentUrl = config?.paymentUrl;
|
|
110
|
+
console.log(`\nResuming your previous website setup...`);
|
|
111
|
+
} else {
|
|
112
|
+
console.log(`\nCreating new website for your documentation...`);
|
|
113
|
+
}
|
|
114
|
+
const { appUrl: homeUrl, token: ltToken } = (await deploy(id, paymentUrl)) || {};
|
|
115
|
+
|
|
116
|
+
appUrl = homeUrl;
|
|
117
|
+
token = ltToken;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
const errorMsg = error?.message || "Unknown error occurred";
|
|
120
|
+
console.error(`${chalk.red("❌ Failed to publish to website:")} ${errorMsg}`);
|
|
121
|
+
return { message: `❌ Publish failed: ${errorMsg}` };
|
|
122
|
+
}
|
|
80
123
|
}
|
|
81
124
|
}
|
|
82
125
|
|
|
83
|
-
|
|
126
|
+
console.log(`\nPublishing docs to ${chalk.cyan(appUrl)}\n`);
|
|
127
|
+
|
|
128
|
+
const accessToken = await getAccessToken(appUrl, token);
|
|
84
129
|
|
|
85
130
|
process.env.DOC_ROOT_DIR = docsDir;
|
|
86
131
|
|
|
@@ -138,6 +183,8 @@ export default async function publishDocs(
|
|
|
138
183
|
} catch (error) {
|
|
139
184
|
message = `❌ Failed to publish docs: ${error.message}`;
|
|
140
185
|
}
|
|
186
|
+
await saveValueToConfig("checkoutId", "", "Checkout ID for document deployment service");
|
|
187
|
+
|
|
141
188
|
// clean up tmp work dir
|
|
142
189
|
await fs.rm(docsDir, { recursive: true, force: true });
|
|
143
190
|
return message ? { message } : {};
|
|
@@ -162,4 +209,4 @@ publishDocs.input_schema = {
|
|
|
162
209
|
},
|
|
163
210
|
};
|
|
164
211
|
|
|
165
|
-
publishDocs.description = "Publish the documentation to
|
|
212
|
+
publishDocs.description = "Publish the documentation to website";
|
package/agents/retranslate.yaml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type: team
|
|
2
2
|
name: translate
|
|
3
|
-
description: Translate
|
|
3
|
+
description: Translate documents into other languages
|
|
4
4
|
skills:
|
|
5
5
|
- url: ./input-generator.mjs
|
|
6
6
|
default_input:
|
|
@@ -42,24 +42,24 @@ skills:
|
|
|
42
42
|
stage: translation_refine
|
|
43
43
|
- url: ./action-success.mjs
|
|
44
44
|
default_input:
|
|
45
|
-
action: "
|
|
45
|
+
action: "✅ Translation completed"
|
|
46
46
|
input_schema:
|
|
47
47
|
type: object
|
|
48
48
|
properties:
|
|
49
49
|
glossary:
|
|
50
50
|
type: string
|
|
51
|
-
description: Glossary
|
|
51
|
+
description: Glossary file for consistent terminology (use @filename.md)
|
|
52
52
|
docs:
|
|
53
53
|
type: array
|
|
54
54
|
items:
|
|
55
55
|
type: string
|
|
56
|
-
description:
|
|
56
|
+
description: Documents to translate
|
|
57
57
|
langs:
|
|
58
58
|
type: array
|
|
59
59
|
items:
|
|
60
60
|
type: string
|
|
61
|
-
description: "
|
|
61
|
+
description: "Target languages (available: en, zh, zh-TW, ja, fr, de, es, it, ru, ko, pt, ar)"
|
|
62
62
|
feedback:
|
|
63
63
|
type: string
|
|
64
|
-
description:
|
|
64
|
+
description: Tell us how to improve the translation style
|
|
65
65
|
mode: sequential
|