bkper 4.10.5 → 4.11.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.
package/README.md CHANGED
@@ -238,6 +238,16 @@ bkper group update "Cash" -b abc123 --hidden true
238
238
  bkper group delete "Cash" -b abc123
239
239
  ```
240
240
 
241
+ ### Book setup guidance (important)
242
+
243
+ When setting up a full Book or starter chart of accounts, prefer a hierarchical group structure by default.
244
+
245
+ Create top-level groups first, then child groups with `--parent`, then accounts with `--groups`.
246
+
247
+ Verify the resulting group hierarchy and account memberships before reporting success.
248
+
249
+ Avoid using the same name for a Group and an Account in the same Book.
250
+
241
251
  <details>
242
252
  <summary>Command reference</summary>
243
253
 
@@ -448,7 +458,7 @@ CSV is significantly more token-efficient than JSON for tabular data, and for wi
448
458
 
449
459
  ### Batch Operations & Piping
450
460
 
451
- Write commands (`account create`, `group create`, `transaction create`) accept JSON data piped via stdin for batch operations. The `transaction update` command also accepts stdin for batch updates. The input format follows the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts) exactly -- a single JSON object or an array of objects.
461
+ Write commands (`account create`, `transaction create`) accept JSON data piped via stdin for batch operations. The `transaction update` command also accepts stdin for batch updates. The input format follows the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts) exactly -- a single JSON object or an array of objects.
452
462
 
453
463
  ```bash
454
464
  # Create transactions
@@ -465,15 +475,13 @@ echo '[{
465
475
  echo '[{"name":"Cash","type":"ASSET"},{"name":"Revenue","type":"INCOMING"}]' | \
466
476
  bkper account create -b abc123
467
477
 
468
- # Create groups
469
- echo '[{"name":"Fixed Costs","hidden":true}]' | \
470
- bkper group create -b abc123
471
-
472
478
  # Pipe from a script
473
479
  python export_bank.py | bkper transaction create -b abc123
474
480
  ```
475
481
 
476
- The input follows the exact `bkper.Transaction`, `bkper.Account`, or `bkper.Group` type from the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts). Custom properties go inside the `properties` object.
482
+ The input follows the exact `bkper.Transaction` or `bkper.Account` type from the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts). Custom properties go inside the `properties` object.
483
+
484
+ Groups are created explicitly with `bkper group create --name` and optional `--parent` so hierarchy stays deterministic during setup.
477
485
 
478
486
  The `--property` CLI flag can override or delete properties from the stdin payload:
479
487
 
@@ -491,21 +499,17 @@ bkper account create -b abc123 < accounts.json
491
499
 
492
500
  **Piping between commands:**
493
501
 
494
- All JSON output is designed to be piped directly as stdin to other commands. The output of any list or batch create command can feed directly into a create or update command:
502
+ For resources that support stdin creation, JSON output can be piped directly into create or update commands:
495
503
 
496
504
  ```bash
497
505
  # Copy all accounts from one book to another
498
506
  bkper account list -b $BOOK_A --format json | bkper account create -b $BOOK_B
499
507
 
500
- # Copy all groups from one book to another
501
- bkper group list -b $BOOK_A --format json | bkper group create -b $BOOK_B
502
-
503
508
  # Copy transactions matching a query
504
509
  bkper transaction list -b $BOOK_A -q "after:2025-01-01" --format json | \
505
510
  bkper transaction create -b $BOOK_B
506
511
 
507
- # Clone a full chart of accounts: groups, then accounts, then transactions
508
- bkper group list -b $SOURCE --format json | bkper group create -b $DEST
512
+ # Clone accounts, then transactions
509
513
  bkper account list -b $SOURCE --format json | bkper account create -b $DEST
510
514
  bkper transaction list -b $SOURCE -q "after:2025-01-01" --format json | \
511
515
  bkper transaction create -b $DEST
@@ -555,15 +559,6 @@ Only the fields below are meaningful when creating or updating resources via std
555
559
  | `groups` | `[{"name":"..."}, ...]` | Groups to assign by name or id |
556
560
  | `properties` | `{"key": "value", ...}` | Custom key/value properties |
557
561
 
558
- **Group** (`bkper.Group`)
559
-
560
- | Field | Type | Notes |
561
- | ------------ | ---------------------------------- | -------------------------------- |
562
- | `name` | `string` | Group name (required) |
563
- | `hidden` | `boolean` | Hide from transactions main menu |
564
- | `parent` | `{"name":"..."}` or `{"id":"..."}` | Parent group for nesting |
565
- | `properties` | `{"key": "value", ...}` | Custom key/value properties |
566
-
567
562
  </details>
568
563
 
569
564
  ---
@@ -1,3 +1,3 @@
1
1
  export declare function getBkperAgentSystemPrompt(): string;
