You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(readme): enhance documentation with installation, workflow and configuration details
- Add installation instructions with marketplace link and CLI command
- Expand typical workflow section with keyboard shortcuts
- Add detailed commands section with keyboard shortcuts
- Include comprehensive configuration options with defaults and ranges
- Add error handling section with categorized error scenarios
- Update development section with clearer instructions
- Add hyperlinks for external resources
- Improve formatting and readability with keyboard shortcut styling
Copy file name to clipboardExpand all lines: README.md
+74-41Lines changed: 74 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Diff Commit
2
2
3
-
Diff Commit is a VSCode extension that helps you generate commit messages following the conventional commits specification using Anthropic's AI models like Claude 3.5 Sonnet. Commit messages are generated using the diff of staged changes and entered directly into the SCM message input.
3
+
Diff Commit is a VSCode extension that helps you generate commit messages following the conventional commits specification using Anthropic's AI models like Claude 3.5 Sonnet. Commit messages are generated using the diff of staged changes and entered directly into the SCM message input or previewed in a new editor window.
4
4
5
-
The generated commit messages are compatible with googleapis/release-please and other tools that use conventional commits.
5
+
The generated commit messages are compatible with [googleapis/release-please](https://github.com/googleapis/release-please) and other tools that use conventional commits.
6
6
7
7
## Features
8
8
@@ -15,68 +15,101 @@ The generated commit messages are compatible with googleapis/release-please and
15
15
16
16
- VSCode 1.9.4 or higher
17
17
- Git installed and configured in your workspace
18
-
- An Anthropic API key for accessing Claude 3.5 AI
18
+
- An [Anthropic API key](https://console.anthropic.com/settings/keys)
19
19
20
-
## Usage
20
+
## Installation
21
21
22
-
1. Stage your changes in Git
23
-
2. Open the Command Palette (Cmd/Ctrl + Shift + P)
24
-
3. Run the command: "DiffCommit :: Generate Commit Message"
25
-
4. Enter your Anthropic API key when prompted for message generation
22
+
Install the extension directly from the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=tpsTech.diff-commit) or:
2. Open the Command Palette (<kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>)
32
+
3. Run the command: "DiffCommit: Generate Commit Message" (<kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>K</kbd> then <kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>G</kbd>)
33
+
4. Enter your Anthropic API key when prompted (_first time only_)
26
34
5. Review the generated commit message in the Source Control message input
27
35
6. Edit the commit message if necessary
28
36
7. Click 'Commit' to commit the changes with the generated message
29
37
30
-
## Configuration
38
+
## Commands
31
39
32
-
The extension provides the following settings:
40
+
Access DiffCommit commands from the Command Palette (<kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>) or using the keyboard shortcuts:
33
41
34
-
-`diffCommit.model`: The Anthropic AI model to use for generating commit messages. (Default: "claude-3-5-sonnet-20241022", Options: "claude-3-5-sonnet-latest", "claude-3-opus-latest", "claude-3-sonnet-20240229", "claude-3-haiku-20240307")
35
-
-`diffCommit.maxTokens`: Maximum number of tokens to generate in the response. Higher values allow for longer commit messages but use more API tokens. (Default: 1024, Range: 1-8192)
36
-
-`diffCommit.temperature`: Controls randomness in the response. Lower values (like 0.4) produce more focused and consistent commit messages, while higher values introduce more variety. (Default: 0.4, Range: 0-1)
42
+
-`DiffCommit: Generate Commit Message`: Generate a commit message for staged changes and enter it in the Source Control message input
43
+
- macOS: <kbd>Cmd</kbd> + <kbd>K</kbd> then <kbd>Cmd</kbd> + <kbd>G</kbd>
44
+
- Windows/Linux: <kbd>Ctrl</kbd> + <kbd>K</kbd> then <kbd>Ctrl</kbd> + <kbd>G</kbd>
45
+
-`DiffCommit: Preview Commit Message`: Generate a commit message for staged changes and preview it in an editor window
46
+
- macOS: <kbd>Cmd</kbd> + <kbd>K</kbd> then <kbd>Cmd</kbd> + <kbd>P</kbd>
47
+
- Windows/Linux: <kbd>Ctrl</kbd> + <kbd>K</kbd> then <kbd>Ctrl</kbd> + <kbd>P</kbd>
48
+
-`DiffCommit: Update API Key`: Update the Anthropic API key used for API access
49
+
-`DiffCommit: Delete API Key`: Remove the stored Anthropic API key
50
+
51
+
## Configuration
52
+
53
+
This extension provides the following settings:
54
+
55
+
-`diffCommit.allowedTypes`: List of allowed commit types. If provided, this replaces the default options.
-`diffCommit.customInstructions`: Add additional custom instructions to the commit generation prompt. Useful for providing context or specific requirements like 'Use Australian English spelling'.
59
+
- Default: ""
60
+
-`diffCommit.model`: The Anthropic AI model to use for generating commit messages.
-`diffCommit.maxTokens`: Maximum number of tokens to generate in the response. Higher values allow for longer commit messages but use more API tokens.
64
+
- Default: 1024
65
+
- Range: 1 - 8192
66
+
-`diffCommit.temperature`: Controls randomness in the response. Lower values (like 0.4) produce more focused and consistent commit messages, while higher values introduce more variety.
67
+
- Default: 0.4
68
+
- Range: 0 - 1
37
69
38
70
## Error Handling
39
71
40
-
Diff Commit includes comprehensive error handling to provide clear feedback and assist in troubleshooting. Here are some common error scenarios and their meanings:
72
+
Diff Commit includes comprehensive error handling to provide clear feedback and assist in troubleshooting. Here are the common error scenarios you might encounter:
73
+
74
+
### Git Related
75
+
76
+
- Git extension not found in VSCode
77
+
- No Git repository found in the current workspace
78
+
- No workspace folder found
79
+
- No staged changes detected
41
80
42
-
-`GIT_EXTENSION_NOT_FOUND`: The VSCode Git extension is not installed or activated
43
-
-`NO_GIT_REPO`: No Git repository was found in the current workspace
44
-
-`NO_STAGED_CHANGES`: There are no staged changes to generate a commit message for
45
-
-`API_KEY_MISSING`: The Anthropic API key was not provided
46
-
-`API_REQUEST_FAILED`: The request to the Anthropic API failed. Check your internet connection and API key
47
-
-`API_NO_RESPONSE`: No response was received from the Anthropic API
48
-
-`API_REQUEST_SETUP_ERROR`: An error occurred while setting up the API request
49
-
-`UNKNOWN_ERROR`: An unexpected error occurred
81
+
### API Key Related
50
82
51
-
If you encounter any of these errors, the extension will display a message with more details. For persistent issues, please check your setup or contact support.
83
+
- API key is missing or not provided
84
+
- Invalid API key format (should start with sk-ant-api)
85
+
- Failed to access or update secure storage
52
86
53
-
##Development
87
+
### Anthropic API Errors
54
88
55
-
### Setup
89
+
- Bad Request (400): Review your prompt and try again
90
+
- Unauthorized (401): Invalid API key, please update and try again
91
+
- Forbidden (403): Permission denied, review your API key
92
+
- Rate Limited (429): Too many requests, try again later
93
+
- Server Error (500): Anthropic API server error
56
94
57
-
1. Clone the repository
58
-
2. Install dependencies:
59
-
```bash
60
-
pnpm install
61
-
```
95
+
### Other Errors
62
96
63
-
### Building
97
+
- Failed to write commit message to Source Control
98
+
- Failed to open commit message preview
99
+
- No commit message was generated by the API
64
100
65
-
Build the extension:
66
-
```bash
67
-
pnpm compile
68
-
```
101
+
If you encounter any of these errors, the extension will display a message with more details. For persistent issues, please check your setup or raise an issue on [GitHub](https://github.com/tsdevau/diff-commit/issues).
69
102
70
-
### Running Tests
103
+
##Local Development
71
104
72
-
Run the tests using:
73
-
```bash
74
-
pnpm test
75
-
```
105
+
1. Clone the [repository](https://github.com/tsdevau/diff-commit)
106
+
2. Install dependencies: `pnpm install`
107
+
3. Build the extension: `pnpm compile`
108
+
4. Run the tests: `pnpm test`
76
109
77
110
### Local Testing
78
111
79
-
1. Press F5 or start the debugger in VSCode to start debugging
112
+
1. Press F5 (<kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and select `Debug: Start Debugging`) to start the debugger
80
113
2. This will open a new VSCode window with the extension loaded
81
114
3. Make changes to files and use the source control panel to test the extension
0 commit comments