trello-cli-unofficial 0.11.0 → 0.11.2

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.2](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.1...v0.11.2) (2025-11-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * resolve Commander.js initialization issues ([c6588e7](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/c6588e75a5c9ca173921e1719849a7f8bce99abf))
7
+
8
+ ## [0.11.1](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.0...v0.11.1) (2025-11-14)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * use static import for Commander to fix cross-platform compatibility ([9796c57](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/9796c57b2f24638a652b4bf989e798fccbc9ea76))
14
+
1
15
  # [0.11.0](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.10.8...v0.11.0) (2025-11-14)
2
16
 
3
17
 
package/dist/main.js CHANGED
@@ -28841,275 +28841,6 @@ var init_repositories = __esm(() => {
28841
28841
  init_TrelloApiRepository();
28842
28842
  });
28843
28843
 
28844
- // src/shared/ErrorHandler.ts
28845
- class ErrorHandler {
28846
- static handle(error, context) {
28847
- if (error instanceof TrelloCliError) {
28848
- this.handleTrelloError(error, context);
28849
- } else if (error instanceof Error) {
28850
- this.handleGenericError(error, context);
28851
- } else {
28852
- this.handleUnknownError(error, context);
28853
- }
28854
- }
28855
- static handleTrelloError(error, context) {
28856
- const prefix = context ? `[${context}] ` : "";
28857
- switch (error.code) {
28858
- case "AUTH_ERROR":
28859
- console.error(t2("errors.authFailed", { message: error.message }));
28860
- console.error(t2("errors.trySetup"));
28861
- break;
28862
- case "API_ERROR":
28863
- console.error(t2("errors.apiError", { statusCode: error.statusCode, message: error.message }));
28864
- if (error instanceof ApiError && error.endpoint) {
28865
- console.error(t2("errors.endpoint", { endpoint: error.endpoint }));
28866
- }
28867
- break;
28868
- case "VALIDATION_ERROR":
28869
- console.error(t2("errors.validationError", { message: error.message }));
28870
- if (error instanceof ValidationError2 && error.field) {
28871
- console.error(t2("errors.field", { field: error.field }));
28872
- }
28873
- break;
28874
- case "NOT_FOUND_ERROR":
28875
- console.error(t2("errors.notFound", { message: error.message }));
28876
- if (error instanceof NotFoundError) {
28877
- if (error.resourceType) {
28878
- console.error(t2("errors.resourceType", { resourceType: error.resourceType }));
28879
- }
28880
- if (error.resourceId) {
28881
- console.error(t2("errors.resourceId", { resourceId: error.resourceId }));
28882
- }
28883
- }
28884
- break;
28885
- case "CONFIG_ERROR":
28886
- console.error(t2("errors.configError", { message: error.message }));
28887
- console.error(t2("errors.checkConfig"));
28888
- break;
28889
- case "NETWORK_ERROR":
28890
- console.error(t2("errors.networkError", { message: error.message }));
28891
- console.error(t2("errors.checkConnection"));
28892
- break;
28893
- default:
28894
- console.error(`\u274C ${prefix}${error.message}`);
28895
- }
28896
- process.exit(error.statusCode || 1);
28897
- }
28898
- static handleGenericError(error, _context) {
28899
- console.error(t2("errors.unexpectedError", { message: error.message }));
28900
- if (true) {
28901
- console.error(t2("errors.stackTrace"), error.stack);
28902
- }
28903
- process.exit(1);
28904
- }
28905
- static handleUnknownError(error, _context) {
28906
- console.error(t2("errors.unknownError"), error);
28907
- process.exit(1);
28908
- }
28909
- static async withErrorHandling(operation, context) {
28910
- try {
28911
- return await operation();
28912
- } catch (error) {
28913
- this.handle(error, context);
28914
- throw error;
28915
- }
28916
- }
28917
- static fromApiResponse(response, endpoint) {
28918
- const statusCode = response.status || response.statusCode || 500;
28919
- const message = response.message || response.error || t2("api.unknownApiError");
28920
- switch (statusCode) {
28921
- case 401:
28922
- return new AuthenticationError(t2("api.invalidToken"));
28923
- case 403:
28924
- return new AuthenticationError("Access denied");
28925
- case 404:
28926
- return new NotFoundError(t2("api.resourceNotFound"), "unknown");
28927
- case 400:
28928
- return new ValidationError2(message);
28929
- case 429:
28930
- return new ApiError(t2("api.rateLimitExceeded"), statusCode, endpoint);
28931
- case 500:
28932
- return new ApiError(t2("api.internalServerError"), statusCode, endpoint);
28933
- default:
28934
- return new ApiError(message, statusCode, endpoint);
28935
- }
28936
- }
28937
- }
28938
- var TrelloCliError, AuthenticationError, ApiError, ValidationError2, NotFoundError;
28939
- var init_ErrorHandler = __esm(() => {
28940
- init_i18n();
28941
- TrelloCliError = class TrelloCliError extends Error {
28942
- code;
28943
- statusCode;
28944
- constructor(message, code, statusCode) {
28945
- super(message);
28946
- this.code = code;
28947
- this.statusCode = statusCode;
28948
- this.name = this.constructor.name;
28949
- }
28950
- };
28951
- AuthenticationError = class AuthenticationError extends TrelloCliError {
28952
- constructor(message = "Authentication failed") {
28953
- super(message, "AUTH_ERROR", 401);
28954
- }
28955
- };
28956
- ApiError = class ApiError extends TrelloCliError {
28957
- statusCode;
28958
- endpoint;
28959
- constructor(message, statusCode, endpoint) {
28960
- super(message, "API_ERROR", statusCode);
28961
- this.statusCode = statusCode;
28962
- this.endpoint = endpoint;
28963
- }
28964
- };
28965
- ValidationError2 = class ValidationError2 extends TrelloCliError {
28966
- field;
28967
- constructor(message, field) {
28968
- super(message, "VALIDATION_ERROR", 400);
28969
- this.field = field;
28970
- }
28971
- };
28972
- NotFoundError = class NotFoundError extends TrelloCliError {
28973
- resourceType;
28974
- resourceId;
28975
- constructor(message, resourceType, resourceId) {
28976
- super(message, "NOT_FOUND_ERROR", 404);
28977
- this.resourceType = resourceType;
28978
- this.resourceId = resourceId;
28979
- }
28980
- };
28981
- });
28982
-
28983
- // src/shared/OutputFormatter.ts
28984
- class OutputFormatter {
28985
- format;
28986
- constructor(format = "table") {
28987
- this.format = format;
28988
- }
28989
- setFormat(format) {
28990
- this.format = format;
28991
- }
28992
- output(data, options) {
28993
- const format = options?.format || this.format;
28994
- switch (format) {
28995
- case "json":
28996
- this.outputJson(data);
28997
- break;
28998
- case "csv":
28999
- this.outputCsv(data, options);
29000
- break;
29001
- case "table":
29002
- default:
29003
- this.outputTable(data, options);
29004
- break;
29005
- }
29006
- }
29007
- outputJson(data) {
29008
- console.log(JSON.stringify(data, null, 2));
29009
- }
29010
- outputCsv(data, options) {
29011
- if (!Array.isArray(data) || data.length === 0) {
29012
- console.log(t2("common.noData"));
29013
- return;
29014
- }
29015
- const firstItem = data[0];
29016
- if (!firstItem) {
29017
- console.log(t2("common.noData"));
29018
- return;
29019
- }
29020
- const plainItem = this.toPlainObject(firstItem);
29021
- const fields = options?.fields || Object.keys(plainItem);
29022
- const headers = options?.headers || fields;
29023
- console.log(headers.join(","));
29024
- for (const item of data) {
29025
- const plainObject = this.toPlainObject(item);
29026
- const row = fields.map((field) => {
29027
- const value = plainObject[field];
29028
- const stringValue = String(value || "");
29029
- if (stringValue.includes(",") || stringValue.includes('"') || stringValue.includes(`
29030
- `)) {
29031
- return `"${stringValue.replace(/"/g, '""')}"`;
29032
- }
29033
- return stringValue;
29034
- });
29035
- console.log(row.join(","));
29036
- }
29037
- }
29038
- outputTable(data, options) {
29039
- if (!Array.isArray(data) || data.length === 0) {
29040
- console.log(t2("common.noData"));
29041
- return;
29042
- }
29043
- const firstItem = data[0];
29044
- if (!firstItem) {
29045
- console.log(t2("common.noData"));
29046
- return;
29047
- }
29048
- const plainItem = this.toPlainObject(firstItem);
29049
- const fields = options?.fields || Object.keys(plainItem);
29050
- const headers = options?.headers || fields;
29051
- const columnWidths = headers.map((header, index) => {
29052
- const field = fields[index];
29053
- const headerWidth = header.length;
29054
- const maxDataWidth = Math.max(...data.map((item) => {
29055
- const plainObject = this.toPlainObject(item);
29056
- return String(plainObject[field] || "").length;
29057
- }));
29058
- return Math.max(headerWidth, maxDataWidth);
29059
- });
29060
- const headerRow = headers.map((header, index) => header.padEnd(columnWidths[index])).join(" | ");
29061
- console.log(headerRow);
29062
- const separator = columnWidths.map((width) => "-".repeat(width)).join("-+-");
29063
- console.log(separator);
29064
- for (const item of data) {
29065
- const plainObject = this.toPlainObject(item);
29066
- const row = fields.map((field, index) => {
29067
- const value = String(plainObject[field] || "");
29068
- return value.padEnd(columnWidths[index]);
29069
- }).join(" | ");
29070
- console.log(row);
29071
- }
29072
- }
29073
- toPlainObject(obj) {
29074
- if (obj === null || obj === undefined) {
29075
- return {};
29076
- }
29077
- if (typeof obj === "object" && obj.constructor !== Object) {
29078
- const plain = {};
29079
- for (const key of Object.keys(obj)) {
29080
- plain[key] = obj[key];
29081
- }
29082
- return plain;
29083
- }
29084
- return obj;
29085
- }
29086
- message(message) {
29087
- console.log(message);
29088
- }
29089
- error(message) {
29090
- console.error(`\u274C ${message}`);
29091
- }
29092
- success(message) {
29093
- console.log(`\u2705 ${message}`);
29094
- }
29095
- warning(message) {
29096
- console.log(`\u26A0\uFE0F ${message}`);
29097
- }
29098
- info(message) {
29099
- console.log(`\u2139\uFE0F ${message}`);
29100
- }
29101
- }
29102
- var init_OutputFormatter = __esm(() => {
29103
- init_i18n();
29104
- });
29105
-
29106
- // src/shared/index.ts
29107
- var init_shared = __esm(() => {
29108
- init_ErrorHandler();
29109
- init_OutputFormatter();
29110
- init_types();
29111
- });
29112
-
29113
28844
  // node_modules/commander/lib/error.js
29114
28845
  var require_error = __commonJS((exports) => {
29115
28846
  class CommanderError extends Error {
@@ -31204,20 +30935,6 @@ var require_commander = __commonJS((exports) => {
31204
30935
  });
31205
30936
 
31206
30937
  // node_modules/commander/esm.mjs
31207
- var exports_esm = {};
31208
- __export(exports_esm, {
31209
- program: () => program,
31210
- createOption: () => createOption,
31211
- createCommand: () => createCommand,
31212
- createArgument: () => createArgument,
31213
- Option: () => Option,
31214
- InvalidOptionArgumentError: () => InvalidOptionArgumentError,
31215
- InvalidArgumentError: () => InvalidArgumentError,
31216
- Help: () => Help,
31217
- CommanderError: () => CommanderError,
31218
- Command: () => Command,
31219
- Argument: () => Argument
31220
- });
31221
30938
  var import__, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
31222
30939
  var init_esm17 = __esm(() => {
31223
30940
  import__ = __toESM(require_commander(), 1);
@@ -31236,6 +30953,141 @@ var init_esm17 = __esm(() => {
31236
30953
  } = import__.default);
31237
30954
  });
31238
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
+
31239
31091
  // src/presentation/cli/TrelloCliController.ts
31240
31092
  var exports_TrelloCliController = {};
31241
31093
  __export(exports_TrelloCliController, {
@@ -31297,8 +31149,7 @@ class CommandController {
31297
31149
  return;
31298
31150
  }
31299
31151
  try {
31300
- const { Command: Command2 } = await Promise.resolve().then(() => (init_esm17(), exports_esm));
31301
- this.program = new Command2;
31152
+ this.program = new Command;
31302
31153
  } catch (error) {
31303
31154
  console.error(t2("menu.errors.commanderInitError"), error);
31304
31155
  throw new Error(t2("menu.errors.commanderInitFailed"));
@@ -31344,7 +31195,7 @@ class CommandController {
31344
31195
  }
31345
31196
  await this.boardController.showBoards();
31346
31197
  } catch (error) {
31347
- ErrorHandler.handle(error, "boards list");
31198
+ console.error(t2("commands.errors.genericError"), error.message);
31348
31199
  }
31349
31200
  });
31350
31201
  boardsCmd.command("show <boardId>").description(t2("commands.boards.show.description")).option("-f, --format <format>", t2("commands.formatOption"), "table").action(async (boardId, options) => {
@@ -31355,7 +31206,7 @@ class CommandController {
31355
31206
  }
31356
31207
  await this.boardController.showBoardDetails(boardId);
31357
31208
  } catch (error) {
31358
- ErrorHandler.handle(error, "boards show");
31209
+ console.error(t2("commands.errors.genericError"), error.message);
31359
31210
  }
31360
31211
  });
31361
31212
  boardsCmd.command("create <name>").description(t2("commands.boards.create.description")).option("-d, --desc <description>", t2("commands.boards.create.descOption")).action(async (name, options) => {
@@ -31384,7 +31235,7 @@ class CommandController {
31384
31235
  }
31385
31236
  await this.boardController.showListsById(boardId);
31386
31237
  } catch (error) {
31387
- ErrorHandler.handle(error, "lists list");
31238
+ console.error(t2("commands.errors.genericError"), error.message);
31388
31239
  }
31389
31240
  });
31390
31241
  listsCmd.command("create <boardId> <name>").description(t2("commands.lists.create.description")).action(async (boardId, name) => {
@@ -31429,7 +31280,7 @@ class CommandController {
31429
31280
  }
31430
31281
  await this.boardController.showCardsByListId(listId);
31431
31282
  } catch (error) {
31432
- ErrorHandler.handle(error, "cards list");
31283
+ console.error(t2("commands.errors.genericError"), error.message);
31433
31284
  }
31434
31285
  });
31435
31286
  cardsCmd.command("create <listId> <name>").description(t2("commands.cards.create.description")).option("-d, --desc <description>", t2("commands.options.cardDescription")).action(async (listId, name, options) => {
@@ -31516,6 +31367,7 @@ class CommandController {
31516
31367
  var init_CommandController = __esm(() => {
31517
31368
  init_services();
31518
31369
  init_repositories();
31370
+ init_esm17();
31519
31371
  init_i18n();
31520
31372
  init_shared();
31521
31373
  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.0",
4
+ "version": "0.11.2",
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,6 +1,6 @@
1
- import type { Command } from 'commander';
2
1
  import type { OutputFormat } from '@/shared';
3
2
  import { readFileSync } from 'node:fs';
3
+
4
4
  import { join } from 'node:path';
5
5
 
6
6
  import { AuthenticationService } from '@domain/services';
@@ -8,9 +8,10 @@ import {
8
8
  FileConfigRepository,
9
9
  TrelloApiRepository,
10
10
  } from '@infrastructure/repositories';
11
+ import { Command } from 'commander';
11
12
 
12
13
  import { t } from '@/i18n';
13
- import { ErrorHandler, OutputFormatter } from '@/shared';
14
+ import { OutputFormatter } from '@/shared';
14
15
  import { AuthController, BoardController, CardController } from './index';
15
16
 
16
17
  export class CommandController {
@@ -33,7 +34,7 @@ export class CommandController {
33
34
  }
34
35
 
35
36
  try {
36
- const { Command } = await import('commander');
37
+ // Use static import - Commander is already imported at the top
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