Skip to content

Commit 728a579

Browse files
committed
feat: add support for agentic plugin documentation
1 parent 0c972b6 commit 728a579

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

scripts/jsdoc-automation/src/AIService.ts

-7
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ export class AIService {
6464
public async generatePluginDocumentation({
6565
existingDocs,
6666
packageJson,
67-
readmeContent,
6867
todoItems,
6968
envUsages
7069
}: {
7170
existingDocs: ASTQueueItem[];
7271
packageJson: any;
73-
readmeContent?: string;
7472
todoItems: TodoItem[];
7573
envUsages: EnvUsage[];
7674
}): Promise<PluginDocumentation & { todos: string }> {
@@ -91,11 +89,6 @@ export class AIService {
9189
// Generate documentation for evaluators
9290
const evaluatorsDocumentation = await this.generateEvaluatorsDocumentation(exports.evaluators);
9391

94-
95-
// write organizedDocs into a json in /here directory
96-
const jsonPath = path.join(this.configuration.absolutePath, 'here', 'organizedDocs.json');
97-
fs.writeFile(jsonPath, JSON.stringify(organizedDocs, null, 2));
98-
9992
const [overview, installation, configuration, usage, apiRef, troubleshooting, todoSection] = await Promise.all([
10093
this.generateOverview(organizedDocs, packageJson),
10194
this.generateInstallation(packageJson),

scripts/jsdoc-automation/src/PluginDocumentationGenerator.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -34,34 +34,34 @@ export class PluginDocumentationGenerator {
3434
if (!packageJson) {
3535
console.error('package.json not found');
3636
}
37-
38-
// Read existing README if it exists
39-
const readmePath = path.join(this.configuration.absolutePath, 'README-automated.md');
40-
const readmeContent = fs.existsSync(readmePath)
41-
? fs.readFileSync(readmePath, 'utf-8')
42-
: undefined;
43-
4437
// Generate documentation
4538
const documentation = await this.aiService.generatePluginDocumentation({
4639
existingDocs,
4740
packageJson,
48-
readmeContent,
4941
todoItems,
5042
envUsages
5143
});
5244

53-
// Generate and write markdown
45+
// Generate markdown content
5446
const markdownContent = this.generateMarkdownContent(documentation, packageJson);
55-
fs.writeFileSync(readmePath, markdownContent);
5647

57-
// Commit if we're in a branch
48+
// Only commit the file if we're in a branch
5849
if (branchName) {
50+
// Use the configuration's relative path to determine the correct README location
51+
const relativeReadmePath = path.join(
52+
this.configuration.relativePath,
53+
'README-automated.md'
54+
);
55+
56+
// Commit the file to the correct location
5957
await this.gitManager.commitFile(
6058
branchName,
61-
'README.md',
59+
relativeReadmePath,
6260
markdownContent,
6361
'docs: Update plugin documentation'
6462
);
63+
} else {
64+
console.error('No branch name provided, skipping commit for README-automated.md');
6565
}
6666
}
6767

0 commit comments

Comments
 (0)