feat: Wave 10 — expense tracker pack (voice-driven)
resources/commands/expenses/ (4 commands):
- expenses.log "потратил 500 на еду" → append entry
- expenses.today "сколько потратил сегодня" → today's total
- expenses.week "сколько на неделе" → 7-day rolling total
- expenses.breakdown "куда ушли деньги" → top-5 categories
Storage: `jarvis.state` (auto-namespaced per-pack JSON). Wire format is
compact "ts1,amount1,cat1|ts2,amount2,cat2" so we don't need a JSON parser
inside Lua.
Phrase parsing:
- Trigger stripped via jarvis.text.strip_trigger.
- First number captured; "12,50" comma decimals accepted.
- Category extracted from "на <слово>" (RU) or "for/on <word>" (EN);
defaults to "разное" / "misc".
Time math:
- Day boundary: local-calendar midnight via os.time({year,month,day,...}).
- Week boundary: rolling 7×86400 seconds.
Pack count: 98 → 99 functional.
This commit is contained in:
parent
bb3b4f5942
commit
87bb186e94
5 changed files with 293 additions and 0 deletions
91
resources/commands/expenses/command.toml
Normal file
91
resources/commands/expenses/command.toml
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
# Personal-finance tracker — voice-log expenses by category, get totals.
|
||||
# Storage is per-pack via `jarvis.state` (auto-namespaced JSON), so it doesn't
|
||||
# bleed into other packs' data.
|
||||
#
|
||||
# Voice flow:
|
||||
# "потратил 500 на еду" → log entry (amount=500, category="еда")
|
||||
# "сколько я потратил сегодня" → speak today's total
|
||||
# "сколько на этой неделе" → speak 7-day total
|
||||
# "куда ушли деньги" → speak per-category breakdown for the week
|
||||
|
||||
[[commands]]
|
||||
id = "expenses.log"
|
||||
type = "lua"
|
||||
script = "log.lua"
|
||||
sandbox = "standard"
|
||||
timeout = 3000
|
||||
|
||||
[commands.phrases]
|
||||
ru = [
|
||||
"потратил",
|
||||
"записать трату",
|
||||
"запиши трату",
|
||||
"купил за",
|
||||
"заплатил за",
|
||||
]
|
||||
en = [
|
||||
"spent",
|
||||
"log expense",
|
||||
"paid for",
|
||||
"bought",
|
||||
]
|
||||
|
||||
|
||||
[[commands]]
|
||||
id = "expenses.today"
|
||||
type = "lua"
|
||||
script = "today.lua"
|
||||
sandbox = "standard"
|
||||
timeout = 3000
|
||||
|
||||
[commands.phrases]
|
||||
ru = [
|
||||
"сколько я потратил сегодня",
|
||||
"траты сегодня",
|
||||
"сколько ушло сегодня",
|
||||
]
|
||||
en = [
|
||||
"spending today",
|
||||
"expenses today",
|
||||
"how much spent today",
|
||||
]
|
||||
|
||||
|
||||
[[commands]]
|
||||
id = "expenses.week"
|
||||
type = "lua"
|
||||
script = "week.lua"
|
||||
sandbox = "standard"
|
||||
timeout = 3000
|
||||
|
||||
[commands.phrases]
|
||||
ru = [
|
||||
"сколько я потратил на этой неделе",
|
||||
"траты на неделе",
|
||||
"недельные траты",
|
||||
]
|
||||
en = [
|
||||
"spending this week",
|
||||
"weekly expenses",
|
||||
]
|
||||
|
||||
|
||||
[[commands]]
|
||||
id = "expenses.breakdown"
|
||||
type = "lua"
|
||||
script = "breakdown.lua"
|
||||
sandbox = "standard"
|
||||
timeout = 3000
|
||||
|
||||
[commands.phrases]
|
||||
ru = [
|
||||
"куда ушли деньги",
|
||||
"разбивка по тратам",
|
||||
"на что я тратил",
|
||||
"разбивка по категориям",
|
||||
]
|
||||
en = [
|
||||
"where did the money go",
|
||||
"expense breakdown",
|
||||
"spending by category",
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue