git-copilot-commit 0.1.17__tar.gz → 0.1.18__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-copilot-commit
3
- Version: 0.1.17
3
+ Version: 0.1.18
4
4
  Summary: Automatically generate and commit changes using copilot
5
5
  Author-email: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
6
6
  License-File: LICENSE
@@ -42,18 +42,39 @@ def main(
42
42
  raise typer.Exit()
43
43
 
44
44
 
45
+ def get_prompt_locations():
46
+ """Get potential prompt file locations in order of preference."""
47
+ import importlib.resources
48
+
49
+ filename = "commit-message-generator-prompt.md"
50
+
51
+ return [
52
+ Path(Settings().data_dir) / "prompts" / filename, # User customizable
53
+ importlib.resources.files("git_copilot_commit") / "prompts" / filename # Packaged version
54
+ ]
55
+
56
+
57
+ def get_active_prompt_path():
58
+ """Get the path of the prompt file that will be used."""
59
+ for path in get_prompt_locations():
60
+ try:
61
+ path.read_text(encoding="utf-8")
62
+ return str(path)
63
+ except (FileNotFoundError, AttributeError):
64
+ continue
65
+ return None
66
+
67
+
45
68
  def load_system_prompt() -> str:
46
69
  """Load the system prompt from the markdown file."""
47
- try:
48
- import importlib.resources
49
-
50
- prompts_dir = importlib.resources.files("git_copilot_commit") / "prompts"
51
- prompt_path = prompts_dir / "commit_message_generator.md"
52
- print(f"Loading system prompt from {prompt_path}")
53
- return prompt_path.read_text(encoding="utf-8")
54
- except (ImportError, FileNotFoundError):
55
- console.print("[red]Error: Prompt file not found[/red]")
56
- raise typer.Exit(1)
70
+ for path in get_prompt_locations():
71
+ try:
72
+ return path.read_text(encoding="utf-8")
73
+ except (FileNotFoundError, AttributeError):
74
+ continue
75
+
76
+ console.print("[red]Error: Prompt file not found in any location[/red]")
77
+ raise typer.Exit(1)
57
78
 
58
79
 
59
80
  def generate_commit_message(
@@ -276,6 +297,12 @@ def config(
276
297
  else:
277
298
  console.print("Default model: [dim]not set[/dim]")
278
299
 
300
+ active_prompt = get_active_prompt_path()
301
+ if active_prompt:
302
+ console.print(f"Active prompt file: [cyan]{active_prompt}[/cyan]")
303
+ else:
304
+ console.print("Active prompt file: [red]not found[/red]")
305
+
279
306
  console.print(f"Config file: [dim]{settings.config_file}[/dim]")
280
307
 
281
308