Skip to content
This repository was archived by the owner on Jan 19, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5ca38b9
feat integration tests for all tools
joshsny Jul 23, 2025
be3702f
feat(wip): python implementation
joshsny Jul 23, 2025
6a5dffe
fixes
joshsny Jul 23, 2025
9989248
Merge branch 'main' into python-implementation
joshsny Jul 23, 2025
47fe078
feat: generate pydantic schema
joshsny Jul 23, 2025
9670876
format
joshsny Jul 23, 2025
c853446
merge in changes from schema gen
joshsny Jul 23, 2025
e4e250d
use autogenerated schema
joshsny Jul 23, 2025
4f75852
format settings
joshsny Jul 23, 2025
236cc49
fix some broken tests
joshsny Jul 23, 2025
ab602e0
formatting, add workflow files
joshsny Jul 23, 2025
2fce8c5
apply fixes
joshsny Jul 23, 2025
7df950c
fix lint issues
joshsny Jul 23, 2025
aabd904
update workflows
joshsny Jul 23, 2025
2442e5f
don't format tool inputs
joshsny Jul 23, 2025
9106b8e
fix formatting issue
joshsny Jul 23, 2025
bdbe767
Merge branch 'main' into python-implementation
joshsny Aug 6, 2025
db87a53
resolve pyproject.toml conflics
joshsny Aug 6, 2025
1a0689c
feat(wip): add type checking for python, fix a bunch of tool issues
joshsny Aug 6, 2025
f1048be
formatting, use ty for python typechecking
joshsny Aug 6, 2025
f341e62
merge ci workflows
joshsny Aug 6, 2025
f60d1cf
merge typecheck job
joshsny Aug 6, 2025
3b41c7b
cleanup, fix client initialization
joshsny Aug 7, 2025
f7db33a
format, add unit tests to CI for python
joshsny Aug 7, 2025
4881aed
fix lint error
joshsny Aug 7, 2025
5e3c11d
formatting
joshsny Aug 8, 2025
de34416
fix some tools
joshsny Aug 8, 2025
e3f180b
use a posthog tool config object to handle env vars
joshsny Aug 11, 2025
2eabf21
add context management support for the tool registry
joshsny Aug 11, 2025
5c2d8ed
update client tests
joshsny Aug 11, 2025
0b44c95
move tool result, add basic example
joshsny Aug 11, 2025
aafd626
fix env vars for tests
joshsny Aug 11, 2025
43e4a36
fix tests for tool return as string
joshsny Aug 11, 2025
5f3e41b
fix the tool result passing for python
joshsny Aug 11, 2025
8e73607
correct env vars
joshsny Aug 11, 2025
52bd9be
env vars
joshsny Aug 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.test.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Test environment configuration
TEST_API_BASE_URL=http://localhost:8010
TEST_API_TOKEN=your_posthog_api_token_here
TEST_POSTHOG_API_BASE_URL=http://localhost:8010
TEST_POSTHOG_PERSONAL_API_KEY=your_posthog_api_token_here
TEST_ORG_ID=your_test_organization_id_here
TEST_PROJECT_ID=your_test_project_id_here
172 changes: 172 additions & 0 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
name: Python CI
permissions:
contents: read

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint-and-format:
name: Lint, Format, and Type Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Install dependencies
run: |
cd python
uv sync --dev

- name: Run ruff linter
run: |
cd python
uv run ruff check --fix .

- name: Run ruff formatter
run: |
cd python
uv run ruff format .

- name: Check for changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Code formatting or linting changes detected!"
git diff
exit 1
fi

- name: Run type checking
run: |
cd python
uvx ty check

unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Install dependencies
run: |
cd python
uv sync --dev

- name: Run unit tests
run: |
cd python
uv run pytest tests/ -v --tb=short --ignore-glob="*_integration.py"
env:
PYTHONPATH: ${{ github.workspace }}/python

integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-integration-${{ github.head_ref || github.ref }}
cancel-in-progress: true

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Install dependencies
run: |
cd python
uv sync --dev

