Compare commits

...

2 Commits

Author SHA1 Message Date
2e71c21094 Enhance CalendarTool: include additional event details in output
- Request additional fields for events, including attendees and attachments
- Extract and display event end time, location, attendees, attachments, and description in the event listing
- Truncate long descriptions for better readability
2026-03-06 13:07:15 -05:00
5d80eab8bd Add CI workflow for testing and linting 2026-03-06 13:07:06 -05:00
2 changed files with 133 additions and 1 deletions

99
.gitea/workflows/ci.yml Normal file
View File

@ -0,0 +1,99 @@
name: CI
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
workflow_dispatch:
jobs:
lint:
name: Lint with ruff
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 ruff
run: |
python -m pip install --upgrade pip
pip install ruff>=0.1.0
- name: Run ruff check
run: |
ruff check nanobot/
- name: Run ruff format check
run: |
ruff format --check nanobot/
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: |
pytest tests/ -v --tb=short
- name: Check package can be imported
run: |
python -c "import nanobot; print(f'nanobot version check passed')"
build:
name: Build package
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build hatchling
- name: Build package
run: |
python -m build
- name: Check build artifacts
run: |
ls -lh dist/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/
retention-days: 7

View File

@ -714,6 +714,8 @@ class CalendarTool(Tool):
maxResults=max_results,
singleEvents=True,
orderBy="startTime",
# Request additional fields to get attendees and attachments
fields="items(id,summary,start,end,description,location,attendees(email,responseStatus),attachments(fileUrl,title))",
)
.execute()
)
@ -727,10 +729,17 @@ class CalendarTool(Tool):
event_ids = []
for idx, event in enumerate(events, 1):
start = event["start"].get("dateTime", event["start"].get("date"))
end = event["end"].get("dateTime", event["end"].get("date"))
title = event.get("summary", "No title")
event_id = event.get("id", "")
event_ids.append(event_id)
# Extract additional information
description = event.get("description", "")
location = event.get("location", "")
attendees = event.get("attendees", [])
attachments = event.get("attachments", [])
# Add position indicator - "last" means the one with the latest time (usually the last in list)
position_note = ""
if idx == len(events):
@ -739,7 +748,31 @@ class CalendarTool(Tool):
position_note = " (FIRST - earliest time)"
# Format: include numbered list with position indicators
result.append(f"{idx}. {title} ({start}) [ID: {event_id}]{position_note}")
result.append(f"{idx}. {title} ({start} - {end}) [ID: {event_id}]{position_note}")
# Add location if present
if location:
result.append(f" Location: {location}")
# Add attendees if present
if attendees:
attendee_emails = [att.get("email", "") for att in attendees if att.get("email")]
if attendee_emails:
result.append(f" Attendees: {', '.join(attendee_emails)}")
# Add attachments if present
if attachments:
attachment_info = []
for att in attachments:
file_name = att.get("fileUrl", "").split("/")[-1] if att.get("fileUrl") else att.get("title", "Unknown file")
attachment_info.append(file_name)
if attachment_info:
result.append(f" Attachments: {', '.join(attachment_info)}")
# Add description if present (truncate if too long)
if description:
desc_preview = description[:100] + "..." if len(description) > 100 else description
result.append(f" Description: {desc_preview}")
# Also include a summary line with all IDs for easy extraction
result.append(f"\nEvent IDs: {', '.join(event_ids)}")