@aigne/doc-smith 0.8.11-beta.6 → 0.8.11
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 +2 -2
- package/.aigne/doc-smith/preferences.yml +28 -20
- package/.aigne/doc-smith/upload-cache.yaml +702 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/agents/generate/document-structure-tools/add-document.mjs +35 -10
- package/agents/generate/document-structure-tools/delete-document.mjs +35 -12
- package/agents/generate/document-structure-tools/move-document.mjs +43 -17
- package/agents/generate/document-structure-tools/update-document.mjs +37 -10
- package/agents/generate/update-document-structure.yaml +1 -7
- package/agents/generate/user-review-document-structure.mjs +5 -4
- package/agents/translate/translate-document.yaml +1 -9
- package/agents/update/check-update-is-single.mjs +2 -1
- package/agents/update/document-tools/update-document-content.mjs +24 -14
- package/agents/update/fs-tools/glob.mjs +184 -0
- package/agents/update/fs-tools/grep.mjs +317 -0
- package/agents/update/fs-tools/read-file.mjs +307 -0
- package/agents/update/generate-document.yaml +4 -7
- package/agents/update/update-document-detail.yaml +6 -10
- package/agents/update/user-review-document.mjs +13 -13
- package/assets/screenshots/doc-complete-setup.png +0 -0
- package/assets/screenshots/doc-generate-docs.png +0 -0
- package/assets/screenshots/doc-generate.png +0 -0
- package/assets/screenshots/doc-generated-successfully.png +0 -0
- package/assets/screenshots/doc-publish.png +0 -0
- package/assets/screenshots/doc-regenerate.png +0 -0
- package/assets/screenshots/doc-translate-langs.png +0 -0
- package/assets/screenshots/doc-translate.png +0 -0
- package/assets/screenshots/doc-update.png +0 -0
- package/docs/advanced-how-it-works.ja.md +31 -31
- package/docs/advanced-how-it-works.md +9 -9
- package/docs/advanced-how-it-works.zh-TW.md +24 -24
- package/docs/advanced-how-it-works.zh.md +20 -20
- package/docs/advanced-quality-assurance.ja.md +57 -61
- package/docs/advanced-quality-assurance.md +57 -61
- package/docs/advanced-quality-assurance.zh-TW.md +57 -61
- package/docs/advanced-quality-assurance.zh.md +57 -61
- package/docs/advanced.ja.md +8 -4
- package/docs/advanced.md +7 -3
- package/docs/advanced.zh-TW.md +9 -5
- package/docs/advanced.zh.md +9 -5
- package/docs/changelog.ja.md +206 -29
- package/docs/changelog.md +177 -0
- package/docs/changelog.zh-TW.md +229 -52
- package/docs/changelog.zh.md +204 -27
- package/docs/cli-reference.ja.md +82 -52
- package/docs/cli-reference.md +56 -26
- package/docs/cli-reference.zh-TW.md +82 -52
- package/docs/cli-reference.zh.md +70 -40
- package/docs/configuration-interactive-setup.ja.md +45 -42
- package/docs/configuration-interactive-setup.md +8 -5
- package/docs/configuration-interactive-setup.zh-TW.md +26 -23
- package/docs/configuration-interactive-setup.zh.md +25 -22
- package/docs/configuration-language-support.ja.md +33 -63
- package/docs/configuration-language-support.md +32 -62
- package/docs/configuration-language-support.zh-TW.md +35 -65
- package/docs/configuration-language-support.zh.md +32 -62
- package/docs/configuration-llm-setup.ja.md +25 -23
- package/docs/configuration-llm-setup.md +20 -18
- package/docs/configuration-llm-setup.zh-TW.md +21 -19
- package/docs/configuration-llm-setup.zh.md +20 -18
- package/docs/configuration-preferences.ja.md +67 -52
- package/docs/configuration-preferences.md +56 -41
- package/docs/configuration-preferences.zh-TW.md +69 -54
- package/docs/configuration-preferences.zh.md +68 -53
- package/docs/configuration.ja.md +65 -81
- package/docs/configuration.md +19 -35
- package/docs/configuration.zh-TW.md +62 -79
- package/docs/configuration.zh.md +50 -67
- package/docs/features-generate-documentation.ja.md +44 -69
- package/docs/features-generate-documentation.md +36 -61
- package/docs/features-generate-documentation.zh-TW.md +42 -67
- package/docs/features-generate-documentation.zh.md +41 -67
- package/docs/features-publish-your-docs.ja.md +36 -36
- package/docs/features-publish-your-docs.md +2 -2
- package/docs/features-publish-your-docs.zh-TW.md +21 -21
- package/docs/features-publish-your-docs.zh.md +23 -23
- package/docs/features-translate-documentation.ja.md +40 -31
- package/docs/features-translate-documentation.md +15 -6
- package/docs/features-translate-documentation.zh-TW.md +37 -28
- package/docs/features-translate-documentation.zh.md +23 -14
- package/docs/features-update-and-refine.ja.md +68 -118
- package/docs/features-update-and-refine.md +58 -108
- package/docs/features-update-and-refine.zh-TW.md +67 -116
- package/docs/features-update-and-refine.zh.md +64 -114
- package/docs/features.ja.md +29 -19
- package/docs/features.md +25 -15
- package/docs/features.zh-TW.md +28 -18
- package/docs/features.zh.md +31 -21
- package/docs/getting-started.ja.md +40 -43
- package/docs/getting-started.md +36 -39
- package/docs/getting-started.zh-TW.md +38 -41
- package/docs/getting-started.zh.md +45 -48
- package/docs/overview.ja.md +63 -11
- package/docs/overview.md +60 -8
- package/docs/overview.zh-TW.md +67 -15
- package/docs/overview.zh.md +62 -10
- package/media.md +9 -9
- package/package.json +1 -1
- package/prompts/detail/custom/custom-components.md +304 -188
- package/prompts/detail/document-rules.md +4 -4
- package/prompts/detail/generate-document.md +21 -8
- package/prompts/detail/update-document.md +8 -12
- package/prompts/structure/update-document-structure.md +12 -8
- package/prompts/utils/feedback-refiner.md +3 -3
- package/tests/agents/generate/document-structure-tools/move-document.test.mjs +9 -9
- package/tests/agents/generate/user-review-document-structure.test.mjs +29 -8
- package/tests/agents/update/document-tools/update-document-content.test.mjs +115 -112
- package/tests/agents/update/fs-tools/glob.test.mjs +438 -0
- package/tests/agents/update/fs-tools/grep.test.mjs +279 -0
- package/tests/agents/update/fs-tools/read-file.test.mjs +553 -0
- package/tests/agents/update/user-review-document.test.mjs +48 -27
- package/types/document-schema.mjs +5 -6
- package/types/document-structure-schema.mjs +20 -8
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import fsPromises from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Detects if a file is likely binary by checking for null bytes
|
|
7
|
+
*/
|
|
8
|
+
function isBinaryFile(buffer) {
|
|
9
|
+
// Check first 8KB for null bytes
|
|
10
|
+
const checkLength = Math.min(buffer.length, 8192);
|
|
11
|
+
for (let i = 0; i < checkLength; i++) {
|
|
12
|
+
if (buffer[i] === 0) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Gets MIME type based on file extension
|
|
21
|
+
*/
|
|
22
|
+
function getMimeType(filePath) {
|
|
23
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
24
|
+
const mimeTypes = {
|
|
25
|
+
// Text files
|
|
26
|
+
".txt": "text/plain",
|
|
27
|
+
".md": "text/markdown",
|
|
28
|
+
".json": "application/json",
|
|
29
|
+
".js": "text/javascript",
|
|
30
|
+
".mjs": "text/javascript",
|
|
31
|
+
".ts": "text/typescript",
|
|
32
|
+
".tsx": "text/typescript",
|
|
33
|
+
".jsx": "text/javascript",
|
|
34
|
+
".py": "text/x-python",
|
|
35
|
+
".java": "text/x-java",
|
|
36
|
+
".cpp": "text/x-c",
|
|
37
|
+
".c": "text/x-c",
|
|
38
|
+
".h": "text/x-c",
|
|
39
|
+
".css": "text/css",
|
|
40
|
+
".html": "text/html",
|
|
41
|
+
".xml": "text/xml",
|
|
42
|
+
".yaml": "text/yaml",
|
|
43
|
+
".yml": "text/yaml",
|
|
44
|
+
".toml": "text/plain",
|
|
45
|
+
".ini": "text/plain",
|
|
46
|
+
".cfg": "text/plain",
|
|
47
|
+
".conf": "text/plain",
|
|
48
|
+
".sh": "text/x-shellscript",
|
|
49
|
+
".bash": "text/x-shellscript",
|
|
50
|
+
".zsh": "text/x-shellscript",
|
|
51
|
+
".fish": "text/x-shellscript",
|
|
52
|
+
|
|
53
|
+
// Image files
|
|
54
|
+
".jpg": "image/jpeg",
|
|
55
|
+
".jpeg": "image/jpeg",
|
|
56
|
+
".png": "image/png",
|
|
57
|
+
".gif": "image/gif",
|
|
58
|
+
".webp": "image/webp",
|
|
59
|
+
".svg": "image/svg+xml",
|
|
60
|
+
".bmp": "image/bmp",
|
|
61
|
+
".ico": "image/x-icon",
|
|
62
|
+
|
|
63
|
+
// Document files
|
|
64
|
+
".pdf": "application/pdf",
|
|
65
|
+
".doc": "application/msword",
|
|
66
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
67
|
+
|
|
68
|
+
// Other
|
|
69
|
+
".zip": "application/zip",
|
|
70
|
+
".tar": "application/x-tar",
|
|
71
|
+
".gz": "application/gzip",
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return mimeTypes[ext] || "application/octet-stream";
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Validates file path and checks accessibility
|
|
79
|
+
*/
|
|
80
|
+
function validateFilePath(filePath) {
|
|
81
|
+
if (!filePath || typeof filePath !== "string" || filePath.trim() === "") {
|
|
82
|
+
return "File path parameter is required and cannot be empty";
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!path.isAbsolute(filePath)) {
|
|
86
|
+
return `File path must be absolute, but was relative: ${filePath}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
const stats = fs.statSync(filePath);
|
|
91
|
+
if (stats.isDirectory()) {
|
|
92
|
+
return `Path is a directory, not a file: ${filePath}`;
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (error.code === "ENOENT") {
|
|
97
|
+
return `File does not exist: ${filePath}`;
|
|
98
|
+
} else if (error.code === "EACCES") {
|
|
99
|
+
return `Permission denied: ${filePath}`;
|
|
100
|
+
}
|
|
101
|
+
return `Cannot access file: ${filePath} (${error.message})`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Reads file content with proper handling for different file types
|
|
107
|
+
*/
|
|
108
|
+
async function readFileContent(filePath, offset = 0, limit = null, encoding = "utf8") {
|
|
109
|
+
const stats = await fsPromises.stat(filePath);
|
|
110
|
+
const fileSize = stats.size;
|
|
111
|
+
const mimeType = getMimeType(filePath);
|
|
112
|
+
|
|
113
|
+
// Handle binary files differently
|
|
114
|
+
if (
|
|
115
|
+
mimeType.startsWith("image/") ||
|
|
116
|
+
mimeType === "application/pdf" ||
|
|
117
|
+
fileSize > 10 * 1024 * 1024
|
|
118
|
+
) {
|
|
119
|
+
return {
|
|
120
|
+
content: `[Binary file: ${path.basename(filePath)}]`,
|
|
121
|
+
mimeType,
|
|
122
|
+
fileSize,
|
|
123
|
+
isBinary: true,
|
|
124
|
+
encoding: null,
|
|
125
|
+
lineCount: null,
|
|
126
|
+
isTruncated: false,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Read file as buffer first to check if it's binary
|
|
131
|
+
const buffer = await fsPromises.readFile(filePath);
|
|
132
|
+
|
|
133
|
+
if (isBinaryFile(buffer)) {
|
|
134
|
+
return {
|
|
135
|
+
content: `[Binary file: ${path.basename(filePath)}]`,
|
|
136
|
+
mimeType,
|
|
137
|
+
fileSize,
|
|
138
|
+
isBinary: true,
|
|
139
|
+
encoding: null,
|
|
140
|
+
lineCount: null,
|
|
141
|
+
isTruncated: false,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Convert buffer to text
|
|
146
|
+
let content = buffer.toString(encoding);
|
|
147
|
+
const lines = content.split(/\r?\n/);
|
|
148
|
+
const totalLines = lines.length;
|
|
149
|
+
let isTruncated = false;
|
|
150
|
+
let linesShown = [1, totalLines];
|
|
151
|
+
|
|
152
|
+
// Handle offset and limit for text files
|
|
153
|
+
if (offset > 0 || limit !== null) {
|
|
154
|
+
const startLine = Math.max(0, offset);
|
|
155
|
+
const endLine = limit !== null ? Math.min(startLine + limit, totalLines) : totalLines;
|
|
156
|
+
|
|
157
|
+
if (startLine >= totalLines) {
|
|
158
|
+
return {
|
|
159
|
+
content: "",
|
|
160
|
+
mimeType,
|
|
161
|
+
fileSize,
|
|
162
|
+
isBinary: false,
|
|
163
|
+
encoding,
|
|
164
|
+
lineCount: totalLines,
|
|
165
|
+
isTruncated: false,
|
|
166
|
+
linesShown: [startLine + 1, startLine + 1],
|
|
167
|
+
message: `Offset ${offset} is beyond file end (file has ${totalLines} lines)`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const selectedLines = lines.slice(startLine, endLine);
|
|
172
|
+
content = selectedLines.join("\n");
|
|
173
|
+
isTruncated = startLine > 0 || endLine < totalLines;
|
|
174
|
+
linesShown = [startLine + 1, endLine];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Auto-truncate very large files (more than 10000 lines)
|
|
178
|
+
const maxLines = 10000;
|
|
179
|
+
if (limit === null && totalLines > maxLines) {
|
|
180
|
+
const selectedLines = lines.slice(0, maxLines);
|
|
181
|
+
content = selectedLines.join("\n");
|
|
182
|
+
isTruncated = true;
|
|
183
|
+
linesShown = [1, maxLines];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
content,
|
|
188
|
+
mimeType,
|
|
189
|
+
fileSize,
|
|
190
|
+
isBinary: false,
|
|
191
|
+
encoding,
|
|
192
|
+
lineCount: totalLines,
|
|
193
|
+
isTruncated,
|
|
194
|
+
linesShown,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export default async function readFile({ path: filePath, offset, limit, encoding = "utf8" }) {
|
|
199
|
+
let result = {};
|
|
200
|
+
let error = null;
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
// Validate file path first (this checks if it's absolute)
|
|
204
|
+
const pathError = validateFilePath(filePath);
|
|
205
|
+
if (pathError) {
|
|
206
|
+
throw new Error(pathError);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Now we know filePath is valid and absolute
|
|
210
|
+
|
|
211
|
+
// Validate numeric parameters
|
|
212
|
+
if (offset !== undefined && (typeof offset !== "number" || offset < 0)) {
|
|
213
|
+
throw new Error("Offset must be a non-negative number");
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (limit !== undefined && (typeof limit !== "number" || limit <= 0)) {
|
|
217
|
+
throw new Error("Limit must be a positive number");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Read file content
|
|
221
|
+
const fileResult = await readFileContent(filePath, offset, limit, encoding);
|
|
222
|
+
|
|
223
|
+
// Build success result
|
|
224
|
+
result = {
|
|
225
|
+
content: fileResult.content,
|
|
226
|
+
metadata: {
|
|
227
|
+
path: filePath,
|
|
228
|
+
mimeType: fileResult.mimeType,
|
|
229
|
+
fileSize: fileResult.fileSize,
|
|
230
|
+
isBinary: fileResult.isBinary,
|
|
231
|
+
encoding: fileResult.encoding,
|
|
232
|
+
lineCount: fileResult.lineCount,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// Add truncation info if applicable
|
|
237
|
+
if (fileResult.isTruncated) {
|
|
238
|
+
result.truncated = {
|
|
239
|
+
isTruncated: true,
|
|
240
|
+
linesShown: fileResult.linesShown,
|
|
241
|
+
totalLines: fileResult.lineCount,
|
|
242
|
+
nextOffset: fileResult.linesShown[1],
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// Add helpful message for truncated content
|
|
246
|
+
const [start, end] = fileResult.linesShown;
|
|
247
|
+
const nextOffset = end;
|
|
248
|
+
result.message =
|
|
249
|
+
`Content truncated. Showing lines ${start}-${end} of ${fileResult.lineCount} total lines. ` +
|
|
250
|
+
`To read more, use offset: ${nextOffset}.`;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Add message if provided
|
|
254
|
+
if (fileResult.message) {
|
|
255
|
+
result.message = fileResult.message;
|
|
256
|
+
}
|
|
257
|
+
} catch (err) {
|
|
258
|
+
error = err;
|
|
259
|
+
result = {
|
|
260
|
+
content: null,
|
|
261
|
+
metadata: {
|
|
262
|
+
path: filePath,
|
|
263
|
+
mimeType: null,
|
|
264
|
+
fileSize: null,
|
|
265
|
+
isBinary: null,
|
|
266
|
+
encoding: null,
|
|
267
|
+
lineCount: null,
|
|
268
|
+
},
|
|
269
|
+
message: `Error reading file: ${err.message}`,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
command: "read_file",
|
|
275
|
+
arguments: {
|
|
276
|
+
path: filePath,
|
|
277
|
+
offset,
|
|
278
|
+
limit,
|
|
279
|
+
encoding,
|
|
280
|
+
},
|
|
281
|
+
result,
|
|
282
|
+
error: error && { message: error.message },
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
readFile.input_schema = {
|
|
287
|
+
type: "object",
|
|
288
|
+
properties: {
|
|
289
|
+
path: {
|
|
290
|
+
type: "string",
|
|
291
|
+
description: "The path to the file to read (for backwards compatibility)",
|
|
292
|
+
},
|
|
293
|
+
offset: {
|
|
294
|
+
type: "number",
|
|
295
|
+
description: "Optional: The 0-based line number to start reading from",
|
|
296
|
+
},
|
|
297
|
+
limit: {
|
|
298
|
+
type: "number",
|
|
299
|
+
description: "Optional: Maximum number of lines to read",
|
|
300
|
+
},
|
|
301
|
+
encoding: {
|
|
302
|
+
type: "string",
|
|
303
|
+
description: "Optional: File encoding (defaults to utf8)",
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
required: ["path"],
|
|
307
|
+
};
|
|
@@ -41,14 +41,11 @@ input_schema:
|
|
|
41
41
|
- rules
|
|
42
42
|
- datasources
|
|
43
43
|
- originalDocumentStructure
|
|
44
|
-
|
|
45
|
-
type: object
|
|
46
|
-
properties:
|
|
47
|
-
content:
|
|
48
|
-
type: string
|
|
49
|
-
required:
|
|
50
|
-
- content
|
|
44
|
+
output_key: content
|
|
51
45
|
skills:
|
|
46
|
+
- fs-tools/glob.mjs
|
|
47
|
+
- fs-tools/grep.mjs
|
|
48
|
+
- fs-tools/read-file.mjs
|
|
52
49
|
- type: team
|
|
53
50
|
task_render_mode: collapse
|
|
54
51
|
name: generateD2DiagramContent
|
|
@@ -39,14 +39,10 @@ input_schema:
|
|
|
39
39
|
required:
|
|
40
40
|
- originalContent
|
|
41
41
|
- feedback
|
|
42
|
-
|
|
43
|
-
type: object
|
|
44
|
-
properties:
|
|
45
|
-
updatedContent:
|
|
46
|
-
type: string
|
|
47
|
-
description: Final updated markdown content after applying modifications
|
|
48
|
-
operationSummary:
|
|
49
|
-
type: string
|
|
50
|
-
description: Summary of the operations performed on the document content
|
|
42
|
+
output_key: message
|
|
51
43
|
skills:
|
|
52
|
-
- ./document-tools/update-document-content.mjs
|
|
44
|
+
- ./document-tools/update-document-content.mjs
|
|
45
|
+
- ./fs-tools/glob.mjs
|
|
46
|
+
- ./fs-tools/grep.mjs
|
|
47
|
+
- ./fs-tools/read-file.mjs
|
|
48
|
+
task_render_mode: collapse
|
|
@@ -134,7 +134,8 @@ export default async function userReviewDocument(
|
|
|
134
134
|
// Print current document headings structure
|
|
135
135
|
printDocumentHeadings(content, title || "Untitled Document");
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
// Initialize shared context with current content
|
|
138
|
+
options.context.userContext.currentContent = content;
|
|
138
139
|
|
|
139
140
|
const MAX_ITERATIONS = 100;
|
|
140
141
|
let iterationCount = 0;
|
|
@@ -163,7 +164,10 @@ export default async function userReviewDocument(
|
|
|
163
164
|
if (action === "finish") {
|
|
164
165
|
break;
|
|
165
166
|
} else if (action === "view") {
|
|
166
|
-
await showDocumentDetail(
|
|
167
|
+
await showDocumentDetail(
|
|
168
|
+
options.context.userContext.currentContent,
|
|
169
|
+
title || "Untitled Document",
|
|
170
|
+
);
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
// Ask for feedback
|
|
@@ -200,20 +204,13 @@ export default async function userReviewDocument(
|
|
|
200
204
|
|
|
201
205
|
try {
|
|
202
206
|
// Call updateDocument agent with feedback
|
|
203
|
-
|
|
207
|
+
await options.context.invoke(updateAgent, {
|
|
204
208
|
...rest,
|
|
205
|
-
originalContent: currentContent,
|
|
209
|
+
originalContent: options.context.userContext.currentContent,
|
|
206
210
|
feedback: feedback.trim(),
|
|
207
211
|
userPreferences,
|
|
208
212
|
});
|
|
209
213
|
|
|
210
|
-
if (result.updatedContent) {
|
|
211
|
-
currentContent = result.updatedContent;
|
|
212
|
-
console.log(`\n✅ ${result.operationSummary || "Document updated successfully"}\n`);
|
|
213
|
-
} else {
|
|
214
|
-
console.log("\n❌ We couldn't update the document. Please try rephrasing your feedback.\n");
|
|
215
|
-
}
|
|
216
|
-
|
|
217
214
|
// Check if feedback should be saved as user preference
|
|
218
215
|
const feedbackRefinerAgent = options.context.agents["checkFeedbackRefiner"];
|
|
219
216
|
if (feedbackRefinerAgent) {
|
|
@@ -229,7 +226,10 @@ export default async function userReviewDocument(
|
|
|
229
226
|
}
|
|
230
227
|
|
|
231
228
|
// Print updated document headings structure
|
|
232
|
-
printDocumentHeadings(
|
|
229
|
+
printDocumentHeadings(
|
|
230
|
+
options.context.userContext.currentContent,
|
|
231
|
+
title || "Untitled Document",
|
|
232
|
+
);
|
|
233
233
|
} catch (error) {
|
|
234
234
|
console.error("Error processing your feedback:");
|
|
235
235
|
console.error(`Type: ${error.name}`);
|
|
@@ -242,7 +242,7 @@ export default async function userReviewDocument(
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
return { content: currentContent };
|
|
245
|
+
return { content: options.context.userContext.currentContent };
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
userReviewDocument.taskTitle = "User review and modify document content";
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
# 仕組み
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith
|
|
3
|
+
AIGNE DocSmithは、マルチagentシステムで動作します。単一のモノリシックなプロセスではなく、専門のAI agentのパイプラインを編成し、各agentが特定のタスクを担当します。このアプローチにより、ソースコードを完全なドキュメントに変換するための構造化されたモジュラーなプロセスが可能になります。
|
|
4
4
|
|
|
5
|
-
このツールは、AI
|
|
5
|
+
このツールは、AIアプリケーションを開発・展開するためのプラットフォームを提供する、より大きなAIGNEエコシステムの不可欠な部分です。
|
|
6
6
|
|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## ドキュメント生成パイプライン
|
|
10
10
|
|
|
11
|
-
DocSmith
|
|
11
|
+
DocSmithの中核は、ソースコードをいくつかの異なるステージを通して処理するパイプラインです。各ステージは1つ以上の専用agentによって管理されます。通常、`aigne doc generate`コマンドによって開始される主要なワークフローは、次のように視覚化できます。
|
|
12
12
|
|
|
13
13
|
```d2
|
|
14
14
|
direction: down
|
|
15
15
|
|
|
16
16
|
Input: {
|
|
17
|
-
label: "
|
|
17
|
+
label: "ソースコードと設定"
|
|
18
18
|
shape: rectangle
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
Pipeline: {
|
|
22
|
-
label: "
|
|
22
|
+
label: "コア生成パイプライン"
|
|
23
23
|
shape: rectangle
|
|
24
24
|
grid-columns: 1
|
|
25
25
|
grid-gap: 40
|
|
26
26
|
|
|
27
27
|
Structure-Planning: {
|
|
28
|
-
label: "1.
|
|
28
|
+
label: "1. 構造計画"
|
|
29
29
|
shape: rectangle
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
Content-Generation: {
|
|
33
|
-
label: "2.
|
|
33
|
+
label: "2. コンテンツ生成"
|
|
34
34
|
shape: rectangle
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
Saving: {
|
|
38
|
-
label: "3.
|
|
38
|
+
label: "3. ドキュメント保存"
|
|
39
39
|
shape: rectangle
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
User-Feedback: {
|
|
44
|
-
label: "
|
|
44
|
+
label: "ユーザーフィードバックループ\n(--feedbackフラグ経由)"
|
|
45
45
|
shape: rectangle
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
Optional-Steps: {
|
|
49
|
-
label: "
|
|
49
|
+
label: "オプションの生成後ステップ"
|
|
50
50
|
shape: rectangle
|
|
51
51
|
grid-columns: 2
|
|
52
52
|
grid-gap: 40
|
|
53
53
|
|
|
54
54
|
Translation: {
|
|
55
|
-
label: "
|
|
55
|
+
label: "翻訳\n(aigne doc translate)"
|
|
56
56
|
shape: rectangle
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
Publishing: {
|
|
60
|
-
label: "
|
|
60
|
+
label: "公開\n(aigne doc publish)"
|
|
61
61
|
shape: rectangle
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -67,35 +67,35 @@ Pipeline.Structure-Planning -> Pipeline.Content-Generation
|
|
|
67
67
|
Pipeline.Content-Generation -> Pipeline.Saving
|
|
68
68
|
Pipeline.Saving -> Optional-Steps
|
|
69
69
|
|
|
70
|
-
User-Feedback -> Pipeline.Structure-Planning: "
|
|
71
|
-
User-Feedback -> Pipeline.Content-Generation: "
|
|
70
|
+
User-Feedback -> Pipeline.Structure-Planning: "構造の改良"
|
|
71
|
+
User-Feedback -> Pipeline.Content-Generation: "コンテンツの再生成"
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
1. **入力分析**:
|
|
74
|
+
1. **入力分析**: このプロセスは、agentがソースコードとプロジェクト設定(`aigne.yaml`)を読み込むことから始まります。
|
|
75
75
|
|
|
76
|
-
2. **構造計画**:
|
|
76
|
+
2. **構造計画**: あるagentがコードベースを分析し、論理的なドキュメント構造を提案します。プロジェクトの構成と指定されたルールに基づいてアウトラインを作成します。
|
|
77
77
|
|
|
78
|
-
3. **コンテンツ生成**:
|
|
78
|
+
3. **コンテンツ生成**: 構造が決定されると、コンテンツ生成agentがドキュメントプランの各セクションに詳細なテキスト、コード例、説明を埋め込んでいきます。
|
|
79
79
|
|
|
80
|
-
4. **改良と更新**: `aigne doc update
|
|
80
|
+
4. **改良と更新**: `aigne doc update`または`aigne doc generate --feedback`を介して入力が提供されると、特定のagentがアクティブになり、個々のドキュメントを更新したり、全体の構造を調整したりします。
|
|
81
81
|
|
|
82
|
-
5. **翻訳と公開**: 主要なコンテンツが生成された後、オプションの
|
|
82
|
+
5. **翻訳と公開**: 主要なコンテンツが生成された後、オプションのagentが多言語翻訳や最終的なドキュメントをウェブプラットフォームに公開するなどのタスクを処理します。
|
|
83
83
|
|
|
84
84
|
## 主要なAI Agent
|
|
85
85
|
|
|
86
|
-
DocSmithの機能は、プロジェクトの設定で定義された
|
|
86
|
+
DocSmithの機能は、プロジェクトの設定で定義されたagentのコレクションによって提供されます。各agentには特定の役割があります。以下の表は、主要なagentとその機能の一部をリストアップしたものです。
|
|
87
87
|
|
|
88
|
-
| 機能的役割
|
|
89
|
-
|
|
|
90
|
-
| **構造計画**
|
|
91
|
-
| **構造の改良**
|
|
92
|
-
| **コンテンツ生成**
|
|
93
|
-
| **翻訳**
|
|
94
|
-
| **公開**
|
|
95
|
-
| **データI/O**
|
|
88
|
+
| 機能的役割 | 主要なAgentファイル | 説明 |
|
|
89
|
+
| :--- | :--- | :--- |
|
|
90
|
+
| **構造計画** | `generate/generate-structure.yaml` | ソースコードを分析し、最初のドキュメントアウトラインを提案します。 |
|
|
91
|
+
| **構造の改良** | `generate/refine-document-structure.yaml` | ユーザーのフィードバックに基づいてドキュメントの構造を修正します。 |
|
|
92
|
+
| **コンテンツ生成** | `update/batch-generate-document.yaml`, `update/generate-document.yaml` | ドキュメント構造の各セクションに詳細なコンテンツを埋め込みます。 |
|
|
93
|
+
| **翻訳** | `translate/translate-document.yaml`, `translate/translate-multilingual.yaml` | 生成されたドキュメントを複数のターゲット言語に翻訳します。 |
|
|
94
|
+
| **公開** | `publish/publish-docs.mjs` | ドキュメントをDiscuss Kitインスタンスに公開するプロセスを管理します。 |
|
|
95
|
+
| **データI/O** | `utils/load-sources.mjs`, `utils/save-docs.mjs` | ソースファイルの読み込みと、最終的なマークダウンドキュメントのディスクへの書き込みを担当します。 |
|
|
96
96
|
|
|
97
|
-
この
|
|
97
|
+
このagentベースのアーキテクチャにより、ドキュメント化プロセスの各ステップを専門のツールで処理できるため、構造化され、保守可能なワークフローが保証されます。
|
|
98
98
|
|
|
99
99
|
---
|
|
100
100
|
|
|
101
|
-
DocSmith
|
|
101
|
+
DocSmithが出力の正確性と形式を保証するために講じている対策を理解するには、[品質保証](./advanced-quality-assurance.md)のセクションに進んでください。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# How It Works
|
|
2
2
|
|
|
3
|
-
AIGNE DocSmith operates on a multi-agent system
|
|
3
|
+
AIGNE DocSmith operates on a multi-agent system. Instead of a single monolithic process, it orchestrates a pipeline of specialized AI agents, where each agent is responsible for a specific task. This approach allows for a structured and modular process that transforms source code into complete documentation.
|
|
4
4
|
|
|
5
5
|
The tool is an integral part of the larger AIGNE ecosystem, which provides a platform for developing and deploying AI applications.
|
|
6
6
|
|
|
@@ -85,14 +85,14 @@ User-Feedback -> Pipeline.Content-Generation: "Regenerate Content"
|
|
|
85
85
|
|
|
86
86
|
DocSmith's functionality is provided by a collection of agents defined in the project's configuration. Each agent has a specific role. The table below lists some of the key agents and their functions.
|
|
87
87
|
|
|
88
|
-
| Functional Role
|
|
89
|
-
|
|
|
90
|
-
| **Structure Planning**
|
|
91
|
-
| **Structure Refinement** | `generate/refine-document-structure.yaml`
|
|
92
|
-
| **Content Generation**
|
|
93
|
-
| **Translation**
|
|
94
|
-
| **Publishing**
|
|
95
|
-
| **Data I/O**
|
|
88
|
+
| Functional Role | Key Agent Files | Description |
|
|
89
|
+
| :--- | :--- | :--- |
|
|
90
|
+
| **Structure Planning** | `generate/generate-structure.yaml` | Analyzes source code to propose the initial document outline. |
|
|
91
|
+
| **Structure Refinement** | `generate/refine-document-structure.yaml` | Modifies the documentation structure based on user feedback. |
|
|
92
|
+
| **Content Generation** | `update/batch-generate-document.yaml`, `update/generate-document.yaml` | Populates the documentation structure with detailed content for each section. |
|
|
93
|
+
| **Translation** | `translate/translate-document.yaml`, `translate/translate-multilingual.yaml` | Translates generated documentation into multiple target languages. |
|
|
94
|
+
| **Publishing** | `publish/publish-docs.mjs` | Manages the process of publishing documents to Discuss Kit instances. |
|
|
95
|
+
| **Data I/O** | `utils/load-sources.mjs`, `utils/save-docs.mjs` | Responsible for reading source files and writing the final markdown documents to disk. |
|
|
96
96
|
|
|
97
97
|
This agent-based architecture allows each step of the documentation process to be handled by a specialized tool, ensuring a structured and maintainable workflow.
|
|
98
98
|
|