trello-cli-unofficial 0.11.1 → 0.11.3

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,17 @@
1
+ ## [0.11.3](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.2...v0.11.3) (2025-11-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * switch to dynamic Commander import for better Windows compatibility ([e1ea7c5](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/e1ea7c588a10a635365a14099e7d6902a8f0eacb))
7
+
8
+ ## [0.11.2](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.1...v0.11.2) (2025-11-14)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * resolve Commander.js initialization issues ([c6588e7](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/c6588e75a5c9ca173921e1719849a7f8bce99abf))
14
+
1
15
  ## [0.11.1](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.0...v0.11.1) (2025-11-14)
2
16
 
3
17
 
package/dist/main.js CHANGED
@@ -28841,6 +28841,141 @@ 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
+
28844
28979
  // node_modules/commander/lib/error.js
28845
28980
  var require_error = __commonJS((exports) => {
28846
28981
  class CommanderError extends Error {
@@ -30935,6 +31070,20 @@ var require_commander = __commonJS((exports) => {
30935
31070
  });
30936
31071
 
30937
31072
  // 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
+ });
30938
31087
  var import__, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
30939
31088
  var init_esm17 = __esm(() => {
30940
31089
  import__ = __toESM(require_commander(), 1);
@@ -30953,275 +31102,6 @@ var init_esm17 = __esm(() => {
30953
31102
  } = import__.default);
30954
31103
  });
30955
31104
 
30956
- // src/shared/ErrorHandler.ts
30957
- class ErrorHandler {
30958
- static handle(error, context) {
30959
- if (error instanceof TrelloCliError) {
30960
- this.handleTrelloError(error, context);
30961
- } else if (error instanceof Error) {
30962
- this.handleGenericError(error, context);
30963
- } else {
30964
- this.handleUnknownError(error, context);
30965
- }
30966
- }
30967
- static handleTrelloError(error, context) {
30968
- const prefix = context ? `[${context}] ` : "";
30969
- switch (error.code) {
30970
- case "AUTH_ERROR":
30971
- console.error(t2("errors.authFailed", { message: error.message }));
30972
- console.error(t2("errors.trySetup"));
30973
- break;
30974
- case "API_ERROR":
30975
- console.error(t2("errors.apiError", { statusCode: error.statusCode, message: error.message }));
30976
- if (error instanceof ApiError && error.endpoint) {
30977
- console.error(t2("errors.endpoint", { endpoint: error.endpoint }));
30978
- }
30979
- break;
30980
- case "VALIDATION_ERROR":
30981
- console.error(t2("errors.validationError", { message: error.message }));
30982
- if (error instanceof ValidationError2 && error.field) {
30983
- console.error(t2("errors.field", { field: error.field }));
30984
- }
30985
- break;
30986
- case "NOT_FOUND_ERROR":
30987
- console.error(t2("errors.notFound", { message: error.message }));
30988
- if (error instanceof NotFoundError) {
30989
- if (error.resourceType) {
30990
- console.error(t2("errors.resourceType", { resourceType: error.resourceType }));
30991
- }
30992
- if (error.resourceId) {
30993
- console.error(t2("errors.resourceId", { resourceId: error.resourceId }));
30994
- }
30995
- }
30996
- break;
30997
- case "CONFIG_ERROR":
30998
- console.error(t2("errors.configError", { message: error.message }));
30999
- console.error(t2("errors.checkConfig"));
31000
- break;
31001
- case "NETWORK_ERROR":
31002
- console.error(t2("errors.networkError", { message: error.message }));
31003
- console.error(t2("errors.checkConnection"));
31004
- break;
31005
- default:
31006
- console.error(`\u274C ${prefix}${error.message}`);
31007
- }
31008
- process.exit(error.statusCode || 1);
31009
- }
31010
- static handleGenericError(error, _context) {
31011
- console.error(t2("errors.unexpectedError", { message: error.message }));
31012
- if (true) {
31013
- console.error(t2("errors.stackTrace"), error.stack);
31014
- }
31015
- process.exit(1);
31016
- }
31017
- static handleUnknownError(error, _context) {
31018
- console.error(t2("errors.unknownError"), error);
31019
- process.exit(1);
31020
- }
31021
- static async withErrorHandling(operation, context) {
31022
- try {
31023
- return await operation();
31024
- } catch (error) {
31025
- this.handle(error, context);
31026
- throw error;
31027
- }
31028
- }
31029
- static fromApiResponse(response, endpoint) {
31030
- const statusCode = response.status || response.statusCode || 500;
31031
- const message = response.message || response.error || t2("api.unknownApiError");
31032
- switch (statusCode) {
31033
- case 401:
31034
- return new AuthenticationError(t2("api.invalidToken"));
31035
- case 403:
31036
- return new AuthenticationError("Access denied");
31037
- case 404:
31038
- return new NotFoundError(t2("api.resourceNotFound"), "unknown");
31039
- case 400:
31040
- return new ValidationError2(message);
31041
- case 429:
31042
- return new ApiError(t2("api.rateLimitExceeded"), statusCode, endpoint);
31043
- case 500:
31044
- return new ApiError(t2("api.internalServerError"), statusCode, endpoint);
31045
- default:
31046
- return new ApiError(message, statusCode, endpoint);
31047
- }
31048
- }
31049
- }
31050
- var TrelloCliError, AuthenticationError, ApiError, ValidationError2, NotFoundError;
31051
- var init_ErrorHandler = __esm(() => {
31052
- init_i18n();
31053
- TrelloCliError = class TrelloCliError extends Error {
31054
- code;
31055
- statusCode;
31056
- constructor(message, code, statusCode) {
31057
- super(message);
31058
- this.code = code;
31059
- this.statusCode = statusCode;
31060
- this.name = this.constructor.name;
31061
- }
31062
- };
31063
- AuthenticationError = class AuthenticationError extends TrelloCliError {
31064
- constructor(message = "Authentication failed") {
31065
- super(message, "AUTH_ERROR", 401);
31066
- }
31067
- };
31068
- ApiError = class ApiError extends TrelloCliError {
31069
- statusCode;
31070
- endpoint;
31071
- constructor(message, statusCode, endpoint) {
31072
- super(message, "API_ERROR", statusCode);
31073
- this.statusCode = statusCode;
31074
- this.endpoint = endpoint;
31075
- }
31076
- };
31077
- ValidationError2 = class ValidationError2 extends TrelloCliError {
31078
- field;
31079
- constructor(message, field) {
31080
- super(message, "VALIDATION_ERROR", 400);
31081
- this.field = field;
31082
- }
31083
- };
31084
- NotFoundError = class NotFoundError extends TrelloCliError {
31085
- resourceType;
31086
- resourceId;
31087
- constructor(message, resourceType, resourceId) {
31088
- super(message, "NOT_FOUND_ERROR", 404);
31089
- this.resourceType = resourceType;
31090
- this.resourceId = resourceId;
31091
- }
31092
- };
31093
- });
31094
-
31095
- // src/shared/OutputFormatter.ts
31096
- class OutputFormatter {
31097
- format;
31098
- constructor(format = "table") {
31099
- this.format = format;
31100
- }
31101
- setFormat(format) {
31102
- this.format = format;
31103
- }
31104
- output(data, options) {
31105
- const format = options?.format || this.format;
31106
- switch (format) {
31107
- case "json":
31108
- this.outputJson(data);
31109
- break;
31110
- case "csv":
31111
- this.outputCsv(data, options);
31112
- break;
31113
- case "table":
31114
- default:
31115
- this.outputTable(data, options);
31116
- break;
31117
- }
31118
- }
31119
- outputJson(data) {
31120
- console.log(JSON.stringify(data, null, 2));
31121
- }
31122
- outputCsv(data, options) {
31123
- if (!Array.isArray(data) || data.length === 0) {
31124
- console.log(t2("common.noData"));
31125
- return;
31126
- }
31127
- const firstItem = data[0];
31128
- if (!firstItem) {
31129
- console.log(t2("common.noData"));
31130
- return;
31131
- }
31132
- const plainItem = this.toPlainObject(firstItem);
31133
- const fields = options?.fields || Object.keys(plainItem);
31134
- const headers = options?.headers || fields;
31135
- console.log(headers.join(","));
31136
- for (const item of data) {
31137
- const plainObject = this.toPlainObject(item);
31138
- const row = fields.map((field) => {
31139
- const value = plainObject[field];
31140
- const stringValue = String(value || "");
31141
- if (stringValue.includes(",") || stringValue.includes('"') || stringValue.includes(`
31142
- `)) {
31143
- return `"${stringValue.replace(/"/g, '""')}"`;
31144
- }
31145
- return stringValue;
31146
- });
31147
- console.log(row.join(","));
31148
- }
31149
- }
31150
- outputTable(data, options) {
31151
- if (!Array.isArray(data) || data.length === 0) {
31152
- console.log(t2("common.noData"));
31153
- return;
31154
- }
31155
- const firstItem = data[0];
31156
- if (!firstItem) {
31157
- console.log(t2("common.noData"));
31158
- return;
31159
- }
31160
- const plainItem = this.toPlainObject(firstItem);
31161
- const fields = options?.fields || Object.keys(plainItem);
31162
- const headers = options?.headers || fields;
31163
- const columnWidths = headers.map((header, index) => {
31164
- const field = fields[index];
31165
- const headerWidth = header.length;
31166
- const maxDataWidth = Math.max(...data.map((item) => {
31167
- const plainObject = this.toPlainObject(item);
31168
- return String(plainObject[field] || "").length;
31169
- }));
31170
- return Math.max(headerWidth, maxDataWidth);
31171
- });
31172
- const headerRow = headers.map((header, index) => header.padEnd(columnWidths[index])).join(" | ");
31173
- console.log(headerRow);
31174
- const separator = columnWidths.map((width) => "-".repeat(width)).join("-+-");
31175
- console.log(separator);
31176
- for (const item of data) {
31177
- const plainObject = this.toPlainObject(item);
31178
- const row = fields.map((field, index) => {
31179
- const value = String(plainObject[field] || "");
31180
- return value.padEnd(columnWidths[index]);
31181
- }).join(" | ");
31182
- console.log(row);
31183
- }
31184
- }
31185
- toPlainObject(obj) {
31186
- if (obj === null || obj === undefined) {
31187
- return {};
31188
- }
31189
- if (typeof obj === "object" && obj.constructor !== Object) {
31190
- const plain = {};
31191
- for (const key of Object.keys(obj)) {
31192
- plain[key] = obj[key];
31193
- }
31194
- return plain;
31195
- }
31196
- return obj;
31197
- }
31198
- message(message) {
31199
- console.log(message);
31200
- }
31201
- error(message) {
31202
- console.error(`\u274C ${message}`);
31203
- }
31204
- success(message) {
31205
- console.log(`\u2705 ${message}`);
31206
- }
31207
- warning(message) {
31208
- console.log(`\u26A0\uFE0F ${message}`);
31209
- }
31210
- info(message) {
31211
- console.log(`\u2139\uFE0F ${message}`);
31212
- }
31213
- }
31214
- var init_OutputFormatter = __esm(() => {
31215
- init_i18n();
31216
- });
31217
-
31218
- // src/shared/index.ts
31219
- var init_shared = __esm(() => {
31220
- init_ErrorHandler();
31221
- init_OutputFormatter();
31222
- init_types();
31223
- });
31224
-
31225
31105
  // src/presentation/cli/TrelloCliController.ts
31226
31106
  var exports_TrelloCliController = {};
31227
31107
  __export(exports_TrelloCliController, {
@@ -31283,7 +31163,8 @@ class CommandController {
31283
31163
  return;
31284
31164
  }
31285
31165
  try {
31286
- this.program = new Command;
31166
+ const { Command: Command2 } = await Promise.resolve().then(() => (init_esm17(), exports_esm));
31167
+ this.program = new Command2;
31287
31168
  } catch (error) {
31288
31169
  console.error(t2("menu.errors.commanderInitError"), error);
31289
31170
  throw new Error(t2("menu.errors.commanderInitFailed"));
@@ -31329,7 +31210,7 @@ class CommandController {
31329
31210
  }
31330
31211
  await this.boardController.showBoards();
31331
31212
  } catch (error) {
31332
- ErrorHandler.handle(error, "boards list");
31213
+ console.error(t2("commands.errors.genericError"), error.message);
31333
31214
  }
31334
31215
  });
31335
31216
  boardsCmd.command("show <boardId>").description(t2("commands.boards.show.description")).option("-f, --format <format>", t2("commands.formatOption"), "table").action(async (boardId, options) => {
@@ -31340,7 +31221,7 @@ class CommandController {
31340
31221
  }
31341
31222
  await this.boardController.showBoardDetails(boardId);
31342
31223
  } catch (error) {
31343
- ErrorHandler.handle(error, "boards show");
31224
+ console.error(t2("commands.errors.genericError"), error.message);
31344
31225
  }
31345
31226
  });
