-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ (project): add initial setup for Slack AI agent
- Loading branch information
Showing
38 changed files
with
4,728 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
You are an AI assistant specialized in Python development. Your approach emphasizes:Clear project structure with separate directories for source code, tests, docs, and config.Modular design with distinct files for models, services, controllers, and utilities.Configuration management using environment variables.Robust error handling and logging, including context capture.Comprehensive testing with pytest.Detailed documentation using docstrings and README files.Dependency management via https://github.com/astral-sh/uv and virtual environments.Code style consistency using Ruff.CI/CD implementation with GitHub Actions or GitLab CI.AI-friendly coding practices:You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development.Follow the following rules:For any python file, be sure to ALWAYS add typing annotations to each function or class. Be sure to include return types when necessary. Add descriptive docstrings to all python functions and classes as well. Please use pep257 convention. Update existing docstrings if need be.Make sure you keep any comments that exist in a file.When writing tests, make sure that you ONLY use pytest or pytest plugins, do NOT use the unittest module. All tests should have typing annotations as well. All tests should be in ./tests. Be sure to create all necessary files and folders. If you are creating files inside of ./tests or ./src/goob_ai, be sure to make a init.py file if one does not exist.All tests should be fully annotated and should contain docstrings. Be sure to import the following if TYPE_CHECKING:from _pytest.capture import CaptureFixturefrom _pytest.fixtures import FixtureRequestfrom _pytest.logging import LogCaptureFixturefrom _pytest.monkeypatch import MonkeyPatchfrom pytest_mock.plugin import MockerFixture |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
max_line_length = 88 | ||
|
||
[*.{py,pyi}] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.{yml,yaml,json,toml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
max_line_length = off | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.{js,jsx,ts,tsx,css,scss}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.sh] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Slack Configuration | ||
SLACK_SIGNING_SECRET=your-slack-signing-secret # Found in Basic Information > App Credentials | ||
SLACK_BOT_TOKEN=xoxb-your-bot-token # Found in OAuth & Permissions > Bot User OAuth Token | ||
|
||
# Server Configuration | ||
PORT=3000 # Application server port | ||
ENVIRONMENT=development # development or production | ||
|
||
# AI Service Configuration | ||
ANTHROPIC_API_KEY=your-anthropic-api-key # Required for Claude AI integration | ||
TAVILY_API_KEY=your-tavily-api-key # Required for search functionality | ||
|
||
# LangGraph Configuration | ||
LANGGRAPH_URL=http://localhost:2024 # LangGraph service endpoint | ||
LANGGRAPH_TOKEN=admin # Authentication token for LangGraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,3 +169,5 @@ cython_debug/ | |
|
||
# PyPI configuration file | ||
.pypirc | ||
|
||
.langgraph_api/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: check-toml | ||
- id: check-json | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.8.4 | ||
hooks: | ||
- id: ruff | ||
args: ["--fix", "--config=pyproject.toml"] | ||
types_or: [python, pyi, jupyter] | ||
- id: ruff-format | ||
args: ["--config=pyproject.toml"] | ||
types_or: [python, pyi, jupyter] | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.14.1 | ||
hooks: | ||
- id: mypy | ||
args: | ||
- --config-file=pyproject.toml | ||
additional_dependencies: | ||
- types-python-dateutil | ||
- types-requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
python 3.12.5 | ||
poetry 1.8.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Tavily" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM python:3.12-slim | ||
WORKDIR /app | ||
|
||
# Install system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
curl \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install langgraph | ||
RUN pip install --no-cache-dir "langgraph-cli[inmem]" | ||
|
||
# Install poetry | ||
ENV POETRY_HOME=/opt/poetry | ||
RUN curl -sSL https://install.python-poetry.org | python - && \ | ||
cd /usr/local/bin && \ | ||
ln -s /opt/poetry/bin/poetry && \ | ||
poetry config virtualenvs.create false | ||
|
||
# Configure poetry | ||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_CREATE=false | ||
|
||
# Copy project files | ||
COPY pyproject.toml poetry.lock ./ | ||
COPY slack_ai_agent/ ./slack_ai_agent/ | ||
COPY langgraph.json ./ | ||
|
||
# Install dependencies | ||
RUN poetry install --only main | ||
|
||
EXPOSE 2024 | ||
ENV PYTHONPATH=/app:$PYTHONPATH | ||
CMD ["langgraph", "dev", "--host", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM python:3.12-slim | ||
WORKDIR /app | ||
|
||
# Install system dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
curl \ | ||
git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install langgraph (needed for web service dependencies) | ||
RUN pip install --no-cache-dir "langgraph-cli[inmem]" | ||
|
||
# Install poetry | ||
ENV POETRY_HOME=/opt/poetry | ||
RUN curl -sSL https://install.python-poetry.org | python - && \ | ||
cd /usr/local/bin && \ | ||
ln -s /opt/poetry/bin/poetry && \ | ||
poetry config virtualenvs.create false | ||
|
||
# Configure poetry | ||
ENV POETRY_NO_INTERACTION=1 \ | ||
POETRY_VIRTUALENVS_CREATE=false \ | ||
PORT=3000 | ||
|
||
# Copy project files | ||
COPY pyproject.toml poetry.lock ./ | ||
COPY slack_ai_agent/ ./slack_ai_agent/ | ||
|
||
# Install dependencies | ||
RUN poetry install --only main | ||
|
||
EXPOSE 3000 | ||
ENV PYTHONPATH=/app:$PYTHONPATH | ||
CMD ["python", "slack_ai_agent/slack/app.py", "--host", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
.PHONY: pre-commit lint type-check format test test-cov dev dev-langgraph dev-web kill help check logs | ||
|
||
# Constants | ||
CURRENT_DIR := $(shell pwd) | ||
LANGGRAPH_PORT := 2024 | ||
WEB_PORT := 3000 | ||
|
||
# Development environment setup and checks | ||
lint: | ||
@echo "Running Ruff linter..." | ||
poetry run ruff check . --fix | ||
|
||
type-check: | ||
@echo "Running mypy type checker..." | ||
poetry run mypy . --config-file=pyproject.toml | ||
|
||
format: | ||
@echo "Formatting code with Ruff..." | ||
poetry run ruff format . | ||
|
||
pre-commit: | ||
@echo "Running pre-commit checks..." | ||
poetry run pre-commit run --all-files | ||
|
||
test: | ||
@echo "Running tests..." | ||
PYTHONPATH=${CURRENT_DIR} poetry run pytest tests/ -v | ||
|
||
test-cov: | ||
@echo "Running tests with coverage..." | ||
PYTHONPATH=${CURRENT_DIR} poetry run pytest tests/ -v --cov=slack_ai_agent --cov-report=term-missing | ||
|
||
check: lint type-check format test pre-commit | ||
@echo "All checks passed!" | ||
|
||
# Development server startup | ||
dev-langgraph: | ||
@echo "Starting LangGraph server on port ${LANGGRAPH_PORT}..." | ||
poetry run langgraph dev --host localhost --port ${LANGGRAPH_PORT} | ||
|
||
dev-web: | ||
@echo "Starting Web server on port ${WEB_PORT}..." | ||
PYTHONPATH=${PYTHONPATH}:${CURRENT_DIR} PORT=${WEB_PORT} HUPPER_NO_STDIN_FILENO=1 poetry run python slack_ai_agent/slack/app.py --host localhost < /dev/null | ||
|
||
dev: | ||
@echo "Starting development servers..." | ||
@echo "LangGraph will be available at http://localhost:${LANGGRAPH_PORT}" | ||
@echo "Web server will be available at http://localhost:${WEB_PORT}" | ||
make dev-langgraph > langgraph.log 2>&1 & make dev-web > web.log 2>&1 & < /dev/null & | ||
@echo "Servers started in background. Check langgraph.log and web.log for output" | ||
@echo "Use 'make logs' to tail the log files" | ||
@echo "Use 'make kill' to stop the servers" | ||
|
||
# Log monitoring | ||
logs: | ||
@echo "Tailing log files..." | ||
tail -f langgraph.log web.log | ||
|
||
# Process management | ||
kill: | ||
@echo "Killing development servers..." | ||
@lsof -ti:${LANGGRAPH_PORT} | xargs kill -9 2>/dev/null || true | ||
@lsof -ti:${WEB_PORT} | xargs kill -9 2>/dev/null || true | ||
@rm -f langgraph.log web.log | ||
@echo "Servers stopped and log files removed" | ||
|
||
# Help | ||
help: | ||
@echo "Available commands:" | ||
@echo "Code Quality:" | ||
@echo " make lint - Run Ruff linter" | ||
@echo " make type-check - Run mypy type checker" | ||
@echo " make format - Format code with Ruff" | ||
@echo " make pre-commit - Run pre-commit checks" | ||
@echo " make test - Run tests" | ||
@echo " make test-cov - Run tests with coverage report" | ||
@echo " make check - Run all checks (lint, type-check, format, test, pre-commit)" | ||
@echo "" | ||
@echo "Development Servers:" | ||
@echo " make dev - Start both LangGraph and Web servers in background" | ||
@echo " make dev-langgraph - Start LangGraph server only" | ||
@echo " make dev-web - Start Web server only" | ||
@echo "" | ||
@echo "Utilities:" | ||
@echo " make logs - Tail both server log files" | ||
@echo " make kill - Kill all development servers and remove log files" |
Oops, something went wrong.