@qontoctl/cli 0.0.0 → 0.1.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 (128) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +66 -0
  3. package/dist/cli.js +8 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/client.d.ts +10 -0
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/client.js +42 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/commands/account.d.ts +6 -0
  10. package/dist/commands/account.d.ts.map +1 -0
  11. package/dist/commands/account.js +61 -0
  12. package/dist/commands/account.js.map +1 -0
  13. package/dist/commands/index.d.ts +6 -0
  14. package/dist/commands/index.d.ts.map +1 -0
  15. package/dist/commands/index.js +8 -0
  16. package/dist/commands/index.js.map +1 -0
  17. package/dist/commands/label.d.ts +3 -0
  18. package/dist/commands/label.d.ts.map +1 -0
  19. package/dist/commands/label.js +45 -0
  20. package/dist/commands/label.js.map +1 -0
  21. package/dist/commands/membership.d.ts +3 -0
  22. package/dist/commands/membership.d.ts.map +1 -0
  23. package/dist/commands/membership.js +30 -0
  24. package/dist/commands/membership.js.map +1 -0
  25. package/dist/commands/org.d.ts +6 -0
  26. package/dist/commands/org.d.ts.map +1 -0
  27. package/dist/commands/org.js +31 -0
  28. package/dist/commands/org.js.map +1 -0
  29. package/dist/commands/profile/add.d.ts +6 -0
  30. package/dist/commands/profile/add.d.ts.map +1 -0
  31. package/dist/commands/profile/add.js +63 -0
  32. package/dist/commands/profile/add.js.map +1 -0
  33. package/dist/commands/profile/index.d.ts +6 -0
  34. package/dist/commands/profile/index.d.ts.map +1 -0
  35. package/dist/commands/profile/index.js +19 -0
  36. package/dist/commands/profile/index.js.map +1 -0
  37. package/dist/commands/profile/list.d.ts +6 -0
  38. package/dist/commands/profile/list.d.ts.map +1 -0
  39. package/dist/commands/profile/list.js +49 -0
  40. package/dist/commands/profile/list.js.map +1 -0
  41. package/dist/commands/profile/remove.d.ts +6 -0
  42. package/dist/commands/profile/remove.d.ts.map +1 -0
  43. package/dist/commands/profile/remove.js +46 -0
  44. package/dist/commands/profile/remove.js.map +1 -0
  45. package/dist/commands/profile/show.d.ts +6 -0
  46. package/dist/commands/profile/show.d.ts.map +1 -0
  47. package/dist/commands/profile/show.js +52 -0
  48. package/dist/commands/profile/show.js.map +1 -0
  49. package/dist/commands/profile/test.d.ts +6 -0
  50. package/dist/commands/profile/test.d.ts.map +1 -0
  51. package/dist/commands/profile/test.js +79 -0
  52. package/dist/commands/profile/test.js.map +1 -0
  53. package/dist/commands/statement.d.ts +6 -0
  54. package/dist/commands/statement.d.ts.map +1 -0
  55. package/dist/commands/statement.js +92 -0
  56. package/dist/commands/statement.js.map +1 -0
  57. package/dist/commands/transaction/index.d.ts +6 -0
  58. package/dist/commands/transaction/index.d.ts.map +1 -0
  59. package/dist/commands/transaction/index.js +13 -0
  60. package/dist/commands/transaction/index.js.map +1 -0
  61. package/dist/commands/transaction/list.d.ts +3 -0
  62. package/dist/commands/transaction/list.d.ts.map +1 -0
  63. package/dist/commands/transaction/list.js +69 -0
  64. package/dist/commands/transaction/list.js.map +1 -0
  65. package/dist/commands/transaction/show.d.ts +3 -0
  66. package/dist/commands/transaction/show.d.ts.map +1 -0
  67. package/dist/commands/transaction/show.js +25 -0
  68. package/dist/commands/transaction/show.js.map +1 -0
  69. package/dist/completions/bash.d.ts +6 -0
  70. package/dist/completions/bash.d.ts.map +1 -0
  71. package/dist/completions/bash.js +170 -0
  72. package/dist/completions/bash.js.map +1 -0
  73. package/dist/completions/fish.d.ts +6 -0
  74. package/dist/completions/fish.d.ts.map +1 -0
  75. package/dist/completions/fish.js +86 -0
  76. package/dist/completions/fish.js.map +1 -0
  77. package/dist/completions/index.d.ts +7 -0
  78. package/dist/completions/index.d.ts.map +1 -0
  79. package/dist/completions/index.js +31 -0
  80. package/dist/completions/index.js.map +1 -0
  81. package/dist/completions/zsh.d.ts +6 -0
  82. package/dist/completions/zsh.d.ts.map +1 -0
  83. package/dist/completions/zsh.js +124 -0
  84. package/dist/completions/zsh.js.map +1 -0
  85. package/dist/error-handler.d.ts +8 -0
  86. package/dist/error-handler.d.ts.map +1 -0
  87. package/dist/error-handler.js +59 -0
  88. package/dist/error-handler.js.map +1 -0
  89. package/dist/formatters/csv.d.ts +8 -0
  90. package/dist/formatters/csv.d.ts.map +1 -0
  91. package/dist/formatters/csv.js +40 -0
  92. package/dist/formatters/csv.js.map +1 -0
  93. package/dist/formatters/index.d.ts +14 -0
  94. package/dist/formatters/index.d.ts.map +1 -0
  95. package/dist/formatters/index.js +30 -0
  96. package/dist/formatters/index.js.map +1 -0
  97. package/dist/formatters/json.d.ts +5 -0
  98. package/dist/formatters/json.d.ts.map +1 -0
  99. package/dist/formatters/json.js +9 -0
  100. package/dist/formatters/json.js.map +1 -0
  101. package/dist/formatters/table.d.ts +8 -0
  102. package/dist/formatters/table.d.ts.map +1 -0
  103. package/dist/formatters/table.js +37 -0
  104. package/dist/formatters/table.js.map +1 -0
  105. package/dist/formatters/yaml.d.ts +5 -0
  106. package/dist/formatters/yaml.d.ts.map +1 -0
  107. package/dist/formatters/yaml.js +10 -0
  108. package/dist/formatters/yaml.js.map +1 -0
  109. package/dist/index.d.ts +15 -0
  110. package/dist/index.d.ts.map +1 -0
  111. package/dist/index.js +16 -0
  112. package/dist/index.js.map +1 -0
  113. package/dist/inherited-options.d.ts +15 -0
  114. package/dist/inherited-options.d.ts.map +1 -0
  115. package/dist/inherited-options.js +31 -0
  116. package/dist/inherited-options.js.map +1 -0
  117. package/dist/options.d.ts +26 -0
  118. package/dist/options.d.ts.map +1 -0
  119. package/dist/options.js +7 -0
  120. package/dist/options.js.map +1 -0
  121. package/dist/pagination.d.ts +52 -0
  122. package/dist/pagination.d.ts.map +1 -0
  123. package/dist/pagination.js +87 -0
  124. package/dist/pagination.js.map +1 -0
  125. package/dist/program.d.ts.map +1 -1
  126. package/dist/program.js +31 -4
  127. package/dist/program.js.map +1 -1
  128. package/package.json +30 -15
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { formatCsv } from "./csv.js";
4
+ import { formatJson } from "./json.js";
5
+ import { formatTable } from "./table.js";
6
+ import { formatYaml } from "./yaml.js";
7
+ export { formatCsv } from "./csv.js";
8
+ export { formatJson } from "./json.js";
9
+ export { formatTable } from "./table.js";
10
+ export { formatYaml } from "./yaml.js";
11
+ /**
12
+ * Route output formatting to the appropriate renderer based on the
13
+ * selected output format.
14
+ *
15
+ * For `table` and `csv`, `data` must be an array of plain objects.
16
+ * For `json` and `yaml`, any serializable value is accepted.
17
+ */
18
+ export function formatOutput(data, format) {
19
+ switch (format) {
20
+ case "json":
21
+ return formatJson(data);
22
+ case "yaml":
23
+ return formatYaml(data);
24
+ case "csv":
25
+ return formatCsv(data);
26
+ case "table":
27
+ return formatTable(data);
28
+ }
29
+ }
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa,EAAE,MAAoB;IAC9D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,KAAK,MAAM;YACT,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,KAAK,KAAK;YACR,OAAO,SAAS,CAAC,IAAiC,CAAC,CAAC;QACtD,KAAK,OAAO;YACV,OAAO,WAAW,CAAC,IAAiC,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Format data as indented JSON.
3
+ */
4
+ export declare function formatJson(data: unknown): string;
5
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,9 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ /**
4
+ * Format data as indented JSON.
5
+ */
6
+ export function formatJson(data) {
7
+ return JSON.stringify(data, null, 2);
8
+ }
9
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/formatters/json.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Format an array of records as a column-aligned text table.
3
+ *
4
+ * Column headers are derived from the keys of the first record.
5
+ * All columns are left-aligned and padded with spaces.
6
+ */
7
+ export declare function formatTable(rows: readonly Record<string, unknown>[]): string;
8
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/formatters/table.ts"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAoB5E"}
@@ -0,0 +1,37 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ function toDisplayValue(value) {
4
+ if (value === null || value === undefined) {
5
+ return "";
6
+ }
7
+ if (typeof value === "string") {
8
+ return value;
9
+ }
10
+ if (typeof value === "object") {
11
+ return JSON.stringify(value);
12
+ }
13
+ return String(value);
14
+ }
15
+ /**
16
+ * Format an array of records as a column-aligned text table.
17
+ *
18
+ * Column headers are derived from the keys of the first record.
19
+ * All columns are left-aligned and padded with spaces.
20
+ */
21
+ export function formatTable(rows) {
22
+ if (rows.length === 0) {
23
+ return "";
24
+ }
25
+ const first = rows[0];
26
+ if (first === undefined) {
27
+ return "";
28
+ }
29
+ const columns = Object.keys(first);
30
+ const cells = rows.map((row) => columns.map((col) => toDisplayValue(row[col])));
31
+ const widths = columns.map((col, i) => Math.max(col.length, ...cells.map((row) => (row[i] ?? "").length)));
32
+ const header = columns.map((col, i) => col.padEnd(widths[i] ?? 0)).join(" ");
33
+ const separator = widths.map((w) => "-".repeat(w)).join(" ");
34
+ const body = cells.map((row) => row.map((cell, i) => cell.padEnd(widths[i] ?? 0)).join(" "));
35
+ return [header, separator, ...body].join("\n");
36
+ }
37
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/formatters/table.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE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C9E,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE9F,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Format data as YAML.
3
+ */
4
+ export declare function formatYaml(data: unknown): string;
5
+ //# sourceMappingURL=yaml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../src/formatters/yaml.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhD"}
@@ -0,0 +1,10 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { stringify } from "yaml";
4
+ /**
5
+ * Format data as YAML.
6
+ */
7
+ export function formatYaml(data) {
8
+ return stringify(data, { lineWidth: 0 });
9
+ }
10
+ //# sourceMappingURL=yaml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../src/formatters/yaml.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,OAAO,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,15 @@
1
+ export { createProgram } from "./program.js";
2
+ export { registerProfileCommands } from "./commands/profile/index.js";
3
+ export { OUTPUT_FORMATS, type GlobalOptions, type OutputFormat, type PaginationOptions } from "./options.js";
4
+ export { formatOutput, formatCsv, formatJson, formatTable, formatYaml } from "./formatters/index.js";
5
+ export { fetchPage, fetchAllPages, fetchPaginated, type Page, type PaginatedResult } from "./pagination.js";
6
+ export type { PaginationMeta } from "@qontoctl/core";
7
+ export { createClient } from "./client.js";
8
+ export { handleCliError } from "./error-handler.js";
9
+ export { addInheritableOptions, resolveGlobalOptions } from "./inherited-options.js";
10
+ export { createLabelCommand, createMembershipCommand } from "./commands/index.js";
11
+ export { registerStatementCommands } from "./commands/index.js";
12
+ export { registerTransactionCommands } from "./commands/transaction/index.js";
13
+ export { registerOrgCommands } from "./commands/index.js";
14
+ export { registerAccountCommands } from "./commands/index.js";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE7G,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAErG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5G,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ export { createProgram } from "./program.js";
4
+ export { registerProfileCommands } from "./commands/profile/index.js";
5
+ export { OUTPUT_FORMATS } from "./options.js";
6
+ export { formatOutput, formatCsv, formatJson, formatTable, formatYaml } from "./formatters/index.js";
7
+ export { fetchPage, fetchAllPages, fetchPaginated } from "./pagination.js";
8
+ export { createClient } from "./client.js";
9
+ export { handleCliError } from "./error-handler.js";
10
+ export { addInheritableOptions, resolveGlobalOptions } from "./inherited-options.js";
11
+ export { createLabelCommand, createMembershipCommand } from "./commands/index.js";
12
+ export { registerStatementCommands } from "./commands/index.js";
13
+ export { registerTransactionCommands } from "./commands/transaction/index.js";
14
+ export { registerOrgCommands } from "./commands/index.js";
15
+ export { registerAccountCommands } from "./commands/index.js";
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAiE,MAAM,cAAc,CAAC;AAE7G,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAErG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAmC,MAAM,iBAAiB,CAAC;AAI5G,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAErF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Adds inheritable global options (--profile, --verbose, --debug) to a command.
4
+ * These mirror the program-level options so users can specify them after the subcommand.
5
+ */
6
+ export declare function addInheritableOptions(cmd: Command): Command;
7
+ /**
8
+ * Resolve global options from a command, giving child (subcommand) precedence over parent.
9
+ *
10
+ * Walks the command ancestor chain from root to leaf, merging options at each level.
11
+ * Later (child) values overwrite earlier (parent) values, so specifying `--profile`
12
+ * on the subcommand takes precedence over the global position.
13
+ */
14
+ export declare function resolveGlobalOptions<T>(cmd: Command): T;
15
+ //# sourceMappingURL=inherited-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inherited-options.d.ts","sourceRoot":"","sources":["../src/inherited-options.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAK3D;AAED;;;;;;GAMG;AAEH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC,CAQvD"}
@@ -0,0 +1,31 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { Option } from "commander";
4
+ /**
5
+ * Adds inheritable global options (--profile, --verbose, --debug) to a command.
6
+ * These mirror the program-level options so users can specify them after the subcommand.
7
+ */
8
+ export function addInheritableOptions(cmd) {
9
+ return cmd
10
+ .addOption(new Option("-p, --profile <name>", "configuration profile to use"))
11
+ .addOption(new Option("--verbose", "enable verbose output"))
12
+ .addOption(new Option("--debug", "enable debug output (implies --verbose)"));
13
+ }
14
+ /**
15
+ * Resolve global options from a command, giving child (subcommand) precedence over parent.
16
+ *
17
+ * Walks the command ancestor chain from root to leaf, merging options at each level.
18
+ * Later (child) values overwrite earlier (parent) values, so specifying `--profile`
19
+ * on the subcommand takes precedence over the global position.
20
+ */
21
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-parameters -- mirrors Commander's optsWithGlobals<T>() pattern
22
+ export function resolveGlobalOptions(cmd) {
23
+ const chain = [];
24
+ for (let current = cmd; current; current = current.parent) {
25
+ chain.push(current);
26
+ }
27
+ // reduceRight processes [this, parent, root] as root → parent → this,
28
+ // so leaf options overwrite parent options via Object.assign.
29
+ return chain.reduceRight((combined, c) => Object.assign(combined, c.opts()), {});
30
+ }
31
+ //# sourceMappingURL=inherited-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inherited-options.js","sourceRoot":"","sources":["../src/inherited-options.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAChD,OAAO,GAAG;SACP,SAAS,CAAC,IAAI,MAAM,CAAC,sBAAsB,EAAE,8BAA8B,CAAC,CAAC;SAC7E,SAAS,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;SAC3D,SAAS,CAAC,IAAI,MAAM,CAAC,SAAS,EAAE,yCAAyC,CAAC,CAAC,CAAC;AACjF,CAAC;AAED;;;;;;GAMG;AACH,iIAAiI;AACjI,MAAM,UAAU,oBAAoB,CAAI,GAAY;IAClD,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,KAAK,IAAI,OAAO,GAAmB,GAAG,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1E,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IACD,sEAAsE;IACtE,8DAA8D;IAC9D,OAAO,KAAK,CAAC,WAAW,CAA0B,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAM,CAAC;AACjH,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Supported output formats for CLI commands.
3
+ */
4
+ export type OutputFormat = "table" | "json" | "yaml" | "csv";
5
+ /**
6
+ * All valid output format values, used for Commander choices validation.
7
+ */
8
+ export declare const OUTPUT_FORMATS: readonly OutputFormat[];
9
+ /**
10
+ * Global CLI options parsed from Commander.
11
+ */
12
+ export interface GlobalOptions {
13
+ readonly profile?: string | undefined;
14
+ readonly output: OutputFormat;
15
+ readonly verbose?: true | undefined;
16
+ readonly debug?: true | undefined;
17
+ }
18
+ /**
19
+ * Pagination options parsed from Commander.
20
+ */
21
+ export interface PaginationOptions {
22
+ readonly page?: number | undefined;
23
+ readonly perPage?: number | undefined;
24
+ readonly paginate: boolean;
25
+ }
26
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAA8C,CAAC;AAEjG;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B"}
@@ -0,0 +1,7 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ /**
4
+ * All valid output format values, used for Commander choices validation.
5
+ */
6
+ export const OUTPUT_FORMATS = ["table", "json", "yaml", "csv"];
7
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAOpC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { HttpClient, PaginationMeta, QueryParams } from "@qontoctl/core";
2
+ import type { PaginationOptions } from "./options.js";
3
+ /**
4
+ * A single page of results from a paginated API endpoint.
5
+ */
6
+ export interface Page<T> {
7
+ readonly items: readonly T[];
8
+ readonly meta: PaginationMeta;
9
+ }
10
+ /**
11
+ * Combined result from fetching one or more pages.
12
+ */
13
+ export interface PaginatedResult<T> {
14
+ readonly items: readonly T[];
15
+ readonly meta: PaginationMeta;
16
+ }
17
+ /**
18
+ * Fetch a single page from a paginated Qonto API endpoint.
19
+ *
20
+ * @param client - The HTTP client to use for the request.
21
+ * @param path - The API path (e.g., `/v2/transactions`).
22
+ * @param collectionKey - The key in the response containing the items array.
23
+ * @param page - The page number (1-based).
24
+ * @param perPage - Number of items per page.
25
+ * @param params - Additional query parameters.
26
+ */
27
+ export declare function fetchPage<T>(client: HttpClient, path: string, collectionKey: string, page: number, perPage: number, params?: QueryParams): Promise<Page<T>>;
28
+ /**
29
+ * Fetch all pages from a paginated endpoint, combining items into a single array.
30
+ *
31
+ * @param client - The HTTP client to use for requests.
32
+ * @param path - The API path.
33
+ * @param collectionKey - The key in the response containing the items array.
34
+ * @param perPage - Number of items per page.
35
+ * @param params - Additional query parameters.
36
+ */
37
+ export declare function fetchAllPages<T>(client: HttpClient, path: string, collectionKey: string, perPage: number, params?: QueryParams): Promise<PaginatedResult<T>>;
38
+ /**
39
+ * Fetch data from a paginated endpoint based on CLI pagination options.
40
+ *
41
+ * - Default (no flags): auto-paginate across all pages.
42
+ * - `--page N`: fetch only page N.
43
+ * - `--no-paginate`: fetch only the first page (disable auto-pagination).
44
+ *
45
+ * @param client - The HTTP client to use for requests.
46
+ * @param path - The API path.
47
+ * @param collectionKey - The key in the response containing the items array.
48
+ * @param paginationOptions - Parsed pagination CLI options.
49
+ * @param params - Additional query parameters.
50
+ */
51
+ export declare function fetchPaginated<T>(client: HttpClient, path: string, collectionKey: string, paginationOptions: PaginationOptions, params?: QueryParams): Promise<PaginatedResult<T>>;
52
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":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,CAc7B"}
@@ -0,0 +1,87 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ const DEFAULT_PER_PAGE = 100;
4
+ const MAX_PAGES = 1000;
5
+ /**
6
+ * Fetch a single page from a paginated Qonto API endpoint.
7
+ *
8
+ * @param client - The HTTP client to use for the request.
9
+ * @param path - The API path (e.g., `/v2/transactions`).
10
+ * @param collectionKey - The key in the response containing the items array.
11
+ * @param page - The page number (1-based).
12
+ * @param perPage - Number of items per page.
13
+ * @param params - Additional query parameters.
14
+ */
15
+ export async function fetchPage(client, path, collectionKey, page, perPage, params) {
16
+ const queryParams = {
17
+ ...params,
18
+ current_page: String(page),
19
+ per_page: String(perPage),
20
+ };
21
+ const response = await client.get(path, queryParams);
22
+ const items = (response[collectionKey] ?? []);
23
+ const meta = response["meta"];
24
+ return { items, meta };
25
+ }
26
+ /**
27
+ * Fetch all pages from a paginated endpoint, combining items into a single array.
28
+ *
29
+ * @param client - The HTTP client to use for requests.
30
+ * @param path - The API path.
31
+ * @param collectionKey - The key in the response containing the items array.
32
+ * @param perPage - Number of items per page.
33
+ * @param params - Additional query parameters.
34
+ */
35
+ export async function fetchAllPages(client, path, collectionKey, perPage, params) {
36
+ const firstPage = await fetchPage(client, path, collectionKey, 1, perPage, params);
37
+ const allItems = [...firstPage.items];
38
+ let currentMeta = firstPage.meta;
39
+ let pagesFetched = 1;
40
+ while (currentMeta.next_page !== null) {
41
+ if (pagesFetched >= MAX_PAGES) {
42
+ break;
43
+ }
44
+ const nextPage = await fetchPage(client, path, collectionKey, currentMeta.next_page, perPage, params);
45
+ allItems.push(...nextPage.items);
46
+ currentMeta = nextPage.meta;
47
+ pagesFetched++;
48
+ }
49
+ return {
50
+ items: allItems,
51
+ meta: {
52
+ ...currentMeta,
53
+ current_page: 1,
54
+ next_page: null,
55
+ prev_page: null,
56
+ total_pages: currentMeta.total_pages,
57
+ total_count: currentMeta.total_count,
58
+ per_page: perPage,
59
+ },
60
+ };
61
+ }
62
+ /**
63
+ * Fetch data from a paginated endpoint based on CLI pagination options.
64
+ *
65
+ * - Default (no flags): auto-paginate across all pages.
66
+ * - `--page N`: fetch only page N.
67
+ * - `--no-paginate`: fetch only the first page (disable auto-pagination).
68
+ *
69
+ * @param client - The HTTP client to use for requests.
70
+ * @param path - The API path.
71
+ * @param collectionKey - The key in the response containing the items array.
72
+ * @param paginationOptions - Parsed pagination CLI options.
73
+ * @param params - Additional query parameters.
74
+ */
75
+ export async function fetchPaginated(client, path, collectionKey, paginationOptions, params) {
76
+ const perPage = paginationOptions.perPage ?? DEFAULT_PER_PAGE;
77
+ if (paginationOptions.page !== undefined) {
78
+ const page = await fetchPage(client, path, collectionKey, paginationOptions.page, perPage, params);
79
+ return { items: page.items, meta: page.meta };
80
+ }
81
+ if (!paginationOptions.paginate) {
82
+ const page = await fetchPage(client, path, collectionKey, 1, perPage, params);
83
+ return { items: page.items, meta: page.meta };
84
+ }
85
+ return fetchAllPages(client, path, collectionKey, perPage, params);
86
+ }
87
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAqBpC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAkB,EAClB,IAAY,EACZ,aAAqB,EACrB,IAAY,EACZ,OAAe,EACf,MAAoB;IAEpB,MAAM,WAAW,GAAgB;QAC/B,GAAG,MAAM;QACT,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC;QAC1B,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC;KAC1B,CAAC;IAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAA0B,IAAI,EAAE,WAAW,CAAC,CAAC;IAC9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F,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAkB,EAClB,IAAY,EACZ,aAAqB,EACrB,iBAAoC,EACpC,MAAoB;IAEpB,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,IAAI,gBAAgB,CAAC;IAE9D,IAAI,iBAAiB,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAI,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACtG,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,MAAM,SAAS,CAAI,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACjF,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,OAAO,aAAa,CAAI,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACxE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,wBAAgB,aAAa,IAAI,OAAO,CASvC"}
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAU5C,wBAAgB,aAAa,IAAI,OAAO,CAwBvC"}
package/dist/program.js CHANGED
@@ -1,12 +1,39 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-only
2
2
  // Copyright (C) 2026 Oleksii PELYKH
