Skip to content

Commit f9586bb

Browse files
committed
docs: Enhance README with comprehensive workflow examples and tool integrations
Expanded documentation to provide more detailed usage scenarios, demonstrate AI-powered development workflows, and showcase the versatility of the context generation tools. Added examples for bug fixing, code refactoring, custom prompt creation, and tool integration across different development tasks.
1 parent 8e78526 commit f9586bb

File tree

1 file changed

+75
-8
lines changed

1 file changed

+75
-8
lines changed

README.md

Lines changed: 75 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Minimalistic AI Coding Assistant
22

3-
A collection of lightweight Bash scripts to enhance your coding workflow with AI assistance.
3+
A collection of lightweight Bash scripts to enhance your coding workflow with AI assistance. These tools integrate seamlessly with your terminal workflow, allowing you to leverage AI models without disrupting your development process.
44

55
## Overview
66

@@ -56,11 +56,59 @@ Generates git-related context to help LLMs create meaningful commit messages.
5656

5757
## Usage Workflows
5858

59-
### Scenario: Code Refactoring
59+
### Unix-style Pipelines
6060

61-
1. Generate context from your code:
61+
These tools are designed to work seamlessly in Unix pipelines, allowing you to create powerful workflows with minimal effort:
62+
63+
```bash
64+
# Copy code context directly to clipboard (macOS)
65+
./context --files="src/api/*.js" | pbcopy
66+
67+
# Generate and apply code changes directly from clipboard (macOS)
68+
pbpaste | ./apply-md
69+
70+
# Auto-generate commit message using an LLM CLI tool
71+
git commit -am "$(./git-context | llm -m openrouter/anthropic/claude-3.5-haiku)" -e
72+
73+
# Stream context to an LLM and apply changes in one command
74+
./context --files="src/components/Button.js" | llm "Refactor this component to use hooks" | ./apply-md
75+
```
76+
77+
### Scenario: Bug Fix Workflow
78+
79+
Let's walk through a complete workflow for fixing a bug:
80+
81+
1. Identify the files involved in the bug:
82+
```bash
83+
# Generate context for the relevant files
84+
./context --files="src/utils/validation.js" --files="src/components/Form.js" --depth=1 | pbcopy
85+
```
86+
87+
2. Paste the context into your preferred AI assistant's web UI with your request:
88+
"There's a bug where form validation fails when empty strings are submitted. Please fix it."
89+
90+
3. Copy the AI's response and apply the suggested changes:
91+
```bash
92+
pbpaste | ./apply-md --dry-run # Preview changes
93+
pbpaste | ./apply-md # Apply changes
94+
```
95+
96+
4. Generate an appropriate commit message:
6297
```bash
63-
./context --files="src/utils/parser.js" --depth=1 > parser_context.txt
98+
# Auto-generate semantically meaningful commit message
99+
./git-context --diff | llm "Generate a conventional commit message" | git commit -F -
100+
101+
# Or with manual editing
102+
git commit -am "$(./git-context | llm "Write a commit message")" -e
103+
```
104+
105+
### Scenario: Code Refactoring with Git Integration
106+
107+
When working on larger refactoring tasks:
108+
109+
1. Generate context with git history for better understanding:
110+
```bash
111+
./context --files="src/utils/parser.js" --depth=1 --include-git --git-depth=5 > parser_context.txt
64112
```
65113

66114
2. Send the context to an LLM with your request (e.g., "Refactor this parser to improve performance")
@@ -72,17 +120,36 @@ Generates git-related context to help LLMs create meaningful commit messages.
72120
cat response.md | ./apply-md
73121
```
74122

75-
4. Generate commit context:
123+
4. Generate commit context and message in one step:
76124
```bash
77-
./git-context --diff --prompt > commit_context.txt
125+
git commit -am "$(./git-context --diff --conventional | llm "Generate a detailed commit message")" -e
78126
```
79127

80-
5. Get a commit message from the LLM and commit your changes
81-
82128
## Customization
83129

84130
All prompts used in the scripts are stored in the `prompts/` directory as text files, making them easy to customize for your specific needs.
85131

132+
### Custom Prompts
133+
134+
You can create your own prompt templates for different scenarios:
135+
136+
```bash
137+
# Create a custom prompt for code review
138+
echo "Please review this code and identify potential bugs and security issues." > prompts/review_prompt.txt
139+
140+
# Use your custom prompt with the context generator
141+
./context --files="src/*.js" | cat - prompts/review_prompt.txt | llm
142+
```
143+
144+
### Integration with Other Tools
145+
146+
These scripts are designed to work with various LLM CLI tools and other Unix utilities:
147+
148+
- **LLM CLI tools**: `llm`, `sgpt`, `chatgpt-cli`, etc.
149+
- **Clipboard utilities**: `pbcopy`/`pbpaste` (macOS), `xclip` (Linux)
150+
- **Text processing**: `sed`, `awk`, `grep`, etc.
151+
- **Version control**: `git`
152+
86153
## Contributing
87154

88155
Contributions are welcome! Feel free to submit a pull request or open an issue to suggest improvements.

0 commit comments

Comments
 (0)