blob: fc7f08090dc5614f952ed5759cfe4f2577306a3f (
plain) (
blame)
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
|
#!/usr/bin/env tsx
import { auth } from "./commands/auth"
import { accounts } from "./commands/accounts"
import { runImport } from "./commands/import"
import { init } from "./commands/init"
import { backup, restore } from "./commands/backup"
import { aiCommand } from "./commands/ai"
const [command, ...args] = process.argv.slice(2)
const commands: Record<string, (args: string[]) => Promise<void>> = {
init: () => init(),
auth: () => auth(),
accounts: () => accounts(),
import: (args) => runImport(args),
backup: () => backup(),
restore: (args) => restore(args),
ai: (args) => aiCommand(args),
}
const handler = commands[command]
if (!handler) {
console.log("Usage: sb1-actual <command> [options]")
console.log("")
console.log("Commands:")
console.log(" init Create or edit config")
console.log(" auth Authenticate with Sparebanken 1 (opens browser)")
console.log(" accounts List accounts from SB1 and Actual, show mappings")
console.log(" import Import transactions into Actual")
console.log(" import --dry-run Preview import without writing")
console.log(" import --since=YYYY-MM-DD Only fetch transactions from this date")
console.log(" backup Export budget to ~/.config/sb1-actual/backups/")
console.log(" restore Restore budget from a backup")
console.log(" ai query [question] Ask a free-form question about your transactions")
console.log(" ai consolidate-payees Identify and merge duplicate/similar payees")
console.log(" ai summarize Summarize spending by category and payee")
console.log(" ai insights Get AI insights into spending patterns")
console.log(" ai add-notes Add descriptive notes to transactions")
process.exit(1)
}
handler(args).catch(err => {
console.error(`Error: ${err.message}`)
process.exit(1)
})
|