Skip to content

Commit c39a797

Browse files
committed
Release analyzer: Node-safe diff sizing; configurable Claude model default
1 parent 22e74e2 commit c39a797

File tree

1 file changed

+8
-7
lines changed
  • docusaurus/scripts/strapi-release-analyzer

1 file changed

+8
-7
lines changed

docusaurus/scripts/strapi-release-analyzer/index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const STRAPI_REPO_OWNER = 'strapi';
1414
const STRAPI_REPO_NAME = 'strapi';
1515
const DOC_REPO_OWNER = 'strapi';
1616
const DOC_REPO_NAME = 'documentation';
17-
const CLAUDE_MODEL = 'claude-sonnet-4-5-20250929';
17+
// Default Claude model; override with env CLAUDE_MODEL or --model flag
18+
const CLAUDE_MODEL = process.env.CLAUDE_MODEL || 'claude-3-5-sonnet-latest';
1819

1920
const octokit = new Octokit({
2021
auth: GITHUB_TOKEN,
@@ -163,14 +164,14 @@ async function generateDocSuggestionsWithClaude(prAnalysis) {
163164
.map(f => `### File: ${f.filename}\n\`\`\`diff\n${f.patch}\n\`\`\``)
164165
.join('\n\n');
165166

166-
const diffSize = new Blob([diffSummary]).size;
167-
if (diffSize > 100000) {
167+
const diffSize = Buffer.byteLength(diffSummary, 'utf8');
168+
if (diffSize > 100000) {
168169
console.log(` ⚠️ Diff too large (${Math.round(diffSize / 1024)}KB), truncating...`);
169170
}
170171

171-
const truncatedDiff = diffSize > 100000
172-
? diffSummary.substring(0, 100000) + '\n\n... (diff truncated due to size)'
173-
: diffSummary;
172+
const truncatedDiff = diffSize > 100000
173+
? diffSummary.slice(0, 100000) + '\n\n... (diff truncated due to size)'
174+
: diffSummary;
174175

175176
const prompt = `You are a technical documentation analyst for Strapi CMS. Your expertise is in identifying documentation gaps and suggesting precise updates.
176177
@@ -651,4 +652,4 @@ async function main() {
651652
}
652653
}
653654

654-
main();
655+
main();

0 commit comments

Comments
 (0)