-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake_demo.py
More file actions
executable file
·86 lines (68 loc) · 3.44 KB
/
make_demo.py
File metadata and controls
executable file
·86 lines (68 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python3
"""Create a small, always-current demo database for recordings."""
from __future__ import annotations
import os
from datetime import datetime, timedelta
from tklr.controller import Controller
from tklr.item import Item
from tklr.tklr_env import TklrEnvironment
os.environ["TKLR_HOME"] = "/Users/dag/Projects/tklr-uv/demo"
def today() -> str:
return datetime.now().strftime("%Y-%m-%d")
def yesterday() -> str:
return (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
def tomorrow() -> str:
return (datetime.now() + timedelta(days=1)).strftime("%Y-%m-%d")
def build_entries() -> list[str]:
return [
f"* Client kickoff #work @s {today()} 10:00 @e 1h @b clients/acme",
f"~ Send January invoice #finance @s {today()} 17:00 @p 1 @b admin/billing",
f"~ Follow up with Sam #urgent @s {yesterday()} 16:00 @p 1",
f"* Weekly review #ops @s {tomorrow()} 16:00 @e 45m @r w @b admin/review",
f"* Call with London #timezone @s {today()} 09:00 z CET @e 30m @b clients/uk",
f"~ Prepare Q1 proposal #proposal @s {tomorrow()} @p 2 @b clients/acme",
f"* Deep work block #billable @s {today()} 13:00 @e 2h @b focus/time",
f"~ Log billable hours #billable @s {today()} 18:00 @b admin/billing",
f"! Billable target #billable @s {yesterday()} @t 20/1w",
"% Client preferences @d Prefers weekly status email on Fridays. #client",
"- Capture idea #idea",
"? Draft: follow-up email template #draft",
f"* Taskforce check-in @s {tomorrow()} 11:00 @e 30m @b clients/acme",
f"""^ Schedule #tennis @s {tomorrow()}
@~ create #project &d for #Tuesdays &r 1
@~ request dates &r 2: 1
@~ create schedule &r 3: 2
@~ deliver schedule &r 4: 3""",
# --- GTD / Tasks View examples -----------------------------------------
"~ Inbox capture: order printer paper #gtd",
f"~ Deferred to calendar #gtd @s {tomorrow()} 09:00",
"~ Waiting on legal review #gtd @c waiting @d Sent to counsel; waiting reply.",
"~ Next action: call supplier #gtd @c next @p 2",
"~ Someday: learn Rust macros #gtd @c someday",
"~ Office context: update desk setup #gtd @c office",
"~ Errands context: pick up dry cleaning #gtd @c errands",
"~ Home context: replace HVAC filter #gtd @c home",
# Jots for processing: only jots without @e/@u should appear in Tasks View inbox
"- Jot to process: ask Alex about Q2 plan #gtd",
f"- Meeting note to process #gtd @s {today()} 15:10",
f"- Time log only (filtered from Tasks View) #gtd @s {today()} 08:30 @e 45m",
f"- Tagged use only (filtered from Tasks View) #gtd @s {today()} 12:20 @u admin.email",
f"- Time + use (filtered from Tasks View) #gtd @s {today()} 13:40 @e 30m @u focus.deepwork",
]
def main() -> None:
env = TklrEnvironment()
env.ensure(init_config=True)
controller = Controller(str(env.db_path), env, reset=True)
count = 0
for entry in build_entries():
item = Item(raw=entry, env=env, final=True, controller=controller)
if item.parse_ok:
controller.add_item(item)
count += 1
else:
print(f"parse failed: {entry}")
print(f" {item.parse_message}")
controller.db_manager.populate_dependent_tables()
print(f"Inserted {count} records into {env.db_path}.")
if __name__ == "__main__":
main()