bkper 4.9.1 → 4.10.1
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 +48 -16
- package/lib/agent/run-agent-mode.js +2 -2
- package/lib/agent/run-agent-mode.js.map +1 -1
- package/lib/agent/system-prompt.d.ts +1 -0
- package/lib/agent/system-prompt.d.ts.map +1 -1
- package/lib/agent/system-prompt.js +18 -0
- package/lib/agent/system-prompt.js.map +1 -1
- package/lib/commands/agent-command.js +2 -2
- package/lib/commands/agent-command.js.map +1 -1
- package/lib/docs/cli-reference.md +924 -0
- package/lib/docs-compliance/live-readme.d.ts +14 -0
- package/lib/docs-compliance/live-readme.d.ts.map +1 -0
- package/lib/docs-compliance/live-readme.js +89 -0
- package/lib/docs-compliance/live-readme.js.map +1 -0
- package/lib/docs-compliance/rules.d.ts +10 -0
- package/lib/docs-compliance/rules.d.ts.map +1 -0
- package/lib/docs-compliance/rules.js +74 -0
- package/lib/docs-compliance/rules.js.map +1 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -268,8 +268,11 @@ bkper transaction create -b abc123 --description "Office supplies"
|
|
|
268
268
|
bkper transaction create -b abc123 --date 2025-01-15 --amount 100.50 \
|
|
269
269
|
--from "Bank Account" --to "Office Supplies" --description "Printer paper"
|
|
270
270
|
|
|
271
|
-
# List transactions
|
|
272
|
-
bkper transaction list -b abc123 -q "
|
|
271
|
+
# List transactions for a full year (on:YYYY)
|
|
272
|
+
bkper transaction list -b abc123 -q "on:2025"
|
|
273
|
+
|
|
274
|
+
# List transactions for a month (on:YYYY-MM)
|
|
275
|
+
bkper transaction list -b abc123 -q "on:2025-01"
|
|
273
276
|
|
|
274
277
|
# List with custom properties included
|
|
275
278
|
bkper transaction list -b abc123 -q "account:Sales" -p
|
|
@@ -325,11 +328,11 @@ bkper transaction merge tx_123 tx_456 -b abc123
|
|
|
325
328
|
Query account balances and group totals.
|
|
326
329
|
|
|
327
330
|
```bash
|
|
328
|
-
# List balances for a
|
|
329
|
-
bkper balance list -b abc123 -q "
|
|
331
|
+
# List balances for a specific date (point-in-time)
|
|
332
|
+
bkper balance list -b abc123 -q "on:2025-12-31"
|
|
330
333
|
|
|
331
|
-
#
|
|
332
|
-
bkper balance list -b abc123 -q "
|
|
334
|
+
# Monthly balance evolution of one account during 2025
|
|
335
|
+
bkper balance list -b abc123 -q "account:'<accountName>' after:2025-01-01 before:2026-01-01 by:m" --expanded 2
|
|
333
336
|
```
|
|
334
337
|
|
|
335
338
|
<details>
|
|
@@ -340,6 +343,28 @@ bkper balance list -b abc123 -q "period:2025-01" --expanded 2
|
|
|
340
343
|
|
|
341
344
|
</details>
|
|
342
345
|
|
|
346
|
+
### Query semantics (transactions and balances)
|
|
347
|
+
|
|
348
|
+
Use the same query language across Bkper web app, CLI, and Google Sheets integrations.
|
|
349
|
+
|
|
350
|
+
- `on:` supports different granularities:
|
|
351
|
+
- `on:2025` → full year
|
|
352
|
+
- `on:2025-01` → full month
|
|
353
|
+
- `on:2025-01-31` → specific day
|
|
354
|
+
- `after:` is **inclusive** and `before:` is **exclusive**.
|
|
355
|
+
- Full year 2025: `after:2025-01-01 before:2026-01-01`
|
|
356
|
+
- For point-in-time statements (typically permanent accounts `ASSET`/`LIABILITY`), prefer `on:` or `before:`.
|
|
357
|
+
- For activity statements over a period (typically non-permanent accounts `INCOMING`/`OUTGOING`), prefer `after:` + `before:`.
|
|
358
|
+
- For statement-level analysis, prefer filtering by the report root group. Root names vary by book.
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
# Balance Sheet snapshot (point-in-time)
|
|
362
|
+
bkper balance list -b abc123 -q "group:'<balanceSheetRootGroup>' before:2026-01-01"
|
|
363
|
+
|
|
364
|
+
# P&L activity over 2025
|
|
365
|
+
bkper balance list -b abc123 -q "group:'<profitAndLossRootGroup>' after:2025-01-01 before:2026-01-01"
|
|
366
|
+
```
|
|
367
|
+
|
|
343
368
|
### Collections
|
|
344
369
|
|
|
345
370
|
Organize books into collections.
|
|
@@ -382,11 +407,11 @@ bkper collection delete col_789
|
|
|
382
407
|
|
|
383
408
|
All commands support three output formats via the `--format` global flag:
|
|
384
409
|
|
|
385
|
-
| Format | Flag | Best for
|
|
386
|
-
| ------ | -------------------------- |
|
|
387
|
-
| Table | `--format table` (default) | Human reading in the terminal
|
|
388
|
-
| JSON | `--format json` | Programmatic access, single-item detail
|
|
389
|
-
| CSV | `--format csv` |
|
|
410
|
+
| Format | Flag | Best for |
|
|
411
|
+
| ------ | -------------------------- | ------------------------------------------- |
|
|
412
|
+
| Table | `--format table` (default) | Human reading in the terminal |
|
|
413
|
+
| JSON | `--format json` | Programmatic access, single-item detail |
|
|
414
|
+
| CSV | `--format csv` | LLM consumption, spreadsheets, list reports |
|
|
390
415
|
|
|
391
416
|
```bash
|
|
392
417
|
# Table output (default)
|
|
@@ -406,13 +431,20 @@ bkper account list -b abc123 --format csv
|
|
|
406
431
|
- **Raw values** -- dates stay in ISO format, numbers are unformatted (no locale formatting)
|
|
407
432
|
- **Single-item commands** (e.g. `account get`, `transaction create`) fall back to JSON since CSV adds no value for non-tabular data
|
|
408
433
|
|
|
409
|
-
**
|
|
434
|
+
**LLM-first output guidance (important):**
|
|
435
|
+
|
|
436
|
+
When command output will be loaded into an LLM context (chat, prompt, memory, or agent reasoning), prefer:
|
|
437
|
+
|
|
438
|
+
- **`--format csv` for list commands** (`balance list`, `transaction list`, `account list`, etc.).
|
|
439
|
+
- **`--format json` for single-item commands** (`get`, `create`, `update`) and CLI-to-CLI pipelines.
|
|
440
|
+
|
|
441
|
+
CSV is significantly more token-efficient than JSON for tabular data, and for wide balance outputs it can reduce token usage by up to **95%**.
|
|
410
442
|
|
|
411
|
-
|
|
443
|
+
**Quick rule:**
|
|
412
444
|
|
|
413
|
-
- **
|
|
414
|
-
- **
|
|
415
|
-
- **
|
|
445
|
+
- **LLM consumption of lists/reports** → CSV
|
|
446
|
+
- **Programmatic processing / pipelines** → JSON
|
|
447
|
+
- **Human terminal reading** → Table
|
|
416
448
|
|
|
417
449
|
### Batch Operations & Piping
|
|
418
450
|
|
|
@@ -8,11 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { createAgentSession, DefaultResourceLoader, InteractiveMode, } from '@mariozechner/pi-coding-agent';
|
|
11
|
-
import {
|
|
11
|
+
import { getBkperAgentSystemPrompt } from './system-prompt.js';
|
|
12
12
|
function createDefaultDependencies() {
|
|
13
13
|
return {
|
|
14
14
|
createResourceLoader: () => new DefaultResourceLoader({
|
|
15
|
-
systemPromptOverride: () =>
|
|
15
|
+
systemPromptOverride: () => getBkperAgentSystemPrompt(),
|
|
16
16
|
appendSystemPromptOverride: () => [],
|
|
17
17
|
extensionFactories: [
|
|
18
18
|
(pi) => {
|
|
@@ -1 +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;
|
|
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,qBAAq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KPER_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
3
|
//# sourceMappingURL=system-prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAQA,wBAAgB,yBAAyB,IAAI,MAAM,CAWlD;AAED,eAAO,MAAM,yBAAyB,igEA2BrC,CAAC"}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
function resolveCliReferencePath() {
|
|
4
|
+
const thisDir = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
return path.resolve(thisDir, '..', 'docs', 'cli-reference.md');
|
|
6
|
+
}
|
|
7
|
+
export function getBkperAgentSystemPrompt() {
|
|
8
|
+
const cliRefPath = resolveCliReferencePath();
|
|
9
|
+
return `${BKPER_AGENT_SYSTEM_PROMPT}
|
|
10
|
+
## Bkper CLI Usage
|
|
11
|
+
|
|
12
|
+
Before executing \`bkper\` CLI commands, **read the full CLI reference** at:
|
|
13
|
+
|
|
14
|
+
\`\`\`
|
|
15
|
+
${cliRefPath}
|
|
16
|
+
\`\`\`
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
1
19
|
export const BKPER_AGENT_SYSTEM_PROMPT = `# You are a Bkper team member
|
|
2
20
|
|
|
3
21
|
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.
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,SAAS,uBAAuB;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,yBAAyB;IACrC,MAAM,UAAU,GAAG,uBAAuB,EAAE,CAAC;IAC7C,OAAO,GAAG,yBAAyB;;;;;;EAMrC,UAAU;;CAEX,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BxC,CAAC"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { main as runPiMain } from '@mariozechner/pi-coding-agent';
|
|
11
|
-
import {
|
|
11
|
+
import { getBkperAgentSystemPrompt } from '../agent/system-prompt.js';
|
|
12
12
|
function createDefaultDependencies() {
|
|
13
13
|
return {
|
|
14
14
|
runPi: (args) => runPiMain(args),
|
|
@@ -21,7 +21,7 @@ function buildPiArgs(args) {
|
|
|
21
21
|
if (hasSystemPromptArg(args)) {
|
|
22
22
|
return args;
|
|
23
23
|
}
|
|
24
|
-
return ['--system-prompt',
|
|
24
|
+
return ['--system-prompt', getBkperAgentSystemPrompt(), ...args];
|
|
25
25
|
}
|
|
26
26
|
export function registerAgentCommands(program, dependencies = createDefaultDependencies()) {
|
|
27
27
|
program
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-command.js","sourceRoot":"","sources":["../../src/commands/agent-command.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAMtE,SAAS,yBAAyB;IAC9B,OAAO;QACH,KAAK,EAAE,CAAC,IAAc,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC;KAC7C,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAc;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,iBAAi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