@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
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @qontoctl/cli
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@qontoctl/cli?logo=npm)](https://www.npmjs.com/package/@qontoctl/cli)
4
+
5
+ CLI commands for [Qonto](https://qonto.com) API integration — transaction listing, organization details, labels, memberships, statements, and more.
6
+
7
+ Part of the [QontoCtl](https://github.com/alexey-pelykh/qontoctl) project.
8
+
9
+ > **Note:** For end-user usage, install the [`qontoctl`](https://www.npmjs.com/package/qontoctl) umbrella package instead. This package is for programmatic access to the CLI command definitions.
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ npm install @qontoctl/cli
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ | Command | Description |
20
+ | ------------------------- | ---------------------------------- |
21
+ | `org show` | Show organization details |
22
+ | `account list` | List bank accounts |
23
+ | `account show <id>` | Show account details |
24
+ | `transaction list` | List transactions with filters |
25
+ | `transaction show <id>` | Show transaction details |
26
+ | `label list` | List all labels |
27
+ | `label show <id>` | Show label details |
28
+ | `membership list` | List organization memberships |
29
+ | `profile add <name>` | Create a new profile interactively |
30
+ | `profile list` | List named profiles |
31
+ | `profile show <name>` | Show profile details |
32
+ | `profile remove <name>` | Delete a named profile |
33
+ | `profile test` | Test profile credentials |
34
+ | `statement list` | List bank statements |
35
+ | `statement show <id>` | Show statement details |
36
+ | `statement download <id>` | Download statement PDF |
37
+ | `completion` | Generate shell completion scripts |
38
+
39
+ ### Global Options
40
+
41
+ | Option | Description |
42
+ | ----------------------- | --------------------------------------------- |
43
+ | `-p, --profile <name>` | Configuration profile to use |
44
+ | `-o, --output <format>` | Output format: `table`, `json`, `yaml`, `csv` |
45
+ | `--verbose` | Enable verbose logging |
46
+ | `--debug` | Enable debug logging |
47
+ | `--page <number>` | Page number for paginated results |
48
+ | `--per-page <number>` | Items per page |
49
+ | `--no-paginate` | Disable auto-pagination |
50
+
51
+ ## Programmatic Usage
52
+
53
+ ```ts
54
+ import { createProgram } from "@qontoctl/cli";
55
+
56
+ const program = createProgram();
57
+ await program.parseAsync(process.argv);
58
+ ```
59
+
60
+ ## Requirements
61
+
62
+ - Node.js >= 24
63
+
64
+ ## License
65
+
66
+ [AGPL-3.0-only](https://github.com/alexey-pelykh/qontoctl/blob/main/LICENSE) — For commercial licensing, contact the maintainer.
package/dist/cli.js CHANGED
@@ -2,5 +2,12 @@
2
2
  // SPDX-License-Identifier: AGPL-3.0-only
3
3
  // Copyright (C) 2026 Oleksii PELYKH
4
4
  import { createProgram } from "./program.js";
5
- createProgram().parse();
5
+ import { handleCliError } from "./error-handler.js";
6
+ const program = createProgram();
7
+ try {
8
+ await program.parseAsync();
9
+ }
10
+ catch (error) {
11
+ handleCliError(error, program.opts()["debug"] === true);
12
+ }
6
13
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAEhC,IAAI,CAAC;IACH,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC;AAAC,OAAO,KAAc,EAAE,CAAC;IACxB,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { HttpClient } from "@qontoctl/core";
2
+ import type { GlobalOptions } from "./options.js";
3
+ /**
4
+ * Create an authenticated HttpClient from global CLI options.
5
+ *
6
+ * Resolves configuration (profile, env), builds the authorization
7
+ * header, and uses the resolved endpoint.
8
+ */
9
+ export declare function createClient(options: GlobalOptions): Promise<HttpClient>;
10
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,UAAU,EAA2C,MAAM,gBAAgB,CAAC;AAC5G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAoC9E"}
package/dist/client.js ADDED
@@ -0,0 +1,42 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { HttpClient, resolveConfig, buildApiKeyAuthorization } from "@qontoctl/core";
4
+ /**
5
+ * Create an authenticated HttpClient from global CLI options.
6
+ *
7
+ * Resolves configuration (profile, env), builds the authorization
8
+ * header, and uses the resolved endpoint.
9
+ */
10
+ export async function createClient(options) {
11
+ const { config, endpoint, warnings } = await resolveConfig({
12
+ profile: options.profile,
13
+ });
14
+ for (const warning of warnings) {
15
+ process.stderr.write(`Warning: ${warning}\n`);
16
+ }
17
+ if (config.apiKey === undefined) {
18
+ throw new Error("No API key credentials found in configuration");
19
+ }
20
+ const authorization = buildApiKeyAuthorization(config.apiKey);
21
+ let logger;
22
+ if (options.debug === true) {
23
+ process.stderr.write("Warning: Debug mode logs full API responses which may include financial data (IBANs, balances). " +
24
+ "Do not use in shared environments.\n");
25
+ logger = {
26
+ verbose: (msg) => process.stderr.write(`${msg}\n`),
27
+ debug: (msg) => process.stderr.write(`${msg}\n`),
28
+ };
29
+ }
30
+ else if (options.verbose === true) {
31
+ logger = {
32
+ verbose: (msg) => process.stderr.write(`${msg}\n`),
33
+ debug: () => { },
34
+ };
35
+ }
36
+ return new HttpClient({
37
+ baseUrl: endpoint,
38
+ authorization,
39
+ logger,
40
+ });
41
+ }
42
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAyB,UAAU,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAG5G;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAsB;IACvD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM,aAAa,CAAC;QACzD,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IAEH,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,OAAO,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,aAAa,GAAG,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE9D,IAAI,MAAoC,CAAC;IACzC,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,kGAAkG;YAChG,sCAAsC,CACzC,CAAC;QACF,MAAM,GAAG;YACP,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;YAClD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;SACjD,CAAC;IACJ,CAAC;SAAM,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACpC,MAAM,GAAG;YACP,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;YAClD,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;SAChB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,UAAU,CAAC;QACpB,OAAO,EAAE,QAAQ;QACjB,aAAa;QACb,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `account` command group on the given program.
4
+ */
5
+ export declare function registerAccountCommands(program: Command): void;
6
+ //# sourceMappingURL=account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuBzC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4C9D"}
@@ -0,0 +1,61 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { getBankAccount } from "@qontoctl/core";
4
+ import { createClient } from "../client.js";
5
+ import { formatOutput } from "../formatters/index.js";
6
+ import { addInheritableOptions, resolveGlobalOptions } from "../inherited-options.js";
7
+ import { fetchPaginated } from "../pagination.js";
8
+ /**
9
+ * Pick the fields shown in table/csv list output.
10
+ */
11
+ function toListRow(account) {
12
+ return {
13
+ id: account.id,
14
+ name: account.name,
15
+ iban: account.iban,
16
+ balance: account.balance,
17
+ currency: account.currency,
18
+ status: account.status,
19
+ };
20
+ }
21
+ /**
22
+ * Register the `account` command group on the given program.
23
+ */
24
+ export function registerAccountCommands(program) {
25
+ const account = program.command("account").description("Bank account operations");
26
+ const list = account.command("list").description("List bank accounts");
27
+ addInheritableOptions(list);
28
+ list.action(async (_options, cmd) => {
29
+ const opts = resolveGlobalOptions(cmd);
30
+ const client = await createClient(opts);
31
+ const result = await fetchPaginated(client, "/v2/bank_accounts", "bank_accounts", opts);
32
+ const data = opts.output === "json" || opts.output === "yaml" ? result.items : result.items.map(toListRow);
33
+ const output = formatOutput(data, opts.output);
34
+ process.stdout.write(output + "\n");
35
+ });
36
+ const show = account.command("show").description("Show bank account details").argument("<id>", "Bank account ID");
37
+ addInheritableOptions(show);
38
+ show.action(async (id, _options, cmd) => {
39
+ const opts = resolveGlobalOptions(cmd);
40
+ const client = await createClient(opts);
41
+ const bankAccount = await getBankAccount(client, id);
42
+ const data = opts.output === "json" || opts.output === "yaml"
43
+ ? bankAccount
44
+ : [
45
+ {
46
+ id: bankAccount.id,
47
+ name: bankAccount.name,
48
+ iban: bankAccount.iban,
49
+ bic: bankAccount.bic,
50
+ balance: bankAccount.balance,
51
+ authorized_balance: bankAccount.authorized_balance,
52
+ currency: bankAccount.currency,
53
+ status: bankAccount.status,
54
+ main: bankAccount.main,
55
+ },
56
+ ];
57
+ const output = formatOutput(data, opts.output);
58
+ process.stdout.write(output + "\n");
59
+ });
60
+ }
61
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/commands/account.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;GAEG;AACH,SAAS,SAAS,CAAC,OAA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AG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAClH,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,QAAiB,EAAE,GAAY,EAAE,EAAE;QAChE,MAAM,IAAI,GAAG,oBAAoB,CAAgB,GAAG,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAErD,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;YAC9C,CAAC,CAAC,WAAW;YACb,CAAC,CAAC;gBACE;oBACE,EAAE,EAAE,WAAW,CAAC,EAAE;oBAClB,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,IAAI,EAAE,WAAW,CAAC,IAAI;oBACtB,GAAG,EAAE,WAAW,CAAC,GAAG;oBACpB,OAAO,EAAE,WAAW,CAAC,OAAO;oBAC5B,kBAAkB,EAAE,WAAW,CAAC,kBAAkB;oBAClD,QAAQ,EAAE,WAAW,CAAC,QAAQ;oBAC9B,MAAM,EAAE,WAAW,CAAC,MAAM;oBAC1B,IAAI,EAAE,WAAW,CAAC,IAAI;iBACvB;aACF,CAAC;QAER,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { createLabelCommand } from "./label.js";
2
+ export { createMembershipCommand } from "./membership.js";
3
+ export { registerStatementCommands } from "./statement.js";
4
+ export { registerOrgCommands } from "./org.js";
5
+ export { registerAccountCommands } from "./account.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ export { createLabelCommand } from "./label.js";
4
+ export { createMembershipCommand } from "./membership.js";
5
+ export { registerStatementCommands } from "./statement.js";
6
+ export { registerOrgCommands } from "./org.js";
7
+ export { registerAccountCommands } from "./account.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function createLabelCommand(): Command;
3
+ //# sourceMappingURL=label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/commands/label.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,kBAAkB,IAAI,OAAO,CA+C5C"}
@@ -0,0 +1,45 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { Command } from "commander";
4
+ import { createClient } from "../client.js";
5
+ import { fetchPaginated } from "../pagination.js";
6
+ import { formatOutput } from "../formatters/index.js";
7
+ import { addInheritableOptions, resolveGlobalOptions } from "../inherited-options.js";
8
+ export function createLabelCommand() {
9
+ const label = new Command("label").description("Manage labels");
10
+ const list = label.command("list").description("List all labels");
11
+ addInheritableOptions(list);
12
+ list.action(async (_options, cmd) => {
13
+ const opts = resolveGlobalOptions(cmd);
14
+ const client = await createClient(opts);
15
+ const result = await fetchPaginated(client, "/v2/labels", "labels", opts);
16
+ const data = opts.output === "json" || opts.output === "yaml"
17
+ ? result.items
18
+ : result.items.map((l) => ({
19
+ id: l.id,
20
+ name: l.name,
21
+ parent_id: l.parent_id ?? "",
22
+ }));
23
+ process.stdout.write(formatOutput(data, opts.output) + "\n");
24
+ });
25
+ const show = label.command("show <id>").description("Show label details");
26
+ addInheritableOptions(show);
27
+ show.action(async (id, _options, cmd) => {
28
+ const opts = resolveGlobalOptions(cmd);
29
+ const client = await createClient(opts);
30
+ const response = await client.get(`/v2/labels/${encodeURIComponent(id)}`);
31
+ const l = response.label;
32
+ const data = opts.output === "json" || opts.output === "yaml"
33
+ ? l
34
+ : [
35
+ {
36
+ id: l.id,
37
+ name: l.name,
38
+ parent_id: l.parent_id ?? "",
39
+ },
40
+ ];
41
+ process.stdout.write(formatOutput(data, opts.output) + "\n");
42
+ });
43
+ return label;
44
+ }
45
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../src/commands/label.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,OAAO,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C,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAC1E,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,QAAiB,EAAE,GAAY,EAAE,EAAE;QAChE,MAAM,IAAI,GAAG,oBAAoB,CAAgB,GAAG,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QAExC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAmB,cAAc,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5F,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;QAEzB,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;YAC9C,CAAC,CAAC,CAAC;YACH,CAAC,CAAC;gBACE;oBACE,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,EAAE;iBAC7B;aACF,CAAC;QAER,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export declare function createMembershipCommand(): Command;
3
+ //# sourceMappingURL=membership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../src/commands/membership.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,wBAAgB,uBAAuB,IAAI,OAAO,CA2BjD"}
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { Command } from "commander";
4
+ import { createClient } from "../client.js";
5
+ import { fetchPaginated } from "../pagination.js";
6
+ import { formatOutput } from "../formatters/index.js";
7
+ import { addInheritableOptions, resolveGlobalOptions } from "../inherited-options.js";
8
+ export function createMembershipCommand() {
9
+ const membership = new Command("membership").description("Manage memberships");
10
+ const list = membership.command("list").description("List all memberships");
11
+ addInheritableOptions(list);
12
+ list.action(async (_options, cmd) => {
13
+ const opts = resolveGlobalOptions(cmd);
14
+ const client = await createClient(opts);
15
+ const result = await fetchPaginated(client, "/v2/memberships", "memberships", opts);
16
+ const data = opts.output === "json" || opts.output === "yaml"
17
+ ? result.items
18
+ : result.items.map((m) => ({
19
+ id: m.id,
20
+ first_name: m.first_name,
21
+ last_name: m.last_name,
22
+ role: m.role,
23
+ team_id: m.team_id,
24
+ status: m.status,
25
+ }));
26
+ process.stdout.write(formatOutput(data, opts.output) + "\n");
27
+ });
28
+ return membership;
29
+ }
30
+ //# sourceMappingURL=membership.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership.js","sourceRoot":"","sources":["../../src/commands/membership.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGtF,MAAM,UAAU,uBAAuB;IACrC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAE/E,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAC5E,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAiB,EAAE,GAAY,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,oBAAoB,CAAoC,GAAG,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QAExC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAa,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;QAEhG,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;YAC9C,CAAC,CAAC,MAAM,CAAC,KAAK;YACd,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACvB,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,SAAS,EAAE,CAAC,CAAC,SAAS;gBACtB,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,MAAM,EAAE,CAAC,CAAC,MAAM;aACjB,CAAC,CAAC,CAAC;QAEV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `org` command group on the given program.
4
+ */
5
+ export declare function registerOrgCommands(program: Command): void;
6
+ //# sourceMappingURL=org.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwB1D"}
@@ -0,0 +1,31 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { getOrganization } from "@qontoctl/core";
4
+ import { createClient } from "../client.js";
5
+ import { formatOutput } from "../formatters/index.js";
6
+ import { addInheritableOptions, resolveGlobalOptions } from "../inherited-options.js";
7
+ /**
8
+ * Register the `org` command group on the given program.
9
+ */
10
+ export function registerOrgCommands(program) {
11
+ const org = program.command("org").description("Organization operations");
12
+ const show = org.command("show").description("Show organization details");
13
+ addInheritableOptions(show);
14
+ show.action(async (_options, cmd) => {
15
+ const opts = resolveGlobalOptions(cmd);
16
+ const client = await createClient(opts);
17
+ const organization = await getOrganization(client);
18
+ const data = opts.output === "json" || opts.output === "yaml"
19
+ ? organization
20
+ : [
21
+ {
22
+ slug: organization.slug,
23
+ legal_name: organization.legal_name,
24
+ bank_accounts: organization.bank_accounts.length,
25
+ },
26
+ ];
27
+ const output = formatOutput(data, opts.output);
28
+ process.stdout.write(output + "\n");
29
+ });
30
+ }
31
+ //# sourceMappingURL=org.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGtF;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAE1E,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAC1E,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAiB,EAAE,GAAY,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,oBAAoB,CAAgB,GAAG,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QACxC,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;QAEnD,MAAM,IAAI,GACR,IAAI,CAAC,MAAM,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM;YAC9C,CAAC,CAAC,YAAY;YACd,CAAC,CAAC;gBACE;oBACE,IAAI,EAAE,YAAY,CAAC,IAAI;oBACvB,UAAU,EAAE,YAAY,CAAC,UAAU;oBACnC,aAAa,EAAE,YAAY,CAAC,aAAa,CAAC,MAAM;iBACjD;aACF,CAAC;QAER,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `profile add <name>` subcommand.
4
+ */
5
+ export declare function registerAddCommand(parent: Command): void;
6
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/commands/profile/add.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAMxD"}
@@ -0,0 +1,63 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { mkdir, writeFile } from "node:fs/promises";
4
+ import { join } from "node:path";
5
+ import { homedir } from "node:os";
6
+ import { createInterface } from "node:readline/promises";
7
+ import { stringify as stringifyYaml } from "yaml";
8
+ import { CONFIG_DIR, isValidProfileName, loadConfigFile } from "@qontoctl/core";
9
+ import { addInheritableOptions } from "../../inherited-options.js";
10
+ /**
11
+ * Register the `profile add <name>` subcommand.
12
+ */
13
+ export function registerAddCommand(parent) {
14
+ const add = parent.command("add <name>").description("create a new profile interactively");
15
+ addInheritableOptions(add);
16
+ add.action(async (name) => {
17
+ await addProfile(name);
18
+ });
19
+ }
20
+ async function addProfile(name) {
21
+ if (!isValidProfileName(name)) {
22
+ console.error("Invalid profile name: must not contain path separators or '..'.");
23
+ process.exitCode = 1;
24
+ return;
25
+ }
26
+ // Check if profile already exists
27
+ const { raw } = await loadConfigFile({ profile: name });
28
+ if (raw !== undefined) {
29
+ console.error(`Profile "${name}" already exists. Remove it first to recreate.`);
30
+ process.exitCode = 1;
31
+ return;
32
+ }
33
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
34
+ try {
35
+ const organizationSlug = await rl.question("Organization slug: ");
36
+ const secretKey = await rl.question("Secret key: ");
37
+ if (organizationSlug.trim() === "") {
38
+ console.error("Organization slug cannot be empty.");
39
+ process.exitCode = 1;
40
+ return;
41
+ }
42
+ if (secretKey.trim() === "") {
43
+ console.error("Secret key cannot be empty.");
44
+ process.exitCode = 1;
45
+ return;
46
+ }
47
+ const config = {
48
+ "api-key": {
49
+ "organization-slug": organizationSlug.trim(),
50
+ "secret-key": secretKey.trim(),
51
+ },
52
+ };
53
+ const dir = join(homedir(), CONFIG_DIR);
54
+ await mkdir(dir, { recursive: true, mode: 0o700 });
55
+ const path = join(dir, `${name}.yaml`);
56
+ await writeFile(path, stringifyYaml(config), { encoding: "utf-8", mode: 0o600 });
57
+ console.log(`Profile "${name}" created at ${path}`);
58
+ }
59
+ finally {
60
+ rl.close();
61
+ }
62
+ }
63
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/profile/add.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAe;IAChD,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,oCAAoC,CAAC,CAAC;IAC3F,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC3B,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;QAChC,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,iEAAiE,CAAC,CA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AAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,OAAO,CAAC,CAAC;QACvC,MAAM,SAAS,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAEjF,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,gBAAgB,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register all `profile` subcommands on the given parent command.
4
+ */
5
+ export declare function registerProfileCommands(program: Command): void;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/profile/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAQ9D"}
@@ -0,0 +1,19 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { registerListCommand } from "./list.js";
4
+ import { registerShowCommand } from "./show.js";
5
+ import { registerAddCommand } from "./add.js";
6
+ import { registerRemoveCommand } from "./remove.js";
7
+ import { registerTestCommand } from "./test.js";
8
+ /**
9
+ * Register all `profile` subcommands on the given parent command.
10
+ */
11
+ export function registerProfileCommands(program) {
12
+ const profile = program.command("profile").description("manage credential profiles");
13
+ registerListCommand(profile);
14
+ registerShowCommand(profile);
15
+ registerAddCommand(profile);
16
+ registerRemoveCommand(profile);
17
+ registerTestCommand(profile);
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/profile/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAGpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;IAErF,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7B,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC5B,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC/B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `profile list` subcommand.
4
+ */
5
+ export declare function registerListCommand(parent: Command): void;
6
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/profile/list.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAOzD"}
@@ -0,0 +1,49 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (C) 2026 Oleksii PELYKH
3
+ import { readdir } from "node:fs/promises";
4
+ import { join } from "node:path";
5
+ import { homedir } from "node:os";
6
+ import { CONFIG_DIR } from "@qontoctl/core";
7
+ import { formatOutput } from "../../formatters/index.js";
8
+ import { addInheritableOptions, resolveGlobalOptions } from "../../inherited-options.js";
9
+ const YAML_EXT = ".yaml";
10
+ /**
11
+ * Register the `profile list` subcommand.
12
+ */
13
+ export function registerListCommand(parent) {
14
+ const list = parent.command("list").description("list named profiles from ~/.qontoctl/");
15
+ addInheritableOptions(list);
16
+ list.action(async (_options, cmd) => {
17
+ const globalOpts = resolveGlobalOptions(cmd);
18
+ await listProfiles(globalOpts);
19
+ });
20
+ }
21
+ async function listProfiles(options) {
22
+ const dir = join(homedir(), CONFIG_DIR);
23
+ let entries;
24
+ try {
25
+ entries = await readdir(dir);
26
+ }
27
+ catch (error) {
28
+ if (isNodeError(error) && error.code === "ENOENT") {
29
+ entries = [];
30
+ }
31
+ else {
32
+ throw error;
33
+ }
34
+ }
35
+ const profiles = entries
36
+ .filter((name) => name.endsWith(YAML_EXT))
37
+ .map((name) => name.slice(0, -YAML_EXT.length))
38
+ .sort()
39
+ .map((name) => ({ name }));
40
+ if (profiles.length === 0) {
41
+ console.log("No profiles found.");
42
+ return;
43
+ }
44
+ console.log(formatOutput(profiles, options.output));
45
+ }
46
+ function isNodeError(error) {
47
+ return error instanceof Error && "code" in error;
48
+ }
49
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/profile/list.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY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GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAE7B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC;AACnD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Command } from "commander";
2
+ /**
3
+ * Register the `profile remove <name>` subcommand.
4
+ */
5
+ export declare function registerRemoveCommand(parent: Command): void;
6
+ //# sourceMappingURL=remove.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/profile/remove.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAM3D"}