agentydragon(tasks): normalize task 18 front-matter; add manager_utils package

This commit is contained in:
Rai (Michael Pokorny)
2025-06-24 17:32:40 -07:00
parent 0e2afc0378
commit d78cfb6330
5 changed files with 168 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
import tempfile
from pathlib import Path
import toml
import pytest
from agentydragon.tools.manager_utils.tasklib import TaskMeta, load_task, save_task
SAMPLE = ''''''
++
id = "99"
title = "Sample Task"
status = "Not started"
dependencies = ""
last_updated = "2023-01-01T12:00:00"
++
# Body here
'''
def test_load_and_save(tmp_path):
md = tmp_path / '99-sample.md'
md.write_text(SAMPLE)
meta, body = load_task(md)
assert meta.id == '99'
assert 'Body here' in body
meta.status = 'Done'
save_task(md, meta, body)
text = md.read_text()
data = toml.loads(text.split('+++')[1])
assert data['status'] == 'Done'
def test_meta_model_validation():
with pytest.raises(ValueError):
TaskMeta(id='a', title='t', status='bogus', dependencies='', last_updated='bad')