release-with-ease 2.0.0 → 2.0.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/bin/release-with-ease.js +7 -2
- package/package.json +1 -1
package/bin/release-with-ease.js
CHANGED
|
@@ -82,7 +82,11 @@ async function askClaudeForRelease(commits) {
|
|
|
82
82
|
'You are a release assistant. Given recent git commits, decide one of: major, minor, or patch following semver. Consider conventional commits, breaking changes, and scope. Also generate concise release notes for a public changelog. Respond with JSON containing "bump" (major/minor/patch), "reasoning" (brief explanation for version bump), and "notes" (array of 3-8 short bullet points of the most important user-facing changes). Use present tense for release notes (e.g. "Add script" not "Added script" or "Adds script"). Do not wrap the JSON in ```json or anything else.';
|
|
83
83
|
|
|
84
84
|
const userContent = commits
|
|
85
|
-
.map(c =>
|
|
85
|
+
.map(c => {
|
|
86
|
+
const body = c.body ? c.body.trim() : '';
|
|
87
|
+
const truncatedBody = body.length > 500 ? body.slice(0, 500) + '…' : body;
|
|
88
|
+
return `- ${c.subject}\n${truncatedBody}`;
|
|
89
|
+
})
|
|
86
90
|
.join('\n');
|
|
87
91
|
|
|
88
92
|
const res = await fetch('https://api.anthropic.com/v1/messages', {
|
|
@@ -107,7 +111,8 @@ async function askClaudeForRelease(commits) {
|
|
|
107
111
|
);
|
|
108
112
|
}
|
|
109
113
|
const data = await res.json();
|
|
110
|
-
const
|
|
114
|
+
const raw = (data.content?.[0]?.text || '').trim();
|
|
115
|
+
const content = raw.replace(/^```(?:json)?\s*\n?/, '').replace(/\n?```\s*$/, '');
|
|
111
116
|
|
|
112
117
|
const parsed = JSON.parse(content);
|
|
113
118
|
if (!parsed.bump || !['major', 'minor', 'patch'].includes(parsed.bump)) {
|