31346
31227
  boardsCmd.command("create <name>").description(t2("commands.boards.create.description")).option("-d, --desc <description>", t2("commands.boards.create.descOption")).action(async (name, options) => {
@@ -31369,7 +31250,7 @@ class CommandController {
31369
31250
  }
31370
31251
  await this.boardController.showListsById(boardId);
31371
31252
  } catch (error) {
31372
- ErrorHandler.handle(error, "lists list");
31253
+ console.error(t2("commands.errors.genericError"), error.message);
31373
31254
  }
31374
31255
  });
31375
31256
  listsCmd.command("create <boardId> <name>").description(t2("commands.lists.create.description")).action(async (boardId, name) => {
@@ -31414,7 +31295,7 @@ class CommandController {
31414
31295
  }
31415
31296
  await this.boardController.showCardsByListId(listId);
31416
31297
  } catch (error) {
31417
- ErrorHandler.handle(error, "cards list");
31298
+ console.error(t2("commands.errors.genericError"), error.message);
31418
31299
  }
31419
31300
  });
31420
31301
  cardsCmd.command("create <listId> <name>").description(t2("commands.cards.create.description")).option("-d, --desc <description>", t2("commands.options.cardDescription")).action(async (listId, name, options) => {
@@ -31501,7 +31382,6 @@ class CommandController {
31501
31382
  var init_CommandController = __esm(() => {
31502
31383
  init_services();
31503
31384
  init_repositories();
31504
- init_esm17();
31505
31385
  init_i18n();
31506
31386
  init_shared();
31507
31387
  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.1",
4
+ "version": "0.11.3",
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,16 +1,16 @@
1
+ import type { Command } from 'commander';
1
2
  import type { OutputFormat } from '@/shared';
2
3
  import { readFileSync } from 'node:fs';
3
- import { join } from 'node:path';
4
4
 
5
+ import { join } from 'node:path';
5
6
  import { AuthenticationService } from '@domain/services';
6
7
  import {
7
8
  FileConfigRepository,
8
9
  TrelloApiRepository,
9
10
  } from '@infrastructure/repositories';
10
- import { Command } from 'commander';
11
-
12
11
  import { t } from '@/i18n';
13
- import { ErrorHandler, OutputFormatter } from '@/shared';
12
+ import { OutputFormatter } from '@/shared';
13
+
14
14
  import { AuthController, BoardController, CardController } from './index';
15
15
 
16
16
  export class CommandController {
@@ -33,7 +33,8 @@ export class CommandController {
33
33
  }
34
34
 
35
35
  try {
36
- // Use static import - Commander is already imported at the top
36
+ // Try dynamic import first (more compatible with bundling)
37
+ const { Command } = await import('commander');
37
38
  this.program = new Command();
38
39
  } catch (error) {
39
40
  console.error(t('menu.errors.commanderInitError'), error);
@@ -130,7 +131,7 @@ export class CommandController {
130
131
  }
131
132
  await this.boardController.showBoards();
132
133
  } catch (error) {
133
- ErrorHandler.handle(error, 'boards list');
134
+ console.error(t('commands.errors.genericError'), (error as Error).message);
134
135
  }
135
136
  });
136
137
 
@@ -146,7 +147,7 @@ export class CommandController {
146
147
  }
147
148
  await this.boardController.showBoardDetails(boardId);
148
149
  } catch (error) {
149
- ErrorHandler.handle(error, 'boards show');
150
+ console.error(t('commands.errors.genericError'), (error as Error).message);
150
151
  }
151
152
  });
152
153
 
@@ -200,7 +201,7 @@ export class CommandController {
200
201
  }
201
202
  await this.boardController.showListsById(boardId);
202
203
  } catch (error) {
203
- ErrorHandler.handle(error, 'lists list');
204
+ console.error(t('commands.errors.genericError'), (error as Error).message);
204
205
  }
205
206
  });
206
207
 
@@ -286,7 +287,7 @@ export class CommandController {
286
287
  }
287
288
  await this.boardController.showCardsByListId(listId);
288
289
  } catch (error) {
289
- ErrorHandler.handle(error, 'cards list');
290
+ console.error(t('commands.errors.genericError'), (error as Error).message);
290
291
  }
291
292
  });
292
293
 
@@ -449,7 +450,6 @@ export class CommandController {
449
450
  }
450
451
 
451
452
  async run(): Promise<void> {
452
- // Ensure program is initialized before parsing
453
453
  await this.initializeProgram();
454
454
  await this.setupCommands();
455
455