Compare commits

..

3 Commits

5 changed files with 46 additions and 45 deletions

View File

@@ -96,7 +96,7 @@ python3 -m py_compile ./home/bin/homeassistant.py
- Redirect stderr appropriately: `2>/dev/null` or `2>&1` - Redirect stderr appropriately: `2>/dev/null` or `2>&1`
### Configuration Files ### Configuration Files
- Before generating a commit, always consult `agents/COMMITS.md` for the required style. - Before generating a commit, always consult `.agent/COMMITS.md` for the required style.
#### chezmoi Templates #### chezmoi Templates
- Dotfiles use chezmoi's templating system - Dotfiles use chezmoi's templating system

View File

@@ -1 +1 @@
AquaAI/qwen3.5:35b AquaAI/glm-4.7-flash

View File

@@ -9,13 +9,15 @@ import operator
import os import os
import sys import sys
import tbapy import tbapy
import todoist from todoist_api_python.api import TodoistAPI
# getProjectID() returns the project id that matches the name given. # getProjectID() returns the project id that matches the name given.
def getProjectID(api, name): def getProjectID(api, name):
for project in api.state['projects']: projectPages = api.get_projects()
if project['name'] == name: for projectList in projectPages:
return project['id'] for project in projectList:
if project.name == name:
return project.id
print('Error: No project with the name {} found'.format(name)) print('Error: No project with the name {} found'.format(name))
exit(1) exit(1)
@@ -25,10 +27,12 @@ def getChecklistName(evemt):
# getEventListID() returns the id of the checklist for the event and if there is none # getEventListID() returns the id of the checklist for the event and if there is none
# returns -1. # returns -1.
def getEventListID(items, event): def getEventListID(api, projectID, event):
for item in items: taskPages = api.get_tasks(project_id=projectID)
if item['content'] == getChecklistName(event): for taskLists in taskPages:
return item['id'] for task in taskLists:
if task.content == getChecklistName(event):
return task.id
return -1 return -1
# matchToTeamList() converts a match to two lists of teams # matchToTeamList() converts a match to two lists of teams
@@ -37,11 +41,11 @@ def matchToTeamList(match):
# createChecklistItem() creates a checklist item of the highest priority. # createChecklistItem() creates a checklist item of the highest priority.
def createChecklistItem(name, api, projectID, item, date): def createChecklistItem(name, api, projectID, item, date):
return api.items.add(name, return api.add_task(name,
project_id=projectID, project_id=projectID,
parent_id=item['id'], parent_id=item.id,
date_string=date, due_string=date,
priority=4) priority=4)
# createPhotoChecklistItem() creates a checklist item that requires a photo. # createPhotoChecklistItem() creates a checklist item that requires a photo.
def createPhotoChecklistItem(name, api, projectID, item, date): def createPhotoChecklistItem(name, api, projectID, item, date):
@@ -50,10 +54,10 @@ def createPhotoChecklistItem(name, api, projectID, item, date):
# createPitList() creates a checklist for taking photos of a teams pit. # createPitList() creates a checklist for taking photos of a teams pit.
def createPitList(api, teams, projectID, checklist, date): def createPitList(api, teams, projectID, checklist, date):
item = api.items.add('**Take** Pit Photos', item = api.add_task('**Take** Pit Photos',
project_id=projectID, project_id=projectID,
parent_id=checklist['id'], parent_id=checklist.id,
date_string=date, due_string=date,
priority=3) priority=3)
for team in teams: for team in teams:
createChecklistItem('Pit photo of **{}** {}'.format(team['team_number'], team['nickname']), createChecklistItem('Pit photo of **{}** {}'.format(team['team_number'], team['nickname']),
@@ -61,11 +65,11 @@ def createPitList(api, teams, projectID, checklist, date):
# createGroupsList() creates a checklist of the different groups of volenteers. # createGroupsList() creates a checklist of the different groups of volenteers.
def createGroupsList(api, projectID, checklist, date): def createGroupsList(api, projectID, checklist, date):
item = api.items.add('Groups', item = api.add_task('Groups',
project_id=projectID, project_id=projectID,
parent_id=checklist['id'], parent_id=checklist.id,
date_string=date, due_string=date,
priority=3) priority=3)
groups = ['Judges', 'Robot Inspectors', 'Referees', 'Safety Inspectors', groups = ['Judges', 'Robot Inspectors', 'Referees', 'Safety Inspectors',
'Field Reset', 'Queuers', 'CSAs', 'VC and Pit Admin'] 'Field Reset', 'Queuers', 'CSAs', 'VC and Pit Admin']
for group in groups: for group in groups:
@@ -73,29 +77,29 @@ def createGroupsList(api, projectID, checklist, date):
# createWinnersList() creates a checklist of the winners of an event. # createWinnersList() creates a checklist of the winners of an event.
def createWinnersList(api, projectID, checklist, date): def createWinnersList(api, projectID, checklist, date):
item = api.items.add('Winners', item = api.add_task('Winners',
project_id=projectID, project_id=projectID,
parent_id=checklist['id'], parent_id=checklist.id,
date_string=date, due_string=date,
priority=3) priority=3)
groups = ['Chairman\'s award', 'Engineering Inspiration', 'Rookie All-Star', 'Winning Alliance', groups = ['Impact', 'Engineering Inspiration', 'Rookie All-Star', 'Winning Alliance',
'Winning Team 1', 'Winning Team 2', 'Winning Team 3'] 'Winning Team 1', 'Winning Team 2', 'Winning Team 3']
for group in groups: for group in groups:
createPhotoChecklistItem(group, api, projectID, item, date) createPhotoChecklistItem(group, api, projectID, item, date)
# createRobotList() creates a checklist for taking photos of a team's robot. # createRobotList() creates a checklist for taking photos of a team's robot.
def createRobotList(api, teams, projectID, checklist, date): def createRobotList(api, teams, projectID, checklist, date):
item = api.items.add('**Take** Robot Photos', item = api.add_task('**Take** Robot Photos',
project_id=projectID, project_id=projectID,
parent_id=checklist['id'], parent_id=checklist.id,
date_string=date, due_string=date,
priority=3) priority=3)
for team in teams: for team in teams:
createChecklistItem('Robot photo of **{}** {}'.format(team['team_number'], team['nickname']), createChecklistItem('Robot photo of **{}** {}'.format(team['team_number'], team['nickname']),
api, projectID, item, date) api, projectID, item, date)
# Parse settings config # Parse settings config
configString = '[Settings]\n' + open('../settings.conf').read() configString = '[Settings]\n' + open('./.config/settings.conf').read()
configParser = configparser.RawConfigParser() configParser = configparser.RawConfigParser()
configParser.read_string(configString) configParser.read_string(configString)
@@ -104,10 +108,8 @@ tbaKey = configParser.get('Settings', 'TBAKey')
todoistToken = configParser.get('Settings', 'TodoistToken') todoistToken = configParser.get('Settings', 'TodoistToken')
# Setup Todoist # Setup Todoist
api = todoist.TodoistAPI(todoistToken) api = TodoistAPI(todoistToken)
api.sync()
projectID = getProjectID(api, '🤖 Robotics') projectID = getProjectID(api, '🤖 Robotics')
items = api.state['items']
# Setup the Blue Alliance # Setup the Blue Alliance
tba = tbapy.TBA(tbaKey) tba = tbapy.TBA(tbaKey)
@@ -128,13 +130,13 @@ def firstMatch(team, matches):
return None, None return None, None
# Check if list already exists # Check if list already exists
eventListID = getEventListID(items, event) eventListID = getEventListID(api, projectID, event)
if eventListID == -1: if eventListID == -1:
# Create checklist # Create checklist
checklist = api.items.add(getChecklistName(event), checklist = api.add_task(getChecklistName(event),
project_id=projectID, project_id=projectID,
date_string=day2, due_string=day2,
priority=2) priority=2)
# Setup # Setup
createPitList(api, teams, projectID, checklist, setupDay) createPitList(api, teams, projectID, checklist, setupDay)
createChecklistItem('**Schedule** Judges photo', api, projectID, checklist, setupDay) createChecklistItem('**Schedule** Judges photo', api, projectID, checklist, setupDay)
@@ -170,4 +172,3 @@ else:
matchNumber = match['match_number'] matchNumber = match['match_number']
matchTime = dt.datetime.fromtimestamp(match['time']).strftime('%Y-%m-%d %I:%M %p') matchTime = dt.datetime.fromtimestamp(match['time']).strftime('%Y-%m-%d %I:%M %p')
robot.update(date_string=matchTime, content='{} match {} {}'.format(robot['content'], matchNumber, side)) robot.update(date_string=matchTime, content='{} match {} {}'.format(robot['content'], matchNumber, side))
api.commit()

View File

@@ -1,7 +1,7 @@
--- ---
description: Commit currently staged code in git description: Commit currently staged code in git
mode: all mode: all
model: {{ template "models/big-brain" . }} model: "{{ template "models/small-brain" }}"
temperature: 0.1 temperature: 0.1
tools: tools:
write: false write: false