- name: Run integration tests
run: |
cd python
uv run pytest tests/tools/ -v --tb=short
env:
PYTHONPATH: ${{ github.workspace }}/python
TEST_POSTHOG_API_BASE_URL: ${{ secrets.TEST_API_BASE_URL }}
TEST_POSTHOG_PERSONAL_API_KEY: ${{ secrets.TEST_API_TOKEN }}
TEST_ORG_ID: ${{ secrets.TEST_ORG_ID }}
TEST_PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}

schema-sync:
name: Schema Synchronization Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Install Node.js dependencies
run: pnpm install

- name: Install Python dependencies
run: |
cd python
uv sync --dev

- name: Generate schemas
run: pnpm run schema:build

- name: Check if schemas are up to date
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Python schemas are out of sync with TypeScript definitions!"
echo "Please run 'pnpm run schema:build' to regenerate the schemas."
git diff
exit 1
fi
53 changes: 42 additions & 11 deletions .github/workflows/test.yml → .github/workflows/ci-typescript.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: TypeScript CI

on:
push:
Expand All @@ -7,13 +7,50 @@
branches: [ main ]

jobs:
lint-and-format:
name: Lint, Format, and Type Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
run: pnpm i

- name: Run linter
run: pnpm run lint:fix

- name: Run formatter
run: pnpm run format

- name: Run type check
run: pnpm run typecheck

- name: Check for changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Code formatting or linting changes detected!"
git diff
exit 1
fi

unit-tests:

Check warning on line 47 in .github/workflows/ci-typescript.yml

View check run for this annotation

GitHub Advanced Security / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
name: Unit Tests
runs-on: ubuntu-latest
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
group: ${{ github.workflow }}-unit-${{ github.head_ref || github.ref }}
cancel-in-progress: true

steps:
Expand All @@ -32,12 +69,6 @@
- name: Install dependencies
run: pnpm install

- name: Run linting
run: pnpm run lint:fix

- name: Run formatting check
run: pnpm run format

- name: Run unit tests
run: pnpm run test

Expand All @@ -48,7 +79,7 @@
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
group: ${{ github.workflow }}-integration-${{ github.head_ref || github.ref }}
cancel-in-progress: true

steps:
Expand All @@ -70,7 +101,7 @@
- name: Run integration tests
run: pnpm run test:integration
env:
TEST_API_BASE_URL: ${{ secrets.TEST_API_BASE_URL }}
TEST_API_TOKEN: ${{ secrets.TEST_API_TOKEN }}
TEST_POSTHOG_API_BASE_URL: ${{ secrets.TEST_API_BASE_URL }}
TEST_POSTHOG_PERSONAL_API_KEY: ${{ secrets.TEST_API_TOKEN }}
TEST_ORG_ID: ${{ secrets.TEST_ORG_ID }}
TEST_PROJECT_ID: ${{ secrets.TEST_PROJECT_ID }}
42 changes: 0 additions & 42 deletions .github/workflows/pr-checks.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ node_modules
.cursor/

# Python
python/venv/
__pycache__/
.mypy_cache/
.ruff_cache/
.pytest_cache/
.mypy_cache/.ruff_cache/
.pytest_cache/

.env
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"schema:build:json": "tsx typescript/scripts/generate-tool-schema.ts",
"schema:build:python": "bash python/scripts/generate-pydantic-models.sh",
"schema:build": "pnpm run schema:build:json && pnpm run schema:build:python",
"test:python": "cd python && uv run pytest tests/ -v",
"lint:python": "cd python && uv run ruff check --fix .",
"format:python": "cd python && uv run ruff format .",
"typecheck:python": "cd python && uvx ty check",
"typecheck": "tsc --project typescript/tsconfig.json --noEmit"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions python/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PostHog API Configuration
POSTHOG_API_TOKEN=your-posthog-api-token-here
POSTHOG_BASE_URL=https://app.posthog.com

# Optional: OpenAI API key for agent testing
# Without this, only individual tool tests will work
OPENAI_API_KEY=your-openai-api-key-here
19 changes: 19 additions & 0 deletions python/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"python.defaultInterpreterPath": "./.venv/bin/python",
"python.linting.enabled": true,
"python.linting.ruffEnabled": true,
"python.linting.flake8Enabled": false,
"python.formatting.provider": "none",
"editor.formatOnType": false,
"editor.codeActionsOnSave": {
"source.fixAll": "never"
},
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll.ruff": "explicit"
}
}
}
Loading