bkper 4.31.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +12 -5
  2. package/lib/agent/extensions/core-concepts-preload.d.ts +4 -6
  3. package/lib/agent/extensions/core-concepts-preload.d.ts.map +1 -1
  4. package/lib/agent/extensions/core-concepts-preload.js +52 -24
  5. package/lib/agent/extensions/core-concepts-preload.js.map +1 -1
  6. package/lib/cli.js +3 -3
  7. package/lib/cli.js.map +1 -1
  8. package/lib/commands/accounts/batch-create.d.ts +1 -1
  9. package/lib/commands/accounts/batch-create.d.ts.map +1 -1
  10. package/lib/commands/accounts/batch-create.js +3 -3
  11. package/lib/commands/accounts/batch-create.js.map +1 -1
  12. package/lib/commands/accounts/list.d.ts +2 -3
  13. package/lib/commands/accounts/list.d.ts.map +1 -1
  14. package/lib/commands/accounts/list.js +2 -12
  15. package/lib/commands/accounts/list.js.map +1 -1
  16. package/lib/commands/accounts/register.js +13 -13
  17. package/lib/commands/accounts/register.js.map +1 -1
  18. package/lib/commands/action.d.ts +2 -3
  19. package/lib/commands/action.d.ts.map +1 -1
  20. package/lib/commands/action.js +2 -3
  21. package/lib/commands/action.js.map +1 -1
  22. package/lib/commands/apps/list.d.ts +2 -3
  23. package/lib/commands/apps/list.d.ts.map +1 -1
  24. package/lib/commands/apps/list.js +2 -14
  25. package/lib/commands/apps/list.js.map +1 -1
  26. package/lib/commands/apps/register.js +10 -10
  27. package/lib/commands/apps/register.js.map +1 -1
  28. package/lib/commands/balances/list.d.ts +0 -2
  29. package/lib/commands/balances/list.d.ts.map +1 -1
  30. package/lib/commands/balances/list.js +9 -17
  31. package/lib/commands/balances/list.js.map +1 -1
  32. package/lib/commands/balances/register.d.ts.map +1 -1
  33. package/lib/commands/balances/register.js +3 -4
  34. package/lib/commands/balances/register.js.map +1 -1
  35. package/lib/commands/books/list.d.ts +2 -4
  36. package/lib/commands/books/list.d.ts.map +1 -1
  37. package/lib/commands/books/list.js +2 -30
  38. package/lib/commands/books/list.js.map +1 -1
  39. package/lib/commands/books/register.js +12 -12
  40. package/lib/commands/books/register.js.map +1 -1
  41. package/lib/commands/cli-helpers.d.ts +9 -4
  42. package/lib/commands/cli-helpers.d.ts.map +1 -1
  43. package/lib/commands/cli-helpers.js +18 -12
  44. package/lib/commands/cli-helpers.js.map +1 -1
  45. package/lib/commands/collections/list.d.ts +2 -3
  46. package/lib/commands/collections/list.d.ts.map +1 -1
  47. package/lib/commands/collections/list.js +2 -14
  48. package/lib/commands/collections/list.js.map +1 -1
  49. package/lib/commands/collections/register.d.ts.map +1 -1
  50. package/lib/commands/collections/register.js +15 -25
  51. package/lib/commands/collections/register.js.map +1 -1
  52. package/lib/commands/events/event-json.d.ts +13 -0
  53. package/lib/commands/events/event-json.d.ts.map +1 -0
  54. package/lib/commands/events/event-json.js +33 -0
  55. package/lib/commands/events/event-json.js.map +1 -0
  56. package/lib/commands/events/list.d.ts +4 -3
  57. package/lib/commands/events/list.d.ts.map +1 -1
  58. package/lib/commands/events/list.js +15 -66
  59. package/lib/commands/events/list.js.map +1 -1
  60. package/lib/commands/events/register.d.ts.map +1 -1
  61. package/lib/commands/events/register.js +7 -6
  62. package/lib/commands/events/register.js.map +1 -1
  63. package/lib/commands/files/list.d.ts +3 -2
  64. package/lib/commands/files/list.d.ts.map +1 -1
  65. package/lib/commands/files/list.js +13 -42
  66. package/lib/commands/files/list.js.map +1 -1
  67. package/lib/commands/files/register.d.ts.map +1 -1
  68. package/lib/commands/files/register.js +13 -10
  69. package/lib/commands/files/register.js.map +1 -1
  70. package/lib/commands/groups/list.d.ts +2 -3
  71. package/lib/commands/groups/list.d.ts.map +1 -1
  72. package/lib/commands/groups/list.js +2 -12
  73. package/lib/commands/groups/list.js.map +1 -1
  74. package/lib/commands/groups/register.js +12 -12
  75. package/lib/commands/groups/register.js.map +1 -1
  76. package/lib/commands/transactions/batch-create.d.ts +1 -1
  77. package/lib/commands/transactions/batch-create.d.ts.map +1 -1
  78. package/lib/commands/transactions/batch-create.js +4 -3
  79. package/lib/commands/transactions/batch-create.js.map +1 -1
  80. package/lib/commands/transactions/batch-update.d.ts +1 -1
  81. package/lib/commands/transactions/batch-update.d.ts.map +1 -1
  82. package/lib/commands/transactions/batch-update.js +4 -3
  83. package/lib/commands/transactions/batch-update.js.map +1 -1
  84. package/lib/commands/transactions/list.d.ts +4 -7
  85. package/lib/commands/transactions/list.d.ts.map +1 -1
  86. package/lib/commands/transactions/list.js +15 -32
  87. package/lib/commands/transactions/list.js.map +1 -1
  88. package/lib/commands/transactions/register.d.ts +1 -1
  89. package/lib/commands/transactions/register.d.ts.map +1 -1
  90. package/lib/commands/transactions/register.js +27 -26
  91. package/lib/commands/transactions/register.js.map +1 -1
  92. package/lib/commands/transactions/transaction-json.d.ts +23 -0
  93. package/lib/commands/transactions/transaction-json.d.ts.map +1 -0
  94. package/lib/commands/transactions/transaction-json.js +56 -0
  95. package/lib/commands/transactions/transaction-json.js.map +1 -0
  96. package/lib/docs/apps/ai.md +2 -2
  97. package/lib/docs/cli/app-management.md +0 -1
  98. package/lib/docs/cli/data-management.md +56 -54
  99. package/lib/docs/index.md +1 -1
  100. package/lib/docs-compliance/live-readme.d.ts.map +1 -1
  101. package/lib/docs-compliance/live-readme.js +0 -3
  102. package/lib/docs-compliance/live-readme.js.map +1 -1
  103. package/lib/docs-compliance/rules.d.ts.map +1 -1
  104. package/lib/docs-compliance/rules.js +9 -0
  105. package/lib/docs-compliance/rules.js.map +1 -1
  106. package/lib/render/index.d.ts +2 -4
  107. package/lib/render/index.d.ts.map +1 -1
  108. package/lib/render/index.js +1 -3
  109. package/lib/render/index.js.map +1 -1
  110. package/lib/render/output.d.ts +42 -22
  111. package/lib/render/output.d.ts.map +1 -1
  112. package/lib/render/output.js +62 -42
  113. package/lib/render/output.js.map +1 -1
  114. package/package.json +8 -7
  115. package/lib/render/csv-formatter.d.ts +0 -15
  116. package/lib/render/csv-formatter.d.ts.map +0 -1
  117. package/lib/render/csv-formatter.js +0 -37
  118. package/lib/render/csv-formatter.js.map +0 -1
  119. package/lib/render/table-formatter.d.ts +0 -34
  120. package/lib/render/table-formatter.d.ts.map +0 -1
  121. package/lib/render/table-formatter.js +0 -239
  122. package/lib/render/table-formatter.js.map +0 -1
