| 10 | |
| 11 | |
| 12 | def new_intent(title, target=None): |
| 13 | before = {row['id'] for row in data('intent', 'list', '--json')} |
| 14 | args = ['intent', 'new', title] |
| 15 | if target: |
| 16 | args += ['--review', 'urn:atomic:intent:' + target] |
| 17 | call(*args) |
| 18 | row = next(row for row in data('intent', 'list', '--json') if row['id'] not in before) |
| 19 | for path in (ROOT / '.vault/intents').glob('*/intent.md'): |
| 20 | text = path.read_text() |
| 21 | if re.search(r'^id: ' + re.escape(row['id']) + r'$', text, re.M): |
| 22 | uid = re.search(r'^uid: (.+)$', text, re.M).group(1) |
| 23 | return row['id'], uid |
| 24 | raise AssertionError('created intent has no materialized identity') |
| 25 | |
| 26 | |
| 27 | def work_body(uid, complete): |