crub 0.1.0__tar.gz

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.
crub-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alexander Yoo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
crub-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,372 @@
1
+ Metadata-Version: 2.4
2
+ Name: crub
3
+ Version: 0.1.0
4
+ Summary: crub - CLI for AI-assisted development with PR workflows
5
+ Author-email: Alex Yoo <alkyyo03@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/alexanderkyoo/crub
8
+ Project-URL: Repository, https://github.com/alexanderkyoo/crub
9
+ Project-URL: Issues, https://github.com/alexanderkyoo/crub/issues
10
+ Keywords: code-review,ai,github,cli,pull-request
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: PyGithub>=2.0.0
21
+ Requires-Dist: keyring>=24.0.0
22
+ Requires-Dist: click>=8.0.0
23
+ Dynamic: license-file
24
+
25
+ # crub
26
+
27
+ **crub** (Code Review User Experience) is a CLI tool that streamlines AI-assisted development with proper code review workflows. It enforces a PR-based review process for AI-generated code, ensuring changes go through proper review before merging.
28
+
29
+ ## What It Does
30
+
31
+ crub manages the full lifecycle of AI-assisted feature development:
32
+
33
+ 1. **Instruct** the agent with project-specific guidance
34
+ 2. **Create** a feature branch
35
+ 3. **Work** on it using AI coding tools (or manually)
36
+ 4. **Submit** changes as a GitHub PR
37
+ 5. **Review** and address PR feedback automatically with AI
38
+ 6. **Wrap up** by cleaning branches after merge
39
+
40
+ ## Why Use crub?
41
+
42
+ - **Enforces code review**: AI-generated code goes through PRs, not directly to main
43
+ - **Tool agnostic**: Works with any AI coding tool (Claude Code, Cursor, Copilot, etc.)
44
+ - **Automates PR feedback**: AI can automatically address review comments
45
+ - **Simple workflow**: Familiar git-style commands
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install crub
51
+ ```
52
+
53
+ Or install from source:
54
+
55
+ ```bash
56
+ git clone https://github.com/alexanderkyoo/crub.git
57
+ cd crub
58
+ pip install -e .
59
+ ```
60
+
61
+ ## Setup
62
+
63
+ ### 1. GitHub Authentication
64
+
65
+ crub needs a GitHub Personal Access Token (PAT) to create and manage PRs.
66
+
67
+ **Create a token:**
68
+ 1. Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
69
+ 2. Generate new token with:
70
+ - `repo` (for private repos)
71
+ - `public_repo` is enough for public-only workflows
72
+
73
+ **Configure crub:**
74
+ - No explicit login command is required.
75
+ - On first GitHub action (`submit`, `review`, `wrap`, `status`), crub prompts for a token and stores it in your keyring.
76
+ - To clear a saved token: `crub auth clear`
77
+
78
+ ### 2. Configure Your AI Tool
79
+
80
+ crub works with any AI coding CLI tool. Set the `CRUB_AI_COMMAND` environment variable to your preferred tool:
81
+
82
+ ```bash
83
+ # For Claude Code
84
+ export CRUB_AI_COMMAND="claude-code {instruction}"
85
+
86
+ # For Cursor CLI (if available)
87
+ export CRUB_AI_COMMAND="cursor --ai {instruction}"
88
+
89
+ # For a custom wrapper script
90
+ export CRUB_AI_COMMAND="my-ai-wrapper {instruction}"
91
+ ```
92
+
93
+ Add this to your `~/.bashrc` or `~/.zshrc` to make it permanent.
94
+
95
+ If `{instruction}` is present, crub replaces it with your instruction text.
96
+ If `{instruction}` is omitted, crub appends the instruction as the last argument.
97
+
98
+ ## Usage
99
+
100
+ ### Basic Workflow
101
+
102
+ ```bash
103
+ # 1. Print project guidance for the agent
104
+ crub instruct
105
+
106
+ # 2. Create a new feature branch
107
+ crub create auth-feature
108
+
109
+ # 3. Do your work (use your AI tool directly, or work manually)
110
+ # Your AI tool makes changes, you review them locally
111
+
112
+ # 4. Submit a PR when ready
113
+ crub submit
114
+
115
+ # 5. Address review comments automatically
116
+ crub review
117
+ ```
118
+
119
+ ### Commands
120
+
121
+ #### `crub`
122
+
123
+ Shows the guided workflow help screen.
124
+
125
+ #### `crub instruct`
126
+
127
+ Prints `AGENT_GUIDE.md` from the current repository root.
128
+
129
+ ```bash
130
+ crub instruct
131
+ ```
132
+
133
+ #### `crub create <branch-name>`
134
+
135
+ Creates a new branch and switches to it.
136
+
137
+ ```bash
138
+ crub create user-authentication
139
+ ```
140
+
141
+ #### `crub submit [branch-name] [--base <target-branch>]`
142
+
143
+ Creates a GitHub PR from your branch.
144
+
145
+ ```bash
146
+ # Submit current branch to main (default)
147
+ crub submit
148
+
149
+ # Submit specific branch
150
+ crub submit auth-feature
151
+
152
+ # Submit to a different base branch
153
+ crub submit auth-feature --base develop
154
+ ```
155
+
156
+ The PR title defaults to your latest commit message. The branch is automatically pushed to GitHub.
157
+
158
+ #### `crub revise <branch-name> "<instruction>"`
159
+
160
+ Manually instruct the AI to make changes.
161
+
162
+ ```bash
163
+ crub revise auth-feature "convert all variable names to camelCase"
164
+ crub revise auth-feature "add error handling to the login function"
165
+ ```
166
+
167
+ Changes are automatically committed and pushed.
168
+
169
+ #### `crub review [branch-name] [--pr <number>] [--comment]`
170
+
171
+ Automatically addresses PR review comments using AI.
172
+
173
+ ```bash
174
+ # Review current branch's PR
175
+ crub review
176
+
177
+ # Review specific branch
178
+ crub review auth-feature
179
+
180
+ # If multiple PRs exist for the branch
181
+ crub review auth-feature --pr 123
182
+
183
+ # Add a comment on the PR after pushing changes
184
+ crub review --comment
185
+ ```
186
+
187
+ The AI fetches all PR comments, makes the requested changes, commits, and pushes.
188
+
189
+ #### `crub status [branch-name]`
190
+
191
+ Shows current (or specified) branch and associated PR(s).
192
+
193
+ ```bash
194
+ # Status for current branch
195
+ crub status
196
+
197
+ # Status for a specific branch
198
+ crub status auth-feature
199
+ ```
200
+
201
+ #### `crub wrap [branch-name] [--pr <number>]`
202
+
203
+ Cleans up branches after a PR is merged.
204
+
205
+ ```bash
206
+ # Wrap up current branch
207
+ crub wrap
208
+
209
+ # Wrap up specific branch
210
+ crub wrap auth-feature
211
+ ```
212
+
213
+ This command:
214
+ - Verifies the PR is actually merged
215
+ - Switches to the base branch
216
+ - Deletes local and remote branches
217
+ - Keeps you on the base branch
218
+
219
+ #### `crub auth clear`
220
+
221
+ Removes your stored GitHub token.
222
+
223
+ ```bash
224
+ crub auth clear
225
+ ```
226
+
227
+ ## Advanced Usage
228
+
229
+ ### Working with Stacked PRs
230
+
231
+ If you're working on a feature that builds on another unmerged feature:
232
+
233
+ ```bash
234
+ # Create base feature
235
+ crub create feature-1
236
+ # ... work on it ...
237
+ crub submit
238
+
239
+ # Create dependent feature
240
+ crub create feature-2
241
+ # ... work on it ...
242
+
243
+ # Submit as a stacked PR (targets feature-1, not main)
244
+ crub submit --base feature-1
245
+ ```
246
+
247
+ ### Using Different AI Tools
248
+
249
+ You can switch AI tools by changing the `CRUB_AI_COMMAND` environment variable:
250
+
251
+ ```bash
252
+ # Try a different tool for this session
253
+ CRUB_AI_COMMAND="aider {instruction}" crub revise my-branch "refactor for clarity"
254
+ ```
255
+
256
+ ### Multiple PRs for One Branch
257
+
258
+ If you have multiple PRs from the same branch (e.g., to different base branches):
259
+
260
+ ```bash
261
+ # crub will error and ask you to specify which PR
262
+ crub review my-branch --pr 123
263
+ ```
264
+
265
+ ## Configuration
266
+
267
+ ### Environment Variables
268
+
269
+ - `CRUB_AI_COMMAND`: Your AI CLI command (required for `revise` and `review`)
270
+ - `{instruction}` placeholder is optional
271
+ - Example: `"claude-code {instruction}"`
272
+
273
+ ### GitHub Token Storage
274
+
275
+ Tokens are stored securely using your system's keyring:
276
+ - macOS: Keychain
277
+ - Linux: Secret Service API / KWallet
278
+ - Windows: Windows Credential Locker
279
+
280
+ ## Examples
281
+
282
+ ### Example 1: Simple Feature Development
283
+
284
+ ```bash
285
+ # Start new feature
286
+ crub create user-profile
287
+
288
+ # Use your AI tool directly to build the feature
289
+ claude-code "implement user profile page with avatar upload"
290
+
291
+ # Submit for review
292
+ crub submit
293
+
294
+ # Teammate leaves comments asking for changes
295
+ # Address them automatically
296
+ crub review --comment
297
+
298
+ # After PR is merged
299
+ crub wrap
300
+ ```
301
+
302
+ ### Example 2: Quick Fix with AI Revision
303
+
304
+ ```bash
305
+ # Create fix branch
306
+ crub create fix-typos
307
+
308
+ # Make a quick change with AI
309
+ crub revise fix-typos "fix all typos in README.md"
310
+
311
+ # Submit
312
+ crub submit
313
+ ```
314
+
315
+ ### Example 3: Complex Multi-Step Feature
316
+
317
+ ```bash
318
+ # Start feature
319
+ crub create payment-integration
320
+
321
+ # Work iteratively with AI
322
+ crub revise payment-integration "add Stripe SDK and basic setup"
323
+ crub revise payment-integration "implement checkout flow"
324
+ crub revise payment-integration "add error handling and logging"
325
+
326
+ # Submit for review
327
+ crub submit
328
+
329
+ # Address review feedback
330
+ crub review --comment
331
+
332
+ # After merge
333
+ crub wrap
334
+ ```
335
+
336
+ ## Requirements
337
+
338
+ - Python 3.10+
339
+ - Git
340
+ - GitHub account with repository access
341
+ - An AI coding tool (Claude Code, Cursor, etc.) - optional but recommended
342
+
343
+ ## Troubleshooting
344
+
345
+ **"Not inside a git repository"**
346
+ - Make sure you're in a git repository directory
347
+ - Run `git init` if starting a new project
348
+
349
+ **"Missing remote.origin.url"**
350
+ - Your git repo needs a GitHub remote
351
+ - Add one: `git remote add origin git@github.com:username/repo.git`
352
+
353
+ **"Set CRUB_AI_COMMAND to your AI CLI"**
354
+ - You need to configure which AI tool to use
355
+ - Set the environment variable: `export CRUB_AI_COMMAND="your-tool {instruction}"`
356
+
357
+ **"No open PR found for branch"**
358
+ - You need to create a PR first with `crub submit`
359
+ - Or the PR might be closed/merged already
360
+
361
+ **Authentication errors**
362
+ - Run `crub auth clear` to remove the cached token
363
+ - Re-run any GitHub command (`crub submit`, `crub status`, etc.) to enter a new token
364
+ - Make sure your token has `repo` permissions
365
+
366
+ ## Contributing
367
+
368
+ Issues and pull requests welcome! This tool is designed to be simple and focused.
369
+
370
+ ## License
371
+
372
+ MIT