@@ -1,54 +1,74 @@
1
- import { formatTable, formatItem } from './table-formatter.js';
2
- import { formatCsv } from './csv-formatter.js';
3
1
  /**
4
- * Renders a ListResult to stdout based on the active output format.
2
+ * JSON-only output rendering.
3
+ *
4
+ * Contract:
5
+ * - stdout carries only the JSON result, so it is always parseable (e.g. by jq).
6
+ * - Lists use a stable `{"items":[...]}` envelope, adding `"cursor"` only when a
7
+ * next page exists. Each record is compact on its own line.
8
+ * - Matrices (balance reports) are bare 2D arrays with one row per line.
9
+ * - Single items are pretty-printed only on an interactive terminal.
10
+ * - Hints, notices, and warnings go to stderr.
5
11
  */
6
- export function renderListResult(result, format) {
7
- if (result.kind === 'json') {
8
- const payload = result.cursor ? { items: result.items, cursor: result.cursor } : result.items;
9
- console.log(JSON.stringify(payload, null, 2));
10
- return;
11
- }
12
- renderTable(result.matrix, format);
13
- if (result.footer && format === 'table') {
14
- console.log(result.footer);
15
- }
12
+ /**
13
+ * Serializes lines as a JSON array body with one entry per line.
14
+ */
15
+ function formatLines(lines) {
16
+ return lines.length > 0 ? `[\n${lines.join(',\n')}\n]` : '[]';
16
17
  }
17
18
  /**
18
- * Renders a 2D matrix as a formatted table, JSON, or CSV.
19
- *
20
- * @param matrix - 2D array where row 0 is headers and rows 1+ are data
21
- * @param format - Output format: 'table' (default), 'json', or 'csv'
22
- */
23
- export function renderTable(matrix, format) {
24
- switch (format) {
25
- case 'json':
26
- console.log(JSON.stringify(matrix, null, 2));
27
- return;
28
- case 'csv': {
29
- const csv = formatCsv(matrix);
30
- console.log(csv || 'No results found.');
31
- return;
32
- }
33
- default: {
34
- const formatted = formatTable(matrix);
35
- console.log(formatted || 'No results found.');
36
- }
19
+ * Formats list items in the `{"items":[...]}` envelope, one record per line.
20
+ */
21
+ export function formatList(items, cursor) {
22
+ const body = formatLines(items.map(item => JSON.stringify(item)));
23
+ const cursorPart = cursor !== undefined ? `,"cursor":${JSON.stringify(cursor)}` : '';
24
+ return `{"items":${body}${cursorPart}}`;
25
+ }
26
+ /**
27
+ * Formats a 2D matrix as JSON, one row per line.
28
+ */
29
+ export function formatMatrix(matrix) {
30
+ return formatLines(matrix.map(row => JSON.stringify(row)));
31
+ }
32
+ /**
33
+ * Formats a single item as pretty (2-space) or compact JSON.
34
+ */
35
+ export function formatItem(item, pretty) {
36
+ return pretty ? JSON.stringify(item, null, 2) : JSON.stringify(item);
37
+ }
38
+ /**
39
+ * Whether stdout is an interactive terminal (a human is reading).
40
+ */
41
+ export function isInteractiveOutput() {
42
+ return process.stdout.isTTY === true;
43
+ }
44
+ /**
45
+ * Renders a list result: JSON to stdout, hint to stderr.
46
+ */
47
+ export function renderList(result) {
48
+ console.log(formatList(result.items, result.cursor));
49
+ if (result.hint) {
50
+ console.error(result.hint);
37
51
  }
38
52
  }
39
53
  /**
40
- * Renders a single item as key-value pairs, JSON, or JSON (for CSV, since
41
- * single items are not tabular, CSV falls back to JSON).
54
+ * Renders a 2D matrix as JSON to stdout.
55
+ */
56
+ export function renderMatrix(matrix) {
57
+ console.log(formatMatrix(matrix));
58
+ }
59
+ /**
60
+ * Renders a single item as JSON to stdout.
42
61
  *
43
62
  * @param item - Record to render
44
- * @param format - Output format: 'table' (default), 'json', or 'csv'
63
+ * @param pretty - Pretty-print; defaults to true only on an interactive terminal
45
64
  */
46
- export function renderItem(item, format) {
47
- if (format === 'json' || format === 'csv') {
48
- console.log(JSON.stringify(item, null, 2));
49
- return;
50
- }
51
- const formatted = formatItem(item);
52
- console.log(formatted || 'No results found.');
65
+ export function renderItem(item, pretty = isInteractiveOutput()) {
66
+ console.log(formatItem(item, pretty));
67
+ }
68
+ /**
69
+ * Renders a human-readable notice (e.g. success without a result) to stderr.
70
+ */
71
+ export function renderNotice(message) {
72
+ console.error(message);
53
73
  }
54
74
  //# sourceMappingURL=output.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/render/output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAe/C;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAkB,EAAE,MAAoB;IACrE,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9F,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC9C,OAAO;IACX,CAAC;IACD,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,MAAmB,EAAE,MAAoB;IACjE,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,MAAM;YACP,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7C,OAAO;QACX,KAAK,KAAK,CAAC,CAAC,CAAC;YACT,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;YAC9B,OAAO,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,OAAe;IACxC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper",
3
- "version": "4.31.2",
3
+ "version": "5.0.0",
4
4
  "description": "Official Bkper CLI for accounting data, automation, apps, and AI agents",
5
5
  "bin": {
6
6
  "bkper": "./lib/cli.js"
@@ -47,10 +47,11 @@
47
47
  "predev": "bun run build",
48
48
  "dev": "tsc -w",
49
49
  "ports": "devpod ssh ../ -L 6274",
50
- "test": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=tsconfig.test.json mocha",
51
- "test:unit": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.json",
52
- "test:integration": "TS_NODE_TRANSPILE_ONLY=true BKPER_API_URL=${BKPER_API_URL:-http://localhost:8081/_ah/api/bkper} TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.integration.json",
53
- "test:deploy": "TS_NODE_TRANSPILE_ONLY=true BKPER_PLATFORM_URL=http://localhost:8790 BKPER_API_URL=https://api-dev.bkper.app TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.deploy.json",
50
+ "test:typecheck": "tsc --noEmit -p tsconfig.test.json",
51
+ "test": "bun run test:typecheck && TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=tsconfig.test.json mocha",
52
+ "test:unit": "bun run test:typecheck && TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.json",
53
+ "test:integration": "bun run test:typecheck && TS_NODE_TRANSPILE_ONLY=true BKPER_API_URL=${BKPER_API_URL:-http://localhost:8081/_ah/api/bkper} TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.integration.json",
54
+ "test:deploy": "bun run test:typecheck && TS_NODE_TRANSPILE_ONLY=true BKPER_PLATFORM_URL=http://localhost:8790 BKPER_API_URL=https://api-dev.bkper.app TS_NODE_PROJECT=tsconfig.test.json mocha --config .mocharc.deploy.json",
54
55
  "test:all": "bun run test:unit && bun run test:integration",
55
56
  "version": "bun ./scripts/sync-plugin-version.ts && git add .claude-plugin/plugin.json .claude-plugin/marketplace.json .codex-plugin/plugin.json",
56
57
  "release:patch": "npm version patch -m \"chore(release): v%s\"",
@@ -61,8 +62,8 @@
61
62
  "upgrade:api": "bun update @bkper/bkper-api-types --latest && bun update bkper-js --latest"
62
63
  },
63
64
  "dependencies": {
64
- "@earendil-works/pi-coding-agent": "0.87.0",
65
- "@earendil-works/pi-tui": "0.87.0",
65
+ "@earendil-works/pi-coding-agent": "0.87.1",
66
+ "@earendil-works/pi-tui": "0.87.1",
66
67
  "bkper-js": "^2.42.0",
67
68
  "commander": "^13.1.0",
68
69
  "dotenv": "^8.2.0",
@@ -1,15 +0,0 @@
1
- /**
2
- * Formats a 2D matrix into an RFC 4180 compliant CSV string.
3
- *
4
- * - Row 0 is treated as headers, rows 1+ as data (all rendered identically)
5
- * - Uses CRLF line endings per RFC 4180
6
- * - Fields containing commas, double quotes, or newlines are quoted
7
- * - Double quotes are escaped by doubling them ("")
8
- * - null/undefined cells are rendered as empty strings
9
- * - No truncation is applied to any field
10
- *
11
- * @param matrix - 2D array where row 0 is headers and rows 1+ are data
12
- * @returns RFC 4180 CSV string
13
- */
14
- export declare function formatCsv(matrix: unknown[][]): string;
15
- //# sourceMappingURL=csv-formatter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"csv-formatter.d.ts","sourceRoot":"","sources":["../../src/render/csv-formatter.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAMrD"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Formats a field value according to RFC 4180 rules.
3
- *
4
- * - null/undefined become empty string
5
- * - Fields containing commas, double quotes, or newlines are wrapped in double quotes
6
- * - Double quotes within a field are escaped by doubling them ("")
7
- */
8
- function formatField(value) {
9
- if (value == null) {
10
- return '';
11
- }
12
- const str = String(value);
13
- if (str.includes('"') || str.includes(',') || str.includes('\n') || str.includes('\r')) {
14
- return '"' + str.replace(/"/g, '""') + '"';
15
- }
16
- return str;
17
- }
18
- /**
19
- * Formats a 2D matrix into an RFC 4180 compliant CSV string.
20
- *
21
- * - Row 0 is treated as headers, rows 1+ as data (all rendered identically)
22
- * - Uses CRLF line endings per RFC 4180
23
- * - Fields containing commas, double quotes, or newlines are quoted
24
- * - Double quotes are escaped by doubling them ("")
25
- * - null/undefined cells are rendered as empty strings
26
- * - No truncation is applied to any field
27
- *
28
- * @param matrix - 2D array where row 0 is headers and rows 1+ are data
29
- * @returns RFC 4180 CSV string
30
- */
31
- export function formatCsv(matrix) {
32
- if (!matrix || matrix.length === 0) {
33
- return '';
34
- }
35
- return matrix.map(row => row.map(formatField).join(',')).join('\r\n');
36
- }
37
- //# sourceMappingURL=csv-formatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"csv-formatter.js","sourceRoot":"","sources":["../../src/render/csv-formatter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,KAAc;IAC/B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAE1B,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACrF,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC;IAC/C,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAC,MAAmB;IACzC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Formats a 2D matrix (row 0 = headers) into an aligned, human-readable table string.
3
- *
4
- * Output format:
5
- * Name Type Parent
6
- * ____________________________
7
- * Revenue INCOMING
8
- * Expenses OUTGOING
9
- *
10
- * @param matrix - 2D array where row 0 is headers and rows 1+ are data
11
- * @returns Formatted table string
12
- */
13
- export declare function formatTable(matrix: unknown[][]): string;
14
- /**
15
- * Formats a record as vertically aligned key-value pairs with recursive
16
- * indented rendering for nested objects and arrays.
17
- *
18
- * Output format:
19
- * name: Checking
20
- * type: ASSET
21
- * collection:
22
- * id: col-123
23
- * name: My Collection
24
- * properties:
25
- * key: value
26
- * tags:
27
- * - tag1
28
- * - tag2
29
- *
30
- * @param item - Record to format
31
- * @returns Formatted key-value string
32
- */
33
- export declare function formatItem(item: Record<string, unknown>): string;
34
- //# sourceMappingURL=table-formatter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-formatter.d.ts","sourceRoot":"","sources":["../../src/render/table-formatter.ts"],"names":[],"mappings":"AAyBA;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAkEvD;AAoID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAUhE"}
@@ -1,239 +0,0 @@
1
- /**
2
- * Maximum width for any single cell value.
3
- * Values exceeding this width are truncated with an ellipsis (…).
4
- * Header cells and ID columns are never truncated.
5
- */
6
- const MAX_CELL_WIDTH = 40;
7
- /**
8
- * Checks whether a column header indicates an ID column.
9
- * ID columns should never be truncated so users can copy-paste values into subsequent commands.
10
- */
11
- function isIdColumn(header) {
12
- return header === 'ID' || header.endsWith(' Id') || header.endsWith('Id');
13
- }
14
- /**
15
- * Truncates a string to maxWidth, appending '…' if it exceeds the limit.
16
- */
17
- function truncateCell(value, maxWidth) {
18
- if (value.length <= maxWidth) {
19
- return value;
20
- }
21
- return value.slice(0, maxWidth - 1) + '…';
22
- }
23
- /**
24
- * Formats a 2D matrix (row 0 = headers) into an aligned, human-readable table string.
25
- *
26
- * Output format:
27
- * Name Type Parent
28
- * ____________________________
29
- * Revenue INCOMING
30
- * Expenses OUTGOING
31
- *
32
- * @param matrix - 2D array where row 0 is headers and rows 1+ are data
33
- * @returns Formatted table string
34
- */
35
- export function formatTable(matrix) {
36
- if (!matrix || matrix.length === 0) {
37
- return '';
38
- }
39
- const COL_GAP = ' ';
40
- // Determine which columns are ID columns (never truncated)
41
- const headerRow = matrix[0];
42
- const noTruncateCols = new Set();
43
- for (let i = 0; i < headerRow.length; i++) {
44
- const header = headerRow[i] == null ? '' : String(headerRow[i]);
45
- if (isIdColumn(header)) {
46
- noTruncateCols.add(i);
47
- }
48
- }
49
- // Convert all cells to strings
50
- const rows = matrix.map((row, rowIndex) => row.map((cell, colIndex) => {
51
- const str = cell == null ? '' : String(cell);
52
- // Don't truncate header row or ID columns
53
- return rowIndex === 0 || noTruncateCols.has(colIndex)
54
- ? str
55
- : truncateCell(str, MAX_CELL_WIDTH);
56
- }));
57
- const headers = rows[0];
58
- const dataRows = rows.slice(1);
59
- const colCount = headers.length;
60
- // Calculate max width per column
61
- const colWidths = new Array(colCount).fill(0);
62
- for (const row of rows) {
63
- for (let i = 0; i < colCount; i++) {
64
- const cellLen = (row[i] || '').length;
65
- if (cellLen > colWidths[i]) {
66
- colWidths[i] = cellLen;
67
- }
68
- }
69
- }
70
- // Build a row string
71
- const formatRow = (row) => {
72
- return row
73
- .map((cell, i) => {
74
- // Don't pad the last column
75
- if (i === colCount - 1) {
76
- return cell;
77
- }
78
- return cell.padEnd(colWidths[i]);
79
- })
80
- .join(COL_GAP)
81
- .trimEnd();
82
- };
83
- const headerLine = formatRow(headers);
84
- const dividerLine = '_'.repeat(headerLine.length);
85
- const lines = [headerLine, dividerLine];
86
- for (const row of dataRows) {
87
- lines.push(formatRow(row));
88
- }
89
- return lines.join('\n');
90
- }
91
- /**
92
- * Checks whether a value is empty (null, undefined, empty array, or empty object).
93
- */
94
- function isEmpty(value) {
95
- if (value == null)
96
- return true;
97
- if (Array.isArray(value) && value.length === 0)
98
- return true;
99
- if (typeof value === 'object' &&
100
- !Array.isArray(value) &&
101
- Object.keys(value).length === 0)
102
- return true;
103
- return false;
104
- }
105
- /**
106
- * Checks whether a value is a primitive (not an object or array, or is null).
107
- */
108
- function isPrimitive(value) {
109
- return value === null || typeof value !== 'object';
110
- }
111
- /**
112
- * Renders key-value pairs of an object as aligned lines at the given indent level.
113
- *
114
- * - Primitive values are rendered inline: `key: value`
115
- * - Nested objects get `key:` on its own line, then recursively indented content
116
- * - Arrays of primitives get `key:` then each item with `- ` prefix
117
- * - Arrays of objects get `key:` then each element as `- firstKey: value` block
118
- *
119
- * @param entries - Filtered [key, value] pairs to render
120
- * @param indent - Current indentation string (e.g., '', ' ', ' ')
121
- * @returns Array of formatted lines
122
- */
123
- function formatEntries(entries, indent) {
124
- const lines = [];
125
- // Find max key length for alignment at this indent level
126
- const maxKeyLen = Math.max(...entries.map(([key]) => key.length));
127
- for (const [key, value] of entries) {
128
- if (isPrimitive(value)) {
129
- const label = `${key}:`.padEnd(maxKeyLen + 2);
130
- lines.push(`${indent}${label} ${String(value)}`);
131
- }
132
- else if (Array.isArray(value)) {
133
- lines.push(`${indent}${key}:`);
134
- const childIndent = indent + ' ';
135
- for (const element of value) {
136
- if (isPrimitive(element)) {
137
- lines.push(`${childIndent}- ${String(element)}`);
138
- }
139
- else {
140
- // Object element in array — render with `- ` prefix on first field
141
- const objEntries = Object.entries(element).filter(([, v]) => !isEmpty(v));
142
- if (objEntries.length === 0)
143
- continue;
144
- // First field gets `- ` prefix
145
- const [firstKey, firstValue] = objEntries[0];
146
- const remainingEntries = objEntries.slice(1);
147
- // Align keys within the array element block
148
- const elementMaxKeyLen = Math.max(...objEntries.map(([k]) => k.length));
149
- const firstLabel = `${firstKey}:`.padEnd(elementMaxKeyLen + 2);
150
- if (isPrimitive(firstValue)) {
151
- lines.push(`${childIndent}- ${firstLabel} ${String(firstValue)}`);
152
- }
153
- else {
154
- lines.push(`${childIndent}- ${firstKey}:`);
155
- // Indent nested value under the `- ` block
156
- const nestedLines = formatNestedValue(firstValue, childIndent + ' ');
157
- lines.push(...nestedLines);
158
- }
159
- // Remaining fields aligned under the `- ` prefix (indented by 2 more to match)
160
- const fieldIndent = childIndent + ' ';
161
- for (const [rKey, rValue] of remainingEntries) {
162
- if (isEmpty(rValue))
163
- continue;
164
- if (isPrimitive(rValue)) {
165
- const rLabel = `${rKey}:`.padEnd(elementMaxKeyLen + 2);
166
- lines.push(`${fieldIndent}${rLabel} ${String(rValue)}`);
167
- }
168
- else {
169
- lines.push(`${fieldIndent}${rKey}:`);
170
- const nestedLines = formatNestedValue(rValue, fieldIndent + ' ');
171
- lines.push(...nestedLines);
172
- }
173
- }
174
- }
175
- }
176
- }
177
- else {
178
- // Nested object
179
- lines.push(`${indent}${key}:`);
180
- const nestedLines = formatNestedValue(value, indent + ' ');
181
- lines.push(...nestedLines);
182
- }
183
- }
184
- return lines;
185
- }
186
- /**
187
- * Renders a nested value (object or array) at the given indent level.
188
- */
189
- function formatNestedValue(value, indent) {
190
- if (Array.isArray(value)) {
191
- const lines = [];
192
- for (const element of value) {
193
- if (isPrimitive(element)) {
194
- lines.push(`${indent}- ${String(element)}`);
195
- }
196
- else {
197
- const objEntries = Object.entries(element).filter(([, v]) => !isEmpty(v));
198
- const nestedLines = formatEntries(objEntries, indent + ' ');
199
- if (nestedLines.length > 0) {
200
- // Replace leading spaces of first line with `- ` prefix
201
- nestedLines[0] = `${indent}- ${nestedLines[0].trimStart()}`;
202
- lines.push(...nestedLines);
203
- }
204
- }
205
- }
206
- return lines;
207
- }
208
- const objEntries = Object.entries(value).filter(([, v]) => !isEmpty(v));
209
- return formatEntries(objEntries, indent);
210
- }
211
- /**
212
- * Formats a record as vertically aligned key-value pairs with recursive
213
- * indented rendering for nested objects and arrays.
214
- *
215
- * Output format:
216
- * name: Checking
217
- * type: ASSET
218
- * collection:
219
- * id: col-123
220
- * name: My Collection
221
- * properties:
222
- * key: value
223
- * tags:
224
- * - tag1
225
- * - tag2
226
- *
227
- * @param item - Record to format
228
- * @returns Formatted key-value string
229
- */
230
- export function formatItem(item) {
231
- // Filter out null/undefined and empty values
232
- const entries = Object.entries(item).filter(([, value]) => !isEmpty(value));
233
- if (entries.length === 0) {
234
- return '';
235
- }
236
- const lines = formatEntries(entries, '');
237
- return lines.join('\n');
238
- }
239
- //# sourceMappingURL=table-formatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-formatter.js","sourceRoot":"","sources":["../../src/render/table-formatter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B;;;GAGG;AACH,SAAS,UAAU,CAAC,MAAc;IAC9B,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9E,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,KAAa,EAAE,QAAgB;IACjD,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG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