git-copilot-commit 0.1.19__tar.gz → 0.1.20__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.
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/PKG-INFO +1 -1
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/src/git_copilot_commit/cli.py +53 -4
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/.github/workflows/ci.yml +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/.gitignore +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/.python-version +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/LICENSE +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/README.md +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/pyproject.toml +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/src/git_copilot_commit/__init__.py +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/src/git_copilot_commit/git.py +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/src/git_copilot_commit/prompts/commit-message-generator-prompt.md +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/src/git_copilot_commit/py.typed +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/src/git_copilot_commit/settings.py +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/src/git_copilot_commit/version.py +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/uv.lock +0 -0
- {git_copilot_commit-0.1.19 → git_copilot_commit-0.1.20}/vhs/demo.vhs +0 -0
|
@@ -3,6 +3,7 @@ git-copilot-commit - AI-powered Git commit assistant
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import rich.terminal_theme
|
|
6
|
+
import sys
|
|
6
7
|
import typer
|
|
7
8
|
from rich.console import Console
|
|
8
9
|
from rich.prompt import Confirm
|
|
@@ -39,12 +40,14 @@ def main(
|
|
|
39
40
|
"""
|
|
40
41
|
if ctx.invoked_subcommand is None:
|
|
41
42
|
# Show help when no command is provided
|
|
42
|
-
print(ctx.get_help())
|
|
43
|
+
console.print(ctx.get_help())
|
|
43
44
|
raise typer.Exit()
|
|
44
45
|
else:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
# Don't show version for print command to avoid interfering with pipes
|
|
47
|
+
if ctx.invoked_subcommand != "echo":
|
|
48
|
+
console.print(
|
|
49
|
+
f"[bold]{(__package__ or 'git_copilot_commit').replace('_', '-')}[/] - [bold blue]v{__version__}[/]\n"
|
|
50
|
+
)
|
|
48
51
|
|
|
49
52
|
|
|
50
53
|
def get_prompt_locations():
|
|
@@ -319,5 +322,51 @@ def config(
|
|
|
319
322
|
console.print(f"Config file: [dim]{settings.config_file}[/dim]")
|
|
320
323
|
|
|
321
324
|
|
|
325
|
+
@app.command()
|
|
326
|
+
def echo(
|
|
327
|
+
model: str | None = typer.Option(
|
|
328
|
+
None, "--model", "-m", help="Model to use for generating commit message"
|
|
329
|
+
),
|
|
330
|
+
):
|
|
331
|
+
"""
|
|
332
|
+
Generate commit message from stdin input (useful for pipes).
|
|
333
|
+
"""
|
|
334
|
+
# Read from stdin
|
|
335
|
+
input_text = sys.stdin.read()
|
|
336
|
+
|
|
337
|
+
if not input_text.strip():
|
|
338
|
+
console.print("[red]Error: No input provided via stdin[/red]")
|
|
339
|
+
raise typer.Exit(1)
|
|
340
|
+
|
|
341
|
+
# Load settings and use default model if none provided
|
|
342
|
+
settings = Settings()
|
|
343
|
+
if model is None:
|
|
344
|
+
model = settings.default_model
|
|
345
|
+
|
|
346
|
+
# Load system prompt and create client
|
|
347
|
+
system_prompt = load_system_prompt()
|
|
348
|
+
client = Copilot(system_prompt=system_prompt)
|
|
349
|
+
|
|
350
|
+
# Generate commit message from the input
|
|
351
|
+
prompt = f"""
|
|
352
|
+
git diff:
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
{input_text.strip()}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Generate a conventional commit message based on the input above:"""
|
|
359
|
+
|
|
360
|
+
try:
|
|
361
|
+
response = client.ask(prompt, model=model) if model else client.ask(prompt)
|
|
362
|
+
# Print the commit message directly to stdout (no rich formatting for pipes)
|
|
363
|
+
import builtins
|
|
364
|
+
|
|
365
|
+
builtins.print(response.content)
|
|
366
|
+
except CopilotAPIError as e:
|
|
367
|
+
console.print(f"[red]Error generating commit message: {e}[/red]")
|
|
368
|
+
raise typer.Exit(1)
|
|
369
|
+
|
|
370
|
+
|
|
322
371
|
if __name__ == "__main__":
|
|
323
372
|
app()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|