bkper 4.7.1 → 4.8.3
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.
- package/README.md +84 -8
- package/lib/agent/cli-dispatch.d.ts +6 -0
- package/lib/agent/cli-dispatch.d.ts.map +1 -0
- package/lib/agent/cli-dispatch.js +7 -0
- package/lib/agent/cli-dispatch.js.map +1 -0
- package/lib/agent/run-agent-mode.d.ts +18 -0
- package/lib/agent/run-agent-mode.d.ts.map +1 -0
- package/lib/agent/run-agent-mode.js +47 -0
- package/lib/agent/run-agent-mode.js.map +1 -0
- package/lib/agent/startup-maintenance.d.ts +6 -0
- package/lib/agent/startup-maintenance.d.ts.map +1 -0
- package/lib/agent/startup-maintenance.js +17 -0
- package/lib/agent/startup-maintenance.js.map +1 -0
- package/lib/agent/system-prompt.d.ts +2 -0
- package/lib/agent/system-prompt.d.ts.map +1 -0
- package/lib/agent/system-prompt.js +29 -0
- package/lib/agent/system-prompt.js.map +1 -0
- package/lib/cli.js +52 -21
- package/lib/cli.js.map +1 -1
- package/lib/commands/agent-command.d.ts +6 -0
- package/lib/commands/agent-command.d.ts.map +1 -0
- package/lib/commands/agent-command.js +43 -0
- package/lib/commands/agent-command.js.map +1 -0
- package/lib/commands/apps/init.d.ts.map +1 -1
- package/lib/commands/apps/init.js +2 -17
- package/lib/commands/apps/init.js.map +1 -1
- package/lib/commands/skills-command.d.ts +8 -0
- package/lib/commands/skills-command.d.ts.map +1 -0
- package/lib/commands/skills-command.js +36 -0
- package/lib/commands/skills-command.js.map +1 -0
- package/lib/commands/skills.d.ts +6 -10
- package/lib/commands/skills.d.ts.map +1 -1
- package/lib/commands/skills.js +28 -76
- package/lib/commands/skills.js.map +1 -1
- package/package.json +3 -2
- package/CHANGELOG.md +0 -71
package/README.md
CHANGED
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
[Developer Docs]: https://bkper.com/docs
|
|
3
3
|
[App Template]: https://github.com/bkper/bkper-app-template
|
|
4
4
|
[Skills Repository]: https://github.com/bkper/skills
|
|
5
|
+
[Pi]: https://pi.dev/
|
|
5
6
|
|
|
6
|
-
A **
|
|
7
|
+
A unified **interface for [Bkper](https://bkper.com)**. Use `bkper` in two complementary modes:
|
|
8
|
+
|
|
9
|
+
- **Interactive mode** — run `bkper` with no arguments to open the agent TUI
|
|
10
|
+
- **Command mode** — run `bkper <command>` for explicit CLI workflows, scripts, and automation
|
|
11
|
+
|
|
12
|
+
With one tool, you can build and deploy Bkper apps, and manage financial data -- books, accounts, transactions, and balances.
|
|
7
13
|
|
|
8
14
|
[](https://www.npmjs.com/package/bkper)
|
|
9
15
|
|
|
@@ -37,6 +43,28 @@ yarn global add bkper
|
|
|
37
43
|
bkper auth login
|
|
38
44
|
```
|
|
39
45
|
|
|
46
|
+
### Start using bkper
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Interactive mode (agent TUI)
|
|
50
|
+
bkper
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Command mode (explicit command)
|
|
55
|
+
bkper book list
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Pick a book and create your first transaction:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
bkper transaction create -b <bookId> --description "Office supplies 123.78"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> Run `bkper --help` or `bkper <command> --help` for built-in documentation on any command.
|
|
65
|
+
>
|
|
66
|
+
> To build and deploy Bkper Apps, see [App Management](#app-management).
|
|
67
|
+
|
|
40
68
|
### Access Token
|
|
41
69
|
|
|
42
70
|
Use the access token for direct API calls from any tool:
|
|
@@ -50,21 +78,61 @@ curl -s -H "Authorization: Bearer $TOKEN" \
|
|
|
50
78
|
https://api.bkper.app/v5/books | jq '.items[].name'
|
|
51
79
|
```
|
|
52
80
|
|
|
53
|
-
|
|
81
|
+
## Interactive Mode (powered by Pi)
|
|
82
|
+
|
|
83
|
+
When you run `bkper` with no arguments in an interactive terminal, bkper starts the embedded agent TUI.
|
|
84
|
+
|
|
85
|
+
Bkper's agent mode is intentionally a **thin wrapper** around [Pi][Pi]:
|
|
86
|
+
|
|
87
|
+
- Pi provides the core agent runtime and TUI
|
|
88
|
+
- bkper adds Bkper-specific domain context, skills distribution defaults, and startup maintenance behavior
|
|
89
|
+
|
|
90
|
+
### Startup maintenance (non-blocking)
|
|
91
|
+
|
|
92
|
+
On each agent startup, bkper performs background checks:
|
|
93
|
+
|
|
94
|
+
- CLI auto-update check (same behavior as command mode)
|
|
95
|
+
- Bkper skills sync check from [Skills Repository]
|
|
96
|
+
|
|
97
|
+
### Pi passthrough
|
|
98
|
+
|
|
99
|
+
Use Pi CLI features directly through bkper:
|
|
54
100
|
|
|
55
101
|
```bash
|
|
56
|
-
bkper
|
|
102
|
+
bkper agent -- <pi-args>
|
|
57
103
|
```
|
|
58
104
|
|
|
59
|
-
|
|
105
|
+
Examples:
|
|
60
106
|
|
|
61
107
|
```bash
|
|
62
|
-
bkper
|
|
108
|
+
bkper agent -- -p "Summarize this repository"
|
|
109
|
+
bkper agent -- --model openai/gpt-4o -c
|
|
110
|
+
bkper agent -- install <pi-package-source>
|
|
63
111
|
```
|
|
64
112
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
113
|
+
`bkper agent` keeps Bkper defaults (including Bkper system prompt) unless you explicitly pass `--system-prompt`.
|
|
114
|
+
|
|
115
|
+
For all available passthrough flags and commands, see the Pi CLI reference:
|
|
116
|
+
https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent#cli-reference
|
|
117
|
+
|
|
118
|
+
### Skills
|
|
119
|
+
|
|
120
|
+
Bkper skills are synced globally to:
|
|
121
|
+
|
|
122
|
+
- `~/.agents/skills`
|
|
123
|
+
- state file: `~/.agents/skills/.bkper-skills.yaml`
|
|
124
|
+
|
|
125
|
+
Trigger a manual sync at any time:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
bkper skills sync
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Skills are agent-agnostic and can be reused by other tools that support `.agents/skills`.
|
|
132
|
+
|
|
133
|
+
Pi-specific extensions are loaded from Pi extension folders (for example `.pi/extensions` and `~/.pi/agent/extensions`).
|
|
134
|
+
|
|
135
|
+
<!-- Suggested showcase media: add a short terminal GIF here (bkper -> "Bkper Agent ready." -> one prompt). -->
|
|
68
136
|
|
|
69
137
|
---
|
|
70
138
|
|
|
@@ -779,6 +847,14 @@ deployment:
|
|
|
779
847
|
- `auth logout` - Remove stored credentials
|
|
780
848
|
- `auth token` - Print the current OAuth access token to stdout
|
|
781
849
|
|
|
850
|
+
#### Agent Bridge (Pi passthrough)
|
|
851
|
+
|
|
852
|
+
- `agent -- <pi-args...>` - Run Pi CLI with Bkper defaults (system prompt/resources)
|
|
853
|
+
|
|
854
|
+
#### Skills
|
|
855
|
+
|
|
856
|
+
- `skills sync` - Sync Bkper skills to `~/.agents/skills`
|
|
857
|
+
|
|
782
858
|
#### App Lifecycle
|
|
783
859
|
|
|
784
860
|
- `app init <name>` - Scaffold a new app from the template
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-dispatch.d.ts","sourceRoot":"","sources":["../../src/agent/cli-dispatch.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,GAAE,sBAGZ,GACF,OAAO,CAET"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function shouldStartAgentMode(argv, environment = {
|
|
2
|
+
stdinIsTTY: process.stdin.isTTY === true,
|
|
3
|
+
stdoutIsTTY: process.stdout.isTTY === true,
|
|
4
|
+
}) {
|
|
5
|
+
return argv.length === 2 && environment.stdinIsTTY && environment.stdoutIsTTY;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=cli-dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-dispatch.js","sourceRoot":"","sources":["../../src/agent/cli-dispatch.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,oBAAoB,CAChC,IAAc,EACd,cAAsC;IAClC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI;IACxC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;CAC7C;IAED,OAAO,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,UAAU,IAAI,WAAW,CAAC,WAAW,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type ReloadableResourceLoader = {
|
|
2
|
+
reload(): Promise<void>;
|
|
3
|
+
};
|
|
4
|
+
export interface AgentModeDependencies {
|
|
5
|
+
createResourceLoader: () => ReloadableResourceLoader;
|
|
6
|
+
createSession: (options: {
|
|
7
|
+
resourceLoader: ReloadableResourceLoader;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
session: unknown;
|
|
10
|
+
modelFallbackMessage?: string;
|
|
11
|
+
}>;
|
|
12
|
+
createInteractiveMode: (session: unknown, modelFallbackMessage?: string) => {
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function runAgentMode(dependencies?: AgentModeDependencies): Promise<void>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=run-agent-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-agent-mode.d.ts","sourceRoot":"","sources":["../../src/agent/run-agent-mode.ts"],"names":[],"mappings":"AASA,KAAK,wBAAwB,GAAG;IAC5B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IAClC,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;IACrD,aAAa,EAAE,CAAC,OAAO,EAAE;QACrB,cAAc,EAAE,wBAAwB,CAAC;KAC5C,KAAK,OAAO,CAAC;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;KACjC,CAAC,CAAC;IACH,qBAAqB,EAAE,CACnB,OAAO,EAAE,OAAO,EAChB,oBAAoB,CAAC,EAAE,MAAM,KAC5B;QACD,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;KACxB,CAAC;CACL;AA4BD,wBAAsB,YAAY,CAC9B,YAAY,GAAE,qBAAmD,GAClE,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { createAgentSession, DefaultResourceLoader, InteractiveMode, } from '@mariozechner/pi-coding-agent';
|
|
11
|
+
import { BKPER_AGENT_SYSTEM_PROMPT } from './system-prompt.js';
|
|
12
|
+
function createDefaultDependencies() {
|
|
13
|
+
return {
|
|
14
|
+
createResourceLoader: () => new DefaultResourceLoader({
|
|
15
|
+
systemPromptOverride: () => BKPER_AGENT_SYSTEM_PROMPT,
|
|
16
|
+
appendSystemPromptOverride: () => [],
|
|
17
|
+
extensionFactories: [
|
|
18
|
+
(pi) => {
|
|
19
|
+
pi.on('session_start', (_event, ctx) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
ctx.ui.notify('Bkper Agent ready.', 'info');
|
|
21
|
+
}));
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
}),
|
|
25
|
+
createSession: (_a) => __awaiter(this, [_a], void 0, function* ({ resourceLoader }) {
|
|
26
|
+
return createAgentSession({
|
|
27
|
+
resourceLoader: resourceLoader,
|
|
28
|
+
});
|
|
29
|
+
}),
|
|
30
|
+
createInteractiveMode: (session, modelFallbackMessage) => new InteractiveMode(session, {
|
|
31
|
+
modelFallbackMessage,
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function runAgentMode() {
|
|
36
|
+
return __awaiter(this, arguments, void 0, function* (dependencies = createDefaultDependencies()) {
|
|
37
|
+
var _a;
|
|
38
|
+
var _b;
|
|
39
|
+
(_a = (_b = process.env).PI_SKIP_VERSION_CHECK) !== null && _a !== void 0 ? _a : (_b.PI_SKIP_VERSION_CHECK = '1');
|
|
40
|
+
const resourceLoader = dependencies.createResourceLoader();
|
|
41
|
+
yield resourceLoader.reload();
|
|
42
|
+
const { session, modelFallbackMessage } = yield dependencies.createSession({ resourceLoader });
|
|
43
|
+
const mode = dependencies.createInteractiveMode(session, modelFallbackMessage);
|
|
44
|
+
yield mode.run();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=run-agent-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-agent-mode.js","sourceRoot":"","sources":["../../src/agent/run-agent-mode.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,GAGlB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAsB/D,SAAS,yBAAyB;IAC9B,OAAO;QACH,oBAAoB,EAAE,GAAG,EAAE,CACvB,IAAI,qBAAqB,CAAC;YACtB,oBAAoB,EAAE,GAAG,EAAE,CAAC,yBAAyB;Y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5
|
+
export declare function runStartupMaintenance(dependencies?: StartupMaintenanceDependencies): void;
|
|
6
|
+
//# sourceMappingURL=startup-maintenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-maintenance.d.ts","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,8BAA8B;IAC3C,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC;AASD,wBAAgB,qBAAqB,CACjC,YAAY,GAAE,8BAA4D,GAC3E,IAAI,CAQN"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { updateSkills } from '../commands/skills.js';
|
|
2
|
+
import { autoUpgrade } from '../upgrade/index.js';
|
|
3
|
+
function createDefaultDependencies() {
|
|
4
|
+
return {
|
|
5
|
+
autoUpgrade,
|
|
6
|
+
updateSkills: () => updateSkills({ silent: true }),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function runStartupMaintenance(dependencies = createDefaultDependencies()) {
|
|
10
|
+
if (!process.env.BKPER_DISABLE_AUTOUPDATE) {
|
|
11
|
+
dependencies.autoUpgrade().catch(() => { });
|
|
12
|
+
}
|
|
13
|
+
if (!process.env.BKPER_DISABLE_SKILLS_SYNC) {
|
|
14
|
+
dependencies.updateSkills().catch(() => { });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=startup-maintenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-maintenance.js","sourceRoot":"","sources":["../../src/agent/startup-maintenance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOlD,SAAS,yBAAyB;IAC9B,OAAO;QACH,WAAW;QACX,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KACrD,CAAC;AACN,CAAC;AAED,MAAM,UAAU,qBAAqB,CACjC,eAA+C,yBAAyB,EAAE;IAE1E,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC;QACxC,YAAY,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC;QACzC,YAAY,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;IAChD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const BKPER_AGENT_SYSTEM_PROMPT = "# You are a Bkper team member\n\nYou think in resources, movements, and balances \u2014 not debits and credits. You extend meaning with properties before adding structural complexity. You protect the zero-sum invariant above all else.\n\n## Core Concepts Canon\n\n- Bkper tracks resources as movements **from one Account to another**.\n- The system enforces a strict **zero-sum invariant** at Book level: nothing is created or destroyed, only transferred.\n- A **Transaction** is the atomic event with date, amount, from Account, to Account, and description.\n- Transaction states define balance impact: **Draft** does not impact balances; **Unchecked** and **Checked** impact balances; **Trashed** removes impact but preserves auditability.\n- Account types govern balance behavior:\n - **Asset** and **Liability** are permanent (cumulative position to a date).\n - **Incoming** and **Outgoing** are non-permanent (activity within a period).\n- **Groups** organize and aggregate Accounts for analysis; they do not alter ledger truth.\n- **Custom Properties** (`key=value`) are first-class semantic bindings across Books, Accounts, Groups, Transactions, Collections, and Files.\n- Use Custom Properties to map core concepts to higher-level domains (invoice, project, tax, SKU, cost center) without changing the core model.\n- Prefer adding meaning with properties before introducing structural complexity.\n- **Balances** are derived from Transactions, never an independent source of truth.\n- A **Book** is a self-contained ledger that always balances to zero.\n- **Collections** organize multiple Books; each Book remains independently balanced.\n\n## Operating Principles\n\n- Preserve invariants and data integrity first, then user intent, then implementation convenience.\n- Model domain and flows before coding; represent business reality, not technical shortcuts.\n- Design for global readiness from day one: currencies, timezones, units, formats.\n- For conceptual questions, answer directly and concisely before reaching for tools.\n";
|
|
2
|
+
//# sourceMappingURL=system-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,igEA2BrC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const BKPER_AGENT_SYSTEM_PROMPT = `# You are a Bkper team member
|
|
2
|
+
|
|
3
|
+
You think in resources, movements, and balances — not debits and credits. You extend meaning with properties before adding structural complexity. You protect the zero-sum invariant above all else.
|
|
4
|
+
|
|
5
|
+
## Core Concepts Canon
|
|
6
|
+
|
|
7
|
+
- Bkper tracks resources as movements **from one Account to another**.
|
|
8
|
+
- The system enforces a strict **zero-sum invariant** at Book level: nothing is created or destroyed, only transferred.
|
|
9
|
+
- A **Transaction** is the atomic event with date, amount, from Account, to Account, and description.
|
|
10
|
+
- Transaction states define balance impact: **Draft** does not impact balances; **Unchecked** and **Checked** impact balances; **Trashed** removes impact but preserves auditability.
|
|
11
|
+
- Account types govern balance behavior:
|
|
12
|
+
- **Asset** and **Liability** are permanent (cumulative position to a date).
|
|
13
|
+
- **Incoming** and **Outgoing** are non-permanent (activity within a period).
|
|
14
|
+
- **Groups** organize and aggregate Accounts for analysis; they do not alter ledger truth.
|
|
15
|
+
- **Custom Properties** (\`key=value\`) are first-class semantic bindings across Books, Accounts, Groups, Transactions, Collections, and Files.
|
|
16
|
+
- Use Custom Properties to map core concepts to higher-level domains (invoice, project, tax, SKU, cost center) without changing the core model.
|
|
17
|
+
- Prefer adding meaning with properties before introducing structural complexity.
|
|
18
|
+
- **Balances** are derived from Transactions, never an independent source of truth.
|
|
19
|
+
- A **Book** is a self-contained ledger that always balances to zero.
|
|
20
|
+
- **Collections** organize multiple Books; each Book remains independently balanced.
|
|
21
|
+
|
|
22
|
+
## Operating Principles
|
|
23
|
+
|
|
24
|
+
- Preserve invariants and data integrity first, then user intent, then implementation convenience.
|
|
25
|
+
- Model domain and flows before coding; represent business reality, not technical shortcuts.
|
|
26
|
+
- Design for global readiness from day one: currencies, timezones, units, formats.
|
|
27
|
+
- For conceptual questions, answer directly and concisely before reaching for tools.
|
|
28
|
+
`;
|
|
29
|
+
//# sourceMappingURL=system-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BxC,CAAC"}
|
package/lib/cli.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
import 'dotenv/config'; // Must be first to load env vars before other imports
|
|
3
12
|
import { program } from 'commander';
|
|
4
13
|
import { registerAuthCommands } from './commands/auth/register.js';
|
|
@@ -10,27 +19,49 @@ import { registerTransactionCommands } from './commands/transactions/register.js
|
|
|
10
19
|
import { registerBalanceCommands } from './commands/balances/register.js';
|
|
11
20
|
import { registerCollectionCommands } from './commands/collections/register.js';
|
|
12
21
|
import { registerUpgradeCommand } from './commands/upgrade.js';
|
|
22
|
+
import { registerSkillsCommands } from './commands/skills-command.js';
|
|
23
|
+
import { registerAgentCommands } from './commands/agent-command.js';
|
|
13
24
|
import { VERSION, autoUpgrade } from './upgrade/index.js';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
import { shouldStartAgentMode } from './agent/cli-dispatch.js';
|
|
26
|
+
import { runAgentMode } from './agent/run-agent-mode.js';
|
|
27
|
+
import { runStartupMaintenance } from './agent/startup-maintenance.js';
|
|
28
|
+
function main() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
if (shouldStartAgentMode(process.argv)) {
|
|
31
|
+
runStartupMaintenance();
|
|
32
|
+
yield runAgentMode();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Version
|
|
36
|
+
program.version(VERSION, '-v, --version');
|
|
37
|
+
// Global output format options
|
|
38
|
+
program.option('--format <format>', 'Output format: table, json, or csv', 'table');
|
|
39
|
+
program.option('--json', 'Output as JSON (alias for --format json)');
|
|
40
|
+
// Auth commands
|
|
41
|
+
registerAuthCommands(program);
|
|
42
|
+
// Resource commands
|
|
43
|
+
registerAppCommands(program);
|
|
44
|
+
registerBookCommands(program);
|
|
45
|
+
registerAccountCommands(program);
|
|
46
|
+
registerGroupCommands(program);
|
|
47
|
+
registerTransactionCommands(program);
|
|
48
|
+
registerBalanceCommands(program);
|
|
49
|
+
registerCollectionCommands(program);
|
|
50
|
+
// Skills command
|
|
51
|
+
registerSkillsCommands(program);
|
|
52
|
+
// Agent bridge command
|
|
53
|
+
registerAgentCommands(program);
|
|
54
|
+
// Upgrade command
|
|
55
|
+
registerUpgradeCommand(program);
|
|
56
|
+
// Trigger silent auto-upgrade in the background (non-blocking, never fails)
|
|
57
|
+
if (!process.env.BKPER_DISABLE_AUTOUPDATE) {
|
|
58
|
+
autoUpgrade().catch(() => { });
|
|
59
|
+
}
|
|
60
|
+
program.parse(process.argv);
|
|
61
|
+
});
|
|
34
62
|
}
|
|
35
|
-
|
|
63
|
+
main().catch(err => {
|
|
64
|
+
console.error(err);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
});
|
|
36
67
|
//# sourceMappingURL=cli.js.map
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,eAAe,CAAC,CAAC,sDAAsD;AAE9E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,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C;YACxC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CAAA;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IACf,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
export interface AgentCommandDependencies {
|
|
3
|
+
runPi: (args: string[]) => Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare function registerAgentCommands(program: Command, dependencies?: AgentCommandDependencies): void;
|
|
6
|
+
//# sourceMappingURL=agent-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-command.d.ts","sourceRoot":"","sources":["../../src/commands/agent-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,MAAM,WAAW,wBAAwB;IACrC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5C;AAoBD,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,OAAO,EAChB,YAAY,GAAE,wBAAsD,GACrE,IAAI,CAeN"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { main as runPiMain } from '@mariozechner/pi-coding-agent';
|
|
11
|
+
import { BKPER_AGENT_SYSTEM_PROMPT } from '../agent/system-prompt.js';
|
|
12
|
+
function createDefaultDependencies() {
|
|
13
|
+
return {
|
|
14
|
+
runPi: (args) => runPiMain(args),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function hasSystemPromptArg(args) {
|
|
18
|
+
return args.some(arg => arg === '--system-prompt' || arg.startsWith('--system-prompt='));
|
|
19
|
+
}
|
|
20
|
+
function buildPiArgs(args) {
|
|
21
|
+
if (hasSystemPromptArg(args)) {
|
|
22
|
+
return args;
|
|
23
|
+
}
|
|
24
|
+
return ['--system-prompt', BKPER_AGENT_SYSTEM_PROMPT, ...args];
|
|
25
|
+
}
|
|
26
|
+
export function registerAgentCommands(program, dependencies = createDefaultDependencies()) {
|
|
27
|
+
program
|
|
28
|
+
.command('agent [piArgs...]')
|
|
29
|
+
.description('Run Pi CLI with Bkper defaults (passthrough)')
|
|
30
|
+
.allowUnknownOption(true)
|
|
31
|
+
.allowExcessArguments(true)
|
|
32
|
+
.action((...args_1) => __awaiter(this, [...args_1], void 0, function* (piArgs = []) {
|
|
33
|
+
try {
|
|
34
|
+
const args = buildPiArgs(piArgs);
|
|
35
|
+
yield dependencies.runPi(args);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
console.error('Error running agent command:', err);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=agent-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-command.js","sourceRoot":"","sources":["../../src/commands/agent-command.ts"],"names":[],"mappings":";;;;;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@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/apps/init.ts"],"names":[],"mappings":"AA2LA;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkEzD"}
|
|
@@ -13,7 +13,6 @@ import path from 'path';
|
|
|
13
13
|
import { Readable } from 'stream';
|
|
14
14
|
import * as tar from 'tar';
|
|
15
15
|
import * as YAML from 'yaml';
|
|
16
|
-
import { updateSkills } from '../skills.js';
|
|
17
16
|
// =============================================================================
|
|
18
17
|
// Constants
|
|
19
18
|
// =============================================================================
|
|
@@ -214,21 +213,7 @@ export function initApp(name) {
|
|
|
214
213
|
console.error('Error updating package.json:', err instanceof Error ? err.message : err);
|
|
215
214
|
process.exit(1);
|
|
216
215
|
}
|
|
217
|
-
// 6.
|
|
218
|
-
try {
|
|
219
|
-
const result = yield updateSkills();
|
|
220
|
-
if (result.updated.length > 0) {
|
|
221
|
-
console.log(` Synced skills (${result.updated.join(', ')})`);
|
|
222
|
-
}
|
|
223
|
-
else if (result.skipped && result.commit) {
|
|
224
|
-
console.log(` Skills up to date (${result.commit.substring(0, 7)})`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
catch (err) {
|
|
228
|
-
// Skills sync is non-fatal, just warn
|
|
229
|
-
console.log(' Warning: Could not sync skills:', err instanceof Error ? err.message : err);
|
|
230
|
-
}
|
|
231
|
-
// 7. Install dependencies
|
|
216
|
+
// 6. Install dependencies
|
|
232
217
|
console.log(' Installing dependencies...');
|
|
233
218
|
try {
|
|
234
219
|
yield runCommand('bun', ['install'], targetDir);
|
|
@@ -237,7 +222,7 @@ export function initApp(name) {
|
|
|
237
222
|
catch (err) {
|
|
238
223
|
console.log(' Warning: Could not install dependencies. Run "bun install" manually.');
|
|
239
224
|
}
|
|
240
|
-
//
|
|
225
|
+
// 7. Print success message
|
|
241
226
|
console.log(`
|
|
242
227
|
Done! To get started:
|
|
243
228
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/apps/init.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/apps/init.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,aAAa,GAAG,0BAA0B,CAAC;AACjD,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAY;IACjC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,0BAA0B,EAAE,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,IAAI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,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACxF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;QAED,0BAA0B;QAC1B,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;QAC5C,IAAI,CAAC;YACD,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QAC5C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;QAC1F,CAAC;QAED,2BAA2B;QAC3B,OAAO,CAAC,GAAG,CAAC;;;OAGT,IAAI;;CAEV,CAAC,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type UpdateSkillsResult } from './skills.js';
|
|
3
|
+
export interface SkillsCommandDependencies {
|
|
4
|
+
updateSkills: () => Promise<UpdateSkillsResult>;
|
|
5
|
+
log: (message: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function registerSkillsCommands(program: Command, dependencies?: SkillsCommandDependencies): void;
|
|
8
|
+
//# sourceMappingURL=skills-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills-command.d.ts","sourceRoot":"","sources":["../../src/commands/skills-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,WAAW,yBAAyB;IACtC,YAAY,EAAE,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAChD,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AASD,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,OAAO,EAChB,YAAY,GAAE,yBAAuD,GACtE,IAAI,CA2BN"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { withAction } from './action.js';
|
|
11
|
+
import { updateSkills } from './skills.js';
|
|
12
|
+
function createDefaultDependencies() {
|
|
13
|
+
return {
|
|
14
|
+
updateSkills: () => updateSkills(),
|
|
15
|
+
log: message => console.log(message),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function registerSkillsCommands(program, dependencies = createDefaultDependencies()) {
|
|
19
|
+
const skillsCommand = program.command('skills').description('Manage Bkper skills');
|
|
20
|
+
skillsCommand
|
|
21
|
+
.command('sync')
|
|
22
|
+
.description('Sync Bkper skills to ~/.agents/skills')
|
|
23
|
+
.action(withAction('syncing skills', () => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const result = yield dependencies.updateSkills();
|
|
25
|
+
if (result.updated.length > 0) {
|
|
26
|
+
dependencies.log(`Synced skills (${result.updated.join(', ')})`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (result.reason) {
|
|
30
|
+
dependencies.log(result.reason);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
dependencies.log('No skill updates found.');
|
|
34
|
+
}), { skipSetup: true }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=skills-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills-command.js","sourceRoot":"","sources":["../../src/commands/skills-command.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAA2B,MAAM,aAAa,CAAC;AAOpE,SAAS,yBAAyB;IAC9B,OAAO;QACH,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE;QAClC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;KACvC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,sBAAsB,CAClC,OAAgB,EAChB,eAA0C,yBAAyB,EAAE;IAErE,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAEnF,aAAa;SACR,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,uCAAuC,CAAC;SACpD,MAAM,CACH,UAAU,CACN,gBAAgB,EAChB,GAAS,EAAE;QACP,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,YAAY,EAAE,CAAC;QAEjD,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,YAAY,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO;QACX,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,OAAO;QACX,CAAC;QAED,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IAChD,CAAC,CAAA,EACD,EAAE,SAAS,EAAE,IAAI,EAAE,CACtB,CACJ,CAAC;AACV,CAAC"}
|
package/lib/commands/skills.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
+
export declare function getSkillsDirectory(homeDir?: string): string;
|
|
2
|
+
export declare function getSkillsStateFile(homeDir?: string): string;
|
|
1
3
|
export interface UpdateSkillsResult {
|
|
2
4
|
updated: string[];
|
|
3
5
|
skipped: boolean;
|
|
4
6
|
reason?: string;
|
|
5
7
|
commit?: string;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* with ~/.config/bkper/skills.yaml. If commits differ, downloads all
|
|
12
|
-
* bkper-* skills.
|
|
13
|
-
*
|
|
14
|
-
* @returns Result indicating what was updated
|
|
15
|
-
*/
|
|
16
|
-
export declare function updateSkills(): Promise<UpdateSkillsResult>;
|
|
9
|
+
export interface UpdateSkillsOptions {
|
|
10
|
+
silent?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function updateSkills(options?: UpdateSkillsOptions): Promise<UpdateSkillsResult>;
|
|
17
13
|
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":"AAyBA,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,MAAqB,GAAG,MAAM,CAEzE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,MAAqB,GAAG,MAAM,CAEzE;AAuID,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAgEjG"}
|
package/lib/commands/skills.js
CHANGED
|
@@ -11,27 +11,21 @@ import fs from 'fs';
|
|
|
11
11
|
import os from 'os';
|
|
12
12
|
import path from 'path';
|
|
13
13
|
import * as YAML from 'yaml';
|
|
14
|
-
// =============================================================================
|
|
15
|
-
// Constants
|
|
16
|
-
// =============================================================================
|
|
17
14
|
const SKILLS_REPO = 'bkper/skills';
|
|
18
15
|
const SKILLS_BASE_PATH = 'skills';
|
|
19
16
|
const GITHUB_API_BASE = 'https://api.github.com';
|
|
20
17
|
const GITHUB_RAW_BASE = 'https://raw.githubusercontent.com';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// =============================================================================
|
|
28
|
-
/**
|
|
29
|
-
* Gets the current local commit SHA from ~/.config/bkper/skills.yaml
|
|
30
|
-
*/
|
|
18
|
+
export function getSkillsDirectory(homeDir = os.homedir()) {
|
|
19
|
+
return path.join(homeDir, '.agents', 'skills');
|
|
20
|
+
}
|
|
21
|
+
export function getSkillsStateFile(homeDir = os.homedir()) {
|
|
22
|
+
return path.join(getSkillsDirectory(homeDir), '.bkper-skills.yaml');
|
|
23
|
+
}
|
|
31
24
|
function getLocalCommit() {
|
|
25
|
+
const skillsStateFile = getSkillsStateFile();
|
|
32
26
|
try {
|
|
33
|
-
if (fs.existsSync(
|
|
34
|
-
const content = fs.readFileSync(
|
|
27
|
+
if (fs.existsSync(skillsStateFile)) {
|
|
28
|
+
const content = fs.readFileSync(skillsStateFile, 'utf8');
|
|
35
29
|
const state = YAML.parse(content);
|
|
36
30
|
return state.commit || null;
|
|
37
31
|
}
|
|
@@ -41,17 +35,12 @@ function getLocalCommit() {
|
|
|
41
35
|
}
|
|
42
36
|
return null;
|
|
43
37
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Saves the current commit SHA to ~/.config/bkper/skills.yaml
|
|
46
|
-
*/
|
|
47
38
|
function saveLocalCommit(commit) {
|
|
48
|
-
|
|
39
|
+
const skillsStateFile = getSkillsStateFile();
|
|
40
|
+
fs.mkdirSync(path.dirname(skillsStateFile), { recursive: true });
|
|
49
41
|
const state = { commit };
|
|
50
|
-
fs.writeFileSync(
|
|
42
|
+
fs.writeFileSync(skillsStateFile, YAML.stringify(state), 'utf8');
|
|
51
43
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Fetches the latest commit SHA that touched the skills/ folder.
|
|
54
|
-
*/
|
|
55
44
|
function fetchLatestCommit() {
|
|
56
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
46
|
const url = `${GITHUB_API_BASE}/repos/${SKILLS_REPO}/commits?path=${SKILLS_BASE_PATH}&per_page=1`;
|
|
@@ -71,9 +60,6 @@ function fetchLatestCommit() {
|
|
|
71
60
|
return commits[0].sha;
|
|
72
61
|
});
|
|
73
62
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Fetches the list of files in a GitHub directory.
|
|
76
|
-
*/
|
|
77
63
|
function fetchGitHubDirectory(repo, dirPath) {
|
|
78
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
65
|
const url = `${GITHUB_API_BASE}/repos/${repo}/contents/${dirPath}`;
|
|
@@ -89,9 +75,6 @@ function fetchGitHubDirectory(repo, dirPath) {
|
|
|
89
75
|
return response.json();
|
|
90
76
|
});
|
|
91
77
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Downloads a file from GitHub raw content.
|
|
94
|
-
*/
|
|
95
78
|
function downloadGitHubFile(repo, filePath) {
|
|
96
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
80
|
const url = `${GITHUB_RAW_BASE}/${repo}/main/${filePath}`;
|
|
@@ -106,9 +89,6 @@ function downloadGitHubFile(repo, filePath) {
|
|
|
106
89
|
return response.text();
|
|
107
90
|
});
|
|
108
91
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Recursively downloads a skill directory from GitHub.
|
|
111
|
-
*/
|
|
112
92
|
function downloadSkillDirectory(skillName, targetDir) {
|
|
113
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
114
94
|
const skillPath = `${SKILLS_BASE_PATH}/${skillName}`;
|
|
@@ -117,7 +97,6 @@ function downloadSkillDirectory(skillName, targetDir) {
|
|
|
117
97
|
const localPath = path.join(targetDir, file.name);
|
|
118
98
|
if (file.type === 'dir') {
|
|
119
99
|
fs.mkdirSync(localPath, { recursive: true });
|
|
120
|
-
// Recursively download subdirectory
|
|
121
100
|
const subFiles = yield fetchGitHubDirectory(SKILLS_REPO, file.path);
|
|
122
101
|
for (const subFile of subFiles) {
|
|
123
102
|
if (subFile.type === 'file' && subFile.download_url) {
|
|
@@ -133,64 +112,42 @@ function downloadSkillDirectory(skillName, targetDir) {
|
|
|
133
112
|
}
|
|
134
113
|
});
|
|
135
114
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*/
|
|
139
|
-
function clearBkperSkills() {
|
|
140
|
-
if (!fs.existsSync(SKILLS_DIR)) {
|
|
115
|
+
function clearBkperSkills(skillsDir) {
|
|
116
|
+
if (!fs.existsSync(skillsDir)) {
|
|
141
117
|
return;
|
|
142
118
|
}
|
|
143
|
-
const entries = fs.readdirSync(
|
|
119
|
+
const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
144
120
|
for (const entry of entries) {
|
|
145
121
|
if (entry.isDirectory() && entry.name.startsWith('bkper-')) {
|
|
146
|
-
fs.rmSync(path.join(
|
|
122
|
+
fs.rmSync(path.join(skillsDir, entry.name), { recursive: true });
|
|
147
123
|
}
|
|
148
124
|
}
|
|
149
125
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Gets the list of available skills from GitHub.
|
|
152
|
-
*/
|
|
153
126
|
function fetchAvailableSkills() {
|
|
154
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
155
128
|
const files = yield fetchGitHubDirectory(SKILLS_REPO, SKILLS_BASE_PATH);
|
|
156
129
|
return files.filter(f => f.type === 'dir' && f.name.startsWith('bkper-')).map(f => f.name);
|
|
157
130
|
});
|
|
158
131
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*/
|
|
162
|
-
function getInstalledBkperSkills() {
|
|
163
|
-
if (!fs.existsSync(SKILLS_DIR)) {
|
|
132
|
+
function getInstalledBkperSkills(skillsDir) {
|
|
133
|
+
if (!fs.existsSync(skillsDir)) {
|
|
164
134
|
return [];
|
|
165
135
|
}
|
|
166
|
-
const entries = fs.readdirSync(
|
|
136
|
+
const entries = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
167
137
|
return entries
|
|
168
138
|
.filter(entry => entry.isDirectory() && entry.name.startsWith('bkper-'))
|
|
169
139
|
.map(entry => entry.name);
|
|
170
140
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Returns a short version of the commit SHA for display.
|
|
173
|
-
*/
|
|
174
141
|
function shortSha(sha) {
|
|
175
142
|
return sha.substring(0, 7);
|
|
176
143
|
}
|
|
177
|
-
/**
|
|
178
|
-
* Updates global Bkper skills in ~/.claude/skills/
|
|
179
|
-
*
|
|
180
|
-
* Fetches the latest commit SHA that touched the skills/ folder and compares
|
|
181
|
-
* with ~/.config/bkper/skills.yaml. If commits differ, downloads all
|
|
182
|
-
* bkper-* skills.
|
|
183
|
-
*
|
|
184
|
-
* @returns Result indicating what was updated
|
|
185
|
-
*/
|
|
186
144
|
export function updateSkills() {
|
|
187
|
-
return __awaiter(this,
|
|
145
|
+
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
146
|
+
const skillsDir = getSkillsDirectory();
|
|
188
147
|
try {
|
|
189
|
-
// 1. Fetch latest commit that touched skills/
|
|
190
148
|
const remoteCommit = yield fetchLatestCommit();
|
|
191
149
|
const localCommit = getLocalCommit();
|
|
192
|
-
|
|
193
|
-
const installedSkills = getInstalledBkperSkills();
|
|
150
|
+
const installedSkills = getInstalledBkperSkills(skillsDir);
|
|
194
151
|
const skillsExist = installedSkills.length > 0;
|
|
195
152
|
if (remoteCommit === localCommit && skillsExist) {
|
|
196
153
|
return {
|
|
@@ -200,7 +157,6 @@ export function updateSkills() {
|
|
|
200
157
|
commit: localCommit,
|
|
201
158
|
};
|
|
202
159
|
}
|
|
203
|
-
// 3. Get list of available skills
|
|
204
160
|
const availableSkills = yield fetchAvailableSkills();
|
|
205
161
|
if (availableSkills.length === 0) {
|
|
206
162
|
return {
|
|
@@ -209,25 +165,22 @@ export function updateSkills() {
|
|
|
209
165
|
reason: 'No bkper-* skills found in repository',
|
|
210
166
|
};
|
|
211
167
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// 5. Create skills directory
|
|
215
|
-
fs.mkdirSync(SKILLS_DIR, { recursive: true });
|
|
216
|
-
// 6. Download all skills
|
|
168
|
+
clearBkperSkills(skillsDir);
|
|
169
|
+
fs.mkdirSync(skillsDir, { recursive: true });
|
|
217
170
|
const updated = [];
|
|
218
171
|
for (const skillName of availableSkills) {
|
|
219
|
-
const skillTargetDir = path.join(
|
|
172
|
+
const skillTargetDir = path.join(skillsDir, skillName);
|
|
220
173
|
fs.mkdirSync(skillTargetDir, { recursive: true });
|
|
221
174
|
try {
|
|
222
175
|
yield downloadSkillDirectory(skillName, skillTargetDir);
|
|
223
176
|
updated.push(skillName);
|
|
224
177
|
}
|
|
225
178
|
catch (err) {
|
|
226
|
-
|
|
227
|
-
|
|
179
|
+
if (!options.silent) {
|
|
180
|
+
console.error(` Warning: Failed to download skill '${skillName}':`, err instanceof Error ? err.message : err);
|
|
181
|
+
}
|
|
228
182
|
}
|
|
229
183
|
}
|
|
230
|
-
// 7. Save new commit
|
|
231
184
|
saveLocalCommit(remoteCommit);
|
|
232
185
|
return {
|
|
233
186
|
updated,
|
|
@@ -236,7 +189,6 @@ export function updateSkills() {
|
|
|
236
189
|
};
|
|
237
190
|
}
|
|
238
191
|
catch (err) {
|
|
239
|
-
// Network error or other failure - silently continue
|
|
240
192
|
return {
|
|
241
193
|
updated: [],
|
|
242
194
|
skipped: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/commands/skills.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAiB7B,MAAM,WAAW,GAAG,cAAc,CAAC;AACnC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAClC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACjD,MAAM,eAAe,GAAG,mCAAmC,CAAC;AAE5D,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,CAAC,OAAO,EAAE;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAkB,EAAE,CAAC,OAAO,EAAE;IAC7D,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,cAAc;IACnB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAE7C,IAAI,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YACzD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wBAClB,OAAO,CAAC,KAAK,CACT,wCAAwC,SAAS,IAAI,EACrD,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAC3C,CAAC;oBACN,CAAC;gBACL,CAAC;YACL,CAAC;YAED,eAAe,CAAC,YAAY,CAAC,CAAC;YAE9B,OAAO;gBACH,OAAO;gBACP,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,YAAY;aACvB,CAAC;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO;gBACH,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,gCAAgC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE;aACrF,CAAC;QACN,CAAC;IACL,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.3",
|
|
4
4
|
"description": "Command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://github.com/bkper/bkper-
|
|
8
|
+
"repository": "https://github.com/bkper/bkper-cli.git",
|
|
9
9
|
"homepage": "https://bkper.com/docs",
|
|
10
10
|
"author": "mael <mael@bkper.com>",
|
|
11
11
|
"license": "Apache-2.0",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@mariozechner/pi-coding-agent": "^0.58.4",
|
|
52
53
|
"bkper-js": "^2.29.4",
|
|
53
54
|
"commander": "^13.1.0",
|
|
54
55
|
"dotenv": "^8.2.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## 2026
|
|
4
|
-
|
|
5
|
-
### **February 2026**
|
|
6
|
-
|
|
7
|
-
- **CLI**
|
|
8
|
-
- Added `--format` flag with `table`, `json`, and `csv` output modes — replaces the `--json` flag
|
|
9
|
-
- CSV output follows RFC 4180 — raw values, all metadata, no truncation, ideal for spreadsheets and data pipelines
|
|
10
|
-
- Batch operations via stdin — pipe JSON or CSV data into create commands for bulk processing
|
|
11
|
-
- Table-formatted output is now the default for all commands
|
|
12
|
-
- Added `-b, --book` option for scoping commands to a specific [Book](https://bkper.com/docs)
|
|
13
|
-
- Added `-p, --properties` repeatable flag for setting custom properties as `key=value` pairs
|
|
14
|
-
- [Transaction](https://bkper.com/docs) tables show formatted dates and values with IDs
|
|
15
|
-
- [Group](https://bkper.com/docs) tables render as indented trees showing hierarchy
|
|
16
|
-
- Single-item commands display as indented key-value pairs
|
|
17
|
-
- Removed MCP server — now maintained as a separate project
|
|
18
|
-
- **Data Management**
|
|
19
|
-
- Added batch create for [Account](https://bkper.com/docs)s, [Group](https://bkper.com/docs)s, and [Transaction](https://bkper.com/docs)s — accepts JSON arrays or CSV via stdin
|
|
20
|
-
- Added [Book](https://bkper.com/docs) create command
|
|
21
|
-
- Added [Collection](https://bkper.com/docs) commands: create, list, get, update, delete, add-book, remove-book
|
|
22
|
-
- Added [Transaction](https://bkper.com/docs) update command
|
|
23
|
-
- Renamed `balance get` to `balance list` for consistency
|
|
24
|
-
- **Authentication**
|
|
25
|
-
- Switched to PKCE-based OAuth flow — no client secret required
|
|
26
|
-
- Branded OAuth callback pages for a polished sign-in experience
|
|
27
|
-
- **App Development**
|
|
28
|
-
- Local development now uses Cloudflare Tunnel for event handling — no cloud deployment needed during development
|
|
29
|
-
- Renamed `dev` environment to `preview` for clarity
|
|
30
|
-
- Added `--no-open` flag to suppress automatic browser launch during dev
|
|
31
|
-
|
|
32
|
-
### **January 2026**
|
|
33
|
-
|
|
34
|
-
- **App Platform**
|
|
35
|
-
- Added [`app init`](https://bkper.com/docs) command to scaffold new apps from template
|
|
36
|
-
- Added [`app deploy`](https://bkper.com/docs) and [`app undeploy`](https://bkper.com/docs) commands for managing deployments
|
|
37
|
-
- Added [`app status`](https://bkper.com/docs) to view current deployment information
|
|
38
|
-
- Added [`app dev`](https://bkper.com/docs) and [`app build`](https://bkper.com/docs) commands for local development and build workflows
|
|
39
|
-
- Added [`app secrets`](https://bkper.com/docs) management — put, list, and delete secrets for your apps
|
|
40
|
-
- Added [`app sync`](https://bkper.com/docs) command to push `bkper.yaml` configuration to the platform
|
|
41
|
-
- Support for shared packages in monorepo setups with hot reload
|
|
42
|
-
- Asset file uploads included in deployments
|
|
43
|
-
- Migrated app configuration from `bkperapp.yaml` to `bkper.yaml`
|
|
44
|
-
|
|
45
|
-
## 2025
|
|
46
|
-
|
|
47
|
-
### **October 2025**
|
|
48
|
-
|
|
49
|
-
- **MCP Server**
|
|
50
|
-
- Added smart [Transaction](https://bkper.com/docs) merging — combine multiple transactions based on date and account matching
|
|
51
|
-
- Simplified [Transaction](https://bkper.com/docs) creation — accounts are now optional for recording simple income and expenses
|
|
52
|
-
- Improved transaction data responses for better AI assistant integration
|
|
53
|
-
|
|
54
|
-
### **September 2025**
|
|
55
|
-
|
|
56
|
-
- **MCP Server**
|
|
57
|
-
- Streamlined transaction data for cleaner AI assistant responses
|
|
58
|
-
- Fixed credential storage to follow standard configuration directories
|
|
59
|
-
|
|
60
|
-
### **July 2025**
|
|
61
|
-
|
|
62
|
-
- **MCP Server**
|
|
63
|
-
- Added monthly and year-to-date [Balance](https://bkper.com/docs) analysis for AI assistants
|
|
64
|
-
- Improved date filtering with `before:` operator
|
|
65
|
-
- Added setup instructions for Claude Desktop and other AI tools
|
|
66
|
-
|
|
67
|
-
### **June 2025**
|
|
68
|
-
|
|
69
|
-
- **CLI**
|
|
70
|
-
- Introduced MCP server — connect AI assistants to your Bkper [Books](https://bkper.com/docs) with `bkper mcp start`
|
|
71
|
-
- Added [Book](https://bkper.com/docs) name filtering to quickly find specific books
|