code-puppy 0.0.31__tar.gz → 0.0.33__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.
Files changed (27) hide show
  1. {code_puppy-0.0.31 → code_puppy-0.0.33}/PKG-INFO +1 -1
  2. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/command_line/prompt_toolkit_completion.py +3 -2
  3. code_puppy-0.0.33/code_puppy/config.py +53 -0
  4. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/main.py +4 -1
  5. {code_puppy-0.0.31 → code_puppy-0.0.33}/pyproject.toml +1 -1
  6. {code_puppy-0.0.31 → code_puppy-0.0.33}/.gitignore +0 -0
  7. {code_puppy-0.0.31 → code_puppy-0.0.33}/LICENSE +0 -0
  8. {code_puppy-0.0.31 → code_puppy-0.0.33}/README.md +0 -0
  9. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/__init__.py +0 -0
  10. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/agent.py +0 -0
  11. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/agent_prompts.py +0 -0
  12. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/command_line/__init__.py +0 -0
  13. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/command_line/file_path_completion.py +0 -0
  14. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/command_line/meta_command_handler.py +0 -0
  15. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/command_line/model_picker_completion.py +0 -0
  16. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/command_line/utils.py +0 -0
  17. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/model_factory.py +0 -0
  18. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/models.json +0 -0
  19. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/session_memory.py +0 -0
  20. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/tools/__init__.py +0 -0
  21. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/tools/code_map.py +0 -0
  22. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/tools/command_runner.py +0 -0
  23. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/tools/common.py +0 -0
  24. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/tools/file_modifications.py +0 -0
  25. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/tools/file_operations.py +0 -0
  26. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/tools/web_search.py +0 -0
  27. {code_puppy-0.0.31 → code_puppy-0.0.33}/code_puppy/version_checker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.31
3
+ Version: 0.0.33
4
4
  Summary: Code generation agent
5
5
  Author: Michael Pfaffenberger
6
6
  License: MIT
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  from code_puppy.command_line.utils import list_directory
3
+ from code_puppy.config import get_puppy_name
3
4
  # ANSI color codes are no longer necessary because prompt_toolkit handles
4
5
  # styling via the `Style` class. We keep them here commented-out in case
5
6
  # someone needs raw ANSI later, but they are unused in the current code.
@@ -59,14 +60,14 @@ from prompt_toolkit.formatted_text import FormattedText
59
60
  def get_prompt_with_active_model(base: str = '>>> '):
60
61
  model = get_active_model() or '(default)'
61
62
  cwd = os.getcwd()
62
- # Abbreviate the home directory to ~ for brevity in the prompt
63
63
  home = os.path.expanduser('~')
64
64
  if cwd.startswith(home):
65
65
  cwd_display = '~' + cwd[len(home):]
66
66
  else:
67
67
  cwd_display = cwd
68
+ puppy_name = get_puppy_name()
68
69
  return FormattedText([
69
- ('bold', '🐶'),
70
+ ('bold', f'🐶 {puppy_name} '),
70
71
  ('class:model', f'[' + str(model) + '] '),
71
72
  ('class:cwd', f'(' + str(cwd_display) + ') '),
72
73
  ('class:arrow', str(base)),
@@ -0,0 +1,53 @@
1
+ import os
2
+ import configparser
3
+
4
+ CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".code_puppy")
5
+ CONFIG_FILE = os.path.join(CONFIG_DIR, "puppy.cfg")
6
+
7
+ DEFAULT_SECTION = "puppy"
8
+ REQUIRED_KEYS = ["puppy_name", "owner_name"]
9
+
10
+
11
+ def ensure_config_exists():
12
+ """
13
+ Ensure that the .code_puppy dir and puppy.cfg exist, prompting if needed.
14
+ Returns configparser.ConfigParser for reading.
15
+ """
16
+ if not os.path.exists(CONFIG_DIR):
17
+ os.makedirs(CONFIG_DIR, exist_ok=True)
18
+ exists = os.path.isfile(CONFIG_FILE)
19
+ config = configparser.ConfigParser()
20
+ if exists:
21
+ config.read(CONFIG_FILE)
22
+ missing = []
23
+ if DEFAULT_SECTION not in config:
24
+ config[DEFAULT_SECTION] = {}
25
+ for key in REQUIRED_KEYS:
26
+ if not config[DEFAULT_SECTION].get(key):
27
+ missing.append(key)
28
+ if missing:
29
+ print("🐾 Let's get your Puppy ready!")
30
+ for key in missing:
31
+ if key == "puppy_name":
32
+ val = input("What should we name the puppy? ").strip()
33
+ elif key == "owner_name":
34
+ val = input("What's your name (so Code Puppy knows its master)? ").strip()
35
+ else:
36
+ val = input(f"Enter {key}: ").strip()
37
+ config[DEFAULT_SECTION][key] = val
38
+ with open(CONFIG_FILE, "w") as f:
39
+ config.write(f)
40
+ return config
41
+
42
+ def get_value(key: str):
43
+ config = configparser.ConfigParser()
44
+ config.read(CONFIG_FILE)
45
+ val = config.get(DEFAULT_SECTION, key, fallback=None)
46
+ return val
47
+
48
+
49
+ def get_puppy_name():
50
+ return get_value("puppy_name") or "Puppy"
51
+
52
+ def get_owner_name():
53
+ return get_value("owner_name") or "Master"
@@ -5,6 +5,7 @@ from code_puppy.version_checker import fetch_latest_version
5
5
  from code_puppy import __version__
6
6
  import sys
7
7
  from dotenv import load_dotenv
8
+ from code_puppy.config import ensure_config_exists
8
9
  from rich.console import Console
9
10
  from rich.markdown import Markdown
10
11
  from rich.console import ConsoleOptions, RenderResult
@@ -32,6 +33,8 @@ def get_secret_file_path():
32
33
 
33
34
 
34
35
  async def main():
36
+ # Ensure the config directory and puppy.cfg with name info exist (prompt user if needed)
37
+ ensure_config_exists()
35
38
  current_version = __version__
36
39
  latest_version = fetch_latest_version('code-puppy')
37
40
  console.print(f'Current version: {current_version}')
@@ -223,7 +226,7 @@ async def interactive_mode(history_file_path: str) -> None:
223
226
  )
224
227
 
225
228
  except Exception:
226
- console.print_exception(show_locals=True)
229
+ console.print_exception()
227
230
 
228
231
 
229
232
  def prettier_code_blocks():
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "code-puppy"
7
- version = "0.0.31"
7
+ version = "0.0.33"
8
8
  description = "Code generation agent"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
File without changes
File without changes
File without changes