2
- 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\n\nBkper tracks resources \u2014 money, inventory, or anything countable \u2014 as movements between places. Every financial event is recorded as an amount moving **from** one Account **to** another. This from-to model replaces the traditional language of debits and credits with something intuitive: resources leave one place and arrive at another.\n\nThe system enforces a **zero-sum invariant** \u2014 the total of all records always equals zero. Nothing is created or destroyed, only transferred. This makes Bkper a double-entry bookkeeping system where every transaction automatically produces balanced entries.\n\nFor those familiar with traditional accounting, \"from\" corresponds to credit and \"to\" corresponds to debit \u2014 but the explicit flow eliminates the need to memorize these rules.\n\n## Accounts\n\n**Accounts** are the places where resources reside or flow through. An Account can represent a bank, a category, a customer, a project, or anything else that holds or transfers value. You define what each Account represents and structure them at whatever level of detail suits your needs.\n\nAn Account registers all incoming and outgoing amounts through transactions. The sum of these movements produces the account's **balance** \u2014 the net result of everything that has flowed in and out.\n\n## Account Types\n\nBkper organizes Accounts into four types that determine how an Account behaves and where it appears in your financial structure:\n\n- **Asset** (blue) \u2014 **permanent**. Real resources you own: bank accounts, cash, receivables. Balances carry forward continuously, showing your position at any point in time.\n- **Liability** (yellow) \u2014 **permanent**. Obligations you owe: credit cards, loans, supplier debts. Balances also carry forward continuously.\n- **Incoming** (green) \u2014 **non-permanent**. Revenue sources: salary, sales, interest. Balances track activity within a period and reset to zero for the next one.\n- **Outgoing** (red) \u2014 **non-permanent**. Expenses and costs: rent, supplies, payroll. Balances also track activity within a period.\n\n## Transactions\n\nA **Transaction** is the atomic unit of financial activity. It captures:\n\n- **Date** \u2014 when it happened\n- **Amount** \u2014 how much moved\n- **From Account** \u2014 where the resource came from\n- **To Account** \u2014 where it went\n- **Description** \u2014 what happened\n\nThe from-to model makes every event explicit and traceable.\n\nA transaction is nothing more than moving a resource from one place to another. When you pay a taxi for a ride, the amount that goes from your wallet to the driver represents a transaction.\n\nIf any essential element is missing, the transaction is saved as an incomplete draft.\n\n## Transaction States\n\nTransactions move through a lifecycle with four states:\n\n- **Draft** \u2014 incomplete or unposted. Does not affect balances.\n- **Unchecked** \u2014 posted and updates balances, but remains editable.\n- **Checked** \u2014 reviewed and locked for integrity.\n- **Trashed** \u2014 removed from balances, but recoverable.\n\nThis structure puts a **human in the loop** \u2014 you review and confirm before records become permanent.\n\n## Groups\n\n**Groups** organize Accounts into hierarchies for reporting and analysis. They don't change the underlying data \u2014 they provide structure for understanding it. Groups consolidate account balances, so you can see totals for categories like \"Expenses\" or \"Assets\" at a glance.\n\nGroups support hierarchies (groups of groups) and multiple perspectives \u2014 an Account can belong to different groups in different hierarchies.\n\nGroups inherit the nature of the accounts they contain:\n\n- **Asset-only group** \u2014 behaves as Asset (blue)\n- **Liability-only group** \u2014 behaves as Liability (yellow)\n- **Mixed Asset + Liability** \u2014 shows Equity (gray, net balance)\n- **Incoming-only group** \u2014 behaves as Income (green)\n- **Outgoing-only group** \u2014 behaves as Expense (red)\n- **Mixed Incoming + Outgoing** \u2014 shows Net Result (gray)\n\n## Books\n\nA **Book** is a self-contained ledger \u2014 the complete scope of an entity, whether an individual, a project, or a business. Every Account, Transaction, and Group lives within a Book, and every Book balances to zero. Books can track any countable resource using the same from-to model.\n\nThe sum of all credits and debits recorded in a Book always tallies to zero \u2014 nothing is created or destroyed, only transferred. For more complex entities, multiple Books can be organized into a Collection.\n\n## Example Flows\n\nThese examples show the same movement model in concrete situations. Some match the diagrams on this page. Others add common accrual flows that are easy to confuse.\n\nThese examples use Bkper's transaction shorthand `From >> To`, meaning the amount leaves the Account on the left and arrives at the Account on the right.\n\n| Situation | Transaction |\n| --- | --- |\n| Salary received | `Salary >> Bank Account` |\n| Investment funded | `Bank Account >> Investments` |\n| Dividends received | `Dividends >> Bank Account` |\n| Loan received | `Loan >> Bank Account` |\n| Rent paid | `Bank Account >> Rent` |\n| Transportation bought on credit card | `Credit Card >> Transportation` |\n\n**Buy on a credit card now, pay it later**\n\n| Step | Transaction |\n| --- | --- |\n| Purchase | `Credit Card >> Outgoing` |\n| Payment | `Bank Account >> Credit Card` |\n\n**Sell now and receive cash later**\n\n| Step | Transaction |\n| --- | --- |\n| Sale on credit | `Incoming >> Accounts Receivable` |\n| Interest added while unpaid | `Incoming >> Accounts Receivable` |\n| Collection | `Accounts Receivable >> Bank Account` |\n\n**Receive a supplier bill now and pay it later**\n\n| Step | Transaction |\n| --- | --- |\n| Bill received | `Accounts Payable >> Outgoing` |\n| Interest added while unpaid | `Accounts Payable >> Outgoing` |\n| Payment | `Bank Account >> Accounts Payable` |\n\n**Receive a loan now and repay principal later**\n\n| Step | Transaction |\n| --- | --- |\n| Loan proceeds | `Loan >> Bank Account` |\n| Principal repayment | `Bank Account >> Loan` |\n\nIn each case, the first movement records the position that was created \u2014 a receivable or a liability. The later movement settles that position. This keeps Incoming and Outgoing focused on activity, while Asset and Liability Accounts hold positions until they are cleared.\n\nIf a receivable or payable grows before settlement, record another movement to that same Account, then settle the total later.\n\n## Balances\n\n**Balances** are always calculated from Transactions, never stored independently. The total balance across all Accounts in a Book is always zero. Account type determines how balances behave over time:\n\n- **Permanent Accounts** (Asset & Liability) \u2014 balance **to a date**, showing cumulative position at a point in time.\n- **Non-permanent Accounts** (Incoming & Outgoing) \u2014 balance **within a period**, showing activity during a timeframe.\n\nBkper maintains a continuous ledger with no concept of closing periods \u2014 the same ledger serves all time-based queries automatically.\n\n## Custom Properties\n\n**Custom Properties** are key-value pairs attachable to any entity \u2014 Books, Accounts, Groups, Transactions, Collections, and Files. They add context, metadata, and meaning beyond core financial data.\n\nBy attaching properties like `invoice: inv123456` or `exc_code: BRL`, entities become rich with information that can drive automation and reporting \u2014 without changing the core model.\n\n## Hashtags\n\n**Hashtags** are lightweight labels on Transactions that enable multi-dimensional tracking. They complement the Account structure by adding dynamic categorization \u2014 a single transaction might carry `#team_marketing #project_alpha #q1_campaign`, enabling filtering and analysis from any perspective.\n\nUnlike Account structures, Hashtags can be added or removed as needs evolve, making them ideal for cost allocation, project tracking, and ad-hoc analysis.\n\n## Collections\n\n**Collections** group related Books for organization and consolidated views. Each Book remains self-contained and balanced \u2014 Collections simply provide navigation and structure across multiple Books. You might track resources in multiple currencies, or organize branch offices in one collection.\n\nCollections can also serve as references for automations (Bots or Apps) that work on all Books in the collection.\n\n## Events\n\nEvery action in a Book \u2014 posting a transaction, editing an account, adding a comment \u2014 generates an **Event**. Events record _who_ (a user) or _what_ (a bot, an automation) performed the action and _when_, forming a complete audit trail essential for collaboration and trust.\n\nEvents are also the foundation of Bkper's automation model. Bots and Agents listen for specific event types and react automatically \u2014 for example, calculating taxes when a transaction is posted or converting currencies when one is checked.\n\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
+ 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## 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";
3
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":"AASA,wBAAgB,yBAAyB,IAAI,MAAM,CAWlD;AAED,eAAO,MAAM,yBAAyB,kjTAYrC,CAAC"}
1
+ {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/agent/system-prompt.ts"],"names":[],"mappings":"AAaA,wBAAgB,yBAAyB,IAAI,MAAM,CAsBlD;AAED,eAAO,MAAM,yBAAyB,0nBAUrC,CAAC"}
@@ -1,28 +1,40 @@
1
1
  import { fileURLToPath } from 'node:url';
2
2
  import path from 'node:path';
3
- import { CORE_CONCEPTS_MARKDOWN } from './core-concepts.js';
4
3
  function resolveCliReferencePath() {
5
4
  const thisDir = path.dirname(fileURLToPath(import.meta.url));
6
5
  return path.resolve(thisDir, '..', 'docs', 'cli-reference.md');
7
6
  }
7
+ function resolveCoreConceptsPath() {
8
+ const thisDir = path.dirname(fileURLToPath(import.meta.url));
9
+ return path.resolve(thisDir, '..', 'docs', 'core-concepts.md');
10
+ }
8
11
  export function getBkperAgentSystemPrompt() {
9
12
  const cliRefPath = resolveCliReferencePath();
13
+ const coreConceptsPath = resolveCoreConceptsPath();
10
14
  return `${BKPER_AGENT_SYSTEM_PROMPT}
11
- ## Bkper CLI Usage
15
+ ## Reference Loading Rules
12
16
 
13
- Before executing \`bkper\` CLI commands, **read the full CLI reference** at:
17
+ If the task touches Bkper accounting semantics or data modeling — such as Accounts, Transactions, balances, account types, groups, books, or mapping real-world flows into Bkper — read:
18
+
19
+ \`\`\`
20
+ ${coreConceptsPath}
21
+ \`\`\`
22
+
23
+ If the task involves using or executing \`bkper\` CLI commands, read:
14
24
 
15
25
  \`\`\`
16
26
  ${cliRefPath}
17
27
  \`\`\`
28
+
29
+ For generic engineering work, you may proceed without loading either reference unless those semantics become relevant.
30
+
31
+ When in doubt, read first.
18
32
  `;
19
33
  }
20
34
  export const BKPER_AGENT_SYSTEM_PROMPT = `# You are a Bkper team member
21
35
 
22
36
  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.
23
37
 
24
- ${CORE_CONCEPTS_MARKDOWN}
25
-
26
38
  ## Operating Principles
27
39
 
28
40
  - Preserve invariants and data integrity first, then user intent, then implementation convenience.
@@ -1 +1 @@
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;AAC7B,OAAO,EAAC,sBAAsB,EAAC,MAAM,oBAAoB,CAAC;AAE1D,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;;;;EAIvC,sBAAsB;;;;;;;;CAQvB,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,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,MAAM,gBAAgB,GAAG,uBAAuB,EAAE,CAAC;IACnD,OAAO,GAAG,yBAAyB;;;;;;EAMrC,gBAAgB;;;;;;EAMhB,UAAU;;;;;;CAMX,CAAC;AACF,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;CAUxC,CAAC"}
@@ -3,5 +3,4 @@ export { getGroup } from './get.js';
3
3
  export { createGroup, CreateGroupOptions } from './create.js';
4
4
  export { updateGroup, UpdateGroupOptions } from './update.js';
5
5
  export { deleteGroup } from './delete.js';
6
- export { batchCreateGroups } from './batch-create.js';
7
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -3,5 +3,4 @@ export { getGroup } from './get.js';
3
3
  export { createGroup } from './create.js';
4
4
  export { updateGroup } from './update.js';
5
5
  export { deleteGroup } from './delete.js';
6
- export { batchCreateGroups } from './batch-create.js';
7
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/groups/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8F5D"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/register.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmF5D"}
@@ -11,8 +11,7 @@ import { withAction } from '../action.js';
11
11
  import { collectProperty } from '../cli-helpers.js';
12
12
  import { renderListResult, renderItem } from '../../render/index.js';
13
13
  import { validateRequiredOptions, throwIfErrors } from '../../utils/validation.js';
14
- import { parseStdinItems } from '../../input/index.js';
15
- import { listGroupsFormatted, getGroup, createGroup, updateGroup, deleteGroup, batchCreateGroups, } from './index.js';
14
+ import { listGroupsFormatted, getGroup, createGroup, updateGroup, deleteGroup } from './index.js';
16
15
  export function registerGroupCommands(program) {
17
16
  const groupCommand = program.command('group').description('Manage Groups');
18
17
  groupCommand
@@ -42,27 +41,17 @@ export function registerGroupCommands(program) {
42
41
  .option('--hidden', 'Hide the group')
43
42
  .option('-p, --property <key=value>', 'Set a property (repeatable)', collectProperty)
44
43
  .action(options => withAction('creating group', (format) => __awaiter(this, void 0, void 0, function* () {
45
- const stdinData = !process.stdin.isTTY ? yield parseStdinItems() : null;
46
- if (stdinData && stdinData.items.length > 0) {
47
- throwIfErrors(validateRequiredOptions(options, [{ name: 'book', flag: '--book' }]));
48
- yield batchCreateGroups(options.book, stdinData.items, options.property);
49
- }
50
- else if (stdinData && stdinData.items.length === 0) {
51
- console.log(JSON.stringify([], null, 2));
52
- }
53
- else {
54
- throwIfErrors(validateRequiredOptions(options, [
55
- { name: 'book', flag: '--book' },
56
- { name: 'name', flag: '--name' },
57
- ]));
58
- const group = yield createGroup(options.book, {
59
- name: options.name,
60
- parent: options.parent,
61
- hidden: options.hidden,
62
- property: options.property,
63
- });
64
- renderItem(group.json(), format);
65
- }
44
+ throwIfErrors(validateRequiredOptions(options, [
45
+ { name: 'book', flag: '--book' },
46
+ { name: 'name', flag: '--name' },
47
+ ]));
48
+ const group = yield createGroup(options.book, {
49
+ name: options.name,
50
+ parent: options.parent,
51
+ hidden: options.hidden,
52
+ property: options.property,
53
+ });
54
+ renderItem(group.json(), format);
66
55
  }))());
67
56
  groupCommand
68
57
  .command('update <idOrName>')
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/commands/groups/register.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACH,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,GACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IAClD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAE3E,YAAY;SACP,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,qBAAqB,EAAE,SAAS,CAAC;SACxC,MAAM,CAAC,OAAO,CAAC,EAAE,CACd,UAAU,CAAC,gBAAgB,EAAE,CAAM,MAAM,EAAC,EAAE;QACxC,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,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E,CAClC,UAAU,CAAC,gBAAgB,EAAE,CAAM,MAAM,EAAC,EAAE;QACxC,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACpF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxD,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC,CAAA,CAAC,EAAE,CACP,CAAC;AACV,CAAC"}
@@ -238,6 +238,16 @@ bkper group update "Cash" -b abc123 --hidden true
238
238
  bkper group delete "Cash" -b abc123
239
239
  ```
240
240
 
241
+ ### Book setup guidance (important)
242
+
243
+ When setting up a full Book or starter chart of accounts, prefer a hierarchical group structure by default.
244
+
245
+ Create top-level groups first, then child groups with `--parent`, then accounts with `--groups`.
246
+
247
+ Verify the resulting group hierarchy and account memberships before reporting success.
248
+
249
+ Avoid using the same name for a Group and an Account in the same Book.
250
+
241
251
  <details>
242
252
  <summary>Command reference</summary>
243
253
 
@@ -448,7 +458,7 @@ CSV is significantly more token-efficient than JSON for tabular data, and for wi
448
458
 
449
459
  ### Batch Operations & Piping
450
460
 
451
- Write commands (`account create`, `group create`, `transaction create`) accept JSON data piped via stdin for batch operations. The `transaction update` command also accepts stdin for batch updates. The input format follows the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts) exactly -- a single JSON object or an array of objects.
461
+ Write commands (`account create`, `transaction create`) accept JSON data piped via stdin for batch operations. The `transaction update` command also accepts stdin for batch updates. The input format follows the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts) exactly -- a single JSON object or an array of objects.
452
462
 
