code-puppy 0.0.31__py3-none-any.whl → 0.0.33__py3-none-any.whl
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.
- code_puppy/command_line/prompt_toolkit_completion.py +3 -2
- code_puppy/config.py +53 -0
- code_puppy/main.py +4 -1
- {code_puppy-0.0.31.dist-info → code_puppy-0.0.33.dist-info}/METADATA +1 -1
- {code_puppy-0.0.31.dist-info → code_puppy-0.0.33.dist-info}/RECORD +9 -8
- {code_puppy-0.0.31.data → code_puppy-0.0.33.data}/data/code_puppy/models.json +0 -0
- {code_puppy-0.0.31.dist-info → code_puppy-0.0.33.dist-info}/WHEEL +0 -0
- {code_puppy-0.0.31.dist-info → code_puppy-0.0.33.dist-info}/entry_points.txt +0 -0
- {code_puppy-0.0.31.dist-info → code_puppy-0.0.33.dist-info}/licenses/LICENSE +0 -0
| @@ -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)),
         | 
    
        code_puppy/config.py
    ADDED
    
    | @@ -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"
         | 
    
        code_puppy/main.py
    CHANGED
    
    | @@ -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( | 
| 229 | 
            +
                            console.print_exception()
         | 
| 227 230 |  | 
| 228 231 |  | 
| 229 232 | 
             
            def prettier_code_blocks():
         | 
| @@ -1,7 +1,8 @@ | |
| 1 1 | 
             
            code_puppy/__init__.py,sha256=orgffM-uGp8g1XCqXGKWaFB4tCCz8TVgsLMPKCOGNx0,81
         | 
| 2 2 | 
             
            code_puppy/agent.py,sha256=2rPSpYuj3ouLi3IlKxXM3WPZ06rhhcoVQLKQdtYqqLs,3144
         | 
| 3 3 | 
             
            code_puppy/agent_prompts.py,sha256=6bM_3Dxv9QAxoDBTFd3jSIJKB6WwAaYcW5NH21N2cx0,6095
         | 
| 4 | 
            -
            code_puppy/ | 
| 4 | 
            +
            code_puppy/config.py,sha256=DvmctmrHsOmjiXaiwT-4vAUiTZ4Cib-imyjKewI70eU,1661
         | 
| 5 | 
            +
            code_puppy/main.py,sha256=bc27bk6rFge95H2BumTTzRLtOx43z5FnsmjIjQx_RpU,10052
         | 
| 5 6 | 
             
            code_puppy/model_factory.py,sha256=IAiOBWxL2LC8PZ3xzesRvKsLAOuZBgWzn5Mh_gT8rRM,8466
         | 
| 6 7 | 
             
            code_puppy/models.json,sha256=Bt4rkn2tHR4UA8kanovpxtW0_-T5TooKrtUpzJNipmo,2212
         | 
| 7 8 | 
             
            code_puppy/session_memory.py,sha256=vuLSw1Pfa-MXD4lD8hj2qt65OR_aL2WdoMuF6Jwnc1k,2597
         | 
| @@ -10,7 +11,7 @@ code_puppy/command_line/__init__.py,sha256=y7WeRemfYppk8KVbCGeAIiTuiOszIURCDjOMZ | |
| 10 11 | 
             
            code_puppy/command_line/file_path_completion.py,sha256=HAlOu9XVYgJ7FbjdrhKBL0rFmCVFxSGGewdcfKTUsPw,2865
         | 
| 11 12 | 
             
            code_puppy/command_line/meta_command_handler.py,sha256=9lg2-UFKin8M67mdleECglWq30sFe61hHhaVsxBpnas,3326
         | 
| 12 13 | 
             
            code_puppy/command_line/model_picker_completion.py,sha256=5D2HkrMCtee7Eo6augls4KU6bh7tu7xR2zH5triRuZg,3658
         | 
| 13 | 
            -
            code_puppy/command_line/prompt_toolkit_completion.py,sha256= | 
| 14 | 
            +
            code_puppy/command_line/prompt_toolkit_completion.py,sha256=KpPRl7t5RaD5zf4xC2WgY_rkIhD3LS3Yt4lrXUvFL44,4667
         | 
| 14 15 | 
             
            code_puppy/command_line/utils.py,sha256=L1PnV9tNupEW1zeziyb5aGAq8DYP8sMiuQbFYLO5Nus,1236
         | 
| 15 16 | 
             
            code_puppy/tools/__init__.py,sha256=48BVpMt0HAMtz8G_z9SQhX6LnRqR83_AVfMQMf7bY0g,557
         | 
| 16 17 | 
             
            code_puppy/tools/code_map.py,sha256=BghDHaebhGDfDGvA34gwO_5r92Py4O0Q3J4RV-WtnWs,3155
         | 
| @@ -19,9 +20,9 @@ code_puppy/tools/common.py,sha256=dbmyZTrTBQh_0WWpaYN6jEync62W2mMrzNS8UFK0co4,14 | |
| 19 20 | 
             
            code_puppy/tools/file_modifications.py,sha256=V8as4Pp_qBJSUFuFl5Y-jpiJKH0tUEQ8dNdkGHzpQM0,11645
         | 
| 20 21 | 
             
            code_puppy/tools/file_operations.py,sha256=9M-JntSSTElsLZ1EMLo9Xu2ifje-N0hjXbwARoBm2Tw,9722
         | 
| 21 22 | 
             
            code_puppy/tools/web_search.py,sha256=HhcwX0MMvMDPFO8gr8gzgesD5wPXOypjkxyLZeNwL5g,589
         | 
| 22 | 
            -
            code_puppy-0.0. | 
| 23 | 
            -
            code_puppy-0.0. | 
| 24 | 
            -
            code_puppy-0.0. | 
| 25 | 
            -
            code_puppy-0.0. | 
| 26 | 
            -
            code_puppy-0.0. | 
| 27 | 
            -
            code_puppy-0.0. | 
| 23 | 
            +
            code_puppy-0.0.33.data/data/code_puppy/models.json,sha256=Bt4rkn2tHR4UA8kanovpxtW0_-T5TooKrtUpzJNipmo,2212
         | 
| 24 | 
            +
            code_puppy-0.0.33.dist-info/METADATA,sha256=pvyumUtOyXpgMNnlTjOar9GNzQjkPJ7ZFOin3INUq6w,4716
         | 
| 25 | 
            +
            code_puppy-0.0.33.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         | 
| 26 | 
            +
            code_puppy-0.0.33.dist-info/entry_points.txt,sha256=d8YkBvIUxF-dHNJAj-x4fPEqizbY5d_TwvYpc01U5kw,58
         | 
| 27 | 
            +
            code_puppy-0.0.33.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
         | 
| 28 | 
            +
            code_puppy-0.0.33.dist-info/RECORD,,
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         |