[PR #7539] [MERGED] [AI] Cache the CLI's local budget between invocations #89424

Closed
opened 2026-05-22 13:40:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/7539
Author: @MatissJanis
Created: 4/17/2026
Status: Merged
Merged: 4/25/2026
Merged by: @MatissJanis

Base: masterHead: ai/cli-budget-cache


📝 Commits (4)

  • 85d601a [AI] Cache the CLI's local budget between invocations
  • 88a8729 [AI] Simplify CLI cache/lock internals
  • a32a3e7 [AI] Address PR #7539 review comments
  • f9f40e2 Merge remote-tracking branch 'origin/master' into worktree-compressed-drifting-ritchie

📊 Changes

28 files changed (+1944 additions, -406 deletions)

View changed files

📝 packages/cli/README.md (+38 -16)
📝 packages/cli/package.json (+5 -1)
packages/cli/src/cache.test.ts (+206 -0)
packages/cli/src/cache.ts (+107 -0)
📝 packages/cli/src/commands/accounts.ts (+79 -51)
📝 packages/cli/src/commands/budgets.ts (+53 -41)
📝 packages/cli/src/commands/categories.ts (+37 -21)
📝 packages/cli/src/commands/category-groups.ts (+36 -20)
📝 packages/cli/src/commands/payees.ts (+48 -24)
📝 packages/cli/src/commands/query.ts (+25 -21)
📝 packages/cli/src/commands/rules.ts (+46 -26)
📝 packages/cli/src/commands/schedules.ts (+38 -22)
📝 packages/cli/src/commands/server.ts (+23 -15)
packages/cli/src/commands/sync.test.ts (+124 -0)
packages/cli/src/commands/sync.ts (+118 -0)
📝 packages/cli/src/commands/tags.ts (+36 -20)
📝 packages/cli/src/commands/transactions.ts (+67 -47)
📝 packages/cli/src/config.test.ts (+122 -0)
📝 packages/cli/src/config.ts (+104 -9)
📝 packages/cli/src/connection.test.ts (+149 -51)

...and 8 more files

📄 Description

Description

CLI: add caching and lockfile logic. This should prevent users from hitting rate limits when doing many consecutive operations via LLMs.

n/a

Testing

n/a

Checklist

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I understand what each change in the code does and why it is needed

Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 34 13.87 MB 0%
loot-core 1 5.27 MB 0%
api 2 3.89 MB 0%
cli 1 7.91 MB → 7.97 MB (+53.29 kB) +0.66%
crdt 1 41.83 kB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
34 13.87 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/index.js 1.86 MB 0%
static/js/BackgroundImage.js 121.09 kB 0%
static/js/FormulaEditor.js 962.55 kB 0%
static/js/PayeeRuleCountLabel.js 52.52 kB 0%
static/js/ReportRouter.js 1.2 MB 0%
static/js/ScheduleEditForm.js 145.68 kB 0%
static/js/TransactionEdit.js 186.56 kB 0%
static/js/TransactionList.js 85.81 kB 0%
static/js/Value.js 4.94 MB 0%
static/js/ca.js 191.68 kB 0%
static/js/chart-theme.js 796.5 kB 0%
static/js/client.js 451.37 kB 0%
static/js/da.js 104.4 kB 0%
static/js/de.js 174.08 kB 0%
static/js/en-GB.js 8.2 kB 0%
static/js/en.js 176.64 kB 0%
static/js/es.js 181.5 kB 0%
static/js/extends.js 518.66 kB 0%
static/js/fr.js 182.7 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 168.53 kB 0%
static/js/narrow.js 364.31 kB 0%
static/js/nb-NO.js 151.58 kB 0%
static/js/nl.js 108.66 kB 0%
static/js/pl.js 88.34 kB 0%
static/js/pt-BR.js 193.45 kB 0%
static/js/resize-observer.js 18.06 kB 0%
static/js/th.js 178.91 kB 0%
static/js/theme.js 31.67 kB 0%
static/js/uk.js 212.28 kB 0%
static/js/useFormatList.js 8.63 kB 0%
static/js/wide.js 453 B 0%
static/js/workbox-window.prod.es5.js 7.33 kB 0%
static/js/zh-Hans.js 119.52 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 5.27 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.JKo6NKKa.js 5.27 MB 0%

api

Total

Files count Total bundle size % Changed
2 3.89 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
index.js 3.89 MB 0%
models.js 0 B 0%

cli

Total

Files count Total bundle size % Changed
1 7.91 MB → 7.97 MB (+53.29 kB) +0.66%
Changeset
File Δ Size
node_modules/graceful-fs/graceful-fs.js 🆕 +10.29 kB 0 B → 10.29 kB
node_modules/graceful-fs/polyfills.js 🆕 +7.23 kB 0 B → 7.23 kB
node_modules/proper-lockfile/lib/lockfile.js 🆕 +6.56 kB 0 B → 6.56 kB
node_modules/signal-exit/index.js 🆕 +4.21 kB 0 B → 4.21 kB
node_modules/retry/lib/retry_operation.js 🆕 +3.46 kB 0 B → 3.46 kB
src/lock.ts 🆕 +2.89 kB 0 B → 2.89 kB
node_modules/graceful-fs/legacy-streams.js 🆕 +2.45 kB 0 B → 2.45 kB
src/commands/sync.ts 🆕 +2.22 kB 0 B → 2.22 kB
node_modules/retry/lib/retry.js 🆕 +2.1 kB 0 B → 2.1 kB
src/cache.ts 🆕 +1.67 kB 0 B → 1.67 kB
node_modules/proper-lockfile/lib/adapter.js 🆕 +1.46 kB 0 B → 1.46 kB
node_modules/proper-lockfile/lib/mtime-precision.js 🆕 +1.12 kB 0 B → 1.12 kB
node_modules/proper-lockfile/index.js 🆕 +1.06 kB 0 B → 1.06 kB
node_modules/graceful-fs/clone.js 🆕 +617 B 0 B → 617 B
node_modules/signal-exit/signals.js 🆕 +488 B 0 B → 488 B
node_modules/retry/index.js 🆕 +173 B 0 B → 173 B
src/connection.ts 📈 +2.08 kB (+167.77%) 1.24 kB → 3.32 kB
src/utils.ts 📈 +488 B (+81.88%) 596 B → 1.06 kB
src/config.ts 📈 +1.39 kB (+65.47%) 2.13 kB → 3.52 kB
src/index.ts 📈 +595 B (+37.56%) 1.55 kB → 2.13 kB
src/commands/rules.ts 📈 +97 B (+5.65%) 1.68 kB → 1.77 kB
src/commands/payees.ts 📈 +116 B (+5.05%) 2.24 kB → 2.35 kB
src/commands/schedules.ts 📈 +77 B (+4.67%) 1.61 kB → 1.69 kB
src/commands/server.ts 📈 +62 B (+4.65%) 1.3 kB → 1.36 kB
src/commands/tags.ts 📈 +77 B (+4.21%) 1.79 kB → 1.86 kB
src/commands/category-groups.ts 📈 +77 B (+4.03%) 1.86 kB → 1.94 kB
src/commands/categories.ts 📈 +77 B (+3.93%) 1.91 kB → 1.99 kB
src/commands/accounts.ts 📈 +135 B (+3.53%) 3.73 kB → 3.86 kB
src/commands/transactions.ts 📈 +96 B (+3.49%) 2.68 kB → 2.78 kB
node_modules/env-paths/index.js 📈 +48 B (+2.46%) 1.9 kB → 1.95 kB
src/input.ts 📈 +4 B (+0.93%) 429 B → 433 B
node_modules/resolve-from/index.js 📈 +4 B (+0.32%) 1.21 kB → 1.21 kB
src/commands/query.ts 📈 +20 B (+0.21%) 9.5 kB → 9.52 kB
src/commands/budgets.ts 📉 -91 B (-2.50%) 3.56 kB → 3.47 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
cli.js 7.91 MB → 7.97 MB (+53.29 kB) +0.66%

Smaller
No assets were smaller

Unchanged
No assets were unchanged


crdt

Total

Files count Total bundle size % Changed
1 41.83 kB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
index.js 41.83 kB 0%

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/7539 **Author:** [@MatissJanis](https://github.com/MatissJanis) **Created:** 4/17/2026 **Status:** ✅ Merged **Merged:** 4/25/2026 **Merged by:** [@MatissJanis](https://github.com/MatissJanis) **Base:** `master` ← **Head:** `ai/cli-budget-cache` --- ### 📝 Commits (4) - [`85d601a`](https://github.com/actualbudget/actual/commit/85d601a7073f8506b426baaace7e37a80e6dab2a) [AI] Cache the CLI's local budget between invocations - [`88a8729`](https://github.com/actualbudget/actual/commit/88a8729071359b959eacb633c4187fd198906c02) [AI] Simplify CLI cache/lock internals - [`a32a3e7`](https://github.com/actualbudget/actual/commit/a32a3e779cde0ca9d8c5068494dd868d0ad3e1bf) [AI] Address PR #7539 review comments - [`f9f40e2`](https://github.com/actualbudget/actual/commit/f9f40e2ced062de90d94db72ebad9bca6a0f42cc) Merge remote-tracking branch 'origin/master' into worktree-compressed-drifting-ritchie ### 📊 Changes **28 files changed** (+1944 additions, -406 deletions) <details> <summary>View changed files</summary> 📝 `packages/cli/README.md` (+38 -16) 📝 `packages/cli/package.json` (+5 -1) ➕ `packages/cli/src/cache.test.ts` (+206 -0) ➕ `packages/cli/src/cache.ts` (+107 -0) 📝 `packages/cli/src/commands/accounts.ts` (+79 -51) 📝 `packages/cli/src/commands/budgets.ts` (+53 -41) 📝 `packages/cli/src/commands/categories.ts` (+37 -21) 📝 `packages/cli/src/commands/category-groups.ts` (+36 -20) 📝 `packages/cli/src/commands/payees.ts` (+48 -24) 📝 `packages/cli/src/commands/query.ts` (+25 -21) 📝 `packages/cli/src/commands/rules.ts` (+46 -26) 📝 `packages/cli/src/commands/schedules.ts` (+38 -22) 📝 `packages/cli/src/commands/server.ts` (+23 -15) ➕ `packages/cli/src/commands/sync.test.ts` (+124 -0) ➕ `packages/cli/src/commands/sync.ts` (+118 -0) 📝 `packages/cli/src/commands/tags.ts` (+36 -20) 📝 `packages/cli/src/commands/transactions.ts` (+67 -47) 📝 `packages/cli/src/config.test.ts` (+122 -0) 📝 `packages/cli/src/config.ts` (+104 -9) 📝 `packages/cli/src/connection.test.ts` (+149 -51) _...and 8 more files_ </details> ### 📄 Description <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes. Try running yarn generate:release-notes *before* pushing your PR for an interactive experience. --> ## Description <!-- What does this PR do? Why is it needed? Please give context on the "why?": why do we need this change? What problem is it solving for you?--> CLI: add caching and lockfile logic. This should prevent users from hitting rate limits when doing many consecutive operations via LLMs. ## Related issue(s) <!-- e.g. Fixes #123, Relates to #456 --> n/a ## Testing <!-- What did you test? How can we reproduce the issue you are fixing or how can we test the feature you built? --> n/a ## Checklist - [x] Release notes added (see link above) - [x] No obvious regressions in affected areas - [x] Self-review has been performed - I understand what each change in the code does and why it is needed <!--- actual-bot-sections ---> <!--- bundlestats-action-comment key:combined start ---> ### Bundle Stats Bundle | Files count | Total bundle size | % Changed ------ | ----------- | ----------------- | --------- desktop-client | 34 | 13.87 MB | 0% loot-core | 1 | 5.27 MB | 0% api | 2 | 3.89 MB | 0% cli | 1 | 7.91 MB → 7.97 MB (+53.29 kB) | +0.66% crdt | 1 | 41.83 kB | 0% <details> <summary>View detailed bundle stats</summary> #### desktop-client **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 34 | 13.87 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/index.js | 1.86 MB | 0% static/js/BackgroundImage.js | 121.09 kB | 0% static/js/FormulaEditor.js | 962.55 kB | 0% static/js/PayeeRuleCountLabel.js | 52.52 kB | 0% static/js/ReportRouter.js | 1.2 MB | 0% static/js/ScheduleEditForm.js | 145.68 kB | 0% static/js/TransactionEdit.js | 186.56 kB | 0% static/js/TransactionList.js | 85.81 kB | 0% static/js/Value.js | 4.94 MB | 0% static/js/ca.js | 191.68 kB | 0% static/js/chart-theme.js | 796.5 kB | 0% static/js/client.js | 451.37 kB | 0% static/js/da.js | 104.4 kB | 0% static/js/de.js | 174.08 kB | 0% static/js/en-GB.js | 8.2 kB | 0% static/js/en.js | 176.64 kB | 0% static/js/es.js | 181.5 kB | 0% static/js/extends.js | 518.66 kB | 0% static/js/fr.js | 182.7 kB | 0% static/js/indexeddb-main-thread-worker-e59fee74.js | 13.46 kB | 0% static/js/it.js | 168.53 kB | 0% static/js/narrow.js | 364.31 kB | 0% static/js/nb-NO.js | 151.58 kB | 0% static/js/nl.js | 108.66 kB | 0% static/js/pl.js | 88.34 kB | 0% static/js/pt-BR.js | 193.45 kB | 0% static/js/resize-observer.js | 18.06 kB | 0% static/js/th.js | 178.91 kB | 0% static/js/theme.js | 31.67 kB | 0% static/js/uk.js | 212.28 kB | 0% static/js/useFormatList.js | 8.63 kB | 0% static/js/wide.js | 453 B | 0% static/js/workbox-window.prod.es5.js | 7.33 kB | 0% static/js/zh-Hans.js | 119.52 kB | 0% </div> </details> --- #### loot-core **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 5.27 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.JKo6NKKa.js | 5.27 MB | 0% </div> </details> --- #### api **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 2 | 3.89 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- index.js | 3.89 MB | 0% models.js | 0 B | 0% </div> </details> --- #### cli **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 7.91 MB → 7.97 MB (+53.29 kB) | +0.66% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `node_modules/graceful-fs/graceful-fs.js` | 🆕 +10.29 kB | 0 B → 10.29 kB `node_modules/graceful-fs/polyfills.js` | 🆕 +7.23 kB | 0 B → 7.23 kB `node_modules/proper-lockfile/lib/lockfile.js` | 🆕 +6.56 kB | 0 B → 6.56 kB `node_modules/signal-exit/index.js` | 🆕 +4.21 kB | 0 B → 4.21 kB `node_modules/retry/lib/retry_operation.js` | 🆕 +3.46 kB | 0 B → 3.46 kB `src/lock.ts` | 🆕 +2.89 kB | 0 B → 2.89 kB `node_modules/graceful-fs/legacy-streams.js` | 🆕 +2.45 kB | 0 B → 2.45 kB `src/commands/sync.ts` | 🆕 +2.22 kB | 0 B → 2.22 kB `node_modules/retry/lib/retry.js` | 🆕 +2.1 kB | 0 B → 2.1 kB `src/cache.ts` | 🆕 +1.67 kB | 0 B → 1.67 kB `node_modules/proper-lockfile/lib/adapter.js` | 🆕 +1.46 kB | 0 B → 1.46 kB `node_modules/proper-lockfile/lib/mtime-precision.js` | 🆕 +1.12 kB | 0 B → 1.12 kB `node_modules/proper-lockfile/index.js` | 🆕 +1.06 kB | 0 B → 1.06 kB `node_modules/graceful-fs/clone.js` | 🆕 +617 B | 0 B → 617 B `node_modules/signal-exit/signals.js` | 🆕 +488 B | 0 B → 488 B `node_modules/retry/index.js` | 🆕 +173 B | 0 B → 173 B `src/connection.ts` | 📈 +2.08 kB (+167.77%) | 1.24 kB → 3.32 kB `src/utils.ts` | 📈 +488 B (+81.88%) | 596 B → 1.06 kB `src/config.ts` | 📈 +1.39 kB (+65.47%) | 2.13 kB → 3.52 kB `src/index.ts` | 📈 +595 B (+37.56%) | 1.55 kB → 2.13 kB `src/commands/rules.ts` | 📈 +97 B (+5.65%) | 1.68 kB → 1.77 kB `src/commands/payees.ts` | 📈 +116 B (+5.05%) | 2.24 kB → 2.35 kB `src/commands/schedules.ts` | 📈 +77 B (+4.67%) | 1.61 kB → 1.69 kB `src/commands/server.ts` | 📈 +62 B (+4.65%) | 1.3 kB → 1.36 kB `src/commands/tags.ts` | 📈 +77 B (+4.21%) | 1.79 kB → 1.86 kB `src/commands/category-groups.ts` | 📈 +77 B (+4.03%) | 1.86 kB → 1.94 kB `src/commands/categories.ts` | 📈 +77 B (+3.93%) | 1.91 kB → 1.99 kB `src/commands/accounts.ts` | 📈 +135 B (+3.53%) | 3.73 kB → 3.86 kB `src/commands/transactions.ts` | 📈 +96 B (+3.49%) | 2.68 kB → 2.78 kB `node_modules/env-paths/index.js` | 📈 +48 B (+2.46%) | 1.9 kB → 1.95 kB `src/input.ts` | 📈 +4 B (+0.93%) | 429 B → 433 B `node_modules/resolve-from/index.js` | 📈 +4 B (+0.32%) | 1.21 kB → 1.21 kB `src/commands/query.ts` | 📈 +20 B (+0.21%) | 9.5 kB → 9.52 kB `src/commands/budgets.ts` | 📉 -91 B (-2.50%) | 3.56 kB → 3.47 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- cli.js | 7.91 MB → 7.97 MB (+53.29 kB) | +0.66% **Smaller** No assets were smaller **Unchanged** No assets were unchanged </div> </details> --- #### crdt **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 41.83 kB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- index.js | 41.83 kB | 0% </div> </details> </details> <!--- bundlestats-action-comment key:combined end ---> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-22 13:40:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#89424