trello-cli-unofficial 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.11.4](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.3...v0.11.4) (2025-11-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Initialize Commander.js in constructor to fix Windows compatibility ([7762da8](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/7762da85b532e90e68be3717609639f838c88b45))
7
+ * revert to synchronous Commander import for Windows compatibility ([badcea4](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/badcea41b971e8e5dbb1ba8993f9661cb01d7358))
8
+
1
9
  ## [0.11.3](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.2...v0.11.3) (2025-11-14)
2
10
 
3
11
 
package/dist/main.js CHANGED
@@ -28841,141 +28841,6 @@ var init_repositories = __esm(() => {
28841
28841
  init_TrelloApiRepository();
28842
28842
  });
28843
28843
 
28844
- // src/shared/ErrorHandler.ts
28845
- var init_ErrorHandler = __esm(() => {
28846
- init_i18n();
28847
- });
28848
-
28849
- // src/shared/OutputFormatter.ts
28850
- class OutputFormatter {
28851
- format;
28852
- constructor(format = "table") {
28853
- this.format = format;
28854
- }
28855
- setFormat(format) {
28856
- this.format = format;
28857
- }
28858
- output(data, options) {
28859
- const format = options?.format || this.format;
28860
- switch (format) {
28861
- case "json":
28862
- this.outputJson(data);
28863
- break;
28864
- case "csv":
28865
- this.outputCsv(data, options);
28866
- break;
28867
- case "table":
28868
- default:
28869
- this.outputTable(data, options);
28870
- break;
28871
- }
28872
- }
28873
- outputJson(data) {
28874
- console.log(JSON.stringify(data, null, 2));
28875
- }
28876
- outputCsv(data, options) {
28877
- if (!Array.isArray(data) || data.length === 0) {
28878
- console.log(t2("common.noData"));
28879
- return;
28880
- }
28881
- const firstItem = data[0];
28882
- if (!firstItem) {
28883
- console.log(t2("common.noData"));
28884
- return;
28885
- }
28886
- const plainItem = this.toPlainObject(firstItem);
28887
- const fields = options?.fields || Object.keys(plainItem);
28888
- const headers = options?.headers || fields;
28889
- console.log(headers.join(","));
28890
- for (const item of data) {
28891
- const plainObject = this.toPlainObject(item);
28892
- const row = fields.map((field) => {
28893
- const value = plainObject[field];
28894
- const stringValue = String(value || "");
28895
- if (stringValue.includes(",") || stringValue.includes('"') || stringValue.includes(`
28896
- `)) {
28897
- return `"${stringValue.replace(/"/g, '""')}"`;
28898
- }
28899
- return stringValue;
28900
- });
28901
- console.log(row.join(","));
28902
- }
28903
- }
28904
- outputTable(data, options) {
28905
- if (!Array.isArray(data) || data.length === 0) {
28906
- console.log(t2("common.noData"));
28907
- return;
28908
- }
28909
- const firstItem = data[0];
28910
- if (!firstItem) {
28911
- console.log(t2("common.noData"));
28912
- return;
28913
- }
28914
- const plainItem = this.toPlainObject(firstItem);
28915
- const fields = options?.fields || Object.keys(plainItem);
28916
- const headers = options?.headers || fields;
28917
- const columnWidths = headers.map((header, index) => {
28918
- const field = fields[index];
28919
- const headerWidth = header.length;
28920
- const maxDataWidth = Math.max(...data.map((item) => {
28921
- const plainObject = this.toPlainObject(item);
28922
- return String(plainObject[field] || "").length;
28923
- }));
28924
- return Math.max(headerWidth, maxDataWidth);
28925
- });
28926
- const headerRow = headers.map((header, index) => header.padEnd(columnWidths[index])).join(" | ");
28927
- console.log(headerRow);
28928
- const separator = columnWidths.map((width) => "-".repeat(width)).join("-+-");
28929
- console.log(separator);
28930
- for (const item of data) {
28931
- const plainObject = this.toPlainObject(item);
28932
- const row = fields.map((field, index) => {
28933
- const value = String(plainObject[field] || "");
28934
- return value.padEnd(columnWidths[index]);
28935
- }).join(" | ");
28936
- console.log(row);
28937
- }
28938
- }
28939
- toPlainObject(obj) {
28940
- if (obj === null || obj === undefined) {
28941
- return {};
28942
- }
28943
- if (typeof obj === "object" && obj.constructor !== Object) {
28944
- const plain = {};
28945
- for (const key of Object.keys(obj)) {
28946
- plain[key] = obj[key];
28947
- }
28948
- return plain;
28949
- }
28950
- return obj;
28951
- }
28952
- message(message) {
28953
- console.log(message);
28954
- }
28955
- error(message) {
28956
- console.error(`\u274C ${message}`);
28957
- }
28958
- success(message) {
28959
- console.log(`\u2705 ${message}`);
28960
- }
28961
- warning(message) {
28962
- console.log(`\u26A0\uFE0F ${message}`);
28963
- }
28964
- info(message) {
28965
- console.log(`\u2139\uFE0F ${message}`);
28966
- }
28967
- }
28968
- var init_OutputFormatter = __esm(() => {
28969
- init_i18n();
28970
- });
28971
-
28972
- // src/shared/index.ts
28973
- var init_shared = __esm(() => {
28974
- init_ErrorHandler();
28975
- init_OutputFormatter();
28976
- init_types();
28977
- });
28978
-
28979
28844
  // node_modules/commander/lib/error.js
28980
28845
  var require_error = __commonJS((exports) => {
28981
28846
  class CommanderError extends Error {
@@ -31070,20 +30935,6 @@ var require_commander = __commonJS((exports) => {
31070
30935
  });
31071
30936
 
31072
30937
  // node_modules/commander/esm.mjs
31073
- var exports_esm = {};
31074
- __export(exports_esm, {
31075
- program: () => program,
31076
- createOption: () => createOption,
31077
- createCommand: () => createCommand,
31078
- createArgument: () => createArgument,
31079
- Option: () => Option,
31080
- InvalidOptionArgumentError: () => InvalidOptionArgumentError,
31081
- InvalidArgumentError: () => InvalidArgumentError,
31082
- Help: () => Help,
31083
- CommanderError: () => CommanderError,
31084
- Command: () => Command,
31085
- Argument: () => Argument
31086
- });
31087
30938
  var import__, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
31088
30939
  var init_esm17 = __esm(() => {
31089
30940
  import__ = __toESM(require_commander(), 1);
@@ -31102,6 +30953,141 @@ var init_esm17 = __esm(() => {
31102
30953
  } = import__.default);
31103
30954
  });
31104
30955
 
30956
+ // src/shared/ErrorHandler.ts
30957
+ var init_ErrorHandler = __esm(() => {
30958
+ init_i18n();
30959
+ });
30960
+
30961
+ // src/shared/OutputFormatter.ts
30962
+ class OutputFormatter {
30963
+ format;
30964
+ constructor(format = "table") {
30965
+ this.format = format;
30966
+ }
30967
+ setFormat(format) {
30968
+ this.format = format;
30969
+ }
30970
+ output(data, options) {
30971
+ const format = options?.format || this.format;
30972
+ switch (format) {
30973
+ case "json":
30974
+ this.outputJson(data);
30975
+ break;
30976
+ case "csv":
30977
+ this.outputCsv(data, options);
30978
+ break;
30979
+ case "table":
30980
+ default:
30981
+ this.outputTable(data, options);
30982
+ break;
30983
+ }
30984
+ }
30985
+ outputJson(data) {
30986
+ console.log(JSON.stringify(data, null, 2));
30987
+ }
30988
+ outputCsv(data, options) {
30989
+ if (!Array.isArray(data) || data.length === 0) {
30990
+ console.log(t2("common.noData"));
30991
+ return;
30992
+ }
30993
+ const firstItem = data[0];
30994
+ if (!firstItem) {
30995
+ console.log(t2("common.noData"));
30996
+ return;
30997
+ }
30998
+ const plainItem = this.toPlainObject(firstItem);
30999
+ const fields = options?.fields || Object.keys(plainItem);
31000
+ const headers = options?.headers || fields;
31001
+ console.log(headers.join(","));
31002
+ for (const item of data) {
31003
+ const plainObject = this.toPlainObject(item);
31004
+ const row = fields.map((field) => {
31005
+ const value = plainObject[field];
31006
+ const stringValue = String(value || "");
31007
+ if (stringValue.includes(",") || stringValue.includes('"') || stringValue.includes(`
31008
+ `)) {
31009
+ return `"${stringValue.replace(/"/g, '""')}"`;
31010
+ }
31011
+ return stringValue;
31012
+ });
31013
+ console.log(row.join(","));
31014
+ }
31015
+ }
31016
+ outputTable(data, options) {
31017
+ if (!Array.isArray(data) || data.length === 0) {
31018
+ console.log(t2("common.noData"));
31019
+ return;
31020
+ }
31021
+ const firstItem = data[0];
31022
+ if (!firstItem) {
31023
+ console.log(t2("common.noData"));
31024
+ return;
31025
+ }
31026
+ const plainItem = this.toPlainObject(firstItem);
31027
+ const fields = options?.fields || Object.keys(plainItem);
31028
+ const headers = options?.headers || fields;
31029
+ const columnWidths = headers.map((header, index) => {
31030
+ const field = fields[index];
31031
+ const headerWidth = header.length;
31032
+ const maxDataWidth = Math.max(...data.map((item) => {
31033
+ const plainObject = this.toPlainObject(item);
31034
+ return String(plainObject[field] || "").length;
31035
+ }));
31036
+ return Math.max(headerWidth, maxDataWidth);
31037
+ });
31038
+ const headerRow = headers.map((header, index) => header.padEnd(columnWidths[index])).join(" | ");
31039
+ console.log(headerRow);
31040
+ const separator = columnWidths.map((width) => "-".repeat(width)).join("-+-");
31041
+ console.log(separator);
31042
+ for (const item of data) {
31043
+ const plainObject = this.toPlainObject(item);
31044
+ const row = fields.map((field, index) => {
31045
+ const value = String(plainObject[field] || "");
31046
+ return value.padEnd(columnWidths[index]);
31047
+ }).join(" | ");
31048
+ console.log(row);
31049
+ }
31050
+ }
31051
+ toPlainObject(obj) {
31052
+ if (obj === null || obj === undefined) {
31053
+ return {};
31054
+ }
31055
+ if (typeof obj === "object" && obj.constructor !== Object) {
31056
+ const plain = {};
31057
+ for (const key of Object.keys(obj)) {
31058
+ plain[key] = obj[key];
31059
+ }
31060
+ return plain;
31061
+ }
31062
+ return obj;
31063
+ }
31064
+ message(message) {
31065
+ console.log(message);
31066
+ }
31067
+ error(message) {
31068
+ console.error(`\u274C ${message}`);
31069
+ }
31070
+ success(message) {
31071
+ console.log(`\u2705 ${message}`);
31072
+ }
31073
+ warning(message) {
31074
+ console.log(`\u26A0\uFE0F ${message}`);
31075
+ }
31076
+ info(message) {
31077
+ console.log(`\u2139\uFE0F ${message}`);
31078
+ }
31079
+ }
31080
+ var init_OutputFormatter = __esm(() => {
31081
+ init_i18n();
31082
+ });
31083
+
31084
+ // src/shared/index.ts
31085
+ var init_shared = __esm(() => {
31086
+ init_ErrorHandler();
31087
+ init_OutputFormatter();
31088
+ init_types();
31089
+ });
31090
+
31105
31091
  // src/presentation/cli/TrelloCliController.ts
31106
31092
  var exports_TrelloCliController = {};
31107
31093
  __export(exports_TrelloCliController, {
@@ -31151,24 +31137,13 @@ class CommandController {
31151
31137
  authController;
31152
31138
  boardController;
31153
31139
  cardController;
31154
- program = null;
31140
+ program;
31155
31141
  outputFormatter;
31156
31142
  constructor() {
31157
31143
  const configRepository = new FileConfigRepository;
31158
31144
  this.authController = new AuthController(configRepository);
31159
31145
  this.outputFormatter = new OutputFormatter;
31160
- }
31161
- async initializeProgram() {
31162
- if (this.program) {
31163
- return;
31164
- }
31165
- try {
31166
- const { Command: Command2 } = await Promise.resolve().then(() => (init_esm17(), exports_esm));
31167
- this.program = new Command2;
31168
- } catch (error) {
31169
- console.error(t2("menu.errors.commanderInitError"), error);
31170
- throw new Error(t2("menu.errors.commanderInitFailed"));
31171
- }
31146
+ this.program = new Command;
31172
31147
  }
31173
31148
  async initializeTrelloControllers() {
31174
31149
  await this.authController.ensureAuthenticated();
@@ -31368,20 +31343,20 @@ class CommandController {
31368
31343
  });
31369
31344
  }
31370
31345
  async run() {
31371
- await this.initializeProgram();
31372
31346
  await this.setupCommands();
31373
31347
  if (process.argv.length === 2) {
31374
31348
  const configRepository = new FileConfigRepository;
31375
31349
  const cli = new (await Promise.resolve().then(() => (init_TrelloCliController(), exports_TrelloCliController))).TrelloCliController(configRepository, this.outputFormatter);
31376
31350
  await cli.run();
31377
31351
  } else {
31378
- this.program.parse();
31352
+ await this.program.parseAsync();
31379
31353
  }
31380
31354
  }
31381
31355
  }
31382
31356
  var init_CommandController = __esm(() => {
31383
31357
  init_services();
31384
31358
  init_repositories();
31359
+ init_esm17();
31385
31360
  init_i18n();
31386
31361
  init_shared();
31387
31362
  init_cli();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trello-cli-unofficial",
3
3
  "type": "module",
4
- "version": "0.11.3",
4
+ "version": "0.11.4",
5
5
  "private": false,
6
6
  "description": "Unofficial Trello CLI using Power-Up authentication, built with Bun for maximum performance",
7
7
  "author": "Matheus Caiser <matheus.kaiser@gmail.com> (https://www.mrdeveloper.com.br/)",
@@ -1,13 +1,14 @@
1
- import type { Command } from 'commander';
2
1
  import type { OutputFormat } from '@/shared';
3
2
  import { readFileSync } from 'node:fs';
4
-
5
3
  import { join } from 'node:path';
4
+
6
5
  import { AuthenticationService } from '@domain/services';
7
6
  import {
8
7
  FileConfigRepository,
9
8
  TrelloApiRepository,
10
9
  } from '@infrastructure/repositories';
10
+
11
+ import { Command } from 'commander';
11
12
  import { t } from '@/i18n';
12
13
  import { OutputFormatter } from '@/shared';
13
14
 
@@ -17,29 +18,15 @@ export class CommandController {
17
18
  private authController: AuthController;
18
19
  private boardController!: BoardController;
19
20
  private cardController!: CardController;
20
- private program: Command | null = null;
21
+ private program: Command;
21
22
  private outputFormatter: OutputFormatter;
22
23
 
23
24
  constructor() {
24
25
  const configRepository = new FileConfigRepository();
25
26
  this.authController = new AuthController(configRepository);
26
27
  this.outputFormatter = new OutputFormatter();
27
- // Commander will be initialized lazily in run()
28
- }
29
-
30
- private async initializeProgram(): Promise<void> {
31
- if (this.program) {
32
- return;
33
- }
34
-
35
- try {
36
- // Try dynamic import first (more compatible with bundling)
37
- const { Command } = await import('commander');
38
- this.program = new Command();
39
- } catch (error) {
40
- console.error(t('menu.errors.commanderInitError'), error);
41
- throw new Error(t('menu.errors.commanderInitFailed'));
42
- }
28
+ // Initialize Commander immediately in constructor
29
+ this.program = new Command();
43
30
  }
44
31
 
45
32
  private async initializeTrelloControllers(): Promise<void> {
@@ -450,7 +437,6 @@ export class CommandController {
450
437
  }
451
438
 
452
439
  async run(): Promise<void> {
453
- await this.initializeProgram();
454
440
  await this.setupCommands();
455
441
 
456
442
  // Fallback to interactive mode if no command specified
@@ -461,7 +447,7 @@ export class CommandController {
461
447
  ).TrelloCliController(configRepository, this.outputFormatter);
462
448
  await cli.run();
463
449
  } else {
464
- this.program!.parse();
450
+ await this.program.parseAsync();
465
451
  }
466
452
  }
467
453
  }