trello-cli-unofficial 0.11.3 → 0.11.5

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,18 @@
1
+ ## [0.11.5](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.4...v0.11.5) (2025-11-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Make version reading robust for Windows compatibility ([5af0780](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/5af07803c4bd074fa28a4a77de24790aa1bda666))
7
+
8
+ ## [0.11.4](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.3...v0.11.4) (2025-11-14)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Initialize Commander.js in constructor to fix Windows compatibility ([7762da8](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/7762da85b532e90e68be3717609639f838c88b45))
14
+ * revert to synchronous Commander import for Windows compatibility ([badcea4](https://github.com/JaegerCaiser/trello-cli-unofficial/commit/badcea41b971e8e5dbb1ba8993f9661cb01d7358))
15
+
1
16
  ## [0.11.3](https://github.com/JaegerCaiser/trello-cli-unofficial/compare/v0.11.2...v0.11.3) (2025-11-14)
2
17
 
3
18
 
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, {
@@ -31144,31 +31130,40 @@ var init_TrelloCliController = __esm(() => {
31144
31130
  });
31145
31131
 
31146
31132
  // src/presentation/cli/CommandController.ts
31147
- import { readFileSync as readFileSync2 } from "fs";
31148
- import { join } from "path";
31133
+ import { existsSync, readFileSync as readFileSync2 } from "fs";
31134
+ import { dirname, join } from "path";
31135
+ import { fileURLToPath as fileURLToPath2 } from "url";
31149
31136
 
31150
31137
  class CommandController {
31151
31138
  authController;
31152
31139
  boardController;
31153
31140
  cardController;
31154
- program = null;
31141
+ program;
31155
31142
  outputFormatter;
31156
31143
  constructor() {
31157
31144
  const configRepository = new FileConfigRepository;
31158
31145
  this.authController = new AuthController(configRepository);
31159
31146
  this.outputFormatter = new OutputFormatter;
31147
+ this.program = new Command;
31160
31148
  }
31161
- async initializeProgram() {
31162
- if (this.program) {
31163
- return;
31149
+ getVersion() {
31150
+ const cwdPackageJson = join(process.cwd(), "package.json");
31151
+ if (existsSync(cwdPackageJson)) {
31152
+ try {
31153
+ const packageJson = JSON.parse(readFileSync2(cwdPackageJson, "utf-8"));
31154
+ return packageJson.version;
31155
+ } catch {}
31164
31156
  }
31165
31157
  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
- }
31158
+ const currentFilePath = fileURLToPath2(import.meta.url);
31159
+ const currentDir = dirname(currentFilePath);
31160
+ const installedPackageJson = join(currentDir, "..", "..", "package.json");
31161
+ if (existsSync(installedPackageJson)) {
31162
+ const packageJson = JSON.parse(readFileSync2(installedPackageJson, "utf-8"));
31163
+ return packageJson.version;
31164
+ }
31165
+ } catch {}
31166
+ return "0.11.3";
31172
31167
  }
31173
31168
  async initializeTrelloControllers() {
31174
31169
  await this.authController.ensureAuthenticated();
@@ -31182,9 +31177,7 @@ class CommandController {
31182
31177
  if (!this.program) {
31183
31178
  throw new Error(t2("errors.programNotInitialized"));
31184
31179
  }
31185
- const packageJsonPath = join(process.cwd(), "package.json");
31186
- const packageJson = JSON.parse(readFileSync2(packageJsonPath, "utf-8"));
31187
- const version = packageJson.version;
31180
+ const version = this.getVersion();
31188
31181
  this.program.name("trello-cli-unofficial").description(t2("commands.description")).version(version).option("-f, --format <format>", t2("commands.formatOption"), "table").option("-v", t2("commands.versionOption")).option("--verbose", t2("commands.verboseOption")).on("option:format", (format) => {
31189
31182
  this.outputFormatter.setFormat(format);
31190
31183
  }).on("option:v", () => {
@@ -31368,20 +31361,20 @@ class CommandController {
31368
31361
  });
31369
31362
  }
31370
31363
  async run() {
31371
- await this.initializeProgram();
31372
31364
  await this.setupCommands();
31373
31365
  if (process.argv.length === 2) {
31374
31366
  const configRepository = new FileConfigRepository;
31375
31367
  const cli = new (await Promise.resolve().then(() => (init_TrelloCliController(), exports_TrelloCliController))).TrelloCliController(configRepository, this.outputFormatter);
31376
31368
  await cli.run();
31377
31369
  } else {
31378
- this.program.parse();
31370
+ await this.program.parseAsync();
31379
31371
  }
31380
31372
  }
31381
31373
  }
31382
31374
  var init_CommandController = __esm(() => {
31383
31375
  init_services();
31384
31376
  init_repositories();
31377
+ init_esm17();
31385
31378
  init_i18n();
31386
31379
  init_shared();
31387
31380
  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.5",
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,15 @@
1
- import type { Command } from 'commander';
2
1
  import type { OutputFormat } from '@/shared';
3
- import { readFileSync } from 'node:fs';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
4
5
 
5
- import { join } from 'node:path';
6
6
  import { AuthenticationService } from '@domain/services';
7
7
  import {
8
8
  FileConfigRepository,
9
9
  TrelloApiRepository,
10
10
  } from '@infrastructure/repositories';
11
+
12
+ import { Command } from 'commander';
11
13
  import { t } from '@/i18n';
12
14
  import { OutputFormatter } from '@/shared';
13
15
 
@@ -17,29 +19,47 @@ export class CommandController {
17
19
  private authController: AuthController;
18
20
  private boardController!: BoardController;
19
21
  private cardController!: CardController;
20
- private program: Command | null = null;
22
+ private program: Command;
21
23
  private outputFormatter: OutputFormatter;
22
24
 
23
25
  constructor() {
24
26
  const configRepository = new FileConfigRepository();
25
27
  this.authController = new AuthController(configRepository);
26
28
  this.outputFormatter = new OutputFormatter();
27
- // Commander will be initialized lazily in run()
29
+ // Initialize Commander immediately in constructor
30
+ this.program = new Command();
28
31
  }
29
32
 
30
- private async initializeProgram(): Promise<void> {
31
- if (this.program) {
32
- return;
33
+ private getVersion(): string {
34
+ // Try multiple approaches to find package.json (robust for different environments)
35
+
36
+ // 1. Try relative to current working directory (development)
37
+ const cwdPackageJson = join(process.cwd(), 'package.json');
38
+ if (existsSync(cwdPackageJson)) {
39
+ try {
40
+ const packageJson = JSON.parse(readFileSync(cwdPackageJson, 'utf-8'));
41
+ return packageJson.version;
42
+ } catch {
43
+ // Continue to next approach
44
+ }
33
45
  }
34
46
 
47
+ // 2. Try relative to this file's directory (when installed globally)
35
48
  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'));
49
+ const currentFilePath = fileURLToPath(import.meta.url);
50
+ const currentDir = dirname(currentFilePath);
51
+ const installedPackageJson = join(currentDir, '..', '..', 'package.json');
52
+
53
+ if (existsSync(installedPackageJson)) {
54
+ const packageJson = JSON.parse(readFileSync(installedPackageJson, 'utf-8'));
55
+ return packageJson.version;
56
+ }
57
+ } catch {
58
+ // Continue to fallback
42
59
  }
60
+
61
+ // 3. Fallback to hardcoded version from package.json
62
+ return '0.11.3';
43
63
  }
44
64
 
45
65
  private async initializeTrelloControllers(): Promise<void> {
@@ -69,10 +89,8 @@ export class CommandController {
69
89
  throw new Error(t('errors.programNotInitialized'));
70
90
  }
71
91
 
72
- // Get version from package.json
73
- const packageJsonPath = join(process.cwd(), 'package.json');
74
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
75
- const version = packageJson.version;
92
+ // Get version using robust method
93
+ const version = this.getVersion();
76
94
 
77
95
  this.program
78
96
  .name('trello-cli-unofficial')
@@ -450,7 +468,6 @@ export class CommandController {
450
468
  }
451
469
 
452
470
  async run(): Promise<void> {
453
- await this.initializeProgram();
454
471
  await this.setupCommands();
455
472
 
456
473
  // Fallback to interactive mode if no command specified
@@ -461,7 +478,7 @@ export class CommandController {
461
478
  ).TrelloCliController(configRepository, this.outputFormatter);
462
479
  await cli.run();
463
480
  } else {
464
- this.program!.parse();
481
+ await this.program.parseAsync();
465
482
  }
466
483
  }
467
484
  }