Skip to content

Commit 7190aa2

Browse files
committed
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
1 parent e6a7727 commit 7190aa2

File tree

1 file changed

+74
-41
lines changed

1 file changed

+74
-41
lines changed

README.md

Lines changed: 74 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Diff Commit
22

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.
44

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.
66

77
## Features
88

@@ -15,68 +15,101 @@ The generated commit messages are compatible with googleapis/release-please and
1515

1616
- VSCode 1.9.4 or higher
1717
- 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)
1919

20-
## Usage
20+
## Installation
2121

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:
23+
24+
1. Open VSCode
25+
2. Press <kbd>Cmd</kbd>/<kbd>Ctrl</kbd> + <kbd>P</kbd>
26+
3. Type `ext install tpsTech.diff-commit`
27+
28+
## Typical Workflow
29+
30+
1. Stage your changes in Source Control
31+
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_)
2634
5. Review the generated commit message in the Source Control message input
2735
6. Edit the commit message if necessary
2836
7. Click 'Commit' to commit the changes with the generated message
2937

30-
## Configuration
38+
## Commands
3139

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:
3341

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.
56+
- Default: [ "feat", "fix", "refactor", "chore", "docs", "style", "test", "perf", "ci" ]
57+
- Options: Array<string>
58+
- `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.
61+
- Default: "claude-3-5-sonnet-latest"
62+
- Options: "claude-3-opus-latest" | "claude-3-sonnet-20240229" | "claude-3-haiku-20240307"
63+
- `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
3769

3870
## Error Handling
3971

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
4180

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
5082

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
5286

53-
## Development
87+
### Anthropic API Errors
5488

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
5694

57-
1. Clone the repository
58-
2. Install dependencies:
59-
```bash
60-
pnpm install
61-
```
95+
### Other Errors
6296

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
64100

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).
69102

70-
### Running Tests
103+
## Local Development
71104

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`
76109

77110
### Local Testing
78111

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
80113
2. This will open a new VSCode window with the extension loaded
81114
3. Make changes to files and use the source control panel to test the extension
82115

0 commit comments

Comments
 (0)