3
- import { Command } from "commander";
3
+ import { createRequire } from "node:module";
4
+ import { Command, Option } from "commander";
5
+ import { registerCompletionCommand } from "./completions/index.js";
6
+ import { registerTransactionCommands } from "./commands/transaction/index.js";
7
+ import { registerOrgCommands } from "./commands/org.js";
8
+ import { registerAccountCommands } from "./commands/account.js";
9
+ import { OUTPUT_FORMATS } from "./options.js";
10
+ const require = createRequire(import.meta.url);
11
+ const packageJson = require("../package.json");
4
12
  export function createProgram() {
5
13
  const program = new Command();
14
+ program.name("qontoctl").description("The complete CLI & MCP for Qonto").version(packageJson.version);
6
15
  program
7
- .name("qontoctl")
8
- .description("The complete CLI & MCP for Qonto")
9
- .version("0.0.0");
16
+ .addOption(new Option("-p, --profile <name>", "configuration profile to use"))
17
+ .addOption(new Option("-o, --output <format>", "output format").choices([...OUTPUT_FORMATS]).default("table"))
18
+ .addOption(new Option("--verbose", "enable verbose output"))
19
+ .addOption(new Option("--debug", "enable debug output (implies --verbose)"))
20
+ .addOption(new Option("--page <number>", "fetch a specific page of results").argParser(parsePositiveInt))
21
+ .addOption(new Option("--per-page <number>", "number of results per page").argParser(parsePositiveInt))
22
+ .addOption(new Option("--no-paginate", "disable auto-pagination"));
23
+ registerCompletionCommand(program);
24
+ registerTransactionCommands(program);
25
+ registerOrgCommands(program);
26
+ registerAccountCommands(program);
27
+ program.action(() => {
28
+ program.outputHelp();
29
+ });
10
30
  return program;
11
31
  }