453
463
  ```bash
454
464
  # Create transactions
@@ -465,15 +475,13 @@ echo '[{
465
475
  echo '[{"name":"Cash","type":"ASSET"},{"name":"Revenue","type":"INCOMING"}]' | \
466
476
  bkper account create -b abc123
467
477
 
468
- # Create groups
469
- echo '[{"name":"Fixed Costs","hidden":true}]' | \
470
- bkper group create -b abc123
471
-
472
478
  # Pipe from a script
473
479
  python export_bank.py | bkper transaction create -b abc123
474
480
  ```
475
481
 
476
- The input follows the exact `bkper.Transaction`, `bkper.Account`, or `bkper.Group` type from the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts). Custom properties go inside the `properties` object.
482
+ The input follows the exact `bkper.Transaction` or `bkper.Account` type from the [Bkper API Types](https://raw.githubusercontent.com/bkper/bkper-api-types/refs/heads/master/index.d.ts). Custom properties go inside the `properties` object.
483
+
484
+ Groups are created explicitly with `bkper group create --name` and optional `--parent` so hierarchy stays deterministic during setup.
477
485
 
478
486
  The `--property` CLI flag can override or delete properties from the stdin payload:
479
487
 
@@ -491,21 +499,17 @@ bkper account create -b abc123 < accounts.json
491
499
 
492
500
  **Piping between commands:**
493
501
 
494
- All JSON output is designed to be piped directly as stdin to other commands. The output of any list or batch create command can feed directly into a create or update command:
502
+ For resources that support stdin creation, JSON output can be piped directly into create or update commands:
495
503
 
496
504
  ```bash
497
505
  # Copy all accounts from one book to another
498
506
  bkper account list -b $BOOK_A --format json | bkper account create -b $BOOK_B
499
507
 
500
- # Copy all groups from one book to another
501
- bkper group list -b $BOOK_A --format json | bkper group create -b $BOOK_B
502
-
503
508
  # Copy transactions matching a query
504
509
  bkper transaction list -b $BOOK_A -q "after:2025-01-01" --format json | \
505
510
  bkper transaction create -b $BOOK_B
506
511
 
507
- # Clone a full chart of accounts: groups, then accounts, then transactions
508
- bkper group list -b $SOURCE --format json | bkper group create -b $DEST
512
+ # Clone accounts, then transactions
509
513
  bkper account list -b $SOURCE --format json | bkper account create -b $DEST
510
514
  bkper transaction list -b $SOURCE -q "after:2025-01-01" --format json | \
511
515
  bkper transaction create -b $DEST
@@ -555,15 +559,6 @@ Only the fields below are meaningful when creating or updating resources via std
555
559
  | `groups` | `[{"name":"..."}, ...]` | Groups to assign by name or id |
556
560
  | `properties` | `{"key": "value", ...}` | Custom key/value properties |
557
561
 
558
- **Group** (`bkper.Group`)
559
-
560
- | Field | Type | Notes |
561
- | ------------ | ---------------------------------- | -------------------------------- |
562
- | `name` | `string` | Group name (required) |
563
- | `hidden` | `boolean` | Hide from transactions main menu |
564
- | `parent` | `{"name":"..."}` or `{"id":"..."}` | Parent group for nesting |
565
- | `properties` | `{"key": "value", ...}` | Custom key/value properties |
566
-
567
562
  </details>
568
563
 
569
564
  ---
@@ -1,6 +1,4 @@
1
- // AUTO-GENERATED FILE. DO NOT EDIT.
2
- // Source: https://bkper.com/docs/core-concepts.md
3
- export const CORE_CONCEPTS_MARKDOWN = `# Core Concepts
1
+ # Core Concepts
4
2
 
5
3
  Bkper tracks resources — money, inventory, or anything countable — as movements between places. Every financial event is recorded as an amount moving **from** one Account **to** another. This from-to model replaces the traditional language of debits and credits with something intuitive: resources leave one place and arrive at another.
6
4
 
@@ -75,46 +73,46 @@ The sum of all credits and debits recorded in a Book always tallies to zero —
75
73
 
76
74
  These examples show the same movement model in concrete situations. Some match the diagrams on this page. Others add common accrual flows that are easy to confuse.
77
75
 
78
- These examples use Bkper's transaction shorthand \`From >> To\`, meaning the amount leaves the Account on the left and arrives at the Account on the right.
76
+ These examples use Bkper's transaction shorthand `From >> To`, meaning the amount leaves the Account on the left and arrives at the Account on the right.
79
77
 
80
78
  | Situation | Transaction |
81
79
  | --- | --- |
82
- | Salary received | \`Salary >> Bank Account\` |
83
- | Investment funded | \`Bank Account >> Investments\` |
84
- | Dividends received | \`Dividends >> Bank Account\` |
85
- | Loan received | \`Loan >> Bank Account\` |
86
- | Rent paid | \`Bank Account >> Rent\` |
87
- | Transportation bought on credit card | \`Credit Card >> Transportation\` |
80
+ | Salary received | `Salary >> Bank Account` |
81
+ | Investment funded | `Bank Account >> Investments` |
82
+ | Dividends received | `Dividends >> Bank Account` |
83
+ | Loan received | `Loan >> Bank Account` |
84
+ | Rent paid | `Bank Account >> Rent` |
85
+ | Transportation bought on credit card | `Credit Card >> Transportation` |
88
86
 
89
87
  **Buy on a credit card now, pay it later**
90
88
 
91
89
  | Step | Transaction |
92
90
  | --- | --- |
93
- | Purchase | \`Credit Card >> Outgoing\` |
94
- | Payment | \`Bank Account >> Credit Card\` |
91
+ | Purchase | `Credit Card >> Outgoing` |
92
+ | Payment | `Bank Account >> Credit Card` |
95
93
 
96
94
  **Sell now and receive cash later**
97
95
 
98
96
  | Step | Transaction |
99
97
  | --- | --- |
100
- | Sale on credit | \`Incoming >> Accounts Receivable\` |
101
- | Interest added while unpaid | \`Incoming >> Accounts Receivable\` |
102
- | Collection | \`Accounts Receivable >> Bank Account\` |
98
+ | Sale on credit | `Incoming >> Accounts Receivable` |
99
+ | Interest added while unpaid | `Incoming >> Accounts Receivable` |
100
+ | Collection | `Accounts Receivable >> Bank Account` |
103
101
 
104
102
  **Receive a supplier bill now and pay it later**
105
103
 
106
104
  | Step | Transaction |
107
105
  | --- | --- |
108
- | Bill received | \`Accounts Payable >> Outgoing\` |
109
- | Interest added while unpaid | \`Accounts Payable >> Outgoing\` |
110
- | Payment | \`Bank Account >> Accounts Payable\` |
106
+ | Bill received | `Accounts Payable >> Outgoing` |
107
+ | Interest added while unpaid | `Accounts Payable >> Outgoing` |
108
+ | Payment | `Bank Account >> Accounts Payable` |
111
109
 
112
110
  **Receive a loan now and repay principal later**
113
111
 
114
112
  | Step | Transaction |
115
113
  | --- | --- |
116
- | Loan proceeds | \`Loan >> Bank Account\` |
117
- | Principal repayment | \`Bank Account >> Loan\` |
114
+ | Loan proceeds | `Loan >> Bank Account` |
115
+ | Principal repayment | `Bank Account >> Loan` |
118
116
 
119
117
  In each case, the first movement records the position that was created — a receivable or a liability. The later movement settles that position. This keeps Incoming and Outgoing focused on activity, while Asset and Liability Accounts hold positions until they are cleared.
120
118
 
@@ -133,11 +131,11 @@ Bkper maintains a continuous ledger with no concept of closing periods — the s
133
131
 
134
132
  **Custom Properties** are key-value pairs attachable to any entity — Books, Accounts, Groups, Transactions, Collections, and Files. They add context, metadata, and meaning beyond core financial data.
135
133
 
136
- By attaching properties like \`invoice: inv123456\` or \`exc_code: BRL\`, entities become rich with information that can drive automation and reporting — without changing the core model.
134
+ By attaching properties like `invoice: inv123456` or `exc_code: BRL`, entities become rich with information that can drive automation and reporting — without changing the core model.
137
135
 
138
136
  ## Hashtags
139
137
 
140
- **Hashtags** are lightweight labels on Transactions that enable multi-dimensional tracking. They complement the Account structure by adding dynamic categorization — a single transaction might carry \`#team_marketing #project_alpha #q1_campaign\`, enabling filtering and analysis from any perspective.
138
+ **Hashtags** are lightweight labels on Transactions that enable multi-dimensional tracking. They complement the Account structure by adding dynamic categorization — a single transaction might carry `#team_marketing #project_alpha #q1_campaign`, enabling filtering and analysis from any perspective.
141
139
 
142
140
  Unlike Account structures, Hashtags can be added or removed as needs evolve, making them ideal for cost allocation, project tracking, and ad-hoc analysis.
143
141
 
@@ -152,5 +150,3 @@ Collections can also serve as references for automations (Bots or Apps) that wor
152
150
  Every action in a Book — posting a transaction, editing an account, adding a comment — generates an **Event**. Events record _who_ (a user) or _what_ (a bot, an automation) performed the action and _when_, forming a complete audit trail essential for collaboration and trust.
153
151
 
154
152
  Events are also the foundation of Bkper's automation model. Bots and Agents listen for specific event types and react automatically — for example, calculating taxes when a transaction is posted or converting currencies when one is checked.
155
- `;
156
- //# sourceMappingURL=core-concepts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/docs-compliance/rules.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B;AA4BD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CA8E1E"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/docs-compliance/rules.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B;AA4BD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAsI1E"}
@@ -39,6 +39,24 @@ export function evaluateReadmeCompliance(content) {
39
39
  line: getLineNumber(content, periodMatch.index),
40
40
  });
41
41
  }
42
+ if (!content.includes('### Book setup guidance (important)')) {
43
+ errors.push({
44
+ code: 'missing-book-setup-guidance-title',
45
+ message: 'Missing `Book setup guidance (important)` section.',
46
+ });
47
+ }
48
+ if (!content.includes('Create top-level groups first, then child groups with `--parent`, then accounts with `--groups`.')) {
49
+ errors.push({
50
+ code: 'missing-book-setup-order-guidance',
51
+ message: 'Missing guidance to create top-level groups first, then child groups, then accounts.',
52
+ });
53
+ }
54
+ if (!content.includes('Verify the resulting group hierarchy and account memberships before reporting success.')) {
55
+ errors.push({
56
+ code: 'missing-book-setup-verification-guidance',
57
+ message: 'Missing guidance to verify hierarchy and account memberships before success.',
58
+ });
59
+ }
42
60
  if (!content.includes('LLM-first output guidance (important):')) {
43
61
  errors.push({
44
62
  code: 'missing-llm-guidance-title',
@@ -69,6 +87,25 @@ export function evaluateReadmeCompliance(content) {
69
87
  message: 'Missing explicit semantics for `after:` and `before:`.',
70
88
  });
71
89
  }
90
+ if (content.includes('Write commands (`account create`, `group create`, `transaction create`) accept JSON data piped via stdin')) {
91
+ errors.push({
92
+ code: 'group-create-stdin-documented',
93
+ message: 'README should not document stdin batch creation for `group create`.',
94
+ });
95
+ }
96
+ const groupPipePattern = /bkper\s+group\s+list\b.*\|\s*bkper\s+group\s+create\b/;
97
+ if (groupPipePattern.test(content)) {
98
+ errors.push({
99
+ code: 'group-create-pipe-documented',
100
+ message: 'README should not document piping group JSON into `group create`.',
101
+ });
102
+ }
103
+ if (content.includes('**Group** (`bkper.Group`)')) {
104
+ errors.push({
105
+ code: 'group-stdin-fields-documented',
106
+ message: 'README should not document stdin writable fields for `bkper.Group`.',
107
+ });
108
+ }
72
109
  return { errors };
73
110
  }
74
111
  //# sourceMappingURL=rules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/docs-compliance/rules.ts"],"names":[],"mappings":"AAUA,SAAS,aAAa,CAAC,OAAe,EAAE,KAAa;IACjD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;AACtD,CAAC;AAED,SAAS,sBAAsB,CAC3B,OAAe,EACf,cAAsB,EACtB,IAAY,EACZ,OAAe;IAEf,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrD,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5D,MAAM,CAAC,IAAI,CAAC;gBACR,IAAI;gBACJ,OAAO;gBACP,IAAI,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC;aAC5C,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC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;IACP,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,iDAAiD,CAAC,EAAE,CAAC;QACvE,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,iCAAiC;YACvC,OAAO,EAAE,gEAAgE;SAC5E,CAAC,CAAC;IACP,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,2DAA2D,CAAC,EAAE,CAAC;QACjF,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,gCAAgC;YACtC,OAAO,EAAE,wDAAwD;SACpE,CAAC,CAAC;IACP,CAAC;IAED,IACI,OAAO,CAAC,QAAQ,CACZ,0GAA0G,CAC7G,EACH,CAAC;QACC,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,+BAA+B;YACrC,OAAO,EAAE,qEAAqE;SACjF,CAAC,CAAC;IACP,CAAC;IAED,MAAM,gBAAgB,GAAG,uDAAuD,CAAC;IACjF,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,8BAA8B;YACpC,OAAO,EAAE,mEAAmE;SAC/E,CAAC,CAAC;IACP,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAAE,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,+BAA+B;YACrC,OAAO,EAAE,qEAAqE;SACjF,CAAC,CAAC;IACP,CAAC;IAED,OAAO,EAAC,MAAM,EAAC,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "4.10.5",
3
+ "version": "4.11.0",
4
4
  "description": "Command line client for Bkper",
5
5
  "bin": {
6
6
  "bkper": "./lib/cli.js"
@@ -1,2 +0,0 @@
1
- export declare const CORE_CONCEPTS_MARKDOWN = "# Core Concepts\n\nBkper tracks resources \u2014 money, inventory, or anything countable \u2014 as movements between places. Every financial event is recorded as an amount moving **from** one Account **to** another. This from-to model replaces the traditional language of debits and credits with something intuitive: resources leave one place and arrive at another.\n\nThe system enforces a **zero-sum invariant** \u2014 the total of all records always equals zero. Nothing is created or destroyed, only transferred. This makes Bkper a double-entry bookkeeping system where every transaction automatically produces balanced entries.\n\nFor those familiar with traditional accounting, \"from\" corresponds to credit and \"to\" corresponds to debit \u2014 but the explicit flow eliminates the need to memorize these rules.\n\n## Accounts\n\n**Accounts** are the places where resources reside or flow through. An Account can represent a bank, a category, a customer, a project, or anything else that holds or transfers value. You define what each Account represents and structure them at whatever level of detail suits your needs.\n\nAn Account registers all incoming and outgoing amounts through transactions. The sum of these movements produces the account's **balance** \u2014 the net result of everything that has flowed in and out.\n\n## Account Types\n\nBkper organizes Accounts into four types that determine how an Account behaves and where it appears in your financial structure:\n\n- **Asset** (blue) \u2014 **permanent**. Real resources you own: bank accounts, cash, receivables. Balances carry forward continuously, showing your position at any point in time.\n- **Liability** (yellow) \u2014 **permanent**. Obligations you owe: credit cards, loans, supplier debts. Balances also carry forward continuously.\n- **Incoming** (green) \u2014 **non-permanent**. Revenue sources: salary, sales, interest. Balances track activity within a period and reset to zero for the next one.\n- **Outgoing** (red) \u2014 **non-permanent**. Expenses and costs: rent, supplies, payroll. Balances also track activity within a period.\n\n## Transactions\n\nA **Transaction** is the atomic unit of financial activity. It captures:\n\n- **Date** \u2014 when it happened\n- **Amount** \u2014 how much moved\n- **From Account** \u2014 where the resource came from\n- **To Account** \u2014 where it went\n- **Description** \u2014 what happened\n\nThe from-to model makes every event explicit and traceable.\n\nA transaction is nothing more than moving a resource from one place to another. When you pay a taxi for a ride, the amount that goes from your wallet to the driver represents a transaction.\n\nIf any essential element is missing, the transaction is saved as an incomplete draft.\n\n## Transaction States\n\nTransactions move through a lifecycle with four states:\n\n- **Draft** \u2014 incomplete or unposted. Does not affect balances.\n- **Unchecked** \u2014 posted and updates balances, but remains editable.\n- **Checked** \u2014 reviewed and locked for integrity.\n- **Trashed** \u2014 removed from balances, but recoverable.\n\nThis structure puts a **human in the loop** \u2014 you review and confirm before records become permanent.\n\n## Groups\n\n**Groups** organize Accounts into hierarchies for reporting and analysis. They don't change the underlying data \u2014 they provide structure for understanding it. Groups consolidate account balances, so you can see totals for categories like \"Expenses\" or \"Assets\" at a glance.\n\nGroups support hierarchies (groups of groups) and multiple perspectives \u2014 an Account can belong to different groups in different hierarchies.\n\nGroups inherit the nature of the accounts they contain:\n\n- **Asset-only group** \u2014 behaves as Asset (blue)\n- **Liability-only group** \u2014 behaves as Liability (yellow)\n- **Mixed Asset + Liability** \u2014 shows Equity (gray, net balance)\n- **Incoming-only group** \u2014 behaves as Income (green)\n- **Outgoing-only group** \u2014 behaves as Expense (red)\n- **Mixed Incoming + Outgoing** \u2014 shows Net Result (gray)\n\n## Books\n\nA **Book** is a self-contained ledger \u2014 the complete scope of an entity, whether an individual, a project, or a business. Every Account, Transaction, and Group lives within a Book, and every Book balances to zero. Books can track any countable resource using the same from-to model.\n\nThe sum of all credits and debits recorded in a Book always tallies to zero \u2014 nothing is created or destroyed, only transferred. For more complex entities, multiple Books can be organized into a Collection.\n\n## Example Flows\n\nThese examples show the same movement model in concrete situations. Some match the diagrams on this page. Others add common accrual flows that are easy to confuse.\n\nThese examples use Bkper's transaction shorthand `From >> To`, meaning the amount leaves the Account on the left and arrives at the Account on the right.\n\n| Situation | Transaction |\n| --- | --- |\n| Salary received | `Salary >> Bank Account` |\n| Investment funded | `Bank Account >> Investments` |\n| Dividends received | `Dividends >> Bank Account` |\n| Loan received | `Loan >> Bank Account` |\n| Rent paid | `Bank Account >> Rent` |\n| Transportation bought on credit card | `Credit Card >> Transportation` |\n\n**Buy on a credit card now, pay it later**\n\n| Step | Transaction |\n| --- | --- |\n| Purchase | `Credit Card >> Outgoing` |\n| Payment | `Bank Account >> Credit Card` |\n\n**Sell now and receive cash later**\n\n| Step | Transaction |\n| --- | --- |\n| Sale on credit | `Incoming >> Accounts Receivable` |\n| Interest added while unpaid | `Incoming >> Accounts Receivable` |\n| Collection | `Accounts Receivable >> Bank Account` |\n\n**Receive a supplier bill now and pay it later**\n\n| Step | Transaction |\n| --- | --- |\n| Bill received | `Accounts Payable >> Outgoing` |\n| Interest added while unpaid | `Accounts Payable >> Outgoing` |\n| Payment | `Bank Account >> Accounts Payable` |\n\n**Receive a loan now and repay principal later**\n\n| Step | Transaction |\n| --- | --- |\n| Loan proceeds | `Loan >> Bank Account` |\n| Principal repayment | `Bank Account >> Loan` |\n\nIn each case, the first movement records the position that was created \u2014 a receivable or a liability. The later movement settles that position. This keeps Incoming and Outgoing focused on activity, while Asset and Liability Accounts hold positions until they are cleared.\n\nIf a receivable or payable grows before settlement, record another movement to that same Account, then settle the total later.\n\n## Balances\n\n**Balances** are always calculated from Transactions, never stored independently. The total balance across all Accounts in a Book is always zero. Account type determines how balances behave over time:\n\n- **Permanent Accounts** (Asset & Liability) \u2014 balance **to a date**, showing cumulative position at a point in time.\n- **Non-permanent Accounts** (Incoming & Outgoing) \u2014 balance **within a period**, showing activity during a timeframe.\n\nBkper maintains a continuous ledger with no concept of closing periods \u2014 the same ledger serves all time-based queries automatically.\n\n## Custom Properties\n\n**Custom Properties** are key-value pairs attachable to any entity \u2014 Books, Accounts, Groups, Transactions, Collections, and Files. They add context, metadata, and meaning beyond core financial data.\n\nBy attaching properties like `invoice: inv123456` or `exc_code: BRL`, entities become rich with information that can drive automation and reporting \u2014 without changing the core model.\n\n## Hashtags\n\n**Hashtags** are lightweight labels on Transactions that enable multi-dimensional tracking. They complement the Account structure by adding dynamic categorization \u2014 a single transaction might carry `#team_marketing #project_alpha #q1_campaign`, enabling filtering and analysis from any perspective.\n\nUnlike Account structures, Hashtags can be added or removed as needs evolve, making them ideal for cost allocation, project tracking, and ad-hoc analysis.\n\n## Collections\n\n**Collections** group related Books for organization and consolidated views. Each Book remains self-contained and balanced \u2014 Collections simply provide navigation and structure across multiple Books. You might track resources in multiple currencies, or organize branch offices in one collection.\n\nCollections can also serve as references for automations (Bots or Apps) that work on all Books in the collection.\n\n## Events\n\nEvery action in a Book \u2014 posting a transaction, editing an account, adding a comment \u2014 generates an **Event**. Events record _who_ (a user) or _what_ (a bot, an automation) performed the action and _when_, forming a complete audit trail essential for collaboration and trust.\n\nEvents are also the foundation of Bkper's automation model. Bots and Agents listen for specific event types and react automatically \u2014 for example, calculating taxes when a transaction is posted or converting currencies when one is checked.\n";
2
- //# sourceMappingURL=core-concepts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-concepts.d.ts","sourceRoot":"","sources":["../../src/agent/core-concepts.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,y7RAwJlC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-concepts.js","sourceRoot":"","sources":["../../src/agent/core-concepts.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kDAAkD;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwJrC,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * Creates multiple groups from stdin items using the batch API.
3
- * Outputs a flat JSON array of all created groups.
4
- *
5
- * Stdin items must follow the bkper.Group format exactly.
6
- *
7
- * @param bookId - Target book ID
8
- * @param items - Parsed stdin items as bkper.Group payloads
9
- * @param propertyOverrides - CLI --property flags that override stdin properties
10
- */
11
- export declare function batchCreateGroups(bookId: string, items: Record<string, unknown>[], propertyOverrides?: string[]): Promise<void>;
12
- //# sourceMappingURL=batch-create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-create.d.ts","sourceRoot":"","sources":["../../../src/commands/groups/batch-create.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAChC,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
@@ -1,49 +0,0 @@
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 { getBkperInstance } from '../../bkper-factory.js';
11
- import { Group } from 'bkper-js';
12
- import { parsePropertyFlag } from '../../utils/properties.js';
13
- /**
14
- * Creates multiple groups from stdin items using the batch API.
15
- * Outputs a flat JSON array of all created groups.
16
- *
17
- * Stdin items must follow the bkper.Group format exactly.
18
- *
19
- * @param bookId - Target book ID
20
- * @param items - Parsed stdin items as bkper.Group payloads
21
- * @param propertyOverrides - CLI --property flags that override stdin properties
22
- */
23
- export function batchCreateGroups(bookId, items, propertyOverrides) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const bkper = getBkperInstance();
26
- const book = yield bkper.getBook(bookId);
27
- const groups = [];
28
- for (const item of items) {
29
- const group = new Group(book, item);
30
- // CLI --property flags override stdin properties
31
- if (propertyOverrides) {
32
- for (const raw of propertyOverrides) {
33
- const [key, value] = parsePropertyFlag(raw);
34
- if (value === '') {
35
- group.deleteProperty(key);
36
- }
37
- else {
38
- group.setProperty(key, value);
39
- }
40
- }
41
- }
42
- groups.push(group);
43
- }
44
- const results = yield book.batchCreateGroups(groups);
45
- const allResults = results.map(result => result.json());
46
- console.log(JSON.stringify(allResults, null, 2));
47
- });
48
- }
49
- //# sourceMappingURL=batch-create.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-create.js","sourceRoot":"","sources":["../../../src/commands/groups/batch-create.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,UAAgB,iBAAiB,CACnC,MAAc,EACd,KAAgC,EAChC,iBAA4B;;QAE5B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,IAAmB,CAAC,CAAC;YAEnD,iDAAiD;YACjD,IAAI,iBAAiB,EAAE,CAAC;gBACpB,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;oBAClC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;oBAC5C,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;wBACf,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;oBAC9B,CAAC;yBAAM,CAAC;wBACJ,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBAClC,CAAC;gBACL,CAAC;YACL,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACrD,MAAM,UAAU,GAAG,O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