From 09b419798f0269fd09f86f55bcff3feb8b55baf1 Mon Sep 17 00:00:00 2001 From: Christopher Pappas Date: Sun, 30 Nov 2025 11:06:34 -0800 Subject: [PATCH] feat: add ci runner --- .github/workflows/type-check.yml | 20 ++++++++++++++++++++ CLAUDE.md | 3 ++- README.md | 8 ++++++++ src/agent_chat_cli/utils/config.py | 17 ++++++++++------- 4 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/type-check.yml diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml new file mode 100644 index 0000000..6af96b9 --- /dev/null +++ b/.github/workflows/type-check.yml @@ -0,0 +1,20 @@ +name: Type Check + +on: [push, pull_request] + +jobs: + type-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Run mypy + run: uv run mypy src/agent_chat_cli diff --git a/CLAUDE.md b/CLAUDE.md index 8e90297..bcf48d2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,7 +1,8 @@ -# CLAUDE.md System Settings +# CLAUDE.md System Prompt ## Rules - The project uses `uv`, `ruff` and `mypy` - Run commands should be prefixed with `uv`: `uv run ...` - Use `asyncio` features, if such is needed +- Absolutely no useless comments! Every class and method does not need to be documented (unless it is legitimetly complex or "lib-ish") diff --git a/README.md b/README.md index 0a4402c..1318899 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,11 @@ This app uses [uv](https://github.com/astral-sh/uv) for package management so fi - `uv run chat` Additional MCP servers are configured in `agent-chat-cli.config.yaml` and prompts added within the `prompts` folder. + +## Development + +- Install pre-commit hooks + - `uv run pre-commit install` +- Typechecking is via [MyPy](https://github.com/python/mypy): + - `uv run mypy src` +- Linting and formatting is via [Ruff](https://docs.astral.sh/ruff/) diff --git a/src/agent_chat_cli/utils/config.py b/src/agent_chat_cli/utils/config.py index 4e367be..a58b153 100644 --- a/src/agent_chat_cli/utils/config.py +++ b/src/agent_chat_cli/utils/config.py @@ -57,34 +57,37 @@ def load_config( raw_config = yaml.safe_load(f) base_system_prompt = "" - if "system_prompt" in raw_config: + + if raw_config.get("system_prompt"): base_system_prompt = load_prompt(raw_config["system_prompt"]) - if "agents" in raw_config: + if raw_config.get("agents"): for agent_config in raw_config["agents"].values(): - if "prompt" in agent_config: + if agent_config.get("prompt"): agent_config["prompt"] = load_prompt(agent_config["prompt"]) mcp_server_prompts = [] - if "mcp_servers" in raw_config: + + if raw_config.get("mcp_servers"): enabled_servers = { name: config for name, config in raw_config["mcp_servers"].items() if config.get("enabled", True) } + raw_config["mcp_servers"] = enabled_servers for server_config in enabled_servers.values(): - if "prompt" in server_config and server_config["prompt"]: + if server_config.get("prompt"): loaded_prompt = load_prompt(server_config["prompt"]) server_config["prompt"] = loaded_prompt mcp_server_prompts.append(loaded_prompt) - if "env" in server_config: + if server_config.get("env"): for key, value in server_config["env"].items(): server_config["env"][key] = os.path.expandvars(value) - if "args" in server_config: + if server_config.get("args"): server_config["args"] = [ os.path.expandvars(arg) for arg in server_config["args"] ]