ownledger 0.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/AGENTS.md +94 -0
  2. package/CHANGELOG.md +30 -0
  3. package/LICENSE +21 -0
  4. package/README.md +101 -1
  5. package/assets/_headers +5 -0
  6. package/assets/app.css +61 -0
  7. package/assets/app.js +369 -0
  8. package/assets/icon.svg +1 -0
  9. package/assets/index.html +30 -0
  10. package/assets/manifest.webmanifest +1 -0
  11. package/dist/cli/check.d.ts +3 -0
  12. package/dist/cli/check.js +21 -0
  13. package/dist/cli/deploy.d.ts +1 -0
  14. package/dist/cli/deploy.js +258 -0
  15. package/dist/cli/dev.d.ts +3 -0
  16. package/dist/cli/dev.js +107 -0
  17. package/dist/cli/import.d.ts +3 -0
  18. package/dist/cli/import.js +151 -0
  19. package/dist/cli/index.d.ts +2 -0
  20. package/dist/cli/index.js +47 -0
  21. package/dist/cli/init.d.ts +1 -0
  22. package/dist/cli/init.js +73 -0
  23. package/dist/cli/jsonc.d.ts +2 -0
  24. package/dist/cli/jsonc.js +39 -0
  25. package/dist/engine/actions.d.ts +61 -0
  26. package/dist/engine/actions.js +227 -0
  27. package/dist/engine/balances.d.ts +30 -0
  28. package/dist/engine/balances.js +75 -0
  29. package/dist/engine/categories.d.ts +17 -0
  30. package/dist/engine/categories.js +35 -0
  31. package/dist/engine/check.d.ts +11 -0
  32. package/dist/engine/check.js +229 -0
  33. package/dist/engine/dates.d.ts +15 -0
  34. package/dist/engine/dates.js +56 -0
  35. package/dist/engine/defaults.d.ts +2 -0
  36. package/dist/engine/defaults.js +61 -0
  37. package/dist/engine/index.d.ts +13 -0
  38. package/dist/engine/index.js +13 -0
  39. package/dist/engine/load.d.ts +23 -0
  40. package/dist/engine/load.js +129 -0
  41. package/dist/engine/networth.d.ts +12 -0
  42. package/dist/engine/networth.js +73 -0
  43. package/dist/engine/registry.d.ts +24 -0
  44. package/dist/engine/registry.js +41 -0
  45. package/dist/engine/reports.d.ts +68 -0
  46. package/dist/engine/reports.js +149 -0
  47. package/dist/engine/schedules.d.ts +75 -0
  48. package/dist/engine/schedules.js +208 -0
  49. package/dist/engine/types.d.ts +132 -0
  50. package/dist/engine/types.js +2 -0
  51. package/dist/engine/write.d.ts +30 -0
  52. package/dist/engine/write.js +105 -0
  53. package/dist/import/hash.d.ts +1 -0
  54. package/dist/import/hash.js +17 -0
  55. package/dist/import/index.d.ts +6 -0
  56. package/dist/import/index.js +6 -0
  57. package/dist/import/mapping.d.ts +96 -0
  58. package/dist/import/mapping.js +54 -0
  59. package/dist/import/profile.d.ts +39 -0
  60. package/dist/import/profile.js +125 -0
  61. package/dist/import/run.d.ts +101 -0
  62. package/dist/import/run.js +416 -0
  63. package/dist/import/workbook.d.ts +13 -0
  64. package/dist/import/workbook.js +168 -0
  65. package/dist/import/xlsx-write.d.ts +6 -0
  66. package/dist/import/xlsx-write.js +38 -0
  67. package/dist/node/files.d.ts +3 -0
  68. package/dist/node/files.js +26 -0
  69. package/dist/node/scaffold.d.ts +14 -0
  70. package/dist/node/scaffold.js +45 -0
  71. package/dist/worker/api.d.ts +3 -0
  72. package/dist/worker/api.js +139 -0
  73. package/dist/worker/auth.d.ts +11 -0
  74. package/dist/worker/auth.js +182 -0
  75. package/dist/worker/env.d.ts +27 -0
  76. package/dist/worker/env.js +6 -0
  77. package/dist/worker/github.d.ts +29 -0
  78. package/dist/worker/github.js +154 -0
  79. package/dist/worker/index.d.ts +5 -0
  80. package/dist/worker/index.js +64 -0
  81. package/dist/worker/mcp.d.ts +4 -0
  82. package/dist/worker/mcp.js +301 -0
  83. package/dist/worker/store.d.ts +42 -0
  84. package/dist/worker/store.js +92 -0
  85. package/dist/worker/tar.d.ts +2 -0
  86. package/dist/worker/tar.js +62 -0
  87. package/dist/worker/version.d.ts +1 -0
  88. package/dist/worker/version.js +2 -0
  89. package/package.json +66 -4
  90. package/presets/misa.mapping.yaml +48 -0
  91. package/templates/repo/.github/dependabot.yml +11 -0
  92. package/templates/repo/.github/workflows/check.yml +15 -0
  93. package/templates/repo/.github/workflows/deploy.yml +21 -0
  94. package/templates/repo/README.md +10 -0