32
+ function parsePositiveInt(value) {
33
+ const parsed = Number.parseInt(value, 10);
34
+ if (!Number.isFinite(parsed) || parsed < 1) {
35
+ throw new Error(`Expected a positive integer, got "${value}".`);
36
+ }
37
+ return parsed;
38
+ }
12
39
  //# sourceMappingURL=program.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAC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"CLI for Qonto API integration",
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,6 +10,7 @@
10
10
  "author": "Alexey Pelykh (https://github.com/alexey-pelykh)",
11
11
  "homepage": "https://github.com/alexey-pelykh/qontoctl/tree/main/packages/cli",
12
12
  "bugs": "https://github.com/alexey-pelykh/qontoctl/issues",
13
+ "funding": "https://github.com/sponsors/alexey-pelykh",
13
14
  "repository": {
14
15
  "type": "git",
15
16
  "url": "https://github.com/alexey-pelykh/qontoctl.git",
@@ -17,8 +18,8 @@
17
18
  },
18
19
  "exports": {
19
20
  ".": {
20
- "types": "./dist/program.d.ts",
21
- "import": "./dist/program.js"
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
22
23
  }
23
24
  },
24
25
  "bin": {
@@ -27,20 +28,34 @@
27
28
  "files": [
28
29
  "dist"
29
30
  ],
30
- "scripts": {
31
- "build": "tsc",
32
- "test": "vitest run --passWithNoTests",
33
- "lint": "eslint src/",
34
- "dev": "tsc --watch"
31
+ "keywords": [
32
+ "qonto",
33
+ "banking",
34
+ "fintech",
35
+ "cli",
36
+ "command-line",
37
+ "qonto-api"
38
+ ],
39
+ "publishConfig": {
40
+ "access": "public"
35
41
  },
36
42
  "dependencies": {
37
- "@qontoctl/core": "workspace:^",
38
- "commander": "catalog:"
43
+ "commander": "^14.0.3",
44
+ "yaml": "^2.7.1",
45
+ "@qontoctl/core": "^0.1.0"
39
46
  },
40
47
  "devDependencies": {
41
- "@types/node": "catalog:",
42
- "eslint": "catalog:",
43
- "typescript": "catalog:",
44
- "vitest": "catalog:"
48
+ "@types/node": "^24",
49
+ "eslint": "^9.39.2",
50
+ "typescript": "^5.9.3",
51
+ "vitest": "^4.0.18"
52
+ },
53
+ "scripts": {
54
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
55
+ "build": "tsc",
56
+ "typecheck": "tsc --noEmit",
57
+ "test": "vitest run",
58
+ "lint": "eslint src/",
59
+ "dev": "tsc --watch"
45
60
  }
46
- }
61
+ }