From 1a5270d7d6a73170610d0f7de733dc8e7fd430e1 Mon Sep 17 00:00:00 2001 From: Tim Stone Date: Sun, 10 Nov 2024 16:02:19 +1000 Subject: [PATCH 1/2] refactor(config): update commit message generation instructions The commit introduces several improvements to the commit message generation instructions: - Added a detailed `` with comprehensive guidance on when to use each commit type - Enhanced the existing instructions with more nuanced explanations - Improved readability and formatting of the instructions - Added a note about "customInstructions" potentially overriding default instructions - Maintained the core principles of generating concise and meaningful commit messages The changes provide clearer guidance for generating conventional commit messages while preserving the original intent of the configuration. --- src/commitMessageGenerator.ts | 49 +++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/src/commitMessageGenerator.ts b/src/commitMessageGenerator.ts index bf34576..3601ecc 100644 --- a/src/commitMessageGenerator.ts +++ b/src/commitMessageGenerator.ts @@ -14,23 +14,40 @@ export class CommitMessageGenerator { "You are a seasoned software engineer with more than 25 years of experience with an extraordinary ability for assessing and interpreting git diffs and writing detailed conventional commit messages and following 'instructions' and 'customInstructions' when generating them." const prompt = ` - - Generate a detailed conventional commit message for the following Git diff: + +Generate a detailed conventional commit message for the following Git diff: - ${diff} - - - - Use ONLY ${config.allowedTypes.map((val) => `'${val}'`).join(" | ")} as appropriate for the type of change. - - When assessing the commit type, consider the real impact of the change on the codebase and reserve 'feat' for significant changes or true feature additions. - - Always include a scope. - - Never use '!' or 'BREAKING CHANGE' in the commit message. - - Avoid excessive adjectives like 'enhance', 'comprehensive' etc - - Output will use markdown formatting for lists etc. - - Output will ONLY contain the commit message. - - Do not explain the output. - - ${config.customInstructions ? `\n${config.customInstructions}\n` : ""} - `.trim() +${diff} + + +- Use ONLY ${config.allowedTypes.map((val) => `'${val}'`).join(" | ")} as appropriate for the type of change. +- When assessing the commit type, consider actual impact of the commit. Refer to the "type-table" below for further guidance on the default commit types. +- Always include a scope. +- Never use '!' or 'BREAKING CHANGE' in the commit message. +- Avoid excessive adjectives like 'enhance', 'comprehensive' etc +- Output will use markdown formatting for lists etc. +- Output will ONLY contain the commit message. +- Do not explain the output. +- "customInstructions" override these instructions if they are provided and conflict. + + +\`\`\`markdown +| Commit Type | Typical Use Case | When to Use | +| ----------- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| chore | Routine maintenance or updates | Use when updating configs or non-code changes. (eg updating dependencies, modifying configs, updating types, etc.) | +| ci | Continuous integration adjustments | Use when updating CI/CD config files. (eg GitHub Actions, Workflows, Pipelines, etc.) | +| docs | Documentation-only changes | Use only when updating or adding documentation, comments, or README files. (Do NOT use when adding or updating page content in web apps. eg Astro content collections.) | +| feat | New feature | Use only when adding new, user-facing feature or functionality or a fundamental change in an existing feature's functionality. | +| fix | Bug fix | Use when fixing a bug or issue in code that may or may not affect functionality. | +| perf | Performance improvement | Use when improving performance. (eg by optimising code.) | +| refactor | Code restructuring | Use when restructuring code without changing functionality or fixing bugs. (This can include significant code changes like abstracting code to its own component.) | +| style | Code formatting or styling | Use when code changes do not affect functionality. (eg linting, formatting adjustments, colour, margin, padding, etc.) | +| test | Adding or updating tests | Use when adding, updating, or removing tests. | +\`\`\` + + +${config.customInstructions ? `\n${config.customInstructions}\n` : ""} +`.trim() let message: Anthropic.Message | undefined = undefined try { From 27047eb99fd0f157b1cee9b7456e82887e5bdbfb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 16:05:46 +1000 Subject: [PATCH 2/2] =?UTF-8?q?build(main):=20=F0=9F=94=96=20Release=20=20?= =?UTF-8?q?diff-commit=200.3.3=20(#31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [0.3.3](https://github.com/tsdevau/diff-commit/compare/diff-commit-v0.3.2...diff-commit-v0.3.3) (2024-11-10) ### Features, Additions & Updates * **config:** update commit message generation instructions ([1a5270d](https://github.com/tsdevau/diff-commit/commit/1a5270d7d6a73170610d0f7de733dc8e7fd430e1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0477999..6969ddf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.2" + ".": "0.3.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6170ed4..15a600e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.3.3](https://github.com/tsdevau/diff-commit/compare/diff-commit-v0.3.2...diff-commit-v0.3.3) (2024-11-10) + + +### Features, Additions & Updates + +* **config:** update commit message generation instructions ([1a5270d](https://github.com/tsdevau/diff-commit/commit/1a5270d7d6a73170610d0f7de733dc8e7fd430e1)) + ## [0.3.2](https://github.com/tsdevau/diff-commit/compare/diff-commit-v0.3.1...diff-commit-v0.3.2) (2024-11-08) diff --git a/package-lock.json b/package-lock.json index eb64296..c267e6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "diff-commit", - "version": "0.3.2", + "version": "0.3.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "diff-commit", - "version": "0.3.2", + "version": "0.3.3", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.32.1" diff --git a/package.json b/package.json index b3c2288..e4f3b28 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "diff-commit", "displayName": "Diff Commit", - "version": "0.3.2", + "version": "0.3.3", "description": "Generate detailed Git commit messages following the conventional commit specification using Anthropic's AI models like Claude 3.5 Sonnet.", "categories": [ "AI",