@@ -0,0 +1,48 @@
1
+ # MISA Sổ Thu Chi export ("Bảng kê thu chi", xlsx, one sheet per wallet).
2
+ # The reading rules below are fixed for this app. The AI fills `accounts`, `categories` and
3
+ # `uncategorized` from `ownledger import <file> --profile`, and the owner reviews them.
4
+ source: misa
5
+ reader: table
6
+ sheets: all
7
+ account_from: sheet
8
+ date_format: dd/mm/yyyy
9
+ columns:
10
+ date: Ngày
11
+ time: Giờ
12
+ in: Số tiền thu
13
+ out: Số tiền chi
14
+ balance: Số dư
15
+ category: Hạng mục cha
16
+ subcategory: Hạng mục con
17
+ who: Chi cho ai
18
+ event: Chuyến đi/Sự kiện
19
+ note: Diễn giải
20
+ totals:
21
+ opening: Số dư đầu kì
22
+ closing: Số dư cuối kì
23
+ in: Tổng thu
24
+ out: Tổng chi
25
+ # Transfers have no category; the note names the other wallet, sometimes after a prefix:
26
+ # "Chuyển tới X", "Gửi tiết kiệm tài khoản N (Chuyển tới X)", "Tất toán sổ tiết kiệm N (Chuyển từ X)".
27
+ transfers:
28
+ only_without_category: true
29
+ out: "\\(?Chuyển tới (?<wallet>.+?)\\)?$"
30
+ in: "\\(?Chuyển từ (?<wallet>.+?)\\)?$"
31
+
32
+ # Sheet name (as in the file) → account. Sheet names are cut to 31 characters and repeated names get
33
+ # a _NN suffix; put the full wallet name(s) from the transfer notes in `names`.
34
+ # Lift facts users write into wallet names (card statement/due day, deposit term and start) into details.
35
+ accounts: {}
36
+ # "cash": { id: cash, name: Tiền mặt, type: cash }
37
+ # "vcb _1234 🗓️20💸5": { id: card-vcb, name: VCB Visa, type: credit_card, names: ["vcb _1234 🗓️20💸5"], details: { statement_day: 20, due_day: 5 } }
38
+ # "gửi 6 tháng từ 01_07_2025": { id: dep-20250701, name: Gửi 6 tháng từ 01/07/2025, type: deposit, names: ["gửi 6 tháng từ 01/07/2025"], details: { term_months: 6, start: 2025-07-01 } }
39
+
40
+ # "Hạng mục cha/Hạng mục con" (or just the parent) → ownledger category path.
41
+ categories: {}
42
+ # "Chi tiêu hàng ngày/Ăn uống": food/eating-out
43
+
44
+ # Rows with no category that are not transfers (MISA allows income with only a note).
45
+ uncategorized: []
46
+ # - { match: "lãi", category: interest, sign: in }
47
+ # uncategorized_in: other-income
48
+ # uncategorized_out: other
@@ -0,0 +1,11 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: /
5
+ schedule: { interval: weekly }
6
+ allow:
7
+ - dependency-name: ownledger
8
+ # patch and minor updates never need a data migration; majors are reviewed by hand
9
+ ignore:
10
+ - dependency-name: ownledger
11
+ update-types: ["version-update:semver-major"]
@@ -0,0 +1,15 @@
1
+ name: check
2
+ on:
3
+ push:
4
+ pull_request:
5
+ permissions:
6
+ contents: read
7
+ jobs:
8
+ check:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v5
12
+ - uses: actions/setup-node@v5
13
+ with: { node-version: 22 }
14
+ - run: npm ci
15
+ - run: npx ownledger check
@@ -0,0 +1,21 @@
1
+ name: deploy
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ workflow_dispatch:
6
+ permissions:
7
+ contents: read
8
+ concurrency: deploy
9
+ jobs:
10
+ deploy:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v5
14
+ - uses: actions/setup-node@v5
15
+ with: { node-version: 22 }
16
+ - run: npm ci
17
+ - run: npx ownledger check
18
+ - run: npx wrangler deploy
19
+ env:
20
+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
21
+ CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
@@ -0,0 +1,10 @@
1
+ # {{name}}
2
+
3
+ My personal finance ledger, kept with [ownledger](https://github.com/phucbm/ownledger). Private.
4
+
5
+ - `data/`: the ledger (YAML, monthly JSONL, prices CSV). Every change is a commit.
6
+ - `imports/`: raw exports and the mapping per source app.
7
+ - `npx ownledger check`: must pass after every change (CI runs it too).
8
+ - `npx ownledger import <file>`: import an export (profile → mapping → preview → `--yes`).
9
+ - `npx ownledger deploy`: (re)deploy my Worker; prints the connector URL.
10
+ - `npx ownledger dev`: run the Worker locally against this folder.