Skip to content

Commit 197f32a

Browse files
docs: add tuntunclaw workflow hooks
docs: add tuntunclaw workflow hooks
2 parents 9c3494f + 18cf13e commit 197f32a

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""Workflow hooks between inventory checks and OpenClaw actions."""
2+
3+
from __future__ import annotations
4+
5+
from dataclasses import dataclass
6+
7+
from inventory import InventoryItem, find_low_stock_items
8+
9+
10+
@dataclass(frozen=True)
11+
class RefillTask:
12+
item_name: str
13+
location: str
14+
reason: str
15+
16+
17+
def plan_refill_tasks(items: list[InventoryItem]) -> list[RefillTask]:
18+
"""Create task descriptions for items that need a refill."""
19+
return [
20+
RefillTask(
21+
item_name=item.name,
22+
location=item.location or "unknown",
23+
reason=f"{item.quantity} <= {item.low_stock_threshold}",
24+
)
25+
for item in find_low_stock_items(items)
26+
]

0 commit comments

Comments
 (0)